Skip to main content

SplitQueue

Struct SplitQueue 

Source
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: u16

Implementations§

Source§

impl SplitQueue

Source

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.

Source

pub const fn size(self) -> u16

Queue size (number of descriptors).

Source

pub fn descriptor_gpa(self, index: u16) -> Option<u64>

Guest-physical address of descriptor index.

Source

pub fn read_descriptor<M: QueueMemory + ?Sized>( self, memory: &mut M, index: u16, ) -> Result<Descriptor, QueueError>

Reads one descriptor.

Source

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.

Source

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.

Source

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.

Source

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

Source

pub fn avail_flags<M: QueueMemory + ?Sized>( &self, memory: &mut M, ) -> Result<u16, QueueError>

Reads the available-ring flags word.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SplitQueue

Source§

impl Debug for SplitQueue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SplitQueue

Source§

impl PartialEq for SplitQueue

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SplitQueue

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.