• Home
  • Raw
  • Download

Lines Matching full:slave

70 static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[],
103 static inline void tlb_init_slave(struct slave *slave) in tlb_init_slave() argument
105 SLAVE_TLB_INFO(slave).load = 0; in tlb_init_slave()
106 SLAVE_TLB_INFO(slave).head = TLB_NULL_INDEX; in tlb_init_slave()
109 static void __tlb_clear_slave(struct bonding *bond, struct slave *slave, in __tlb_clear_slave() argument
115 /* clear slave from tx_hashtbl */ in __tlb_clear_slave()
120 index = SLAVE_TLB_INFO(slave).head; in __tlb_clear_slave()
128 tlb_init_slave(slave); in __tlb_clear_slave()
131 static void tlb_clear_slave(struct bonding *bond, struct slave *slave, in tlb_clear_slave() argument
135 __tlb_clear_slave(bond, slave, save_load); in tlb_clear_slave()
176 static long long compute_gap(struct slave *slave) in compute_gap() argument
178 return (s64) (slave->speed << 20) - /* Convert to Megabit per sec */ in compute_gap()
179 (s64) (SLAVE_TLB_INFO(slave).load << 3); /* Bytes to bits */ in compute_gap()
182 static struct slave *tlb_get_least_loaded_slave(struct bonding *bond) in tlb_get_least_loaded_slave()
184 struct slave *slave, *least_loaded; in tlb_get_least_loaded_slave() local
191 /* Find the slave with the largest gap */ in tlb_get_least_loaded_slave()
192 bond_for_each_slave_rcu(bond, slave, iter) { in tlb_get_least_loaded_slave()
193 if (bond_slave_can_tx(slave)) { in tlb_get_least_loaded_slave()
194 long long gap = compute_gap(slave); in tlb_get_least_loaded_slave()
197 least_loaded = slave; in tlb_get_least_loaded_slave()
206 static struct slave *__tlb_choose_channel(struct bonding *bond, u32 hash_index, in __tlb_choose_channel()
211 struct slave *assigned_slave; in __tlb_choose_channel()
242 static struct slave *tlb_choose_channel(struct bonding *bond, u32 hash_index, in tlb_choose_channel()
245 struct slave *tx_slave; in tlb_choose_channel()
288 struct slave *slave) in rlb_arp_recv() argument
321 static struct slave *__rlb_next_rx_slave(struct bonding *bond) in __rlb_next_rx_slave()
324 struct slave *before = NULL, *rx_slave = NULL, *slave; in __rlb_next_rx_slave() local
328 bond_for_each_slave_rcu(bond, slave, iter) { in __rlb_next_rx_slave()
329 if (!bond_slave_can_tx(slave)) in __rlb_next_rx_slave()
332 if (!before || before->speed < slave->speed) in __rlb_next_rx_slave()
333 before = slave; in __rlb_next_rx_slave()
335 if (!rx_slave || rx_slave->speed < slave->speed) in __rlb_next_rx_slave()
336 rx_slave = slave; in __rlb_next_rx_slave()
338 if (slave == bond_info->rx_slave) in __rlb_next_rx_slave()
342 * better before and up to the current slave in __rlb_next_rx_slave()
354 static struct slave *rlb_next_rx_slave(struct bonding *bond) in rlb_next_rx_slave()
356 struct slave *rx_slave; in rlb_next_rx_slave()
367 /* teach the switch the mac of a disabled slave
374 struct slave *curr_active = rtnl_dereference(bond->curr_active_slave); in rlb_teach_disabled_mac_on_primary()
391 /* slave being removed should not be active at this point
395 static void rlb_clear_slave(struct bonding *bond, struct slave *slave) in rlb_clear_slave() argument
401 /* clear slave from rx_hashtbl */ in rlb_clear_slave()
408 if (rx_hash_table[index].slave == slave) { in rlb_clear_slave()
409 struct slave *assigned_slave = rlb_next_rx_slave(bond); in rlb_clear_slave()
412 rx_hash_table[index].slave = assigned_slave; in rlb_clear_slave()
416 /* A slave has been removed from the in rlb_clear_slave()
426 } else { /* there is no active slave */ in rlb_clear_slave()
427 rx_hash_table[index].slave = NULL; in rlb_clear_slave()
434 if (slave != rtnl_dereference(bond->curr_active_slave)) in rlb_clear_slave()
435 rlb_teach_disabled_mac_on_primary(bond, slave->dev->dev_addr); in rlb_clear_slave()
442 if (!client_info->slave || !is_valid_ether_addr(client_info->mac_dst)) in rlb_update_client()
450 client_info->slave->dev, in rlb_update_client()
453 client_info->slave->dev->dev_addr, in rlb_update_client()
456 netdev_err(client_info->slave->bond->dev, in rlb_update_client()
461 skb->dev = client_info->slave->dev; in rlb_update_client()
500 /* The slave was assigned a new mac address - update the clients */
501 static void rlb_req_update_slave_clients(struct bonding *bond, struct slave *slave) in rlb_req_update_slave_clients() argument
515 if ((client_info->slave == slave) && in rlb_req_update_slave_clients()
546 if (!client_info->slave) { in rlb_req_update_subnet_clients()
555 !ether_addr_equal_64bits(client_info->slave->dev->dev_addr, in rlb_req_update_subnet_clients()
566 static struct slave *rlb_choose_channel(struct sk_buff *skb, in rlb_choose_channel()
571 struct slave *assigned_slave, *curr_active_slave; in rlb_choose_channel()
592 assigned_slave = client_info->slave; in rlb_choose_channel()
603 client_info->slave != curr_active_slave) { in rlb_choose_channel()
604 client_info->slave = curr_active_slave; in rlb_choose_channel()
609 /* assign a new slave */ in rlb_choose_channel()
632 client_info->slave = assigned_slave; in rlb_choose_channel()
665 static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) in rlb_arp_xmit()
667 struct slave *tx_slave = NULL; in rlb_arp_xmit()
702 * the primary slave. We must register these clients to be in rlb_arp_xmit()
715 struct slave *assigned_slave; in rlb_rebalance()
728 if (assigned_slave && (client_info->slave != assigned_slave)) { in rlb_rebalance()
729 client_info->slave = assigned_slave; in rlb_rebalance()
749 entry->slave = NULL; in rlb_init_table_entry_dst()
918 static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[], in alb_send_lp_vid() argument
940 skb->dev = slave->dev; in alb_send_lp_vid()
942 netdev_dbg(slave->bond->dev, in alb_send_lp_vid()
944 slave->dev->name, mac_addr, vid); in alb_send_lp_vid()
954 struct slave *slave; member
964 struct slave *slave = data->slave; in alb_upper_dev_walk() local
971 alb_send_lp_vid(slave, mac_addr, in alb_upper_dev_walk()
975 alb_send_lp_vid(slave, upper->dev_addr, in alb_upper_dev_walk()
988 alb_send_lp_vid(slave, upper->dev_addr, in alb_upper_dev_walk()
996 static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[], in alb_send_learning_packets() argument
999 struct bonding *bond = bond_get_bond_by_slave(slave); in alb_send_learning_packets()
1003 .slave = slave, in alb_send_learning_packets()
1008 alb_send_lp_vid(slave, mac_addr, 0, 0); in alb_send_learning_packets()
1018 static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[], in alb_set_slave_mac_addr() argument
1021 struct net_device *dev = slave->dev; in alb_set_slave_mac_addr()
1024 if (BOND_MODE(slave->bond) == BOND_MODE_TLB) { in alb_set_slave_mac_addr()
1029 /* for rlb each slave must have a unique hw mac addresses so that in alb_set_slave_mac_addr()
1030 * each slave will receive packets destined to a different mac in alb_set_slave_mac_addr()
1035 …netdev_err(slave->bond->dev, "dev_set_mac_address of dev %s failed! ALB mode requires that the bas… in alb_set_slave_mac_addr()
1046 static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2) in alb_swap_mac_addr()
1063 static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, in alb_fasten_mac_swap()
1064 struct slave *slave2) in alb_fasten_mac_swap()
1067 struct slave *disabled_slave = NULL; in alb_fasten_mac_swap()
1097 /* A disabled slave was assigned an active mac addr */ in alb_fasten_mac_swap()
1106 * @slave: the slave that was just detached
1108 * We assume that @slave was already detached from the slave list.
1110 * If @slave's permanent hw address is different both from its current
1112 * a slave that has @slave's permanet address as its current address.
1113 * We'll make sure that that slave no longer uses @slave's permanent address.
1117 static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave) in alb_change_hw_addr_on_detach() argument
1121 struct slave *found_slave; in alb_change_hw_addr_on_detach()
1123 perm_curr_diff = !ether_addr_equal_64bits(slave->perm_hwaddr, in alb_change_hw_addr_on_detach()
1124 slave->dev->dev_addr); in alb_change_hw_addr_on_detach()
1125 perm_bond_diff = !ether_addr_equal_64bits(slave->perm_hwaddr, in alb_change_hw_addr_on_detach()
1129 found_slave = bond_slave_has_mac(bond, slave->perm_hwaddr); in alb_change_hw_addr_on_detach()
1132 alb_swap_mac_addr(slave, found_slave); in alb_change_hw_addr_on_detach()
1133 alb_fasten_mac_swap(bond, slave, found_slave); in alb_change_hw_addr_on_detach()
1141 * @slave: the slave that was just attached
1143 * checks uniqueness of slave's mac address and handles the case the
1144 * new slave uses the bonds mac address.
1146 * If the permanent hw address of @slave is @bond's hw address, we need to
1147 * find a different hw address to give @slave, that isn't in use by any other
1148 * slave in the bond. This address must be, of course, one of the permanent
1151 * We go over the slave list, and for each slave there we compare its
1153 * If no match was found, then we've found a slave with a permanent address
1154 * that isn't used by any other slave in the bond, so we can assign it to
1155 * @slave.
1157 * assumption: this function is called before @slave is attached to the
1158 * bond slave list.
1160 static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave) in alb_handle_addr_collision_on_attach() argument
1162 struct slave *has_bond_addr = rcu_access_pointer(bond->curr_active_slave); in alb_handle_addr_collision_on_attach()
1163 struct slave *tmp_slave1, *free_mac_slave = NULL; in alb_handle_addr_collision_on_attach()
1167 /* this is the first slave */ in alb_handle_addr_collision_on_attach()
1171 /* if slave's mac address differs from bond's mac address in alb_handle_addr_collision_on_attach()
1172 * check uniqueness of slave's mac address against the other in alb_handle_addr_collision_on_attach()
1175 if (!ether_addr_equal_64bits(slave->perm_hwaddr, bond->dev->dev_addr)) { in alb_handle_addr_collision_on_attach()
1176 if (!bond_slave_has_mac(bond, slave->dev->dev_addr)) in alb_handle_addr_collision_on_attach()
1179 /* Try setting slave mac to bond address and fall-through in alb_handle_addr_collision_on_attach()
1182 alb_set_slave_mac_addr(slave, bond->dev->dev_addr, in alb_handle_addr_collision_on_attach()
1186 /* The slave's address is equal to the address of the bond. in alb_handle_addr_collision_on_attach()
1187 * Search for a spare address in the bond for this slave. in alb_handle_addr_collision_on_attach()
1191 /* no slave has tmp_slave1's perm addr in alb_handle_addr_collision_on_attach()
1208 alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr, in alb_handle_addr_collision_on_attach()
1211 …netdev_warn(bond->dev, "the hw address of slave %s is in use by the bond; giving it the hw address… in alb_handle_addr_collision_on_attach()
1212 slave->dev->name, free_mac_slave->dev->name); in alb_handle_addr_collision_on_attach()
1215 …netdev_err(bond->dev, "the hw address of slave %s is in use by the bond; couldn't find a slave wit… in alb_handle_addr_collision_on_attach()
1216 slave->dev->name); in alb_handle_addr_collision_on_attach()
1232 * For each slave, this function sets the interface to the new address and then
1239 struct slave *slave, *rollback_slave; in alb_set_mac_address() local
1248 bond_for_each_slave(bond, slave, iter) { in alb_set_mac_address()
1250 bond_hw_addr_copy(tmp_addr, slave->dev->dev_addr, in alb_set_mac_address()
1251 slave->dev->addr_len); in alb_set_mac_address()
1253 res = dev_set_mac_address(slave->dev, addr); in alb_set_mac_address()
1256 bond_hw_addr_copy(slave->dev->dev_addr, tmp_addr, in alb_set_mac_address()
1257 slave->dev->addr_len); in alb_set_mac_address()
1269 /* unwind from head to the slave that failed */ in alb_set_mac_address()
1271 if (rollback_slave == slave) in alb_set_mac_address()
1319 struct slave *tx_slave) in bond_do_alb_xmit()
1357 struct slave *tx_slave = NULL; in bond_tlb_xmit()
1396 struct slave *tx_slave = NULL; in bond_alb_xmit()
1530 struct slave *slave; in bond_alb_monitor() local
1547 bond_for_each_slave_rcu(bond, slave, iter) { in bond_alb_monitor()
1550 * use mac of the slave device. in bond_alb_monitor()
1553 strict_match = (slave != rcu_access_pointer(bond->curr_active_slave) || in bond_alb_monitor()
1555 alb_send_learning_packets(slave, slave->dev->dev_addr, in bond_alb_monitor()
1563 bond_for_each_slave_rcu(bond, slave, iter) { in bond_alb_monitor()
1564 tlb_clear_slave(bond, slave, 1); in bond_alb_monitor()
1565 if (slave == rcu_access_pointer(bond->curr_active_slave)) { in bond_alb_monitor()
1566 SLAVE_TLB_INFO(slave).load = in bond_alb_monitor()
1589 * because a slave was disabled then in bond_alb_monitor()
1623 /* assumption: called before the slave is attached to the bond
1626 int bond_alb_init_slave(struct bonding *bond, struct slave *slave) in bond_alb_init_slave() argument
1630 res = alb_set_slave_mac_addr(slave, slave->perm_hwaddr, in bond_alb_init_slave()
1631 slave->dev->addr_len); in bond_alb_init_slave()
1635 res = alb_handle_addr_collision_on_attach(bond, slave); in bond_alb_init_slave()
1639 tlb_init_slave(slave); in bond_alb_init_slave()
1650 /* Remove slave from tlb and rlb hash tables, and fix up MAC addresses
1655 void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) in bond_alb_deinit_slave() argument
1658 alb_change_hw_addr_on_detach(bond, slave); in bond_alb_deinit_slave()
1660 tlb_clear_slave(bond, slave, 0); in bond_alb_deinit_slave()
1664 rlb_clear_slave(bond, slave); in bond_alb_deinit_slave()
1669 void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link) in bond_alb_handle_link_change() argument
1674 tlb_clear_slave(bond, slave, 0); in bond_alb_handle_link_change()
1676 rlb_clear_slave(bond, slave); in bond_alb_handle_link_change()
1692 pr_err("Failed to build slave-array for TLB mode.\n"); in bond_alb_handle_link_change()
1699 * @new_slave: new slave to assign
1706 void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave) in bond_alb_handle_active_change()
1708 struct slave *swap_slave; in bond_alb_handle_active_change()
1709 struct slave *curr_active; in bond_alb_handle_active_change()
1741 /* in TLB mode, the slave might flip down/up with the old dev_addr, in bond_alb_handle_active_change()
1780 struct slave *curr_active; in bond_alb_set_mac_address()
1781 struct slave *swap_slave; in bond_alb_set_mac_address()