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: boolWhether this queue has already been activated.
max_size: u16The maximal size in elements offered by the device
size: u16The 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: boolIndicates if the queue is finished with configuration
vector: u16MSI-X vector for the queue. Don’t care for INTx
features: u64Ring features (e.g. VIRTIO_RING_F_EVENT_IDX, VIRTIO_F_RING_PACKED) offered by the
device
acked_features: u64§desc_table: GuestAddressGuest physical address of the descriptor table
avail_ring: GuestAddressGuest physical address of the available ring (driver area)
TODO(b/290657008): update field and accessor names to match the current virtio spec
used_ring: GuestAddressGuest 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
impl QueueConfig
Sourcepub fn new(max_size: u16, features: u64) -> Self
pub fn new(max_size: u16, features: u64) -> Self
Constructs a virtio queue configuration with the given max_size.
Sourcepub fn set_vector(&mut self, val: u16)
pub fn set_vector(&mut self, val: u16)
Sets the interrupt vector for this queue.
Sourcepub fn desc_table(&self) -> GuestAddress
pub fn desc_table(&self) -> GuestAddress
Getter for descriptor area
Sourcepub fn set_desc_table(&mut self, val: GuestAddress)
pub fn set_desc_table(&mut self, val: GuestAddress)
Setter for descriptor area
Sourcepub fn avail_ring(&self) -> GuestAddress
pub fn avail_ring(&self) -> GuestAddress
Getter for driver area
Sourcepub fn set_avail_ring(&mut self, val: GuestAddress)
pub fn set_avail_ring(&mut self, val: GuestAddress)
Setter for driver area
Sourcepub fn used_ring(&self) -> GuestAddress
pub fn used_ring(&self) -> GuestAddress
Getter for device area
Sourcepub fn set_used_ring(&mut self, val: GuestAddress)
pub fn set_used_ring(&mut self, val: GuestAddress)
Setter for device area
Sourcepub fn next_avail(&self) -> Wrapping<u16>
pub fn next_avail(&self) -> Wrapping<u16>
Getter for next_avail index
Sourcepub fn set_next_avail(&mut self, val: Wrapping<u16>)
pub fn set_next_avail(&mut self, val: Wrapping<u16>)
Setter for next_avail index
Sourcepub fn set_next_used(&mut self, val: Wrapping<u16>)
pub fn set_next_used(&mut self, val: Wrapping<u16>)
Setter for next_used index
Sourcepub fn acked_features(&self) -> u64
pub fn acked_features(&self) -> u64
Returns the features that have been acknowledged by the driver.
Sourcepub fn ack_features(&mut self, features: u64)
pub fn ack_features(&mut self, features: u64)
Acknowledges that this set of features should be enabled on this queue.
Sourcepub fn set_ready(&mut self, enable: bool)
pub fn set_ready(&mut self, enable: bool)
Signal that the driver has completed queue configuration.
Sourcepub fn activate(
&mut self,
mem: &GuestMemory,
event: Event,
interrupt: Interrupt,
) -> Result<Queue>
pub fn activate( &mut self, mem: &GuestMemory, event: Event, interrupt: Interrupt, ) -> Result<Queue>
Convert the queue configuration into an active queue.
Sourcepub fn snapshot(&self) -> Result<AnySnapshot>
pub fn snapshot(&self) -> Result<AnySnapshot>
Take snapshot of queue configuration
Sourcepub fn restore(&mut self, data: AnySnapshot) -> Result<()>
pub fn restore(&mut self, data: AnySnapshot) -> Result<()>
Restore queue configuration from snapshot