mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Skorodumov <skorodumov.dmitry@huawei.com>
To: Kuniyuki Iwashima <kuniyu@google.com>,
	Dmitry Skorodumov <dskr99@gmail.com>
Cc: <netdev@vger.kernel.org>, Jakub Kicinski <kuba@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Xiao Liang <shaw.leon@gmail.com>, <linux-kernel@vger.kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH v2 net-next 2/3] ipvlan: Common code from v6/v4 validator_event
Date: Tue, 27 Jan 2026 08:56:40 +0300	[thread overview]
Message-ID: <a4a16ead-a534-47e6-8468-58898350415c@huawei.com> (raw)
In-Reply-To: <CAAVpQUBGAitiYbXjGoU7ByaXuU9oYF3nfywu43susMHi8mSy8g@mail.gmail.com>

On 1/26/2026 9:01 PM, Kuniyuki Iwashima wrote:
> On Fri, Jan 23, 2026 at 9:04 AM Dmitry Skorodumov <dskr99@gmail.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


  reply	other threads:[~2026-01-27  5:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260123170412.906280-1-skorodumov.dmitry@huawei.com>
2026-01-23 17:03 ` [PATCH v2 net-next 1/3] ipvlan: const-specifier for functions that use iaddr Dmitry Skorodumov
2026-01-23 17:03 ` [PATCH v2 net-next 2/3] ipvlan: Common code from v6/v4 validator_event Dmitry Skorodumov
2026-01-26 18:01   ` Kuniyuki Iwashima
2026-01-27  5:56     ` Dmitry Skorodumov [this message]
2026-01-27  7:37       ` Eric Dumazet
2026-01-27  7:54         ` Dmitry Skorodumov
2026-01-27  8:11           ` Kuniyuki Iwashima
2026-01-23 17:03 ` [PATCH v2 net-next 3/3] ipvlan: common code to handle ipv6/ipv4 address events Dmitry Skorodumov

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=a4a16ead-a534-47e6-8468-58898350415c@huawei.com \
    --to=skorodumov.dmitry@huawei.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dskr99@gmail.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=shaw.leon@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®