Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202635
b: refs/heads/master
c: 097811b
h: refs/heads/master
i:
  202633: f312bd4
  202631: bba75b4
v: v3
  • Loading branch information
Jiri Pirko authored and David S. Miller committed Jun 2, 2010
1 parent 38a4c62 commit 5d6b967
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5206e24c2c348d739c31ebed10a741a02bbde9e0
refs/heads/master: 097811bb48c7837db94d7fe5d94f0f4b5e19e78c
33 changes: 13 additions & 20 deletions trunk/drivers/net/bonding/bond_alb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5d6b967

Please sign in to comment.