diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-03-25 23:10:56 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:23:51 -0400 |
commit | 759e5d006462d53fb708daa8284b4ad909415da1 (patch) | |
tree | edcc4e9d975199b3fe5e2aadc3d1e06824755e75 /net/core | |
parent | 1ab6eb62b02e0949a392fb19bf31ba59ae1022b1 (diff) |
[UDP]: Clean up UDP-Lite receive checksum
This patch eliminates some duplicate code for the verification of
receive checksums between UDP-Lite and UDP. It does this by
introducing __skb_checksum_complete_head which is identical to
__skb_checksum_complete_head apart from the fact that it takes
a length parameter rather than computing the first skb->len bytes.
As a result UDP-Lite will be able to use hardware checksum offload
for packets which do not use partial coverage checksums. It also
means that UDP-Lite loopback no longer does unnecessary checksum
verification.
If any NICs start support UDP-Lite this would also start working
automatically.
This patch removes the assumption that msg_flags has MSG_TRUNC clear
upon entry in recvmsg.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/datagram.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c index 186212b5b7da..cb056f476126 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -411,11 +411,11 @@ fault: | |||
411 | return -EFAULT; | 411 | return -EFAULT; |
412 | } | 412 | } |
413 | 413 | ||
414 | __sum16 __skb_checksum_complete(struct sk_buff *skb) | 414 | __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len) |
415 | { | 415 | { |
416 | __sum16 sum; | 416 | __sum16 sum; |
417 | 417 | ||
418 | sum = csum_fold(skb_checksum(skb, 0, skb->len, skb->csum)); | 418 | sum = csum_fold(skb_checksum(skb, 0, len, skb->csum)); |
419 | if (likely(!sum)) { | 419 | if (likely(!sum)) { |
420 | if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) | 420 | if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) |
421 | netdev_rx_csum_fault(skb->dev); | 421 | netdev_rx_csum_fault(skb->dev); |
@@ -423,6 +423,12 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb) | |||
423 | } | 423 | } |
424 | return sum; | 424 | return sum; |
425 | } | 425 | } |
426 | EXPORT_SYMBOL(__skb_checksum_complete_head); | ||
427 | |||
428 | __sum16 __skb_checksum_complete(struct sk_buff *skb) | ||
429 | { | ||
430 | return __skb_checksum_complete_head(skb, skb->len); | ||
431 | } | ||
426 | EXPORT_SYMBOL(__skb_checksum_complete); | 432 | EXPORT_SYMBOL(__skb_checksum_complete); |
427 | 433 | ||
428 | /** | 434 | /** |