Hi Andrew,

this is a good shout. But be mindful of the implementation.

On 26/11/2025 14:16, Andrew Bailey wrote:
Currently, users must modprobe vfio-pci before running DTS when using a
non-mellanox NIC. This patch automates the process on test run start up.

Signed-off-by: Andrew Bailey <[email protected]>
---
  dts/framework/test_run.py | 8 ++++++++
  1 file changed, 8 insertions(+)

diff --git a/dts/framework/test_run.py b/dts/framework/test_run.py
index ff0a12c9ce..9d7b6271c7 100644
--- a/dts/framework/test_run.py
+++ b/dts/framework/test_run.py
@@ -106,6 +106,7 @@
  from types import MethodType
  from typing import ClassVar, Protocol, Union
+from api.capabilities import LinkTopology
  from framework.config.test_run import TestRunConfiguration
  from framework.context import Context, init_ctx
  from framework.exception import InternalError, SkippedTestException, 
TestCaseVerifyError
@@ -347,6 +348,13 @@ def next(self) -> State | None:
          test_run.ctx.dpdk.setup()
          test_run.ctx.topology.setup()
+ if (
+            test_run.ctx.topology.type != LinkTopology.NO_LINK
+            and test_run.ctx.sut_node.ports[0].config.os_driver_for_dpdk == 
"vfio-pci"
+        ):
+            test_run.ctx.sut_node.main_session.send_command("modprobe vfio")
+            test_run.ctx.sut_node.main_session.send_command("modprobe 
vfio-pci")
+
          if test_run.config.use_virtual_functions:
              test_run.ctx.topology.instantiate_vf_ports()

Loading vfio-pci is perfectly fine in my opinion, but like Patrick already mentioned, this part of the framework should be OS-agnostic, therefore you should place the logic accordingly in Node (load_drivers) and LinuxSession for the actual command.

Since this is part of the Node setup, it should be part of Node.setup and not in test_run.py

Best,
Luca

Reply via email to