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 9E91DA0A0E for ; Mon, 10 May 2021 18:16:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9881040140; Mon, 10 May 2021 18:16:56 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2067.outbound.protection.outlook.com [40.107.237.67]) by mails.dpdk.org (Postfix) with ESMTP id A89084014E for ; Mon, 10 May 2021 18:16:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fpMewN/Safi1nUbXR5xo4ct5e2o2SQW4pmVXbL/bE2JJJKweNrAjHgrEcz8yC3vZWbQPJnKyFM9zzanccqTN2Iv9sE6DGsMwSn4hmu3i0FqnxSitv2T6ItT31cY91ttN8rOJj20vegeepTwP8pq5HQD+ueAGzjWm1vFx94FWMOxOyttjcxTgZotV5xK9sdKxkzA0/67o+riMsZAU9BKiSUY7xNY2LN9CweMftVIIspLdj6NuTxTXw3JRjZK61NTONutQ7X9SAM5L9Yv64ZIEoyeAy2fd2kV6vEHdYeXJlz1V6gLDHbuQXI6O0/kX6r49tQaOUQq3HV4FPIPNnJKjww== 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=KcDyy0lFnfoSGwq6lloN7P8w6T5PLJWuWDlrrrKn8wA=; b=hLxecr1pEa/K4ke2jrCcgZrhoJkthg7vzl6XRt01HwMkArosPQjxoZT/2Lu+mGYpEVEen669dNBn4LzBfu5mMm3zt4DZb6nELhdVDLYHVoY7N804CB5CQur6Em8nEJTB1EW8NhTVTdJINkzXoEPE19y1BN+KCVEZLmfAVyvTBJCLERsJuwnxSQSilNScrY7luMDZMu1EifSH5Qpdf0t+3HcZqriMHg1oYkgmK+SFePVwjStgnZ/jn884aviPQAIQN6KGlWmO2s/Zqhjdodo1EXkfBjWFOc9l06Uhu2769eQwLGQl51At7Vj5zdD4NUgG+Q2lBRiZyoU6zcIPE0CMkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org 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=KcDyy0lFnfoSGwq6lloN7P8w6T5PLJWuWDlrrrKn8wA=; b=k7K7yloW27cXK05Mur7WuRSmLw4QgBDMlywau0zKoxRia5BkK1zAHacv322jiJNQrCZjGGqX9ZZyZWW7d1JZXcBCrwxJVOUTHiNXtlqJbBuYJIUQ7UcMrQTQMZOTZwc6H/hsTBEV4fC/2+oXV5vdbdDYfdTeJ4FuAcNIMgqAY4SqUkxM4OZ6Kb7W5nrn1fN6c01mSkee1z2eCZqu7pqP47SO8ZzZhEvshDttbaKw8dEjHH/lQXFFURh9Z5W7QlkRDPL5kzluh+5hWDJh8f2nPh+0cWqRtXGjvPNN8Q7qdZIybaBk+A+zUdOkSnaW9rksySSqfOV++Bwfi+0u6Ocu4w== Received: from DS7PR03CA0160.namprd03.prod.outlook.com (2603:10b6:5:3b2::15) by BN6PR1201MB0177.namprd12.prod.outlook.com (2603:10b6:405:4d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Mon, 10 May 2021 16:16:54 +0000 Received: from DM6NAM11FT061.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b2:cafe::91) by DS7PR03CA0160.outlook.office365.com (2603:10b6:5:3b2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:16:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 DM6NAM11FT061.mail.protection.outlook.com (10.13.173.138) 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:16:54 +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:16:52 +0000 From: Xueming Li To: "Min Hu (Connor)" CC: Luca Boccassi , dpdk stable Date: Tue, 11 May 2021 00:01:26 +0800 Message-ID: <20210510160258.30982-137-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: 15c027a8-915b-4a50-24b2-08d913cf06cb X-MS-TrafficTypeDiagnostic: BN6PR1201MB0177: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RIvxxDJxjnZ02jLVFPH4xbMZK+uXrHGtoyUSsueeoSgLbSdH1qxFJhlB0Fb23DO2r3eaFOkWA45GlIhqrHnhPKI0wEvvSJs45FtNZCHHzBMMx1u6zY82/WAcj0gf1eLdXOS3Vzz24BV7yOC5wt+EOzf3SbPovCx8A/7M8rjrUK9b5K0V8JxWsfrtCBr4yAUlAcCvUvd9zHzoNwvRhcJfDeoXsB5ijzxpIuaz3uf95Q1BRpZBmJV92eJF0pL0pi/dwghLQy9m+kya62g2OZDzWXQe3PDZxQ+06utn2dM7XGsYkk3O0PQAutd+s6Kk5anoBXJTTVenZI00ZUo4GAT5W8LIDDtjf1sU7k4Ms4EERWmSRNJJCUmxgHItTZdaudtoEJOljTTSZtb3tM7suSJJzqeMny5SM6VtIUE5tbb3ZJarP/hJnwumlI1JVqvmvbvK22UsoB+D4DMUyWaA3OQ9QjDrYxGdjUO7VvziMYoVhpR7/oyoxn86ZbUXeJzHtcL9Qhnp0YRVuHbz6WGZZeBr8TxCatupRspZLvSxjbHofWzi+eFUuZcqWrprHco862qrClJ/fnXv4eMw7T9hYc6PddVz01Sq3wCIUL+NBBr++u55fFjhUHad9+H1QI83GkKzVPdaN4egGd5onMdMo0CZ3WNKxxzWR8MdzCVuMn7/kxlby1RRO5C7DgQGFKw/CQjAgZdhlV8nE/WuQ7aKmNMNMrK1UJy2wpCE5VlxQOHhKkiHuZhaAjqcKolWjW4bwKHoVA3sUjlth8WW3HhQ1rOVeg== 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)(136003)(396003)(376002)(39860400002)(346002)(36840700001)(46966006)(1076003)(26005)(186003)(4326008)(16526019)(356005)(82310400003)(82740400003)(316002)(36906005)(54906003)(47076005)(6286002)(8936002)(36756003)(55016002)(8676002)(83380400001)(966005)(2906002)(70586007)(70206006)(336012)(36860700001)(86362001)(478600001)(53546011)(7696005)(2616005)(6916009)(6666004)(7636003)(426003)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 16:16:54.1521 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15c027a8-915b-4a50-24b2-08d913cf06cb 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: DM6NAM11FT061.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0177 Subject: [dpdk-stable] patch 'net/hns3: fix MTU config complexity' 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/fdd1a587627de72b4366222437191b0fda56f9c1 Thanks. Xueming Li --- >From fdd1a587627de72b4366222437191b0fda56f9c1 Mon Sep 17 00:00:00 2001 From: "Min Hu (Connor)" Date: Thu, 1 Apr 2021 21:38:03 +0800 Subject: [PATCH] net/hns3: fix MTU config complexity Cc: Luca Boccassi [ upstream commit d81d78eb86d50732ba98a8b255d19c2f6292521c ] This patch fixed cyclomatic complexity about MTU in device configure process. Fixes: 1f5ca0b460cd ("net/hns3: support some device operations") Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev.c | 62 +++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index ba26230829..a4c6440768 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2302,6 +2302,41 @@ hns3_init_ring_with_vector(struct hns3_hw *hw) return 0; } +static int +hns3_refresh_mtu(struct rte_eth_dev *dev, struct rte_eth_conf *conf) +{ + struct hns3_adapter *hns = dev->data->dev_private; + struct hns3_hw *hw = &hns->hw; + uint32_t max_rx_pkt_len; + uint16_t mtu; + int ret; + + if (!(conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME)) + return 0; + + /* + * If jumbo frames are enabled, MTU needs to be refreshed + * according to the maximum RX packet length. + */ + max_rx_pkt_len = conf->rxmode.max_rx_pkt_len; + if (max_rx_pkt_len > HNS3_MAX_FRAME_LEN || + max_rx_pkt_len <= HNS3_DEFAULT_FRAME_LEN) { + hns3_err(hw, "maximum Rx packet length must be greater than %u " + "and no more than %u when jumbo frame enabled.", + (uint16_t)HNS3_DEFAULT_FRAME_LEN, + (uint16_t)HNS3_MAX_FRAME_LEN); + return -EINVAL; + } + + mtu = (uint16_t)HNS3_PKTLEN_TO_MTU(max_rx_pkt_len); + ret = hns3_dev_mtu_set(dev, mtu); + if (ret) + return ret; + dev->data->mtu = mtu; + + return 0; +} + static int hns3_dev_configure(struct rte_eth_dev *dev) { @@ -2313,8 +2348,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) uint16_t nb_rx_q = dev->data->nb_rx_queues; uint16_t nb_tx_q = dev->data->nb_tx_queues; struct rte_eth_rss_conf rss_conf; - uint32_t max_rx_pkt_len; - uint16_t mtu; bool gro_en; int ret; @@ -2367,28 +2400,9 @@ hns3_dev_configure(struct rte_eth_dev *dev) goto cfg_err; } - /* - * If jumbo frames are enabled, MTU needs to be refreshed - * according to the maximum RX packet length. - */ - if (conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { - max_rx_pkt_len = conf->rxmode.max_rx_pkt_len; - if (max_rx_pkt_len > HNS3_MAX_FRAME_LEN || - max_rx_pkt_len <= HNS3_DEFAULT_FRAME_LEN) { - hns3_err(hw, "maximum Rx packet length must be greater " - "than %u and less than %u when jumbo frame enabled.", - (uint16_t)HNS3_DEFAULT_FRAME_LEN, - (uint16_t)HNS3_MAX_FRAME_LEN); - ret = -EINVAL; - goto cfg_err; - } - - mtu = (uint16_t)HNS3_PKTLEN_TO_MTU(max_rx_pkt_len); - ret = hns3_dev_mtu_set(dev, mtu); - if (ret) - goto cfg_err; - dev->data->mtu = mtu; - } + ret = hns3_refresh_mtu(dev, conf); + if (ret) + goto cfg_err; ret = hns3_dev_configure_vlan(dev); if (ret) -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-10 23:59:30.130931400 +0800 +++ 0138-net-hns3-fix-MTU-config-complexity.patch 2021-05-10 23:59:26.530000000 +0800 @@ -1 +1 @@ -From d81d78eb86d50732ba98a8b255d19c2f6292521c Mon Sep 17 00:00:00 2001 +From fdd1a587627de72b4366222437191b0fda56f9c1 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit d81d78eb86d50732ba98a8b255d19c2f6292521c ] @@ -10 +12,0 @@ -Cc: stable@dpdk.org @@ -18 +20 @@ -index 9c718082b0..b07996928b 100644 +index ba26230829..a4c6440768 100644 @@ -21 +23 @@ -@@ -2372,6 +2372,41 @@ hns3_init_ring_with_vector(struct hns3_hw *hw) +@@ -2302,6 +2302,41 @@ hns3_init_ring_with_vector(struct hns3_hw *hw) @@ -63 +65 @@ -@@ -2382,8 +2417,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) +@@ -2313,8 +2348,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) @@ -72 +74 @@ -@@ -2431,28 +2464,9 @@ hns3_dev_configure(struct rte_eth_dev *dev) +@@ -2367,28 +2400,9 @@ hns3_dev_configure(struct rte_eth_dev *dev)