diff options
author | Shan Wei <shanwei@cn.fujitsu.com> | 2010-11-17 14:55:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-17 15:21:14 -0500 |
commit | 24b7ea9f6c9787fad885442ed0cc010f1aa69cca (patch) | |
tree | fe72feefde54c1f7914b5b2bf05437b8b8eb1eee /drivers/net | |
parent | d5d3ebe3be5c5123f2d444e186717f45284151e2 (diff) |
8139cp: fix checksum broken
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>
Diffstat (limited to 'drivers/net')
-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 ac422cd332ea..dd16e83933a2 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) | |||
490 | { | 490 | { |
491 | unsigned int protocol = (status >> 16) & 0x3; | 491 | unsigned int protocol = (status >> 16) & 0x3; |
492 | 492 | ||
493 | if (likely((protocol == RxProtoTCP) && (!(status & TCPFail)))) | 493 | if (((protocol == RxProtoTCP) && !(status & TCPFail)) || |
494 | ((protocol == RxProtoUDP) && !(status & UDPFail))) | ||
494 | return 1; | 495 | return 1; |
495 | else if ((protocol == RxProtoUDP) && (!(status & UDPFail))) | 496 | else |
496 | return 1; | 497 | return 0; |
497 | else if ((protocol == RxProtoIP) && (!(status & IPFail))) | ||
498 | return 1; | ||
499 | return 0; | ||
500 | } | 498 | } |
501 | 499 | ||
502 | static int cp_rx_poll(struct napi_struct *napi, int budget) | 500 | static int cp_rx_poll(struct napi_struct *napi, int budget) |