Lines Matching refs:slave
113 static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]);
153 static inline void tlb_init_slave(struct slave *slave) in tlb_init_slave() argument
155 SLAVE_TLB_INFO(slave).load = 0; in tlb_init_slave()
156 SLAVE_TLB_INFO(slave).head = TLB_NULL_INDEX; in tlb_init_slave()
160 static void tlb_clear_slave(struct bonding *bond, struct slave *slave, int save_load) in tlb_clear_slave() argument
172 index = SLAVE_TLB_INFO(slave).head; in tlb_clear_slave()
180 tlb_init_slave(slave); in tlb_clear_slave()
229 static struct slave *tlb_get_least_loaded_slave(struct bonding *bond) in tlb_get_least_loaded_slave()
231 struct slave *slave, *least_loaded; in tlb_get_least_loaded_slave() local
236 bond_for_each_slave(bond, slave, i) { in tlb_get_least_loaded_slave()
237 if (SLAVE_IS_OK(slave)) { in tlb_get_least_loaded_slave()
247 least_loaded = slave; in tlb_get_least_loaded_slave()
248 max_gap = (s64)(slave->speed << 20) - /* Convert to Megabit per sec */ in tlb_get_least_loaded_slave()
249 (s64)(SLAVE_TLB_INFO(slave).load << 3); /* Bytes to bits */ in tlb_get_least_loaded_slave()
252 bond_for_each_slave_from(bond, slave, i, least_loaded) { in tlb_get_least_loaded_slave()
253 if (SLAVE_IS_OK(slave)) { in tlb_get_least_loaded_slave()
254 s64 gap = (s64)(slave->speed << 20) - in tlb_get_least_loaded_slave()
255 (s64)(SLAVE_TLB_INFO(slave).load << 3); in tlb_get_least_loaded_slave()
257 least_loaded = slave; in tlb_get_least_loaded_slave()
267 static struct slave *tlb_choose_channel(struct bonding *bond, u32 hash_index, u32 skb_len) in tlb_choose_channel()
271 struct slave *assigned_slave; in tlb_choose_channel()
389 static struct slave *rlb_next_rx_slave(struct bonding *bond) in rlb_next_rx_slave()
392 struct slave *rx_slave, *slave, *start_at; in rlb_next_rx_slave() local
403 bond_for_each_slave_from(bond, slave, i, start_at) { in rlb_next_rx_slave()
404 if (SLAVE_IS_OK(slave)) { in rlb_next_rx_slave()
406 rx_slave = slave; in rlb_next_rx_slave()
407 } else if (slave->speed > rx_slave->speed) { in rlb_next_rx_slave()
408 rx_slave = slave; in rlb_next_rx_slave()
447 static void rlb_clear_slave(struct bonding *bond, struct slave *slave) in rlb_clear_slave() argument
460 if (rx_hash_table[index].slave == slave) { in rlb_clear_slave()
461 struct slave *assigned_slave = rlb_next_rx_slave(bond); in rlb_clear_slave()
464 rx_hash_table[index].slave = assigned_slave; in rlb_clear_slave()
480 rx_hash_table[index].slave = NULL; in rlb_clear_slave()
489 if (slave != bond->curr_active_slave) { in rlb_clear_slave()
490 rlb_teach_disabled_mac_on_primary(bond, slave->dev->dev_addr); in rlb_clear_slave()
500 if (!client_info->slave) { in rlb_update_client()
509 client_info->slave->dev, in rlb_update_client()
512 client_info->slave->dev->dev_addr, in rlb_update_client()
517 client_info->slave->dev->master->name); in rlb_update_client()
521 skb->dev = client_info->slave->dev; in rlb_update_client()
528 client_info->slave->dev->master->name); in rlb_update_client()
566 static void rlb_req_update_slave_clients(struct bonding *bond, struct slave *slave) in rlb_req_update_slave_clients() argument
579 if ((client_info->slave == slave) && in rlb_req_update_slave_clients()
609 if (!client_info->slave) { in rlb_req_update_subnet_clients()
621 memcmp(client_info->slave->dev->dev_addr, in rlb_req_update_subnet_clients()
633 static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bond) in rlb_choose_channel()
637 struct slave *assigned_slave; in rlb_choose_channel()
655 assigned_slave = client_info->slave; in rlb_choose_channel()
666 client_info->slave != bond->curr_active_slave) { in rlb_choose_channel()
667 client_info->slave = bond->curr_active_slave; in rlb_choose_channel()
683 client_info->slave = assigned_slave; in rlb_choose_channel()
718 static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) in rlb_arp_xmit()
721 struct slave *tx_slave = NULL; in rlb_arp_xmit()
761 struct slave *assigned_slave; in rlb_rebalance()
773 if (assigned_slave && (client_info->slave != assigned_slave)) { in rlb_rebalance()
774 client_info->slave = assigned_slave; in rlb_rebalance()
885 static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]) in alb_send_learning_packets() argument
887 struct bonding *bond = bond_get_bond_by_slave(slave); in alb_send_learning_packets()
913 skb->dev = slave->dev; in alb_send_learning_packets()
944 static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw) in alb_set_slave_mac_addr() argument
946 struct net_device *dev = slave->dev; in alb_set_slave_mac_addr()
977 static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct slave *slave2) in alb_swap_mac_addr()
992 static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, in alb_fasten_mac_swap()
993 struct slave *slave2) in alb_fasten_mac_swap()
996 struct slave *disabled_slave = NULL; in alb_fasten_mac_swap()
1046 static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave) in alb_change_hw_addr_on_detach() argument
1051 perm_curr_diff = memcmp(slave->perm_hwaddr, in alb_change_hw_addr_on_detach()
1052 slave->dev->dev_addr, in alb_change_hw_addr_on_detach()
1054 perm_bond_diff = memcmp(slave->perm_hwaddr, in alb_change_hw_addr_on_detach()
1059 struct slave *tmp_slave; in alb_change_hw_addr_on_detach()
1063 if (!memcmp(slave->perm_hwaddr, in alb_change_hw_addr_on_detach()
1073 alb_swap_mac_addr(bond, slave, tmp_slave); in alb_change_hw_addr_on_detach()
1074 alb_fasten_mac_swap(bond, slave, tmp_slave); in alb_change_hw_addr_on_detach()
1104 static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave) in alb_handle_addr_collision_on_attach() argument
1106 struct slave *tmp_slave1, *tmp_slave2, *free_mac_slave; in alb_handle_addr_collision_on_attach()
1107 struct slave *has_bond_addr = bond->curr_active_slave; in alb_handle_addr_collision_on_attach()
1119 if (memcmp(slave->perm_hwaddr, bond->dev->dev_addr, ETH_ALEN)) { in alb_handle_addr_collision_on_attach()
1121 if (!memcmp(tmp_slave1->dev->dev_addr, slave->dev->dev_addr, in alb_handle_addr_collision_on_attach()
1133 alb_set_slave_mac_addr(slave, bond->dev->dev_addr, in alb_handle_addr_collision_on_attach()
1172 alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr, in alb_handle_addr_collision_on_attach()
1178 bond->dev->name, slave->dev->name, free_mac_slave->dev->name); in alb_handle_addr_collision_on_attach()
1185 bond->dev->name, slave->dev->name); in alb_handle_addr_collision_on_attach()
1209 struct slave *slave, *stop_at; in alb_set_mac_address() local
1218 bond_for_each_slave(bond, slave, i) { in alb_set_mac_address()
1220 memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN); in alb_set_mac_address()
1222 res = dev_set_mac_address(slave->dev, addr); in alb_set_mac_address()
1225 memcpy(slave->dev->dev_addr, tmp_addr, ETH_ALEN); in alb_set_mac_address()
1238 stop_at = slave; in alb_set_mac_address()
1239 bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) { in alb_set_mac_address()
1240 memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN); in alb_set_mac_address()
1241 dev_set_mac_address(slave->dev, &sa); in alb_set_mac_address()
1242 memcpy(slave->dev->dev_addr, tmp_addr, ETH_ALEN); in alb_set_mac_address()
1290 struct slave *tx_slave = NULL; in bond_alb_xmit()
1426 struct slave *slave; in bond_alb_monitor() local
1453 bond_for_each_slave(bond, slave, i) { in bond_alb_monitor()
1454 alb_send_learning_packets(slave, slave->dev->dev_addr); in bond_alb_monitor()
1467 bond_for_each_slave(bond, slave, i) { in bond_alb_monitor()
1468 tlb_clear_slave(bond, slave, 1); in bond_alb_monitor()
1469 if (slave == bond->curr_active_slave) { in bond_alb_monitor()
1470 SLAVE_TLB_INFO(slave).load = in bond_alb_monitor()
1536 int bond_alb_init_slave(struct bonding *bond, struct slave *slave) in bond_alb_init_slave() argument
1540 res = alb_set_slave_mac_addr(slave, slave->perm_hwaddr, in bond_alb_init_slave()
1551 res = alb_handle_addr_collision_on_attach(bond, slave); in bond_alb_init_slave()
1559 tlb_init_slave(slave); in bond_alb_init_slave()
1577 void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) in bond_alb_deinit_slave() argument
1580 alb_change_hw_addr_on_detach(bond, slave); in bond_alb_deinit_slave()
1583 tlb_clear_slave(bond, slave, 0); in bond_alb_deinit_slave()
1587 rlb_clear_slave(bond, slave); in bond_alb_deinit_slave()
1592 void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link) in bond_alb_handle_link_change() argument
1597 tlb_clear_slave(bond, slave, 0); in bond_alb_handle_link_change()
1599 rlb_clear_slave(bond, slave); in bond_alb_handle_link_change()
1630 void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave) in bond_alb_handle_active_change()
1632 struct slave *swap_slave; in bond_alb_handle_active_change()
1656 struct slave *tmp_slave; in bond_alb_handle_active_change()
1710 struct slave *slave, *swap_slave; in bond_alb_set_mac_address() local
1735 bond_for_each_slave(bond, slave, i) { in bond_alb_set_mac_address()
1736 if (!memcmp(slave->dev->dev_addr, bond_dev->dev_addr, ETH_ALEN)) { in bond_alb_set_mac_address()
1737 swap_slave = slave; in bond_alb_set_mac_address()