From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C401745A3B; Thu, 26 Sep 2024 21:50:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0086E402CC; Thu, 26 Sep 2024 21:50:01 +0200 (CEST) Received: from mail-pf1-f229.google.com (mail-pf1-f229.google.com [209.85.210.229]) by mails.dpdk.org (Postfix) with ESMTP id 7D2DD40279 for ; Thu, 26 Sep 2024 21:49:58 +0200 (CEST) Received: by mail-pf1-f229.google.com with SMTP id d2e1a72fcca58-71923d87be4so1117654b3a.0 for ; Thu, 26 Sep 2024 12:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1727380197; x=1727984997; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hWIOoJyTEGObJWzVhmPwnkGrS4POaInbazT2gvTQEuw=; b=GphkiO7oVhNj/+ajhU3UdLbGFbAqDsRafixActUFDDk2ADk+OMbLPuJ1H2xiHwd2Yp 0X63Pza0GKQAIeEVFIwmT5/pN+mk5u3c5muZexcyr1LsGHwcYY3JamOq3Rt8k2LrHc3K HY0XnpqPdWWbF1TRJqNAoBU2MP4gFvrkK5igE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727380197; x=1727984997; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hWIOoJyTEGObJWzVhmPwnkGrS4POaInbazT2gvTQEuw=; b=SJEEuBpOTaI7c4JCeajsRpQtuHNqqEZTw1RZIf1B5ekpbEPn15b6qw1GjbikiS3v2m wUxxLfOuiDrsqRLatdeyzjgJjJQHhvUDM6J6mjHtiwLvrft6mLe4owHxJd5H4QqBeC2t 0T7UliAPvgVUFgnKuKb0gf9HA3BpYBKJvZhiKueLbaL6lUnfhCZ09rVrNPUqUnnnls+t 2Gljs7Szl6WKIUgbUzRszN5Ioe0QW4RmWEnXOYd349O4w66MtxpYt4fn0f2t9QlPxIjK Cu2FVjq/qd2WiKVdRv9sUaeP+Z5hkxTkwpiwZ5dZ/kP6xiimJgYV7qnd/Q2hgXOu2mHW mqOw== X-Gm-Message-State: AOJu0YwHbHBdMTob7brQhkikNAHC0fWUAGUEmMQLHdKnRNjJJSU0jY/M J57aTD3CLizHMLUnnSbItUtcqALntutAZB1XOTZUzVohDjHSIqsIbCVCUIeO+hHlXk+jT2HIcUl BFJClHVz+B7sdjQAR3LmIwEX/wqOWJLvDDbMk3j8+ayw+1KrA X-Google-Smtp-Source: AGHT+IEGZCN5+ap0EM1X6K6DkKnREhu5M3iSOZqegmEFohuFpbEn+cu3/lCVPfJ/EcvMR2IMy3BOpyn0UqAG X-Received: by 2002:a05:6a00:13a1:b0:717:88b6:6b1e with SMTP id d2e1a72fcca58-71b260487eemr1332312b3a.18.1727380197551; Thu, 26 Sep 2024 12:49:57 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [2606:4100:3880:1234::84]) by smtp-relay.gmail.com with ESMTPS id d2e1a72fcca58-71b26495a35sm35159b3a.4.2024.09.26.12.49.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2024 12:49:57 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1257::1083]) by postal.iol.unh.edu (Postfix) with ESMTP id 1E041605C351; Thu, 26 Sep 2024 15:49:56 -0400 (EDT) From: jspewock@iol.unh.edu To: alex.chapman@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech, thomas@monjalon.net, npratte@iol.unh.edu, probb@iol.unh.edu, Luca.Vizzarro@arm.com, wathsala.vithanage@arm.com, Honnappa.Nagarahalli@arm.com, yoan.picchi@foss.arm.com Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v3 2/2] dts: add pf smoke testing suite Date: Thu, 26 Sep 2024 15:49:41 -0400 Message-ID: <20240926194941.17582-3-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240926194941.17582-1-jspewock@iol.unh.edu> References: <20240806185631.335737-1-jspewock@iol.unh.edu> <20240926194941.17582-1-jspewock@iol.unh.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Jeremy Spewock 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. Signed-off-by: Jeremy Spewock --- Depends-on: series-33147 ("dts: adjust packet addressing and add send_packets to test_suite") 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 df390e8ae2..c15f960318 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