net/bonding: fix race condition
authorRadu Nicolau <radu.nicolau@intel.com>
Wed, 25 Jul 2018 09:39:40 +0000 (10:39 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 5 Aug 2018 00:18:16 +0000 (02:18 +0200)
Race condition can appear in the bond_mode_8023ad_periodic_cb()
callback when bonding port is stopped, reconfigured and restarted.

Re-ordered calls in bond_ethdev_start() to have callback alarm set
after slave ports are reconfigured.

Fixes: 2efb58cbab6e ("bond: new link bonding library")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Chas Williams <chas3@att.com>
drivers/net/bonding/rte_eth_bond_pmd.c

index ad6e33f..ca74eb0 100644 (file)
@@ -2113,10 +2113,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);
@@ -2157,6 +2153,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);