Search code examples
dpdkvfio

Dpdk20.11.3 cannot bind device to vfio-pci


I am using dpdk to do user space network IO. But I cannot bind eth0 to vfio-pci.

My environment

  • vmware workstation 17 pro
  • Ubuntu 20.04
  • DPDK 20.11.3

What I have done

  1. setup two network card: eht0 (using vmxnet3 driver), eth1 (e1000 driver)
  2. disable eth0 using ifconfig eth0 down
  3. check devices with dpdk/usertools/dpdk-devbind.py --status and get
network devices using kernel driver
===================================
0000:02:02.0 '82545EM Gigabit Ethernet Controller (Copper) 100f' if=eth1 drv=e1000 unused=vfio-pci *Active*

Other Network devices
=====================
0000:03:00.0 'VMXNET3 Ethernet Controller 07b0' unused=vmxnet3,vfio-pci

No 'Baseband' devices detected
==============================

No 'Crypto' devices detected
============================

No 'DMA' devices detected
=========================

No 'Eventdev' devices detected
==============================

No 'Mempool' devices detected
=============================

No 'Compress' devices detected
==============================

No 'Misc (rawdev)' devices detected
===================================

No 'Regex' devices detected
===========================
  1. bind eth0 - 0000:03:00.0 to vfio-pci using dpdk/usertools/dpdk-devbind.py -b vfio-pci 0000:03:00.0 and get
Error: bind failed for 0000:03:00.0 - Cannot bind to driver vfio-pci: [Errno 22] Invalid argument
  1. I read the source code of dpdk-devbind.py and tried echo 0000:03:00.0 >> /sys/bus/pci/drivers/vfio-pci/bind and get error echo: write error: Invalid argument

My question is: what is wrong, and how to fix it?

Solve this problem. Bind network card to vfio-pci


Solution

  • You have to enable unsafe mode to bind via VFIO-pci if there is no IOMMU available on the system, VFIO can still be used, but it has to be loaded with an additional module parameter:

    modprobe vfio enable_unsafe_noiommu_mode=1
    

    Alternatively, one can also enable this option in an already loaded kernel module:

    echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode