diff options
author | Shan Wei <shanwei@cn.fujitsu.com> | 2010-11-17 11:55:08 -0800 |
---|---|---|
committer | AK <andi@firstfloor.org> | 2011-02-06 11:03:35 -0800 |
commit | 4fef93a724a0294bc372e3f0049b5f9dfa09e44e (patch) | |
tree | e04566e79dea4a73fe7dd1f93a05fe6b15016f45 /drivers | |
parent | 5f8d6ba121ac7b0651396e8ce71c6fea4befca45 (diff) | |
download | linux-stable-4fef93a724a0294bc372e3f0049b5f9dfa09e44e.tar.gz linux-stable-4fef93a724a0294bc372e3f0049b5f9dfa09e44e.tar.bz2 linux-stable-4fef93a724a0294bc372e3f0049b5f9dfa09e44e.zip |
8139cp: fix checksum broken
[ Upstream commit 24b7ea9f6c9787fad885442ed0cc010f1aa69cca ]
I am not family with RealTek RTL-8139C+ series 10/100 PCI Ethernet driver.
I try to guess the meaning of RxProtoIP and IPFail.
RxProtoIP stands for received IPv4 packet that upper protocol is not tcp and udp.
!(status & IPFail) is true means that driver correctly to check checksum in IPv4 header.
If these are right, driver will set ip_summed with CHECKSUM_UNNECESSARY for other
upper protocol, e.g. sctp, igmp protocol. This will cause protocol stack ignores
checksum check for packets with invalid checksum.
This patch is only compile-test.
Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/8139cp.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 284a5f4a63ac..7b1b2569a2f6 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c @@ -490,13 +490,11 @@ static inline unsigned int cp_rx_csum_ok (u32 status) { unsigned int protocol = (status >> 16) & 0x3; - if (likely((protocol == RxProtoTCP) && (!(status & TCPFail)))) + if (((protocol == RxProtoTCP) && !(status & TCPFail)) || + ((protocol == RxProtoUDP) && !(status & UDPFail))) return 1; - else if ((protocol == RxProtoUDP) && (!(status & UDPFail))) - return 1; - else if ((protocol == RxProtoIP) && (!(status & IPFail))) - return 1; - return 0; + else + return 0; } static int cp_rx_poll(struct napi_struct *napi, int budget) |