linux/include/uapi/linux/if_xdp.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 * if_xdp: XDP socket user-space interface
 * Copyright(c) 2018 Intel Corporation.
 *
 * Author(s): Björn Töpel <[email protected]>
 *	      Magnus Karlsson <[email protected]>
 */

#ifndef _LINUX_IF_XDP_H
#define _LINUX_IF_XDP_H

#include <linux/types.h>

/* Options for the sxdp_flags field */
#define XDP_SHARED_UMEM
#define XDP_COPY
#define XDP_ZEROCOPY
/* If this option is set, the driver might go sleep and in that case
 * the XDP_RING_NEED_WAKEUP flag in the fill and/or Tx rings will be
 * set. If it is set, the application need to explicitly wake up the
 * driver with a poll() (Rx and Tx) or sendto() (Tx only). If you are
 * running the driver and the application on the same core, you should
 * use this option so that the kernel will yield to the user space
 * application.
 */
#define XDP_USE_NEED_WAKEUP
/* By setting this option, userspace application indicates that it can
 * handle multiple descriptors per packet thus enabling AF_XDP to split
 * multi-buffer XDP frames into multiple Rx descriptors. Without this set
 * such frames will be dropped.
 */
#define XDP_USE_SG

/* Flags for xsk_umem_config flags */
#define XDP_UMEM_UNALIGNED_CHUNK_FLAG

/* Force checksum calculation in software. Can be used for testing or
 * working around potential HW issues. This option causes performance
 * degradation and only works in XDP_COPY mode.
 */
#define XDP_UMEM_TX_SW_CSUM

/* Request to reserve tx_metadata_len bytes of per-chunk metadata.
 */
#define XDP_UMEM_TX_METADATA_LEN

struct sockaddr_xdp {};

/* XDP_RING flags */
#define XDP_RING_NEED_WAKEUP

struct xdp_ring_offset {};

struct xdp_mmap_offsets {};

/* XDP socket options */
#define XDP_MMAP_OFFSETS
#define XDP_RX_RING
#define XDP_TX_RING
#define XDP_UMEM_REG
#define XDP_UMEM_FILL_RING
#define XDP_UMEM_COMPLETION_RING
#define XDP_STATISTICS
#define XDP_OPTIONS

struct xdp_umem_reg {};

struct xdp_statistics {};

struct xdp_options {};

/* Flags for the flags field of struct xdp_options */
#define XDP_OPTIONS_ZEROCOPY

/* Pgoff for mmaping the rings */
#define XDP_PGOFF_RX_RING
#define XDP_PGOFF_TX_RING
#define XDP_UMEM_PGOFF_FILL_RING
#define XDP_UMEM_PGOFF_COMPLETION_RING

/* Masks for unaligned chunks mode */
#define XSK_UNALIGNED_BUF_OFFSET_SHIFT
#define XSK_UNALIGNED_BUF_ADDR_MASK

/* Request transmit timestamp. Upon completion, put it into tx_timestamp
 * field of struct xsk_tx_metadata.
 */
#define XDP_TXMD_FLAGS_TIMESTAMP

/* Request transmit checksum offload. Checksum start position and offset
 * are communicated via csum_start and csum_offset fields of struct
 * xsk_tx_metadata.
 */
#define XDP_TXMD_FLAGS_CHECKSUM

/* AF_XDP offloads request. 'request' union member is consumed by the driver
 * when the packet is being transmitted. 'completion' union member is
 * filled by the driver when the transmit completion arrives.
 */
struct xsk_tx_metadata {};

/* Rx/Tx descriptor */
struct xdp_desc {};

/* UMEM descriptor is __u64 */

/* Flag indicating that the packet continues with the buffer pointed out by the
 * next frame in the ring. The end of the packet is signalled by setting this
 * bit to zero. For single buffer packets, every descriptor has 'options' set
 * to 0 and this maintains backward compatibility.
 */
#define XDP_PKT_CONTD

/* TX packet carries valid metadata. */
#define XDP_TX_METADATA

#endif /* _LINUX_IF_XDP_H */