aboutsummaryrefslogtreecommitdiff
path: root/net/ipv4
diff options
context:
space:
mode:
authorNicolas Dichtel2015-07-24 12:28:36 +0200
committerDavid S. Miller2015-07-27 01:02:49 -0700
commit5a6228a0b472062646434cd2536d109c102b606e (patch)
tree29b6d0958db33b1fc5980dbbcec192a7b1d20c19 /net/ipv4
parentd943659508a4fb883507fdd3f998329e70a8f922 (diff)
lwtunnel: change prototype of lwtunnel_state_get()
It saves some lines and simplify a bit the code when the state is returning by this function. It's also useful to handle a NULL entry. To avoid too long lines, I've also renamed lwtunnel_state_get() and lwtunnel_state_put() to lwtstate_get() and lwtstate_put(). CC: Thomas Graf <tgraf@suug.ch> CC: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Thomas Graf <tgraf@suug.ch> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_semantics.c9
-rw-r--r--net/ipv4/route.c9
2 files changed, 6 insertions, 12 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index d4c6732cfbfa..65e00399a9a6 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -209,7 +209,7 @@ static void free_fib_info_rcu(struct rcu_head *head)
change_nexthops(fi) {
if (nexthop_nh->nh_dev)
dev_put(nexthop_nh->nh_dev);
- lwtunnel_state_put(nexthop_nh->nh_lwtstate);
+ lwtstate_put(nexthop_nh->nh_lwtstate);
free_nh_exceptions(nexthop_nh);
rt_fibinfo_free_cpus(nexthop_nh->nh_pcpu_rth_output);
rt_fibinfo_free(&nexthop_nh->nh_rth_input);
@@ -514,8 +514,8 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
nla, &lwtstate);
if (ret)
goto errout;
- lwtunnel_state_get(lwtstate);
- nexthop_nh->nh_lwtstate = lwtstate;
+ nexthop_nh->nh_lwtstate =
+ lwtstate_get(lwtstate);
}
}
@@ -971,8 +971,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
if (err)
goto failure;
- lwtunnel_state_get(lwtstate);
- nh->nh_lwtstate = lwtstate;
+ nh->nh_lwtstate = lwtstate_get(lwtstate);
}
nh->nh_oif = cfg->fc_oif;
nh->nh_gw = cfg->fc_gw;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 519ec232818d..11096396ef4a 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1358,7 +1358,7 @@ static void ipv4_dst_destroy(struct dst_entry *dst)
list_del(&rt->rt_uncached);
spin_unlock_bh(&ul->lock);
}
- lwtunnel_state_put(rt->rt_lwtstate);
+ lwtstate_put(rt->rt_lwtstate);
}
void rt_flush_dev(struct net_device *dev)
@@ -1407,12 +1407,7 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
#ifdef CONFIG_IP_ROUTE_CLASSID
rt->dst.tclassid = nh->nh_tclassid;
#endif
- if (nh->nh_lwtstate) {
- lwtunnel_state_get(nh->nh_lwtstate);
- rt->rt_lwtstate = nh->nh_lwtstate;
- } else {
- rt->rt_lwtstate = NULL;
- }
+ rt->rt_lwtstate = lwtstate_get(nh->nh_lwtstate);
if (unlikely(fnhe))
cached = rt_bind_exception(rt, fnhe, daddr);
else if (!(rt->dst.flags & DST_NOCACHE))