From: Neil Horman <nhorman@localhost.localdomain>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, Neil Horman <nhorman@tuxdriver.com>
Subject: Re: [PATCH] net: Get rid of consume_skb when tracing is off
Date: Sat, 22 Aug 2020 13:54:19 -0400 [thread overview]
Message-ID: <20200822175419.GA293438@localhost.localdomain> (raw)
In-Reply-To: <20200821222329.GA2633@gondor.apana.org.au>
On Sat, Aug 22, 2020 at 08:23:29AM +1000, Herbert Xu wrote:
> The function consume_skb is only meaningful when tracing is enabled.
> This patch makes it conditional on CONFIG_TRACEPOINTS.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 46881d902124..e8bca74857a3 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -1056,7 +1056,16 @@ void kfree_skb(struct sk_buff *skb);
> void kfree_skb_list(struct sk_buff *segs);
> void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt);
> void skb_tx_error(struct sk_buff *skb);
> +
> +#ifdef CONFIG_TRACEPOINTS
> void consume_skb(struct sk_buff *skb);
> +#else
> +static inline void consume_skb(struct sk_buff *skb)
> +{
> + return kfree_skb(skb);
> +}
> +#endif
> +
Wouldn't it be better to make this:
#define consume_skb(x) kfree_skb(x)
?
Best
Neil
> void __consume_stateless_skb(struct sk_buff *skb);
> void __kfree_skb(struct sk_buff *skb);
> extern struct kmem_cache *skbuff_head_cache;
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 7e2e502ef519..593fe73d4993 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -820,6 +820,7 @@ void skb_tx_error(struct sk_buff *skb)
> }
> EXPORT_SYMBOL(skb_tx_error);
>
> +#ifdef CONFIG_TRACEPOINTS
> /**
> * consume_skb - free an skbuff
> * @skb: buffer to free
> @@ -837,6 +838,7 @@ void consume_skb(struct sk_buff *skb)
> __kfree_skb(skb);
> }
> EXPORT_SYMBOL(consume_skb);
> +#endif
>
> /**
> * consume_stateless_skb - free an skbuff, assuming it is stateless
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
>
next prev parent reply other threads:[~2020-08-22 17:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 22:23 [PATCH] net: Get rid of consume_skb when tracing is off Herbert Xu
2020-08-21 23:40 ` Eric Dumazet
2020-08-22 1:08 ` Herbert Xu
2020-08-22 17:54 ` Neil Horman [this message]
2020-08-22 19:49 ` David Miller
2020-08-24 12:17 ` Neil Horman
2020-08-22 22:47 ` Herbert Xu
2020-08-24 23:12 ` David Miller
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=20200822175419.GA293438@localhost.localdomain \
--to=nhorman@localhost.localdomain \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.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;
as well as URLs for NNTP newsgroup(s).