]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
ipv6: Prepare the tree for un-inlined jhash.
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 25 Nov 2010 03:15:07 +0000 (03:15 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 28 Nov 2010 19:26:21 +0000 (11:26 -0800)
jhash is widely used in the kernel and because the functions
are inlined, the cost in size is significant. Also, the new jhash
functions are slightly larger than the previous ones so better un-inline.
As a preparation step, the calls to the internal macros are replaced
with the plain jhash function calls.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/inet6_connection_sock.c
net/ipv6/reassembly.c

index 8a1628023bd1826809fded79d7dc7c6c4aa6f41e..861d252bd1baeef7cb246413a3766444daa197ed 100644 (file)
@@ -60,18 +60,16 @@ EXPORT_SYMBOL_GPL(inet6_csk_bind_conflict);
 static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport,
                           const u32 rnd, const u16 synq_hsize)
 {
-       u32 a = (__force u32)raddr->s6_addr32[0];
-       u32 b = (__force u32)raddr->s6_addr32[1];
-       u32 c = (__force u32)raddr->s6_addr32[2];
-
-       a += JHASH_GOLDEN_RATIO;
-       b += JHASH_GOLDEN_RATIO;
-       c += rnd;
-       __jhash_mix(a, b, c);
-
-       a += (__force u32)raddr->s6_addr32[3];
-       b += (__force u32)rport;
-       __jhash_mix(a, b, c);
+       u32 c;
+
+       c = jhash_3words((__force u32)raddr->s6_addr32[0],
+                        (__force u32)raddr->s6_addr32[1],
+                        (__force u32)raddr->s6_addr32[2],
+                        rnd);
+
+       c = jhash_2words((__force u32)raddr->s6_addr32[3],
+                        (__force u32)rport,
+                        c);
 
        return c & (synq_hsize - 1);
 }
index 0f276645375969054b36aea6c8fcb7a80666921c..07beeb06f752da7cae16fb442d9d060624668275 100644 (file)
@@ -104,26 +104,22 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
 unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr,
                             const struct in6_addr *daddr, u32 rnd)
 {
-       u32 a, b, c;
-
-       a = (__force u32)saddr->s6_addr32[0];
-       b = (__force u32)saddr->s6_addr32[1];
-       c = (__force u32)saddr->s6_addr32[2];
-
-       a += JHASH_GOLDEN_RATIO;
-       b += JHASH_GOLDEN_RATIO;
-       c += rnd;
-       __jhash_mix(a, b, c);
-
-       a += (__force u32)saddr->s6_addr32[3];
-       b += (__force u32)daddr->s6_addr32[0];
-       c += (__force u32)daddr->s6_addr32[1];
-       __jhash_mix(a, b, c);
-
-       a += (__force u32)daddr->s6_addr32[2];
-       b += (__force u32)daddr->s6_addr32[3];
-       c += (__force u32)id;
-       __jhash_mix(a, b, c);
+       u32 c;
+
+       c = jhash_3words((__force u32)saddr->s6_addr32[0],
+                        (__force u32)saddr->s6_addr32[1],
+                        (__force u32)saddr->s6_addr32[2],
+                        rnd);
+
+       c = jhash_3words((__force u32)saddr->s6_addr32[3],
+                        (__force u32)daddr->s6_addr32[0],
+                        (__force u32)daddr->s6_addr32[1],
+                        c);
+
+       c =  jhash_3words((__force u32)daddr->s6_addr32[2],
+                         (__force u32)daddr->s6_addr32[3],
+                         (__force u32)id,
+                         c);
 
        return c & (INETFRAGS_HASHSZ - 1);
 }