diff mbox series

[bpf-next] bpf: Document PROG_TEST_RUN limitations

Message ID 20210410174549.816482-1-joe@cilium.io (mailing list archive)
State Accepted
Commit f3c45326ee71d1d3ec11e9ddb5afc04bca9ae492
Delegated to: BPF
Headers show
Series [bpf-next] bpf: Document PROG_TEST_RUN limitations | 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 5 maintainers not CCed: netdev@vger.kernel.org kpsingh@kernel.org andrii@kernel.org kafai@fb.com john.fastabend@gmail.com
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: 11983 this patch: 11983
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, 27 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 12470 this patch: 12470
netdev/header_inline success Link

Commit Message

Joe Stringer April 10, 2021, 5:45 p.m. UTC
Per net/bpf/test_run.c, particular prog types have additional
restrictions around the parameters that can be provided, so document
these in the header.

I didn't bother documenting the limitation on duration for raw
tracepoints since that's an output parameter anyway.

Tested with ./tools/testing/selftests/bpf/test_doc_build.sh.

Suggested-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Joe Stringer <joe@cilium.io>
---
CC: Lorenz Bauer <lmb@cloudflare.com>
CC: Song Liu <songliubraving@fb.com>
CC: Stanislav Fomichev <sdf@google.com>
---
 include/uapi/linux/bpf.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Yonghong Song April 11, 2021, 4:22 p.m. UTC | #1
On 4/10/21 10:45 AM, Joe Stringer wrote:
> Per net/bpf/test_run.c, particular prog types have additional
> restrictions around the parameters that can be provided, so document
> these in the header.
> 
> I didn't bother documenting the limitation on duration for raw
> tracepoints since that's an output parameter anyway.
> 
> Tested with ./tools/testing/selftests/bpf/test_doc_build.sh.
> 
> Suggested-by: Yonghong Song <yhs@fb.com>
> Signed-off-by: Joe Stringer <joe@cilium.io>
> ---
> CC: Lorenz Bauer <lmb@cloudflare.com>
> CC: Song Liu <songliubraving@fb.com>
> CC: Stanislav Fomichev <sdf@google.com>

Thanks for the fix of the doc.

Acked-by: Yonghong Song <yhs@fb.com>
Lorenz Bauer April 12, 2021, 9:02 a.m. UTC | #2
On Sat, 10 Apr 2021 at 18:45, Joe Stringer <joe@cilium.io> wrote:
>
> Per net/bpf/test_run.c, particular prog types have additional
> restrictions around the parameters that can be provided, so document
> these in the header.
>
> I didn't bother documenting the limitation on duration for raw
> tracepoints since that's an output parameter anyway.
>
> Tested with ./tools/testing/selftests/bpf/test_doc_build.sh.
>
> Suggested-by: Yonghong Song <yhs@fb.com>
> Signed-off-by: Joe Stringer <joe@cilium.io>

Thanks Joe!

Acked-by: Lorenz Bauer <lmb@cloudflare.com>
patchwork-bot+netdevbpf@kernel.org April 12, 2021, 3:40 p.m. UTC | #3
Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

On Sat, 10 Apr 2021 10:45:48 -0700 you wrote:
> Per net/bpf/test_run.c, particular prog types have additional
> restrictions around the parameters that can be provided, so document
> these in the header.
> 
> I didn't bother documenting the limitation on duration for raw
> tracepoints since that's an output parameter anyway.
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpf: Document PROG_TEST_RUN limitations
    https://git.kernel.org/bpf/bpf-next/c/f3c45326ee71

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 49371eba98ba..e1ee1be7e49b 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -312,6 +312,27 @@  union bpf_iter_link_info {
  *		*ctx_out*, *data_out* (for example, packet data), result of the
  *		execution *retval*, and *duration* of the test run.
  *
+ *		The sizes of the buffers provided as input and output
+ *		parameters *ctx_in*, *ctx_out*, *data_in*, and *data_out* must
+ *		be provided in the corresponding variables *ctx_size_in*,
+ *		*ctx_size_out*, *data_size_in*, and/or *data_size_out*. If any
+ *		of these parameters are not provided (ie set to NULL), the
+ *		corresponding size field must be zero.
+ *
+ *		Some program types have particular requirements:
+ *
+ *		**BPF_PROG_TYPE_SK_LOOKUP**
+ *			*data_in* and *data_out* must be NULL.
+ *
+ *		**BPF_PROG_TYPE_XDP**
+ *			*ctx_in* and *ctx_out* must be NULL.
+ *
+ *		**BPF_PROG_TYPE_RAW_TRACEPOINT**,
+ *		**BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE**
+ *
+ *			*ctx_out*, *data_in* and *data_out* must be NULL.
+ *			*repeat* must be zero.
+ *
  *	Return
  *		Returns zero on success. On error, -1 is returned and *errno*
  *		is set appropriately.