[dpdk-dev] [PATCH v5 3/3] app/testpmd: fix port stop

Bernard Iremonger bernard.iremonger at intel.com
Wed Jan 25 15:36:03 CET 2017


The rte_eth_dev_stop function is not called if the port_status is
not RTE_PORT_STARTED. This can happen if the rte_eth_dev_start
function is called directly, ie not through the start_port function.

Make sure rte_eth_dev_stop is always called in stop_port function.

Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
Signed-off-by: Bernard Iremonger <bernard.iremonger at intel.com>
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index ed7d83c..2d0ca3f 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1490,13 +1490,13 @@ stop_port(portid_t pid)
 			continue;
 		}
 
+		rte_eth_dev_stop(pi);
+
 		port = &ports[pi];
 		if (rte_atomic16_cmpset(&(port->port_status), RTE_PORT_STARTED,
 						RTE_PORT_HANDLING) == 0)
 			continue;
 
-		rte_eth_dev_stop(pi);
-
 		if (rte_atomic16_cmpset(&(port->port_status),
 			RTE_PORT_HANDLING, RTE_PORT_STOPPED) == 0)
 			printf("Port %d can not be set into stopped\n", pi);
-- 
2.10.1



More information about the dev mailing list