Received: by 10.223.176.5 with SMTP id f5csp476939wra; Fri, 2 Feb 2018 00:46:15 -0800 (PST) X-Google-Smtp-Source: AH8x224TrbFy2Arzs5bIXMO1K1JpHrtRzvZUM6hkp1D1VnrIs4+4/g65DvKD1TQAZU2Fzg+hMz72 X-Received: by 10.101.83.133 with SMTP id x5mr30657049pgq.244.1517561175686; Fri, 02 Feb 2018 00:46:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517561175; cv=none; d=google.com; s=arc-20160816; b=zc92jcHsbrg4VdCSqKaHwteSSfMwya/RafCQtO3F+wFNNOclEZmLO5Z29BPKVA/FrU BeM0P1pPkjTfctSSOYgSS8iD8aDaJwMge5psUGXYPuuTMRVdHZr8JMQXxnQad9MOWyMn 2ab1BazbYoyv9nRdx+xokKCYGWpAJNFFyXW6OJEQL5K2oD9Mj7l6jkdPdARvlclbyYRK Vh3X+ZG/C23x+0ce1XyIC7Vk6GnSBCQKFfCJdEFtndKo0APl7hRY/jnSbLX1dU4aJAiC N/YM38XRey9rCxhtaVdWBjDNwDAh2r0wqELszcuKQIpacwqTti4ntcTx2sYj6VDtROs8 AB0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by :arc-authentication-results; bh=dUtEcuqcX2XQS/h+dwBi6Sx4hYvLzc/Jivla4XChAuA=; b=Zf7xSz6j+b2cpPTOrvi9tf+HSxqLbS/ZruZ8Pa4O4ieStD6fROwx2yAAqVnqFO8f+1 iE/ZcWUGuSUrQXYzhlOGDrOAoUCoB6fpfQVVi26mN5IMGW3EnsHyrCY9FXJhSRQ7nGxQ m6jULbR828m5lGqI+wsM0hltNtxtCCyqd7wzBxbOR4zbcSuFkzHRNGLnNUKE5iBMb6MK hGLUk++7dQUZ2MwWW2XLQOU5yY2fNZww6xtZGxoaGQiXkMlzqaOcKzr4NHUaUbBPj/p3 M4U2a/CA4woG+C7H+NDUCqVRHB0VCowUbkerra7RRwXxYIVp5WRRnSM1lLqDgPn/2lJQ 3TcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si1043364pgo.360.2018.02.02.00.46.01; Fri, 02 Feb 2018 00:46:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751941AbeBBIoS (ORCPT + 99 others); Fri, 2 Feb 2018 03:44:18 -0500 Received: from rtits2.realtek.com ([211.75.126.72]:46689 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751822AbeBBIoB (ORCPT ); Fri, 2 Feb 2018 03:44:01 -0500 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID w128hwc5023476, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcasv01.realtek.com.tw [172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTP id w128hwc5023476; Fri, 2 Feb 2018 16:43:58 +0800 Received: from fc26.localdomain (172.21.177.200) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.294.0; Fri, 2 Feb 2018 16:43:57 +0800 From: Hayes Wang To: CC: , , , Hayes Wang Subject: [PATCH net 1/2] r8152: fix wrong checksum status for received IPv4 packets Date: Fri, 2 Feb 2018 16:43:35 +0800 Message-ID: <1394712342-15778-284-albertk@realtek.com> X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <1394712342-15778-283-albertk@realtek.com> References: <1394712342-15778-283-albertk@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.177.200] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The device could only check the checksum of TCP and UDP packets. Therefore, for the IPv4 packets excluding TCP and UDP, the check of checksum is necessary, even though the IP checksum is correct. Take ICMP for example, The IP checksum may be correct, but the ICMP checksum may be wrong. Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 0657203ffb91..756de9ea8d2e 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1848,11 +1848,9 @@ static u8 r8152_rx_csum(struct r8152 *tp, struct rx_desc *rx_desc) if (opts2 & RD_IPV4_CS) { if (opts3 & IPF) checksum = CHECKSUM_NONE; - else if ((opts2 & RD_UDP_CS) && (opts3 & UDPF)) - checksum = CHECKSUM_NONE; - else if ((opts2 & RD_TCP_CS) && (opts3 & TCPF)) - checksum = CHECKSUM_NONE; - else + else if ((opts2 & RD_UDP_CS) && !(opts3 & UDPF)) + checksum = CHECKSUM_UNNECESSARY; + else if ((opts2 & RD_TCP_CS) && !(opts3 & TCPF)) checksum = CHECKSUM_UNNECESSARY; } else if (opts2 & RD_IPV6_CS) { if ((opts2 & RD_UDP_CS) && !(opts3 & UDPF)) -- 2.13.6