From: Radu Nicolau Date: Wed, 18 Jul 2018 13:21:17 +0000 (+0100) Subject: net/bonding: fix slave add for mode 4 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=94421f9e76bfea67c858eb806263b131d2188ff4;p=dpdk.git net/bonding: fix slave add for mode 4 Moved the link status validity check from the slave add to the slave activation step. Otherwise slave add will fail for mode 4 if the ports are all stopped but only one of them checked. Removed activate slave call from slave add function. Bugzilla ID: 52 Fixes: b77d21cc2364 ("ethdev: add link status get/set helper functions") Cc: stable@dpdk.org Signed-off-by: Radu Nicolau Acked-by: Declan Doherty --- diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 49fa2d78d4..8bc04cfd11 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -345,14 +345,6 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) internals->tx_queue_offload_capa &= dev_info.tx_queue_offload_capa; internals->flow_type_rss_offloads &= dev_info.flow_type_rss_offloads; - if (link_properties_valid(bonded_eth_dev, - &slave_eth_dev->data->dev_link) != 0) { - RTE_BOND_LOG(ERR, "Invalid link properties for slave %d" - " in bonding mode %d", slave_port_id, - internals->mode); - return -1; - } - /* RETA size is GCD of all slaves RETA sizes, so, if all sizes will be * the power of 2, the lower one is GCD */ @@ -412,11 +404,6 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) !internals->user_defined_primary_port) bond_ethdev_primary_set(internals, slave_port_id); - - if (find_slave_by_id(internals->active_slaves, - internals->active_slave_count, - slave_port_id) == internals->active_slave_count) - activate_slave(bonded_eth_dev, slave_port_id); } } diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index ca74eb0b4a..58f7377c60 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2732,6 +2732,17 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, mac_address_slaves_update(bonded_eth_dev); } + /* check link state properties if bonded link is up*/ + if (bonded_eth_dev->data->dev_link.link_status == ETH_LINK_UP) { + if (link_properties_valid(bonded_eth_dev, &link) != 0) + RTE_BOND_LOG(ERR, "Invalid link properties " + "for slave %d in bonding mode %d", + port_id, internals->mode); + } else { + /* inherit slave link properties */ + link_properties_set(bonded_eth_dev, &link); + } + activate_slave(bonded_eth_dev, port_id); /* If user has defined the primary port then default to using it */