1 /* 2 * This file is auto-generated. Modifications will be lost. 3 * 4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5 * for more information. 6 */ 7 #ifndef _LINUX_IF_XDP_H 8 #define _LINUX_IF_XDP_H 9 #include <linux/types.h> 10 #define XDP_SHARED_UMEM (1 << 0) 11 #define XDP_COPY (1 << 1) 12 #define XDP_ZEROCOPY (1 << 2) 13 #define XDP_USE_NEED_WAKEUP (1 << 3) 14 #define XDP_USE_SG (1 << 4) 15 #define XDP_UMEM_UNALIGNED_CHUNK_FLAG (1 << 0) 16 #define XDP_UMEM_TX_SW_CSUM (1 << 1) 17 struct sockaddr_xdp { 18 __u16 sxdp_family; 19 __u16 sxdp_flags; 20 __u32 sxdp_ifindex; 21 __u32 sxdp_queue_id; 22 __u32 sxdp_shared_umem_fd; 23 }; 24 #define XDP_RING_NEED_WAKEUP (1 << 0) 25 struct xdp_ring_offset { 26 __u64 producer; 27 __u64 consumer; 28 __u64 desc; 29 __u64 flags; 30 }; 31 struct xdp_mmap_offsets { 32 struct xdp_ring_offset rx; 33 struct xdp_ring_offset tx; 34 struct xdp_ring_offset fr; 35 struct xdp_ring_offset cr; 36 }; 37 #define XDP_MMAP_OFFSETS 1 38 #define XDP_RX_RING 2 39 #define XDP_TX_RING 3 40 #define XDP_UMEM_REG 4 41 #define XDP_UMEM_FILL_RING 5 42 #define XDP_UMEM_COMPLETION_RING 6 43 #define XDP_STATISTICS 7 44 #define XDP_OPTIONS 8 45 struct xdp_umem_reg { 46 __u64 addr; 47 __u64 len; 48 __u32 chunk_size; 49 __u32 headroom; 50 __u32 flags; 51 __u32 tx_metadata_len; 52 }; 53 struct xdp_statistics { 54 __u64 rx_dropped; 55 __u64 rx_invalid_descs; 56 __u64 tx_invalid_descs; 57 __u64 rx_ring_full; 58 __u64 rx_fill_ring_empty_descs; 59 __u64 tx_ring_empty_descs; 60 }; 61 struct xdp_options { 62 __u32 flags; 63 }; 64 #define XDP_OPTIONS_ZEROCOPY (1 << 0) 65 #define XDP_PGOFF_RX_RING 0 66 #define XDP_PGOFF_TX_RING 0x80000000 67 #define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL 68 #define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL 69 #define XSK_UNALIGNED_BUF_OFFSET_SHIFT 48 70 #define XSK_UNALIGNED_BUF_ADDR_MASK ((1ULL << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1) 71 #define XDP_TXMD_FLAGS_TIMESTAMP (1 << 0) 72 #define XDP_TXMD_FLAGS_CHECKSUM (1 << 1) 73 struct xsk_tx_metadata { 74 __u64 flags; 75 union { 76 struct { 77 __u16 csum_start; 78 __u16 csum_offset; 79 } request; 80 struct { 81 __u64 tx_timestamp; 82 } completion; 83 }; 84 }; 85 struct xdp_desc { 86 __u64 addr; 87 __u32 len; 88 __u32 options; 89 }; 90 #define XDP_PKT_CONTD (1 << 0) 91 #define XDP_TX_METADATA (1 << 1) 92 #endif 93