From 681f040ea84a4283635654c4fbe6060cd6153fd8 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 14 Oct 2011 14:28:49 -0700 Subject: [PATCH] datapath: Factor out repeated tnl_vport_to_vport() calls. This is a code cleanup only. Signed-off-by: Ben Pfaff Acked-by: Jesse Gross --- datapath/tunnel.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/datapath/tunnel.c b/datapath/tunnel.c index 3bf58ddf..5b3d7f51 100644 --- a/datapath/tunnel.c +++ b/datapath/tunnel.c @@ -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; } } -- 2.30.2