net/ixgbe/base: update X550 SFP identification
[dpdk.git] / drivers / net / bonding / rte_eth_bond_api.c
index d558df8..8bc04cf 100644 (file)
@@ -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
                 */
@@ -373,6 +365,13 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
                return -1;
        }
 
+       /* Add additional MAC addresses to the slave */
+       if (slave_add_mac_addresses(bonded_eth_dev, slave_port_id) != 0) {
+               RTE_BOND_LOG(ERR, "Failed to add mac address(es) to slave %hu",
+                               slave_port_id);
+               return -1;
+       }
+
        internals->slave_count++;
 
        if (bonded_eth_dev->data->dev_started) {
@@ -387,7 +386,7 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
        /* Add slave details to bonded device */
        slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE;
 
-       /* Update all slave devices MACs*/
+       /* Update all slave devices MACs */
        mac_address_slaves_update(bonded_eth_dev);
 
        /* Register link status change callback with bonded device pointer as
@@ -405,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);
                }
        }
 
@@ -491,6 +485,9 @@ __eth_bond_slave_remove_lock_free(uint16_t bonded_port_id,
        rte_eth_dev_default_mac_addr_set(slave_port_id,
                        &(internals->slaves[slave_idx].persisted_mac_addr));
 
+       /* remove additional MAC addresses from the slave */
+       slave_remove_mac_addresses(bonded_eth_dev, slave_port_id);
+
        /*
         * Remove bond device flows from slave device.
         * Note: don't restore flow isolate mode.
@@ -716,9 +713,21 @@ rte_eth_bond_mac_address_reset(uint16_t bonded_port_id)
        internals->user_defined_mac = 0;
 
        if (internals->slave_count > 0) {
+               int slave_port;
+               /* Get the primary slave location based on the primary port
+                * number as, while slave_add(), we will keep the primary
+                * slave based on slave_count,but not based on the primary port.
+                */
+               for (slave_port = 0; slave_port < internals->slave_count;
+                    slave_port++) {
+                       if (internals->slaves[slave_port].port_id ==
+                           internals->primary_port)
+                               break;
+               }
+
                /* Set MAC Address of Bonded Device */
                if (mac_address_set(bonded_eth_dev,
-                               &internals->slaves[internals->primary_port].persisted_mac_addr)
+                       &internals->slaves[slave_port].persisted_mac_addr)
                                != 0) {
                        RTE_BOND_LOG(ERR, "Failed to set MAC address on bonded device");
                        return -1;