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>
"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"
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) {
testpmd> port close (port_id|all)
+port reset
+~~~~~~~~~~
+
+Reset all ports or a specific port::
+
+ testpmd> port reset (port_id|all)
+
+User should stop port(s) before resetting and (re-)start after reset.
+
port config - queue ring size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~