test suite reviews and discussions
 help / color / mirror / Atom feed
From: "xu,gang" <gangx.xu@intel.com>
To: dts@dpdk.org
Cc: "xu,gang" <gangx.xu@intel.com>
Subject: [dts] [PATCH V3] modify pci prefix error on freebsd V3
Date: Thu,  8 Sep 2016 16:55:47 +0800	[thread overview]
Message-ID: <1473324947-8753-1-git-send-email-gangx.xu@intel.com> (raw)

Signed-off-by: xu,gang <gangx.xu@intel.com>
---
 framework/crb.py   |  2 +-
 framework/dut.py   | 14 +++++++-------
 nics/net_device.py | 17 +++++++++--------
 3 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/framework/crb.py b/framework/crb.py
index 066bb3f..51946f5 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -281,7 +281,7 @@ class Crb(object):
             return None
         return match.group(1)
 
-    def get_pci_dev_driver_freebsd(self, bus_id, devfun_id):
+    def get_pci_dev_driver_freebsd(self, domain_id, bus_id, devfun_id):
         """
         Get the driver of specified pci device.
         """
diff --git a/framework/dut.py b/framework/dut.py
index 2f4e53a..86923d1 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -229,10 +229,7 @@ class Dut(Crb):
         """
         After all execution done, some special nic like fm10k should be stop
         """
-        for port in self.ports_info:
-            pci_bus = port['pci']
-            pci_id = port['type']
-            # get device driver
+        for (pci_bus, pci_id) in self.pci_devices_info:
             driver = settings.get_nic_driver(pci_id)
             if driver is not None:
                 # unbind device driver
@@ -718,15 +715,18 @@ class Dut(Crb):
         self.ports_info = []
 
         skipped = RED('Skipped: Unknown/not selected')
-
+        
         for (pci_bus, pci_id) in self.pci_devices_info:
 
             if not dts.accepted_nic(pci_id):
                 self.logger.info("DUT: [%s %s] %s" % (pci_bus, pci_id,
                                                       skipped))
                 continue
-
-            port = GetNicObj(self, pci_bus, '')
+            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)
             intf = port.get_interface_name()
 
             macaddr = port.get_mac_addr()
diff --git a/nics/net_device.py b/nics/net_device.py
index 897ceb9..be25ab7 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -136,7 +136,7 @@ class NetDevice(object):
             socket = -1
         return socket
 
-    def get_nic_socket_freebsd(self, bus_id, devfun_id):
+    def get_nic_socket_freebsd(self, domain_id, bus_id, devfun_id):
         NotImplemented
 
     @nic_has_driver
@@ -200,7 +200,7 @@ class NetDevice(object):
             domain_id, bus_id, devfun_id)
         return self.__send_expect(command, '# ')
 
-    def get_interface_name_freebsd(self, bus_id, devfun_id, driver):
+    def get_interface_name_freebsd(self, domain_id, bus_id, devfun_id, driver):
         """
         Get interface name of specified pci device on Freebsd.
         """
@@ -212,14 +212,15 @@ class NetDevice(object):
             get_interface_name_freebsd = getattr(self,
                                                  'get_interface_name_freebsd_%s' % generic_driver)
 
-        return get_interface_name_freebsd(bus_id, devfun_id)
+        return get_interface_name_freebsd(domain_id, bus_id, devfun_id)
 
-    def get_interface_name_freebsd_generic(self, bus_id, devfun_id):
+    def get_interface_name_freebsd_generic(self, domain_id, bus_id, devfun_id):
         """
         Get the interface name by the default way on freebsd.
         """
+        pci_str = "%s:%s:%s" % (domain_id, bus_id, devfun_id) 
         out = self.__send_expect("pciconf -l", "# ")
-        rexp = r"(\w*)@pci0:%s" % bus_id
+        rexp = r"(\w*)@pci0:%s" % pci_str
         pattern = re.compile(rexp)
         match = pattern.findall(out)
         if len(match) == 0:
@@ -307,7 +308,7 @@ class NetDevice(object):
                    (domain_id, bus_id, devfun_id, virtio, intf))
         return self.__send_expect(command, '# ')
 
-    def get_mac_addr_freebsd(self, intf, bus_id, devfun_id, driver):
+    def get_mac_addr_freebsd(self, intf, domain_id, bus_id, devfun_id, driver):
         """
         Get mac address of specified pci device on Freebsd.
         """
@@ -323,9 +324,9 @@ class NetDevice(object):
                 'get_mac_addr_freebsd_%s' %
                 generic_driver)
 
-        return get_mac_addr_freebsd(intf, bus_id, devfun_id)
+        return get_mac_addr_freebsd(intf, domain_id, bus_id, devfun_id)
 
-    def get_mac_addr_freebsd_generic(self, intf, bus_id, devfun_id):
+    def get_mac_addr_freebsd_generic(self, intf, domain_id, bus_id, devfun_id):
         """
         Get the MAC by the default way on Freebsd.
         """
-- 
1.9.3

             reply	other threads:[~2016-09-08  9:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08  8:55 xu,gang [this message]
2016-09-09  1:28 ` Liu, Yong

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=1473324947-8753-1-git-send-email-gangx.xu@intel.com \
    --to=gangx.xu@intel.com \
    --cc=dts@dpdk.org \
    /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).