blob: d2b6bfd8ae83b1ba88a2b4d37b0323dfb6acda00 [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)
26#define XDP_UMEM_UNALIGNED_CHUNK_FLAG (1 << 0)
Christopher Ferris9ce28842018-10-25 12:11:39 -070027struct 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};
Christopher Ferris9584fa42019-12-09 15:36:13 -080034#define XDP_RING_NEED_WAKEUP (1 << 0)
Christopher Ferris9ce28842018-10-25 12:11:39 -070035struct xdp_ring_offset {
36 __u64 producer;
37 __u64 consumer;
38 __u64 desc;
Christopher Ferris9584fa42019-12-09 15:36:13 -080039 __u64 flags;
Christopher Ferris9ce28842018-10-25 12:11:39 -070040};
41struct 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
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070054#define XDP_OPTIONS 8
Christopher Ferris9ce28842018-10-25 12:11:39 -070055struct xdp_umem_reg {
56 __u64 addr;
57 __u64 len;
58 __u32 chunk_size;
59 __u32 headroom;
Christopher Ferris9584fa42019-12-09 15:36:13 -080060 __u32 flags;
Christopher Ferris9ce28842018-10-25 12:11:39 -070061};
62struct xdp_statistics {
63 __u64 rx_dropped;
64 __u64 rx_invalid_descs;
65 __u64 tx_invalid_descs;
Christopher Ferris25c18d42020-10-14 17:42:58 -070066 __u64 rx_ring_full;
67 __u64 rx_fill_ring_empty_descs;
68 __u64 tx_ring_empty_descs;
Christopher Ferris9ce28842018-10-25 12:11:39 -070069};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070070struct xdp_options {
71 __u32 flags;
72};
73#define XDP_OPTIONS_ZEROCOPY (1 << 0)
Christopher Ferris9ce28842018-10-25 12:11:39 -070074#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
Christopher Ferris9584fa42019-12-09 15:36:13 -080078#define XSK_UNALIGNED_BUF_OFFSET_SHIFT 48
79#define XSK_UNALIGNED_BUF_ADDR_MASK ((1ULL << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1)
Christopher Ferris9ce28842018-10-25 12:11:39 -070080struct xdp_desc {
81 __u64 addr;
82 __u32 len;
83 __u32 options;
84};
85#endif