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
106106 BPF_TASK_FD_QUERY,
107107 BPF_MAP_LOOKUP_AND_DELETE_ELEM,
108108 BPF_MAP_FREEZE,
109+ BPF_BTF_GET_NEXT_ID,
109110 };
110111
111112 enum bpf_map_type {
@@ -284,6 +285,9 @@ enum bpf_attach_type { · 172 unmodified lines
284285 */
285286 #define BPF_F_TEST_RND_HI32 (1U << 2)
286287
288+/* The verifier internal test flag. Behavior is undefined */
289+#define BPF_F_TEST_STATE_FREQ (1U << 3)
290+
287291 /* When BPF ldimm64's insn[0].src_reg != 0 then this can have
288292 * two extensions:
289293 *
@@ -337,6 +341,9 @@ enum bpf_attach_type { · 47 unmodified lines
337341 #define BPF_F_RDONLY_PROG (1U << 7)
338342 #define BPF_F_WRONLY_PROG (1U << 8)
339343
344+/* Clone map from listener for newly accepted socket */
345+#define BPF_F_CLONE (1U << 9)
346+
340347 /* flags for BPF_PROG_QUERY */
341348 #define BPF_F_QUERY_EFFECTIVE (1U << 0)
342349
@@ -576,6 +583,8 @@ union bpf_attr { · 233 unmodified lines
576583 * limited to five).
577584 *
578585 * 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.
579588 * The format of the trace is customizable, and the exact output
580589 * one will get depends on the options set in
581590 * *\/sys/kernel/debug/tracing/trace_options* (see also the
@@ -1014,7 +1023,7 @@ union bpf_attr { · 432 unmodified lines
10141023 * The realm of the route for the packet associated to *skb*, or 0
10151024 * if none was found.
10161025 *
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)
10181027 * Description
10191028 * Write raw *data* blob into a special BPF perf event held by
10201029 * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf
@@ -1076,7 +1085,7 @@ union bpf_attr { · 55 unmodified lines
10761085 * Return
10771086 * 0 on success, or a negative error in case of failure.
10781087 *
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)
10801089 * Description
10811090 * Walk a user or a kernel stack and return its id. To achieve
10821091 * this, the helper needs *ctx*, which is a pointer to the context
@@ -1725,7 +1734,7 @@ union bpf_attr { · 642 unmodified lines
17251734 * Return
17261735 * 0 on success, or a negative error in case of failure.
17271736 *
1728− * int bpf_override_return(struct pt_reg *regs, u64 rc)
1737+ * int bpf_override_return(struct pt_regs *regs, u64 rc)
17291738 * Description
17301739 * Used for error injection, this helper uses kprobes to override
17311740 * 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
1616 #define XDP_SHARED_UMEM (1 << 0)
1717 #define XDP_COPY (1 << 1) /* Force copy-mode */
1818 #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)
1931
2032 struct sockaddr_xdp {
2133 __u16 sxdp_family;
@@ -25,10 +37,14 @@ struct sockaddr_xdp { · 3 unmodified lines
2537 __u32 sxdp_shared_umem_fd;
2638 };
2739
40+/* XDP_RING flags */
41+#define XDP_RING_NEED_WAKEUP (1 << 0)
42+
2843 struct xdp_ring_offset {
2944 __u64 producer;
3045 __u64 consumer;
3146 __u64 desc;
47+ __u64 flags;
3248 };
3349
3450 struct xdp_mmap_offsets {
@@ -53,6 +69,7 @@ struct xdp_umem_reg { · 18 unmodified lines
5369 __u64 len; /* Length of packet data area */
5470 __u32 chunk_size;
5571 __u32 headroom;
72+ __u32 flags;
5673 };
5774
5875 struct xdp_statistics {
@@ -74,6 +91,11 @@ struct xdp_options { · 15 unmodified lines
7491 #define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL
7592 #define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL
7693
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+
7799 /* Rx/Tx descriptor */
78100 struct xdp_desc {
79101 __u64 addr;