diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-02-11 16:23:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-11 16:23:02 +0100 |
| commit | d6fdf9db8497164921afb28abc22f1c7bcd18f52 (patch) | |
| tree | 7e95c0cb5730cc0586747c3ea469b015491f8622 | |
| parent | e0f173bba7fda35c12788418c6f0f027fb940666 (diff) | |
| parent | 66a188ab57c187590459866c96bc9d4d23656cef (diff) | |
| download | vyos-1x-d6fdf9db8497164921afb28abc22f1c7bcd18f52.tar.gz vyos-1x-d6fdf9db8497164921afb28abc22f1c7bcd18f52.zip | |
Merge pull request #4979 from natali-rs1985/T7811
vpp: T7811: Add rebind_gve_driver function for correct gve device handling
| -rw-r--r-- | python/vyos/vpp/control_host.py | 24 | ||||
| -rwxr-xr-x | src/conf_mode/vpp.py | 8 |
2 files changed, 31 insertions, 1 deletions
diff --git a/python/vyos/vpp/control_host.py b/python/vyos/vpp/control_host.py index f284cbb7d..50ab4d97a 100644 --- a/python/vyos/vpp/control_host.py +++ b/python/vyos/vpp/control_host.py @@ -85,6 +85,30 @@ def unbind_driver(bus_id: str, device_id: str) -> bool: return True +def rebind_gve_driver(iface: str, bus_id: str, device_id: str) -> None: + """ + Rebind a device to the gve kernel driver. + + Args: + iface (str): Interface name + bus_id (str): Bus type (pci, vmbus, etc.) + device_id (str): device id on the bus (PCI address, VMBus UUID) + """ + set_status(iface, 'down') + + # Unbind the device from its current driver + unbind_driver(bus_id, device_id) + + # Clear driver override (if set) + device_path = Path(f'/sys/bus/{bus_id}/devices/{device_id}').resolve() + (device_path / 'driver_override').write_text('') + + # Bind the device to the gve kernel driver + Path(f'/sys/bus/{bus_id}/drivers/gve/bind').write_text(device_id) + + set_status(iface, 'up') + + def probe_driver(bus_id: str, device_id: str) -> None: """Probe driver for a device on a bus diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py index 27262efb5..ae75594d6 100755 --- a/src/conf_mode/vpp.py +++ b/src/conf_mode/vpp.py @@ -680,7 +680,13 @@ def generate(config): def initialize_interface(iface, driver, iface_config) -> None: # DPDK - rescan PCI to use a proper driver if driver == 'dpdk' and iface_config['original_driver'] not in not_pci_drv: - control_host.pci_rescan(iface_config['dev_id']) + # 'gve' devices require a specific unbind/bind process instead of a standard PCI rescan. + if iface_config['original_driver'] == 'gve': + control_host.rebind_gve_driver( + iface, iface_config['bus_id'], iface_config['dev_id'] + ) + else: + control_host.pci_rescan(iface_config['dev_id']) # rename to the proper name iface_new_name: str = control_host.get_eth_name(iface_config['dev_id']) control_host.rename_iface(iface_new_name, iface) |
