pub struct InterfaceInfo {
pub name: String,
pub index: u32,
pub mtu: u32,
pub speed: u32,
pub driver: String,
pub num_queues: u32,
pub carrier: bool,
pub flags: u32,
}Expand description
Information about a network interface.
Useful for choosing ring buffer sizes, frame sizes, and fanout thread count.
§Examples
use netring::InterfaceInfo;
let info = netring::interface_info("lo").unwrap();
println!("MTU: {}, speed: {} Mbps, queues: {}", info.mtu, info.speed, info.num_queues);
println!("Suggested profile: {:?}", info.suggest_profile());Fields§
§name: StringInterface name.
index: u32Interface index.
mtu: u32Maximum Transmission Unit in bytes (e.g., 1500, 9000 for jumbo).
speed: u32Link speed in Mbps (0 if unknown, e.g., loopback).
driver: StringDriver name (e.g., “e1000e”, “mlx5_core”). Empty if unknown.
num_queues: u32Number of RX queues (for fanout thread count).
carrier: boolWhether the interface link is up.
flags: u32Interface flags (IFF_UP, IFF_RUNNING, etc.).
Implementations§
Source§impl InterfaceInfo
impl InterfaceInfo
Sourcepub fn suggest_profile(&self) -> RingProfile
pub fn suggest_profile(&self) -> RingProfile
Suggest a ring profile based on interface capabilities.
Uses MTU and link speed to pick the best default:
- Jumbo MTU (> 1500) →
RingProfile::JumboFrames - 10 Gbps+ →
RingProfile::HighThroughput - 1 Gbps+ →
RingProfile::Default - Slower →
RingProfile::LowMemory
Sourcepub fn suggest_fanout_threads(&self) -> usize
pub fn suggest_fanout_threads(&self) -> usize
Suggest the number of fanout threads.
Returns the number of RX queues, capped at available CPUs.
Trait Implementations§
Source§impl Clone for InterfaceInfo
impl Clone for InterfaceInfo
Source§fn clone(&self) -> InterfaceInfo
fn clone(&self) -> InterfaceInfo
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for InterfaceInfo
impl RefUnwindSafe for InterfaceInfo
impl Send for InterfaceInfo
impl Sync for InterfaceInfo
impl Unpin for InterfaceInfo
impl UnsafeUnpin for InterfaceInfo
impl UnwindSafe for InterfaceInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more