diff options
author | David S. Miller <davem@davemloft.net> | 2013-12-02 17:26:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-02 17:26:05 -0500 |
commit | 7ce5a27f2ef8ed4f8f892f46391f933c0e2ac0f1 (patch) | |
tree | 0841c7f73548bfecd44049497a0833765431793c /include | |
parent | 28e24c62ab3062e965ef1b3bcc244d50aee7fa85 (diff) |
Revert "net: Handle CHECKSUM_COMPLETE more adequately in pskb_trim_rcsum()."
This reverts commit 018c5bba052b3a383d83cf0c756da0e7bc748397.
It causes regressions for people using chips driven by the sungem
driver. Suspicion is that the skb->csum value isn't being adjusted
properly.
The change also has a bug in that if __pskb_trim() fails, we'll leave
a corruped skb->csum value in there. We would really need to revert
it to it's original value in that case.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/skbuff.h | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bec1cc7d5e3c..215b5ea1cb30 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -2263,6 +2263,24 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb, | |||
2263 | 2263 | ||
2264 | unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); | 2264 | unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); |
2265 | 2265 | ||
2266 | /** | ||
2267 | * pskb_trim_rcsum - trim received skb and update checksum | ||
2268 | * @skb: buffer to trim | ||
2269 | * @len: new length | ||
2270 | * | ||
2271 | * This is exactly the same as pskb_trim except that it ensures the | ||
2272 | * checksum of received packets are still valid after the operation. | ||
2273 | */ | ||
2274 | |||
2275 | static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | ||
2276 | { | ||
2277 | if (likely(len >= skb->len)) | ||
2278 | return 0; | ||
2279 | if (skb->ip_summed == CHECKSUM_COMPLETE) | ||
2280 | skb->ip_summed = CHECKSUM_NONE; | ||
2281 | return __pskb_trim(skb, len); | ||
2282 | } | ||
2283 | |||
2266 | #define skb_queue_walk(queue, skb) \ | 2284 | #define skb_queue_walk(queue, skb) \ |
2267 | for (skb = (queue)->next; \ | 2285 | for (skb = (queue)->next; \ |
2268 | skb != (struct sk_buff *)(queue); \ | 2286 | skb != (struct sk_buff *)(queue); \ |
@@ -2360,27 +2378,6 @@ __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len, | |||
2360 | __wsum skb_checksum(const struct sk_buff *skb, int offset, int len, | 2378 | __wsum skb_checksum(const struct sk_buff *skb, int offset, int len, |
2361 | __wsum csum); | 2379 | __wsum csum); |
2362 | 2380 | ||
2363 | /** | ||
2364 | * pskb_trim_rcsum - trim received skb and update checksum | ||
2365 | * @skb: buffer to trim | ||
2366 | * @len: new length | ||
2367 | * | ||
2368 | * This is exactly the same as pskb_trim except that it ensures the | ||
2369 | * checksum of received packets are still valid after the operation. | ||
2370 | */ | ||
2371 | |||
2372 | static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | ||
2373 | { | ||
2374 | if (likely(len >= skb->len)) | ||
2375 | return 0; | ||
2376 | if (skb->ip_summed == CHECKSUM_COMPLETE) { | ||
2377 | __wsum adj = skb_checksum(skb, len, skb->len - len, 0); | ||
2378 | |||
2379 | skb->csum = csum_sub(skb->csum, adj); | ||
2380 | } | ||
2381 | return __pskb_trim(skb, len); | ||
2382 | } | ||
2383 | |||
2384 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | 2381 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, |
2385 | int len, void *buffer) | 2382 | int len, void *buffer) |
2386 | { | 2383 | { |