History

bpf: Fix formatting in documentation for BPF helpers

Fix a formatting error in the description of bpf_load_hdr_opt() (rst2man complains about a wrong indentation, but what is missing is actually a blank line before the bullet list). Fix and harmonise the formatting for other helpers.

Quentin Monnet committed 6 years ago

Commit 938c3ef1 parent 1a7581b1 file · +45 −42Browse files

Unified · Split

include/uapi/linux/bpf.h+45−42
@@ -3349,38 +3349,38 @@ union bpf_attr { · 3348 unmodified lines
3349 * Description3349 * Description
3350 * Dynamically cast a *sk* pointer to a *tcp6_sock* pointer.3350 * Dynamically cast a *sk* pointer to a *tcp6_sock* pointer.
3351 * Return3351 * Return
3352 * *sk* if casting is valid, or NULL otherwise.3352 * *sk* if casting is valid, or **NULL** otherwise.
3353 *3353 *
3354 * struct tcp_sock *bpf_skc_to_tcp_sock(void *sk)3354 * struct tcp_sock *bpf_skc_to_tcp_sock(void *sk)
3355 * Description3355 * Description
3356 * Dynamically cast a *sk* pointer to a *tcp_sock* pointer.3356 * Dynamically cast a *sk* pointer to a *tcp_sock* pointer.
3357 * Return3357 * Return
3358 * *sk* if casting is valid, or NULL otherwise.3358 * *sk* if casting is valid, or **NULL** otherwise.
3359 *3359 *
3360 * struct tcp_timewait_sock *bpf_skc_to_tcp_timewait_sock(void *sk)3360 * struct tcp_timewait_sock *bpf_skc_to_tcp_timewait_sock(void *sk)
3361 * Description3361 * Description
3362 * Dynamically cast a *sk* pointer to a *tcp_timewait_sock* pointer.3362 * Dynamically cast a *sk* pointer to a *tcp_timewait_sock* pointer.
3363 * Return3363 * Return
3364 * *sk* if casting is valid, or NULL otherwise.3364 * *sk* if casting is valid, or **NULL** otherwise.
3365 *3365 *
3366 * struct tcp_request_sock *bpf_skc_to_tcp_request_sock(void *sk)3366 * struct tcp_request_sock *bpf_skc_to_tcp_request_sock(void *sk)
3367 * Description3367 * Description
3368 * Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer.3368 * Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer.
3369 * Return3369 * Return
3370 * *sk* if casting is valid, or NULL otherwise.3370 * *sk* if casting is valid, or **NULL** otherwise.
3371 *3371 *
3372 * struct udp6_sock *bpf_skc_to_udp6_sock(void *sk)3372 * struct udp6_sock *bpf_skc_to_udp6_sock(void *sk)
3373 * Description3373 * Description
3374 * Dynamically cast a *sk* pointer to a *udp6_sock* pointer.3374 * Dynamically cast a *sk* pointer to a *udp6_sock* pointer.
3375 * Return3375 * Return
3376 * *sk* if casting is valid, or NULL otherwise.3376 * *sk* if casting is valid, or **NULL** otherwise.
3377 *3377 *
3378 * long bpf_get_task_stack(struct task_struct *task, void *buf, u32 size, u64 flags)3378 * long bpf_get_task_stack(struct task_struct *task, void *buf, u32 size, u64 flags)
3379 * Description3379 * Description
3380 * Return a user or a kernel stack in bpf program provided buffer.3380 * Return a user or a kernel stack in bpf program provided buffer.
3381 * To achieve this, the helper needs *task*, which is a valid3381 * To achieve this, the helper needs *task*, which is a valid
3382 * pointer to struct task_struct. To store the stacktrace, the3382 * pointer to **struct task_struct**. To store the stacktrace, the
3383 * bpf program provides *buf* with a nonnegative *size*.3383 * bpf program provides *buf* with a nonnegative *size*.
3384 *3384 *
3385 * The last argument, *flags*, holds the number of stack frames to3385 * The last argument, *flags*, holds the number of stack frames to
3386 * skip (from 0 to 255), masked with3386 * skip (from 0 to 255), masked with
@@ -3410,12 +3410,12 @@ union bpf_attr { · 23 unmodified lines
3410 * long bpf_load_hdr_opt(struct bpf_sock_ops *skops, void *searchby_res, u32 len, u64 flags)3410 * long bpf_load_hdr_opt(struct bpf_sock_ops *skops, void *searchby_res, u32 len, u64 flags)
3411 * Description3411 * Description
3412 * Load header option. Support reading a particular TCP header3412 * Load header option. Support reading a particular TCP header
3413 * option for bpf program (BPF_PROG_TYPE_SOCK_OPS).3413 * option for bpf program (**BPF_PROG_TYPE_SOCK_OPS**).
3414 *3414 *
3415 * If *flags* is 0, it will search the option from the3415 * If *flags* is 0, it will search the option from the
3416 * sock_ops->skb_data. The comment in "struct bpf_sock_ops"3416 * *skops*\ **->skb_data**. The comment in **struct bpf_sock_ops**
3417 * has details on what skb_data contains under different3417 * has details on what skb_data contains under different
3418 * sock_ops->op.3418 * *skops*\ **->op**.
3419 *3419 *
3420 * The first byte of the *searchby_res* specifies the3420 * The first byte of the *searchby_res* specifies the
3421 * kind that it wants to search.3421 * kind that it wants to search.
@@ -3435,7 +3435,7 @@ union bpf_attr { · 13 unmodified lines
3435 * [ 254, 4, 0xeB, 0x9F, 0, 0, .... 0 ].3435 * [ 254, 4, 0xeB, 0x9F, 0, 0, .... 0 ].
3436 *3436 *
3437 * To search for the standard window scale option (3),3437 * To search for the standard window scale option (3),
3438 * the searchby_res should be [ 3, 0, 0, .... 0 ].3438 * the *searchby_res* should be [ 3, 0, 0, .... 0 ].
3439 * Note, kind-length must be 0 for regular option.3439 * Note, kind-length must be 0 for regular option.
3440 *3440 *
3441 * Searching for No-Op (0) and End-of-Option-List (1) are3441 * Searching for No-Op (0) and End-of-Option-List (1) are
@@ -3445,27 +3445,30 @@ union bpf_attr { · 3 unmodified lines
3445 * of a header option.3445 * of a header option.
3446 *3446 *
3447 * Supported flags:3447 * Supported flags:
3448 *
3448 * * **BPF_LOAD_HDR_OPT_TCP_SYN** to search from the3449 * * **BPF_LOAD_HDR_OPT_TCP_SYN** to search from the
3449 * saved_syn packet or the just-received syn packet.3450 * saved_syn packet or the just-received syn packet.
3450 *3451 *
3451 * Return3452 * Return
3452 * >0 when found, the header option is copied to *searchby_res*.3453 * > 0 when found, the header option is copied to *searchby_res*.
3453 * The return value is the total length copied.3454 * The return value is the total length copied. On failure, a
3455 * negative error code is returned:
3454 *3456 *
3455 * **-EINVAL** If param is invalid3457 * **-EINVAL** if a parameter is invalid.
3456 *3458 *
3457 * **-ENOMSG** The option is not found3459 * **-ENOMSG** if the option is not found.
3458 *3460 *
3459 * **-ENOENT** No syn packet available when3461 * **-ENOENT** if no syn packet is available when
3460 * **BPF_LOAD_HDR_OPT_TCP_SYN** is used3462 * **BPF_LOAD_HDR_OPT_TCP_SYN** is used.
3461 *3463 *
3462 * **-ENOSPC** Not enough space. Only *len* number of3464 * **-ENOSPC** if there is not enough space. Only *len* number of
3463 * bytes are copied.3465 * bytes are copied.
3464 *3466 *
3465 * **-EFAULT** Cannot parse the header options in the packet3467 * **-EFAULT** on failure to parse the header options in the
3468 * packet.
3466 *3469 *
3467 * **-EPERM** This helper cannot be used under the3470 * **-EPERM** if the helper cannot be used under the current
3468 * current sock_ops->op.3471 * *skops*\ **->op**.
3469 *3472 *
3470 * long bpf_store_hdr_opt(struct bpf_sock_ops *skops, const void *from, u32 len, u64 flags)3473 * long bpf_store_hdr_opt(struct bpf_sock_ops *skops, const void *from, u32 len, u64 flags)
3471 * Description3474 * Description
@@ -3483,44 +3486,44 @@ union bpf_attr { · 11 unmodified lines
3483 * by searching the same option in the outgoing skb.3486 * by searching the same option in the outgoing skb.
3484 *3487 *
3485 * This helper can only be called during3488 * This helper can only be called during
3486 * BPF_SOCK_OPS_WRITE_HDR_OPT_CB.3489 * **BPF_SOCK_OPS_WRITE_HDR_OPT_CB**.
3487 *3490 *
3488 * Return3491 * Return
3489 * 0 on success, or negative error in case of failure:3492 * 0 on success, or negative error in case of failure:
3490 *3493 *
3491 * **-EINVAL** If param is invalid3494 * **-EINVAL** If param is invalid.
3492 *3495 *
3493 * **-ENOSPC** Not enough space in the header.3496 * **-ENOSPC** if there is not enough space in the header.
3494 * Nothing has been written3497 * Nothing has been written
3495 *3498 *
3496 * **-EEXIST** The option has already existed3499 * **-EEXIST** if the option already exists.
3497 *3500 *
3498 * **-EFAULT** Cannot parse the existing header options3501 * **-EFAULT** on failrue to parse the existing header options.
3499 *3502 *
3500 * **-EPERM** This helper cannot be used under the3503 * **-EPERM** if the helper cannot be used under the current
3501 * current sock_ops->op.3504 * *skops*\ **->op**.
3502 *3505 *
3503 * long bpf_reserve_hdr_opt(struct bpf_sock_ops *skops, u32 len, u64 flags)3506 * long bpf_reserve_hdr_opt(struct bpf_sock_ops *skops, u32 len, u64 flags)
3504 * Description3507 * Description
3505 * Reserve *len* bytes for the bpf header option. The3508 * Reserve *len* bytes for the bpf header option. The
3506 * space will be used by bpf_store_hdr_opt() later in3509 * space will be used by **bpf_store_hdr_opt**\ () later in
3507 * BPF_SOCK_OPS_WRITE_HDR_OPT_CB.3510 * **BPF_SOCK_OPS_WRITE_HDR_OPT_CB**.
3508 *3511 *
3509 * If bpf_reserve_hdr_opt() is called multiple times,3512 * If **bpf_reserve_hdr_opt**\ () is called multiple times,
3510 * the total number of bytes will be reserved.3513 * the total number of bytes will be reserved.
3511 *3514 *
3512 * This helper can only be called during3515 * This helper can only be called during
3513 * BPF_SOCK_OPS_HDR_OPT_LEN_CB.3516 * **BPF_SOCK_OPS_HDR_OPT_LEN_CB**.
3514 *3517 *
3515 * Return3518 * Return
3516 * 0 on success, or negative error in case of failure:3519 * 0 on success, or negative error in case of failure:
3517 *3520 *
3518 * **-EINVAL** if param is invalid3521 * **-EINVAL** if a parameter is invalid.
3519 *3522 *
3520 * **-ENOSPC** Not enough space in the header.3523 * **-ENOSPC** if there is not enough space in the header.
3521 *3524 *
3522 * **-EPERM** This helper cannot be used under the3525 * **-EPERM** if the helper cannot be used under the current
3523 * current sock_ops->op.3526 * *skops*\ **->op**.
3524 *3527 *
3525 * void *bpf_inode_storage_get(struct bpf_map *map, void *inode, void *value, u64 flags)3528 * void *bpf_inode_storage_get(struct bpf_map *map, void *inode, void *value, u64 flags)
3526 * Description3529 * Description
@@ -3560,9 +3563,9 @@ union bpf_attr { · 33 unmodified lines
3560 *3563 *
3561 * long bpf_d_path(struct path *path, char *buf, u32 sz)3564 * long bpf_d_path(struct path *path, char *buf, u32 sz)
3562 * Description3565 * Description
3563 * Return full path for given 'struct path' object, which3566 * Return full path for given **struct path** object, which
3564 * needs to be the kernel BTF 'path' object. The path is3567 * needs to be the kernel BTF *path* object. The path is
3565 * returned in the provided buffer 'buf' of size 'sz' and3568 * returned in the provided buffer *buf* of size *sz* and
3566 * is zero terminated.3569 * is zero terminated.
3567 *3570 *
3568 * Return3571 * Return
@@ -3573,7 +3576,7 @@ union bpf_attr { · 4 unmodified lines
3573 * long bpf_copy_from_user(void *dst, u32 size, const void *user_ptr)3576 * long bpf_copy_from_user(void *dst, u32 size, const void *user_ptr)
3574 * Description3577 * Description
3575 * Read *size* bytes from user space address *user_ptr* and store3578 * Read *size* bytes from user space address *user_ptr* and store
3576 * the data in *dst*. This is a wrapper of copy_from_user().3579 * the data in *dst*. This is a wrapper of **copy_from_user**\ ().
3577 * Return3580 * Return
3578 * 0 on success, or a negative error in case of failure.3581 * 0 on success, or a negative error in case of failure.
3579 */3582 */