From patchwork Mon Nov 15 03:31:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shan Wei X-Patchwork-Id: 71173 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3329FB710D for ; Mon, 15 Nov 2010 14:33:14 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757358Ab0KODdH (ORCPT ); Sun, 14 Nov 2010 22:33:07 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:54691 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751901Ab0KODdG (ORCPT ); Sun, 14 Nov 2010 22:33:06 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 56396170137; Mon, 15 Nov 2010 11:33:04 +0800 (CST) Received: from mailserver.fnst.cn.fujitus.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id oAF3SeIB006680; Mon, 15 Nov 2010 11:28:40 +0800 Received: from [10.167.225.31] ([10.167.225.31]) by mailserver.fnst.cn.fujitus.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2010111511332877-6275 ; Mon, 15 Nov 2010 11:33:28 +0800 Message-ID: <4CE0A994.4080606@cn.fujitsu.com> Date: Mon, 15 Nov 2010 11:31:32 +0800 From: Shan Wei User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: David Miller CC: Francois Romieu , "netdev@vger.kernel.org" , jgarzik@pobox.com Subject: Re: [PATCH] r8169: fix checksum broken References: <4CDD13BD.7060109@cn.fujitsu.com> <20101112224746.GA6676@electric-eye.fr.zoreil.com> <20101112231325.GB6676@electric-eye.fr.zoreil.com> In-Reply-To: <20101112231325.GB6676@electric-eye.fr.zoreil.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2010-11-15 11:33:28, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2010-11-15 11:33:29, Serialize complete at 2010-11-15 11:33:29 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Francois Romieu wrote, at 11/13/2010 07:13 AM: > Francois Romieu : > [...] >> Which kind of device do you use : PCI-E 8168 / 810x or PCI 8169 ? > > Wrong page. Forget it. > > Acked-by: Francois Romieu 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 --- 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)