[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 12 Dec 2018 01:11:29 +0100
From: Florian Westphal <fw@...len.de>
To: Mat Martineau <mathew.j.martineau@...ux.intel.com>
Cc: Florian Westphal <fw@...len.de>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 02/13] sk_buff: add skb extension infrastructure
Mat Martineau <mathew.j.martineau@...ux.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
Powered by blists - more mailing lists