From 90c88873e54d100a944761f69a998085cae3f14b Mon Sep 17 00:00:00 2001 From: Yichen Wang Date: Sat, 4 Mar 2017 23:58:41 -0800 Subject: Use vfio-pci as DPDK driver if prerequisites are satisfied Change-Id: Ic43742256e3f69361d0413b672341f1ea4cc02fc Signed-off-by: Yichen Wang Conflicts: scripts/dpdk_setup_ports.py --- scripts/dpdk_setup_ports.py | 4 +++- scripts/trex-cfg | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/dpdk_setup_ports.py b/scripts/dpdk_setup_ports.py index bf6d171d..6eb7481d 100755 --- a/scripts/dpdk_setup_ports.py +++ b/scripts/dpdk_setup_ports.py @@ -24,6 +24,8 @@ import platform # 32 : no errors - mlx share object should be loaded MLX_EXIT_CODE = 32 +out = subprocess.check_output(['lsmod']) +DPDK_DRIVER = 'vfio-pci' if out.find('vfio_pci') != -1 else 'igb_uio' class ConfigCreator(object): mandatory_interface_fields = ['Slot_str', 'Device_str', 'NUMA'] @@ -444,7 +446,7 @@ Other network devices if mellanox: drv="mlx5_core" else: - drv="igb_uio" + drv=DPDK_DRIVER cmd='%s dpdk_nic_bind.py --bind=%s %s ' % (sys.executable, drv,key) print(cmd) diff --git a/scripts/trex-cfg b/scripts/trex-cfg index aaaa2a32..5945a074 100755 --- a/scripts/trex-cfg +++ b/scripts/trex-cfg @@ -45,7 +45,10 @@ done PATH=$PATH:/sbin:/usr/sbin -if ! lsmod | grep -q igb_uio ; then +VFIO_PCI_KO=`find /lib/modules/$(uname -r) -type f -name vfio-pci.ko` +if [ $VFIO_PCI_KO ] && grep "iommu=pt" /proc/cmdline | grep -q "intel_iommu=on" ; then + modprobe vfio-pci +elif ! lsmod | grep -q igb_uio ; then echo "Loading kernel drivers for the first time" modprobe uio if [ $? -ne 0 ]; then -- cgit 1.2.3-korg