Skip to content

Commit

Permalink
Revert "net: Handle CHECKSUM_COMPLETE more adequately in pskb_trim_rc…
Browse files Browse the repository at this point in the history
…sum()."

This reverts commit 018c5bb.

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>
  • Loading branch information
David S. Miller committed Dec 2, 2013
1 parent 28e24c6 commit 7ce5a27
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -2263,6 +2263,24 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb,

unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);

/**
* pskb_trim_rcsum - trim received skb and update checksum
* @skb: buffer to trim
* @len: new length
*
* This is exactly the same as pskb_trim except that it ensures the
* checksum of received packets are still valid after the operation.
*/

static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
{
if (likely(len >= skb->len))
return 0;
if (skb->ip_summed == CHECKSUM_COMPLETE)
skb->ip_summed = CHECKSUM_NONE;
return __pskb_trim(skb, len);
}

#define skb_queue_walk(queue, skb) \
for (skb = (queue)->next; \
skb != (struct sk_buff *)(queue); \
Expand Down Expand Up @@ -2360,27 +2378,6 @@ __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
__wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
__wsum csum);

/**
* pskb_trim_rcsum - trim received skb and update checksum
* @skb: buffer to trim
* @len: new length
*
* This is exactly the same as pskb_trim except that it ensures the
* checksum of received packets are still valid after the operation.
*/

static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
{
if (likely(len >= skb->len))
return 0;
if (skb->ip_summed == CHECKSUM_COMPLETE) {
__wsum adj = skb_checksum(skb, len, skb->len - len, 0);

skb->csum = csum_sub(skb->csum, adj);
}
return __pskb_trim(skb, len);
}

static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
int len, void *buffer)
{
Expand Down

0 comments on commit 7ce5a27

Please sign in to comment.