From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 85CEEA0527 for ; Mon, 9 Nov 2020 19:44:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7EB646A6F; Mon, 9 Nov 2020 19:44:54 +0100 (CET) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by dpdk.org (Postfix) with ESMTP id 1008A6A6F for ; Mon, 9 Nov 2020 19:44:53 +0100 (CET) Received: by mail-wr1-f51.google.com with SMTP id b8so9881637wrn.0 for ; Mon, 09 Nov 2020 10:44:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OWM3urgzx67rOpyS6JO1wIEF60JF38duZkGmfV3Byng=; b=Nw9kHkzJa6b694FfU40luFWWUol9C9ZldMVwofGpdnUlAgNfurc/jPZ+BBBof5xYuC dpR8Y58mhJ1GpuG52D8hyOYkUPR3MHqsctTRkNBlkJeaQumvHIsRaRAwQsEvOWPJp0kI xSw+YpuN7JyuVHJq8B+7KPQEOKa8y4+68N9qwWIrL6ITOvPq2bZcVKhfS2kIXLtR1QVd vuZZb1zAeKV6wnBYy6++wY7yHvY7j9vE8Fh967jPFmHnDVGE01FxfGPeRgH0TguP22PZ A+66si6uBNMKEwyRye2fHfCA9mKzSDvMPYHxw6Ky4NzJY1QnExO3q3OkGBHqw917tQba s04Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OWM3urgzx67rOpyS6JO1wIEF60JF38duZkGmfV3Byng=; b=na7+/wkoAyyTCiViQRF/V730BON+pMKXCcNcaQ2/8buCrlHydrzS2VZtScVn3mUeS4 xSKsbS3xi8Ex2dpvyY20UeiLu0FQrTjXuyzV86I9Asw2A+cP6o4ihvslzE3Bi3ASeyO7 6Z4Gm5ljI72ERe+NMgMLnsRven/M2P7ol0aWZT7bWTgPTv3m1gaeTylwAW7nLmZMpyX3 VwcawLfv+fOEeSYNuo8rgGXpWNX5URkxzVR6wSxHaOmVRwFEBJcg6zYAeelNERSQs8x7 34HDsUUX9vs5z+RVfqtN08Namr30pOKCt6rKJW/Y6aHcEOeqmgLo+V3jDIy8rq+BP5sf wY6A== X-Gm-Message-State: AOAM530FSzxyDD4f47HclAyr4eLoyRB/YwIyOX0kwKz6IVEMsIdQi2cC Zbcpxk3YIPB4wa+WMjf0PBZMqxeSh5Dv9kXe X-Google-Smtp-Source: ABdhPJw61RlA+aoSMY8kt7bqNPghDx+7eCRPhti1vzRuCqILEppKc9SR6Kdb9r8qovRYVCWDlEvhcg== X-Received: by 2002:a05:6000:1050:: with SMTP id c16mr19555744wrx.400.1604947491804; Mon, 09 Nov 2020 10:44:51 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id v8sm308589wmg.28.2020.11.09.10.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 10:44:50 -0800 (PST) From: luca.boccassi@gmail.com To: Huisong Li Cc: Lijun Ou , dpdk stable Date: Mon, 9 Nov 2020 18:40:51 +0000 Message-Id: <20201109184111.3463090-63-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201109184111.3463090-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-207-luca.boccassi@gmail.com> <20201109184111.3463090-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: fix RSS max queue id allowed in multi-TC' has been queued to stable release 19.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 19.11.6 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/11/20. 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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/8d16746bf8be2e188090f9342de4a206bffe704e Thanks. Luca Boccassi --- >From 8d16746bf8be2e188090f9342de4a206bffe704e Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Thu, 29 Oct 2020 20:51:51 +0800 Subject: [PATCH] net/hns3: fix RSS max queue id allowed in multi-TC [ upstream commit 5e76dfc33ff4e0523e52ba6b7d815640a3379140 ] Currently, driver uses the maximum number of queues configured by user as the maximum queue id that can be specified by the RSS rule or the reta_update api. It is unreasonable and may trigger an incorrect behavior in the multi-TC scenario. The driver must ensure that the queue id configured in the redirection table must be within the range of the number of queues allocated to a TC. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Signed-off-by: Huisong Li Signed-off-by: Lijun Ou --- drivers/net/hns3/hns3_flow.c | 45 +++++++++++++++--------------------- drivers/net/hns3/hns3_rss.c | 13 +++++------ 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 21dd126ffe..bd2d4ab3bc 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1272,13 +1272,18 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, act, "no valid queues"); } + if (rss->queue_num > RTE_DIM(rss_conf->queue)) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, + "queue number configured exceeds " + "queue buffer size driver supported"); + for (n = 0; n < rss->queue_num; n++) { - if (rss->queue[n] < dev->data->nb_rx_queues) + if (rss->queue[n] < hw->alloc_rss_size) continue; return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION_CONF, - act, - "queue id > max number of queues"); + RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, + "queue id must be less than queue number allocated to a TC"); } if (!(rss->types & HNS3_ETH_RSS_SUPPORT) && rss->types) @@ -1299,10 +1304,6 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, "RSS hash key must be exactly 40 bytes"); - if (rss->queue_num > RTE_DIM(rss_conf->queue)) - return rte_flow_error_set(error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, - "too many queues for RSS context"); act_index++; @@ -1338,9 +1339,8 @@ hns3_disable_rss(struct hns3_hw *hw) static void hns3_parse_rss_key(struct hns3_hw *hw, struct rte_flow_action_rss *rss_conf) { - if (rss_conf->key == NULL || - rss_conf->key_len < HNS3_RSS_KEY_SIZE) { - hns3_info(hw, "Default RSS hash key to be set"); + if (rss_conf->key == NULL || rss_conf->key_len < HNS3_RSS_KEY_SIZE) { + hns3_warn(hw, "Default RSS hash key to be set"); rss_conf->key = hns3_hash_key; rss_conf->key_len = HNS3_RSS_KEY_SIZE; } @@ -1381,10 +1381,8 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) struct hns3_rss_tuple_cfg *tuple; int ret; - /* Parse hash key */ hns3_parse_rss_key(hw, rss_config); - /* Parse hash algorithm */ ret = hns3_parse_rss_algorithm(hw, &rss_config->func, &hash_algo); if (ret) return ret; @@ -1412,21 +1410,19 @@ hns3_update_indir_table(struct rte_eth_dev *dev, struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; uint8_t indir_tbl[HNS3_RSS_IND_TBL_SIZE]; - uint16_t j, allow_rss_queues; + uint16_t j; uint8_t queue_id; uint32_t i; - allow_rss_queues = RTE_MIN(dev->data->nb_rx_queues, hw->rss_size_max); /* Fill in redirection table */ memcpy(indir_tbl, hw->rss_info.rss_indirection_tbl, HNS3_RSS_IND_TBL_SIZE); for (i = 0, j = 0; i < HNS3_RSS_IND_TBL_SIZE; i++, j++) { j %= num; - if (conf->queue[j] >= allow_rss_queues) { - hns3_err(hw, "Invalid queue id(%u) to be set in " - "redirection table, max number of rss " - "queues: %u", conf->queue[j], - allow_rss_queues); + if (conf->queue[j] >= hw->alloc_rss_size) { + hns3_err(hw, "queue id(%u) set to redirection table " + "exceeds queue number(%u) allocated to a TC.", + conf->queue[j], hw->alloc_rss_size); return -EINVAL; } queue_id = conf->queue[j]; @@ -1513,11 +1509,8 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, return 0; } - /* Get rx queues num */ - num = dev->data->nb_rx_queues; - /* Set rx queues to use */ - num = RTE_MIN(num, rss_flow_conf.queue_num); + num = RTE_MIN(dev->data->nb_rx_queues, rss_flow_conf.queue_num); if (rss_flow_conf.queue_num > num) hns3_warn(hw, "Config queue numbers %u are beyond the scope of truncated", rss_flow_conf.queue_num); @@ -1554,7 +1547,6 @@ rss_config_err: return ret; } -/* Remove the rss filter */ static int hns3_clear_rss_filter(struct rte_eth_dev *dev) { @@ -1590,7 +1582,6 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) return ret; } -/* Restore the rss filter */ int hns3_restore_rss_filter(struct rte_eth_dev *dev) { @@ -1612,7 +1603,6 @@ hns3_flow_parse_rss(struct rte_eth_dev *dev, struct hns3_hw *hw = &hns->hw; bool ret; - /* Action rss same */ ret = hns3_action_rss_same(&hw->rss_info.conf, &conf->conf); if (ret) { hns3_err(hw, "Enter duplicate RSS configuration : %d", ret); @@ -1770,6 +1760,7 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, ret = -ENOMEM; goto err_fdir; } + memcpy(&fdir_rule_ptr->fdir_conf, &fdir_rule, sizeof(struct hns3_fdir_rule)); TAILQ_INSERT_TAIL(&process_list->fdir_list, diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index a6cab29c93..a63d6ef725 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -358,7 +358,7 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, struct hns3_rss_conf *rss_cfg = &hw->rss_info; uint16_t i, indir_size = HNS3_RSS_IND_TBL_SIZE; /* Table size is 512 */ uint8_t indirection_tbl[HNS3_RSS_IND_TBL_SIZE]; - uint16_t idx, shift, allow_rss_queues; + uint16_t idx, shift; int ret; if (reta_size != indir_size || reta_size > ETH_RSS_RETA_SIZE_512) { @@ -370,16 +370,15 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, rte_spinlock_lock(&hw->lock); memcpy(indirection_tbl, rss_cfg->rss_indirection_tbl, HNS3_RSS_IND_TBL_SIZE); - allow_rss_queues = RTE_MIN(dev->data->nb_rx_queues, hw->rss_size_max); for (i = 0; i < reta_size; i++) { idx = i / RTE_RETA_GROUP_SIZE; shift = i % RTE_RETA_GROUP_SIZE; - if (reta_conf[idx].reta[shift] >= allow_rss_queues) { + if (reta_conf[idx].reta[shift] >= hw->alloc_rss_size) { rte_spinlock_unlock(&hw->lock); - hns3_err(hw, "Invalid queue id(%u) to be set in " - "redirection table, max number of rss " - "queues: %u", reta_conf[idx].reta[shift], - allow_rss_queues); + hns3_err(hw, "queue id(%u) set to redirection table " + "exceeds queue number(%u) allocated to a TC", + reta_conf[idx].reta[shift], + hw->alloc_rss_size); return -EINVAL; } -- 2.27.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-09 18:40:13.569614065 +0000 +++ 0063-net-hns3-fix-RSS-max-queue-id-allowed-in-multi-TC.patch 2020-11-09 18:40:11.199312340 +0000 @@ -1 +1 @@ -From 5e76dfc33ff4e0523e52ba6b7d815640a3379140 Mon Sep 17 00:00:00 2001 +From 8d16746bf8be2e188090f9342de4a206bffe704e Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5e76dfc33ff4e0523e52ba6b7d815640a3379140 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index 73f5e8e37b..0d5dd1a7af 100644 +index 21dd126ffe..bd2d4ab3bc 100644 @@ -27 +28 @@ -@@ -1367,13 +1367,18 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, +@@ -1272,13 +1272,18 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, @@ -50 +51 @@ -@@ -1394,10 +1399,6 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, +@@ -1299,10 +1304,6 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, @@ -59,3 +60,3 @@ - /* - * For Kunpeng920 and Kunpeng930 NIC hardware, it is not supported to -@@ -1450,9 +1451,8 @@ hns3_disable_rss(struct hns3_hw *hw) + act_index++; + +@@ -1338,9 +1339,8 @@ hns3_disable_rss(struct hns3_hw *hw) @@ -73 +74 @@ -@@ -1493,10 +1493,8 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) +@@ -1381,10 +1381,8 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) @@ -81,2 +82 @@ - ret = hns3_parse_rss_algorithm(hw, &rss_config->func, - &hw->rss_info.hash_algo); + ret = hns3_parse_rss_algorithm(hw, &rss_config->func, &hash_algo); @@ -84 +84,2 @@ -@@ -1525,20 +1523,18 @@ hns3_update_indir_table(struct rte_eth_dev *dev, + return ret; +@@ -1412,21 +1410,19 @@ hns3_update_indir_table(struct rte_eth_dev *dev, @@ -87 +88 @@ - uint16_t indir_tbl[HNS3_RSS_IND_TBL_SIZE]; + uint8_t indir_tbl[HNS3_RSS_IND_TBL_SIZE]; @@ -89,0 +91 @@ + uint8_t queue_id; @@ -95 +97 @@ - sizeof(hw->rss_info.rss_indirection_tbl)); + HNS3_RSS_IND_TBL_SIZE); @@ -109,2 +111,2 @@ - indir_tbl[i] = conf->queue[j]; -@@ -1607,11 +1603,8 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, + queue_id = conf->queue[j]; +@@ -1513,11 +1509,8 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, @@ -123 +125 @@ -@@ -1648,7 +1641,6 @@ rss_config_err: +@@ -1554,7 +1547,6 @@ rss_config_err: @@ -131 +133 @@ -@@ -1684,7 +1676,6 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) +@@ -1590,7 +1582,6 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) @@ -139 +141 @@ -@@ -1706,7 +1697,6 @@ hns3_flow_parse_rss(struct rte_eth_dev *dev, +@@ -1612,7 +1603,6 @@ hns3_flow_parse_rss(struct rte_eth_dev *dev, @@ -147 +149 @@ -@@ -1864,6 +1854,7 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -1770,6 +1760,7 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -156 +158 @@ -index 2efd410b4d..a4e552b221 100644 +index a6cab29c93..a63d6ef725 100644 @@ -159 +161 @@ -@@ -510,7 +510,7 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, +@@ -358,7 +358,7 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, @@ -162 +164 @@ - uint16_t indirection_tbl[HNS3_RSS_IND_TBL_SIZE]; + uint8_t indirection_tbl[HNS3_RSS_IND_TBL_SIZE]; @@ -168 +170 @@ -@@ -522,16 +522,15 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, +@@ -370,16 +370,15 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, @@ -171 +173 @@ - sizeof(rss_cfg->rss_indirection_tbl)); + HNS3_RSS_IND_TBL_SIZE);