diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2018-12-11 04:26:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-11 14:06:43 -0500 |
commit | 0bd72117fba2dd51a65eaa7b480adc0eea9a4409 (patch) | |
tree | 6df19d4dc865aa33767315d5bc47624d5c3c1934 | |
parent | addb0679839a1f74da6ec742137558be244dd0e9 (diff) |
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>
-rw-r--r-- | include/uapi/linux/bpf.h | 12 | ||||
-rw-r--r-- | tools/include/uapi/linux/bpf.h | 87 |
2 files changed, 50 insertions, 49 deletions
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 92e962ba0c47..aa582cd5bfcf 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h | |||
@@ -2218,9 +2218,9 @@ union bpf_attr { | |||
2218 | * This helper is available only if the kernel was compiled with | 2218 | * This helper is available only if the kernel was compiled with |
2219 | * **CONFIG_NET** configuration option. | 2219 | * **CONFIG_NET** configuration option. |
2220 | * Return | 2220 | * Return |
2221 | * Pointer to *struct bpf_sock*, or NULL in case of failure. | 2221 | * Pointer to **struct bpf_sock**, or **NULL** in case of failure. |
2222 | * For sockets with reuseport option, the *struct bpf_sock* | 2222 | * For sockets with reuseport option, the **struct bpf_sock** |
2223 | * result is from reuse->socks[] using the hash of the tuple. | 2223 | * result is from **reuse->socks**\ [] using the hash of the tuple. |
2224 | * | 2224 | * |
2225 | * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags) | 2225 | * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags) |
2226 | * Description | 2226 | * Description |
@@ -2254,9 +2254,9 @@ union bpf_attr { | |||
2254 | * This helper is available only if the kernel was compiled with | 2254 | * This helper is available only if the kernel was compiled with |
2255 | * **CONFIG_NET** configuration option. | 2255 | * **CONFIG_NET** configuration option. |
2256 | * Return | 2256 | * Return |
2257 | * Pointer to *struct bpf_sock*, or NULL in case of failure. | 2257 | * Pointer to **struct bpf_sock**, or **NULL** in case of failure. |
2258 | * For sockets with reuseport option, the *struct bpf_sock* | 2258 | * For sockets with reuseport option, the **struct bpf_sock** |
2259 | * result is from reuse->socks[] using the hash of the tuple. | 2259 | * result is from **reuse->socks**\ [] using the hash of the tuple. |
2260 | * | 2260 | * |
2261 | * int bpf_sk_release(struct bpf_sock *sock) | 2261 | * int bpf_sk_release(struct bpf_sock *sock) |
2262 | * Description | 2262 | * Description |
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 94c002584068..aa582cd5bfcf 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h | |||
@@ -502,18 +502,6 @@ union bpf_attr { | |||
502 | * Return | 502 | * Return |
503 | * 0 on success, or a negative error in case of failure. | 503 | * 0 on success, or a negative error in case of failure. |
504 | * | 504 | * |
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 | * | ||
517 | * int bpf_probe_read(void *dst, u32 size, const void *src) | 505 | * int bpf_probe_read(void *dst, u32 size, const void *src) |
518 | * Description | 506 | * Description |
519 | * For tracing programs, safely attempt to read *size* bytes from | 507 | * For tracing programs, safely attempt to read *size* bytes from |
@@ -1937,9 +1925,9 @@ union bpf_attr { | |||
1937 | * is set to metric from route (IPv4/IPv6 only), and ifindex | 1925 | * is set to metric from route (IPv4/IPv6 only), and ifindex |
1938 | * is set to the device index of the nexthop from the FIB lookup. | 1926 | * is set to the device index of the nexthop from the FIB lookup. |
1939 | * | 1927 | * |
1940 | * *plen* argument is the size of the passed in struct. | 1928 | * *plen* argument is the size of the passed in struct. |
1941 | * *flags* argument can be a combination of one or more of the | 1929 | * *flags* argument can be a combination of one or more of the |
1942 | * following values: | 1930 | * following values: |
1943 | * | 1931 | * |
1944 | * **BPF_FIB_LOOKUP_DIRECT** | 1932 | * **BPF_FIB_LOOKUP_DIRECT** |
1945 | * Do a direct table lookup vs full lookup using FIB | 1933 | * Do a direct table lookup vs full lookup using FIB |
@@ -1948,9 +1936,9 @@ union bpf_attr { | |||
1948 | * Perform lookup from an egress perspective (default is | 1936 | * Perform lookup from an egress perspective (default is |
1949 | * ingress). | 1937 | * ingress). |
1950 | * | 1938 | * |
1951 | * *ctx* is either **struct xdp_md** for XDP programs or | 1939 | * *ctx* is either **struct xdp_md** for XDP programs or |
1952 | * **struct sk_buff** tc cls_act programs. | 1940 | * **struct sk_buff** tc cls_act programs. |
1953 | * Return | 1941 | * Return |
1954 | * * < 0 if any input argument is invalid | 1942 | * * < 0 if any input argument is invalid |
1955 | * * 0 on success (packet is forwarded, nexthop neighbor exists) | 1943 | * * 0 on success (packet is forwarded, nexthop neighbor exists) |
1956 | * * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the | 1944 | * * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the |
@@ -2095,8 +2083,8 @@ union bpf_attr { | |||
2095 | * translated to a keycode using the rc keymap, and reported as | 2083 | * translated to a keycode using the rc keymap, and reported as |
2096 | * an input key down event. After a period a key up event is | 2084 | * an input key down event. After a period a key up event is |
2097 | * generated. This period can be extended by calling either | 2085 | * generated. This period can be extended by calling either |
2098 | * **bpf_rc_keydown** () again with the same values, or calling | 2086 | * **bpf_rc_keydown**\ () again with the same values, or calling |
2099 | * **bpf_rc_repeat** (). | 2087 | * **bpf_rc_repeat**\ (). |
2100 | * | 2088 | * |
2101 | * Some protocols include a toggle bit, in case the button was | 2089 | * Some protocols include a toggle bit, in case the button was |
2102 | * released and pressed again between consecutive scancodes. | 2090 | * released and pressed again between consecutive scancodes. |
@@ -2179,21 +2167,22 @@ union bpf_attr { | |||
2179 | * The *flags* meaning is specific for each map type, | 2167 | * The *flags* meaning is specific for each map type, |
2180 | * and has to be 0 for cgroup local storage. | 2168 | * and has to be 0 for cgroup local storage. |
2181 | * | 2169 | * |
2182 | * Depending on the bpf program type, a local storage area | 2170 | * Depending on the BPF program type, a local storage area |
2183 | * can be shared between multiple instances of the bpf program, | 2171 | * can be shared between multiple instances of the BPF program, |
2184 | * running simultaneously. | 2172 | * running simultaneously. |
2185 | * | 2173 | * |
2186 | * A user should care about the synchronization by himself. | 2174 | * 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 |
2188 | * the shared data. | 2176 | * the shared data. |
2189 | * Return | 2177 | * Return |
2190 | * Pointer to the local storage area. | 2178 | * A pointer to the local storage area. |
2191 | * | 2179 | * |
2192 | * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags) | 2180 | * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags) |
2193 | * Description | 2181 | * Description |
2194 | * Select a SO_REUSEPORT sk from a BPF_MAP_TYPE_REUSEPORT_ARRAY map | 2182 | * Select a **SO_REUSEPORT** socket from a |
2195 | * It checks the selected sk is matching the incoming | 2183 | * **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*. |
2196 | * request in the skb. | 2184 | * It checks the selected socket is matching the incoming |
2185 | * request in the socket buffer. | ||
2197 | * Return | 2186 | * Return |
2198 | * 0 on success, or a negative error in case of failure. | 2187 | * 0 on success, or a negative error in case of failure. |
2199 | * | 2188 | * |
@@ -2201,7 +2190,7 @@ union bpf_attr { | |||
2201 | * Description | 2190 | * Description |
2202 | * Look for TCP socket matching *tuple*, optionally in a child | 2191 | * Look for TCP socket matching *tuple*, optionally in a child |
2203 | * network namespace *netns*. The return value must be checked, | 2192 | * 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**\ (). |
2205 | * | 2194 | * |
2206 | * The *ctx* should point to the context of the program, such as | 2195 | * The *ctx* should point to the context of the program, such as |
2207 | * the skb or socket (depending on the hook in use). This is used | 2196 | * the skb or socket (depending on the hook in use). This is used |
@@ -2229,15 +2218,15 @@ union bpf_attr { | |||
2229 | * This helper is available only if the kernel was compiled with | 2218 | * This helper is available only if the kernel was compiled with |
2230 | * **CONFIG_NET** configuration option. | 2219 | * **CONFIG_NET** configuration option. |
2231 | * Return | 2220 | * Return |
2232 | * Pointer to *struct bpf_sock*, or NULL in case of failure. | 2221 | * Pointer to **struct bpf_sock**, or **NULL** in case of failure. |
2233 | * For sockets with reuseport option, the *struct bpf_sock* | 2222 | * For sockets with reuseport option, the **struct bpf_sock** |
2234 | * result is from reuse->socks[] using the hash of the tuple. | 2223 | * result is from **reuse->socks**\ [] using the hash of the tuple. |
2235 | * | 2224 | * |
2236 | * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags) | 2225 | * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags) |
2237 | * Description | 2226 | * Description |
2238 | * Look for UDP socket matching *tuple*, optionally in a child | 2227 | * Look for UDP socket matching *tuple*, optionally in a child |
2239 | * network namespace *netns*. The return value must be checked, | 2228 | * 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**\ (). |
2241 | * | 2230 | * |
2242 | * The *ctx* should point to the context of the program, such as | 2231 | * The *ctx* should point to the context of the program, such as |
2243 | * the skb or socket (depending on the hook in use). This is used | 2232 | * the skb or socket (depending on the hook in use). This is used |
@@ -2265,42 +2254,54 @@ union bpf_attr { | |||
2265 | * This helper is available only if the kernel was compiled with | 2254 | * This helper is available only if the kernel was compiled with |
2266 | * **CONFIG_NET** configuration option. | 2255 | * **CONFIG_NET** configuration option. |
2267 | * Return | 2256 | * Return |
2268 | * Pointer to *struct bpf_sock*, or NULL in case of failure. | 2257 | * Pointer to **struct bpf_sock**, or **NULL** in case of failure. |
2269 | * For sockets with reuseport option, the *struct bpf_sock* | 2258 | * For sockets with reuseport option, the **struct bpf_sock** |
2270 | * result is from reuse->socks[] using the hash of the tuple. | 2259 | * result is from **reuse->socks**\ [] using the hash of the tuple. |
2271 | * | 2260 | * |
2272 | * int bpf_sk_release(struct bpf_sock *sk) | 2261 | * int bpf_sk_release(struct bpf_sock *sock) |
2273 | * Description | 2262 | * Description |
2274 | * Release the reference held by *sock*. *sock* must be a non-NULL | 2263 | * Release the reference held by *sock*. *sock* must be a |
2275 | * pointer that was returned from bpf_sk_lookup_xxx\ (). | 2264 | * non-**NULL** pointer that was returned from |
2265 | * **bpf_sk_lookup_xxx**\ (). | ||
2276 | * Return | 2266 | * Return |
2277 | * 0 on success, or a negative error in case of failure. | 2267 | * 0 on success, or a negative error in case of failure. |
2278 | * | 2268 | * |
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 | * | ||
2279 | * int bpf_msg_push_data(struct sk_buff *skb, u32 start, u32 len, u64 flags) | 2281 | * int bpf_msg_push_data(struct sk_buff *skb, u32 start, u32 len, u64 flags) |
2280 | * Description | 2282 | * Description |
2281 | * For socket policies, insert *len* bytes into msg at offset | 2283 | * For socket policies, insert *len* bytes into *msg* at offset |
2282 | * *start*. | 2284 | * *start*. |
2283 | * | 2285 | * |
2284 | * If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a | 2286 | * 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*. |
2286 | * This can later be read and used by any of the lower layer BPF | 2288 | * This can later be read and used by any of the lower layer BPF |
2287 | * hooks. | 2289 | * hooks. |
2288 | * | 2290 | * |
2289 | * This helper may fail if under memory pressure (a malloc | 2291 | * This helper may fail if under memory pressure (a malloc |
2290 | * fails) in these cases BPF programs will get an appropriate | 2292 | * fails) in these cases BPF programs will get an appropriate |
2291 | * error and BPF programs will need to handle them. | 2293 | * error and BPF programs will need to handle them. |
2292 | * | ||
2293 | * Return | 2294 | * Return |
2294 | * 0 on success, or a negative error in case of failure. | 2295 | * 0 on success, or a negative error in case of failure. |
2295 | * | 2296 | * |
2296 | * int bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 pop, u64 flags) | 2297 | * int bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 pop, u64 flags) |
2297 | * Description | 2298 | * Description |
2298 | * Will remove *pop* bytes from a *msg* starting at byte *start*. | 2299 | * Will remove *pop* bytes from a *msg* starting at byte *start*. |
2299 | * This may result in **ENOMEM** errors under certain situations if | 2300 | * This may result in **ENOMEM** errors under certain situations if |
2300 | * an allocation and copy are required due to a full ring buffer. | 2301 | * an allocation and copy are required due to a full ring buffer. |
2301 | * However, the helper will try to avoid doing the allocation | 2302 | * However, the helper will try to avoid doing the allocation |
2302 | * if possible. Other errors can occur if input parameters are | 2303 | * 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* |
2304 | * payload and/or *pop* value being to large. | 2305 | * payload and/or *pop* value being to large. |
2305 | * Return | 2306 | * Return |
2306 | * 0 on success, or a negative error in case of failure. | 2307 | * 0 on success, or a negative error in case of failure. |