test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH] fix strip virtio-pci device information failure
Date: Fri, 26 Jun 2015 13:27:50 +0800	[thread overview]
Message-ID: <1435296470-25633-1-git-send-email-yong.liu@intel.com> (raw)

From: Marvin Liu <yong.liu@intel.com>

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/dut.py b/framework/dut.py
index 7a47fe3..662b570 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -519,12 +519,7 @@ class Dut(Crb):
         unknow_interface = RED('Skipped: unknow_interface')
 
         for port_info in self.ports_info:
-            pci_bus = port_info['pci']
-            addr_array = pci_bus.split(':')
-            bus_id = addr_array[0]
-            devfun_id = addr_array[1]
-
-            port = NetDevice(self, bus_id, devfun_id)
+            port = port_info['port']
             intf = port.get_interface_name()
             if "No such file" in intf:
                 self.logger.info("DUT: [0000:%s] %s" % (pci_bus, unknow_interface))
@@ -598,7 +593,7 @@ class Dut(Crb):
             devfun_id = addr_array[1]
 
             port = NetDevice(self, bus_id, devfun_id)
-            numa = self.get_device_numa(bus_id, devfun_id)
+            numa = port.socket
             # store the port info to port mapping
             self.ports_info.append(
                 {'port': port, 'pci': pci_bus, 'type': pci_id, 'numa': numa})
diff --git a/framework/net_device.py b/framework/net_device.py
index b8d785e..2681785 100644
--- a/framework/net_device.py
+++ b/framework/net_device.py
@@ -136,11 +136,12 @@ class NetDevice(object):
         """
         Get interface name of specified pci device on linux.
         """
+        driver_alias = driver.replace('-', '_')
         try:
             get_interface_name_linux = getattr(
                 self,
                 'get_interface_name_linux_%s' %
-                driver)
+                driver_alias)
         except Exception as e:
             generic_driver = 'generic'
             get_interface_name_linux = getattr(self,
@@ -148,6 +149,14 @@ class NetDevice(object):
 
         return get_interface_name_linux(bus_id, devfun_id)
 
+    def get_interface_name_linux_virtio_pci(self, bus_id, devfun_id):
+        """
+        Get virtio device interface name by the default way on linux.
+        """
+        command = 'ls --color=never /sys/bus/pci/devices/0000\:%s\:%s/virtio*/net' % (
+            bus_id, devfun_id)
+        return self.__send_expect(command, '# ')
+
     def get_interface_name_linux_generic(self, bus_id, devfun_id):
         """
         Get the interface name by the default way on linux.
@@ -192,11 +201,12 @@ class NetDevice(object):
         """
         Get mac address of specified pci device on linux.
         """
+        driver_alias = driver.replace('-', '_')
         try:
             get_mac_addr_linux = getattr(
                 self,
                 'get_mac_addr_linux_%s' %
-                driver)
+                driver_alias)
         except Exception as e:
             generic_driver = 'generic'
             get_mac_addr_linux = getattr(
@@ -225,6 +235,18 @@ class NetDevice(object):
                    (bus_id, devfun_id, intf))
         return self.__send_expect(command, '# ')
 
+    def get_mac_addr_linux_virtio_pci(self, intf, bus_id, devfun_id, driver):
+        """
+        Get MAC by the default way on linux.
+        """
+        virtio_cmd = ('ls /sys/bus/pci/devices/0000\:%s\:%s/ | grep --color=never virtio' %
+                    (bus_id, devfun_id))
+        virtio = self.__send_expect(virtio_cmd, '# ')
+
+        command = ('cat /sys/bus/pci/devices/0000\:%s\:%s/%s/net/%s/address' %
+                   (bus_id, devfun_id, virtio, intf))
+        return self.__send_expect(command, '# ')
+
     def get_mac_addr_freebsd(self, intf, bus_id, devfun_id, driver):
         """
         Get mac address of specified pci device on Freebsd.
diff --git a/framework/settings.py b/framework/settings.py
index 9923b0c..42667bb 100644
--- a/framework/settings.py
+++ b/framework/settings.py
@@ -90,7 +90,7 @@ DRIVERS = {
     '82540EM': 'igb',
     'springville': 'igb',
     'springfountain': 'ixgbe',
-    'virtio': 'igb',
+    'virtio': 'virtio-pci',
     'avoton': 'igb',
     'avoton2c5': 'igb',
     'I217V': 'igb',
-- 
1.9.3

                 reply	other threads:[~2015-06-26  5:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1435296470-25633-1-git-send-email-yong.liu@intel.com \
    --to=yong.liu@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).