From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 11/17] app/testpmd: add missing type to RSS hash commands
Date: Mon, 5 Oct 2015 19:54:46 +0200 [thread overview]
Message-ID: <1444067692-29645-12-git-send-email-adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <1444067692-29645-1-git-send-email-adrien.mazarguil@6wind.com>
From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
DPDK uses a structure to get or set a new hash key (see
eth_rte_rss_hash_conf). rss_hf field from this structure is used in
rss_hash_get_conf to retrieve the hash key and in rss_hash_update uses
it to verify the key exists before trying to update it.
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
app/test-pmd/cmdline.c | 45 +++++++++++++++++---
app/test-pmd/config.c | 66 ++++++++++++++++++-----------
app/test-pmd/testpmd.h | 6 ++-
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +-
4 files changed, 85 insertions(+), 34 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0f8f48f..9e3b7f9 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -190,7 +190,9 @@ static void cmd_help_long_parsed(void *parsed_result,
" by masks on port X. size is used to indicate the"
" hardware supported reta size\n\n"
- "show port rss-hash [key]\n"
+ "show port rss-hash ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|"
+ "ipv4-sctp|ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|"
+ "ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex [key]\n"
" Display the RSS hash functions and RSS hash key"
" of port X\n\n"
@@ -1498,6 +1500,7 @@ struct cmd_config_rss_hash_key {
cmdline_fixed_string_t config;
uint8_t port_id;
cmdline_fixed_string_t rss_hash_key;
+ cmdline_fixed_string_t rss_type;
cmdline_fixed_string_t key;
};
@@ -1555,7 +1558,8 @@ cmd_config_rss_hash_key_parsed(void *parsed_result,
return;
hash_key[i] = (uint8_t) ((xdgt0 * 16) + xdgt1);
}
- port_rss_hash_key_update(res->port_id, hash_key);
+ port_rss_hash_key_update(res->port_id, res->rss_type, hash_key,
+ RSS_HASH_KEY_LENGTH);
}
cmdline_parse_token_string_t cmd_config_rss_hash_key_port =
@@ -1568,18 +1572,29 @@ cmdline_parse_token_num_t cmd_config_rss_hash_key_port_id =
cmdline_parse_token_string_t cmd_config_rss_hash_key_rss_hash_key =
TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key,
rss_hash_key, "rss-hash-key");
+cmdline_parse_token_string_t cmd_config_rss_hash_key_rss_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key, rss_type,
+ "ipv4#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
+ "ipv4-other#ipv6#ipv6-frag#ipv6-tcp#ipv6-udp#"
+ "ipv6-sctp#ipv6-other#l2-payload#ipv6-ex#"
+ "ipv6-tcp-ex#ipv6-udp-ex");
cmdline_parse_token_string_t cmd_config_rss_hash_key_value =
TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key, key, NULL);
cmdline_parse_inst_t cmd_config_rss_hash_key = {
.f = cmd_config_rss_hash_key_parsed,
.data = NULL,
- .help_str = "port config X rss-hash-key 80 hexa digits",
+ .help_str =
+ "port config X rss-hash-key ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|"
+ "ipv4-sctp|ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|"
+ "ipv6-sctp|ipv6-other|l2-payload|"
+ "ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex 80 hexa digits\n",
.tokens = {
(void *)&cmd_config_rss_hash_key_port,
(void *)&cmd_config_rss_hash_key_config,
(void *)&cmd_config_rss_hash_key_port_id,
(void *)&cmd_config_rss_hash_key_rss_hash_key,
+ (void *)&cmd_config_rss_hash_key_rss_type,
(void *)&cmd_config_rss_hash_key_value,
NULL,
},
@@ -1929,6 +1944,7 @@ struct cmd_showport_rss_hash {
cmdline_fixed_string_t port;
uint8_t port_id;
cmdline_fixed_string_t rss_hash;
+ cmdline_fixed_string_t rss_type;
cmdline_fixed_string_t key; /* optional argument */
};
@@ -1938,7 +1954,8 @@ static void cmd_showport_rss_hash_parsed(void *parsed_result,
{
struct cmd_showport_rss_hash *res = parsed_result;
- port_rss_hash_conf_show(res->port_id, show_rss_key != NULL);
+ port_rss_hash_conf_show(res->port_id, res->rss_type,
+ show_rss_key != NULL);
}
cmdline_parse_token_string_t cmd_showport_rss_hash_show =
@@ -1950,18 +1967,29 @@ cmdline_parse_token_num_t cmd_showport_rss_hash_port_id =
cmdline_parse_token_string_t cmd_showport_rss_hash_rss_hash =
TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash, rss_hash,
"rss-hash");
+cmdline_parse_token_string_t cmd_showport_rss_hash_rss_hash_info =
+ TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash, rss_type,
+ "ipv4#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
+ "ipv4-other#ipv6#ipv6-frag#ipv6-tcp#ipv6-udp#"
+ "ipv6-sctp#ipv6-other#l2-payload#ipv6-ex#"
+ "ipv6-tcp-ex#ipv6-udp-ex");
cmdline_parse_token_string_t cmd_showport_rss_hash_rss_key =
TOKEN_STRING_INITIALIZER(struct cmd_showport_rss_hash, key, "key");
cmdline_parse_inst_t cmd_showport_rss_hash = {
.f = cmd_showport_rss_hash_parsed,
.data = NULL,
- .help_str = "show port X rss-hash (X = port number)\n",
+ .help_str =
+ "show port X rss-hash ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|"
+ "ipv4-sctp|ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|"
+ "ipv6-sctp|ipv6-other|l2-payload|"
+ "ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex (X = port number)\n",
.tokens = {
(void *)&cmd_showport_rss_hash_show,
(void *)&cmd_showport_rss_hash_port,
(void *)&cmd_showport_rss_hash_port_id,
(void *)&cmd_showport_rss_hash_rss_hash,
+ (void *)&cmd_showport_rss_hash_rss_hash_info,
NULL,
},
};
@@ -1969,12 +1997,17 @@ cmdline_parse_inst_t cmd_showport_rss_hash = {
cmdline_parse_inst_t cmd_showport_rss_hash_key = {
.f = cmd_showport_rss_hash_parsed,
.data = (void *)1,
- .help_str = "show port X rss-hash key (X = port number)\n",
+ .help_str =
+ "show port X rss-hash ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|"
+ "ipv4-sctp|ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|"
+ "ipv6-sctp|ipv6-other|l2-payload|"
+ "ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex key (X = port number)\n",
.tokens = {
(void *)&cmd_showport_rss_hash_show,
(void *)&cmd_showport_rss_hash_port,
(void *)&cmd_showport_rss_hash_port_id,
(void *)&cmd_showport_rss_hash_rss_hash,
+ (void *)&cmd_showport_rss_hash_rss_hash_info,
(void *)&cmd_showport_rss_hash_rss_key,
NULL,
},
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cf2aa6e..f3b96a3 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -97,6 +97,30 @@
static char *flowtype_to_str(uint16_t flow_type);
+struct rss_type_info {
+ char str[32];
+ uint64_t rss_type;
+};
+
+static const struct rss_type_info rss_type_table[] = {
+ { "ipv4", ETH_RSS_IPV4 },
+ { "ipv4-frag", ETH_RSS_FRAG_IPV4 },
+ { "ipv4-tcp", ETH_RSS_NONFRAG_IPV4_TCP },
+ { "ipv4-udp", ETH_RSS_NONFRAG_IPV4_UDP },
+ { "ipv4-sctp", ETH_RSS_NONFRAG_IPV4_SCTP },
+ { "ipv4-other", ETH_RSS_NONFRAG_IPV4_OTHER },
+ { "ipv6", ETH_RSS_IPV6 },
+ { "ipv6-frag", ETH_RSS_FRAG_IPV6 },
+ { "ipv6-tcp", ETH_RSS_NONFRAG_IPV6_TCP },
+ { "ipv6-udp", ETH_RSS_NONFRAG_IPV6_UDP },
+ { "ipv6-sctp", ETH_RSS_NONFRAG_IPV6_SCTP },
+ { "ipv6-other", ETH_RSS_NONFRAG_IPV6_OTHER },
+ { "l2-payload", ETH_RSS_L2_PAYLOAD },
+ { "ipv6-ex", ETH_RSS_IPV6_EX },
+ { "ipv6-tcp-ex", ETH_RSS_IPV6_TCP_EX },
+ { "ipv6-udp-ex", ETH_RSS_IPV6_UDP_EX },
+};
+
static void
print_ethaddr(const char *name, struct ether_addr *eth_addr)
{
@@ -852,31 +876,8 @@ port_rss_reta_info(portid_t port_id,
* key of the port.
*/
void
-port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
+port_rss_hash_conf_show(portid_t port_id, char rss_info[], int show_rss_key)
{
- struct rss_type_info {
- char str[32];
- uint64_t rss_type;
- };
- static const struct rss_type_info rss_type_table[] = {
- {"ipv4", ETH_RSS_IPV4},
- {"ipv4-frag", ETH_RSS_FRAG_IPV4},
- {"ipv4-tcp", ETH_RSS_NONFRAG_IPV4_TCP},
- {"ipv4-udp", ETH_RSS_NONFRAG_IPV4_UDP},
- {"ipv4-sctp", ETH_RSS_NONFRAG_IPV4_SCTP},
- {"ipv4-other", ETH_RSS_NONFRAG_IPV4_OTHER},
- {"ipv6", ETH_RSS_IPV6},
- {"ipv6-frag", ETH_RSS_FRAG_IPV6},
- {"ipv6-tcp", ETH_RSS_NONFRAG_IPV6_TCP},
- {"ipv6-udp", ETH_RSS_NONFRAG_IPV6_UDP},
- {"ipv6-sctp", ETH_RSS_NONFRAG_IPV6_SCTP},
- {"ipv6-other", ETH_RSS_NONFRAG_IPV6_OTHER},
- {"l2-payload", ETH_RSS_L2_PAYLOAD},
- {"ipv6-ex", ETH_RSS_IPV6_EX},
- {"ipv6-tcp-ex", ETH_RSS_IPV6_TCP_EX},
- {"ipv6-udp-ex", ETH_RSS_IPV6_UDP_EX},
- };
-
struct rte_eth_rss_conf rss_conf;
uint8_t rss_key[10 * 4];
uint64_t rss_hf;
@@ -885,6 +886,13 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
+
+ rss_conf.rss_hf = 0;
+ for (i = 0; i < RTE_DIM(rss_type_table); i++) {
+ if (!strcmp(rss_info, rss_type_table[i].str))
+ rss_conf.rss_hf = rss_type_table[i].rss_type;
+ }
+
/* Get RSS hash key if asked to display it */
rss_conf.rss_key = (show_rss_key) ? rss_key : NULL;
diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
@@ -922,12 +930,20 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
}
void
-port_rss_hash_key_update(portid_t port_id, uint8_t *hash_key)
+port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
+ uint hash_key_len)
{
struct rte_eth_rss_conf rss_conf;
int diag;
+ unsigned int i;
rss_conf.rss_key = NULL;
+ rss_conf.rss_key_len = hash_key_len;
+ rss_conf.rss_hf = 0;
+ for (i = 0; i < RTE_DIM(rss_type_table); i++) {
+ if (!strcmp(rss_type_table[i].str, rss_type))
+ rss_conf.rss_hf = rss_type_table[i].rss_type;
+ }
diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
if (diag == 0) {
rss_conf.rss_key = hash_key;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index d287274..31a7cb8 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -563,8 +563,10 @@ int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate);
int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
uint64_t q_msk);
-void port_rss_hash_conf_show(portid_t port_id, int show_rss_key);
-void port_rss_hash_key_update(portid_t port_id, uint8_t *hash_key);
+void port_rss_hash_conf_show(portid_t port_id, char rss_info[],
+ int show_rss_key);
+void port_rss_hash_key_update(portid_t port_id, char rss_type[],
+ uint8_t *hash_key, uint hash_key_len);
void get_syn_filter(uint8_t port_id);
void get_ethertype_filter(uint8_t port_id, uint16_t index);
void get_2tuple_filter(uint8_t port_id, uint16_t index);
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index aa77a91..a469b0b 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -179,7 +179,7 @@ show port rss-hash
Display the RSS hash functions and RSS hash key of a port:
-show port (port_id) rss-hash [key]
+show port (port_id) rss-hash ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex [key]
clear port
~~~~~~~~~~
--
2.1.0
next prev parent reply other threads:[~2015-10-05 17:55 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-05 17:54 [dpdk-dev] [PATCH 00/17] Enhance mlx5 with Mellanox OFED 3.1 Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 01/17] mlx5: use fast Verbs interface for scattered RX operation Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 02/17] mlx5: get rid of the WR structure in RX queue elements Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 03/17] mlx5: refactor RX code for the new Verbs RSS API Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 04/17] mlx5: restore allmulti and promisc modes after device restart Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 05/17] mlx5: use separate indirection table for default hash RX queue Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 06/17] mlx5: adapt indirection table size depending on RX queues number Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 07/17] mlx5: define specific flow steering rules for each hash RX QP Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 08/17] mlx5: use alternate method to configure promiscuous mode Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 09/17] mlx5: add RSS hash update/get Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 10/17] mlx5: use one RSS hash key per flow type Adrien Mazarguil
2015-10-05 17:54 ` Adrien Mazarguil [this message]
2015-10-05 17:54 ` [dpdk-dev] [PATCH 12/17] app/testpmd: fix missing initialization in the RSS hash show command Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 13/17] mlx5: remove normal MAC flows when enabling promiscuous mode Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 14/17] mlx5: use experimental flows in hash RX queues Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 15/17] mlx5: enable multi packet send WR in TX CQ Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 16/17] mlx5: fix compilation error with GCC < 4.6 Adrien Mazarguil
2015-10-05 17:54 ` [dpdk-dev] [PATCH 17/17] doc: update mlx5 documentation Adrien Mazarguil
2015-10-06 8:54 ` [dpdk-dev] [PATCH 00/17] Enhance mlx5 with Mellanox OFED 3.1 Stephen Hemminger
2015-10-06 9:58 ` Vincent JARDIN
2015-10-07 13:30 ` Joongi Kim
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 00/16] " Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 01/16] mlx5: use fast Verbs interface for scattered RX operation Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 02/16] mlx5: get rid of the WR structure in RX queue elements Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 03/16] mlx5: refactor RX code for the new Verbs RSS API Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 04/16] mlx5: use separate indirection table for default hash RX queue Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 05/16] mlx5: adapt indirection table size depending on RX queues number Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 06/16] mlx5: define specific flow steering rules for each hash RX QP Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 07/16] mlx5: use alternate method to configure promisc and allmulti modes Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 08/16] mlx5: add RSS hash update/get Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 09/16] mlx5: use one RSS hash key per flow type Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 10/16] app/testpmd: add missing type to RSS hash commands Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 11/16] app/testpmd: fix missing initialization in the RSS hash show command Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 12/16] mlx5: disable useless flows in promiscuous mode Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 13/16] mlx5: add IPv6 RSS support using experimental flows Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 14/16] mlx5: enable multi packet send WR in TX CQ Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 15/16] mlx5: fix compilation error with GCC < 4.6 Adrien Mazarguil
2015-10-30 18:55 ` [dpdk-dev] [PATCH v2 16/16] doc: update mlx5 documentation Adrien Mazarguil
2015-11-01 10:26 ` [dpdk-dev] [PATCH v2 00/16] Enhance mlx5 with Mellanox OFED 3.1 Thomas Monjalon
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=1444067692-29645-12-git-send-email-adrien.mazarguil@6wind.com \
--to=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
/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).