[dpdk-dev,v3,2/2] test-pmd: modified testpmd for link_bonding
diff mbox

Message ID 1434126088-28333-3-git-send-email-bernard.iremonger@intel.com
State Superseded, archived
Headers show

Commit Message

Iremonger, Bernard June 12, 2015, 4:21 p.m. UTC
When the bonded port is started it also starts the slave port,
but the slave port status is not set. A slave_flag has been
added to struct rte_port to resolve this issue.

Changes in V3:
test-pmd changes added to patchset.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/cmdline.c |    4 +++-
 app/test-pmd/testpmd.c |   24 +++++++++++++++++++++---
 app/test-pmd/testpmd.h |    7 +++++--
 3 files changed, 29 insertions(+), 6 deletions(-)

Patch
diff mbox

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f01db2a..a9c1b8b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1,7 +1,7 @@ 
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   Copyright(c) 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -3950,6 +3950,7 @@  static void cmd_add_bonding_slave_parsed(void *parsed_result,
 		return;
 	}
 	init_port_config();
+	set_port_slave_flag(slave_port_id);
 }
 
 cmdline_parse_token_string_t cmd_addbonding_slave_add =
@@ -4006,6 +4007,7 @@  static void cmd_remove_bonding_slave_parsed(void *parsed_result,
 		return;
 	}
 	init_port_config();
+	clear_port_slave_flag(slave_port_id);
 }
 
 cmdline_parse_token_string_t cmd_removebonding_slave_remove =
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 82b465d..b271728 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1,7 +1,7 @@ 
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -1202,7 +1202,8 @@  all_ports_started(void)
 	FOREACH_PORT(pi, ports) {
 		port = &ports[pi];
 		/* Check if there is a port which is not started */
-		if (port->port_status != RTE_PORT_STARTED)
+		if ((port->port_status != RTE_PORT_STARTED) &&
+			(port->slave_flag == 0))
 			return 0;
 	}
 
@@ -1218,7 +1219,8 @@  all_ports_stopped(void)
 
 	FOREACH_PORT(pi, ports) {
 		port = &ports[pi];
-		if (port->port_status != RTE_PORT_STOPPED)
+		if ((port->port_status != RTE_PORT_STOPPED) &&
+			(port->slave_flag == 0))
 			return 0;
 	}
 
@@ -1810,6 +1812,22 @@  init_port_config(void)
 	}
 }
 
+void set_port_slave_flag(portid_t slave_pid)
+{
+	struct rte_port *port;
+
+	port = &ports[slave_pid];
+	port->slave_flag = 1;
+}
+
+void clear_port_slave_flag(portid_t slave_pid)
+{
+	struct rte_port *port;
+
+	port = &ports[slave_pid];
+	port->slave_flag = 0;
+}
+
 const uint16_t vlan_tags[] = {
 		0,  1,  2,  3,  4,  5,  6,  7,
 		8,  9, 10, 11,  12, 13, 14, 15,
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index c3b6700..466964d 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1,7 +1,7 @@ 
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -159,9 +159,10 @@  struct rte_port {
 	uint8_t                 need_reconfig;  /**< need reconfiguring port or not */
 	uint8_t                 need_reconfig_queues; /**< need reconfiguring queues or not */
 	uint8_t                 rss_flag;   /**< enable rss or not */
-	uint8_t			dcb_flag;   /**< enable dcb */
+	uint8_t			        dcb_flag;   /**< enable dcb */
 	struct rte_eth_rxconf   rx_conf;    /**< rx configuration */
 	struct rte_eth_txconf   tx_conf;    /**< tx configuration */
+	uint8_t                 slave_flag; /**< bonding slave port */
 };
 
 extern portid_t __rte_unused
@@ -528,6 +529,8 @@  void stop_packet_forwarding(void);
 void dev_set_link_up(portid_t pid);
 void dev_set_link_down(portid_t pid);
 void init_port_config(void);
+void set_port_slave_flag(portid_t slave_pid);
+void clear_port_slave_flag(portid_t slave_pid);
 int init_port_dcb_config(portid_t pid,struct dcb_config *dcb_conf);
 int start_port(portid_t pid);
 void stop_port(portid_t pid);