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 7DA6CA034F for ; Wed, 10 Nov 2021 07:47:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7732840142; Wed, 10 Nov 2021 07:47:41 +0100 (CET) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2057.outbound.protection.outlook.com [40.107.102.57]) by mails.dpdk.org (Postfix) with ESMTP id 7784A40142 for ; Wed, 10 Nov 2021 07:47:40 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PzOE3W6s/omSXd2z5eBV16h0cze43kHOlwI5pDbtpKMyjfEAPjG0uvzbZO7CAqBCNGlE5vq5cJAPhuOBYaJu6cvALUGC6VMEwUkTEjQBf/STZ70qTh35Gz0aBde5vtbqxFpAAleUMsZFNm0Az1ujNcX0hdfdhqh/neaOledstpLfEE8KzHQNur5HCwrJQZBbo9HdfGlvknsPFyX+flaA7qF6QW1m2XleKSKlTL2yYwphjsEhcNI+su0cnSlaxyp+GIm4UZb8YmCosxxKhwFgcEPFMhyHX7Sgu8CJkaCVRfAZCo/u+jLS0fGNHmvGPXw9/PxHlrsUUyztrNPKMCrosA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gCiBjAjq8Nlt+8DqW8xfUz5mSDgAk2OLWe0ozYK2kDM=; b=KvjLyzlHIAtbVUw3HNc30A1SLpGJ8qvwPfb5Mx7DAFB5FE7lRXgjbG1/NkIH92mjmS7foN8Xp0UXGF3NPw6eRrxS2GFcHlzldlb624zd5FL8DYVcltbWvEJRnyUJUYS59dg5oh/LpSkJg7AH8XuAt5MIgKz416FziCri48M/qk4BZ2Jy4NNrUnCgAuu/y13H7ccTKuUU5fEvnMaz2WTihInHeAjysymWC1wdqJjfvRIw0RlT19xmNLUzDSYi5hSmPhr4lqPcnVnM6muu7YOjc9c+fY3hW7fZgDtSQ6pDY5T7ua/oJjnXSmkC4MzwsqrIrfcnRdtQ6koKi8fhrVwqOg== 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=quarantine sp=quarantine 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=gCiBjAjq8Nlt+8DqW8xfUz5mSDgAk2OLWe0ozYK2kDM=; b=tVVXOy7GW8teAWkL6Y9DcrjkLFPAXPWoocP3VHQgZxC1MwErDrp8RrxHwZEwrpezQB4I7vmu4zyhZS+xQXGE/UvKx5NCbSkUMQMo6thDe2xXTLj8TvPy7kSuSl1dwXa9mAxF2KMEsrjR7RxQWoNb9rKANFWpkny1UYx8AwoWDNBWQs5zzzRt+//3GBlrCpjpc/g3/TWnKxqPwktPfxw0vscJWBs7lHoPXlzvmT+gmxPerUKya7H9ew6c7/wkL3yIpRLXl5e9Uk1KeSda2cfizeQy0z2XagpPpVTCm4fz48h9dd1Fn2+wZ+4rNztz8mRYNskr1FFBpPQAejIcWivAKw== Received: from BN9PR03CA0413.namprd03.prod.outlook.com (2603:10b6:408:111::28) by DM6PR12MB3211.namprd12.prod.outlook.com (2603:10b6:5:15c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.15; Wed, 10 Nov 2021 06:47:38 +0000 Received: from BN8NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::1) by BN9PR03CA0413.outlook.office365.com (2603:10b6:408:111::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Wed, 10 Nov 2021 06:47:38 +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 BN8NAM11FT017.mail.protection.outlook.com (10.13.177.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 06:47:38 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:47:36 +0000 From: Xueming Li To: Chengchang Tang CC: Luca Boccassi , Min Hu , dpdk stable Date: Wed, 10 Nov 2021 14:30:20 +0800 Message-ID: <20211110063216.2744012-137-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 696f7258-696f-4bda-9c9d-08d9a415fc79 X-MS-TrafficTypeDiagnostic: DM6PR12MB3211: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wEP4Ib4Uk9jTCxsvkW6vNR/Iam4FC05xYPOzilIKgbHiKSnAfN/oYeUiwdGiZzE7AoaWTtcJwY293DQKaDUaAxrLZ4u6Ns3VToPM6JTIiDQJZEiQI2rEBcywOD3FWCV7naagfbqCpuC/rkwcqfOxRnZ4kt11bOPGYZ0ApSEXEB5wqru+6nJX45s10jMasjqBNhEo72WsGR4SRtFbC0U8DcfWqGyYHMWhUts5pQyFogpwzWMbDprpQGPfTbcbo/ZSkt2FwDFEa2Os2Vb1QdqIflyXtZFgISNORNv+9o7z01NsMynIPTKec7OAhkiAah6SOzBw0c8yYBgsIh+F8oUGTyETnvux/alMQIG7rgCANO8GrNqio7eqwRopilujZxzHKFZKSYdurvk0K1Palh+U8KmI1P2JrQmZXlpMIdfVxZGcd5Y3sEk0ajkKC3T9vw+BjI3QAp3e43g7jd0klsvHP4V4IzOMONRENCvCm2mTMKTUl0SXi0Ame+ieE1n2MDXX7/KGaCTRZQEdvYEatOr1CS8B03KIa/eigQaeJ8Y2Jm9gmsd6UYE546flAeG+gV8jhuNLlp/rrNxH6pZWNJJPzCrlxjcEgP47xLWjJUlJsygCudrgip3H7N47LnmRJ42vn0viQjf7wjah4VFXVSPq+hyeMi1lUcBnn8inYQ97se7Mp7OcwMX6VK0OPxbZ08P8rnsA+Or2JLKrrG1dr7IBQsy583exK8TNLmgEffk1LttGU6WKSNNhImFXZloHo8vmlENpo11aj0Fs1HGsSXdRqPFRWSheWmzGUodbJHR3OonirUIhDxSD9IizkyxNW44LIytkESohYPKEeXqiqk6rQA== 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)(46966006)(36840700001)(356005)(8676002)(4001150100001)(47076005)(6286002)(7636003)(36756003)(40140700001)(5660300002)(2906002)(70206006)(53546011)(83380400001)(2616005)(36860700001)(70586007)(1076003)(6666004)(8936002)(6916009)(55016002)(16526019)(82310400003)(508600001)(54906003)(966005)(336012)(4326008)(186003)(86362001)(7696005)(26005)(36906005)(316002)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:47:38.5073 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 696f7258-696f-4bda-9c9d-08d9a415fc79 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: BN8NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3211 Subject: [dpdk-stable] patch 'net/bonding: fix RSS key length' has been queued to stable release 20.11.4 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.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/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/709c5b655fe8e51cdca93ea063a58099c8996932 Thanks. Xueming Li --- >From 709c5b655fe8e51cdca93ea063a58099c8996932 Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Wed, 22 Sep 2021 15:09:13 +0800 Subject: [PATCH] net/bonding: fix RSS key length Cc: Xueming Li [ upstream commit 6b1a001ec54635d63ed3f91eaef5164abee7a089 ] Currently the hash_key_size information has not been set. So, apps can not get the key size from dev_info(), this make some problem. e.g, in testpmd, the hash_key_size will be checked before configure or get the hash key: testpmd> show port 4 rss-hash dev_info did not provide a valid hash key size testpmd> show port 4 rss-hash key dev_info did not provide a valid hash key size testpmd> port config 4 rss-hash-key ipv4 (hash key) dev_info did not provide a valid hash key size In this patch, the meaning of rss_key_len has been modified. It only indicated the length of the configured hash key before. Therefore, its value depends on the user's configuration. This seems unreasonable. And now, it indicates the minimum hash key length required by the bonded device. Its value will be the shortest hash key among all slave drivers. Fixes: 734ce47f71e0 ("bonding: support RSS dynamic configuration") Signed-off-by: Chengchang Tang Signed-off-by: Min Hu (Connor) --- drivers/net/bonding/rte_eth_bond_api.c | 6 ++++ drivers/net/bonding/rte_eth_bond_pmd.c | 44 ++++++++++++++++---------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 44775f61e5..c751a1242d 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -290,6 +290,7 @@ eth_bond_slave_inherit_dev_info_rx_first(struct bond_dev_private *internals, struct rte_eth_rxconf *rxconf_i = &internals->default_rxconf; internals->reta_size = di->reta_size; + internals->rss_key_len = di->hash_key_size; /* Inherit Rx offload capabilities from the first slave device */ internals->rx_offload_capa = di->rx_offload_capa; @@ -385,6 +386,11 @@ eth_bond_slave_inherit_dev_info_rx_next(struct bond_dev_private *internals, */ if (internals->reta_size > di->reta_size) internals->reta_size = di->reta_size; + if (internals->rss_key_len > di->hash_key_size) { + RTE_BOND_LOG(WARNING, "slave has different rss key size, " + "configuring rss may fail"); + internals->rss_key_len = di->hash_key_size; + } if (!internals->max_rx_pktlen && di->max_rx_pktlen < internals->candidate_max_rx_pktlen) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index baa01b17e5..fb430be549 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1705,14 +1705,11 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, /* If RSS is enabled for bonding, try to enable it for slaves */ if (bonded_eth_dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) { - if (internals->rss_key_len != 0) { - slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len = + /* rss_key won't be empty if RSS is configured in bonded dev */ + slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len = internals->rss_key_len; - slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key = + slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key = internals->rss_key; - } else { - slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL; - } slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf = bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf; @@ -2244,6 +2241,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads; dev_info->reta_size = internals->reta_size; + dev_info->hash_key_size = internals->rss_key_len; return 0; } @@ -3033,13 +3031,15 @@ bond_ethdev_rss_hash_update(struct rte_eth_dev *dev, if (bond_rss_conf.rss_hf != 0) dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf = bond_rss_conf.rss_hf; - if (bond_rss_conf.rss_key && bond_rss_conf.rss_key_len < - sizeof(internals->rss_key)) { - if (bond_rss_conf.rss_key_len == 0) - bond_rss_conf.rss_key_len = 40; - internals->rss_key_len = bond_rss_conf.rss_key_len; + if (bond_rss_conf.rss_key) { + if (bond_rss_conf.rss_key_len < internals->rss_key_len) + return -EINVAL; + else if (bond_rss_conf.rss_key_len > internals->rss_key_len) + RTE_BOND_LOG(WARNING, "rss_key will be truncated"); + memcpy(internals->rss_key, bond_rss_conf.rss_key, internals->rss_key_len); + bond_rss_conf.rss_key_len = internals->rss_key_len; } for (i = 0; i < internals->slave_count; i++) { @@ -3502,14 +3502,24 @@ bond_ethdev_configure(struct rte_eth_dev *dev) * Fall back to default RSS key if the key is not specified */ if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS) { - if (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key != NULL) { - internals->rss_key_len = - dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len; - memcpy(internals->rss_key, - dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key, + struct rte_eth_rss_conf *rss_conf = + &dev->data->dev_conf.rx_adv_conf.rss_conf; + if (rss_conf->rss_key != NULL) { + if (internals->rss_key_len > rss_conf->rss_key_len) { + RTE_BOND_LOG(ERR, "Invalid rss key length(%u)", + rss_conf->rss_key_len); + return -EINVAL; + } + + memcpy(internals->rss_key, rss_conf->rss_key, internals->rss_key_len); } else { - internals->rss_key_len = sizeof(default_rss_key); + if (internals->rss_key_len > sizeof(default_rss_key)) { + RTE_BOND_LOG(ERR, + "There is no suitable default hash key"); + return -EINVAL; + } + memcpy(internals->rss_key, default_rss_key, internals->rss_key_len); } -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:07.982241182 +0800 +++ 0136-net-bonding-fix-RSS-key-length.patch 2021-11-10 14:17:01.900745845 +0800 @@ -1 +1 @@ -From 6b1a001ec54635d63ed3f91eaef5164abee7a089 Mon Sep 17 00:00:00 2001 +From 709c5b655fe8e51cdca93ea063a58099c8996932 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 6b1a001ec54635d63ed3f91eaef5164abee7a089 ] @@ -26 +28,0 @@ -Cc: stable@dpdk.org @@ -36 +38 @@ -index eb8d15d160..5140ef14c2 100644 +index 44775f61e5..c751a1242d 100644 @@ -60 +62 @@ -index 542c6633b5..4c604d6aec 100644 +index baa01b17e5..fb430be549 100644 @@ -63 +65 @@ -@@ -1701,14 +1701,11 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, +@@ -1705,14 +1705,11 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, @@ -81 +83 @@ -@@ -2251,6 +2248,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) +@@ -2244,6 +2241,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) @@ -89 +91 @@ -@@ -3044,13 +3042,15 @@ bond_ethdev_rss_hash_update(struct rte_eth_dev *dev, +@@ -3033,13 +3031,15 @@ bond_ethdev_rss_hash_update(struct rte_eth_dev *dev, @@ -110 +112 @@ -@@ -3510,14 +3510,24 @@ bond_ethdev_configure(struct rte_eth_dev *dev) +@@ -3502,14 +3502,24 @@ bond_ethdev_configure(struct rte_eth_dev *dev)