aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-07-22 17:33:45 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-22 17:33:45 -0400
commit417f28bb340725544c36b35465444d2fd57232b8 (patch)
tree8a38097b4ea34a2877ecfdb95f37ad2864f5754d
parent888c848ed34bd5f8cb56567624c0d951ab35174e (diff)
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: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/netns/ipv6.h2
-rw-r--r--net/ipv6/ip6_fib.c40
2 files changed, 14 insertions, 28 deletions
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 5bacd838e88b..2932721180c0 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -39,7 +39,7 @@ struct netns_ipv6 {
39#endif 39#endif
40 struct rt6_info *ip6_null_entry; 40 struct rt6_info *ip6_null_entry;
41 struct rt6_statistics *rt6_stats; 41 struct rt6_statistics *rt6_stats;
42 struct timer_list *ip6_fib_timer; 42 struct timer_list ip6_fib_timer;
43 struct hlist_head *fib_table_hash; 43 struct hlist_head *fib_table_hash;
44 struct fib6_table *fib6_main_tbl; 44 struct fib6_table *fib6_main_tbl;
45 struct dst_ops *ip6_dst_ops; 45 struct dst_ops *ip6_dst_ops;
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 944095cf5e32..e0922975c410 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -661,16 +661,16 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
661 661
662static __inline__ void fib6_start_gc(struct net *net, struct rt6_info *rt) 662static __inline__ void fib6_start_gc(struct net *net, struct rt6_info *rt)
663{ 663{
664 if (!timer_pending(net->ipv6.ip6_fib_timer) && 664 if (!timer_pending(&net->ipv6.ip6_fib_timer) &&
665 (rt->rt6i_flags & (RTF_EXPIRES|RTF_CACHE))) 665 (rt->rt6i_flags & (RTF_EXPIRES|RTF_CACHE)))
666 mod_timer(net->ipv6.ip6_fib_timer, 666 mod_timer(&net->ipv6.ip6_fib_timer,
667 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); 667 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval);
668} 668}
669 669
670void fib6_force_start_gc(struct net *net) 670void fib6_force_start_gc(struct net *net)
671{ 671{
672 if (!timer_pending(net->ipv6.ip6_fib_timer)) 672 if (!timer_pending(&net->ipv6.ip6_fib_timer))
673 mod_timer(net->ipv6.ip6_fib_timer, 673 mod_timer(&net->ipv6.ip6_fib_timer,
674 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); 674 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval);
675} 675}
676 676
@@ -1449,7 +1449,7 @@ void fib6_run_gc(unsigned long expires, struct net *net)
1449 } else { 1449 } else {
1450 local_bh_disable(); 1450 local_bh_disable();
1451 if (!spin_trylock(&fib6_gc_lock)) { 1451 if (!spin_trylock(&fib6_gc_lock)) {
1452 mod_timer(net->ipv6.ip6_fib_timer, jiffies + HZ); 1452 mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ);
1453 local_bh_enable(); 1453 local_bh_enable();
1454 return; 1454 return;
1455 } 1455 }
@@ -1462,12 +1462,10 @@ void fib6_run_gc(unsigned long expires, struct net *net)
1462 fib6_clean_all(net, fib6_age, 0, NULL); 1462 fib6_clean_all(net, fib6_age, 0, NULL);
1463 1463
1464 if (gc_args.more) 1464 if (gc_args.more)
1465 mod_timer(net->ipv6.ip6_fib_timer, jiffies + 1465 mod_timer(&net->ipv6.ip6_fib_timer, jiffies +
1466 net->ipv6.sysctl.ip6_rt_gc_interval); 1466 net->ipv6.sysctl.ip6_rt_gc_interval);
1467 else { 1467 else
1468 del_timer(net->ipv6.ip6_fib_timer); 1468 del_timer(&net->ipv6.ip6_fib_timer);
1469 net->ipv6.ip6_fib_timer->expires = 0;
1470 }
1471 spin_unlock_bh(&fib6_gc_lock); 1469 spin_unlock_bh(&fib6_gc_lock);
1472} 1470}
1473 1471
@@ -1478,16 +1476,7 @@ static void fib6_gc_timer_cb(unsigned long arg)
1478 1476
1479static int fib6_net_init(struct net *net) 1477static int fib6_net_init(struct net *net)
1480{ 1478{
1481 int ret; 1479 setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net);
1482 struct timer_list *timer;
1483
1484 ret = -ENOMEM;
1485 timer = kzalloc(sizeof(*timer), GFP_KERNEL);
1486 if (!timer)
1487 goto out;
1488
1489 setup_timer(timer, fib6_gc_timer_cb, (unsigned long)net);
1490 net->ipv6.ip6_fib_timer = timer;
1491 1480
1492 net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL); 1481 net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL);
1493 if (!net->ipv6.rt6_stats) 1482 if (!net->ipv6.rt6_stats)
@@ -1521,9 +1510,7 @@ static int fib6_net_init(struct net *net)
1521#endif 1510#endif
1522 fib6_tables_init(net); 1511 fib6_tables_init(net);
1523 1512
1524 ret = 0; 1513 return 0;
1525out:
1526 return ret;
1527 1514
1528#ifdef CONFIG_IPV6_MULTIPLE_TABLES 1515#ifdef CONFIG_IPV6_MULTIPLE_TABLES
1529out_fib6_main_tbl: 1516out_fib6_main_tbl:
@@ -1534,15 +1521,14 @@ out_fib_table_hash:
1534out_rt6_stats: 1521out_rt6_stats:
1535 kfree(net->ipv6.rt6_stats); 1522 kfree(net->ipv6.rt6_stats);
1536out_timer: 1523out_timer:
1537 kfree(timer); 1524 return -ENOMEM;
1538 goto out;
1539 } 1525 }
1540 1526
1541static void fib6_net_exit(struct net *net) 1527static void fib6_net_exit(struct net *net)
1542{ 1528{
1543 rt6_ifdown(net, NULL); 1529 rt6_ifdown(net, NULL);
1544 del_timer_sync(net->ipv6.ip6_fib_timer); 1530 del_timer_sync(&net->ipv6.ip6_fib_timer);
1545 kfree(net->ipv6.ip6_fib_timer); 1531
1546#ifdef CONFIG_IPV6_MULTIPLE_TABLES 1532#ifdef CONFIG_IPV6_MULTIPLE_TABLES
1547 kfree(net->ipv6.fib6_local_tbl); 1533 kfree(net->ipv6.fib6_local_tbl);
1548#endif 1534#endif