From patchwork Mon Feb 28 03:21:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 108377 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C60C7A0350; Mon, 28 Feb 2022 04:22:11 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9492541157; Mon, 28 Feb 2022 04:22:02 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id F1CBE4068A for ; Mon, 28 Feb 2022 04:21:57 +0100 (CET) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4K6QZ74Tm4z9sN8; Mon, 28 Feb 2022 11:18:23 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.21; Mon, 28 Feb 2022 11:21:55 +0800 From: "Min Hu (Connor)" To: CC: , Subject: [PATCH 1/6] net/hns3: remove duplicate macro definition Date: Mon, 28 Feb 2022 11:21:41 +0800 Message-ID: <20220228032146.37407-2-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220228032146.37407-1-humin29@huawei.com> References: <20220228032146.37407-1-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Jie Hai This patch fixes duplicate macro definition of HNS3_RSS_CFG_TBL_SIZE. Fixes: 737f30e1c3ab ("net/hns3: support command interface with firmware") Cc: stable@dpdk.org Signed-off-by: Jie Hai Acked-by: Min Hu (Connor) --- drivers/net/hns3/hns3_cmd.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h index 81bc9e9d98..f9addc6069 100644 --- a/drivers/net/hns3/hns3_cmd.h +++ b/drivers/net/hns3/hns3_cmd.h @@ -603,7 +603,6 @@ struct hns3_cfg_gro_status_cmd { #define HNS3_RSS_HASH_KEY_OFFSET_B 4 -#define HNS3_RSS_CFG_TBL_SIZE 16 #define HNS3_RSS_HASH_KEY_NUM 16 /* Configure the algorithm mode and Hash Key, opcode:0x0D01 */ struct hns3_rss_generic_config_cmd { From patchwork Mon Feb 28 03:21:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 108380 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A34C8A0350; Mon, 28 Feb 2022 04:22:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 406D24116D; Mon, 28 Feb 2022 04:22:05 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 01E384068C for ; Mon, 28 Feb 2022 04:21:57 +0100 (CET) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4K6QZ75p1Qz9sNG; Mon, 28 Feb 2022 11:18:23 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.21; Mon, 28 Feb 2022 11:21:55 +0800 From: "Min Hu (Connor)" To: CC: , Subject: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS behavior Date: Mon, 28 Feb 2022 11:21:42 +0800 Message-ID: <20220228032146.37407-3-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220228032146.37407-1-humin29@huawei.com> References: <20220228032146.37407-1-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in dev_configure phase. However, if this flag isn't set, RSS can be enabled through the ethdev ops and rte_flow API. This behavior is contrary to each other. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Cc: stable@dpdk.org Signed-off-by: Huisong Li --- drivers/net/hns3/hns3_flow.c | 5 +++++ drivers/net/hns3/hns3_rss.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index aba07aaa6f..46371c4190 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1371,6 +1371,7 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, const struct rte_flow_action *actions, struct rte_flow_error *error) { + enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode; struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; struct hns3_rss_conf *rss_conf = &hw->rss_info; @@ -1426,6 +1427,10 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, RTE_FLOW_ERROR_TYPE_ACTION_CONF, &rss->types, "input RSS types are not supported"); + if (!((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + act, "multi-queue RSS isn't enabled"); act_index++; diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index 1782d63883..e0eab05fb9 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -399,6 +399,7 @@ int hns3_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { + enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode; struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; struct hns3_rss_tuple_cfg *tuple = &hw->rss_info.rss_tuple_sets; @@ -408,6 +409,11 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, uint8_t *key = rss_conf->rss_key; int ret; + if (!((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) { + hns3_err(hw, "multi-queue RSS isn't enabled."); + return -EOPNOTSUPP; + } + if (hw->rss_dis_flag) return -EINVAL; @@ -498,6 +504,7 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) { + enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode; struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; struct hns3_rss_conf *rss_cfg = &hw->rss_info; @@ -506,6 +513,11 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, uint16_t i; int ret; + if (!((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) { + hns3_err(hw, "multi-queue RSS isn't enabled."); + return -EOPNOTSUPP; + } + if (reta_size != hw->rss_ind_tbl_size) { hns3_err(hw, "The size of hash lookup table configured (%u)" "doesn't match the number hardware can supported" From patchwork Mon Feb 28 03:21:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 108381 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B07B4A0350; Mon, 28 Feb 2022 04:22:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EA0F41176; Mon, 28 Feb 2022 04:22:06 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 08A5D40DDB for ; Mon, 28 Feb 2022 04:21:57 +0100 (CET) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4K6Qcm2QdFzdZNl; Mon, 28 Feb 2022 11:20:40 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.21; Mon, 28 Feb 2022 11:21:55 +0800 From: "Min Hu (Connor)" To: CC: , Subject: [PATCH 3/6] net/hns3: remove unnecessary RSS switch Date: Mon, 28 Feb 2022 11:21:43 +0800 Message-ID: <20220228032146.37407-4-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220228032146.37407-1-humin29@huawei.com> References: <20220228032146.37407-1-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li Whether the RSS is enabled depends on RTE_ETH_MQ_RX_RSS_FLAG and packet tuple are enabled. So the RSS switch is unnecessary. Fixes: 5e782bc2570c ("net/hns3: fix configuring RSS hash when rules are flushed") Fixes: fd8196838763 ("net/hns3: fix configuring device with RSS enabled") Cc: stable@dpdk.org Signed-off-by: Huisong Li --- drivers/net/hns3/hns3_ethdev.c | 2 -- drivers/net/hns3/hns3_ethdev.h | 1 - drivers/net/hns3/hns3_ethdev_vf.c | 2 -- drivers/net/hns3/hns3_flow.c | 1 - drivers/net/hns3/hns3_rss.c | 3 --- 5 files changed, 9 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 4e089e682f..24ae5ef929 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2019,7 +2019,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) if ((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) { conf->rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH; rss_conf = conf->rx_adv_conf.rss_conf; - hw->rss_dis_flag = false; ret = hns3_dev_rss_hash_update(dev, &rss_conf); if (ret) goto cfg_err; @@ -2825,7 +2824,6 @@ hns3_get_board_configuration(struct hns3_hw *hw) hw->mac.media_type = cfg.media_type; hw->rss_size_max = cfg.rss_size_max; - hw->rss_dis_flag = false; memcpy(hw->mac.mac_addr, cfg.mac_addr, RTE_ETHER_ADDR_LEN); hw->mac.phy_addr = cfg.phy_addr; hw->dcb_info.num_pg = 1; diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 9a0fa09b57..a00f841543 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -520,7 +520,6 @@ struct hns3_hw { /* The configuration info of RSS */ struct hns3_rss_conf rss_info; - bool rss_dis_flag; /* disable rss flag. true: disable, false: enable */ uint16_t rss_ind_tbl_size; uint16_t rss_key_size; diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 06ddf64184..8f18e7dd54 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -495,7 +495,6 @@ hns3vf_dev_configure(struct rte_eth_dev *dev) /* When RSS is not configured, redirect the packet queue 0 */ if ((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) { conf->rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH; - hw->rss_dis_flag = false; rss_conf = conf->rx_adv_conf.rss_conf; ret = hns3_dev_rss_hash_update(dev, &rss_conf); if (ret) @@ -997,7 +996,6 @@ hns3vf_get_configuration(struct hns3_hw *hw) int ret; hw->mac.media_type = HNS3_MEDIA_TYPE_NONE; - hw->rss_dis_flag = false; /* Get device capability */ ret = hns3vf_get_capability(hw); diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 46371c4190..485b7be854 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1458,7 +1458,6 @@ hns3_disable_rss(struct hns3_hw *hw) /* Disable RSS */ hw->rss_info.conf.types = 0; - hw->rss_dis_flag = true; return 0; } diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index e0eab05fb9..5be7a05af2 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -414,9 +414,6 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, return -EOPNOTSUPP; } - if (hw->rss_dis_flag) - return -EINVAL; - rte_spinlock_lock(&hw->lock); ret = hns3_set_rss_tuple_by_rss_hf(hw, tuple, rss_hf); if (ret) From patchwork Mon Feb 28 03:21:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 108376 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1F550A0350; Mon, 28 Feb 2022 04:22:06 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD13A410FB; Mon, 28 Feb 2022 04:22:00 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 242314068C for ; Mon, 28 Feb 2022 04:21:57 +0100 (CET) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4K6Qcm3j7yzdZfb; Mon, 28 Feb 2022 11:20:40 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.21; Mon, 28 Feb 2022 11:21:55 +0800 From: "Min Hu (Connor)" To: CC: , Subject: [PATCH 4/6] net/hns3: fix the time waiting for PF reset completion Date: Mon, 28 Feb 2022 11:21:44 +0800 Message-ID: <20220228032146.37407-5-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220228032146.37407-1-humin29@huawei.com> References: <20220228032146.37407-1-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li On the case that PF and VF need to be reset, after the hardware reset is complete, VF needs wait for 1 second to restore the configuration so that VF does not fail to recover because PF reset isn't complete. But the estimated time is not sufficient. This patch fixes it to 5 seconds. Fixes: 2790c6464725 ("net/hns3: support device reset") Cc: stable@dpdk.org Signed-off-by: Huisong Li --- drivers/net/hns3/hns3_ethdev_vf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 8f18e7dd54..7d414b1af8 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1875,6 +1875,7 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) static int hns3vf_wait_hardware_ready(struct hns3_adapter *hns) { +#define HNS3_WAIT_PF_RESET_READY_TIME 5 struct hns3_hw *hw = &hns->hw; struct hns3_wait_data *wait_data = hw->reset.wait_data; struct timeval tv; @@ -1895,12 +1896,14 @@ hns3vf_wait_hardware_ready(struct hns3_adapter *hns) return 0; wait_data->check_completion = NULL; - wait_data->interval = 1 * MSEC_PER_SEC * USEC_PER_MSEC; + wait_data->interval = + HNS3_WAIT_PF_RESET_READY_TIME * MSEC_PER_SEC * USEC_PER_MSEC; wait_data->count = 1; wait_data->result = HNS3_WAIT_REQUEST; rte_eal_alarm_set(wait_data->interval, hns3_wait_callback, wait_data); - hns3_warn(hw, "hardware is ready, delay 1 sec for PF reset complete"); + hns3_warn(hw, "hardware is ready, delay %d sec for PF reset complete", + HNS3_WAIT_PF_RESET_READY_TIME); return -EAGAIN; } else if (wait_data->result == HNS3_WAIT_TIMEOUT) { hns3_clock_gettime(&tv); From patchwork Mon Feb 28 03:21:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 108379 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B98F7A0350; Mon, 28 Feb 2022 04:22:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 577E741165; Mon, 28 Feb 2022 04:22:04 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 0CA8A40E0F for ; Mon, 28 Feb 2022 04:21:57 +0100 (CET) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4K6Qcm26z6zdfcy; Mon, 28 Feb 2022 11:20:40 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.21; Mon, 28 Feb 2022 11:21:55 +0800 From: "Min Hu (Connor)" To: CC: , Subject: [PATCH 5/6] net/hns3: fix RSS TC mode entry Date: Mon, 28 Feb 2022 11:21:45 +0800 Message-ID: <20220228032146.37407-6-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220228032146.37407-1-humin29@huawei.com> References: <20220228032146.37407-1-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li The driver allocates queues only to valid TCs. But the driver also configure queues for invalid TCs, which is unreasonable. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Cc: stable@dpdk.org Signed-off-by: Huisong Li --- drivers/net/hns3/hns3_rss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index 5be7a05af2..5077d49882 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -610,8 +610,8 @@ hns3_set_rss_tc_mode(struct hns3_hw *hw) for (i = 0; i < HNS3_MAX_TC_NUM; i++) { tc_valid[i] = !!(hw->hw_tc_map & BIT(i)); - tc_size[i] = roundup_size; - tc_offset[i] = rss_size * i; + tc_size[i] = tc_valid[i] ? roundup_size : 0; + tc_offset[i] = tc_valid[i] ? rss_size * i : 0; } hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_TC_MODE, false); From patchwork Mon Feb 28 03:21:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 108375 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 63BFCA0350; Mon, 28 Feb 2022 04:22:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EBD9E4068C; Mon, 28 Feb 2022 04:21:59 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 6A4EF4068A for ; Mon, 28 Feb 2022 04:21:57 +0100 (CET) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4K6QXt73rGzbbtr; Mon, 28 Feb 2022 11:17:18 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.21; Mon, 28 Feb 2022 11:21:55 +0800 From: "Min Hu (Connor)" To: CC: , Subject: [PATCH 6/6] net/hns3: fix VF RSS TC mode entry Date: Mon, 28 Feb 2022 11:21:46 +0800 Message-ID: <20220228032146.37407-7-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220228032146.37407-1-humin29@huawei.com> References: <20220228032146.37407-1-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li For packets with VLAN priorities destined for the VF, hardware still assign Rx queue based on the Up-to-TC mapping PF configured. But VF has only one TC. If other TC don't enable, it causes that the priority packets that aren't destined for TC0 aren't received by RSS hash but is destined for queue 0. So driver has to enable the unused TC by using TC0 queue mapping configuration. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Cc: stable@dpdk.org Signed-off-by: Huisong Li --- drivers/net/hns3/hns3_rss.c | 56 +++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index 5077d49882..9606801140 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -587,33 +587,59 @@ hns3_dev_rss_reta_query(struct rte_eth_dev *dev, return 0; } -/* - * Used to configure the tc_size and tc_offset. - */ +static void +hns3_set_rss_tc_mode_entry(struct hns3_hw *hw, uint8_t *tc_valid, + uint16_t *tc_size, uint16_t *tc_offset, + uint8_t tc_num) +{ + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + uint16_t rss_size = hw->alloc_rss_size; + uint16_t roundup_size; + uint16_t i; + + roundup_size = roundup_pow_of_two(rss_size); + roundup_size = ilog2(roundup_size); + + for (i = 0; i < tc_num; i++) { + if (hns->is_vf) { + /* + * For packets with VLAN priorities destined for the VF, + * hardware still assign Rx queue based on the Up-to-TC + * mapping PF configured. But VF has only one TC. If + * other TC don't enable, it causes that the priority + * packets that aren't destined for TC0 aren't received + * by RSS hash but is destined for queue 0. So driver + * has to enable the unused TC by using TC0 queue + * mapping configuration. + */ + tc_valid[i] = (hw->hw_tc_map & BIT(i)) ? + !!(hw->hw_tc_map & BIT(i)) : 1; + tc_size[i] = roundup_size; + tc_offset[i] = (hw->hw_tc_map & BIT(i)) ? + rss_size * i : 0; + } else { + tc_valid[i] = !!(hw->hw_tc_map & BIT(i)); + tc_size[i] = tc_valid[i] ? roundup_size : 0; + tc_offset[i] = tc_valid[i] ? rss_size * i : 0; + } + } +} + static int hns3_set_rss_tc_mode(struct hns3_hw *hw) { - uint16_t rss_size = hw->alloc_rss_size; struct hns3_rss_tc_mode_cmd *req; uint16_t tc_offset[HNS3_MAX_TC_NUM]; uint8_t tc_valid[HNS3_MAX_TC_NUM]; uint16_t tc_size[HNS3_MAX_TC_NUM]; struct hns3_cmd_desc desc; - uint16_t roundup_size; uint16_t i; int ret; - req = (struct hns3_rss_tc_mode_cmd *)desc.data; - - roundup_size = roundup_pow_of_two(rss_size); - roundup_size = ilog2(roundup_size); - - for (i = 0; i < HNS3_MAX_TC_NUM; i++) { - tc_valid[i] = !!(hw->hw_tc_map & BIT(i)); - tc_size[i] = tc_valid[i] ? roundup_size : 0; - tc_offset[i] = tc_valid[i] ? rss_size * i : 0; - } + hns3_set_rss_tc_mode_entry(hw, tc_valid, tc_size, + tc_offset, HNS3_MAX_TC_NUM); + req = (struct hns3_rss_tc_mode_cmd *)desc.data; hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_TC_MODE, false); for (i = 0; i < HNS3_MAX_TC_NUM; i++) { uint16_t mode = 0;