blob: fb9c686bf3541224a1ab62e81b57c0b69b4d5360 [file] [log] [blame]
Christopher Ferris9ce28842018-10-25 12:11:39 -07001/****************************************************************************
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)
Christopher Ferris9584fa42019-12-09 15:36:13 -080025#define XDP_USE_NEED_WAKEUP (1 << 3)
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070026#define XDP_USE_SG (1 << 4)
Christopher Ferris9584fa42019-12-09 15:36:13 -080027#define XDP_UMEM_UNALIGNED_CHUNK_FLAG (1 << 0)
Christopher Ferris9ce28842018-10-25 12:11:39 -070028struct sockaddr_xdp {
29 __u16 sxdp_family;
30 __u16 sxdp_flags;
31 __u32 sxdp_ifindex;
32 __u32 sxdp_queue_id;
33 __u32 sxdp_shared_umem_fd;
34};
Christopher Ferris9584fa42019-12-09 15:36:13 -080035#define XDP_RING_NEED_WAKEUP (1 << 0)
Christopher Ferris9ce28842018-10-25 12:11:39 -070036struct xdp_ring_offset {
37 __u64 producer;
38 __u64 consumer;
39 __u64 desc;
Christopher Ferris9584fa42019-12-09 15:36:13 -080040 __u64 flags;
Christopher Ferris9ce28842018-10-25 12:11:39 -070041};
42struct xdp_mmap_offsets {
43 struct xdp_ring_offset rx;
44 struct xdp_ring_offset tx;
45 struct xdp_ring_offset fr;
46 struct xdp_ring_offset cr;
47};
48#define XDP_MMAP_OFFSETS 1
49#define XDP_RX_RING 2
50#define XDP_TX_RING 3
51#define XDP_UMEM_REG 4
52#define XDP_UMEM_FILL_RING 5
53#define XDP_UMEM_COMPLETION_RING 6
54#define XDP_STATISTICS 7
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070055#define XDP_OPTIONS 8
Christopher Ferris9ce28842018-10-25 12:11:39 -070056struct xdp_umem_reg {
57 __u64 addr;
58 __u64 len;
59 __u32 chunk_size;
60 __u32 headroom;
Christopher Ferris9584fa42019-12-09 15:36:13 -080061 __u32 flags;
Christopher Ferris9ce28842018-10-25 12:11:39 -070062};
63struct xdp_statistics {
64 __u64 rx_dropped;
65 __u64 rx_invalid_descs;
66 __u64 tx_invalid_descs;
Christopher Ferris25c18d42020-10-14 17:42:58 -070067 __u64 rx_ring_full;
68 __u64 rx_fill_ring_empty_descs;
69 __u64 tx_ring_empty_descs;
Christopher Ferris9ce28842018-10-25 12:11:39 -070070};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070071struct xdp_options {
72 __u32 flags;
73};
74#define XDP_OPTIONS_ZEROCOPY (1 << 0)
Christopher Ferris9ce28842018-10-25 12:11:39 -070075#define XDP_PGOFF_RX_RING 0
76#define XDP_PGOFF_TX_RING 0x80000000
77#define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL
78#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL
Christopher Ferris9584fa42019-12-09 15:36:13 -080079#define XSK_UNALIGNED_BUF_OFFSET_SHIFT 48
80#define XSK_UNALIGNED_BUF_ADDR_MASK ((1ULL << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1)
Christopher Ferris9ce28842018-10-25 12:11:39 -070081struct xdp_desc {
82 __u64 addr;
83 __u32 len;
84 __u32 options;
85};
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070086#define XDP_PKT_CONTD (1 << 0)
Christopher Ferris9ce28842018-10-25 12:11:39 -070087#endif