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 5E815A0509; Wed, 6 Apr 2022 08:57:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0416140E2D; Wed, 6 Apr 2022 08:57:42 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 239BE40DF6 for ; Wed, 6 Apr 2022 08:57:40 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KYFf206gNzgYR2; Wed, 6 Apr 2022 14:55:53 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 6 Apr 2022 14:57:37 +0800 From: "Min Hu (Connor)" To: CC: , Subject: [PATCH v2 1/2] ethdev: fix enabling RSS behavior inconsistent Date: Wed, 6 Apr 2022 14:57:00 +0800 Message-ID: <20220406065701.27738-2-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220406065701.27738-1-humin29@huawei.com> References: <20220228032146.37407-1-humin29@huawei.com> <20220406065701.27738-1-humin29@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected 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 From: Huisong Li The RTE_ETH_MQ_RX_RSS_FLAG flag is a switch to enable RSS. If the flag is not set in dev_configure, RSS will be not configured and enabled. However, RSS hash and reta can still be configured by ethdev ops to enable RSS if the flag isn't set. The behavior is inconsistent. Fixes: 99a2dd955fba ("lib: remove librte_ prefix from directory names") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) --- lib/ethdev/rte_ethdev.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 29a3d80466..8520aec561 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -3867,6 +3867,7 @@ rte_eth_dev_rss_reta_update(uint16_t port_id, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) { + enum rte_eth_rx_mq_mode mq_mode; struct rte_eth_dev *dev; int ret; @@ -3898,6 +3899,12 @@ rte_eth_dev_rss_reta_update(uint16_t port_id, if (ret < 0) return ret; + mq_mode = dev->data->dev_conf.rxmode.mq_mode; + if (!(mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) { + RTE_ETHDEV_LOG(ERR, "Multi-queue RSS mode isn't enabled.\n"); + return -ENOTSUP; + } + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP); return eth_err(port_id, (*dev->dev_ops->reta_update)(dev, reta_conf, reta_size)); @@ -3937,6 +3944,7 @@ rte_eth_dev_rss_hash_update(uint16_t port_id, { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info = { .flow_type_rss_offloads = 0, }; + enum rte_eth_rx_mq_mode mq_mode; int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); @@ -3962,6 +3970,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id, dev_info.flow_type_rss_offloads); return -EINVAL; } + + mq_mode = dev->data->dev_conf.rxmode.mq_mode; + if (!(mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) { + RTE_ETHDEV_LOG(ERR, "Multi-queue RSS mode isn't enabled.\n"); + return -ENOTSUP; + } + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP); return eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev, rss_conf)); -- 2.33.0