Lines Matching +full:acquisition +full:- +full:time +full:- +full:ns

1 // SPDX-License-Identifier: GPL-1.0+
20 * will be assigned at this time. The hw mac address will come from
97 /*---------------------------- Module parameters ----------------------------*/
147 MODULE_PARM_DESC(mode, "Mode of operation; 0 for balance-rr, "
148 "1 for active-backup, 2 for balance-xor, "
149 "3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, "
150 "6 for balance-alb");
172 MODULE_PARM_DESC(xmit_hash_policy, "balance-alb, balance-tlb, balance-xor, 802.3ad hashing method; "
187 MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to "
198 MODULE_PARM_DESC(packets_per_slave, "Packets to send per slave in balance-rr "
206 /*----------------------------- Global variables ----------------------------*/
259 /*-------------------------- Forward declarations ---------------------------*/
270 /*---------------------------- General routines -----------------------------*/
275 [BOND_MODE_ROUNDROBIN] = "load balancing (round-robin)", in bond_mode_name()
276 [BOND_MODE_ACTIVEBACKUP] = "fault-tolerance (active-backup)", in bond_mode_name()
278 [BOND_MODE_BROADCAST] = "fault-tolerance (broadcast)", in bond_mode_name()
291 * bond_dev_queue_xmit - Prepare skb for xmit.
300 skb->dev = slave_dev; in bond_dev_queue_xmit()
302 BUILD_BUG_ON(sizeof(skb->queue_mapping) != in bond_dev_queue_xmit()
303 sizeof(qdisc_skb_cb(skb)->slave_dev_queue_mapping)); in bond_dev_queue_xmit()
304 skb_set_queue_mapping(skb, qdisc_skb_cb(skb)->slave_dev_queue_mapping); in bond_dev_queue_xmit()
306 if (unlikely(netpoll_tx_running(bond->dev))) in bond_dev_queue_xmit()
317 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34) in bond_sk_check()
336 if (bond->params.xmit_policy != BOND_XMIT_POLICY_VLAN_SRCMAC) in bond_xdp_check()
344 /*---------------------------------- VLAN -----------------------------------*/
363 * bond_vlan_rx_add_vid - Propagates adding an id to slaves
377 res = vlan_vid_add(slave->dev, proto, vid); in bond_vlan_rx_add_vid()
390 vlan_vid_del(rollback_slave->dev, proto, vid); in bond_vlan_rx_add_vid()
397 * bond_vlan_rx_kill_vid - Propagates deleting an id to slaves
410 vlan_vid_del(slave->dev, proto, vid); in bond_vlan_rx_kill_vid()
418 /*---------------------------------- XFRM -----------------------------------*/
422 * bond_ipsec_add_sa - program device with a security association
429 struct net_device *bond_dev = xs->xso.dev; in bond_ipsec_add_sa()
436 return -EINVAL; in bond_ipsec_add_sa()
440 slave = rcu_dereference(bond->curr_active_slave); in bond_ipsec_add_sa()
443 return -ENODEV; in bond_ipsec_add_sa()
446 if (!slave->dev->xfrmdev_ops || in bond_ipsec_add_sa()
447 !slave->dev->xfrmdev_ops->xdo_dev_state_add || in bond_ipsec_add_sa()
448 netif_is_bond_master(slave->dev)) { in bond_ipsec_add_sa()
451 return -EINVAL; in bond_ipsec_add_sa()
457 return -ENOMEM; in bond_ipsec_add_sa()
459 xs->xso.real_dev = slave->dev; in bond_ipsec_add_sa()
461 err = slave->dev->xfrmdev_ops->xdo_dev_state_add(xs, extack); in bond_ipsec_add_sa()
463 ipsec->xs = xs; in bond_ipsec_add_sa()
464 INIT_LIST_HEAD(&ipsec->list); in bond_ipsec_add_sa()
465 spin_lock_bh(&bond->ipsec_lock); in bond_ipsec_add_sa()
466 list_add(&ipsec->list, &bond->ipsec_list); in bond_ipsec_add_sa()
467 spin_unlock_bh(&bond->ipsec_lock); in bond_ipsec_add_sa()
477 struct net_device *bond_dev = bond->dev; in bond_ipsec_add_sa_all()
482 slave = rcu_dereference(bond->curr_active_slave); in bond_ipsec_add_sa_all()
486 if (!slave->dev->xfrmdev_ops || in bond_ipsec_add_sa_all()
487 !slave->dev->xfrmdev_ops->xdo_dev_state_add || in bond_ipsec_add_sa_all()
488 netif_is_bond_master(slave->dev)) { in bond_ipsec_add_sa_all()
489 spin_lock_bh(&bond->ipsec_lock); in bond_ipsec_add_sa_all()
490 if (!list_empty(&bond->ipsec_list)) in bond_ipsec_add_sa_all()
491 slave_warn(bond_dev, slave->dev, in bond_ipsec_add_sa_all()
494 spin_unlock_bh(&bond->ipsec_lock); in bond_ipsec_add_sa_all()
498 spin_lock_bh(&bond->ipsec_lock); in bond_ipsec_add_sa_all()
499 list_for_each_entry(ipsec, &bond->ipsec_list, list) { in bond_ipsec_add_sa_all()
500 ipsec->xs->xso.real_dev = slave->dev; in bond_ipsec_add_sa_all()
501 if (slave->dev->xfrmdev_ops->xdo_dev_state_add(ipsec->xs, NULL)) { in bond_ipsec_add_sa_all()
502 slave_warn(bond_dev, slave->dev, "%s: failed to add SA\n", __func__); in bond_ipsec_add_sa_all()
503 ipsec->xs->xso.real_dev = NULL; in bond_ipsec_add_sa_all()
506 spin_unlock_bh(&bond->ipsec_lock); in bond_ipsec_add_sa_all()
512 * bond_ipsec_del_sa - clear out this specific SA
517 struct net_device *bond_dev = xs->xso.dev; in bond_ipsec_del_sa()
527 slave = rcu_dereference(bond->curr_active_slave); in bond_ipsec_del_sa()
532 if (!xs->xso.real_dev) in bond_ipsec_del_sa()
535 WARN_ON(xs->xso.real_dev != slave->dev); in bond_ipsec_del_sa()
537 if (!slave->dev->xfrmdev_ops || in bond_ipsec_del_sa()
538 !slave->dev->xfrmdev_ops->xdo_dev_state_delete || in bond_ipsec_del_sa()
539 netif_is_bond_master(slave->dev)) { in bond_ipsec_del_sa()
540 slave_warn(bond_dev, slave->dev, "%s: no slave xdo_dev_state_delete\n", __func__); in bond_ipsec_del_sa()
544 slave->dev->xfrmdev_ops->xdo_dev_state_delete(xs); in bond_ipsec_del_sa()
546 spin_lock_bh(&bond->ipsec_lock); in bond_ipsec_del_sa()
547 list_for_each_entry(ipsec, &bond->ipsec_list, list) { in bond_ipsec_del_sa()
548 if (ipsec->xs == xs) { in bond_ipsec_del_sa()
549 list_del(&ipsec->list); in bond_ipsec_del_sa()
554 spin_unlock_bh(&bond->ipsec_lock); in bond_ipsec_del_sa()
560 struct net_device *bond_dev = bond->dev; in bond_ipsec_del_sa_all()
565 slave = rcu_dereference(bond->curr_active_slave); in bond_ipsec_del_sa_all()
571 spin_lock_bh(&bond->ipsec_lock); in bond_ipsec_del_sa_all()
572 list_for_each_entry(ipsec, &bond->ipsec_list, list) { in bond_ipsec_del_sa_all()
573 if (!ipsec->xs->xso.real_dev) in bond_ipsec_del_sa_all()
576 if (!slave->dev->xfrmdev_ops || in bond_ipsec_del_sa_all()
577 !slave->dev->xfrmdev_ops->xdo_dev_state_delete || in bond_ipsec_del_sa_all()
578 netif_is_bond_master(slave->dev)) { in bond_ipsec_del_sa_all()
579 slave_warn(bond_dev, slave->dev, in bond_ipsec_del_sa_all()
583 slave->dev->xfrmdev_ops->xdo_dev_state_delete(ipsec->xs); in bond_ipsec_del_sa_all()
585 ipsec->xs->xso.real_dev = NULL; in bond_ipsec_del_sa_all()
587 spin_unlock_bh(&bond->ipsec_lock); in bond_ipsec_del_sa_all()
592 * bond_ipsec_offload_ok - can this packet use the xfrm hw offload
598 struct net_device *bond_dev = xs->xso.dev; in bond_ipsec_offload_ok()
606 curr_active = rcu_dereference(bond->curr_active_slave); in bond_ipsec_offload_ok()
607 real_dev = curr_active->dev; in bond_ipsec_offload_ok()
614 if (!xs->xso.real_dev) { in bond_ipsec_offload_ok()
619 if (!real_dev->xfrmdev_ops || in bond_ipsec_offload_ok()
620 !real_dev->xfrmdev_ops->xdo_dev_offload_ok || in bond_ipsec_offload_ok()
626 err = real_dev->xfrmdev_ops->xdo_dev_offload_ok(skb, xs); in bond_ipsec_offload_ok()
639 /*------------------------------- Link status -------------------------------*/
659 if (slave->link == BOND_LINK_UP) { in bond_set_carrier()
660 if (!netif_carrier_ok(bond->dev)) { in bond_set_carrier()
661 netif_carrier_on(bond->dev); in bond_set_carrier()
669 if (netif_carrier_ok(bond->dev)) { in bond_set_carrier()
670 netif_carrier_off(bond->dev); in bond_set_carrier()
678 * values are invalid, set speed and duplex to -1,
684 struct net_device *slave_dev = slave->dev; in bond_update_speed_duplex()
688 slave->speed = SPEED_UNKNOWN; in bond_update_speed_duplex()
689 slave->duplex = DUPLEX_UNKNOWN; in bond_update_speed_duplex()
694 if (ecmd.base.speed == 0 || ecmd.base.speed == ((__u32)-1)) in bond_update_speed_duplex()
704 slave->speed = ecmd.base.speed; in bond_update_speed_duplex()
705 slave->duplex = ecmd.base.duplex; in bond_update_speed_duplex()
735 * If reporting is non-zero, instead of faking link up, return -1 if
744 const struct net_device_ops *slave_ops = slave_dev->netdev_ops; in bond_check_dev_link()
752 if (bond->params.use_carrier) in bond_check_dev_link()
756 if (slave_dev->ethtool_ops->get_link) in bond_check_dev_link()
757 return slave_dev->ethtool_ops->get_link(slave_dev) ? in bond_check_dev_link()
761 ioctl = slave_ops->ndo_eth_ioctl; in bond_check_dev_link()
776 strscpy_pad(ifr.ifr_name, slave_dev->name, IFNAMSIZ); in bond_check_dev_link()
779 mii->reg_num = MII_BMSR; in bond_check_dev_link()
781 return mii->val_out & BMSR_LSTATUS; in bond_check_dev_link()
790 return reporting ? -1 : BMSR_LSTATUS; in bond_check_dev_link()
793 /*----------------------------- Multicast list ------------------------------*/
802 struct slave *curr_active = rtnl_dereference(bond->curr_active_slave); in bond_set_promiscuity()
805 err = dev_set_promiscuity(curr_active->dev, inc); in bond_set_promiscuity()
810 err = dev_set_promiscuity(slave->dev, inc); in bond_set_promiscuity()
825 struct slave *curr_active = rtnl_dereference(bond->curr_active_slave); in bond_set_allmulti()
828 err = dev_set_allmulti(curr_active->dev, inc); in bond_set_allmulti()
833 err = dev_set_allmulti(slave->dev, inc); in bond_set_allmulti()
851 queue_delayed_work(bond->wq, &bond->mcast_work, 1); in bond_resend_igmp_join_requests_delayed()
854 call_netdevice_notifiers(NETDEV_RESEND_IGMP, bond->dev); in bond_resend_igmp_join_requests_delayed()
856 if (bond->igmp_retrans > 1) { in bond_resend_igmp_join_requests_delayed()
857 bond->igmp_retrans--; in bond_resend_igmp_join_requests_delayed()
858 queue_delayed_work(bond->wq, &bond->mcast_work, HZ/5); in bond_resend_igmp_join_requests_delayed()
876 /*--------------------------- Active slave change ---------------------------*/
887 if (bond->dev->flags & IFF_PROMISC) in bond_hw_addr_swap()
888 dev_set_promiscuity(old_active->dev, -1); in bond_hw_addr_swap()
890 if (bond->dev->flags & IFF_ALLMULTI) in bond_hw_addr_swap()
891 dev_set_allmulti(old_active->dev, -1); in bond_hw_addr_swap()
893 if (bond->dev->flags & IFF_UP) in bond_hw_addr_swap()
894 bond_hw_addr_flush(bond->dev, old_active->dev); in bond_hw_addr_swap()
899 if (bond->dev->flags & IFF_PROMISC) in bond_hw_addr_swap()
900 dev_set_promiscuity(new_active->dev, 1); in bond_hw_addr_swap()
902 if (bond->dev->flags & IFF_ALLMULTI) in bond_hw_addr_swap()
903 dev_set_allmulti(new_active->dev, 1); in bond_hw_addr_swap()
905 if (bond->dev->flags & IFF_UP) { in bond_hw_addr_swap()
906 netif_addr_lock_bh(bond->dev); in bond_hw_addr_swap()
907 dev_uc_sync(new_active->dev, bond->dev); in bond_hw_addr_swap()
908 dev_mc_sync(new_active->dev, bond->dev); in bond_hw_addr_swap()
909 netif_addr_unlock_bh(bond->dev); in bond_hw_addr_swap()
915 * bond_set_dev_addr - clone slave's address to bond
926 slave_dbg(bond_dev, slave_dev, "bond_dev=%p slave_dev=%p slave_dev->addr_len=%d\n", in bond_set_dev_addr()
927 bond_dev, slave_dev, slave_dev->addr_len); in bond_set_dev_addr()
928 err = dev_pre_changeaddr_notify(bond_dev, slave_dev->dev_addr, NULL); in bond_set_dev_addr()
932 __dev_addr_set(bond_dev, slave_dev->dev_addr, slave_dev->addr_len); in bond_set_dev_addr()
933 bond_dev->addr_assign_type = NET_ADDR_STOLEN; in bond_set_dev_addr()
948 if (ether_addr_equal(bond->dev->dev_addr, slave->dev->dev_addr)) in bond_get_old_active()
969 switch (bond->params.fail_over_mac) { in bond_do_fail_over_mac()
972 rv = bond_set_dev_addr(bond->dev, new_active->dev); in bond_do_fail_over_mac()
974 slave_err(bond->dev, new_active->dev, "Error %d setting bond MAC from slave\n", in bond_do_fail_over_mac()
975 -rv); in bond_do_fail_over_mac()
990 bond_hw_addr_copy(tmp_mac, new_active->dev->dev_addr, in bond_do_fail_over_mac()
991 new_active->dev->addr_len); in bond_do_fail_over_mac()
993 old_active->dev->dev_addr, in bond_do_fail_over_mac()
994 old_active->dev->addr_len); in bond_do_fail_over_mac()
995 ss.ss_family = new_active->dev->type; in bond_do_fail_over_mac()
997 bond_hw_addr_copy(ss.__data, bond->dev->dev_addr, in bond_do_fail_over_mac()
998 bond->dev->addr_len); in bond_do_fail_over_mac()
999 ss.ss_family = bond->dev->type; in bond_do_fail_over_mac()
1002 rv = dev_set_mac_address(new_active->dev, in bond_do_fail_over_mac()
1005 slave_err(bond->dev, new_active->dev, "Error %d setting MAC of new active slave\n", in bond_do_fail_over_mac()
1006 -rv); in bond_do_fail_over_mac()
1014 new_active->dev->addr_len); in bond_do_fail_over_mac()
1015 ss.ss_family = old_active->dev->type; in bond_do_fail_over_mac()
1017 rv = dev_set_mac_address(old_active->dev, in bond_do_fail_over_mac()
1020 slave_err(bond->dev, old_active->dev, "Error %d setting MAC of old active slave\n", in bond_do_fail_over_mac()
1021 -rv); in bond_do_fail_over_mac()
1025 netdev_err(bond->dev, "bond_do_fail_over_mac impossible: bad policy %d\n", in bond_do_fail_over_mac()
1026 bond->params.fail_over_mac); in bond_do_fail_over_mac()
1033 * bond_choose_primary_or_current - select the primary or high priority slave
1036 * - Check if there is a primary link. If the primary link was set and is up,
1039 * - If primary link is not set or down, find the highest priority link.
1045 struct slave *prim = rtnl_dereference(bond->primary_slave); in bond_choose_primary_or_current()
1046 struct slave *curr = rtnl_dereference(bond->curr_active_slave); in bond_choose_primary_or_current()
1050 if (!prim || prim->link != BOND_LINK_UP) { in bond_choose_primary_or_current()
1052 if (slave->link == BOND_LINK_UP) { in bond_choose_primary_or_current()
1054 if (slave->prio > hprio->prio) in bond_choose_primary_or_current()
1064 if (!curr || curr->link != BOND_LINK_UP) in bond_choose_primary_or_current()
1069 if (bond->force_primary) { in bond_choose_primary_or_current()
1070 bond->force_primary = false; in bond_choose_primary_or_current()
1075 if (!curr || curr->link != BOND_LINK_UP) in bond_choose_primary_or_current()
1079 switch (bond->params.primary_reselect) { in bond_choose_primary_or_current()
1083 if (prim->speed < curr->speed) in bond_choose_primary_or_current()
1085 if (prim->speed == curr->speed && prim->duplex <= curr->duplex) in bond_choose_primary_or_current()
1091 netdev_err(bond->dev, "impossible primary_reselect %d\n", in bond_choose_primary_or_current()
1092 bond->params.primary_reselect); in bond_choose_primary_or_current()
1098 * bond_find_best_slave - select the best available slave to be the active one
1105 int mintime = bond->params.updelay; in bond_find_best_slave()
1112 if (slave->link == BOND_LINK_UP) in bond_find_best_slave()
1114 if (slave->link == BOND_LINK_BACK && bond_slave_is_up(slave) && in bond_find_best_slave()
1115 slave->delay < mintime) { in bond_find_best_slave()
1116 mintime = slave->delay; in bond_find_best_slave()
1129 slave = rcu_dereference(bond->curr_active_slave); in bond_should_notify_peers()
1132 if (!slave || !bond->send_peer_notif || in bond_should_notify_peers()
1133 bond->send_peer_notif % in bond_should_notify_peers()
1134 max(1, bond->params.peer_notif_delay) != 0 || in bond_should_notify_peers()
1135 !netif_carrier_ok(bond->dev) || in bond_should_notify_peers()
1136 test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) in bond_should_notify_peers()
1139 netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", in bond_should_notify_peers()
1140 slave ? slave->dev->name : "NULL"); in bond_should_notify_peers()
1146 * bond_change_active_slave - change the active slave into the specified one
1152 * Setting include flags, mc-list, promiscuity, allmulti, etc.
1166 old_active = rtnl_dereference(bond->curr_active_slave); in bond_change_active_slave()
1176 new_active->last_link_up = jiffies; in bond_change_active_slave()
1178 if (new_active->link == BOND_LINK_BACK) { in bond_change_active_slave()
1180 slave_info(bond->dev, new_active->dev, "making interface the new active one %d ms earlier\n", in bond_change_active_slave()
1181 (bond->params.updelay - new_active->delay) * bond->params.miimon); in bond_change_active_slave()
1184 new_active->delay = 0; in bond_change_active_slave()
1195 slave_info(bond->dev, new_active->dev, "making interface the new active one\n"); in bond_change_active_slave()
1211 rcu_assign_pointer(bond->curr_active_slave, new_active); in bond_change_active_slave()
1225 if (bond->params.fail_over_mac) in bond_change_active_slave()
1229 if (netif_running(bond->dev)) { in bond_change_active_slave()
1230 bond->send_peer_notif = in bond_change_active_slave()
1231 bond->params.num_peer_notif * in bond_change_active_slave()
1232 max(1, bond->params.peer_notif_delay); in bond_change_active_slave()
1237 call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, bond->dev); in bond_change_active_slave()
1239 bond->send_peer_notif--; in bond_change_active_slave()
1241 bond->dev); in bond_change_active_slave()
1255 if (netif_running(bond->dev) && (bond->params.resend_igmp > 0) && in bond_change_active_slave()
1258 bond->igmp_retrans = bond->params.resend_igmp; in bond_change_active_slave()
1259 queue_delayed_work(bond->wq, &bond->mcast_work, 1); in bond_change_active_slave()
1264 * bond_select_active_slave - select a new active slave, if needed
1268 * - The old curr_active_slave has been released or lost its link.
1269 * - The primary_slave has got its link back.
1270 * - A slave has got its link back and there's no old curr_active_slave.
1282 if (best_slave != rtnl_dereference(bond->curr_active_slave)) { in bond_select_active_slave()
1288 if (netif_carrier_ok(bond->dev)) in bond_select_active_slave()
1289 netdev_info(bond->dev, "active interface up!\n"); in bond_select_active_slave()
1291 netdev_info(bond->dev, "now running without any active interface!\n"); in bond_select_active_slave()
1302 err = -ENOMEM; in slave_enable_netpoll()
1306 err = __netpoll_setup(np, slave->dev); in slave_enable_netpoll()
1311 slave->np = np; in slave_enable_netpoll()
1317 struct netpoll *np = slave->np; in slave_disable_netpoll()
1322 slave->np = NULL; in slave_disable_netpoll()
1344 SLAVE_AD_INFO(slave)->port.aggregator; in bond_poll_controller()
1347 agg->aggregator_identifier != ad_info.aggregator_id) in bond_poll_controller()
1351 netpoll_poll_dev(slave->dev); in bond_poll_controller()
1395 /*---------------------------------- IOCTL ----------------------------------*/
1412 slave->dev->features, in bond_fix_features()
1441 struct net_device *bond_dev = bond->dev; in bond_compute_features()
1455 slave->dev->vlan_features, BOND_VLAN_FEATURES); in bond_compute_features()
1458 slave->dev->hw_enc_features, in bond_compute_features()
1463 slave->dev->hw_enc_features, in bond_compute_features()
1468 slave->dev->mpls_features, in bond_compute_features()
1471 dst_release_flag &= slave->dev->priv_flags; in bond_compute_features()
1472 if (slave->dev->hard_header_len > max_hard_header_len) in bond_compute_features()
1473 max_hard_header_len = slave->dev->hard_header_len; in bond_compute_features()
1475 tso_max_size = min(tso_max_size, slave->dev->tso_max_size); in bond_compute_features()
1476 tso_max_segs = min(tso_max_segs, slave->dev->tso_max_segs); in bond_compute_features()
1478 bond_dev->hard_header_len = max_hard_header_len; in bond_compute_features()
1481 bond_dev->vlan_features = vlan_features; in bond_compute_features()
1482 bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL | in bond_compute_features()
1486 bond_dev->hw_enc_features |= xfrm_features; in bond_compute_features()
1488 bond_dev->mpls_features = mpls_features; in bond_compute_features()
1492 bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; in bond_compute_features()
1493 if ((bond_dev->priv_flags & IFF_XMIT_DST_RELEASE_PERM) && in bond_compute_features()
1495 bond_dev->priv_flags |= IFF_XMIT_DST_RELEASE; in bond_compute_features()
1503 bond_dev->header_ops = slave_dev->header_ops; in bond_setup_by_slave()
1505 bond_dev->type = slave_dev->type; in bond_setup_by_slave()
1506 bond_dev->hard_header_len = slave_dev->hard_header_len; in bond_setup_by_slave()
1507 bond_dev->needed_headroom = slave_dev->needed_headroom; in bond_setup_by_slave()
1508 bond_dev->addr_len = slave_dev->addr_len; in bond_setup_by_slave()
1510 memcpy(bond_dev->broadcast, slave_dev->broadcast, in bond_setup_by_slave()
1511 slave_dev->addr_len); in bond_setup_by_slave()
1513 if (slave_dev->flags & IFF_POINTOPOINT) { in bond_setup_by_slave()
1514 bond_dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST); in bond_setup_by_slave()
1515 bond_dev->flags |= (IFF_POINTOPOINT | IFF_NOARP); in bond_setup_by_slave()
1520 * duplicates except for alb non-mcast/bcast.
1528 skb->pkt_type != PACKET_BROADCAST && in bond_should_deliver_exact_match()
1529 skb->pkt_type != PACKET_MULTICAST) in bond_should_deliver_exact_match()
1551 slave = bond_slave_get_rcu(skb->dev); in bond_handle_frame()
1552 bond = slave->bond; in bond_handle_frame()
1554 recv_probe = READ_ONCE(bond->recv_probe); in bond_handle_frame()
1565 * be suppressed we want to make an exception for link-local packets. in bond_handle_frame()
1570 * At the same time, packets that are passed to the bonding master in bond_handle_frame()
1571 * (including link-local ones) can have their originating interface in bond_handle_frame()
1575 if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) in bond_handle_frame()
1580 skb->dev = bond->dev; in bond_handle_frame()
1583 netif_is_bridge_port(bond->dev) && in bond_handle_frame()
1584 skb->pkt_type == PACKET_HOST) { in bond_handle_frame()
1587 skb->data - skb_mac_header(skb)))) { in bond_handle_frame()
1591 bond_hw_addr_copy(eth_hdr(skb)->h_dest, bond->dev->dev_addr, in bond_handle_frame()
1592 bond->dev->addr_len); in bond_handle_frame()
1621 switch (bond->params.xmit_policy) { in bond_lag_hash_type()
1650 err = netdev_master_upper_dev_link(slave->dev, bond->dev, slave, in bond_master_upper_dev_link()
1655 slave->dev->flags |= IFF_SLAVE; in bond_master_upper_dev_link()
1661 netdev_upper_dev_unlink(slave->dev, bond->dev); in bond_upper_dev_unlink()
1662 slave->dev->flags &= ~IFF_SLAVE; in bond_upper_dev_unlink()
1670 cancel_delayed_work_sync(&slave->notify_work); in slave_kobj_release()
1688 err = kobject_init_and_add(&slave->kobj, &slave_ktype, in bond_kobj_init()
1689 &(slave->dev->dev.kobj), "bonding_slave"); in bond_kobj_init()
1691 kobject_put(&slave->kobj); in bond_kobj_init()
1705 slave->bond = bond; in bond_alloc_slave()
1706 slave->dev = slave_dev; in bond_alloc_slave()
1707 INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); in bond_alloc_slave()
1716 kobject_put(&slave->kobj); in bond_alloc_slave()
1726 info->bond_mode = BOND_MODE(bond); in bond_fill_ifbond()
1727 info->miimon = bond->params.miimon; in bond_fill_ifbond()
1728 info->num_slaves = bond->slave_cnt; in bond_fill_ifbond()
1733 strcpy(info->slave_name, slave->dev->name); in bond_fill_ifslave()
1734 info->link = slave->link; in bond_fill_ifslave()
1735 info->state = bond_slave_state(slave); in bond_fill_ifslave()
1736 info->link_failure_count = slave->link_failure_count; in bond_fill_ifslave()
1748 bond_fill_ifbond(slave->bond, &binfo.master); in bond_netdev_notify_work()
1749 netdev_bonding_info_change(slave->dev, &binfo); in bond_netdev_notify_work()
1752 queue_delayed_work(slave->bond->wq, &slave->notify_work, 1); in bond_netdev_notify_work()
1758 queue_delayed_work(slave->bond->wq, &slave->notify_work, 0); in bond_queue_slave_event()
1765 info.link_up = slave->link == BOND_LINK_UP || in bond_lower_state_changed()
1766 slave->link == BOND_LINK_FAIL; in bond_lower_state_changed()
1768 netdev_lower_state_changed(slave->dev, &info); in bond_lower_state_changed()
1792 unsigned int flags = bond_dev->flags & (IFF_SLAVE | IFF_UP); in bond_ether_setup()
1795 bond_dev->flags |= IFF_MASTER | flags; in bond_ether_setup()
1796 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING; in bond_ether_setup()
1814 val &= slave->dev->xdp_features; in bond_xdp_set_features()
1824 const struct net_device_ops *slave_ops = slave_dev->netdev_ops; in bond_enslave()
1830 if (slave_dev->flags & IFF_MASTER && in bond_enslave()
1834 return -EPERM; in bond_enslave()
1837 if (!bond->params.use_carrier && in bond_enslave()
1838 slave_dev->ethtool_ops->get_link == NULL && in bond_enslave()
1839 slave_ops->ndo_eth_ioctl == NULL) { in bond_enslave()
1843 /* already in-use? */ in bond_enslave()
1847 return -EBUSY; in bond_enslave()
1852 return -EPERM; in bond_enslave()
1857 if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { in bond_enslave()
1862 return -EPERM; in bond_enslave()
1870 if (slave_dev->features & NETIF_F_HW_ESP) in bond_enslave()
1871 slave_dbg(bond_dev, slave_dev, "is esp-hw-offload capable\n"); in bond_enslave()
1878 if (slave_dev->flags & IFF_UP) { in bond_enslave()
1881 return -EPERM; in bond_enslave()
1884 /* set bonding device ether type by slave - bonding netdevices are in bond_enslave()
1888 * bond ether type mutual exclusion - don't allow slaves of dissimilar in bond_enslave()
1892 if (bond_dev->type != slave_dev->type) { in bond_enslave()
1894 bond_dev->type, slave_dev->type); in bond_enslave()
1901 return -EBUSY; in bond_enslave()
1908 if (slave_dev->type != ARPHRD_ETHER) in bond_enslave()
1916 } else if (bond_dev->type != slave_dev->type) { in bond_enslave()
1919 return -EINVAL; in bond_enslave()
1922 if (slave_dev->type == ARPHRD_INFINIBAND && in bond_enslave()
1925 "Only active-backup mode is supported for infiniband slaves"); in bond_enslave()
1926 res = -EOPNOTSUPP; in bond_enslave()
1930 if (!slave_ops->ndo_set_mac_address || in bond_enslave()
1931 slave_dev->type == ARPHRD_INFINIBAND) { in bond_enslave()
1934 bond->params.fail_over_mac != BOND_FOM_ACTIVE) { in bond_enslave()
1936 bond->params.fail_over_mac = BOND_FOM_ACTIVE; in bond_enslave()
1937 slave_warn(bond_dev, slave_dev, "Setting fail_over_mac to active for active-backup mode\n"); in bond_enslave()
1941 res = -EOPNOTSUPP; in bond_enslave()
1953 bond->dev->addr_assign_type == NET_ADDR_RANDOM) { in bond_enslave()
1954 res = bond_set_dev_addr(bond->dev, slave_dev); in bond_enslave()
1961 res = -ENOMEM; in bond_enslave()
1968 new_slave->queue_id = 0; in bond_enslave()
1971 new_slave->original_mtu = slave_dev->mtu; in bond_enslave()
1972 res = dev_set_mtu(slave_dev, bond->dev->mtu); in bond_enslave()
1982 bond_hw_addr_copy(new_slave->perm_hwaddr, slave_dev->dev_addr, in bond_enslave()
1983 slave_dev->addr_len); in bond_enslave()
1985 if (!bond->params.fail_over_mac || in bond_enslave()
1990 memcpy(ss.__data, bond_dev->dev_addr, bond_dev->addr_len); in bond_enslave()
1991 ss.ss_family = slave_dev->type; in bond_enslave()
2001 slave_dev->priv_flags |= IFF_NO_ADDRCONF; in bond_enslave()
2010 slave_dev->priv_flags |= IFF_BONDING; in bond_enslave()
2012 dev_get_stats(new_slave->dev, &new_slave->slave_stats); in bond_enslave()
2031 new_slave->delay = 0; in bond_enslave()
2032 new_slave->link_failure_count = 0; in bond_enslave()
2036 new_slave->link = BOND_LINK_DOWN; in bond_enslave()
2038 new_slave->last_rx = jiffies - in bond_enslave()
2039 (msecs_to_jiffies(bond->params.arp_interval) + 1); in bond_enslave()
2041 new_slave->target_last_arp_rx[i] = new_slave->last_rx; in bond_enslave()
2043 new_slave->last_tx = new_slave->last_rx; in bond_enslave()
2045 if (bond->params.miimon && !bond->params.use_carrier) { in bond_enslave()
2048 if ((link_reporting == -1) && !bond->params.arp_interval) { in bond_enslave()
2058 } else if (link_reporting == -1) { in bond_enslave()
2065 new_slave->link = BOND_LINK_NOCHANGE; in bond_enslave()
2066 if (bond->params.miimon) { in bond_enslave()
2068 if (bond->params.updelay) { in bond_enslave()
2072 new_slave->delay = bond->params.updelay; in bond_enslave()
2082 } else if (bond->params.arp_interval) { in bond_enslave()
2092 if (new_slave->link != BOND_LINK_DOWN) in bond_enslave()
2093 new_slave->last_link_up = jiffies; in bond_enslave()
2095 new_slave->link == BOND_LINK_DOWN ? "DOWN" : in bond_enslave()
2096 (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); in bond_enslave()
2098 if (bond_uses_primary(bond) && bond->params.primary[0]) { in bond_enslave()
2100 if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { in bond_enslave()
2101 rcu_assign_pointer(bond->primary_slave, new_slave); in bond_enslave()
2102 bond->force_primary = true; in bond_enslave()
2119 SLAVE_AD_INFO(new_slave)->id = 1; in bond_enslave()
2125 SLAVE_AD_INFO(new_slave)->id = in bond_enslave()
2126 SLAVE_AD_INFO(prev_slave)->id + 1; in bond_enslave()
2146 if (!rcu_access_pointer(bond->curr_active_slave) && in bond_enslave()
2147 new_slave->link == BOND_LINK_UP) in bond_enslave()
2148 rcu_assign_pointer(bond->curr_active_slave, new_slave); in bond_enslave()
2154 if (bond->dev->npinfo) { in bond_enslave()
2157 res = -EBUSY; in bond_enslave()
2163 if (!(bond_dev->features & NETIF_F_LRO)) in bond_enslave()
2192 if (bond_dev->flags & IFF_PROMISC) { in bond_enslave()
2199 if (bond_dev->flags & IFF_ALLMULTI) { in bond_enslave()
2202 if (bond_dev->flags & IFF_PROMISC) in bond_enslave()
2203 dev_set_promiscuity(slave_dev, -1); in bond_enslave()
2208 if (bond_dev->flags & IFF_UP) { in bond_enslave()
2219 bond->slave_cnt++; in bond_enslave()
2233 if (!slave_dev->netdev_ops->ndo_bpf || in bond_enslave()
2234 !slave_dev->netdev_ops->ndo_xdp_xmit) { in bond_enslave()
2235 if (bond->xdp_prog) { in bond_enslave()
2238 res = -EOPNOTSUPP; in bond_enslave()
2241 } else if (bond->xdp_prog) { in bond_enslave()
2245 .prog = bond->xdp_prog, in bond_enslave()
2252 res = -EOPNOTSUPP; in bond_enslave()
2256 res = slave_dev->netdev_ops->ndo_bpf(slave_dev, &xdp); in bond_enslave()
2262 if (bond->xdp_prog) in bond_enslave()
2263 bpf_prog_inc(bond->xdp_prog); in bond_enslave()
2270 new_slave->link != BOND_LINK_DOWN ? "an up" : "a down"); in bond_enslave()
2288 if (rcu_access_pointer(bond->primary_slave) == new_slave) in bond_enslave()
2289 RCU_INIT_POINTER(bond->primary_slave, NULL); in bond_enslave()
2290 if (rcu_access_pointer(bond->curr_active_slave) == new_slave) { in bond_enslave()
2302 slave_dev->priv_flags &= ~IFF_BONDING; in bond_enslave()
2306 slave_dev->priv_flags &= ~IFF_NO_ADDRCONF; in bond_enslave()
2307 if (!bond->params.fail_over_mac || in bond_enslave()
2309 /* XXX TODO - fom follow mode needs to change master's in bond_enslave()
2313 bond_hw_addr_copy(ss.__data, new_slave->perm_hwaddr, in bond_enslave()
2314 new_slave->dev->addr_len); in bond_enslave()
2315 ss.ss_family = slave_dev->type; in bond_enslave()
2320 dev_set_mtu(slave_dev, new_slave->original_mtu); in bond_enslave()
2323 kobject_put(&new_slave->kobj); in bond_enslave()
2328 if (ether_addr_equal_64bits(bond_dev->dev_addr, in bond_enslave()
2329 slave_dev->dev_addr)) in bond_enslave()
2331 if (bond_dev->type != ARPHRD_ETHER) { in bond_enslave()
2342 * is RTNL-locked. If "all" is true it means that the function is being called
2358 int old_flags = bond_dev->flags; in __bond_release_one()
2359 netdev_features_t old_features = bond_dev->features; in __bond_release_one()
2362 if (!(slave_dev->flags & IFF_SLAVE) || in __bond_release_one()
2365 return -EINVAL; in __bond_release_one()
2375 return -EINVAL; in __bond_release_one()
2383 bond_get_stats(bond->dev, &bond->bond_stats); in __bond_release_one()
2385 if (bond->xdp_prog) { in __bond_release_one()
2392 if (slave_dev->netdev_ops->ndo_bpf(slave_dev, &xdp)) in __bond_release_one()
2412 oldcurrent = rcu_access_pointer(bond->curr_active_slave); in __bond_release_one()
2414 RCU_INIT_POINTER(bond->current_arp_slave, NULL); in __bond_release_one()
2416 if (!all && (!bond->params.fail_over_mac || in __bond_release_one()
2418 if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) && in __bond_release_one()
2420 …slave_warn(bond_dev, slave_dev, "the permanent HWaddr of slave - %pM - is still in use by bond - s… in __bond_release_one()
2421 slave->perm_hwaddr); in __bond_release_one()
2424 if (rtnl_dereference(bond->primary_slave) == slave) in __bond_release_one()
2425 RCU_INIT_POINTER(bond->primary_slave, NULL); in __bond_release_one()
2440 RCU_INIT_POINTER(bond->curr_active_slave, NULL); in __bond_release_one()
2455 bond->slave_cnt--; in __bond_release_one()
2458 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); in __bond_release_one()
2459 call_netdevice_notifiers(NETDEV_RELEASE, bond->dev); in __bond_release_one()
2463 if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && in __bond_release_one()
2465 …slave_info(bond_dev, slave_dev, "last VLAN challenged slave left bond - VLAN blocking is removed\n… in __bond_release_one()
2481 dev_set_promiscuity(slave_dev, -1); in __bond_release_one()
2485 dev_set_allmulti(slave_dev, -1); in __bond_release_one()
2496 slave_dev->priv_flags &= ~IFF_NO_ADDRCONF; in __bond_release_one()
2498 if (bond->params.fail_over_mac != BOND_FOM_ACTIVE || in __bond_release_one()
2501 bond_hw_addr_copy(ss.__data, slave->perm_hwaddr, in __bond_release_one()
2502 slave->dev->addr_len); in __bond_release_one()
2503 ss.ss_family = slave_dev->type; in __bond_release_one()
2508 __dev_set_mtu(slave_dev, slave->original_mtu); in __bond_release_one()
2510 dev_set_mtu(slave_dev, slave->original_mtu); in __bond_release_one()
2513 slave_dev->priv_flags &= ~IFF_BONDING; in __bond_release_one()
2516 kobject_put(&slave->kobj); in __bond_release_one()
2538 bond_dev->reg_state != NETREG_UNREGISTERING) { in bond_release_and_destroy()
2539 bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; in bond_release_and_destroy()
2558 int i = 0, res = -ENODEV; in bond_slave_info_query()
2562 if (i++ == (int)info->slave_id) { in bond_slave_info_query()
2572 /*-------------------------------- Monitoring -------------------------------*/
2583 ignore_updelay = !rcu_dereference(bond->curr_active_slave); in bond_miimon_inspect()
2587 usable_slaves = rcu_dereference(bond->usable_slaves); in bond_miimon_inspect()
2589 if (usable_slaves && usable_slaves->count == 0) in bond_miimon_inspect()
2596 link_state = bond_check_dev_link(bond, slave->dev, 0); in bond_miimon_inspect()
2598 switch (slave->link) { in bond_miimon_inspect()
2605 slave->delay = bond->params.downdelay; in bond_miimon_inspect()
2606 if (slave->delay) { in bond_miimon_inspect()
2607 slave_info(bond->dev, slave->dev, "link status down for %sinterface, disabling it in %d ms\n", in bond_miimon_inspect()
2612 bond->params.downdelay * bond->params.miimon); in bond_miimon_inspect()
2619 slave->last_link_up = jiffies; in bond_miimon_inspect()
2620 slave_info(bond->dev, slave->dev, "link status up again after %d ms\n", in bond_miimon_inspect()
2621 (bond->params.downdelay - slave->delay) * in bond_miimon_inspect()
2622 bond->params.miimon); in bond_miimon_inspect()
2627 if (slave->delay <= 0) { in bond_miimon_inspect()
2633 slave->delay--; in bond_miimon_inspect()
2642 slave->delay = bond->params.updelay; in bond_miimon_inspect()
2644 if (slave->delay) { in bond_miimon_inspect()
2645 slave_info(bond->dev, slave->dev, "link status up, enabling it in %d ms\n", in bond_miimon_inspect()
2647 bond->params.updelay * in bond_miimon_inspect()
2648 bond->params.miimon); in bond_miimon_inspect()
2654 slave_info(bond->dev, slave->dev, "link status down again after %d ms\n", in bond_miimon_inspect()
2655 (bond->params.updelay - slave->delay) * in bond_miimon_inspect()
2656 bond->params.miimon); in bond_miimon_inspect()
2662 slave->delay = 0; in bond_miimon_inspect()
2664 if (slave->delay <= 0) { in bond_miimon_inspect()
2671 slave->delay--; in bond_miimon_inspect()
2706 switch (slave->link_new_state) { in bond_miimon_commit()
2715 slave->link == BOND_LINK_UP) in bond_miimon_commit()
2722 slave->link = BOND_LINK_DOWN; in bond_miimon_commit()
2724 slave_warn(bond->dev, slave->dev, in bond_miimon_commit()
2730 slave->last_link_up = jiffies; in bond_miimon_commit()
2732 primary = rtnl_dereference(bond->primary_slave); in bond_miimon_commit()
2741 slave_info(bond->dev, slave->dev, "link status definitely up, %u Mbps %s duplex\n", in bond_miimon_commit()
2742 slave->speed == SPEED_UNKNOWN ? 0 : slave->speed, in bond_miimon_commit()
2743 slave->duplex ? "full" : "half"); in bond_miimon_commit()
2747 active = rtnl_dereference(bond->curr_active_slave); in bond_miimon_commit()
2748 if (!active || slave == primary || slave->prio > active->prio) in bond_miimon_commit()
2754 if (slave->link_failure_count < UINT_MAX) in bond_miimon_commit()
2755 slave->link_failure_count++; in bond_miimon_commit()
2765 slave_info(bond->dev, slave->dev, "link status definitely down, disabling slave\n"); in bond_miimon_commit()
2769 if (slave == rcu_access_pointer(bond->curr_active_slave)) in bond_miimon_commit()
2775 slave_err(bond->dev, slave->dev, "invalid new link %d on slave\n", in bond_miimon_commit()
2776 slave->link_new_state); in bond_miimon_commit()
2796 * an acquisition of appropriate locks followed by a commit phase to
2809 delay = msecs_to_jiffies(bond->params.miimon); in bond_mii_monitor()
2817 if (bond->send_peer_notif) { in bond_mii_monitor()
2820 bond->send_peer_notif--; in bond_mii_monitor()
2844 if (bond->params.miimon) in bond_mii_monitor()
2845 queue_delayed_work(bond->wq, &bond->mii_work, delay); in bond_mii_monitor()
2850 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); in bond_mii_monitor()
2858 __be32 ip = *(__be32 *)priv->data; in bond_upper_dev_walk()
2870 if (ip == bond_confirm_addr(bond->dev, 0, ip)) in bond_has_this_ip()
2874 if (netdev_walk_all_upper_dev_rcu(bond->dev, bond_upper_dev_walk, &priv)) in bond_has_this_ip()
2886 struct net_device *bond_dev = slave->bond->dev; in bond_handle_vlan()
2887 struct net_device *slave_dev = slave->dev; in bond_handle_vlan()
2890 if (!tags || tags->vlan_proto == BOND_VLAN_PROTO_NONE) in bond_handle_vlan()
2896 while (tags->vlan_proto != BOND_VLAN_PROTO_NONE) { in bond_handle_vlan()
2897 if (!tags->vlan_id) { in bond_handle_vlan()
2903 ntohs(outer_tag->vlan_proto), tags->vlan_id); in bond_handle_vlan()
2904 skb = vlan_insert_tag_set_proto(skb, tags->vlan_proto, in bond_handle_vlan()
2905 tags->vlan_id); in bond_handle_vlan()
2914 if (outer_tag->vlan_id) { in bond_handle_vlan()
2916 ntohs(outer_tag->vlan_proto), outer_tag->vlan_id); in bond_handle_vlan()
2917 __vlan_hwaccel_put_tag(skb, outer_tag->vlan_proto, in bond_handle_vlan()
2918 outer_tag->vlan_id); in bond_handle_vlan()
2926 * "native" to a VLAN) might not pass non-tagged frames.
2931 struct net_device *bond_dev = slave->bond->dev; in bond_arp_send()
2932 struct net_device *slave_dev = slave->dev; in bond_arp_send()
2939 NULL, slave_dev->dev_addr, NULL); in bond_arp_send()
2971 return ERR_PTR(-ENOMEM); in bond_verify_device_path()
2998 __be32 *targets = bond->params.arp_targets, addr; in bond_arp_send_all()
3002 slave_dbg(bond->dev, slave->dev, "%s: target %pI4\n", in bond_arp_send_all()
3007 rt = ip_route_output(dev_net(bond->dev), targets[i], 0, in bond_arp_send_all()
3010 /* there's no route to target - try to send arp in bond_arp_send_all()
3013 if (bond->params.arp_validate) in bond_arp_send_all()
3015 bond->dev->name, in bond_arp_send_all()
3023 if (rt->dst.dev == bond->dev) in bond_arp_send_all()
3027 tags = bond_verify_device_path(bond->dev, rt->dst.dev, 0); in bond_arp_send_all()
3033 /* Not our device - skip */ in bond_arp_send_all()
3034 slave_dbg(bond->dev, slave->dev, "no path to arp_ip_target %pI4 via rt.dev %s\n", in bond_arp_send_all()
3035 &targets[i], rt->dst.dev ? rt->dst.dev->name : "NULL"); in bond_arp_send_all()
3041 addr = bond_confirm_addr(rt->dst.dev, targets[i], 0); in bond_arp_send_all()
3053 slave_dbg(bond->dev, slave->dev, "%s: sip %pI4 tip %pI4 not found\n", in bond_validate_arp()
3058 i = bond_get_targets_ip(bond->params.arp_targets, sip); in bond_validate_arp()
3059 if (i == -1) { in bond_validate_arp()
3060 slave_dbg(bond->dev, slave->dev, "%s: sip %pI4 not found in targets\n", in bond_validate_arp()
3064 slave->last_rx = jiffies; in bond_validate_arp()
3065 slave->target_last_arp_rx[i] = jiffies; in bond_validate_arp()
3071 struct arphdr *arp = (struct arphdr *)skb->data; in bond_arp_rcv()
3077 alen = arp_hdr_len(bond->dev); in bond_arp_rcv()
3087 if (arp->ar_hln != bond->dev->addr_len || in bond_arp_rcv()
3088 skb->pkt_type == PACKET_OTHERHOST || in bond_arp_rcv()
3089 skb->pkt_type == PACKET_LOOPBACK || in bond_arp_rcv()
3090 arp->ar_hrd != htons(ARPHRD_ETHER) || in bond_arp_rcv()
3091 arp->ar_pro != htons(ETH_P_IP) || in bond_arp_rcv()
3092 arp->ar_pln != 4) in bond_arp_rcv()
3096 arp_ptr += bond->dev->addr_len; in bond_arp_rcv()
3098 arp_ptr += 4 + bond->dev->addr_len; in bond_arp_rcv()
3101 slave_dbg(bond->dev, slave->dev, "%s: %s/%d av %d sv %d sip %pI4 tip %pI4\n", in bond_arp_rcv()
3102 __func__, slave->dev->name, bond_slave_state(slave), in bond_arp_rcv()
3103 bond->params.arp_validate, slave_do_arp_validate(bond, slave), in bond_arp_rcv()
3106 curr_active_slave = rcu_dereference(bond->curr_active_slave); in bond_arp_rcv()
3107 curr_arp_slave = rcu_dereference(bond->current_arp_slave); in bond_arp_rcv()
3136 curr_active_slave->last_link_up)) in bond_arp_rcv()
3138 else if (curr_arp_slave && (arp->ar_op == htons(ARPOP_REPLY)) && in bond_arp_rcv()
3143 if (arp != (struct arphdr *)skb->data) in bond_arp_rcv()
3152 struct net_device *bond_dev = slave->bond->dev; in bond_ns_send()
3153 struct net_device *slave_dev = slave->dev; in bond_ns_send()
3157 slave_dbg(bond_dev, slave_dev, "NS on slave: dst %pI6c src %pI6c\n", in bond_ns_send()
3162 net_err_ratelimited("NS packet allocation failed\n"); in bond_ns_send()
3175 struct in6_addr *targets = bond->params.ns_targets; in bond_ns_send_all()
3183 slave_dbg(bond->dev, slave->dev, "%s: target %pI6c\n", in bond_ns_send_all()
3190 fl6.flowi6_oif = bond->dev->ifindex; in bond_ns_send_all()
3192 dst = ip6_route_output(dev_net(bond->dev), NULL, &fl6); in bond_ns_send_all()
3193 if (dst->error) { in bond_ns_send_all()
3195 /* there's no route to target - try to send arp in bond_ns_send_all()
3198 if (bond->params.arp_validate) in bond_ns_send_all()
3200 bond->dev->name, in bond_ns_send_all()
3207 if (dst->dev == bond->dev) in bond_ns_send_all()
3211 tags = bond_verify_device_path(bond->dev, dst->dev, 0); in bond_ns_send_all()
3217 /* Not our device - skip */ in bond_ns_send_all()
3218 slave_dbg(bond->dev, slave->dev, "no path to ns_ip6_target %pI6c via dst->dev %s\n", in bond_ns_send_all()
3219 &targets[i], dst->dev ? dst->dev->name : "NULL"); in bond_ns_send_all()
3225 if (!ipv6_dev_get_saddr(dev_net(dst->dev), dst->dev, &targets[i], 0, &saddr)) in bond_ns_send_all()
3238 struct in6_addr *addr = (struct in6_addr *)priv->data; in bond_confirm_addr6()
3250 if (bond_confirm_addr6(bond->dev, &priv)) in bond_has_this_ip6()
3254 if (netdev_walk_all_upper_dev_rcu(bond->dev, bond_confirm_addr6, &priv)) in bond_has_this_ip6()
3268 * 2. Dest address is neither all-nodes multicast address nor in bond_validate_na()
3274 slave_dbg(bond->dev, slave->dev, "%s: sip %pI6c tip %pI6c not found\n", in bond_validate_na()
3279 i = bond_get_targets_ip6(bond->params.ns_targets, saddr); in bond_validate_na()
3280 if (i == -1) { in bond_validate_na()
3281 slave_dbg(bond->dev, slave->dev, "%s: sip %pI6c not found in targets\n", in bond_validate_na()
3285 slave->last_rx = jiffies; in bond_validate_na()
3286 slave->target_last_arp_rx[i] = jiffies; in bond_validate_na()
3299 if (skb->pkt_type == PACKET_OTHERHOST || in bond_na_rcv()
3300 skb->pkt_type == PACKET_LOOPBACK) in bond_na_rcv()
3304 if (!combined || combined->ip6.nexthdr != NEXTHDR_ICMP || in bond_na_rcv()
3305 (combined->icmp6.icmp6_type != NDISC_NEIGHBOUR_SOLICITATION && in bond_na_rcv()
3306 combined->icmp6.icmp6_type != NDISC_NEIGHBOUR_ADVERTISEMENT)) in bond_na_rcv()
3309 saddr = &combined->ip6.saddr; in bond_na_rcv()
3310 daddr = &combined->ip6.daddr; in bond_na_rcv()
3312 slave_dbg(bond->dev, slave->dev, "%s: %s/%d av %d sv %d sip %pI6c tip %pI6c\n", in bond_na_rcv()
3313 __func__, slave->dev->name, bond_slave_state(slave), in bond_na_rcv()
3314 bond->params.arp_validate, slave_do_arp_validate(bond, slave), in bond_na_rcv()
3317 curr_active_slave = rcu_dereference(bond->curr_active_slave); in bond_na_rcv()
3318 curr_arp_slave = rcu_dereference(bond->current_arp_slave); in bond_na_rcv()
3327 curr_active_slave->last_link_up)) in bond_na_rcv()
3342 bool is_ipv6 = skb->protocol == __cpu_to_be16(ETH_P_IPV6); in bond_rcv_validate()
3344 bool is_arp = skb->protocol == __cpu_to_be16(ETH_P_ARP); in bond_rcv_validate()
3346 slave_dbg(bond->dev, slave->dev, "%s: skb->dev %s\n", in bond_rcv_validate()
3347 __func__, skb->dev->name); in bond_rcv_validate()
3349 /* Use arp validate logic for both ARP and NS */ in bond_rcv_validate()
3356 slave->last_rx = jiffies; in bond_rcv_validate()
3378 * (last_act - arp_interval) <= jiffies <= (last_act + mod * arp_interval +
3384 int delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); in bond_time_in_interval()
3387 last_act - delta_in_ticks, in bond_time_in_interval()
3393 * is used in load-balancing mode. if the adapter has been dormant, then an
3408 oldcurrent = rcu_dereference(bond->curr_active_slave); in bond_loadbalance_arp_mon()
3411 * the picture unless it is null. also, slave->last_link_up is not in bond_loadbalance_arp_mon()
3422 if (slave->link != BOND_LINK_UP) { in bond_loadbalance_arp_mon()
3424 bond_time_in_interval(bond, slave->last_rx, 1)) { in bond_loadbalance_arp_mon()
3429 /* primary_slave has no meaning in round-robin in bond_loadbalance_arp_mon()
3435 slave_info(bond->dev, slave->dev, "link status definitely up\n"); in bond_loadbalance_arp_mon()
3438 slave_info(bond->dev, slave->dev, "interface is now up\n"); in bond_loadbalance_arp_mon()
3442 /* slave->link == BOND_LINK_UP */ in bond_loadbalance_arp_mon()
3448 if (!bond_time_in_interval(bond, last_tx, bond->params.missed_max) || in bond_loadbalance_arp_mon()
3449 !bond_time_in_interval(bond, slave->last_rx, bond->params.missed_max)) { in bond_loadbalance_arp_mon()
3454 if (slave->link_failure_count < UINT_MAX) in bond_loadbalance_arp_mon()
3455 slave->link_failure_count++; in bond_loadbalance_arp_mon()
3457 slave_info(bond->dev, slave->dev, "interface is now down\n"); in bond_loadbalance_arp_mon()
3464 /* note: if switch is in round-robin mode, all links in bond_loadbalance_arp_mon()
3465 * must tx arp to ensure all links rx an arp - otherwise in bond_loadbalance_arp_mon()
3468 * do - all replies will be rx'ed on same link causing slaves in bond_loadbalance_arp_mon()
3482 if (slave->link_new_state != BOND_LINK_NOCHANGE) in bond_loadbalance_arp_mon()
3483 slave->link = slave->link_new_state; in bond_loadbalance_arp_mon()
3500 if (bond->params.arp_interval) in bond_loadbalance_arp_mon()
3501 queue_delayed_work(bond->wq, &bond->arp_work, in bond_loadbalance_arp_mon()
3502 msecs_to_jiffies(bond->params.arp_interval)); in bond_loadbalance_arp_mon()
3505 /* Called to inspect slaves for active-backup mode ARP monitor link state
3523 if (slave->link != BOND_LINK_UP) { in bond_ab_arp_inspect()
3527 } else if (slave->link == BOND_LINK_BACK) { in bond_ab_arp_inspect()
3538 if (bond_time_in_interval(bond, slave->last_link_up, 2)) in bond_ab_arp_inspect()
3542 * - No current_arp_slave AND in bond_ab_arp_inspect()
3543 * - more than (missed_max+1)*delta since last receive AND in bond_ab_arp_inspect()
3544 * - the bond has an IP address in bond_ab_arp_inspect()
3546 * Note: a non-null current_arp_slave indicates in bond_ab_arp_inspect()
3549 * we only take the curr_active_slave down - this in bond_ab_arp_inspect()
3554 !rcu_access_pointer(bond->current_arp_slave) && in bond_ab_arp_inspect()
3555 !bond_time_in_interval(bond, last_rx, bond->params.missed_max + 1)) { in bond_ab_arp_inspect()
3561 * - more than missed_max*delta since transmitting OR in bond_ab_arp_inspect()
3562 * - (more than missed_max*delta since receive AND in bond_ab_arp_inspect()
3567 (!bond_time_in_interval(bond, last_tx, bond->params.missed_max) || in bond_ab_arp_inspect()
3568 !bond_time_in_interval(bond, last_rx, bond->params.missed_max))) { in bond_ab_arp_inspect()
3578 * active-backup mode ARP monitor.
3590 switch (slave->link_new_state) { in bond_ab_arp_commit()
3596 if (rtnl_dereference(bond->curr_active_slave) != slave || in bond_ab_arp_commit()
3597 (!rtnl_dereference(bond->curr_active_slave) && in bond_ab_arp_commit()
3601 current_arp_slave = rtnl_dereference(bond->current_arp_slave); in bond_ab_arp_commit()
3608 RCU_INIT_POINTER(bond->current_arp_slave, NULL); in bond_ab_arp_commit()
3611 slave_info(bond->dev, slave->dev, "link status definitely up\n"); in bond_ab_arp_commit()
3613 if (!rtnl_dereference(bond->curr_active_slave) || in bond_ab_arp_commit()
3614 slave == rtnl_dereference(bond->primary_slave) || in bond_ab_arp_commit()
3615 slave->prio > rtnl_dereference(bond->curr_active_slave)->prio) in bond_ab_arp_commit()
3623 if (slave->link_failure_count < UINT_MAX) in bond_ab_arp_commit()
3624 slave->link_failure_count++; in bond_ab_arp_commit()
3631 slave_info(bond->dev, slave->dev, "link status definitely down, disabling slave\n"); in bond_ab_arp_commit()
3633 if (slave == rtnl_dereference(bond->curr_active_slave)) { in bond_ab_arp_commit()
3634 RCU_INIT_POINTER(bond->current_arp_slave, NULL); in bond_ab_arp_commit()
3649 if (rtnl_dereference(bond->curr_active_slave)) in bond_ab_arp_commit()
3650 RCU_INIT_POINTER(bond->current_arp_slave, NULL); in bond_ab_arp_commit()
3654 slave_err(bond->dev, slave->dev, in bond_ab_arp_commit()
3656 slave->link_new_state); in bond_ab_arp_commit()
3670 /* Send ARP probes for active-backup mode ARP monitor.
3677 *curr_arp_slave = rcu_dereference(bond->current_arp_slave), in bond_ab_arp_probe()
3678 *curr_active_slave = rcu_dereference(bond->curr_active_slave); in bond_ab_arp_probe()
3684 netdev_info(bond->dev, "PROBE: c_arp %s && cas %s BAD\n", in bond_ab_arp_probe()
3685 curr_arp_slave->dev->name, in bond_ab_arp_probe()
3686 curr_active_slave->dev->name); in bond_ab_arp_probe()
3711 * mark it down - this can happen if we have in bond_ab_arp_probe()
3717 if (!bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) { in bond_ab_arp_probe()
3720 if (slave->link_failure_count < UINT_MAX) in bond_ab_arp_probe()
3721 slave->link_failure_count++; in bond_ab_arp_probe()
3726 slave_info(bond->dev, slave->dev, "backup interface is now down\n"); in bond_ab_arp_probe()
3742 new_slave->last_link_up = jiffies; in bond_ab_arp_probe()
3743 rcu_assign_pointer(bond->current_arp_slave, new_slave); in bond_ab_arp_probe()
3747 if (slave->should_notify || slave->should_notify_link) { in bond_ab_arp_probe()
3761 delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); in bond_activebackup_arp_mon()
3790 if (bond->params.arp_interval) in bond_activebackup_arp_mon()
3791 queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks); in bond_activebackup_arp_mon()
3798 bond->send_peer_notif--; in bond_activebackup_arp_mon()
3800 bond->dev); in bond_activebackup_arp_mon()
3822 /*-------------------------- netdev event handling --------------------------*/
3877 bond_dev = slave->bond->dev; in bond_slave_netdev_event()
3878 bond = slave->bond; in bond_slave_netdev_event()
3879 primary = rtnl_dereference(bond->primary_slave); in bond_slave_netdev_event()
3885 if (bond_dev->type != ARPHRD_ETHER) in bond_slave_netdev_event()
3894 * in weird state. Mark it as link-fail if the link was in bond_slave_netdev_event()
3895 * previously up or link-down if it hasn't yet come up, and in bond_slave_netdev_event()
3896 * let link-monitoring (miimon) set it right when correct in bond_slave_netdev_event()
3901 if (slave->last_link_up) in bond_slave_netdev_event()
3902 slave->link = BOND_LINK_FAIL; in bond_slave_netdev_event()
3904 slave->link = BOND_LINK_DOWN; in bond_slave_netdev_event()
3911 /* Refresh slave-array if applicable! in bond_slave_netdev_event()
3912 * If the setup does not use miimon or arpmon (mode-specific!), in bond_slave_netdev_event()
3913 * then these events will not cause the slave-array to be in bond_slave_netdev_event()
3925 * an active-backup bond, slaves need in bond_slave_netdev_event()
3938 !bond->params.primary[0]) in bond_slave_netdev_event()
3942 /* slave's name changed - he's no longer primary */ in bond_slave_netdev_event()
3943 RCU_INIT_POINTER(bond->primary_slave, NULL); in bond_slave_netdev_event()
3944 } else if (!strcmp(slave_dev->name, bond->params.primary)) { in bond_slave_netdev_event()
3946 rcu_assign_pointer(bond->primary_slave, slave); in bond_slave_netdev_event()
3947 } else { /* we didn't change primary - exit */ in bond_slave_netdev_event()
3951 netdev_info(bond->dev, "Primary slave changed to %s, reselecting active slave\n", in bond_slave_netdev_event()
3952 primary ? slave_dev->name : "none"); in bond_slave_netdev_event()
3959 if (!bond->notifier_ctx) { in bond_slave_netdev_event()
3960 bond->notifier_ctx = true; in bond_slave_netdev_event()
3962 bond->notifier_ctx = false; in bond_slave_netdev_event()
3967 call_netdevice_notifiers(event, slave->bond->dev); in bond_slave_netdev_event()
3994 if (!(event_dev->priv_flags & IFF_BONDING)) in bond_netdev_event()
3997 if (event_dev->flags & IFF_MASTER) { in bond_netdev_event()
4005 if (event_dev->flags & IFF_SLAVE) in bond_netdev_event()
4015 /*---------------------------- Hashing Policies -----------------------------*/
4026 return skb->data; in bond_pull_data()
4041 return ep->h_dest[5] ^ ep->h_source[5] ^ be16_to_cpu(ep->h_proto); in bond_eth_hash()
4057 *nhoff += iph->ihl << 2; in bond_flow_ip()
4059 *ip_proto = iph->protocol; in bond_flow_ip()
4068 *ip_proto = iph6->nexthdr; in bond_flow_ip()
4074 fk->ports.ports = __skb_flow_get_ports(skb, *nhoff, *ip_proto, data, hlen); in bond_flow_ip()
4092 srcmac_vendor = (srcmac_vendor << 8) | mac_hdr->h_source[i]; in bond_vlan_srcmac_hash()
4095 srcmac_dev = (srcmac_dev << 8) | mac_hdr->h_source[i]; in bond_vlan_srcmac_hash()
4107 bool l34 = bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34; in bond_flow_dissect()
4108 int ip_proto = -1; in bond_flow_dissect()
4110 switch (bond->params.xmit_policy) { in bond_flow_dissect()
4120 fk->ports.ports = 0; in bond_flow_dissect()
4121 memset(&fk->icmp, 0, sizeof(fk->icmp)); in bond_flow_dissect()
4131 skb_flow_get_icmp_tci(skb, &fk->icmp, data, nhoff, hlen); in bond_flow_dissect()
4133 if (!icmp_is_err(fk->icmp.type)) in bond_flow_dissect()
4138 if (!icmpv6_is_err(fk->icmp.type)) in bond_flow_dissect()
4174 if (bond->params.xmit_policy == BOND_XMIT_POLICY_VLAN_SRCMAC) in __bond_xmit_hash()
4177 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER2 || in __bond_xmit_hash()
4181 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER23 || in __bond_xmit_hash()
4182 bond->params.xmit_policy == BOND_XMIT_POLICY_ENCAP23) { in __bond_xmit_hash()
4191 return bond_ip_hash(hash, &flow, bond->params.xmit_policy); in __bond_xmit_hash()
4195 * bond_xmit_hash - generate a hash value based on the xmit policy
4204 if (bond->params.xmit_policy == BOND_XMIT_POLICY_ENCAP34 && in bond_xmit_hash()
4205 skb->l4_hash) in bond_xmit_hash()
4206 return skb->hash; in bond_xmit_hash()
4208 return __bond_xmit_hash(bond, skb, skb->data, skb->protocol, in bond_xmit_hash()
4214 * bond_xmit_hash_xdp - generate a hash value based on the xmit policy
4224 if (xdp->data + sizeof(struct ethhdr) > xdp->data_end) in bond_xmit_hash_xdp()
4227 eth = (struct ethhdr *)xdp->data; in bond_xmit_hash_xdp()
4229 return __bond_xmit_hash(bond, NULL, xdp->data, eth->h_proto, 0, in bond_xmit_hash_xdp()
4230 sizeof(struct ethhdr), xdp->data_end - xdp->data); in bond_xmit_hash_xdp()
4233 /*-------------------------- Device entry points ----------------------------*/
4237 INIT_DELAYED_WORK(&bond->mcast_work, in bond_work_init_all()
4239 INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor); in bond_work_init_all()
4240 INIT_DELAYED_WORK(&bond->mii_work, bond_mii_monitor); in bond_work_init_all()
4241 INIT_DELAYED_WORK(&bond->arp_work, bond_arp_monitor); in bond_work_init_all()
4242 INIT_DELAYED_WORK(&bond->ad_work, bond_3ad_state_machine_handler); in bond_work_init_all()
4243 INIT_DELAYED_WORK(&bond->slave_arr_work, bond_slave_arr_handler); in bond_work_init_all()
4248 cancel_delayed_work_sync(&bond->mii_work); in bond_work_cancel_all()
4249 cancel_delayed_work_sync(&bond->arp_work); in bond_work_cancel_all()
4250 cancel_delayed_work_sync(&bond->alb_work); in bond_work_cancel_all()
4251 cancel_delayed_work_sync(&bond->ad_work); in bond_work_cancel_all()
4252 cancel_delayed_work_sync(&bond->mcast_work); in bond_work_cancel_all()
4253 cancel_delayed_work_sync(&bond->slave_arr_work); in bond_work_cancel_all()
4262 if (BOND_MODE(bond) == BOND_MODE_ROUNDROBIN && !bond->rr_tx_counter) { in bond_open()
4263 bond->rr_tx_counter = alloc_percpu(u32); in bond_open()
4264 if (!bond->rr_tx_counter) in bond_open()
4265 return -ENOMEM; in bond_open()
4268 /* reset slave->backup and slave->inactive */ in bond_open()
4272 slave != rcu_access_pointer(bond->curr_active_slave)) { in bond_open()
4287 return -ENOMEM; in bond_open()
4288 if (bond->params.tlb_dynamic_lb || BOND_MODE(bond) == BOND_MODE_ALB) in bond_open()
4289 queue_delayed_work(bond->wq, &bond->alb_work, 0); in bond_open()
4292 if (bond->params.miimon) /* link check interval, in milliseconds. */ in bond_open()
4293 queue_delayed_work(bond->wq, &bond->mii_work, 0); in bond_open()
4295 if (bond->params.arp_interval) { /* arp interval, in milliseconds. */ in bond_open()
4296 queue_delayed_work(bond->wq, &bond->arp_work, 0); in bond_open()
4297 bond->recv_probe = bond_rcv_validate; in bond_open()
4301 queue_delayed_work(bond->wq, &bond->ad_work, 0); in bond_open()
4303 bond->recv_probe = bond_3ad_lacpdu_recv; in bond_open()
4307 dev_mc_add(slave->dev, lacpdu_mcast_addr); in bond_open()
4322 bond->send_peer_notif = 0; in bond_close()
4325 bond->recv_probe = NULL; in bond_close()
4329 slave = rcu_dereference(bond->curr_active_slave); in bond_close()
4331 bond_hw_addr_flush(bond_dev, slave->dev); in bond_close()
4337 bond_hw_addr_flush(bond_dev, slave->dev); in bond_close()
4358 s64 delta = nv - ov; in bond_fold_stats()
4362 delta = (s64)(s32)((u32)nv - (u32)ov); in bond_fold_stats()
4380 iter = &dev->adj_list.lower; in bond_get_lowest_level_rcu()
4390 niter = &ldev->adj_list.lower; in bond_get_lowest_level_rcu()
4401 next = dev_stack[--cur]; in bond_get_lowest_level_rcu()
4428 spin_lock_nested(&bond->stats_lock, nest_level); in bond_get_stats()
4429 memcpy(stats, &bond->bond_stats, sizeof(*stats)); in bond_get_stats()
4433 dev_get_stats(slave->dev, &temp); in bond_get_stats()
4435 bond_fold_stats(stats, new, &slave->slave_stats); in bond_get_stats()
4438 memcpy(&slave->slave_stats, new, sizeof(*new)); in bond_get_stats()
4441 memcpy(&bond->bond_stats, stats, sizeof(*stats)); in bond_get_stats()
4442 spin_unlock(&bond->stats_lock); in bond_get_stats()
4457 return -EINVAL; in bond_eth_ioctl()
4459 mii->phy_id = 0; in bond_eth_ioctl()
4467 return -EINVAL; in bond_eth_ioctl()
4469 if (mii->reg_num == 1) { in bond_eth_ioctl()
4470 mii->val_out = 0; in bond_eth_ioctl()
4471 if (netif_carrier_ok(bond->dev)) in bond_eth_ioctl()
4472 mii->val_out = BMSR_LSTATUS; in bond_eth_ioctl()
4477 return -EOPNOTSUPP; in bond_eth_ioctl()
4499 u_binfo = (struct ifbond __user *)ifr->ifr_data; in bond_do_ioctl()
4502 return -EFAULT; in bond_do_ioctl()
4506 return -EFAULT; in bond_do_ioctl()
4510 u_sinfo = (struct ifslave __user *)ifr->ifr_data; in bond_do_ioctl()
4513 return -EFAULT; in bond_do_ioctl()
4518 return -EFAULT; in bond_do_ioctl()
4527 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) in bond_do_ioctl()
4528 return -EPERM; in bond_do_ioctl()
4530 slave_dev = __dev_get_by_name(net, ifr->ifr_slave); in bond_do_ioctl()
4535 return -ENODEV; in bond_do_ioctl()
4548 bond_opt_initstr(&newval, slave_dev->name); in bond_do_ioctl()
4553 res = -EOPNOTSUPP; in bond_do_ioctl()
4579 return -EOPNOTSUPP; in bond_siocdevprivate()
4588 bond_dev->flags & IFF_PROMISC ? 1 : -1); in bond_change_rx_flags()
4592 bond_dev->flags & IFF_ALLMULTI ? 1 : -1); in bond_change_rx_flags()
4603 slave = rcu_dereference(bond->curr_active_slave); in bond_set_rx_mode()
4605 dev_uc_sync(slave->dev, bond_dev); in bond_set_rx_mode()
4606 dev_mc_sync(slave->dev, bond_dev); in bond_set_rx_mode()
4610 dev_uc_sync_multiple(slave->dev, bond_dev); in bond_set_rx_mode()
4611 dev_mc_sync_multiple(slave->dev, bond_dev); in bond_set_rx_mode()
4619 struct bonding *bond = netdev_priv(n->dev); in bond_neigh_init()
4629 slave_ops = slave->dev->netdev_ops; in bond_neigh_init()
4630 if (!slave_ops->ndo_neigh_setup) in bond_neigh_init()
4642 ret = slave_ops->ndo_neigh_setup(slave->dev, &parms); in bond_neigh_init()
4654 /* The bonding ndo_neigh_setup is called at init time beofre any
4656 * be used at run time to resolve the actual slave neigh param setup.
4659 * underlying devices. In that case - do nothing, we're already set up from
4666 if (parms->dev == dev) in bond_neigh_setup()
4667 parms->neigh_setup = bond_neigh_init; in bond_neigh_setup()
4683 slave_dbg(bond_dev, slave->dev, "s %p c_m %p\n", in bond_change_mtu()
4684 slave, slave->dev->netdev_ops->ndo_change_mtu); in bond_change_mtu()
4686 res = dev_set_mtu(slave->dev, new_mtu); in bond_change_mtu()
4697 slave_dbg(bond_dev, slave->dev, "err %d setting mtu to %d\n", in bond_change_mtu()
4703 bond_dev->mtu = new_mtu; in bond_change_mtu()
4715 tmp_res = dev_set_mtu(rollback_slave->dev, bond_dev->mtu); in bond_change_mtu()
4717 slave_dbg(bond_dev, rollback_slave->dev, "unwind err %d\n", in bond_change_mtu()
4747 if (bond->params.fail_over_mac && in bond_set_mac_address()
4751 if (!is_valid_ether_addr(ss->__data)) in bond_set_mac_address()
4752 return -EADDRNOTAVAIL; in bond_set_mac_address()
4755 slave_dbg(bond_dev, slave->dev, "%s: slave=%p\n", in bond_set_mac_address()
4757 res = dev_set_mac_address(slave->dev, addr, NULL); in bond_set_mac_address()
4765 slave_dbg(bond_dev, slave->dev, "%s: err %d\n", in bond_set_mac_address()
4772 dev_addr_set(bond_dev, ss->__data); in bond_set_mac_address()
4776 memcpy(tmp_ss.__data, bond_dev->dev_addr, bond_dev->addr_len); in bond_set_mac_address()
4777 tmp_ss.ss_family = bond_dev->type; in bond_set_mac_address()
4786 tmp_res = dev_set_mac_address(rollback_slave->dev, in bond_set_mac_address()
4789 slave_dbg(bond_dev, rollback_slave->dev, "%s: unwind err %d\n", in bond_set_mac_address()
4798 * bond_get_slave_by_id - get xmit slave with slave_id
4800 * @slave_id: slave id up to slave_cnt-1 through which to transmit
4814 if (--i < 0) { in bond_get_slave_by_id()
4823 if (--i < 0) in bond_get_slave_by_id()
4833 * bond_rr_gen_slave_id - generate slave id based on packets_per_slave
4844 int packets_per_slave = bond->params.packets_per_slave; in bond_rr_gen_slave_id()
4851 slave_id = this_cpu_inc_return(*bond->rr_tx_counter); in bond_rr_gen_slave_id()
4855 bond->params.reciprocal_packets_per_slave; in bond_rr_gen_slave_id()
4856 slave_id = this_cpu_inc_return(*bond->rr_tx_counter); in bond_rr_gen_slave_id()
4878 if (skb->protocol == htons(ETH_P_IP)) { in bond_xmit_roundrobin_slave_get()
4886 if (iph->protocol == IPPROTO_IGMP) { in bond_xmit_roundrobin_slave_get()
4887 slave = rcu_dereference(bond->curr_active_slave); in bond_xmit_roundrobin_slave_get()
4895 slave_cnt = READ_ONCE(bond->slave_cnt); in bond_xmit_roundrobin_slave_get()
4910 void *data = xdp->data; in bond_xdp_xmit_roundrobin_slave_get()
4912 if (data + sizeof(struct ethhdr) > xdp->data_end) in bond_xdp_xmit_roundrobin_slave_get()
4919 if (eth->h_proto == htons(ETH_P_IP)) { in bond_xdp_xmit_roundrobin_slave_get()
4922 if (data + sizeof(struct iphdr) > xdp->data_end) in bond_xdp_xmit_roundrobin_slave_get()
4927 if (iph->protocol == IPPROTO_IGMP) { in bond_xdp_xmit_roundrobin_slave_get()
4928 slave = rcu_dereference(bond->curr_active_slave); in bond_xdp_xmit_roundrobin_slave_get()
4936 slave_cnt = READ_ONCE(bond->slave_cnt); in bond_xdp_xmit_roundrobin_slave_get()
4952 return bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_roundrobin()
4959 return rcu_dereference(bond->curr_active_slave); in bond_xmit_activebackup_slave_get()
4962 /* In active-backup mode, we know that bond->curr_active_slave is always valid if
4973 return bond_dev_queue_xmit(bond, skb, slave->dev); in bond_xmit_activebackup()
4984 queue_delayed_work(bond->wq, &bond->slave_arr_work, delay); in bond_slave_arr_work_rearm()
5020 * this to-be-skipped slave to send a packet out. in bond_skip_slave()
5022 for (idx = 0; slaves && idx < slaves->count; idx++) { in bond_skip_slave()
5023 if (skipslave == slaves->arr[idx]) { in bond_skip_slave()
5024 slaves->arr[idx] = in bond_skip_slave()
5025 slaves->arr[slaves->count - 1]; in bond_skip_slave()
5026 slaves->count--; in bond_skip_slave()
5038 usable = rtnl_dereference(bond->usable_slaves); in bond_set_slave_arr()
5039 rcu_assign_pointer(bond->usable_slaves, usable_slaves); in bond_set_slave_arr()
5042 all = rtnl_dereference(bond->all_slaves); in bond_set_slave_arr()
5043 rcu_assign_pointer(bond->all_slaves, all_slaves); in bond_set_slave_arr()
5052 /* Build the usable slaves array in control path for modes that use xmit-hash
5053 * to determine the slave interface -
5071 bond->slave_cnt), GFP_KERNEL); in bond_update_slave_arr()
5073 bond->slave_cnt), GFP_KERNEL); in bond_update_slave_arr()
5075 ret = -ENOMEM; in bond_update_slave_arr()
5081 spin_lock_bh(&bond->mode_lock); in bond_update_slave_arr()
5083 spin_unlock_bh(&bond->mode_lock); in bond_update_slave_arr()
5091 spin_unlock_bh(&bond->mode_lock); in bond_update_slave_arr()
5098 all_slaves->arr[all_slaves->count++] = slave; in bond_update_slave_arr()
5102 agg = SLAVE_AD_INFO(slave)->port.aggregator; in bond_update_slave_arr()
5103 if (!agg || agg->aggregator_identifier != agg_id) in bond_update_slave_arr()
5109 slave_dbg(bond->dev, slave->dev, "Adding slave to tx hash array[%d]\n", in bond_update_slave_arr()
5110 usable_slaves->count); in bond_update_slave_arr()
5112 usable_slaves->arr[usable_slaves->count++] = slave; in bond_update_slave_arr()
5119 bond_skip_slave(rtnl_dereference(bond->all_slaves), in bond_update_slave_arr()
5121 bond_skip_slave(rtnl_dereference(bond->usable_slaves), in bond_update_slave_arr()
5139 count = slaves ? READ_ONCE(slaves->count) : 0; in bond_xmit_3ad_xor_slave_get()
5143 slave = slaves->arr[hash % count]; in bond_xmit_3ad_xor_slave_get()
5155 slaves = rcu_dereference(bond->usable_slaves); in bond_xdp_xmit_3ad_xor_slave_get()
5156 count = slaves ? READ_ONCE(slaves->count) : 0; in bond_xdp_xmit_3ad_xor_slave_get()
5160 return slaves->arr[hash % count]; in bond_xdp_xmit_3ad_xor_slave_get()
5174 slaves = rcu_dereference(bond->usable_slaves); in bond_3ad_xor_xmit()
5177 return bond_dev_queue_xmit(bond, skb, slave->dev); in bond_3ad_xor_xmit()
5195 if (!(bond_slave_is_up(slave) && slave->link == BOND_LINK_UP)) in bond_xmit_broadcast()
5205 bond_dev->name, __func__); in bond_xmit_broadcast()
5210 if (bond_dev_queue_xmit(bond, skb2, slave->dev) == NETDEV_TX_OK) in bond_xmit_broadcast()
5224 /*------------------------- Device initialization ---------------------------*/
5238 if (slave->queue_id == skb_get_queue_mapping(skb)) { in bond_slave_override()
5240 slave->link == BOND_LINK_UP) { in bond_slave_override()
5241 bond_dev_queue_xmit(bond, skb, slave->dev); in bond_slave_override()
5264 qdisc_skb_cb(skb)->slave_dev_queue_mapping = skb_get_queue_mapping(skb); in bond_select_queue()
5266 if (unlikely(txq >= dev->real_num_tx_queues)) { in bond_select_queue()
5268 txq -= dev->real_num_tx_queues; in bond_select_queue()
5269 } while (txq >= dev->real_num_tx_queues); in bond_select_queue()
5292 slaves = rcu_dereference(bond->all_slaves); in bond_xmit_get_slave()
5294 slaves = rcu_dereference(bond->usable_slaves); in bond_xmit_get_slave()
5312 return slave->dev; in bond_xmit_get_slave()
5318 switch (sk->sk_family) { in bond_sk_to_flow()
5322 ipv6_addr_type(&sk->sk_v6_daddr) != IPV6_ADDR_MAPPED) { in bond_sk_to_flow()
5323 flow->control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; in bond_sk_to_flow()
5324 flow->addrs.v6addrs.src = inet6_sk(sk)->saddr; in bond_sk_to_flow()
5325 flow->addrs.v6addrs.dst = sk->sk_v6_daddr; in bond_sk_to_flow()
5331 flow->control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; in bond_sk_to_flow()
5332 flow->addrs.v4addrs.src = inet_sk(sk)->inet_rcv_saddr; in bond_sk_to_flow()
5333 flow->addrs.v4addrs.dst = inet_sk(sk)->inet_daddr; in bond_sk_to_flow()
5337 flow->ports.src = inet_sk(sk)->inet_sport; in bond_sk_to_flow()
5338 flow->ports.dst = inet_sk(sk)->inet_dport; in bond_sk_to_flow()
5342 * bond_sk_hash_l34 - generate a hash value based on the socket's L3 and L4 fields
5370 slaves = rcu_dereference(bond->usable_slaves); in __bond_sk_get_lower_dev()
5371 count = slaves ? READ_ONCE(slaves->count) : 0; in __bond_sk_get_lower_dev()
5376 slave = slaves->arr[hash % count]; in __bond_sk_get_lower_dev()
5378 return slave->dev; in __bond_sk_get_lower_dev()
5399 struct net_device *tls_netdev = rcu_dereference(tls_get_ctx(skb->sk)->netdev); in bond_tls_device_xmit()
5497 return slave->dev; in bond_xdp_get_xmit_slave()
5505 int nxmit, err = -ENXIO; in bond_xdp_xmit()
5519 err = -ENXIO; in bond_xdp_xmit()
5523 err = slave_dev->netdev_ops->ndo_xdp_xmit(slave_dev, 1, frames1, flags); in bond_xdp_xmit()
5557 return -EOPNOTSUPP; in bond_xdp_set()
5559 old_prog = bond->xdp_prog; in bond_xdp_set()
5560 bond->xdp_prog = prog; in bond_xdp_set()
5563 struct net_device *slave_dev = slave->dev; in bond_xdp_set()
5565 if (!slave_dev->netdev_ops->ndo_bpf || in bond_xdp_set()
5566 !slave_dev->netdev_ops->ndo_xdp_xmit) { in bond_xdp_set()
5569 err = -EOPNOTSUPP; in bond_xdp_set()
5576 err = -EOPNOTSUPP; in bond_xdp_set()
5580 err = slave_dev->netdev_ops->ndo_bpf(slave_dev, &xdp); in bond_xdp_set()
5601 bond->xdp_prog = old_prog; in bond_xdp_set()
5606 struct net_device *slave_dev = rollback_slave->dev; in bond_xdp_set()
5612 err_unwind = slave_dev->netdev_ops->ndo_bpf(slave_dev, &xdp); in bond_xdp_set()
5624 switch (xdp->command) { in bond_xdp()
5626 return bond_xdp_set(dev, xdp->prog, xdp->extack); in bond_xdp()
5628 return -EINVAL; in bond_xdp()
5635 speed = slave->speed; in bond_mode_bcast_speed()
5637 speed = min(speed, slave->speed); in bond_mode_bcast_speed()
5645 struct ifreq *ifr = kernel_cfg->ifr; in bond_set_phc_index_flag()
5648 if (kernel_cfg->copied_to_user) { in bond_set_phc_index_flag()
5650 if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) in bond_set_phc_index_flag()
5651 return -EFAULT; in bond_set_phc_index_flag()
5654 if (copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg))) in bond_set_phc_index_flag()
5655 return -EFAULT; in bond_set_phc_index_flag()
5657 kernel_cfg->flags |= HWTSTAMP_FLAG_BONDED_PHC_INDEX; in bond_set_phc_index_flag()
5672 return -EOPNOTSUPP; in bond_hwtstamp_get()
5689 if (!(cfg->flags & HWTSTAMP_FLAG_BONDED_PHC_INDEX)) in bond_hwtstamp_set()
5690 return -EOPNOTSUPP; in bond_hwtstamp_set()
5694 return -EOPNOTSUPP; in bond_hwtstamp_set()
5711 cmd->base.duplex = DUPLEX_UNKNOWN; in bond_ethtool_get_link_ksettings()
5712 cmd->base.port = PORT_OTHER; in bond_ethtool_get_link_ksettings()
5722 if (slave->speed != SPEED_UNKNOWN) { in bond_ethtool_get_link_ksettings()
5727 speed += slave->speed; in bond_ethtool_get_link_ksettings()
5729 if (cmd->base.duplex == DUPLEX_UNKNOWN && in bond_ethtool_get_link_ksettings()
5730 slave->duplex != DUPLEX_UNKNOWN) in bond_ethtool_get_link_ksettings()
5731 cmd->base.duplex = slave->duplex; in bond_ethtool_get_link_ksettings()
5734 cmd->base.speed = speed ? : SPEED_UNKNOWN; in bond_ethtool_get_link_ksettings()
5742 strscpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); in bond_ethtool_get_drvinfo()
5743 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d", in bond_ethtool_get_drvinfo()
5766 ops = real_dev->ethtool_ops; in bond_ethtool_get_ts_info()
5767 phydev = real_dev->phydev; in bond_ethtool_get_ts_info()
5772 } else if (ops->get_ts_info) { in bond_ethtool_get_ts_info()
5773 ret = ops->get_ts_info(real_dev, info); in bond_ethtool_get_ts_info()
5780 ret = -1; in bond_ethtool_get_ts_info()
5781 ops = slave->dev->ethtool_ops; in bond_ethtool_get_ts_info()
5782 phydev = slave->dev->phydev; in bond_ethtool_get_ts_info()
5786 else if (ops->get_ts_info) in bond_ethtool_get_ts_info()
5787 ret = ops->get_ts_info(slave->dev, &ts_info); in bond_ethtool_get_ts_info()
5801 info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE | in bond_ethtool_get_ts_info()
5804 info->so_timestamping |= SOF_TIMESTAMPING_TX_SOFTWARE; in bond_ethtool_get_ts_info()
5806 info->phc_index = -1; in bond_ethtool_get_ts_info()
5864 if (bond->wq) in bond_destructor()
5865 destroy_workqueue(bond->wq); in bond_destructor()
5867 free_percpu(bond->rr_tx_counter); in bond_destructor()
5874 spin_lock_init(&bond->mode_lock); in bond_setup()
5875 bond->params = bonding_defaults; in bond_setup()
5878 bond->dev = bond_dev; in bond_setup()
5882 bond_dev->max_mtu = ETH_MAX_MTU; in bond_setup()
5883 bond_dev->netdev_ops = &bond_netdev_ops; in bond_setup()
5884 bond_dev->ethtool_ops = &bond_ethtool_ops; in bond_setup()
5886 bond_dev->needs_free_netdev = true; in bond_setup()
5887 bond_dev->priv_destructor = bond_destructor; in bond_setup()
5892 bond_dev->flags |= IFF_MASTER; in bond_setup()
5893 bond_dev->priv_flags |= IFF_BONDING | IFF_UNICAST_FLT | IFF_NO_QUEUE; in bond_setup()
5894 bond_dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); in bond_setup()
5897 /* set up xfrm device ops (only supported in active-backup right now) */ in bond_setup()
5898 bond_dev->xfrmdev_ops = &bond_xfrmdev_ops; in bond_setup()
5899 INIT_LIST_HEAD(&bond->ipsec_list); in bond_setup()
5900 spin_lock_init(&bond->ipsec_lock); in bond_setup()
5904 bond_dev->features |= NETIF_F_LLTX; in bond_setup()
5914 bond_dev->features |= NETIF_F_NETNS_LOCAL; in bond_setup()
5916 bond_dev->hw_features = BOND_VLAN_FEATURES | in bond_setup()
5922 bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL; in bond_setup()
5923 bond_dev->features |= bond_dev->hw_features; in bond_setup()
5924 bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; in bond_setup()
5926 bond_dev->hw_features |= BOND_XFRM_FEATURES; in bond_setup()
5927 /* Only enable XFRM features if this is an active-backup config */ in bond_setup()
5929 bond_dev->features |= BOND_XFRM_FEATURES; in bond_setup()
5933 bond_dev->xdp_features = NETDEV_XDP_ACT_MASK; in bond_setup()
5949 __bond_release_one(bond_dev, slave->dev, true, true); in bond_uninit()
5954 list_del(&bond->bond_list); in bond_uninit()
5959 /*------------------------- Module initialization ---------------------------*/
5982 return -EINVAL; in bond_check_params()
5984 bond_mode = valptr->value; in bond_check_params()
6000 return -EINVAL; in bond_check_params()
6002 xmit_hashtype = valptr->value; in bond_check_params()
6017 return -EINVAL; in bond_check_params()
6019 lacp_fast = valptr->value; in bond_check_params()
6029 return -EINVAL; in bond_check_params()
6031 params->ad_select = valptr->value; in bond_check_params()
6035 params->ad_select = BOND_AD_STABLE; in bond_check_params()
6039 …pr_warn("Warning: max_bonds (%d) not in range %d-%d, so it was reset to BOND_DEFAULT_MAX_BONDS (%d… in bond_check_params()
6045 pr_warn("Warning: miimon module parameter (%d), not in range 0-%d, so it was reset to 0\n", in bond_check_params()
6051 pr_warn("Warning: updelay module parameter (%d), not in range 0-%d, so it was reset to 0\n", in bond_check_params()
6057 pr_warn("Warning: downdelay module parameter (%d), not in range 0-%d, so it was reset to 0\n", in bond_check_params()
6069 pr_warn("Warning: num_grat_arp/num_unsol_na (%d) not in range 0-255 so it was reset to 1\n", in bond_check_params()
6109 …module updelay parameter (%d msec) is incompatible with the forwarding delay time of the switch\n", in bond_check_params()
6146 pr_warn("Warning: arp_interval module parameter (%d), not in range 0-%d, so it was reset to 0\n", in bond_check_params()
6156 if (!in4_pton(arp_ip_target[i], -1, (u8 *)&ip, -1, NULL) || in bond_check_params()
6162 if (bond_get_targets_ip(arp_target, ip) == -1) in bond_check_params()
6180 return -EINVAL; in bond_check_params()
6189 return -EINVAL; in bond_check_params()
6191 arp_validate_value = valptr->value; in bond_check_params()
6205 arp_all_targets_value = valptr->value; in bond_check_params()
6215 arp_interval, valptr->string, arp_ip_count); in bond_check_params()
6245 return -EINVAL; in bond_check_params()
6247 primary_reselect_value = valptr->value; in bond_check_params()
6259 return -EINVAL; in bond_check_params()
6261 fail_over_mac_value = valptr->value; in bond_check_params()
6263 pr_warn("Warning: fail_over_mac only affects active-backup mode\n"); in bond_check_params()
6274 return -EINVAL; in bond_check_params()
6276 ad_actor_sys_prio = valptr->value; in bond_check_params()
6282 return -EINVAL; in bond_check_params()
6284 ad_user_port_key = valptr->value; in bond_check_params()
6290 return -EINVAL; in bond_check_params()
6292 tlb_dynamic_lb = valptr->value; in bond_check_params()
6301 params->mode = bond_mode; in bond_check_params()
6302 params->xmit_policy = xmit_hashtype; in bond_check_params()
6303 params->miimon = miimon; in bond_check_params()
6304 params->num_peer_notif = num_peer_notif; in bond_check_params()
6305 params->arp_interval = arp_interval; in bond_check_params()
6306 params->arp_validate = arp_validate_value; in bond_check_params()
6307 params->arp_all_targets = arp_all_targets_value; in bond_check_params()
6308 params->missed_max = 2; in bond_check_params()
6309 params->updelay = updelay; in bond_check_params()
6310 params->downdelay = downdelay; in bond_check_params()
6311 params->peer_notif_delay = 0; in bond_check_params()
6312 params->use_carrier = use_carrier; in bond_check_params()
6313 params->lacp_active = 1; in bond_check_params()
6314 params->lacp_fast = lacp_fast; in bond_check_params()
6315 params->primary[0] = 0; in bond_check_params()
6316 params->primary_reselect = primary_reselect_value; in bond_check_params()
6317 params->fail_over_mac = fail_over_mac_value; in bond_check_params()
6318 params->tx_queues = tx_queues; in bond_check_params()
6319 params->all_slaves_active = all_slaves_active; in bond_check_params()
6320 params->resend_igmp = resend_igmp; in bond_check_params()
6321 params->min_links = min_links; in bond_check_params()
6322 params->lp_interval = lp_interval; in bond_check_params()
6323 params->packets_per_slave = packets_per_slave; in bond_check_params()
6324 params->tlb_dynamic_lb = tlb_dynamic_lb; in bond_check_params()
6325 params->ad_actor_sys_prio = ad_actor_sys_prio; in bond_check_params()
6326 eth_zero_addr(params->ad_actor_system); in bond_check_params()
6327 params->ad_user_port_key = ad_user_port_key; in bond_check_params()
6329 params->reciprocal_packets_per_slave = in bond_check_params()
6335 params->reciprocal_packets_per_slave = in bond_check_params()
6340 strscpy_pad(params->primary, primary, sizeof(params->primary)); in bond_check_params()
6342 memcpy(params->arp_targets, arp_target, sizeof(arp_target)); in bond_check_params()
6344 memset(params->ns_targets, 0, sizeof(struct in6_addr) * BOND_MAX_NS_TARGETS); in bond_check_params()
6358 bond->wq = alloc_ordered_workqueue(bond_dev->name, WQ_MEM_RECLAIM); in bond_init()
6359 if (!bond->wq) in bond_init()
6360 return -ENOMEM; in bond_init()
6362 bond->notifier_ctx = false; in bond_init()
6364 spin_lock_init(&bond->stats_lock); in bond_init()
6367 list_add_tail(&bond->bond_list, &bn->dev_list); in bond_init()
6374 if (is_zero_ether_addr(bond_dev->dev_addr) && in bond_init()
6375 bond_dev->addr_assign_type == NET_ADDR_PERM) in bond_init()
6395 int res = -ENOMEM; in bond_create()
6407 bond_dev->rtnl_link_ops = &bond_link_ops; in bond_create()
6428 bn->net = net; in bond_net_init()
6429 INIT_LIST_HEAD(&bn->dev_list); in bond_net_init()
6454 list_for_each_entry_safe(bond, tmp_bond, &bn->dev_list, bond_list) in bond_net_exit_batch()
6455 unregister_netdevice_queue(bond->dev, &list); in bond_net_exit_batch()