diff options
| author | Oleksandr Kuchmystyi <o.kuchmystyi@vyos.io> | 2026-03-10 17:08:48 +0300 |
|---|---|---|
| committer | Oleksandr Kuchmystyi <o.kuchmystyi@vyos.io> | 2026-03-18 15:13:02 +0300 |
| commit | 3722268b0859831ae96c9cb3f634382713139f6d (patch) | |
| tree | 2b9401f6ef9ab7f0ab19359d08d6d30a1c79572b /python | |
| parent | 124304285eef883069303773093ed76f6d593c16 (diff) | |
| download | vyos-1x-3722268b0859831ae96c9cb3f634382713139f6d.tar.gz vyos-1x-3722268b0859831ae96c9cb3f634382713139f6d.zip | |
vpp: T8315: Add support for configuring unsupported NICs and update compatible list
Introduce `set vpp settings unsupported nics <pci-id>` and
`set vpp settings unsupported drivers <driver>` to permit VPP activation
on hardware not present in the validated NIC list. Update current compatible list.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/vpp/config_verify.py | 62 | ||||
| -rw-r--r-- | python/vyos/vpp/control_host.py | 36 |
2 files changed, 36 insertions, 62 deletions
diff --git a/python/vyos/vpp/config_verify.py b/python/vyos/vpp/config_verify.py index 6f1774b2f..57a94ddd5 100644 --- a/python/vyos/vpp/config_verify.py +++ b/python/vyos/vpp/config_verify.py @@ -62,68 +62,6 @@ def verify_vpp_tunnel_source_address(config: dict): ) -def verify_dev_driver(driver_type: str, driver: str) -> bool: - # Lists of drivers compatible with DPDK and XDP - drivers_dpdk: list[str] = [ - 'atlantic', - 'bnx2x', - 'e1000', - 'ena', - 'gve', - 'hv_netvsc', - 'i40e', - 'ice', - 'igc', - 'ixgbe', - 'ixgbevf', - 'liquidio', - 'mlx4_core', - 'mlx5_core', - 'qede', - 'sfc', - 'tap', - 'tun', - 'virtio_net', - 'vmxnet3', - ] - - drivers_xdp: list[str] = [ - 'atlantic', - 'ena', - 'gve', - 'hv_netvsc', - 'i40e', - 'ice', - 'igb', - 'igc', - 'ixgbe', - 'mlx4_core', - 'mlx5_core', - 'qede', - 'sfc', - 'tap', - 'tun', - 'virtio_net', - 'vmxnet3', - ] - - if driver_type == 'dpdk': - if driver in drivers_dpdk: - return True - # XDP support is intentionally disabled (T8202). - # XDP is no longer configurable via the CLI. - # This logic is kept commented out to make it easy - # to reintroduce XDP if there is a clear need in the future. - # - # elif driver_type == 'xdp': - # if driver in drivers_xdp: - # return True - else: - raise ConfigError(f'"Driver type {driver_type} is wrong') - - return False - - def create_cpu_error_message(cpus_required: int, cpus_available: int = None) -> str: cpu_info = get_cpus() logical_cores = sum( diff --git a/python/vyos/vpp/control_host.py b/python/vyos/vpp/control_host.py index 50ab4d97a..9808c9418 100644 --- a/python/vyos/vpp/control_host.py +++ b/python/vyos/vpp/control_host.py @@ -313,6 +313,42 @@ def get_eth_driver(iface: str) -> str: raise Exception(f'Could not determine driver for "{iface}": {error}') from error +def get_pci_id(iface: str) -> str | None: + """ + Retrieves the PCI ID for a specified network interface. + + Args: + iface (str): The name of the network interface (e.g., 'eth0'). + + Raises: + OSError: The interface cannot be resolved or PCI ID files cannot be read + + Returns: + str: The PCI ID in the format 'vendor:device'. + None: In case a NIC is not on a PCI bus. + """ + dev_id = get_dev_id(iface) + + # Check if this device is on a PCI bus, return `None` if this is not a PCI device + pci_dev_path = Path(f'/sys/bus/pci/devices/{dev_id}') + if not pci_dev_path.exists(): + return None + + # Read vendor and device IDs + def _read_bus(file: str) -> str: + path = Path(f'/sys/bus/pci/devices/{dev_id}/{file}') + return path.read_text().removeprefix('0x').strip() + + try: + device_id, vendor_id = _read_bus('device'), _read_bus('vendor') + except OSError as e: + # If we reached this exception, then something really weird happened, + # but it is still right to have it + raise OSError(f'PCI IDs for {iface} cannot be retrieved') from e + + return f'{vendor_id}:{device_id}'.lower() + + def unsafe_noiommu_mode(status: bool) -> None: """Control unsafe_noiommu_mode parameter of vfio module |
