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
e1000crate (legacy 8254x family). - e1000e_
drv - Kernel adapter for the
e1000crate (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Β§
- NetDevice
Entry π
EnumsΒ§
ConstantsΒ§
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_handlerto callhandle_interrupt(). Set viaset_nic_device()after PCI probe. - NIC_
IRQ_ LINE - IRQ line of the first registered NIC. Written once by the NIC driverβs
init(); read bynic_handlerin the IDT to send EOI. - PREFIX_
COUNTERS π - Counters per-prefix so that
em0,em1,vtnet0are 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Β§
- Network
Device - 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βshandle_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.