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
1036 BPF_LSM_CGROUP,1036 BPF_LSM_CGROUP,
1037 BPF_STRUCT_OPS,1037 BPF_STRUCT_OPS,
1038 BPF_NETFILTER,1038 BPF_NETFILTER,
1039 BPF_TCX_INGRESS,
1040 BPF_TCX_EGRESS,
1039 __MAX_BPF_ATTACH_TYPE1041 __MAX_BPF_ATTACH_TYPE
1040};1042};
1041 1043
@@ -1053,7 +1055,7 @@ enum bpf_link_type { · 11 unmodified lines
1053 BPF_LINK_TYPE_KPROBE_MULTI = 8,1055 BPF_LINK_TYPE_KPROBE_MULTI = 8,
1054 BPF_LINK_TYPE_STRUCT_OPS = 9,1056 BPF_LINK_TYPE_STRUCT_OPS = 9,
1055 BPF_LINK_TYPE_NETFILTER = 10,1057 BPF_LINK_TYPE_NETFILTER = 10,
1056 1058 BPF_LINK_TYPE_TCX = 11,
1057 MAX_BPF_LINK_TYPE,1059 MAX_BPF_LINK_TYPE,
1058};1060};
1059 1061
@@ -1113,7 +1115,12 @@ enum bpf_perf_event_type { · 53 unmodified lines
1113 */1115 */
1114#define BPF_F_ALLOW_OVERRIDE (1U << 0)1116#define BPF_F_ALLOW_OVERRIDE (1U << 0)
1115#define BPF_F_ALLOW_MULTI (1U << 1)1117#define BPF_F_ALLOW_MULTI (1U << 1)
1118/* Generic attachment flags. */
1116#define BPF_F_REPLACE (1U << 2)1119#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 */
1117 1124
1118/* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the1125/* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the
1119 * verifier will perform strict alignment checking as if the kernel1126 * verifier will perform strict alignment checking as if the kernel
@@ -1444,14 +1451,19 @@ union bpf_attr { · 324 unmodified lines
1444 };1451 };
1445 1452
1446 struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */1453 struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */
1447 __u32 target_fd; /* container object to attach to */1454 union {
1448 __u32 attach_bpf_fd; /* eBPF program to attach */1455 __u32 target_fd; /* target object to attach to or ... */
1456 __u32 target_ifindex; /* target ifindex */
1457 };
1458 __u32 attach_bpf_fd;
1449 __u32 attach_type;1459 __u32 attach_type;
1450 __u32 attach_flags;1460 __u32 attach_flags;
1451 __u32 replace_bpf_fd; /* previously attached eBPF1461 __u32 replace_bpf_fd;
1452 * program to replace if1462 union {
1453 * BPF_F_REPLACE is used1463 __u32 relative_fd;
1454 */1464 __u32 relative_id;
1465 };
1466 __u64 expected_revision;
1455 };1467 };
1456 1468
1457 struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */1469 struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */
@@ -1497,16 +1509,26 @@ union bpf_attr { · 39 unmodified lines
1497 } info;1509 } info;
1498 1510
1499 struct { /* anonymous struct used by BPF_PROG_QUERY command */1511 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 };
1501 __u32 attach_type;1516 __u32 attach_type;
1502 __u32 query_flags;1517 __u32 query_flags;
1503 __u32 attach_flags;1518 __u32 attach_flags;
1504 __aligned_u64 prog_ids;1519 __aligned_u64 prog_ids;
1505 __u32 prog_cnt;1520 union {
1521 __u32 prog_cnt;
1522 __u32 count;
1523 };
1524 __u32 :32;
1506 /* output: per-program attach_flags.1525 /* output: per-program attach_flags.
1507 * not allowed to be set during effective query.1526 * not allowed to be set during effective query.
1508 */1527 */
1509 __aligned_u64 prog_attach_flags;1528 __aligned_u64 prog_attach_flags;
1529 __aligned_u64 link_ids;
1530 __aligned_u64 link_attach_flags;
1531 __u64 revision;
1510 } query;1532 } query;
1511 1533
1512 struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */1534 struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */
@@ -1549,13 +1571,13 @@ union bpf_attr { · 36 unmodified lines
1549 __u32 map_fd; /* struct_ops to attach */1571 __u32 map_fd; /* struct_ops to attach */
1550 };1572 };
1551 union {1573 union {
1552 __u32 target_fd; /* object to attach to */1574 __u32 target_fd; /* target object to attach to or ... */
1553 __u32 target_ifindex; /* target ifindex */1575 __u32 target_ifindex; /* target ifindex */
1554 };1576 };
1555 __u32 attach_type; /* attach type */1577 __u32 attach_type; /* attach type */
1556 __u32 flags; /* extra flags */1578 __u32 flags; /* extra flags */
1557 union {1579 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 */
1559 struct {1581 struct {
1560 __aligned_u64 iter_info; /* extra bpf_iter_link_info */1582 __aligned_u64 iter_info; /* extra bpf_iter_link_info */
1561 __u32 iter_info_len; /* iter_info length */1583 __u32 iter_info_len; /* iter_info length */
@@ -1589,6 +1611,13 @@ union bpf_attr { · 27 unmodified lines
1589 __s32 priority;1611 __s32 priority;
1590 __u32 flags;1612 __u32 flags;
1591 } netfilter;1613 } netfilter;
1614 struct {
1615 union {
1616 __u32 relative_fd;
1617 __u32 relative_id;
1618 };
1619 __u64 expected_revision;
1620 } tcx;
1592 };1621 };
1593 } link_create;1622 } link_create;
1594 1623
@@ -6197,6 +6226,19 @@ struct bpf_sock_tuple { · 4602 unmodified lines
6197 };6226 };
6198};6227};
6199 6228
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 */
6235enum tcx_action_base {
6236 TCX_NEXT = -1,
6237 TCX_PASS = 0,
6238 TCX_DROP = 2,
6239 TCX_REDIRECT = 7,
6240};
6241
6200struct bpf_xdp_sock {6242struct bpf_xdp_sock {
6201 __u32 queue_id;6243 __u32 queue_id;
6202};6244};
@@ -6479,6 +6521,10 @@ struct bpf_link_info { · 276 unmodified lines
6479 } event; /* BPF_PERF_EVENT_EVENT */6521 } event; /* BPF_PERF_EVENT_EVENT */
6480 };6522 };
6481 } perf_event;6523 } perf_event;
6524 struct {
6525 __u32 ifindex;
6526 __u32 attach_type;
6527 } tcx;
6482 };6528 };
6483} __attribute__((aligned(8)));6529} __attribute__((aligned(8)));
6484 6530
@@ -7052,6 +7098,7 @@ struct bpf_list_head { · 567 unmodified lines
7052struct bpf_list_node {7098struct bpf_list_node {
7053 __u64 :64;7099 __u64 :64;
7054 __u64 :64;7100 __u64 :64;
7101 __u64 :64;
7055} __attribute__((aligned(8)));7102} __attribute__((aligned(8)));
7056 7103
7057struct bpf_rb_root {7104struct bpf_rb_root {
@@ -7063,6 +7110,7 @@ struct bpf_rb_node { · 5 unmodified lines
7063 __u64 :64;7110 __u64 :64;
7064 __u64 :64;7111 __u64 :64;
7065 __u64 :64;7112 __u64 :64;
7113 __u64 :64;
7066} __attribute__((aligned(8)));7114} __attribute__((aligned(8)));
7067 7115
7068struct bpf_refcount {7116struct bpf_refcount {
include/uapi/linux/if_xdp.h+13−0
@@ -25,6 +25,12 @@ · 24 unmodified lines
25 * application.25 * application.
26 */26 */
27#define XDP_USE_NEED_WAKEUP (1 << 3)27#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)
28 34
29/* Flags for xsk_umem_config flags */35/* Flags for xsk_umem_config flags */
30#define XDP_UMEM_UNALIGNED_CHUNK_FLAG (1 << 0)36#define XDP_UMEM_UNALIGNED_CHUNK_FLAG (1 << 0)
@@ -108,4 +114,11 @@ struct xdp_desc { · 77 unmodified lines
108 114
109/* UMEM descriptor is __u64 */115/* UMEM descriptor is __u64 */
110 116
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
111#endif /* _LINUX_IF_XDP_H */124#endif /* _LINUX_IF_XDP_H */
include/uapi/linux/netdev.h+1−0
@@ -41,6 +41,7 @@ enum { · 40 unmodified lines
41 NETDEV_A_DEV_IFINDEX = 1,41 NETDEV_A_DEV_IFINDEX = 1,
42 NETDEV_A_DEV_PAD,42 NETDEV_A_DEV_PAD,
43 NETDEV_A_DEV_XDP_FEATURES,43 NETDEV_A_DEV_XDP_FEATURES,
44 NETDEV_A_DEV_XDP_ZC_MAX_SEGS,
44 45
45 __NETDEV_A_DEV_MAX,46 __NETDEV_A_DEV_MAX,
46 NETDEV_A_DEV_MAX = (__NETDEV_A_DEV_MAX - 1)47 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