Skip to content

Commit 9920e48

Browse files
Paolo Abenidavem330
authored andcommitted
ipv4: use l4 hash for locally generated multipath flows
This patch changes how the multipath hash is computed for locally generated flows: now the hash comprises l4 information. This allows better utilization of the available paths when the existing flows have the same source IP and the same destination IP: with l3 hash, even when multiple connections are in place simultaneously, a single path will be used, while with l4 hash we can use all the available paths. v2 changes: - use get_hash_from_flowi4() instead of implementing just another l4 hash function Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1032a66 commit 9920e48

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv4/fib_semantics.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1564,7 +1564,8 @@ void fib_select_path(struct net *net, struct fib_result *res,
15641564
#ifdef CONFIG_IP_ROUTE_MULTIPATH
15651565
if (res->fi->fib_nhs > 1 && fl4->flowi4_oif == 0) {
15661566
if (mp_hash < 0)
1567-
mp_hash = fib_multipath_hash(fl4->saddr, fl4->daddr);
1567+
mp_hash = get_hash_from_flowi4(fl4) >> 1;
1568+
15681569
fib_select_multipath(res, mp_hash);
15691570
}
15701571
else

0 commit comments

Comments
 (0)