Commit c6644d07 authored by Kosuke Tatsukawa's avatar Kosuke Tatsukawa Committed by David S. Miller

net: bonding: Fix transmit load balancing in balance-alb mode if specified by sysfs

Commit cbf5ecb3 ("net: bonding: Fix transmit load balancing in
balance-alb mode") tried to fix transmit dynamic load balancing in
balance-alb mode, which wasn't working after commit 8b426dc5
("bonding: remove hardcoded value").

It turned out that my previous patch only fixed the case when
balance-alb was specified as bonding module parameter, and not when
balance-alb mode was set using /sys/class/net/*/bonding/mode (the most
common usage).  In the latter case, tlb_dynamic_lb was set up according
to the default mode of the bonding interface, which happens to be

This additional patch addresses this issue by setting up tlb_dynamic_lb
to 1 if "mode" is set to balance-alb through the sysfs interface.

I didn't add code to change tlb_balance_lb back to the default value for
other modes, because "mode" is usually set up only once during
initialization, and it's not worthwhile to change the static variable
bonding_defaults in bond_main.c to a global variable just for this

Commit 8b426dc5 also changes the value of tlb_dynamic_lb for
balance-tlb mode if it is set up using the sysfs interface.  I didn't
change that behavior, because the value of tlb_balance_lb can be changed
using the sysfs interface for balance-tlb, and I didn't like changing
the default value back and forth for balance-tlb.

As for balance-alb, /sys/class/net/*/bonding/tlb_balance_lb cannot be
written to.  However, I think balance-alb with tlb_dynamic_lb set to 0
is not an intended usage, so there is little use making it writable at
this moment.

Fixes: 8b426dc5 ("bonding: remove hardcoded value")
Reported-by: Reinis Rozītis's avatarReinis Rozitis <[email protected]>
Signed-off-by: default avatarKosuke Tatsukawa <[email protected]>
Cc: [email protected]  # v4.12+
Acked-by: default avatarNikolay Aleksandrov <[email protected]>
Acked-by: default avatarMahesh Bandewar <[email protected]>
Signed-off-by: default avatarDavid S. Miller <[email protected]>
parent 8f2bb1de
......@@ -754,6 +754,9 @@ static int bond_option_mode_set(struct bonding *bond,
if (newval->value == BOND_MODE_ALB)
bond->params.tlb_dynamic_lb = 1;
/* don't cache arp_validate between modes */
bond->params.arp_validate = BOND_ARP_VALIDATE_NONE;
bond->params.mode = newval->value;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment