From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D419D18F for ; Wed, 14 Jan 2015 02:38:04 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 13 Jan 2015 17:32:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,753,1413270000"; d="scan'208";a="661457024" Received: from pgsmsx108.gar.corp.intel.com ([10.221.44.103]) by fmsmga002.fm.intel.com with ESMTP; 13 Jan 2015 17:37:57 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by PGSMSX108.gar.corp.intel.com (10.221.44.103) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 14 Jan 2015 09:35:56 +0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.192]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.173]) with mapi id 14.03.0195.001; Wed, 14 Jan 2015 09:35:55 +0800 From: "Liu, Yong" To: "Qiu, Michael" , "dts@dpdk.org" Thread-Topic: [PATCH 6/6] framework/crb: rework restore_interfaces() Thread-Index: AQHQLzbYuDcJAKjcJEKZ1XyT4dMcipy+1kJQ Date: Wed, 14 Jan 2015 01:35:54 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E10D4C287@SHSMSX103.ccr.corp.intel.com> References: <1421156540-25810-1-git-send-email-michael.qiu@intel.com> <1421156540-25810-7-git-send-email-michael.qiu@intel.com> In-Reply-To: <1421156540-25810-7-git-send-email-michael.qiu@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH 6/6] framework/crb: rework restore_interfaces() 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, 14 Jan 2015 01:38:05 -0000 That's great, will merged into main branch. > -----Original Message----- > From: Qiu, Michael > Sent: Tuesday, January 13, 2015 9:42 PM > To: dts@dpdk.org > Cc: Liu, Yong; Qiu, Michael > Subject: [PATCH 6/6] framework/crb: rework restore_interfaces() >=20 > Currently restore_interfaces() is very ugly, and hard to add new > device's support. >=20 > Just make it more flexible to support other new device. >=20 > Signed-off-by: Michael Qiu > --- > framework/crb.py | 33 ++++++++++++++++++--------------- > 1 file changed, 18 insertions(+), 15 deletions(-) >=20 > diff --git a/framework/crb.py b/framework/crb.py > index ee005c4..a08db46 100644 > --- a/framework/crb.py > +++ b/framework/crb.py > @@ -139,30 +139,33 @@ class Crb(object): > """ > Restore Linux interfaces. > """ > + # ToDo: put to cfg file later > + driver_list =3D ["igb", "ixgbe", "e1000e", "e1000", "virtio_net"= , "i40e"] > if dts.drivername =3D=3D "vfio-pci": > self.send_expect("rmmod vfio_iommu_type1", "# ", 10) > self.send_expect("rmmod vfio_pci", "# ", 10) > self.send_expect("rmmod vfio", "# ", 10) > else: > self.send_expect("rmmod igb_uio", "# ", 10) > - self.send_expect("modprobe igb", "# ", 20) > - self.send_expect("modprobe ixgbe", "# ", 20) > - self.send_expect("modprobe e1000e", "# ", 20) > - self.send_expect("modprobe e1000", "# ", 20) > - self.send_expect("modprobe virtio_net", "# ", 20) > + for driver in driver_list: > + # Need remove check after i40e driver in upstream linux kern= el > + if driver !=3D "i40e": > + self.send_expect("modprobe %s"%driver, "# ", 20) > + else: > + self.send_expect("insmod /root/i40e.ko", "# ", 30) >=20 > try: > for (pci_bus, pci_id) in self.pci_devices_info: > - if pci_id in ('8086:10fb', '8086:151c', '8086:1528', '80= 86:1512', > '8086:154a'): > - self.send_expect("echo 0000:%s > > /sys/bus/pci/drivers/ixgbe/bind" % pci_bus, "# ") > - elif pci_id in ('8086:10e8', '8086:150e', '8086:1521', '= 8086:10c9', > '8086:1526', '8086:1533'): > - self.send_expect("echo 0000:%s > /sys/bus/pci/driver= s/igb/bind" % > pci_bus, "# ") > - elif pci_id in('8086:10d3', '8086:10b9'): > - self.send_expect("echo 0000:%s > > /sys/bus/pci/drivers/e1000e/bind" % pci_bus, "# ") > - elif pci_id in ('8086:100f', '8086:100e'): > - self.send_expect("echo 0000:%s > > /sys/bus/pci/drivers/e1000/bind" % pci_bus, "# ") > - elif pci_id in ('1af4:1000'): > - self.send_expect("echo 0000%s > /sys/bus/pci/drivers= /virtio- > pci/bind" % pci_bus, "# ") > + full_bus =3D "0000:%s"% pci_bus > + driver_path =3D "/sys/bus/pci/devices/%s/driver"%full_bu= s > + # Get the abs path of the driver > + driver_path =3D self.send_expect("cd %s && pwd -P" % > + driver_path, "# ", > + verify =3D True) > + if driver_path !=3D -1 and \ > + driver_path.split('/')[-1] in driver_list: > + self.send_expect("echo %s > %s/bind" % > + (full_bus, driver_path), "# ") > else: > continue >=20 > -- > 1.9.3