dpdk/0217-net-hns3-fix-queue-flow-action-validation.patch
speech_white 1c77287214 sync to master branch
sync patches ranges from versoin 9 t0 17 from master branch

Signed-off-by: speech_white <humin29@huawei.com>
2021-12-17 10:45:19 +08:00

59 lines
2.3 KiB
Diff

From 15c37af398c3a22b5f46aff8abfc9166f949567c Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang@huawei.com>
Date: Mon, 30 Aug 2021 16:26:49 +0800
Subject: [PATCH] net/hns3: fix queue flow action validation
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 fc77979c5f..841e0b9da3 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.33.0