From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 7547CC31C for ; Thu, 4 Jun 2015 09:21:56 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 04 Jun 2015 00:21:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,551,1427785200"; d="scan'208";a="502560675" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 04 Jun 2015 00:21:51 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t547Lol4017642; Thu, 4 Jun 2015 15:21:50 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t547LmuG003067; Thu, 4 Jun 2015 15:21:50 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t547LlYW003063; Thu, 4 Jun 2015 15:21:48 +0800 From: Yong Liu To: dts@dpdk.org Date: Thu, 4 Jun 2015 15:21:44 +0800 Message-Id: <1433402506-3031-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH 1/3] Strip hugepage mount directory and netdev numa id for vxlan sample. X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Jun 2015 07:21:57 -0000 From: Marvin Liu Signed-off-by: Marvin Liu 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