提交 9b887909 编写于 作者: S Sami Farin 提交者: David S. Miller

[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: NSami Farin <safari-netfilter@safari.iki.fi>
Signed-off-by: NPatrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8e87e014
...@@ -128,10 +128,11 @@ static u_int32_t __hash_conntrack(const struct nf_conntrack_tuple *tuple, ...@@ -128,10 +128,11 @@ static u_int32_t __hash_conntrack(const struct nf_conntrack_tuple *tuple,
unsigned int size, unsigned int rnd) unsigned int size, unsigned int rnd)
{ {
unsigned int a, b; unsigned int a, b;
a = jhash((void *)tuple->src.u3.all, sizeof(tuple->src.u3.all),
((tuple->src.l3num) << 16) | tuple->dst.protonum); a = jhash2(tuple->src.u3.all, ARRAY_SIZE(tuple->src.u3.all),
b = jhash((void *)tuple->dst.u3.all, sizeof(tuple->dst.u3.all), (tuple->src.l3num << 16) | tuple->dst.protonum);
(tuple->src.u.all << 16) | tuple->dst.u.all); 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; return jhash_2words(a, b, rnd) % size;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册