static void bond_activebackup_arp_mon(struct net_device *bond_dev) 
void bond_activebackup_arp_mon(struct net_device *bond_dev) 
static void bond_activebackup_arp_mon(struct net_device *bond_dev){	struct bonding *bond = bond_dev->priv;	struct slave *slave;	int delta_in_ticks;	int i;	read_lock(&bond->lock);	delta_in_ticks = (bond->params.arp_interval * HZ) / 1000;	if (bond->kill_timers) {		goto out;	}	if (bond->slave_cnt == 0) {		goto re_arm;	}	/* determine if any slave has come up or any backup slave has	 * gone down	 * TODO: what about up/down delay in arp mode? it wasn't here before	 *       so it can wait	 */	bond_for_each_slave(bond, slave, i) {		if (slave->link != BOND_LINK_UP) {			if ((jiffies - slave->dev->last_rx) <= delta_in_ticks) {				slave->link = BOND_LINK_UP;				write_lock(&bond->curr_slave_lock);				if ((!bond->curr_active_slave) &&				    ((jiffies - slave->dev->trans_start) <= delta_in_ticks)) {					bond_change_active_slave(bond, slave);					bond->current_arp_slave = NULL;				} 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					 * a new slave that is up while we are					 * searching for a new slave					 */					bond_set_slave_inactive_flags(slave);					bond->current_arp_slave = NULL;				}				if (slave == bond->curr_active_slave) {					printk(KERN_INFO DRV_NAME					       ": %s: %s is up and now the "					       "active interface\n",					       bond_dev->name,					       slave->dev->name);				} else {					printk(KERN_INFO DRV_NAME					       ": %s: backup interface %s is "					       "now up\n",					       bond_dev->name,					       slave->dev->name);				}				write_unlock(&bond->curr_slave_lock);			}		} else {			read_lock(&bond->curr_slave_lock);			if ((slave != bond->curr_active_slave) &&			    (!bond->current_arp_slave) &&			    (((jiffies - slave->dev->last_rx) >= 3*delta_in_ticks) &&			     bond_has_ip(bond))) {				/* a backup slave has gone down; three times				 * the delta allows the current slave to be				 * taken out before the backup slave.				 * note: a non-null current_arp_slave indicates				 * the curr_active_slave went down and we are				 * searching for a new one; under this				 * 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->curr_slave_lock);				slave->link  = BOND_LINK_DOWN;				if (slave->link_failure_count < UINT_MAX) {					slave->link_failure_count++;				}				bond_set_slave_inactive_flags(slave);				printk(KERN_INFO DRV_NAME				       ": %s: backup interface %s is now down\n",				       bond_dev->name,				       slave->dev->name);			} else {				read_unlock(&bond->curr_slave_lock);			}		}	}	read_lock(&bond->curr_slave_lock);	slave = bond->curr_active_slave;	read_unlock(&bond->curr_slave_lock);	if (slave) {		/* 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 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 curr_active_slave		 */		if ((((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) ||	    (((jiffies - slave->dev->last_rx) >= (2*delta_in_ticks)) &&	     bond_has_ip(bond))) &&		    ((jiffies - slave->jiffies) >= 2*delta_in_ticks)) {			slave->link  = BOND_LINK_DOWN;			if (slave->link_failure_count < UINT_MAX) {				slave->link_failure_count++;			}			printk(KERN_INFO DRV_NAME			       ": %s: link status down for active interface "			       "%s, disabling it\n",			       bond_dev->name,			       slave->dev->name);			write_lock(&bond->curr_slave_lock);			bond_select_active_slave(bond);			slave = bond->curr_active_slave;			write_unlock(&bond->curr_slave_lock);			bond->current_arp_slave = slave;			if (slave) {				slave->jiffies = jiffies;			}		} else if ((bond->primary_slave) &&			   (bond->primary_slave != slave) &&			   (bond->primary_slave->link == BOND_LINK_UP)) {			/* at this point, slave is the curr_active_slave */			printk(KERN_INFO DRV_NAME			       ": %s: changing from interface %s to primary "			       "interface %s\n",			       bond_dev->name,			       slave->dev->name,			       bond->primary_slave->dev->name);			/* primary is up so switch to it */			write_lock(&bond->curr_slave_lock);			bond_change_active_slave(bond, bond->primary_slave);			write_unlock(&bond->curr_slave_lock);			slave = bond->primary_slave;			slave->jiffies = jiffies;		} else {			bond->current_arp_slave = NULL;		}		/* the current slave must tx an arp to ensure backup slaves		 * rx traffic		 */		if (slave && bond_has_ip(bond)) {			bond_arp_send_all(bond, slave);		}	}	/* 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 curr_active_slave	 */	if (!slave) {		if (!bond->current_arp_slave) {			bond->current_arp_slave = bond->first_slave;		}		if (bond->current_arp_slave) {			bond_set_slave_inactive_flags(bond->current_arp_slave);			/* search for next candidate */			bond_for_each_slave_from(bond, slave, i, bond->current_arp_slave->next) {				if (IS_UP(slave->dev)) {					slave->link = BOND_LINK_BACK;					bond_set_slave_active_flags(slave);					bond_arp_send_all(bond, slave);					slave->jiffies = jiffies;					bond->current_arp_slave = slave;					break;				}				/* if the link state is up at this point, we				 * mark it down - this can happen if we have				 * simultaneous link failures and				 * reselect_active_interface doesn't make this				 * one the current slave so it is still marked				 * up when it is actually down				 */				if (slave->link == BOND_LINK_UP) {					slave->link  = BOND_LINK_DOWN;					if (slave->link_failure_count < UINT_MAX) {						slave->link_failure_count++;					}					bond_set_slave_inactive_flags(slave);					printk(KERN_INFO DRV_NAME					       ": %s: backup interface %s is "					       "now down.\n",					       bond_dev->name,					       slave->dev->name);				}			}		}	}re_arm:	if (bond->params.arp_interval) {		mod_timer(&bond->arp_timer, jiffies + delta_in_ticks);	}out:	read_unlock(&bond->lock);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/a77b53258d76513c37e766dc0db1fc9db7c4ac1e/bond_main.c/clean/drivers/net/bonding/bond_main.c