From: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
To: dts@dpdk.org, yong.liu@intel.com, aczubak@caviumnetworks.com
Cc: herbert.guan@linaro.org,
Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
Subject: [dts] [PATCH 2/4] framework: Fixing unnamed interface detection
Date: Fri, 1 Dec 2017 22:20:52 +0100 [thread overview]
Message-ID: <1512163254-31552-3-git-send-email-radoslaw.biernacki@linaro.org> (raw)
In-Reply-To: <1512163254-31552-1-git-send-email-radoslaw.biernacki@linaro.org>
This patch fixes interface name detection broken in one of previous commits.
With introduction of mentioned commit, when interface has no name
get_interface_name() returns "N/A" instead of "No such file".
Fixes: f3e7b094176d ("fix bug that unbound device then run dts will show wrong interface")
Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
---
framework/dut.py | 46 +++++++++++++++++++++++-----------------------
framework/tester.py | 5 ++++-
2 files changed, 27 insertions(+), 24 deletions(-)
diff --git a/framework/dut.py b/framework/dut.py
index 22ff0bb..c83377a 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -260,25 +260,29 @@ class Dut(Crb):
pci_id = port['type']
# get device driver
driver = settings.get_nic_driver(pci_id)
- if driver is not None:
- # unbind device driver
- addr_array = pci_bus.split(':')
- domain_id = addr_array[0]
- bus_id = addr_array[1]
- devfun_id = addr_array[2]
+ if driver is None:
+ self.logger.info("NOT FOUND DRIVER FOR PORT (%s|%s)!!!" % (pci_bus, pci_id))
+ continue
+ # unbind device driver
+ addr_array = pci_bus.split(':')
+ domain_id = addr_array[0]
+ bus_id = addr_array[1]
+ devfun_id = addr_array[2]
- port = GetNicObj(self, domain_id, bus_id, devfun_id)
+ port = GetNicObj(self, domain_id, bus_id, devfun_id)
- 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('echo %s > /sys/bus/pci/drivers/%s/bind'
- % (pci_bus, driver), '# ')
- itf = port.get_interface_name()
- self.send_expect("ifconfig %s up" % itf, "# ")
- else:
- self.logger.info("NOT FOUND DRIVER FOR PORT (%s|%s)!!!" % (pci_bus, pci_id))
+ 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('echo %s > /sys/bus/pci/drivers/%s/bind'
+ % (pci_bus, driver), '# ')
+ itf = port.get_interface_name()
+
+ if "N/A" in itf:
+ self.logger.warning("Cannot bring up the interface due missing inf name")
+ continue
+ self.send_expect("ifconfig %s up" % itf, "# ")
def setup_memory(self, hugepages=-1):
"""
@@ -619,7 +623,7 @@ class Dut(Crb):
for port_info in self.ports_info:
port = port_info['port']
intf = port.get_interface_name()
- if "No such file" in intf:
+ if "N/A" in intf:
self.logger.info("DUT: [%s] %s" % (pci_bus, unknow_interface))
continue
self.send_expect("ifconfig %s up" % intf, "# ")
@@ -717,15 +721,11 @@ class Dut(Crb):
port = GetNicObj(self, domain_id, bus_id, devfun_id)
intf = port.get_interface_name()
- if "No such file" in intf:
+ if "N/A" in intf:
self.logger.info("DUT: [%s] %s" % (pci_bus, unknow_interface))
continue
macaddr = port.get_mac_addr()
- if "No such file" in intf:
- self.logger.info("DUT: [%s] %s" % (pci_bus, unknow_interface))
- continue
-
numa = port.socket
# store the port info to port mapping
self.ports_info.append(
diff --git a/framework/tester.py b/framework/tester.py
index 1c854d7..b612cf1 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -237,6 +237,9 @@ class Tester(Crb):
addr_array = pci_bus.split(':')
port = GetNicObj(self, addr_array[0], addr_array[1], addr_array[2])
itf = port.get_interface_name()
+ if "N/A" in itf:
+ self.logger.warning("Cannot bring up the interface due missing inf name")
+ continue
self.enable_ipv6(itf)
self.send_expect("ifconfig %s up" % itf, "# ")
if port.get_interface2_name():
@@ -340,7 +343,7 @@ class Tester(Crb):
port = GetNicObj(self, domain_id, bus_id, devfun_id)
intf = port.get_interface_name()
- if "No such file" in intf:
+ if "N/A" in intf:
self.logger.info("Tester: [%s %s] %s" % (pci_bus, pci_id,
"unknow_interface"))
continue
--
2.7.4
next prev parent reply other threads:[~2017-12-01 21:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-01 21:20 [dts] [PATCH 0/4] ThunderX DTS initialization phase fixes Radoslaw Biernacki
2017-12-01 21:20 ` [dts] [PATCH 1/4] framework/crb: Fixing ThunderX ethernet controler detection Radoslaw Biernacki
2017-12-04 10:44 ` Radoslaw Biernacki
[not found] ` <CY4PR07MB2920B4D6EB1565292042CC4CF43C0@CY4PR07MB2920.namprd07.prod.outlook.com>
2017-12-04 13:57 ` Radoslaw Biernacki
2017-12-05 1:45 ` Liu, Yong
2017-12-01 21:20 ` Radoslaw Biernacki [this message]
2017-12-01 21:20 ` [dts] [PATCH 3/4] framework/dut: fixing mixed tab and space python indention Radoslaw Biernacki
2017-12-01 21:20 ` [dts] [PATCH 4/4] framework/dut: Adding exception in case ports_map is empty 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=1512163254-31552-3-git-send-email-radoslaw.biernacki@linaro.org \
--to=radoslaw.biernacki@linaro.org \
--cc=aczubak@caviumnetworks.com \
--cc=dts@dpdk.org \
--cc=herbert.guan@linaro.org \
--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).