[NET]: Detect hardware rx checksum faults correctly
Here is the patch that introduces the generic skb_checksum_complete which also checks for hardware RX checksum faults. If that happens, it'll call netdev_rx_csum_fault which currently prints out a stack trace with the device name. In future it can turn off RX checksum. I've converted every spot under net/ that does RX checksum checks to use skb_checksum_complete or __skb_checksum_complete with the exceptions of: * Those places where checksums are done bit by bit. These will call netdev_rx_csum_fault directly. * The following have not been completely checked/converted: ipmr ip_vs netfilter dccp This patch is based on patches and suggestions from Stephen Hemminger and David S. Miller. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
1064e944d0
commit
fb286bb299
@@ -761,7 +761,7 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
|
||||
|
||||
static __inline__ int __udp_checksum_complete(struct sk_buff *skb)
|
||||
{
|
||||
return (unsigned short)csum_fold(skb_checksum(skb, 0, skb->len, skb->csum));
|
||||
return __skb_checksum_complete(skb);
|
||||
}
|
||||
|
||||
static __inline__ int udp_checksum_complete(struct sk_buff *skb)
|
||||
@@ -1100,11 +1100,8 @@ static int udp_checksum_init(struct sk_buff *skb, struct udphdr *uh,
|
||||
if (uh->check == 0) {
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
} else if (skb->ip_summed == CHECKSUM_HW) {
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
if (!udp_check(uh, ulen, saddr, daddr, skb->csum))
|
||||
return 0;
|
||||
LIMIT_NETDEBUG(KERN_DEBUG "udp v4 hw csum failure.\n");
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
}
|
||||
if (skb->ip_summed != CHECKSUM_UNNECESSARY)
|
||||
skb->csum = csum_tcpudp_nofold(saddr, daddr, ulen, IPPROTO_UDP, 0);
|
||||
|
Reference in New Issue
Block a user