test suite reviews and discussions
 help / color / mirror / Atom feed
From: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
To: dts@dpdk.org, yong.liu@intel.com
Cc: herbert.guan@arm.com, Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
Subject: [dts] [PATCH 1/2] framework/dut: fixing misconception about nic pci driver name and driver module filename
Date: Tue, 12 Dec 2017 15:35:13 +0100	[thread overview]
Message-ID: <1513089314-12719-1-git-send-email-radoslaw.biernacki@linaro.org> (raw)

.name field from pci_driver structure in kernel is used for sysfs while driver
file name is defined by module Makefile. There is no rule that those two are the
same. As an example we have /sys/bus/pci/drivers/thunder-nicvf/ and nicvf.ko.
This difference make confusion in DTS scripts as it asumed that pci driver name
is equal to kernel driver module name.

Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
---
 framework/dut.py          |   4 +-
 framework/project_dpdk.py |   2 +-
 framework/settings.py     | 107 ++++++++++++++++++++++++----------------------
 framework/test_case.py    |   2 +-
 4 files changed, 60 insertions(+), 55 deletions(-)

diff --git a/framework/dut.py b/framework/dut.py
index 22ff0bb..6b89439 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -259,7 +259,7 @@ class Dut(Crb):
             pci_bus = port['pci']
             pci_id = port['type']
             # get device driver
-            driver = settings.get_nic_driver(pci_id)
+            driver, driver_module = settings.get_nic_driver_module(pci_id)
             if driver is not None:
                 # unbind device driver
                 addr_array = pci_bus.split(':')
@@ -272,7 +272,7 @@ class Dut(Crb):
                 self.send_expect('echo %s > /sys/bus/pci/devices/%s\:%s\:%s/driver/unbind'
                                  % (pci_bus, domain_id, bus_id, devfun_id), '# ')
                 # bind to linux kernel driver
-                self.send_expect('modprobe %s' % driver, '# ')
+                self.send_expect('modprobe %s' % driver_module, '# ')
                 self.send_expect('echo %s > /sys/bus/pci/drivers/%s/bind'
                                  % (pci_bus, driver), '# ')
                 itf = port.get_interface_name()
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index 6bc47f2..8de5218 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -73,7 +73,7 @@ class DPDKdut(Dut):
 
         # Enable MLNX driver before installing dpdk
         drivername = load_global_setting(HOST_DRIVER_SETTING)
-        if drivername == DRIVERS['ConnectX4']:
+        if drivername == DRIVERS['ConnectX4'][0]:
             self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_MLX5_PMD=n/"
                              + "CONFIG_RTE_LIBRTE_MLX5_PMD=y/' config/common_base", "# ", 30)
 
diff --git a/framework/settings.py b/framework/settings.py
index e5b7746..1ab7908 100644
--- a/framework/settings.py
+++ b/framework/settings.py
@@ -95,51 +95,53 @@ NICS = {
     'cavium_0011': '177d:0011',
 }
 
+NICS_REV = dict(zip(NICS.values(), NICS.keys()))
+
 DRIVERS = {
-    'kawela': 'igb',
-    'kawela_2': 'igb',
-    'kawela_4': 'igb',
-    'bartonhills': 'igb',
-    'powerville': 'igb',
-    'powerville_vf': 'igbvf',
-    'ophir': 'igb',
-    'niantic': 'ixgbe',
-    'niantic_vf': 'ixgbevf',
-    'ironpond': 'ixgbe',
-    'twinpond': 'ixgbe',
-    'twinville': 'ixgbe',
-    'sageville': 'ixgbe',
-    'sageville_vf': 'ixgbevf',
-    'sagepond': 'ixgbe',
-    'sagepond_vf': 'ixgbevf',
-    'magnolia_park' : 'ixgbe',
-    'hartwell': 'igb',
-    '82545EM': 'igb',
-    '82540EM': 'igb',
-    'springville': 'igb',
-    'springfountain': 'ixgbe',
-    'virtio': 'virtio-pci',
-    'avoton': 'igb',
-    'avoton2c5': 'igb',
-    'I217V': 'igb',
-    'I217LM': 'igb',
-    'I218V': 'igb',
-    'I218LM': 'igb',
-    'fortville_eagle': 'i40e',
-    'fortville_spirit': 'i40e',
-    'fortville_spirit_single': 'i40e',
-    'redrockcanyou': 'fm10k',
-    'fortpark': 'i40e',
-    'fortpark_TLV': 'i40e',
-    'fortpark_TLV_vf': 'i40evf',
-    'fvl10g_vf': 'i40evf',
-    'atwood': 'fm10k',
-    'ConnectX3': 'mlx4_core',
-    'ConnectX4': 'mlx5_core',
-    'boulderrapid': 'fm10k',
-    'fortville_25g': 'i40e',
-    'cavium_a034': 'thunder-nicvf',
-    'cavium_0011': 'thunder-nicvf',
+    'kawela': ['igb', 'igb'],
+    'kawela_2': ['igb', 'igb'],
+    'kawela_4': ['igb', 'igb'],
+    'bartonhills': ['igb', 'igb'],
+    'powerville': ['igb', 'igb'],
+    'powerville_vf': ['igbvf', 'igbvf'],
+    'ophir': ['igb', 'igb'],
+    'niantic': ['ixgbe', 'ixgbe'],
+    'niantic_vf': ['ixgbevf', 'ixgbevf'],
+    'ironpond': ['ixgbe', 'ixgbe'],
+    'twinpond': ['ixgbe', 'ixgbe'],
+    'twinville': ['ixgbe', 'ixgbe'],
+    'sageville': ['ixgbe', 'ixgbe'],
+    'sageville_vf': ['ixgbevf', 'ixgbevf'],
+    'sagepond': ['ixgbe', 'ixgbe'],
+    'sagepond_vf': ['ixgbevf', 'ixgbevf'],
+    'magnolia_park' : ['ixgbe', 'ixgbe'],
+    'hartwell': ['igb', 'igb'],
+    '82545EM': ['igb', 'igb'],
+    '82540EM': ['igb', 'igb'],
+    'springville': ['igb', 'igb'],
+    'springfountain': ['ixgbe', 'ixgbe'],
+    'virtio': ['virtio-pci', 'virtio-pci'],
+    'avoton': ['igb', 'igb'],
+    'avoton2c5': ['igb', 'igb'],
+    'I217V': ['igb', 'igb'],
+    'I217LM': ['igb', 'igb'],
+    'I218V': ['igb', 'igb'],
+    'I218LM': ['igb', 'igb'],
+    'fortville_eagle': ['i40e', 'i40e'],
+    'fortville_spirit': ['i40e', 'i40e'],
+    'fortville_spirit_single': ['i40e', 'i40e'],
+    'redrockcanyou': ['fm10k', 'fm10k'],
+    'fortpark': ['i40e', 'i40e'],
+    'fortpark_TLV': ['i40e', 'i40e'],
+    'fortpark_TLV_vf': ['i40evf', 'i40evf'],
+    'fvl10g_vf': ['i40evf', 'i40evf'],
+    'atwood': ['fm10k', 'fm10k'],
+    'ConnectX3': ['mlx4_core', 'mlx4_core'],
+    'ConnectX4': ['mlx5_core', 'mlx5_core'],
+    'boulderrapid': ['fm10k', 'fm10k'],
+    'fortville_25g': ['i40e', 'i40e'],
+    'cavium_a034': ['thunder-nicvf', 'nicvf'],
+    'cavium_0011': ['thunder-nicvf', 'nicvf'],
 }
 
 """
@@ -234,17 +236,20 @@ def get_nic_name(type):
             return name
     return 'Unknown'
 
-
-def get_nic_driver(pci_id):
+def get_nic_driver_module(pci_id):
     """
-    Return linux driver for specified pci device
+    Return linux driver name and driver module for specified pci device
     """
-    driverlist = dict(zip(NICS.values(), DRIVERS.keys()))
     try:
-        driver = DRIVERS[driverlist[pci_id]]
+        driver_name, driver_module = DRIVERS[NICS_REV[pci_id]]
     except Exception as e:
-        driver = None
-    return driver
+        driver_name = None
+        driver_module = None
+    return driver_name, driver_module
+
+
+def get_nic_driver(pci_id):
+   return get_nic_driver_module(pci_id)[0]
 
 
 def get_netdev(crb, pci):
diff --git a/framework/test_case.py b/framework/test_case.py
index a84e2bb..a8643da 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -156,7 +156,7 @@ class TestCase(object):
 
     def _get_nic_driver(self, nic_name):
         if nic_name in DRIVERS.keys():
-            return DRIVERS[nic_name]
+            return DRIVERS[nic_name][0]
 
         return "Unknown"
 
-- 
2.7.4

             reply	other threads:[~2017-12-12 14:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12 14:35 Radoslaw Biernacki [this message]
2017-12-12 14:35 ` [dts] [PATCH 2/2] framework/dut: Style and clean up Radoslaw Biernacki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513089314-12719-1-git-send-email-radoslaw.biernacki@linaro.org \
    --to=radoslaw.biernacki@linaro.org \
    --cc=dts@dpdk.org \
    --cc=herbert.guan@arm.com \
    --cc=yong.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).