From: jspewock@iol.unh.edu
To: npratte@iol.unh.edu, juraj.linkes@pantheon.tech,
Honnappa.Nagarahalli@arm.com, wathsala.vithanage@arm.com,
alex.chapman@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com,
yoan.picchi@foss.arm.com, Luca.Vizzarro@arm.com,
thomas@monjalon.net
Cc: dev@dpdk.org, Jeremy Spewock <jspewock@iol.unh.edu>
Subject: [PATCH v2 2/2] dts: add pf smoke testing suite
Date: Fri, 6 Sep 2024 12:51:51 -0400 [thread overview]
Message-ID: <20240906165151.14668-3-jspewock@iol.unh.edu> (raw)
In-Reply-To: <20240906165151.14668-1-jspewock@iol.unh.edu>
From: Jeremy Spewock <jspewock@iol.unh.edu>
This patch adds a smoke testing suite for Physical Function features.
The goal of this suite is to test some of the most basic features of
DPDK on a physical function and bail out early if any of these features
aren't supported as expected. Unlike DTS smoke tests, these ones are not
included as a switch in the config file and thus are an additional test
suite that developers can include alongside others at their own
discretion.
Depends-on: patch-143594 ("dts: add send_packets to test suites and
rework packet addressing")
Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
dts/framework/config/conf_yaml_schema.json | 3 +-
dts/tests/TestSuite_pf_smoke_tests.py | 121 +++++++++++++++++++++
2 files changed, 123 insertions(+), 1 deletion(-)
create mode 100644 dts/tests/TestSuite_pf_smoke_tests.py
diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json
index f02a310bb5..910134f9e4 100644
--- a/dts/framework/config/conf_yaml_schema.json
+++ b/dts/framework/config/conf_yaml_schema.json
@@ -187,7 +187,8 @@
"enum": [
"hello_world",
"os_udp",
- "pmd_buffer_scatter"
+ "pmd_buffer_scatter",
+ "pf_smoke_tests"
]
},
"test_target": {
diff --git a/dts/tests/TestSuite_pf_smoke_tests.py b/dts/tests/TestSuite_pf_smoke_tests.py
new file mode 100644
index 0000000000..287132e9dd
--- /dev/null
+++ b/dts/tests/TestSuite_pf_smoke_tests.py
@@ -0,0 +1,121 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2024 University of New Hampshire
+"""Physical Function (PF) smoke testing suite.
+
+This test suite tests some of the more common DPDK functionality on a PF. Things such as
+jumbroframes, Receive Side Scaling (RSS) functions, and being able to modify the number of queues
+at runtime should all be supported by PMDs that are capable of running DPDK. Since this is a smoke
+testing suite, it is considered a blocking suite that will stop following ones from running.
+"""
+
+from typing import ClassVar
+
+from scapy.layers.inet import IP # type: ignore[import-untyped]
+from scapy.layers.l2 import Ether # type: ignore[import-untyped]
+from scapy.packet import Raw # type: ignore[import-untyped]
+
+from framework.exception import InteractiveCommandExecutionError, TestCaseVerifyError
+from framework.params.testpmd import SimpleForwardingModes
+from framework.remote_session.testpmd_shell import TestPmdShell
+from framework.test_suite import TestSuite
+
+
+class TestPfSmokeTests(TestSuite):
+ """DPDK Physical Function Testing Suite.
+
+ This test suite is designed to verify the basic functions of DPDK on a PF. The MTU of the ports
+ on the traffic generator are increased to 9000 to support jumboframes for one of the test
+ cases, and then reverted back to 1500 once the test suite is complete.
+
+ Attributes:
+ is_blocking: This test suite will block the execution of all other test suites
+ in the build target after it.
+ """
+
+ is_blocking: ClassVar[bool] = True
+ jumbo_frame_len: ClassVar[int] = 9000
+ num_queues: int = 4
+
+ def set_up_suite(self) -> None:
+ """Increase the MTU of the traffic generator to support jumboframes."""
+ for port_link in self._port_links:
+ self.tg_node.main_session.configure_port_mtu(self.jumbo_frame_len, port_link.tg_port)
+
+ def test_jumbo_frame_support(self) -> None:
+ """Verify that the PF is able to send and receive jumboframes."""
+ with TestPmdShell(
+ self.sut_node,
+ max_pkt_len=self.jumbo_frame_len,
+ mbuf_size=[self.jumbo_frame_len + 128],
+ forward_mode=SimpleForwardingModes.mac,
+ ) as testpmd:
+ testpmd.start()
+ # Take 26 bytes off the MTU size to account for Ethernet headers
+ payload_len = self.jumbo_frame_len - 26
+ packet = Ether() / Raw("X" * payload_len)
+ recv = self.send_packet_and_capture(packet)
+ self.verify(
+ any(hasattr(p, "load") and "X" * 20 in str(p.load) for p in recv),
+ f"Jumboframe was not received even when MTU was set to {self.jumbo_frame_len}.",
+ )
+
+ def test_rss_functionality(self) -> None:
+ """Test that Receive Side Scaling functions are working as intended.
+
+ The primary things to test in this case are that packets that are sent with different
+ destination IP addresses are handled by different queues and that the RSS hash of every
+ packet is unique. Verification of these functionalities is done by sending packets with
+ a unique source MAC addresses so that the packets sent by this test suite can be
+ differentiated from other packets sent to the same port.
+ """
+ with TestPmdShell(
+ self.sut_node,
+ forward_mode=SimpleForwardingModes.rxonly,
+ rx_queues=self.num_queues,
+ tx_queues=self.num_queues,
+ ) as testpmd:
+ testpmd.set_verbose(1)
+ src_max = "00:00:00:00:00:01"
+ send_pkts = [
+ Ether(src=src_max) / IP(dst=f"192.168.0.{i+1}") for i in range(self.num_queues * 4)
+ ]
+ testpmd.start()
+ self.send_packets(send_pkts)
+ verbose_stats = TestPmdShell.extract_verbose_output(testpmd.stop())
+ # Filter down the packets to only the ones with the correct source MAC
+ verbose_stats = list(filter(lambda x: x.src_mac == src_max, verbose_stats))
+ self.verify(
+ len(verbose_stats) > 0, "Testpmd did not receive any packets from the test case."
+ )
+ rss_hashes = [p.rss_hash for p in verbose_stats]
+ self.verify(
+ all(rss_h is not None for rss_h in rss_hashes),
+ "At least one packet did not have an RSS hash.",
+ )
+ self.verify(
+ len(set(rss_hashes)) == len(rss_hashes),
+ "RSS hashes were not unique.",
+ )
+ self.verify(
+ all(any(q == p.queue_id for p in verbose_stats) for q in range(self.num_queues)),
+ "Not all ports were used when packets were sent with different destination "
+ "addresses.",
+ )
+
+ def test_runtime_modify_num_queues(self) -> None:
+ """Ensure that the number of queues on a port can be changed at runtime."""
+ with TestPmdShell(
+ self.sut_node, rx_queues=self.num_queues, tx_queues=self.num_queues
+ ) as testpmd:
+ try:
+ testpmd.set_num_queues_all(2, True, verify=True)
+ testpmd.set_num_queues_all(2, False, verify=True)
+ except InteractiveCommandExecutionError as e:
+ raise TestCaseVerifyError(
+ "Failed to change the number of queues on a port at runtime."
+ ) from e
+
+ def tear_down_suite(self) -> None:
+ """Revert MTU back to a standard value of 1500."""
+ for port_link in self._port_links:
+ self.tg_node.main_session.configure_port_mtu(1500, port_link.tg_port)
--
2.46.0
next prev parent reply other threads:[~2024-09-06 16:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 18:56 [RFC PATCH v1 0/3] dts: pf_smoke port jspewock
2024-08-06 18:56 ` [RFC PATCH v1 1/3] dts: add ability to modify number of queues on a port to testpmd jspewock
2024-08-06 18:56 ` [RFC PATCH v1 2/3] dts: add pf smoke testing suite jspewock
2024-08-06 18:56 ` [RFC PATCH v1 3/3] dts: added pf_smoke_tests to yaml schema jspewock
2024-09-06 16:51 ` [PATCH v2 0/2] dts: pf_smoke port jspewock
2024-09-06 16:51 ` [PATCH v2 1/2] dts: add ability to modify number of queues on a port to testpmd jspewock
2024-09-06 16:51 ` jspewock [this message]
2024-09-26 19:49 ` [PATCH v3 0/2] dts: pf_smoke port jspewock
2024-09-26 19:49 ` [PATCH v3 1/2] dts: add ability to modify number of queues on a port to testpmd jspewock
2024-09-26 19:49 ` [PATCH v3 2/2] dts: add pf smoke testing suite jspewock
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=20240906165151.14668-3-jspewock@iol.unh.edu \
--to=jspewock@iol.unh.edu \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=Luca.Vizzarro@arm.com \
--cc=alex.chapman@arm.com \
--cc=dev@dpdk.org \
--cc=juraj.linkes@pantheon.tech \
--cc=npratte@iol.unh.edu \
--cc=paul.szczepanek@arm.com \
--cc=probb@iol.unh.edu \
--cc=thomas@monjalon.net \
--cc=wathsala.vithanage@arm.com \
--cc=yoan.picchi@foss.arm.com \
/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).