• 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

20  *	the first slave bonded to the channel.  All slaves will then use
27 * will attach eth0 to bond0 as a slave. eth0 hw mac address will either
139 MODULE_PARM_DESC(primary_reselect, "Reselect primary slave "
144 "2 for only on active slave "
351 * Searches the slave list. Returns 1 if a vlan challenged slave
358 struct slave *slave;
361 bond_for_each_slave(bond, slave, i) {
362 if (slave->dev->features & NETIF_F_VLAN_CHALLENGED) {
363 pr_debug("found VLAN challenged slave - %s\n",
364 slave->dev->name);
413 * @slave_dev: slave that is supposed to xmit this skbuff
417 * needs to relay this skb to a slave that is not
463 * and bond_vlan_rx_kill_vid, We don't protect the slave list iteration with a
488 struct slave *slave;
495 bond_for_each_slave(bond, slave, i) {
496 struct net_device *slave_dev = slave->dev;
514 struct slave *slave;
517 bond_for_each_slave(bond, slave, i) {
518 struct net_device *slave_dev = slave->dev;
542 struct slave *slave;
546 bond_for_each_slave(bond, slave, i) {
547 struct net_device *slave_dev = slave->dev;
553 * since the slave's driver might clear it.
606 * since the slave's driver might clear it.
630 struct slave *slave;
639 bond_for_each_slave(bond, slave, i) {
640 if (slave->link == BOND_LINK_UP) {
658 * Get link speed and duplex from the slave's base driver
663 static int bond_update_speed_duplex(struct slave *slave)
665 struct net_device *slave_dev = slave->dev;
670 slave->speed = SPEED_100;
671 slave->duplex = DUPLEX_FULL;
698 slave->speed = etool.speed;
699 slave->duplex = etool.duplex;
794 struct slave *slave;
796 bond_for_each_slave(bond, slave, i) {
797 err = dev_set_promiscuity(slave->dev, inc);
818 struct slave *slave;
820 bond_for_each_slave(bond, slave, i) {
821 err = dev_set_allmulti(slave->dev, inc);
840 struct slave *slave;
843 bond_for_each_slave(bond, slave, i)
844 dev_mc_add(slave->dev, addr);
849 * Remove a multicast address from slave
859 struct slave *slave;
861 bond_for_each_slave(bond, slave, i) {
862 dev_mc_del(slave->dev, addr);
871 * slave.
908 /*--------------------------- Active slave change ---------------------------*/
915 static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
916 struct slave *old_active)
958 struct slave *new_active,
959 struct slave *old_active)
978 * if just old_active, do nothing (going to no active slave)
999 pr_err("%s: Error %d setting MAC of slave %s\n",
1012 pr_err("%s: Error %d setting MAC of slave %s\n",
1028 struct slave *prim = bond->primary_slave;
1029 struct slave *curr = bond->curr_active_slave;
1047 * find_best_interface - select the best available slave to be the active one
1052 static struct slave *bond_find_best_slave(struct bonding *bond)
1054 struct slave *new_active, *old_active;
1055 struct slave *bestslave = NULL;
1062 if (bond->slave_cnt > 0) /* found one slave */
1065 return NULL; /* still no slave, return NULL */
1094 * change_active_interface - change the active slave into the specified one
1096 * @new: the new slave to make the active one
1098 * Set the new slave to the bond's settings and unset them on the old
1103 * because it is apparently the best available slave we have, even though its
1109 void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1111 struct slave *old_active = bond->curr_active_slave;
1189 * bond_select_active_slave - select a new active slave, if needed
1195 * - A slave has got its link back and there's no old curr_active_slave.
1201 struct slave *best_slave;
1221 /*--------------------------- slave list handling ---------------------------*/
1224 * This function attaches the slave to the end of list.
1228 static void bond_attach_slave(struct bonding *bond, struct slave *new_slave)
1230 if (bond->first_slave == NULL) { /* attaching the first slave */
1245 * This function detaches the slave from the list.
1246 * WARNING: no check is made to verify if the slave effectively
1249 * If any slave pointer in bond was pointing to <slave>,
1254 static void bond_detach_slave(struct bonding *bond, struct slave *slave)
1256 if (slave->next)
1257 slave->next->prev = slave->prev;
1259 if (slave->prev)
1260 slave->prev->next = slave->next;
1262 if (bond->first_slave == slave) { /* slave is the first slave */
1263 if (bond->slave_cnt > 1) { /* there are more slave */
1264 bond->first_slave = slave->next;
1266 bond->first_slave = NULL; /* slave was the last one */
1270 slave->next = NULL;
1271 slave->prev = NULL;
1282 struct slave *slave;
1286 bond_for_each_slave(bond, slave, i) {
1287 if ((slave->dev->priv_flags & IFF_DISABLE_NETPOLL) ||
1288 !slave->dev->netdev_ops->ndo_poll_controller)
1304 struct slave *slave;
1310 bond_for_each_slave(bond, slave, i) {
1311 if (slave->dev) {
1312 ops = slave->dev->netdev_ops;
1314 ops->ndo_netpoll_cleanup(slave->dev);
1316 slave->dev->npinfo = NULL;
1353 struct slave *slave;
1370 bond_for_each_slave(bond, slave, i) {
1372 slave->dev->features,
1375 slave->dev->vlan_features,
1377 if (slave->dev->hard_header_len > max_hard_header_len)
1378 max_hard_header_len = slave->dev->hard_header_len;
1406 /* enslave device <slave> to bond device <master> */
1411 struct slave *new_slave = NULL;
1441 pr_err("%s: Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n",
1445 pr_warning("%s: Warning: enslaved VLAN challenged slave %s. Adding VLANs will be blocked as long as %s is part of bond %s\n",
1453 /* First slave, and it is not VLAN challenged,
1462 * be identified with moderate accuracy by the state of the slave:
1473 /* set bonding device ether type by slave - bonding netdevices are
1474 * created with ether_setup, so when the slave type is not ARPHRD_ETHER
1518 pr_warning("%s: Warning: The first slave device specified does not support setting the MAC address. Setting fail_over_mac to active.",
1522 pr_err("%s: Error: The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active.\n",
1529 /* If this is the first slave, then we need to set the master's hardware
1530 * address to be the same as the slave's. */
1536 new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL);
1548 /* Save slave's original mtu and then set it to match the bond */
1557 * Save slave's original ("permanent") mac address for modes
1565 * Set slave to master's mac address. The application already
1566 * set the master's mac address to that of the first slave
1582 /* open the slave since the application closed it */
1585 pr_debug("Opening slave %s failed\n", slave_dev->name);
1601 /* If the mode USES_PRIMARY, then the new slave gets the
1607 /* set promiscuity level to new slave */
1614 /* set allmulti level to new slave */
1622 /* upload master's mc_list to new slave */
1703 /* if there is a primary slave, remember it */
1723 /* if this is the first slave */
1745 pr_debug("This slave is always active in trunk mode\n");
1778 pr_info("New slave device %s does not support netpoll\n",
1825 * Try to release the slave device <slave> from the bond device <master>
1829 * The rules for slave state should be:
1838 struct slave *slave, *oldcurrent;
1841 /* slave is not a slave or master is not master of this slave */
1852 slave = bond_get_slave_by_dev(bond, slave_dev);
1853 if (!slave) {
1854 /* not a slave of this bond */
1862 if (!compare_ether_addr(bond_dev->dev_addr, slave->perm_hwaddr) &&
1866 slave->perm_hwaddr,
1870 /* Inform AD package of unbinding of slave. */
1872 /* must be called before the slave is
1875 bond_3ad_unbind_slave(slave);
1880 (slave->state == BOND_STATE_ACTIVE) ? "active" : "backup",
1887 /* release the slave from its bond */
1888 bond_detach_slave(bond, slave);
1892 if (bond->primary_slave == slave)
1895 if (oldcurrent == slave)
1899 /* Must be called only after the slave has been
1902 * but before a new active slave is selected.
1905 bond_alb_deinit_slave(bond, slave);
1909 if (oldcurrent == slave) {
1912 * is no concern that another slave add/remove event
1929 /* if the last slave was removed, zero the mac address
1931 * to the mac address of the first slave
1945 pr_info("%s: last VLAN challenged slave %s left bond %s. VLAN blocking is removed\n",
1959 * already taken care of above when we detached the slave
1962 /* unset promiscuity level from slave */
1966 /* unset allmulti level from slave */
1970 /* flush master's mc_list from slave */
1992 /* close slave before restoring its mac address */
1997 memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN);
2002 dev_set_mtu(slave_dev, slave->original_mtu);
2008 kfree(slave);
2014 * First release a slave and than destroy the bond if no more slaves are left.
2038 struct slave *slave;
2053 while ((slave = bond->first_slave) != NULL) {
2054 /* Inform AD package of unbinding of slave
2055 * before slave is detached from the list.
2058 bond_3ad_unbind_slave(slave);
2060 slave_dev = slave->dev;
2061 bond_detach_slave(bond, slave);
2063 /* now that the slave is detached, unlock and perform
2070 /* must be called only after the slave
2073 bond_alb_deinit_slave(bond, slave);
2083 * already taken care of above when we detached the slave
2086 /* unset promiscuity level from slave */
2090 /* unset allmulti level from slave */
2094 /* flush master's mc_list from slave */
2102 /* close slave before restoring its mac address */
2107 memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN);
2115 kfree(slave);
2117 /* re-acquire the lock before getting the next slave */
2123 * first slave
2145 * This function changes the active slave to slave <slave_dev>.
2148 * - There is not active slave now.
2158 struct slave *old_active = NULL;
2159 struct slave *new_active = NULL;
2217 struct slave *slave;
2222 bond_for_each_slave(bond, slave, i) {
2225 strcpy(info->slave_name, slave->dev->name);
2226 info->link = slave->link;
2227 info->state = slave->state;
2228 info->link_failure_count = slave->link_failure_count;
2243 struct slave *slave;
2249 bond_for_each_slave(bond, slave, i) {
2250 slave->new_link = BOND_LINK_NOCHANGE;
2252 link_state = bond_check_dev_link(bond, slave->dev, 0);
2254 switch (slave->link) {
2259 slave->link = BOND_LINK_FAIL;
2260 slave->delay = bond->params.downdelay;
2261 if (slave->delay) {
2266 ((slave->state == BOND_STATE_ACTIVE) ?
2268 slave->dev->name,
2277 slave->link = BOND_LINK_UP;
2278 slave->jiffies = jiffies;
2281 (bond->params.downdelay - slave->delay) *
2283 slave->dev->name);
2287 if (slave->delay <= 0) {
2288 slave->new_link = BOND_LINK_DOWN;
2293 slave->delay--;
2300 slave->link = BOND_LINK_BACK;
2301 slave->delay = bond->params.updelay;
2303 if (slave->delay) {
2305 bond->dev->name, slave->dev->name,
2313 slave->link = BOND_LINK_DOWN;
2316 (bond->params.updelay - slave->delay) *
2318 slave->dev->name);
2324 slave->delay = 0;
2326 if (slave->delay <= 0) {
2327 slave->new_link = BOND_LINK_UP;
2333 slave->delay--;
2343 struct slave *slave;
2346 bond_for_each_slave(bond, slave, i) {
2347 switch (slave->new_link) {
2352 slave->link = BOND_LINK_UP;
2353 slave->jiffies = jiffies;
2357 slave->state = BOND_STATE_BACKUP;
2360 slave->state = BOND_STATE_ACTIVE;
2361 } else if (slave != bond->primary_slave) {
2363 slave->state = BOND_STATE_BACKUP;
2367 bond->dev->name, slave->dev->name);
2371 bond_3ad_handle_link_change(slave, BOND_LINK_UP);
2374 bond_alb_handle_link_change(bond, slave,
2378 (slave == bond->primary_slave))
2384 if (slave->link_failure_count < UINT_MAX)
2385 slave->link_failure_count++;
2387 slave->link = BOND_LINK_DOWN;
2391 bond_set_slave_inactive_flags(slave);
2394 bond->dev->name, slave->dev->name);
2397 bond_3ad_handle_link_change(slave,
2401 bond_alb_handle_link_change(bond, slave,
2404 if (slave == bond->curr_active_slave)
2410 pr_err("%s: invalid new link %d on slave %s\n",
2411 bond->dev->name, slave->new_link,
2412 slave->dev->name);
2413 slave->new_link = BOND_LINK_NOCHANGE;
2528 pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op,
2549 static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2564 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
2593 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
2611 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
2633 struct slave *slave = bond->curr_active_slave;
2637 pr_debug("bond_send_grat_arp: bond %s slave %s\n",
2638 bond->dev->name, slave ? slave->dev->name : "NULL");
2640 if (!slave || !bond->send_grat_arp ||
2641 test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
2647 bond_arp_send(slave->dev, ARPOP_REPLY, bond->master_ip,
2657 bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip,
2663 static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 sip, __be32 tip)
2674 slave->last_arp_rx = jiffies;
2683 struct slave *slave;
2709 slave = bond_get_slave_by_dev(bond, orig_dev);
2710 if (!slave || !slave_do_arp_validate(bond, slave))
2732 bond->dev->name, slave->dev->name, slave->state,
2733 bond->params.arp_validate, slave_do_arp_validate(bond, slave),
2744 if (slave->state == BOND_STATE_ACTIVE)
2745 bond_validate_arp(bond, slave, sip, tip);
2747 bond_validate_arp(bond, slave, tip, sip);
2757 * this function is called regularly to monitor each slave's link
2767 struct slave *slave, *oldcurrent;
2788 * the picture unless it is null. also, slave->jiffies is not needed
2789 * here because we send an arp on each slave and give a slave as
2794 bond_for_each_slave(bond, slave, i) {
2795 unsigned long trans_start = dev_trans_start(slave->dev);
2797 if (slave->link != BOND_LINK_UP) {
2802 slave->dev->last_rx - delta_in_ticks,
2803 slave->dev->last_rx + delta_in_ticks)) {
2805 slave->link = BOND_LINK_UP;
2806 slave->state = BOND_STATE_ACTIVE;
2809 * mode. the window of a slave being up and
2816 slave->dev->name);
2821 slave->dev->name);
2825 /* slave->link == BOND_LINK_UP */
2835 slave->dev->last_rx - delta_in_ticks,
2836 slave->dev->last_rx + 2 * delta_in_ticks)) {
2838 slave->link = BOND_LINK_DOWN;
2839 slave->state = BOND_STATE_BACKUP;
2841 if (slave->link_failure_count < UINT_MAX)
2842 slave->link_failure_count++;
2846 slave->dev->name);
2848 if (slave == oldcurrent)
2860 if (IS_UP(slave->dev))
2861 bond_arp_send_all(bond, slave);
2882 * place for the slave. Returns 0 if no changes are found, >0 if changes
2889 struct slave *slave;
2893 bond_for_each_slave(bond, slave, i) {
2894 slave->new_link = BOND_LINK_NOCHANGE;
2896 if (slave->link != BOND_LINK_UP) {
2898 slave_last_rx(bond, slave) - delta_in_ticks,
2899 slave_last_rx(bond, slave) + delta_in_ticks)) {
2901 slave->new_link = BOND_LINK_UP;
2914 slave->jiffies - delta_in_ticks,
2915 slave->jiffies + 2 * delta_in_ticks))
2919 * Backup slave is down if:
2928 * gives each slave a chance to tx/rx traffic
2931 if (slave->state == BOND_STATE_BACKUP &&
2934 slave_last_rx(bond, slave) - delta_in_ticks,
2935 slave_last_rx(bond, slave) + 3 * delta_in_ticks)) {
2937 slave->new_link = BOND_LINK_DOWN;
2942 * Active slave is down if:
2947 trans_start = dev_trans_start(slave->dev);
2948 if ((slave->state == BOND_STATE_ACTIVE) &&
2953 slave_last_rx(bond, slave) - delta_in_ticks,
2954 slave_last_rx(bond, slave) + 2 * delta_in_ticks))) {
2956 slave->new_link = BOND_LINK_DOWN;
2972 struct slave *slave;
2976 bond_for_each_slave(bond, slave, i) {
2977 switch (slave->new_link) {
2982 trans_start = dev_trans_start(slave->dev);
2987 bond->curr_active_slave != slave) {
2988 slave->link = BOND_LINK_UP;
2992 bond->dev->name, slave->dev->name);
2995 (slave == bond->primary_slave))
3003 if (slave->link_failure_count < UINT_MAX)
3004 slave->link_failure_count++;
3006 slave->link = BOND_LINK_DOWN;
3007 bond_set_slave_inactive_flags(slave);
3010 bond->dev->name, slave->dev->name);
3012 if (slave == bond->curr_active_slave) {
3020 pr_err("%s: impossible: new_link %d on slave %s\n",
3021 bond->dev->name, slave->new_link,
3022 slave->dev->name);
3043 struct slave *slave;
3062 * backup slave from the current_arp_slave and make it the candidate
3075 bond_for_each_slave_from(bond, slave, i, bond->current_arp_slave->next) {
3076 if (IS_UP(slave->dev)) {
3077 slave->link = BOND_LINK_BACK;
3078 bond_set_slave_active_flags(slave);
3079 bond_arp_send_all(bond, slave);
3080 slave->jiffies = jiffies;
3081 bond->current_arp_slave = slave;
3089 * one the current slave so it is still marked
3092 if (slave->link == BOND_LINK_UP) {
3093 slave->link = BOND_LINK_DOWN;
3094 if (slave->link_failure_count < UINT_MAX)
3095 slave->link_failure_count++;
3097 bond_set_slave_inactive_flags(slave);
3100 bond->dev->name, slave->dev->name);
3164 struct slave *slave;
3174 bond_for_each_slave(bond, slave, i) {
3176 return slave;
3185 struct slave *slave = v;
3191 slave = slave->next;
3193 return (slave == bond->first_slave) ? NULL : slave;
3209 struct slave *curr;
3303 const struct slave *slave)
3307 seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name);
3309 (slave->link == BOND_LINK_UP) ? "up" : "down");
3311 slave->link_failure_count);
3313 seq_printf(seq, "Permanent HW addr: %pM\n", slave->perm_hwaddr);
3317 = SLAVE_AD_INFO(slave).port.aggregator;
3325 seq_printf(seq, "Slave queue ID: %d\n", slave->queue_id);
3490 struct slave *slave;
3492 slave = bond_get_slave_by_dev(bond, slave_dev);
3493 if (slave) {
3494 u16 old_speed = slave->speed;
3495 u16 old_duplex = slave->duplex;
3497 bond_update_speed_duplex(slave);
3502 if (old_speed != slave->speed)
3503 bond_3ad_adapter_speed_changed(slave);
3504 if (old_duplex != slave->duplex)
3505 bond_3ad_adapter_duplex_changed(slave);
3524 * take over the slave's change_mtu
3549 * locks for us to safely manipulate the slave devices (RTNL lock,
3842 struct slave *slave;
3849 bond_for_each_slave(bond, slave, i) {
3851 dev_get_stats(slave->dev, &temp);
4067 struct slave *slave = bond->first_slave;
4069 if (slave) {
4071 = slave->dev->netdev_ops;
4073 return slave_ops->ndo_neigh_setup(slave->dev, parms);
4084 struct slave *slave, *stop_at;
4097 * of setting the slave's MTU while it is
4106 bond_for_each_slave(bond, slave, i) {
4108 slave,
4109 slave->prev,
4110 slave->dev->netdev_ops->ndo_change_mtu);
4112 res = dev_set_mtu(slave->dev, new_mtu);
4115 /* If we failed to set the slave's mtu to the new value
4118 * different mtu values than the active slave we'll
4123 pr_debug("err %d %s\n", res, slave->dev->name);
4133 /* unwind from head to the slave that failed */
4134 stop_at = slave;
4135 bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) {
4138 tmp_res = dev_set_mtu(slave->dev, bond_dev->mtu);
4141 tmp_res, slave->dev->name);
4159 struct slave *slave, *stop_at;
4186 * of setting the slave's hw address while it is
4195 bond_for_each_slave(bond, slave, i) {
4196 const struct net_device_ops *slave_ops = slave->dev->netdev_ops;
4197 pr_debug("slave %p %s\n", slave, slave->dev->name);
4201 pr_debug("EOPNOTSUPP %s\n", slave->dev->name);
4205 res = dev_set_mac_address(slave->dev, addr);
4207 /* TODO: consider downing the slave
4213 pr_debug("err %d %s\n", res, slave->dev->name);
4226 /* unwind from head to the slave that failed */
4227 stop_at = slave;
4228 bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) {
4231 tmp_res = dev_set_mac_address(slave->dev, &tmp_sa);
4234 tmp_res, slave->dev->name);
4244 struct slave *slave, *start_at;
4263 slave = bond->curr_active_slave;
4266 if (!slave)
4276 bond_for_each_slave(bond, slave, i) {
4283 start_at = slave;
4284 bond_for_each_slave_from(bond, slave, i, start_at) {
4285 if (IS_UP(slave->dev) &&
4286 (slave->link == BOND_LINK_UP) &&
4287 (slave->state == BOND_STATE_ACTIVE)) {
4288 res = bond_dev_queue_xmit(bond, skb, slave->dev);
4336 * find the next active slave.
4341 struct slave *slave, *start_at;
4353 bond_for_each_slave(bond, slave, i) {
4359 start_at = slave;
4361 bond_for_each_slave_from(bond, slave, i, start_at) {
4362 if (IS_UP(slave->dev) &&
4363 (slave->link == BOND_LINK_UP) &&
4364 (slave->state == BOND_STATE_ACTIVE)) {
4365 res = bond_dev_queue_xmit(bond, skb, slave->dev);
4385 struct slave *slave, *start_at;
4402 bond_for_each_slave_from(bond, slave, i, start_at) {
4403 if (IS_UP(slave->dev) &&
4404 (slave->link == BOND_LINK_UP) &&
4405 (slave->state == BOND_STATE_ACTIVE)) {
4420 tx_dev = slave->dev;
4456 * Lookup the slave that corresponds to a qid
4462 struct slave *slave = NULL;
4463 struct slave *check_slave;
4473 slave = check_slave;
4478 /* If the slave isn't UP, use default transmit policy. */
4479 if (slave && slave->queue_id && IS_UP(slave->dev) &&
4480 (slave->link == BOND_LINK_UP)) {
4481 res = bond_dev_queue_xmit(bond, skb, slave->dev);