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 bool bond_should_change_active(struct bonding *bond) in bond_should_change_active() argument
716 struct slave *prim = rtnl_dereference(bond->primary_slave); in bond_should_change_active()
717 struct slave *curr = rtnl_dereference(bond->curr_active_slave); in bond_should_change_active()
721 if (bond->force_primary) { in bond_should_change_active()
722 bond->force_primary = false; in bond_should_change_active()
725 if (bond->params.primary_reselect == BOND_PRI_RESELECT_BETTER && in bond_should_change_active()
729 if (bond->params.primary_reselect == BOND_PRI_RESELECT_FAILURE) in bond_should_change_active()
738 static struct slave *bond_find_best_slave(struct bonding *bond) in bond_find_best_slave() argument
742 int mintime = bond->params.updelay; in bond_find_best_slave()
744 primary = rtnl_dereference(bond->primary_slave); in bond_find_best_slave()
746 bond_should_change_active(bond)) in bond_find_best_slave()
749 bond_for_each_slave(bond, slave, iter) { in bond_find_best_slave()
762 static bool bond_should_notify_peers(struct bonding *bond) in bond_should_notify_peers() argument
767 slave = rcu_dereference(bond->curr_active_slave); in bond_should_notify_peers()
770 netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", in bond_should_notify_peers()
773 if (!slave || !bond->send_peer_notif || in bond_should_notify_peers()
795 void bond_change_active_slave(struct bonding *bond, struct slave *new_active) in bond_change_active_slave() argument
801 old_active = rtnl_dereference(bond->curr_active_slave); in bond_change_active_slave()
810 if (bond_uses_primary(bond)) { in bond_change_active_slave()
811 netdev_info(bond->dev, "making interface %s the new active one %d ms earlier\n", in bond_change_active_slave()
813 (bond->params.updelay - new_active->delay) * bond->params.miimon); in bond_change_active_slave()
819 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_change_active_slave()
822 if (bond_is_lb(bond)) in bond_change_active_slave()
823 bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); in bond_change_active_slave()
825 if (bond_uses_primary(bond)) { in bond_change_active_slave()
826 netdev_info(bond->dev, "making interface %s the new active one\n", in bond_change_active_slave()
832 if (bond_uses_primary(bond)) in bond_change_active_slave()
833 bond_hw_addr_swap(bond, new_active, old_active); in bond_change_active_slave()
835 if (bond_is_lb(bond)) { in bond_change_active_slave()
836 bond_alb_handle_active_change(bond, new_active); in bond_change_active_slave()
844 rcu_assign_pointer(bond->curr_active_slave, new_active); in bond_change_active_slave()
847 if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) { in bond_change_active_slave()
858 if (bond->params.fail_over_mac) in bond_change_active_slave()
859 bond_do_fail_over_mac(bond, new_active, in bond_change_active_slave()
862 if (netif_running(bond->dev)) { in bond_change_active_slave()
863 bond->send_peer_notif = in bond_change_active_slave()
864 bond->params.num_peer_notif; in bond_change_active_slave()
866 bond_should_notify_peers(bond); in bond_change_active_slave()
869 call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, bond->dev); in bond_change_active_slave()
872 bond->dev); in bond_change_active_slave()
881 if (netif_running(bond->dev) && (bond->params.resend_igmp > 0) && in bond_change_active_slave()
882 ((bond_uses_primary(bond) && new_active) || in bond_change_active_slave()
883 BOND_MODE(bond) == BOND_MODE_ROUNDROBIN)) { in bond_change_active_slave()
884 bond->igmp_retrans = bond->params.resend_igmp; in bond_change_active_slave()
885 queue_delayed_work(bond->wq, &bond->mcast_work, 1); in bond_change_active_slave()
900 void bond_select_active_slave(struct bonding *bond) in bond_select_active_slave() argument
907 best_slave = bond_find_best_slave(bond); in bond_select_active_slave()
908 if (best_slave != rtnl_dereference(bond->curr_active_slave)) { in bond_select_active_slave()
909 bond_change_active_slave(bond, best_slave); in bond_select_active_slave()
910 rv = bond_set_carrier(bond); in bond_select_active_slave()
914 if (netif_carrier_ok(bond->dev)) { in bond_select_active_slave()
915 netdev_info(bond->dev, "first active interface up!\n"); in bond_select_active_slave()
917 netdev_info(bond->dev, "now running without any active interface!\n"); in bond_select_active_slave()
955 struct bonding *bond = netdev_priv(bond_dev); in bond_poll_controller() local
962 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_poll_controller()
963 if (bond_3ad_get_active_agg_info(bond, &ad_info)) in bond_poll_controller()
967 bond_for_each_slave_rcu(bond, slave, iter) { in bond_poll_controller()
972 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_poll_controller()
992 struct bonding *bond = netdev_priv(bond_dev); in bond_netpoll_cleanup() local
996 bond_for_each_slave(bond, slave, iter) in bond_netpoll_cleanup()
1003 struct bonding *bond = netdev_priv(dev); in bond_netpoll_setup() local
1008 bond_for_each_slave(bond, slave, iter) { in bond_netpoll_setup()
1035 struct bonding *bond = netdev_priv(dev); in bond_fix_features() local
1048 bond_for_each_slave(bond, slave, iter) { in bond_fix_features()
1065 static void bond_compute_features(struct bonding *bond) in bond_compute_features() argument
1071 struct net_device *bond_dev = bond->dev; in bond_compute_features()
1078 if (!bond_has_slaves(bond)) in bond_compute_features()
1082 bond_for_each_slave(bond, slave, iter) { in bond_compute_features()
1130 struct bonding *bond) in bond_should_deliver_exact_match() argument
1133 if (BOND_MODE(bond) == BOND_MODE_ALB && in bond_should_deliver_exact_match()
1146 struct bonding *bond; in bond_handle_frame() local
1158 bond = slave->bond; in bond_handle_frame()
1160 recv_probe = ACCESS_ONCE(bond->recv_probe); in bond_handle_frame()
1162 ret = recv_probe(skb, bond, slave); in bond_handle_frame()
1169 if (bond_should_deliver_exact_match(skb, slave, bond)) { in bond_handle_frame()
1173 skb->dev = bond->dev; in bond_handle_frame()
1175 if (BOND_MODE(bond) == BOND_MODE_ALB && in bond_handle_frame()
1176 bond->dev->priv_flags & IFF_BRIDGE_PORT && in bond_handle_frame()
1184 ether_addr_copy(eth_hdr(skb)->h_dest, bond->dev->dev_addr); in bond_handle_frame()
1211 static struct slave *bond_alloc_slave(struct bonding *bond) in bond_alloc_slave() argument
1219 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_alloc_slave()
1232 struct bonding *bond = bond_get_bond_by_slave(slave); in bond_free_slave() local
1234 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_free_slave()
1240 static void bond_fill_ifbond(struct bonding *bond, struct ifbond *info) in bond_fill_ifbond() argument
1242 info->bond_mode = BOND_MODE(bond); in bond_fill_ifbond()
1243 info->miimon = bond->params.miimon; in bond_fill_ifbond()
1244 info->num_slaves = bond->slave_cnt; in bond_fill_ifbond()
1275 struct bonding *bond = slave->bond; in bond_queue_slave_event() local
1284 bond_fill_ifbond(bond, &nnw->bonding_info.master); in bond_queue_slave_event()
1287 queue_delayed_work(slave->bond->wq, &nnw->work, 0); in bond_queue_slave_event()
1293 struct bonding *bond = netdev_priv(bond_dev); in bond_enslave() local
1300 if (!bond->params.use_carrier && in bond_enslave()
1356 if (!bond_has_slaves(bond)) { in bond_enslave()
1393 if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP && in bond_enslave()
1394 bond->params.fail_over_mac != BOND_FOM_ACTIVE) { in bond_enslave()
1395 if (!bond_has_slaves(bond)) { in bond_enslave()
1396 bond->params.fail_over_mac = BOND_FOM_ACTIVE; in bond_enslave()
1411 if (!bond_has_slaves(bond) && in bond_enslave()
1412 bond->dev->addr_assign_type == NET_ADDR_RANDOM) in bond_enslave()
1413 bond_set_dev_addr(bond->dev, slave_dev); in bond_enslave()
1415 new_slave = bond_alloc_slave(bond); in bond_enslave()
1421 new_slave->bond = bond; in bond_enslave()
1430 res = dev_set_mtu(slave_dev, bond->dev->mtu); in bond_enslave()
1442 if (!bond->params.fail_over_mac || in bond_enslave()
1443 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { in bond_enslave()
1470 if (bond_is_lb(bond)) { in bond_enslave()
1474 res = bond_alb_init_slave(bond, new_slave); in bond_enslave()
1482 if (!bond_uses_primary(bond)) { in bond_enslave()
1505 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_enslave()
1519 prev_slave = bond_last_slave(bond); in bond_enslave()
1527 (msecs_to_jiffies(bond->params.arp_interval) + 1); in bond_enslave()
1531 if (bond->params.miimon && !bond->params.use_carrier) { in bond_enslave()
1532 link_reporting = bond_check_dev_link(bond, slave_dev, 1); in bond_enslave()
1534 if ((link_reporting == -1) && !bond->params.arp_interval) { in bond_enslave()
1553 if (bond->params.miimon) { in bond_enslave()
1554 if (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS) { in bond_enslave()
1555 if (bond->params.updelay) { in bond_enslave()
1558 new_slave->delay = bond->params.updelay; in bond_enslave()
1566 } else if (bond->params.arp_interval) { in bond_enslave()
1580 if (bond_uses_primary(bond) && bond->params.primary[0]) { in bond_enslave()
1582 if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { in bond_enslave()
1583 rcu_assign_pointer(bond->primary_slave, new_slave); in bond_enslave()
1584 bond->force_primary = true; in bond_enslave()
1588 switch (BOND_MODE(bond)) { in bond_enslave()
1605 bond_3ad_initialize(bond, 1000/AD_TIMER_INTERVAL); in bond_enslave()
1628 if (!rcu_access_pointer(bond->curr_active_slave) && in bond_enslave()
1630 rcu_assign_pointer(bond->curr_active_slave, new_slave); in bond_enslave()
1636 slave_dev->npinfo = bond->dev->npinfo; in bond_enslave()
1668 bond->slave_cnt++; in bond_enslave()
1669 bond_compute_features(bond); in bond_enslave()
1670 bond_set_carrier(bond); in bond_enslave()
1672 if (bond_uses_primary(bond)) { in bond_enslave()
1674 bond_select_active_slave(bond); in bond_enslave()
1678 if (bond_mode_uses_xmit_hash(bond)) in bond_enslave()
1679 bond_update_slave_arr(bond, NULL); in bond_enslave()
1698 if (!bond_uses_primary(bond)) in bond_enslave()
1702 if (rcu_access_pointer(bond->primary_slave) == new_slave) in bond_enslave()
1703 RCU_INIT_POINTER(bond->primary_slave, NULL); in bond_enslave()
1704 if (rcu_access_pointer(bond->curr_active_slave) == new_slave) { in bond_enslave()
1706 bond_change_active_slave(bond, NULL); in bond_enslave()
1707 bond_select_active_slave(bond); in bond_enslave()
1720 if (!bond->params.fail_over_mac || in bond_enslave()
1721 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { in bond_enslave()
1739 if (!bond_has_slaves(bond) && in bond_enslave()
1761 struct bonding *bond = netdev_priv(bond_dev); in __bond_release_one() local
1777 slave = bond_get_slave_by_dev(bond, slave_dev); in __bond_release_one()
1789 bond_get_stats(bond->dev, &bond->bond_stats); in __bond_release_one()
1797 if (BOND_MODE(bond) == BOND_MODE_8023AD) in __bond_release_one()
1800 if (bond_mode_uses_xmit_hash(bond)) in __bond_release_one()
1801 bond_update_slave_arr(bond, slave); in __bond_release_one()
1807 oldcurrent = rcu_access_pointer(bond->curr_active_slave); in __bond_release_one()
1809 RCU_INIT_POINTER(bond->current_arp_slave, NULL); in __bond_release_one()
1811 if (!all && (!bond->params.fail_over_mac || in __bond_release_one()
1812 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)) { in __bond_release_one()
1814 bond_has_slaves(bond)) in __bond_release_one()
1820 if (rtnl_dereference(bond->primary_slave) == slave) in __bond_release_one()
1821 RCU_INIT_POINTER(bond->primary_slave, NULL); in __bond_release_one()
1824 bond_change_active_slave(bond, NULL); in __bond_release_one()
1826 if (bond_is_lb(bond)) { in __bond_release_one()
1832 bond_alb_deinit_slave(bond, slave); in __bond_release_one()
1836 RCU_INIT_POINTER(bond->curr_active_slave, NULL); in __bond_release_one()
1842 bond_select_active_slave(bond); in __bond_release_one()
1845 if (!bond_has_slaves(bond)) { in __bond_release_one()
1846 bond_set_carrier(bond); in __bond_release_one()
1852 bond->slave_cnt--; in __bond_release_one()
1854 if (!bond_has_slaves(bond)) { in __bond_release_one()
1855 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); in __bond_release_one()
1856 call_netdevice_notifiers(NETDEV_RELEASE, bond->dev); in __bond_release_one()
1859 bond_compute_features(bond); in __bond_release_one()
1870 if (!bond_uses_primary(bond)) { in __bond_release_one()
1893 if (bond->params.fail_over_mac != BOND_FOM_ACTIVE || in __bond_release_one()
1894 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { in __bond_release_one()
1922 struct bonding *bond = netdev_priv(bond_dev); in bond_release_and_destroy() local
1926 if (ret == 0 && !bond_has_slaves(bond)) { in bond_release_and_destroy()
1930 bond_remove_proc_entry(bond); in bond_release_and_destroy()
1938 struct bonding *bond = netdev_priv(bond_dev); in bond_info_query() local
1939 bond_fill_ifbond(bond, info); in bond_info_query()
1945 struct bonding *bond = netdev_priv(bond_dev); in bond_slave_info_query() local
1950 bond_for_each_slave(bond, slave, iter) { in bond_slave_info_query()
1964 static int bond_miimon_inspect(struct bonding *bond) in bond_miimon_inspect() argument
1971 ignore_updelay = !rcu_dereference(bond->curr_active_slave); in bond_miimon_inspect()
1973 bond_for_each_slave_rcu(bond, slave, iter) { in bond_miimon_inspect()
1976 link_state = bond_check_dev_link(bond, slave->dev, 0); in bond_miimon_inspect()
1984 slave->delay = bond->params.downdelay; in bond_miimon_inspect()
1986 netdev_info(bond->dev, "link status down for %sinterface %s, disabling it in %d ms\n", in bond_miimon_inspect()
1987 (BOND_MODE(bond) == in bond_miimon_inspect()
1992 bond->params.downdelay * bond->params.miimon); in bond_miimon_inspect()
2000 netdev_info(bond->dev, "link status up again after %d ms for interface %s\n", in bond_miimon_inspect()
2001 (bond->params.downdelay - slave->delay) * in bond_miimon_inspect()
2002 bond->params.miimon, in bond_miimon_inspect()
2021 slave->delay = bond->params.updelay; in bond_miimon_inspect()
2024 netdev_info(bond->dev, "link status up for interface %s, enabling it in %d ms\n", in bond_miimon_inspect()
2027 bond->params.updelay * in bond_miimon_inspect()
2028 bond->params.miimon); in bond_miimon_inspect()
2035 netdev_info(bond->dev, "link status down again after %d ms for interface %s\n", in bond_miimon_inspect()
2036 (bond->params.updelay - slave->delay) * in bond_miimon_inspect()
2037 bond->params.miimon, in bond_miimon_inspect()
2061 static void bond_miimon_commit(struct bonding *bond) in bond_miimon_commit() argument
2066 bond_for_each_slave(bond, slave, iter) { in bond_miimon_commit()
2075 primary = rtnl_dereference(bond->primary_slave); in bond_miimon_commit()
2076 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_miimon_commit()
2079 } else if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { in bond_miimon_commit()
2087 netdev_info(bond->dev, "link status definitely up for interface %s, %u Mbps %s duplex\n", in bond_miimon_commit()
2093 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_miimon_commit()
2096 if (bond_is_lb(bond)) in bond_miimon_commit()
2097 bond_alb_handle_link_change(bond, slave, in bond_miimon_commit()
2100 if (BOND_MODE(bond) == BOND_MODE_XOR) in bond_miimon_commit()
2101 bond_update_slave_arr(bond, NULL); in bond_miimon_commit()
2103 if (!bond->curr_active_slave || slave == primary) in bond_miimon_commit()
2114 if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP || in bond_miimon_commit()
2115 BOND_MODE(bond) == BOND_MODE_8023AD) in bond_miimon_commit()
2119 netdev_info(bond->dev, "link status definitely down for interface %s, disabling it\n", in bond_miimon_commit()
2122 if (BOND_MODE(bond) == BOND_MODE_8023AD) in bond_miimon_commit()
2126 if (bond_is_lb(bond)) in bond_miimon_commit()
2127 bond_alb_handle_link_change(bond, slave, in bond_miimon_commit()
2130 if (BOND_MODE(bond) == BOND_MODE_XOR) in bond_miimon_commit()
2131 bond_update_slave_arr(bond, NULL); in bond_miimon_commit()
2133 if (slave == rcu_access_pointer(bond->curr_active_slave)) in bond_miimon_commit()
2139 netdev_err(bond->dev, "invalid new link %d on slave %s\n", in bond_miimon_commit()
2148 bond_select_active_slave(bond); in bond_miimon_commit()
2152 bond_set_carrier(bond); in bond_miimon_commit()
2164 struct bonding *bond = container_of(work, struct bonding, in bond_mii_monitor() local
2169 delay = msecs_to_jiffies(bond->params.miimon); in bond_mii_monitor()
2171 if (!bond_has_slaves(bond)) in bond_mii_monitor()
2176 should_notify_peers = bond_should_notify_peers(bond); in bond_mii_monitor()
2178 if (bond_miimon_inspect(bond)) { in bond_mii_monitor()
2188 bond_miimon_commit(bond); in bond_mii_monitor()
2195 if (bond->params.miimon) in bond_mii_monitor()
2196 queue_delayed_work(bond->wq, &bond->mii_work, delay); in bond_mii_monitor()
2201 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); in bond_mii_monitor()
2206 static bool bond_has_this_ip(struct bonding *bond, __be32 ip) in bond_has_this_ip() argument
2212 if (ip == bond_confirm_addr(bond->dev, 0, ip)) in bond_has_this_ip()
2216 netdev_for_each_all_upper_dev_rcu(bond->dev, upper, iter) { in bond_has_this_ip()
2324 static void bond_arp_send_all(struct bonding *bond, struct slave *slave) in bond_arp_send_all() argument
2328 __be32 *targets = bond->params.arp_targets, addr; in bond_arp_send_all()
2332 netdev_dbg(bond->dev, "basa: target %pI4\n", &targets[i]); in bond_arp_send_all()
2336 rt = ip_route_output(dev_net(bond->dev), targets[i], 0, in bond_arp_send_all()
2342 if (bond->params.arp_validate) in bond_arp_send_all()
2344 bond->dev->name, in bond_arp_send_all()
2352 if (rt->dst.dev == bond->dev) in bond_arp_send_all()
2356 tags = bond_verify_device_path(bond->dev, rt->dst.dev, 0); in bond_arp_send_all()
2363 netdev_dbg(bond->dev, "no path to arp_ip_target %pI4 via rt.dev %s\n", in bond_arp_send_all()
2378 static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 sip, __be32 tip) in bond_validate_arp() argument
2382 if (!sip || !bond_has_this_ip(bond, tip)) { in bond_validate_arp()
2383 netdev_dbg(bond->dev, "bva: sip %pI4 tip %pI4 not found\n", in bond_validate_arp()
2388 i = bond_get_targets_ip(bond->params.arp_targets, sip); in bond_validate_arp()
2390 netdev_dbg(bond->dev, "bva: sip %pI4 not found in targets\n", in bond_validate_arp()
2398 int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, in bond_arp_rcv() argument
2407 if (!slave_do_arp_validate(bond, slave)) { in bond_arp_rcv()
2408 if ((slave_do_arp_validate_only(bond) && is_arp) || in bond_arp_rcv()
2409 !slave_do_arp_validate_only(bond)) in bond_arp_rcv()
2416 alen = arp_hdr_len(bond->dev); in bond_arp_rcv()
2418 netdev_dbg(bond->dev, "bond_arp_rcv: skb->dev %s\n", in bond_arp_rcv()
2429 if (arp->ar_hln != bond->dev->addr_len || in bond_arp_rcv()
2438 arp_ptr += bond->dev->addr_len; in bond_arp_rcv()
2440 arp_ptr += 4 + bond->dev->addr_len; in bond_arp_rcv()
2443 netdev_dbg(bond->dev, "bond_arp_rcv: %s/%d av %d sv %d sip %pI4 tip %pI4\n", in bond_arp_rcv()
2445 bond->params.arp_validate, slave_do_arp_validate(bond, slave), in bond_arp_rcv()
2448 curr_active_slave = rcu_dereference(bond->curr_active_slave); in bond_arp_rcv()
2449 curr_arp_slave = rcu_dereference(bond->current_arp_slave); in bond_arp_rcv()
2475 bond_validate_arp(bond, slave, sip, tip); in bond_arp_rcv()
2477 time_after(slave_last_rx(bond, curr_active_slave), in bond_arp_rcv()
2479 bond_validate_arp(bond, slave, tip, sip); in bond_arp_rcv()
2481 bond_time_in_interval(bond, in bond_arp_rcv()
2483 bond_validate_arp(bond, slave, sip, tip); in bond_arp_rcv()
2495 static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act, in bond_time_in_interval() argument
2498 int delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); in bond_time_in_interval()
2513 struct bonding *bond = container_of(work, struct bonding, in bond_loadbalance_arp_mon() local
2519 if (!bond_has_slaves(bond)) in bond_loadbalance_arp_mon()
2524 oldcurrent = rcu_dereference(bond->curr_active_slave); in bond_loadbalance_arp_mon()
2533 bond_for_each_slave_rcu(bond, slave, iter) { in bond_loadbalance_arp_mon()
2537 if (bond_time_in_interval(bond, trans_start, 1) && in bond_loadbalance_arp_mon()
2538 bond_time_in_interval(bond, slave->last_rx, 1)) { in bond_loadbalance_arp_mon()
2549 netdev_info(bond->dev, "link status definitely up for interface %s\n", in bond_loadbalance_arp_mon()
2553 netdev_info(bond->dev, "interface %s is now up\n", in bond_loadbalance_arp_mon()
2564 if (!bond_time_in_interval(bond, trans_start, 2) || in bond_loadbalance_arp_mon()
2565 !bond_time_in_interval(bond, slave->last_rx, 2)) { in bond_loadbalance_arp_mon()
2573 netdev_info(bond->dev, "interface %s is now down\n", in bond_loadbalance_arp_mon()
2589 bond_arp_send_all(bond, slave); in bond_loadbalance_arp_mon()
2599 bond_slave_state_change(bond); in bond_loadbalance_arp_mon()
2600 if (BOND_MODE(bond) == BOND_MODE_XOR) in bond_loadbalance_arp_mon()
2601 bond_update_slave_arr(bond, NULL); in bond_loadbalance_arp_mon()
2605 bond_select_active_slave(bond); in bond_loadbalance_arp_mon()
2612 if (bond->params.arp_interval) in bond_loadbalance_arp_mon()
2613 queue_delayed_work(bond->wq, &bond->arp_work, in bond_loadbalance_arp_mon()
2614 msecs_to_jiffies(bond->params.arp_interval)); in bond_loadbalance_arp_mon()
2624 static int bond_ab_arp_inspect(struct bonding *bond) in bond_ab_arp_inspect() argument
2631 bond_for_each_slave_rcu(bond, slave, iter) { in bond_ab_arp_inspect()
2633 last_rx = slave_last_rx(bond, slave); in bond_ab_arp_inspect()
2636 if (bond_time_in_interval(bond, last_rx, 1)) { in bond_ab_arp_inspect()
2647 if (bond_time_in_interval(bond, slave->last_link_up, 2)) in bond_ab_arp_inspect()
2663 !rcu_access_pointer(bond->current_arp_slave) && in bond_ab_arp_inspect()
2664 !bond_time_in_interval(bond, last_rx, 3)) { in bond_ab_arp_inspect()
2676 (!bond_time_in_interval(bond, trans_start, 2) || in bond_ab_arp_inspect()
2677 !bond_time_in_interval(bond, last_rx, 2))) { in bond_ab_arp_inspect()
2691 static void bond_ab_arp_commit(struct bonding *bond) in bond_ab_arp_commit() argument
2697 bond_for_each_slave(bond, slave, iter) { in bond_ab_arp_commit()
2704 if (rtnl_dereference(bond->curr_active_slave) != slave || in bond_ab_arp_commit()
2705 (!rtnl_dereference(bond->curr_active_slave) && in bond_ab_arp_commit()
2706 bond_time_in_interval(bond, trans_start, 1))) { in bond_ab_arp_commit()
2709 current_arp_slave = rtnl_dereference(bond->current_arp_slave); in bond_ab_arp_commit()
2715 RCU_INIT_POINTER(bond->current_arp_slave, NULL); in bond_ab_arp_commit()
2718 netdev_info(bond->dev, "link status definitely up for interface %s\n", in bond_ab_arp_commit()
2721 if (!rtnl_dereference(bond->curr_active_slave) || in bond_ab_arp_commit()
2722 slave == rtnl_dereference(bond->primary_slave)) in bond_ab_arp_commit()
2737 netdev_info(bond->dev, "link status definitely down for interface %s, disabling it\n", in bond_ab_arp_commit()
2740 if (slave == rtnl_dereference(bond->curr_active_slave)) { in bond_ab_arp_commit()
2741 RCU_INIT_POINTER(bond->current_arp_slave, NULL); in bond_ab_arp_commit()
2748 netdev_err(bond->dev, "impossible: new_link %d on slave %s\n", in bond_ab_arp_commit()
2755 bond_select_active_slave(bond); in bond_ab_arp_commit()
2759 bond_set_carrier(bond); in bond_ab_arp_commit()
2766 static bool bond_ab_arp_probe(struct bonding *bond) in bond_ab_arp_probe() argument
2769 *curr_arp_slave = rcu_dereference(bond->current_arp_slave), in bond_ab_arp_probe()
2770 *curr_active_slave = rcu_dereference(bond->curr_active_slave); in bond_ab_arp_probe()
2776 netdev_info(bond->dev, "PROBE: c_arp %s && cas %s BAD\n", in bond_ab_arp_probe()
2781 bond_arp_send_all(bond, curr_active_slave); in bond_ab_arp_probe()
2791 curr_arp_slave = bond_first_slave_rcu(bond); in bond_ab_arp_probe()
2798 bond_for_each_slave_rcu(bond, slave, iter) { in bond_ab_arp_probe()
2819 netdev_info(bond->dev, "backup interface %s is now down\n", in bond_ab_arp_probe()
2834 bond_arp_send_all(bond, new_slave); in bond_ab_arp_probe()
2836 rcu_assign_pointer(bond->current_arp_slave, new_slave); in bond_ab_arp_probe()
2839 bond_for_each_slave_rcu(bond, slave, iter) { in bond_ab_arp_probe()
2850 struct bonding *bond = container_of(work, struct bonding, in bond_activebackup_arp_mon() local
2856 delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); in bond_activebackup_arp_mon()
2858 if (!bond_has_slaves(bond)) in bond_activebackup_arp_mon()
2863 should_notify_peers = bond_should_notify_peers(bond); in bond_activebackup_arp_mon()
2865 if (bond_ab_arp_inspect(bond)) { in bond_activebackup_arp_mon()
2875 bond_ab_arp_commit(bond); in bond_activebackup_arp_mon()
2881 should_notify_rtnl = bond_ab_arp_probe(bond); in bond_activebackup_arp_mon()
2885 if (bond->params.arp_interval) in bond_activebackup_arp_mon()
2886 queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks); in bond_activebackup_arp_mon()
2894 bond->dev); in bond_activebackup_arp_mon()
2896 bond_slave_state_notify(bond); in bond_activebackup_arp_mon()
2905 static int bond_event_changename(struct bonding *bond) in bond_event_changename() argument
2907 bond_remove_proc_entry(bond); in bond_event_changename()
2908 bond_create_proc_entry(bond); in bond_event_changename()
2910 bond_debug_reregister(bond); in bond_event_changename()
2944 struct bonding *bond; in bond_slave_netdev_event() local
2955 bond_dev = slave->bond->dev; in bond_slave_netdev_event()
2956 bond = slave->bond; in bond_slave_netdev_event()
2957 primary = rtnl_dereference(bond->primary_slave); in bond_slave_netdev_event()
2973 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_slave_netdev_event()
2989 if (bond_mode_uses_xmit_hash(bond)) in bond_slave_netdev_event()
2990 bond_update_slave_arr(bond, NULL); in bond_slave_netdev_event()
3007 if (!bond_uses_primary(bond) || in bond_slave_netdev_event()
3008 !bond->params.primary[0]) in bond_slave_netdev_event()
3013 RCU_INIT_POINTER(bond->primary_slave, NULL); in bond_slave_netdev_event()
3014 } else if (!strcmp(slave_dev->name, bond->params.primary)) { in bond_slave_netdev_event()
3016 rcu_assign_pointer(bond->primary_slave, slave); in bond_slave_netdev_event()
3021 netdev_info(bond->dev, "Primary slave changed to %s, reselecting active slave\n", in bond_slave_netdev_event()
3025 bond_select_active_slave(bond); in bond_slave_netdev_event()
3029 bond_compute_features(bond); in bond_slave_netdev_event()
3033 call_netdevice_notifiers(event, slave->bond->dev); in bond_slave_netdev_event()
3090 static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb, in bond_flow_dissect() argument
3097 if (bond->params.xmit_policy > BOND_XMIT_POLICY_LAYER23) in bond_flow_dissect()
3122 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34 && proto >= 0) in bond_flow_dissect()
3136 u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb) in bond_xmit_hash() argument
3141 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER2 || in bond_xmit_hash()
3142 !bond_flow_dissect(bond, skb, &flow)) in bond_xmit_hash()
3145 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER23 || in bond_xmit_hash()
3146 bond->params.xmit_policy == BOND_XMIT_POLICY_ENCAP23) in bond_xmit_hash()
3159 static void bond_work_init_all(struct bonding *bond) in bond_work_init_all() argument
3161 INIT_DELAYED_WORK(&bond->mcast_work, in bond_work_init_all()
3163 INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor); in bond_work_init_all()
3164 INIT_DELAYED_WORK(&bond->mii_work, bond_mii_monitor); in bond_work_init_all()
3165 if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) in bond_work_init_all()
3166 INIT_DELAYED_WORK(&bond->arp_work, bond_activebackup_arp_mon); in bond_work_init_all()
3168 INIT_DELAYED_WORK(&bond->arp_work, bond_loadbalance_arp_mon); in bond_work_init_all()
3169 INIT_DELAYED_WORK(&bond->ad_work, bond_3ad_state_machine_handler); in bond_work_init_all()
3170 INIT_DELAYED_WORK(&bond->slave_arr_work, bond_slave_arr_handler); in bond_work_init_all()
3173 static void bond_work_cancel_all(struct bonding *bond) in bond_work_cancel_all() argument
3175 cancel_delayed_work_sync(&bond->mii_work); in bond_work_cancel_all()
3176 cancel_delayed_work_sync(&bond->arp_work); in bond_work_cancel_all()
3177 cancel_delayed_work_sync(&bond->alb_work); in bond_work_cancel_all()
3178 cancel_delayed_work_sync(&bond->ad_work); in bond_work_cancel_all()
3179 cancel_delayed_work_sync(&bond->mcast_work); in bond_work_cancel_all()
3180 cancel_delayed_work_sync(&bond->slave_arr_work); in bond_work_cancel_all()
3185 struct bonding *bond = netdev_priv(bond_dev); in bond_open() local
3190 if (bond_has_slaves(bond)) { in bond_open()
3191 bond_for_each_slave(bond, slave, iter) { in bond_open()
3192 if (bond_uses_primary(bond) && in bond_open()
3193 slave != rcu_access_pointer(bond->curr_active_slave)) { in bond_open()
3196 } else if (BOND_MODE(bond) != BOND_MODE_8023AD) { in bond_open()
3203 bond_work_init_all(bond); in bond_open()
3205 if (bond_is_lb(bond)) { in bond_open()
3209 if (bond_alb_initialize(bond, (BOND_MODE(bond) == BOND_MODE_ALB))) in bond_open()
3211 if (bond->params.tlb_dynamic_lb) in bond_open()
3212 queue_delayed_work(bond->wq, &bond->alb_work, 0); in bond_open()
3215 if (bond->params.miimon) /* link check interval, in milliseconds. */ in bond_open()
3216 queue_delayed_work(bond->wq, &bond->mii_work, 0); in bond_open()
3218 if (bond->params.arp_interval) { /* arp interval, in milliseconds. */ in bond_open()
3219 queue_delayed_work(bond->wq, &bond->arp_work, 0); in bond_open()
3220 bond->recv_probe = bond_arp_rcv; in bond_open()
3223 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_open()
3224 queue_delayed_work(bond->wq, &bond->ad_work, 0); in bond_open()
3226 bond->recv_probe = bond_3ad_lacpdu_recv; in bond_open()
3227 bond_3ad_initiate_agg_selection(bond, 1); in bond_open()
3230 if (bond_mode_uses_xmit_hash(bond)) in bond_open()
3231 bond_update_slave_arr(bond, NULL); in bond_open()
3238 struct bonding *bond = netdev_priv(bond_dev); in bond_close() local
3240 bond_work_cancel_all(bond); in bond_close()
3241 bond->send_peer_notif = 0; in bond_close()
3242 if (bond_is_lb(bond)) in bond_close()
3243 bond_alb_deinitialize(bond); in bond_close()
3244 bond->recv_probe = NULL; in bond_close()
3252 struct bonding *bond = netdev_priv(bond_dev); in bond_get_stats() local
3257 memcpy(stats, &bond->bond_stats, sizeof(*stats)); in bond_get_stats()
3259 bond_for_each_slave(bond, slave, iter) { in bond_get_stats()
3293 memcpy(&bond->bond_stats, stats, sizeof(*stats)); in bond_get_stats()
3300 struct bonding *bond = netdev_priv(bond_dev); in bond_do_ioctl() local
3331 if (netif_carrier_ok(bond->dev)) in bond_do_ioctl()
3396 res = __bond_opt_set(bond, BOND_OPT_ACTIVE_SLAVE, &newval); in bond_do_ioctl()
3407 struct bonding *bond = netdev_priv(bond_dev); in bond_change_rx_flags() local
3410 bond_set_promiscuity(bond, in bond_change_rx_flags()
3414 bond_set_allmulti(bond, in bond_change_rx_flags()
3420 struct bonding *bond = netdev_priv(bond_dev); in bond_set_rx_mode() local
3425 if (bond_uses_primary(bond)) { in bond_set_rx_mode()
3426 slave = rcu_dereference(bond->curr_active_slave); in bond_set_rx_mode()
3432 bond_for_each_slave_rcu(bond, slave, iter) { in bond_set_rx_mode()
3442 struct bonding *bond = netdev_priv(n->dev); in bond_neigh_init() local
3448 slave = bond_first_slave(bond); in bond_neigh_init()
3495 struct bonding *bond = netdev_priv(bond_dev); in bond_change_mtu() local
3500 netdev_dbg(bond_dev, "bond=%p, new_mtu=%d\n", bond, new_mtu); in bond_change_mtu()
3502 bond_for_each_slave(bond, slave, iter) { in bond_change_mtu()
3529 bond_for_each_slave(bond, rollback_slave, iter) { in bond_change_mtu()
3553 struct bonding *bond = netdev_priv(bond_dev); in bond_set_mac_address() local
3559 if (BOND_MODE(bond) == BOND_MODE_ALB) in bond_set_mac_address()
3563 netdev_dbg(bond_dev, "bond=%p\n", bond); in bond_set_mac_address()
3568 if (bond->params.fail_over_mac && in bond_set_mac_address()
3569 BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) in bond_set_mac_address()
3575 bond_for_each_slave(bond, slave, iter) { in bond_set_mac_address()
3599 bond_for_each_slave(bond, rollback_slave, iter) { in bond_set_mac_address()
3625 static void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int slave_id) in bond_xmit_slave_id() argument
3632 bond_for_each_slave_rcu(bond, slave, iter) { in bond_xmit_slave_id()
3635 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_slave_id()
3643 bond_for_each_slave_rcu(bond, slave, iter) { in bond_xmit_slave_id()
3647 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_slave_id()
3652 bond_tx_drop(bond->dev, skb); in bond_xmit_slave_id()
3663 static u32 bond_rr_gen_slave_id(struct bonding *bond) in bond_rr_gen_slave_id() argument
3667 int packets_per_slave = bond->params.packets_per_slave; in bond_rr_gen_slave_id()
3674 slave_id = bond->rr_tx_counter; in bond_rr_gen_slave_id()
3678 bond->params.reciprocal_packets_per_slave; in bond_rr_gen_slave_id()
3679 slave_id = reciprocal_divide(bond->rr_tx_counter, in bond_rr_gen_slave_id()
3683 bond->rr_tx_counter++; in bond_rr_gen_slave_id()
3690 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_roundrobin() local
3702 slave = rcu_dereference(bond->curr_active_slave); in bond_xmit_roundrobin()
3704 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_roundrobin()
3706 bond_xmit_slave_id(bond, skb, 0); in bond_xmit_roundrobin()
3708 int slave_cnt = ACCESS_ONCE(bond->slave_cnt); in bond_xmit_roundrobin()
3711 slave_id = bond_rr_gen_slave_id(bond); in bond_xmit_roundrobin()
3712 bond_xmit_slave_id(bond, skb, slave_id % slave_cnt); in bond_xmit_roundrobin()
3726 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_activebackup() local
3729 slave = rcu_dereference(bond->curr_active_slave); in bond_xmit_activebackup()
3731 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_activebackup()
3742 void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay) in bond_slave_arr_work_rearm() argument
3744 queue_delayed_work(bond->wq, &bond->slave_arr_work, delay); in bond_slave_arr_work_rearm()
3750 struct bonding *bond = container_of(work, struct bonding, in bond_slave_arr_handler() local
3757 ret = bond_update_slave_arr(bond, NULL); in bond_slave_arr_handler()
3766 bond_slave_arr_work_rearm(bond, 1); in bond_slave_arr_handler()
3777 int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave) in bond_update_slave_arr() argument
3787 WARN_ON(lockdep_is_held(&bond->mode_lock)); in bond_update_slave_arr()
3790 new_arr = kzalloc(offsetof(struct bond_up_slave, arr[bond->slave_cnt]), in bond_update_slave_arr()
3797 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_update_slave_arr()
3800 if (bond_3ad_get_active_agg_info(bond, &ad_info)) { in bond_update_slave_arr()
3806 old_arr = rtnl_dereference(bond->slave_arr); in bond_update_slave_arr()
3808 RCU_INIT_POINTER(bond->slave_arr, NULL); in bond_update_slave_arr()
3816 bond_for_each_slave(bond, slave, iter) { in bond_update_slave_arr()
3817 if (BOND_MODE(bond) == BOND_MODE_8023AD) { in bond_update_slave_arr()
3831 old_arr = rtnl_dereference(bond->slave_arr); in bond_update_slave_arr()
3832 rcu_assign_pointer(bond->slave_arr, new_arr); in bond_update_slave_arr()
3847 old_arr = rtnl_dereference(bond->slave_arr); in bond_update_slave_arr()
3866 struct bonding *bond = netdev_priv(dev); in bond_3ad_xor_xmit() local
3871 slaves = rcu_dereference(bond->slave_arr); in bond_3ad_xor_xmit()
3874 slave = slaves->arr[bond_xmit_hash(bond, skb) % count]; in bond_3ad_xor_xmit()
3875 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_3ad_xor_xmit()
3886 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_broadcast() local
3890 bond_for_each_slave_rcu(bond, slave, iter) { in bond_xmit_broadcast()
3891 if (bond_is_last_slave(bond, slave)) in bond_xmit_broadcast()
3901 bond_dev_queue_xmit(bond, skb2, slave->dev); in bond_xmit_broadcast()
3905 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_broadcast()
3915 static inline int bond_slave_override(struct bonding *bond, in bond_slave_override() argument
3925 bond_for_each_slave_rcu(bond, slave, iter) { in bond_slave_override()
3929 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_slave_override()
3964 struct bonding *bond = netdev_priv(dev); in __bond_start_xmit() local
3966 if (bond_should_override_tx_queue(bond) && in __bond_start_xmit()
3967 !bond_slave_override(bond, skb)) in __bond_start_xmit()
3970 switch (BOND_MODE(bond)) { in __bond_start_xmit()
3986 netdev_err(dev, "Unknown bonding mode %d\n", BOND_MODE(bond)); in __bond_start_xmit()
3995 struct bonding *bond = netdev_priv(dev); in bond_start_xmit() local
4005 if (bond_has_slaves(bond)) in bond_start_xmit()
4017 struct bonding *bond = netdev_priv(bond_dev); in bond_ethtool_get_settings() local
4030 bond_for_each_slave(bond, slave, iter) { in bond_ethtool_get_settings()
4094 struct bonding *bond = netdev_priv(bond_dev); in bond_destructor() local
4095 if (bond->wq) in bond_destructor()
4096 destroy_workqueue(bond->wq); in bond_destructor()
4102 struct bonding *bond = netdev_priv(bond_dev); in bond_setup() local
4104 spin_lock_init(&bond->mode_lock); in bond_setup()
4105 bond->params = bonding_defaults; in bond_setup()
4108 bond->dev = bond_dev; in bond_setup()
4153 struct bonding *bond = netdev_priv(bond_dev); in bond_uninit() local
4161 bond_for_each_slave(bond, slave, iter) in bond_uninit()
4165 arr = rtnl_dereference(bond->slave_arr); in bond_uninit()
4167 RCU_INIT_POINTER(bond->slave_arr, NULL); in bond_uninit()
4171 list_del(&bond->bond_list); in bond_uninit()
4173 bond_debug_unregister(bond); in bond_uninit()
4550 struct bonding *bond = netdev_priv(bond_dev); in bond_init() local
4555 bond->wq = create_singlethread_workqueue(bond_dev->name); in bond_init()
4556 if (!bond->wq) in bond_init()
4561 list_add_tail(&bond->bond_list, &bn->dev_list); in bond_init()
4563 bond_prepare_sysfs_group(bond); in bond_init()
4565 bond_debug_register(bond); in bond_init()
4588 struct bonding *bond; in bond_create() local
4607 bond = netdev_priv(bond_dev); in bond_create()
4608 bond_info = &(BOND_ALB_INFO(bond)); in bond_create()
4640 struct bonding *bond, *tmp_bond; in bond_net_exit() local
4647 list_for_each_entry_safe(bond, tmp_bond, &bn->dev_list, bond_list) in bond_net_exit()
4648 unregister_netdevice_queue(bond->dev, &list); in bond_net_exit()