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

ipv6: move tcp_ipv6_hash_secret and udp_ipv6_hash_secret to net_hotdata

Use a 32bit hole in "struct net_offload" to store
the remaining 32bit secrets used by TCPv6 and UDPv6.

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-17-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
df51b845 5af674bb

+5 -6
+2
include/net/hotdata.h
··· 39 39 #define inet_ehash_secret net_hotdata.tcp_protocol.secret 40 40 #define udp_ehash_secret net_hotdata.udp_protocol.secret 41 41 #define inet6_ehash_secret net_hotdata.tcpv6_protocol.secret 42 + #define tcp_ipv6_hash_secret net_hotdata.tcpv6_offload.secret 42 43 #define udp6_ehash_secret net_hotdata.udpv6_protocol.secret 44 + #define udp_ipv6_hash_secret net_hotdata.udpv6_offload.secret 43 45 44 46 extern struct net_hotdata net_hotdata; 45 47
+1
include/net/protocol.h
··· 70 70 struct net_offload { 71 71 struct offload_callbacks callbacks; 72 72 unsigned int flags; /* Flags used by IPv6 for now */ 73 + u32 secret; 73 74 }; 74 75 /* This should be set for any extension header which is compatible with GSO. */ 75 76 #define INET6_PROTO_GSO_EXTHDR 0x1
+2 -4
net/ipv6/inet6_hashtables.c
··· 26 26 const struct in6_addr *laddr, const u16 lport, 27 27 const struct in6_addr *faddr, const __be16 fport) 28 28 { 29 - static u32 ipv6_hash_secret __read_mostly; 30 - 31 29 u32 lhash, fhash; 32 30 33 31 net_get_random_once(&inet6_ehash_secret, sizeof(inet6_ehash_secret)); 34 - net_get_random_once(&ipv6_hash_secret, sizeof(ipv6_hash_secret)); 32 + net_get_random_once(&tcp_ipv6_hash_secret, sizeof(tcp_ipv6_hash_secret)); 35 33 36 34 lhash = (__force u32)laddr->s6_addr32[3]; 37 - fhash = __ipv6_addr_jhash(faddr, ipv6_hash_secret); 35 + fhash = __ipv6_addr_jhash(faddr, tcp_ipv6_hash_secret); 38 36 39 37 return __inet6_ehashfn(lhash, lport, fhash, fport, 40 38 inet6_ehash_secret + net_hash_mix(net));
-2
net/ipv6/udp.c
··· 79 79 const struct in6_addr *faddr, 80 80 const __be16 fport) 81 81 { 82 - static u32 udp_ipv6_hash_secret __read_mostly; 83 - 84 82 u32 lhash, fhash; 85 83 86 84 net_get_random_once(&udp6_ehash_secret,