Trait driver_net::NetDriverOps 
source · 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§
sourcefn mac_address(&self) -> EthernetAddress
 
fn mac_address(&self) -> EthernetAddress
The ethernet address of the NIC.
sourcefn can_transmit(&self) -> bool
 
fn can_transmit(&self) -> bool
Whether can transmit packets.
sourcefn can_receive(&self) -> bool
 
fn can_receive(&self) -> bool
Whether can receive packets.
sourcefn rx_queue_size(&self) -> usize
 
fn rx_queue_size(&self) -> usize
Size of the receive queue.
sourcefn tx_queue_size(&self) -> usize
 
fn tx_queue_size(&self) -> usize
Size of the transmit queue.
sourcefn recycle_rx_buffer(&mut self, rx_buf: NetBufPtr) -> DevResult
 
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.
sourcefn recycle_tx_buffers(&mut self) -> DevResult
 
fn recycle_tx_buffers(&mut self) -> DevResult
Poll the transmit queue and gives back the buffers for previous transmiting.
returns DevResult.
sourcefn transmit(&mut self, tx_buf: NetBufPtr) -> DevResult
 
fn transmit(&mut self, tx_buf: NetBufPtr) -> DevResult
Transmits a packet in the buffer to the network, without blocking,
returns DevResult.
sourcefn receive(&mut self) -> DevResult<NetBufPtr>
 
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.