pub struct QueueConfig {
    activated: bool,
    max_size: u16,
    size: u16,
    ready: bool,
    vector: u16,
    features: u64,
    acked_features: u64,
    desc_table: GuestAddress,
    avail_ring: GuestAddress,
    used_ring: GuestAddress,
    next_avail: Wrapping<u16>,
    next_used: Wrapping<u16>,
}
Expand description

A virtio queue’s parameters.

QueueConfig can be converted into a running Queue by calling QueueConfig::activate().

Fields§

§activated: bool

Whether this queue has already been activated.

§max_size: u16

The maximal size in elements offered by the device

§size: u16

The queue size in elements the driver selected. This is always guaranteed to be a power of two less than or equal to max_size, as required for split virtqueues. These invariants are enforced by set_size().

§ready: bool

Indicates if the queue is finished with configuration

§vector: u16

MSI-X vector for the queue. Don’t care for INTx

§features: u64

Ring features (e.g. VIRTIO_RING_F_EVENT_IDX, VIRTIO_F_RING_PACKED) offered by the device

§acked_features: u64§desc_table: GuestAddress

Guest physical address of the descriptor table

§avail_ring: GuestAddress

Guest physical address of the available ring (driver area)

TODO(b/290657008): update field and accessor names to match the current virtio spec

§used_ring: GuestAddress

Guest physical address of the used ring (device area)

§next_avail: Wrapping<u16>

Initial available ring index when the queue is activated.

§next_used: Wrapping<u16>

Initial used ring index when the queue is activated.

Implementations§

source§

impl QueueConfig

source

pub fn new(max_size: u16, features: u64) -> Self

Constructs a virtio queue configuration with the given max_size.

source

pub fn max_size(&self) -> u16

Returns the maximum size of this queue.

source

pub fn size(&self) -> u16

Returns the currently configured size of the queue.

source

pub fn set_size(&mut self, val: u16)

Sets the queue size.

source

pub fn vector(&self) -> u16

Returns the currently configured interrupt vector.

source

pub fn set_vector(&mut self, val: u16)

Sets the interrupt vector for this queue.

source

pub fn desc_table(&self) -> GuestAddress

Getter for descriptor area

source

pub fn set_desc_table(&mut self, val: GuestAddress)

Setter for descriptor area

source

pub fn avail_ring(&self) -> GuestAddress

Getter for driver area

source

pub fn set_avail_ring(&mut self, val: GuestAddress)

Setter for driver area

source

pub fn used_ring(&self) -> GuestAddress

Getter for device area

source

pub fn set_used_ring(&mut self, val: GuestAddress)

Setter for device area

source

pub fn next_avail(&self) -> Wrapping<u16>

Getter for next_avail index

source

pub fn set_next_avail(&mut self, val: Wrapping<u16>)

Setter for next_avail index

source

pub fn next_used(&self) -> Wrapping<u16>

Getter for next_used index

source

pub fn set_next_used(&mut self, val: Wrapping<u16>)

Setter for next_used index

source

pub fn acked_features(&self) -> u64

Returns the features that have been acknowledged by the driver.

source

pub fn ack_features(&mut self, features: u64)

Acknowledges that this set of features should be enabled on this queue.

source

pub fn ready(&self) -> bool

Return whether the driver has enabled this queue.

source

pub fn set_ready(&mut self, enable: bool)

Signal that the driver has completed queue configuration.

source

pub fn activate( &mut self, mem: &GuestMemory, event: Event, interrupt: Interrupt ) -> Result<Queue>

Convert the queue configuration into an active queue.

source

pub fn reset(&mut self)

Reset queue to a clean state

source

pub fn snapshot(&self) -> Result<Value>

Take snapshot of queue configuration

source

pub fn restore(&mut self, data: Value) -> Result<()>

Restore queue configuration from snapshot

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V