Merge tag 'chrome-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof...
[cascardo/linux.git] / drivers / net / bonding / bond_main.c
index 089a402..78dde56 100644 (file)
@@ -928,6 +928,39 @@ static inline void slave_disable_netpoll(struct slave *slave)
 
 static void bond_poll_controller(struct net_device *bond_dev)
 {
+       struct bonding *bond = netdev_priv(bond_dev);
+       struct slave *slave = NULL;
+       struct list_head *iter;
+       struct ad_info ad_info;
+       struct netpoll_info *ni;
+       const struct net_device_ops *ops;
+
+       if (BOND_MODE(bond) == BOND_MODE_8023AD)
+               if (bond_3ad_get_active_agg_info(bond, &ad_info))
+                       return;
+
+       rcu_read_lock_bh();
+       bond_for_each_slave_rcu(bond, slave, iter) {
+               ops = slave->dev->netdev_ops;
+               if (!bond_slave_is_up(slave) || !ops->ndo_poll_controller)
+                       continue;
+
+               if (BOND_MODE(bond) == BOND_MODE_8023AD) {
+                       struct aggregator *agg =
+                           SLAVE_AD_INFO(slave)->port.aggregator;
+
+                       if (agg &&
+                           agg->aggregator_identifier != ad_info.aggregator_id)
+                               continue;
+               }
+
+               ni = rcu_dereference_bh(slave->dev->npinfo);
+               if (down_trylock(&ni->dev_lock))
+                       continue;
+               ops->ndo_poll_controller(slave->dev);
+               up(&ni->dev_lock);
+       }
+       rcu_read_unlock_bh();
 }
 
 static void bond_netpoll_cleanup(struct net_device *bond_dev)
@@ -2900,6 +2933,8 @@ static int bond_slave_netdev_event(unsigned long event,
                        if (old_duplex != slave->duplex)
                                bond_3ad_adapter_duplex_changed(slave);
                }
+               /* Fallthrough */
+       case NETDEV_DOWN:
                /* Refresh slave-array if applicable!
                 * If the setup does not use miimon or arpmon (mode-specific!),
                 * then these events will not cause the slave-array to be
@@ -2911,10 +2946,6 @@ static int bond_slave_netdev_event(unsigned long event,
                if (bond_mode_uses_xmit_hash(bond))
                        bond_update_slave_arr(bond, NULL);
                break;
-       case NETDEV_DOWN:
-               if (bond_mode_uses_xmit_hash(bond))
-                       bond_update_slave_arr(bond, NULL);
-               break;
        case NETDEV_CHANGEMTU:
                /* TODO: Should slaves be allowed to
                 * independently alter their MTU?  For
@@ -4008,6 +4039,7 @@ static const struct net_device_ops bond_netdev_ops = {
        .ndo_fix_features       = bond_fix_features,
        .ndo_bridge_setlink     = ndo_dflt_netdev_switch_port_bridge_setlink,
        .ndo_bridge_dellink     = ndo_dflt_netdev_switch_port_bridge_dellink,
+       .ndo_features_check     = passthru_features_check,
 };
 
 static const struct device_type bond_type = {