Subject: Re: [RFC PATCH net-next 2/2] net: Remove unused code and variables.

From: Simon Horman <[email-masked]>
Date: Wed, 17 May 2023 16:56:56 +0200

On Tue, May 16, 2023 at 09:27:57PM -0700, Kui-Feng Lee wrote:
> Since GC has been removed, some functions and variables are useless.  That
> includes some sysctl variables that control GC.
> 
> Signed-off-by: Kui-Feng Lee <[email-masked]>

Hi Kui-Feng,

thanks for your patch.
Some initial review from my side.

> -static void fib6_gc_timer_cb(struct timer_list *t)
> -{
> -	struct net *arg = from_timer(arg, t, ipv6.ip6_fib_timer);
> -
> -	fib6_run_gc(0, arg, true);
> -}
> -

There is a forward declaration of fib6_gc_timer_cb around line 80.
It should be removed too.

...

> @@ -3283,28 +3281,6 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
>  	return dst;
>  }
>  
> -static void ip6_dst_gc(struct dst_ops *ops)

There is a forward declaration of ip6_dst_gc() around line 94.
That should be deleted too.

> -{
> -	struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops);
> -	int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
> -	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;
> -	unsigned int val;
> -	int entries;
> -
> -	if (time_after(rt_last_gc + rt_min_interval, jiffies))
> -		goto out;
> -
> -	fib6_run_gc(atomic_inc_return(&net->ipv6.ip6_rt_gc_expire), net, true);
> -	entries = dst_entries_get_slow(ops);
> -	if (entries < ops->gc_thresh)
> -		atomic_set(&net->ipv6.ip6_rt_gc_expire, rt_gc_timeout >> 1);
> -out:
> -	val = atomic_read(&net->ipv6.ip6_rt_gc_expire);
> -	atomic_set(&net->ipv6.ip6_rt_gc_expire, val - (val >> rt_elasticity));
> -}
> -

...