test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V3] modify pci prefix error on freebsd V3
@ 2016-09-08  8:55 xu,gang
  2016-09-09  1:28 ` Liu, Yong
  0 siblings, 1 reply; 2+ messages in thread
From: xu,gang @ 2016-09-08  8:55 UTC (permalink / raw)
  To: dts; +Cc: xu,gang

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-09  1:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-08  8:55 [dts] [PATCH V3] modify pci prefix error on freebsd V3 xu,gang
2016-09-09  1:28 ` Liu, Yong

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).