diff mbox series

[PATCHv2,bpf-next,06/15] bpf: Document BPF_PROG_TEST_RUN syscall command

Message ID 20210302171947.2268128-7-joe@cilium.io (mailing list archive)
State Accepted
Delegated to: BPF
Headers show
Series Improve BPF syscall command documentation | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 7 maintainers not CCed: yhs@fb.com netdev@vger.kernel.org john.fastabend@gmail.com kpsingh@kernel.org songliubraving@fb.com kafai@fb.com andrii@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 11835 this patch: 11835
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 12482 this patch: 12482
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Joe Stringer March 2, 2021, 5:19 p.m. UTC
Based on a brief read of the corresponding source code.

Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Joe Stringer <joe@cilium.io>
---
 include/uapi/linux/bpf.h | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Comments

Yonghong Song March 3, 2021, 8:29 p.m. UTC | #1
On 3/2/21 9:19 AM, Joe Stringer wrote:
> Based on a brief read of the corresponding source code.
> 
> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
> Reviewed-by: Quentin Monnet <quentin@isovalent.com>
> Signed-off-by: Joe Stringer <joe@cilium.io>

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

> ---
>   include/uapi/linux/bpf.h | 14 +++++++++++---
>   1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index a8f2964ec885..a6cd6650e23d 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -306,14 +306,22 @@ union bpf_iter_link_info {
>    *
>    * BPF_PROG_TEST_RUN
>    *	Description
> - *		Run an eBPF program a number of times against a provided
> - *		program context and return the modified program context and
> - *		duration of the test run.
> + *		Run the eBPF program associated with the *prog_fd* a *repeat*
> + *		number of times against a provided program context *ctx_in* and
> + *		data *data_in*, and return the modified program context
> + *		*ctx_out*, *data_out* (for example, packet data), result of the
> + *		execution *retval*, and *duration* of the test run.

FYI, Lorenz's BPF_PROG_TEST_RUN support for sk_lookup program
requires data_in and data_out to be NULL. Not sure whether it is 
worthwhile to specially mention here or not. The patch has not
been merged but close.

https://lore.kernel.org/bpf/20210301101859.46045-1-lmb@cloudflare.com/

>    *
>    *	Return
>    *		Returns zero on success. On error, -1 is returned and *errno*
>    *		is set appropriately.
>    *
> + *		**ENOSPC**
> + *			Either *data_size_out* or *ctx_size_out* is too small.
> + *		**ENOTSUPP**
> + *			This command is not supported by the program type of
> + *			the program referred to by *prog_fd*.
> + *
>    * BPF_PROG_GET_NEXT_ID
>    *	Description
>    *		Fetch the next eBPF program currently loaded into the kernel.
>
Joe Stringer March 3, 2021, 11:53 p.m. UTC | #2
On Wed, Mar 3, 2021 at 12:29 PM Yonghong Song <yhs@fb.com> wrote:
>
>
>
> On 3/2/21 9:19 AM, Joe Stringer wrote:
> > Based on a brief read of the corresponding source code.
> >
> > Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
> > Reviewed-by: Quentin Monnet <quentin@isovalent.com>
> > Signed-off-by: Joe Stringer <joe@cilium.io>
>
> Acked-by: Yonghong Song <yhs@fb.com>
>
> > ---
> >   include/uapi/linux/bpf.h | 14 +++++++++++---
> >   1 file changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> > index a8f2964ec885..a6cd6650e23d 100644
> > --- a/include/uapi/linux/bpf.h
> > +++ b/include/uapi/linux/bpf.h
> > @@ -306,14 +306,22 @@ union bpf_iter_link_info {
> >    *
> >    * BPF_PROG_TEST_RUN
> >    *  Description
> > - *           Run an eBPF program a number of times against a provided
> > - *           program context and return the modified program context and
> > - *           duration of the test run.
> > + *           Run the eBPF program associated with the *prog_fd* a *repeat*
> > + *           number of times against a provided program context *ctx_in* and
> > + *           data *data_in*, and return the modified program context
> > + *           *ctx_out*, *data_out* (for example, packet data), result of the
> > + *           execution *retval*, and *duration* of the test run.
>
> FYI, Lorenz's BPF_PROG_TEST_RUN support for sk_lookup program
> requires data_in and data_out to be NULL. Not sure whether it is
> worthwhile to specially mention here or not. The patch has not
> been merged but close.
>
> https://lore.kernel.org/bpf/20210301101859.46045-1-lmb@cloudflare.com/

Not sure how close either series is but I'm sure between Lorenz & I we
can figure out how to fix this up. If I need to respin the series and
Lorenz's one is in by then, I'll fix it up but it's not the end of the
world to send an extra dedicated patch for this.
Joe Stringer April 10, 2021, 6:12 p.m. UTC | #3
On Wed, Mar 3, 2021 at 5:38 PM Joe Stringer <joe@cilium.io> wrote:
>
> On Wed, Mar 3, 2021 at 12:29 PM Yonghong Song <yhs@fb.com> wrote:
> >
> >
> >
> > On 3/2/21 9:19 AM, Joe Stringer wrote:
> > > Based on a brief read of the corresponding source code.
> > >
> > > Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
> > > Reviewed-by: Quentin Monnet <quentin@isovalent.com>
> > > Signed-off-by: Joe Stringer <joe@cilium.io>
> >
> > Acked-by: Yonghong Song <yhs@fb.com>
> >
> > > ---
> > >   include/uapi/linux/bpf.h | 14 +++++++++++---
> > >   1 file changed, 11 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> > > index a8f2964ec885..a6cd6650e23d 100644
> > > --- a/include/uapi/linux/bpf.h
> > > +++ b/include/uapi/linux/bpf.h
> > > @@ -306,14 +306,22 @@ union bpf_iter_link_info {
> > >    *
> > >    * BPF_PROG_TEST_RUN
> > >    *  Description
> > > - *           Run an eBPF program a number of times against a provided
> > > - *           program context and return the modified program context and
> > > - *           duration of the test run.
> > > + *           Run the eBPF program associated with the *prog_fd* a *repeat*
> > > + *           number of times against a provided program context *ctx_in* and
> > > + *           data *data_in*, and return the modified program context
> > > + *           *ctx_out*, *data_out* (for example, packet data), result of the
> > > + *           execution *retval*, and *duration* of the test run.
> >
> > FYI, Lorenz's BPF_PROG_TEST_RUN support for sk_lookup program
> > requires data_in and data_out to be NULL. Not sure whether it is
> > worthwhile to specially mention here or not. The patch has not
> > been merged but close.
> >
> > https://lore.kernel.org/bpf/20210301101859.46045-1-lmb@cloudflare.com/
>
> Not sure how close either series is but I'm sure between Lorenz & I we
> can figure out how to fix this up. If I need to respin the series and
> Lorenz's one is in by then, I'll fix it up but it's not the end of the
> world to send an extra dedicated patch for this.

I sent this out:
https://lore.kernel.org/bpf/20210410174549.816482-1-joe@cilium.io/T/#u
diff mbox series

Patch

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index a8f2964ec885..a6cd6650e23d 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -306,14 +306,22 @@  union bpf_iter_link_info {
  *
  * BPF_PROG_TEST_RUN
  *	Description
- *		Run an eBPF program a number of times against a provided
- *		program context and return the modified program context and
- *		duration of the test run.
+ *		Run the eBPF program associated with the *prog_fd* a *repeat*
+ *		number of times against a provided program context *ctx_in* and
+ *		data *data_in*, and return the modified program context
+ *		*ctx_out*, *data_out* (for example, packet data), result of the
+ *		execution *retval*, and *duration* of the test run.
  *
  *	Return
  *		Returns zero on success. On error, -1 is returned and *errno*
  *		is set appropriately.
  *
+ *		**ENOSPC**
+ *			Either *data_size_out* or *ctx_size_out* is too small.
+ *		**ENOTSUPP**
+ *			This command is not supported by the program type of
+ *			the program referred to by *prog_fd*.
+ *
  * BPF_PROG_GET_NEXT_ID
  *	Description
  *		Fetch the next eBPF program currently loaded into the kernel.