On 23. 9. 2024 20:42, jspew...@iol.unh.edu wrote:
From: Jeremy Spewock <jspew...@iol.unh.edu> Previously the DTS framework only included methods that bind all ports that the test run was aware of to either the DPDK driver or the OS driver. There are however some cases, like creating virtual functions, where you would want some ports bound to the OS driver and others bound to their DPDK driver. This patch adds the ability to bind individual ports to their respective drviers to solve this problem.
Typo: drviers
Depends-on: patch-144318 ("dts: add binding to different drivers to TG node") Signed-off-by: Jeremy Spewock <jspew...@iol.unh.edu> --- dts/framework/testbed_model/node.py | 21 ++++++++++++--------- dts/tests/TestSuite_os_udp.py | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
@@ -266,12 +266,15 @@ def bind_ports_to_driver(self, for_dpdk: bool = True) -> None: If :data:`False`, binds to os_driver. """ for port in self.ports: - driver = port.os_driver_for_dpdk if for_dpdk else port.os_driver - self.main_session.send_command( - f"{self.path_to_devbind_script} -b {driver} --force {port.pci}", - privileged=True, - verify=True, - ) + self._bind_port_to_driver(port, for_dpdk) + + def _bind_port_to_driver(self, port: Port, for_dpdk: bool = True) -> None: + driver = port.os_driver_for_dpdk if for_dpdk else port.os_driver + self.main_session.send_command( + f"{self.path_to_devbind_script} -b {driver} --force {port.pci}", + privileged=True, + verify=True, + )
I noticed we're doing this port by port, but we can bind multiple ports in one devbind run - just pass all ports to it. I think this improvement is well worth it.