DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <bluca@debian.org>,
	<luoxianjun@huawei.com>, <luoxingyu@huawei.com>,
	<zhouguoyang@huawei.com>, <shahar.belkar@huawei.com>,
	 <yin.yinshi@huawei.com>, <david.yangxiaoliang@huawei.com>,
	<zhaohui8@huawei.com>, <zhengjingzhou@huawei.com>,
	Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
Subject: [dpdk-dev] [PATCH v1 4/4] net/hinic: optimize RSS RETA table updates
Date: Thu, 14 May 2020 17:29:19 +0800	[thread overview]
Message-ID: <bc14ac569b4d5191ca2cf9db3d3424481447b557.1589442278.git.cloud.wangxiaoyun@huawei.com> (raw)
In-Reply-To: <cover.1589442278.git.cloud.wangxiaoyun@huawei.com>

Before updating RSS indirection table, firstly determine whether
rq num in RETA table is legal, if it is invalid(such as exceeding
the maximum rxq num), driver will not update hw indirection
table and return fail.

Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 drivers/net/hinic/hinic_pmd_ethdev.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 8634fe8..2f0f33a 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -2075,16 +2075,16 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev,
 	for (i = 0; i < reta_size; i++) {
 		idx = i / RTE_RETA_GROUP_SIZE;
 		shift = i % RTE_RETA_GROUP_SIZE;
-		if (reta_conf[idx].mask & (1ULL << shift))
-			indirtbl[i] = reta_conf[idx].reta[shift];
-	}
 
-	for (i = 0 ; i < reta_size; i++) {
-		if (indirtbl[i] >= nic_dev->num_rq) {
-			PMD_DRV_LOG(ERR, "Invalid reta entry, index: %d, num_rq: %d",
-				    i, nic_dev->num_rq);
-			goto disable_rss;
+		if (reta_conf[idx].reta[shift] >= nic_dev->num_rq) {
+			PMD_DRV_LOG(ERR, "Invalid reta entry, indirtbl[%d]: %d "
+				"exceeds the maximum rxq num: %d", i,
+				reta_conf[idx].reta[shift], nic_dev->num_rq);
+			return -EINVAL;
 		}
+
+		if (reta_conf[idx].mask & (1ULL << shift))
+			indirtbl[i] = reta_conf[idx].reta[shift];
 	}
 
 	err = hinic_rss_set_indir_tbl(nic_dev->hwdev, tmpl_idx, indirtbl);
-- 
1.8.3.1


  parent reply	other threads:[~2020-05-14  9:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14  9:29 [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style Xiaoyun wang
2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 1/4] net/hinic: the queues resource free problem fixes Xiaoyun wang
2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 2/4] net/hinic: the pkt len updates of mbuf fixes Xiaoyun wang
2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 3/4] net/hinic: code style modification Xiaoyun wang
2020-05-14  9:29 ` Xiaoyun wang [this message]
2020-05-14 16:44 ` [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc14ac569b4d5191ca2cf9db3d3424481447b557.1589442278.git.cloud.wangxiaoyun@huawei.com \
    --to=cloud.wangxiaoyun@huawei.com \
    --cc=bluca@debian.org \
    --cc=david.yangxiaoliang@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=luoxianjun@huawei.com \
    --cc=luoxingyu@huawei.com \
    --cc=shahar.belkar@huawei.com \
    --cc=yin.yinshi@huawei.com \
    --cc=zhaohui8@huawei.com \
    --cc=zhengjingzhou@huawei.com \
    --cc=zhouguoyang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).