From patchwork Fri Jul 6 10:27:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 141291 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2946791ljj; Fri, 6 Jul 2018 03:31:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfRkKBmbTGlmuPLij7bYmnPX1ctim/h+1hdTliaonRXXOkhHis3OPLZt8qFibMlZVdkYqLT X-Received: by 2002:a63:9311:: with SMTP id b17-v6mr8925299pge.261.1530873071046; Fri, 06 Jul 2018 03:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530873071; cv=none; d=google.com; s=arc-20160816; b=rFAss8TgINIChZrAs4ds7Qlv5ex99DAjfjjm1f3QCnD7U8MOnlR6+6bRtkI8C+ngvP n01+eb1Is/2KY5O5fV/J4Vljk+ExZNAr0/fV1Py/UwPxfNMPtnwOypxSguqfx0wE3Mrl wKstYohYEWN76eKvfZq8nyfT4RGKajpoUqJNNOepKb05QpCXQGeiSY1/YG0SKwxV4Wgj 4MzKtoBL5nhn9G5UQYZiMIjPSmEU36+eFoOdGFzY3cQHFKr66aMYonoMKzJs2qsuy+fm +6FIy4iLiIaODDLd3cySxmw1QoRdVR/qWOCD/igYyJoYSdgjMlVBJU6x0iygQA7+IqMQ fiaw== 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:arc-authentication-results; bh=7H5g8SOL+BObaxpfQ3ewPRG6nyJ40q+EBK9xzBR+KW0=; b=00txZCaof0CsbC23jYctEpysvdtnaCvWWWaEabclUiNWNO7JddaPXFsFeI4MDgoJmY tJ/IgSHl9nORsEswo3JZXzc4/T6rOPXRzaY++vWxn0bYNwqssevSg9NC8soIdzxO9htB b6aq+ShC/JXxo6TTZdk11nsVsvhTzqYPXidxArDTcKSusJmmcYfxEUBYEVdyWIFgJeWx ty6GIKwdw5zYvHJLdgiVsw/TJqJISIN2jHcqRsriA56FNPgroCUabu3bpVQ4+9MFrlqy SL6c6LN7PTR+YX+CxvhluLevRlmHnu6pzFaVPp0wtP8T0U7LQ14MZMY1bVgrKh/KpeUE CS/Q== 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 e20-v6si8923127pfm.177.2018.07.06.03.31.10; Fri, 06 Jul 2018 03:31:11 -0700 (PDT) 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 S932537AbeGFK3V (ORCPT + 30 others); Fri, 6 Jul 2018 06:29:21 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9161 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932439AbeGFK3T (ORCPT ); Fri, 6 Jul 2018 06:29:19 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 93EFD6ABBC82C; Fri, 6 Jul 2018 18:29:05 +0800 (CST) Received: from S00293818-DELL1.huawei.com (10.202.226.54) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.382.0; Fri, 6 Jul 2018 18:28:58 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 04/10] net: hns3: Fix for l4 checksum offload bug Date: Fri, 6 Jul 2018 11:27:58 +0100 Message-ID: <20180706102804.196-5-salil.mehta@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180706102804.196-1-salil.mehta@huawei.com> References: <20180706102804.196-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin Hardware only support tcp/udp/sctp l4 checksum offload, but the driver currently tell hardware to do l4 checksum offlad when l3 is IPv4 or IPv6, which may cause checksumm error. This patch fixes it by only enabling the l4 offload when l4 is tcp/udp/sctp. Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index e5e51e8..c211450 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -791,16 +791,14 @@ static int hns3_set_l3l4_type_csum(struct sk_buff *skb, u8 ol4_proto, */ if (skb_is_gso(skb)) hnae3_set_bit(*type_cs_vlan_tso, HNS3_TXD_L3CS_B, 1); - - hnae3_set_bit(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1); } else if (l3.v6->version == 6) { hnae3_set_field(*type_cs_vlan_tso, HNS3_TXD_L3T_M, HNS3_TXD_L3T_S, HNS3_L3T_IPV6); - hnae3_set_bit(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1); } switch (l4_proto) { case IPPROTO_TCP: + hnae3_set_bit(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1); hnae3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_M, HNS3_TXD_L4T_S, @@ -810,12 +808,14 @@ static int hns3_set_l3l4_type_csum(struct sk_buff *skb, u8 ol4_proto, if (hns3_tunnel_csum_bug(skb)) break; + hnae3_set_bit(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1); hnae3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_M, HNS3_TXD_L4T_S, HNS3_L4T_UDP); break; case IPPROTO_SCTP: + hnae3_set_bit(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1); hnae3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_M, HNS3_TXD_L4T_S,