raw: use net_hash_mix() in hash function
authorEric Dumazet <edumazet@google.com>
Thu, 2 Feb 2023 09:41:00 +0000 (09:41 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Apr 2023 14:55:23 +0000 (16:55 +0200)
commit53a0031217c9b8d7a53edfb70d1633a1935c4395
treeacbb4df6550728d2100bd7592e55cb3a331eb1e5
parent73b99db789ef6c18a0fd55a2ac6f7c1e59f06e01
raw: use net_hash_mix() in hash function

[ Upstream commit 6579f5bacc2c4cbc5ef6abb45352416939d1f844 ]

Some applications seem to rely on RAW sockets.

If they use private netns, we can avoid piling all RAW
sockets bound to a given protocol into a single bucket.

Also place (struct raw_hashinfo).lock into its own
cache line to limit false sharing.

Alternative would be to have per-netns hashtables,
but this seems too expensive for most netns
where RAW sockets are not used.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 0a78cf7264d2 ("raw: Fix NULL deref in raw_get_next().")
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/raw.h
net/ipv4/raw.c
net/ipv6/raw.c