From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 8202020F for ; Thu, 5 Feb 2015 03:18:50 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 04 Feb 2015 18:14:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="450022229" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 04 Feb 2015 18:04:33 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t152IjYA009806; Thu, 5 Feb 2015 10:18:45 +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 t152Ig9u021999; Thu, 5 Feb 2015 10:18:44 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t152IgLQ021995; Thu, 5 Feb 2015 10:18:42 +0800 From: Yong Liu To: dts@dpdk.org Date: Thu, 5 Feb 2015 10:18:34 +0800 Message-Id: <1423102714-21962-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1423032214-19856-1-git-send-email-yong.liu@intel.com> References: <1423032214-19856-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH] framework: add port config pci bus id check suites: seperated checksum_offload function and performance port requirements 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, 05 Feb 2015 02:18:51 -0000 Signed-off-by: Marvinliu --- conf/ports.cfg | 2 +- framework/config.py | 16 ++++++++++++++-- framework/dut.py | 5 +++-- tests/TestSuite_checksum_offload.py | 6 +++++- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/conf/ports.cfg b/conf/ports.cfg index 55e26d8..eb2cb34 100644 --- a/conf/ports.cfg +++ b/conf/ports.cfg @@ -5,5 +5,5 @@ # pci=Pci BDF,mac=Mac address,peer=Tester Pci BDF,numa=Port Numa [DUT IP] ports = - pci=XX:XX.X,intf=eth0 + pci=XX:XX.X,intf=eth0; pci=YY:YY.Y,mac=XX:XX:XX:XX:XX:XX,peer=ZZ:ZZ.Z,numa=0 diff --git a/framework/config.py b/framework/config.py index dc4f944..af014a8 100755 --- a/framework/config.py +++ b/framework/config.py @@ -33,6 +33,7 @@ Generic port and crbs configuration file load function """ +import re import ConfigParser # config parse module import argparse # prase arguments module @@ -46,6 +47,7 @@ class UserConf(): self.port_config = port_conf self.crb_config = crb_conf self.ports_cfg = {} + self.pci_regex = "([\da-f]{2}:[\da-f]{2}.\d{1})$" try: self.port_conf = ConfigParser.SafeConfigParser() self.port_conf.read(self.port_config) @@ -61,20 +63,30 @@ class UserConf(): for port in self.port_conf.get(crb, 'ports').split(';')] for port in ports: - port_cfg = self.parse_port_param(port) + port_cfg = self.__parse_port_param(port) + # check pci BDF validity if 'pci' not in port_cfg: + print "NOT FOUND CONFIG FOR NO PCI ADDRESS!!!" + continue + m = re.match(self.pci_regex, port_cfg['pci']) + if m is None: print "INVALID CONFIG FOR NO PCI ADDRESS!!!" + continue + keys = port_cfg.keys() keys.remove('pci') self.ports_cfg[port_cfg['pci']] = {key: port_cfg[key] for key in keys} + def get_ports_config(self): + return self.ports_cfg + def check_port_available(self, pci_addr): if pci_addr in self.ports_cfg.keys(): return True else: return False - def parse_port_param(self, port): + def __parse_port_param(self, port): portDict = dict() for param in port.split(','): diff --git a/framework/dut.py b/framework/dut.py index cddc248..e095d86 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -562,8 +562,9 @@ class Dut(Crb): """ for port in self.ports_info: pci_bus = port['pci'] - if pci_bus in self.conf.ports_cfg: - port_cfg = self.conf.ports_cfg[pci_bus] + ports_cfg = self.conf.get_ports_config() + if pci_bus in ports_cfg: + port_cfg = ports_cfg[pci_bus] port_cfg['source'] = 'cfg' else: port_cfg = {} diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py index 05438b2..e353aaa 100644 --- a/tests/TestSuite_checksum_offload.py +++ b/tests/TestSuite_checksum_offload.py @@ -54,7 +54,7 @@ class TestChecksumOffload(TestCase): Checksum offload prerequisites. """ # Based on h/w type, choose how many ports to use - self.dut_ports = self.dut.get_ports_performance() + self.dut_ports = self.dut.get_ports() # Verify that enough ports are available self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing") @@ -297,6 +297,10 @@ class TestChecksumOffload(TestCase): """ Test checksum offload performance. """ + self.dut_ports = self.dut.get_ports_performance() + # Verify that enough ports are available + self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing") + # sizes = [64, 128, 256, 512, 1024] sizes = [64, 128] pkts = { -- 1.9.3