From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 598B0A0096 for ; Fri, 15 Mar 2019 08:08:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1BEE32C17; Fri, 15 Mar 2019 08:08:15 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 25FD12BD3 for ; Fri, 15 Mar 2019 08:08:12 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Mar 2019 00:08:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,481,1544515200"; d="scan'208";a="122886087" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga007.jf.intel.com with ESMTP; 15 Mar 2019 00:08:11 -0700 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 15 Mar 2019 00:08:11 -0700 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 15 Mar 2019 00:08:11 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.158]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.10]) with mapi id 14.03.0415.000; Fri, 15 Mar 2019 15:08:09 +0800 From: "Tu, Lijuan" To: "Luo, Michael" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH] framework/dut.py: pull the name after bound the interface to kernel driver Thread-Index: AQHU2LEF+aqCzXn+bkmrGu8WkZvMG6YMSkOA Date: Fri, 15 Mar 2019 07:08:08 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA4338E@SHSMSX101.ccr.corp.intel.com> References: <1552380566-30145-1-git-send-email-michael.luo@intel.com> In-Reply-To: <1552380566-30145-1-git-send-email-michael.luo@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODhjMjQzMWYtZTc5NS00NGQ5LWIyOTAtY2IyYjRiM2NmM2FlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiK05zcms3SzlRSmJDcGpmK05IbjN5Tk1TSjRZQVwvM2NSZUFBUDBrYWRJczFEOXhtWWFsS0dWc01SOXZVZktXYTEifQ== 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] framework/dut.py: pull the name after bound the interface to kernel driver 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of michael.luo@intel.co= m > Sent: Tuesday, March 12, 2019 4:49 PM > To: dts@dpdk.org > Subject: [dts] [PATCH] framework/dut.py: pull the name after bound the > interface to kernel driver >=20 > From: Luo Gaoliang >=20 > When restoring the interface, it will do unbinding, then bind the interfa= ce with > the kernel driver, it's better to pull the interface name with 1s interva= l. > Because on some system, especially on VMs, if try to get the name immedia= tely > after bind the interface with the driver, it may not be ready in its sysf= s. >=20 > Signed-off-by: Luo Gaoliang > --- > framework/dut.py | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) >=20 > diff --git a/framework/dut.py b/framework/dut.py index ab0eb32..541ab7b > 100644 > --- a/framework/dut.py > +++ b/framework/dut.py > @@ -281,8 +281,18 @@ class Dut(Crb): > self.send_expect('modprobe %s' % driver, '# ') > self.send_expect('echo %s > /sys/bus/pci/drivers/%s/bind= ' > % (pci_bus, driver), '# ') > - itf =3D port.get_interface_name() > - self.send_expect("ifconfig %s up" % itf, "# ") > + pull_retries =3D 5 > + while pull_retries > 0: > + itf =3D port.get_interface_name() > + if itf =3D=3D 'N/A': > + time.sleep(1) > + pull_retries -=3D 1 > + else: > + break > + if itf =3D=3D 'N/A': > + self.logger.warning("Fail to bind the device with th= e linux driver") > + else: > + self.send_expect("ifconfig %s up" % itf, "# ") > else: > self.logger.info("NOT FOUND DRIVER FOR PORT (%s|%s)!!!" = % > (pci_bus, pci_id)) >=20 > -- > 2.7.4