bonding: discard lowest hash bit for 802.3ad layer3+4
Subsystems (3)
PATCH v2 1/1 bonding: discard lowest hash bit for 802.3ad layer3+4
After commit 07f4c90062f8 ("tcp/dccp: try to not exhaust ip_local_port_range in connect()"), we will try to use even ports for connect(). Then if an application (seen clearly with iperf) opens multiple streams to the same destination IP and port, each stream will be given an even source port.
So the bonding driver's simple xmit_hash_policy based on layer3+4 addressing will always hash all these streams to the same interface. And the total throughput will limited to a single slave.
Change the tcp code will impact the whole tcp behavior, only for bonding usage. Paolo Abeni suggested fix this by changing the bonding code only, which should be more reasonable, and less impact.
Fix this by discarding the lowest hash bit because it contains little entropy. After the fix we can re-balance between slaves.
--- drivers/net/bonding/bond_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +1 -1
@@ -3253,7 +3253,7 @@ u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb) hash ^= (hash >>16 ); hash ^= (hash >>8 ); -return hash; +return hash >>1 ; }/*-------------------------- Device entry points ----------------------------*/
Signature · 1 line
2.5.5
David Miller
maintainerFrom: Hangbin Liu <[email protected]>
Date: Mon, 6 Nov 2017 09:01:57 +0800
Quoted 13 lines
After commit
07f4c90062f8("tcp/dccp: try to not exhaustip_local_port_rangeinconnect()"), we will try to use even ports forconnect(). Then if an application (seen clearly with iperf) opens multiple streams to the same destination IP and port, each stream will be given an even source port.So the bonding driver's simple
xmit_hash_policybased on layer3+4 addressing will always hash all these streams to the same interface. And the total throughput will limited to a single slave.Change the tcp code will impact the whole tcp behavior, only for bonding usage. Paolo Abeni suggested fix this by changing the bonding code only, which should be more reasonable, and less impact.
Quoted 5 lines
Fix this by discarding the lowest hash bit because it contains little entropy. After the fix we can re-balance between slaves.
Signed-off-by Paolo Abeni <[email protected]>Signed-off-by Hangbin Liu <[email protected]>
Applied and queued up for -stable, thank you.