Commit 7019b78e authored by Daniel Lezcano's avatar Daniel Lezcano Committed by David S. Miller

[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: default avatarDaniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: default avatarBenjamin Thery <benjamin.thery@bull.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6891a346
...@@ -992,22 +992,26 @@ int icmp6_dst_gc(int *more) ...@@ -992,22 +992,26 @@ int icmp6_dst_gc(int *more)
static int ip6_dst_gc(struct dst_ops *ops) static int ip6_dst_gc(struct dst_ops *ops)
{ {
struct net *net = ops->dst_net;
unsigned long now = jiffies; unsigned long now = jiffies;
struct net *net = ops->dst_net;
if (time_after(net->ipv6.ip6_rt_last_gc + net->ipv6.sysctl.ip6_rt_gc_min_interval, now) && int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
atomic_read(&net->ipv6.ip6_dst_ops->entries) <= net->ipv6.sysctl.ip6_rt_max_size) 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; goto out;
net->ipv6.ip6_rt_gc_expire++; net->ipv6.ip6_rt_gc_expire++;
fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net); fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net);
net->ipv6.ip6_rt_last_gc = now; net->ipv6.ip6_rt_last_gc = now;
if (atomic_read(&net->ipv6.ip6_dst_ops->entries) < net->ipv6.ip6_dst_ops->gc_thresh) if (atomic_read(&ops->entries) < ops->gc_thresh)
net->ipv6.ip6_rt_gc_expire = net->ipv6.sysctl.ip6_rt_gc_timeout>>1; net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1;
out: out:
net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>net->ipv6.sysctl.ip6_rt_gc_elasticity; net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>rt_elasticity;
return (atomic_read(&net->ipv6.ip6_dst_ops->entries) > net->ipv6.sysctl.ip6_rt_max_size); return (atomic_read(&ops->entries) > rt_max_size);
} }
/* Clean host part of a prefix. Not necessary in radix tree, /* Clean host part of a prefix. Not necessary in radix tree,
......
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