Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp15231pxb; Mon, 13 Sep 2021 11:41:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB9z0Rk/UwwZv0LHAJ/dfyAZoUHHQF6Xz2fLikP3DPEodjkHHVSNoA4VatxVnawHXMAP/3 X-Received: by 2002:a6b:610e:: with SMTP id v14mr9993122iob.70.1631558503385; Mon, 13 Sep 2021 11:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631558503; cv=none; d=google.com; s=arc-20160816; b=GrUEVckOYGSV6CdatBd3TWxg3EPxHeNHq2s7k4Qn1yFE+6SoPbpfIOm3Z+locKzoXM adeeIjKYpNs2F923mFFgDUrHR8FXIfaL4DCMJxP0FJOEDombh4btYVBsL28XAIimlaJb EGsmO/Zurd37z2QRFc+2jj0nCvgjsmmWuMIEu+1jjpeMYICVAzalhuybWEStV/JSgGNy aHdoCjujnDJUT6Wzd1uu30K4MhQZD0tRkEeJvu/rl/vdVkoVjbF5EwM9RpdKK7BQ+wvL gQSzw6JvX97FiP8Z7S4/tsEDykY1WCy3qAJMEfet5pkHEUqVuhF5HcT2XKlXHcrxppHk QhzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Q4K13Fl78/Oo1EDQX127z+YG+Mmwunyj3+VOxFgUd+Y=; b=uqevqvNP7fl7zwcyrW2AeRyCURutYFIrmhEpanC6KogunVWNH0+1Hkskcdt4eWoiY0 3bYw/HPUwL0mCBvn1oQW5ssf9WzXf0y9nT150dV8JOa+8yOeg1miIzd2o29NWuhoSiFL 2HQDQGnfOjgDlUzSa/kHkn3mZZZyR70mnSq5ZyMQEGSdW7C9kb/OHW4H+dlIg//bxL8d L/vmMIEJE5EIKiFnfOi14W8SSiwLu+/JazjI2Os7A2Tv7/bot2yYoDWaDOIG8CqWWtao q5CMUlgmhoDxLWkLb+5uMJZWBkAw/XyRUrVhwbZosIEkb1h/b17WKa5m5abj0ldnSkil fTsA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o29si7610689jac.75.2021.09.13.11.41.30; Mon, 13 Sep 2021 11:41:43 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239316AbhIMNN7 (ORCPT + 99 others); Mon, 13 Sep 2021 09:13:59 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:9424 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236725AbhIMNNu (ORCPT ); Mon, 13 Sep 2021 09:13:50 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4H7Rc373w6z8yVZ; Mon, 13 Sep 2021 21:08:03 +0800 (CST) Received: from kwepemm600016.china.huawei.com (7.193.23.20) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Mon, 13 Sep 2021 21:12:28 +0800 Received: from localhost.localdomain (10.67.165.24) by kwepemm600016.china.huawei.com (7.193.23.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Mon, 13 Sep 2021 21:12:28 +0800 From: Guangbin Huang To: , CC: , , , Subject: [PATCH net 2/6] net: hns3: pad the short tunnel frame before sending to hardware Date: Mon, 13 Sep 2021 21:08:21 +0800 Message-ID: <20210913130825.27025-3-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913130825.27025-1-huangguangbin2@huawei.com> References: <20210913130825.27025-1-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600016.china.huawei.com (7.193.23.20) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yufeng Mo The hardware cannot handle short tunnel frames below 65 bytes, and will cause vlan tag missing problem. So pads packet size to 65 bytes for tunnel frames to fix this bug. Fixes: 3db084d28dc0("net: hns3: Fix for vxlan tx checksum bug") Signed-off-by: Yufeng Mo Signed-off-by: Guangbin Huang --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 293243bbe407..adc54a726661 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -76,6 +76,7 @@ module_param(page_pool_enabled, bool, 0400); #define HNS3_OUTER_VLAN_TAG 2 #define HNS3_MIN_TX_LEN 33U +#define HNS3_MIN_TUN_PKT_LEN 65U /* hns3_pci_tbl - PCI Device ID Table * @@ -1427,8 +1428,11 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto, l4.tcp->doff); break; case IPPROTO_UDP: - if (hns3_tunnel_csum_bug(skb)) - return skb_checksum_help(skb); + if (hns3_tunnel_csum_bug(skb)) { + int ret = skb_put_padto(skb, HNS3_MIN_TUN_PKT_LEN); + + return ret ? ret : skb_checksum_help(skb); + } hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1); hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_S, -- 2.33.0