Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b887909 authored by Sami Farin's avatar Sami Farin Committed by David S. Miller
Browse files

[NETFILTER]: nf_conntrack: use jhash2 in __hash_conntrack



Now it uses jhash, but using jhash2 would be around 3-4 times faster
(on P4).

Signed-off-by: default avatarSami Farin <safari-netfilter@safari.iki.fi>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8e87e014
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -128,9 +128,10 @@ static u_int32_t __hash_conntrack(const struct nf_conntrack_tuple *tuple,
				  unsigned int size, unsigned int rnd)
{
	unsigned int a, b;
	a = jhash((void *)tuple->src.u3.all, sizeof(tuple->src.u3.all),
		  ((tuple->src.l3num) << 16) | tuple->dst.protonum);
	b = jhash((void *)tuple->dst.u3.all, sizeof(tuple->dst.u3.all),

	a = jhash2(tuple->src.u3.all, ARRAY_SIZE(tuple->src.u3.all),
		   (tuple->src.l3num << 16) | tuple->dst.protonum);
	b = jhash2(tuple->dst.u3.all, ARRAY_SIZE(tuple->dst.u3.all),
		   (tuple->src.u.all << 16) | tuple->dst.u.all);

	return jhash_2words(a, b, rnd) % size;