Skip to content

Commit d180c11

Browse files
IronShenPaolo Abeni
authored andcommitted
net: hns3: using the num_tqps to check whether tqp_index is out of range when vf get ring info from mbx
Currently, rss_size = num_tqps / tc_num. If tc_num is 1, then num_tqps equals rss_size. However, if the tc_num is greater than 1, then rss_size will be less than num_tqps, causing the tqp_index check for subsequent TCs using rss_size to always fail. This patch uses the num_tqps to check whether tqp_index is out of range, instead of rss_size. Fixes: 326334a ("net: hns3: add a check for tqp_index in hclge_get_ring_chain_from_mbx()") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Jijie Shao <shaojijie@huawei.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20251211023737.2327018-3-shaojijie@huawei.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent c2a1626 commit d180c11

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ static int hclge_get_ring_chain_from_mbx(
193193
return -EINVAL;
194194

195195
for (i = 0; i < ring_num; i++) {
196-
if (req->msg.param[i].tqp_index >= vport->nic.kinfo.rss_size) {
196+
if (req->msg.param[i].tqp_index >= vport->nic.kinfo.num_tqps) {
197197
dev_err(&hdev->pdev->dev, "tqp index(%u) is out of range(0-%u)\n",
198198
req->msg.param[i].tqp_index,
199-
vport->nic.kinfo.rss_size - 1U);
199+
vport->nic.kinfo.num_tqps - 1U);
200200
return -EINVAL;
201201
}
202202
}

0 commit comments

Comments
 (0)