diff options
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 7a9beeb1c458..d8d397acb52c 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -567,7 +567,8 @@ struct sk_buff { | |||
567 | * headers if needed | 567 | * headers if needed |
568 | */ | 568 | */ |
569 | __u8 encapsulation:1; | 569 | __u8 encapsulation:1; |
570 | /* 6/8 bit hole (depending on ndisc_nodetype presence) */ | 570 | __u8 encap_hdr_csum:1; |
571 | /* 5/7 bit hole (depending on ndisc_nodetype presence) */ | ||
571 | kmemcheck_bitfield_end(flags2); | 572 | kmemcheck_bitfield_end(flags2); |
572 | 573 | ||
573 | #if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL | 574 | #if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL |
@@ -2988,6 +2989,7 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb) | |||
2988 | struct skb_gso_cb { | 2989 | struct skb_gso_cb { |
2989 | int mac_offset; | 2990 | int mac_offset; |
2990 | int encap_level; | 2991 | int encap_level; |
2992 | __u16 csum_start; | ||
2991 | }; | 2993 | }; |
2992 | #define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb) | 2994 | #define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb) |
2993 | 2995 | ||
@@ -3012,6 +3014,28 @@ static inline int gso_pskb_expand_head(struct sk_buff *skb, int extra) | |||
3012 | return 0; | 3014 | return 0; |
3013 | } | 3015 | } |
3014 | 3016 | ||
3017 | /* Compute the checksum for a gso segment. First compute the checksum value | ||
3018 | * from the start of transport header to SKB_GSO_CB(skb)->csum_start, and | ||
3019 | * then add in skb->csum (checksum from csum_start to end of packet). | ||
3020 | * skb->csum and csum_start are then updated to reflect the checksum of the | ||
3021 | * resultant packet starting from the transport header-- the resultant checksum | ||
3022 | * is in the res argument (i.e. normally zero or ~ of checksum of a pseudo | ||
3023 | * header. | ||
3024 | */ | ||
3025 | static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res) | ||
3026 | { | ||
3027 | int plen = SKB_GSO_CB(skb)->csum_start - skb_headroom(skb) - | ||
3028 | skb_transport_offset(skb); | ||
3029 | __u16 csum; | ||
3030 | |||
3031 | csum = csum_fold(csum_partial(skb_transport_header(skb), | ||
3032 | plen, skb->csum)); | ||
3033 | skb->csum = res; | ||
3034 | SKB_GSO_CB(skb)->csum_start -= plen; | ||
3035 | |||
3036 | return csum; | ||
3037 | } | ||
3038 | |||
3015 | static inline bool skb_is_gso(const struct sk_buff *skb) | 3039 | static inline bool skb_is_gso(const struct sk_buff *skb) |
3016 | { | 3040 | { |
3017 | return skb_shinfo(skb)->gso_size; | 3041 | return skb_shinfo(skb)->gso_size; |