test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH 1/3] Strip hugepage mount directory and netdev numa id for vxlan sample.
Date: Thu,  4 Jun 2015 15:21:44 +0800	[thread overview]
Message-ID: <1433402506-3031-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/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

             reply	other threads:[~2015-06-04  7:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04  7:21 Yong Liu [this message]
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

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=1433402506-3031-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).