Commit 417f28bb authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

netns: dont alloc ipv6 fib timer list

FIB timer list is a trivial size structure, avoid indirection and just
put it in existing ns.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 888c848e
...@@ -39,7 +39,7 @@ struct netns_ipv6 { ...@@ -39,7 +39,7 @@ struct netns_ipv6 {
#endif #endif
struct rt6_info *ip6_null_entry; struct rt6_info *ip6_null_entry;
struct rt6_statistics *rt6_stats; struct rt6_statistics *rt6_stats;
struct timer_list *ip6_fib_timer; struct timer_list ip6_fib_timer;
struct hlist_head *fib_table_hash; struct hlist_head *fib_table_hash;
struct fib6_table *fib6_main_tbl; struct fib6_table *fib6_main_tbl;
struct dst_ops *ip6_dst_ops; struct dst_ops *ip6_dst_ops;
......
...@@ -661,16 +661,16 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, ...@@ -661,16 +661,16 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
static __inline__ void fib6_start_gc(struct net *net, struct rt6_info *rt) static __inline__ void fib6_start_gc(struct net *net, struct rt6_info *rt)
{ {
if (!timer_pending(net->ipv6.ip6_fib_timer) && if (!timer_pending(&net->ipv6.ip6_fib_timer) &&
(rt->rt6i_flags & (RTF_EXPIRES|RTF_CACHE))) (rt->rt6i_flags & (RTF_EXPIRES|RTF_CACHE)))
mod_timer(net->ipv6.ip6_fib_timer, mod_timer(&net->ipv6.ip6_fib_timer,
jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); jiffies + net->ipv6.sysctl.ip6_rt_gc_interval);
} }
void fib6_force_start_gc(struct net *net) void fib6_force_start_gc(struct net *net)
{ {
if (!timer_pending(net->ipv6.ip6_fib_timer)) if (!timer_pending(&net->ipv6.ip6_fib_timer))
mod_timer(net->ipv6.ip6_fib_timer, mod_timer(&net->ipv6.ip6_fib_timer,
jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); jiffies + net->ipv6.sysctl.ip6_rt_gc_interval);
} }
...@@ -1449,7 +1449,7 @@ void fib6_run_gc(unsigned long expires, struct net *net) ...@@ -1449,7 +1449,7 @@ void fib6_run_gc(unsigned long expires, struct net *net)
} else { } else {
local_bh_disable(); local_bh_disable();
if (!spin_trylock(&fib6_gc_lock)) { if (!spin_trylock(&fib6_gc_lock)) {
mod_timer(net->ipv6.ip6_fib_timer, jiffies + HZ); mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ);
local_bh_enable(); local_bh_enable();
return; return;
} }
...@@ -1462,12 +1462,10 @@ void fib6_run_gc(unsigned long expires, struct net *net) ...@@ -1462,12 +1462,10 @@ void fib6_run_gc(unsigned long expires, struct net *net)
fib6_clean_all(net, fib6_age, 0, NULL); fib6_clean_all(net, fib6_age, 0, NULL);
if (gc_args.more) if (gc_args.more)
mod_timer(net->ipv6.ip6_fib_timer, jiffies + mod_timer(&net->ipv6.ip6_fib_timer, jiffies +
net->ipv6.sysctl.ip6_rt_gc_interval); net->ipv6.sysctl.ip6_rt_gc_interval);
else { else
del_timer(net->ipv6.ip6_fib_timer); del_timer(&net->ipv6.ip6_fib_timer);
net->ipv6.ip6_fib_timer->expires = 0;
}
spin_unlock_bh(&fib6_gc_lock); spin_unlock_bh(&fib6_gc_lock);
} }
...@@ -1478,16 +1476,7 @@ static void fib6_gc_timer_cb(unsigned long arg) ...@@ -1478,16 +1476,7 @@ static void fib6_gc_timer_cb(unsigned long arg)
static int fib6_net_init(struct net *net) static int fib6_net_init(struct net *net)
{ {
int ret; setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net);
struct timer_list *timer;
ret = -ENOMEM;
timer = kzalloc(sizeof(*timer), GFP_KERNEL);
if (!timer)
goto out;
setup_timer(timer, fib6_gc_timer_cb, (unsigned long)net);
net->ipv6.ip6_fib_timer = timer;
net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL); net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL);
if (!net->ipv6.rt6_stats) if (!net->ipv6.rt6_stats)
...@@ -1521,9 +1510,7 @@ static int fib6_net_init(struct net *net) ...@@ -1521,9 +1510,7 @@ static int fib6_net_init(struct net *net)
#endif #endif
fib6_tables_init(net); fib6_tables_init(net);
ret = 0; return 0;
out:
return ret;
#ifdef CONFIG_IPV6_MULTIPLE_TABLES #ifdef CONFIG_IPV6_MULTIPLE_TABLES
out_fib6_main_tbl: out_fib6_main_tbl:
...@@ -1534,15 +1521,14 @@ static int fib6_net_init(struct net *net) ...@@ -1534,15 +1521,14 @@ static int fib6_net_init(struct net *net)
out_rt6_stats: out_rt6_stats:
kfree(net->ipv6.rt6_stats); kfree(net->ipv6.rt6_stats);
out_timer: out_timer:
kfree(timer); return -ENOMEM;
goto out;
} }
static void fib6_net_exit(struct net *net) static void fib6_net_exit(struct net *net)
{ {
rt6_ifdown(net, NULL); rt6_ifdown(net, NULL);
del_timer_sync(net->ipv6.ip6_fib_timer); del_timer_sync(&net->ipv6.ip6_fib_timer);
kfree(net->ipv6.ip6_fib_timer);
#ifdef CONFIG_IPV6_MULTIPLE_TABLES #ifdef CONFIG_IPV6_MULTIPLE_TABLES
kfree(net->ipv6.fib6_local_tbl); kfree(net->ipv6.fib6_local_tbl);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment