[dpdk-dev] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue

Message ID 82F45D86ADE5454A95A89742C8D1410E01CC7E49@shsmsx102.ccr.corp.intel.com (mailing list archive)
State Not Applicable, archived
Headers

Commit Message

Xu, Qian Q Feb. 26, 2015, 5:52 a.m. UTC
  Tested-by: Qian Xu <qian.q.xu@intel.com>

- Tested Commit: b67578ccdf45df9fd0f0204578b71acd854ca834
- OS: Fedora20 3.11
- GCC: gcc version 4.8.3 20140624
- CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
- NIC: Intel 82599 Ethernet 10G SFI/SFP+ Network Connection
- Default x86_64-native-linuxapp-gcc configuration
- Total 1 case, 1 passed, 0 failed

- Case: bind virtio-pci driver when igb_uio is removed
Steps:   
1. Bind virtio port to igb_uio driver;
2. Remove igb_uio module;
3. Bind virtio port to virtio-pci driver, it can be binded to virtio-pci driver and also have a warning that no supported modules(DPDK Driver) are loaded.
   
Signed-off-by: Qian Xu <qian.q.xu@intel.com>
 
-----Original Message-----
From: Ouyang, Changchun 
Sent: Thursday, February 26, 2015 12:58 PM
To: dev@dpdk.org
Cc: Richardson, Bruce; Cao, Waterman; Ouyang, Changchun
Subject: [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue

In virtio test, on guest
1. Bind virtio port to igb_uio driver;
2. Remove igb_uio module;
3. Bind virtio port to virtio-pci driver, it fails and reports:
   "Error - no supported modules are loaded"

The tool should check the to-be-bound driver flag, if it is dpdk driver(igb_uio, vfio etc), and the corresponding module is not loaded, then exit, otherwise, just report a warning, and continue to bind the non-dpdk driver(like virtio-pci) to dev.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
 tools/dpdk_nic_bind.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--
1.8.4.2
  

Patch

diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py index 2483056..8523f82 100755
--- a/tools/dpdk_nic_bind.py
+++ b/tools/dpdk_nic_bind.py
@@ -175,8 +175,11 @@  def check_modules():
 
     # check if we have at least one loaded module
     if True not in [mod["Found"] for mod in mods] and b_flag is not None:
-        print "Error - no supported modules are loaded"
-        sys.exit(1)
+        if b_flag in dpdk_drivers:
+            print "Error - no supported modules(DPDK driver) are loaded"
+            sys.exit(1)
+        else:
+            print "Warning - no supported modules(DPDK driver) are loaded"
 
     # change DPDK driver list to only contain drivers that are loaded
     dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]]