pub struct SplitQueue {
size: u16,
desc: u64,
avail: u64,
used: u64,
last_avail: u16,
last_used: u16,
}Expand description
One split virtqueue.
All addresses are guest-physical; avail points to the available-ring
header and used to the used-ring header (the ring[] arrays follow their
headers, as defined by the virtio specification).
Fields§
§size: u16§desc: u64§avail: u64§used: u64§last_avail: u16§last_used: u16Implementations§
Source§impl SplitQueue
impl SplitQueue
Sourcepub fn new(
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Result<Self, QueueError>
pub fn new( size: u16, desc: u64, avail: u64, used: u64, ) -> Result<Self, QueueError>
Creates a queue from the three table addresses programmed by the driver.
Sourcepub fn descriptor_gpa(self, index: u16) -> Option<u64>
pub fn descriptor_gpa(self, index: u16) -> Option<u64>
Guest-physical address of descriptor index.
Sourcepub fn read_descriptor<M: QueueMemory + ?Sized>(
self,
memory: &mut M,
index: u16,
) -> Result<Descriptor, QueueError>
pub fn read_descriptor<M: QueueMemory + ?Sized>( self, memory: &mut M, index: u16, ) -> Result<Descriptor, QueueError>
Reads one descriptor.
Sourcepub fn pop_available<M: QueueMemory + ?Sized>(
&mut self,
memory: &mut M,
) -> Result<Option<u16>, QueueError>
pub fn pop_available<M: QueueMemory + ?Sized>( &mut self, memory: &mut M, ) -> Result<Option<u16>, QueueError>
Pops the next available chain head, or None when the driver has not
published anything new. The available index is advanced only when a
descriptor is actually returned.
Sourcepub fn chain<M: QueueMemory + ?Sized>(
self,
memory: &mut M,
head: u16,
) -> Result<Vec<Descriptor>, QueueError>
pub fn chain<M: QueueMemory + ?Sized>( self, memory: &mut M, head: u16, ) -> Result<Vec<Descriptor>, QueueError>
Walks the chain starting at head.
One level of indirect descriptors is supported: their table is expanded
in place and the outer NEXT flag then continues the chain.
Sourcefn expand_indirect<M: QueueMemory + ?Sized>(
self,
memory: &mut M,
indirect: Descriptor,
chain: &mut Vec<Descriptor>,
) -> Result<(), QueueError>
fn expand_indirect<M: QueueMemory + ?Sized>( self, memory: &mut M, indirect: Descriptor, chain: &mut Vec<Descriptor>, ) -> Result<(), QueueError>
Expands an indirect descriptor table into chain.
Sourcepub fn push_used<M: QueueMemory + ?Sized>(
&mut self,
memory: &mut M,
head: u16,
written: u32,
) -> Result<(), QueueError>
pub fn push_used<M: QueueMemory + ?Sized>( &mut self, memory: &mut M, head: u16, written: u32, ) -> Result<(), QueueError>
Publishes a completed chain in the used ring.
written is the number of bytes the device wrote into the chain, which
the driver reads after the used-ring entry becomes visible.
Source§impl SplitQueue
impl SplitQueue
Sourcepub fn avail_flags<M: QueueMemory + ?Sized>(
&self,
memory: &mut M,
) -> Result<u16, QueueError>
pub fn avail_flags<M: QueueMemory + ?Sized>( &self, memory: &mut M, ) -> Result<u16, QueueError>
Reads the available-ring flags word.
Sourcepub fn no_interrupt_requested<M: QueueMemory + ?Sized>(
&self,
memory: &mut M,
) -> Result<bool, QueueError>
pub fn no_interrupt_requested<M: QueueMemory + ?Sized>( &self, memory: &mut M, ) -> Result<bool, QueueError>
True when the driver set VIRTQ_AVAIL_F_NO_INTERRUPT, i.e. it does
not want a used-ring interrupt for the buffers it has published.
Trait Implementations§
Source§impl Clone for SplitQueue
impl Clone for SplitQueue
impl Copy for SplitQueue
Source§impl Debug for SplitQueue
impl Debug for SplitQueue
impl Eq for SplitQueue
Source§impl PartialEq for SplitQueue
impl PartialEq for SplitQueue
impl StructuralPartialEq for SplitQueue
Auto Trait Implementations§
impl Forget for SplitQueue
impl Freeze for SplitQueue
impl Move for SplitQueue
impl RefUnwindSafe for SplitQueue
impl Send for SplitQueue
impl Sync for SplitQueue
impl Unpin for SplitQueue
impl UnsafeUnpin for SplitQueue
impl UnwindSafe for SplitQueue
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more