ipv6: optimize inet6_hash_frag()
authorEric Dumazet <edumazet@google.com>
Fri, 15 Feb 2013 18:14:48 +0000 (18:14 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 Feb 2013 17:23:51 +0000 (12:23 -0500)
Use ipv6_addr_hash() and a single jhash invocation.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/reassembly.c

index e354743ed4267563c6959700c3ea99f70172b06d..9a6428aaa2d8f30198b67b71d77b1a8784221781 100644 (file)
@@ -79,20 +79,7 @@ unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr,
 {
        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);
+       c = jhash_3words(ipv6_addr_hash(saddr), ipv6_addr_hash(daddr), id, rnd);
 
        return c & (INETFRAGS_HASHSZ - 1);
 }