pub struct NetDevice { /* private fields */ }Expand description
virtio-net frontend.
Implementations§
Source§impl NetDevice
impl NetDevice
Sourcepub fn new(
config: NetConfig,
backend: Arc<dyn NetBackend>,
interceptor: Arc<dyn FrameInterceptor>,
) -> Self
pub fn new( config: NetConfig, backend: Arc<dyn NetBackend>, interceptor: Arc<dyn FrameInterceptor>, ) -> Self
Build a virtio-net.
Trait Implementations§
Source§impl VirtioDevice for NetDevice
impl VirtioDevice for NetDevice
Source§fn device_type(&self) -> VirtioDeviceType
fn device_type(&self) -> VirtioDeviceType
Device-type discriminant for the MMIO
DeviceID register.Source§fn avail_features(&self) -> u64
fn avail_features(&self) -> u64
Bitmap of features the device offers. The transport ANDs this with
the driver’s
acked_features and surfaces the negotiated set.Source§fn acked_features(&self) -> u64
fn acked_features(&self) -> u64
Bitmap of features the driver has acknowledged.
Source§fn set_acked_features(&mut self, value: u64)
fn set_acked_features(&mut self, value: u64)
Set the driver-acked feature set. The transport calls this once per
MMIO
DriverFeatures write; implementors typically just store the
value.Source§fn queue_max_sizes(&self) -> &[u16]
fn queue_max_sizes(&self) -> &[u16]
Per-queue maximum descriptor counts. The vector length determines how
many vrings the device exposes; the value at each index becomes
QueueNumMax for that queue.Source§fn queues_mut(&mut self) -> &mut [Queue]
fn queues_mut(&mut self) -> &mut [Queue]
Borrow the device’s queue state mutably (transport uses this when the
driver writes queue-config registers).
Source§fn read_config(&self, offset: u64, data: &mut [u8])
fn read_config(&self, offset: u64, data: &mut [u8])
Read a slice of the device’s config space at
offset.Source§fn write_config(&mut self, _offset: u64, _data: &[u8])
fn write_config(&mut self, _offset: u64, _data: &[u8])
Write a slice into the device’s config space at
offset. Per the
virtio spec § 2.4.2, drivers SHOULD not write config-space after
DRIVER_OK; the transport gates on this and silently drops post-OK
writes via crate::transport::VirtioMmioTransport::accept_config_write.Source§fn activate(
&mut self,
mem: Arc<dyn GuestMemory>,
irq: IrqLine,
) -> Result<(), ActivateError>
fn activate( &mut self, mem: Arc<dyn GuestMemory>, irq: IrqLine, ) -> Result<(), ActivateError>
Take ownership of the resources needed to drive the device live.
Called exactly once on the driver’s
DRIVER_OK transition. Read moreSource§fn is_activated(&self) -> bool
fn is_activated(&self) -> bool
true once activate has succeeded.Source§fn process_queue(&mut self, queue_index: u16)
fn process_queue(&mut self, queue_index: u16)
Handler invoked on a guest write to the MMIO
QueueNotify register. Read moreAuto Trait Implementations§
impl Freeze for NetDevice
impl !RefUnwindSafe for NetDevice
impl Send for NetDevice
impl Sync for NetDevice
impl Unpin for NetDevice
impl UnsafeUnpin for NetDevice
impl !UnwindSafe for NetDevice
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