pub trait NetDriverOps: BaseDriverOps {
    // Required methods
    fn mac_address(&self) -> EthernetAddress;
    fn can_transmit(&self) -> bool;
    fn can_receive(&self) -> bool;
    fn rx_queue_size(&self) -> usize;
    fn tx_queue_size(&self) -> usize;
    fn recycle_rx_buffer(&mut self, rx_buf: NetBufPtr) -> DevResult;
    fn recycle_tx_buffers(&mut self) -> DevResult;
    fn transmit(&mut self, tx_buf: NetBufPtr) -> DevResult;
    fn receive(&mut self) -> DevResult<NetBufPtr>;
    fn alloc_tx_buffer(&mut self, size: usize) -> DevResult<NetBufPtr>;
}
Expand description

Operations that require a network device (NIC) driver to implement.

Required Methods§

source

fn mac_address(&self) -> EthernetAddress

The ethernet address of the NIC.

source

fn can_transmit(&self) -> bool

Whether can transmit packets.

source

fn can_receive(&self) -> bool

Whether can receive packets.

source

fn rx_queue_size(&self) -> usize

Size of the receive queue.

source

fn tx_queue_size(&self) -> usize

Size of the transmit queue.

source

fn recycle_rx_buffer(&mut self, rx_buf: NetBufPtr) -> DevResult

Gives back the rx_buf to the receive queue for later receiving.

rx_buf should be the same as the one returned by NetDriverOps::receive.

source

fn recycle_tx_buffers(&mut self) -> DevResult

Poll the transmit queue and gives back the buffers for previous transmiting. returns DevResult.

source

fn transmit(&mut self, tx_buf: NetBufPtr) -> DevResult

Transmits a packet in the buffer to the network, without blocking, returns DevResult.

source

fn receive(&mut self) -> DevResult<NetBufPtr>

Receives a packet from the network and store it in the NetBuf, returns the buffer.

Before receiving, the driver should have already populated some buffers in the receive queue by NetDriverOps::recycle_rx_buffer.

If currently no incomming packets, returns an error with type DevError::Again.

source

fn alloc_tx_buffer(&mut self, size: usize) -> DevResult<NetBufPtr>

Allocate a memory buffer of a specified size for network transmission, returns DevResult

Implementors§

source§

impl<H: IxgbeHal, const QS: usize, const QN: u16> NetDriverOps for IxgbeNic<H, QS, QN>