summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorShougang Wang <shougangx.wang@intel.com>2019-09-24 04:49:03 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-07 15:00:56 +0200
commit1cde1b9a9b4dbf31cb5e5ccdfc5da3cb079f43a2 (patch)
tree1647286d262f0f0ebb994e148b1e3ad3b525d697 /app
parent82a8f1385994d67e8c4181ad95651d1b39273d5b (diff)
downloaddpdk-1cde1b9a9b4dbf31cb5e5ccdfc5da3cb079f43a2.zip
dpdk-1cde1b9a9b4dbf31cb5e5ccdfc5da3cb079f43a2.tar.gz
dpdk-1cde1b9a9b4dbf31cb5e5ccdfc5da3cb079f43a2.tar.xz
app/testpmd: fix crash on port reset
port reset cause crash when ports are not stopped. Fixed by refusing the reset when port is not stopped. Fixes: 97f1e196799f ("app/testpmd: add port reset command") Cc: stable@dpdk.org Signed-off-by: Shougang Wang <shougangx.wang@intel.com> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Diffstat (limited to 'app')
-rw-r--r--app/test-pmd/cmdline.c3
-rw-r--r--app/test-pmd/testpmd.c6
2 files changed, 9 insertions, 0 deletions
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index dd4e6e6..def471d 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -758,6 +758,9 @@ static void cmd_help_long_parsed(void *parsed_result,
"port close (port_id|all)\n"
" Close all ports or port_id.\n\n"
+ "port reset (port_id|all)\n"
+ " Reset all ports or port_id.\n\n"
+
"port attach (ident)\n"
" Attach physical or virtual dev by pci address or virtual device name\n\n"
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 1e3dc44..5701f31 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2361,6 +2361,12 @@ reset_port(portid_t pid)
if (port_id_is_invalid(pid, ENABLED_WARN))
return;
+ if ((pid == (portid_t)RTE_PORT_ALL && !all_ports_stopped()) ||
+ (pid != (portid_t)RTE_PORT_ALL && !port_is_stopped(pid))) {
+ printf("Can not reset port(s), please stop port(s) first.\n");
+ return;
+ }
+
printf("Resetting ports...\n");
RTE_ETH_FOREACH_DEV(pi) {