From: Patrick Robb <probb@iol.unh.edu>
To: Paul.Szczepanek@arm.com
Cc: dev@dpdk.org, Luca.Vizzarro@arm.com, npratte@iol.unh.edu,
dmarx@iol.unh.edu, Patrick Robb <probb@iol.unh.edu>,
Jeremy Spewock <jspewock@iol.unh.edu>
Subject: [PATCH v5 2/2] dts: add VF configuration and workflow
Date: Wed, 12 Mar 2025 23:36:11 -0400 [thread overview]
Message-ID: <20250313033611.1896695-3-probb@iol.unh.edu> (raw)
In-Reply-To: <20250313033611.1896695-1-probb@iol.unh.edu>
This patch adds an additional test run config option for
selecting physical functions or virtual functions for the
testrun. If virtual function is selected, it adds a workflow
for creating the virtual functions during test run setup.
Bugzilla ID: 1500
Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
Signed-off-by: Patrick Robb <probb@iol.unh.edu>
---
dts/framework/config/test_run.py | 2 ++
dts/framework/remote_session/dpdk.py | 11 +++++++++--
dts/framework/test_run.py | 7 ++++++-
dts/framework/testbed_model/node.py | 5 +++++
dts/framework/testbed_model/port.py | 16 ++++++++++++++++
dts/test_run.example.yaml | 1 +
6 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/dts/framework/config/test_run.py b/dts/framework/config/test_run.py
index 06fe28143c..2298960f48 100644
--- a/dts/framework/config/test_run.py
+++ b/dts/framework/config/test_run.py
@@ -464,6 +464,8 @@ class TestRunConfiguration(FrozenModel):
perf: bool
#: Whether to run functional tests.
func: bool
+ #: Whether to run the testing with virtual functions instead of physical functions
+ virtual_functions_testrun: bool
#: Whether to skip smoke tests.
skip_smoke_tests: bool = False
#: The names of test suites and/or test cases to execute.
diff --git a/dts/framework/remote_session/dpdk.py b/dts/framework/remote_session/dpdk.py
index 8d9f3b8948..b0445caded 100644
--- a/dts/framework/remote_session/dpdk.py
+++ b/dts/framework/remote_session/dpdk.py
@@ -415,12 +415,19 @@ def __init__(
self._ports_bound_to_dpdk = False
self._kill_session = None
- def setup(self, ports: Iterable[Port]):
+ def setup(self, ports: Iterable[Port], vf_ports: bool):
"""Set up the DPDK runtime on the target node."""
if self.build:
self.build.setup()
self._prepare_devbind_script()
- self.bind_ports_to_driver(ports)
+
+ if not vf_ports:
+ # for PF test, bind PFs to the DPDK driver
+ self.bind_ports_to_driver(ports)
+ else:
+ # for VF test, leave PFs bound to kernel driver. Bind each PF's VFs to the DPDK driver
+ for port in ports:
+ self.bind_ports_to_driver(port.virtual_functions)
def teardown(self, ports: Iterable[Port]) -> None:
"""Reset DPDK variables and bind port driver to the OS driver."""
diff --git a/dts/framework/test_run.py b/dts/framework/test_run.py
index f9cfe5e908..9fe30113c2 100644
--- a/dts/framework/test_run.py
+++ b/dts/framework/test_run.py
@@ -202,6 +202,9 @@ def __init__(
for link in self.config.port_topology
)
+ if self.config.virtual_functions_testrun:
+ sut_node.set_vfs()
+
dpdk_build_env = DPDKBuildEnvironment(config.dpdk.build, sut_node)
dpdk_runtime_env = DPDKRuntimeEnvironment(config.dpdk, sut_node, dpdk_build_env)
traffic_generator = create_traffic_generator(config.traffic_generator, tg_node)
@@ -344,7 +347,9 @@ def next(self) -> State | None:
test_run.ctx.sut_node.setup()
test_run.ctx.tg_node.setup()
- test_run.ctx.dpdk.setup(test_run.ctx.topology.sut_ports)
+ test_run.ctx.dpdk.setup(
+ test_run.ctx.topology.sut_ports, test_run.config.virtual_functions_testrun
+ )
test_run.ctx.tg.setup(test_run.ctx.topology.tg_ports)
self.result.ports = test_run.ctx.topology.sut_ports + test_run.ctx.topology.tg_ports
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index e6737cd173..ac4f44550b 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -185,6 +185,11 @@ def close(self) -> None:
for session in self._other_sessions:
session.close()
+ def set_vfs(self):
+ """Iterate through node ports and create VFs."""
+ for port in self.ports:
+ port.set_vfs()
+
def create_session(node_config: NodeConfiguration, name: str, logger: DTSLogger) -> OSSession:
"""Factory for OS-aware sessions.
diff --git a/dts/framework/testbed_model/port.py b/dts/framework/testbed_model/port.py
index f638120eeb..e47ee7948e 100644
--- a/dts/framework/testbed_model/port.py
+++ b/dts/framework/testbed_model/port.py
@@ -26,6 +26,7 @@ class Port:
mac_address: The MAC address of the port.
logical_name: The logical name of the port.
bound_for_dpdk: :data:`True` if the port is bound to the driver for DPDK.
+ virtual_functions: The list of virtual functions on the port.
"""
node: Final["Node"]
@@ -33,6 +34,7 @@ class Port:
mac_address: Final[str]
logical_name: Final[str]
bound_for_dpdk: bool
+ virtual_functions: list["Port"]
def __init__(self, node: "Node", config: PortConfig):
"""Initialize the port from `node` and `config`.
@@ -45,6 +47,7 @@ def __init__(self, node: "Node", config: PortConfig):
self.config = config
self.logical_name, self.mac_address = node.main_session.get_port_info(config.pci)
self.bound_for_dpdk = False
+ self.virtual_functions = []
@property
def name(self) -> str:
@@ -64,6 +67,19 @@ def configure_mtu(self, mtu: int):
"""
return self.node.main_session.configure_port_mtu(mtu, self)
+ def set_vfs(self):
+ """Create virtual functions for the port."""
+ self.node.main_session.create_vfs(self)
+ addr_list = self.node.main_session.get_pci_addr_of_vfs(self)
+ for addr in addr_list:
+ vf_port_config = PortConfig(
+ name=f"{self.name}-vf-{addr}",
+ pci=addr,
+ os_driver_for_dpdk=self.config.os_driver_for_dpdk,
+ os_driver=self.config.os_driver,
+ )
+ self.virtual_functions.append(Port(self.node, vf_port_config))
+
def to_dict(self) -> dict[str, Any]:
"""Convert to a dictionary."""
return {
diff --git a/dts/test_run.example.yaml b/dts/test_run.example.yaml
index 330a31bb18..16d15dc568 100644
--- a/dts/test_run.example.yaml
+++ b/dts/test_run.example.yaml
@@ -27,6 +27,7 @@ traffic_generator:
type: SCAPY
perf: false # disable performance testing
func: true # enable functional testing
+virtual_functions_testrun: false # testsuites are run from physical functions if set to false, and virtual functions if set to true
skip_smoke_tests: false # optional
# by removing the `test_suites` field, this test run will run every test suite available
test_suites: # the following test suites will be run in their entirety
--
2.48.1
next prev parent reply other threads:[~2025-03-13 3:40 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 19:15 [RFC PATCH v1 0/5] dts: add VFs to the framework jspewock
2024-08-21 19:15 ` [RFC PATCH v1 1/5] dts: allow binding only a single port to a different driver jspewock
2024-08-21 19:15 ` [RFC PATCH v1 2/5] dts: parameterize what ports the TG sends packets to jspewock
2024-08-21 19:15 ` [RFC PATCH v1 3/5] dts: add class for virtual functions jspewock
2024-08-21 19:15 ` [RFC PATCH v1 4/5] dts: add OS abstractions for creating " jspewock
2024-08-21 19:15 ` [RFC PATCH v1 5/5] dts: add functions for managing VFs to Node jspewock
2024-08-21 19:21 ` [RFC PATCH v2 0/5] dts: add VFs to the framework jspewock
2024-08-21 19:21 ` [RFC PATCH v2 1/5] dts: allow binding only a single port to a different driver jspewock
2024-08-21 19:21 ` [RFC PATCH v2 2/5] dts: parameterize what ports the TG sends packets to jspewock
2024-08-21 19:21 ` [RFC PATCH v2 3/5] dts: add class for virtual functions jspewock
2024-08-21 19:21 ` [RFC PATCH v2 4/5] dts: add OS abstractions for creating " jspewock
2024-08-21 19:21 ` [RFC PATCH v2 5/5] dts: add functions for managing VFs to Node jspewock
2024-08-21 19:38 ` [RFC PATCH v2 0/5] dts: add VFs to the framework jspewock
2024-08-21 19:38 ` [RFC PATCH v2 1/5] dts: allow binding only a single port to a different driver jspewock
2024-08-21 19:38 ` [RFC PATCH v2 2/5] dts: parameterize what ports the TG sends packets to jspewock
2024-08-21 19:38 ` [RFC PATCH v2 3/5] dts: add class for virtual functions jspewock
2024-08-21 19:38 ` [RFC PATCH v2 4/5] dts: add OS abstractions for creating " jspewock
2024-08-21 19:38 ` [RFC PATCH v2 5/5] dts: add functions for managing VFs to Node jspewock
2024-08-21 19:44 ` [RFC PATCH v2 0/5] dts: add VFs to the framework Jeremy Spewock
2024-08-21 21:30 ` [RFC PATCH v3 " jspewock
2024-08-21 21:30 ` [RFC PATCH v3 1/5] dts: allow binding only a single port to a different driver jspewock
2024-08-21 21:30 ` [RFC PATCH v3 2/5] dts: parameterize what ports the TG sends packets to jspewock
2024-08-21 21:30 ` [RFC PATCH v3 3/5] dts: add class for virtual functions jspewock
2024-08-21 21:30 ` [RFC PATCH v3 4/5] dts: add OS abstractions for creating " jspewock
2024-08-21 21:30 ` [RFC PATCH v3 5/5] dts: add functions for managing VFs to Node jspewock
2024-09-23 18:42 ` [PATCH v4 0/5] dts: add VFs to the framework jspewock
2024-09-23 18:42 ` [PATCH v4 1/5] dts: allow binding only a single port to a different driver jspewock
2024-09-25 8:45 ` Juraj Linkeš
2024-11-14 16:45 ` Luca Vizzarro
2024-09-23 18:42 ` [PATCH v4 2/5] dts: parameterize what ports the TG sends packets to jspewock
2024-09-25 10:58 ` Juraj Linkeš
2024-11-14 17:01 ` Luca Vizzarro
2024-09-23 18:42 ` [PATCH v4 3/5] dts: add class for virtual functions jspewock
2024-09-25 11:28 ` Juraj Linkeš
2024-11-14 17:10 ` Luca Vizzarro
2024-09-23 18:42 ` [PATCH v4 4/5] dts: add OS abstractions for creating " jspewock
2024-09-25 12:05 ` Juraj Linkeš
2024-11-14 17:29 ` Luca Vizzarro
2024-09-23 18:42 ` [PATCH v4 5/5] dts: add functions for managing VFs to Node jspewock
2024-09-25 13:29 ` Juraj Linkeš
2024-11-14 17:36 ` Luca Vizzarro
2024-09-25 8:24 ` [PATCH v4 0/5] dts: add VFs to the framework Juraj Linkeš
2025-03-13 3:36 ` [PATCH v5 0/2] " Patrick Robb
2025-03-13 3:36 ` [PATCH v5 1/2] dts: add OS abstractions for creating virtual functions Patrick Robb
2025-03-13 12:53 ` Patrick Robb
2025-06-11 20:24 ` Patrick Robb
2025-03-13 3:36 ` Patrick Robb [this message]
2025-03-13 12:56 ` [PATCH v5 2/2] dts: add VF configuration and workflow Patrick Robb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250313033611.1896695-3-probb@iol.unh.edu \
--to=probb@iol.unh.edu \
--cc=Luca.Vizzarro@arm.com \
--cc=Paul.Szczepanek@arm.com \
--cc=dev@dpdk.org \
--cc=dmarx@iol.unh.edu \
--cc=jspewock@iol.unh.edu \
--cc=npratte@iol.unh.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).