From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 4C935595E for ; Wed, 20 Jan 2016 02:47:51 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 19 Jan 2016 17:47:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,319,1449561600"; d="scan'208";a="730765615" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 19 Jan 2016 17:47:49 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u0K1lljU027554; Wed, 20 Jan 2016 09:47:47 +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 u0K1liUd011472; Wed, 20 Jan 2016 09:47:46 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u0K1liU0011468; Wed, 20 Jan 2016 09:47:44 +0800 From: Yong Liu To: dts@dpdk.org Date: Wed, 20 Jan 2016 09:47:41 +0800 Message-Id: <1453254463-11436-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH 1/3] framework dut: add port stop when execution exit 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: Wed, 20 Jan 2016 01:47:52 -0000 Some nic like RRC required additional setup like testpoint start-up. So when execution done, need call additional stop function. Signed-off-by: Marvin Liu diff --git a/framework/dts.py b/framework/dts.py index 2dd511b..1e60a01 100644 --- a/framework/dts.py +++ b/framework/dts.py @@ -341,6 +341,7 @@ def dts_run_target(crbInst, targets, test_suites, nic, scenario): scene.destroy_scene() scene = None + dut.stop_ports() dut.restore_interfaces() tester.restore_interfaces() diff --git a/framework/dut.py b/framework/dut.py index 178c35f..afb5204 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -225,6 +225,23 @@ class Dut(Crb): self.send_expect("kldunload contigmem.ko", "#") self.send_expect("kldload if_ixgbe.ko", "#", 20) + def stop_ports(self): + """ + After all execution done, some special nic like fm10k should be stop + """ + for port in self.ports_info: + pci_bus = port['pci'] + pci_id = port['type'] + # get device driver + driver = settings.get_nic_driver(pci_id) + if driver is not None: + # unbind device driver + addr_array = pci_bus.split(':') + bus_id = addr_array[0] + devfun_id = addr_array[1] + port = GetNicObj(self, bus_id, devfun_id) + port.stop() + def restore_interfaces_linux(self): """ Restore Linux interfaces. @@ -824,7 +841,7 @@ class Dut(Crb): dutpci = self.ports_info[dutPort]['pci'] if peer is not None: for remotePort in range(len(self.tester.ports_info)): - if self.tester.ports_info[remotePort]['pci'] == peer: + if self.tester.ports_info[remotePort]['pci'].lower() == peer.lower(): hits[remotePort] = True self.ports_map[dutPort] = remotePort break diff --git a/nics/net_device.py b/nics/net_device.py index 2b0517b..c3b3755 100644 --- a/nics/net_device.py +++ b/nics/net_device.py @@ -64,6 +64,9 @@ class NetDevice(object): self.get_interface_name() self.socket = self.get_nic_socket() + def stop(self): + pass + def close(self): pass -- 2.4.3