route.c (6891a346c387bd0a64afa50f4522f5fe8ba879d8) route.c (7019b78e1483fa724dcba56e8465376b8fd03ea8)
1/*
2 * Linux INET6 implementation
3 * FIB front-end.
4 *
5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt>
7 *
8 * $Id: route.c,v 1.56 2001/10/31 21:55:55 davem Exp $

--- 978 unchanged lines hidden (view full) ---

987
988 spin_unlock_bh(&icmp6_dst_lock);
989
990 return freed;
991}
992
993static int ip6_dst_gc(struct dst_ops *ops)
994{
1/*
2 * Linux INET6 implementation
3 * FIB front-end.
4 *
5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt>
7 *
8 * $Id: route.c,v 1.56 2001/10/31 21:55:55 davem Exp $

--- 978 unchanged lines hidden (view full) ---

987
988 spin_unlock_bh(&icmp6_dst_lock);
989
990 return freed;
991}
992
993static int ip6_dst_gc(struct dst_ops *ops)
994{
995 struct net *net = ops->dst_net;
996 unsigned long now = jiffies;
995 unsigned long now = jiffies;
996 struct net *net = ops->dst_net;
997 int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
998 int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size;
999 int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity;
1000 int rt_gc_timeout = net->ipv6.sysctl.ip6_rt_gc_timeout;
1001 unsigned long rt_last_gc = net->ipv6.ip6_rt_last_gc;
997
1002
998 if (time_after(net->ipv6.ip6_rt_last_gc + net->ipv6.sysctl.ip6_rt_gc_min_interval, now) &&
999 atomic_read(&net->ipv6.ip6_dst_ops->entries) <= net->ipv6.sysctl.ip6_rt_max_size)
1003 if (time_after(rt_last_gc + rt_min_interval, now) &&
1004 atomic_read(&ops->entries) <= rt_max_size)
1000 goto out;
1001
1002 net->ipv6.ip6_rt_gc_expire++;
1003 fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net);
1004 net->ipv6.ip6_rt_last_gc = now;
1005 goto out;
1006
1007 net->ipv6.ip6_rt_gc_expire++;
1008 fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net);
1009 net->ipv6.ip6_rt_last_gc = now;
1005 if (atomic_read(&net->ipv6.ip6_dst_ops->entries) < net->ipv6.ip6_dst_ops->gc_thresh)
1006 net->ipv6.ip6_rt_gc_expire = net->ipv6.sysctl.ip6_rt_gc_timeout>>1;
1007
1010 if (atomic_read(&ops->entries) < ops->gc_thresh)
1011 net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1;
1008out:
1012out:
1009 net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>net->ipv6.sysctl.ip6_rt_gc_elasticity;
1010 return (atomic_read(&net->ipv6.ip6_dst_ops->entries) > net->ipv6.sysctl.ip6_rt_max_size);
1013 net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>rt_elasticity;
1014 return (atomic_read(&ops->entries) > rt_max_size);
1011}
1012
1013/* Clean host part of a prefix. Not necessary in radix tree,
1014 but results in cleaner routing tables.
1015
1016 Remove it only when all the things will work!
1017 */
1018

--- 1706 unchanged lines hidden ---
1015}
1016
1017/* Clean host part of a prefix. Not necessary in radix tree,
1018 but results in cleaner routing tables.
1019
1020 Remove it only when all the things will work!
1021 */
1022

--- 1706 unchanged lines hidden ---