pub struct VirtIoNetDev<H: Hal, T: Transport, const QS: usize> { /* private fields */ }
Available on crate feature net only.
Expand description

The VirtIO network device driver.

QS is the VirtIO queue size.

Implementations§

source§

impl<H: Hal, T: Transport, const QS: usize> VirtIoNetDev<H, T, QS>

source

pub fn try_new(transport: T) -> DevResult<Self>

Creates a new driver instance and initializes the device, or returns an error if any step fails.

Trait Implementations§

source§

impl<H: Hal, T: Transport, const QS: usize> BaseDriverOps for VirtIoNetDev<H, T, QS>

source§

fn device_name(&self) -> &str

The name of the device.
source§

fn device_type(&self) -> DeviceType

The type of the device.
source§

impl<H: Hal, T: Transport, const QS: usize> NetDriverOps for VirtIoNetDev<H, T, QS>

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. Read more
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. Read more
source§

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

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

impl<H: Hal, T: Transport, const QS: usize> Send for VirtIoNetDev<H, T, QS>

source§

impl<H: Hal, T: Transport, const QS: usize> Sync for VirtIoNetDev<H, T, QS>

Auto Trait Implementations§

§

impl<H, T, const QS: usize> !RefUnwindSafe for VirtIoNetDev<H, T, QS>

§

impl<H, T, const QS: usize> Unpin for VirtIoNetDev<H, T, QS>
where H: Unpin, T: Unpin,

§

impl<H, T, const QS: usize> !UnwindSafe for VirtIoNetDev<H, T, QS>

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>,

§

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>,

§

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.