From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 13/13] app/testpmd: rework of commands for updating/querying reta
Date: Thu, 25 Sep 2014 16:40:27 +0800 [thread overview]
Message-ID: <1411634427-746-14-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1411634427-746-1-git-send-email-helin.zhang@intel.com>
As multiple sizes of redirection table have been supported,
the commands of updating/querying reta need to be reworked
as well. In addition, the reta size can be queried by the
existing command of 'show port info <>'.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Jijiang Liu <jijiang.liu@intel.com>
Reviewed-by: Cunming Liang <cunming.liang@intel.com>
Reviewed-by: Jingjing Wu <jingjing.wu@intel.com>
---
app/test-pmd/cmdline.c | 144 ++++++++++++++++++++++++++++++++++++-------------
app/test-pmd/config.c | 37 +++++++------
app/test-pmd/testpmd.h | 4 +-
3 files changed, 129 insertions(+), 56 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 933c6f9..accdc8e 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -59,6 +59,7 @@
#include <rte_cycles.h>
#include <rte_memory.h>
#include <rte_memzone.h>
+#include <rte_malloc.h>
#include <rte_launch.h>
#include <rte_tailq.h>
#include <rte_eal.h>
@@ -186,6 +187,11 @@ static void cmd_help_long_parsed(void *parsed_result,
"show port (info|stats|xstats|fdir|stat_qmap) (port_id|all)\n"
" Display information for port_id, or all.\n\n"
+ "show port X rss reta (size) (mask0,mask1,...)\n"
+ " Display the rss redirection table entry indicated"
+ " by masks on port X. size is used to indicate the"
+ " hardware supported reta size\n\n"
+
"show port rss-hash [key]\n"
" Display the RSS hash functions and RSS hash key"
" of port X\n\n"
@@ -1535,11 +1541,13 @@ struct cmd_config_rss_reta {
};
static int
-parse_reta_config(const char *str, struct rte_eth_rss_reta *reta_conf)
+parse_reta_config(const char *str,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t nb_entries)
{
int i;
unsigned size;
- uint8_t hash_index;
+ uint16_t hash_index, idx, shift;
uint8_t nb_queue;
char s[256];
const char *p, *p0 = str;
@@ -1567,24 +1575,23 @@ parse_reta_config(const char *str, struct rte_eth_rss_reta *reta_conf)
for (i = 0; i < _NUM_FLD; i++) {
errno = 0;
int_fld[i] = strtoul(str_fld[i], &end, 0);
- if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
+ if (errno != 0 || end == str_fld[i] ||
+ int_fld[i] > 65535)
return -1;
}
- hash_index = (uint8_t)int_fld[FLD_HASH_INDEX];
+ hash_index = (uint16_t)int_fld[FLD_HASH_INDEX];
nb_queue = (uint8_t)int_fld[FLD_QUEUE];
- if (hash_index >= ETH_RSS_RETA_NUM_ENTRIES) {
+ if (hash_index >= nb_entries) {
printf("Invalid RETA hash index=%d\n", hash_index);
return -1;
}
- if (hash_index < ETH_RSS_RETA_NUM_ENTRIES/2)
- reta_conf->mask_lo |= (1ULL << hash_index);
- else
- reta_conf->mask_hi |= (1ULL << (hash_index - ETH_RSS_RETA_NUM_ENTRIES/2));
-
- reta_conf->reta[hash_index] = nb_queue;
+ idx = hash_index / RTE_BIT_WIDTH_64;
+ shift = hash_index % RTE_BIT_WIDTH_64;
+ reta_conf[idx].mask |= (1ULL << shift);
+ reta_conf[idx].reta[shift] = nb_queue;
}
return 0;
@@ -1596,17 +1603,35 @@ cmd_set_rss_reta_parsed(void *parsed_result,
__attribute__((unused)) void *data)
{
int ret;
- struct rte_eth_rss_reta reta_conf;
+ struct rte_eth_dev_info dev_info;
+ struct rte_eth_rss_reta_entry64 reta_conf[8];
struct cmd_config_rss_reta *res = parsed_result;
- memset(&reta_conf, 0, sizeof(struct rte_eth_rss_reta));
+ memset(&dev_info, 0, sizeof(dev_info));
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+ if (dev_info.reta_size == 0) {
+ printf("Redirection table size is 0 which is "
+ "invalid for RSS\n");
+ return;
+ } else
+ printf("The reta size of port %d is %u\n",
+ res->port_id, dev_info.reta_size);
+ if (dev_info.reta_size > ETH_RSS_RETA_SIZE_512) {
+ printf("Currently do not support more than %u entries of "
+ "redirection table\n", ETH_RSS_RETA_SIZE_512);
+ return;
+ }
+
+ memset(reta_conf, 0, sizeof(reta_conf));
if (!strcmp(res->list_name, "reta")) {
- if (parse_reta_config(res->list_of_items, &reta_conf)) {
+ if (parse_reta_config(res->list_of_items, reta_conf,
+ dev_info.reta_size)) {
printf("Invalid RSS Redirection Table "
"config entered\n");
return;
}
- ret = rte_eth_dev_rss_reta_update(res->port_id, &reta_conf);
+ ret = rte_eth_dev_rss_reta_update(res->port_id,
+ reta_conf, dev_info.reta_size);
if (ret != 0)
printf("Bad redirection table parameter, "
"return code = %d \n", ret);
@@ -1648,26 +1673,73 @@ struct cmd_showport_reta {
uint8_t port_id;
cmdline_fixed_string_t rss;
cmdline_fixed_string_t reta;
- uint64_t mask_lo;
- uint64_t mask_hi;
+ uint16_t size;
+ cmdline_fixed_string_t list_of_items;
};
-static void cmd_showport_reta_parsed(void *parsed_result,
- __attribute__((unused)) struct cmdline *cl,
- __attribute__((unused)) void *data)
+static int
+showport_parse_reta_config(struct rte_eth_rss_reta_entry64 *conf,
+ uint16_t nb_entries,
+ char *str)
{
- struct cmd_showport_reta *res = parsed_result;
- struct rte_eth_rss_reta reta_conf;
+ uint32_t size;
+ const char *p, *p0 = str;
+ char s[256];
+ char *end;
+ char *str_fld[8];
+ uint16_t i, num = nb_entries / RTE_BIT_WIDTH_64;
+ int ret;
- if ((res->mask_lo == 0) && (res->mask_hi == 0)) {
- printf("Invalid RSS Redirection Table config entered\n");
- return;
+ p = strchr(p0, '(');
+ if (p == NULL)
+ return -1;
+ p++;
+ p0 = strchr(p, ')');
+ if (p0 == NULL)
+ return -1;
+ size = p0 - p;
+ if (size >= sizeof(s)) {
+ printf("The string size exceeds the internal buffer size\n");
+ return -1;
}
+ snprintf(s, sizeof(s), "%.*s", size, p);
+ ret = rte_strsplit(s, sizeof(s), str_fld, num, ',');
+ if (ret <= 0 || ret != num) {
+ printf("The bits of masks do not match the number of "
+ "reta entries: %u\n", num);
+ return -1;
+ }
+ for (i = 0; i < ret; i++)
+ conf[i].mask = (uint64_t)strtoul(str_fld[i], &end, 0);
- reta_conf.mask_lo = res->mask_lo;
- reta_conf.mask_hi = res->mask_hi;
+ return 0;
+}
- port_rss_reta_info(res->port_id,&reta_conf);
+static void
+cmd_showport_reta_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_showport_reta *res = parsed_result;
+ struct rte_eth_rss_reta_entry64 reta_conf[8];
+ struct rte_eth_dev_info dev_info;
+
+ memset(&dev_info, 0, sizeof(dev_info));
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+ if (dev_info.reta_size == 0 || res->size != dev_info.reta_size ||
+ res->size > ETH_RSS_RETA_SIZE_512) {
+ printf("Invalid redirection table size: %u\n", res->size);
+ return;
+ }
+
+ memset(reta_conf, 0, sizeof(reta_conf));
+ if (showport_parse_reta_config(reta_conf, res->size,
+ res->list_of_items) < 0) {
+ printf("Invalid string: %s for reta masks\n",
+ res->list_of_items);
+ return;
+ }
+ port_rss_reta_info(res->port_id, reta_conf, res->size);
}
cmdline_parse_token_string_t cmd_showport_reta_show =
@@ -1680,24 +1752,24 @@ cmdline_parse_token_string_t cmd_showport_reta_rss =
TOKEN_STRING_INITIALIZER(struct cmd_showport_reta, rss, "rss");
cmdline_parse_token_string_t cmd_showport_reta_reta =
TOKEN_STRING_INITIALIZER(struct cmd_showport_reta, reta, "reta");
-cmdline_parse_token_num_t cmd_showport_reta_mask_lo =
- TOKEN_NUM_INITIALIZER(struct cmd_showport_reta, mask_lo, UINT64);
-cmdline_parse_token_num_t cmd_showport_reta_mask_hi =
- TOKEN_NUM_INITIALIZER(struct cmd_showport_reta, mask_hi, UINT64);
+cmdline_parse_token_num_t cmd_showport_reta_size =
+ TOKEN_NUM_INITIALIZER(struct cmd_showport_reta, size, UINT16);
+cmdline_parse_token_string_t cmd_showport_reta_list_of_items =
+ TOKEN_STRING_INITIALIZER(struct cmd_showport_reta,
+ list_of_items, NULL);
cmdline_parse_inst_t cmd_showport_reta = {
.f = cmd_showport_reta_parsed,
.data = NULL,
- .help_str = "show port X rss reta mask_lo mask_hi (X = port number)\n\
- (mask_lo and mask_hi is UINT64)",
+ .help_str = "show port X rss reta (size) (mask0,mask1,...)",
.tokens = {
(void *)&cmd_showport_reta_show,
(void *)&cmd_showport_reta_port,
(void *)&cmd_showport_reta_port_id,
(void *)&cmd_showport_reta_rss,
(void *)&cmd_showport_reta_reta,
- (void *)&cmd_showport_reta_mask_lo,
- (void *)&cmd_showport_reta_mask_hi,
+ (void *)&cmd_showport_reta_size,
+ (void *)&cmd_showport_reta_list_of_items,
NULL,
},
};
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 84c59b7..2287ccc 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -288,6 +288,7 @@ port_infos_display(portid_t port_id)
struct rte_port *port;
struct ether_addr mac_addr;
struct rte_eth_link link;
+ struct rte_eth_dev_info dev_info;
int vlan_offload;
struct rte_mempool * mp;
static const char *info_border = "*********************";
@@ -343,6 +344,11 @@ port_infos_display(portid_t port_id)
else
printf(" qinq(extend) off \n");
}
+
+ memset(&dev_info, 0, sizeof(dev_info));
+ rte_eth_dev_info_get(port_id, &dev_info);
+ if (dev_info.reta_size > 0)
+ printf("Redirection table size: %u\n", dev_info.reta_size);
}
int
@@ -762,36 +768,29 @@ rxtx_config_display(void)
}
void
-port_rss_reta_info(portid_t port_id,struct rte_eth_rss_reta *reta_conf)
+port_rss_reta_info(portid_t port_id,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t nb_entries)
{
- uint8_t i, j;
+ uint16_t i, idx, shift;
int ret;
if (port_id_is_invalid(port_id))
return;
- ret = rte_eth_dev_rss_reta_query(port_id, reta_conf);
+ ret = rte_eth_dev_rss_reta_query(port_id, reta_conf, nb_entries);
if (ret != 0) {
printf("Failed to get RSS RETA info, return code = %d\n", ret);
return;
}
- if (reta_conf->mask_lo != 0) {
- for (i = 0; i< ETH_RSS_RETA_NUM_ENTRIES/2; i++) {
- if (reta_conf->mask_lo & (uint64_t)(1ULL << i))
- printf("RSS RETA configuration: hash index=%d,"
- "queue=%d\n",i,reta_conf->reta[i]);
- }
- }
-
- if (reta_conf->mask_hi != 0) {
- for (i = 0; i< ETH_RSS_RETA_NUM_ENTRIES/2; i++) {
- if(reta_conf->mask_hi & (uint64_t)(1ULL << i)) {
- j = (uint8_t)(i + ETH_RSS_RETA_NUM_ENTRIES/2);
- printf("RSS RETA configuration: hash index=%d,"
- "queue=%d\n",j,reta_conf->reta[j]);
- }
- }
+ for (i = 0; i < nb_entries; i++) {
+ idx = i / RTE_BIT_WIDTH_64;
+ shift = i % RTE_BIT_WIDTH_64;
+ if (!(reta_conf[idx].mask & (1ULL << shift)))
+ continue;
+ printf("RSS RETA configuration: hash index=%u, queue=%u\n",
+ i, reta_conf[idx].reta[shift]);
}
}
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9cbfeac..10bf13f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -533,7 +533,9 @@ void fdir_remove_perfect_filter(portid_t port_id, uint16_t soft_id,
struct rte_fdir_filter *fdir_filter);
void fdir_set_masks(portid_t port_id, struct rte_fdir_masks *fdir_masks);
-void port_rss_reta_info(portid_t port_id, struct rte_eth_rss_reta *reta_conf);
+void port_rss_reta_info(portid_t port_id,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t nb_entries);
void set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on);
void set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id,
--
1.8.1.4
next prev parent reply other threads:[~2014-09-25 8:34 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-25 8:40 [dpdk-dev] [PATCH v2 00/13] support of multiple sizes of redirection table Helin Zhang
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 01/13] app/testpmd: code style fix Helin Zhang
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 02/13] i40evf: " Helin Zhang
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 03/13] ethdev: add more annotation Helin Zhang
2014-10-21 20:38 ` Thomas Monjalon
2014-10-21 22:20 ` Zhang, Helin
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 04/13] ethdev: support of multiple sizes of redirection table Helin Zhang
2014-10-21 20:53 ` Thomas Monjalon
2014-10-28 0:33 ` Zhang, Helin
2014-10-28 10:10 ` Thomas Monjalon
2014-10-28 10:18 ` Richardson, Bruce
2014-10-28 13:20 ` Zhang, Helin
2014-10-28 14:22 ` Thomas Monjalon
2014-10-29 8:18 ` Zhang, Helin
2014-10-28 12:00 ` Zhang, Helin
2014-10-28 12:13 ` Thomas Monjalon
2014-10-28 12:36 ` Zhang, Helin
2014-10-29 8:24 ` Zhang, Helin
2014-10-29 10:00 ` Thomas Monjalon
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 05/13] igb: add new function for VF ops of 'dev_infos_get' Helin Zhang
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 06/13] igb: rework of updating/querying reta Helin Zhang
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 07/13] ixgbe: add new function for VF ops of 'dev_infos_get' Helin Zhang
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 08/13] ixgbe: rework of updating/querying reta Helin Zhang
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 09/13] i40e: support of setting hash lookup table size Helin Zhang
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 10/13] i40e: support of getting redirection " Helin Zhang
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 11/13] i40e: rework of updating/querying reta Helin Zhang
2014-09-25 8:40 ` [dpdk-dev] [PATCH v2 12/13] i40evf: support of updating/querying redirection table Helin Zhang
2014-09-25 8:40 ` Helin Zhang [this message]
2014-10-10 3:11 ` [dpdk-dev] [PATCH v2 00/13] support of multiple sizes of " Liang, Cunming
2014-10-22 11:53 ` [dpdk-dev] [PATCH v3 0/8] " Helin Zhang
2014-10-22 11:53 ` [dpdk-dev] [PATCH v3 1/8] app/testpmd: code style fix Helin Zhang
2014-10-22 11:53 ` [dpdk-dev] [PATCH v3 2/8] i40evf: " Helin Zhang
2014-10-22 11:53 ` [dpdk-dev] [PATCH v3 3/8] i40e: support of setting hash lookup table size Helin Zhang
2014-10-27 14:13 ` Thomas Monjalon
2014-10-27 20:21 ` Matthew Hall
2014-10-27 21:41 ` Thomas Monjalon
2014-10-22 11:53 ` [dpdk-dev] [PATCH v3 4/8] igb: implement ops of 'dev_infos_get' for PF and VF respectively Helin Zhang
2014-10-22 11:53 ` [dpdk-dev] [PATCH v3 5/8] ixgbe: " Helin Zhang
2014-10-22 11:53 ` [dpdk-dev] [PATCH v3 6/8] i40e: rework of ops of 'dev_infos_get' for both PF and VF Helin Zhang
2014-10-22 11:53 ` [dpdk-dev] [PATCH v3 7/8] ethdev: support of multiple sizes of redirection table Helin Zhang
2014-10-27 14:23 ` Thomas Monjalon
2014-10-28 0:37 ` Zhang, Helin
2014-10-28 10:04 ` Thomas Monjalon
2014-10-31 1:39 ` Zhang, Helin
2014-10-31 8:46 ` Thomas Monjalon
2014-10-22 11:53 ` [dpdk-dev] [PATCH v3 8/8] i40evf: support of updating/querying " Helin Zhang
2014-10-31 9:03 ` [dpdk-dev] [PATCH v4 0/8] support of multiple sizes of " Helin Zhang
2014-10-31 9:03 ` [dpdk-dev] [PATCH v4 1/8] app/testpmd: code style fix Helin Zhang
2014-10-31 9:03 ` [dpdk-dev] [PATCH v4 2/8] i40evf: " Helin Zhang
2014-10-31 9:03 ` [dpdk-dev] [PATCH v4 3/8] i40e: support of setting hash lookup table size Helin Zhang
2014-10-31 9:03 ` [dpdk-dev] [PATCH v4 4/8] igb: implement ops of 'dev_infos_get' for PF and VF respectively Helin Zhang
2014-10-31 9:03 ` [dpdk-dev] [PATCH v4 5/8] ixgbe: " Helin Zhang
2014-10-31 9:03 ` [dpdk-dev] [PATCH v4 6/8] i40e: rework of ops of 'dev_infos_get' for both PF and VF Helin Zhang
2014-10-31 9:03 ` [dpdk-dev] [PATCH v4 7/8] ethdev: support of multiple sizes of redirection table Helin Zhang
2014-11-05 20:52 ` Thomas Monjalon
2014-11-06 1:02 ` Zhang, Helin
2014-11-06 8:33 ` Thomas Monjalon
2014-11-06 8:52 ` Zhang, Helin
2014-10-31 9:03 ` [dpdk-dev] [PATCH v4 8/8] i40evf: support of updating/querying " Helin Zhang
2014-11-06 14:25 ` [dpdk-dev] [PATCH v5 0/8] support of multiple sizes of " Helin Zhang
2014-11-06 14:25 ` [dpdk-dev] [PATCH v5 1/8] app/testpmd: code style fix Helin Zhang
2014-11-06 14:25 ` [dpdk-dev] [PATCH v5 2/8] i40evf: " Helin Zhang
2014-11-06 14:25 ` [dpdk-dev] [PATCH v5 3/8] i40e: support of setting hash lookup table size Helin Zhang
2014-11-06 14:25 ` [dpdk-dev] [PATCH v5 4/8] igb: implement ops of 'dev_infos_get' for PF and VF respectively Helin Zhang
2014-11-06 14:25 ` [dpdk-dev] [PATCH v5 5/8] ixgbe: " Helin Zhang
2014-11-06 14:25 ` [dpdk-dev] [PATCH v5 6/8] i40e: rework of ops of 'dev_infos_get' for both PF and VF Helin Zhang
2014-11-06 14:25 ` [dpdk-dev] [PATCH v5 7/8] ethdev: support of multiple sizes of redirection table Helin Zhang
2014-11-06 14:25 ` [dpdk-dev] [PATCH v5 8/8] i40evf: support of updating/querying " Helin Zhang
2014-11-15 16:03 ` [dpdk-dev] [PATCH v6 0/8] support of multiple sizes of " Helin Zhang
2014-11-15 16:03 ` [dpdk-dev] [PATCH v6 1/8] app/testpmd: code style fix Helin Zhang
2014-11-15 16:03 ` [dpdk-dev] [PATCH v6 2/8] i40evf: " Helin Zhang
2014-11-15 16:03 ` [dpdk-dev] [PATCH v6 3/8] i40e: support of setting hash lookup table size Helin Zhang
2014-11-15 16:03 ` [dpdk-dev] [PATCH v6 4/8] igb: implement ops of 'dev_infos_get' for PF and VF respectively Helin Zhang
2014-11-15 16:03 ` [dpdk-dev] [PATCH v6 5/8] ixgbe: " Helin Zhang
2014-11-15 16:03 ` [dpdk-dev] [PATCH v6 6/8] i40e: rework of ops of 'dev_infos_get' for both PF and VF Helin Zhang
2014-11-15 16:03 ` [dpdk-dev] [PATCH v6 7/8] ethdev: support of multiple sizes of redirection table Helin Zhang
2014-11-15 16:03 ` [dpdk-dev] [PATCH v6 8/8] i40evf: support of updating/querying " Helin Zhang
2014-11-24 22:20 ` Thomas Monjalon
2014-11-25 0:28 ` Zhang, Helin
2014-11-17 13:39 ` [dpdk-dev] [PATCH v6 0/8] support of multiple sizes of " Ananyev, Konstantin
2014-11-24 22:00 ` Thomas Monjalon
2014-11-19 9:28 ` Chen, Erlu
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=1411634427-746-14-git-send-email-helin.zhang@intel.com \
--to=helin.zhang@intel.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).