Skip to content

Commit d4ce440

Browse files
stewartsmithmngyadam
authored andcommitted
net/ipv6: Improve performance of inet6_ehashfn()
Signed-off-by: Samuel Mendoza-Jonas <samjonas@amazon.com>
1 parent 6ffb559 commit d4ce440

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

net/ipv6/inet6_hashtables.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,14 @@ u32 inet6_ehashfn(const struct net *net,
3535
net_get_random_once(&inet6_ehash_secret, sizeof(inet6_ehash_secret));
3636
net_get_random_once(&ipv6_hash_secret, sizeof(ipv6_hash_secret));
3737

38-
lhash = (__force u32)laddr->s6_addr32[3];
39-
fhash = __ipv6_addr_jhash(faddr, ipv6_hash_secret);
38+
lhash = jhash_3words((__force u32)laddr->s6_addr32[3],
39+
(((u32)lport) << 16) | (__force u32)fport,
40+
(__force u32)faddr->s6_addr32[0],
41+
ipv6_hash_secret);
42+
fhash = jhash_3words((__force u32)faddr->s6_addr32[1],
43+
(__force u32)faddr->s6_addr32[2],
44+
(__force u32)faddr->s6_addr32[3],
45+
ipv6_hash_secret);
4046

4147
return __inet6_ehashfn(lhash, lport, fhash, fport,
4248
inet6_ehash_secret + net_hash_mix(net));

0 commit comments

Comments
 (0)