Skip to main content

NicDataPlane

Struct NicDataPlane 

Source
pub struct NicDataPlane {
    pub queues: Vec<RingPair>,
}
Expand description

Multi-queue NIC data plane.

Initialised during NIC driver setup. Each hardware queue gets one RingPair; the consumer (strate-net) polls all RX rings in round-robin.

Fields§

§queues: Vec<RingPair>

One ring pair per RSS queue.

Implementations§

Source§

impl NicDataPlane

Source

pub fn new( queue_count: usize, slot_count: u32, slot_size: usize, ) -> Result<Self, &'static str>

Create a new data plane with queue_count ring pairs.

Each ring has slot_count slots of slot_size bytes. Returns an error if ring allocation fails.

Source

pub fn push_rx(&self, queue_index: usize, data: &[u8]) -> Result<(), ()>

Push a received packet into the RX ring for queue_index.

Called from the NIC IRQ handler. Returns Err if the ring is full (backpressure : drop the packet).

Source

pub fn pop_rx( &self, queue_index: usize, buf: &mut [u8], ) -> Result<Option<usize>, ()>

Pop a received packet from the RX ring for queue_index.

Called by strate-net. Returns Ok(None) if the ring is empty.

Source

pub fn push_tx(&self, queue_index: usize, data: &[u8]) -> Result<(), ()>

Push an outbound packet into the TX ring for queue_index.

Called by strate-net. The NIC driver will read from the TX ring and transmit onto the wire.

Source

pub fn pop_tx( &self, queue_index: usize, buf: &mut [u8], ) -> Result<Option<usize>, ()>

Pop an outbound packet from the TX ring for queue_index.

Called by the NIC driver. Returns Ok(None) if the ring is empty.

Source

pub fn notify_rx_consumer(&self, queue_index: usize)

Notify the consumer (strate-net) that new RX data is available.

Source

pub fn notify_tx_producer(&self, queue_index: usize)

Notify the NIC driver that new TX data is available.

Source

pub fn queue_count(&self) -> usize

Number of queues (ring pairs).

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.