[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAVpQUCRN-bS-=5wAB+S_bCQ-hYY1kp6XpjX6cKGoC2LhYLwyQ@mail.gmail.com>
Date: Tue, 27 Jan 2026 00:11:45 -0800
From: Kuniyuki Iwashima <kuniyu@...gle.com>
To: Dmitry Skorodumov <skorodumov.dmitry@...wei.com>
Cc: Eric Dumazet <edumazet@...gle.com>, Dmitry Skorodumov <dskr99@...il.com>, netdev@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>, Xiao Liang <shaw.leon@...il.com>,
linux-kernel@...r.kernel.org, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH v2 net-next 2/3] ipvlan: Common code from v6/v4 validator_event
On Mon, Jan 26, 2026 at 11:54 PM Dmitry Skorodumov
<skorodumov.dmitry@...wei.com> wrote:
>
> On 1/27/2026 10:37 AM, Eric Dumazet wrote:
> > On Tue, Jan 27, 2026 at 6:56 AM Dmitry Skorodumov
> > <skorodumov.dmitry@...wei.com> wrote:
> >> It even might be a good idea to replace wherever possible preprocessor
> >> checks with runtime checks. Use
> >> if (IS_ENABLED(CONFIG_IPV6)) { ... }
> >>
> >> instead of #if IS_ENABLED(CONFIG_IPV6) ... #endif
> >>
> >> --
> >>
> >> I'm ok with both approaches (though i tend to like runtime checks) - but
> >> unsure what is a common practice in bpf-net
> >
> > What you call runtime checks is in reality the same : C compiler is
> > able to optimize constant boolean expressions
>
> Should I fix patches to be something like
>
> if (nblock == &ipvlan_addr4_vtor_notifier_block) {
> } else if (IS_ENABLED(CONFIG_IPV6)) {
> ...
> }
>
> but still with __maybe_unused for ipvlan_addr6_vtor_notifier_block ?
If IS_ENABLED() or #if is used properly, __maybe_unused
should be unnecessary. Actually the patch moved
ipvlan_addr6_vtor_notifier_block out of the existing #if guard.
Also, ipvlan_main.c already has such #if guards.
>
> I see that this __maybe_unused is used quite often in linux-kernel in
> similar way
but not that under net/.
$ grep -rnI __maybe_unused | wc -l
4827
$ grep -rnI __maybe_unused net | wc -l
33
Powered by blists - more mailing lists