From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by dpdk.org (Postfix) with ESMTP id CFBC31D90 for ; Tue, 12 Dec 2017 15:35:50 +0100 (CET) Received: by mail-lf0-f67.google.com with SMTP id f20so23459486lfe.3 for ; Tue, 12 Dec 2017 06:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=tx5j14lrETJRANEDgUSHFHN76+/kMg2E/mV1c2xnRc8=; b=e0SeNNfEoUXOQCP0lga/tnpId+lGbjGYlrgxYb3mKgNpot0vlex8rYG8+35QptYe9N D0zTIBnkI7KVOwrq+RcMSpCkn97+jYbeEYOUkaj6+0vav6XUPCpLgSZZdOe6kqlWS/vK SUrQ5KY/sNBEZWC4K3LHDVsqu0R+JoUqGZXxA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tx5j14lrETJRANEDgUSHFHN76+/kMg2E/mV1c2xnRc8=; b=Yvdra+ycGVZJxZl7ucMZ7ApCdkYl4mSR0ZYZCzeQT8O6NvtedUI/JTmF2dJbluqPmB /93tb4LeDYt6w/elJgVZbLB7Ibj1F/hg115wbkprXid2vExsdUQ3aOrGgsJmdhUaYUaU ZjSBwk/YlcbUOaiKrttoKlNNjiUfaTV18tkcFML1/4IuACh1Hc62zjdlQXDqww/e08uY R4YXD6PkHmj/HhtgAN7umFFRR/xzryyGtRHG3WcBFCl+eWPd/BoSUyk7a2exIej7w8wn iDkT5WynH7HyjpLMjuIoAqvYCDTJa/EwktdJuS/G6XqTlHxDi+AgixWhxTDj2ehaD7oO p1zQ== X-Gm-Message-State: AKGB3mLdBVyTsGXWPvGh9ZJksKuo+m+pnEho4hG0gwEiKyoNPkqqmx7d g9m8gkXYVtRMe/YfHAhNymefest3l1I= X-Google-Smtp-Source: ACJfBovv9QEJhiRghZpnXrIGrL7ScXKR//WmzdJ+clWU5ujcynAHjUT5SDmIMTmrnZzkWO0nQD1obQ== X-Received: by 10.25.79.14 with SMTP id d14mr1753745lfb.174.1513089350168; Tue, 12 Dec 2017 06:35:50 -0800 (PST) Received: from rad-H81M-S1.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id g15sm3212933lfj.21.2017.12.12.06.35.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Dec 2017 06:35:49 -0800 (PST) From: Radoslaw Biernacki To: dts@dpdk.org, yong.liu@intel.com Cc: herbert.guan@arm.com, Radoslaw Biernacki Date: Tue, 12 Dec 2017 15:35:13 +0100 Message-Id: <1513089314-12719-1-git-send-email-radoslaw.biernacki@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH 1/2] framework/dut: fixing misconception about nic pci driver name and driver module filename X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Dec 2017 14:35:51 -0000 .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 --- 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