[PATCH v4 7/8] dts: support virtio PCI ports

Isaac Boukris iboukris at gmail.com
Wed Nov 18 09:27:51 CET 2026


DTS reads the logical name and the MAC address of a port from the
lshw entry of its PCI device. A virtio device has none there, because
lshw lists its network interface as an entry of its own, on the
virtio bus, right after the PCI device. The test run setup then
fails:

  Could not gather a valid MAC address and/or logical name for port
  port-0 in node SUT 1.

Copy to the PCI entry what it lacks from the entry of its interface.

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
---
v4: shorter commit message, no code change.

 dts/framework/testbed_model/linux_session.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
index 786e8c4eb4..40cc87adaf 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -438,7 +438,14 @@ def get_pci_addr_of_vfs(self, pf_port: Port) -> list[str]:
     @cached_property
     def _lshw_net_info(self) -> list[LshwOutput]:
         output = self.send_command("lshw -quiet -json -C network", verify=True)
-        return json.loads(output.stdout)
+        ports = json.loads(output.stdout)
+        # The network interface of a virtio device is an entry of its own, on the virtio bus,
+        # right after the entry of the PCI device. Copy from it what the PCI entry lacks.
+        for device, interface in zip(ports, ports[1:]):
+            if "logicalname" not in device and interface.get("businfo", "").startswith("virtio@"):
+                configuration = interface.get("configuration", {}) | device.get("configuration", {})
+                device.update(interface | device | {"configuration": configuration})
+        return ports
 
     def refresh_lshw(self) -> None:
         """Force refresh of cached lshw network info."""
-- 
2.56.1



More information about the dev mailing list