1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef _LINUX_IF_XDP_H 20 #define _LINUX_IF_XDP_H 21 #include <linux/types.h> 22 #define XDP_SHARED_UMEM (1 << 0) 23 #define XDP_COPY (1 << 1) 24 #define XDP_ZEROCOPY (1 << 2) 25 #define XDP_USE_NEED_WAKEUP (1 << 3) 26 #define XDP_UMEM_UNALIGNED_CHUNK_FLAG (1 << 0) 27 struct sockaddr_xdp { 28 __u16 sxdp_family; 29 __u16 sxdp_flags; 30 __u32 sxdp_ifindex; 31 __u32 sxdp_queue_id; 32 __u32 sxdp_shared_umem_fd; 33 }; 34 #define XDP_RING_NEED_WAKEUP (1 << 0) 35 struct xdp_ring_offset { 36 __u64 producer; 37 __u64 consumer; 38 __u64 desc; 39 __u64 flags; 40 }; 41 struct xdp_mmap_offsets { 42 struct xdp_ring_offset rx; 43 struct xdp_ring_offset tx; 44 struct xdp_ring_offset fr; 45 struct xdp_ring_offset cr; 46 }; 47 #define XDP_MMAP_OFFSETS 1 48 #define XDP_RX_RING 2 49 #define XDP_TX_RING 3 50 #define XDP_UMEM_REG 4 51 #define XDP_UMEM_FILL_RING 5 52 #define XDP_UMEM_COMPLETION_RING 6 53 #define XDP_STATISTICS 7 54 #define XDP_OPTIONS 8 55 struct xdp_umem_reg { 56 __u64 addr; 57 __u64 len; 58 __u32 chunk_size; 59 __u32 headroom; 60 __u32 flags; 61 }; 62 struct xdp_statistics { 63 __u64 rx_dropped; 64 __u64 rx_invalid_descs; 65 __u64 tx_invalid_descs; 66 __u64 rx_ring_full; 67 __u64 rx_fill_ring_empty_descs; 68 __u64 tx_ring_empty_descs; 69 }; 70 struct xdp_options { 71 __u32 flags; 72 }; 73 #define XDP_OPTIONS_ZEROCOPY (1 << 0) 74 #define XDP_PGOFF_RX_RING 0 75 #define XDP_PGOFF_TX_RING 0x80000000 76 #define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL 77 #define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL 78 #define XSK_UNALIGNED_BUF_OFFSET_SHIFT 48 79 #define XSK_UNALIGNED_BUF_ADDR_MASK ((1ULL << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1) 80 struct xdp_desc { 81 __u64 addr; 82 __u32 len; 83 __u32 options; 84 }; 85 #endif 86