History

Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

Alexei Starovoitov says: ==================== pull-request: bpf-next 2023-07-19 We've added 45 non-merge commits during the last 3 day(s) which contain a total of 71 files changed, 7808 insertions(+), 592 deletions(-). The main changes are: 1) multi-buffer support in AF_XDP, from Maciej Fijalkowski, Magnus Karlsson, Tirthendu Sarkar. 2) BPF link support for tc BPF programs, from Daniel Borkmann. 3) Enable bpf_map_sum_elem_count kfunc for all program types, from Anton Protopopov. 4) Add 'owner' field to bpf_rb_node to fix races in shared ownership, Dave Marchevsky. 5) Prevent potential skb_header_pointer() misuse, from Alexei Starovoitov. * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (45 commits) bpf, net: Introduce skb_pointer_if_linear(). bpf: sync tools/ uapi header with selftests/bpf: Add mprog API tests for BPF tcx links selftests/bpf: Add mprog API tests for BPF tcx opts bpftool: Extend net dump with tcx progs libbpf: Add helper macro to clear opts structs libbpf: Add link-based API for tcx libbpf: Add opts-based attach/detach/query API for tcx bpf: Add fd-based tcx multi-prog infra with link support bpf: Add generic attach/detach/query API for multi-progs selftests/xsk: reset NIC settings to default after running test suite selftests/xsk: add test for too many frags selftests/xsk: add metadata copy test for multi-buff selftests/xsk: add invalid descriptor test for multi-buffer selftests/xsk: add unaligned mode test for multi-buffer selftests/xsk: add basic multi-buffer test selftests/xsk: transmit and receive multi-buffer packets xsk: add multi-buffer documentation i40e: xsk: add TX multi-buffer support ice: xsk: Tx multi-buffer support ... ====================

Jakub Kicinski committed 3 years ago

Commit e93165d2 parents 97083c2 6f5a63071 files · +7808 −592Browse files

Showing the changes to include/uapi (3 of 71 files). Show all

Unified · Split

3 files
  1. include/uapi/linux/bpf.h +60 −12
  2. include/uapi/linux/if_xdp.h +13 −0
  3. include/uapi/linux/netdev.h +1 −0
include/uapi/linux/bpf.h+60−12
@@ -1036,6 +1036,8 @@ enum bpf_attach_type { · 1035 unmodified lines
10361036 BPF_LSM_CGROUP,
10371037 BPF_STRUCT_OPS,
10381038 BPF_NETFILTER,
1039+ BPF_TCX_INGRESS,
1040+ BPF_TCX_EGRESS,
10391041 __MAX_BPF_ATTACH_TYPE
10401042 };
10411043
@@ -1053,7 +1055,7 @@ enum bpf_link_type { · 11 unmodified lines
10531055 BPF_LINK_TYPE_KPROBE_MULTI = 8,
10541056 BPF_LINK_TYPE_STRUCT_OPS = 9,
10551057 BPF_LINK_TYPE_NETFILTER = 10,
1056−
1058+ BPF_LINK_TYPE_TCX = 11,
10571059 MAX_BPF_LINK_TYPE,
10581060 };
10591061
@@ -1113,7 +1115,12 @@ enum bpf_perf_event_type { · 53 unmodified lines
11131115 */
11141116 #define BPF_F_ALLOW_OVERRIDE (1U << 0)
11151117 #define BPF_F_ALLOW_MULTI (1U << 1)
1118+/* Generic attachment flags. */
11161119 #define BPF_F_REPLACE (1U << 2)
1120+#define BPF_F_BEFORE (1U << 3)
1121+#define BPF_F_AFTER (1U << 4)
1122+#define BPF_F_ID (1U << 5)
1123+#define BPF_F_LINK BPF_F_LINK /* 1 << 13 */
11171124
11181125 /* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the
11191126 * verifier will perform strict alignment checking as if the kernel
@@ -1444,14 +1451,19 @@ union bpf_attr { · 324 unmodified lines
14441451 };
14451452
14461453 struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */
1447− __u32 target_fd; /* container object to attach to */
1448− __u32 attach_bpf_fd; /* eBPF program to attach */
1454+ union {
1455+ __u32 target_fd; /* target object to attach to or ... */
1456+ __u32 target_ifindex; /* target ifindex */
1457+ };
1458+ __u32 attach_bpf_fd;
14491459 __u32 attach_type;
14501460 __u32 attach_flags;
1451− __u32 replace_bpf_fd; /* previously attached eBPF
1452− * program to replace if
1453− * BPF_F_REPLACE is used
1454− */
1461+ __u32 replace_bpf_fd;
1462+ union {
1463+ __u32 relative_fd;
1464+ __u32 relative_id;
1465+ };
1466+ __u64 expected_revision;
14551467 };
14561468
14571469 struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */
@@ -1497,16 +1509,26 @@ union bpf_attr { · 39 unmodified lines
14971509 } info;
14981510
14991511 struct { /* anonymous struct used by BPF_PROG_QUERY command */
1500− __u32 target_fd; /* container object to query */
1512+ union {
1513+ __u32 target_fd; /* target object to query or ... */
1514+ __u32 target_ifindex; /* target ifindex */
1515+ };
15011516 __u32 attach_type;
15021517 __u32 query_flags;
15031518 __u32 attach_flags;
15041519 __aligned_u64 prog_ids;
1505− __u32 prog_cnt;
1520+ union {
1521+ __u32 prog_cnt;
1522+ __u32 count;
1523+ };
1524+ __u32 :32;
15061525 /* output: per-program attach_flags.
15071526 * not allowed to be set during effective query.
15081527 */
15091528 __aligned_u64 prog_attach_flags;
1529+ __aligned_u64 link_ids;
1530+ __aligned_u64 link_attach_flags;
1531+ __u64 revision;
15101532 } query;
15111533
15121534 struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */
@@ -1549,13 +1571,13 @@ union bpf_attr { · 36 unmodified lines
15491571 __u32 map_fd; /* struct_ops to attach */
15501572 };
15511573 union {
1552− __u32 target_fd; /* object to attach to */
1553− __u32 target_ifindex; /* target ifindex */
1574+ __u32 target_fd; /* target object to attach to or ... */
1575+ __u32 target_ifindex; /* target ifindex */
15541576 };
15551577 __u32 attach_type; /* attach type */
15561578 __u32 flags; /* extra flags */
15571579 union {
1558− __u32 target_btf_id; /* btf_id of target to attach to */
1580+ __u32 target_btf_id; /* btf_id of target to attach to */
15591581 struct {
15601582 __aligned_u64 iter_info; /* extra bpf_iter_link_info */
15611583 __u32 iter_info_len; /* iter_info length */
@@ -1589,6 +1611,13 @@ union bpf_attr { · 27 unmodified lines
15891611 __s32 priority;
15901612 __u32 flags;
15911613 } netfilter;
1614+ struct {
1615+ union {
1616+ __u32 relative_fd;
1617+ __u32 relative_id;
1618+ };
1619+ __u64 expected_revision;
1620+ } tcx;
15921621 };
15931622 } link_create;
15941623
@@ -6197,6 +6226,19 @@ struct bpf_sock_tuple { · 4602 unmodified lines
61976226 };
61986227 };
61996228
6229+/* (Simplified) user return codes for tcx prog type.
6230+ * A valid tcx program must return one of these defined values. All other
6231+ * return codes are reserved for future use. Must remain compatible with
6232+ * their TC_ACT_* counter-parts. For compatibility in behavior, unknown
6233+ * return codes are mapped to TCX_NEXT.
6234+ */
6235+enum tcx_action_base {
6236+ TCX_NEXT = -1,
6237+ TCX_PASS = 0,
6238+ TCX_DROP = 2,
6239+ TCX_REDIRECT = 7,
6240+};
6241+
62006242 struct bpf_xdp_sock {
62016243 __u32 queue_id;
62026244 };
@@ -6479,6 +6521,10 @@ struct bpf_link_info { · 276 unmodified lines
64796521 } event; /* BPF_PERF_EVENT_EVENT */
64806522 };
64816523 } perf_event;
6524+ struct {
6525+ __u32 ifindex;
6526+ __u32 attach_type;
6527+ } tcx;
64826528 };
64836529 } __attribute__((aligned(8)));
64846530
@@ -7052,6 +7098,7 @@ struct bpf_list_head { · 567 unmodified lines
70527098 struct bpf_list_node {
70537099 __u64 :64;
70547100 __u64 :64;
7101+ __u64 :64;
70557102 } __attribute__((aligned(8)));
70567103
70577104 struct bpf_rb_root {
@@ -7063,6 +7110,7 @@ struct bpf_rb_node { · 5 unmodified lines
70637110 __u64 :64;
70647111 __u64 :64;
70657112 __u64 :64;
7113+ __u64 :64;
70667114 } __attribute__((aligned(8)));
70677115
70687116 struct bpf_refcount {
include/uapi/linux/if_xdp.h+13−0
@@ -25,6 +25,12 @@ · 24 unmodified lines
2525 * application.
2626 */
2727 #define XDP_USE_NEED_WAKEUP (1 << 3)
28+/* By setting this option, userspace application indicates that it can
29+ * handle multiple descriptors per packet thus enabling AF_XDP to split
30+ * multi-buffer XDP frames into multiple Rx descriptors. Without this set
31+ * such frames will be dropped.
32+ */
33+#define XDP_USE_SG (1 << 4)
2834
2935 /* Flags for xsk_umem_config flags */
3036 #define XDP_UMEM_UNALIGNED_CHUNK_FLAG (1 << 0)
@@ -108,4 +114,11 @@ struct xdp_desc { · 77 unmodified lines
108114
109115 /* UMEM descriptor is __u64 */
110116
117+/* Flag indicating that the packet continues with the buffer pointed out by the
118+ * next frame in the ring. The end of the packet is signalled by setting this
119+ * bit to zero. For single buffer packets, every descriptor has 'options' set
120+ * to 0 and this maintains backward compatibility.
121+ */
122+#define XDP_PKT_CONTD (1 << 0)
123+
111124 #endif /* _LINUX_IF_XDP_H */
include/uapi/linux/netdev.h+1−0
@@ -41,6 +41,7 @@ enum { · 40 unmodified lines
4141 NETDEV_A_DEV_IFINDEX = 1,
4242 NETDEV_A_DEV_PAD,
4343 NETDEV_A_DEV_XDP_FEATURES,
44+ NETDEV_A_DEV_XDP_ZC_MAX_SEGS,
4445
4546 __NETDEV_A_DEV_MAX,
4647 NETDEV_A_DEV_MAX = (__NETDEV_A_DEV_MAX - 1)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t