Struct virtio_queue::QueueState
source · [−]pub struct QueueState {
pub max_size: u16,
pub next_avail: Wrapping<u16>,
pub next_used: Wrapping<u16>,
pub event_idx_enabled: bool,
pub signalled_used: Option<Wrapping<u16>>,
pub size: u16,
pub ready: bool,
pub desc_table: GuestAddress,
pub avail_ring: GuestAddress,
pub used_ring: GuestAddress,
}
Expand description
Struct to maintain information and manipulate state of a virtio queue.
Fields
max_size: u16
The maximum size in elements offered by the device.
next_avail: Wrapping<u16>
Tail position of the available ring.
next_used: Wrapping<u16>
Head position of the used ring.
event_idx_enabled: bool
VIRTIO_F_RING_EVENT_IDX negotiated.
signalled_used: Option<Wrapping<u16>>
The last used value when using VIRTIO_F_EVENT_IDX.
size: u16
The queue size in elements the driver selected.
ready: bool
Indicates if the queue is finished with configuration.
desc_table: GuestAddress
Guest physical address of the descriptor table.
avail_ring: GuestAddress
Guest physical address of the available ring.
used_ring: GuestAddress
Guest physical address of the used ring.
Implementations
sourceimpl QueueState
impl QueueState
Trait Implementations
sourceimpl Clone for QueueState
impl Clone for QueueState
sourcefn clone(&self) -> QueueState
fn clone(&self) -> QueueState
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for QueueState
impl Debug for QueueState
sourceimpl<'a> QueueStateGuard<'a> for QueueState
impl<'a> QueueStateGuard<'a> for QueueState
sourceimpl QueueStateT for QueueState
impl QueueStateT for QueueState
sourcefn new(max_size: u16) -> Self
fn new(max_size: u16) -> Self
Construct an empty virtio queue state object with the given max_size
.
sourcefn is_valid<M: GuestMemory>(&self, mem: &M) -> bool
fn is_valid<M: GuestMemory>(&self, mem: &M) -> bool
Check whether the queue configuration is valid.
sourcefn lock(&mut self) -> <Self as QueueStateGuard<'_>>::G
fn lock(&mut self) -> <Self as QueueStateGuard<'_>>::G
Get an exclusive reference to the underlying QueueState
object. Read more
sourcefn set_desc_table_address(&mut self, low: Option<u32>, high: Option<u32>)
fn set_desc_table_address(&mut self, low: Option<u32>, high: Option<u32>)
Set the descriptor table address for the queue. Read more
sourcefn set_avail_ring_address(&mut self, low: Option<u32>, high: Option<u32>)
fn set_avail_ring_address(&mut self, low: Option<u32>, high: Option<u32>)
Set the available ring address for the queue. Read more
sourcefn set_used_ring_address(&mut self, low: Option<u32>, high: Option<u32>)
fn set_used_ring_address(&mut self, low: Option<u32>, high: Option<u32>)
Set the used ring address for the queue. Read more
sourcefn set_event_idx(&mut self, enabled: bool)
fn set_event_idx(&mut self, enabled: bool)
Enable/disable the VIRTIO_F_RING_EVENT_IDX feature for interrupt coalescing.
sourcefn avail_idx<M: GuestMemory>(
&self,
mem: &M,
order: Ordering
) -> Result<Wrapping<u16>, Error>
fn avail_idx<M: GuestMemory>(
&self,
mem: &M,
order: Ordering
) -> Result<Wrapping<u16>, Error>
Read the idx
field from the available ring.
sourcefn used_idx<M: GuestMemory>(
&self,
mem: &M,
order: Ordering
) -> Result<Wrapping<u16>, Error>
fn used_idx<M: GuestMemory>(
&self,
mem: &M,
order: Ordering
) -> Result<Wrapping<u16>, Error>
Read the idx
field from the used ring.
sourcefn add_used<M: GuestMemory>(
&mut self,
mem: &M,
head_index: u16,
len: u32
) -> Result<(), Error>
fn add_used<M: GuestMemory>(
&mut self,
mem: &M,
head_index: u16,
len: u32
) -> Result<(), Error>
Put a used descriptor head into the used ring.
sourcefn enable_notification<M: GuestMemory>(
&mut self,
mem: &M
) -> Result<bool, Error>
fn enable_notification<M: GuestMemory>(
&mut self,
mem: &M
) -> Result<bool, Error>
Enable notification events from the guest driver. Read more
sourcefn disable_notification<M: GuestMemory>(&mut self, mem: &M) -> Result<(), Error>
fn disable_notification<M: GuestMemory>(&mut self, mem: &M) -> Result<(), Error>
Disable notification events from the guest driver.
sourcefn needs_notification<M: GuestMemory>(&mut self, mem: &M) -> Result<bool, Error>
fn needs_notification<M: GuestMemory>(&mut self, mem: &M) -> Result<bool, Error>
Check whether a notification to the guest is needed. Read more
sourcefn next_avail(&self) -> u16
fn next_avail(&self) -> u16
Return the index of the next entry in the available ring.
sourcefn set_next_avail(&mut self, next_avail: u16)
fn set_next_avail(&mut self, next_avail: u16)
Set the index of the next entry in the available ring.
sourcefn set_next_used(&mut self, next_used: u16)
fn set_next_used(&mut self, next_used: u16)
Set the index for the next descriptor in the used ring.
sourcefn lock_with_memory<M>(
&mut self,
mem: M
) -> QueueGuard<M, <Self as QueueStateGuard<'_>>::G> where
M: Deref + Clone,
M::Target: GuestMemory + Sized,
fn lock_with_memory<M>(
&mut self,
mem: M
) -> QueueGuard<M, <Self as QueueStateGuard<'_>>::G> where
M: Deref + Clone,
M::Target: GuestMemory + Sized,
Get an exclusive reference to the underlying QueueState
object with an associated
GuestMemory
object. Read more
Auto Trait Implementations
impl RefUnwindSafe for QueueState
impl Send for QueueState
impl Sync for QueueState
impl Unpin for QueueState
impl UnwindSafe for QueueState
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more