diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/skbuff.h | 16 | ||||
-rw-r--r-- | include/net/tcp.h | 2 | ||||
-rw-r--r-- | include/net/udp.h | 2 |
3 files changed, 13 insertions, 7 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 910560e85561..c413afbe0b9c 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -32,10 +32,11 @@ | |||
32 | #define HAVE_ALLOC_SKB /* For the drivers to know */ | 32 | #define HAVE_ALLOC_SKB /* For the drivers to know */ |
33 | #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ | 33 | #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ |
34 | 34 | ||
35 | /* Don't change this without changing skb_csum_unnecessary! */ | ||
35 | #define CHECKSUM_NONE 0 | 36 | #define CHECKSUM_NONE 0 |
36 | #define CHECKSUM_PARTIAL 1 | 37 | #define CHECKSUM_UNNECESSARY 1 |
37 | #define CHECKSUM_UNNECESSARY 2 | 38 | #define CHECKSUM_COMPLETE 2 |
38 | #define CHECKSUM_COMPLETE 3 | 39 | #define CHECKSUM_PARTIAL 3 |
39 | 40 | ||
40 | #define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ | 41 | #define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ |
41 | ~(SMP_CACHE_BYTES - 1)) | 42 | ~(SMP_CACHE_BYTES - 1)) |
@@ -1572,6 +1573,11 @@ static inline void __net_timestamp(struct sk_buff *skb) | |||
1572 | extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); | 1573 | extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); |
1573 | extern __sum16 __skb_checksum_complete(struct sk_buff *skb); | 1574 | extern __sum16 __skb_checksum_complete(struct sk_buff *skb); |
1574 | 1575 | ||
1576 | static inline int skb_csum_unnecessary(const struct sk_buff *skb) | ||
1577 | { | ||
1578 | return skb->ip_summed & CHECKSUM_UNNECESSARY; | ||
1579 | } | ||
1580 | |||
1575 | /** | 1581 | /** |
1576 | * skb_checksum_complete - Calculate checksum of an entire packet | 1582 | * skb_checksum_complete - Calculate checksum of an entire packet |
1577 | * @skb: packet to process | 1583 | * @skb: packet to process |
@@ -1590,8 +1596,8 @@ extern __sum16 __skb_checksum_complete(struct sk_buff *skb); | |||
1590 | */ | 1596 | */ |
1591 | static inline unsigned int skb_checksum_complete(struct sk_buff *skb) | 1597 | static inline unsigned int skb_checksum_complete(struct sk_buff *skb) |
1592 | { | 1598 | { |
1593 | return skb->ip_summed != CHECKSUM_UNNECESSARY && | 1599 | return skb_csum_unnecessary(skb) ? |
1594 | __skb_checksum_complete(skb); | 1600 | 0 : __skb_checksum_complete(skb); |
1595 | } | 1601 | } |
1596 | 1602 | ||
1597 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 1603 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
diff --git a/include/net/tcp.h b/include/net/tcp.h index af9273204cfd..07f724e02f84 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -818,7 +818,7 @@ static inline __sum16 __tcp_checksum_complete(struct sk_buff *skb) | |||
818 | 818 | ||
819 | static inline int tcp_checksum_complete(struct sk_buff *skb) | 819 | static inline int tcp_checksum_complete(struct sk_buff *skb) |
820 | { | 820 | { |
821 | return skb->ip_summed != CHECKSUM_UNNECESSARY && | 821 | return !skb_csum_unnecessary(skb) && |
822 | __tcp_checksum_complete(skb); | 822 | __tcp_checksum_complete(skb); |
823 | } | 823 | } |
824 | 824 | ||
diff --git a/include/net/udp.h b/include/net/udp.h index 4906ed7113e7..98755ebaf163 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -77,7 +77,7 @@ static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) | |||
77 | 77 | ||
78 | static inline int udp_lib_checksum_complete(struct sk_buff *skb) | 78 | static inline int udp_lib_checksum_complete(struct sk_buff *skb) |
79 | { | 79 | { |
80 | return skb->ip_summed != CHECKSUM_UNNECESSARY && | 80 | return !skb_csum_unnecessary(skb) && |
81 | __udp_lib_checksum_complete(skb); | 81 | __udp_lib_checksum_complete(skb); |
82 | } | 82 | } |
83 | 83 | ||