1 Star 0 Fork 75

mds.lanruo/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0249-net-hns3-use-new-RSS-rule-to-configure-hardware.patch 4.07 KB
一键复制 编辑 原始数据 按行查看 历史
From 08730d02d9f5cb532ea3953c2ae1920aaa123358 Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong@huawei.com>
Date: Fri, 10 Mar 2023 17:35:13 +0800
Subject: net/hns3: use new RSS rule to configure hardware
[ upstream commit 218a119a08e01f203f92b46334b6b2f03ff9765d ]
Remove redundant assignment and directly use new RSS rule to configure
hardware. Additionally, considering that the new rule configuration may
need to be modified, the 'const' of input parameter about it is removed.
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 | 52 ++++++++++++++----------------------
1 file changed, 20 insertions(+), 32 deletions(-)
diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index 80dda63afe..3ac5279538 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1482,6 +1482,7 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config)
{
uint8_t rss_key[HNS3_RSS_KEY_SIZE_MAX] = {0};
bool use_default_key = false;
+ uint64_t flow_types;
uint8_t hash_algo;
int ret;
@@ -1501,10 +1502,18 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config)
hw->rss_key_size);
if (ret)
return ret;
-
hw->rss_info.rte_flow_hash_algo = hash_algo;
- ret = hns3_set_rss_tuple_by_rss_hf(hw, rss_config->types);
+ /* Filter the unsupported flow types */
+ flow_types = rss_config->types ?
+ rss_config->types & HNS3_ETH_RSS_SUPPORT :
+ hw->rss_info.rss_hf;
+ if (flow_types != rss_config->types)
+ hns3_warn(hw, "modified RSS types based on hardware support,"
+ " requested:0x%" PRIx64 " configured:0x%" PRIx64,
+ rss_config->types, flow_types);
+
+ ret = hns3_set_rss_tuple_by_rss_hf(hw, flow_types);
if (ret)
hns3_err(hw, "Update RSS tuples by rss hf failed %d", ret);
@@ -1550,48 +1559,27 @@ hns3_reset_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf)
}
static int
-hns3_config_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf)
+hns3_config_rss_filter(struct hns3_hw *hw, struct hns3_rss_conf *conf)
{
- uint64_t flow_types;
+ struct rte_flow_action_rss *rss_act;
uint16_t num;
int ret;
- struct rte_flow_action_rss rss_flow_conf = {
- .func = conf->conf.func,
- .level = conf->conf.level,
- .types = conf->conf.types,
- .key_len = conf->conf.key_len,
- .queue_num = conf->conf.queue_num,
- .key = conf->conf.key_len ?
- (void *)(uintptr_t)conf->conf.key : NULL,
- .queue = conf->conf.queue,
- };
-
+ rss_act = &conf->conf;
/* 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)
+ num = RTE_MIN(hw->data->nb_rx_queues, rss_act->queue_num);
+ if (rss_act->queue_num > num)
hns3_warn(hw, "Config queue numbers %u are beyond the scope of truncated",
- rss_flow_conf.queue_num);
+ rss_act->queue_num);
hns3_info(hw, "Max of contiguous %u PF queues are configured", num);
if (num) {
- ret = hns3_update_indir_table(hw, &rss_flow_conf, num);
+ ret = hns3_update_indir_table(hw, rss_act, num);
if (ret)
return ret;
}
- /* Filter the unsupported flow types */
- flow_types = conf->conf.types ?
- rss_flow_conf.types & HNS3_ETH_RSS_SUPPORT :
- hw->rss_info.rss_hf;
- if (flow_types != rss_flow_conf.types)
- hns3_warn(hw, "modified RSS types based on hardware support,"
- " requested:0x%" PRIx64 " configured:0x%" PRIx64,
- rss_flow_conf.types, flow_types);
- /* Update the useful flow types */
- rss_flow_conf.types = flow_types;
-
/* Set hash algorithm and flow types by the user's config */
- return hns3_hw_rss_hash_set(hw, &rss_flow_conf);
+ return hns3_hw_rss_hash_set(hw, rss_act);
}
static int
@@ -1680,7 +1668,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)
+hns3_flow_parse_rss(struct rte_eth_dev *dev, struct hns3_rss_conf *conf)
{
struct hns3_adapter *hns = dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mdslanruo/dpdk.git
git@gitee.com:mdslanruo/dpdk.git
mdslanruo
dpdk
dpdk
master

搜索帮助