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 <shah...@mellanox.com>
---
 app/test-pmd/testpmd.c | 16 ++++++++++++----
 app/test-pmd/testpmd.h |  1 +
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6785b09..77154ef 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1394,15 +1394,23 @@ static int eth_event_callback(portid_t port_id,
 }
 
 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 1639d27..ab74d39 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -682,6 +682,7 @@ int init_port_dcb_config(portid_t pid, enum dcb_mode_enable 
dcb_mode,
 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);
-- 
1.8.3.1

Reply via email to