aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-12-27 16:04:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-27 16:04:52 -0500
commite0c38a4d1f196a4b17d2eba36afff8f656a4f1de (patch)
treeb26a69fabef0160adb127416a9744217700feeb7 /tools/include
parent7f9f852c75e7d776b078813586c76a2bc7dca993 (diff)
parent90cadbbf341dd5b2df991c33a6bd6341f3a53788 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: 1) New ipset extensions for matching on destination MAC addresses, from Stefano Brivio. 2) Add ipv4 ttl and tos, plus ipv6 flow label and hop limit offloads to nfp driver. From Stefano Brivio. 3) Implement GRO for plain UDP sockets, from Paolo Abeni. 4) Lots of work from Michał Mirosław to eliminate the VLAN_TAG_PRESENT bit so that we could support the entire vlan_tci value. 5) Rework the IPSEC policy lookups to better optimize more usecases, from Florian Westphal. 6) Infrastructure changes eliminating direct manipulation of SKB lists wherever possible, and to always use the appropriate SKB list helpers. This work is still ongoing... 7) Lots of PHY driver and state machine improvements and simplifications, from Heiner Kallweit. 8) Various TSO deferral refinements, from Eric Dumazet. 9) Add ntuple filter support to aquantia driver, from Dmitry Bogdanov. 10) Batch dropping of XDP packets in tuntap, from Jason Wang. 11) Lots of cleanups and improvements to the r8169 driver from Heiner Kallweit, including support for ->xmit_more. This driver has been getting some much needed love since he started working on it. 12) Lots of new forwarding selftests from Petr Machata. 13) Enable VXLAN learning in mlxsw driver, from Ido Schimmel. 14) Packed ring support for virtio, from Tiwei Bie. 15) Add new Aquantia AQtion USB driver, from Dmitry Bezrukov. 16) Add XDP support to dpaa2-eth driver, from Ioana Ciocoi Radulescu. 17) Implement coalescing on TCP backlog queue, from Eric Dumazet. 18) Implement carrier change in tun driver, from Nicolas Dichtel. 19) Support msg_zerocopy in UDP, from Willem de Bruijn. 20) Significantly improve garbage collection of neighbor objects when the table has many PERMANENT entries, from David Ahern. 21) Remove egdev usage from nfp and mlx5, and remove the facility completely from the tree as it no longer has any users. From Oz Shlomo and others. 22) Add a NETDEV_PRE_CHANGEADDR so that drivers can veto the change and therefore abort the operation before the commit phase (which is the NETDEV_CHANGEADDR event). From Petr Machata. 23) Add indirect call wrappers to avoid retpoline overhead, and use them in the GRO code paths. From Paolo Abeni. 24) Add support for netlink FDB get operations, from Roopa Prabhu. 25) Support bloom filter in mlxsw driver, from Nir Dotan. 26) Add SKB extension infrastructure. This consolidates the handling of the auxiliary SKB data used by IPSEC and bridge netfilter, and is designed to support the needs to MPTCP which could be integrated in the future. 27) Lots of XDP TX optimizations in mlx5 from Tariq Toukan. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1845 commits) net: dccp: fix kernel crash on module load drivers/net: appletalk/cops: remove redundant if statement and mask bnx2x: Fix NULL pointer dereference in bnx2x_del_all_vlans() on some hw net/net_namespace: Check the return value of register_pernet_subsys() net/netlink_compat: Fix a missing check of nla_parse_nested ieee802154: lowpan_header_create check must check daddr net/mlx4_core: drop useless LIST_HEAD mlxsw: spectrum: drop useless LIST_HEAD net/mlx5e: drop useless LIST_HEAD iptunnel: Set tun_flags in the iptunnel_metadata_reply from src net/mlx5e: fix semicolon.cocci warnings staging: octeon: fix build failure with XFRM enabled net: Revert recent Spectre-v1 patches. can: af_can: Fix Spectre v1 vulnerability packet: validate address length if non-zero nfc: af_nfc: Fix Spectre v1 vulnerability phonet: af_phonet: Fix Spectre v1 vulnerability net: core: Fix Spectre v1 vulnerability net: minor cleanup in skb_ext_add() net: drop the unused helper skb_ext_get() ...
Diffstat (limited to 'tools/include')
-rw-r--r--tools/include/uapi/linux/bpf.h188
-rw-r--r--tools/include/uapi/linux/btf.h38
2 files changed, 174 insertions, 52 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 72c453a8bf50..91c43884f295 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -133,6 +133,14 @@ enum bpf_map_type {
133 BPF_MAP_TYPE_STACK, 133 BPF_MAP_TYPE_STACK,
134}; 134};
135 135
136/* Note that tracing related programs such as
137 * BPF_PROG_TYPE_{KPROBE,TRACEPOINT,PERF_EVENT,RAW_TRACEPOINT}
138 * are not subject to a stable API since kernel internal data
139 * structures can change from release to release and may
140 * therefore break existing tracing BPF programs. Tracing BPF
141 * programs correspond to /a/ specific kernel which is to be
142 * analyzed, and not /a/ specific kernel /and/ all future ones.
143 */
136enum bpf_prog_type { 144enum bpf_prog_type {
137 BPF_PROG_TYPE_UNSPEC, 145 BPF_PROG_TYPE_UNSPEC,
138 BPF_PROG_TYPE_SOCKET_FILTER, 146 BPF_PROG_TYPE_SOCKET_FILTER,
@@ -232,6 +240,20 @@ enum bpf_attach_type {
232 */ 240 */
233#define BPF_F_STRICT_ALIGNMENT (1U << 0) 241#define BPF_F_STRICT_ALIGNMENT (1U << 0)
234 242
243/* If BPF_F_ANY_ALIGNMENT is used in BPF_PROF_LOAD command, the
244 * verifier will allow any alignment whatsoever. On platforms
245 * with strict alignment requirements for loads ands stores (such
246 * as sparc and mips) the verifier validates that all loads and
247 * stores provably follow this requirement. This flag turns that
248 * checking and enforcement off.
249 *
250 * It is mostly used for testing when we want to validate the
251 * context and memory access aspects of the verifier, but because
252 * of an unaligned access the alignment check would trigger before
253 * the one we are interested in.
254 */
255#define BPF_F_ANY_ALIGNMENT (1U << 1)
256
235/* when bpf_ldimm64->src_reg == BPF_PSEUDO_MAP_FD, bpf_ldimm64->imm == fd */ 257/* when bpf_ldimm64->src_reg == BPF_PSEUDO_MAP_FD, bpf_ldimm64->imm == fd */
236#define BPF_PSEUDO_MAP_FD 1 258#define BPF_PSEUDO_MAP_FD 1
237 259
@@ -257,9 +279,6 @@ enum bpf_attach_type {
257/* Specify numa node during map creation */ 279/* Specify numa node during map creation */
258#define BPF_F_NUMA_NODE (1U << 2) 280#define BPF_F_NUMA_NODE (1U << 2)
259 281
260/* flags for BPF_PROG_QUERY */
261#define BPF_F_QUERY_EFFECTIVE (1U << 0)
262
263#define BPF_OBJ_NAME_LEN 16U 282#define BPF_OBJ_NAME_LEN 16U
264 283
265/* Flags for accessing BPF object */ 284/* Flags for accessing BPF object */
@@ -269,6 +288,12 @@ enum bpf_attach_type {
269/* Flag for stack_map, store build_id+offset instead of pointer */ 288/* Flag for stack_map, store build_id+offset instead of pointer */
270#define BPF_F_STACK_BUILD_ID (1U << 5) 289#define BPF_F_STACK_BUILD_ID (1U << 5)
271 290
291/* Zero-initialize hash function seed. This should only be used for testing. */
292#define BPF_F_ZERO_SEED (1U << 6)
293
294/* flags for BPF_PROG_QUERY */
295#define BPF_F_QUERY_EFFECTIVE (1U << 0)
296
272enum bpf_stack_build_id_status { 297enum bpf_stack_build_id_status {
273 /* user space need an empty entry to identify end of a trace */ 298 /* user space need an empty entry to identify end of a trace */
274 BPF_STACK_BUILD_ID_EMPTY = 0, 299 BPF_STACK_BUILD_ID_EMPTY = 0,
@@ -326,7 +351,7 @@ union bpf_attr {
326 __u32 log_level; /* verbosity level of verifier */ 351 __u32 log_level; /* verbosity level of verifier */
327 __u32 log_size; /* size of user buffer */ 352 __u32 log_size; /* size of user buffer */
328 __aligned_u64 log_buf; /* user supplied buffer */ 353 __aligned_u64 log_buf; /* user supplied buffer */
329 __u32 kern_version; /* checked when prog_type=kprobe */ 354 __u32 kern_version; /* not used */
330 __u32 prog_flags; 355 __u32 prog_flags;
331 char prog_name[BPF_OBJ_NAME_LEN]; 356 char prog_name[BPF_OBJ_NAME_LEN];
332 __u32 prog_ifindex; /* ifindex of netdev to prep for */ 357 __u32 prog_ifindex; /* ifindex of netdev to prep for */
@@ -335,6 +360,13 @@ union bpf_attr {
335 * (context accesses, allowed helpers, etc). 360 * (context accesses, allowed helpers, etc).
336 */ 361 */
337 __u32 expected_attach_type; 362 __u32 expected_attach_type;
363 __u32 prog_btf_fd; /* fd pointing to BTF type data */
364 __u32 func_info_rec_size; /* userspace bpf_func_info size */
365 __aligned_u64 func_info; /* func info */
366 __u32 func_info_cnt; /* number of bpf_func_info records */
367 __u32 line_info_rec_size; /* userspace bpf_line_info size */
368 __aligned_u64 line_info; /* line info */
369 __u32 line_info_cnt; /* number of bpf_line_info records */
338 }; 370 };
339 371
340 struct { /* anonymous struct used by BPF_OBJ_* commands */ 372 struct { /* anonymous struct used by BPF_OBJ_* commands */
@@ -353,8 +385,11 @@ union bpf_attr {
353 struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */ 385 struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */
354 __u32 prog_fd; 386 __u32 prog_fd;
355 __u32 retval; 387 __u32 retval;
356 __u32 data_size_in; 388 __u32 data_size_in; /* input: len of data_in */
357 __u32 data_size_out; 389 __u32 data_size_out; /* input/output: len of data_out
390 * returns ENOSPC if data_out
391 * is too small.
392 */
358 __aligned_u64 data_in; 393 __aligned_u64 data_in;
359 __aligned_u64 data_out; 394 __aligned_u64 data_out;
360 __u32 repeat; 395 __u32 repeat;
@@ -475,18 +510,6 @@ union bpf_attr {
475 * Return 510 * Return
476 * 0 on success, or a negative error in case of failure. 511 * 0 on success, or a negative error in case of failure.
477 * 512 *
478 * int bpf_map_pop_elem(struct bpf_map *map, void *value)
479 * Description
480 * Pop an element from *map*.
481 * Return
482 * 0 on success, or a negative error in case of failure.
483 *
484 * int bpf_map_peek_elem(struct bpf_map *map, void *value)
485 * Description
486 * Get an element from *map* without removing it.
487 * Return
488 * 0 on success, or a negative error in case of failure.
489 *
490 * int bpf_probe_read(void *dst, u32 size, const void *src) 513 * int bpf_probe_read(void *dst, u32 size, const void *src)
491 * Description 514 * Description
492 * For tracing programs, safely attempt to read *size* bytes from 515 * For tracing programs, safely attempt to read *size* bytes from
@@ -1910,9 +1933,9 @@ union bpf_attr {
1910 * is set to metric from route (IPv4/IPv6 only), and ifindex 1933 * is set to metric from route (IPv4/IPv6 only), and ifindex
1911 * is set to the device index of the nexthop from the FIB lookup. 1934 * is set to the device index of the nexthop from the FIB lookup.
1912 * 1935 *
1913 * *plen* argument is the size of the passed in struct. 1936 * *plen* argument is the size of the passed in struct.
1914 * *flags* argument can be a combination of one or more of the 1937 * *flags* argument can be a combination of one or more of the
1915 * following values: 1938 * following values:
1916 * 1939 *
1917 * **BPF_FIB_LOOKUP_DIRECT** 1940 * **BPF_FIB_LOOKUP_DIRECT**
1918 * Do a direct table lookup vs full lookup using FIB 1941 * Do a direct table lookup vs full lookup using FIB
@@ -1921,9 +1944,9 @@ union bpf_attr {
1921 * Perform lookup from an egress perspective (default is 1944 * Perform lookup from an egress perspective (default is
1922 * ingress). 1945 * ingress).
1923 * 1946 *
1924 * *ctx* is either **struct xdp_md** for XDP programs or 1947 * *ctx* is either **struct xdp_md** for XDP programs or
1925 * **struct sk_buff** tc cls_act programs. 1948 * **struct sk_buff** tc cls_act programs.
1926 * Return 1949 * Return
1927 * * < 0 if any input argument is invalid 1950 * * < 0 if any input argument is invalid
1928 * * 0 on success (packet is forwarded, nexthop neighbor exists) 1951 * * 0 on success (packet is forwarded, nexthop neighbor exists)
1929 * * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the 1952 * * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the
@@ -2068,8 +2091,8 @@ union bpf_attr {
2068 * translated to a keycode using the rc keymap, and reported as 2091 * translated to a keycode using the rc keymap, and reported as
2069 * an input key down event. After a period a key up event is 2092 * an input key down event. After a period a key up event is
2070 * generated. This period can be extended by calling either 2093 * generated. This period can be extended by calling either
2071 * **bpf_rc_keydown** () again with the same values, or calling 2094 * **bpf_rc_keydown**\ () again with the same values, or calling
2072 * **bpf_rc_repeat** (). 2095 * **bpf_rc_repeat**\ ().
2073 * 2096 *
2074 * Some protocols include a toggle bit, in case the button was 2097 * Some protocols include a toggle bit, in case the button was
2075 * released and pressed again between consecutive scancodes. 2098 * released and pressed again between consecutive scancodes.
@@ -2152,21 +2175,22 @@ union bpf_attr {
2152 * The *flags* meaning is specific for each map type, 2175 * The *flags* meaning is specific for each map type,
2153 * and has to be 0 for cgroup local storage. 2176 * and has to be 0 for cgroup local storage.
2154 * 2177 *
2155 * Depending on the bpf program type, a local storage area 2178 * Depending on the BPF program type, a local storage area
2156 * can be shared between multiple instances of the bpf program, 2179 * can be shared between multiple instances of the BPF program,
2157 * running simultaneously. 2180 * running simultaneously.
2158 * 2181 *
2159 * A user should care about the synchronization by himself. 2182 * A user should care about the synchronization by himself.
2160 * For example, by using the BPF_STX_XADD instruction to alter 2183 * For example, by using the **BPF_STX_XADD** instruction to alter
2161 * the shared data. 2184 * the shared data.
2162 * Return 2185 * Return
2163 * Pointer to the local storage area. 2186 * A pointer to the local storage area.
2164 * 2187 *
2165 * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags) 2188 * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
2166 * Description 2189 * Description
2167 * Select a SO_REUSEPORT sk from a BPF_MAP_TYPE_REUSEPORT_ARRAY map 2190 * Select a **SO_REUSEPORT** socket from a
2168 * It checks the selected sk is matching the incoming 2191 * **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*.
2169 * request in the skb. 2192 * It checks the selected socket is matching the incoming
2193 * request in the socket buffer.
2170 * Return 2194 * Return
2171 * 0 on success, or a negative error in case of failure. 2195 * 0 on success, or a negative error in case of failure.
2172 * 2196 *
@@ -2174,7 +2198,7 @@ union bpf_attr {
2174 * Description 2198 * Description
2175 * Look for TCP socket matching *tuple*, optionally in a child 2199 * Look for TCP socket matching *tuple*, optionally in a child
2176 * network namespace *netns*. The return value must be checked, 2200 * network namespace *netns*. The return value must be checked,
2177 * and if non-NULL, released via **bpf_sk_release**\ (). 2201 * and if non-**NULL**, released via **bpf_sk_release**\ ().
2178 * 2202 *
2179 * The *ctx* should point to the context of the program, such as 2203 * The *ctx* should point to the context of the program, such as
2180 * the skb or socket (depending on the hook in use). This is used 2204 * the skb or socket (depending on the hook in use). This is used
@@ -2202,15 +2226,15 @@ union bpf_attr {
2202 * This helper is available only if the kernel was compiled with 2226 * This helper is available only if the kernel was compiled with
2203 * **CONFIG_NET** configuration option. 2227 * **CONFIG_NET** configuration option.
2204 * Return 2228 * Return
2205 * Pointer to *struct bpf_sock*, or NULL in case of failure. 2229 * Pointer to **struct bpf_sock**, or **NULL** in case of failure.
2206 * For sockets with reuseport option, the *struct bpf_sock* 2230 * For sockets with reuseport option, the **struct bpf_sock**
2207 * result is from reuse->socks[] using the hash of the tuple. 2231 * result is from **reuse->socks**\ [] using the hash of the tuple.
2208 * 2232 *
2209 * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags) 2233 * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
2210 * Description 2234 * Description
2211 * Look for UDP socket matching *tuple*, optionally in a child 2235 * Look for UDP socket matching *tuple*, optionally in a child
2212 * network namespace *netns*. The return value must be checked, 2236 * network namespace *netns*. The return value must be checked,
2213 * and if non-NULL, released via **bpf_sk_release**\ (). 2237 * and if non-**NULL**, released via **bpf_sk_release**\ ().
2214 * 2238 *
2215 * The *ctx* should point to the context of the program, such as 2239 * The *ctx* should point to the context of the program, such as
2216 * the skb or socket (depending on the hook in use). This is used 2240 * the skb or socket (depending on the hook in use). This is used
@@ -2238,33 +2262,71 @@ union bpf_attr {
2238 * This helper is available only if the kernel was compiled with 2262 * This helper is available only if the kernel was compiled with
2239 * **CONFIG_NET** configuration option. 2263 * **CONFIG_NET** configuration option.
2240 * Return 2264 * Return
2241 * Pointer to *struct bpf_sock*, or NULL in case of failure. 2265 * Pointer to **struct bpf_sock**, or **NULL** in case of failure.
2242 * For sockets with reuseport option, the *struct bpf_sock* 2266 * For sockets with reuseport option, the **struct bpf_sock**
2243 * result is from reuse->socks[] using the hash of the tuple. 2267 * result is from **reuse->socks**\ [] using the hash of the tuple.
2244 * 2268 *
2245 * int bpf_sk_release(struct bpf_sock *sk) 2269 * int bpf_sk_release(struct bpf_sock *sock)
2246 * Description 2270 * Description
2247 * Release the reference held by *sock*. *sock* must be a non-NULL 2271 * Release the reference held by *sock*. *sock* must be a
2248 * pointer that was returned from bpf_sk_lookup_xxx\ (). 2272 * non-**NULL** pointer that was returned from
2273 * **bpf_sk_lookup_xxx**\ ().
2249 * Return 2274 * Return
2250 * 0 on success, or a negative error in case of failure. 2275 * 0 on success, or a negative error in case of failure.
2251 * 2276 *
2277 * int bpf_map_pop_elem(struct bpf_map *map, void *value)
2278 * Description
2279 * Pop an element from *map*.
2280 * Return
2281 * 0 on success, or a negative error in case of failure.
2282 *
2283 * int bpf_map_peek_elem(struct bpf_map *map, void *value)
2284 * Description
2285 * Get an element from *map* without removing it.
2286 * Return
2287 * 0 on success, or a negative error in case of failure.
2288 *
2252 * int bpf_msg_push_data(struct sk_buff *skb, u32 start, u32 len, u64 flags) 2289 * int bpf_msg_push_data(struct sk_buff *skb, u32 start, u32 len, u64 flags)
2253 * Description 2290 * Description
2254 * For socket policies, insert *len* bytes into msg at offset 2291 * For socket policies, insert *len* bytes into *msg* at offset
2255 * *start*. 2292 * *start*.
2256 * 2293 *
2257 * If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a 2294 * If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a
2258 * *msg* it may want to insert metadata or options into the msg. 2295 * *msg* it may want to insert metadata or options into the *msg*.
2259 * This can later be read and used by any of the lower layer BPF 2296 * This can later be read and used by any of the lower layer BPF
2260 * hooks. 2297 * hooks.
2261 * 2298 *
2262 * This helper may fail if under memory pressure (a malloc 2299 * This helper may fail if under memory pressure (a malloc
2263 * fails) in these cases BPF programs will get an appropriate 2300 * fails) in these cases BPF programs will get an appropriate
2264 * error and BPF programs will need to handle them. 2301 * error and BPF programs will need to handle them.
2302 * Return
2303 * 0 on success, or a negative error in case of failure.
2265 * 2304 *
2305 * int bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 pop, u64 flags)
2306 * Description
2307 * Will remove *pop* bytes from a *msg* starting at byte *start*.
2308 * This may result in **ENOMEM** errors under certain situations if
2309 * an allocation and copy are required due to a full ring buffer.
2310 * However, the helper will try to avoid doing the allocation
2311 * if possible. Other errors can occur if input parameters are
2312 * invalid either due to *start* byte not being valid part of *msg*
2313 * payload and/or *pop* value being to large.
2266 * Return 2314 * Return
2267 * 0 on success, or a negative error in case of failure. 2315 * 0 on success, or a negative error in case of failure.
2316 *
2317 * int bpf_rc_pointer_rel(void *ctx, s32 rel_x, s32 rel_y)
2318 * Description
2319 * This helper is used in programs implementing IR decoding, to
2320 * report a successfully decoded pointer movement.
2321 *
2322 * The *ctx* should point to the lirc sample as passed into
2323 * the program.
2324 *
2325 * This helper is only available is the kernel was compiled with
2326 * the **CONFIG_BPF_LIRC_MODE2** configuration option set to
2327 * "**y**".
2328 * Return
2329 * 0
2268 */ 2330 */
2269#define __BPF_FUNC_MAPPER(FN) \ 2331#define __BPF_FUNC_MAPPER(FN) \
2270 FN(unspec), \ 2332 FN(unspec), \
@@ -2357,7 +2419,9 @@ union bpf_attr {
2357 FN(map_push_elem), \ 2419 FN(map_push_elem), \
2358 FN(map_pop_elem), \ 2420 FN(map_pop_elem), \
2359 FN(map_peek_elem), \ 2421 FN(map_peek_elem), \
2360 FN(msg_push_data), 2422 FN(msg_push_data), \
2423 FN(msg_pop_data), \
2424 FN(rc_pointer_rel),
2361 2425
2362/* integer value in 'imm' field of BPF_CALL instruction selects which helper 2426/* integer value in 'imm' field of BPF_CALL instruction selects which helper
2363 * function eBPF program intends to call 2427 * function eBPF program intends to call
@@ -2474,6 +2538,8 @@ struct __sk_buff {
2474 2538
2475 __u32 data_meta; 2539 __u32 data_meta;
2476 __bpf_md_ptr(struct bpf_flow_keys *, flow_keys); 2540 __bpf_md_ptr(struct bpf_flow_keys *, flow_keys);
2541 __u64 tstamp;
2542 __u32 wire_len;
2477}; 2543};
2478 2544
2479struct bpf_tunnel_key { 2545struct bpf_tunnel_key {
@@ -2599,6 +2665,7 @@ struct sk_msg_md {
2599 __u32 local_ip6[4]; /* Stored in network byte order */ 2665 __u32 local_ip6[4]; /* Stored in network byte order */
2600 __u32 remote_port; /* Stored in network byte order */ 2666 __u32 remote_port; /* Stored in network byte order */
2601 __u32 local_port; /* stored in host byte order */ 2667 __u32 local_port; /* stored in host byte order */
2668 __u32 size; /* Total size of sk_msg */
2602}; 2669};
2603 2670
2604struct sk_reuseport_md { 2671struct sk_reuseport_md {
@@ -2649,6 +2716,18 @@ struct bpf_prog_info {
2649 __u32 nr_jited_func_lens; 2716 __u32 nr_jited_func_lens;
2650 __aligned_u64 jited_ksyms; 2717 __aligned_u64 jited_ksyms;
2651 __aligned_u64 jited_func_lens; 2718 __aligned_u64 jited_func_lens;
2719 __u32 btf_id;
2720 __u32 func_info_rec_size;
2721 __aligned_u64 func_info;
2722 __u32 nr_func_info;
2723 __u32 nr_line_info;
2724 __aligned_u64 line_info;
2725 __aligned_u64 jited_line_info;
2726 __u32 nr_jited_line_info;
2727 __u32 line_info_rec_size;
2728 __u32 jited_line_info_rec_size;
2729 __u32 nr_prog_tags;
2730 __aligned_u64 prog_tags;
2652} __attribute__((aligned(8))); 2731} __attribute__((aligned(8)));
2653 2732
2654struct bpf_map_info { 2733struct bpf_map_info {
@@ -2960,4 +3039,19 @@ struct bpf_flow_keys {
2960 }; 3039 };
2961}; 3040};
2962 3041
3042struct bpf_func_info {
3043 __u32 insn_off;
3044 __u32 type_id;
3045};
3046
3047#define BPF_LINE_INFO_LINE_NUM(line_col) ((line_col) >> 10)
3048#define BPF_LINE_INFO_LINE_COL(line_col) ((line_col) & 0x3ff)
3049
3050struct bpf_line_info {
3051 __u32 insn_off;
3052 __u32 file_name_off;
3053 __u32 line_off;
3054 __u32 line_col;
3055};
3056
2963#endif /* _UAPI__LINUX_BPF_H__ */ 3057#endif /* _UAPI__LINUX_BPF_H__ */
diff --git a/tools/include/uapi/linux/btf.h b/tools/include/uapi/linux/btf.h
index 972265f32871..7b7475ef2f17 100644
--- a/tools/include/uapi/linux/btf.h
+++ b/tools/include/uapi/linux/btf.h
@@ -34,13 +34,16 @@ struct btf_type {
34 * bits 0-15: vlen (e.g. # of struct's members) 34 * bits 0-15: vlen (e.g. # of struct's members)
35 * bits 16-23: unused 35 * bits 16-23: unused
36 * bits 24-27: kind (e.g. int, ptr, array...etc) 36 * bits 24-27: kind (e.g. int, ptr, array...etc)
37 * bits 28-31: unused 37 * bits 28-30: unused
38 * bit 31: kind_flag, currently used by
39 * struct, union and fwd
38 */ 40 */
39 __u32 info; 41 __u32 info;
40 /* "size" is used by INT, ENUM, STRUCT and UNION. 42 /* "size" is used by INT, ENUM, STRUCT and UNION.
41 * "size" tells the size of the type it is describing. 43 * "size" tells the size of the type it is describing.
42 * 44 *
43 * "type" is used by PTR, TYPEDEF, VOLATILE, CONST and RESTRICT. 45 * "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT,
46 * FUNC and FUNC_PROTO.
44 * "type" is a type_id referring to another type. 47 * "type" is a type_id referring to another type.
45 */ 48 */
46 union { 49 union {
@@ -51,6 +54,7 @@ struct btf_type {
51 54
52#define BTF_INFO_KIND(info) (((info) >> 24) & 0x0f) 55#define BTF_INFO_KIND(info) (((info) >> 24) & 0x0f)
53#define BTF_INFO_VLEN(info) ((info) & 0xffff) 56#define BTF_INFO_VLEN(info) ((info) & 0xffff)
57#define BTF_INFO_KFLAG(info) ((info) >> 31)
54 58
55#define BTF_KIND_UNKN 0 /* Unknown */ 59#define BTF_KIND_UNKN 0 /* Unknown */
56#define BTF_KIND_INT 1 /* Integer */ 60#define BTF_KIND_INT 1 /* Integer */
@@ -64,8 +68,10 @@ struct btf_type {
64#define BTF_KIND_VOLATILE 9 /* Volatile */ 68#define BTF_KIND_VOLATILE 9 /* Volatile */
65#define BTF_KIND_CONST 10 /* Const */ 69#define BTF_KIND_CONST 10 /* Const */
66#define BTF_KIND_RESTRICT 11 /* Restrict */ 70#define BTF_KIND_RESTRICT 11 /* Restrict */
67#define BTF_KIND_MAX 11 71#define BTF_KIND_FUNC 12 /* Function */
68#define NR_BTF_KINDS 12 72#define BTF_KIND_FUNC_PROTO 13 /* Function Proto */
73#define BTF_KIND_MAX 13
74#define NR_BTF_KINDS 14
69 75
70/* For some specific BTF_KIND, "struct btf_type" is immediately 76/* For some specific BTF_KIND, "struct btf_type" is immediately
71 * followed by extra data. 77 * followed by extra data.
@@ -107,7 +113,29 @@ struct btf_array {
107struct btf_member { 113struct btf_member {
108 __u32 name_off; 114 __u32 name_off;
109 __u32 type; 115 __u32 type;
110 __u32 offset; /* offset in bits */ 116 /* If the type info kind_flag is set, the btf_member offset
117 * contains both member bitfield size and bit offset. The
118 * bitfield size is set for bitfield members. If the type
119 * info kind_flag is not set, the offset contains only bit
120 * offset.
121 */
122 __u32 offset;
123};
124
125/* If the struct/union type info kind_flag is set, the
126 * following two macros are used to access bitfield_size
127 * and bit_offset from btf_member.offset.
128 */
129#define BTF_MEMBER_BITFIELD_SIZE(val) ((val) >> 24)
130#define BTF_MEMBER_BIT_OFFSET(val) ((val) & 0xffffff)
131
132/* BTF_KIND_FUNC_PROTO is followed by multiple "struct btf_param".
133 * The exact number of btf_param is stored in the vlen (of the
134 * info in "struct btf_type").
135 */
136struct btf_param {
137 __u32 name_off;
138 __u32 type;
111}; 139};
112 140
113#endif /* _UAPI__LINUX_BTF_H__ */ 141#endif /* _UAPI__LINUX_BTF_H__ */