我要评分
获取效率
正确性
完整性
易理解

Using Gazelle to Take Over Network Interfaces

Bind a network interface to the user mode to allow the user-mode NIC driver to access NIC resources, thereby achieving higher network performance than kernel-mode network interfaces.

The procedure described in this section applies to Huawei Hi1822 NICs. If CX4 NICs are used, go to Modifying the Gazelle Configuration File after performing 1 and 2.

You can run the lspci |grep -i net command to query the NIC model.

  • In the following figure, the queried NICs are Huawei HiSilicon Hi1822 NICs.

  • In the following figure, the queried NICs are Mellanox ConnectX-4 LX NICs (CX4 NICs).

  1. Enable the no-IOMMU mode of the Virtual Function I/O (VFIO) module.
    1
    modprobe vfio enable_unsafe_noiommu_mode=1
    
  2. Load the vfio-pci driver.
    1
    modprobe vfio-pci
    
  3. Check available network interfaces on the current device.
    1
    ip a
    
  4. The command output shows that enp125s0f0 and enp3s0 are available.

  5. Query and record the NIC driver and the corresponding PCI address.
    1
    ethtool -i enp3s0
    

  6. Check the name of the service network interface to be bound and disable this interface. In this example, the name of the service network interface is enp3s0.

    Before running this command, check and record the MAC address of this network interface.

    1
    ip link set enp3s0 down
    
  7. Bind the network interface to the vfio-pci driver.
    1
    dpdk-devbind -b vfio-pci enp3s0
    
  8. After the network interface is bound, check network interfaces on the current device again.
    1
    ip a
    
  9. View the command output. It shows that the bound interface enp3s0 is not included in the available network interface list.

    To unbind a NIC, perform the following steps:

    1. Check the network interface status. As shown in the preceding figure, the NIC whose PCI address is 0000:03:00.0 has been taken over by the DPDK.
      1
      dpdk-devbind -s
      

    2. Bind the network interface to the driver queried in 5.
      1
      dpdk-devbind -b hinic 0000:03:00.0
      
    3. Enable this network interface.
      1
      ip link set enp3s0 up