Skip to content

Commit 5af674b

Browse files
edumazetkuba-moo
authored andcommitted
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 <[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 6e07357 commit 5af674b

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

include/net/hotdata.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ struct net_hotdata {
3838

3939
#define inet_ehash_secret net_hotdata.tcp_protocol.secret
4040
#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
4143

4244
extern struct net_hotdata net_hotdata;
4345

include/net/protocol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct inet6_protocol {
6060
__be32 info);
6161

6262
unsigned int flags; /* INET6_PROTO_xxx */
63+
u32 secret;
6364
};
6465

6566
#define INET6_PROTO_NOPOLICY 0x1

net/ipv6/inet6_hashtables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/random.h>
1515

1616
#include <net/addrconf.h>
17+
#include <net/hotdata.h>
1718
#include <net/inet_connection_sock.h>
1819
#include <net/inet_hashtables.h>
1920
#include <net/inet6_hashtables.h>
@@ -25,7 +26,6 @@ u32 inet6_ehashfn(const struct net *net,
2526
const struct in6_addr *laddr, const u16 lport,
2627
const struct in6_addr *faddr, const __be16 fport)
2728
{
28-
static u32 inet6_ehash_secret __read_mostly;
2929
static u32 ipv6_hash_secret __read_mostly;
3030

3131
u32 lhash, fhash;

net/ipv6/udp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ u32 udp6_ehashfn(const struct net *net,
7979
const struct in6_addr *faddr,
8080
const __be16 fport)
8181
{
82-
static u32 udp6_ehash_secret __read_mostly;
8382
static u32 udp_ipv6_hash_secret __read_mostly;
8483

8584
u32 lhash, fhash;

0 commit comments

Comments
 (0)