Skip to content

Commit bc0b5a0

Browse files
qmonnetborkmann
authored andcommitted
tools, bpf: Synchronise BPF UAPI header with tools
Synchronise the bpf.h header under tools, to report the fixes recently brought to the documentation for the BPF helpers. Signed-off-by: Quentin Monnet <quentin@isovalent.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20200904161454.31135-4-quentin@isovalent.com
1 parent 938c3ef commit bc0b5a0

File tree

1 file changed

+45
-42
lines changed
  • tools/include/uapi/linux

1 file changed

+45
-42
lines changed

tools/include/uapi/linux/bpf.h

+45-42
Original file line numberDiff line numberDiff line change
@@ -3349,38 +3349,38 @@ union bpf_attr {
33493349
* Description
33503350
* Dynamically cast a *sk* pointer to a *tcp6_sock* pointer.
33513351
* Return
3352-
* *sk* if casting is valid, or NULL otherwise.
3352+
* *sk* if casting is valid, or **NULL** otherwise.
33533353
*
33543354
* struct tcp_sock *bpf_skc_to_tcp_sock(void *sk)
33553355
* Description
33563356
* Dynamically cast a *sk* pointer to a *tcp_sock* pointer.
33573357
* Return
3358-
* *sk* if casting is valid, or NULL otherwise.
3358+
* *sk* if casting is valid, or **NULL** otherwise.
33593359
*
33603360
* struct tcp_timewait_sock *bpf_skc_to_tcp_timewait_sock(void *sk)
33613361
* Description
33623362
* Dynamically cast a *sk* pointer to a *tcp_timewait_sock* pointer.
33633363
* Return
3364-
* *sk* if casting is valid, or NULL otherwise.
3364+
* *sk* if casting is valid, or **NULL** otherwise.
33653365
*
33663366
* struct tcp_request_sock *bpf_skc_to_tcp_request_sock(void *sk)
33673367
* Description
33683368
* Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer.
33693369
* Return
3370-
* *sk* if casting is valid, or NULL otherwise.
3370+
* *sk* if casting is valid, or **NULL** otherwise.
33713371
*
33723372
* struct udp6_sock *bpf_skc_to_udp6_sock(void *sk)
33733373
* Description
33743374
* Dynamically cast a *sk* pointer to a *udp6_sock* pointer.
33753375
* Return
3376-
* *sk* if casting is valid, or NULL otherwise.
3376+
* *sk* if casting is valid, or **NULL** otherwise.
33773377
*
33783378
* long bpf_get_task_stack(struct task_struct *task, void *buf, u32 size, u64 flags)
33793379
* Description
33803380
* Return a user or a kernel stack in bpf program provided buffer.
33813381
* To achieve this, the helper needs *task*, which is a valid
3382-
* pointer to struct task_struct. To store the stacktrace, the
3383-
* bpf program provides *buf* with a nonnegative *size*.
3382+
* pointer to **struct task_struct**. To store the stacktrace, the
3383+
* bpf program provides *buf* with a nonnegative *size*.
33843384
*
33853385
* The last argument, *flags*, holds the number of stack frames to
33863386
* skip (from 0 to 255), masked with
@@ -3410,12 +3410,12 @@ union bpf_attr {
34103410
* long bpf_load_hdr_opt(struct bpf_sock_ops *skops, void *searchby_res, u32 len, u64 flags)
34113411
* Description
34123412
* 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**).
34143414
*
34153415
* 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**
34173417
* has details on what skb_data contains under different
3418-
* sock_ops->op.
3418+
* *skops*\ **->op**.
34193419
*
34203420
* The first byte of the *searchby_res* specifies the
34213421
* kind that it wants to search.
@@ -3435,7 +3435,7 @@ union bpf_attr {
34353435
* [ 254, 4, 0xeB, 0x9F, 0, 0, .... 0 ].
34363436
*
34373437
* 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 ].
34393439
* Note, kind-length must be 0 for regular option.
34403440
*
34413441
* Searching for No-Op (0) and End-of-Option-List (1) are
@@ -3445,27 +3445,30 @@ union bpf_attr {
34453445
* of a header option.
34463446
*
34473447
* Supported flags:
3448+
*
34483449
* * **BPF_LOAD_HDR_OPT_TCP_SYN** to search from the
34493450
* saved_syn packet or the just-received syn packet.
34503451
*
34513452
* Return
3452-
* >0 when found, the header option is copied to *searchby_res*.
3453-
* The return value is the total length copied.
3453+
* > 0 when found, the header option is copied to *searchby_res*.
3454+
* The return value is the total length copied. On failure, a
3455+
* negative error code is returned:
34543456
*
3455-
* **-EINVAL** If param is invalid
3457+
* **-EINVAL** if a parameter is invalid.
34563458
*
3457-
* **-ENOMSG** The option is not found
3459+
* **-ENOMSG** if the option is not found.
34583460
*
3459-
* **-ENOENT** No syn packet available when
3460-
* **BPF_LOAD_HDR_OPT_TCP_SYN** is used
3461+
* **-ENOENT** if no syn packet is available when
3462+
* **BPF_LOAD_HDR_OPT_TCP_SYN** is used.
34613463
*
3462-
* **-ENOSPC** Not enough space. Only *len* number of
3463-
* bytes are copied.
3464+
* **-ENOSPC** if there is not enough space. Only *len* number of
3465+
* bytes are copied.
34643466
*
3465-
* **-EFAULT** Cannot parse the header options in the packet
3467+
* **-EFAULT** on failure to parse the header options in the
3468+
* packet.
34663469
*
3467-
* **-EPERM** This helper cannot be used under the
3468-
* current sock_ops->op.
3470+
* **-EPERM** if the helper cannot be used under the current
3471+
* *skops*\ **->op**.
34693472
*
34703473
* long bpf_store_hdr_opt(struct bpf_sock_ops *skops, const void *from, u32 len, u64 flags)
34713474
* Description
@@ -3483,44 +3486,44 @@ union bpf_attr {
34833486
* by searching the same option in the outgoing skb.
34843487
*
34853488
* This helper can only be called during
3486-
* BPF_SOCK_OPS_WRITE_HDR_OPT_CB.
3489+
* **BPF_SOCK_OPS_WRITE_HDR_OPT_CB**.
34873490
*
34883491
* Return
34893492
* 0 on success, or negative error in case of failure:
34903493
*
3491-
* **-EINVAL** If param is invalid
3494+
* **-EINVAL** If param is invalid.
34923495
*
3493-
* **-ENOSPC** Not enough space in the header.
3494-
* Nothing has been written
3496+
* **-ENOSPC** if there is not enough space in the header.
3497+
* Nothing has been written
34953498
*
3496-
* **-EEXIST** The option has already existed
3499+
* **-EEXIST** if the option already exists.
34973500
*
3498-
* **-EFAULT** Cannot parse the existing header options
3501+
* **-EFAULT** on failrue to parse the existing header options.
34993502
*
3500-
* **-EPERM** This helper cannot be used under the
3501-
* current sock_ops->op.
3503+
* **-EPERM** if the helper cannot be used under the current
3504+
* *skops*\ **->op**.
35023505
*
35033506
* long bpf_reserve_hdr_opt(struct bpf_sock_ops *skops, u32 len, u64 flags)
35043507
* Description
35053508
* Reserve *len* bytes for the bpf header option. The
3506-
* space will be used by bpf_store_hdr_opt() later in
3507-
* BPF_SOCK_OPS_WRITE_HDR_OPT_CB.
3509+
* space will be used by **bpf_store_hdr_opt**\ () later in
3510+
* **BPF_SOCK_OPS_WRITE_HDR_OPT_CB**.
35083511
*
3509-
* If bpf_reserve_hdr_opt() is called multiple times,
3512+
* If **bpf_reserve_hdr_opt**\ () is called multiple times,
35103513
* the total number of bytes will be reserved.
35113514
*
35123515
* This helper can only be called during
3513-
* BPF_SOCK_OPS_HDR_OPT_LEN_CB.
3516+
* **BPF_SOCK_OPS_HDR_OPT_LEN_CB**.
35143517
*
35153518
* Return
35163519
* 0 on success, or negative error in case of failure:
35173520
*
3518-
* **-EINVAL** if param is invalid
3521+
* **-EINVAL** if a parameter is invalid.
35193522
*
3520-
* **-ENOSPC** Not enough space in the header.
3523+
* **-ENOSPC** if there is not enough space in the header.
35213524
*
3522-
* **-EPERM** This helper cannot be used under the
3523-
* current sock_ops->op.
3525+
* **-EPERM** if the helper cannot be used under the current
3526+
* *skops*\ **->op**.
35243527
*
35253528
* void *bpf_inode_storage_get(struct bpf_map *map, void *inode, void *value, u64 flags)
35263529
* Description
@@ -3560,9 +3563,9 @@ union bpf_attr {
35603563
*
35613564
* long bpf_d_path(struct path *path, char *buf, u32 sz)
35623565
* Description
3563-
* Return full path for given 'struct path' object, which
3564-
* needs to be the kernel BTF 'path' object. The path is
3565-
* returned in the provided buffer 'buf' of size 'sz' and
3566+
* Return full path for given **struct path** object, which
3567+
* needs to be the kernel BTF *path* object. The path is
3568+
* returned in the provided buffer *buf* of size *sz* and
35663569
* is zero terminated.
35673570
*
35683571
* Return
@@ -3573,7 +3576,7 @@ union bpf_attr {
35733576
* long bpf_copy_from_user(void *dst, u32 size, const void *user_ptr)
35743577
* Description
35753578
* 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**\ ().
35773580
* Return
35783581
* 0 on success, or a negative error in case of failure.
35793582
*/

0 commit comments

Comments
 (0)