From d74acc4db2987d9ac40aae10be8453c922a16731 Mon Sep 17 00:00:00 2001 From: pmikus Date: Fri, 5 May 2023 08:37:28 +0000 Subject: fix(core): Unbind only when needed Signed-off-by: pmikus Change-Id: I7b7b8744fac6669a696253acb94e7a5d713fdb5b --- resources/libraries/python/InterfaceUtil.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'resources') diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 2368ee3362..3ab96d1b4d 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -1884,12 +1884,20 @@ class InterfaceUtil: node, pf_dev, state=u"up" ) - DUTSetup.pci_vf_driver_unbind(node, pf_pci_addr, vf_id) - DUTSetup.pci_vf_driver_bind(node, pf_pci_addr, vf_id, uio_driver) + vf_pci_addr = DUTSetup.get_virtfn_pci_addr(node, pf_pci_addr, vf_id) + current_driver = DUTSetup.get_pci_dev_driver( + node, vf_pci_addr.replace(":", r"\:") + ) + if current_driver and current_driver != uio_driver: + DUTSetup.pci_vf_driver_unbind( + node, pf_pci_addr, vf_id + ) + DUTSetup.pci_vf_driver_bind( + node, pf_pci_addr, vf_id, uio_driver + ) # Add newly created ports into topology file vf_ifc_name = f"{ifc_key}_vif" - vf_pci_addr = DUTSetup.get_virtfn_pci_addr(node, pf_pci_addr, vf_id) vf_ifc_key = Topology.add_new_port(node, vf_ifc_name) Topology.update_interface_name( node, vf_ifc_key, vf_ifc_name+str(vf_id+1) -- cgit 1.2.3-korg