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 drivers to their respective ports to solve this problem.
Signed-off-by: Jeremy Spewock <jspew...@iol.unh.edu> --- dts/framework/testbed_model/node.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py index 8e6181e424..85d4eb1f7c 100644 --- a/dts/framework/testbed_model/node.py +++ b/dts/framework/testbed_model/node.py @@ -167,12 +167,12 @@ def set_up_build_target(self, build_target_config: BuildTargetConfiguration) -> the setup steps will be taken. """ self._copy_dpdk_tarball() - self.bind_ports_to_driver() + self.bind_all_ports_to_driver() def tear_down_build_target(self) -> None: """Reset DPDK variables and bind port driver to the OS driver.""" self.__remote_dpdk_dir = None - self.bind_ports_to_driver(for_dpdk=False) + self.bind_all_ports_to_driver(for_dpdk=False) def create_session(self, name: str) -> OSSession: """Create and return a new OS-aware remote session. @@ -317,7 +317,7 @@ def _copy_dpdk_tarball(self) -> None: # then extract to remote path self.main_session.extract_remote_tarball(remote_tarball_path, self._remote_dpdk_dir) - def bind_ports_to_driver(self, for_dpdk: bool = True) -> None: + def bind_all_ports_to_driver(self, for_dpdk: bool = True) -> None: """Bind all ports on the node to a driver. Args: @@ -325,12 +325,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, + ) def create_session(node_config: NodeConfiguration, name: str, logger: DTSLogger) -> OSSession: -- 2.46.0