aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2010-11-24 22:15:07 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-28 14:26:21 -0500
commit82a39eb6b3829a02e235656feddb4542517fcabc (patch)
tree51fee60823c57fd6110faa264a71b6403c1602f4 /net
parentaa285b1740f5b13e5a2606a927f3129954583d78 (diff)
ipv6: Prepare the tree for un-inlined jhash.
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>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/inet6_connection_sock.c22
-rw-r--r--net/ipv6/reassembly.c36
2 files changed, 26 insertions, 32 deletions
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index 8a1628023bd..861d252bd1b 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -60,18 +60,16 @@ EXPORT_SYMBOL_GPL(inet6_csk_bind_conflict);
60static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, 60static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport,
61 const u32 rnd, const u16 synq_hsize) 61 const u32 rnd, const u16 synq_hsize)
62{ 62{
63 u32 a = (__force u32)raddr->s6_addr32[0]; 63 u32 c;
64 u32 b = (__force u32)raddr->s6_addr32[1]; 64
65 u32 c = (__force u32)raddr->s6_addr32[2]; 65 c = jhash_3words((__force u32)raddr->s6_addr32[0],
66 66 (__force u32)raddr->s6_addr32[1],
67 a += JHASH_GOLDEN_RATIO; 67 (__force u32)raddr->s6_addr32[2],
68 b += JHASH_GOLDEN_RATIO; 68 rnd);
69 c += rnd; 69
70 __jhash_mix(a, b, c); 70 c = jhash_2words((__force u32)raddr->s6_addr32[3],
71 71 (__force u32)rport,
72 a += (__force u32)raddr->s6_addr32[3]; 72 c);
73 b += (__force u32)rport;
74 __jhash_mix(a, b, c);
75 73
76 return c & (synq_hsize - 1); 74 return c & (synq_hsize - 1);
77} 75}
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 0f276645375..07beeb06f75 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -104,26 +104,22 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
104unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr, 104unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr,
105 const struct in6_addr *daddr, u32 rnd) 105 const struct in6_addr *daddr, u32 rnd)
106{ 106{
107 u32 a, b, c; 107 u32 c;
108 108
109 a = (__force u32)saddr->s6_addr32[0]; 109 c = jhash_3words((__force u32)saddr->s6_addr32[0],
110 b = (__force u32)saddr->s6_addr32[1]; 110 (__force u32)saddr->s6_addr32[1],
111 c = (__force u32)saddr->s6_addr32[2]; 111 (__force u32)saddr->s6_addr32[2],
112 112 rnd);
113 a += JHASH_GOLDEN_RATIO; 113
114 b += JHASH_GOLDEN_RATIO; 114 c = jhash_3words((__force u32)saddr->s6_addr32[3],
115 c += rnd; 115 (__force u32)daddr->s6_addr32[0],
116 __jhash_mix(a, b, c); 116 (__force u32)daddr->s6_addr32[1],
117 117 c);
118 a += (__force u32)saddr->s6_addr32[3]; 118
119 b += (__force u32)daddr->s6_addr32[0]; 119 c = jhash_3words((__force u32)daddr->s6_addr32[2],
120 c += (__force u32)daddr->s6_addr32[1]; 120 (__force u32)daddr->s6_addr32[3],
121 __jhash_mix(a, b, c); 121 (__force u32)id,
122 122 c);
123 a += (__force u32)daddr->s6_addr32[2];
124 b += (__force u32)daddr->s6_addr32[3];
125 c += (__force u32)id;
126 __jhash_mix(a, b, c);
127 123
128 return c & (INETFRAGS_HASHSZ - 1); 124 return c & (INETFRAGS_HASHSZ - 1);
129} 125}