Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: move inet6_ehash_secret and udp6_ehash_secret into net_hotdata

"struct inet6_protocol" has a 32bit hole in 32bit arches.

Use it to store the 32bit secret used by UDP and TCP,
to increase cache locality in rx path.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20240306160031.874438-16-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
5af674bb 6e073572

+4 -2
+2
include/net/hotdata.h
··· 38 38 39 39 #define inet_ehash_secret net_hotdata.tcp_protocol.secret 40 40 #define udp_ehash_secret net_hotdata.udp_protocol.secret 41 + #define inet6_ehash_secret net_hotdata.tcpv6_protocol.secret 42 + #define udp6_ehash_secret net_hotdata.udpv6_protocol.secret 41 43 42 44 extern struct net_hotdata net_hotdata; 43 45
+1
include/net/protocol.h
··· 60 60 __be32 info); 61 61 62 62 unsigned int flags; /* INET6_PROTO_xxx */ 63 + u32 secret; 63 64 }; 64 65 65 66 #define INET6_PROTO_NOPOLICY 0x1
+1 -1
net/ipv6/inet6_hashtables.c
··· 14 14 #include <linux/random.h> 15 15 16 16 #include <net/addrconf.h> 17 + #include <net/hotdata.h> 17 18 #include <net/inet_connection_sock.h> 18 19 #include <net/inet_hashtables.h> 19 20 #include <net/inet6_hashtables.h> ··· 26 25 const struct in6_addr *laddr, const u16 lport, 27 26 const struct in6_addr *faddr, const __be16 fport) 28 27 { 29 - static u32 inet6_ehash_secret __read_mostly; 30 28 static u32 ipv6_hash_secret __read_mostly; 31 29 32 30 u32 lhash, fhash;
-1
net/ipv6/udp.c
··· 79 79 const struct in6_addr *faddr, 80 80 const __be16 fport) 81 81 { 82 - static u32 udp6_ehash_secret __read_mostly; 83 82 static u32 udp_ipv6_hash_secret __read_mostly; 84 83 85 84 u32 lhash, fhash;