test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH 1/3] Strip hugepage mount directory and netdev numa id for vxlan sample.
@ 2015-06-04  7:21 Yong Liu
  2015-06-04  7:21 ` [dts] [PATCH 2/3] Add vxlan sample test plan Yong Liu
  2015-06-04  7:21 ` [dts] [PATCH 3/3] Add vxlan sample test suite Yong Liu
  0 siblings, 2 replies; 3+ messages in thread
From: Yong Liu @ 2015-06-04  7:21 UTC (permalink / raw)
  To: dts

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

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

diff --git a/framework/crb.py b/framework/crb.py
index 7a86b31..c4553b6 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -101,6 +101,14 @@ class Crb(object):
         self.send_expect('mkdir -p /mnt/huge', '# ')
         self.send_expect('mount -t hugetlbfs nodev /mnt/huge', '# ')
 
+    def strip_hugepage_path(self):
+        mounts = self.send_expect("cat /proc/mounts |grep hugetlbfs", "# ")
+        infos = mounts.split()
+        if len(infos) >= 2:
+            return infos[1]
+        else:
+            return ''
+
     def set_huge_pages(self, huge_pages, numa=-1):
         """
         Set numbers of huge pages
diff --git a/framework/dut.py b/framework/dut.py
index caaae62..a9b4ed0 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -258,6 +258,8 @@ class Dut(Crb):
         """
         Setup Linux hugepages.
         """
+        if self.virttype == 'XEN':
+            return
         hugepages_size = self.send_expect("awk '/Hugepagesize/ {print $2}' /proc/meminfo", "# ")
 
         if int(hugepages_size) < (1024 * 1024):
@@ -275,6 +277,8 @@ class Dut(Crb):
             if total_huge_pages != arch_huge_pages:
                 self.set_huge_pages(arch_huge_pages)
 
+            self.hugepage_path = self.strip_hugepage_path()
+
     def setup_memory_freebsd(self, hugepages=-1):
         """
         Setup Freebsd hugepages.
diff --git a/framework/net_device.py b/framework/net_device.py
index 0e6614f..b8d785e 100644
--- a/framework/net_device.py
+++ b/framework/net_device.py
@@ -60,6 +60,7 @@ class NetDevice(object):
         if self.nic_is_pf():
             self.default_vf_driver = ''
         self.intf_name = self.get_interface_name()
+        self.socket = self.get_nic_socket()
 
     def __send_expect(self, cmds, expected, timeout=TIMEOUT, alt_session=True):
         """
@@ -98,6 +99,29 @@ class NetDevice(object):
         """
         return self.crb.get_pci_dev_driver(self.bus_id, self.devfun_id)
 
+    def get_nic_socket(self):
+        """
+        Get socket id of specified pci device.
+        """
+        get_nic_socket = getattr(
+            self, 'get_nic_socket_%s' %
+            self.__get_os_type())
+        return get_nic_socket(self.bus_id, self.devfun_id)
+
+    def get_nic_socket_linux(self, bus_id, devfun_id):
+        command = ('cat /sys/bus/pci/devices/0000\:%s\:%s/numa_node' %
+                   (bus_id, devfun_id))
+        try:
+            out = self.__send_expect(command, '# ')
+            socket = int(out)
+        except:
+            socket = -1
+        return socket
+
+
+    def get_nic_socket_freebsd(self, bus_id, devfun_id):
+        NotImplemented
+
     @nic_has_driver
     def get_interface_name(self):
         """
@@ -234,7 +258,7 @@ class NetDevice(object):
         """
         Get ipv4 address of specified pci device.
         """
-        get_ipv4_addr = getaddr(
+        get_ipv4_addr = getattr(
             self, 'get_ipv4_addr_%s' % self.__get_os_type())
         return get_ipv4_addr(self.intf_name, self.currenct_driver)
 
-- 
1.9.3

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

end of thread, other threads:[~2015-06-04  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-04  7:21 [dts] [PATCH 1/3] Strip hugepage mount directory and netdev numa id for vxlan sample Yong Liu
2015-06-04  7:21 ` [dts] [PATCH 2/3] Add vxlan sample test plan Yong Liu
2015-06-04  7:21 ` [dts] [PATCH 3/3] Add vxlan sample test suite Yong Liu

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