From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A7996A034F; Mon, 30 Aug 2021 10:28:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 669114113E; Mon, 30 Aug 2021 10:28:14 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id E950F41125 for ; Mon, 30 Aug 2021 10:28:12 +0200 (CEST) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Gyjz459lYzbcx8 for ; Mon, 30 Aug 2021 16:24:16 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Mon, 30 Aug 2021 16:28:10 +0800 From: "Min Hu (Connor)" To: CC: , Date: Mon, 30 Aug 2021 16:26:49 +0800 Message-ID: <1630312011-65160-2-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1630312011-65160-1-git-send-email-humin29@huawei.com> References: <1630312011-65160-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 1/3] net/hns3: fix queue flow action validation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengchang Tang 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 Signed-off-by: Min Hu (Connor) --- 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