Activating Virtual Functions

Getting Started with Napatech Link-Virtualization™ Software

Platform
Napatech SmartNIC
Content Type
Getting Started
Getting Started Guide
Capture Software Version
Link-Virtualization™ Software 4.5

Virtual functions must be enabled after each system restart.

About this task

This shows the procedure to activate and verify virtual functions.

Procedure

  1. Load the vfio-pci device driver and configure the vendor ID and the device ID of the SmartNIC to be controlled by the vfio-pci device driver..
    modprobe vfio-pci enable_sriov=1
    echo 18f4 <device_id> > /sys/bus/pci/drivers/vfio-pci/remove_id 2>/dev/null
    echo 18f4 <device_id> > /sys/bus/pci/drivers/vfio-pci/new_id
    
    

    18f4 is the PCI vendor ID for Napatech, and device_id is the PCI device ID for the SmartNIC.

    • Enter the following command for an NT200A02 SmartNIC:
      echo 18f4 01c5 > /sys/bus/pci/drivers/vfio-pci/new_id
    • Enter the following command for an NT50B01 SmartNIC:
      echo 18f4 01d5 > /sys/bus/pci/drivers/vfio-pci/new_id
    Run the following command to verify.
    lsmod | grep vfio
    An output example:
    vfio_pci               65536  0
    vfio_virqfd            16384  1 vfio_pci
    vfio_iommu_type1       45056  0
    vfio                   45056  2 vfio_iommu_type1,vfio_pci
    irqbypass              16384  2 vfio_pci,kvm
  2. Activate a number of virtual functions.
    Check the current status of the Napatech SmartNIC.
    lspci | grep Napatech
    An output example:
    42:00.0 Network controller: Napatech A/S NT200A02 Network Adapter
    Activate virtual functions. This example activates 5 virtual functions.
    DEV=$(lspci -Dd 18f4: | cut -d' ' -f1 | head -1)
    NUMVF=5
    echo $NUMVF > /sys/bus/pci/devices/$DEV/sriov_numvfs
    cat /sys/bus/pci/devices/$DEV/sriov_numvfs
    where:

    $NUMVF represents the number of virtual channels to VMs, plus one for OVS. Thus using NUMVF=3 will enable 3 channels for VMs. The current maximum supported Virtual Functions count is 128.

    Note: 33.00 or newer version FPGA images support SR-IOV capabilities. If the FPGA image of the SmartNIC has been switched from an older version to 33.00 or newer version, you must reboot the server to enumerate SR-IOV capabilities.
    If activating virtual functions fails, see Common Problems and Solutions Activating Virtual Functions
  3. Verify the Virtual Functions with the command lspci | grep Napatech.
    This is an example of the lspci | grep Napatech.
    42:00.0 Network controller: Napatech A/S NT200A02 Network Adapter
    42:00.4 Network controller: Napatech A/S Device 051a
    42:00.5 Network controller: Napatech A/S Device 051a
    42:00.6 Network controller: Napatech A/S Device 051a
    42:00.7 Network controller: Napatech A/S Device 051a
    42:01.0 Network controller: Napatech A/S Device 051a
    Note: The virtual functions are bound to devices XX:XX.4 and up.
  4. Verify the kernel driver using the command lspci -k | grep -A1 Napatech.
    42:00.0 Network controller: Napatech A/S NT200A02 Network Adapter
            Subsystem: Napatech A/S Device 0001
            Kernel driver in use: vfio-pci
    42:00.4 Network controller: Napatech A/S Device 051a
            Subsystem: Napatech A/S Device 0001
            Kernel driver in use: vfio-pci
    42:00.5 Network controller: Napatech A/S Device 051a
            Subsystem: Napatech A/S Device 0001
            Kernel driver in use: vfio-pci
    42:00.6 Network controller: Napatech A/S Device 051a
            Subsystem: Napatech A/S Device 0001
            Kernel driver in use: vfio-pci
    42:00.7 Network controller: Napatech A/S Device 051a
            Subsystem: Napatech A/S Device 0001
            Kernel driver in use: vfio-pci
    42:01.0 Network controller: Napatech A/S Device 051a
            Subsystem: Napatech A/S Device 0001
            Kernel driver in use: vfio-pci