New upstream version 17.11.4
[deb_dpdk.git] / drivers / net / bonding / rte_eth_bond_pmd.c
index e19a4a3..8880231 100644 (file)
@@ -1932,10 +1932,6 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev)
                }
        }
 
-       /* Update all slave devices MACs*/
-       if (mac_address_slaves_update(eth_dev) != 0)
-               goto out_err;
-
        /* If bonded device is configure in promiscuous mode then re-apply config */
        if (internals->promiscuous_en)
                bond_ethdev_promiscuous_enable(eth_dev);
@@ -1976,6 +1972,10 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev)
                        (void *)&rte_eth_devices[internals->port_id]);
        }
 
+       /* Update all slave devices MACs*/
+       if (mac_address_slaves_update(eth_dev) != 0)
+               goto out_err;
+
        if (internals->user_defined_primary_port)
                bond_ethdev_primary_set(internals, internals->primary_port);
 
@@ -2048,7 +2048,6 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev)
                        tlb_last_obytets[internals->active_slaves[i]] = 0;
        }
 
-       internals->active_slave_count = 0;
        internals->link_status_polling_enabled = 0;
        for (i = 0; i < internals->slave_count; i++)
                internals->slaves[i].last_link_status = 0;
@@ -2535,10 +2534,8 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
 
        rte_eth_link_get_nowait(port_id, &link);
        if (link.link_status) {
-               if (active_pos < internals->active_slave_count) {
-                       rte_spinlock_unlock(&internals->lsc_lock);
-                       return rc;
-               }
+               if (active_pos < internals->active_slave_count)
+                       goto link_update;
 
                /* if no active slave ports then set this port to be primary port */
                if (internals->active_slave_count < 1) {
@@ -2557,10 +2554,8 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
                                internals->primary_port == port_id)
                        bond_ethdev_primary_set(internals, port_id);
        } else {
-               if (active_pos == internals->active_slave_count) {
-                       rte_spinlock_unlock(&internals->lsc_lock);
-                       return rc;
-               }
+               if (active_pos == internals->active_slave_count)
+                       goto link_update;
 
                /* Remove from active slave list */
                deactivate_slave(bonded_eth_dev, port_id);
@@ -2579,6 +2574,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
                }
        }
 
+link_update:
        /**
         * Update bonded device link properties after any change to active
         * slaves
@@ -2616,7 +2612,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
 
        rte_spinlock_unlock(&internals->lsc_lock);
 
-       return 0;
+       return rc;
 }
 
 static int