diff options
author | pmikus <peter.mikus@protonmail.ch> | 2023-05-05 08:37:28 +0000 |
---|---|---|
committer | Peter Mikus <peter.mikus@protonmail.ch> | 2023-05-05 09:06:17 +0000 |
commit | d74acc4db2987d9ac40aae10be8453c922a16731 (patch) | |
tree | 5d09207b372fd311cf736476e6072ff818af39b3 /resources/libraries/python | |
parent | 5efb062fbad4c7710334e8b29f49be8c4d77ac7a (diff) |
fix(core): Unbind only when needed
Signed-off-by: pmikus <peter.mikus@protonmail.ch>
Change-Id: I7b7b8744fac6669a696253acb94e7a5d713fdb5b
Diffstat (limited to 'resources/libraries/python')
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 14 |
1 files changed, 11 insertions, 3 deletions
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) |