Create Content



image image image image image image



On This Page

Created on Jun 27, 2022

Introduction

This post describes the setup and configuration of SR-IOV in a ESXi 7.0 host using a NVIDIA ConnectX®-6 InfiniBand adapter card with a Native driver.

Note: Setting up a VM is out of the scope of this post.

References

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. NVIDIA adapters are capable of exposing in ConnectX-6 adapter cards up to 128 virtual instances called Virtual Functions (VFs). 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.

Overview

SR-IOV configuration includes the following:

  • Enables Virtualization (SR-IOV) in the BIOS (prerequisites)
  • Enables SR-IOV in the firmware
  • Enables SR-IOV in the MLNX_OFED Driver
  • Maps the Virtual Machine (VM) to the relevant port via SR-IOV

Hardware and Software Requirements

  • A server platform with an SR-IOV-capable motherboard BIOS
  • NVIDIA ConnectX®-6 adapter
  • Installer Privileges: The installation requires administrator privileges on the target machine

Prerequisites

To set up an SR-IOV environment, the following is required:

  1. Make sure that SR-IOV is enabled in the BIOS of the specific server. Each server has different BIOS configuration options for virtualization. See as sample How-to Set Dell PowerEdge R730 BIOS parameters to support SR-IOV for BIOS configuration examples.
  2. Install NVIDIA Firmware Tools (MFT) on ESXi server, refer to How-to: Install NVIDIA Firmware Tools (MFT) on VMware ESXi 6.7/7.0.
  3. Make sure to have the last supported firmware version.
    Refer to NVIDIA ConnectX® Ethernet Driver for VMware® ESXi Server and  How-to: Firmware update for NVIDIA ConnectX-5/6 adapter on VMware ESXi 6.5 and above.

Setting Up SR-IOV

Enable SR-IOV in the BIOS

Each server has a different BIOS configuration options for virtualization.

The figures used in this section are for illustration purposes only.

For further information, please refer to the appropriate BIOS User Manual. 

  1. Enable "SR-IOV" in the system BIOS.
  2. Enable "Intel Virtualization Technology".

Enable SR-IOV on the Firmware

  1. Enable the SSH Access to ESXi server.
  2. Log into the ESXi vSphere Command-Line Interface with root permissions.
  3. Enter Maintenance Mode the ESXi host.
  4. Run MFT and check the status.

    ESXi Console
    # /opt/mellanox/bin/mst start
    Module mst is already loaded
    
    # /opt/mellanox/bin/mst status -vv 
    PCI devices:
    ------------
    DEVICE_TYPE             MST                           PCI       RDMA            NET                       NUMA
    ConnectX6(rev:0)        mt4123_pciconf1               37:00.0
    
    ConnectX6(rev:0)        mt4123_pciconf1.1             37:00.1
  5. Query the status of the device.

    ESXi Console
    # /opt/mellanox/bin/mlxconfig -d mt4123_pciconf1 q
    
    Device #1:
    ----------  
    Device type:    ConnectX6
    Name:           MCX654106A-HCA_Ax
    Description:    ConnectX-6 VPI adapter card; HDR IB (200Gb/s) and 200GbE; dual-port QSFP56; Socket Direct 2x PCIe3.0 x16; tall bracket; ROHS R6
    Device:         mt4123_pciconf1
      
    Configurations:             Next Boot
    ...
    NUM_OF_VFS					0
    SRIOV_EN 					False(0)
    ...
  6. Set the link type of one or both ports to InfiniBand (default).

    ESXi Console
    # /opt/mellanox/bin/mlxconfig -d mt4123_pciconf1 set LINK_TYPE_P1=1
    
    Device #1:
    ----------
    
    Device type:    ConnectX6
    Name:           MCX654106A-HCA_Ax
    Description:    ConnectX-6 VPI adapter card; HDR IB (200Gb/s) and 200GbE; dual-port QSFP56; Socket Direct 2x PCIe3.0 x16; tall bracket; ROHS R6
    Device:         mt4123_pciconf1
    
    Configurations:                              Next Boot       New
             LINK_TYPE_P1                        ETH(2)           IB(1)
    
     Apply new Configuration? (y/n) [n] : y
    Applying... Done!
    
    # /opt/mellanox/bin/mlxconfig -d mt4123_pciconf1 set LINK_TYPE_P2=1
    
    Device #1:
    ----------
    
    Device type:    ConnectX6
    Name:           MCX654106A-HCA_Ax
    Description:    ConnectX-6 VPI adapter card; HDR IB (200Gb/s) and 200GbE; dual-port QSFP56; Socket Direct 2x PCIe3.0 x16; tall bracket; ROHS R6
    Device:         mt4123_pciconf1
    
    Configurations:                              Next Boot       New
             LINK_TYPE_P2                        ETH(2)           IB(1)
    
     Apply new Configuration? (y/n) [n] : y
    Applying... Done!
    -I- Please reboot machine to load new configurations.
    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.
  7. Enable Ethernet PCI subclass override.

    ESXi Console
    # /opt/mellanox/bin/mlxconfig -d mt4123_pciconf1 set ADVANCED_PCI_SETTINGS=1
    # /opt/mellanox/bin/mlxconfig -d mt4123_pciconf1 set FORCE_ETH_PCI_SUBCLASS=1
  8. Reboot the server.

  9. Enable SR-IOV and set the desired number of Virtual Functions (VFs).

    1. SRIOV_EN=1
    2. NUM_OF_VFS=16 ; This is an example with eight VFs per port.

      ESXi Console
      # /opt/mellanox/bin/mlxconfig -d mt4123_pciconf1 s SRIOV_EN=1 NUM_OF_VFS=16
      
      Device #1:
      ----------  
      
      Device type:    ConnectX6
      Name:           MCX654106A-HCA_Ax
      Description:    ConnectX-6 VPI adapter card; HDR IB (200Gb/s) and 200GbE; dual-port QSFP56; Socket Direct 2x PCIe3.0 x16; tall bracket; ROHS R6
      Device:         mt4123_pciconf1
        
      Configurations:                              Next Boot       New
               SRIOV_EN                            False(0)        True(1)
               NUM_OF_VFS                          0               16
      
       Apply new Configuration? (y/n) [n] : y
      Applying... Done!
      -I- Please reboot machine to load new configurations.
      Note: mlxconfig must be performed for each PCI device (adapter). In parallel, in the driver the configuration is per module, which means that it will be applicable for all adapters installed on the server.
  10. Reboot the server.

    Note: At this point, the VFs are not seen when using "lspci". Only when SR-IOV is enabled on the driver will you be able to see them.
  11. Check if SR-IOV is enabled in the firmware.

    ESXi Console
    # /opt/mellanox/bin/mlxconfig -d mt4123_pciconf1 q   
    
    Device #1:
    ----------  
    
    Device type:    ConnectX6
    Name:           MCX654106A-HCA_Ax
    Description:    ConnectX-6 VPI adapter card; HDR IB (200Gb/s) and 200GbE; dual-port QSFP56; Socket Direct 2x PCIe3.0 x16; tall bracket; ROHS R6
    Device:         mt4123_pciconf1
       Configurations: Current
    
    ...
    
    NUM_OF_VFS 16
    
    SRIOV_EN True(1)
    
    ...

Enable SR-IOV on the Driver

  1. Get the module parameter list as follows:

    ESXi Console
    # esxcli system module parameters list -m nmlx5_core
    
    Name Type Value Description
    ...
    max_vfs array of uint Number of PCI VFs to initialize
    Values : Array of 'uint' of range 0-128, May be limited by device, 0 - disabled
    Default: 0
    ...
  2. Enable SR-IOV in the driver and set the max_vfs module parameter.

    ESXi Console
    # esxcli system module parameters set -m nmlx5_core -p "max_vfs=16,16"

    Or, if your card second NVIDIA card.
    Sample:

    ESXi Console
    # esxcli system module parameters set -m nmlx5_core -p "max_vfs=0,0,16,16"

    Note 1: Allow at least one more VF to be configured on the firmware (num_of_vfs) than on the driver. In our example we had eight VFs configured on the firmware while four is configured on the driver (max_vfs).

    Note 2: mlxconfig must be performed for each PCI device (adapter). In parallel, in the driver the configuration is per module, which means that it will be applicable for all adapters installed on the server.

    Note 3: Changing the number of VFs is persistent.

  3. Reboot the server.

  4. Exit Maintenance Mode on the ESXi host.

  5. Check the PCI bus and verify that you see the VFs (with the same number of VFs on each port).

    ESXi Console
    # lspci -d | grep Mellanox   
    
    0000:37:00.0 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6] [vmnic4] 
    0000:37:00.1 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6] [vmnic5]
    0000:37:00.2 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_0]
    0000:37:00.3 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_1]
    0000:37:00.4 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_2]
    0000:37:00.5 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_3]
    0000:37:00.6 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_4]
    0000:37:00.7 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_5]
    0000:37:01.0 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_6]
    0000:37:01.1 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_7]
    0000:37:01.2 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_8]
    0000:37:01.3 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_9]
    0000:37:01.4 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_10]
    0000:37:01.5 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_11]
    0000:37:01.6 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_12]
    0000:37:01.7 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_13]
    0000:37:02.0 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_14]
    0000:37:02.1 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.0_VF_15]
    0000:37:02.2 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_0]
    0000:37:02.3 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_1]
    0000:37:02.4 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_2]
    0000:37:02.5 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_3]
    0000:37:02.6 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_4]
    0000:37:02.7 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_5]
    0000:37:03.0 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_6]
    0000:37:03.1 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_7]
    0000:37:03.2 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_8]
    0000:37:03.3 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_9]
    0000:37:03.4 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_10]
    0000:37:03.5 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_11]
    0000:37:03.6 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_12]
    0000:37:03.7 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_13]
    0000:37:04.0 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_14]
    0000:37:04.1 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function] [PF_0.55.1_VF_15]


At this point you can see 16 VFs and one Physical Function (PF).

Add Network Adapter to the VM in SR-IOV Mode

Note 1: Make sure the VM version is Rel. 10 or above, and upgrade it if needed by accessing the Compatibility section (otherwise SR-IOV will not appear as an option in the network adapter selection).

Note 2: Before you start, power off the VM.

After you enable the Virtual Functions on the host, each of them becomes available as a PCI device.

To assign Virtual Function to a Virtual Machine in the vSphere Web Client:

  1. Locate the Virtual Machine in the vSphere Web Client.
    1. Select a data center, folder, cluster, resource pool, or host and click the Related Objects tab.
    2. Click Virtual Machines and select the virtual machine from the list.
  2. Power off the Virtual Machine.
  3. Select the VM and Go to "Edit Settings".
  4. Click on Add Network adapter.
  5. Under Adapter Type select the SR-IOV passthrough connectivity option.
  6. Check the Reserve all guest memory (All locked) checkbox.
    I/O memory management unit (IOMMU) must reach all Virtual Machine memory so that the passthrough device can access the memory by using direct memory access (DMA). 
  7. Expand the New Network section and connect the Virtual Machine to the SRIOV net port group from the combo box at the bottom of the screen.
    The virtual NIC does not use this port group for data traffic. The port group is used to extract the networking properties, for example VLAN tagging, to apply on the data traffic.

    MAC Address and MTU Considerations

    Note 1: You can leave the automatic generated MAC address (this is the default), or change it manually.

    Note 2: The Hypervisor MTU should be higher or equal to the Guest VM, otherwise, the packets may be dropped. You may modify “Set Guest OS MTU change” to allow changing MTU from guest. This step is applicable only if this feature is supported by the driver.

  8. Power on the VM

  9. Open the VM command line and make sure that you have the interface connected.

  • On the guest VM install the OS NVIDIA driver (OFED, WinOF ...).
  • Configure the IP Address and check Network connectivity.

Troubleshooting

  1. At least one more VF must be configured on the firmware than on the driver. In our example we had eight VFs configured on the firmware while four are configured on the driver.
  2. mlxconfig must be performed for each PCI device (adapter). In parallel, in the driver the configuration is per module, which means that it will be applicable for all adapters installed on the server.
  3. Make sure the VM version is Rel. 10 or above, and upgrade it if needed by accessing the Compatibility section (otherwise SR-IOV will not appear as option in network adapter selection).


Done !

Authors


Boris Kovalev

Boris Kovalev has worked for the past several years as a Solutions Architect, focusing on NVIDIA Networking/Mellanox technology, and is responsible for complex machine learning, Big Data and advanced VMware-based cloud research and design. Boris previously spent more than 20 years as a senior consultant and solutions architect at multiple companies, most recently at VMware. He has written multiple reference designs covering VMware, machine learning, Kubernetes, and container solutions which are available at the Mellanox Documents website.



Notice

This document is provided for information purposes only and shall not be regarded as a warranty of a certain functionality, condition, or quality of a product. Neither NVIDIA Corporation nor any of its direct or indirect subsidiaries and affiliates (collectively: “NVIDIA”) make any representations or warranties, expressed or implied, as to the accuracy or completeness of the information contained in this document and assumes no responsibility for any errors contained herein. NVIDIA shall have no liability for the consequences or use of such information or for any infringement of patents or other rights of third parties that may result from its use. This document is not a commitment to develop, release, or deliver any Material (defined below), code, or functionality.
NVIDIA reserves the right to make corrections, modifications, enhancements, improvements, and any other changes to this document, at any time without notice.
Customer should obtain the latest relevant information before placing orders and should verify that such information is current and complete.
NVIDIA products are sold subject to the NVIDIA standard terms and conditions of sale supplied at the time of order acknowledgement, unless otherwise agreed in an individual sales agreement signed by authorized representatives of NVIDIA and customer (“Terms of Sale”). NVIDIA hereby expressly objects to applying any customer general terms and conditions with regards to the purchase of the NVIDIA product referenced in this document. No contractual obligations are formed either directly or indirectly by this document.
NVIDIA products are not designed, authorized, or warranted to be suitable for use in medical, military, aircraft, space, or life support equipment, nor in applications where failure or malfunction of the NVIDIA product can reasonably be expected to result in personal injury, death, or property or environmental damage. NVIDIA accepts no liability for inclusion and/or use of NVIDIA products in such equipment or applications and therefore such inclusion and/or use is at customer’s own risk.
NVIDIA makes no representation or warranty that products based on this document will be suitable for any specified use. Testing of all parameters of each product is not necessarily performed by NVIDIA. It is customer’s sole responsibility to evaluate and determine the applicability of any information contained in this document, ensure the product is suitable and fit for the application planned by customer, and perform the necessary testing for the application in order to avoid a default of the application or the product. Weaknesses in customer’s product designs may affect the quality and reliability of the NVIDIA product and may result in additional or different conditions and/or requirements beyond those contained in this document. NVIDIA accepts no liability related to any default, damage, costs, or problem which may be based on or attributable to: (i) the use of the NVIDIA product in any manner that is contrary to this document or (ii) customer product designs.
No license, either expressed or implied, is granted under any NVIDIA patent right, copyright, or other NVIDIA intellectual property right under this document. Information published by NVIDIA regarding third-party products or services does not constitute a license from NVIDIA to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property rights of the third party, or a license from NVIDIA under the patents or other intellectual property rights of NVIDIA.
Reproduction of information in this document is permissible only if approved in advance by NVIDIA in writing, reproduced without alteration and in full compliance with all applicable export laws and regulations, and accompanied by all associated conditions, limitations, and notices.
THIS DOCUMENT AND ALL NVIDIA DESIGN SPECIFICATIONS, REFERENCE BOARDS, FILES, DRAWINGS, DIAGNOSTICS, LISTS, AND OTHER DOCUMENTS (TOGETHER AND SEPARATELY, “MATERIALS”) ARE BEING PROVIDED “AS IS.” NVIDIA MAKES NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL NVIDIA BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS DOCUMENT, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Notwithstanding any damages that customer might incur for any reason whatsoever, NVIDIA’s aggregate and cumulative liability towards customer for the products described herein shall be limited in accordance with the Terms of Sale for the product.

Trademarks
NVIDIA, the NVIDIA logo, and Mellanox are trademarks and/or registered trademarks of NVIDIA Corporation and/or Mellanox Technologies Ltd. in the U.S. and in other countries. Other company and product names may be trademarks of the respective companies with which they are associated.

Copyright
© 2022 NVIDIA Corporation & affiliates. All Rights Reserved.