linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace/xdp: fix compile warning: ‘struct bpf_map’ declared inside parameter list
@ 2017-11-29  8:35 Xie XiuQi
  2017-11-29  9:15 ` Jesper Dangaard Brouer
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Xie XiuQi @ 2017-11-29  8:35 UTC (permalink / raw)
  To: rostedt, mingo, davem, brouer
  Cc: daniel, ast, kstewart, gregkh, john.fastabend, linux-kernel,
	xiexiuqi, huangdaode, Hanjun Guo

We meet this compile warning, which caused by missing bpf.h in xdp.h.

In file included from ./include/trace/events/xdp.h:10:0,
                 from ./include/linux/bpf_trace.h:6,
                 from drivers/net/ethernet/intel/i40e/i40e_txrx.c:29:
./include/trace/events/xdp.h:93:17: warning: ‘struct bpf_map’ declared inside parameter list will not be visible outside of this definition or declaration
    const struct bpf_map *map, u32 map_index),
                 ^
./include/linux/tracepoint.h:187:34: note: in definition of macro ‘__DECLARE_TRACE’
  static inline void trace_##name(proto)    \
                                  ^~~~~
./include/linux/tracepoint.h:352:24: note: in expansion of macro ‘PARAMS’
  __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),  \
                        ^~~~~~
./include/linux/tracepoint.h:477:2: note: in expansion of macro ‘DECLARE_TRACE’
  DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
  ^~~~~~~~~~~~~
./include/linux/tracepoint.h:477:22: note: in expansion of macro ‘PARAMS’
  DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
                      ^~~~~~
./include/trace/events/xdp.h:89:1: note: in expansion of macro ‘DEFINE_EVENT’
 DEFINE_EVENT(xdp_redirect_template, xdp_redirect,
 ^~~~~~~~~~~~
./include/trace/events/xdp.h:90:2: note: in expansion of macro ‘TP_PROTO’
  TP_PROTO(const struct net_device *dev,
  ^~~~~~~~
./include/trace/events/xdp.h:93:17: warning: ‘struct bpf_map’ declared inside parameter list will not be visible outside of this definition or declaration
    const struct bpf_map *map, u32 map_index),
                 ^
./include/linux/tracepoint.h:203:38: note: in definition of macro ‘__DECLARE_TRACE’
  register_trace_##name(void (*probe)(data_proto), void *data) \
                                      ^~~~~~~~~~
./include/linux/tracepoint.h:354:4: note: in expansion of macro ‘PARAMS’
    PARAMS(void *__data, proto),   \
    ^~~~~~

Reported-by: Huang Daode <huangdaode@hisilicon.com>
Cc: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
---
 include/trace/events/xdp.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h
index 4cd0f05..8989a92 100644
--- a/include/trace/events/xdp.h
+++ b/include/trace/events/xdp.h
@@ -8,6 +8,7 @@
 #include <linux/netdevice.h>
 #include <linux/filter.h>
 #include <linux/tracepoint.h>
+#include <linux/bpf.h>
 
 #define __XDP_ACT_MAP(FN)	\
 	FN(ABORTED)		\
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] trace/xdp: fix compile warning: ‘struct bpf_map’ declared inside parameter list
  2017-11-29  8:35 [PATCH] trace/xdp: fix compile warning: ‘struct bpf_map’ declared inside parameter list Xie XiuQi
@ 2017-11-29  9:15 ` Jesper Dangaard Brouer
  2017-11-29 11:13   ` Daniel Borkmann
  2017-11-29 12:16 ` Steven Rostedt
  2017-11-29 13:49 ` David Laight
  2 siblings, 1 reply; 7+ messages in thread
From: Jesper Dangaard Brouer @ 2017-11-29  9:15 UTC (permalink / raw)
  To: Xie XiuQi
  Cc: rostedt, mingo, davem, daniel, ast, kstewart, gregkh,
	john.fastabend, linux-kernel, huangdaode, Hanjun Guo, brouer,
	netdev

On Wed, 29 Nov 2017 16:35:01 +0800
Xie XiuQi <xiexiuqi@huawei.com> wrote:

> We meet this compile warning, which caused by missing bpf.h in xdp.h.
> 
> In file included from ./include/trace/events/xdp.h:10:0,
>                  from ./include/linux/bpf_trace.h:6,
>                  from drivers/net/ethernet/intel/i40e/i40e_txrx.c:29:
> ./include/trace/events/xdp.h:93:17: warning: ‘struct bpf_map’ declared inside parameter list will not be visible outside of this definition or declaration
>     const struct bpf_map *map, u32 map_index),
>                  ^
> ./include/linux/tracepoint.h:187:34: note: in definition of macro ‘__DECLARE_TRACE’
>   static inline void trace_##name(proto)    \
>                                   ^~~~~
> ./include/linux/tracepoint.h:352:24: note: in expansion of macro ‘PARAMS’
>   __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),  \
>                         ^~~~~~
> ./include/linux/tracepoint.h:477:2: note: in expansion of macro ‘DECLARE_TRACE’
>   DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
>   ^~~~~~~~~~~~~
> ./include/linux/tracepoint.h:477:22: note: in expansion of macro ‘PARAMS’
>   DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
>                       ^~~~~~
> ./include/trace/events/xdp.h:89:1: note: in expansion of macro ‘DEFINE_EVENT’
>  DEFINE_EVENT(xdp_redirect_template, xdp_redirect,
>  ^~~~~~~~~~~~
> ./include/trace/events/xdp.h:90:2: note: in expansion of macro ‘TP_PROTO’
>   TP_PROTO(const struct net_device *dev,
>   ^~~~~~~~
> ./include/trace/events/xdp.h:93:17: warning: ‘struct bpf_map’ declared inside parameter list will not be visible outside of this definition or declaration
>     const struct bpf_map *map, u32 map_index),
>                  ^
> ./include/linux/tracepoint.h:203:38: note: in definition of macro ‘__DECLARE_TRACE’
>   register_trace_##name(void (*probe)(data_proto), void *data) \
>                                       ^~~~~~~~~~
> ./include/linux/tracepoint.h:354:4: note: in expansion of macro ‘PARAMS’
>     PARAMS(void *__data, proto),   \
>     ^~~~~~
> 
> Reported-by: Huang Daode <huangdaode@hisilicon.com>
> Cc: Hanjun Guo <guohanjun@huawei.com>
> Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
> ---
>  include/trace/events/xdp.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h
> index 4cd0f05..8989a92 100644
> --- a/include/trace/events/xdp.h
> +++ b/include/trace/events/xdp.h
> @@ -8,6 +8,7 @@
>  #include <linux/netdevice.h>
>  #include <linux/filter.h>
>  #include <linux/tracepoint.h>
> +#include <linux/bpf.h>
>  
>  #define __XDP_ACT_MAP(FN)	\
>  	FN(ABORTED)		\

Strange that I'm not see this compile issue, and kbuild-bot also didn't
report it, but the patch looks okay to me... I guess I introduced the
issue in below "fixes" commit.  Can the person applying this include
the fixes line?

Fixes: 8d3b778ff544 ("xdp: tracepoint xdp_redirect also need a map argument")

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] trace/xdp: fix compile warning: ‘struct bpf_map’ declared inside parameter list
  2017-11-29  9:15 ` Jesper Dangaard Brouer
@ 2017-11-29 11:13   ` Daniel Borkmann
  2017-11-30  1:28     ` Xie XiuQi
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Borkmann @ 2017-11-29 11:13 UTC (permalink / raw)
  To: Jesper Dangaard Brouer, Xie XiuQi
  Cc: rostedt, mingo, davem, ast, kstewart, gregkh, john.fastabend,
	linux-kernel, huangdaode, Hanjun Guo, netdev

On 11/29/2017 10:15 AM, Jesper Dangaard Brouer wrote:
> On Wed, 29 Nov 2017 16:35:01 +0800
> Xie XiuQi <xiexiuqi@huawei.com> wrote:
> 
>> We meet this compile warning, which caused by missing bpf.h in xdp.h.
>>
>> In file included from ./include/trace/events/xdp.h:10:0,
>>                  from ./include/linux/bpf_trace.h:6,
>>                  from drivers/net/ethernet/intel/i40e/i40e_txrx.c:29:
>> ./include/trace/events/xdp.h:93:17: warning: ‘struct bpf_map’ declared inside parameter list will not be visible outside of this definition or declaration
>>     const struct bpf_map *map, u32 map_index),
>>                  ^
>> ./include/linux/tracepoint.h:187:34: note: in definition of macro ‘__DECLARE_TRACE’
>>   static inline void trace_##name(proto)    \
>>                                   ^~~~~
>> ./include/linux/tracepoint.h:352:24: note: in expansion of macro ‘PARAMS’
>>   __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),  \
>>                         ^~~~~~
>> ./include/linux/tracepoint.h:477:2: note: in expansion of macro ‘DECLARE_TRACE’
>>   DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
>>   ^~~~~~~~~~~~~
>> ./include/linux/tracepoint.h:477:22: note: in expansion of macro ‘PARAMS’
>>   DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
>>                       ^~~~~~
>> ./include/trace/events/xdp.h:89:1: note: in expansion of macro ‘DEFINE_EVENT’
>>  DEFINE_EVENT(xdp_redirect_template, xdp_redirect,
>>  ^~~~~~~~~~~~
>> ./include/trace/events/xdp.h:90:2: note: in expansion of macro ‘TP_PROTO’
>>   TP_PROTO(const struct net_device *dev,
>>   ^~~~~~~~
>> ./include/trace/events/xdp.h:93:17: warning: ‘struct bpf_map’ declared inside parameter list will not be visible outside of this definition or declaration
>>     const struct bpf_map *map, u32 map_index),
>>                  ^
>> ./include/linux/tracepoint.h:203:38: note: in definition of macro ‘__DECLARE_TRACE’
>>   register_trace_##name(void (*probe)(data_proto), void *data) \
>>                                       ^~~~~~~~~~
>> ./include/linux/tracepoint.h:354:4: note: in expansion of macro ‘PARAMS’
>>     PARAMS(void *__data, proto),   \
>>     ^~~~~~
>>
>> Reported-by: Huang Daode <huangdaode@hisilicon.com>
>> Cc: Hanjun Guo <guohanjun@huawei.com>
>> Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
>> ---
>>  include/trace/events/xdp.h | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h
>> index 4cd0f05..8989a92 100644
>> --- a/include/trace/events/xdp.h
>> +++ b/include/trace/events/xdp.h
>> @@ -8,6 +8,7 @@
>>  #include <linux/netdevice.h>
>>  #include <linux/filter.h>
>>  #include <linux/tracepoint.h>
>> +#include <linux/bpf.h>
>>  
>>  #define __XDP_ACT_MAP(FN)	\
>>  	FN(ABORTED)		\
> 
> Strange that I'm not see this compile issue, and kbuild-bot also didn't
> report it, but the patch looks okay to me... I guess I introduced the
> issue in below "fixes" commit.  Can the person applying this include
> the fixes line?

Xie, thanks for the patch! We could route this fix via bpf tree if you want.

Could you resend your patch with below Fixes and Acked-by tag added to
netdev@vger.kernel.org in Cc, so that it ends up in patchwork there?

> Fixes: 8d3b778ff544 ("xdp: tracepoint xdp_redirect also need a map argument")
> 
> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Thanks,
Daniel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] trace/xdp: fix compile warning: ‘struct bpf_map’ declared inside parameter list
  2017-11-29  8:35 [PATCH] trace/xdp: fix compile warning: ‘struct bpf_map’ declared inside parameter list Xie XiuQi
  2017-11-29  9:15 ` Jesper Dangaard Brouer
@ 2017-11-29 12:16 ` Steven Rostedt
  2017-11-29 13:49 ` David Laight
  2 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2017-11-29 12:16 UTC (permalink / raw)
  To: Xie XiuQi
  Cc: mingo, davem, brouer, daniel, ast, kstewart, gregkh,
	john.fastabend, linux-kernel, huangdaode, Hanjun Guo

On Wed, 29 Nov 2017 16:35:01 +0800
Xie XiuQi <xiexiuqi@huawei.com> wrote:

> We meet this compile warning, which caused by missing bpf.h in xdp.h.
> 
> In file included from ./include/trace/events/xdp.h:10:0,
>                  from ./include/linux/bpf_trace.h:6,
>                  from drivers/net/ethernet/intel/i40e/i40e_txrx.c:29:
> ./include/trace/events/xdp.h:93:17: warning: ‘struct bpf_map’ declared inside parameter list will not be visible outside of this definition or declaration
>     const struct bpf_map *map, u32 map_index),
>
> Reported-by: Huang Daode <huangdaode@hisilicon.com>
> Cc: Hanjun Guo <guohanjun@huawei.com>
> Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
> ---
>  include/trace/events/xdp.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h
> index 4cd0f05..8989a92 100644
> --- a/include/trace/events/xdp.h
> +++ b/include/trace/events/xdp.h
> @@ -8,6 +8,7 @@
>  #include <linux/netdevice.h>
>  #include <linux/filter.h>
>  #include <linux/tracepoint.h>
> +#include <linux/bpf.h>

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

>  
>  #define __XDP_ACT_MAP(FN)	\
>  	FN(ABORTED)		\

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] trace/xdp: fix compile warning: ‘struct bpf_map’ declared inside parameter list
  2017-11-29  8:35 [PATCH] trace/xdp: fix compile warning: ‘struct bpf_map’ declared inside parameter list Xie XiuQi
  2017-11-29  9:15 ` Jesper Dangaard Brouer
  2017-11-29 12:16 ` Steven Rostedt
@ 2017-11-29 13:49 ` David Laight
  2017-11-29 14:05   ` Jesper Dangaard Brouer
  2 siblings, 1 reply; 7+ messages in thread
From: David Laight @ 2017-11-29 13:49 UTC (permalink / raw)
  To: 'Xie XiuQi', rostedt, mingo, davem, brouer
  Cc: daniel, ast, kstewart, gregkh, john.fastabend, linux-kernel,
	huangdaode, Hanjun Guo

From: Xie XiuQi
> Sent: 29 November 2017 08:35
>
> We meet this compile warning, which caused by missing bpf.h in xdp.h.
> 
> In file included from ./include/trace/events/xdp.h:10:0,
>                  from ./include/linux/bpf_trace.h:6,
>                  from drivers/net/ethernet/intel/i40e/i40e_txrx.c:29:
> ./include/trace/events/xdp.h:93:17: warning: struct bpf_map declared inside parameter list will not be
> visible outside of this definition or declaration
>     const struct bpf_map *map, u32 map_index),
>                  ^
...
> diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h
> index 4cd0f05..8989a92 100644
> --- a/include/trace/events/xdp.h
> +++ b/include/trace/events/xdp.h
> @@ -8,6 +8,7 @@
>  #include <linux/netdevice.h>
>  #include <linux/filter.h>
>  #include <linux/tracepoint.h>
> +#include <linux/bpf.h>

Isn't it just enough to add:
struct bpf_map;
before the first prototype instead of pulling in the entire header?

	David

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] trace/xdp: fix compile warning: ‘struct bpf_map’ declared inside parameter list
  2017-11-29 13:49 ` David Laight
@ 2017-11-29 14:05   ` Jesper Dangaard Brouer
  0 siblings, 0 replies; 7+ messages in thread
From: Jesper Dangaard Brouer @ 2017-11-29 14:05 UTC (permalink / raw)
  To: David Laight
  Cc: 'Xie XiuQi',
	rostedt, mingo, davem, daniel, ast, kstewart, gregkh,
	john.fastabend, linux-kernel, huangdaode, Hanjun Guo, brouer,
	netdev

On Wed, 29 Nov 2017 13:49:01 +0000
David Laight <David.Laight@ACULAB.COM> wrote:

> From: Xie XiuQi
> > Sent: 29 November 2017 08:35
> >
> > We meet this compile warning, which caused by missing bpf.h in xdp.h.
> > 
> > In file included from ./include/trace/events/xdp.h:10:0,
> >                  from ./include/linux/bpf_trace.h:6,
> >                  from drivers/net/ethernet/intel/i40e/i40e_txrx.c:29:
> > ./include/trace/events/xdp.h:93:17: warning: struct bpf_map declared inside parameter list will not be
> > visible outside of this definition or declaration
> >     const struct bpf_map *map, u32 map_index),
> >                  ^  
> ...
> > diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h
> > index 4cd0f05..8989a92 100644
> > --- a/include/trace/events/xdp.h
> > +++ b/include/trace/events/xdp.h
> > @@ -8,6 +8,7 @@
> >  #include <linux/netdevice.h>
> >  #include <linux/filter.h>
> >  #include <linux/tracepoint.h>
> > +#include <linux/bpf.h>  
> 
> Isn't it just enough to add:
> struct bpf_map;
> before the first prototype instead of pulling in the entire header?

Nope, because we deref map->id.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] trace/xdp: fix compile warning: ‘struct bpf_map’ declared inside parameter list
  2017-11-29 11:13   ` Daniel Borkmann
@ 2017-11-30  1:28     ` Xie XiuQi
  0 siblings, 0 replies; 7+ messages in thread
From: Xie XiuQi @ 2017-11-30  1:28 UTC (permalink / raw)
  To: Daniel Borkmann, Jesper Dangaard Brouer
  Cc: rostedt, mingo, davem, ast, kstewart, gregkh, john.fastabend,
	linux-kernel, huangdaode, Hanjun Guo, netdev


On 2017/11/29 19:13, Daniel Borkmann wrote:
> Xie, thanks for the patch! We could route this fix via bpf tree if you want.
> 
> Could you resend your patch with below Fixes and Acked-by tag added to
> netdev@vger.kernel.org in Cc, so that it ends up in patchwork there?
> 

Sure, I'll resend soon.

>> Fixes: 8d3b778ff544 ("xdp: tracepoint xdp_redirect also need a map argument")
>>
>> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Thanks,
> Daniel

-- 
Thanks,
Xie XiuQi

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-11-30  1:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29  8:35 [PATCH] trace/xdp: fix compile warning: ‘struct bpf_map’ declared inside parameter list Xie XiuQi
2017-11-29  9:15 ` Jesper Dangaard Brouer
2017-11-29 11:13   ` Daniel Borkmann
2017-11-30  1:28     ` Xie XiuQi
2017-11-29 12:16 ` Steven Rostedt
2017-11-29 13:49 ` David Laight
2017-11-29 14:05   ` Jesper Dangaard Brouer

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).