diff options
Diffstat (limited to 'drivers/net/bonding/bond_alb.c')
| -rw-r--r-- | drivers/net/bonding/bond_alb.c | 37 | 
1 files changed, 15 insertions, 22 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 8d7dfd2f1e9..c746b331771 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -233,34 +233,27 @@ static void tlb_deinitialize(struct bonding *bond)  	_unlock_tx_hashtbl(bond);  } +static long long compute_gap(struct slave *slave) +{ +	return (s64) (slave->speed << 20) - /* Convert to Megabit per sec */ +	       (s64) (SLAVE_TLB_INFO(slave).load << 3); /* Bytes to bits */ +} +  /* Caller must hold bond lock for read */  static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)  {  	struct slave *slave, *least_loaded; -	s64 max_gap; -	int i, found = 0; - -	/* Find the first enabled slave */ -	bond_for_each_slave(bond, slave, i) { -		if (SLAVE_IS_OK(slave)) { -			found = 1; -			break; -		} -	} - -	if (!found) { -		return NULL; -	} +	long long max_gap; +	int i; -	least_loaded = slave; -	max_gap = (s64)(slave->speed << 20) - /* Convert to Megabit per sec */ -			(s64)(SLAVE_TLB_INFO(slave).load << 3); /* Bytes to bits */ +	least_loaded = NULL; +	max_gap = LLONG_MIN;  	/* Find the slave with the largest gap */ -	bond_for_each_slave_from(bond, slave, i, least_loaded) { +	bond_for_each_slave(bond, slave, i) {  		if (SLAVE_IS_OK(slave)) { -			s64 gap = (s64)(slave->speed << 20) - -					(s64)(SLAVE_TLB_INFO(slave).load << 3); +			long long gap = compute_gap(slave); +  			if (max_gap < gap) {  				least_loaded = slave;  				max_gap = gap; @@ -689,7 +682,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon  			client_info->ntt = 0;  		} -		if (!list_empty(&bond->vlan_list)) { +		if (bond->vlgrp) {  			if (!vlan_get_tag(skb, &client_info->vlan_id))  				client_info->tag = 1;  		} @@ -911,7 +904,7 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])  		skb->priority = TC_PRIO_CONTROL;  		skb->dev = slave->dev; -		if (!list_empty(&bond->vlan_list)) { +		if (bond->vlgrp) {  			struct vlan_entry *vlan;  			vlan = bond_next_vlan(bond,  |