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.
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.