Skip to content

Commit 0bd7211

Browse files
borkmanndavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Quentin Monnet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent addb067 commit 0bd7211

File tree

2 files changed

+50
-49
lines changed
  • include/uapi/linux
  • tools/include/uapi/linux

2 files changed

+50
-49
lines changed

include/uapi/linux/bpf.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,9 +2218,9 @@ union bpf_attr {
22182218
* This helper is available only if the kernel was compiled with
22192219
* **CONFIG_NET** configuration option.
22202220
* Return
2221-
* Pointer to *struct bpf_sock*, or NULL in case of failure.
2222-
* For sockets with reuseport option, the *struct bpf_sock*
2223-
* result is from reuse->socks[] using the hash of the tuple.
2221+
* Pointer to **struct bpf_sock**, or **NULL** in case of failure.
2222+
* For sockets with reuseport option, the **struct bpf_sock**
2223+
* result is from **reuse->socks**\ [] using the hash of the tuple.
22242224
*
22252225
* struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
22262226
* Description
@@ -2254,9 +2254,9 @@ union bpf_attr {
22542254
* This helper is available only if the kernel was compiled with
22552255
* **CONFIG_NET** configuration option.
22562256
* Return
2257-
* Pointer to *struct bpf_sock*, or NULL in case of failure.
2258-
* For sockets with reuseport option, the *struct bpf_sock*
2259-
* result is from reuse->socks[] using the hash of the tuple.
2257+
* Pointer to **struct bpf_sock**, or **NULL** in case of failure.
2258+
* For sockets with reuseport option, the **struct bpf_sock**
2259+
* result is from **reuse->socks**\ [] using the hash of the tuple.
22602260
*
22612261
* int bpf_sk_release(struct bpf_sock *sock)
22622262
* Description

tools/include/uapi/linux/bpf.h

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -502,18 +502,6 @@ union bpf_attr {
502502
* Return
503503
* 0 on success, or a negative error in case of failure.
504504
*
505-
* int bpf_map_pop_elem(struct bpf_map *map, void *value)
506-
* Description
507-
* Pop an element from *map*.
508-
* Return
509-
* 0 on success, or a negative error in case of failure.
510-
*
511-
* int bpf_map_peek_elem(struct bpf_map *map, void *value)
512-
* Description
513-
* Get an element from *map* without removing it.
514-
* Return
515-
* 0 on success, or a negative error in case of failure.
516-
*
517505
* int bpf_probe_read(void *dst, u32 size, const void *src)
518506
* Description
519507
* For tracing programs, safely attempt to read *size* bytes from
@@ -1937,9 +1925,9 @@ union bpf_attr {
19371925
* is set to metric from route (IPv4/IPv6 only), and ifindex
19381926
* is set to the device index of the nexthop from the FIB lookup.
19391927
*
1940-
* *plen* argument is the size of the passed in struct.
1941-
* *flags* argument can be a combination of one or more of the
1942-
* following values:
1928+
* *plen* argument is the size of the passed in struct.
1929+
* *flags* argument can be a combination of one or more of the
1930+
* following values:
19431931
*
19441932
* **BPF_FIB_LOOKUP_DIRECT**
19451933
* Do a direct table lookup vs full lookup using FIB
@@ -1948,9 +1936,9 @@ union bpf_attr {
19481936
* Perform lookup from an egress perspective (default is
19491937
* ingress).
19501938
*
1951-
* *ctx* is either **struct xdp_md** for XDP programs or
1952-
* **struct sk_buff** tc cls_act programs.
1953-
* Return
1939+
* *ctx* is either **struct xdp_md** for XDP programs or
1940+
* **struct sk_buff** tc cls_act programs.
1941+
* Return
19541942
* * < 0 if any input argument is invalid
19551943
* * 0 on success (packet is forwarded, nexthop neighbor exists)
19561944
* * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the
@@ -2095,8 +2083,8 @@ union bpf_attr {
20952083
* translated to a keycode using the rc keymap, and reported as
20962084
* an input key down event. After a period a key up event is
20972085
* generated. This period can be extended by calling either
2098-
* **bpf_rc_keydown** () again with the same values, or calling
2099-
* **bpf_rc_repeat** ().
2086+
* **bpf_rc_keydown**\ () again with the same values, or calling
2087+
* **bpf_rc_repeat**\ ().
21002088
*
21012089
* Some protocols include a toggle bit, in case the button was
21022090
* released and pressed again between consecutive scancodes.
@@ -2179,29 +2167,30 @@ union bpf_attr {
21792167
* The *flags* meaning is specific for each map type,
21802168
* and has to be 0 for cgroup local storage.
21812169
*
2182-
* Depending on the bpf program type, a local storage area
2183-
* can be shared between multiple instances of the bpf program,
2170+
* Depending on the BPF program type, a local storage area
2171+
* can be shared between multiple instances of the BPF program,
21842172
* running simultaneously.
21852173
*
21862174
* A user should care about the synchronization by himself.
2187-
* For example, by using the BPF_STX_XADD instruction to alter
2175+
* For example, by using the **BPF_STX_XADD** instruction to alter
21882176
* the shared data.
21892177
* Return
2190-
* Pointer to the local storage area.
2178+
* A pointer to the local storage area.
21912179
*
21922180
* int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
21932181
* Description
2194-
* Select a SO_REUSEPORT sk from a BPF_MAP_TYPE_REUSEPORT_ARRAY map
2195-
* It checks the selected sk is matching the incoming
2196-
* request in the skb.
2182+
* Select a **SO_REUSEPORT** socket from a
2183+
* **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*.
2184+
* It checks the selected socket is matching the incoming
2185+
* request in the socket buffer.
21972186
* Return
21982187
* 0 on success, or a negative error in case of failure.
21992188
*
22002189
* struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
22012190
* Description
22022191
* Look for TCP socket matching *tuple*, optionally in a child
22032192
* network namespace *netns*. The return value must be checked,
2204-
* and if non-NULL, released via **bpf_sk_release**\ ().
2193+
* and if non-**NULL**, released via **bpf_sk_release**\ ().
22052194
*
22062195
* The *ctx* should point to the context of the program, such as
22072196
* the skb or socket (depending on the hook in use). This is used
@@ -2229,15 +2218,15 @@ union bpf_attr {
22292218
* This helper is available only if the kernel was compiled with
22302219
* **CONFIG_NET** configuration option.
22312220
* Return
2232-
* Pointer to *struct bpf_sock*, or NULL in case of failure.
2233-
* For sockets with reuseport option, the *struct bpf_sock*
2234-
* result is from reuse->socks[] using the hash of the tuple.
2221+
* Pointer to **struct bpf_sock**, or **NULL** in case of failure.
2222+
* For sockets with reuseport option, the **struct bpf_sock**
2223+
* result is from **reuse->socks**\ [] using the hash of the tuple.
22352224
*
22362225
* struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
22372226
* Description
22382227
* Look for UDP socket matching *tuple*, optionally in a child
22392228
* network namespace *netns*. The return value must be checked,
2240-
* and if non-NULL, released via **bpf_sk_release**\ ().
2229+
* and if non-**NULL**, released via **bpf_sk_release**\ ().
22412230
*
22422231
* The *ctx* should point to the context of the program, such as
22432232
* the skb or socket (depending on the hook in use). This is used
@@ -2265,42 +2254,54 @@ union bpf_attr {
22652254
* This helper is available only if the kernel was compiled with
22662255
* **CONFIG_NET** configuration option.
22672256
* Return
2268-
* Pointer to *struct bpf_sock*, or NULL in case of failure.
2269-
* For sockets with reuseport option, the *struct bpf_sock*
2270-
* result is from reuse->socks[] using the hash of the tuple.
2257+
* Pointer to **struct bpf_sock**, or **NULL** in case of failure.
2258+
* For sockets with reuseport option, the **struct bpf_sock**
2259+
* result is from **reuse->socks**\ [] using the hash of the tuple.
22712260
*
2272-
* int bpf_sk_release(struct bpf_sock *sk)
2261+
* int bpf_sk_release(struct bpf_sock *sock)
22732262
* Description
2274-
* Release the reference held by *sock*. *sock* must be a non-NULL
2275-
* pointer that was returned from bpf_sk_lookup_xxx\ ().
2263+
* Release the reference held by *sock*. *sock* must be a
2264+
* non-**NULL** pointer that was returned from
2265+
* **bpf_sk_lookup_xxx**\ ().
22762266
* Return
22772267
* 0 on success, or a negative error in case of failure.
22782268
*
2269+
* int bpf_map_pop_elem(struct bpf_map *map, void *value)
2270+
* Description
2271+
* Pop an element from *map*.
2272+
* Return
2273+
* 0 on success, or a negative error in case of failure.
2274+
*
2275+
* int bpf_map_peek_elem(struct bpf_map *map, void *value)
2276+
* Description
2277+
* Get an element from *map* without removing it.
2278+
* Return
2279+
* 0 on success, or a negative error in case of failure.
2280+
*
22792281
* int bpf_msg_push_data(struct sk_buff *skb, u32 start, u32 len, u64 flags)
22802282
* Description
2281-
* For socket policies, insert *len* bytes into msg at offset
2283+
* For socket policies, insert *len* bytes into *msg* at offset
22822284
* *start*.
22832285
*
22842286
* If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a
2285-
* *msg* it may want to insert metadata or options into the msg.
2287+
* *msg* it may want to insert metadata or options into the *msg*.
22862288
* This can later be read and used by any of the lower layer BPF
22872289
* hooks.
22882290
*
22892291
* This helper may fail if under memory pressure (a malloc
22902292
* fails) in these cases BPF programs will get an appropriate
22912293
* error and BPF programs will need to handle them.
2292-
*
22932294
* Return
22942295
* 0 on success, or a negative error in case of failure.
22952296
*
22962297
* int bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 pop, u64 flags)
2297-
* Description
2298+
* Description
22982299
* Will remove *pop* bytes from a *msg* starting at byte *start*.
22992300
* This may result in **ENOMEM** errors under certain situations if
23002301
* an allocation and copy are required due to a full ring buffer.
23012302
* However, the helper will try to avoid doing the allocation
23022303
* if possible. Other errors can occur if input parameters are
2303-
* invalid either due to *start* byte not being valid part of msg
2304+
* invalid either due to *start* byte not being valid part of *msg*
23042305
* payload and/or *pop* value being to large.
23052306
* Return
23062307
* 0 on success, or a negative error in case of failure.

0 commit comments

Comments
 (0)