Subject: Re: [PATCH net-next] ipv6: add IPV6_CALL() helper

From: Jakub Kicinski <[email-masked]>
Date: Tue, 3 Mar 2026 18:45:46 -0800

On Wed, 4 Mar 2026 03:33:59 +0100 Eric Dumazet wrote:
> > > I thought if we remove IPV6=m we would delete ipv6_stub completely?  
> >
> > So we will add #ifdef around helpers ?
> >
> > Lets take :
> >
> > diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
> > index 866746695712aeae425100eefb231e44d52d52d4..5de8fd283ac9b0dbc07d5851f05d15e84c3645e3
> > 100644
> > --- a/drivers/infiniband/core/addr.c
> > +++ b/drivers/infiniband/core/addr.c
> > @@ -411,7 +411,7 @@ static int addr6_resolve(struct sockaddr *src_sock,
> >         fl6.saddr = src_in->sin6_addr;
> >         fl6.flowi6_oif = addr->bound_dev_if;
> >
> > -       dst = ipv6_stub->ipv6_dst_lookup_flow(addr->net, NULL, &fl6, NULL);
> > +       dst = ip6_dst_lookup_flow(addr->net, NULL, &fl6, NULL);
> >         if (IS_ERR(dst))
> >                 return PTR_ERR(dst);
> >
> >
> > Is the plan to define ipv6_dst_lookup_flow() differently for IPV6=y and IPV6=n ?  
> 
> drivers/infiniband/core/addr.c was probably not a good example because
> addr6_resolve()
> is guarded by #if IS_ENABLED(CONFIG_IPV6)
> 
> But other places do not have such preprocessor clauses.

"Normally" for code which is either in or out we add static inlines, no?

#if !IS_ENABLED(CONFIG_IPV6)
static inline struct dst_entry *ip6_dst_lookup_flow(...)
{
	return ERR_PTR(-EAFNOSUPPORT);
}
#else
struct dst_entry *ip6_dst_lookup_flow(...);
#endif