hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/include/uapi/linux/if_xdp.h
....@@ -16,6 +16,18 @@
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 @@
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 {
....@@ -46,19 +62,31 @@
4662 #define XDP_UMEM_FILL_RING 5
4763 #define XDP_UMEM_COMPLETION_RING 6
4864 #define XDP_STATISTICS 7
65
+#define XDP_OPTIONS 8
4966
5067 struct xdp_umem_reg {
5168 __u64 addr; /* Start of packet data area */
5269 __u64 len; /* Length of packet data area */
5370 __u32 chunk_size;
5471 __u32 headroom;
72
+ __u32 flags;
5573 };
5674
5775 struct xdp_statistics {
58
- __u64 rx_dropped; /* Dropped for reasons other than invalid desc */
76
+ __u64 rx_dropped; /* Dropped for other reasons */
5977 __u64 rx_invalid_descs; /* Dropped due to invalid descriptor */
6078 __u64 tx_invalid_descs; /* Dropped due to invalid descriptor */
79
+ __u64 rx_ring_full; /* Dropped due to rx ring being full */
80
+ __u64 rx_fill_ring_empty_descs; /* Failed to retrieve item from fill ring */
81
+ __u64 tx_ring_empty_descs; /* Failed to retrieve item from tx ring */
6182 };
83
+
84
+struct xdp_options {
85
+ __u32 flags;
86
+};
87
+
88
+/* Flags for the flags field of struct xdp_options */
89
+#define XDP_OPTIONS_ZEROCOPY (1 << 0)
6290
6391 /* Pgoff for mmaping the rings */
6492 #define XDP_PGOFF_RX_RING 0
....@@ -66,6 +94,11 @@
6694 #define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL
6795 #define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL
6896
97
+/* Masks for unaligned chunks mode */
98
+#define XSK_UNALIGNED_BUF_OFFSET_SHIFT 48
99
+#define XSK_UNALIGNED_BUF_ADDR_MASK \
100
+ ((1ULL << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1)
101
+
69102 /* Rx/Tx descriptor */
70103 struct xdp_desc {
71104 __u64 addr;