diff options
| -rw-r--r-- | python/vyos/vpp/control_host.py | 17 | ||||
| -rwxr-xr-x | src/conf_mode/vpp.py | 1 |
2 files changed, 13 insertions, 5 deletions
diff --git a/python/vyos/vpp/control_host.py b/python/vyos/vpp/control_host.py index 2ebfd180b..f284cbb7d 100644 --- a/python/vyos/vpp/control_host.py +++ b/python/vyos/vpp/control_host.py @@ -133,13 +133,22 @@ def override_driver(bus_id: str, device_id: str, driver_name: str = '') -> None: unbind_driver(bus_id, device_id) - # vfio-pci needs special approach + # vfio-pci requires a different workflow: drivers must be explicitly bound by + # writing the vendor/device IDs to the vfio-pci `new_id` interface. The kernel + # does not provide a reliable way to check whether an ID has already been + # registered, so we simply attempt the write and ignore the FileExistsError. + # Any other failure is treated as a warning. if driver_name == 'vfio-pci': vendor: str = Path(f'{device_resolved}/vendor').read_text() device: str = Path(f'{device_resolved}/device').read_text() - Path('/sys/module/vfio_pci/drivers/pci:vfio-pci/new_id').write_text( - f'{vendor} {device}' - ) + try: + Path('/sys/module/vfio_pci/drivers/pci:vfio-pci/new_id').write_text( + f'{vendor} {device}' + ) + except FileExistsError: + pass + except Exception as e: + print(f"Warning: failed to write new_id for vfio-pci: {e}") # override a driver Path(f'{device_resolved}/driver_override').write_text(f'{driver_name}\n') diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py index 63000110a..b5aac3f2e 100755 --- a/src/conf_mode/vpp.py +++ b/src/conf_mode/vpp.py @@ -90,7 +90,6 @@ dependency_interface_type_map = { # dict of drivers that needs to be overrided override_drivers: dict[str, str] = { 'hv_netvsc': 'uio_hv_generic', - 'ena': 'vfio-pci', } # drivers that does not use PCIe addresses |
