include/uapi/linux/virtio_net.h
Source file repositories/reference/linux-study-clean/include/uapi/linux/virtio_net.h
File Facts
- System
- Linux kernel
- Corpus path
include/uapi/linux/virtio_net.h- Extension
.h- Size
- 20262 bytes
- Lines
- 600
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/virtio_ids.hlinux/virtio_config.hlinux/virtio_types.hlinux/if_ether.h
Detected Declarations
struct virtio_net_configstruct virtio_net_hdr_v1struct virtio_net_hdr_v1_hashstruct virtio_net_hdr_v1_hash_tunnelstruct virtio_net_hdrstruct virtio_net_hdr_mrg_rxbufstruct virtio_net_ctrl_hdrstruct virtio_net_ctrl_macstruct virtio_net_ctrl_mqstruct virtio_net_rss_configstruct virtio_net_rss_config_hdrstruct virtio_net_rss_config_trailerstruct virtio_net_hash_configstruct virtio_net_ctrl_coal_txstruct virtio_net_ctrl_coal_rxstruct virtio_net_ctrl_coalstruct virtio_net_ctrl_coal_vqstruct virtio_net_stats_capabilitiesstruct virtio_net_ctrl_queue_statsstruct virtio_net_stats_reply_hdrstruct virtio_net_stats_cvqstruct virtio_net_stats_rx_basicstruct virtio_net_stats_tx_basicstruct virtio_net_stats_rx_csumstruct virtio_net_stats_tx_csumstruct virtio_net_stats_rx_gsostruct virtio_net_stats_tx_gsostruct virtio_net_stats_rx_speedstruct virtio_net_stats_tx_speed
Annotated Snippet
struct virtio_net_config {
/* The config defining mac address (if VIRTIO_NET_F_MAC) */
__u8 mac[ETH_ALEN];
/* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */
__virtio16 status;
/* Maximum number of each of transmit and receive queues;
* see VIRTIO_NET_F_MQ and VIRTIO_NET_CTRL_MQ.
* Legal values are between 1 and 0x8000
*/
__virtio16 max_virtqueue_pairs;
/* Default maximum transmit unit advice */
__virtio16 mtu;
/*
* speed, in units of 1Mb. All values 0 to INT_MAX are legal.
* Any other value stands for unknown.
*/
__le32 speed;
/*
* 0x00 - half duplex
* 0x01 - full duplex
* Any other value stands for unknown.
*/
__u8 duplex;
/* maximum size of RSS key */
__u8 rss_max_key_size;
/* maximum number of indirection table entries */
__le16 rss_max_indirection_table_length;
/* bitmask of supported VIRTIO_NET_RSS_HASH_ types */
__le32 supported_hash_types;
} __attribute__((packed));
/*
* This header comes first in the scatter-gather list. If you don't
* specify GSO or CSUM features, you can simply ignore the header.
*
* This is bitwise-equivalent to the legacy struct virtio_net_hdr_mrg_rxbuf,
* only flattened.
*/
struct virtio_net_hdr_v1 {
#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset */
#define VIRTIO_NET_HDR_F_DATA_VALID 2 /* Csum is valid */
#define VIRTIO_NET_HDR_F_RSC_INFO 4 /* rsc info in csum_ fields */
#define VIRTIO_NET_HDR_F_UDP_TUNNEL_CSUM 8 /* UDP tunnel csum offload */
__u8 flags;
#define VIRTIO_NET_HDR_GSO_NONE 0 /* Not a GSO frame */
#define VIRTIO_NET_HDR_GSO_TCPV4 1 /* GSO frame, IPv4 TCP (TSO) */
#define VIRTIO_NET_HDR_GSO_UDP 3 /* GSO frame, IPv4 UDP (UFO) */
#define VIRTIO_NET_HDR_GSO_TCPV6 4 /* GSO frame, IPv6 TCP */
#define VIRTIO_NET_HDR_GSO_UDP_L4 5 /* GSO frame, IPv4& IPv6 UDP (USO) */
#define VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV4 0x20 /* UDPv4 tunnel present */
#define VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV6 0x40 /* UDPv6 tunnel present */
#define VIRTIO_NET_HDR_GSO_UDP_TUNNEL (VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV4 | \
VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV6)
#define VIRTIO_NET_HDR_GSO_ECN 0x80 /* TCP has ECN set */
__u8 gso_type;
__virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
__virtio16 gso_size; /* Bytes to append to hdr_len per frame */
union {
struct {
__virtio16 csum_start;
__virtio16 csum_offset;
};
/* Checksum calculation */
struct {
/* Position to start checksumming from */
__virtio16 start;
/* Offset after that to place checksum */
__virtio16 offset;
} csum;
/* Receive Segment Coalescing */
struct {
/* Number of coalesced segments */
__le16 segments;
/* Number of duplicated acks */
__le16 dup_acks;
} rsc;
};
__virtio16 num_buffers; /* Number of merged rx buffers */
};
struct virtio_net_hdr_v1_hash {
struct virtio_net_hdr_v1 hdr;
__le16 hash_value_lo;
__le16 hash_value_hi;
#define VIRTIO_NET_HASH_REPORT_NONE 0
#define VIRTIO_NET_HASH_REPORT_IPv4 1
#define VIRTIO_NET_HASH_REPORT_TCPv4 2
#define VIRTIO_NET_HASH_REPORT_UDPv4 3
#define VIRTIO_NET_HASH_REPORT_IPv6 4
#define VIRTIO_NET_HASH_REPORT_TCPv6 5
Annotation
- Immediate include surface: `linux/types.h`, `linux/virtio_ids.h`, `linux/virtio_config.h`, `linux/virtio_types.h`, `linux/if_ether.h`.
- Detected declarations: `struct virtio_net_config`, `struct virtio_net_hdr_v1`, `struct virtio_net_hdr_v1_hash`, `struct virtio_net_hdr_v1_hash_tunnel`, `struct virtio_net_hdr`, `struct virtio_net_hdr_mrg_rxbuf`, `struct virtio_net_ctrl_hdr`, `struct virtio_net_ctrl_mac`, `struct virtio_net_ctrl_mq`, `struct virtio_net_rss_config`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.