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 3C835B591 for ; Mon, 16 Feb 2015 04:08:05 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 15 Feb 2015 19:02:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,584,1418112000"; d="scan'208";a="652605917" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 15 Feb 2015 19:08:04 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t1G381TU023100; Mon, 16 Feb 2015 11:08:01 +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 t1G37xNV001397; Mon, 16 Feb 2015 11:08:01 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t1G37wHg001393; Mon, 16 Feb 2015 11:07:58 +0800 From: Yong Liu To: dts@dpdk.org Date: Mon, 16 Feb 2015 11:07:47 +0800 Message-Id: <1424056068-1156-5-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1424056068-1156-1-git-send-email-yong.liu@intel.com> References: <1423728550-14792-1-git-send-email-yong.liu@intel.com> <1424056068-1156-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH V3 4/5] framework: optimize wirespeed calculation and kill_all function 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: Mon, 16 Feb 2015 03:08:05 -0000 When calculate wirespeed of one dut port, we need known both driver and nic name. All nic use ixgbe driver, wirespeed is 10G. NIC avoton2c5 wirespeed is 2.5G. NIC fortville_eagle wirespeed is 10G. Other Fortville NICs wirespeed is 40G. Signed-off-by: Marvinliu diff --git a/framework/crb.py b/framework/crb.py index 317be15..28df2f9 100644 --- a/framework/crb.py +++ b/framework/crb.py @@ -286,7 +286,6 @@ class Crb(object): | awk '/config/ {print $2}'` ; do kill -9 $i; done" self.alt_session.session.send_expect(cmd, "# ", 10) time.sleep(.7) - self.check_os_type() def close(self): """ diff --git a/framework/test_case.py b/framework/test_case.py index 66f7262..b1595fb 100644 --- a/framework/test_case.py +++ b/framework/test_case.py @@ -33,8 +33,9 @@ A base class for creating DTF test cases. """ +import dts from exception import VerifyFailure -from settings import DRIVERS +from settings import DRIVERS, NICS class TestCase(object): @@ -67,18 +68,32 @@ class TestCase(object): raise ValueError(nic_name) + def get_nic_name(self, pci_id): + for nic_name, pci in NICS.items(): + if pci_id == pci: + return nic_name + + raise ValueError(nic_name) + def wirespeed(self, nic, frame_size, num_ports): """ Calculate bit rate. It is depended for NICs """ bitrate = 1000.0 # 1Gb ('.0' forces to operate as float) - if self.get_nic_driver(self.nic) == "ixgbe": + if self.nic == "any" or self.nic == "cfg": + driver = dts.get_nic_driver(self.dut.ports_info[0]['type']) + nic = self.get_nic_name(self.dut.ports_info[0]['type']) + else: + driver = self.get_nic_driver(self.nic) + nic = self.nic + + if driver == "ixgbe": bitrate *= 10 # 10 Gb NICs - elif self.nic == "avoton2c5": + elif nic == "avoton2c5": bitrate *= 2.5 # 2.5 Gb NICs - elif self.nic in ["fortville_spirit", "fortville_spirit_single"]: + elif nic in ["fortville_spirit", "fortville_spirit_single"]: bitrate *= 40 - elif self.nic == 'fortville_eagle': + elif nic == 'fortville_eagle': bitrate *= 10 return bitrate * num_ports / 8 / (frame_size + 20) -- 1.9.3