From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 514E49374 for ; Thu, 8 Sep 2016 10:45:18 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP; 08 Sep 2016 01:45:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,298,1470726000"; d="scan'208";a="1053005361" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 08 Sep 2016 01:45:17 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 8 Sep 2016 01:45:17 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 8 Sep 2016 01:45:16 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.102]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.174]) with mapi id 14.03.0248.002; Thu, 8 Sep 2016 16:45:14 +0800 From: "Liu, Yong" To: "Xu, GangX" , "dts@dpdk.org" CC: "Xu, GangX" Thread-Topic: [dts] [PATCH V2] modify pci prefix error on freebsd Thread-Index: AQHSCaedRacxDORtTEKcvasV2BANNqBvRq9w Date: Thu, 8 Sep 2016 08:45:14 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E6022EAC5@SHSMSX103.ccr.corp.intel.com> References: <1473321463-8148-1-git-send-email-gangx.xu@intel.com> In-Reply-To: <1473321463-8148-1-git-send-email-gangx.xu@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDE3ODFkODctODgyOC00NTVmLTk2OWYtNDMxYzhkZmRhNDU5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlY3SHkxcm1Says4dkRma0sxZU53MDN6ZTRJZitsYjM0TUJxTFNRZG55b1U9In0= x-ctpclassification: CTP_IC 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 V2] modify pci prefix error on freebsd 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, 08 Sep 2016 08:45:18 -0000 Gang, please check code style with pep8 tool. Thanks. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xu,gang > Sent: Thursday, September 08, 2016 3:58 PM > To: dts@dpdk.org > Cc: Xu, GangX > Subject: [dts] [PATCH V2] modify pci prefix error on freebsd >=20 > Signed-off-by: xu,gang > --- > framework/crb.py | 2 +- > framework/dut.py | 14 +++++++------- > nics/net_device.py | 17 +++++++++-------- > 3 files changed, 17 insertions(+), 16 deletions(-) >=20 > diff --git a/framework/crb.py b/framework/crb.py > index 066bb3f..c5faa3e 100644 > --- a/framework/crb.py > +++ b/framework/crb.py > @@ -281,7 +281,7 @@ class Crb(object): > return None > return match.group(1) >=20 > - def get_pci_dev_driver_freebsd(self, bus_id, devfun_id): > + def get_pci_dev_driver_freebsd(self, domain_id,bus_id, devfun_id): Need space between two parameters, you can check the issue by pep8 command = and auto fix by autopep8 command. > """ > Get the driver of specified pci device. > """ > diff --git a/framework/dut.py b/framework/dut.py > index 2f4e53a..1305bed 100644 > --- a/framework/dut.py > +++ b/framework/dut.py > @@ -229,10 +229,7 @@ class Dut(Crb): > """ > After all execution done, some special nic like fm10k should be > stop > """ > - for port in self.ports_info: > - pci_bus =3D port['pci'] > - pci_id =3D port['type'] > - # get device driver > + for (pci_bus, pci_id) in self.pci_devices_info: > driver =3D settings.get_nic_driver(pci_id) > if driver is not None: > # unbind device driver > @@ -718,15 +715,18 @@ class Dut(Crb): > self.ports_info =3D [] >=20 > skipped =3D RED('Skipped: Unknown/not selected') > - > + > for (pci_bus, pci_id) in self.pci_devices_info: >=20 > if not dts.accepted_nic(pci_id): > self.logger.info("DUT: [%s %s] %s" % (pci_bus, pci_id, > skipped)) > continue > - > - port =3D GetNicObj(self, pci_bus, '') > + addr_array =3D pci_bus.split(':') > + domain_id =3D addr_array[0] > + bus_id =3D addr_array[1] > + devfun_id =3D addr_array[2] > + port =3D GetNicObj(self,domain_id,bus_id,devfun_id) > intf =3D port.get_interface_name() >=20 > macaddr =3D port.get_mac_addr() > diff --git a/nics/net_device.py b/nics/net_device.py > index 897ceb9..93b7c6b 100644 > --- a/nics/net_device.py > +++ b/nics/net_device.py > @@ -136,7 +136,7 @@ class NetDevice(object): > socket =3D -1 > return socket >=20 > - def get_nic_socket_freebsd(self, bus_id, devfun_id): > + def get_nic_socket_freebsd(self,domain_id, bus_id, devfun_id): Same as previous comment. > NotImplemented >=20 > @nic_has_driver > @@ -200,7 +200,7 @@ class NetDevice(object): > domain_id, bus_id, devfun_id) > return self.__send_expect(command, '# ') >=20 > - def get_interface_name_freebsd(self, bus_id, devfun_id, driver): > + def get_interface_name_freebsd(self, domain_id,bus_id, devfun_id, > driver): > """ > Get interface name of specified pci device on Freebsd. > """ > @@ -212,14 +212,15 @@ class NetDevice(object): > get_interface_name_freebsd =3D getattr(self, >=20 > 'get_interface_name_freebsd_%s' % generic_driver) >=20 > - return get_interface_name_freebsd(bus_id, devfun_id) > + return get_interface_name_freebsd(domain_id,bus_id, devfun_id) >=20 > - def get_interface_name_freebsd_generic(self, bus_id, devfun_id): > + def get_interface_name_freebsd_generic(self, domain_id,bus_id, > devfun_id): > """ > Get the interface name by the default way on freebsd. > """ > + pci_str =3D "%s:%s:%s" % (domain_id,bus_id,devfun_id) Need follow pep8 rule. > out =3D self.__send_expect("pciconf -l", "# ") > - rexp =3D r"(\w*)@pci0:%s" % bus_id > + rexp =3D r"(\w*)@pci0:%s" % pci_str > pattern =3D re.compile(rexp) > match =3D pattern.findall(out) > if len(match) =3D=3D 0: > @@ -307,7 +308,7 @@ class NetDevice(object): > (domain_id, bus_id, devfun_id, virtio, intf)) > return self.__send_expect(command, '# ') >=20 > - def get_mac_addr_freebsd(self, intf, bus_id, devfun_id, driver): > + def get_mac_addr_freebsd(self, intf, domain_id, bus_id, devfun_id, > driver): > """ > Get mac address of specified pci device on Freebsd. > """ > @@ -323,9 +324,9 @@ class NetDevice(object): > 'get_mac_addr_freebsd_%s' % > generic_driver) >=20 > - return get_mac_addr_freebsd(intf, bus_id, devfun_id) > + return get_mac_addr_freebsd(intf, domain_id, bus_id, devfun_id) >=20 > - def get_mac_addr_freebsd_generic(self, intf, bus_id, devfun_id): > + def get_mac_addr_freebsd_generic(self, intf, domain_id, bus_id, > devfun_id): > """ > Get the MAC by the default way on Freebsd. > """ > -- > 1.9.3