From: Jie Hai <haijie1@huawei.com>
To: <thomas@monjalon.net>, <ferruh.yigit@amd.com>, <dev@dpdk.org>,
<andrew.rybchenko@oktetlabs.ru>
Cc: <fengchengwen@huawei.com>, <lihuisong@huawei.com>
Subject: [RESEND 2/2] app/testpmd: support set RSS hash algorithm
Date: Thu, 30 Nov 2023 18:44:15 +0800 [thread overview]
Message-ID: <20231130104415.1064644-3-haijie1@huawei.com> (raw)
In-Reply-To: <20231130104415.1064644-1-haijie1@huawei.com>
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>
---
app/test-pmd/cmdline.c | 79 +++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 +++
2 files changed, 90 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 9369d3b4c526..2cd85c918a09 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,80 @@ 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;
+ 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 confinguration\n",
+ res->port_id);
+ return;
+ }
+
+ ret = rte_eth_find_rss_algo(res->algo, &rss_conf.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 +13243,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 447e28e6944f..3c7d20c2db82 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2263,6 +2263,17 @@ 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.30.0
next prev parent reply other threads:[~2023-11-30 10:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 9:48 [PATCH 0/2] " Jie Hai
2023-11-22 9:48 ` [PATCH 1/2] ethdev: add new API to get RSS hash algorithm by name Jie Hai
2023-11-22 9:48 ` [PATCH 2/2] app/testpmd: support set RSS hash algorithm Jie Hai
2023-11-22 10:46 ` [PATCH 0/2] " Ferruh Yigit
2023-11-23 6:32 ` Jie Hai
2023-11-30 9:02 ` Ferruh Yigit
2023-11-30 10:01 ` Jie Hai
2023-11-30 10:44 ` [RESEND " Jie Hai
2023-11-30 10:44 ` [RESEND 1/2] ethdev: add new API to get RSS hash algorithm by name Jie Hai
2023-11-30 11:23 ` Ferruh Yigit
2023-11-30 10:44 ` Jie Hai [this message]
2023-11-30 11:37 ` [RESEND 2/2] app/testpmd: support set RSS hash algorithm Ferruh Yigit
2023-11-30 11:38 ` Ferruh Yigit
2023-12-01 8:52 ` [PATCH v2 0/2] " Jie Hai
2023-12-01 8:52 ` [PATCH v2 1/2] ethdev: add new API to get RSS hash algorithm by name Jie Hai
2023-12-01 8:52 ` [PATCH v2 2/2] app/testpmd: support set RSS hash algorithm Jie Hai
2023-12-01 11:26 ` Ferruh Yigit
2023-12-04 13:57 ` [PATCH v2 0/2] " 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=20231130104415.1064644-3-haijie1@huawei.com \
--to=haijie1@huawei.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=ferruh.yigit@amd.com \
--cc=lihuisong@huawei.com \
--cc=thomas@monjalon.net \
/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).