pub struct Net<T> {
descriptor: File,
phantom: PhantomData<T>,
}
Expand description
Handle to run VHOST_NET ioctls.
This provides a simple wrapper around a VHOST_NET file descriptor and methods that safely run ioctls on that file descriptor.
Fields§
§descriptor: File
§phantom: PhantomData<T>
Trait Implementations§
source§impl<T> AsRawDescriptor for Net<T>
impl<T> AsRawDescriptor for Net<T>
source§fn as_raw_descriptor(&self) -> RawDescriptor
fn as_raw_descriptor(&self) -> RawDescriptor
Returns the underlying raw descriptor. Read more
source§impl<T> NetT<T> for Net<T>where
T: TapT,
impl<T> NetT<T> for Net<T>where
T: TapT,
source§impl<T> Vhost for Net<T>
impl<T> Vhost for Net<T>
source§fn set_owner(&self) -> Result<()>
fn set_owner(&self) -> Result<()>
Set the current process as the owner of this file descriptor.
This must be run before any other vhost ioctls.
source§fn reset_owner(&self) -> Result<()>
fn reset_owner(&self) -> Result<()>
Give up ownership and reset the device to default values. Allows a subsequent call to
set_owner
to succeed.source§fn get_features(&self) -> Result<u64>
fn get_features(&self) -> Result<u64>
Get a bitmask of supported virtio/vhost features.
source§fn set_features(&self, features: u64) -> Result<()>
fn set_features(&self, features: u64) -> Result<()>
Inform the vhost subsystem which features to enable. This should be a subset of
supported features from VHOST_GET_FEATURES. Read more
source§fn set_mem_table(&self, mem: &GuestMemory) -> Result<()>
fn set_mem_table(&self, mem: &GuestMemory) -> Result<()>
Set the guest memory mappings for vhost to use.
source§fn set_vring_num(&self, queue_index: usize, num: u16) -> Result<()>
fn set_vring_num(&self, queue_index: usize, num: u16) -> Result<()>
Set the number of descriptors in the vring. Read more
source§fn set_vring_addr(
&self,
mem: &GuestMemory,
queue_max_size: u16,
queue_size: u16,
queue_index: usize,
flags: u32,
desc_addr: GuestAddress,
used_addr: GuestAddress,
avail_addr: GuestAddress,
log_addr: Option<GuestAddress>
) -> Result<()>
fn set_vring_addr( &self, mem: &GuestMemory, queue_max_size: u16, queue_size: u16, queue_index: usize, flags: u32, desc_addr: GuestAddress, used_addr: GuestAddress, avail_addr: GuestAddress, log_addr: Option<GuestAddress> ) -> Result<()>
Set the addresses for a given vring. Read more
source§fn set_vring_base(&self, queue_index: usize, num: u16) -> Result<()>
fn set_vring_base(&self, queue_index: usize, num: u16) -> Result<()>
Set the first index to look for available descriptors. Read more
source§fn get_vring_base(&self, queue_index: usize) -> Result<u16>
fn get_vring_base(&self, queue_index: usize) -> Result<u16>
Gets the index of the next available descriptor in the queue. Read more
source§fn set_vring_call(&self, queue_index: usize, event: &Event) -> Result<()>
fn set_vring_call(&self, queue_index: usize, event: &Event) -> Result<()>
Set the event to trigger when buffers have been used by the host. Read more
Auto Trait Implementations§
impl<T> RefUnwindSafe for Net<T>where
T: RefUnwindSafe,
impl<T> Send for Net<T>where
T: Send,
impl<T> Sync for Net<T>where
T: Sync,
impl<T> Unpin for Net<T>where
T: Unpin,
impl<T> UnwindSafe for Net<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
§fn as_raw_descriptors(&self) -> Vec<i32>
fn as_raw_descriptors(&self) -> Vec<i32>
Returns the underlying raw descriptors. Read more
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