All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: dsahern@kernel.org
Cc: netdev@vger.kernel.org, idosch@nvidia.com, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, ralf@mandelbit.com, ja@ssi.bg,
	dahern@nvidia.com, noreply@anthropic.com
Subject: Re: [PATCH net-next v3 07/13] ipv6: make rt_genid_bump_ipv6() a plain counter increment
Date: Sat, 05 Dec 2026 19:20:57 +0000	[thread overview]
Message-ID: <179649845771.3148.18160229809237331625@kernel.org> (raw)
In-Reply-To: <20261201174021.7211-8-dsahern@kernel.org>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] In include/net/net_namespace.h, this patch changes
  rt_genid_bump_ipv6() from void to int.

--

ipv6: make rt_genid_bump_ipv6() a plain counter increment

This patch replaces the fib6_flush_trees() walk behind
rt_genid_bump_ipv6() with an increment of net->ipv6.fib6_sernum. The
increment wraps to 1 so the value is never 0. It also drops the
__fib6_flush_trees pointer and its export, fib6_new_sernum(), and the
sernum handling in fib6_cleaner.

> diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
> index 4a4d72080acdc..f39baf51bcc5d 100644
> --- a/include/net/net_namespace.h
> +++ b/include/net/net_namespace.h
> @@ -556,18 +556,30 @@ static inline int rt_genid_ipv6(const struct net *net)
>  {
>  	return atomic_read(&net->ipv6.fib6_sernum);
>  }
> -#endif
>  
> -static inline void rt_genid_bump_ipv4(struct net *net)
> +/* Invalidate every cached IPv6 dst in @net. Returns the new generation,
> + * which is never 0.
> + */
> +static inline int rt_genid_bump_ipv6(struct net *net)
>  {
> -	atomic_inc(&net->ipv4.rt_genid);
> +	int new, old = atomic_read(&net->ipv6.fib6_sernum);
> +
> +	do {
> +		new = old < INT_MAX ? old + 1 : 1;
> +	} while (!atomic_try_cmpxchg(&net->ipv6.fib6_sernum, &old, new));
> +
> +	return new;
>  }
> +#else
> +static inline int rt_genid_bump_ipv6(struct net *net)
> +{
> +	return 0;
> +}
> +#endif

[Severity: Low]
This isn't a bug, but the new comment on rt_genid_bump_ipv6() says the
return value is never 0. The !CONFIG_IPV6 stub added just below returns
exactly 0.

No current caller is affected. The callers that use the return value
are fib6_update_sernum(), fib6_update_sernum_upto_root() and fib6_add()
in net/ipv6/ip6_fib.c, which only builds with IPv6. Every other caller
ignores the result: rt_genid_bump_all(), xfrm_policy.c, nexthop.c,
addrconf.c and fib6_rules.c.

The later patch in the series, "ipv6: stamp dsts with the generation
sampled before the FIB lookup", adds rt_genid_ipv6_sample() but leaves
this comment and the stub unchanged.

Would it be clearer for the comment to say the non-zero guarantee holds
only with CONFIG_IPV6? Another option is to have the stub return a
non-zero value, so a future caller outside IPv6 can't rely on 0 meaning
something.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201174021.7211-1-dsahern%40kernel.org

  reply	other threads:[~2026-12-05 19:20 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 17:40 [PATCH net-next v3 00/13] ipv6: validate cached dsts against the netns route generation David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 01/13] ipv6: allocate the exception entry before removing the one it replaces David Ahern
2026-12-02 16:02   ` Ido Schimmel
2026-12-01 17:40 ` [PATCH net-next v3 02/13] ipv6: keep a superseded pcpu dst working until its holders notice David Ahern
2026-12-02 16:19   ` Ido Schimmel
2026-12-05 19:20   ` netdev-bot+sashiko
2026-12-01 17:40 ` [PATCH net-next v3 03/13] ipv6: don't insert a PMTU exception whose MTU could not be stored David Ahern
2026-12-05 19:20   ` netdev-bot+sashiko
2026-12-01 17:40 ` [PATCH net-next v3 04/13] ipv6: invalidate the failing dst in ip6_link_failure() David Ahern
2026-12-05 19:20   ` netdev-bot+sashiko
2026-12-01 17:40 ` [PATCH net-next v3 05/13] ipv6: tell route dumps about exception inserts with a table sequence David Ahern
2026-12-05 19:20   ` netdev-bot+sashiko
2026-12-01 17:40 ` [PATCH net-next v3 06/13] ipv6: validate dsts against the netns route generation David Ahern
2026-12-05 19:20   ` netdev-bot+sashiko
2026-12-01 17:40 ` [PATCH net-next v3 07/13] ipv6: make rt_genid_bump_ipv6() a plain counter increment David Ahern
2026-12-05 19:20   ` netdev-bot+sashiko [this message]
2026-12-01 17:40 ` [PATCH net-next v3 08/13] nexthop: factor out nh_has_f6i() David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 09/13] nexthop: bump the IPv6 route generation on group changes David Ahern
2026-12-05 19:20   ` netdev-bot+sashiko
2026-12-01 17:40 ` [PATCH net-next v3 10/13] ipv6: stamp dsts with the generation sampled before the FIB lookup David Ahern
2026-12-05 19:21   ` netdev-bot+sashiko
2026-12-01 17:40 ` [PATCH net-next v3 11/13] selftests: net: pmtu: check that a deleted cached exception stays deleted David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 12/13] selftests: net: fib_tests: Add stale pcpu test David Ahern
2026-12-05 19:21   ` netdev-bot+sashiko
2026-12-01 17:40 ` [PATCH net-next v3 13/13] selftests: net: ipvs: check a PMTU learned after the DR route was cached David Ahern
2026-12-05 19:21   ` netdev-bot+sashiko
2026-12-01 17:43 ` [PATCH net-next v3 00/13] ipv6: validate cached dsts against the netns route generation netdev-bot+sinfo
2026-12-02  9:45 ` Ralf Lici
2026-12-03 15:34 ` Ido Schimmel
2026-12-03 16:55   ` Ralf Lici
2026-12-03 17:16     ` Ido Schimmel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179649845771.3148.18160229809237331625@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=dahern@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=ja@ssi.bg \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=noreply@anthropic.com \
    --cc=pabeni@redhat.com \
    --cc=ralf@mandelbit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.