summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-02-11 16:23:02 +0100
committerGitHub <noreply@github.com>2026-02-11 16:23:02 +0100
commitd6fdf9db8497164921afb28abc22f1c7bcd18f52 (patch)
tree7e95c0cb5730cc0586747c3ea469b015491f8622 /python
parente0f173bba7fda35c12788418c6f0f027fb940666 (diff)
parent66a188ab57c187590459866c96bc9d4d23656cef (diff)
downloadvyos-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
Diffstat (limited to 'python')
-rw-r--r--python/vyos/vpp/control_host.py24
1 files changed, 24 insertions, 0 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