• Home
  • Raw
  • Download

Lines Matching full:slave

20  *	the first slave bonded to the channel.  All slaves will then use
27 * will attach eth0 to bond0 as a slave. eth0 hw mac address will either
144 MODULE_PARM_DESC(primary_reselect, "Reselect primary slave "
149 "2 for only on active slave "
188 MODULE_PARM_DESC(packets_per_slave, "Packets to send per slave in balance-rr "
189 "mode; 0 for a random slave, 1 packet per "
190 "slave (default), >1 packets per slave.");
242 * @slave_dev: slave that is supposed to xmit this skbuff
260 * We don't protect the slave list iteration with a lock because:
284 struct slave *slave, *rollback_slave; in bond_vlan_rx_add_vid() local
288 bond_for_each_slave(bond, slave, iter) { in bond_vlan_rx_add_vid()
289 res = vlan_vid_add(slave->dev, proto, vid); in bond_vlan_rx_add_vid()
297 /* unwind to the slave that failed */ in bond_vlan_rx_add_vid()
299 if (rollback_slave == slave) in bond_vlan_rx_add_vid()
318 struct slave *slave; in bond_vlan_rx_kill_vid() local
320 bond_for_each_slave(bond, slave, iter) in bond_vlan_rx_kill_vid()
321 vlan_vid_del(slave->dev, proto, vid); in bond_vlan_rx_kill_vid()
340 struct slave *slave; in bond_set_carrier() local
348 bond_for_each_slave(bond, slave, iter) { in bond_set_carrier()
349 if (slave->link == BOND_LINK_UP) { in bond_set_carrier()
366 /* Get link speed and duplex from the slave's base driver
372 static int bond_update_speed_duplex(struct slave *slave) in bond_update_speed_duplex() argument
374 struct net_device *slave_dev = slave->dev; in bond_update_speed_duplex()
378 slave->speed = SPEED_UNKNOWN; in bond_update_speed_duplex()
379 slave->duplex = DUPLEX_UNKNOWN; in bond_update_speed_duplex()
394 slave->speed = ecmd.base.speed; in bond_update_speed_duplex()
395 slave->duplex = ecmd.base.duplex; in bond_update_speed_duplex()
492 struct slave *curr_active = rtnl_dereference(bond->curr_active_slave); in bond_set_promiscuity()
497 struct slave *slave; in bond_set_promiscuity() local
499 bond_for_each_slave(bond, slave, iter) { in bond_set_promiscuity()
500 err = dev_set_promiscuity(slave->dev, inc); in bond_set_promiscuity()
515 struct slave *curr_active = rtnl_dereference(bond->curr_active_slave); in bond_set_allmulti()
520 struct slave *slave; in bond_set_allmulti() local
522 bond_for_each_slave(bond, slave, iter) { in bond_set_allmulti()
523 err = dev_set_allmulti(slave->dev, inc); in bond_set_allmulti()
533 * slave.
553 /* Flush bond's hardware addresses from slave */
570 /*--------------------------- Active slave change ---------------------------*/
577 static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active, in bond_hw_addr_swap()
578 struct slave *old_active) in bond_hw_addr_swap()
606 * bond_set_dev_addr - clone slave's address to bond
608 * @slave_dev: slave net device
622 static struct slave *bond_get_old_active(struct bonding *bond, in bond_get_old_active()
623 struct slave *new_active) in bond_get_old_active()
625 struct slave *slave; in bond_get_old_active() local
628 bond_for_each_slave(bond, slave, iter) { in bond_get_old_active()
629 if (slave == new_active) in bond_get_old_active()
632 if (ether_addr_equal(bond->dev->dev_addr, slave->dev->dev_addr)) in bond_get_old_active()
633 return slave; in bond_get_old_active()
646 struct slave *new_active, in bond_do_fail_over_mac()
647 struct slave *old_active) in bond_do_fail_over_mac()
660 * if just old_active, do nothing (going to no active slave) in bond_do_fail_over_mac()
685 netdev_err(bond->dev, "Error %d setting MAC of slave %s\n", in bond_do_fail_over_mac()
700 netdev_err(bond->dev, "Error %d setting MAC of slave %s\n", in bond_do_fail_over_mac()
712 static struct slave *bond_choose_primary_or_current(struct bonding *bond) in bond_choose_primary_or_current()
714 struct slave *prim = rtnl_dereference(bond->primary_slave); in bond_choose_primary_or_current()
715 struct slave *curr = rtnl_dereference(bond->curr_active_slave); in bond_choose_primary_or_current()
751 * bond_find_best_slave - select the best available slave to be the active one
754 static struct slave *bond_find_best_slave(struct bonding *bond) in bond_find_best_slave()
756 struct slave *slave, *bestslave = NULL; in bond_find_best_slave() local
760 slave = bond_choose_primary_or_current(bond); in bond_find_best_slave()
761 if (slave) in bond_find_best_slave()
762 return slave; in bond_find_best_slave()
764 bond_for_each_slave(bond, slave, iter) { in bond_find_best_slave()
765 if (slave->link == BOND_LINK_UP) in bond_find_best_slave()
766 return slave; in bond_find_best_slave()
767 if (slave->link == BOND_LINK_BACK && bond_slave_is_up(slave) && in bond_find_best_slave()
768 slave->delay < mintime) { in bond_find_best_slave()
769 mintime = slave->delay; in bond_find_best_slave()
770 bestslave = slave; in bond_find_best_slave()
779 struct slave *slave; in bond_should_notify_peers() local
782 slave = rcu_dereference(bond->curr_active_slave); in bond_should_notify_peers()
785 netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", in bond_should_notify_peers()
786 slave ? slave->dev->name : "NULL"); in bond_should_notify_peers()
788 if (!slave || !bond->send_peer_notif || in bond_should_notify_peers()
790 test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) in bond_should_notify_peers()
797 * change_active_interface - change the active slave into the specified one
799 * @new: the new slave to make the active one
801 * Set the new slave to the bond's settings and unset them on the old
806 * because it is apparently the best available slave we have, even though its
811 void bond_change_active_slave(struct bonding *bond, struct slave *new_active) in bond_change_active_slave()
813 struct slave *old_active; in bond_change_active_slave()
893 /* resend IGMP joins since active slave has changed or in bond_change_active_slave()
907 * bond_select_active_slave - select a new active slave, if needed
913 * - A slave has got its link back and there's no old curr_active_slave.
919 struct slave *best_slave; in bond_select_active_slave()
939 static inline int slave_enable_netpoll(struct slave *slave) in slave_enable_netpoll() argument
949 err = __netpoll_setup(np, slave->dev); in slave_enable_netpoll()
954 slave->np = np; in slave_enable_netpoll()
958 static inline void slave_disable_netpoll(struct slave *slave) in slave_disable_netpoll() argument
960 struct netpoll *np = slave->np; in slave_disable_netpoll()
965 slave->np = NULL; in slave_disable_netpoll()
972 struct slave *slave = NULL; in bond_poll_controller() local
980 bond_for_each_slave_rcu(bond, slave, iter) { in bond_poll_controller()
981 if (!bond_slave_is_up(slave)) in bond_poll_controller()
986 SLAVE_AD_INFO(slave)->port.aggregator; in bond_poll_controller()
993 netpoll_poll_dev(slave->dev); in bond_poll_controller()
1001 struct slave *slave; in bond_netpoll_cleanup() local
1003 bond_for_each_slave(bond, slave, iter) in bond_netpoll_cleanup()
1004 if (bond_slave_is_up(slave)) in bond_netpoll_cleanup()
1005 slave_disable_netpoll(slave); in bond_netpoll_cleanup()
1012 struct slave *slave; in bond_netpoll_setup() local
1015 bond_for_each_slave(bond, slave, iter) { in bond_netpoll_setup()
1016 err = slave_enable_netpoll(slave); in bond_netpoll_setup()
1025 static inline int slave_enable_netpoll(struct slave *slave) in slave_enable_netpoll() argument
1029 static inline void slave_disable_netpoll(struct slave *slave) in slave_disable_netpoll() argument
1045 struct slave *slave; in bond_fix_features() local
1052 bond_for_each_slave(bond, slave, iter) { in bond_fix_features()
1054 slave->dev->features, in bond_fix_features()
1077 struct slave *slave; in bond_compute_features() local
1086 bond_for_each_slave(bond, slave, iter) { in bond_compute_features()
1088 slave->dev->vlan_features, BOND_VLAN_FEATURES); in bond_compute_features()
1091 slave->dev->hw_enc_features, in bond_compute_features()
1093 dst_release_flag &= slave->dev->priv_flags; in bond_compute_features()
1094 if (slave->dev->hard_header_len > max_hard_header_len) in bond_compute_features()
1095 max_hard_header_len = slave->dev->hard_header_len; in bond_compute_features()
1097 gso_max_size = min(gso_max_size, slave->dev->gso_max_size); in bond_compute_features()
1098 gso_max_segs = min(gso_max_segs, slave->dev->gso_max_segs); in bond_compute_features()
1133 /* On bonding slaves other than the currently active slave, suppress
1137 struct slave *slave, in bond_should_deliver_exact_match() argument
1140 if (bond_is_slave_inactive(slave)) { in bond_should_deliver_exact_match()
1153 struct slave *slave; in bond_handle_frame() local
1156 struct slave *); in bond_handle_frame()
1165 slave = bond_slave_get_rcu(skb->dev); in bond_handle_frame()
1166 bond = slave->bond; in bond_handle_frame()
1170 ret = recv_probe(skb, bond, slave); in bond_handle_frame()
1181 * inactive slave links without being forced to bind to them in bond_handle_frame()
1188 if (bond_should_deliver_exact_match(skb, slave, bond)) { in bond_handle_frame()
1251 static int bond_master_upper_dev_link(struct bonding *bond, struct slave *slave, in bond_master_upper_dev_link() argument
1261 return netdev_master_upper_dev_link(slave->dev, bond->dev, slave, in bond_master_upper_dev_link()
1265 static void bond_upper_dev_unlink(struct bonding *bond, struct slave *slave) in bond_upper_dev_unlink() argument
1267 netdev_upper_dev_unlink(slave->dev, bond->dev); in bond_upper_dev_unlink()
1268 slave->dev->flags &= ~IFF_SLAVE; in bond_upper_dev_unlink()
1271 static struct slave *bond_alloc_slave(struct bonding *bond) in bond_alloc_slave()
1273 struct slave *slave = NULL; in bond_alloc_slave() local
1275 slave = kzalloc(sizeof(*slave), GFP_KERNEL); in bond_alloc_slave()
1276 if (!slave) in bond_alloc_slave()
1280 SLAVE_AD_INFO(slave) = kzalloc(sizeof(struct ad_slave_info), in bond_alloc_slave()
1282 if (!SLAVE_AD_INFO(slave)) { in bond_alloc_slave()
1283 kfree(slave); in bond_alloc_slave()
1287 INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); in bond_alloc_slave()
1289 return slave; in bond_alloc_slave()
1292 static void bond_free_slave(struct slave *slave) in bond_free_slave() argument
1294 struct bonding *bond = bond_get_bond_by_slave(slave); in bond_free_slave()
1296 cancel_delayed_work_sync(&slave->notify_work); in bond_free_slave()
1298 kfree(SLAVE_AD_INFO(slave)); in bond_free_slave()
1300 kfree(slave); in bond_free_slave()
1310 static void bond_fill_ifslave(struct slave *slave, struct ifslave *info) in bond_fill_ifslave() argument
1312 strcpy(info->slave_name, slave->dev->name); in bond_fill_ifslave()
1313 info->link = slave->link; in bond_fill_ifslave()
1314 info->state = bond_slave_state(slave); in bond_fill_ifslave()
1315 info->link_failure_count = slave->link_failure_count; in bond_fill_ifslave()
1320 struct slave *slave = container_of(_work, struct slave, in bond_netdev_notify_work() local
1326 bond_fill_ifslave(slave, &binfo.slave); in bond_netdev_notify_work()
1327 bond_fill_ifbond(slave->bond, &binfo.master); in bond_netdev_notify_work()
1328 netdev_bonding_info_change(slave->dev, &binfo); in bond_netdev_notify_work()
1331 queue_delayed_work(slave->bond->wq, &slave->notify_work, 1); in bond_netdev_notify_work()
1335 void bond_queue_slave_event(struct slave *slave) in bond_queue_slave_event() argument
1337 queue_delayed_work(slave->bond->wq, &slave->notify_work, 0); in bond_queue_slave_event()
1340 void bond_lower_state_changed(struct slave *slave) in bond_lower_state_changed() argument
1344 info.link_up = slave->link == BOND_LINK_UP || in bond_lower_state_changed()
1345 slave->link == BOND_LINK_FAIL; in bond_lower_state_changed()
1346 info.tx_enabled = bond_is_active_slave(slave); in bond_lower_state_changed()
1347 netdev_lower_state_changed(slave->dev, &info); in bond_lower_state_changed()
1350 /* enslave device <slave> to bond device <master> */
1356 struct slave *new_slave = NULL, *prev_slave; in bond_enslave()
1389 netdev_err(bond_dev, "Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n", in bond_enslave()
1393 …netdev_warn(bond_dev, "enslaved VLAN challenged slave %s. Adding VLANs will be blocked as long as … in bond_enslave()
1403 * be identified with moderate accuracy by the state of the slave: in bond_enslave()
1414 /* set bonding device ether type by slave - bonding netdevices are in bond_enslave()
1415 * created with ether_setup, so when the slave type is not ARPHRD_ETHER in bond_enslave()
1466 netdev_warn(bond_dev, "The slave device specified does not support setting the MAC address\n"); in bond_enslave()
1473 …NL_SET_ERR_MSG(extack, "Slave device does not support setting the MAC address, but fail_over_mac i… in bond_enslave()
1474 …netdev_err(bond_dev, "The slave device specified does not support setting the MAC address, but fai… in bond_enslave()
1483 /* If this is the first slave, then we need to set the master's hardware in bond_enslave()
1484 * address to be the same as the slave's. in bond_enslave()
1503 /* Save slave's original mtu and then set it to match the bond */ in bond_enslave()
1511 /* Save slave's original ("permanent") mac address for modes in bond_enslave()
1520 /* Set slave to master's mac address. The application already in bond_enslave()
1521 * set the master's mac address to that of the first slave in bond_enslave()
1532 /* set slave flag before open to prevent IPv6 addrconf */ in bond_enslave()
1535 /* open the slave since the application closed it */ in bond_enslave()
1538 netdev_dbg(bond_dev, "Opening slave %s failed\n", slave_dev->name); in bond_enslave()
1543 /* initialize slave stats */ in bond_enslave()
1632 /* if there is a primary slave, remember it */ in bond_enslave()
1650 /* if this is the first slave */ in bond_enslave()
1670 netdev_dbg(bond_dev, "This slave is always active in trunk mode\n"); in bond_enslave()
1689 …netdev_info(bond_dev, "master_dev is using netpoll, but new slave device does not support netpoll\… in bond_enslave()
1724 /* set promiscuity level to new slave */ in bond_enslave()
1731 /* set allmulti level to new slave */ in bond_enslave()
1811 * MAC if this slave's MAC is in use by the bond, or at in bond_enslave()
1827 /* Enslave of first slave has failed and we need to fix master's mac */ in bond_enslave()
1843 /* Try to release the slave device <slave> from the bond device <master>
1848 * The rules for slave state should be:
1859 struct slave *slave, *oldcurrent; in __bond_release_one() local
1864 /* slave is not a slave or master is not master of this slave */ in __bond_release_one()
1874 slave = bond_get_slave_by_dev(bond, slave_dev); in __bond_release_one()
1875 if (!slave) { in __bond_release_one()
1876 /* not a slave of this bond */ in __bond_release_one()
1883 bond_set_slave_inactive_flags(slave, BOND_SLAVE_NOTIFY_NOW); in __bond_release_one()
1885 bond_sysfs_slave_del(slave); in __bond_release_one()
1887 /* recompute stats just before removing the slave */ in __bond_release_one()
1890 bond_upper_dev_unlink(bond, slave); in __bond_release_one()
1892 * for this slave anymore. in __bond_release_one()
1897 bond_3ad_unbind_slave(slave); in __bond_release_one()
1900 bond_update_slave_arr(bond, slave); in __bond_release_one()
1903 bond_is_active_slave(slave) ? "active" : "backup", in __bond_release_one()
1912 if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) && in __bond_release_one()
1915 slave_dev->name, slave->perm_hwaddr, in __bond_release_one()
1919 if (rtnl_dereference(bond->primary_slave) == slave) in __bond_release_one()
1922 if (oldcurrent == slave) in __bond_release_one()
1926 /* Must be called only after the slave has been in __bond_release_one()
1929 * but before a new active slave is selected. in __bond_release_one()
1931 bond_alb_deinit_slave(bond, slave); in __bond_release_one()
1936 } else if (oldcurrent == slave) { in __bond_release_one()
1938 * is no concern that another slave add/remove event in __bond_release_one()
1964 netdev_info(bond_dev, "last VLAN challenged slave %s left bond %s - VLAN blocking is removed\n", in __bond_release_one()
1973 /* unset promiscuity level from slave in __bond_release_one()
1977 * when this slave was attached, so we cache at the start of the in __bond_release_one()
1983 /* unset allmulti level from slave */ in __bond_release_one()
1990 slave_disable_netpoll(slave); in __bond_release_one()
1992 /* close slave before restoring its mac address */ in __bond_release_one()
1998 bond_hw_addr_copy(ss.__data, slave->perm_hwaddr, in __bond_release_one()
1999 slave->dev->addr_len); in __bond_release_one()
2005 __dev_set_mtu(slave_dev, slave->original_mtu); in __bond_release_one()
2007 dev_set_mtu(slave_dev, slave->original_mtu); in __bond_release_one()
2012 bond_free_slave(slave); in __bond_release_one()
2023 /* First release a slave and then destroy the bond if no more slaves are left.
2055 struct slave *slave; in bond_slave_info_query() local
2057 bond_for_each_slave(bond, slave, iter) { in bond_slave_info_query()
2060 bond_fill_ifslave(slave, info); in bond_slave_info_query()
2075 struct slave *slave; in bond_miimon_inspect() local
2080 bond_for_each_slave_rcu(bond, slave, iter) { in bond_miimon_inspect()
2081 bond_propose_link_state(slave, BOND_LINK_NOCHANGE); in bond_miimon_inspect()
2083 link_state = bond_check_dev_link(bond, slave->dev, 0); in bond_miimon_inspect()
2085 switch (slave->link) { in bond_miimon_inspect()
2090 bond_propose_link_state(slave, BOND_LINK_FAIL); in bond_miimon_inspect()
2092 slave->delay = bond->params.downdelay; in bond_miimon_inspect()
2093 if (slave->delay) { in bond_miimon_inspect()
2097 (bond_is_active_slave(slave) ? in bond_miimon_inspect()
2099 slave->dev->name, in bond_miimon_inspect()
2106 bond_propose_link_state(slave, BOND_LINK_UP); in bond_miimon_inspect()
2107 slave->last_link_up = jiffies; in bond_miimon_inspect()
2109 (bond->params.downdelay - slave->delay) * in bond_miimon_inspect()
2111 slave->dev->name); in bond_miimon_inspect()
2116 if (slave->delay <= 0) { in bond_miimon_inspect()
2117 bond_propose_link_state(slave, BOND_LINK_DOWN); in bond_miimon_inspect()
2122 slave->delay--; in bond_miimon_inspect()
2129 bond_propose_link_state(slave, BOND_LINK_BACK); in bond_miimon_inspect()
2131 slave->delay = bond->params.updelay; in bond_miimon_inspect()
2133 if (slave->delay) { in bond_miimon_inspect()
2135 slave->dev->name, in bond_miimon_inspect()
2143 bond_propose_link_state(slave, BOND_LINK_DOWN); in bond_miimon_inspect()
2145 (bond->params.updelay - slave->delay) * in bond_miimon_inspect()
2147 slave->dev->name); in bond_miimon_inspect()
2153 slave->delay = 0; in bond_miimon_inspect()
2155 if (slave->delay <= 0) { in bond_miimon_inspect()
2156 bond_propose_link_state(slave, BOND_LINK_UP); in bond_miimon_inspect()
2162 slave->delay--; in bond_miimon_inspect()
2171 struct slave *slave, in bond_miimon_link_change() argument
2176 bond_3ad_handle_link_change(slave, link); in bond_miimon_link_change()
2180 bond_alb_handle_link_change(bond, slave, link); in bond_miimon_link_change()
2191 struct slave *slave, *primary; in bond_miimon_commit() local
2193 bond_for_each_slave(bond, slave, iter) { in bond_miimon_commit()
2194 switch (slave->link_new_state) { in bond_miimon_commit()
2196 /* For 802.3ad mode, check current slave speed and in bond_miimon_commit()
2203 slave->link == BOND_LINK_UP) in bond_miimon_commit()
2204 bond_3ad_adapter_speed_duplex_changed(slave); in bond_miimon_commit()
2208 if (bond_update_speed_duplex(slave) && in bond_miimon_commit()
2210 slave->link = BOND_LINK_DOWN; in bond_miimon_commit()
2214 slave->dev->name); in bond_miimon_commit()
2217 bond_set_slave_link_state(slave, BOND_LINK_UP, in bond_miimon_commit()
2219 slave->last_link_up = jiffies; in bond_miimon_commit()
2224 bond_set_backup_slave(slave); in bond_miimon_commit()
2227 bond_set_active_slave(slave); in bond_miimon_commit()
2231 slave->dev->name, in bond_miimon_commit()
2232 slave->speed == SPEED_UNKNOWN ? 0 : slave->speed, in bond_miimon_commit()
2233 slave->duplex ? "full" : "half"); in bond_miimon_commit()
2235 bond_miimon_link_change(bond, slave, BOND_LINK_UP); in bond_miimon_commit()
2237 if (!bond->curr_active_slave || slave == primary) in bond_miimon_commit()
2243 if (slave->link_failure_count < UINT_MAX) in bond_miimon_commit()
2244 slave->link_failure_count++; in bond_miimon_commit()
2246 bond_set_slave_link_state(slave, BOND_LINK_DOWN, in bond_miimon_commit()
2251 bond_set_slave_inactive_flags(slave, in bond_miimon_commit()
2255 slave->dev->name); in bond_miimon_commit()
2257 bond_miimon_link_change(bond, slave, BOND_LINK_DOWN); in bond_miimon_commit()
2259 if (slave == rcu_access_pointer(bond->curr_active_slave)) in bond_miimon_commit()
2265 netdev_err(bond->dev, "invalid new link %d on slave %s\n", in bond_miimon_commit()
2266 slave->link_new_state, slave->dev->name); in bond_miimon_commit()
2267 bond_propose_link_state(slave, BOND_LINK_NOCHANGE); in bond_miimon_commit()
2294 struct slave *slave; in bond_mii_monitor() local
2316 bond_for_each_slave(bond, slave, iter) { in bond_mii_monitor()
2317 bond_commit_link_state(slave, BOND_SLAVE_NOTIFY_LATER); in bond_mii_monitor()
2370 netdev_dbg(slave_dev, "arp %d on slave %s: dst %pI4 src %pI4\n", in bond_arp_send()
2456 static void bond_arp_send_all(struct bonding *bond, struct slave *slave) in bond_arp_send_all() argument
2478 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], in bond_arp_send_all()
2504 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], in bond_arp_send_all()
2510 static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 sip, __be32 tip) in bond_validate_arp() argument
2526 slave->last_rx = jiffies; in bond_validate_arp()
2527 slave->target_last_arp_rx[i] = jiffies; in bond_validate_arp()
2531 struct slave *slave) in bond_arp_rcv() argument
2534 struct slave *curr_active_slave, *curr_arp_slave; in bond_arp_rcv()
2540 if (!slave_do_arp_validate(bond, slave)) { in bond_arp_rcv()
2543 slave->last_rx = jiffies; in bond_arp_rcv()
2577 slave->dev->name, bond_slave_state(slave), in bond_arp_rcv()
2578 bond->params.arp_validate, slave_do_arp_validate(bond, slave), in bond_arp_rcv()
2586 * (a) the slave receiving the ARP is active (which includes the in bond_arp_rcv()
2587 * current ARP slave, if any), or in bond_arp_rcv()
2589 * (b) the receiving slave isn't active, but there is a currently in bond_arp_rcv()
2590 * active slave and it received valid arp reply(s) after it became in bond_arp_rcv()
2591 * the currently active slave, or in bond_arp_rcv()
2593 * (c) there is an ARP slave that sent an ARP during the prior ARP in bond_arp_rcv()
2594 * interval, and we receive an ARP reply on any slave. We accept in bond_arp_rcv()
2596 * reply to a slave other than the sender of the ARP request. in bond_arp_rcv()
2600 * slave through the L2 switch(es) to the receiving slave. Since in bond_arp_rcv()
2607 if (bond_is_active_slave(slave)) in bond_arp_rcv()
2608 bond_validate_arp(bond, slave, sip, tip); in bond_arp_rcv()
2612 bond_validate_arp(bond, slave, tip, sip); in bond_arp_rcv()
2616 bond_validate_arp(bond, slave, sip, tip); in bond_arp_rcv()
2638 /* This function is called regularly to monitor each slave's link
2646 struct slave *slave, *oldcurrent; in bond_loadbalance_arp_mon() local
2658 * the picture unless it is null. also, slave->last_link_up is not in bond_loadbalance_arp_mon()
2659 * needed here because we send an arp on each slave and give a slave in bond_loadbalance_arp_mon()
2664 bond_for_each_slave_rcu(bond, slave, iter) { in bond_loadbalance_arp_mon()
2665 unsigned long trans_start = dev_trans_start(slave->dev); in bond_loadbalance_arp_mon()
2667 bond_propose_link_state(slave, BOND_LINK_NOCHANGE); in bond_loadbalance_arp_mon()
2669 if (slave->link != BOND_LINK_UP) { in bond_loadbalance_arp_mon()
2671 bond_time_in_interval(bond, slave->last_rx, 1)) { in bond_loadbalance_arp_mon()
2673 bond_propose_link_state(slave, BOND_LINK_UP); in bond_loadbalance_arp_mon()
2677 * mode. the window of a slave being up and in bond_loadbalance_arp_mon()
2683 slave->dev->name); in bond_loadbalance_arp_mon()
2687 slave->dev->name); in bond_loadbalance_arp_mon()
2691 /* slave->link == BOND_LINK_UP */ in bond_loadbalance_arp_mon()
2698 !bond_time_in_interval(bond, slave->last_rx, 2)) { in bond_loadbalance_arp_mon()
2700 bond_propose_link_state(slave, BOND_LINK_DOWN); in bond_loadbalance_arp_mon()
2703 if (slave->link_failure_count < UINT_MAX) in bond_loadbalance_arp_mon()
2704 slave->link_failure_count++; in bond_loadbalance_arp_mon()
2707 slave->dev->name); in bond_loadbalance_arp_mon()
2709 if (slave == oldcurrent) in bond_loadbalance_arp_mon()
2721 if (bond_slave_is_up(slave)) in bond_loadbalance_arp_mon()
2722 bond_arp_send_all(bond, slave); in bond_loadbalance_arp_mon()
2731 bond_for_each_slave(bond, slave, iter) { in bond_loadbalance_arp_mon()
2732 if (slave->link_new_state != BOND_LINK_NOCHANGE) in bond_loadbalance_arp_mon()
2733 slave->link = slave->link_new_state; in bond_loadbalance_arp_mon()
2757 * should take place for the slave. Returns 0 if no changes are found, >0
2766 struct slave *slave; in bond_ab_arp_inspect() local
2769 bond_for_each_slave_rcu(bond, slave, iter) { in bond_ab_arp_inspect()
2770 bond_propose_link_state(slave, BOND_LINK_NOCHANGE); in bond_ab_arp_inspect()
2771 last_rx = slave_last_rx(bond, slave); in bond_ab_arp_inspect()
2773 if (slave->link != BOND_LINK_UP) { in bond_ab_arp_inspect()
2775 bond_propose_link_state(slave, BOND_LINK_UP); in bond_ab_arp_inspect()
2777 } else if (slave->link == BOND_LINK_BACK) { in bond_ab_arp_inspect()
2778 bond_propose_link_state(slave, BOND_LINK_FAIL); in bond_ab_arp_inspect()
2788 if (bond_time_in_interval(bond, slave->last_link_up, 2)) in bond_ab_arp_inspect()
2791 /* Backup slave is down if: in bond_ab_arp_inspect()
2800 * gives each slave a chance to tx/rx traffic in bond_ab_arp_inspect()
2803 if (!bond_is_active_slave(slave) && in bond_ab_arp_inspect()
2806 bond_propose_link_state(slave, BOND_LINK_DOWN); in bond_ab_arp_inspect()
2810 /* Active slave is down if: in bond_ab_arp_inspect()
2815 trans_start = dev_trans_start(slave->dev); in bond_ab_arp_inspect()
2816 if (bond_is_active_slave(slave) && in bond_ab_arp_inspect()
2819 bond_propose_link_state(slave, BOND_LINK_DOWN); in bond_ab_arp_inspect()
2836 struct slave *slave; in bond_ab_arp_commit() local
2838 bond_for_each_slave(bond, slave, iter) { in bond_ab_arp_commit()
2839 switch (slave->link_new_state) { in bond_ab_arp_commit()
2844 trans_start = dev_trans_start(slave->dev); in bond_ab_arp_commit()
2845 if (rtnl_dereference(bond->curr_active_slave) != slave || in bond_ab_arp_commit()
2848 struct slave *current_arp_slave; in bond_ab_arp_commit()
2851 bond_set_slave_link_state(slave, BOND_LINK_UP, in bond_ab_arp_commit()
2861 slave->dev->name); in bond_ab_arp_commit()
2864 slave == rtnl_dereference(bond->primary_slave)) in bond_ab_arp_commit()
2872 if (slave->link_failure_count < UINT_MAX) in bond_ab_arp_commit()
2873 slave->link_failure_count++; in bond_ab_arp_commit()
2875 bond_set_slave_link_state(slave, BOND_LINK_DOWN, in bond_ab_arp_commit()
2877 bond_set_slave_inactive_flags(slave, in bond_ab_arp_commit()
2881 slave->dev->name); in bond_ab_arp_commit()
2883 if (slave == rtnl_dereference(bond->curr_active_slave)) { in bond_ab_arp_commit()
2891 bond_set_slave_link_state(slave, BOND_LINK_FAIL, in bond_ab_arp_commit()
2893 bond_set_slave_inactive_flags(slave, in bond_ab_arp_commit()
2896 /* A slave has just been enslaved and has become in bond_ab_arp_commit()
2897 * the current active slave. in bond_ab_arp_commit()
2904 netdev_err(bond->dev, "impossible: new_link %d on slave %s\n", in bond_ab_arp_commit()
2905 slave->link_new_state, slave->dev->name); in bond_ab_arp_commit()
2924 struct slave *slave, *before = NULL, *new_slave = NULL, in bond_ab_arp_probe() local
2942 * backup slave from the current_arp_slave and make it the candidate in bond_ab_arp_probe()
2952 bond_for_each_slave_rcu(bond, slave, iter) { in bond_ab_arp_probe()
2953 if (!found && !before && bond_slave_is_up(slave)) in bond_ab_arp_probe()
2954 before = slave; in bond_ab_arp_probe()
2956 if (found && !new_slave && bond_slave_is_up(slave)) in bond_ab_arp_probe()
2957 new_slave = slave; in bond_ab_arp_probe()
2962 * one the current slave so it is still marked in bond_ab_arp_probe()
2965 if (!bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) { in bond_ab_arp_probe()
2966 bond_set_slave_link_state(slave, BOND_LINK_DOWN, in bond_ab_arp_probe()
2968 if (slave->link_failure_count < UINT_MAX) in bond_ab_arp_probe()
2969 slave->link_failure_count++; in bond_ab_arp_probe()
2971 bond_set_slave_inactive_flags(slave, in bond_ab_arp_probe()
2975 slave->dev->name); in bond_ab_arp_probe()
2977 if (slave == curr_arp_slave) in bond_ab_arp_probe()
2995 bond_for_each_slave_rcu(bond, slave, iter) { in bond_ab_arp_probe()
2996 if (slave->should_notify || slave->should_notify_link) { in bond_ab_arp_probe()
3110 struct slave *slave = bond_slave_get_rtnl(slave_dev), *primary; in bond_slave_netdev_event() local
3116 * slave will be NULL in bond_slave_netdev_event()
3118 if (!slave) in bond_slave_netdev_event()
3120 bond_dev = slave->bond->dev; in bond_slave_netdev_event()
3121 bond = slave->bond; in bond_slave_netdev_event()
3134 * Getting invalid Speed/Duplex values here will put slave in bond_slave_netdev_event()
3140 if (bond_update_speed_duplex(slave) && in bond_slave_netdev_event()
3142 if (slave->last_link_up) in bond_slave_netdev_event()
3143 slave->link = BOND_LINK_FAIL; in bond_slave_netdev_event()
3145 slave->link = BOND_LINK_DOWN; in bond_slave_netdev_event()
3149 bond_3ad_adapter_speed_duplex_changed(slave); in bond_slave_netdev_event()
3152 /* Refresh slave-array if applicable! in bond_slave_netdev_event()
3154 * then these events will not cause the slave-array to be in bond_slave_netdev_event()
3155 * refreshed. This will cause xmit to use a slave that is not in bond_slave_netdev_event()
3171 * take over the slave's change_mtu in bond_slave_netdev_event()
3182 if (slave == primary) { in bond_slave_netdev_event()
3183 /* slave's name changed - he's no longer primary */ in bond_slave_netdev_event()
3186 /* we have a new primary slave */ in bond_slave_netdev_event()
3187 rcu_assign_pointer(bond->primary_slave, slave); in bond_slave_netdev_event()
3192 netdev_info(bond->dev, "Primary slave changed to %s, reselecting active slave\n", in bond_slave_netdev_event()
3204 call_netdevice_notifiers(event, slave->bond->dev); in bond_slave_netdev_event()
3217 * locks for us to safely manipulate the slave devices (RTNL lock,
3362 struct slave *slave; in bond_open() local
3364 /* reset slave->backup and slave->inactive */ in bond_open()
3366 bond_for_each_slave(bond, slave, iter) { in bond_open()
3368 slave != rcu_access_pointer(bond->curr_active_slave)) { in bond_open()
3369 bond_set_slave_inactive_flags(slave, in bond_open()
3372 bond_set_slave_active_flags(slave, in bond_open()
3464 struct slave *slave; in bond_get_stats() local
3470 bond_for_each_slave_rcu(bond, slave, iter) { in bond_get_stats()
3472 dev_get_stats(slave->dev, &temp); in bond_get_stats()
3474 bond_fold_stats(stats, new, &slave->slave_stats); in bond_get_stats()
3476 /* save off the slave stats for the next run */ in bond_get_stats()
3477 memcpy(&slave->slave_stats, new, sizeof(*new)); in bond_get_stats()
3609 struct slave *slave; in bond_set_rx_mode() local
3613 slave = rcu_dereference(bond->curr_active_slave); in bond_set_rx_mode()
3614 if (slave) { in bond_set_rx_mode()
3615 dev_uc_sync(slave->dev, bond_dev); in bond_set_rx_mode()
3616 dev_mc_sync(slave->dev, bond_dev); in bond_set_rx_mode()
3619 bond_for_each_slave_rcu(bond, slave, iter) { in bond_set_rx_mode()
3620 dev_uc_sync_multiple(slave->dev, bond_dev); in bond_set_rx_mode()
3621 dev_mc_sync_multiple(slave->dev, bond_dev); in bond_set_rx_mode()
3632 struct slave *slave; in bond_neigh_init() local
3635 slave = bond_first_slave(bond); in bond_neigh_init()
3636 if (!slave) in bond_neigh_init()
3638 slave_ops = slave->dev->netdev_ops; in bond_neigh_init()
3644 ret = slave_ops->ndo_neigh_setup(slave->dev, &parms); in bond_neigh_init()
3648 /* Assign slave's neigh_cleanup to neighbour in case cleanup is called in bond_neigh_init()
3649 * after the last slave has been detached. Assumes that all slaves in bond_neigh_init()
3662 * slave exists. So we must declare proxy setup function which will
3663 * be used at run time to resolve the actual slave neigh param setup.
3683 struct slave *slave, *rollback_slave; in bond_change_mtu() local
3689 bond_for_each_slave(bond, slave, iter) { in bond_change_mtu()
3691 slave, slave->dev->netdev_ops->ndo_change_mtu); in bond_change_mtu()
3693 res = dev_set_mtu(slave->dev, new_mtu); in bond_change_mtu()
3696 /* If we failed to set the slave's mtu to the new value in bond_change_mtu()
3699 * different mtu values than the active slave we'll in bond_change_mtu()
3705 slave->dev->name); in bond_change_mtu()
3715 /* unwind from head to the slave that failed */ in bond_change_mtu()
3719 if (rollback_slave == slave) in bond_change_mtu()
3741 struct slave *slave, *rollback_slave; in bond_set_mac_address() local
3762 bond_for_each_slave(bond, slave, iter) { in bond_set_mac_address()
3763 netdev_dbg(bond_dev, "slave %p %s\n", slave, slave->dev->name); in bond_set_mac_address()
3764 res = dev_set_mac_address(slave->dev, addr); in bond_set_mac_address()
3766 /* TODO: consider downing the slave in bond_set_mac_address()
3772 netdev_dbg(bond_dev, "err %d %s\n", res, slave->dev->name); in bond_set_mac_address()
3785 /* unwind from head to the slave that failed */ in bond_set_mac_address()
3789 if (rollback_slave == slave) in bond_set_mac_address()
3804 * bond_xmit_slave_id - transmit skb through slave with slave_id
3807 * @slave_id: slave id up to slave_cnt-1 through which to transmit
3809 * This function tries to transmit through slave with slave_id but in case
3810 * it fails, it tries to find the first available slave for transmission.
3816 struct slave *slave; in bond_xmit_slave_id() local
3819 /* Here we start from the slave with slave_id */ in bond_xmit_slave_id()
3820 bond_for_each_slave_rcu(bond, slave, iter) { in bond_xmit_slave_id()
3822 if (bond_slave_can_tx(slave)) { in bond_xmit_slave_id()
3823 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_slave_id()
3829 /* Here we start from the first slave up to slave_id */ in bond_xmit_slave_id()
3831 bond_for_each_slave_rcu(bond, slave, iter) { in bond_xmit_slave_id()
3834 if (bond_slave_can_tx(slave)) { in bond_xmit_slave_id()
3835 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_slave_id()
3839 /* no slave that can tx has been found */ in bond_xmit_slave_id()
3844 * bond_rr_gen_slave_id - generate slave id based on packets_per_slave
3848 * this function generates a slave id, which is usually used as the next
3849 * slave to transmit through.
3880 struct slave *slave; in bond_xmit_roundrobin() local
3899 slave = rcu_dereference(bond->curr_active_slave); in bond_xmit_roundrobin()
3900 if (slave) in bond_xmit_roundrobin()
3901 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_roundrobin()
3926 struct slave *slave; in bond_xmit_activebackup() local
3928 slave = rcu_dereference(bond->curr_active_slave); in bond_xmit_activebackup()
3929 if (slave) in bond_xmit_activebackup()
3930 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_activebackup()
3946 /* Slave array work handler. Holds only RTNL */
3959 pr_warn_ratelimited("Failed to update slave array from WT\n"); in bond_slave_arr_handler()
3969 * to determine the slave interface -
3976 int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave) in bond_update_slave_arr()
3978 struct slave *slave; in bond_update_slave_arr() local
3992 pr_err("Failed to build slave-array.\n"); in bond_update_slave_arr()
4013 bond_for_each_slave(bond, slave, iter) { in bond_update_slave_arr()
4017 agg = SLAVE_AD_INFO(slave)->port.aggregator; in bond_update_slave_arr()
4021 if (!bond_slave_can_tx(slave)) in bond_update_slave_arr()
4023 if (skipslave == slave) in bond_update_slave_arr()
4027 "Adding slave dev %s to tx hash array[%d]\n", in bond_update_slave_arr()
4028 slave->dev->name, new_arr->count); in bond_update_slave_arr()
4030 new_arr->arr[new_arr->count++] = slave; in bond_update_slave_arr()
4042 * slave but allocation failed (most likely!). BTW this is in bond_update_slave_arr()
4047 * this to-be-skipped slave to send a packet out. in bond_update_slave_arr()
4063 * usable slave array is formed in the control path. The xmit function
4070 struct slave *slave; in bond_3ad_xor_xmit() local
4077 slave = slaves->arr[bond_xmit_hash(bond, skb) % count]; in bond_3ad_xor_xmit()
4078 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_3ad_xor_xmit()
4091 struct slave *slave = NULL; in bond_xmit_broadcast() local
4094 bond_for_each_slave_rcu(bond, slave, iter) { in bond_xmit_broadcast()
4095 if (bond_is_last_slave(bond, slave)) in bond_xmit_broadcast()
4097 if (bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) { in bond_xmit_broadcast()
4105 bond_dev_queue_xmit(bond, skb2, slave->dev); in bond_xmit_broadcast()
4108 if (slave && bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) in bond_xmit_broadcast()
4109 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_broadcast()
4118 /* Lookup the slave that corresponds to a qid */
4122 struct slave *slave = NULL; in bond_slave_override() local
4129 bond_for_each_slave_rcu(bond, slave, iter) { in bond_slave_override()
4130 if (slave->queue_id == skb_get_queue_mapping(skb)) { in bond_slave_override()
4131 if (bond_slave_is_up(slave) && in bond_slave_override()
4132 slave->link == BOND_LINK_UP) { in bond_slave_override()
4133 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_slave_override()
4136 /* If the slave isn't UP, use default transmit policy. */ in bond_slave_override()
4219 static u32 bond_mode_bcast_speed(struct slave *slave, u32 speed) in bond_mode_bcast_speed() argument
4222 speed = slave->speed; in bond_mode_bcast_speed()
4224 speed = min(speed, slave->speed); in bond_mode_bcast_speed()
4234 struct slave *slave; in bond_ethtool_get_link_ksettings() local
4245 bond_for_each_slave(bond, slave, iter) { in bond_ethtool_get_link_ksettings()
4246 if (bond_slave_can_tx(slave)) { in bond_ethtool_get_link_ksettings()
4247 if (slave->speed != SPEED_UNKNOWN) { in bond_ethtool_get_link_ksettings()
4249 speed = bond_mode_bcast_speed(slave, in bond_ethtool_get_link_ksettings()
4252 speed += slave->speed; in bond_ethtool_get_link_ksettings()
4255 slave->duplex != DUPLEX_UNKNOWN) in bond_ethtool_get_link_ksettings()
4256 cmd->base.duplex = slave->duplex; in bond_ethtool_get_link_ksettings()
4374 struct slave *slave; in bond_uninit() local
4380 bond_for_each_slave(bond, slave, iter) in bond_uninit()
4381 __bond_release_one(bond_dev, slave->dev, true, true); in bond_uninit()