DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <andrew.rybchenko@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 1/3] net/hns3: fix queue flow action validation
Date: Mon, 30 Aug 2021 16:26:49 +0800	[thread overview]
Message-ID: <1630312011-65160-2-git-send-email-humin29@huawei.com> (raw)
In-Reply-To: <1630312011-65160-1-git-send-email-humin29@huawei.com>

From: Chengchang Tang <tangchengchang@huawei.com>

The used_rx_queues only takes effect after device is started, and
its value is incorrect before the device is started. Therefore, it
is not suitable for flow action to use it to verify the queue index
before the device is started.

E.g. Enable dedicated queue in bonding device will configure a queue
flow action before start its slave devices. The above problem will
make this reasonable flow action configuration fail.

This patch use the nb_rx_queues from the configuration phase to
achieve verification.

Fixes: a951c1ed3ab5 ("net/hns3: support different numbers of Rx and Tx queues")
Fixes: f8e7fcbfd0b8 ("net/hns3: support flow action of queue region")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_flow.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index fc77979..841e0b9 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -275,10 +275,10 @@ hns3_handle_action_queue(struct rte_eth_dev *dev,
 	struct hns3_hw *hw = &hns->hw;
 
 	queue = (const struct rte_flow_action_queue *)action->conf;
-	if (queue->index >= hw->used_rx_queues) {
+	if (queue->index >= hw->data->nb_rx_queues) {
 		hns3_err(hw, "queue ID(%u) is greater than number of "
 			  "available queue (%u) in driver.",
-			  queue->index, hw->used_rx_queues);
+			  queue->index, hw->data->nb_rx_queues);
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
 					  action, "Invalid queue ID in PF");
@@ -308,8 +308,8 @@ hns3_handle_action_queue_region(struct rte_eth_dev *dev,
 
 	if ((!rte_is_power_of_2(conf->queue_num)) ||
 		conf->queue_num > hw->rss_size_max ||
-		conf->queue[0] >= hw->used_rx_queues ||
-		conf->queue[0] + conf->queue_num > hw->used_rx_queues) {
+		conf->queue[0] >= hw->data->nb_rx_queues ||
+		conf->queue[0] + conf->queue_num > hw->data->nb_rx_queues) {
 		return rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ACTION_CONF, action,
 			"Invalid start queue ID and queue num! the start queue "
-- 
2.7.4


  reply	other threads:[~2021-08-30  8:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30  8:26 [dpdk-dev] [PATCH 0/3] bugfixes for hns3 PMD Min Hu (Connor)
2021-08-30  8:26 ` Min Hu (Connor) [this message]
2021-08-30  8:26 ` [dpdk-dev] [PATCH 2/3] net/hns3: fix new taskqueue pair reset command Min Hu (Connor)
2021-08-30  8:26 ` [dpdk-dev] [PATCH 3/3] net/hns3: fix Tx push capability Min Hu (Connor)
2021-09-09 17:38 ` [dpdk-dev] [PATCH 0/3] bugfixes for hns3 PMD 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=1630312011-65160-2-git-send-email-humin29@huawei.com \
    --to=humin29@huawei.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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).