summaryrefslogtreecommitdiff
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-03-04 13:50:14 -0800
committerDavid S. Miller <davem@davemloft.net>2008-03-04 13:50:14 -0800
commit7019b78e1483fa724dcba56e8465376b8fd03ea8 (patch)
treedb1724c6a9e63257eb810b4e4d4ee744098c4f6c /net/ipv6/route.c
parent6891a346c387bd0a64afa50f4522f5fe8ba879d8 (diff)
downloadlinux-3.10-7019b78e1483fa724dcba56e8465376b8fd03ea8.tar.gz
linux-3.10-7019b78e1483fa724dcba56e8465376b8fd03ea8.tar.bz2
linux-3.10-7019b78e1483fa724dcba56e8465376b8fd03ea8.zip
[NETNS][IPV6] route6 - Make ip6_dst_gc simpler
This patches improves the readibility of the ip6_dst_gc() routine. It simplifies long lines which grow a lot due to the introduction of network namespaces support. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Acked-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 10a6cc0aca6..ec1fedb339c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -992,22 +992,26 @@ int icmp6_dst_gc(int *more)
static int ip6_dst_gc(struct dst_ops *ops)
{
- struct net *net = ops->dst_net;
unsigned long now = jiffies;
-
- if (time_after(net->ipv6.ip6_rt_last_gc + net->ipv6.sysctl.ip6_rt_gc_min_interval, now) &&
- atomic_read(&net->ipv6.ip6_dst_ops->entries) <= net->ipv6.sysctl.ip6_rt_max_size)
+ struct net *net = ops->dst_net;
+ int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
+ int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size;
+ int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity;
+ int rt_gc_timeout = net->ipv6.sysctl.ip6_rt_gc_timeout;
+ unsigned long rt_last_gc = net->ipv6.ip6_rt_last_gc;
+
+ if (time_after(rt_last_gc + rt_min_interval, now) &&
+ atomic_read(&ops->entries) <= rt_max_size)
goto out;
net->ipv6.ip6_rt_gc_expire++;
fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net);
net->ipv6.ip6_rt_last_gc = now;
- if (atomic_read(&net->ipv6.ip6_dst_ops->entries) < net->ipv6.ip6_dst_ops->gc_thresh)
- net->ipv6.ip6_rt_gc_expire = net->ipv6.sysctl.ip6_rt_gc_timeout>>1;
-
+ if (atomic_read(&ops->entries) < ops->gc_thresh)
+ net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1;
out:
- net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>net->ipv6.sysctl.ip6_rt_gc_elasticity;
- return (atomic_read(&net->ipv6.ip6_dst_ops->entries) > net->ipv6.sysctl.ip6_rt_max_size);
+ net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>rt_elasticity;
+ return (atomic_read(&ops->entries) > rt_max_size);
}
/* Clean host part of a prefix. Not necessary in radix tree,