pub struct IncomingRing<M: RingMem> { /* private fields */ }
Expand description
The interface to the receiving endpoint of a ring buffer.
Implementations§
Source§impl<M: RingMem> IncomingRing<M>
impl<M: RingMem> IncomingRing<M>
Sourcepub fn new(mem: M) -> Result<Self, Error>
pub fn new(mem: M) -> Result<Self, Error>
Returns a new incoming ring. Fails if the ring memory is not sized or aligned correctly or if the ring control data is corrupt.
Sourcepub fn supports_pending_send_size(&self) -> bool
pub fn supports_pending_send_size(&self) -> bool
Indicates whether pending send size notification is supported on the vmbus ring.
Sourcepub fn set_interrupt_mask(&self, state: bool)
pub fn set_interrupt_mask(&self, state: bool)
Enables or disables the interrupt mask, declaring to the opposite endpoint that interrupts should not or should be sent for a ring empty-to-non-empty transition.
Sourcepub fn verify_interrupts_unmasked(&self) -> Result<(), Error>
pub fn verify_interrupts_unmasked(&self) -> Result<(), Error>
Verifies that interrupts are currently unmasked.
This can be used to check that ring state is consistent.
Sourcepub fn incoming(&self) -> Result<IncomingOffset, Error>
pub fn incoming(&self) -> Result<IncomingOffset, Error>
Returns the current incoming offset, for passing to read
and
commit_read
.
Sourcepub fn can_read(&self, incoming: &mut IncomingOffset) -> Result<bool, Error>
pub fn can_read(&self, incoming: &mut IncomingOffset) -> Result<bool, Error>
Returns true if there are any packets to read.
Sourcepub fn commit_read(&self, ptrs: &mut IncomingOffset) -> bool
pub fn commit_read(&self, ptrs: &mut IncomingOffset) -> bool
Commits a series of packet reads, returning whether the opposite endpoint should be signaled.
Sourcepub fn read(
&self,
ptrs: &mut IncomingOffset,
) -> Result<IncomingPacket, ReadError>
pub fn read( &self, ptrs: &mut IncomingOffset, ) -> Result<IncomingPacket, ReadError>
Parses the next packet descriptor, returning the parsed information and
a range that can be used to read the packet. The caller should commit
the read with commit_read
to free up space in the ring.