Skip to main content

Module virtio_net

Module virtio_net 

Source
Expand description

VirtIO Network Device driver

Provides network I/O via VirtIO-net protocol for QEMU/KVM environments. Implements the common crate::hardware::nic::NetworkDevice trait so this driver plugs into the unified /dev/net/ scheme.

Reference: VirtIO spec v1.2, Section 5.1 (Network Device) https://docs.oasis-open.org/virtio/virtio/v1.4/cs01/virtio-v1.4-cs01.html#x1-2700001

Modulesยง

features
VirtIO net device features
net_status
VirtIO net status flags

Structsยง

VirtioNetDevice
VirtIO Network Device driver
VirtioNetHeader
VirtIO net header (prepended to every packet)

Constantsยง

RX_FRAME_TRACK_CAPACITY ๐Ÿ”’
TX_FRAME_TRACK_CAPACITY ๐Ÿ”’

Staticsยง

NET_HDR_SIZE ๐Ÿ”’
VirtIO net header size (12 bytes with MRG_RXBUF, 10 bytes without). Determined at runtime during feature negotiation.
VIRTIO_NET ๐Ÿ”’
Global VirtIO network device

Functionsยง

get_device
Get the VirtIO network device instance (if present).
init
Initialize VirtIO network device and register it in the global net registry.
read_plausible_mac ๐Ÿ”’
Read 6 bytes at offset in the device-config window and accept them only if they look like a unicast MAC (not an all-ones/all-zeros unmapped read).