aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2007-04-24 07:44:47 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:29:55 -0400
commit87d1a164df0b5e297cda698724ea7984d8392b06 (patch)
treecedad5d1b3d0f1f2255c1816bd85003784be2b42 /net
parent420fe234ad7adaa5a5445e5fab83b1485ed9e0f3 (diff)
[IPV4] IPIP: Unify code path to get hash array index.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ipip.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 37ab39170175..ebd2f2d532f6 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -157,10 +157,10 @@ static struct ip_tunnel * ipip_tunnel_lookup(__be32 remote, __be32 local)
157 return NULL; 157 return NULL;
158} 158}
159 159
160static struct ip_tunnel **ipip_bucket(struct ip_tunnel *t) 160static struct ip_tunnel **__ipip_bucket(struct ip_tunnel_parm *parms)
161{ 161{
162 __be32 remote = t->parms.iph.daddr; 162 __be32 remote = parms->iph.daddr;
163 __be32 local = t->parms.iph.saddr; 163 __be32 local = parms->iph.saddr;
164 unsigned h = 0; 164 unsigned h = 0;
165 int prio = 0; 165 int prio = 0;
166 166
@@ -175,6 +175,10 @@ static struct ip_tunnel **ipip_bucket(struct ip_tunnel *t)
175 return &tunnels[prio][h]; 175 return &tunnels[prio][h];
176} 176}
177 177
178static inline struct ip_tunnel **ipip_bucket(struct ip_tunnel *t)
179{
180 return __ipip_bucket(&t->parms);
181}
178 182
179static void ipip_tunnel_unlink(struct ip_tunnel *t) 183static void ipip_tunnel_unlink(struct ip_tunnel *t)
180{ 184{
@@ -206,19 +210,9 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c
206 __be32 local = parms->iph.saddr; 210 __be32 local = parms->iph.saddr;
207 struct ip_tunnel *t, **tp, *nt; 211 struct ip_tunnel *t, **tp, *nt;
208 struct net_device *dev; 212 struct net_device *dev;
209 unsigned h = 0;
210 int prio = 0;
211 char name[IFNAMSIZ]; 213 char name[IFNAMSIZ];
212 214
213 if (remote) { 215 for (tp = __ipip_bucket(parms); (t = *tp) != NULL; tp = &t->next) {
214 prio |= 2;
215 h ^= HASH(remote);
216 }
217 if (local) {
218 prio |= 1;
219 h ^= HASH(local);
220 }
221 for (tp = &tunnels[prio][h]; (t = *tp) != NULL; tp = &t->next) {
222 if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr) 216 if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr)
223 return t; 217 return t;
224 } 218 }