Expand description
§VirtIO Network Device Driver
This module provides a driver for VirtIO network devices, implementing the NetworkDevice trait for integration with the kernel’s network subsystem.
The driver supports basic network operations (packet transmission and reception) and handles the VirtIO queue management for network device requests.
§VirtIO Network Device Features
The driver checks for and handles the following VirtIO network device features:
- Basic packet transmission and reception
- MAC address configuration
- MTU management
- Link status detection
§Implementation Details
The driver uses two virtqueues:
- Receive queue (index 0): For receiving packets from the network
- Transmit queue (index 1): For sending packets to the network
Each network packet is handled through the VirtIO descriptor chain mechanism, with proper memory management for packet buffers.
Structs§
- Virtio
NetConfig - VirtIO Network Device Configuration
- Virtio
NetDevice - VirtIO Network Device
- Virtio
NetHdr - VirtIO Network Header (for packet transmission/reception)
- Virtio
NetHdr Basic - Basic VirtIO Network Header (without num_buffers field)
Constants§
- DEFAULT_
MTU 🔒 - VIRTIO_
NET_ 🔒F_ CSUM - VIRTIO_
NET_ 🔒F_ CTRL_ GUEST_ OFFLOADS - VIRTIO_
NET_ 🔒F_ CTRL_ MAC_ ADDR - VIRTIO_
NET_ 🔒F_ CTRL_ RX - VIRTIO_
NET_ 🔒F_ CTRL_ VLAN - VIRTIO_
NET_ 🔒F_ CTRL_ VQ - VIRTIO_
NET_ 🔒F_ GUEST_ ANNOUNCE - VIRTIO_
NET_ 🔒F_ GUEST_ CSUM - VIRTIO_
NET_ 🔒F_ GUEST_ ECN - VIRTIO_
NET_ 🔒F_ GUEST_ TSO4 - VIRTIO_
NET_ 🔒F_ GUEST_ TSO6 - VIRTIO_
NET_ 🔒F_ GUEST_ UFO - VIRTIO_
NET_ 🔒F_ HOST_ ECN - VIRTIO_
NET_ 🔒F_ HOST_ TSO4 - VIRTIO_
NET_ 🔒F_ HOST_ TSO6 - VIRTIO_
NET_ 🔒F_ HOST_ UFO - VIRTIO_
NET_ 🔒F_ MAC - VIRTIO_
NET_ 🔒F_ MQ - VIRTIO_
NET_ 🔒F_ MRG_ RXBUF - VIRTIO_
NET_ 🔒F_ MTU - VIRTIO_
NET_ 🔒F_ STATUS - VIRTIO_
NET_ 🔒S_ ANNOUNCE - VIRTIO_
NET_ 🔒S_ LINK_ UP