Re: [PATCH v2 net-next] tcp: improve inet6_ehashfn() entropy
From: Kuniyuki Iwashima <kuniyu@google.com>
Date: 2026-03-16 01:18:48
From: Kuniyuki Iwashima <kuniyu@google.com>
Date: 2026-03-16 01:18:48
On Fri, Mar 13, 2026 at 5:03 AM Eric Dumazet [off-list ref] wrote:
Instead of only using the 32 low order bits of the local address, use all of them. Xor net_hash_mix(net) with the 32 high order bits of the local address so that we can use __jhash_mix() three times. If we were hashing 4 extra bytes, we would need one __jhash_final() which is a bit expensive. Using net_hash_mix() at the beginning allows beter register allocation. We no longer use a cascade of two jhash and inet6_ehash_secret, this was dubious/weak. Add a comment explaining why @lport is not part of the jhash computation. $ scripts/bloat-o-meter -t vmlinux.0 vmlinux.1 add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-24 (-24) Function old new delta inet6_ehashfn 330 306 -24 Total: Before=24855958, After=24855934, chg -0.00% Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>