From: Dongdong Liu <liudongdong3@huawei.com>
To: <dev@dpdk.org>, <ferruh.yigit@amd.com>, <thomas@monjalon.net>,
<andrew.rybchenko@oktetlabs.ru>
Cc: <stable@dpdk.org>, <yisen.zhuang@huawei.com>,
<liudongdong3@huawei.com>, <lihuisong@huawei.com>
Subject: [PATCH 10/16] net/hns3: separate the setting and clearing of RSS rule
Date: Fri, 10 Mar 2023 17:35:12 +0800 [thread overview]
Message-ID: <20230310093518.5198-11-liudongdong3@huawei.com> (raw)
In-Reply-To: <20230310093518.5198-1-liudongdong3@huawei.com>
From: Huisong Li <lihuisong@huawei.com>
Separate the setting and clearing of RSS rule.
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
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
next prev parent reply other threads:[~2023-03-10 9:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 9:35 [PATCH 00/16] net/hns3: some code refactor for hns3 RSS Dongdong Liu
2023-03-10 9:35 ` [PATCH 01/16] net/hns3: fix possible truncation of hash key when config Dongdong Liu
2023-03-10 19:36 ` Ferruh Yigit
2023-03-29 1:56 ` lihuisong (C)
2023-03-10 9:35 ` [PATCH 02/16] net/hns3: fix possible truncation of redirection table Dongdong Liu
2023-03-10 19:36 ` Ferruh Yigit
2023-03-10 9:35 ` [PATCH 03/16] net/hns3: use hardware config to report hash key Dongdong Liu
2023-03-10 9:35 ` [PATCH 04/16] net/hns3: use hardware config to report hash types Dongdong Liu
2023-03-10 9:35 ` [PATCH 05/16] net/hns3: use hardware config to report redirection table Dongdong Liu
2023-03-10 9:35 ` [PATCH 06/16] net/hns3: separate the setting of hash algorithm Dongdong Liu
2023-03-10 19:36 ` Ferruh Yigit
2023-03-29 1:58 ` lihuisong (C)
2023-03-29 8:13 ` Ferruh Yigit
2023-03-10 9:35 ` [PATCH 07/16] net/hns3: separate the setting of hash key Dongdong Liu
2023-03-10 9:35 ` [PATCH 08/16] net/hns3: separate the setting of redirection table Dongdong Liu
2023-03-10 9:35 ` [PATCH 09/16] net/hns3: separate the setting of RSS types Dongdong Liu
2023-03-10 9:35 ` Dongdong Liu [this message]
2023-03-10 9:35 ` [PATCH 11/16] net/hns3: use new RSS rule to configure hardware Dongdong Liu
2023-03-10 9:35 ` [PATCH 12/16] net/hns3: save hash algo to RSS filter list node Dongdong Liu
2023-03-10 9:35 ` [PATCH 13/16] net/hns3: adding queue buffer size hash rule allowed Dongdong Liu
2023-03-10 9:35 ` [PATCH 14/16] net/hns3: separate rte flow RSS config from hns3 rss conf Dongdong Liu
2023-03-10 9:35 ` [PATCH 15/16] net/hns3: reimplement hash flow function Dongdong Liu
2023-03-10 9:35 ` [PATCH 16/16] net/hns3: add the verification of RSS types Dongdong Liu
2023-03-10 20:58 ` [PATCH 00/16] net/hns3: some code refactor for hns3 RSS Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230310093518.5198-11-liudongdong3@huawei.com \
--to=liudongdong3@huawei.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=lihuisong@huawei.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
--cc=yisen.zhuang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).