From patchwork Tue Aug 6 12:51:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Vizzarro X-Patchwork-Id: 142954 X-Patchwork-Delegate: juraj.linkes@pantheon.tech Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 236714574D; Tue, 6 Aug 2024 14:53:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D38942F00; Tue, 6 Aug 2024 14:53:07 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id B628D42EEF for ; Tue, 6 Aug 2024 14:53:04 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DE182FEC; Tue, 6 Aug 2024 05:53:29 -0700 (PDT) Received: from localhost.localdomain (JR4XG4HTQC.cambridge.arm.com [10.1.36.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 573D23F766; Tue, 6 Aug 2024 05:53:03 -0700 (PDT) From: Luca Vizzarro To: dev@dpdk.org Cc: Jeremy Spewock , =?utf-8?q?Juraj_Linke=C5=A1?= , Honnappa Nagarahalli , Luca Vizzarro , Paul Szczepanek Subject: [PATCH] dts: add l2fwd test suite Date: Tue, 6 Aug 2024 13:51:40 +0100 Message-Id: <20240806125140.2582859-1-luca.vizzarro@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 Add a basic L2 forwarding test suite which tests the correct functionality of the forwarding facility built-in in the DPDK. The tests are performed with different queues numbers per port. Bugzilla ID: 1481 Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek Reviewed-by: Dean Marx Reviewed-by: Patrick Robb Tested-by: Patrick Robb Reviewed-by: Nicholas Pratte Tested-by: Nicholas Pratte --- Depends-on: series-32714 ("dts: add pktgen and testpmd changes") --- dts/framework/config/conf_yaml_schema.json | 3 +- dts/tests/TestSuite_l2fwd.py | 58 ++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 dts/tests/TestSuite_l2fwd.py diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json index df390e8ae2..58a719a923 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", + "l2fwd" ] }, "test_target": { diff --git a/dts/tests/TestSuite_l2fwd.py b/dts/tests/TestSuite_l2fwd.py new file mode 100644 index 0000000000..46f07b78eb --- /dev/null +++ b/dts/tests/TestSuite_l2fwd.py @@ -0,0 +1,58 @@ +"""Basic L2 forwarding test suite. + +This testing suites runs basic L2 forwarding on testpmd with different queue sizes per port. +The forwarding test is performed with several packets being sent at once. +""" + +from framework.params.testpmd import EthPeer, SimpleForwardingModes +from framework.remote_session.testpmd_shell import TestPmdShell +from framework.test_suite import TestSuite +from framework.testbed_model.cpu import LogicalCoreCount +from framework.utils import generate_random_packets + + +class TestL2fwd(TestSuite): + """L2 forwarding test suite.""" + + #: The total number of packets to generate and send for forwarding. + NUMBER_OF_PACKETS_TO_SEND = 50 + #: The payload size to use for the generated packets in bytes. + PAYLOAD_SIZE = 100 + + def set_up_suite(self) -> None: + """Set up the test suite. + + Setup: + Verify that we have at least 2 ports in the current test. Generate the random packets + that will be sent and spawn a reusable testpmd shell. + """ + self.verify(len(self.sut_node.ports) >= 2, "At least 2 ports are required for this test.") + self.packets = generate_random_packets(self.NUMBER_OF_PACKETS_TO_SEND, self.PAYLOAD_SIZE) + + def test_l2fwd_integrity(self) -> None: + """Test the L2 forwarding integrity. + + Test: + Configure a testpmd shell with a different numbers of queues per run. Start up L2 + forwarding, send random packets from the TG and verify they were all received back. + """ + queues = [1, 2, 4, 8] + + with TestPmdShell( + self.sut_node, + lcore_filter_specifier=LogicalCoreCount(cores_per_socket=4), + forward_mode=SimpleForwardingModes.mac, + eth_peer=[EthPeer(1, self.tg_node.ports[1].mac_address)], + disable_device_start=True, + ) as shell: + for queues_num in queues: + self._logger.info(f"Testing L2 forwarding with {queues_num} queue(s)") + shell.set_ports_queues(queues_num) + shell.start() + + received_packets = self.send_packets_and_capture(self.packets) + + expected_packets = [self.get_expected_packet(packet) for packet in self.packets] + self.match_all_packets(expected_packets, received_packets) + + shell.stop()