pub struct Queue<'a, N> { /* private fields */ }Expand description
Representation of a virtqueue.
Aside from construction of the queue the only provided method is to retrieve the [next_chain]
(Queue::next_chain) if one has been published by the driver. The DescChain, if one is
returned, implements a custom drop to return the chain to the queue, and hence to the driver.
Implementations§
Source§impl<'a, N> Queue<'a, N>
impl<'a, N> Queue<'a, N>
Sourcepub fn new(mem: QueueMemory<'a>, notify: N) -> Option<Self>
pub fn new(mem: QueueMemory<'a>, notify: N) -> Option<Self>
Constructs a new Queue from memory descriptions.
Takes a QueueMemory, which is just a list of memory regions, for which to create a
queue out of. This internally creates a Driver and [Device]
(ring::Device) from the provided regions.
The rings are assumed to not have yet been used and so the used and avail indices will
start at 0. There is presently no way to construct a Queue around rings that have
already been in use.
Sourcepub fn new_from_rings(
driver: Driver<'a>,
device: Device<'a>,
notify: N,
) -> Option<Self>
pub fn new_from_rings( driver: Driver<'a>, device: Device<'a>, notify: N, ) -> Option<Self>
Source§impl<'a, N: DriverNotify> Queue<'a, N>
impl<'a, N: DriverNotify> Queue<'a, N>
Sourcepub fn next_chain<'b>(&'b self) -> Option<DescChain<'a, 'b, N>>
pub fn next_chain<'b>(&'b self) -> Option<DescChain<'a, 'b, N>>
Return any available DescChain.
Polls the available ring for any queued descriptor chain, and if found returns a
DescChain abstraction around it.
It is the responsibility of the device to know, presumably via the transport level queue notifications, when a descriptor chain might be available and to call this polling function.
The DescChain is automatically returned the driver, via the used ring, when it is
dropped.