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
257257 /* Specify numa node during map creation */
258258 #define BPF_F_NUMA_NODE (1U << 2)
259259
260−/* flags for BPF_PROG_QUERY */
261−#define BPF_F_QUERY_EFFECTIVE (1U << 0)
262−
263260 #define BPF_OBJ_NAME_LEN 16U
264261
265262 /* Flags for accessing BPF object */
@@ -269,6 +266,12 @@ enum bpf_attach_type { · 3 unmodified lines
269266 /* Flag for stack_map, store build_id+offset instead of pointer */
270267 #define BPF_F_STACK_BUILD_ID (1U << 5)
271268
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+
272275 enum bpf_stack_build_id_status {
273276 /* user space need an empty entry to identify end of a trace */
274277 BPF_STACK_BUILD_ID_EMPTY = 0,
@@ -335,6 +338,10 @@ union bpf_attr { · 60 unmodified lines
335338 * (context accesses, allowed helpers, etc).
336339 */
337340 __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 */
338345 };
339346
340347 struct { /* anonymous struct used by BPF_OBJ_* commands */
@@ -2201,6 +2208,8 @@ union bpf_attr { · 1860 unmodified lines
22012208 * **CONFIG_NET** configuration option.
22022209 * Return
22032210 * 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.
22042213 *
22052214 * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)
22062215 * Description
@@ -2233,6 +2242,8 @@ union bpf_attr { · 26 unmodified lines
22332242 * **CONFIG_NET** configuration option.
22342243 * Return
22352244 * 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.
22362247 *
22372248 * int bpf_sk_release(struct bpf_sock *sk)
22382249 * Description
@@ -2457,6 +2468,7 @@ struct __sk_buff { · 218 unmodified lines
24572468
24582469 __u32 data_meta;
24592470 struct bpf_flow_keys *flow_keys;
2471+ __u64 tstamp;
24602472 };
24612473
24622474 struct bpf_tunnel_key {
@@ -2631,6 +2643,10 @@ struct bpf_prog_info { · 168 unmodified lines
26312643 __u32 nr_jited_func_lens;
26322644 __aligned_u64 jited_ksyms;
26332645 __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;
26342650 } __attribute__((aligned(8)));
26352651
26362652 struct bpf_map_info {
@@ -2942,4 +2958,9 @@ struct bpf_flow_keys { · 305 unmodified lines
29422958 };
29432959 };
29442960
2961+struct bpf_func_info {
2962+ __u32 insn_offset;
2963+ __u32 type_id;
2964+};
2965+
29452966 #endif /* _UAPI__LINUX_BPF_H__ */
include/uapi/linux/btf.h+15−3
@@ -40,7 +40,8 @@ struct btf_type { · 39 unmodified lines
4040 /* "size" is used by INT, ENUM, STRUCT and UNION.
4141 * "size" tells the size of the type it is describing.
4242 *
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.
4445 * "type" is a type_id referring to another type.
4546 */
4647 union {
@@ -64,8 +65,10 @@ struct btf_type { · 17 unmodified lines
6465 #define BTF_KIND_VOLATILE 9 /* Volatile */
6566 #define BTF_KIND_CONST 10 /* Const */
6667 #define BTF_KIND_RESTRICT 11 /* Restrict */
67−#define BTF_KIND_MAX 11
68−#define NR_BTF_KINDS 12
68+#define BTF_KIND_FUNC 12 /* Function */
69+#define BTF_KIND_FUNC_PROTO 13 /* Function Proto */
70+#define BTF_KIND_MAX 13
71+#define NR_BTF_KINDS 14
6972
7073 /* For some specific BTF_KIND, "struct btf_type" is immediately
7174 * followed by extra data.
@@ -110,4 +113,13 @@ struct btf_member { · 38 unmodified lines
110113 __u32 offset; /* offset in bits */
111114 };
112115
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+ */
120+struct btf_param {
121+ __u32 name_off;
122+ __u32 type;
123+};
124+
113125 #endif /* _UAPI__LINUX_BTF_H__ */