pub struct CompletionRing { /* private fields */ }Expand description
Ring buffer for UMEM completion descriptors (chunk addresses pushed by kernel/NIC after TX completion).
Implementations§
Source§impl CompletionRing
impl CompletionRing
Sourcepub fn new(capacity: u32) -> Self
pub fn new(capacity: u32) -> Self
Creates a new completion ring with capacity descriptors. capacity must be a power of two.
Sourcepub fn produce(&mut self, addr: u64) -> bool
pub fn produce(&mut self, addr: u64) -> bool
Enqueues a chunk address into the completion ring. Returns false if full.
Sourcepub fn produce_batch(&mut self, addrs: &[u64]) -> usize
pub fn produce_batch(&mut self, addrs: &[u64]) -> usize
Enqueues a batch of chunk addresses into the ring. Returns count enqueued.
Sourcepub fn consume_batch(&mut self, out: &mut [u64]) -> usize
pub fn consume_batch(&mut self, out: &mut [u64]) -> usize
Dequeues up to out.len() chunk addresses into out. Returns count dequeued.
Trait Implementations§
Source§impl Clone for CompletionRing
impl Clone for CompletionRing
Auto Trait Implementations§
impl Freeze for CompletionRing
impl RefUnwindSafe for CompletionRing
impl Send for CompletionRing
impl Sync for CompletionRing
impl Unpin for CompletionRing
impl UnsafeUnpin for CompletionRing
impl UnwindSafe for CompletionRing
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
Mutably borrows from an owned value. Read more