pub struct IxgbeNetBuf { /* private fields */ }Expand description
A network buffer for the ixgbe driver.
IxgbeNetBuf wraps a packet buffer with a cleaner interface for use with
the NicDevice trait. It provides access to packet data and metadata.
Implementations§
Source§impl IxgbeNetBuf
impl IxgbeNetBuf
Sourcepub fn alloc(pool: &Arc<MemPool>, size: usize) -> IxgbeResult<Self>
pub fn alloc(pool: &Arc<MemPool>, size: usize) -> IxgbeResult<Self>
Allocates a new network buffer from the memory pool.
§Arguments
pool- The memory pool to allocate fromsize- Size of the packet buffer in bytes
§Errors
Returns IxgbeError::NoMemory if the allocation fails.
Sourcepub fn packet_mut(&mut self) -> &mut [u8]
pub fn packet_mut(&mut self) -> &mut [u8]
Returns a mutable reference to the packet data.
Sourcepub fn packet_len(&self) -> usize
pub fn packet_len(&self) -> usize
Returns the length of the packet data in bytes.
Sourcepub fn pool_entry(&self) -> usize
pub fn pool_entry(&self) -> usize
Returns the pool entry index for this packet.
Sourcepub fn construct(
pool_entry: usize,
pool: &Arc<MemPool>,
len: usize,
) -> IxgbeResult<Self>
pub fn construct( pool_entry: usize, pool: &Arc<MemPool>, len: usize, ) -> IxgbeResult<Self>
Constructs an IxgbeNetBuf from a specific pool entry.
This is used internally when receiving packets to wrap a buffer that was already allocated in the receive queue.
§Arguments
pool_entry- The index of the entry in the memory poolpool- The memory poollen- Length of the packet data
§Safety
The caller must ensure that pool_entry is valid and the memory
region is properly initialized.
Auto Trait Implementations§
impl Freeze for IxgbeNetBuf
impl !RefUnwindSafe for IxgbeNetBuf
impl !Send for IxgbeNetBuf
impl !Sync for IxgbeNetBuf
impl Unpin for IxgbeNetBuf
impl UnsafeUnpin for IxgbeNetBuf
impl !UnwindSafe for IxgbeNetBuf
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