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 A34C8A0350; Mon, 28 Feb 2022 04:22:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 406D24116D; Mon, 28 Feb 2022 04:22:05 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 01E384068C for ; Mon, 28 Feb 2022 04:21:57 +0100 (CET) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4K6QZ75p1Qz9sNG; Mon, 28 Feb 2022 11:18:23 +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.21; Mon, 28 Feb 2022 11:21:55 +0800 From: "Min Hu (Connor)" To: CC: , Subject: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS behavior Date: Mon, 28 Feb 2022 11:21:42 +0800 Message-ID: <20220228032146.37407-3-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220228032146.37407-1-humin29@huawei.com> References: <20220228032146.37407-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: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme756-chm.china.huawei.com (10.3.19.102) 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 RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in dev_configure phase. However, if this flag isn't set, RSS can be enabled through the ethdev ops and rte_flow API. This behavior is contrary to each other. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Cc: stable@dpdk.org Signed-off-by: Huisong Li --- drivers/net/hns3/hns3_flow.c | 5 +++++ drivers/net/hns3/hns3_rss.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index aba07aaa6f..46371c4190 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1371,6 +1371,7 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, const struct rte_flow_action *actions, struct rte_flow_error *error) { + enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode; struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; struct hns3_rss_conf *rss_conf = &hw->rss_info; @@ -1426,6 +1427,10 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, RTE_FLOW_ERROR_TYPE_ACTION_CONF, &rss->types, "input RSS types are not supported"); + if (!((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + act, "multi-queue RSS isn't enabled"); act_index++; diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index 1782d63883..e0eab05fb9 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -399,6 +399,7 @@ int hns3_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { + enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode; struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; struct hns3_rss_tuple_cfg *tuple = &hw->rss_info.rss_tuple_sets; @@ -408,6 +409,11 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, uint8_t *key = rss_conf->rss_key; int ret; + if (!((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) { + hns3_err(hw, "multi-queue RSS isn't enabled."); + return -EOPNOTSUPP; + } + if (hw->rss_dis_flag) return -EINVAL; @@ -498,6 +504,7 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) { + enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode; struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; struct hns3_rss_conf *rss_cfg = &hw->rss_info; @@ -506,6 +513,11 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, uint16_t i; int ret; + if (!((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) { + hns3_err(hw, "multi-queue RSS isn't enabled."); + return -EOPNOTSUPP; + } + if (reta_size != hw->rss_ind_tbl_size) { hns3_err(hw, "The size of hash lookup table configured (%u)" "doesn't match the number hardware can supported" -- 2.33.0