代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/dpdk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 787e715f8e77722658d56209c1a73ba5626d19fa Mon Sep 17 00:00:00 2001
From: Jie Hai <haijie1@huawei.com>
Date: Fri, 1 Dec 2023 16:52:54 +0800
Subject: [PATCH 20/30] app/testpmd: set RSS hash algorithm
[ upstream commit 3da59f30a23f2e795d2315f3d949e1b3e0ce0c3d ]
Since API rte_eth_dev_rss_hash_update() supports setting RSS hash
algorithm, add new command to support it:
testpmd> port config 0 rss-hash-algo symmetric_toeplitz
Signed-off-by: Jie Hai <haijie1@huawei.com>
Reviewed-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
app/test-pmd/cmdline.c | 81 +++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +++
2 files changed, 91 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 9369d3b..f704319 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -726,6 +726,10 @@ static void cmd_help_long_parsed(void *parsed_result,
"port config port-id rss reta (hash,queue)[,(hash,queue)]\n"
" Set the RSS redirection table.\n\n"
+ "port config (port_id) rss-hash-algo (default|simple_xor|toeplitz|"
+ "symmetric_toeplitz|symmetric_toeplitz_sort)\n"
+ " Set the RSS hash algorithm.\n\n"
+
"port config (port_id) dcb vt (on|off) (traffic_class)"
" pfc (on|off)\n"
" Set the DCB mode.\n\n"
@@ -2275,6 +2279,82 @@ static cmdline_parse_inst_t cmd_config_rss_hash_key = {
},
};
+/* *** configure rss hash algorithm *** */
+struct cmd_config_rss_hash_algo {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t config;
+ portid_t port_id;
+ cmdline_fixed_string_t rss_hash_algo;
+ cmdline_fixed_string_t algo;
+};
+
+static void
+cmd_config_rss_hash_algo_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_config_rss_hash_algo *res = parsed_result;
+ uint8_t rss_key[RSS_HASH_KEY_LENGTH];
+ struct rte_eth_rss_conf rss_conf;
+ uint32_t algorithm;
+ int ret;
+
+ rss_conf.rss_key_len = RSS_HASH_KEY_LENGTH;
+ rss_conf.rss_key = rss_key;
+ ret = rte_eth_dev_rss_hash_conf_get(res->port_id, &rss_conf);
+ if (ret != 0) {
+ fprintf(stderr, "failed to get port %u RSS configuration\n",
+ res->port_id);
+ return;
+ }
+
+ algorithm = (uint32_t)rss_conf.algorithm;
+ ret = rte_eth_find_rss_algo(res->algo, &algorithm);
+ if (ret != 0) {
+ fprintf(stderr, "port %u configured invalid RSS hash algorithm: %s\n",
+ res->port_id, res->algo);
+ return;
+ }
+
+ ret = rte_eth_dev_rss_hash_update(res->port_id, &rss_conf);
+ if (ret != 0) {
+ fprintf(stderr, "failed to set port %u RSS hash algorithm\n",
+ res->port_id);
+ return;
+ }
+}
+
+static cmdline_parse_token_string_t cmd_config_rss_hash_algo_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_algo, port, "port");
+static cmdline_parse_token_string_t cmd_config_rss_hash_algo_config =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_algo, config,
+ "config");
+static cmdline_parse_token_num_t cmd_config_rss_hash_algo_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_config_rss_hash_algo, port_id,
+ RTE_UINT16);
+static cmdline_parse_token_string_t cmd_config_rss_hash_algo_rss_hash_algo =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_algo,
+ rss_hash_algo, "rss-hash-algo");
+static cmdline_parse_token_string_t cmd_config_rss_hash_algo_algo =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_algo, algo,
+ "default#simple_xor#toeplitz#"
+ "symmetric_toeplitz#symmetric_toeplitz_sort");
+
+static cmdline_parse_inst_t cmd_config_rss_hash_algo = {
+ .f = cmd_config_rss_hash_algo_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> rss-hash-algo "
+ "default|simple_xor|toeplitz|symmetric_toeplitz|symmetric_toeplitz_sort",
+ .tokens = {
+ (void *)&cmd_config_rss_hash_algo_port,
+ (void *)&cmd_config_rss_hash_algo_config,
+ (void *)&cmd_config_rss_hash_algo_port_id,
+ (void *)&cmd_config_rss_hash_algo_rss_hash_algo,
+ (void *)&cmd_config_rss_hash_algo_algo,
+ NULL,
+ },
+};
+
/* *** cleanup txq mbufs *** */
struct cmd_cleanup_txq_mbufs_result {
cmdline_fixed_string_t port;
@@ -13165,6 +13245,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
(cmdline_parse_inst_t *)&cmd_showport_rss_hash_key,
(cmdline_parse_inst_t *)&cmd_showport_rss_hash_algo,
(cmdline_parse_inst_t *)&cmd_config_rss_hash_key,
+ (cmdline_parse_inst_t *)&cmd_config_rss_hash_algo,
(cmdline_parse_inst_t *)&cmd_cleanup_txq_mbufs,
(cmdline_parse_inst_t *)&cmd_dump,
(cmdline_parse_inst_t *)&cmd_dump_one,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 447e28e..227188f 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2263,6 +2263,16 @@ hash of input [IP] packets received on port::
ipv6-udp-ex <string of hex digits \
(variable length, NIC dependent)>)
+port config rss hash algorithm
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To configure the RSS hash algorithm used to compute the RSS
+hash of input packets received on port::
+
+ testpmd> port config <port_id> rss-hash-algo (default|\
+ simple_xor|toeplitz|symmetric_toeplitz|\
+ symmetric_toeplitz_sort)
+
port cleanup txq mbufs
~~~~~~~~~~~~~~~~~~~~~~
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。