Skip to contentSkip to conversation

bpf: Document PROG_TEST_RUN limitations

PATCH Applied Joe Stringer 4 participants 4 messages Apr 10, 2021 – Apr 12, 2021 BPF

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Document PROG_TEST_RUN limitations

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.

---
CC: Lorenz Bauer <[email protected]>
CC: Song Liu <[email protected]>
CC: Stanislav Fomichev <[email protected]>

---
 include/uapi/linux/bpf.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
include/uapi/linux/bpf.h +21 -0
index 49371eba98ba..e1ee1be7e49b 100644
@@ -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.
Signature · 1 line
2.27.0
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Joe Stringer

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.

Quoted 8 lines

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

---
CC: Lorenz Bauer <[email protected]>
CC: Song Liu <[email protected]>
CC: Stanislav Fomichev <[email protected]>

Thanks for the fix of the doc.

Acked-by on v1 1/1
#2 lore raw
In reply to Joe Stringer
Quoted 5 lines · Joe Stringer

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.

Quoted 7 lines

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.

Thanks Joe!

Signature · 4 lines
Lorenz Bauer  |  Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK

www.cloudflare.com
#3 lore raw
In reply to Joe Stringer
This patch was applied to bpf/bpf-next.git (refs/heads/master):

Hello:

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

Quoted 8 lines · 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