Skip to main content

DeviceQueue

Trait DeviceQueue 

Source
pub trait DeviceQueue: QueuePort {
    type Chain: DeviceChain;
    type Error;

    // Required methods
    fn pop_available(
        &mut self,
    ) -> Result<Option<Self::Chain>, QueueError<Self::Error>>;
    fn complete(
        &mut self,
        chain: Self::Chain,
        used: UsedLength,
    ) -> Result<NotificationHint, QueueError<Self::Error>>;
    fn disable_available_notifications(
        &mut self,
    ) -> Result<(), QueueError<Self::Error>>;
    fn enable_available_notifications(
        &mut self,
    ) -> Result<NotificationRecheck, QueueError<Self::Error>>;
    fn reset(
        &mut self,
        next_epoch: QueueEpoch,
    ) -> Result<(), QueueError<Self::Error>>;
}
Expand description

Device-side available-ring consumption and completion publication.

A successful DeviceQueue::pop_available acquires request and descriptor writes made before driver publication. DeviceQueue::complete consumes the chain, publishes response bytes and the used index with release ordering, and only then returns a notification decision.

Required Associated Types§

Source

type Chain: DeviceChain

Owned consumed-chain type.

Source

type Error

Concrete transport failure.

Required Methods§

Source

fn pop_available( &mut self, ) -> Result<Option<Self::Chain>, QueueError<Self::Error>>

Consume one available descriptor chain.

This operation must not block or allocate. Chains are returned in available-ring order.

Source

fn complete( &mut self, chain: Self::Chain, used: UsedLength, ) -> Result<NotificationHint, QueueError<Self::Error>>

Publish one chain completion and consume its ownership token.

This operation must not block or allocate. It must reject a stale epoch without writing guest bytes, a used entry, or a notification. used must not exceed writable capacity.

Source

fn disable_available_notifications( &mut self, ) -> Result<(), QueueError<Self::Error>>

Disable available-ring notifications before draining work.

This operation must not block or allocate.

Source

fn enable_available_notifications( &mut self, ) -> Result<NotificationRecheck, QueueError<Self::Error>>

Enable available-ring notifications and atomically recheck for missed work.

This operation must not block or allocate. WorkPending requires the caller to continue draining rather than sleep.

Source

fn reset( &mut self, next_epoch: QueueEpoch, ) -> Result<(), QueueError<Self::Error>>

Invalidate all consumed chains from the old epoch and return the queue to its base state.

This operation must not block or allocate. next_epoch must be greater than the current epoch. No later completion from the old epoch may write guest memory or publish a used entry.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§