Received: by 10.223.185.116 with SMTP id b49csp1116428wrg; Sat, 3 Mar 2018 16:03:47 -0800 (PST) X-Google-Smtp-Source: AG47ELssqdzVmK7ZAQrOUUUd5iRRLguAtXqbTNOnCfLPQwOjofK2TYx+fnDvkqBdf35HrTUciio1 X-Received: by 10.99.96.18 with SMTP id u18mr8637330pgb.124.1520121827682; Sat, 03 Mar 2018 16:03:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520121827; cv=none; d=google.com; s=arc-20160816; b=FzdwR31luwPqtrKd113PhIyEnMARIr0bMxg2XAQ66MGXNid/0rnDOUuroV31juk6N/ EK7OjAvLiqYjdFW/5CtfGmN2mveTT2W3tJ67mjIQ1RVPQ83hqLBn+E0ANCwAI/IYWex3 7P7Fk2hBJh+CR450HTwoRPJl17UlwMyOIlcWYOO9QhwuCVTD9HFURkbmPqiMPB8A5nM9 EAa+T37QpGOFAzj6QsEOe7e2n+V6p2WrDvObURZ9amoD9l+yIFJb0lfe5zDVdro+zFee oxdzQ/WHbPm7QEReiFcyZbfXAUs/7HXhPJkxXkEE8XdhhdnnRf8l9O3ewb7vSNMPsSln sTmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=H6jUFFMwfP2JjPbkEmdCT+TFu2NFyT3BceOwZLFMNeY=; b=n7E/2TH//bkxnH72eXEmV4Sr+rizt1IyQutpwnGwcLiokTriVUD7QXTJTyE9ld7QVp 8Hx9QEBklg2NiPvbnnsVqdX0Xbq4RzhVpuxyFtHbuxdabNrwjPcFyY0cVJn7aXHiPBI/ 3ONq3PKwJZnbp2rXj8LSrfbkdzXSGUKoVAEpGfZhqbRmNCgT3vE9SeMAdNMYCnAPAQ7W W8jQTbiSt3wBHGHfG1j2zY5/H8zZ716dlDMScCR+zQR1QUYSUxD9rT3XEH6PZnBluFOI bwxchc3flp8KgfHqSMSHD6x1EjAVsunDZbdc9MBAYTKNNLoozopQKJJYHuGyyouxSkS5 hK5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=o88B/ovt; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y28si7530897pfk.273.2018.03.03.16.03.33; Sat, 03 Mar 2018 16:03:47 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=o88B/ovt; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933785AbeCDACk (ORCPT + 99 others); Sat, 3 Mar 2018 19:02:40 -0500 Received: from mail-co1nam03on0109.outbound.protection.outlook.com ([104.47.40.109]:6764 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932872AbeCCWb6 (ORCPT ); Sat, 3 Mar 2018 17:31:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=H6jUFFMwfP2JjPbkEmdCT+TFu2NFyT3BceOwZLFMNeY=; b=o88B/ovtx2+FBYdzc9kQtj38VFH72KB6agmXxP9vGUJXmKnyVoQ5Ci/ryEwCArUCSDHHlGPL7hkuh5ckFfm3SvmiyoA3GBkeZbh0p0Ida9x6Xk5nIswBjxMxt0qCbttRRlwKKPi/b3hSw6Vti7nYfuP9L4wmpPaPqm66XlQApuw= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1083.namprd21.prod.outlook.com (52.132.149.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.1; Sat, 3 Mar 2018 22:31:57 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:31:57 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Iyappan Subramanian , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 033/219] drivers: net: xgene: Fix Rx checksum validation logic Thread-Topic: [PATCH AUTOSEL for 4.9 033/219] drivers: net: xgene: Fix Rx checksum validation logic Thread-Index: AQHTsz7raS0p6u5lhkiDa6v4/JTU3Q== Date: Sat, 3 Mar 2018 22:28:14 +0000 Message-ID: <20180303222716.26640-33-alexander.levin@microsoft.com> References: <20180303222716.26640-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222716.26640-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB1083;6:hgag4b1tlFTD8ZH+8oGF1plHzzZd652NSc4EJ1olsWyAu4DMHYbmXr9v8zxtGWUWQo2dTPYX4LM/6lQbF3zEGFbBTeRLTPet/HNeQ8Yf5etqHX71PHTsNDi7D1ZsdB0v1UbL1AN/qibM9nIUAlYdJQPgxsO6qLLHxVzf0ngXz9Al72bK/FpGgLtiPHrQ+X3ggObN2e38Tn7MvGCjgZIeWwx7ZXII95uBQ9+0TmmmBAFtliWfsYnUUW+OipTQ+DwewYyKdit2HOLea+yyLSlwaWsybozx9axLdTaUdB4UsyDXSWlCsoie4HlmyKITx7aqATGLZtMGhFG7avsIv4i1eDtzn93yjD4OVSylZ8Ykjr7/YCpkMgzrYqQFde+VlG8d;5:an0ItP3Jd9MFUC9lxvrppXX9YY3z3HC3PV4HnbGkpxONdPFDx/5r4CRD1d1rf1WH/HT7eVw18ANwUxdbOPIPpFCNWHaPJgcdndDyirklsX7x2T1Llvu5pTnmvGQ8xCkQM4/Jx+k4kOUweIoK65mM6c12WpnRFYZMuaoWjmgatSs=;24:KBXBpycI0JPptB52NHbulaExq2MQJaxADwnMpJbGsulCMrPKy13IK5nqqUld4H0nvzxnT/kFVHZr1SV4xKGNpYXC+H/yaCgS5oZOm9Waaj8=;7:+871A3sm072i02KJHJvCYrXRIplVJn5QABDW5CTPQPRfw8ysSWzjI/FUihwnvPpeFntvB4BQ1NPnB4jGWDgg6GYrkoc0Q87l57osliV/08gt51eev88OJ0KjoPU230jsUizsVGCerPsFi8GsoAmBYYyoeE1KzlEoeovIfXl/D3HJokRsNDBjgc/MGkbZxfJtm+ffL7bTGyxAqsD7RtDWb9grEA0NlRspRCA46FCXyuzFhBvaGHXhxfMdTAm6uohX x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ef6fb89a-a2d5-4288-ebcd-08d5815692a2 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7193020);SRVR:MW2PR2101MB1083; x-ms-traffictypediagnostic: MW2PR2101MB1083: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB1083;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1083; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(39860400002)(39380400002)(396003)(346002)(366004)(189003)(199004)(106356001)(53936002)(316002)(305945005)(7736002)(3280700002)(107886003)(2906002)(6512007)(6436002)(97736004)(3660700001)(6486002)(99286004)(81166006)(8936002)(81156014)(76176011)(8676002)(25786009)(2950100002)(6506007)(4326008)(110136005)(5250100002)(54906003)(36756003)(105586002)(6116002)(6666003)(22452003)(86612001)(10090500001)(186003)(68736007)(26005)(2900100001)(86362001)(66066001)(102836004)(3846002)(14454004)(478600001)(72206003)(10290500003)(5660300001)(59450400001)(1076002)(2501003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1083;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: oJWOg4kNHLZJXa2uSA58d2tEL5Ofp/ET1YwZyxt+Ibudn3gJwTfTCET8F7wnlgiVfW8CGX96DMORkNSNkbx9KS6giA3xSmq2VZdjKKJAYySabo2HwFZnyQ+UFq/P3GLkjRFKDhzTmAZ0nCUxtanWsFi64fjR2v/6ES02iSBF4UU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef6fb89a-a2d5-4288-ebcd-08d5815692a2 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:28:14.7912 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1083 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Iyappan Subramanian [ Upstream commit 0a0400c3094b5d5cedd479ddbf1329de74c09c4b ] This patch fixes Rx checksum validation logic and adds NETIF_F_RXCSUM flag. Signed-off-by: Iyappan Subramanian Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 27 +++++++++++++++-----= ---- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net= /ethernet/apm/xgene/xgene_enet_main.c index de1546a63a7f..651f308cdc60 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -505,14 +505,24 @@ static netdev_tx_t xgene_enet_start_xmit(struct sk_bu= ff *skb, return NETDEV_TX_OK; } =20 -static void xgene_enet_skip_csum(struct sk_buff *skb) +static void xgene_enet_rx_csum(struct sk_buff *skb) { + struct net_device *ndev =3D skb->dev; struct iphdr *iph =3D ip_hdr(skb); =20 - if (!ip_is_fragment(iph) || - (iph->protocol !=3D IPPROTO_TCP && iph->protocol !=3D IPPROTO_UDP)) { - skb->ip_summed =3D CHECKSUM_UNNECESSARY; - } + if (!(ndev->features & NETIF_F_RXCSUM)) + return; + + if (skb->protocol !=3D htons(ETH_P_IP)) + return; + + if (ip_is_fragment(iph)) + return; + + if (iph->protocol !=3D IPPROTO_TCP && iph->protocol !=3D IPPROTO_UDP) + return; + + skb->ip_summed =3D CHECKSUM_UNNECESSARY; } =20 static int xgene_enet_rx_frame(struct xgene_enet_desc_ring *rx_ring, @@ -555,10 +565,7 @@ static int xgene_enet_rx_frame(struct xgene_enet_desc_= ring *rx_ring, =20 skb_checksum_none_assert(skb); skb->protocol =3D eth_type_trans(skb, ndev); - if (likely((ndev->features & NETIF_F_IP_CSUM) && - skb->protocol =3D=3D htons(ETH_P_IP))) { - xgene_enet_skip_csum(skb); - } + xgene_enet_rx_csum(skb); =20 rx_ring->rx_packets++; rx_ring->rx_bytes +=3D datalen; @@ -1725,7 +1732,7 @@ static int xgene_enet_probe(struct platform_device *p= dev) xgene_enet_setup_ops(pdata); =20 if (pdata->phy_mode =3D=3D PHY_INTERFACE_MODE_XGMII) { - ndev->features |=3D NETIF_F_TSO; + ndev->features |=3D NETIF_F_TSO | NETIF_F_RXCSUM; spin_lock_init(&pdata->mss_lock); } ndev->hw_features =3D ndev->features; --=20 2.14.1