From 759e5d006462d53fb708daa8284b4ad909415da1 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sun, 25 Mar 2007 20:10:56 -0700 Subject: [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 Signed-off-by: David S. Miller --- include/net/udp.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'include/net/udp.h') diff --git a/include/net/udp.h b/include/net/udp.h index 1b921fa8147..4a9699f7928 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -72,10 +72,7 @@ struct sk_buff; */ static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) { - if (! UDP_SKB_CB(skb)->partial_cov) - return __skb_checksum_complete(skb); - return csum_fold(skb_checksum(skb, 0, UDP_SKB_CB(skb)->cscov, - skb->csum)); + return __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov); } static inline int udp_lib_checksum_complete(struct sk_buff *skb) -- cgit v1.2.3