[dts] [PATCH v3 02/27] framework dut and project_dpdk: using correct available binding scripts

Angela Czubak aczubak at caviumnetworks.com
Wed Apr 19 14:21:55 CEST 2017


Below patch makes scripts look for correct DPDK binding script,
checking whether 'usertools' or 'tools' directory is present and which
script exist in 'tools' directory ('dpdk-devbind.py' or
'dpdk_nic_bind.py'). Looking for correct pathc is done in get_dpdk_bind_script method.

Signed-off-by: Angela Czubak <aczubak at caviumnetworks.com>
---
 framework/dut.py          | 19 ++++++++++++++++---
 framework/project_dpdk.py |  6 ++++--
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/framework/dut.py b/framework/dut.py
index 9cbdaf7..deffa1d 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -356,6 +356,18 @@ class Dut(Crb):
         else:
             return False
 
+    def get_dpdk_bind_script(self):
+        op = self.send_command("ls")
+        if "usertools" in op:
+            res = 'usertools/dpdk-devbind.py'
+        else:
+            op = self.send_command("ls tools")
+            if "dpdk_nic_bind.py" in op:
+                res = 'tools/dpdk_nic_bind.py'
+            else:
+                res = 'tools/dpdk-devbind.py'
+        return res
+
     def bind_interfaces_linux(self, driver='igb_uio', nics_to_bind=None):
         """
         Bind the interfaces to the selected driver. nics_to_bind can be None
@@ -377,8 +389,8 @@ class Dut(Crb):
         if current_nic == 0:
             self.logger.info("Not nic need bind driver: %s" % driver)
             return
-
-        self.send_expect('usertools/dpdk-devbind.py %s' % binding_list, '# ')
+        bind_script_path = self.get_dpdk_bind_script()
+        self.send_expect('%s --force %s' % (bind_script_path, binding_list), '# ')
 
     def unbind_interfaces_linux(self, nics_to_bind=None):
         """
@@ -402,7 +414,8 @@ class Dut(Crb):
             self.logger.info("Not nic need unbind driver")
             return
 
-        self.send_expect('usertools/dpdk-devbind.py %s' % binding_list, '# ', 30)
+        bind_script_path = self.get_dpdk_bind_script()
+        self.send_expect('%s --force %s' % (bind_script_path, binding_list), '# ')
 
     def get_ports(self, nic_type='any', perf=None, socket=None):
         """
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index a0cb4c2..4dc6a8c 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -314,7 +314,8 @@ class DPDKdut(Dut):
                 binding_list += '%s ' % (port_info['pci'])
             current_nic += 1
 
-        self.send_expect('usertools/dpdk-devbind.py %s' % binding_list, '# ')
+        bind_script_path = self.get_dpdk_bind_script()
+        self.send_expect('%s --force %s' % (bind_script_path, binding_list), '# ')
 
     def unbind_interfaces_linux(self, nics_to_bind=None):
         """
@@ -329,7 +330,8 @@ class DPDKdut(Dut):
                 binding_list += '%s ' % (port_info['pci'])
             current_nic += 1
 
-        self.send_expect('usertools/dpdk-devbind.py %s' % binding_list, '# ', 30)
+        bind_script_path = self.get_dpdk_bind_script()
+        self.send_expect('%s --force %s' % (bind_script_path, binding_list), '# ')
 
     def build_dpdk_apps(self, folder, extra_options=''):
         """
-- 
2.7.4



More information about the dts mailing list