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 E8E8D41E3A; Fri, 10 Mar 2023 10:37:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6187A42D5E; Fri, 10 Mar 2023 10:36:42 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id D417642D4A; Fri, 10 Mar 2023 10:36:39 +0100 (CET) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PY18C0C6SznWrN; Fri, 10 Mar 2023 17:33:47 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 10 Mar 2023 17:36:37 +0800 From: Dongdong Liu To: , , , CC: , , , Subject: [PATCH 10/16] net/hns3: separate the setting and clearing of RSS rule Date: Fri, 10 Mar 2023 17:35:12 +0800 Message-ID: <20230310093518.5198-11-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230310093518.5198-1-liudongdong3@huawei.com> References: <20230310093518.5198-1-liudongdong3@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500017.china.huawei.com (7.221.188.110) 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 Separate the setting and clearing of RSS rule. Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_flow.c | 46 +++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 21e00e515e..4da98d7adc 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1535,8 +1535,22 @@ hns3_update_indir_table(struct hns3_hw *hw, } static int -hns3_config_rss_filter(struct hns3_hw *hw, - const struct hns3_rss_conf *conf, bool add) +hns3_reset_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf) +{ + int ret; + + if (!conf->valid) + return 0; + + ret = hns3_disable_rss(hw); + if (ret) + hns3_err(hw, "RSS disable failed(%d)", ret); + + return ret; +} + +static int +hns3_config_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf) { uint64_t flow_types; uint16_t num; @@ -1553,19 +1567,6 @@ hns3_config_rss_filter(struct hns3_hw *hw, .queue = conf->conf.queue, }; - if (!add) { - if (!conf->valid) - return 0; - - ret = hns3_disable_rss(hw); - if (ret) { - hns3_err(hw, "RSS disable failed(%d)", ret); - return ret; - } - - return 0; - } - /* Set rx queues to use */ num = RTE_MIN(hw->data->nb_rx_queues, rss_flow_conf.queue_num); if (rss_flow_conf.queue_num > num) @@ -1606,8 +1607,7 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) rss_filter_ptr = TAILQ_FIRST(&hw->flow_rss_list); while (rss_filter_ptr) { TAILQ_REMOVE(&hw->flow_rss_list, rss_filter_ptr, entries); - ret = hns3_config_rss_filter(hw, &rss_filter_ptr->filter_info, - false); + ret = hns3_reset_rss_filter(hw, &rss_filter_ptr->filter_info); if (ret) rss_rule_fail_cnt++; else @@ -1636,7 +1636,7 @@ hns3_restore_rss_filter(struct hns3_hw *hw) if (!filter->filter_info.valid) continue; - ret = hns3_config_rss_filter(hw, &filter->filter_info, true); + ret = hns3_config_rss_filter(hw, &filter->filter_info); if (ret != 0) { hns3_err(hw, "restore RSS filter failed, ret=%d", ret); goto out; @@ -1680,8 +1680,7 @@ hns3_rss_action_is_dup(struct hns3_hw *hw, } static int -hns3_flow_parse_rss(struct rte_eth_dev *dev, - const struct hns3_rss_conf *conf, bool add) +hns3_flow_parse_rss(struct rte_eth_dev *dev, const struct hns3_rss_conf *conf) { struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; @@ -1691,7 +1690,7 @@ hns3_flow_parse_rss(struct rte_eth_dev *dev, return -EINVAL; } - return hns3_config_rss_filter(hw, conf, add); + return hns3_config_rss_filter(hw, conf); } static int @@ -1778,7 +1777,7 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev, } } - ret = hns3_flow_parse_rss(dev, new_conf, true); + ret = hns3_flow_parse_rss(dev, new_conf); if (ret != 0) { rte_free(rss_filter_ptr); return ret; @@ -1961,8 +1960,7 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, break; case RTE_ETH_FILTER_HASH: rss_filter_ptr = (struct hns3_rss_conf_ele *)flow->rule; - ret = hns3_config_rss_filter(hw, &rss_filter_ptr->filter_info, - false); + ret = hns3_reset_rss_filter(hw, &rss_filter_ptr->filter_info); if (ret) return rte_flow_error_set(error, EIO, RTE_FLOW_ERROR_TYPE_HANDLE, -- 2.22.0