Struct devices::virtio::queue::packed_queue::PackedQueue
source · pub struct PackedQueue {
mem: GuestMemory,
event: Event,
interrupt: Interrupt,
size: u16,
vector: u16,
avail_index: PackedQueueIndex,
use_index: PackedQueueIndex,
signalled_used_index: PackedQueueIndex,
features: u64,
desc_table: GuestAddress,
device_event_suppression: GuestAddress,
driver_event_suppression: GuestAddress,
}
Fields§
§mem: GuestMemory
§event: Event
§interrupt: Interrupt
§size: u16
§vector: u16
§avail_index: PackedQueueIndex
§use_index: PackedQueueIndex
§signalled_used_index: PackedQueueIndex
§features: u64
§desc_table: GuestAddress
§device_event_suppression: GuestAddress
§driver_event_suppression: GuestAddress
Implementations§
source§impl PackedQueue
impl PackedQueue
sourcepub fn new(
config: &QueueConfig,
mem: &GuestMemory,
event: Event,
interrupt: Interrupt
) -> Result<Self>
pub fn new( config: &QueueConfig, mem: &GuestMemory, event: Event, interrupt: Interrupt ) -> Result<Self>
Constructs an empty virtio queue with the given max_size
.
pub fn vhost_user_reclaim(&mut self, _vring_base: u16)
pub fn next_avail_to_process(&self) -> u16
sourcepub fn size(&self) -> u16
pub fn size(&self) -> u16
Return the actual size of the queue, as the driver may not set up a queue as big as the device allows.
sourcepub fn desc_table(&self) -> GuestAddress
pub fn desc_table(&self) -> GuestAddress
Getter for descriptor area
sourcepub fn avail_ring(&self) -> GuestAddress
pub fn avail_ring(&self) -> GuestAddress
Getter for driver area
sourcepub fn used_ring(&self) -> GuestAddress
pub fn used_ring(&self) -> GuestAddress
Getter for device area
fn area_sizes( queue_size: u16, desc_table: GuestAddress, driver_area: GuestAddress, device_area: GuestAddress ) -> Vec<(GuestAddress, usize)>
sourcefn set_avail_event(&mut self, event: PackedDescEvent)
fn set_avail_event(&mut self, event: PackedDescEvent)
Set the device event suppression
This field is used to specify the timing of when the driver notifies the device that the descriptor table is ready to be processed.
fn get_driver_event(&self) -> PackedDescEvent
sourcepub fn peek(&mut self) -> Option<DescriptorChain>
pub fn peek(&mut self) -> Option<DescriptorChain>
Get the first available descriptor chain without removing it from the queue.
Call pop_peeked
to remove the returned descriptor chain from the queue.
sourcepub(super) fn pop_peeked(&mut self, descriptor_chain: &DescriptorChain)
pub(super) fn pop_peeked(&mut self, descriptor_chain: &DescriptorChain)
Remove the first available descriptor chain from the queue.
This function should only be called immediately following peek
and must be passed a
reference to the same DescriptorChain
returned by the most recent peek
.
sourcepub fn add_used(&mut self, desc_chain: DescriptorChain, len: u32)
pub fn add_used(&mut self, desc_chain: DescriptorChain, len: u32)
Write to first descriptor in descriptor chain to mark descriptor chain as used
sourcefn queue_wants_interrupt(&mut self) -> bool
fn queue_wants_interrupt(&mut self) -> bool
Returns if the queue should have an interrupt sent based on its state.
sourcepub fn trigger_interrupt(&mut self) -> bool
pub fn trigger_interrupt(&mut self) -> bool
inject interrupt into guest on this queue return true: interrupt is injected into guest for this queue false: interrupt isn’t injected
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 snapshot(&self) -> Result<Value>
pub fn snapshot(&self) -> Result<Value>
TODO: b/290307056 - Implement snapshot for packed virtqueue, add tests to validate.
sourcepub fn restore(
_queue_value: Value,
_mem: &GuestMemory,
_event: Event,
_interrupt: Interrupt
) -> Result<PackedQueue>
pub fn restore( _queue_value: Value, _mem: &GuestMemory, _event: Event, _interrupt: Interrupt ) -> Result<PackedQueue>
TODO: b/290307056 - Implement restore for packed virtqueue, add tests to validate.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PackedQueue
impl Send for PackedQueue
impl Sync for PackedQueue
impl Unpin for PackedQueue
impl !UnwindSafe for PackedQueue
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.