Once DTS completes execution, it re-binds ports to the drivers they were initially bound to. However, when a port was not bound to any drivers, it would raise an error when the bind command was run. This patch resolves this issue, and properly unbinds a driver if it was unbound before DTS execution began.
Signed-off-by: Koushik Bhargav Nimoji <[email protected]> --- dts/framework/testbed_model/linux_session.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py index c118f803b6..1297c301b5 100644 --- a/dts/framework/testbed_model/linux_session.py +++ b/dts/framework/testbed_model/linux_session.py @@ -272,13 +272,19 @@ def bind_ports_to_driver(self, ports: list[Port], driver_name: str) -> None: """ ports_pci_addrs = " ".join(port.pci for port in ports) - self.send_command( - f"{self.devbind_script_path} -b {driver_name} --force {ports_pci_addrs}", - privileged=True, - verify=True, - ) + if not driver_name: + self.send_command( + f"{self.devbind_script_path} -u {ports_pci_addrs}", privileged=True, verify=True + ) + else: + self.send_command( + f"{self.devbind_script_path} -b {driver_name} --force {ports_pci_addrs}", + privileged=True, + verify=True, + ) - del self._lshw_net_info + if self._lshw_net_info: + del self._lshw_net_info def bring_up_link(self, ports: Iterable[Port]) -> None: """Overrides :meth:`~.os_session.OSSession.bring_up_link`.""" -- 2.55.0

