From: Bernard Iremonger Date: Mon, 27 Jul 2015 15:54:35 +0000 (+0100) Subject: app/testpmd: fix bonding start X-Git-Tag: spdx-start~8625 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=41b05095c4d1;p=dpdk.git app/testpmd: fix bonding start 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. Signed-off-by: Bernard Iremonger Acked-by: Declan Doherty --- diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b9d844cda1..5799c9cac7 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. * @@ -4018,6 +4018,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 = @@ -4074,6 +4075,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 4769533333..4bcece6727 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -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; } @@ -1808,6 +1810,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 e91e07704a..d287274f43 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 @@ -162,11 +162,12 @@ 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 */ struct ether_addr *mc_addr_pool; /**< pool of multicast addrs */ uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ + uint8_t slave_flag; /**< bonding slave port */ }; extern portid_t __rte_unused @@ -534,6 +535,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);