History

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

Daniel Borkmann says: ==================== The following pull-request contains BPF updates for your *net-next* tree. The main changes are: 1) Add the ability to use unaligned chunks in the AF_XDP umem. By relaxing where the chunks can be placed, it allows to use an arbitrary buffer size and place whenever there is a free address in the umem. Helps more seamless DPDK AF_XDP driver integration. Support for i40e, ixgbe and mlx5e, from Kevin and Maxim. 2) Addition of a wakeup flag for AF_XDP tx and fill rings so the application can wake up the kernel for rx/tx processing which avoids busy-spinning of the latter, useful when app and driver is located on the same core. Support for i40e, ixgbe and mlx5e, from Magnus and Maxim. 3) bpftool fixes for printf()-like functions so compiler can actually enforce checks, bpftool build system improvements for custom output directories, and addition of 'bpftool map freeze' command, from Quentin. 4) Support attaching/detaching XDP programs from 'bpftool net' command, from Daniel. 5) Automatic xskmap cleanup when AF_XDP socket is released, and several barrier/{read,write}_once fixes in AF_XDP code, from Björn. 6) Relicense of bpf_helpers.h/bpf_endian.h for future libbpf inclusion as well as libbpf versioning improvements, from Andrii. 7) Several new BPF kselftests for verifier precision tracking, from Alexei. 8) Several BPF kselftest fixes wrt endianess to run on s390x, from Ilya. 9) And more BPF kselftest improvements all over the place, from Stanislav. 10) Add simple BPF map op cache for nfp driver to batch dumps, from Jakub. 11) AF_XDP socket umem mapping improvements for 32bit archs, from Ivan. 12) Add BPF-to-BPF call and BTF line info support for s390x JIT, from Yauheni. 13) Small optimization in arm64 JIT to spare 1 insns for BPF_MOD, from Jerin. 14) Fix an error check in bpf_tcp_gen_syncookie() helper, from Petar. 15) Various minor fixes and cleanups, from Nathan, Masahiro, Masanari, Peter, Wei, Yue. ====================

David S. Miller committed 7 years ago

Commit 1e46c092 parents f9bcfe2 593f191124 files · +3489 −698Browse files

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

Unified · Split

2 files
  1. include/uapi/linux/bpf.h +12 −3
  2. include/uapi/linux/if_xdp.h +22 −0
include/uapi/linux/bpf.h+12−3
@@ -106,6 +106,7 @@ enum bpf_cmd { · 105 unmodified lines
106 BPF_TASK_FD_QUERY,106 BPF_TASK_FD_QUERY,
107 BPF_MAP_LOOKUP_AND_DELETE_ELEM,107 BPF_MAP_LOOKUP_AND_DELETE_ELEM,
108 BPF_MAP_FREEZE,108 BPF_MAP_FREEZE,
109 BPF_BTF_GET_NEXT_ID,
109};110};
110 111
111enum bpf_map_type {112enum bpf_map_type {
@@ -284,6 +285,9 @@ enum bpf_attach_type { · 172 unmodified lines
284 */285 */
285#define BPF_F_TEST_RND_HI32 (1U << 2)286#define BPF_F_TEST_RND_HI32 (1U << 2)
286 287
288/* The verifier internal test flag. Behavior is undefined */
289#define BPF_F_TEST_STATE_FREQ (1U << 3)
290
287/* When BPF ldimm64's insn[0].src_reg != 0 then this can have291/* When BPF ldimm64's insn[0].src_reg != 0 then this can have
288 * two extensions:292 * two extensions:
289 *293 *
@@ -337,6 +341,9 @@ enum bpf_attach_type { · 47 unmodified lines
337#define BPF_F_RDONLY_PROG (1U << 7)341#define BPF_F_RDONLY_PROG (1U << 7)
338#define BPF_F_WRONLY_PROG (1U << 8)342#define BPF_F_WRONLY_PROG (1U << 8)
339 343
344/* Clone map from listener for newly accepted socket */
345#define BPF_F_CLONE (1U << 9)
346
340/* flags for BPF_PROG_QUERY */347/* flags for BPF_PROG_QUERY */
341#define BPF_F_QUERY_EFFECTIVE (1U << 0)348#define BPF_F_QUERY_EFFECTIVE (1U << 0)
342 349
@@ -576,6 +583,8 @@ union bpf_attr { · 233 unmodified lines
576 * limited to five).583 * limited to five).
577 *584 *
578 * Each time the helper is called, it appends a line to the trace.585 * Each time the helper is called, it appends a line to the trace.
586 * Lines are discarded while *\/sys/kernel/debug/tracing/trace* is
587 * open, use *\/sys/kernel/debug/tracing/trace_pipe* to avoid this.
579 * The format of the trace is customizable, and the exact output588 * The format of the trace is customizable, and the exact output
580 * one will get depends on the options set in589 * one will get depends on the options set in
581 * *\/sys/kernel/debug/tracing/trace_options* (see also the590 * *\/sys/kernel/debug/tracing/trace_options* (see also the
@@ -1014,7 +1023,7 @@ union bpf_attr { · 432 unmodified lines
1014 * The realm of the route for the packet associated to *skb*, or 01023 * The realm of the route for the packet associated to *skb*, or 0
1015 * if none was found.1024 * if none was found.
1016 *1025 *
1017 * int bpf_perf_event_output(struct pt_reg *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)1026 * int bpf_perf_event_output(struct pt_regs *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
1018 * Description1027 * Description
1019 * Write raw *data* blob into a special BPF perf event held by1028 * Write raw *data* blob into a special BPF perf event held by
1020 * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf1029 * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf
@@ -1076,7 +1085,7 @@ union bpf_attr { · 55 unmodified lines
1076 * Return1085 * Return
1077 * 0 on success, or a negative error in case of failure.1086 * 0 on success, or a negative error in case of failure.
1078 *1087 *
1079 * int bpf_get_stackid(struct pt_reg *ctx, struct bpf_map *map, u64 flags)1088 * int bpf_get_stackid(struct pt_regs *ctx, struct bpf_map *map, u64 flags)
1080 * Description1089 * Description
1081 * Walk a user or a kernel stack and return its id. To achieve1090 * Walk a user or a kernel stack and return its id. To achieve
1082 * this, the helper needs *ctx*, which is a pointer to the context1091 * this, the helper needs *ctx*, which is a pointer to the context
@@ -1725,7 +1734,7 @@ union bpf_attr { · 642 unmodified lines
1725 * Return1734 * Return
1726 * 0 on success, or a negative error in case of failure.1735 * 0 on success, or a negative error in case of failure.
1727 *1736 *
1728 * int bpf_override_return(struct pt_reg *regs, u64 rc)1737 * int bpf_override_return(struct pt_regs *regs, u64 rc)
1729 * Description1738 * Description
1730 * Used for error injection, this helper uses kprobes to override1739 * Used for error injection, this helper uses kprobes to override
1731 * the return value of the probed function, and to set it to *rc*.1740 * the return value of the probed function, and to set it to *rc*.
include/uapi/linux/if_xdp.h+22−0
@@ -16,6 +16,18 @@ · 15 unmodified lines
16#define XDP_SHARED_UMEM (1 << 0)16#define XDP_SHARED_UMEM (1 << 0)
17#define XDP_COPY (1 << 1) /* Force copy-mode */17#define XDP_COPY (1 << 1) /* Force copy-mode */
18#define XDP_ZEROCOPY (1 << 2) /* Force zero-copy mode */18#define XDP_ZEROCOPY (1 << 2) /* Force zero-copy mode */
19/* If this option is set, the driver might go sleep and in that case
20 * the XDP_RING_NEED_WAKEUP flag in the fill and/or Tx rings will be
21 * set. If it is set, the application need to explicitly wake up the
22 * driver with a poll() (Rx and Tx) or sendto() (Tx only). If you are
23 * running the driver and the application on the same core, you should
24 * use this option so that the kernel will yield to the user space
25 * application.
26 */
27#define XDP_USE_NEED_WAKEUP (1 << 3)
28
29/* Flags for xsk_umem_config flags */
30#define XDP_UMEM_UNALIGNED_CHUNK_FLAG (1 << 0)
19 31
20struct sockaddr_xdp {32struct sockaddr_xdp {
21 __u16 sxdp_family;33 __u16 sxdp_family;
@@ -25,10 +37,14 @@ struct sockaddr_xdp { · 3 unmodified lines
25 __u32 sxdp_shared_umem_fd;37 __u32 sxdp_shared_umem_fd;
26};38};
27 39
40/* XDP_RING flags */
41#define XDP_RING_NEED_WAKEUP (1 << 0)
42
28struct xdp_ring_offset {43struct xdp_ring_offset {
29 __u64 producer;44 __u64 producer;
30 __u64 consumer;45 __u64 consumer;
31 __u64 desc;46 __u64 desc;
47 __u64 flags;
32};48};
33 49
34struct xdp_mmap_offsets {50struct xdp_mmap_offsets {
@@ -53,6 +69,7 @@ struct xdp_umem_reg { · 18 unmodified lines
53 __u64 len; /* Length of packet data area */69 __u64 len; /* Length of packet data area */
54 __u32 chunk_size;70 __u32 chunk_size;
55 __u32 headroom;71 __u32 headroom;
72 __u32 flags;
56};73};
57 74
58struct xdp_statistics {75struct xdp_statistics {
@@ -74,6 +91,11 @@ struct xdp_options { · 15 unmodified lines
74#define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL91#define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL
75#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL92#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL
76 93
94/* Masks for unaligned chunks mode */
95#define XSK_UNALIGNED_BUF_OFFSET_SHIFT 48
96#define XSK_UNALIGNED_BUF_ADDR_MASK \
97 ((1ULL << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1)
98
77/* Rx/Tx descriptor */99/* Rx/Tx descriptor */
78struct xdp_desc {100struct xdp_desc {
79 __u64 addr;101 __u64 addr;