加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0226-net-hns3-use-RSS-filter-list-to-check-duplicated-rul.patch 2.54 KB
一键复制 编辑 原始数据 按行查看 历史
From dd5efbef75ed9511f497e2da05131e902dc4f277 Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong@huawei.com>
Date: Tue, 31 Jan 2023 21:02:56 +0800
Subject: net/hns3: use RSS filter list to check duplicated rule
[ upstream commit 6afde23d843ecf67453eaf69924bd79873f6f207 ]
All rules from user are saved in RSS filter list, so use RSS
filter list to check duplicated rule.
Fixes: c37ca66f2b27 ("net/hns3: support RSS")
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 | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index c338eab049..303275ae93 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1300,7 +1300,7 @@ hns3_action_rss_same(const struct rte_flow_action_rss *comp,
!memcmp(comp->key, with->key, with->key_len);
return (func_is_same && rss_key_is_same &&
- comp->types == (with->types & HNS3_ETH_RSS_SUPPORT) &&
+ comp->types == with->types &&
comp->level == with->level &&
comp->queue_num == with->queue_num &&
!memcmp(comp->queue, with->queue,
@@ -1596,15 +1596,7 @@ hns3_config_rss_filter(struct hns3_hw *hw,
}
/* Set hash algorithm and flow types by the user's config */
- ret = hns3_hw_rss_hash_set(hw, &rss_flow_conf);
- if (ret)
- return ret;
-
- ret = hns3_rss_conf_copy(rss_info, &rss_flow_conf);
- if (ret)
- hns3_err(hw, "RSS config init fail(%d)", ret);
-
- return ret;
+ return hns3_hw_rss_hash_set(hw, &rss_flow_conf);
}
static int
@@ -1676,17 +1668,32 @@ hns3_restore_filter(struct hns3_adapter *hns)
return hns3_restore_rss_filter(hw);
}
+static bool
+hns3_rss_action_is_dup(struct hns3_hw *hw,
+ const struct rte_flow_action_rss *act)
+{
+ struct hns3_rss_conf_ele *filter;
+
+ TAILQ_FOREACH(filter, &hw->flow_rss_list, entries) {
+ if (!filter->filter_info.valid)
+ continue;
+
+ if (hns3_action_rss_same(&filter->filter_info.conf, act))
+ return true;
+ }
+
+ return false;
+}
+
static int
hns3_flow_parse_rss(struct rte_eth_dev *dev,
const struct hns3_rss_conf *conf, bool add)
{
struct hns3_adapter *hns = dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
- bool ret;
- ret = hns3_action_rss_same(&hw->rss_info.conf, &conf->conf);
- if (ret) {
- hns3_err(hw, "Enter duplicate RSS configuration : %d", ret);
+ if (hns3_rss_action_is_dup(hw, &conf->conf)) {
+ hns3_err(hw, "duplicate RSS configuration");
return -EINVAL;
}
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化