Re: [PATCH v2 net-next 2/3] ipvlan: Common code from v6/v4 validator_event

From: Dmitry Skorodumov

Date: Tue Jan 27 2026 - 02:55:10 EST


On 1/27/2026 10:37 AM, Eric Dumazet wrote:
On Tue, Jan 27, 2026 at 6:56 AM Dmitry Skorodumov
<skorodumov.dmitry@xxxxxxxxxx> 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 ?

I see that this __maybe_unused is used quite often in linux-kernel in similar way

Dmitry