diff mbox series

[bpf-next,v1] bpf: fix bpf_skb_pull_data documentation

Message ID 20220714224721.2615592-1-joannelkoong@gmail.com (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series [bpf-next,v1] bpf: fix bpf_skb_pull_data documentation | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1780 this patch: 1780
netdev/cc_maintainers warning 8 maintainers not CCed: haoluo@google.com song@kernel.org yhs@fb.com martin.lau@linux.dev john.fastabend@gmail.com jolsa@kernel.org sdf@google.com kpsingh@kernel.org
netdev/build_clang success Errors and warnings before: 189 this patch: 189
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1791 this patch: 1791
netdev/checkpatch warning WARNING: line length of 82 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR fail PR summary
bpf/vmtest-bpf-next-VM_Test-3 success Logs for Kernel LATEST on z15 with gcc
bpf/vmtest-bpf-next-VM_Test-1 success Logs for Kernel LATEST on ubuntu-latest with gcc
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Kernel LATEST on ubuntu-latest with llvm-15

Commit Message

Joanne Koong July 14, 2022, 10:47 p.m. UTC
Fix documentation for bpf_skb_pull_data() helper for
when flags == 0.

Fixes: fa15601ab31e ("bpf: add documentation for eBPF helpers (33-41)")
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
---
 include/uapi/linux/bpf.h       | 3 ++-
 tools/include/uapi/linux/bpf.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Joanne Koong July 14, 2022, 11:14 p.m. UTC | #1
On Thu, Jul 14, 2022 at 3:48 PM Joanne Koong <joannelkoong@gmail.com> wrote:
>
> Fix documentation for bpf_skb_pull_data() helper for
> when flags == 0.
sorry, this commit message should be "when len == 0" (not flags).
>
> Fixes: fa15601ab31e ("bpf: add documentation for eBPF helpers (33-41)")
> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
> ---
>  include/uapi/linux/bpf.h       | 3 ++-
>  tools/include/uapi/linux/bpf.h | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 379e68fb866f..a80c1f6bbe25 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -2361,7 +2361,8 @@ union bpf_attr {
>   *             Pull in non-linear data in case the *skb* is non-linear and not
>   *             all of *len* are part of the linear section. Make *len* bytes
>   *             from *skb* readable and writable. If a zero value is passed for
> - *             *len*, then the whole length of the *skb* is pulled.
> + *             *len*, then all bytes in the head of the skb will be made readable
> + *             and writable.
>   *
>   *             This helper is only needed for reading and writing with direct
>   *             packet access.
> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
> index 379e68fb866f..a80c1f6bbe25 100644
> --- a/tools/include/uapi/linux/bpf.h
> +++ b/tools/include/uapi/linux/bpf.h
> @@ -2361,7 +2361,8 @@ union bpf_attr {
>   *             Pull in non-linear data in case the *skb* is non-linear and not
>   *             all of *len* are part of the linear section. Make *len* bytes
>   *             from *skb* readable and writable. If a zero value is passed for
> - *             *len*, then the whole length of the *skb* is pulled.
> + *             *len*, then all bytes in the head of the skb will be made readable
> + *             and writable.
>   *
>   *             This helper is only needed for reading and writing with direct
>   *             packet access.
> --
> 2.30.2
>
Quentin Monnet July 15, 2022, 8:51 a.m. UTC | #2
On 15/07/2022 00:14, Joanne Koong wrote:
> On Thu, Jul 14, 2022 at 3:48 PM Joanne Koong <joannelkoong@gmail.com> wrote:
>>
>> Fix documentation for bpf_skb_pull_data() helper for
>> when flags == 0.
> sorry, this commit message should be "when len == 0" (not flags).
>>
>> Fixes: fa15601ab31e ("bpf: add documentation for eBPF helpers (33-41)")
>> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>

Yes, Rumen reported this to me some time ago but I never took the time
to send a fix. Thanks a lot!

Acked-by: Quentin Monnet <quentin@isovalent.com>
Daniel Borkmann July 15, 2022, 1:43 p.m. UTC | #3
On 7/15/22 12:47 AM, Joanne Koong wrote:
> Fix documentation for bpf_skb_pull_data() helper for
> when flags == 0.
> 
> Fixes: fa15601ab31e ("bpf: add documentation for eBPF helpers (33-41)")
> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
> ---
>   include/uapi/linux/bpf.h       | 3 ++-
>   tools/include/uapi/linux/bpf.h | 3 ++-
>   2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 379e68fb866f..a80c1f6bbe25 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -2361,7 +2361,8 @@ union bpf_attr {
>    * 		Pull in non-linear data in case the *skb* is non-linear and not
>    * 		all of *len* are part of the linear section. Make *len* bytes
>    * 		from *skb* readable and writable. If a zero value is passed for
> - * 		*len*, then the whole length of the *skb* is pulled.
> + *		*len*, then all bytes in the head of the skb will be made readable

Quentin, should the formatting be '*skb*' instead of 'skb'?

Maybe it's more clear if we speak of 'all bytes in the linear part' instead of 'all
bytes in the head' of the skb to make it clearer? Either is ok with me though.

Thanks,
Daniel
Quentin Monnet July 15, 2022, 1:50 p.m. UTC | #4
On 15/07/2022 14:43, Daniel Borkmann wrote:
> On 7/15/22 12:47 AM, Joanne Koong wrote:
>> Fix documentation for bpf_skb_pull_data() helper for
>> when flags == 0.
>>
>> Fixes: fa15601ab31e ("bpf: add documentation for eBPF helpers (33-41)")
>> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
>> ---
>>   include/uapi/linux/bpf.h       | 3 ++-
>>   tools/include/uapi/linux/bpf.h | 3 ++-
>>   2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>> index 379e68fb866f..a80c1f6bbe25 100644
>> --- a/include/uapi/linux/bpf.h
>> +++ b/include/uapi/linux/bpf.h
>> @@ -2361,7 +2361,8 @@ union bpf_attr {
>>    *         Pull in non-linear data in case the *skb* is non-linear
>> and not
>>    *         all of *len* are part of the linear section. Make *len*
>> bytes
>>    *         from *skb* readable and writable. If a zero value is
>> passed for
>> - *         *len*, then the whole length of the *skb* is pulled.
>> + *        *len*, then all bytes in the head of the skb will be made
>> readable
> 
> Quentin, should the formatting be '*skb*' instead of 'skb'?

Correct

> Maybe it's more clear if we speak of 'all bytes in the linear part'
> instead of 'all
> bytes in the head' of the skb to make it clearer? Either is ok with me
> though.

Good suggestion, “linear part” is maybe easier to understand given that
the paragraph has no other mention the “head”.

Would it be worth, even, linking to e.g. Dave's doc
(http://vger.kernel.org/~davem/skb.html) here, to provide more details?
People reading the header file may not need that, but folks reading the
generated man page may not be aware of what a skb contains.

Quentin
Joanne Koong July 15, 2022, 5:44 p.m. UTC | #5
On Fri, Jul 15, 2022 at 6:50 AM Quentin Monnet <quentin@isovalent.com> wrote:
>
> On 15/07/2022 14:43, Daniel Borkmann wrote:
> > On 7/15/22 12:47 AM, Joanne Koong wrote:
> >> Fix documentation for bpf_skb_pull_data() helper for
> >> when flags == 0.
> >>
> >> Fixes: fa15601ab31e ("bpf: add documentation for eBPF helpers (33-41)")
> >> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
> >> ---
> >>   include/uapi/linux/bpf.h       | 3 ++-
> >>   tools/include/uapi/linux/bpf.h | 3 ++-
> >>   2 files changed, 4 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> >> index 379e68fb866f..a80c1f6bbe25 100644
> >> --- a/include/uapi/linux/bpf.h
> >> +++ b/include/uapi/linux/bpf.h
> >> @@ -2361,7 +2361,8 @@ union bpf_attr {
> >>    *         Pull in non-linear data in case the *skb* is non-linear
> >> and not
> >>    *         all of *len* are part of the linear section. Make *len*
> >> bytes
> >>    *         from *skb* readable and writable. If a zero value is
> >> passed for
> >> - *         *len*, then the whole length of the *skb* is pulled.
> >> + *        *len*, then all bytes in the head of the skb will be made
> >> readable
> >
> > Quentin, should the formatting be '*skb*' instead of 'skb'?
>
> Correct
>
> > Maybe it's more clear if we speak of 'all bytes in the linear part'
> > instead of 'all
> > bytes in the head' of the skb to make it clearer? Either is ok with me
> > though.
>
> Good suggestion, “linear part” is maybe easier to understand given that
> the paragraph has no other mention the “head”.
>
Great, I'll send out v2 with these edits:
* changing skb -> *skb*
* changing "all bytes in the head" -> "all bytes in the linear part"

> Would it be worth, even, linking to e.g. Dave's doc
> (http://vger.kernel.org/~davem/skb.html) here, to provide more details?
> People reading the header file may not need that, but folks reading the
> generated man page may not be aware of what a skb contains.

In my personal opinion, I think people who are writing programs that
are using skbs will already have read that page and/or know the
internals of skbs. But I'm also happy to add that link in if you think
it'd provide more context.

>
> Quentin
>
diff mbox series

Patch

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 379e68fb866f..a80c1f6bbe25 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -2361,7 +2361,8 @@  union bpf_attr {
  * 		Pull in non-linear data in case the *skb* is non-linear and not
  * 		all of *len* are part of the linear section. Make *len* bytes
  * 		from *skb* readable and writable. If a zero value is passed for
- * 		*len*, then the whole length of the *skb* is pulled.
+ *		*len*, then all bytes in the head of the skb will be made readable
+ *		and writable.
  *
  * 		This helper is only needed for reading and writing with direct
  * 		packet access.
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 379e68fb866f..a80c1f6bbe25 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -2361,7 +2361,8 @@  union bpf_attr {
  * 		Pull in non-linear data in case the *skb* is non-linear and not
  * 		all of *len* are part of the linear section. Make *len* bytes
  * 		from *skb* readable and writable. If a zero value is passed for
- * 		*len*, then the whole length of the *skb* is pulled.
+ *		*len*, then all bytes in the head of the skb will be made readable
+ *		and writable.
  *
  * 		This helper is only needed for reading and writing with direct
  * 		packet access.