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.
Showing the changes to include/uapi (1 of 1 file). Show all
Unified · Split
| @@ -312,6 +312,27 @@ union bpf_iter_link_info { · 311 unmodified lines | |||
| 312 | * *ctx_out*, *data_out* (for example, packet data), result of the | 312 | * *ctx_out*, *data_out* (for example, packet data), result of the |
| 313 | * execution *retval*, and *duration* of the test run. | 313 | * execution *retval*, and *duration* of the test run. |
| 314 | * | 314 | * |
| 315 | * The sizes of the buffers provided as input and output | ||
| 316 | * parameters *ctx_in*, *ctx_out*, *data_in*, and *data_out* must | ||
| 317 | * be provided in the corresponding variables *ctx_size_in*, | ||
| 318 | * *ctx_size_out*, *data_size_in*, and/or *data_size_out*. If any | ||
| 319 | * of these parameters are not provided (ie set to NULL), the | ||
| 320 | * corresponding size field must be zero. | ||
| 321 | * | ||
| 322 | * Some program types have particular requirements: | ||
| 323 | * | ||
| 324 | * **BPF_PROG_TYPE_SK_LOOKUP** | ||
| 325 | * *data_in* and *data_out* must be NULL. | ||
| 326 | * | ||
| 327 | * **BPF_PROG_TYPE_XDP** | ||
| 328 | * *ctx_in* and *ctx_out* must be NULL. | ||
| 329 | * | ||
| 330 | * **BPF_PROG_TYPE_RAW_TRACEPOINT**, | ||
| 331 | * **BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE** | ||
| 332 | * | ||
| 333 | * *ctx_out*, *data_in* and *data_out* must be NULL. | ||
| 334 | * *repeat* must be zero. | ||
| 335 | * | ||
| 315 | * Return | 336 | * Return |
| 316 | * Returns zero on success. On error, -1 is returned and *errno* | 337 | * Returns zero on success. On error, -1 is returned and *errno* |
| 317 | * is set appropriately. | 338 | * is set appropriately. |