From: Chas Williams Date: Wed, 17 Jan 2018 16:44:44 +0000 (-0500) Subject: net/bonding: do not early mark device as bonded X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b61d8340020666879def3f8f6cc2f6f763ae6bf0;p=dpdk.git net/bonding: do not early mark device as bonded bonding immediately marks the incoming eth device as bonded and doesn't clear this in later error paths. Delay marking the dev until we are certain that we are going to add this eth device to the bond group. Signed-off-by: Chas Williams Acked-by: Radu Nicolau --- diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 03b73be032..b73cb73c3b 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -242,9 +242,6 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) return -1; } - /* Add slave details to bonded device */ - slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE; - rte_eth_dev_info_get(slave_port_id, &dev_info); if (dev_info.max_rx_pktlen < internals->max_rx_pktlen) { RTE_BOND_LOG(ERR, "Slave (port %u) max_rx_pktlen too small", @@ -316,18 +313,21 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) internals->slave_count++; - /* Update all slave devices MACs*/ - mac_address_slaves_update(bonded_eth_dev); - if (bonded_eth_dev->data->dev_started) { if (slave_configure(bonded_eth_dev, slave_eth_dev) != 0) { - slave_eth_dev->data->dev_flags &= (~RTE_ETH_DEV_BONDED_SLAVE); + internals->slave_count--; RTE_BOND_LOG(ERR, "rte_bond_slaves_configure: port=%d", slave_port_id); return -1; } } + /* Add slave details to bonded device */ + slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE; + + /* Update all slave devices MACs*/ + mac_address_slaves_update(bonded_eth_dev); + /* Register link status change callback with bonded device pointer as * argument*/ rte_eth_dev_callback_register(slave_port_id, RTE_ETH_EVENT_INTR_LSC,