Skip to main content

IxgbeNetBuf

Struct IxgbeNetBuf 

Source
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

Source

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 from
  • size - Size of the packet buffer in bytes
§Errors

Returns IxgbeError::NoMemory if the allocation fails.

Source

pub fn packet(&self) -> &[u8]

Returns an immutable reference to the packet data.

Source

pub fn packet_mut(&mut self) -> &mut [u8]

Returns a mutable reference to the packet data.

Source

pub fn packet_len(&self) -> usize

Returns the length of the packet data in bytes.

Source

pub fn pool_entry(&self) -> usize

Returns the pool entry index for this packet.

Source

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 pool
  • pool - The memory pool
  • len - 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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.