mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 22:51:42 +00:00
bpf: fix up uapi helper description and sync bpf header with tools
Minor markup fixup from bpf-next into net-next merge in the BPF helper description of bpf_sk_lookup_tcp() and bpf_sk_lookup_udp(). Also sync up the copy of bpf.h from tooling infrastructure. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
addb067983
commit
0bd72117fb
@ -2218,9 +2218,9 @@ union bpf_attr {
|
|||||||
* This helper is available only if the kernel was compiled with
|
* This helper is available only if the kernel was compiled with
|
||||||
* **CONFIG_NET** configuration option.
|
* **CONFIG_NET** configuration option.
|
||||||
* Return
|
* Return
|
||||||
* Pointer to *struct bpf_sock*, or NULL in case of failure.
|
* Pointer to **struct bpf_sock**, or **NULL** in case of failure.
|
||||||
* For sockets with reuseport option, the *struct bpf_sock*
|
* For sockets with reuseport option, the **struct bpf_sock**
|
||||||
* result is from reuse->socks[] using the hash of the tuple.
|
* result is from **reuse->socks**\ [] using the hash of the tuple.
|
||||||
*
|
*
|
||||||
* struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
|
* struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
|
||||||
* Description
|
* Description
|
||||||
@ -2254,9 +2254,9 @@ union bpf_attr {
|
|||||||
* This helper is available only if the kernel was compiled with
|
* This helper is available only if the kernel was compiled with
|
||||||
* **CONFIG_NET** configuration option.
|
* **CONFIG_NET** configuration option.
|
||||||
* Return
|
* Return
|
||||||
* Pointer to *struct bpf_sock*, or NULL in case of failure.
|
* Pointer to **struct bpf_sock**, or **NULL** in case of failure.
|
||||||
* For sockets with reuseport option, the *struct bpf_sock*
|
* For sockets with reuseport option, the **struct bpf_sock**
|
||||||
* result is from reuse->socks[] using the hash of the tuple.
|
* result is from **reuse->socks**\ [] using the hash of the tuple.
|
||||||
*
|
*
|
||||||
* int bpf_sk_release(struct bpf_sock *sock)
|
* int bpf_sk_release(struct bpf_sock *sock)
|
||||||
* Description
|
* Description
|
||||||
|
@ -502,18 +502,6 @@ union bpf_attr {
|
|||||||
* Return
|
* Return
|
||||||
* 0 on success, or a negative error in case of failure.
|
* 0 on success, or a negative error in case of failure.
|
||||||
*
|
*
|
||||||
* int bpf_map_pop_elem(struct bpf_map *map, void *value)
|
|
||||||
* Description
|
|
||||||
* Pop an element from *map*.
|
|
||||||
* Return
|
|
||||||
* 0 on success, or a negative error in case of failure.
|
|
||||||
*
|
|
||||||
* int bpf_map_peek_elem(struct bpf_map *map, void *value)
|
|
||||||
* Description
|
|
||||||
* Get an element from *map* without removing it.
|
|
||||||
* Return
|
|
||||||
* 0 on success, or a negative error in case of failure.
|
|
||||||
*
|
|
||||||
* int bpf_probe_read(void *dst, u32 size, const void *src)
|
* int bpf_probe_read(void *dst, u32 size, const void *src)
|
||||||
* Description
|
* Description
|
||||||
* For tracing programs, safely attempt to read *size* bytes from
|
* For tracing programs, safely attempt to read *size* bytes from
|
||||||
@ -1937,9 +1925,9 @@ union bpf_attr {
|
|||||||
* is set to metric from route (IPv4/IPv6 only), and ifindex
|
* is set to metric from route (IPv4/IPv6 only), and ifindex
|
||||||
* is set to the device index of the nexthop from the FIB lookup.
|
* is set to the device index of the nexthop from the FIB lookup.
|
||||||
*
|
*
|
||||||
* *plen* argument is the size of the passed in struct.
|
* *plen* argument is the size of the passed in struct.
|
||||||
* *flags* argument can be a combination of one or more of the
|
* *flags* argument can be a combination of one or more of the
|
||||||
* following values:
|
* following values:
|
||||||
*
|
*
|
||||||
* **BPF_FIB_LOOKUP_DIRECT**
|
* **BPF_FIB_LOOKUP_DIRECT**
|
||||||
* Do a direct table lookup vs full lookup using FIB
|
* Do a direct table lookup vs full lookup using FIB
|
||||||
@ -1948,9 +1936,9 @@ union bpf_attr {
|
|||||||
* Perform lookup from an egress perspective (default is
|
* Perform lookup from an egress perspective (default is
|
||||||
* ingress).
|
* ingress).
|
||||||
*
|
*
|
||||||
* *ctx* is either **struct xdp_md** for XDP programs or
|
* *ctx* is either **struct xdp_md** for XDP programs or
|
||||||
* **struct sk_buff** tc cls_act programs.
|
* **struct sk_buff** tc cls_act programs.
|
||||||
* Return
|
* Return
|
||||||
* * < 0 if any input argument is invalid
|
* * < 0 if any input argument is invalid
|
||||||
* * 0 on success (packet is forwarded, nexthop neighbor exists)
|
* * 0 on success (packet is forwarded, nexthop neighbor exists)
|
||||||
* * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the
|
* * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the
|
||||||
@ -2095,8 +2083,8 @@ union bpf_attr {
|
|||||||
* translated to a keycode using the rc keymap, and reported as
|
* translated to a keycode using the rc keymap, and reported as
|
||||||
* an input key down event. After a period a key up event is
|
* an input key down event. After a period a key up event is
|
||||||
* generated. This period can be extended by calling either
|
* generated. This period can be extended by calling either
|
||||||
* **bpf_rc_keydown** () again with the same values, or calling
|
* **bpf_rc_keydown**\ () again with the same values, or calling
|
||||||
* **bpf_rc_repeat** ().
|
* **bpf_rc_repeat**\ ().
|
||||||
*
|
*
|
||||||
* Some protocols include a toggle bit, in case the button was
|
* Some protocols include a toggle bit, in case the button was
|
||||||
* released and pressed again between consecutive scancodes.
|
* released and pressed again between consecutive scancodes.
|
||||||
@ -2179,21 +2167,22 @@ union bpf_attr {
|
|||||||
* The *flags* meaning is specific for each map type,
|
* The *flags* meaning is specific for each map type,
|
||||||
* and has to be 0 for cgroup local storage.
|
* and has to be 0 for cgroup local storage.
|
||||||
*
|
*
|
||||||
* Depending on the bpf program type, a local storage area
|
* Depending on the BPF program type, a local storage area
|
||||||
* can be shared between multiple instances of the bpf program,
|
* can be shared between multiple instances of the BPF program,
|
||||||
* running simultaneously.
|
* running simultaneously.
|
||||||
*
|
*
|
||||||
* A user should care about the synchronization by himself.
|
* A user should care about the synchronization by himself.
|
||||||
* For example, by using the BPF_STX_XADD instruction to alter
|
* For example, by using the **BPF_STX_XADD** instruction to alter
|
||||||
* the shared data.
|
* the shared data.
|
||||||
* Return
|
* Return
|
||||||
* Pointer to the local storage area.
|
* A pointer to the local storage area.
|
||||||
*
|
*
|
||||||
* int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
|
* int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
|
||||||
* Description
|
* Description
|
||||||
* Select a SO_REUSEPORT sk from a BPF_MAP_TYPE_REUSEPORT_ARRAY map
|
* Select a **SO_REUSEPORT** socket from a
|
||||||
* It checks the selected sk is matching the incoming
|
* **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*.
|
||||||
* request in the skb.
|
* It checks the selected socket is matching the incoming
|
||||||
|
* request in the socket buffer.
|
||||||
* Return
|
* Return
|
||||||
* 0 on success, or a negative error in case of failure.
|
* 0 on success, or a negative error in case of failure.
|
||||||
*
|
*
|
||||||
@ -2201,7 +2190,7 @@ union bpf_attr {
|
|||||||
* Description
|
* Description
|
||||||
* Look for TCP socket matching *tuple*, optionally in a child
|
* Look for TCP socket matching *tuple*, optionally in a child
|
||||||
* network namespace *netns*. The return value must be checked,
|
* network namespace *netns*. The return value must be checked,
|
||||||
* and if non-NULL, released via **bpf_sk_release**\ ().
|
* and if non-**NULL**, released via **bpf_sk_release**\ ().
|
||||||
*
|
*
|
||||||
* The *ctx* should point to the context of the program, such as
|
* The *ctx* should point to the context of the program, such as
|
||||||
* the skb or socket (depending on the hook in use). This is used
|
* the skb or socket (depending on the hook in use). This is used
|
||||||
@ -2229,15 +2218,15 @@ union bpf_attr {
|
|||||||
* This helper is available only if the kernel was compiled with
|
* This helper is available only if the kernel was compiled with
|
||||||
* **CONFIG_NET** configuration option.
|
* **CONFIG_NET** configuration option.
|
||||||
* Return
|
* Return
|
||||||
* Pointer to *struct bpf_sock*, or NULL in case of failure.
|
* Pointer to **struct bpf_sock**, or **NULL** in case of failure.
|
||||||
* For sockets with reuseport option, the *struct bpf_sock*
|
* For sockets with reuseport option, the **struct bpf_sock**
|
||||||
* result is from reuse->socks[] using the hash of the tuple.
|
* result is from **reuse->socks**\ [] using the hash of the tuple.
|
||||||
*
|
*
|
||||||
* struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
|
* struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
|
||||||
* Description
|
* Description
|
||||||
* Look for UDP socket matching *tuple*, optionally in a child
|
* Look for UDP socket matching *tuple*, optionally in a child
|
||||||
* network namespace *netns*. The return value must be checked,
|
* network namespace *netns*. The return value must be checked,
|
||||||
* and if non-NULL, released via **bpf_sk_release**\ ().
|
* and if non-**NULL**, released via **bpf_sk_release**\ ().
|
||||||
*
|
*
|
||||||
* The *ctx* should point to the context of the program, such as
|
* The *ctx* should point to the context of the program, such as
|
||||||
* the skb or socket (depending on the hook in use). This is used
|
* the skb or socket (depending on the hook in use). This is used
|
||||||
@ -2265,42 +2254,54 @@ union bpf_attr {
|
|||||||
* This helper is available only if the kernel was compiled with
|
* This helper is available only if the kernel was compiled with
|
||||||
* **CONFIG_NET** configuration option.
|
* **CONFIG_NET** configuration option.
|
||||||
* Return
|
* Return
|
||||||
* Pointer to *struct bpf_sock*, or NULL in case of failure.
|
* Pointer to **struct bpf_sock**, or **NULL** in case of failure.
|
||||||
* For sockets with reuseport option, the *struct bpf_sock*
|
* For sockets with reuseport option, the **struct bpf_sock**
|
||||||
* result is from reuse->socks[] using the hash of the tuple.
|
* result is from **reuse->socks**\ [] using the hash of the tuple.
|
||||||
*
|
*
|
||||||
* int bpf_sk_release(struct bpf_sock *sk)
|
* int bpf_sk_release(struct bpf_sock *sock)
|
||||||
* Description
|
* Description
|
||||||
* Release the reference held by *sock*. *sock* must be a non-NULL
|
* Release the reference held by *sock*. *sock* must be a
|
||||||
* pointer that was returned from bpf_sk_lookup_xxx\ ().
|
* non-**NULL** pointer that was returned from
|
||||||
|
* **bpf_sk_lookup_xxx**\ ().
|
||||||
* Return
|
* Return
|
||||||
* 0 on success, or a negative error in case of failure.
|
* 0 on success, or a negative error in case of failure.
|
||||||
*
|
*
|
||||||
|
* int bpf_map_pop_elem(struct bpf_map *map, void *value)
|
||||||
|
* Description
|
||||||
|
* Pop an element from *map*.
|
||||||
|
* Return
|
||||||
|
* 0 on success, or a negative error in case of failure.
|
||||||
|
*
|
||||||
|
* int bpf_map_peek_elem(struct bpf_map *map, void *value)
|
||||||
|
* Description
|
||||||
|
* Get an element from *map* without removing it.
|
||||||
|
* Return
|
||||||
|
* 0 on success, or a negative error in case of failure.
|
||||||
|
*
|
||||||
* int bpf_msg_push_data(struct sk_buff *skb, u32 start, u32 len, u64 flags)
|
* int bpf_msg_push_data(struct sk_buff *skb, u32 start, u32 len, u64 flags)
|
||||||
* Description
|
* Description
|
||||||
* For socket policies, insert *len* bytes into msg at offset
|
* For socket policies, insert *len* bytes into *msg* at offset
|
||||||
* *start*.
|
* *start*.
|
||||||
*
|
*
|
||||||
* If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a
|
* If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a
|
||||||
* *msg* it may want to insert metadata or options into the msg.
|
* *msg* it may want to insert metadata or options into the *msg*.
|
||||||
* This can later be read and used by any of the lower layer BPF
|
* This can later be read and used by any of the lower layer BPF
|
||||||
* hooks.
|
* hooks.
|
||||||
*
|
*
|
||||||
* This helper may fail if under memory pressure (a malloc
|
* This helper may fail if under memory pressure (a malloc
|
||||||
* fails) in these cases BPF programs will get an appropriate
|
* fails) in these cases BPF programs will get an appropriate
|
||||||
* error and BPF programs will need to handle them.
|
* error and BPF programs will need to handle them.
|
||||||
*
|
|
||||||
* Return
|
* Return
|
||||||
* 0 on success, or a negative error in case of failure.
|
* 0 on success, or a negative error in case of failure.
|
||||||
*
|
*
|
||||||
* int bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 pop, u64 flags)
|
* int bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 pop, u64 flags)
|
||||||
* Description
|
* Description
|
||||||
* Will remove *pop* bytes from a *msg* starting at byte *start*.
|
* Will remove *pop* bytes from a *msg* starting at byte *start*.
|
||||||
* This may result in **ENOMEM** errors under certain situations if
|
* This may result in **ENOMEM** errors under certain situations if
|
||||||
* an allocation and copy are required due to a full ring buffer.
|
* an allocation and copy are required due to a full ring buffer.
|
||||||
* However, the helper will try to avoid doing the allocation
|
* However, the helper will try to avoid doing the allocation
|
||||||
* if possible. Other errors can occur if input parameters are
|
* if possible. Other errors can occur if input parameters are
|
||||||
* invalid either due to *start* byte not being valid part of msg
|
* invalid either due to *start* byte not being valid part of *msg*
|
||||||
* payload and/or *pop* value being to large.
|
* payload and/or *pop* value being to large.
|
||||||
* Return
|
* Return
|
||||||
* 0 on success, or a negative error in case of failure.
|
* 0 on success, or a negative error in case of failure.
|
||||||
|
Loading…
Reference in New Issue
Block a user