linux/include/uapi/linux/if_packet.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __LINUX_IF_PACKET_H
#define __LINUX_IF_PACKET_H

#include <asm/byteorder.h>
#include <linux/types.h>

struct sockaddr_pkt {};

struct sockaddr_ll {};

/* Packet types */

#define PACKET_HOST
#define PACKET_BROADCAST
#define PACKET_MULTICAST
#define PACKET_OTHERHOST
#define PACKET_OUTGOING
#define PACKET_LOOPBACK
#define PACKET_USER
#define PACKET_KERNEL
/* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */
#define PACKET_FASTROUTE

/* Packet socket options */

#define PACKET_ADD_MEMBERSHIP
#define PACKET_DROP_MEMBERSHIP
#define PACKET_RECV_OUTPUT
/* Value 4 is still used by obsolete turbo-packet. */
#define PACKET_RX_RING
#define PACKET_STATISTICS
#define PACKET_COPY_THRESH
#define PACKET_AUXDATA
#define PACKET_ORIGDEV
#define PACKET_VERSION
#define PACKET_HDRLEN
#define PACKET_RESERVE
#define PACKET_TX_RING
#define PACKET_LOSS
#define PACKET_VNET_HDR
#define PACKET_TX_TIMESTAMP
#define PACKET_TIMESTAMP
#define PACKET_FANOUT
#define PACKET_TX_HAS_OFF
#define PACKET_QDISC_BYPASS
#define PACKET_ROLLOVER_STATS
#define PACKET_FANOUT_DATA
#define PACKET_IGNORE_OUTGOING
#define PACKET_VNET_HDR_SZ

#define PACKET_FANOUT_HASH
#define PACKET_FANOUT_LB
#define PACKET_FANOUT_CPU
#define PACKET_FANOUT_ROLLOVER
#define PACKET_FANOUT_RND
#define PACKET_FANOUT_QM
#define PACKET_FANOUT_CBPF
#define PACKET_FANOUT_EBPF
#define PACKET_FANOUT_FLAG_ROLLOVER
#define PACKET_FANOUT_FLAG_UNIQUEID
#define PACKET_FANOUT_FLAG_IGNORE_OUTGOING
#define PACKET_FANOUT_FLAG_DEFRAG

struct tpacket_stats {};

struct tpacket_stats_v3 {};

struct tpacket_rollover_stats {};

tpacket_stats_u;

struct tpacket_auxdata {};

/* Rx ring - header status */
#define TP_STATUS_KERNEL
#define TP_STATUS_USER
#define TP_STATUS_COPY
#define TP_STATUS_LOSING
#define TP_STATUS_CSUMNOTREADY
#define TP_STATUS_VLAN_VALID
#define TP_STATUS_BLK_TMO
#define TP_STATUS_VLAN_TPID_VALID
#define TP_STATUS_CSUM_VALID
#define TP_STATUS_GSO_TCP

/* Tx ring - header status */
#define TP_STATUS_AVAILABLE
#define TP_STATUS_SEND_REQUEST
#define TP_STATUS_SENDING
#define TP_STATUS_WRONG_FORMAT

/* Rx and Tx ring - header status */
#define TP_STATUS_TS_SOFTWARE
#define TP_STATUS_TS_SYS_HARDWARE
#define TP_STATUS_TS_RAW_HARDWARE

/* Rx ring - feature request bits */
#define TP_FT_REQ_FILL_RXHASH

struct tpacket_hdr {};

#define TPACKET_ALIGNMENT
#define TPACKET_ALIGN(x)
#define TPACKET_HDRLEN

struct tpacket2_hdr {};

struct tpacket_hdr_variant1 {};

struct tpacket3_hdr {};

struct tpacket_bd_ts {};

struct tpacket_hdr_v1 {};

tpacket_bd_header_u;

struct tpacket_block_desc {};

#define TPACKET2_HDRLEN
#define TPACKET3_HDRLEN

enum tpacket_versions {};

/*
   Frame structure:

   - Start. Frame must be aligned to TPACKET_ALIGNMENT=16
   - struct tpacket_hdr
   - pad to TPACKET_ALIGNMENT=16
   - struct sockaddr_ll
   - Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16
   - Start+tp_mac: [ Optional MAC header ]
   - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16.
   - Pad to align to TPACKET_ALIGNMENT=16
 */

struct tpacket_req {};

struct tpacket_req3 {};

tpacket_req_u;

struct packet_mreq {};

struct fanout_args {};

#define PACKET_MR_MULTICAST
#define PACKET_MR_PROMISC
#define PACKET_MR_ALLMULTI
#define PACKET_MR_UNICAST

#endif