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.
- poll_
all - Call
poll()on every registered NIC (watchdog + link check). Safe to call from any non-IRQ context (allocates via get_all_tasks). - 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.
- 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.