summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Wiles <keith.wiles@intel.com>2017-09-10 19:00:09 -0500
committerKeith Wiles <keith.wiles@intel.com>2017-11-25 07:48:58 -0600
commit6dd2cf6aa1fe1961b93412ba78d14aedeb1be896 (patch)
tree3b6b345554e1c845da6cd8555e0455c590a4fe9b
parentc8f5cffb95737fdc623acade87f1f57d9f5aaef9 (diff)
downloaddpdk-draft-cli-6dd2cf6aa1fe1961b93412ba78d14aedeb1be896.zip
dpdk-draft-cli-6dd2cf6aa1fe1961b93412ba78d14aedeb1be896.tar.gz
dpdk-draft-cli-6dd2cf6aa1fe1961b93412ba78d14aedeb1be896.tar.xz
testpmd: fix show port crash
-rw-r--r--app/test-pmd/cli_cmds.c97
1 files changed, 58 insertions, 39 deletions
diff --git a/app/test-pmd/cli_cmds.c b/app/test-pmd/cli_cmds.c
index e435aee..531e134 100644
--- a/app/test-pmd/cli_cmds.c
+++ b/app/test-pmd/cli_cmds.c
@@ -1400,11 +1400,16 @@ showport_parse_reta_config(struct rte_eth_rss_reta_entry64 *conf,
static struct cli_map display_map[] = {
{ 0, "show port %d rss reta %d %s" },
- { 10, "show port %d 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" },
+ { 10, "show port %d 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" },
{ 20, "show bypass config %d" },
{ 30, "show bonding config %d"},
- { 40, "%|show|clear port %|info|stats|xstats|fdir|stat_qmap|dcb_tc|cap %d" },
+ { 40, "show port %|info|stats|xstats|fdir|stat_qmap|dcb_tc|cap %d" },
+ { 41, "show port %|info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all" },
+ { 45, "clear port %|info|stats|xstats|fdir|stat_qmap|dcb_tc|cap %d" },
+ { 46, "clear port %|info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all" },
{ 50, "show %|rxq|txq info %d %d" },
{ -1, NULL }
};
@@ -1424,10 +1429,11 @@ display_cmd(int argc, char **argv)
m = cli_mapping(display_map, argc, argv);
if (!m)
return -1;
+
pid = atoi(argv[2]);
- size = atoi(argv[5]);
switch(m->index) {
case 0:
+ size = atoi(argv[5]);
rte_eth_dev_info_get(pid, &dev_info);
if (dev_info.reta_size == 0 || size != dev_info.reta_size ||
size > ETH_RSS_RETA_SIZE_512) {
@@ -1615,49 +1621,62 @@ display_cmd(int argc, char **argv)
printf("\tPrimary: [%d]\n", primary_id);
}
break;
- case 40: /* %|show|clear %|info|stats|xstats|fdir|stat_qmap|dcb_tc|cap %d */
- pid = atoi(argv[2]);
+ case 40: /* show port %|info|stats|xstats|fdir|stat_qmap|dcb_tc|cap %d */
+ case 41: /* show port %|info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all */
n = rte_stropt("info|stats|xstats|fdir|stat_qmap|dcb_tc|cap",
- argv[1], "|");
- if (!strcmp(argv[0],"show")) {
+ argv[2], "|");
+
+ pid = 0;
+ if (m->index == 40) {
+ pid = atoi(argv[3]);
switch(n) {
- case 0:
- port_infos_display(pid);
- break;
- case 1:
- nic_stats_display(pid);
- break;
- case 2:
- nic_xstats_display(pid);
- break;
- case 3:
- fdir_get_infos(pid);
- break;
- case 4:
- nic_stats_mapping_display(pid);
- break;
- case 5:
- port_dcb_info_display(pid);
- break;
- case 6:
- break;
+ case 0: port_infos_display(pid); break;
+ case 1: nic_stats_display(pid); break;
+ case 2: nic_xstats_display(pid); break;
+ case 3: fdir_get_infos(pid); break;
+ case 4: nic_stats_mapping_display(pid); break;
+ case 5: port_dcb_info_display(pid); break;
+ case 6: port_offload_cap_display(pid); break;
default:
break;
}
- } else {
+ break;
+ }
+ RTE_ETH_FOREACH_DEV(pid)
switch(n) {
- case 0:
- return -1; /* Info is invalid for clear */
- case 1:
- nic_stats_clear(pid);
- break;
- case 2:
- nic_xstats_clear(pid);
+ case 0: port_infos_display(pid); break;
+ case 1: nic_stats_display(pid); break;
+ case 2: nic_xstats_display(pid); break;
+ case 3: fdir_get_infos(pid); break;
+ case 4: nic_stats_mapping_display(pid); break;
+ case 5: port_dcb_info_display(pid); break;
+ case 6: port_offload_cap_display(pid); break;
+ default:
break;
+ }
+ break;
+ case 45: /* clear port %|stats|xstats %d */
+ case 46: /* clear port %|stats|xstats all */
+ n = rte_stropt("stats|xstats", argv[2], "|");
+
+ pid = 0;
+ if (m->index == 45) {
+ pid = atoi(argv[3]);
+ switch(n) {
+ case 0: nic_stats_clear(pid); break;
+ case 1: nic_xstats_clear(pid); break;
default:
break;
}
+ break;
}
+ RTE_ETH_FOREACH_DEV(pid)
+ switch(n) {
+ case 0: nic_stats_clear(pid); break;
+ case 1: nic_xstats_clear(pid); break;
+ default:
+ break;
+ }
break;
case 50: /* show %|rxq|txq info %d %d */
pid = atoi(argv[4]);
@@ -5767,8 +5786,8 @@ reset_cmd(int argc, char **argv)
}
static struct cli_tree default_tree[] = {
- c_dir("/pmd"),
- c_cmd("help-pmd", help_cmd, "help command"),
+ c_dir("/bin"),
+ c_cmd("help", help_cmd, "help for testpmd commands"),
c_cmd("start", control_cmd, "Start packet forwarding"),
c_cmd("stop", control_cmd, "Stop packet forwarding"),
@@ -5810,7 +5829,7 @@ init_tree(void)
if (cli_add_tree(cli_root_node(), default_tree))
return -1;
- if (cli_add_bin_path("/pmd"))
+ if (cli_add_bin_path("/bin"))
return -1;
return 0;