Skip to main content

Module nic

Module nic 

Source
Expand description

Network driver integration layer.

Thin kernel glue that wires external crates (net-core, e1000, …) to kernel services (PCI, DMA allocator, VFS schemes).

ModulesΒ§

common
Shared utilities for Intel E1000-family NIC drivers.
data_plane
NIC data-plane using lock-free SPSC rings (N2).
e1000_drv
Kernel adapter for the e1000 crate (legacy 8254x family).
e1000e_drv
Kernel adapter for the e1000 crate (e1000e / I217-I219 family).
igc_drv
pcnet_drv
rtl8139_drv
scheme
Network VFS scheme – mounts at /dev/net/.
virtio_net
VirtIO Network Device driver

StructsΒ§

NetDeviceEntry πŸ”’

EnumsΒ§

NetError

ConstantsΒ§

MTU

StaticsΒ§

NET_DEVICES πŸ”’
NIC_DATA_PLANE πŸ”’
Global NIC data plane, lazily initialised after NIC detection.
NIC_DEVICE πŸ”’
Global reference to the first NIC device, used by nic_handler to call handle_interrupt(). Set via set_nic_device() after PCI probe.
NIC_IRQ_LINE
IRQ line of the first registered NIC. Written once by the NIC driver’s init(); read by nic_handler in the IDT to send EOI.
PREFIX_COUNTERS πŸ”’
Counters per-prefix so that em0, em1, vtnet0 are independent.
STRATE_NET_TID πŸ”’
Cached task ID of the strate-net process, registered from the boot sequence after strate-net is spawned. Zero = not yet known; the NIC handler will skip the wakeup and rely on strate-net’s periodic polling.

TraitsΒ§

NetworkDevice
Unified network device interface.

FunctionsΒ§

bsd_prefix πŸ”’
Map a driver name to a FreeBSD-style interface prefix.
data_plane
Access the global N2 data plane (returns None if not yet initialised).
get_default_device
Returns default device.
get_device
Returns device.
handle_interrupt
Called from idt.rs:nic_handler. Dispatches to the registered NIC’s handle_interrupt() (reads ICR, coalescing, TX reclaim). If the N2 data plane is active, drains received packets into the RX ring before waking strate-net (zero-syscall data path).
init
Performs the init operation.
init_data_plane πŸ”’
Initialise the N2 data plane with one ring pair per registered device. Each device gets a single RX/TX pair (RSS queues extend this).
list_interfaces
Performs the list interfaces operation.
next_index_for πŸ”’
Performs the next index for operation.
nic_irq_ready
True when a NIC IRQ handler is registered (N2 rings will be drained).
poll_all
Call poll() on every registered NIC (watchdog + link check). Safe from deferred-work / idle / syscall-return contexts only β€” not from the hardirq swapgs window.
register_device
Performs the register device operation.
register_strate_net_tid
Register the strate-net task ID so the NIC IRQ handler can wake it.
service_data_plane_polling πŸ”’
Drain RX HW β†’ N2 and N2 TX β†’ HW without relying on a NIC IRQ.
set_nic_device
Store a NIC device reference and its IRQ line for the IDT handler.
try_register_strate_net
Try to discover strate-net and cache its task ID.