pub trait Queue: Send + InspectMut {
// Required methods
fn poll_ready(
&mut self,
cx: &mut Context<'_>,
pool: &mut dyn BufferAccess,
) -> Poll<()>;
fn rx_avail(&mut self, pool: &mut dyn BufferAccess, done: &[RxId]);
fn rx_poll(
&mut self,
pool: &mut dyn BufferAccess,
packets: &mut [RxId],
) -> Result<usize>;
fn tx_avail(
&mut self,
pool: &mut dyn BufferAccess,
segments: &[TxSegment],
) -> Result<(bool, usize)>;
fn tx_poll(
&mut self,
pool: &mut dyn BufferAccess,
done: &mut [TxId],
) -> Result<usize, TxError>;
// Provided methods
fn update_target_vp<'life0, 'async_trait>(
&'life0 mut self,
target_vp: u32,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn queue_stats(&self) -> Option<&dyn BackendQueueStats> { ... }
}Expand description
A single TX/RX data path for sending and receiving network packets.
Created by Endpoint::get_queues and driven by the frontend in
a poll loop. Every method that touches receive buffers takes
pool: &mut dyn BufferAccess so the frontend retains ownership
of guest memory state.
Typical poll loop:
loop {
poll_ready(cx, pool) // wait for backend events
rx_poll(pool, ..) // drain completed receives
tx_avail(pool, ..) // post guest TX packets
tx_poll(pool, ..) // drain TX completions
}Required Methods§
Sourcefn poll_ready(
&mut self,
cx: &mut Context<'_>,
pool: &mut dyn BufferAccess,
) -> Poll<()>
fn poll_ready( &mut self, cx: &mut Context<'_>, pool: &mut dyn BufferAccess, ) -> Poll<()>
Polls the queue for readiness.
Sourcefn rx_avail(&mut self, pool: &mut dyn BufferAccess, done: &[RxId])
fn rx_avail(&mut self, pool: &mut dyn BufferAccess, done: &[RxId])
Makes receive buffers available for use by the device.
Sourcefn rx_poll(
&mut self,
pool: &mut dyn BufferAccess,
packets: &mut [RxId],
) -> Result<usize>
fn rx_poll( &mut self, pool: &mut dyn BufferAccess, packets: &mut [RxId], ) -> Result<usize>
Polls the device for receives.
Provided Methods§
Sourcefn update_target_vp<'life0, 'async_trait>(
&'life0 mut self,
target_vp: u32,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_target_vp<'life0, 'async_trait>(
&'life0 mut self,
target_vp: u32,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Updates the queue’s target VP.
Sourcefn queue_stats(&self) -> Option<&dyn BackendQueueStats>
fn queue_stats(&self) -> Option<&dyn BackendQueueStats>
Get queue statistics