[RFC,v3,1/5] dts: allow binding only a single port to a different driver
Checks
Commit Message
From: Jeremy Spewock <jspewock@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.
Depends-on: patch-143101 ("dts: add binding to different drivers to TG
node")
Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
dts/framework/testbed_model/node.py | 21 ++++++++++++---------
dts/tests/TestSuite_os_udp.py | 4 ++--
2 files changed, 14 insertions(+), 11 deletions(-)
@@ -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:
@@ -23,7 +23,7 @@ def set_up_suite(self) -> None:
Bind the SUT ports to the OS driver, configure the ports and configure the SUT
to route traffic from if1 to if2.
"""
- self.sut_node.bind_ports_to_driver(for_dpdk=False)
+ self.sut_node.bind_all_ports_to_driver(for_dpdk=False)
self.configure_testbed_ipv4()
def test_os_udp(self) -> None:
@@ -50,4 +50,4 @@ def tear_down_suite(self) -> None:
"""
self.configure_testbed_ipv4(restore=True)
# Assume other suites will likely need dpdk driver
- self.sut_node.bind_ports_to_driver(for_dpdk=True)
+ self.sut_node.bind_all_ports_to_driver(for_dpdk=True)