[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:
Herbert Xu
2005-11-10 13:01:24 -08:00
committed by David S. Miller
parent 1064e944d0
commit fb286bb299
19 changed files with 173 additions and 134 deletions
+6 -9
View File
@@ -23,6 +23,7 @@
#include <linux/in.h>
#include <linux/in6.h>
#include <linux/icmp.h>
#include <linux/skbuff.h>
#include <net/sock.h>
#include <net/ip.h>
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
@@ -475,15 +476,11 @@ void rxrpc_trans_receive_packet(struct rxrpc_transport *trans)
/* we'll probably need to checksum it (didn't call
* sock_recvmsg) */
if (pkt->ip_summed != CHECKSUM_UNNECESSARY) {
if ((unsigned short)
csum_fold(skb_checksum(pkt, 0, pkt->len,
pkt->csum))) {
kfree_skb(pkt);
rxrpc_krxiod_queue_transport(trans);
_leave(" CSUM failed");
return;
}
if (skb_checksum_complete(pkt)) {
kfree_skb(pkt);
rxrpc_krxiod_queue_transport(trans);
_leave(" CSUM failed");
return;
}
addr = pkt->nh.iph->saddr;