[Bug 547] New: use jhash2 in __hash_conntrack

bugzilla-daemon at bugzilla.netfilter.org bugzilla-daemon at bugzilla.netfilter.org
Thu Feb 22 23:17:55 CET 2007


https://bugzilla.netfilter.org/bugzilla/show_bug.cgi?id=547

           Summary: use jhash2 in __hash_conntrack
           Product: netfilter/iptables
           Version: linux-2.6.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: nf_conntrack
        AssignedTo: yasuyuki.kozakai at toshiba.co.jp
        ReportedBy: safari-nfbugzilla at safari.iki.fi


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

--- linux-2.6.19/net/netfilter/nf_conntrack_core.c.bak	2006-11-29
23:57:37.000000000 +0200
+++ linux-2.6.19/net/netfilter/nf_conntrack_core.c	2007-02-22 23:11:50.795230861
+0200
@@ -270,10 +270,11 @@ static u_int32_t __hash_conntrack(const 
 				  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;
 }

-- 
Configure bugmail: https://bugzilla.netfilter.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the netfilter-buglog mailing list