Struct ixgbe::IxgbeNic

source ·
pub struct IxgbeNic { /* private fields */ }
Expand description

A struct representing an ixgbe network interface card.

Implementations§

source§

impl IxgbeNic

source

pub fn init( ixgbe_pci_dev: &PciDevice, dev_id: PciLocation, enable_virtualization: bool, interrupts: Option<Vec<InterruptHandler>>, enable_rss: bool, rx_buffer_size_kbytes: RxBufferSizeKiB, num_rx_descriptors: u16, num_tx_descriptors: u16 ) -> Result<IrqSafeMutex<IxgbeNic>, &'static str>

Store required values from the device’s PCI config space, and initialize different features of the nic.

Arguments
  • ixgbe_pci_dev: Contains the pci device information for this NIC.
  • dev_id: Device id as assigned by the device manager. Currently this is just the pci location.
  • link_speed: The link speed of the ethernet connection which depends on the SFI module attached to the cable. We do not access the PHY module for link information yet and currently only support 1 Gbps and 10 Gbps links.
  • enable_virtualization: True if language-level virtualization is enabled. If this is true then interrupts and RSS need to be disabled. When the virtual NIC is created, these features should be enabled on a per-queue basis. We do not support that as of yet.
  • interrupts: A vector of packet reception interrupt handlers where the length of the vector is the number of receive queues for which interrupts are enabled. We have currently tested for 16 receive queues. The interrupt handler at index i is for receive queue i. The number of handlers must be less than or equal to IXGBE_NUM_RX_QUEUES_ENABLED. If interrupts are disabled, this should be set to None.
  • enable_rss: true if receive side scaling is enabled.
  • rx_buffer_size_kbytes: The size of receive buffers.
  • num_rx_descriptors: The number of descriptors in each receive queue.
  • num_tx_descriptors: The number of descriptors in each transmit queue.
source

pub fn device_id(&self) -> PciLocation

Returns the device id of the PCI device.

source

pub fn spoof_mac(&mut self, spoofed_mac_addr: [u8; 6])

Returns value of (links, links2) registers

Returns link speed in Mb/s

source

pub fn get_stats(&self) -> (u32, u64, u32, u64)

Returns the Rx and Tx statistics in the form: (Good Rx packets, Good Rx bytes, Good Tx packets, Good Tx bytes). A good packet is one that is >= 64 bytes including ethernet header and CRC

source

pub fn enable_rss( regs2: &mut IntelIxgbeRegisters2, regs3: &mut IntelIxgbeRegisters3 ) -> Result<(), &'static str>

Enable multiple receive queues with RSS. Part of queue initialization is done in the rx_init function.

source

pub fn set_5_tuple_filter( &mut self, source_ip: Option<[u8; 4]>, dest_ip: Option<[u8; 4]>, source_port: Option<u16>, dest_port: Option<u16>, protocol: Option<FilterProtocol>, priority: u8, qid: u8 ) -> Result<u8, &'static str>

Sets the L3/L4 5-tuple filter which can do an exact match of the packet’s header with the filter and send to chosen rx queue (7.1.2.5). There are up to 128 such filters. If more are needed, will have to enable Flow Director filters.

Argument
  • source_ip: ipv4 source address
  • dest_ip: ipv4 destination address
  • source_port: TCP/UDP/SCTP source port
  • dest_port: TCP/UDP/SCTP destination port
  • protocol: IP L4 protocol
  • priority: priority relative to other filters, can be from 0 (lowest) to 7 (highest)
  • qid: number of the queue to forward packet to

Trait Implementations§

source§

impl NetworkDevice for IxgbeNic

source§

fn send(&mut self, buf: TransmitBuffer)

Sends a buffer on the device. Read more
source§

fn receive(&mut self) -> Option<ReceivedFrame>

Receives a frame from the device.
source§

fn mac_address(&self) -> [u8; 6]

Returns the MAC address.
§

fn capabilities(&self) -> DeviceCapabilities

Returns the device capabilities.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V