From: Shahaf Shuler <shahafs@mellanox.com>
Date: Wed, 10 Jan 2018 09:09:11 +0000 (+0200)
Subject: app/testpmd: add function to check port stopped
X-Git-Tag: spdx-start~705
X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6018eb8cc8b072a99fa9a2bdff9466947b7367d8;p=dpdk.git

app/testpmd: add function to check port stopped

This patch adds supports for checking if a single port is stopped.
currently there is a function to check only for all ports.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 686d9e4dd6..27268f1e7f 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1365,16 +1365,24 @@ all_ports_started(void)
 	return 1;
 }
 
+int
+port_is_stopped(portid_t port_id)
+{
+	struct rte_port *port = &ports[port_id];
+
+	if ((port->port_status != RTE_PORT_STOPPED) &&
+	    (port->slave_flag == 0))
+		return 0;
+	return 1;
+}
+
 int
 all_ports_stopped(void)
 {
 	portid_t pi;
-	struct rte_port *port;
 
 	RTE_ETH_FOREACH_DEV(pi) {
-		port = &ports[pi];
-		if ((port->port_status != RTE_PORT_STOPPED) &&
-			(port->slave_flag == 0))
+		if (!port_is_stopped(pi))
 			return 0;
 	}
 
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 2a266fd1b7..ed0f6a0fe7 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -654,6 +654,7 @@ void reset_port(portid_t pid);
 void attach_port(char *identifier);
 void detach_port(portid_t port_id);
 int all_ports_stopped(void);
+int port_is_stopped(portid_t port_id);
 int port_is_started(portid_t port_id);
 void pmd_test_exit(void);
 void fdir_get_infos(portid_t port_id);