Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1163629pxu; Fri, 27 Nov 2020 00:56:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJx87EdKIXvTeJn6hFn6t2jjEvRANjRI0zP1u3O1UyUz6fKONTKfg2eRHmGOVjPdRxZj9QNt X-Received: by 2002:a05:6402:b45:: with SMTP id bx5mr6528920edb.193.1606467401577; Fri, 27 Nov 2020 00:56:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606467401; cv=none; d=google.com; s=arc-20160816; b=ZqI6P5GujL5lM31FrVMeWW907r0FsREW4od8aNXkNEGXsFlhS2FTjvpFtqUH5C6Kf/ 7F0Qx4sSJ4ClHk8jkWcI+1mb1hGKfH1SPcXO5lV30P6CoEu1Y96RmXAPsf1/SodXzzH4 6kCr6TGPQj7Vd5V5/9P0oCarxRIRqtKz8uZLuipFHbyXbv8jgFSOiTJRG8Iow9dvK9m4 T90hIDiBcC4JJvt46MvpSvTtf+c5lJZhAgaFRCf4EBsC/vvDbK5B6XbAsXt9DrxxqrfJ y4+r+TKR3VBi0x1LmKWLmDLRldAgwP8ypA83J3Me35GceJuN+CgT9R/EbyGXt9TlXLBM t9lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=hYypO2R4nQ+70HzcaW0QtozlrZIXZQrk3WytY33NTEY=; b=spx/RCMeMQqGm4j7Ndclv5SPPNnY9R3KpnKclhUUhvHAm4yEPaYp8jbhdExttP6Hbr /YP98jTGX6AzKygjVlWYMbNipfXZ8rQEZllarb6SSRcA/P0FyBEJr3rTFc0ZLjF6tDgE A4azKSBCvVI3v/crdnQIP8S6t6S8PdAG20eUQWPWch/aDds9bksk9DBYHm0+OhV8ZG34 FPCNjiprR4G/yZA08mOmdKDJHHW4LTRHWqav7IeaayKmUqVDeIBHkQnTn5EhHHdIQl2k 8f0zRHjkCEflW48gMTvQ0piNWpjG10J/d81yB+2UQRjUaqqQSPgbMbiFjD+ZLwiYkP61 2/9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v9si4642776edb.48.2020.11.27.00.56.19; Fri, 27 Nov 2020 00:56:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729480AbgK0Irt (ORCPT + 99 others); Fri, 27 Nov 2020 03:47:49 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:7746 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728731AbgK0Irr (ORCPT ); Fri, 27 Nov 2020 03:47:47 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Cj7Xw3qSwzkhCS; Fri, 27 Nov 2020 16:47:12 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Fri, 27 Nov 2020 16:47:34 +0800 From: Huazhong Tan To: CC: , , , , , , Huazhong Tan Subject: [PATCH net-next 6/7] net: hns3: add a check for devcie's verion in hns3_tunnel_csum_bug() Date: Fri, 27 Nov 2020 16:47:21 +0800 Message-ID: <1606466842-57749-7-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1606466842-57749-1-git-send-email-tanhuazhong@huawei.com> References: <1606466842-57749-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For the device whose version is above V3(include V3), the hardware can do checksum offload for the non-tunnel udp packet, who has a dest port as the IANA assigned. So add a check for devcie's verion in hns3_tunnel_csum_bug(). Signed-off-by: Huazhong Tan --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 07bdb3d5..b51bf61 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -828,8 +828,16 @@ static int hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto, */ static bool hns3_tunnel_csum_bug(struct sk_buff *skb) { + struct hns3_nic_priv *priv = netdev_priv(skb->dev); + struct hnae3_ae_dev *ae_dev = pci_get_drvdata(priv->ae_handle->pdev); union l4_hdr_info l4; + /* device version above V3(include V3), the hardware can + * do this checksum offload. + */ + if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3) + return false; + l4.hdr = skb_transport_header(skb); if (!(!skb->encapsulation && -- 2.7.4