diff options
| author | Eric Dumazet <edumazet@google.com> | 2026-03-13 15:03:46 +0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-03-17 05:27:41 +0300 |
| commit | 854587e69ef3b7a14b4380d9b99e18693bb9a07b (patch) | |
| tree | fd4188543efb968e75ca0c8f0ae219bf8b1133e2 /include | |
| parent | 6a33a706265daa3a0d92fece0baf6f2c3915f1cd (diff) | |
| download | linux-854587e69ef3b7a14b4380d9b99e18693bb9a07b.tar.xz | |
tcp: improve inet6_ehashfn() entropy
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 better 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: Simon Horman <horms@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260313120346.3378811-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
