Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH bpf] bpf: refer to struct xdp_md in user space comments
@ 2020-08-19 19:27 Jakub Kicinski
  2020-08-19 20:50 ` Yonghong Song
  2020-08-20 14:16 ` Daniel Borkmann
  0 siblings, 2 replies; 5+ messages in thread
From: Jakub Kicinski @ 2020-08-19 19:27 UTC (permalink / raw)
  To: bpf; +Cc: netdev, Jakub Kicinski

uAPI uses xdp_md, not xdp_buff. Fix comments.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 include/uapi/linux/bpf.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 0480f893facd..cc3553a102d0 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -1554,7 +1554,7 @@ union bpf_attr {
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
- * long bpf_xdp_adjust_head(struct xdp_buff *xdp_md, int delta)
+ * long bpf_xdp_adjust_head(struct xdp_md *xdp_md, int delta)
  * 	Description
  * 		Adjust (move) *xdp_md*\ **->data** by *delta* bytes. Note that
  * 		it is possible to use a negative value for *delta*. This helper
@@ -1752,7 +1752,7 @@ union bpf_attr {
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
- * long bpf_xdp_adjust_meta(struct xdp_buff *xdp_md, int delta)
+ * long bpf_xdp_adjust_meta(struct xdp_md *xdp_md, int delta)
  * 	Description
  * 		Adjust the address pointed by *xdp_md*\ **->data_meta** by
  * 		*delta* (which can be positive or negative). Note that this
@@ -2051,7 +2051,7 @@ union bpf_attr {
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
- * long bpf_xdp_adjust_tail(struct xdp_buff *xdp_md, int delta)
+ * long bpf_xdp_adjust_tail(struct xdp_md *xdp_md, int delta)
  * 	Description
  * 		Adjust (move) *xdp_md*\ **->data_end** by *delta* bytes. It is
  * 		possible to both shrink and grow the packet tail.
@@ -3049,7 +3049,7 @@ union bpf_attr {
  *		The value to write, of *size*, is passed through eBPF stack and
  *		pointed by *data*.
  *
- *		*ctx* is a pointer to in-kernel struct xdp_buff.
+ *		*ctx* is a pointer to in-kernel struct xdp_md.
  *
  *		This helper is similar to **bpf_perf_eventoutput**\ () but
  *		restricted to raw_tracepoint bpf programs.
-- 
2.26.2


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

* Re: [PATCH bpf] bpf: refer to struct xdp_md in user space comments
  2020-08-19 19:27 [PATCH bpf] bpf: refer to struct xdp_md in user space comments Jakub Kicinski
@ 2020-08-19 20:50 ` Yonghong Song
  2020-08-20 14:16 ` Daniel Borkmann
  1 sibling, 0 replies; 5+ messages in thread
From: Yonghong Song @ 2020-08-19 20:50 UTC (permalink / raw)
  To: Jakub Kicinski, bpf; +Cc: netdev



On 8/19/20 12:27 PM, Jakub Kicinski wrote:
> uAPI uses xdp_md, not xdp_buff. Fix comments.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Acked-by: Yonghong Song <yhs@fb.com>

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

* Re: [PATCH bpf] bpf: refer to struct xdp_md in user space comments
  2020-08-19 19:27 [PATCH bpf] bpf: refer to struct xdp_md in user space comments Jakub Kicinski
  2020-08-19 20:50 ` Yonghong Song
@ 2020-08-20 14:16 ` Daniel Borkmann
  2020-08-31 22:43   ` Jakub Kicinski
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2020-08-20 14:16 UTC (permalink / raw)
  To: Jakub Kicinski, bpf; +Cc: netdev, yhs

On 8/19/20 9:27 PM, Jakub Kicinski wrote:
> uAPI uses xdp_md, not xdp_buff. Fix comments.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>   include/uapi/linux/bpf.h | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 0480f893facd..cc3553a102d0 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -1554,7 +1554,7 @@ union bpf_attr {

Needs also tooling header copy, but once that is done, it needs fixup for libbpf:

[root@pc-9 bpf]# make
   GEN      bpf_helper_defs.h
Unrecognized type 'struct xdp_md', please add it to known types!
make[1]: *** [Makefile:186: bpf_helper_defs.h] Error 1
make[1]: *** Deleting file 'bpf_helper_defs.h'
make: *** [Makefile:160: all] Error 2
[root@pc-9 bpf]#

Pls fix up and send v2, thanks.
Daniel

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

* Re: [PATCH bpf] bpf: refer to struct xdp_md in user space comments
  2020-08-20 14:16 ` Daniel Borkmann
@ 2020-08-31 22:43   ` Jakub Kicinski
  2020-08-31 23:28     ` David Ahern
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2020-08-31 22:43 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: bpf, netdev, yhs, David Ahern

On Thu, 20 Aug 2020 16:16:47 +0200 Daniel Borkmann wrote:
> On 8/19/20 9:27 PM, Jakub Kicinski wrote:
> > uAPI uses xdp_md, not xdp_buff. Fix comments.
> > 
> > Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> > ---
> >   include/uapi/linux/bpf.h | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> > index 0480f893facd..cc3553a102d0 100644
> > --- a/include/uapi/linux/bpf.h
> > +++ b/include/uapi/linux/bpf.h
> > @@ -1554,7 +1554,7 @@ union bpf_attr {  
> 
> Needs also tooling header copy, but once that is done, it needs fixup for libbpf:
> 
> [root@pc-9 bpf]# make
>    GEN      bpf_helper_defs.h
> Unrecognized type 'struct xdp_md', please add it to known types!
> make[1]: *** [Makefile:186: bpf_helper_defs.h] Error 1
> make[1]: *** Deleting file 'bpf_helper_defs.h'
> make: *** [Makefile:160: all] Error 2
> [root@pc-9 bpf]#
> 
> Pls fix up and send v2, thanks.

FWIW upon closer inspection it appears that this is intentional
(even if confusing) and bpf_helpers_doc.py swaps the types to 
__sk_buff and xdp_md when generating man pages and the header.

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

* Re: [PATCH bpf] bpf: refer to struct xdp_md in user space comments
  2020-08-31 22:43   ` Jakub Kicinski
@ 2020-08-31 23:28     ` David Ahern
  0 siblings, 0 replies; 5+ messages in thread
From: David Ahern @ 2020-08-31 23:28 UTC (permalink / raw)
  To: Jakub Kicinski, Daniel Borkmann; +Cc: bpf, netdev, yhs

On 8/31/20 4:43 PM, Jakub Kicinski wrote:
> On Thu, 20 Aug 2020 16:16:47 +0200 Daniel Borkmann wrote:
>> On 8/19/20 9:27 PM, Jakub Kicinski wrote:
>>> uAPI uses xdp_md, not xdp_buff. Fix comments.
>>>
>>> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>>> ---
>>>   include/uapi/linux/bpf.h | 8 ++++----
>>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>>> index 0480f893facd..cc3553a102d0 100644
>>> --- a/include/uapi/linux/bpf.h
>>> +++ b/include/uapi/linux/bpf.h
>>> @@ -1554,7 +1554,7 @@ union bpf_attr {  
>>
>> Needs also tooling header copy, but once that is done, it needs fixup for libbpf:
>>
>> [root@pc-9 bpf]# make
>>    GEN      bpf_helper_defs.h
>> Unrecognized type 'struct xdp_md', please add it to known types!
>> make[1]: *** [Makefile:186: bpf_helper_defs.h] Error 1
>> make[1]: *** Deleting file 'bpf_helper_defs.h'
>> make: *** [Makefile:160: all] Error 2
>> [root@pc-9 bpf]#
>>
>> Pls fix up and send v2, thanks.
> 
> FWIW upon closer inspection it appears that this is intentional
> (even if confusing) and bpf_helpers_doc.py swaps the types to 
> __sk_buff and xdp_md when generating man pages and the header.
> 

I liked the direction of fixing the uapi file. Is there a legit reason
to have the documentation in uapi/linux/bpf.h to reference a struct that
is not part of the uapi?

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

end of thread, other threads:[~2020-08-31 23:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 19:27 [PATCH bpf] bpf: refer to struct xdp_md in user space comments Jakub Kicinski
2020-08-19 20:50 ` Yonghong Song
2020-08-20 14:16 ` Daniel Borkmann
2020-08-31 22:43   ` Jakub Kicinski
2020-08-31 23:28     ` David Ahern

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