[NETFILTER]: nf_conntrack: use jhash2 in __hash_conntrack
authorSami Farin <safari-netfilter@safari.iki.fi>
Wed, 14 Mar 2007 23:43:00 +0000 (16:43 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:25:53 +0000 (22:25 -0700)
Now it uses jhash, but using jhash2 would be around 3-4 times faster
(on P4).

Signed-off-by: Sami Farin <safari-netfilter@safari.iki.fi>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netfilter/nf_conntrack_core.c

index 9858bcb29aa05d4cb39560d84b46d0ed927a03e9..2b0cc7a1771cbd2bb7b4abb5b6fe36e8e29d1e37 100644 (file)
@@ -128,10 +128,11 @@ 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),
-                       (tuple->src.u.all << 16) | tuple->dst.u.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;
 }