diff -Nuarp a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt --- a/Documentation/networking/bonding.txt Sun Dec 21 16:08:52 2003 +++ b/Documentation/networking/bonding.txt Sun Dec 21 16:08:53 2003 @@ -363,9 +363,9 @@ mode 2. Base driver support for setting the hw address of a device also when it is open. This is required so that there will always be one slave in the team using the bond hw - address (the current_slave) while having a unique hw - address for each slave in the bond. If the current_slave - fails it's hw address is swapped with the new current_slave + address (the curr_active_slave) while having a unique hw + address for each slave in the bond. If the curr_active_slave + fails it's hw address is swapped with the new curr_active_slave that was chosen. primary diff -Nuarp a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c --- a/drivers/net/bonding/bond_3ad.c Sun Dec 21 16:08:52 2003 +++ b/drivers/net/bonding/bond_3ad.c Sun Dec 21 16:08:53 2003 @@ -1890,13 +1890,13 @@ static u16 aggregator_identifier; void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution, int lacp_fast) { // check that the bond is not initialized yet - if (MAC_ADDRESS_COMPARE(&(BOND_AD_INFO(bond).system.sys_mac_addr), &(bond->device->dev_addr))) { + if (MAC_ADDRESS_COMPARE(&(BOND_AD_INFO(bond).system.sys_mac_addr), &(bond->dev->dev_addr))) { aggregator_identifier = 0; BOND_AD_INFO(bond).lacp_fast = lacp_fast; BOND_AD_INFO(bond).system.sys_priority = 0xFFFF; - BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->device->dev_addr); + BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr); // initialize how many times this module is called in one second(should be about every 100ms) ad_ticks_per_sec = tick_resolution; @@ -1964,7 +1964,7 @@ int bond_3ad_bind_slave(struct slave *sl ad_initialize_agg(aggregator); - aggregator->aggregator_mac_address = *((struct mac_addr *)bond->device->dev_addr); + aggregator->aggregator_mac_address = *((struct mac_addr *)bond->dev->dev_addr); aggregator->aggregator_identifier = (++aggregator_identifier); aggregator->slave = slave; aggregator->is_active = 0; @@ -2399,7 +2399,7 @@ int bond_3ad_xmit_xor(struct sk_buff *sk return 0; } - slave_agg_no = (data->h_dest[5]^bond->device->dev_addr[5]) % slaves_in_agg; + slave_agg_no = (data->h_dest[5]^bond->dev->dev_addr[5]) % slaves_in_agg; bond_for_each_slave(bond, slave, i) { struct aggregator *agg = SLAVE_AD_INFO(slave).port.aggregator; diff -Nuarp a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c --- a/drivers/net/bonding/bond_alb.c Sun Dec 21 16:08:52 2003 +++ b/drivers/net/bonding/bond_alb.c Sun Dec 21 16:08:53 2003 @@ -191,7 +191,7 @@ static int tlb_initialize(struct bonding if (bond_info->tx_hashtbl == NULL) { printk(KERN_ERR DRV_NAME ": Error: %s: Failed to allocate TLB hash table\n", - bond->device->name); + bond->dev->name); _unlock_tx_hashtbl(bond); return -1; } @@ -401,20 +401,20 @@ static struct slave *rlb_next_rx_slave(s /* teach the switch the mac of a disabled slave * on the primary for fault tolerance * - * Caller must hold bond->ptrlock for write or bond lock for write + * Caller must hold bond->curr_slave_lock for write or bond lock for write */ static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[]) { - if (!bond->current_slave) { + if (!bond->curr_active_slave) { return; } if (!bond->alb_info.primary_is_promisc) { bond->alb_info.primary_is_promisc = 1; - dev_set_promiscuity(bond->current_slave->dev, 1); + dev_set_promiscuity(bond->curr_active_slave->dev, 1); } bond->alb_info.rlb_promisc_timeout_counter = 0; - alb_send_learning_packets(bond->current_slave, addr); + alb_send_learning_packets(bond->curr_active_slave, addr); } /* slave being removed should not be active at this point @@ -463,11 +463,11 @@ static void rlb_clear_slave(struct bondi _unlock_rx_hashtbl(bond); - write_lock(&bond->ptrlock); - if (slave != bond->current_slave) { + write_lock(&bond->curr_slave_lock); + if (slave != bond->curr_active_slave) { rlb_teach_disabled_mac_on_primary(bond, slave->dev->dev_addr); } - write_unlock(&bond->ptrlock); + write_unlock(&bond->curr_slave_lock); } static void rlb_update_client(struct rlb_client_info *client_info) @@ -570,12 +570,12 @@ static void rlb_req_update_subnet_client continue; } /*update all clients using this src_ip, that are not assigned - * to the team's address (current_slave) and have a known + * to the team's address (curr_active_slave) and have a known * unicast mac address. */ if ((client_info->ip_src == src_ip) && memcmp(client_info->slave->dev->dev_addr, - bond->device->dev_addr, ETH_ALEN) && + bond->dev->dev_addr, ETH_ALEN) && memcmp(client_info->mac_dst, mac_bcast, ETH_ALEN)) { client_info->ntt = 1; bond_info->rx_ntt = 1; @@ -616,12 +616,12 @@ struct slave *rlb_choose_channel(struct } } else { /* the entry is already assigned to some other client, - * move the old client to primary (current_slave) so + * move the old client to primary (curr_active_slave) so * that the new client can be assigned to this entry. */ - if (bond->current_slave && - client_info->slave != bond->current_slave) { - client_info->slave = bond->current_slave; + if (bond->curr_active_slave && + client_info->slave != bond->curr_active_slave) { + client_info->slave = bond->curr_active_slave; rlb_update_client(client_info); } } @@ -666,7 +666,7 @@ struct slave *rlb_choose_channel(struct /* chooses (and returns) transmit channel for arp reply * does not choose channel for other arp types since they are - * sent on the current_slave + * sent on the curr_active_slave */ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) { @@ -761,7 +761,7 @@ static int rlb_initialize(struct bonding if (bond_info->rx_hashtbl == NULL) { printk(KERN_ERR DRV_NAME ": Error: %s: Failed to allocate RLB hash table\n", - bond->device->name); + bond->dev->name); _unlock_rx_hashtbl(bond); return -1; } @@ -775,7 +775,7 @@ static int rlb_initialize(struct bonding /*initialize packet type*/ pk_type->type = __constant_htons(ETH_P_ARP); - pk_type->dev = bond->device; + pk_type->dev = bond->dev; pk_type->func = rlb_arp_recv; pk_type->data = (void*)1; /* understand shared skbs */ @@ -861,7 +861,7 @@ static int alb_set_slave_mac_addr(struct return 0; } -/* Caller must hold bond lock for write or ptrlock for write*/ +/* Caller must hold bond lock for write or curr_slave_lock for write*/ static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct slave *slave2) { struct slave *disabled_slave = NULL; @@ -933,7 +933,7 @@ static void alb_change_hw_addr_on_detach slave->dev->dev_addr, ETH_ALEN); perm_bond_diff = memcmp(slave->perm_hwaddr, - bond->device->dev_addr, + bond->dev->dev_addr, ETH_ALEN); if (perm_curr_diff && perm_bond_diff) { bond_for_each_slave(bond, tmp_slave, i) { @@ -990,7 +990,7 @@ static int alb_handle_addr_collision_on_ * check uniqueness of slave's mac address against the other * slaves in the bond. */ - if (memcmp(slave->perm_hwaddr, bond->device->dev_addr, ETH_ALEN)) { + if (memcmp(slave->perm_hwaddr, bond->dev->dev_addr, ETH_ALEN)) { bond_for_each_slave(bond, tmp_slave1, i) { if (!memcmp(tmp_slave1->dev->dev_addr, slave->dev->dev_addr, ETH_ALEN)) { @@ -1104,8 +1104,8 @@ static int alb_set_mac_address(struct bo return 0; unwind: - memcpy(sa.sa_data, bond->device->dev_addr, bond->device->addr_len); - sa.sa_family = bond->device->type; + memcpy(sa.sa_data, bond->dev->dev_addr, bond->dev->addr_len); + sa.sa_family = bond->dev->type; /* unwind from head to the slave that failed */ stop_at = slave; @@ -1170,7 +1170,7 @@ int bond_alb_xmit(struct sk_buff *skb, s return 0; } - /* make sure that the current_slave and the slaves list do + /* make sure that the curr_active_slave and the slaves list do * not change during tx */ read_lock(&bond->lock); @@ -1182,7 +1182,7 @@ int bond_alb_xmit(struct sk_buff *skb, s return 0; } - read_lock(&bond->ptrlock); + read_lock(&bond->curr_slave_lock); switch (ntohs(skb->protocol)) { case ETH_P_IP: @@ -1246,13 +1246,13 @@ int bond_alb_xmit(struct sk_buff *skb, s if (!tx_slave) { /* unbalanced or unassigned, send through primary */ - tx_slave = bond->current_slave; + tx_slave = bond->curr_active_slave; bond_info->unbalanced_load += skb->len; } if (tx_slave && SLAVE_IS_OK(tx_slave)) { skb->dev = tx_slave->dev; - if (tx_slave != bond->current_slave) { + if (tx_slave != bond->curr_active_slave) { memcpy(eth_data->h_source, tx_slave->dev->dev_addr, ETH_ALEN); @@ -1266,7 +1266,7 @@ int bond_alb_xmit(struct sk_buff *skb, s dev_kfree_skb(skb); } - read_unlock(&bond->ptrlock); + read_unlock(&bond->curr_slave_lock); read_unlock(&bond->lock); return 0; } @@ -1295,44 +1295,44 @@ void bond_alb_monitor(struct bonding *bo /* send learning packets */ if (bond_info->lp_counter >= BOND_ALB_LP_TICKS) { - /* change of current_slave involves swapping of mac addresses. + /* change of curr_active_slave involves swapping of mac addresses. * in order to avoid this swapping from happening while - * sending the learning packets, the ptrlock must be held for + * sending the learning packets, the curr_slave_lock must be held for * read. */ - read_lock(&bond->ptrlock); + read_lock(&bond->curr_slave_lock); bond_for_each_slave(bond, slave, i) { alb_send_learning_packets(slave,slave->dev->dev_addr); } - read_unlock(&bond->ptrlock); + read_unlock(&bond->curr_slave_lock); bond_info->lp_counter = 0; } /* rebalance tx traffic */ if (bond_info->tx_rebalance_counter >= BOND_TLB_REBALANCE_TICKS) { - read_lock(&bond->ptrlock); + read_lock(&bond->curr_slave_lock); bond_for_each_slave(bond, slave, i) { tlb_clear_slave(bond, slave, 1); - if (slave == bond->current_slave) { + if (slave == bond->curr_active_slave) { SLAVE_TLB_INFO(slave).load = bond_info->unbalanced_load / BOND_TLB_REBALANCE_INTERVAL; bond_info->unbalanced_load = 0; } } - read_unlock(&bond->ptrlock); + read_unlock(&bond->curr_slave_lock); bond_info->tx_rebalance_counter = 0; } /* handle rlb stuff */ if (bond_info->rlb_enabled) { /* the following code changes the promiscuity of the - * the current_slave. It needs to be locked with a + * the curr_active_slave. It needs to be locked with a * write lock to protect from other code that also * sets the promiscuity. */ - write_lock(&bond->ptrlock); + write_lock(&bond->curr_slave_lock); if (bond_info->primary_is_promisc && (++bond_info->rlb_promisc_timeout_counter >= RLB_PROMISC_TIMEOUT)) { @@ -1343,10 +1343,10 @@ void bond_alb_monitor(struct bonding *bo * because a slave was disabled then * it can now leave promiscuous mode. */ - dev_set_promiscuity(bond->current_slave->dev, -1); + dev_set_promiscuity(bond->curr_active_slave->dev, -1); bond_info->primary_is_promisc = 0; } - write_unlock(&bond->ptrlock); + write_unlock(&bond->curr_slave_lock); if (bond_info->rlb_rebalance == 1) { bond_info->rlb_rebalance = 0; @@ -1374,7 +1374,7 @@ out: read_unlock(&bond->lock); } -/* assumption: called before the slave is attched to the bond +/* assumption: called before the slave is attached to the bond * and not locked by the bond lock */ int bond_alb_init_slave(struct bonding *bond, struct slave *slave) @@ -1452,61 +1452,61 @@ void bond_alb_handle_link_change(struct } /** - * bond_alb_handle_active_change - assign new current_slave + * bond_alb_handle_active_change - assign new curr_active_slave * @bond: our bonding struct * @new_slave: new slave to assign * - * Set the bond->current_slave to @new_slave and handle + * Set the bond->curr_active_slave to @new_slave and handle * mac address swapping and promiscuity changes as needed. * - * Caller must hold bond ptrlock for write (or bond lock for write) + * Caller must hold bond curr_slave_lock for write (or bond lock for write) */ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave) { struct slave *swap_slave; int i, found = 0; - if (bond->current_slave == new_slave) { + if (bond->curr_active_slave == new_slave) { return; } - if (bond->current_slave && bond->alb_info.primary_is_promisc) { - dev_set_promiscuity(bond->current_slave->dev, -1); + if (bond->curr_active_slave && bond->alb_info.primary_is_promisc) { + dev_set_promiscuity(bond->curr_active_slave->dev, -1); bond->alb_info.primary_is_promisc = 0; bond->alb_info.rlb_promisc_timeout_counter = 0; } - swap_slave = bond->current_slave; - bond->current_slave = new_slave; + swap_slave = bond->curr_active_slave; + bond->curr_active_slave = new_slave; if (!new_slave || (bond->slave_cnt == 0)) { return; } - /* set the new current_slave to the bonds mac address - * i.e. swap mac addresses of old current_slave and new current_slave + /* set the new curr_active_slave to the bonds mac address + * i.e. swap mac addresses of old curr_active_slave and new curr_active_slave */ if (!swap_slave) { /* find slave that is holding the bond's mac address */ bond_for_each_slave(bond, swap_slave, i) { if (!memcmp(swap_slave->dev->dev_addr, - bond->device->dev_addr, ETH_ALEN)) { + bond->dev->dev_addr, ETH_ALEN)) { found = 1; break; } } } - /* current_slave must be set before calling alb_swap_mac_addr */ + /* curr_active_slave must be set before calling alb_swap_mac_addr */ if (found) { /* swap mac address */ alb_swap_mac_addr(bond, swap_slave, new_slave); } else { /* set the new_slave to the bond mac address */ - alb_set_slave_mac_addr(new_slave, bond->device->dev_addr, + alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr, bond->alb_info.rlb_enabled); /* fasten bond mac on new current slave */ - alb_send_learning_packets(new_slave, bond->device->dev_addr); + alb_send_learning_packets(new_slave, bond->dev->dev_addr); } } @@ -1529,11 +1529,11 @@ int bond_alb_set_mac_address(struct net_ memcpy(bond_dev->dev_addr, sa->sa_data, bond_dev->addr_len); - /* If there is no current_slave there is nothing else to do. + /* If there is no curr_active_slave there is nothing else to do. * Otherwise we'll need to pass the new address to it and handle * duplications. */ - if (bond->current_slave == NULL) { + if (bond->curr_active_slave == NULL) { return 0; } @@ -1545,15 +1545,15 @@ int bond_alb_set_mac_address(struct net_ } if (found) { - alb_swap_mac_addr(bond, swap_slave, bond->current_slave); + alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave); } else { - alb_set_slave_mac_addr(bond->current_slave, bond_dev->dev_addr, + alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr, bond->alb_info.rlb_enabled); - alb_send_learning_packets(bond->current_slave, bond_dev->dev_addr); + alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr); if (bond->alb_info.rlb_enabled) { /* inform clients mac address has changed */ - rlb_req_update_slave_clients(bond, bond->current_slave); + rlb_req_update_slave_clients(bond, bond->curr_active_slave); } } diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Sun Dec 21 16:08:52 2003 +++ b/drivers/net/bonding/bond_main.c Sun Dec 21 16:08:53 2003 @@ -248,7 +248,7 @@ * * 2002/11/16 - Laurent Deniel * - fix multicast handling in activebackup_arp_monitor - * - remove one unnecessary and confusing current_slave == slave test + * - remove one unnecessary and confusing curr_active_slave == slave test * in activebackup_arp_monitor * * 2002/11/17 - Laurent Deniel @@ -330,7 +330,7 @@ * new/old ifenslave and new/old bonding. * * 2003/05/01 - Shmulik Hen - * - Fixed bug in bond_release_all(): save old value of current_slave + * - Fixed bug in bond_release_all(): save old value of curr_active_slave * before setting it to NULL. * - Changed driver versioning scheme to include version number instead * of release date (that is already in another field). There are 3 @@ -358,7 +358,7 @@ * * 2003/05/01 - Shmulik Hen * - Added support for Transmit load balancing mode. - * - Concentrate all assignments of current_slave to a single point + * - Concentrate all assignments of curr_active_slave to a single point * so specific modes can take actions when the primary adapter is * changed. * - Take the updelay parameter into consideration during bond_enslave @@ -846,7 +846,7 @@ static void bond_register_lacpdu(struct /* initialize packet type */ pk_type->type = PKT_TYPE_LACPDU; - pk_type->dev = bond->device; + pk_type->dev = bond->dev; pk_type->func = bond_3ad_lacpdu_recv; pk_type->data = (void*)1; /* understand shared skbs */ @@ -1018,8 +1018,8 @@ static void bond_mc_add(struct bonding * { if (USES_PRIMARY(bond_mode)) { /* write lock already acquired */ - if (bond->current_slave != NULL) - dev_mc_add(bond->current_slave->dev, addr, alen, 0); + if (bond->curr_active_slave != NULL) + dev_mc_add(bond->curr_active_slave->dev, addr, alen, 0); } else { struct slave *slave; int i; @@ -1037,8 +1037,8 @@ static void bond_mc_delete(struct bondin { if (USES_PRIMARY(bond_mode)) { /* write lock already acquired */ - if (bond->current_slave != NULL) - dev_mc_delete(bond->current_slave->dev, addr, alen, 0); + if (bond->curr_active_slave != NULL) + dev_mc_delete(bond->curr_active_slave->dev, addr, alen, 0); } else { struct slave *slave; int i; @@ -1089,8 +1089,8 @@ static void bond_set_promiscuity(struct { if (USES_PRIMARY(bond_mode)) { /* write lock already acquired */ - if (bond->current_slave) { - dev_set_promiscuity(bond->current_slave->dev, inc); + if (bond->curr_active_slave) { + dev_set_promiscuity(bond->curr_active_slave->dev, inc); } } else { @@ -1109,8 +1109,8 @@ static void bond_set_allmulti(struct bon { if (USES_PRIMARY(bond_mode)) { /* write lock already acquired */ - if (bond->current_slave != NULL) - dev_set_allmulti(bond->current_slave->dev, inc); + if (bond->curr_active_slave != NULL) + dev_set_allmulti(bond->curr_active_slave->dev, inc); } else { struct slave *slave; int i; @@ -1197,25 +1197,25 @@ static void bond_mc_swap(struct bonding } if (old_active) { - if (bond->device->flags & IFF_PROMISC) { + if (bond->dev->flags & IFF_PROMISC) { dev_set_promiscuity(old_active->dev, -1); } - if (bond->device->flags & IFF_ALLMULTI) { + if (bond->dev->flags & IFF_ALLMULTI) { dev_set_allmulti(old_active->dev, -1); } - for (dmi = bond->device->mc_list; dmi != NULL; dmi = dmi->next) { + for (dmi = bond->dev->mc_list; dmi != NULL; dmi = dmi->next) { dev_mc_delete(old_active->dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); } } if (new_active) { - if (bond->device->flags & IFF_PROMISC) { + if (bond->dev->flags & IFF_PROMISC) { dev_set_promiscuity(new_active->dev, 1); } - if (bond->device->flags & IFF_ALLMULTI) { + if (bond->dev->flags & IFF_ALLMULTI) { dev_set_allmulti(new_active->dev, 1); } - for (dmi = bond->device->mc_list; dmi != NULL; dmi = dmi->next) { + for (dmi = bond->dev->mc_list; dmi != NULL; dmi = dmi->next) { dev_mc_add(new_active->dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); } } @@ -1355,7 +1355,7 @@ static int bond_enslave(struct net_devic /* If the mode USES_PRIMARY, then the new slave gets the * master's promisc (and mc) settings only if it becomes the - * current_slave, and that is taken care of later when calling + * curr_active_slave, and that is taken care of later when calling * bond_change_active() */ if (!USES_PRIMARY(bond_mode)) { @@ -1467,11 +1467,11 @@ static int bond_enslave(struct net_devic * interface. The backup interfaces will have their NOARP flag set * because we need them to be completely deaf and not to respond to * any ARP request on the network to avoid fooling a switch. Thus, - * since we guarantee that current_slave always point to the last + * since we guarantee that curr_active_slave always point to the last * usable interface, we just have to verify this interface's flag. */ - if (((bond->current_slave == NULL) - || (bond->current_slave->dev->flags & IFF_NOARP)) + if (((bond->curr_active_slave == NULL) + || (bond->curr_active_slave->dev->flags & IFF_NOARP)) && (new_slave->link != BOND_LINK_DOWN)) { dprintk("This is the first active slave\n"); /* first slave or no active slave yet, and this link @@ -1507,7 +1507,7 @@ static int bond_enslave(struct net_devic case BOND_MODE_TLB: case BOND_MODE_ALB: new_slave->state = BOND_STATE_ACTIVE; - if ((bond->current_slave == NULL) && (new_slave->link != BOND_LINK_DOWN)) { + if ((bond->curr_active_slave == NULL) && (new_slave->link != BOND_LINK_DOWN)) { /* first slave or no active slave yet, and this link * is OK, so make this interface the active one */ @@ -1519,12 +1519,12 @@ static int bond_enslave(struct net_devic /* always active in trunk mode */ new_slave->state = BOND_STATE_ACTIVE; - /* In trunking mode there is little meaning to current_slave + /* In trunking mode there is little meaning to curr_active_slave * anyway (it holds no special properties of the bond device), * so we can change it without calling change_active_interface() */ - if (bond->current_slave == NULL) - bond->current_slave = new_slave; + if (bond->curr_active_slave == NULL) + bond->curr_active_slave = new_slave; break; } /* switch(bond_mode) */ @@ -1616,7 +1616,7 @@ static int bond_ioctl_change_active(stru write_lock_bh(&bond->lock); - old_active = bond->current_slave; + old_active = bond->curr_active_slave; new_active = bond_get_slave_by_dev(bond, slave_dev); /* @@ -1643,7 +1643,7 @@ static int bond_ioctl_change_active(stru * find_best_interface - select the best available slave to be the active one * @bond: our bonding struct * - * Warning: Caller must hold ptrlock for writing. + * Warning: Caller must hold curr_slave_lock for writing. */ static struct slave *bond_find_best_slave(struct bonding *bond) { @@ -1652,7 +1652,7 @@ static struct slave *bond_find_best_slav int mintime; int i; - new_active = old_active = bond->current_slave; + new_active = old_active = bond->curr_active_slave; if (new_active == NULL) { /* there were no active slaves left */ if (bond->slave_cnt > 0) { /* found one slave */ @@ -1665,8 +1665,8 @@ static struct slave *bond_find_best_slav mintime = updelay; /* first try the primary link; if arping, a link must tx/rx traffic - * before it can be considered the current_slave - also, we would skip - * slaves between the current_slave and primary_slave that may be up + * before it can be considered the curr_active_slave - also, we would skip + * slaves between the curr_active_slave and primary_slave that may be up * and able to arp */ if ((bond->primary_slave != NULL) && (arp_interval == 0)) { @@ -1701,18 +1701,18 @@ static struct slave *bond_find_best_slav * @new: the new slave to make the active one * * Set the new slave to the bond's settings and unset them on the old - * current_slave. + * curr_active_slave. * Setting include flags, mc-list, promiscuity, allmulti, etc. * * If @new's link state is %BOND_LINK_BACK we'll set it to %BOND_LINK_UP, * because it is apparently the best available slave we have, even though its * updelay hasn't timed out yet. * - * Warning: Caller must hold ptrlock for writing. + * Warning: Caller must hold curr_slave_lock for writing. */ static void bond_change_active_slave(struct bonding *bond, struct slave *new_active) { - struct slave *old_active = bond->current_slave; + struct slave *old_active = bond->curr_active_slave; if (old_active == new_active) { return; @@ -1724,7 +1724,7 @@ static void bond_change_active_slave(str printk(KERN_INFO DRV_NAME ": %s: making interface %s the new " "active one %d ms earlier.\n", - bond->device->name, new_active->dev->name, + bond->dev->name, new_active->dev->name, (updelay - new_active->delay) * miimon); } @@ -1745,7 +1745,7 @@ static void bond_change_active_slave(str printk(KERN_INFO DRV_NAME ": %s: making interface %s the new " "active one.\n", - bond->device->name, new_active->dev->name); + bond->dev->name, new_active->dev->name); } } } @@ -1768,7 +1768,7 @@ static void bond_change_active_slave(str (bond_mode == BOND_MODE_ALB)) { bond_alb_handle_active_change(bond, new_active); } else { - bond->current_slave = new_active; + bond->curr_active_slave = new_active; } } @@ -1777,11 +1777,11 @@ static void bond_change_active_slave(str * @bond: our bonding struct * * This functions shoud be called when one of the following occurs: - * - The old current_slave has been released or lost its link. + * - The old curr_active_slave has been released or lost its link. * - The primary_slave has got its link back. - * - A slave has got its link back and there's no old current_slave. + * - A slave has got its link back and there's no old curr_active_slave. * - * Warning: Caller must hold ptrlock for writing. + * Warning: Caller must hold curr_slave_lock for writing. */ static void bond_select_active_slave(struct bonding *bond) { @@ -1789,14 +1789,14 @@ static void bond_select_active_slave(str best_slave = bond_find_best_slave(bond); - if (best_slave != bond->current_slave) { + if (best_slave != bond->curr_active_slave) { bond_change_active_slave(bond, best_slave); } } /* * Try to release the slave device from the bond device - * It is legal to access current_slave without a lock because all the function + * It is legal to access curr_active_slave without a lock because all the function * is write-locked. * * The rules for slave state should be: @@ -1832,7 +1832,7 @@ static int bond_release(struct net_devic return -EINVAL; } - mac_addr_differ = memcmp(bond->device->dev_addr, + mac_addr_differ = memcmp(bond_dev->dev_addr, slave->perm_hwaddr, ETH_ALEN); if (!mac_addr_differ && (bond->slave_cnt > 1)) { @@ -1849,7 +1849,7 @@ static int bond_release(struct net_devic slave->perm_hwaddr[3], slave->perm_hwaddr[4], slave->perm_hwaddr[5], - bond->device->name, + bond_dev->name, slave_dev->name); } @@ -1877,12 +1877,12 @@ static int bond_release(struct net_devic bond->primary_slave = NULL; } - if (bond->current_slave == slave) { + if (bond->curr_active_slave == slave) { bond_change_active_slave(bond, NULL); bond_select_active_slave(bond); } - if (bond->current_slave == NULL) { + if (bond->curr_active_slave == NULL) { printk(KERN_INFO DRV_NAME ": %s: now running without any active " "interface !\n", @@ -1892,7 +1892,7 @@ static int bond_release(struct net_devic if ((bond_mode == BOND_MODE_TLB) || (bond_mode == BOND_MODE_ALB)) { /* must be called only after the slave has been - * detached from the list and the current_slave + * detached from the list and the curr_active_slave * has been replaced (if our_slave == old_current) */ bond_alb_deinit_slave(bond, slave); @@ -1901,7 +1901,7 @@ static int bond_release(struct net_devic write_unlock_bh(&bond->lock); /* If the mode USES_PRIMARY, then we should only remove its - * promisc and mc settings if it was the current_slave, but that was + * promisc and mc settings if it was the curr_active_slave, but that was * already taken care of above when we detached the slave */ if (!USES_PRIMARY(bond_mode)) { @@ -1997,7 +1997,7 @@ static int bond_release_all(struct net_d write_unlock_bh(&bond->lock); /* If the mode USES_PRIMARY, then we should only remove its - * promisc and mc settings if it was the current_slave, but that was + * promisc and mc settings if it was the curr_active_slave, but that was * already taken care of above when we detached the slave */ if (!USES_PRIMARY(bond_mode)) { @@ -2080,9 +2080,9 @@ static void bond_mii_monitor(struct net_ * program could monitor the link itself if needed. */ - read_lock(&bond->ptrlock); - oldcurrent = bond->current_slave; - read_unlock(&bond->ptrlock); + read_lock(&bond->curr_slave_lock); + oldcurrent = bond->curr_active_slave; + read_unlock(&bond->curr_slave_lock); bond_for_each_slave(bond, slave, i) { struct net_device *slave_dev = slave->dev; @@ -2267,17 +2267,17 @@ static void bond_mii_monitor(struct net_ } /* end of for */ if (do_failover) { - write_lock(&bond->ptrlock); + write_lock(&bond->curr_slave_lock); bond_select_active_slave(bond); - if (oldcurrent && !bond->current_slave) { + if (oldcurrent && !bond->curr_active_slave) { printk(KERN_INFO DRV_NAME ": %s: now running without any active " "interface !\n", bond_dev->name); } - write_unlock(&bond->ptrlock); + write_unlock(&bond->curr_slave_lock); } re_arm: @@ -2311,12 +2311,12 @@ static void bond_loadbalance_arp_mon(str goto re_arm; } - read_lock(&bond->ptrlock); - oldcurrent = bond->current_slave; - read_unlock(&bond->ptrlock); + read_lock(&bond->curr_slave_lock); + oldcurrent = bond->curr_active_slave; + read_unlock(&bond->curr_slave_lock); /* see if any of the previous devices are up now (i.e. they have - * xmt and rcv traffic). the current_slave does not come into + * xmt and rcv traffic). the curr_active_slave does not come into * the picture unless it is null. also, slave->jiffies is not needed * here because we send an arp on each slave and give a slave as * long as it needs to get the tx/rx within the delta. @@ -2337,7 +2337,7 @@ static void bond_loadbalance_arp_mon(str /* primary_slave has no meaning in round-robin * mode. the window of a slave being up and - * current_slave being null after enslaving + * curr_active_slave being null after enslaving * is closed. */ if (oldcurrent == NULL) { @@ -2394,17 +2394,17 @@ static void bond_loadbalance_arp_mon(str } if (do_failover) { - write_lock(&bond->ptrlock); + write_lock(&bond->curr_slave_lock); bond_select_active_slave(bond); - if (oldcurrent && !bond->current_slave) { + if (oldcurrent && !bond->curr_active_slave) { printk(KERN_INFO DRV_NAME ": %s: now running without any active " "interface !\n", bond_dev->name); } - write_unlock(&bond->ptrlock); + write_unlock(&bond->curr_slave_lock); } re_arm: @@ -2457,13 +2457,13 @@ static void bond_activebackup_arp_mon(st delta_in_ticks) { slave->link = BOND_LINK_UP; - write_lock(&bond->ptrlock); - if ((bond->current_slave == NULL) && + write_lock(&bond->curr_slave_lock); + if ((bond->curr_active_slave == NULL) && ((jiffies - slave->dev->trans_start) <= delta_in_ticks)) { bond_change_active_slave(bond, slave); bond->current_arp_slave = NULL; - } else if (bond->current_slave != slave) { + } else if (bond->curr_active_slave != slave) { /* this slave has just come up but we * already have a current slave; this * can also happen if bond_enslave adds @@ -2474,7 +2474,7 @@ static void bond_activebackup_arp_mon(st bond->current_arp_slave = NULL; } - if (slave == bond->current_slave) { + if (slave == bond->curr_active_slave) { printk(KERN_INFO DRV_NAME ": %s: %s is up and now the " "active interface\n", @@ -2488,11 +2488,11 @@ static void bond_activebackup_arp_mon(st slave->dev->name); } - write_unlock(&bond->ptrlock); + write_unlock(&bond->curr_slave_lock); } } else { - read_lock(&bond->ptrlock); - if ((slave != bond->current_slave) && + read_lock(&bond->curr_slave_lock); + if ((slave != bond->curr_active_slave) && (bond->current_arp_slave == NULL) && (((jiffies - slave->dev->last_rx) >= 3*delta_in_ticks) && (my_ip != 0))) { @@ -2500,13 +2500,13 @@ static void bond_activebackup_arp_mon(st * the delta allows the current slave to be * taken out before the backup slave. * note: a non-null current_arp_slave indicates - * the current_slave went down and we are + * the curr_active_slave went down and we are * searching for a new one; under this - * condition we only take the current_slave + * condition we only take the curr_active_slave * down - this gives each slave a chance to * tx/rx traffic before being taken out */ - read_unlock(&bond->ptrlock); + read_unlock(&bond->curr_slave_lock); slave->link = BOND_LINK_DOWN; if (slave->link_failure_count < UINT_MAX) { slave->link_failure_count++; @@ -2517,24 +2517,24 @@ static void bond_activebackup_arp_mon(st bond_dev->name, slave->dev->name); } else { - read_unlock(&bond->ptrlock); + read_unlock(&bond->curr_slave_lock); } } } - read_lock(&bond->ptrlock); - slave = bond->current_slave; - read_unlock(&bond->ptrlock); + read_lock(&bond->curr_slave_lock); + slave = bond->curr_active_slave; + read_unlock(&bond->curr_slave_lock); if (slave != NULL) { /* if we have sent traffic in the past 2*arp_intervals but * haven't xmit and rx traffic in that time interval, select * a different slave. slave->jiffies is only updated when - * a slave first becomes the current_slave - not necessarily + * a slave first becomes the curr_active_slave - not necessarily * after every arp; this ensures the slave has a full 2*delta * before being taken out. if a primary is being used, check - * if it is up and needs to take over as the current_slave + * if it is up and needs to take over as the curr_active_slave */ if ((((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) || @@ -2551,10 +2551,10 @@ static void bond_activebackup_arp_mon(st "%s, disabling it", bond_dev->name, slave->dev->name); - write_lock(&bond->ptrlock); + write_lock(&bond->curr_slave_lock); bond_select_active_slave(bond); - slave = bond->current_slave; - write_unlock(&bond->ptrlock); + slave = bond->curr_active_slave; + write_unlock(&bond->curr_slave_lock); bond->current_arp_slave = slave; if (slave != NULL) { slave->jiffies = jiffies; @@ -2563,7 +2563,7 @@ static void bond_activebackup_arp_mon(st } else if ((bond->primary_slave != NULL) && (bond->primary_slave != slave) && (bond->primary_slave->link == BOND_LINK_UP)) { - /* at this point, slave is the current_slave */ + /* at this point, slave is the curr_active_slave */ printk(KERN_INFO DRV_NAME ": %s: changing from interface %s to primary " "interface %s\n", @@ -2572,9 +2572,9 @@ static void bond_activebackup_arp_mon(st bond->primary_slave->dev->name); /* primary is up so switch to it */ - write_lock(&bond->ptrlock); + write_lock(&bond->curr_slave_lock); bond_change_active_slave(bond, bond->primary_slave); - write_unlock(&bond->ptrlock); + write_unlock(&bond->curr_slave_lock); slave = bond->primary_slave; slave->jiffies = jiffies; } else { @@ -2589,9 +2589,9 @@ static void bond_activebackup_arp_mon(st } } - /* if we don't have a current_slave, search for the next available + /* if we don't have a curr_active_slave, search for the next available * backup slave from the current_arp_slave and make it the candidate - * for becoming the current_slave + * for becoming the curr_active_slave */ if (slave == NULL) { @@ -2787,11 +2787,11 @@ static int bond_do_ioctl(struct net_devi struct bonding *bond = (struct bonding *)bond_dev->priv; mii->val_out = 0; read_lock_bh(&bond->lock); - read_lock(&bond->ptrlock); - if (bond->current_slave) { + read_lock(&bond->curr_slave_lock); + if (bond->curr_active_slave) { mii->val_out = BMSR_LSTATUS; } - read_unlock(&bond->ptrlock); + read_unlock(&bond->curr_slave_lock); read_unlock_bh(&bond->lock); } return 0; @@ -2913,9 +2913,9 @@ static int bond_xmit_broadcast(struct sk read_lock(&bond->lock); - read_lock(&bond->ptrlock); - start_at = bond->current_slave; - read_unlock(&bond->ptrlock); + read_lock(&bond->curr_slave_lock); + start_at = bond->curr_active_slave; + read_unlock(&bond->curr_slave_lock); if (start_at == NULL) { /* we're at the root, get the first slave */ /* no suitable interface, frame not sent */ @@ -2970,9 +2970,9 @@ static int bond_xmit_roundrobin(struct s read_lock(&bond->lock); - read_lock(&bond->ptrlock); - slave = start_at = bond->current_slave; - read_unlock(&bond->ptrlock); + read_lock(&bond->curr_slave_lock); + slave = start_at = bond->curr_active_slave; + read_unlock(&bond->curr_slave_lock); if (slave == NULL) { /* we're at the root, get the first slave */ /* no suitable interface, frame not sent */ @@ -2990,9 +2990,9 @@ static int bond_xmit_roundrobin(struct s skb->priority = 1; dev_queue_xmit(skb); - write_lock(&bond->ptrlock); - bond->current_slave = slave->next; - write_unlock(&bond->ptrlock); + write_lock(&bond->curr_slave_lock); + bond->curr_active_slave = slave->next; + write_unlock(&bond->curr_slave_lock); read_unlock(&bond->lock); return 0; @@ -3032,7 +3032,7 @@ static int bond_xmit_xor(struct sk_buff return 0; } - slave_no = (data->h_dest[5]^bond->device->dev_addr[5]) % bond->slave_cnt; + slave_no = (data->h_dest[5]^bond_dev->dev_addr[5]) % bond->slave_cnt; bond_for_each_slave(bond, slave, i) { slave_no--; @@ -3064,7 +3064,7 @@ static int bond_xmit_xor(struct sk_buff } /* - * in active-backup mode, we know that bond->current_slave is always valid if + * in active-backup mode, we know that bond->curr_active_slave is always valid if * the bond has a usable interface. */ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_dev) @@ -3090,17 +3090,17 @@ static int bond_xmit_activebackup(struct read_lock(&bond->lock); - read_lock(&bond->ptrlock); - if (bond->current_slave != NULL) { /* one usable interface */ - skb->dev = bond->current_slave->dev; - read_unlock(&bond->ptrlock); + read_lock(&bond->curr_slave_lock); + if (bond->curr_active_slave != NULL) { /* one usable interface */ + skb->dev = bond->curr_active_slave->dev; + read_unlock(&bond->curr_slave_lock); skb->priority = 1; ret = dev_queue_xmit(skb); read_unlock(&bond->lock); return 0; } else { - read_unlock(&bond->ptrlock); + read_unlock(&bond->curr_slave_lock); } /* no suitable interface, frame not sent */ @@ -3211,9 +3211,9 @@ static void bond_info_show_master(struct { struct slave *curr; - read_lock(&bond->ptrlock); - curr = bond->current_slave; - read_unlock(&bond->ptrlock); + read_lock(&bond->curr_slave_lock); + curr = bond->curr_active_slave; + read_unlock(&bond->curr_slave_lock); seq_printf(seq, "Bonding Mode: %s\n", bond_mode_name()); @@ -3237,7 +3237,7 @@ static void bond_info_show_master(struct if (bond_3ad_get_active_agg_info(bond, &ad_info)) { seq_printf(seq, "bond %s has no active aggregator\n", - bond->device->name); + bond->dev->name); } else { seq_printf(seq, "Active Aggregator Info:\n"); @@ -3337,21 +3337,21 @@ static struct file_operations bond_info_ static int bond_create_proc_entry(struct bonding *bond) { - struct net_device *bond_dev = bond->device; + struct net_device *bond_dev = bond->dev; if (bond_proc_dir) { - bond->bond_proc_file = create_proc_entry(bond_dev->name, - S_IRUGO, - bond_proc_dir); - if (bond->bond_proc_file == NULL) { + bond->proc_entry = create_proc_entry(bond_dev->name, + S_IRUGO, + bond_proc_dir); + if (bond->proc_entry == NULL) { printk(KERN_WARNING DRV_NAME ": Warning: Cannot create /proc/net/bonding/%s\n", bond_dev->name); } else { - bond->bond_proc_file->data = bond; - bond->bond_proc_file->proc_fops = &bond_info_fops; - bond->bond_proc_file->owner = THIS_MODULE; - memcpy(bond->procdir_name, bond_dev->name, IFNAMSIZ); + bond->proc_entry->data = bond; + bond->proc_entry->proc_fops = &bond_info_fops; + bond->proc_entry->owner = THIS_MODULE; + memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ); } } @@ -3360,10 +3360,10 @@ static int bond_create_proc_entry(struct static void bond_remove_proc_entry(struct bonding *bond) { - if (bond_proc_dir && bond->bond_proc_file) { - remove_proc_entry(bond->procdir_name, bond_proc_dir); - memset(bond->procdir_name, 0, IFNAMSIZ); - bond->bond_proc_file = NULL; + if (bond_proc_dir && bond->proc_entry) { + remove_proc_entry(bond->proc_file_name, bond_proc_dir); + memset(bond->proc_file_name, 0, IFNAMSIZ); + bond->proc_entry = NULL; } } @@ -3709,7 +3709,7 @@ static void bond_free_all(void) struct bonding *bond, *nxt; list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) { - struct net_device *bond_dev = bond->device; + struct net_device *bond_dev = bond->dev; unregister_netdevice(bond_dev); bond_deinit(bond_dev); @@ -3734,14 +3734,14 @@ static int __init bond_init(struct net_d /* initialize rwlocks */ rwlock_init(&bond->lock); - rwlock_init(&bond->ptrlock); + rwlock_init(&bond->curr_slave_lock); /* Initialize pointers */ bond->first_slave = NULL; - bond->current_slave = NULL; + bond->curr_active_slave = NULL; bond->current_arp_slave = NULL; bond->primary_slave = NULL; - bond->device = bond_dev; + bond->dev = bond_dev; /* Initialize the device structure. */ bond_dev->set_mac_address = bond_set_mac_address; diff -Nuarp a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h --- a/drivers/net/bonding/bonding.h Sun Dec 21 16:08:52 2003 +++ b/drivers/net/bonding/bonding.h Sun Dec 21 16:08:53 2003 @@ -62,15 +62,15 @@ struct slave { + struct net_device *dev; /* first - usefull for panic debug */ struct slave *next; struct slave *prev; - struct net_device *dev; - short delay; - unsigned long jiffies; - char link; /* one of BOND_LINK_XXXX */ - char state; /* one of BOND_STATE_XXXX */ - unsigned short original_flags; - u32 link_failure_count; + s16 delay; + u32 jiffies; + s8 link; /* one of BOND_LINK_XXXX */ + s8 state; /* one of BOND_STATE_XXXX */ + u32 original_flags; + u32 link_failure_count; u16 speed; u8 duplex; u8 perm_hwaddr[ETH_ALEN]; @@ -82,33 +82,33 @@ struct slave { * Here are the locking policies for the two bonding locks: * * 1) Get bond->lock when reading/writing slave list. - * 2) Get bond->ptrlock when reading/writing bond->current_slave. + * 2) Get bond->curr_slave_lock when reading/writing bond->curr_active_slave. * (It is unnecessary when the write-lock is put with bond->lock.) - * 3) When we lock with bond->ptrlock, we must lock with bond->lock + * 3) When we lock with bond->curr_slave_lock, we must lock with bond->lock * beforehand. */ struct bonding { - struct slave *first_slave; - struct slave *current_slave; - struct slave *primary_slave; - struct slave *current_arp_slave; - int slave_cnt; /* never change this value outside the attach/detach wrappers */ + struct net_device *dev; /* first - usefull for panic debug */ + struct slave *first_slave; + struct slave *curr_active_slave; + struct slave *current_arp_slave; + struct slave *primary_slave; + s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ rwlock_t lock; - rwlock_t ptrlock; - struct timer_list mii_timer; - struct timer_list arp_timer; - int kill_timers; - struct net_device_stats stats; + rwlock_t curr_slave_lock; + struct timer_list mii_timer; + struct timer_list arp_timer; + s8 kill_timers; + struct net_device_stats stats; #ifdef CONFIG_PROC_FS - struct proc_dir_entry *bond_proc_file; - char procdir_name[IFNAMSIZ]; + struct proc_dir_entry *proc_entry; + char proc_file_name[IFNAMSIZ]; #endif /* CONFIG_PROC_FS */ - struct list_head bond_list; - struct net_device *device; - struct dev_mc_list *mc_list; - unsigned short flags; - struct ad_bond_info ad_info; - struct alb_bond_info alb_info; + struct list_head bond_list; + struct dev_mc_list *mc_list; + u16 flags; + struct ad_bond_info ad_info; + struct alb_bond_info alb_info; }; /** diff -Nuarp a/include/linux/if_bonding.h b/include/linux/if_bonding.h --- a/include/linux/if_bonding.h Sun Dec 21 16:08:52 2003 +++ b/include/linux/if_bonding.h Sun Dec 21 16:08:53 2003 @@ -86,9 +86,9 @@ typedef struct ifbond { typedef struct ifslave { __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */ - char slave_name[IFNAMSIZ]; - char link; - char state; + __s8 slave_name[IFNAMSIZ]; + __s8 link; + __s8 state; __u32 link_failure_count; } ifslave;