History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

Daniel Borkmann says: ==================== pull-request: bpf-next 2018-11-26 The following pull-request contains BPF updates for your *net-next* tree. The main changes are: 1) Extend BTF to support function call types and improve the BPF symbol handling with this info for kallsyms and bpftool program dump to make debugging easier, from Martin and Yonghong. 2) Optimize LPM lookups by making longest_prefix_match() handle multiple bytes at a time, from Eric. 3) Adds support for loading and attaching flow dissector BPF progs from bpftool, from Stanislav. 4) Extend the sk_lookup() helper to be supported from XDP, from Nitin. 5) Enable verifier to support narrow context loads with offset > 0 to adapt to LLVM code generation (currently only offset of 0 was supported). Add test cases as well, from Andrey. 6) Simplify passing device functions for offloaded BPF progs by adding callbacks to bpf_prog_offload_ops instead of ndo_bpf. Also convert nfp and netdevsim to make use of them, from Quentin. 7) Add support for sock_ops based BPF programs to send events to the perf ring-buffer through perf_event_output helper, from Sowmini and Daniel. 8) Add read / write support for skb->tstamp from tc BPF and cg BPF programs to allow for supporting rate-limiting in EDT qdiscs like fq from BPF side, from Vlad. 9) Extend libbpf API to support map in map types and add test cases for it as well to BPF kselftests, from Nikita. 10) Account the maximum packet offset accessed by a BPF program in the verifier and use it for optimizing nfp JIT, from Jiong. 11) Fix error handling regarding kprobe_events in BPF sample loader, from Daniel T. 12) Add support for queue and stack map type in bpftool, from David. ====================

David S. Miller committed 7 years ago

Commit 4afe60a2 parents 4bffc66 ffac28f63 files · +4208 −596Browse files

Showing the changes to include/uapi/linux (2 of 63 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/bpf.h +24 −3
  2. include/uapi/linux/btf.h +15 −3
include/uapi/linux/bpf.h+24−3
@@ -257,9 +257,6 @@ enum bpf_attach_type { · 256 unmodified lines
257/* Specify numa node during map creation */257/* Specify numa node during map creation */
258#define BPF_F_NUMA_NODE (1U << 2)258#define BPF_F_NUMA_NODE (1U << 2)
259 259
260/* flags for BPF_PROG_QUERY */
261#define BPF_F_QUERY_EFFECTIVE (1U << 0)
262
263#define BPF_OBJ_NAME_LEN 16U260#define BPF_OBJ_NAME_LEN 16U
264 261
265/* Flags for accessing BPF object */262/* Flags for accessing BPF object */
@@ -269,6 +266,12 @@ enum bpf_attach_type { · 3 unmodified lines
269/* Flag for stack_map, store build_id+offset instead of pointer */266/* Flag for stack_map, store build_id+offset instead of pointer */
270#define BPF_F_STACK_BUILD_ID (1U << 5)267#define BPF_F_STACK_BUILD_ID (1U << 5)
271 268
269/* Zero-initialize hash function seed. This should only be used for testing. */
270#define BPF_F_ZERO_SEED (1U << 6)
271
272/* flags for BPF_PROG_QUERY */
273#define BPF_F_QUERY_EFFECTIVE (1U << 0)
274
272enum bpf_stack_build_id_status {275enum bpf_stack_build_id_status {
273 /* user space need an empty entry to identify end of a trace */276 /* user space need an empty entry to identify end of a trace */
274 BPF_STACK_BUILD_ID_EMPTY = 0,277 BPF_STACK_BUILD_ID_EMPTY = 0,
@@ -335,6 +338,10 @@ union bpf_attr { · 60 unmodified lines
335 * (context accesses, allowed helpers, etc).338 * (context accesses, allowed helpers, etc).
336 */339 */
337 __u32 expected_attach_type;340 __u32 expected_attach_type;
341 __u32 prog_btf_fd; /* fd pointing to BTF type data */
342 __u32 func_info_rec_size; /* userspace bpf_func_info size */
343 __aligned_u64 func_info; /* func info */
344 __u32 func_info_cnt; /* number of bpf_func_info records */
338 };345 };
339 346
340 struct { /* anonymous struct used by BPF_OBJ_* commands */347 struct { /* anonymous struct used by BPF_OBJ_* commands */
@@ -2201,6 +2208,8 @@ union bpf_attr { · 1860 unmodified lines
2201 * **CONFIG_NET** configuration option.2208 * **CONFIG_NET** configuration option.
2202 * Return2209 * Return
2203 * Pointer to *struct bpf_sock*, or NULL in case of failure.2210 * Pointer to *struct bpf_sock*, or NULL in case of failure.
2211 * For sockets with reuseport option, *struct bpf_sock*
2212 * return is from reuse->socks[] using hash of the packet.
2204 *2213 *
2205 * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)2214 * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)
2206 * Description2215 * Description
@@ -2233,6 +2242,8 @@ union bpf_attr { · 26 unmodified lines
2233 * **CONFIG_NET** configuration option.2242 * **CONFIG_NET** configuration option.
2234 * Return2243 * Return
2235 * Pointer to *struct bpf_sock*, or NULL in case of failure.2244 * Pointer to *struct bpf_sock*, or NULL in case of failure.
2245 * For sockets with reuseport option, *struct bpf_sock*
2246 * return is from reuse->socks[] using hash of the packet.
2236 *2247 *
2237 * int bpf_sk_release(struct bpf_sock *sk)2248 * int bpf_sk_release(struct bpf_sock *sk)
2238 * Description2249 * Description
@@ -2457,6 +2468,7 @@ struct __sk_buff { · 218 unmodified lines
2457 2468
2458 __u32 data_meta;2469 __u32 data_meta;
2459 struct bpf_flow_keys *flow_keys;2470 struct bpf_flow_keys *flow_keys;
2471 __u64 tstamp;
2460};2472};
2461 2473
2462struct bpf_tunnel_key {2474struct bpf_tunnel_key {
@@ -2631,6 +2643,10 @@ struct bpf_prog_info { · 168 unmodified lines
2631 __u32 nr_jited_func_lens;2643 __u32 nr_jited_func_lens;
2632 __aligned_u64 jited_ksyms;2644 __aligned_u64 jited_ksyms;
2633 __aligned_u64 jited_func_lens;2645 __aligned_u64 jited_func_lens;
2646 __u32 btf_id;
2647 __u32 func_info_rec_size;
2648 __aligned_u64 func_info;
2649 __u32 func_info_cnt;
2634} __attribute__((aligned(8)));2650} __attribute__((aligned(8)));
2635 2651
2636struct bpf_map_info {2652struct bpf_map_info {
@@ -2942,4 +2958,9 @@ struct bpf_flow_keys { · 305 unmodified lines
2942 };2958 };
2943};2959};
2944 2960
2961struct bpf_func_info {
2962 __u32 insn_offset;
2963 __u32 type_id;
2964};
2965
2945#endif /* _UAPI__LINUX_BPF_H__ */2966#endif /* _UAPI__LINUX_BPF_H__ */
include/uapi/linux/btf.h+15−3
@@ -40,7 +40,8 @@ struct btf_type { · 39 unmodified lines
40 /* "size" is used by INT, ENUM, STRUCT and UNION.40 /* "size" is used by INT, ENUM, STRUCT and UNION.
41 * "size" tells the size of the type it is describing.41 * "size" tells the size of the type it is describing.
42 *42 *
43 * "type" is used by PTR, TYPEDEF, VOLATILE, CONST and RESTRICT.43 * "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT,
44 * FUNC and FUNC_PROTO.
44 * "type" is a type_id referring to another type.45 * "type" is a type_id referring to another type.
45 */46 */
46 union {47 union {
@@ -64,8 +65,10 @@ struct btf_type { · 17 unmodified lines
64#define BTF_KIND_VOLATILE 9 /* Volatile */65#define BTF_KIND_VOLATILE 9 /* Volatile */
65#define BTF_KIND_CONST 10 /* Const */66#define BTF_KIND_CONST 10 /* Const */
66#define BTF_KIND_RESTRICT 11 /* Restrict */67#define BTF_KIND_RESTRICT 11 /* Restrict */
67#define BTF_KIND_MAX 1168#define BTF_KIND_FUNC 12 /* Function */
68#define NR_BTF_KINDS 1269#define BTF_KIND_FUNC_PROTO 13 /* Function Proto */
70#define BTF_KIND_MAX 13
71#define NR_BTF_KINDS 14
69 72
70/* For some specific BTF_KIND, "struct btf_type" is immediately73/* For some specific BTF_KIND, "struct btf_type" is immediately
71 * followed by extra data.74 * followed by extra data.
@@ -110,4 +113,13 @@ struct btf_member { · 38 unmodified lines
110 __u32 offset; /* offset in bits */113 __u32 offset; /* offset in bits */
111};114};
112 115
116/* BTF_KIND_FUNC_PROTO is followed by multiple "struct btf_param".
117 * The exact number of btf_param is stored in the vlen (of the
118 * info in "struct btf_type").
119 */
120struct btf_param {
121 __u32 name_off;
122 __u32 type;
123};
124
113#endif /* _UAPI__LINUX_BTF_H__ */125#endif /* _UAPI__LINUX_BTF_H__ */