" 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"
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;
};
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 =
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,
},
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 */
};
{
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 =
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,
},
};
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,
},
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)
{
* 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;
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);
}
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;