pub struct IxgbeNic { /* private fields */ }
Expand description
A struct representing an ixgbe network interface card.
Implementations§
source§impl IxgbeNic
impl IxgbeNic
sourcepub 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>
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 indexi
is for receive queuei
. The number of handlers must be less than or equal toIXGBE_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.
pub fn spoof_mac(&mut self, spoofed_mac_addr: [u8; 6])
sourcepub fn link_status(&self) -> (u32, u32)
pub fn link_status(&self) -> (u32, u32)
Returns value of (links, links2) registers
sourcepub fn link_speed(&self) -> LinkSpeedMbps
pub fn link_speed(&self) -> LinkSpeedMbps
Returns link speed in Mb/s
sourcepub fn get_stats(&self) -> (u32, u64, u32, u64)
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
sourcepub fn enable_rss(
regs2: &mut IntelIxgbeRegisters2,
regs3: &mut IntelIxgbeRegisters3
) -> Result<(), &'static str>
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.
sourcepub 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>
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 addressdest_ip
: ipv4 destination addresssource_port
: TCP/UDP/SCTP source portdest_port
: TCP/UDP/SCTP destination portprotocol
: IP L4 protocolpriority
: 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
impl NetworkDevice for IxgbeNic
source§fn mac_address(&self) -> [u8; 6]
fn mac_address(&self) -> [u8; 6]
Returns the MAC address.
§fn capabilities(&self) -> DeviceCapabilities
fn capabilities(&self) -> DeviceCapabilities
Returns the device capabilities.
Auto Trait Implementations§
impl !RefUnwindSafe for IxgbeNic
impl Send for IxgbeNic
impl Sync for IxgbeNic
impl Unpin for IxgbeNic
impl !UnwindSafe for IxgbeNic
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more