pub trait NetworkDevice: Send + Sync {
Show 16 methods
// Required methods
fn name(&self) -> &str;
fn receive(&self, buf: &mut [u8]) -> Result<usize, NetError>;
fn transmit(&self, buf: &[u8]) -> Result<(), NetError>;
fn mac_address(&self) -> [u8; 6];
fn link_up(&self) -> bool;
// Provided methods
fn handle_interrupt(&self) { ... }
fn media(&self) -> NetMedia { ... }
fn poll(&self) { ... }
fn features(&self) -> u64 { ... }
fn mtu(&self) -> usize { ... }
fn queue_count(&self) -> u16 { ... }
fn link_speed_mbps(&self) -> u32 { ... }
fn epoch(&self) -> u32 { ... }
fn quiesce(&self) -> Result<(), NetError> { ... }
fn resume(&self) -> Result<(), NetError> { ... }
fn reset(&self) -> Result<(), NetError> { ... }
}Expand description
Unified network device interface.
Kernel-resident drivers wrap their hardware-specific struct in a
SpinLock and implement this trait with interior mutability.
Future silo-hosted drivers expose the same interface via IPC.
Required Methods§
fn name(&self) -> &str
fn receive(&self, buf: &mut [u8]) -> Result<usize, NetError>
fn transmit(&self, buf: &[u8]) -> Result<(), NetError>
fn mac_address(&self) -> [u8; 6]
fn link_up(&self) -> bool
Provided Methods§
fn handle_interrupt(&self)
Sourcefn poll(&self)
fn poll(&self)
Periodic housekeeping called from the timer path (or interrupt context). Default is a no-op; drivers that need a watchdog or buffer-reclamation cycle override this.
Sourcefn features(&self) -> u64
fn features(&self) -> u64
Negotiated strat9_abi::net::features::* mask.
Drivers return only the features they actually implement; the stack must never assume an offload is available. Default is 0 (software fallback for everything).
Sourcefn queue_count(&self) -> u16
fn queue_count(&self) -> u16
Number of hardware queues exposed by the device.
Sourcefn link_speed_mbps(&self) -> u32
fn link_speed_mbps(&self) -> u32
Current link speed in Mbps, or 0 when unknown.
Sourcefn epoch(&self) -> u32
fn epoch(&self) -> u32
Device generation. Bumped after reset/hotplug; consumers must reject operations carrying a stale epoch.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".