[dts] [PATCH V1 2/5]framework/dut.py: update method of restore_interfaces_linux

Xiao Qimai qimaix.xiao at intel.com
Tue Jun 30 11:46:35 CEST 2020


Signed-off-by: Xiao Qimai <qimaix.xiao at intel.com>
---
 framework/dut.py | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/framework/dut.py b/framework/dut.py
index 73f965e..2545621 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -447,13 +447,30 @@ class Dut(Crb):
                 self.send_expect('echo %s > /sys/bus/pci/drivers/%s/bind'
                                  % (pci_bus, driver), '# ')
                 pull_retries = 5
+                itf = 'N/A'
                 while pull_retries > 0:
                     itf = port.get_interface_name()
-                    if itf == 'N/A':
+                    if not itf or itf == 'N/A':
                         time.sleep(1)
                         pull_retries -= 1
                     else:
                         break
+                else:
+                    # try to bind nic with iavf
+                    if driver == 'i40evf':
+                        driver = 'iavf'
+                        self.send_expect('modprobe %s' % driver, '# ')
+                        self.send_expect('echo %s > /sys/bus/pci/drivers/%s/bind'
+                                         % (pci_bus, driver), '# ')
+                        pull_retries = 5
+                        itf = 'N/A'
+                        while pull_retries > 0:
+                            itf = port.get_interface_name()
+                            if not itf or 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:
-- 
1.8.3.1



More information about the dts mailing list