* [PATCH] net: Get rid of consume_skb when tracing is off
@ 2020-08-21 22:23 Herbert Xu
2020-08-21 23:40 ` Eric Dumazet
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Herbert Xu @ 2020-08-21 22:23 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, netdev; +Cc: Neil Horman
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
+
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] net: Get rid of consume_skb when tracing is off
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
2020-08-24 23:12 ` David Miller
2 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2020-08-21 23:40 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Jakub Kicinski, netdev; +Cc: Neil Horman
On 8/21/20 3:23 PM, 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>
>
I am not completely familiar with CONFIG_TRACEPOINTS
Is "perf probe" support requiring it ?
We want the following to be supported.
perf probe consume_skb
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] net: Get rid of consume_skb when tracing is off
2020-08-21 23:40 ` Eric Dumazet
@ 2020-08-22 1:08 ` Herbert Xu
0 siblings, 0 replies; 8+ messages in thread
From: Herbert Xu @ 2020-08-22 1:08 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David S. Miller, Jakub Kicinski, netdev, Neil Horman
On Fri, Aug 21, 2020 at 04:40:49PM -0700, Eric Dumazet wrote:
>
> I am not completely familiar with CONFIG_TRACEPOINTS
>
> Is "perf probe" support requiring it ?
Yes.
perf probe requires CONFIG_KPROBE_EVENTS which selects CONFIG_TRACING
which selects CONFIG_TRACEPOINTS.
> We want the following to be supported.
>
> perf probe consume_skb
That should continue to work as this patch does not change anything
when CONFIG_TRACEPOINTS is enabled.
Cheers,
--
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] net: Get rid of consume_skb when tracing is off
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 17:54 ` Neil Horman
2020-08-22 19:49 ` David Miller
2020-08-22 22:47 ` Herbert Xu
2020-08-24 23:12 ` David Miller
2 siblings, 2 replies; 8+ messages in thread
From: Neil Horman @ 2020-08-22 17:54 UTC (permalink / raw)
To: Herbert Xu; +Cc: David S. Miller, Jakub Kicinski, netdev, Neil Horman
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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] net: Get rid of consume_skb when tracing is off
2020-08-22 17:54 ` Neil Horman
@ 2020-08-22 19:49 ` David Miller
2020-08-24 12:17 ` Neil Horman
2020-08-22 22:47 ` Herbert Xu
1 sibling, 1 reply; 8+ messages in thread
From: David Miller @ 2020-08-22 19:49 UTC (permalink / raw)
To: herbert, kuba, netdev, nhorman
From: Neil Horman <nhorman@localhost.localdomain>
Neil, you might want to fix this so people can reply to you :-)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] net: Get rid of consume_skb when tracing is off
2020-08-22 17:54 ` Neil Horman
2020-08-22 19:49 ` David Miller
@ 2020-08-22 22:47 ` Herbert Xu
1 sibling, 0 replies; 8+ messages in thread
From: Herbert Xu @ 2020-08-22 22:47 UTC (permalink / raw)
To: Neil Horman; +Cc: David S. Miller, Jakub Kicinski, netdev
On Sat, Aug 22, 2020 at 01:54:19PM -0400, Neil Horman wrote:
>
> Wouldn't it be better to make this:
> #define consume_skb(x) kfree_skb(x)
Either way is fine but I prefer inline functions over macros.
Cheers,
--
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] net: Get rid of consume_skb when tracing is off
2020-08-22 19:49 ` David Miller
@ 2020-08-24 12:17 ` Neil Horman
0 siblings, 0 replies; 8+ messages in thread
From: Neil Horman @ 2020-08-24 12:17 UTC (permalink / raw)
To: David Miller; +Cc: herbert, kuba, netdev, nhorman
On Sat, Aug 22, 2020 at 12:49:02PM -0700, David Miller wrote:
>
> From: Neil Horman <nhorman@localhost.localdomain>
>
> Neil, you might want to fix this so people can reply to you :-)
Crap, thanks, new computer.
Neil
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] net: Get rid of consume_skb when tracing is off
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 17:54 ` Neil Horman
@ 2020-08-24 23:12 ` David Miller
2 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2020-08-24 23:12 UTC (permalink / raw)
To: herbert; +Cc: kuba, netdev, nhorman
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sat, 22 Aug 2020 08:23:29 +1000
> 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>
Fair enough, applied, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-08-24 23:12 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
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).