Struct devices::virtio::QueueConfig
source · 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
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.
Auto Trait Implementations§
impl RefUnwindSafe for QueueConfig
impl Send for QueueConfig
impl Sync for QueueConfig
impl Unpin for QueueConfig
impl UnwindSafe for QueueConfig
Blanket Implementations§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.