1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * if_xdp: XDP socket user-space interface
4 * Copyright(c) 2018 Intel Corporation.
10 #ifndef _LINUX_IF_XDP_H
11 #define _LINUX_IF_XDP_H
13 #include <linux/types.h>
15 /* Options for the sxdp_flags field */
16 #define XDP_SHARED_UMEM (1 << 0)
17 #define XDP_COPY (1 << 1) /* Force copy-mode */
18 #define XDP_ZEROCOPY (1 << 2) /* Force zero-copy mode */
25 __u32 sxdp_shared_umem_fd;
28 struct xdp_ring_offset {
34 struct xdp_mmap_offsets {
35 struct xdp_ring_offset rx;
36 struct xdp_ring_offset tx;
37 struct xdp_ring_offset fr; /* Fill */
38 struct xdp_ring_offset cr; /* Completion */
41 /* XDP socket options */
42 #define XDP_MMAP_OFFSETS 1
45 #define XDP_UMEM_REG 4
46 #define XDP_UMEM_FILL_RING 5
47 #define XDP_UMEM_COMPLETION_RING 6
48 #define XDP_STATISTICS 7
51 __u64 addr; /* Start of packet data area */
52 __u64 len; /* Length of packet data area */
57 struct xdp_statistics {
58 __u64 rx_dropped; /* Dropped for reasons other than invalid desc */
59 __u64 rx_invalid_descs; /* Dropped due to invalid descriptor */
60 __u64 tx_invalid_descs; /* Dropped due to invalid descriptor */
63 /* Pgoff for mmaping the rings */
64 #define XDP_PGOFF_RX_RING 0
65 #define XDP_PGOFF_TX_RING 0x80000000
66 #define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL
67 #define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL
69 /* Rx/Tx descriptor */
76 /* UMEM descriptor is __u64 */
78 #endif /* _LINUX_IF_XDP_H */