Lines Matching refs:bond

217 static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act,
249 void bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, in bond_dev_queue_xmit() argument
258 if (unlikely(netpoll_tx_running(bond->dev))) in bond_dev_queue_xmit()
259 bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb); in bond_dev_queue_xmit()
288 struct bonding *bond = netdev_priv(bond_dev); in bond_vlan_rx_add_vid() local
293 bond_for_each_slave(bond, slave, iter) { in bond_vlan_rx_add_vid()
303 bond_for_each_slave(bond, rollback_slave, iter) { in bond_vlan_rx_add_vid()
321 struct bonding *bond = netdev_priv(bond_dev); in bond_vlan_rx_kill_vid() local
325 bond_for_each_slave(bond, slave, iter) in bond_vlan_rx_kill_vid()
328 if (bond_is_lb(bond)) in bond_vlan_rx_kill_vid()
329 bond_alb_clear_vlan(bond, vid); in bond_vlan_rx_kill_vid()
342 int bond_set_carrier(struct bonding *bond) in bond_set_carrier() argument
347 if (!bond_has_slaves(bond)) in bond_set_carrier()
350 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_set_carrier()
351 return bond_3ad_set_carrier(bond); in bond_set_carrier()
353 bond_for_each_slave(bond, slave, iter) { in bond_set_carrier()
355 if (!netif_carrier_ok(bond->dev)) { in bond_set_carrier()
356 netif_carrier_on(bond->dev); in bond_set_carrier()
364 if (netif_carrier_ok(bond->dev)) { in bond_set_carrier()
365 netif_carrier_off(bond->dev); in bond_set_carrier()
439 static int bond_check_dev_link(struct bonding *bond, in bond_check_dev_link() argument
450 if (bond->params.use_carrier) in bond_check_dev_link()
494 static int bond_set_promiscuity(struct bonding *bond, int inc) in bond_set_promiscuity() argument
499 if (bond_uses_primary(bond)) { in bond_set_promiscuity()
500 struct slave *curr_active = rtnl_dereference(bond->curr_active_slave); in bond_set_promiscuity()
507 bond_for_each_slave(bond, slave, iter) { in bond_set_promiscuity()
517 static int bond_set_allmulti(struct bonding *bond, int inc) in bond_set_allmulti() argument
522 if (bond_uses_primary(bond)) { in bond_set_allmulti()
523 struct slave *curr_active = rtnl_dereference(bond->curr_active_slave); in bond_set_allmulti()
530 bond_for_each_slave(bond, slave, iter) { in bond_set_allmulti()
545 struct bonding *bond = container_of(work, struct bonding, in bond_resend_igmp_join_requests_delayed() local
549 queue_delayed_work(bond->wq, &bond->mcast_work, 1); in bond_resend_igmp_join_requests_delayed()
552 call_netdevice_notifiers(NETDEV_RESEND_IGMP, bond->dev); in bond_resend_igmp_join_requests_delayed()
554 if (bond->igmp_retrans > 1) { in bond_resend_igmp_join_requests_delayed()
555 bond->igmp_retrans--; in bond_resend_igmp_join_requests_delayed()
556 queue_delayed_work(bond->wq, &bond->mcast_work, HZ/5); in bond_resend_igmp_join_requests_delayed()
565 struct bonding *bond = netdev_priv(bond_dev); in bond_hw_addr_flush() local
570 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_hw_addr_flush()
585 static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active, in bond_hw_addr_swap() argument
589 if (bond->dev->flags & IFF_PROMISC) in bond_hw_addr_swap()
592 if (bond->dev->flags & IFF_ALLMULTI) in bond_hw_addr_swap()
595 bond_hw_addr_flush(bond->dev, old_active->dev); in bond_hw_addr_swap()
600 if (bond->dev->flags & IFF_PROMISC) in bond_hw_addr_swap()
603 if (bond->dev->flags & IFF_ALLMULTI) in bond_hw_addr_swap()
606 netif_addr_lock_bh(bond->dev); in bond_hw_addr_swap()
607 dev_uc_sync(new_active->dev, bond->dev); in bond_hw_addr_swap()
608 dev_mc_sync(new_active->dev, bond->dev); in bond_hw_addr_swap()
609 netif_addr_unlock_bh(bond->dev); in bond_hw_addr_swap()
630 static struct slave *bond_get_old_active(struct bonding *bond, in bond_get_old_active() argument
636 bond_for_each_slave(bond, slave, iter) { in bond_get_old_active()
640 if (ether_addr_equal(bond->dev->dev_addr, slave->dev->dev_addr)) in bond_get_old_active()
653 static void bond_do_fail_over_mac(struct bonding *bond, in bond_do_fail_over_mac() argument
661 switch (bond->params.fail_over_mac) { in bond_do_fail_over_mac()
664 bond_set_dev_addr(bond->dev, new_active->dev); in bond_do_fail_over_mac()
675 old_active = bond_get_old_active(bond, new_active); in bond_do_fail_over_mac()
683 ether_addr_copy(saddr.sa_data, bond->dev->dev_addr); in bond_do_fail_over_mac()
684 saddr.sa_family = bond->dev->type; in bond_do_fail_over_mac()
689 netdev_err(bond->dev, "Error %d setting MAC of slave %s\n", in bond_do_fail_over_mac()
702 netdev_err(bond->dev, "Error %d setting MAC of slave %s\n", in bond_do_fail_over_mac()
707 netdev_err(bond->dev, "bond_do_fail_over_mac impossible: bad policy %d\n", in bond_do_fail_over_mac()
708 bond->params.fail_over_mac); in bond_do_fail_over_mac()
714 static struct slave *bond_choose_primary_or_current(struct bonding *bond) in bond_choose_primary_or_current() argument
716 struct slave *prim = rtnl_dereference(bond->primary_slave); in bond_choose_primary_or_current()
717 struct slave *curr = rtnl_dereference(bond->curr_active_slave); in bond_choose_primary_or_current()
725 if (bond->force_primary) { in bond_choose_primary_or_current()
726 bond->force_primary = false; in bond_choose_primary_or_current()
734 switch (bond->params.primary_reselect) { in bond_choose_primary_or_current()
746 netdev_err(bond->dev, "impossible primary_reselect %d\n", in bond_choose_primary_or_current()
747 bond->params.primary_reselect); in bond_choose_primary_or_current()
756 static struct slave *bond_find_best_slave(struct bonding *bond) in bond_find_best_slave() argument
760 int mintime = bond->params.updelay; in bond_find_best_slave()
762 slave = bond_choose_primary_or_current(bond); in bond_find_best_slave()
766 bond_for_each_slave(bond, slave, iter) { in bond_find_best_slave()
779 static bool bond_should_notify_peers(struct bonding *bond) in bond_should_notify_peers() argument
784 slave = rcu_dereference(bond->curr_active_slave); in bond_should_notify_peers()
787 netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", in bond_should_notify_peers()
790 if (!slave || !bond->send_peer_notif || in bond_should_notify_peers()
791 !netif_carrier_ok(bond->dev) || in bond_should_notify_peers()
813 void bond_change_active_slave(struct bonding *bond, struct slave *new_active) in bond_change_active_slave() argument
819 old_active = rtnl_dereference(bond->curr_active_slave); in bond_change_active_slave()
828 if (bond_uses_primary(bond)) { in bond_change_active_slave()
829 netdev_info(bond->dev, "making interface %s the new active one %d ms earlier\n", in bond_change_active_slave()
831 (bond->params.updelay - new_active->delay) * bond->params.miimon); in bond_change_active_slave()
837 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_change_active_slave()
840 if (bond_is_lb(bond)) in bond_change_active_slave()
841 bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); in bond_change_active_slave()
843 if (bond_uses_primary(bond)) { in bond_change_active_slave()
844 netdev_info(bond->dev, "making interface %s the new active one\n", in bond_change_active_slave()
850 if (bond_uses_primary(bond)) in bond_change_active_slave()
851 bond_hw_addr_swap(bond, new_active, old_active); in bond_change_active_slave()
853 if (bond_is_lb(bond)) { in bond_change_active_slave()
854 bond_alb_handle_active_change(bond, new_active); in bond_change_active_slave()
862 rcu_assign_pointer(bond->curr_active_slave, new_active); in bond_change_active_slave()
865 if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) { in bond_change_active_slave()
876 if (bond->params.fail_over_mac) in bond_change_active_slave()
877 bond_do_fail_over_mac(bond, new_active, in bond_change_active_slave()
880 if (netif_running(bond->dev)) { in bond_change_active_slave()
881 bond->send_peer_notif = in bond_change_active_slave()
882 bond->params.num_peer_notif; in bond_change_active_slave()
884 bond_should_notify_peers(bond); in bond_change_active_slave()
887 call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, bond->dev); in bond_change_active_slave()
890 bond->dev); in bond_change_active_slave()
899 if (netif_running(bond->dev) && (bond->params.resend_igmp > 0) && in bond_change_active_slave()
900 ((bond_uses_primary(bond) && new_active) || in bond_change_active_slave()
901 BOND_MODE(bond) == BOND_MODE_ROUNDROBIN)) { in bond_change_active_slave()
902 bond->igmp_retrans = bond->params.resend_igmp; in bond_change_active_slave()
903 queue_delayed_work(bond->wq, &bond->mcast_work, 1); in bond_change_active_slave()
918 void bond_select_active_slave(struct bonding *bond) in bond_select_active_slave() argument
925 best_slave = bond_find_best_slave(bond); in bond_select_active_slave()
926 if (best_slave != rtnl_dereference(bond->curr_active_slave)) { in bond_select_active_slave()
927 bond_change_active_slave(bond, best_slave); in bond_select_active_slave()
928 rv = bond_set_carrier(bond); in bond_select_active_slave()
932 if (netif_carrier_ok(bond->dev)) { in bond_select_active_slave()
933 netdev_info(bond->dev, "first active interface up!\n"); in bond_select_active_slave()
935 netdev_info(bond->dev, "now running without any active interface!\n"); in bond_select_active_slave()
973 struct bonding *bond = netdev_priv(bond_dev); in bond_poll_controller() local
980 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_poll_controller()
981 if (bond_3ad_get_active_agg_info(bond, &ad_info)) in bond_poll_controller()
984 bond_for_each_slave_rcu(bond, slave, iter) { in bond_poll_controller()
989 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_poll_controller()
1008 struct bonding *bond = netdev_priv(bond_dev); in bond_netpoll_cleanup() local
1012 bond_for_each_slave(bond, slave, iter) in bond_netpoll_cleanup()
1019 struct bonding *bond = netdev_priv(dev); in bond_netpoll_setup() local
1024 bond_for_each_slave(bond, slave, iter) { in bond_netpoll_setup()
1051 struct bonding *bond = netdev_priv(dev); in bond_fix_features() local
1061 bond_for_each_slave(bond, slave, iter) { in bond_fix_features()
1078 static void bond_compute_features(struct bonding *bond) in bond_compute_features() argument
1084 struct net_device *bond_dev = bond->dev; in bond_compute_features()
1091 if (!bond_has_slaves(bond)) in bond_compute_features()
1095 bond_for_each_slave(bond, slave, iter) { in bond_compute_features()
1143 struct bonding *bond) in bond_should_deliver_exact_match() argument
1146 if (BOND_MODE(bond) == BOND_MODE_ALB && in bond_should_deliver_exact_match()
1159 struct bonding *bond; in bond_handle_frame() local
1171 bond = slave->bond; in bond_handle_frame()
1173 recv_probe = ACCESS_ONCE(bond->recv_probe); in bond_handle_frame()
1175 ret = recv_probe(skb, bond, slave); in bond_handle_frame()
1182 if (bond_should_deliver_exact_match(skb, slave, bond)) { in bond_handle_frame()
1186 skb->dev = bond->dev; in bond_handle_frame()
1188 if (BOND_MODE(bond) == BOND_MODE_ALB && in bond_handle_frame()
1189 bond->dev->priv_flags & IFF_BRIDGE_PORT && in bond_handle_frame()
1197 ether_addr_copy(eth_hdr(skb)->h_dest, bond->dev->dev_addr); in bond_handle_frame()
1224 static struct slave *bond_alloc_slave(struct bonding *bond) in bond_alloc_slave() argument
1232 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_alloc_slave()
1245 struct bonding *bond = bond_get_bond_by_slave(slave); in bond_free_slave() local
1247 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_free_slave()
1253 static void bond_fill_ifbond(struct bonding *bond, struct ifbond *info) in bond_fill_ifbond() argument
1255 info->bond_mode = BOND_MODE(bond); in bond_fill_ifbond()
1256 info->miimon = bond->params.miimon; in bond_fill_ifbond()
1257 info->num_slaves = bond->slave_cnt; in bond_fill_ifbond()
1288 struct bonding *bond = slave->bond; in bond_queue_slave_event() local
1297 bond_fill_ifbond(bond, &nnw->bonding_info.master); in bond_queue_slave_event()
1300 queue_delayed_work(slave->bond->wq, &nnw->work, 0); in bond_queue_slave_event()
1306 struct bonding *bond = netdev_priv(bond_dev); in bond_enslave() local
1313 if (!bond->params.use_carrier && in bond_enslave()
1369 if (!bond_has_slaves(bond)) { in bond_enslave()
1406 if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP && in bond_enslave()
1407 bond->params.fail_over_mac != BOND_FOM_ACTIVE) { in bond_enslave()
1408 if (!bond_has_slaves(bond)) { in bond_enslave()
1409 bond->params.fail_over_mac = BOND_FOM_ACTIVE; in bond_enslave()
1424 if (!bond_has_slaves(bond) && in bond_enslave()
1425 bond->dev->addr_assign_type == NET_ADDR_RANDOM) in bond_enslave()
1426 bond_set_dev_addr(bond->dev, slave_dev); in bond_enslave()
1428 new_slave = bond_alloc_slave(bond); in bond_enslave()
1434 new_slave->bond = bond; in bond_enslave()
1443 res = dev_set_mtu(slave_dev, bond->dev->mtu); in bond_enslave()
1455 if (!bond->params.fail_over_mac || in bond_enslave()
1456 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { in bond_enslave()
1483 if (bond_is_lb(bond)) { in bond_enslave()
1487 res = bond_alb_init_slave(bond, new_slave); in bond_enslave()
1495 if (!bond_uses_primary(bond)) { in bond_enslave()
1518 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_enslave()
1532 prev_slave = bond_last_slave(bond); in bond_enslave()
1540 (msecs_to_jiffies(bond->params.arp_interval) + 1); in bond_enslave()
1544 if (bond->params.miimon && !bond->params.use_carrier) { in bond_enslave()
1545 link_reporting = bond_check_dev_link(bond, slave_dev, 1); in bond_enslave()
1547 if ((link_reporting == -1) && !bond->params.arp_interval) { in bond_enslave()
1566 if (bond->params.miimon) { in bond_enslave()
1567 if (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS) { in bond_enslave()
1568 if (bond->params.updelay) { in bond_enslave()
1571 new_slave->delay = bond->params.updelay; in bond_enslave()
1579 } else if (bond->params.arp_interval) { in bond_enslave()
1593 if (bond_uses_primary(bond) && bond->params.primary[0]) { in bond_enslave()
1595 if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { in bond_enslave()
1596 rcu_assign_pointer(bond->primary_slave, new_slave); in bond_enslave()
1597 bond->force_primary = true; in bond_enslave()
1601 switch (BOND_MODE(bond)) { in bond_enslave()
1618 bond_3ad_initialize(bond, 1000/AD_TIMER_INTERVAL); in bond_enslave()
1641 if (!rcu_access_pointer(bond->curr_active_slave) && in bond_enslave()
1643 rcu_assign_pointer(bond->curr_active_slave, new_slave); in bond_enslave()
1649 slave_dev->npinfo = bond->dev->npinfo; in bond_enslave()
1681 bond->slave_cnt++; in bond_enslave()
1682 bond_compute_features(bond); in bond_enslave()
1683 bond_set_carrier(bond); in bond_enslave()
1685 if (bond_uses_primary(bond)) { in bond_enslave()
1687 bond_select_active_slave(bond); in bond_enslave()
1691 if (bond_mode_uses_xmit_hash(bond)) in bond_enslave()
1692 bond_update_slave_arr(bond, NULL); in bond_enslave()
1711 if (!bond_uses_primary(bond)) in bond_enslave()
1715 if (rcu_access_pointer(bond->primary_slave) == new_slave) in bond_enslave()
1716 RCU_INIT_POINTER(bond->primary_slave, NULL); in bond_enslave()
1717 if (rcu_access_pointer(bond->curr_active_slave) == new_slave) { in bond_enslave()
1719 bond_change_active_slave(bond, NULL); in bond_enslave()
1720 bond_select_active_slave(bond); in bond_enslave()
1733 if (!bond->params.fail_over_mac || in bond_enslave()
1734 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { in bond_enslave()
1752 if (!bond_has_slaves(bond)) { in bond_enslave()
1782 struct bonding *bond = netdev_priv(bond_dev); in __bond_release_one() local
1798 slave = bond_get_slave_by_dev(bond, slave_dev); in __bond_release_one()
1810 bond_get_stats(bond->dev, &bond->bond_stats); in __bond_release_one()
1818 if (BOND_MODE(bond) == BOND_MODE_8023AD) in __bond_release_one()
1821 if (bond_mode_uses_xmit_hash(bond)) in __bond_release_one()
1822 bond_update_slave_arr(bond, slave); in __bond_release_one()
1828 oldcurrent = rcu_access_pointer(bond->curr_active_slave); in __bond_release_one()
1830 RCU_INIT_POINTER(bond->current_arp_slave, NULL); in __bond_release_one()
1832 if (!all && (!bond->params.fail_over_mac || in __bond_release_one()
1833 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)) { in __bond_release_one()
1835 bond_has_slaves(bond)) in __bond_release_one()
1841 if (rtnl_dereference(bond->primary_slave) == slave) in __bond_release_one()
1842 RCU_INIT_POINTER(bond->primary_slave, NULL); in __bond_release_one()
1845 bond_change_active_slave(bond, NULL); in __bond_release_one()
1847 if (bond_is_lb(bond)) { in __bond_release_one()
1853 bond_alb_deinit_slave(bond, slave); in __bond_release_one()
1857 RCU_INIT_POINTER(bond->curr_active_slave, NULL); in __bond_release_one()
1863 bond_select_active_slave(bond); in __bond_release_one()
1866 if (!bond_has_slaves(bond)) { in __bond_release_one()
1867 bond_set_carrier(bond); in __bond_release_one()
1873 bond->slave_cnt--; in __bond_release_one()
1875 if (!bond_has_slaves(bond)) { in __bond_release_one()
1876 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); in __bond_release_one()
1877 call_netdevice_notifiers(NETDEV_RELEASE, bond->dev); in __bond_release_one()
1880 bond_compute_features(bond); in __bond_release_one()
1891 if (!bond_uses_primary(bond)) { in __bond_release_one()
1914 if (bond->params.fail_over_mac != BOND_FOM_ACTIVE || in __bond_release_one()
1915 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { in __bond_release_one()
1943 struct bonding *bond = netdev_priv(bond_dev); in bond_release_and_destroy() local
1947 if (ret == 0 && !bond_has_slaves(bond)) { in bond_release_and_destroy()
1951 bond_remove_proc_entry(bond); in bond_release_and_destroy()
1959 struct bonding *bond = netdev_priv(bond_dev); in bond_info_query() local
1960 bond_fill_ifbond(bond, info); in bond_info_query()
1966 struct bonding *bond = netdev_priv(bond_dev); in bond_slave_info_query() local
1971 bond_for_each_slave(bond, slave, iter) { in bond_slave_info_query()
1985 static int bond_miimon_inspect(struct bonding *bond) in bond_miimon_inspect() argument
1992 ignore_updelay = !rcu_dereference(bond->curr_active_slave); in bond_miimon_inspect()
1994 bond_for_each_slave_rcu(bond, slave, iter) { in bond_miimon_inspect()
1997 link_state = bond_check_dev_link(bond, slave->dev, 0); in bond_miimon_inspect()
2005 slave->delay = bond->params.downdelay; in bond_miimon_inspect()
2007 netdev_info(bond->dev, "link status down for %sinterface %s, disabling it in %d ms\n", in bond_miimon_inspect()
2008 (BOND_MODE(bond) == in bond_miimon_inspect()
2013 bond->params.downdelay * bond->params.miimon); in bond_miimon_inspect()
2021 netdev_info(bond->dev, "link status up again after %d ms for interface %s\n", in bond_miimon_inspect()
2022 (bond->params.downdelay - slave->delay) * in bond_miimon_inspect()
2023 bond->params.miimon, in bond_miimon_inspect()
2042 slave->delay = bond->params.updelay; in bond_miimon_inspect()
2045 netdev_info(bond->dev, "link status up for interface %s, enabling it in %d ms\n", in bond_miimon_inspect()
2048 bond->params.updelay * in bond_miimon_inspect()
2049 bond->params.miimon); in bond_miimon_inspect()
2056 netdev_info(bond->dev, "link status down again after %d ms for interface %s\n", in bond_miimon_inspect()
2057 (bond->params.updelay - slave->delay) * in bond_miimon_inspect()
2058 bond->params.miimon, in bond_miimon_inspect()
2082 static void bond_miimon_commit(struct bonding *bond) in bond_miimon_commit() argument
2087 bond_for_each_slave(bond, slave, iter) { in bond_miimon_commit()
2096 primary = rtnl_dereference(bond->primary_slave); in bond_miimon_commit()
2097 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_miimon_commit()
2100 } else if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { in bond_miimon_commit()
2108 netdev_info(bond->dev, "link status definitely up for interface %s, %u Mbps %s duplex\n", in bond_miimon_commit()
2114 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_miimon_commit()
2117 if (bond_is_lb(bond)) in bond_miimon_commit()
2118 bond_alb_handle_link_change(bond, slave, in bond_miimon_commit()
2121 if (BOND_MODE(bond) == BOND_MODE_XOR) in bond_miimon_commit()
2122 bond_update_slave_arr(bond, NULL); in bond_miimon_commit()
2124 if (!bond->curr_active_slave || slave == primary) in bond_miimon_commit()
2135 if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP || in bond_miimon_commit()
2136 BOND_MODE(bond) == BOND_MODE_8023AD) in bond_miimon_commit()
2140 netdev_info(bond->dev, "link status definitely down for interface %s, disabling it\n", in bond_miimon_commit()
2143 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_miimon_commit()
2147 if (bond_is_lb(bond)) in bond_miimon_commit()
2148 bond_alb_handle_link_change(bond, slave, in bond_miimon_commit()
2151 if (BOND_MODE(bond) == BOND_MODE_XOR) in bond_miimon_commit()
2152 bond_update_slave_arr(bond, NULL); in bond_miimon_commit()
2154 if (slave == rcu_access_pointer(bond->curr_active_slave)) in bond_miimon_commit()
2160 netdev_err(bond->dev, "invalid new link %d on slave %s\n", in bond_miimon_commit()
2169 bond_select_active_slave(bond); in bond_miimon_commit()
2173 bond_set_carrier(bond); in bond_miimon_commit()
2185 struct bonding *bond = container_of(work, struct bonding, in bond_mii_monitor() local
2190 delay = msecs_to_jiffies(bond->params.miimon); in bond_mii_monitor()
2192 if (!bond_has_slaves(bond)) in bond_mii_monitor()
2197 should_notify_peers = bond_should_notify_peers(bond); in bond_mii_monitor()
2199 if (bond_miimon_inspect(bond)) { in bond_mii_monitor()
2209 bond_miimon_commit(bond); in bond_mii_monitor()
2216 if (bond->params.miimon) in bond_mii_monitor()
2217 queue_delayed_work(bond->wq, &bond->mii_work, delay); in bond_mii_monitor()
2222 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); in bond_mii_monitor()
2227 static bool bond_has_this_ip(struct bonding *bond, __be32 ip) in bond_has_this_ip() argument
2233 if (ip == bond_confirm_addr(bond->dev, 0, ip)) in bond_has_this_ip()
2237 netdev_for_each_all_upper_dev_rcu(bond->dev, upper, iter) { in bond_has_this_ip()
2345 static void bond_arp_send_all(struct bonding *bond, struct slave *slave) in bond_arp_send_all() argument
2349 __be32 *targets = bond->params.arp_targets, addr; in bond_arp_send_all()
2353 netdev_dbg(bond->dev, "basa: target %pI4\n", &targets[i]); in bond_arp_send_all()
2357 rt = ip_route_output(dev_net(bond->dev), targets[i], 0, in bond_arp_send_all()
2363 if (bond->params.arp_validate) in bond_arp_send_all()
2365 bond->dev->name, in bond_arp_send_all()
2373 if (rt->dst.dev == bond->dev) in bond_arp_send_all()
2377 tags = bond_verify_device_path(bond->dev, rt->dst.dev, 0); in bond_arp_send_all()
2384 netdev_dbg(bond->dev, "no path to arp_ip_target %pI4 via rt.dev %s\n", in bond_arp_send_all()
2399 static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 sip, __be32 tip) in bond_validate_arp() argument
2403 if (!sip || !bond_has_this_ip(bond, tip)) { in bond_validate_arp()
2404 netdev_dbg(bond->dev, "bva: sip %pI4 tip %pI4 not found\n", in bond_validate_arp()
2409 i = bond_get_targets_ip(bond->params.arp_targets, sip); in bond_validate_arp()
2411 netdev_dbg(bond->dev, "bva: sip %pI4 not found in targets\n", in bond_validate_arp()
2419 int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, in bond_arp_rcv() argument
2428 if (!slave_do_arp_validate(bond, slave)) { in bond_arp_rcv()
2429 if ((slave_do_arp_validate_only(bond) && is_arp) || in bond_arp_rcv()
2430 !slave_do_arp_validate_only(bond)) in bond_arp_rcv()
2437 alen = arp_hdr_len(bond->dev); in bond_arp_rcv()
2439 netdev_dbg(bond->dev, "bond_arp_rcv: skb->dev %s\n", in bond_arp_rcv()
2450 if (arp->ar_hln != bond->dev->addr_len || in bond_arp_rcv()
2459 arp_ptr += bond->dev->addr_len; in bond_arp_rcv()
2461 arp_ptr += 4 + bond->dev->addr_len; in bond_arp_rcv()
2464 netdev_dbg(bond->dev, "bond_arp_rcv: %s/%d av %d sv %d sip %pI4 tip %pI4\n", in bond_arp_rcv()
2466 bond->params.arp_validate, slave_do_arp_validate(bond, slave), in bond_arp_rcv()
2469 curr_active_slave = rcu_dereference(bond->curr_active_slave); in bond_arp_rcv()
2470 curr_arp_slave = rcu_dereference(bond->current_arp_slave); in bond_arp_rcv()
2496 bond_validate_arp(bond, slave, sip, tip); in bond_arp_rcv()
2498 time_after(slave_last_rx(bond, curr_active_slave), in bond_arp_rcv()
2500 bond_validate_arp(bond, slave, tip, sip); in bond_arp_rcv()
2502 bond_time_in_interval(bond, in bond_arp_rcv()
2504 bond_validate_arp(bond, slave, sip, tip); in bond_arp_rcv()
2516 static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act, in bond_time_in_interval() argument
2519 int delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); in bond_time_in_interval()
2534 struct bonding *bond = container_of(work, struct bonding, in bond_loadbalance_arp_mon() local
2540 if (!bond_has_slaves(bond)) in bond_loadbalance_arp_mon()
2545 oldcurrent = rcu_dereference(bond->curr_active_slave); in bond_loadbalance_arp_mon()
2554 bond_for_each_slave_rcu(bond, slave, iter) { in bond_loadbalance_arp_mon()
2558 if (bond_time_in_interval(bond, trans_start, 1) && in bond_loadbalance_arp_mon()
2559 bond_time_in_interval(bond, slave->last_rx, 1)) { in bond_loadbalance_arp_mon()
2570 netdev_info(bond->dev, "link status definitely up for interface %s\n", in bond_loadbalance_arp_mon()
2574 netdev_info(bond->dev, "interface %s is now up\n", in bond_loadbalance_arp_mon()
2585 if (!bond_time_in_interval(bond, trans_start, 2) || in bond_loadbalance_arp_mon()
2586 !bond_time_in_interval(bond, slave->last_rx, 2)) { in bond_loadbalance_arp_mon()
2594 netdev_info(bond->dev, "interface %s is now down\n", in bond_loadbalance_arp_mon()
2610 bond_arp_send_all(bond, slave); in bond_loadbalance_arp_mon()
2620 bond_slave_state_change(bond); in bond_loadbalance_arp_mon()
2621 if (BOND_MODE(bond) == BOND_MODE_XOR) in bond_loadbalance_arp_mon()
2622 bond_update_slave_arr(bond, NULL); in bond_loadbalance_arp_mon()
2626 bond_select_active_slave(bond); in bond_loadbalance_arp_mon()
2633 if (bond->params.arp_interval) in bond_loadbalance_arp_mon()
2634 queue_delayed_work(bond->wq, &bond->arp_work, in bond_loadbalance_arp_mon()
2635 msecs_to_jiffies(bond->params.arp_interval)); in bond_loadbalance_arp_mon()
2645 static int bond_ab_arp_inspect(struct bonding *bond) in bond_ab_arp_inspect() argument
2652 bond_for_each_slave_rcu(bond, slave, iter) { in bond_ab_arp_inspect()
2654 last_rx = slave_last_rx(bond, slave); in bond_ab_arp_inspect()
2657 if (bond_time_in_interval(bond, last_rx, 1)) { in bond_ab_arp_inspect()
2668 if (bond_time_in_interval(bond, slave->last_link_up, 2)) in bond_ab_arp_inspect()
2684 !rcu_access_pointer(bond->current_arp_slave) && in bond_ab_arp_inspect()
2685 !bond_time_in_interval(bond, last_rx, 3)) { in bond_ab_arp_inspect()
2697 (!bond_time_in_interval(bond, trans_start, 2) || in bond_ab_arp_inspect()
2698 !bond_time_in_interval(bond, last_rx, 2))) { in bond_ab_arp_inspect()
2712 static void bond_ab_arp_commit(struct bonding *bond) in bond_ab_arp_commit() argument
2718 bond_for_each_slave(bond, slave, iter) { in bond_ab_arp_commit()
2725 if (rtnl_dereference(bond->curr_active_slave) != slave || in bond_ab_arp_commit()
2726 (!rtnl_dereference(bond->curr_active_slave) && in bond_ab_arp_commit()
2727 bond_time_in_interval(bond, trans_start, 1))) { in bond_ab_arp_commit()
2730 current_arp_slave = rtnl_dereference(bond->current_arp_slave); in bond_ab_arp_commit()
2736 RCU_INIT_POINTER(bond->current_arp_slave, NULL); in bond_ab_arp_commit()
2739 netdev_info(bond->dev, "link status definitely up for interface %s\n", in bond_ab_arp_commit()
2742 if (!rtnl_dereference(bond->curr_active_slave) || in bond_ab_arp_commit()
2743 slave == rtnl_dereference(bond->primary_slave)) in bond_ab_arp_commit()
2758 netdev_info(bond->dev, "link status definitely down for interface %s, disabling it\n", in bond_ab_arp_commit()
2761 if (slave == rtnl_dereference(bond->curr_active_slave)) { in bond_ab_arp_commit()
2762 RCU_INIT_POINTER(bond->current_arp_slave, NULL); in bond_ab_arp_commit()
2769 netdev_err(bond->dev, "impossible: new_link %d on slave %s\n", in bond_ab_arp_commit()
2776 bond_select_active_slave(bond); in bond_ab_arp_commit()
2780 bond_set_carrier(bond); in bond_ab_arp_commit()
2787 static bool bond_ab_arp_probe(struct bonding *bond) in bond_ab_arp_probe() argument
2790 *curr_arp_slave = rcu_dereference(bond->current_arp_slave), in bond_ab_arp_probe()
2791 *curr_active_slave = rcu_dereference(bond->curr_active_slave); in bond_ab_arp_probe()
2797 netdev_info(bond->dev, "PROBE: c_arp %s && cas %s BAD\n", in bond_ab_arp_probe()
2802 bond_arp_send_all(bond, curr_active_slave); in bond_ab_arp_probe()
2812 curr_arp_slave = bond_first_slave_rcu(bond); in bond_ab_arp_probe()
2819 bond_for_each_slave_rcu(bond, slave, iter) { in bond_ab_arp_probe()
2840 netdev_info(bond->dev, "backup interface %s is now down\n", in bond_ab_arp_probe()
2855 bond_arp_send_all(bond, new_slave); in bond_ab_arp_probe()
2857 rcu_assign_pointer(bond->current_arp_slave, new_slave); in bond_ab_arp_probe()
2860 bond_for_each_slave_rcu(bond, slave, iter) { in bond_ab_arp_probe()
2871 struct bonding *bond = container_of(work, struct bonding, in bond_activebackup_arp_mon() local
2877 delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); in bond_activebackup_arp_mon()
2879 if (!bond_has_slaves(bond)) in bond_activebackup_arp_mon()
2884 should_notify_peers = bond_should_notify_peers(bond); in bond_activebackup_arp_mon()
2886 if (bond_ab_arp_inspect(bond)) { in bond_activebackup_arp_mon()
2896 bond_ab_arp_commit(bond); in bond_activebackup_arp_mon()
2902 should_notify_rtnl = bond_ab_arp_probe(bond); in bond_activebackup_arp_mon()
2906 if (bond->params.arp_interval) in bond_activebackup_arp_mon()
2907 queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks); in bond_activebackup_arp_mon()
2915 bond->dev); in bond_activebackup_arp_mon()
2917 bond_slave_state_notify(bond); in bond_activebackup_arp_mon()
2926 static int bond_event_changename(struct bonding *bond) in bond_event_changename() argument
2928 bond_remove_proc_entry(bond); in bond_event_changename()
2929 bond_create_proc_entry(bond); in bond_event_changename()
2931 bond_debug_reregister(bond); in bond_event_changename()
2965 struct bonding *bond; in bond_slave_netdev_event() local
2974 bond_dev = slave->bond->dev; in bond_slave_netdev_event()
2975 bond = slave->bond; in bond_slave_netdev_event()
2976 primary = rtnl_dereference(bond->primary_slave); in bond_slave_netdev_event()
2988 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_slave_netdev_event()
3000 if (bond_mode_uses_xmit_hash(bond)) in bond_slave_netdev_event()
3001 bond_update_slave_arr(bond, NULL); in bond_slave_netdev_event()
3018 if (!bond_uses_primary(bond) || in bond_slave_netdev_event()
3019 !bond->params.primary[0]) in bond_slave_netdev_event()
3024 RCU_INIT_POINTER(bond->primary_slave, NULL); in bond_slave_netdev_event()
3025 } else if (!strcmp(slave_dev->name, bond->params.primary)) { in bond_slave_netdev_event()
3027 rcu_assign_pointer(bond->primary_slave, slave); in bond_slave_netdev_event()
3032 netdev_info(bond->dev, "Primary slave changed to %s, reselecting active slave\n", in bond_slave_netdev_event()
3036 bond_select_active_slave(bond); in bond_slave_netdev_event()
3040 bond_compute_features(bond); in bond_slave_netdev_event()
3044 call_netdevice_notifiers(event, slave->bond->dev); in bond_slave_netdev_event()
3101 static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb, in bond_flow_dissect() argument
3108 if (bond->params.xmit_policy > BOND_XMIT_POLICY_LAYER23) in bond_flow_dissect()
3131 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34 && proto >= 0) in bond_flow_dissect()
3145 u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb) in bond_xmit_hash() argument
3150 if (bond->params.xmit_policy == BOND_XMIT_POLICY_ENCAP34 && in bond_xmit_hash()
3154 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER2 || in bond_xmit_hash()
3155 !bond_flow_dissect(bond, skb, &flow)) in bond_xmit_hash()
3158 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER23 || in bond_xmit_hash()
3159 bond->params.xmit_policy == BOND_XMIT_POLICY_ENCAP23) in bond_xmit_hash()
3173 static void bond_work_init_all(struct bonding *bond) in bond_work_init_all() argument
3175 INIT_DELAYED_WORK(&bond->mcast_work, in bond_work_init_all()
3177 INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor); in bond_work_init_all()
3178 INIT_DELAYED_WORK(&bond->mii_work, bond_mii_monitor); in bond_work_init_all()
3179 if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) in bond_work_init_all()
3180 INIT_DELAYED_WORK(&bond->arp_work, bond_activebackup_arp_mon); in bond_work_init_all()
3182 INIT_DELAYED_WORK(&bond->arp_work, bond_loadbalance_arp_mon); in bond_work_init_all()
3183 INIT_DELAYED_WORK(&bond->ad_work, bond_3ad_state_machine_handler); in bond_work_init_all()
3184 INIT_DELAYED_WORK(&bond->slave_arr_work, bond_slave_arr_handler); in bond_work_init_all()
3187 static void bond_work_cancel_all(struct bonding *bond) in bond_work_cancel_all() argument
3189 cancel_delayed_work_sync(&bond->mii_work); in bond_work_cancel_all()
3190 cancel_delayed_work_sync(&bond->arp_work); in bond_work_cancel_all()
3191 cancel_delayed_work_sync(&bond->alb_work); in bond_work_cancel_all()
3192 cancel_delayed_work_sync(&bond->ad_work); in bond_work_cancel_all()
3193 cancel_delayed_work_sync(&bond->mcast_work); in bond_work_cancel_all()
3194 cancel_delayed_work_sync(&bond->slave_arr_work); in bond_work_cancel_all()
3199 struct bonding *bond = netdev_priv(bond_dev); in bond_open() local
3204 if (bond_has_slaves(bond)) { in bond_open()
3205 bond_for_each_slave(bond, slave, iter) { in bond_open()
3206 if (bond_uses_primary(bond) && in bond_open()
3207 slave != rcu_access_pointer(bond->curr_active_slave)) { in bond_open()
3210 } else if (BOND_MODE(bond) != BOND_MODE_8023AD) { in bond_open()
3217 bond_work_init_all(bond); in bond_open()
3219 if (bond_is_lb(bond)) { in bond_open()
3223 if (bond_alb_initialize(bond, (BOND_MODE(bond) == BOND_MODE_ALB))) in bond_open()
3225 if (bond->params.tlb_dynamic_lb) in bond_open()
3226 queue_delayed_work(bond->wq, &bond->alb_work, 0); in bond_open()
3229 if (bond->params.miimon) /* link check interval, in milliseconds. */ in bond_open()
3230 queue_delayed_work(bond->wq, &bond->mii_work, 0); in bond_open()
3232 if (bond->params.arp_interval) { /* arp interval, in milliseconds. */ in bond_open()
3233 queue_delayed_work(bond->wq, &bond->arp_work, 0); in bond_open()
3234 bond->recv_probe = bond_arp_rcv; in bond_open()
3237 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_open()
3238 queue_delayed_work(bond->wq, &bond->ad_work, 0); in bond_open()
3240 bond->recv_probe = bond_3ad_lacpdu_recv; in bond_open()
3241 bond_3ad_initiate_agg_selection(bond, 1); in bond_open()
3244 if (bond_mode_uses_xmit_hash(bond)) in bond_open()
3245 bond_update_slave_arr(bond, NULL); in bond_open()
3252 struct bonding *bond = netdev_priv(bond_dev); in bond_close() local
3254 bond_work_cancel_all(bond); in bond_close()
3255 bond->send_peer_notif = 0; in bond_close()
3256 if (bond_is_lb(bond)) in bond_close()
3257 bond_alb_deinitialize(bond); in bond_close()
3258 bond->recv_probe = NULL; in bond_close()
3290 struct bonding *bond = netdev_priv(bond_dev); in bond_get_stats() local
3295 spin_lock(&bond->stats_lock); in bond_get_stats()
3296 memcpy(stats, &bond->bond_stats, sizeof(*stats)); in bond_get_stats()
3299 bond_for_each_slave_rcu(bond, slave, iter) { in bond_get_stats()
3310 memcpy(&bond->bond_stats, stats, sizeof(*stats)); in bond_get_stats()
3311 spin_unlock(&bond->stats_lock); in bond_get_stats()
3318 struct bonding *bond = netdev_priv(bond_dev); in bond_do_ioctl() local
3349 if (netif_carrier_ok(bond->dev)) in bond_do_ioctl()
3414 res = __bond_opt_set(bond, BOND_OPT_ACTIVE_SLAVE, &newval); in bond_do_ioctl()
3425 struct bonding *bond = netdev_priv(bond_dev); in bond_change_rx_flags() local
3428 bond_set_promiscuity(bond, in bond_change_rx_flags()
3432 bond_set_allmulti(bond, in bond_change_rx_flags()
3438 struct bonding *bond = netdev_priv(bond_dev); in bond_set_rx_mode() local
3443 if (bond_uses_primary(bond)) { in bond_set_rx_mode()
3444 slave = rcu_dereference(bond->curr_active_slave); in bond_set_rx_mode()
3450 bond_for_each_slave_rcu(bond, slave, iter) { in bond_set_rx_mode()
3460 struct bonding *bond = netdev_priv(n->dev); in bond_neigh_init() local
3466 slave = bond_first_slave(bond); in bond_neigh_init()
3513 struct bonding *bond = netdev_priv(bond_dev); in bond_change_mtu() local
3518 netdev_dbg(bond_dev, "bond=%p, new_mtu=%d\n", bond, new_mtu); in bond_change_mtu()
3520 bond_for_each_slave(bond, slave, iter) { in bond_change_mtu()
3547 bond_for_each_slave(bond, rollback_slave, iter) { in bond_change_mtu()
3571 struct bonding *bond = netdev_priv(bond_dev); in bond_set_mac_address() local
3577 if (BOND_MODE(bond) == BOND_MODE_ALB) in bond_set_mac_address()
3581 netdev_dbg(bond_dev, "bond=%p\n", bond); in bond_set_mac_address()
3586 if (bond->params.fail_over_mac && in bond_set_mac_address()
3587 BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) in bond_set_mac_address()
3593 bond_for_each_slave(bond, slave, iter) { in bond_set_mac_address()
3617 bond_for_each_slave(bond, rollback_slave, iter) { in bond_set_mac_address()
3643 static void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int slave_id) in bond_xmit_slave_id() argument
3650 bond_for_each_slave_rcu(bond, slave, iter) { in bond_xmit_slave_id()
3653 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_slave_id()
3661 bond_for_each_slave_rcu(bond, slave, iter) { in bond_xmit_slave_id()
3665 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_slave_id()
3670 bond_tx_drop(bond->dev, skb); in bond_xmit_slave_id()
3681 static u32 bond_rr_gen_slave_id(struct bonding *bond) in bond_rr_gen_slave_id() argument
3685 int packets_per_slave = bond->params.packets_per_slave; in bond_rr_gen_slave_id()
3692 slave_id = bond->rr_tx_counter; in bond_rr_gen_slave_id()
3696 bond->params.reciprocal_packets_per_slave; in bond_rr_gen_slave_id()
3697 slave_id = reciprocal_divide(bond->rr_tx_counter, in bond_rr_gen_slave_id()
3701 bond->rr_tx_counter++; in bond_rr_gen_slave_id()
3708 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_roundrobin() local
3720 slave = rcu_dereference(bond->curr_active_slave); in bond_xmit_roundrobin()
3722 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_roundrobin()
3724 bond_xmit_slave_id(bond, skb, 0); in bond_xmit_roundrobin()
3726 int slave_cnt = ACCESS_ONCE(bond->slave_cnt); in bond_xmit_roundrobin()
3729 slave_id = bond_rr_gen_slave_id(bond); in bond_xmit_roundrobin()
3730 bond_xmit_slave_id(bond, skb, slave_id % slave_cnt); in bond_xmit_roundrobin()
3744 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_activebackup() local
3747 slave = rcu_dereference(bond->curr_active_slave); in bond_xmit_activebackup()
3749 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_activebackup()
3760 void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay) in bond_slave_arr_work_rearm() argument
3762 queue_delayed_work(bond->wq, &bond->slave_arr_work, delay); in bond_slave_arr_work_rearm()
3768 struct bonding *bond = container_of(work, struct bonding, in bond_slave_arr_handler() local
3775 ret = bond_update_slave_arr(bond, NULL); in bond_slave_arr_handler()
3784 bond_slave_arr_work_rearm(bond, 1); in bond_slave_arr_handler()
3795 int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave) in bond_update_slave_arr() argument
3804 WARN_ON(lockdep_is_held(&bond->mode_lock)); in bond_update_slave_arr()
3807 new_arr = kzalloc(offsetof(struct bond_up_slave, arr[bond->slave_cnt]), in bond_update_slave_arr()
3814 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_update_slave_arr()
3817 if (bond_3ad_get_active_agg_info(bond, &ad_info)) { in bond_update_slave_arr()
3823 old_arr = rtnl_dereference(bond->slave_arr); in bond_update_slave_arr()
3825 RCU_INIT_POINTER(bond->slave_arr, NULL); in bond_update_slave_arr()
3832 bond_for_each_slave(bond, slave, iter) { in bond_update_slave_arr()
3833 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_update_slave_arr()
3847 old_arr = rtnl_dereference(bond->slave_arr); in bond_update_slave_arr()
3848 rcu_assign_pointer(bond->slave_arr, new_arr); in bond_update_slave_arr()
3863 old_arr = rtnl_dereference(bond->slave_arr); in bond_update_slave_arr()
3882 struct bonding *bond = netdev_priv(dev); in bond_3ad_xor_xmit() local
3887 slaves = rcu_dereference(bond->slave_arr); in bond_3ad_xor_xmit()
3890 slave = slaves->arr[bond_xmit_hash(bond, skb) % count]; in bond_3ad_xor_xmit()
3891 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_3ad_xor_xmit()
3902 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_broadcast() local
3906 bond_for_each_slave_rcu(bond, slave, iter) { in bond_xmit_broadcast()
3907 if (bond_is_last_slave(bond, slave)) in bond_xmit_broadcast()
3917 bond_dev_queue_xmit(bond, skb2, slave->dev); in bond_xmit_broadcast()
3921 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_broadcast()
3931 static inline int bond_slave_override(struct bonding *bond, in bond_slave_override() argument
3941 bond_for_each_slave_rcu(bond, slave, iter) { in bond_slave_override()
3945 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_slave_override()
3980 struct bonding *bond = netdev_priv(dev); in __bond_start_xmit() local
3982 if (bond_should_override_tx_queue(bond) && in __bond_start_xmit()
3983 !bond_slave_override(bond, skb)) in __bond_start_xmit()
3986 switch (BOND_MODE(bond)) { in __bond_start_xmit()
4002 netdev_err(dev, "Unknown bonding mode %d\n", BOND_MODE(bond)); in __bond_start_xmit()
4011 struct bonding *bond = netdev_priv(dev); in bond_start_xmit() local
4021 if (bond_has_slaves(bond)) in bond_start_xmit()
4033 struct bonding *bond = netdev_priv(bond_dev); in bond_ethtool_get_settings() local
4046 bond_for_each_slave(bond, slave, iter) { in bond_ethtool_get_settings()
4114 struct bonding *bond = netdev_priv(bond_dev); in bond_destructor() local
4115 if (bond->wq) in bond_destructor()
4116 destroy_workqueue(bond->wq); in bond_destructor()
4122 struct bonding *bond = netdev_priv(bond_dev); in bond_setup() local
4124 spin_lock_init(&bond->mode_lock); in bond_setup()
4125 spin_lock_init(&bond->stats_lock); in bond_setup()
4126 bond->params = bonding_defaults; in bond_setup()
4129 bond->dev = bond_dev; in bond_setup()
4173 struct bonding *bond = netdev_priv(bond_dev); in bond_uninit() local
4181 bond_for_each_slave(bond, slave, iter) in bond_uninit()
4185 arr = rtnl_dereference(bond->slave_arr); in bond_uninit()
4187 RCU_INIT_POINTER(bond->slave_arr, NULL); in bond_uninit()
4191 list_del(&bond->bond_list); in bond_uninit()
4193 bond_debug_unregister(bond); in bond_uninit()
4593 struct bonding *bond = netdev_priv(bond_dev); in bond_init() local
4598 bond->wq = create_singlethread_workqueue(bond_dev->name); in bond_init()
4599 if (!bond->wq) in bond_init()
4604 list_add_tail(&bond->bond_list, &bn->dev_list); in bond_init()
4606 bond_prepare_sysfs_group(bond); in bond_init()
4608 bond_debug_register(bond); in bond_init()
4631 struct bonding *bond; in bond_create() local
4650 bond = netdev_priv(bond_dev); in bond_create()
4651 bond_info = &(BOND_ALB_INFO(bond)); in bond_create()
4683 struct bonding *bond, *tmp_bond; in bond_net_exit() local
4690 list_for_each_entry_safe(bond, tmp_bond, &bn->dev_list, bond_list) in bond_net_exit()
4691 unregister_netdevice_queue(bond->dev, &list); in bond_net_exit()