From 66a188ab57c187590459866c96bc9d4d23656cef Mon Sep 17 00:00:00 2001 From: Nataliia Solomko Date: Tue, 10 Feb 2026 12:15:24 +0200 Subject: vpp: T7811: Add rebind_gve_driver function for correct gve device handling --- python/vyos/vpp/control_host.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'python') 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 -- cgit v1.2.3