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 8FC76A00C5 for ; Tue, 2 Aug 2022 13:30:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 70F2440141; Tue, 2 Aug 2022 13:30:30 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id F3ED5400D7 for ; Tue, 2 Aug 2022 13:30:28 +0200 (CEST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Lxt4r4t77zjXgT; Tue, 2 Aug 2022 19:27:24 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 2 Aug 2022 19:30:26 +0800 Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 2 Aug 2022 19:30:25 +0800 From: Huisong Li To: , CC: , , , , Subject: [PATCH 19.11] ethdev: fix RSS update when RSS is disabled Date: Tue, 2 Aug 2022 19:29:32 +0800 Message-ID: <20220802112932.14139-1-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [ upstream commit 93e1ea6dfa99dea359b8d66123576a395c2c0acd ] The 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. Bugzilla ID: 1056 Fixes: 99a2dd955fba ("lib: remove librte_ prefix from directory names") Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) Reviewed-by: Ferruh Yigit --- lib/librte_ethdev/rte_ethdev.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 76699cc10f..eb82e12ea4 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -3504,6 +3504,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; @@ -3521,6 +3522,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 & 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)); @@ -3553,6 +3560,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); @@ -3572,6 +3580,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 & 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.22.0