Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=87d1a164df0b5e297cda698724ea7984d8392b06
Commit:     87d1a164df0b5e297cda698724ea7984d8392b06
Parent:     420fe234ad7adaa5a5445e5fab83b1485ed9e0f3
Author:     YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
AuthorDate: Tue Apr 24 20:44:47 2007 +0900
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Apr 25 22:29:55 2007 -0700

    [IPV4] IPIP: Unify code path to get hash array index.
    
    Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 net/ipv4/ipip.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 37ab391..ebd2f2d 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)
        return NULL;
 }
 
-static struct ip_tunnel **ipip_bucket(struct ip_tunnel *t)
+static struct ip_tunnel **__ipip_bucket(struct ip_tunnel_parm *parms)
 {
-       __be32 remote = t->parms.iph.daddr;
-       __be32 local = t->parms.iph.saddr;
+       __be32 remote = parms->iph.daddr;
+       __be32 local = parms->iph.saddr;
        unsigned h = 0;
        int prio = 0;
 
@@ -175,6 +175,10 @@ static struct ip_tunnel **ipip_bucket(struct ip_tunnel *t)
        return &tunnels[prio][h];
 }
 
+static inline struct ip_tunnel **ipip_bucket(struct ip_tunnel *t)
+{
+       return __ipip_bucket(&t->parms);
+}
 
 static void ipip_tunnel_unlink(struct ip_tunnel *t)
 {
@@ -206,19 +210,9 @@ static struct ip_tunnel * ipip_tunnel_locate(struct 
ip_tunnel_parm *parms, int c
        __be32 local = parms->iph.saddr;
        struct ip_tunnel *t, **tp, *nt;
        struct net_device *dev;
-       unsigned h = 0;
-       int prio = 0;
        char name[IFNAMSIZ];
 
-       if (remote) {
-               prio |= 2;
-               h ^= HASH(remote);
-       }
-       if (local) {
-               prio |= 1;
-               h ^= HASH(local);
-       }
-       for (tp = &tunnels[prio][h]; (t = *tp) != NULL; tp = &t->next) {
+       for (tp = __ipip_bucket(parms); (t = *tp) != NULL; tp = &t->next) {
                if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr)
                        return t;
        }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to