dpdk: Support of DPDK16.07-rc5 and newer 55/17555/1
authorMartin Klozik <martinx.klozik@intel.com>
Tue, 26 Jul 2016 11:16:17 +0000 (12:16 +0100)
committerMartin Klozik <martinx.klozik@intel.com>
Tue, 26 Jul 2016 11:22:02 +0000 (12:22 +0100)
DPDK 16.07-rc5 has renamed script tools/dpdk_nic_bind.py
to tools/dpdk-devbind.py. VSPERF was updated to use wildcard
in the script name, which is backward compatible.
Function get_version() from tools/systeminfo was updated
to correctly parse version information for DPDK v16. Version
name includes a minor version as defined inside rte_version.h.
It means, that for tag v16.07-rc5 VSPERF will show v16.07.0-rc5
in the report.

JIRA: VSPERF-333

Change-Id: I61a4ab2d90304fffdfc4d22a5cbf0cb7295402b3
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: <bmichalo@redhat.com>
src/dpdk/dpdk.py
tools/networkcard.py
tools/systeminfo.py
vnfs/qemu/qemu.py
vnfs/qemu/qemu_pci_passthrough.py

index 30f228f..477c1de 100644 (file)
@@ -14,7 +14,7 @@
 
 """Automation of system configuration for DPDK use.
 
-Parts of this based on ``tools/dpdk_nic_bind.py`` script from Intel(R)
+Parts of this based on ``tools/dpdk*bind.py`` script from Intel(R)
 DPDK.
 """
 
@@ -23,14 +23,15 @@ from sys import platform as _platform
 import os
 import subprocess
 import logging
+import glob
 
 from tools import tasks
 from conf import settings
 from tools.module_manager import ModuleManager
 
 _LOGGER = logging.getLogger(__name__)
-RTE_PCI_TOOL = os.path.join(
-    settings.getValue('RTE_SDK_USER'), 'tools', 'dpdk_nic_bind.py')
+RTE_PCI_TOOL = glob.glob(os.path.join(
+    settings.getValue('RTE_SDK_USER'), 'tools', 'dpdk*bind.py'))[0]
 
 _DPDK_MODULE_MANAGER = ModuleManager()
 
@@ -168,7 +169,7 @@ def _vhost_user_cleanup():
 
 
 def _bind_nics():
-    """Bind NICs using the Intel DPDK ``dpdk_nic_bind.py`` tool.
+    """Bind NICs using the Intel DPDK ``dpdk*bind.py`` tool.
     """
     try:
         _driver = 'igb_uio'
@@ -189,7 +190,7 @@ def _bind_nics():
         _LOGGER.error('Unable to bind NICs %s', str(_NICS_PCI))
 
 def _unbind_nics():
-    """Unbind NICs using the Intel DPDK ``dpdk_nic_bind.py`` tool.
+    """Unbind NICs using the Intel DPDK ``dpdk*bind.py`` tool.
     """
     try:
         tasks.run_task(['sudo', RTE_PCI_TOOL, '--unbind'] +
@@ -199,7 +200,7 @@ def _unbind_nics():
     except subprocess.CalledProcessError:
         _LOGGER.error('Unable to unbind NICs %s', str(_NICS_PCI))
     # Rebind NICs to their original drivers
-    # using the Intel DPDK ``dpdk_nic_bind.py`` tool.
+    # using the Intel DPDK ``dpdk*bind.py`` tool.
     for nic in _NICS:
         try:
             if nic['driver']:
index c31be69..8d704fd 100644 (file)
@@ -249,7 +249,7 @@ def reinit_vfs(pf_pci_handle):
 
     :param pf_pci_handle: PCI slot identifier of PF with domain part.
     """
-    rte_pci_tool = os.path.join(settings.getValue('RTE_SDK'), 'tools', 'dpdk_nic_bind.py')
+    rte_pci_tool = glob.glob(os.path.join(settings.getValue('RTE_SDK'), 'tools', 'dpdk*bind.py'))[0]
 
     for vf_nic in get_sriov_vfs_list(pf_pci_handle):
         nic_driver = get_driver(vf_nic)
index 9d8eb5c..50dc17e 100644 (file)
@@ -223,22 +223,45 @@ def get_version(app_name):
         app_git_tag = get_git_tag(S.getValue('OVS_DIR'))
     elif app_name.lower() in ['dpdk', 'testpmd']:
         tmp_ver = ['', '', '']
-        found = False
+        dpdk_16 = False
         with open(app_version_file['dpdk']) as file_:
             for line in file_:
                 if not line.strip():
                     continue
+                # DPDK version < 16
                 if line.startswith('#define RTE_VER_MAJOR'):
-                    found = True
                     tmp_ver[0] = line.rstrip('\n').split(' ')[2]
-                if line.startswith('#define RTE_VER_MINOR'):
-                    found = True
-                    tmp_ver[1] = line.rstrip('\n').split(' ')[2]
-                if line.startswith('#define RTE_VER_PATCH_LEVEL'):
-                    found = True
+                # DPDK version < 16
+                elif line.startswith('#define RTE_VER_PATCH_LEVEL'):
                     tmp_ver[2] = line.rstrip('\n').split(' ')[2]
-
-        if found:
+                # DPDK version < 16
+                elif line.startswith('#define RTE_VER_PATCH_RELEASE'):
+                    release = line.rstrip('\n').split(' ')[2]
+                    if not '16' in release:
+                        tmp_ver[2] += line.rstrip('\n').split(' ')[2]
+                # DPDK all versions
+                elif line.startswith('#define RTE_VER_MINOR'):
+                    if dpdk_16:
+                        tmp_ver[2] = line.rstrip('\n').split(' ')[2]
+                    else:
+                        tmp_ver[1] = line.rstrip('\n').split(' ')[2]
+                # DPDK all versions
+                elif line.startswith('#define RTE_VER_SUFFIX'):
+                    tmp_ver[2] += line.rstrip('\n').split('"')[1]
+                # DPDK version >= 16
+                elif line.startswith('#define RTE_VER_YEAR'):
+                    dpdk_16 = True
+                    tmp_ver[0] = line.rstrip('\n').split(' ')[2]
+                # DPDK version >= 16
+                elif line.startswith('#define RTE_VER_MONTH'):
+                    tmp_ver[1] = '{:0>2}'.format(line.rstrip('\n').split(' ')[2])
+                # DPDK version >= 16
+                elif line.startswith('#define RTE_VER_RELEASE'):
+                    release = line.rstrip('\n').split(' ')[2]
+                    if not '16' in release:
+                        tmp_ver[2] += line.rstrip('\n').split(' ')[2]
+
+        if len(tmp_ver[0]):
             app_version = '.'.join(tmp_ver)
         app_git_tag = get_git_tag(S.getValue('RTE_SDK'))
     elif app_name.lower().startswith('qemu'):
index 9382ede..02ada4b 100644 (file)
@@ -338,16 +338,16 @@ class IVnfQemu(IVnf):
         self.execute_and_wait('modprobe uio')
         self.execute_and_wait('insmod %s/kmod/igb_uio.ko' %
                               S.getValue('RTE_TARGET'))
-        self.execute_and_wait('./tools/dpdk_nic_bind.py --status')
+        self.execute_and_wait('./tools/dpdk*bind.py --status')
         self.execute_and_wait(
-            './tools/dpdk_nic_bind.py -u' ' ' +
+            './tools/dpdk*bind.py -u' ' ' +
             S.getValue('GUEST_NET1_PCI_ADDRESS')[self._number] + ' ' +
             S.getValue('GUEST_NET2_PCI_ADDRESS')[self._number])
         self.execute_and_wait(
-            './tools/dpdk_nic_bind.py -b igb_uio' ' ' +
+            './tools/dpdk*bind.py -b igb_uio' ' ' +
             S.getValue('GUEST_NET1_PCI_ADDRESS')[self._number] + ' ' +
             S.getValue('GUEST_NET2_PCI_ADDRESS')[self._number])
-        self.execute_and_wait('./tools/dpdk_nic_bind.py --status')
+        self.execute_and_wait('./tools/dpdk*bind.py --status')
 
         # build and run 'test-pmd'
         self.execute_and_wait('cd ' + S.getValue('GUEST_OVS_DPDK_DIR') +
index 1b55fdf..14810f0 100644 (file)
@@ -19,6 +19,7 @@
 import logging
 import subprocess
 import os
+import glob
 
 from conf import settings as S
 from vnfs.qemu.qemu import IVnfQemu
@@ -26,7 +27,7 @@ from tools import tasks
 from tools.module_manager import ModuleManager
 
 _MODULE_MANAGER = ModuleManager()
-_RTE_PCI_TOOL = os.path.join(S.getValue('RTE_SDK'), 'tools', 'dpdk_nic_bind.py')
+_RTE_PCI_TOOL = glob.glob(os.path.join(S.getValue('RTE_SDK'), 'tools', 'dpdk*bind.py'))[0]
 
 class QemuPciPassthrough(IVnfQemu):
     """