Single Root IO Virtualization (SR-IOV)
Single Root IO Virtualization (SR-IOV) is a technology that allows a physical PCIe device to present itself multiple times through the PCIe bus. This technology enables multiple virtual instances of the device with separate resources. Mellanox adapters are capable of exposing in ConnectX-4 onwards adapter cards up to 63/127 virtual instances called Virtual Functions (VFs) depending on the firmware capabilities. These Virtual Functions can then be provisioned separately. Each VF can be seen as an addition device connected to the Physical Function. It shares the same resources with the Physical Function.
SR-IOV is commonly used in conjunction with an SR-IOV enabled hypervisor to provide virtual machines direct hardware access to network resources, hence increasing its performance.
In this chapter we will demonstrate setup and configuration of SR-IOV in a ESXi environment using Mellanox ConnectX® adapter cards family.
To set up an SR-IOV environment, the following is required:
- nmlx5_core Driver
- A server/blade with an SR-IOV-capable motherboard BIOS
- Mellanox ConnectX® Adapter Card family with SR-IOV capability
Hypervisor that supports SR-IOV such as: ESXi7.0
Setting Up SR-IOV
Configuring SR-IOV for ConnectX-4 Onward
To configure SR-IOV for ConnectX-4 onward, perform the following steps:
- Install the MLNX-NATIVE-ESX-<adapter card> driver for ESXi that supports SR-IOV.
- Download the MFT package. Go to:
www.mellanox.com → Products → Software → InfiniBand/VPI Drivers → MFT (http://www.mellanox.com/page/management_tools)
Start the mst driver.
Check if SR-IOV is enabled in the firmware.
If not, use mlxconfig to enable it.
Note: The example below shows how to enable SR-IOV and allow the creation of 16 VFs.
Validate the configuration set.
Set the number of Virtual Functions you need to create for the PF using the max_vfs module parameter.
max_vfs is a module parameter which expects an array on numbers where each number in the array indicates how many VFs should be created on that port.
The number of elements in this array is based on the “supported_num_ports” module parameter.
The example below shows the creation of 8 VFs on the first port and 7 on the second port.
Reboot the server.
The number of max_vf is set per port. See the nmlx5_core Module Parameters table in the introduction, for more information.
- Install the latest nmlx5 driver.
Install the latest MFT version.
Query the firmware configuration to locate the device.
Use MFT to burn the latest firmware version.
Set the link type of one or both ports to InfiniBand.
One InfiniBand port per subnet must be dedicated to running the Subnet Manager (SM). Since the SM can only run on PFs, that port must be passthrough to a VM.
Enable Ethernet PCI subclass override.
Set the "max_vfs" module parameter to the preferred number of VFs.
The example above refers to a single port HBA. In case of dual port, then the "max_vfs" parameter should be
InfiniBand ports are displayed on the ESXi host as “downed” uplinks and have no data path. The data path exists only for Guest OS.
Assign the InfiniBand SR-IOV VFs to the VMs.For further information on how to assign the VFs, see “Assigning a Virtual Function to a Virtual Machine in the vSphere Web Client” section.
When ESXi sets the MAC for an InfiniBand VF, the formula used to convert it to GUID is adding "FF:FE" between the 3rd and the 4th octet:
When assigning VFs in InfiniBand SR-IOV, the value set for MTU is ignored.
Configure the Subnet Manager.
Passthrough an InfiniBand PF to a VM.
Create an OpenSM config file
Add to the opensm.conf file “virt_enabled 2”
If configured correctly, the link state of the VFs should be “Active”.
Please refer to the MLNX_OFED User Manual for further information.
Do not forget to enable virtualization in the Subnet Manager configuration (see section "Configuring SR-IOV for ConnectX-4/Connect-IB (InfiniBand) "Step 7" in MLNX_OFED User Manual).
Communication of InfiniBand VFs is GID based only, and requires every message to include GRH header. Thus, when using ib_write_*/ib_send_* tools, "-x 0" option must be specified explicitly.