Skip to content

Commit df51b84

Browse files
edumazetkuba-moo
authored andcommitted
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 <[email protected]> Acked-by: Soheil Hassas Yeganeh <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5af674b commit df51b84

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

include/net/hotdata.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ struct net_hotdata {
3939
#define inet_ehash_secret net_hotdata.tcp_protocol.secret
4040
#define udp_ehash_secret net_hotdata.udp_protocol.secret
4141
#define inet6_ehash_secret net_hotdata.tcpv6_protocol.secret
42+
#define tcp_ipv6_hash_secret net_hotdata.tcpv6_offload.secret
4243
#define udp6_ehash_secret net_hotdata.udpv6_protocol.secret
44+
#define udp_ipv6_hash_secret net_hotdata.udpv6_offload.secret
4345

4446
extern struct net_hotdata net_hotdata;
4547

include/net/protocol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct inet6_protocol {
7070
struct net_offload {
7171
struct offload_callbacks callbacks;
7272
unsigned int flags; /* Flags used by IPv6 for now */
73+
u32 secret;
7374
};
7475
/* This should be set for any extension header which is compatible with GSO. */
7576
#define INET6_PROTO_GSO_EXTHDR 0x1

net/ipv6/inet6_hashtables.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ u32 inet6_ehashfn(const struct net *net,
2626
const struct in6_addr *laddr, const u16 lport,
2727
const struct in6_addr *faddr, const __be16 fport)
2828
{
29-
static u32 ipv6_hash_secret __read_mostly;
30-
3129
u32 lhash, fhash;
3230

3331
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));
3533

3634
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);
3836

3937
return __inet6_ehashfn(lhash, lport, fhash, fport,
4038
inet6_ehash_secret + net_hash_mix(net));

net/ipv6/udp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ u32 udp6_ehashfn(const struct net *net,
7979
const struct in6_addr *faddr,
8080
const __be16 fport)
8181
{
82-
static u32 udp_ipv6_hash_secret __read_mostly;
83-
8482
u32 lhash, fhash;
8583

8684
net_get_random_once(&udp6_ehash_secret,

0 commit comments

Comments
 (0)