From: Shan Wei <shanwei@cn.fujitsu.com>
To: David Miller <davem@davemloft.net>
Cc: Francois Romieu <romieu@fr.zoreil.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
jgarzik@pobox.com
Subject: Re: [PATCH] r8169: fix checksum broken
Date: Mon, 15 Nov 2010 11:31:32 +0800 [thread overview]
Message-ID: <4CE0A994.4080606@cn.fujitsu.com> (raw)
In-Reply-To: <20101112231325.GB6676@electric-eye.fr.zoreil.com>
Francois Romieu wrote, at 11/13/2010 07:13 AM:
> Francois Romieu <romieu@fr.zoreil.com> :
> [...]
>> Which kind of device do you use : PCI-E 8168 / 810x or PCI 8169 ?
>
> Wrong page. Forget it.
>
> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
While grepping IPFail variable, maybe cp_rx_csum_ok() in 8139cp driver also has same bug.
There is no NIC on hand using RealTek RTL-8139C+ series 10/100 PCI Ethernet driver,
So don't confirm it.
===
[PATCH] 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>
---
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 ac422cd..dd16e83 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)
--
1.6.3.3
next prev parent reply other threads:[~2010-11-15 3:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 10:15 [PATCH] r8169: fix checksum broken Shan Wei
2010-11-12 20:44 ` David Miller
2010-11-12 22:47 ` Francois Romieu
2010-11-12 23:13 ` Francois Romieu
2010-11-15 3:31 ` Shan Wei [this message]
2010-11-15 21:01 ` Francois Romieu
2010-11-17 19:55 ` David Miller
2010-11-17 19:54 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CE0A994.4080606@cn.fujitsu.com \
--to=shanwei@cn.fujitsu.com \
--cc=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.