[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a4a16ead-a534-47e6-8468-58898350415c@huawei.com>
Date: Tue, 27 Jan 2026 08:56:40 +0300
From: Dmitry Skorodumov <skorodumov.dmitry@...wei.com>
To: Kuniyuki Iwashima <kuniyu@...gle.com>, Dmitry Skorodumov
<dskr99@...il.com>
CC: <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>, Eric Dumazet <edumazet@...gle.com>, Paolo
Abeni <pabeni@...hat.com>
Subject: Re: [PATCH v2 net-next 2/3] ipvlan: Common code from v6/v4
validator_event
On 1/26/2026 9:01 PM, Kuniyuki Iwashima wrote:
> On Fri, Jan 23, 2026 at 9:04 AM Dmitry Skorodumov <dskr99@...il.com> wrote:
>> +static int ipvlan_addr_validator_event_cb(struct notifier_block *nblock,
>> + unsigned long event, void *ptr)
>> +{
>> + struct in6_validator_info *i6vi;
>> + struct net_device *dev;
>> +
>> + if (nblock == &ipvlan_addr4_vtor_notifier_block) {
>
> If you check this against the v6 one instead, the if block
> and the i6vi definition can be guarded with
> #if IS_ENABLED(CONFIG_IPV6)
Hm... Few months ago, I had a conversation here that convinced me: avoid
#ifdef whenever possible. They overburden code and reduce readability.
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
Dmitry
Powered by blists - more mailing lists