pub trait QueueStateT: for<'a> QueueStateGuard<'a> {
Show 23 methods fn new(max_size: u16) -> Self;
fn is_valid<M: GuestMemory>(&self, mem: &M) -> bool;
fn reset(&mut self);
fn lock(&mut self) -> <Self as QueueStateGuard<'_>>::G;
fn max_size(&self) -> u16;
fn set_size(&mut self, size: u16);
fn ready(&self) -> bool;
fn set_ready(&mut self, ready: bool);
fn set_desc_table_address(&mut self, low: Option<u32>, high: Option<u32>);
fn set_avail_ring_address(&mut self, low: Option<u32>, high: Option<u32>);
fn set_used_ring_address(&mut self, low: Option<u32>, high: Option<u32>);
fn set_event_idx(&mut self, enabled: bool);
fn avail_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>;
fn add_used<M: GuestMemory>(
        &mut self,
        mem: &M,
        head_index: u16,
        len: u32
    ) -> Result<(), Error>;
fn enable_notification<M: GuestMemory>(
        &mut self,
        mem: &M
    ) -> Result<bool, Error>;
fn disable_notification<M: GuestMemory>(
        &mut self,
        mem: &M
    ) -> Result<(), Error>;
fn needs_notification<M: GuestMemory>(
        &mut self,
        mem: &M
    ) -> Result<bool, Error>;
fn next_avail(&self) -> u16;
fn set_next_avail(&mut self, next_avail: u16);
fn next_used(&self) -> u16;
fn set_next_used(&mut self, next_used: u16); fn lock_with_memory<M>(
        &mut self,
        mem: M
    ) -> QueueGuard<M, <Self as QueueStateGuard<'_>>::G>
    where
        M: Deref + Clone,
        M::Target: GuestMemory + Sized
, { ... }
}
Expand description

Trait to access and manipulate a virtio queue.

To optimize for performance, different implementations of the QueueStateT trait may be provided for single-threaded context and multi-threaded context.

Using Higher-Rank Trait Bounds (HRTBs) to effectively define an associated type that has a lifetime parameter, without tagging the QueueStateT trait with a lifetime as well.

Required methods

Construct an empty virtio queue state object with the given max_size.

Check whether the queue configuration is valid.

Reset the queue to the initial state.

Get an exclusive reference to the underlying QueueState object.

Logically this method will acquire the underlying lock protecting the QueueState Object. The lock will be released when the returned object gets dropped.

Get the maximum size of the virtio queue.

Configure the queue size for the virtio queue.

Check whether the queue is ready to be processed.

Configure the queue to ready for processing state.

Set the descriptor table address for the queue.

The descriptor table address is 64-bit, the corresponding part will be updated if ‘low’ and/or high is Some and valid.

Set the available ring address for the queue.

The available ring address is 64-bit, the corresponding part will be updated if ‘low’ and/or high is Some and valid.

Set the used ring address for the queue.

The used ring address is 64-bit, the corresponding part will be updated if ‘low’ and/or high is Some and valid.

Enable/disable the VIRTIO_F_RING_EVENT_IDX feature for interrupt coalescing.

Read the idx field from the available ring.

Read the idx field from the used ring.

Put a used descriptor head into the used ring.

Enable notification events from the guest driver.

Return true if one or more descriptors can be consumed from the available ring after notifications were enabled (and thus it’s possible there will be no corresponding notification).

Disable notification events from the guest driver.

Check whether a notification to the guest is needed.

Please note this method has side effects: once it returns true, it considers the driver will actually be notified, remember the associated index in the used ring, and won’t return true again until the driver updates used_event and/or the notification conditions hold once more.

Return the index of the next entry in the available ring.

Set the index of the next entry in the available ring.

Return the index for the next descriptor in the used ring.

Set the index for the next descriptor in the used ring.

Provided methods

Get an exclusive reference to the underlying QueueState object with an associated GuestMemory object.

Logically this method will acquire the underlying lock protecting the QueueState Object. The lock will be released when the returned object gets dropped.

Implementors