From: "Tu, Lijuan" <lijuan.tu@intel.com>
To: "Luo, Michael" <michael.luo@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Subject: Re: [dts] [PATCH] framework/dut.py: pull the name after bound the interface to kernel driver
Date: Fri, 15 Mar 2019 07:08:08 +0000 [thread overview]
Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA4338E@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1552380566-30145-1-git-send-email-michael.luo@intel.com>
Applied, thanks
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of michael.luo@intel.com
> 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
>
> From: Luo Gaoliang <michael.luo@intel.com>
>
> When restoring the interface, it will do unbinding, then bind the interface with
> the kernel driver, it's better to pull the interface name with 1s interval.
> Because on some system, especially on VMs, if try to get the name immediately
> after bind the interface with the driver, it may not be ready in its sysfs.
>
> Signed-off-by: Luo Gaoliang <michael.luo@intel.com>
> ---
> framework/dut.py | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> 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 = port.get_interface_name()
> - self.send_expect("ifconfig %s up" % itf, "# ")
> + pull_retries = 5
> + while pull_retries > 0:
> + itf = port.get_interface_name()
> + if itf == 'N/A':
> + time.sleep(1)
> + pull_retries -= 1
> + else:
> + break
> + if itf == 'N/A':
> + self.logger.warning("Fail to bind the device with the 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))
>
> --
> 2.7.4
prev parent reply other threads:[~2019-03-15 7:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-12 8:49 michael.luo
2019-03-15 7:08 ` Tu, Lijuan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8CE3E05A3F976642AAB0F4675D0AD20E0BA4338E@SHSMSX101.ccr.corp.intel.com \
--to=lijuan.tu@intel.com \
--cc=dts@dpdk.org \
--cc=michael.luo@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).