diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2006-03-21 01:43:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:43:56 -0500 |
commit | cbb042f9e1292434e3cacb90e67d8d381aeac5a9 (patch) | |
tree | cc42f42232e56b68111cfebdc175197d8607bdd7 /include/linux/skbuff.h | |
parent | ecba320f2e95c9a0c35011d1ecb1db4419980536 (diff) |
[NET]: Replace skb_pull/skb_postpull_rcsum with skb_pull_rcsum
We're now starting to have quite a number of places that do skb_pull
followed immediately by an skb_postpull_rcsum. We can merge these two
operations into one function with skb_pull_rcsum. This makes sense
since most pull operations on receive skb's need to update the
checksum.
I've decided to make this out-of-line since it is fairly big and the
fast path where hardware checksums are enabled need to call
csum_partial anyway.
Since this is a brand new function we get to add an extra check on the
len argument. As it is most callers of skb_pull ignore its return
value which essentially means that there is no check on the len
argument.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 75c963103b9f..613b9513f8b9 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1159,12 +1159,14 @@ static inline int skb_linearize(struct sk_buff *skb, gfp_t gfp) | |||
1159 | */ | 1159 | */ |
1160 | 1160 | ||
1161 | static inline void skb_postpull_rcsum(struct sk_buff *skb, | 1161 | static inline void skb_postpull_rcsum(struct sk_buff *skb, |
1162 | const void *start, int len) | 1162 | const void *start, unsigned int len) |
1163 | { | 1163 | { |
1164 | if (skb->ip_summed == CHECKSUM_HW) | 1164 | if (skb->ip_summed == CHECKSUM_HW) |
1165 | skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); | 1165 | skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); |
1166 | } | 1166 | } |
1167 | 1167 | ||
1168 | unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); | ||
1169 | |||
1168 | /** | 1170 | /** |
1169 | * pskb_trim_rcsum - trim received skb and update checksum | 1171 | * pskb_trim_rcsum - trim received skb and update checksum |
1170 | * @skb: buffer to trim | 1172 | * @skb: buffer to trim |