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 6B425A034F; Sat, 15 May 2021 02:53:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8601441110; Sat, 15 May 2021 02:52:59 +0200 (CEST) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id C56C540042 for ; Sat, 15 May 2021 02:52:53 +0200 (CEST) Received: from dggems701-chm.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Fhmxc5jBszPxfp for ; Sat, 15 May 2021 08:49:24 +0800 (CST) Received: from dggeme756-chm.china.huawei.com (10.3.19.102) by dggems701-chm.china.huawei.com (10.3.19.178) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Sat, 15 May 2021 08:52:50 +0800 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.2176.2; Sat, 15 May 2021 08:52:49 +0800 From: "Min Hu (Connor)" To: CC: Date: Sat, 15 May 2021 08:52:33 +0800 Message-ID: <1621039958-34847-2-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621039958-34847-1-git-send-email-humin29@huawei.com> References: <1621039958-34847-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 1/6] net/hns3: fix check of Rx/Tx queue numbers 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: Huisong Li The Rx/Tx queue numbers should be greater than TC number, this patch adds this check for PF before updating the mapping between TC and queue. Fixes: a951c1ed3ab5 ("net/hns3: support different numbers of Rx and Tx queues") Fixes: 76d794566d43 ("net/hns3: maximize queue number") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_dcb.c | 12 ++++++++++++ drivers/net/hns3/hns3_ethdev_vf.c | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c index 30e59e8..ab307f1 100644 --- a/drivers/net/hns3/hns3_dcb.c +++ b/drivers/net/hns3/hns3_dcb.c @@ -727,6 +727,18 @@ hns3_queue_to_tc_mapping(struct hns3_hw *hw, uint16_t nb_rx_q, uint16_t nb_tx_q) { int ret; + if (nb_rx_q < hw->num_tc) { + hns3_err(hw, "number of Rx queues(%u) is less than number of TC(%u).", + nb_rx_q, hw->num_tc); + return -EINVAL; + } + + if (nb_tx_q < hw->num_tc) { + hns3_err(hw, "number of Tx queues(%u) is less than number of TC(%u).", + nb_tx_q, hw->num_tc); + return -EINVAL; + } + ret = hns3_set_rss_size(hw, nb_rx_q); if (ret) return ret; diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 536ed46..c649616 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1498,18 +1498,6 @@ hns3vf_set_tc_queue_mapping(struct hns3_adapter *hns, uint16_t nb_rx_q, { struct hns3_hw *hw = &hns->hw; - if (nb_rx_q < hw->num_tc) { - hns3_err(hw, "number of Rx queues(%u) is less than tcs(%u).", - nb_rx_q, hw->num_tc); - return -EINVAL; - } - - if (nb_tx_q < hw->num_tc) { - hns3_err(hw, "number of Tx queues(%u) is less than tcs(%u).", - nb_tx_q, hw->num_tc); - return -EINVAL; - } - return hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); } -- 2.7.4