[5/6] net/hns3: fix RSS TC mode entry

Message ID 20220228032146.37407-6-humin29@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series bugfixes for hns3 PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

humin (Q) Feb. 28, 2022, 3:21 a.m. UTC
  From: Huisong Li <lihuisong@huawei.com>

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 <lihuisong@huawei.com>
---
 drivers/net/hns3/hns3_rss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

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);