[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c9bee472-c94e-4878-8cc2-1512b2c54db5@redhat.com>
Date: Wed, 16 Apr 2025 11:57:23 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>,
"David S. Miller" <davem@...emloft.net>, David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>
Cc: Simon Horman <horms@...nel.org>, Kuniyuki Iwashima <kuni1840@...il.com>,
netdev@...r.kernel.org
Subject: Re: [PATCH RESEND v2 net-next 10/14] ipv6: Factorise
ip6_route_multipath_add().
On 4/14/25 8:14 PM, Kuniyuki Iwashima wrote:
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 49eea7e1e2da..c026f8fe5f78 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -5315,29 +5315,131 @@ struct rt6_nh {
> struct fib6_info *fib6_info;
> struct fib6_config r_cfg;
> struct list_head next;
> + int weight;
> };
>
> -static int ip6_route_info_append(struct list_head *rt6_nh_list,
> - struct fib6_info *rt,
> - struct fib6_config *r_cfg)
> +static void ip6_route_mpath_info_cleanup(struct list_head *rt6_nh_list)
> {
> - struct rt6_nh *nh;
> - int err = -EEXIST;
> + struct rt6_nh *nh, *nh_next;
>
> - list_for_each_entry(nh, rt6_nh_list, next) {
> - /* check if fib6_info already exists */
> - if (rt6_duplicate_nexthop(nh->fib6_info, rt))
> - return err;
> + list_for_each_entry_safe(nh, nh_next, rt6_nh_list, next) {
> + struct fib6_info *rt = nh->fib6_info;
> +
> + if (rt) {
> + free_percpu(rt->fib6_nh->nh_common.nhc_pcpu_rth_output);
> + free_percpu(rt->fib6_nh->rt6i_pcpu);
> + ip_fib_metrics_put(rt->fib6_metrics);
> + kfree(rt);
> + }
> +
> + list_del(&nh->next);
Somewhat unrelated, but the field 'next' has IMHO a quite misleading
name, and it would be great to rename it to something else ('list'),
could you please consider including such change?
Thanks,
Paolo
Powered by blists - more mailing lists