From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 97930A0A0E for ; Mon, 10 May 2021 18:05:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91BDE4003E; Mon, 10 May 2021 18:05:58 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2064.outbound.protection.outlook.com [40.107.101.64]) by mails.dpdk.org (Postfix) with ESMTP id 6FAE540147 for ; Mon, 10 May 2021 18:05:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P3QVonCWySiEYHn0BITMKO9mfztzLxwotsUfMDjadEmD7g88h9EDAc4oDrepyRpWsWat8GD2/9AdaUm7rQMqf44P3DVvm9ABPqI4Y8sade0gZWKde2H3XusRg7BmMAIdOx3FEECvGk5pg0XujR7k/3fqjc/WyrjnuoE2JbgvqSWH+lOFFKwAF83j/rRX0pOgFqlGVbBbJTwQJyyyuPa0nANLneVyXkN0e6OYTXRmxVoK5W6CXFf7wpeVfW+id2w2eqrxkhAAGGBOFQ29fLcb26bJCm6IsVHB0HHiSvLSfKeU2Fnhjfn4CnMFq6446bs2HRBcFBKTDOZiLp8EFYF+EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5KW40uFprWpbF2cILzoYoJUSSjdSUffufsIangYwlQQ=; b=ASkOwYBiAchopvv0S3QWujEy//GNtVgn1g028BbZLQu3a9Xwo71aB+8fFqoXNhN7//JQD31ou4R2TQq6xzqMoykgxNF6WbePQMv4gMIs/rvUHSJkQGnRF1Atkm0ErDmT0pIJ3o/s3F7Bu1Y2Y2lgspSoKZA52brulG0O/7HLpdY7/geP/p/URkASUN5LjF/Ki9sQrvao/TBLG/PP9ddJJkYuS3x3gtHoFC+m6bW2db/zHJoKdMh/S8a1d0t8r4XPdAd+7p0oC34j0nqdHd7jYnB1Ug8bMZN615HeSarYcmuWTBDg4/HVcDYOXaPHpnVHBAgaelyCFWdEHPQagMTT0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=huawei.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5KW40uFprWpbF2cILzoYoJUSSjdSUffufsIangYwlQQ=; b=WE0P3tTYt+mlwTO/PtrEwM3XmS9DD0Xvme13TmXkdeWEZbPETmtGvfwXyXDxhi0rdfvlpUKQSwDUd5i7agJ+yLi3/H6GRfBXM522wB8dKjgFQWBFDAwdeLgLpf2plbDnm6gzeDPeS7q5dJrMxuBz9AsRtpDLFwjK0yiHnHTdSx1amN0KmzNnLRWAqQzy+9uBvRN2ih0pFtL0gG53mxDH+N7OTggewi3fld9RJWrG44+BlpYV7gshP4O6/S0sH/axgM3rGKdcJNo3cavXOMcAw+AWNlCHGwICDw0pXxlYvB50wVIGEZibr4vDH0aQ6vRz9p0XWP9nNO/KyUW0qm+6kA== Received: from BN6PR12CA0034.namprd12.prod.outlook.com (2603:10b6:405:70::20) by SN6PR12MB4718.namprd12.prod.outlook.com (2603:10b6:805:ee::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.28; Mon, 10 May 2021 16:05:55 +0000 Received: from BN8NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:405:70:cafe::32) by BN6PR12CA0034.outlook.office365.com (2603:10b6:405:70::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Mon, 10 May 2021 16:05:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT006.mail.protection.outlook.com (10.13.177.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:05:55 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 16:05:53 +0000 From: Xueming Li To: Chengchang Tang CC: Luca Boccassi , Lijun Ou , dpdk stable Date: Mon, 10 May 2021 23:59:36 +0800 Message-ID: <20210510160258.30982-27-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510160258.30982-1-xuemingl@nvidia.com> References: <20210510160258.30982-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 843f579f-7bd2-44f5-e03d-08d913cd7e44 X-MS-TrafficTypeDiagnostic: SN6PR12MB4718: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RdZvrSAbzTkigic250gUycTXIVQXU0tkKAoMmOq8G2rp4h88FS1/hlp0qFtS+S2XDasELEgrVPx3cyFtoTeu5wrKq4k/a+JAHuKsvnwn8/H9D/FB29k8utNh/PxADCqRiTRZwdRyNU9i7C4eyl8bFOmPyixol3n7BbNNRD0NPb6SHhrWcXlojD8LPbu7E1yKzyrvl2ra+nsrX4CeN7ERhutGCiUqTaRWQ00XPvXJN4Rzu5m1M367j2UHtuwqLFaNsJlFGQgP7aYPLUqOiZKLcU3CdqzpULLfaJ0pi6T9BfZA54uDleTyJVwQtvgU48xpwTqPLFimDKbWM+i3a7iXip0fA9EDufx4Q7+RHNRGlnyPAdD7pKQOcekPpKpwbn4fNH8ycbhYdBXl8DaiVvvfJ1Ec0bTdC5vudQK63eyd6X/i1oLe7aE4wwAFDKtml1RAHv2SNlPDqijsVeLgkNQjiPfa+evT71nMX+jo9esnROecYEBjelNe106x2aXSmzqFkk/PzyCIna6/wiqLrAwiyyYbNiTH/fqzW19MrGkPBmQaD8441HsAuRwB6ZqUPnV3dQ+SS6yw/KiBD12e5m+SQASNmGrElmDJBNhNlvDoZ3V0yFro4gO90QN916lAm71L7hwEq/kKAdamEW+wafsJR4O2k6zVgJ7SXES7CXP88K/InZbZrWT7e2IOZ+R2wzfkLbJ1Vv28gNfcCGf+46ixajptuvJVYG10WKVvwsFwpSz3XlqNcuyz84Qi3fP4FyHSCJvsbWDEIOByWIJUX5w2cQ== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(346002)(39860400002)(396003)(136003)(376002)(46966006)(36840700001)(4326008)(82740400003)(8936002)(53546011)(2616005)(966005)(186003)(26005)(47076005)(86362001)(336012)(8676002)(7696005)(6286002)(478600001)(16526019)(5660300002)(15650500001)(70206006)(426003)(1076003)(6916009)(82310400003)(36756003)(36906005)(55016002)(2906002)(6666004)(83380400001)(356005)(70586007)(54906003)(36860700001)(7636003)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 16:05:55.5603 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 843f579f-7bd2-44f5-e03d-08d913cd7e44 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4718 Subject: [dpdk-stable] patch 'net/hns3: fix HW buffer size on MTU update' has been queued to stable release 20.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/3997b852411f2022478b2b32e1916f9a555a68b8 Thanks. Xueming Li --- >From 3997b852411f2022478b2b32e1916f9a555a68b8 Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Thu, 4 Mar 2021 15:44:50 +0800 Subject: [PATCH] net/hns3: fix HW buffer size on MTU update Cc: Luca Boccassi [ upstream commit 25fb790f7868f8eee96f7f051a834dec01b8a369 ] After MTU changed, the buffer used to store packets in HW should be reallocated. And buffer size is allocated based on the maximum frame size in the PF struct. However, the value of maximum frame size is not updated in time when MTU is changed. This would lead to a packet loss for not enough buffer. This patch update the maximum frame size before reallocating the HW buffer. And a rollback operation is added to avoid the side effects of buffer reallocation failures. Fixes: 1f5ca0b460cd ("net/hns3: support some device operations") Fixes: d51867db65c1 ("net/hns3: add initialization") Signed-off-by: Chengchang Tang Signed-off-by: Lijun Ou --- drivers/net/hns3/hns3_ethdev.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index ba7d6e38a2..8f4ce58c0b 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2435,17 +2435,33 @@ hns3_set_mac_mtu(struct hns3_hw *hw, uint16_t new_mps) static int hns3_config_mtu(struct hns3_hw *hw, uint16_t mps) { + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + uint16_t original_mps = hns->pf.mps; + int err; int ret; ret = hns3_set_mac_mtu(hw, mps); if (ret) { - hns3_err(hw, "Failed to set mtu, ret = %d", ret); + hns3_err(hw, "failed to set mtu, ret = %d", ret); return ret; } + hns->pf.mps = mps; ret = hns3_buffer_alloc(hw); - if (ret) - hns3_err(hw, "Failed to allocate buffer, ret = %d", ret); + if (ret) { + hns3_err(hw, "failed to allocate buffer, ret = %d", ret); + goto rollback; + } + + return 0; + +rollback: + err = hns3_set_mac_mtu(hw, original_mps); + if (err) { + hns3_err(hw, "fail to rollback MTU, err = %d", err); + return ret; + } + hns->pf.mps = original_mps; return ret; } @@ -2480,7 +2496,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) dev->data->port_id, mtu, ret); return ret; } - hns->pf.mps = (uint16_t)frame_size; + if (is_jumbo_frame) dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-10 23:59:27.408646500 +0800 +++ 0028-net-hns3-fix-HW-buffer-size-on-MTU-update.patch 2021-05-10 23:59:26.350000000 +0800 @@ -1 +1 @@ -From 25fb790f7868f8eee96f7f051a834dec01b8a369 Mon Sep 17 00:00:00 2001 +From 3997b852411f2022478b2b32e1916f9a555a68b8 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 25fb790f7868f8eee96f7f051a834dec01b8a369 ] @@ -18 +20,0 @@ -Cc: stable@dpdk.org @@ -27 +29 @@ -index b3fd331fe4..21c3c59cdd 100644 +index ba7d6e38a2..8f4ce58c0b 100644 @@ -30 +32 @@ -@@ -2460,17 +2460,33 @@ hns3_set_mac_mtu(struct hns3_hw *hw, uint16_t new_mps) +@@ -2435,17 +2435,33 @@ hns3_set_mac_mtu(struct hns3_hw *hw, uint16_t new_mps) @@ -67 +69 @@ -@@ -2505,7 +2521,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) +@@ -2480,7 +2496,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)