datapath: Factor out repeated tnl_vport_to_vport() calls.
authorBen Pfaff <blp@nicira.com>
Fri, 14 Oct 2011 21:28:49 +0000 (14:28 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 17 Oct 2011 15:59:35 +0000 (08:59 -0700)
This is a code cleanup only.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
datapath/tunnel.c

index 3bf58ddf5a54867a0d6ab1eb6f868e20676a4364..5b3d7f51d6694919d82927093fdf31d7e0c89197 100644 (file)
@@ -227,8 +227,8 @@ static void port_table_remove_port(struct vport *vport)
        (*find_port_pool(rtnl_dereference(tnl_vport->mutable)))--;
 }
 
-static struct tnl_vport *port_table_lookup(struct port_lookup_key *key,
-                           const struct tnl_mutable_config **pmutable)
+static struct vport *port_table_lookup(struct port_lookup_key *key,
+                                      const struct tnl_mutable_config **pmutable)
 {
        struct hlist_node *n;
        struct hlist_head *bucket;
@@ -243,7 +243,7 @@ static struct tnl_vport *port_table_lookup(struct port_lookup_key *key,
                mutable = rcu_dereference_rtnl(tnl_vport->mutable);
                if (!memcmp(&mutable->key, key, PORT_KEY_LEN)) {
                        *pmutable = mutable;
-                       return tnl_vport;
+                       return tnl_vport_to_vport(tnl_vport);
                }
        }
 
@@ -255,7 +255,7 @@ struct vport *tnl_find_port(__be32 saddr, __be32 daddr, __be64 key,
                            const struct tnl_mutable_config **mutable)
 {
        struct port_lookup_key lookup;
-       struct tnl_vport * tnl_vport;
+       struct vport *vport;
 
        lookup.saddr = saddr;
        lookup.daddr = daddr;
@@ -265,16 +265,16 @@ struct vport *tnl_find_port(__be32 saddr, __be32 daddr, __be64 key,
                lookup.tunnel_type = tunnel_type & ~TNL_T_KEY_MATCH;
 
                if (key_local_remote_ports) {
-                       tnl_vport = port_table_lookup(&lookup, mutable);
-                       if (tnl_vport)
-                               return tnl_vport_to_vport(tnl_vport);
+                       vport = port_table_lookup(&lookup, mutable);
+                       if (vport)
+                               return vport;
                }
 
                if (key_remote_ports) {
                        lookup.saddr = 0;
-                       tnl_vport = port_table_lookup(&lookup, mutable);
-                       if (tnl_vport)
-                               return tnl_vport_to_vport(tnl_vport);
+                       vport = port_table_lookup(&lookup, mutable);
+                       if (vport)
+                               return vport;
 
                        lookup.saddr = saddr;
                }
@@ -285,16 +285,16 @@ struct vport *tnl_find_port(__be32 saddr, __be32 daddr, __be64 key,
                lookup.tunnel_type = tunnel_type & ~TNL_T_KEY_EXACT;
 
                if (local_remote_ports) {
-                       tnl_vport = port_table_lookup(&lookup, mutable);
-                       if (tnl_vport)
-                               return tnl_vport_to_vport(tnl_vport);
+                       vport = port_table_lookup(&lookup, mutable);
+                       if (vport)
+                               return vport;
                }
 
                if (remote_ports) {
                        lookup.saddr = 0;
-                       tnl_vport = port_table_lookup(&lookup, mutable);
-                       if (tnl_vport)
-                               return tnl_vport_to_vport(tnl_vport);
+                       vport = port_table_lookup(&lookup, mutable);
+                       if (vport)
+                               return vport;
                }
        }