From: Eric Kinzie Date: Thu, 4 Aug 2016 18:24:42 +0000 (-0700) Subject: net/bonding: validate speed after link up X-Git-Tag: spdx-start~5578 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b4092cacf6bd6470c0c37937862255639293e9b0;p=dpdk.git net/bonding: validate speed after link up It's possible for the bonding driver to mistakenly reject an interface based in it's, as yet, unnegotiated link speed and duplex. Always allow the interface to be added to the bonding interface but require link properties validation to succeed before slave is activated. Fixes: 2efb58cbab6e ("bond: new link bonding library") Signed-off-by: Eric Kinzie Acked-by: Bernard Iremonger --- diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 8514652ae1..8a20999c1e 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -373,21 +373,6 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id) internals->candidate_max_rx_pktlen = dev_info.max_rx_pktlen; } else { - /* Check slave link properties are supported if props are set, - * all slaves must be the same */ - if (internals->link_props_set) { - if (link_properties_valid(&(bonded_eth_dev->data->dev_link), - &(slave_eth_dev->data->dev_link))) { - slave_eth_dev->data->dev_flags &= (~RTE_ETH_DEV_BONDED_SLAVE); - RTE_BOND_LOG(ERR, - "Slave port %d link speed/duplex not supported", - slave_port_id); - return -1; - } - } else { - link_properties_set(bonded_eth_dev, - &(slave_eth_dev->data->dev_link)); - } internals->rx_offload_capa &= dev_info.rx_offload_capa; internals->tx_offload_capa &= dev_info.tx_offload_capa; internals->flow_type_rss_offloads &= dev_info.flow_type_rss_offloads; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 970fe0c8b0..8cec1f44ff 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1985,6 +1985,16 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type, /* Inherit eth dev link properties from first active slave */ link_properties_set(bonded_eth_dev, &(slave_eth_dev->data->dev_link)); + } else { + if (link_properties_valid( + &bonded_eth_dev->data->dev_link, &link) != 0) { + slave_eth_dev->data->dev_flags &= + (~RTE_ETH_DEV_BONDED_SLAVE); + RTE_LOG(ERR, PMD, + "port %u invalid speed/duplex\n", + port_id); + return; + } } activate_slave(bonded_eth_dev, port_id);