From c90482ab8d2bf3714252b3f32823f26efd1e35a1 Mon Sep 17 00:00:00 2001 From: Amir Noam Date: Thu, 11 Sep 2003 06:52:28 -0400 Subject: [PATCH] [bonding 2.6] fix load balance problem with high UDP Tx stress --- drivers/net/bonding/bond_alb.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 4e0ec9b6361f6..f0399fc818b0b 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -17,6 +17,13 @@ * * The full GNU General Public License is included in this distribution in the * file called LICENSE. + * + * + * Changes: + * + * 2003/06/25 - Shmulik Hen + * - Fixed signed/unsigned calculation errors that caused load sharing + * to collapse to one slave under very heavy UDP Tx stress. */ #include @@ -246,7 +253,7 @@ tlb_get_least_loaded_slave(struct bonding *bond) { struct slave *slave; struct slave *least_loaded; - u32 curr_gap, max_gap; + s64 curr_gap, max_gap; /* Find the first enabled slave */ slave = bond_get_first_slave(bond); @@ -262,15 +269,15 @@ tlb_get_least_loaded_slave(struct bonding *bond) } least_loaded = slave; - max_gap = (slave->speed * 1000000) - - (SLAVE_TLB_INFO(slave).load * 8); + max_gap = (s64)(slave->speed * 1000000) - + (s64)(SLAVE_TLB_INFO(slave).load * 8); /* Find the slave with the largest gap */ slave = bond_get_next_slave(bond, slave); while (slave) { if (SLAVE_IS_OK(slave)) { - curr_gap = (slave->speed * 1000000) - - (SLAVE_TLB_INFO(slave).load * 8); + curr_gap = (s64)(slave->speed * 1000000) - + (s64)(SLAVE_TLB_INFO(slave).load * 8); if (max_gap < curr_gap) { least_loaded = slave; max_gap = curr_gap; -- 2.53.0