• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/net/bonding/

Lines Matching refs:slave

79 /* RLB_PROMISC_TIMEOUT = 10 sec equals the time that the current slave is
122 static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]);
162 static inline void tlb_init_slave(struct slave *slave)
164 SLAVE_TLB_INFO(slave).load = 0;
165 SLAVE_TLB_INFO(slave).head = TLB_NULL_INDEX;
169 static void tlb_clear_slave(struct bonding *bond, struct slave *slave, int save_load)
176 /* clear slave from tx_hashtbl */
181 index = SLAVE_TLB_INFO(slave).head;
189 tlb_init_slave(slave);
236 static long long compute_gap(struct slave *slave)
238 return (s64) (slave->speed << 20) - /* Convert to Megabit per sec */
239 (s64) (SLAVE_TLB_INFO(slave).load << 3); /* Bytes to bits */
243 static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)
245 struct slave *slave, *least_loaded;
252 /* Find the slave with the largest gap */
253 bond_for_each_slave(bond, slave, i) {
254 if (SLAVE_IS_OK(slave)) {
255 long long gap = compute_gap(slave);
258 least_loaded = slave;
268 static struct slave *tlb_choose_channel(struct bonding *bond, u32 hash_index, u32 skb_len)
272 struct slave *assigned_slave;
389 static struct slave *rlb_next_rx_slave(struct bonding *bond)
392 struct slave *rx_slave, *slave, *start_at;
403 bond_for_each_slave_from(bond, slave, i, start_at) {
404 if (SLAVE_IS_OK(slave)) {
406 rx_slave = slave;
407 } else if (slave->speed > rx_slave->speed) {
408 rx_slave = slave;
420 /* teach the switch the mac of a disabled slave
443 /* slave being removed should not be active at this point
447 static void rlb_clear_slave(struct bonding *bond, struct slave *slave)
453 /* clear slave from rx_hashtbl */
460 if (rx_hash_table[index].slave == slave) {
461 struct slave *assigned_slave = rlb_next_rx_slave(bond);
464 rx_hash_table[index].slave = assigned_slave;
469 /* A slave has been removed from the
479 } else { /* there is no active slave */
480 rx_hash_table[index].slave = NULL;
489 if (slave != bond->curr_active_slave) {
490 rlb_teach_disabled_mac_on_primary(bond, slave->dev->dev_addr);
500 if (!client_info->slave) {
509 client_info->slave->dev,
512 client_info->slave->dev->dev_addr,
516 client_info->slave->dev->master->name);
520 skb->dev = client_info->slave->dev;
526 client_info->slave->dev->master->name);
563 /* The slave was assigned a new mac address - update the clients */
564 static void rlb_req_update_slave_clients(struct bonding *bond, struct slave *slave)
577 if ((client_info->slave == slave) &&
607 if (!client_info->slave) {
617 compare_ether_addr_64bits(client_info->slave->dev->dev_addr,
629 static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bond)
633 struct slave *assigned_slave;
651 assigned_slave = client_info->slave;
662 client_info->slave != bond->curr_active_slave) {
663 client_info->slave = bond->curr_active_slave;
668 /* assign a new slave */
679 client_info->slave = assigned_slave;
714 static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
717 struct slave *tx_slave = NULL;
743 * the primary slave. We must register these clients to be
757 struct slave *assigned_slave;
769 if (assigned_slave && (client_info->slave != assigned_slave)) {
770 client_info->slave = assigned_slave;
880 static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
882 struct bonding *bond = bond_get_bond_by_slave(slave);
908 skb->dev = slave->dev;
938 static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw)
940 struct net_device *dev = slave->dev;
948 /* for rlb each slave must have a unique hw mac addresses so that */
949 /* each slave will receive packets destined to a different mac */
968 static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct slave *slave2)
983 static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
984 struct slave *slave2)
987 struct slave *disabled_slave = NULL;
1017 /* A disabled slave was assigned an active mac addr */
1026 * @slave: the slave that was just detached
1028 * We assume that @slave was already detached from the slave list.
1030 * If @slave's permanent hw address is different both from its current
1032 * a slave that has @slave's permanet address as its current address.
1033 * We'll make sure that that slave no longer uses @slave's permanent address.
1037 static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave)
1042 perm_curr_diff = compare_ether_addr_64bits(slave->perm_hwaddr,
1043 slave->dev->dev_addr);
1044 perm_bond_diff = compare_ether_addr_64bits(slave->perm_hwaddr,
1048 struct slave *tmp_slave;
1052 if (!compare_ether_addr_64bits(slave->perm_hwaddr,
1061 alb_swap_mac_addr(bond, slave, tmp_slave);
1062 alb_fasten_mac_swap(bond, slave, tmp_slave);
1070 * @slave: the slave that was just attached
1072 * checks uniqueness of slave's mac address and handles the case the
1073 * new slave uses the bonds mac address.
1075 * If the permanent hw address of @slave is @bond's hw address, we need to
1076 * find a different hw address to give @slave, that isn't in use by any other
1077 * slave in the bond. This address must be, of course, one of the premanent
1080 * We go over the slave list, and for each slave there we compare its
1082 * If no match was found, then we've found a slave with a permanent address
1083 * that isn't used by any other slave in the bond, so we can assign it to
1084 * @slave.
1086 * assumption: this function is called before @slave is attached to the
1087 * bond slave list.
1092 static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave)
1094 struct slave *tmp_slave1, *tmp_slave2, *free_mac_slave;
1095 struct slave *has_bond_addr = bond->curr_active_slave;
1099 /* this is the first slave */
1103 /* if slave's mac address differs from bond's mac address
1104 * check uniqueness of slave's mac address against the other
1107 if (compare_ether_addr_64bits(slave->perm_hwaddr, bond->dev->dev_addr)) {
1110 slave->dev->dev_addr)) {
1119 /* Try setting slave mac to bond address and fall-through
1121 alb_set_slave_mac_addr(slave, bond->dev->dev_addr,
1125 /* The slave's address is equal to the address of the bond.
1126 * Search for a spare address in the bond for this slave.
1141 /* no slave has tmp_slave1's perm addr
1158 alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr,
1161 pr_warning("%s: Warning: the hw address of slave %s is in use by the bond; giving it the hw address of %s\n",
1162 bond->dev->name, slave->dev->name,
1166 pr_err("%s: Error: the hw address of slave %s is in use by the bond; couldn't find a slave with a free hw address to give it (this should not have happened)\n",
1167 bond->dev->name, slave->dev->name);
1183 * For each slave, this function sets the interface to the new address and then
1191 struct slave *slave, *stop_at;
1200 bond_for_each_slave(bond, slave, i) {
1202 memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN);
1204 res = dev_set_mac_address(slave->dev, addr);
1207 memcpy(slave->dev->dev_addr, tmp_addr, ETH_ALEN);
1219 /* unwind from head to the slave that failed */
1220 stop_at = slave;
1221 bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) {
1222 memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN);
1223 dev_set_mac_address(slave->dev, &sa);
1224 memcpy(slave->dev->dev_addr, tmp_addr, ETH_ALEN);
1272 struct slave *tx_slave = NULL;
1408 struct slave *slave;
1435 bond_for_each_slave(bond, slave, i) {
1436 alb_send_learning_packets(slave, slave->dev->dev_addr);
1449 bond_for_each_slave(bond, slave, i) {
1450 tlb_clear_slave(bond, slave, 1);
1451 if (slave == bond->curr_active_slave) {
1452 SLAVE_TLB_INFO(slave).load =
1479 * because a slave was disabled then
1515 /* assumption: called before the slave is attached to the bond
1518 int bond_alb_init_slave(struct bonding *bond, struct slave *slave)
1522 res = alb_set_slave_mac_addr(slave, slave->perm_hwaddr,
1533 res = alb_handle_addr_collision_on_attach(bond, slave);
1541 tlb_init_slave(slave);
1554 * Remove slave from tlb and rlb hash tables, and fix up MAC addresses
1559 void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave)
1562 alb_change_hw_addr_on_detach(bond, slave);
1565 tlb_clear_slave(bond, slave, 0);
1569 rlb_clear_slave(bond, slave);
1574 void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link)
1579 tlb_clear_slave(bond, slave, 0);
1581 rlb_clear_slave(bond, slave);
1600 * @new_slave: new slave to assign
1612 void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave)
1618 struct slave *swap_slave;
1642 struct slave *tmp_slave;
1643 /* find slave that is holding the bond's mac address */
1698 struct slave *slave, *swap_slave;
1723 bond_for_each_slave(bond, slave, i) {
1724 if (!compare_ether_addr_64bits(slave->dev->dev_addr,
1726 swap_slave = slave;