[dts] [PATCH] framework/dut.py: pull the name after bound the interface to kernel driver
Tu, Lijuan
lijuan.tu at intel.com
Fri Mar 15 08:08:08 CET 2019
Applied, thanks
> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of michael.luo at intel.com
> Sent: Tuesday, March 12, 2019 4:49 PM
> To: dts at dpdk.org
> Subject: [dts] [PATCH] framework/dut.py: pull the name after bound the
> interface to kernel driver
>
> From: Luo Gaoliang <michael.luo at 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 at 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
More information about the dts
mailing list