Mat Martineau <mathew.j.martin...@linux.intel.com> wrote:
> 
> On Mon, 11 Dec 2018, Florian Westphal wrote:
> 
> ...
> 
> > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> > index b1831a5ca173..d715736eb734 100644
> > --- a/include/linux/skbuff.h
> > +++ b/include/linux/skbuff.h
> 
> ...
> 
> > @@ -3896,6 +3906,113 @@ static inline void nf_conntrack_get(struct 
> > nf_conntrack *nfct)
> >                 atomic_inc(&nfct->use);
> >  }
> >  #endif
> > +
> > +#ifdef CONFIG_SKB_EXTENSIONS
> > +enum skb_ext_id {
> > +#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
> > +       SKB_EXT_BRIDGE_NF,
> > +#endif
> > +       SKB_EXT_NUM, /* must be last */
> > +};
> 
> Could enum skb_ext_id always be defined, with none of the SKB_EXT_* values
> conditionally excluded?

Yes, this is certainly possible.

> In combination with some alternate function
> definitions below (see later comments) I think this could reduce the need
> for CONFIG_SKB_EXTENSIONS preprocessor conditionals throughout the net code.

Perhaps.  I'll give this a shot.

> > +static inline void skb_ext_del(struct sk_buff *skb, int unused) {}
> > +static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff 
> > *s) {}
> > +static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff 
> > *s) {}
> 
> For the !CONFIG_SKB_EXTENSIONS case, an alternate definition of
> skb_ext_exist() that always returns false would be useful to reduce the need
> for preprocessor conditionals. A similar skb_ext_find() that always returns
> NULL might also be helpful.

I'll do this and double-check that gcc removes the branches accordingly.

Thanks,
Florian

Reply via email to