Lines Matching full:bond
56 static void rlb_purge_src_ip(struct bonding *bond, struct arp_pkt *arp);
57 static void rlb_src_unlink(struct bonding *bond, u32 index);
58 static void rlb_src_link(struct bonding *bond, u32 ip_src_hash,
93 static void __tlb_clear_slave(struct bonding *bond, struct slave *slave, in __tlb_clear_slave() argument
100 tx_hash_table = BOND_ALB_INFO(bond).tx_hashtbl; in __tlb_clear_slave()
116 static void tlb_clear_slave(struct bonding *bond, struct slave *slave, in tlb_clear_slave() argument
119 spin_lock_bh(&bond->mode_lock); in tlb_clear_slave()
120 __tlb_clear_slave(bond, slave, save_load); in tlb_clear_slave()
121 spin_unlock_bh(&bond->mode_lock); in tlb_clear_slave()
125 static int tlb_initialize(struct bonding *bond) in tlb_initialize() argument
127 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in tlb_initialize()
136 spin_lock_bh(&bond->mode_lock); in tlb_initialize()
143 spin_unlock_bh(&bond->mode_lock); in tlb_initialize()
149 static void tlb_deinitialize(struct bonding *bond) in tlb_deinitialize() argument
151 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in tlb_deinitialize()
153 spin_lock_bh(&bond->mode_lock); in tlb_deinitialize()
158 spin_unlock_bh(&bond->mode_lock); in tlb_deinitialize()
167 static struct slave *tlb_get_least_loaded_slave(struct bonding *bond) in tlb_get_least_loaded_slave() argument
177 bond_for_each_slave_rcu(bond, slave, iter) { in tlb_get_least_loaded_slave()
191 static struct slave *__tlb_choose_channel(struct bonding *bond, u32 hash_index, in __tlb_choose_channel() argument
194 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in __tlb_choose_channel()
201 assigned_slave = tlb_get_least_loaded_slave(bond); in __tlb_choose_channel()
227 static struct slave *tlb_choose_channel(struct bonding *bond, u32 hash_index, in tlb_choose_channel() argument
236 spin_lock(&bond->mode_lock); in tlb_choose_channel()
237 tx_slave = __tlb_choose_channel(bond, hash_index, skb_len); in tlb_choose_channel()
238 spin_unlock(&bond->mode_lock); in tlb_choose_channel()
248 static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp) in rlb_update_entry_from_arp() argument
250 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_update_entry_from_arp()
254 spin_lock_bh(&bond->mode_lock); in rlb_update_entry_from_arp()
269 spin_unlock_bh(&bond->mode_lock); in rlb_update_entry_from_arp()
272 static int rlb_arp_recv(const struct sk_buff *skb, struct bonding *bond, in rlb_arp_recv() argument
286 * itself or on a system that is bridged together with the bond). in rlb_arp_recv()
294 rlb_purge_src_ip(bond, arp); in rlb_arp_recv()
298 rlb_update_entry_from_arp(bond, arp); in rlb_arp_recv()
299 slave_dbg(bond->dev, slave->dev, "Server received an ARP Reply from client\n"); in rlb_arp_recv()
306 static struct slave *__rlb_next_rx_slave(struct bonding *bond) in __rlb_next_rx_slave() argument
308 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in __rlb_next_rx_slave()
313 bond_for_each_slave_rcu(bond, slave, iter) { in __rlb_next_rx_slave()
339 static struct slave *rlb_next_rx_slave(struct bonding *bond) in rlb_next_rx_slave() argument
346 rx_slave = __rlb_next_rx_slave(bond); in rlb_next_rx_slave()
357 static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, in rlb_teach_disabled_mac_on_primary() argument
360 struct slave *curr_active = rtnl_dereference(bond->curr_active_slave); in rlb_teach_disabled_mac_on_primary()
365 if (!bond->alb_info.primary_is_promisc) { in rlb_teach_disabled_mac_on_primary()
367 bond->alb_info.primary_is_promisc = 1; in rlb_teach_disabled_mac_on_primary()
369 bond->alb_info.primary_is_promisc = 0; in rlb_teach_disabled_mac_on_primary()
372 bond->alb_info.rlb_promisc_timeout_counter = 0; in rlb_teach_disabled_mac_on_primary()
381 static void rlb_clear_slave(struct bonding *bond, struct slave *slave) in rlb_clear_slave() argument
383 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_clear_slave()
388 spin_lock_bh(&bond->mode_lock); in rlb_clear_slave()
395 struct slave *assigned_slave = rlb_next_rx_slave(bond); in rlb_clear_slave()
418 spin_unlock_bh(&bond->mode_lock); in rlb_clear_slave()
420 if (slave != rtnl_dereference(bond->curr_active_slave)) in rlb_clear_slave()
421 rlb_teach_disabled_mac_on_primary(bond, slave->dev->dev_addr); in rlb_clear_slave()
442 slave_err(client_info->slave->bond->dev, in rlb_update_client()
460 static void rlb_update_rx_clients(struct bonding *bond) in rlb_update_rx_clients() argument
462 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_update_rx_clients()
466 spin_lock_bh(&bond->mode_lock); in rlb_update_rx_clients()
484 spin_unlock_bh(&bond->mode_lock); in rlb_update_rx_clients()
488 static void rlb_req_update_slave_clients(struct bonding *bond, struct slave *slave) in rlb_req_update_slave_clients() argument
490 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_req_update_slave_clients()
495 spin_lock_bh(&bond->mode_lock); in rlb_req_update_slave_clients()
516 spin_unlock_bh(&bond->mode_lock); in rlb_req_update_slave_clients()
520 static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip) in rlb_req_update_subnet_clients() argument
522 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_req_update_subnet_clients()
526 spin_lock(&bond->mode_lock); in rlb_req_update_subnet_clients()
534 netdev_err(bond->dev, "found a client with no channel in the client's hash table\n"); in rlb_req_update_subnet_clients()
543 bond->dev->dev_addr) && in rlb_req_update_subnet_clients()
550 spin_unlock(&bond->mode_lock); in rlb_req_update_subnet_clients()
554 struct bonding *bond, in rlb_choose_channel() argument
557 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_choose_channel()
562 spin_lock(&bond->mode_lock); in rlb_choose_channel()
564 curr_active_slave = rcu_dereference(bond->curr_active_slave); in rlb_choose_channel()
581 spin_unlock(&bond->mode_lock); in rlb_choose_channel()
597 assigned_slave = __rlb_next_rx_slave(bond); in rlb_choose_channel()
607 rlb_src_unlink(bond, hash_index); in rlb_choose_channel()
608 rlb_src_link(bond, hash_src, hash_index); in rlb_choose_channel()
623 bond->alb_info.rx_ntt = 1; in rlb_choose_channel()
644 spin_unlock(&bond->mode_lock); in rlb_choose_channel()
653 static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) in rlb_arp_xmit() argument
664 * from the bond itself or a VLAN directly above the bond. in rlb_arp_xmit()
666 if (!bond_slave_has_mac_rcu(bond, arp->mac_src)) in rlb_arp_xmit()
669 dev = ip_dev_find(dev_net(bond->dev), arp->ip_src); in rlb_arp_xmit()
680 tx_slave = rlb_choose_channel(skb, bond, arp); in rlb_arp_xmit()
684 netdev_dbg(bond->dev, "(slave %s): Server sent ARP Reply packet\n", in rlb_arp_xmit()
692 tx_slave = rlb_choose_channel(skb, bond, arp); in rlb_arp_xmit()
697 bond->alb_info.rlb_update_delay_counter = RLB_UPDATE_DELAY; in rlb_arp_xmit()
704 rlb_req_update_subnet_clients(bond, arp->ip_src); in rlb_arp_xmit()
705 netdev_dbg(bond->dev, "(slave %s): Server sent ARP Request packet\n", in rlb_arp_xmit()
712 static void rlb_rebalance(struct bonding *bond) in rlb_rebalance() argument
714 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_rebalance()
720 spin_lock_bh(&bond->mode_lock); in rlb_rebalance()
727 assigned_slave = __rlb_next_rx_slave(bond); in rlb_rebalance()
740 spin_unlock_bh(&bond->mode_lock); in rlb_rebalance()
766 static void rlb_delete_table_entry_dst(struct bonding *bond, u32 index) in rlb_delete_table_entry_dst() argument
768 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_delete_table_entry_dst()
781 static void rlb_src_unlink(struct bonding *bond, u32 index) in rlb_src_unlink() argument
783 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_src_unlink()
804 static void rlb_delete_table_entry(struct bonding *bond, u32 index) in rlb_delete_table_entry() argument
806 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_delete_table_entry()
809 rlb_delete_table_entry_dst(bond, index); in rlb_delete_table_entry()
812 rlb_src_unlink(bond, index); in rlb_delete_table_entry()
818 static void rlb_src_link(struct bonding *bond, u32 ip_src_hash, u32 ip_dst_hash) in rlb_src_link() argument
820 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_src_link()
834 static void rlb_purge_src_ip(struct bonding *bond, struct arp_pkt *arp) in rlb_purge_src_ip() argument
836 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_purge_src_ip()
840 spin_lock_bh(&bond->mode_lock); in rlb_purge_src_ip()
849 rlb_delete_table_entry(bond, index); in rlb_purge_src_ip()
852 spin_unlock_bh(&bond->mode_lock); in rlb_purge_src_ip()
855 static int rlb_initialize(struct bonding *bond) in rlb_initialize() argument
857 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_initialize()
866 spin_lock_bh(&bond->mode_lock); in rlb_initialize()
875 spin_unlock_bh(&bond->mode_lock); in rlb_initialize()
878 bond->recv_probe = rlb_arp_recv; in rlb_initialize()
883 static void rlb_deinitialize(struct bonding *bond) in rlb_deinitialize() argument
885 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_deinitialize()
887 spin_lock_bh(&bond->mode_lock); in rlb_deinitialize()
893 spin_unlock_bh(&bond->mode_lock); in rlb_deinitialize()
896 static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id) in rlb_clear_vlan() argument
898 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in rlb_clear_vlan()
901 spin_lock_bh(&bond->mode_lock); in rlb_clear_vlan()
909 rlb_delete_table_entry(bond, curr_index); in rlb_clear_vlan()
914 spin_unlock_bh(&bond->mode_lock); in rlb_clear_vlan()
943 slave_dbg(slave->bond->dev, slave->dev, in alb_send_lp_vid()
953 struct bonding *bond; member
965 struct bonding *bond = data->bond; in alb_upper_dev_walk() local
970 bond->dev->lower_level == upper->lower_level - 1) { in alb_upper_dev_walk()
986 tags = bond_verify_device_path(bond->dev, upper, 0); in alb_upper_dev_walk()
1001 struct bonding *bond = bond_get_bond_by_slave(slave); in alb_send_learning_packets() local
1007 .bond = bond, in alb_send_learning_packets()
1018 netdev_walk_all_upper_dev_rcu(bond->dev, alb_upper_dev_walk, &priv); in alb_send_learning_packets()
1028 if (BOND_MODE(slave->bond) == BOND_MODE_TLB) { in alb_set_slave_mac_addr()
1039 …slave_err(slave->bond->dev, dev, "dev_set_mac_address on slave failed! ALB mode requires that the … in alb_set_slave_mac_addr()
1066 static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, in alb_fasten_mac_swap() argument
1077 if (bond->alb_info.rlb_enabled) { in alb_fasten_mac_swap()
1081 rlb_req_update_slave_clients(bond, slave1); in alb_fasten_mac_swap()
1089 if (bond->alb_info.rlb_enabled) { in alb_fasten_mac_swap()
1093 rlb_req_update_slave_clients(bond, slave2); in alb_fasten_mac_swap()
1099 if (bond->alb_info.rlb_enabled && slaves_state_differ) { in alb_fasten_mac_swap()
1101 rlb_teach_disabled_mac_on_primary(bond, in alb_fasten_mac_swap()
1108 * @bond: bonding we're working on
1114 * address and from @bond's address, then somewhere in the bond there's
1120 static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave) in alb_change_hw_addr_on_detach() argument
1129 bond->dev->dev_addr); in alb_change_hw_addr_on_detach()
1132 found_slave = bond_slave_has_mac(bond, slave->perm_hwaddr); in alb_change_hw_addr_on_detach()
1136 alb_fasten_mac_swap(bond, slave, found_slave); in alb_change_hw_addr_on_detach()
1143 * @bond: bonding we're working on
1149 * If the permanent hw address of @slave is @bond's hw address, we need to
1151 * slave in the bond. This address must be, of course, one of the permanent
1157 * that isn't used by any other slave in the bond, so we can assign it to
1161 * bond slave list.
1163 static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave) in alb_handle_addr_collision_on_attach() argument
1165 struct slave *has_bond_addr = rcu_access_pointer(bond->curr_active_slave); in alb_handle_addr_collision_on_attach()
1169 if (!bond_has_slaves(bond)) { in alb_handle_addr_collision_on_attach()
1174 /* if slave's mac address differs from bond's mac address in alb_handle_addr_collision_on_attach()
1176 * slaves in the bond. in alb_handle_addr_collision_on_attach()
1178 if (!ether_addr_equal_64bits(slave->perm_hwaddr, bond->dev->dev_addr)) { in alb_handle_addr_collision_on_attach()
1179 if (!bond_slave_has_mac(bond, slave->dev->dev_addr)) in alb_handle_addr_collision_on_attach()
1182 /* Try setting slave mac to bond address and fall-through in alb_handle_addr_collision_on_attach()
1185 alb_set_slave_mac_addr(slave, bond->dev->dev_addr, in alb_handle_addr_collision_on_attach()
1186 bond->dev->addr_len); in alb_handle_addr_collision_on_attach()
1189 /* The slave's address is equal to the address of the bond. in alb_handle_addr_collision_on_attach()
1190 * Search for a spare address in the bond for this slave. in alb_handle_addr_collision_on_attach()
1192 bond_for_each_slave(bond, tmp_slave1, iter) { in alb_handle_addr_collision_on_attach()
1193 if (!bond_slave_has_mac(bond, tmp_slave1->perm_hwaddr)) { in alb_handle_addr_collision_on_attach()
1203 bond->dev->dev_addr)) { in alb_handle_addr_collision_on_attach()
1214 …slave_warn(bond->dev, slave->dev, "the slave hw address is in use by the bond; giving it the hw ad… in alb_handle_addr_collision_on_attach()
1218 …slave_err(bond->dev, slave->dev, "the slave hw address is in use by the bond; couldn't find a slav… in alb_handle_addr_collision_on_attach()
1227 * @bond: bonding we're working on
1230 * In TLB mode all slaves are configured to the bond's hw address, but set
1237 * Unwinding assumes bond's mac address has not yet changed.
1239 static int alb_set_mac_address(struct bonding *bond, void *addr) in alb_set_mac_address() argument
1247 if (bond->alb_info.rlb_enabled) in alb_set_mac_address()
1250 bond_for_each_slave(bond, slave, iter) { in alb_set_mac_address()
1267 memcpy(ss.__data, bond->dev->dev_addr, bond->dev->addr_len); in alb_set_mac_address()
1268 ss.ss_family = bond->dev->type; in alb_set_mac_address()
1271 bond_for_each_slave(bond, rollback_slave, iter) { in alb_set_mac_address()
1285 static bool alb_determine_nd(struct sk_buff *skb, struct bonding *bond) in alb_determine_nd() argument
1307 int bond_alb_initialize(struct bonding *bond, int rlb_enabled) in bond_alb_initialize() argument
1311 res = tlb_initialize(bond); in bond_alb_initialize()
1316 res = rlb_initialize(bond); in bond_alb_initialize()
1318 tlb_deinitialize(bond); in bond_alb_initialize()
1321 bond->alb_info.rlb_enabled = 1; in bond_alb_initialize()
1323 bond->alb_info.rlb_enabled = 0; in bond_alb_initialize()
1329 void bond_alb_deinitialize(struct bonding *bond) in bond_alb_deinitialize() argument
1331 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in bond_alb_deinitialize()
1333 tlb_deinitialize(bond); in bond_alb_deinitialize()
1336 rlb_deinitialize(bond); in bond_alb_deinitialize()
1339 static netdev_tx_t bond_do_alb_xmit(struct sk_buff *skb, struct bonding *bond, in bond_do_alb_xmit() argument
1342 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in bond_do_alb_xmit()
1347 tx_slave = rcu_dereference(bond->curr_active_slave); in bond_do_alb_xmit()
1348 if (bond->params.tlb_dynamic_lb) in bond_do_alb_xmit()
1353 if (tx_slave != rcu_access_pointer(bond->curr_active_slave)) { in bond_do_alb_xmit()
1358 return bond_dev_queue_xmit(bond, skb, tx_slave->dev); in bond_do_alb_xmit()
1361 if (tx_slave && bond->params.tlb_dynamic_lb) { in bond_do_alb_xmit()
1362 spin_lock(&bond->mode_lock); in bond_do_alb_xmit()
1363 __tlb_clear_slave(bond, tx_slave, 0); in bond_do_alb_xmit()
1364 spin_unlock(&bond->mode_lock); in bond_do_alb_xmit()
1368 return bond_tx_drop(bond->dev, skb); in bond_do_alb_xmit()
1371 struct slave *bond_xmit_tlb_slave_get(struct bonding *bond, in bond_xmit_tlb_slave_get() argument
1385 if (alb_determine_nd(skb, bond)) in bond_xmit_tlb_slave_get()
1389 hash_index = bond_xmit_hash(bond, skb); in bond_xmit_tlb_slave_get()
1390 if (bond->params.tlb_dynamic_lb) { in bond_xmit_tlb_slave_get()
1391 tx_slave = tlb_choose_channel(bond, in bond_xmit_tlb_slave_get()
1398 slaves = rcu_dereference(bond->usable_slaves); in bond_xmit_tlb_slave_get()
1412 struct bonding *bond = netdev_priv(bond_dev); in bond_tlb_xmit() local
1415 tx_slave = bond_xmit_tlb_slave_get(bond, skb); in bond_tlb_xmit()
1416 return bond_do_alb_xmit(skb, bond, tx_slave); in bond_tlb_xmit()
1419 struct slave *bond_xmit_alb_slave_get(struct bonding *bond, in bond_xmit_alb_slave_get() argument
1422 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in bond_xmit_alb_slave_get()
1471 if (alb_determine_nd(skb, bond)) { in bond_xmit_alb_slave_get()
1494 tx_slave = rlb_arp_xmit(skb, bond); in bond_xmit_alb_slave_get()
1502 if (bond->params.tlb_dynamic_lb) { in bond_xmit_alb_slave_get()
1504 tx_slave = tlb_choose_channel(bond, hash_index, skb->len); in bond_xmit_alb_slave_get()
1514 slaves = rcu_dereference(bond->usable_slaves); in bond_xmit_alb_slave_get()
1517 tx_slave = slaves->arr[bond_xmit_hash(bond, skb) % in bond_xmit_alb_slave_get()
1526 struct bonding *bond = netdev_priv(bond_dev); in bond_alb_xmit() local
1529 tx_slave = bond_xmit_alb_slave_get(bond, skb); in bond_alb_xmit()
1530 return bond_do_alb_xmit(skb, bond, tx_slave); in bond_alb_xmit()
1535 struct bonding *bond = container_of(work, struct bonding, in bond_alb_monitor() local
1537 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in bond_alb_monitor()
1541 if (!bond_has_slaves(bond)) { in bond_alb_monitor()
1553 if (bond_info->lp_counter >= BOND_ALB_LP_TICKS(bond)) { in bond_alb_monitor()
1556 bond_for_each_slave_rcu(bond, slave, iter) { in bond_alb_monitor()
1562 strict_match = (slave != rcu_access_pointer(bond->curr_active_slave) || in bond_alb_monitor()
1572 bond_for_each_slave_rcu(bond, slave, iter) { in bond_alb_monitor()
1573 tlb_clear_slave(bond, slave, 1); in bond_alb_monitor()
1574 if (slave == rcu_access_pointer(bond->curr_active_slave)) { in bond_alb_monitor()
1601 dev_set_promiscuity(rtnl_dereference(bond->curr_active_slave)->dev, in bond_alb_monitor()
1611 rlb_rebalance(bond); in bond_alb_monitor()
1619 rlb_update_rx_clients(bond); in bond_alb_monitor()
1629 queue_delayed_work(bond->wq, &bond->alb_work, alb_delta_in_ticks); in bond_alb_monitor()
1632 /* assumption: called before the slave is attached to the bond
1633 * and not locked by the bond lock
1635 int bond_alb_init_slave(struct bonding *bond, struct slave *slave) in bond_alb_init_slave() argument
1644 res = alb_handle_addr_collision_on_attach(bond, slave); in bond_alb_init_slave()
1651 atomic_set(&bond->alb_info.tx_rebalance_counter, in bond_alb_init_slave()
1654 if (bond->alb_info.rlb_enabled) in bond_alb_init_slave()
1655 bond->alb_info.rlb_rebalance = 1; in bond_alb_init_slave()
1665 void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) in bond_alb_deinit_slave() argument
1667 if (bond_has_slaves(bond)) in bond_alb_deinit_slave()
1668 alb_change_hw_addr_on_detach(bond, slave); in bond_alb_deinit_slave()
1670 tlb_clear_slave(bond, slave, 0); in bond_alb_deinit_slave()
1672 if (bond->alb_info.rlb_enabled) { in bond_alb_deinit_slave()
1673 bond->alb_info.rx_slave = NULL; in bond_alb_deinit_slave()
1674 rlb_clear_slave(bond, slave); in bond_alb_deinit_slave()
1679 void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link) in bond_alb_handle_link_change() argument
1681 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); in bond_alb_handle_link_change()
1684 tlb_clear_slave(bond, slave, 0); in bond_alb_handle_link_change()
1685 if (bond->alb_info.rlb_enabled) in bond_alb_handle_link_change()
1686 rlb_clear_slave(bond, slave); in bond_alb_handle_link_change()
1691 if (bond->alb_info.rlb_enabled) { in bond_alb_handle_link_change()
1692 bond->alb_info.rlb_rebalance = 1; in bond_alb_handle_link_change()
1701 if (bond_is_nondyn_tlb(bond)) { in bond_alb_handle_link_change()
1702 if (bond_update_slave_arr(bond, NULL)) in bond_alb_handle_link_change()
1709 * @bond: our bonding struct
1712 * Set the bond->curr_active_slave to @new_slave and handle
1717 void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave) in bond_alb_handle_active_change() argument
1722 curr_active = rtnl_dereference(bond->curr_active_slave); in bond_alb_handle_active_change()
1726 if (curr_active && bond->alb_info.primary_is_promisc) { in bond_alb_handle_active_change()
1728 bond->alb_info.primary_is_promisc = 0; in bond_alb_handle_active_change()
1729 bond->alb_info.rlb_promisc_timeout_counter = 0; in bond_alb_handle_active_change()
1733 rcu_assign_pointer(bond->curr_active_slave, new_slave); in bond_alb_handle_active_change()
1735 if (!new_slave || !bond_has_slaves(bond)) in bond_alb_handle_active_change()
1742 swap_slave = bond_slave_has_mac(bond, bond->dev->dev_addr); in bond_alb_handle_active_change()
1749 tlb_clear_slave(bond, swap_slave, 1); in bond_alb_handle_active_change()
1750 tlb_clear_slave(bond, new_slave, 1); in bond_alb_handle_active_change()
1753 * and thus filter bond->dev_addr's packets, so force bond's mac in bond_alb_handle_active_change()
1755 if (BOND_MODE(bond) == BOND_MODE_TLB) { in bond_alb_handle_active_change()
1762 bond_hw_addr_copy(ss.__data, bond->dev->dev_addr, in bond_alb_handle_active_change()
1763 bond->dev->addr_len); in bond_alb_handle_active_change()
1764 ss.ss_family = bond->dev->type; in bond_alb_handle_active_change()
1776 alb_fasten_mac_swap(bond, swap_slave, new_slave); in bond_alb_handle_active_change()
1778 /* set the new_slave to the bond mac address */ in bond_alb_handle_active_change()
1779 alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr, in bond_alb_handle_active_change()
1780 bond->dev->addr_len); in bond_alb_handle_active_change()
1781 alb_send_learning_packets(new_slave, bond->dev->dev_addr, in bond_alb_handle_active_change()
1789 struct bonding *bond = netdev_priv(bond_dev); in bond_alb_set_mac_address() local
1798 res = alb_set_mac_address(bond, addr); in bond_alb_set_mac_address()
1808 curr_active = rtnl_dereference(bond->curr_active_slave); in bond_alb_set_mac_address()
1812 swap_slave = bond_slave_has_mac(bond, bond_dev->dev_addr); in bond_alb_set_mac_address()
1816 alb_fasten_mac_swap(bond, swap_slave, curr_active); in bond_alb_set_mac_address()
1823 if (bond->alb_info.rlb_enabled) { in bond_alb_set_mac_address()
1825 rlb_req_update_slave_clients(bond, curr_active); in bond_alb_set_mac_address()
1832 void bond_alb_clear_vlan(struct bonding *bond, unsigned short vlan_id) in bond_alb_clear_vlan() argument
1834 if (bond->alb_info.rlb_enabled) in bond_alb_clear_vlan()
1835 rlb_clear_vlan(bond, vlan_id); in bond_alb_clear_vlan()