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 230634373D; Mon, 18 Dec 2023 19:13:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6CA2742DE4; Mon, 18 Dec 2023 19:13:11 +0100 (CET) Received: from mail-pj1-f99.google.com (mail-pj1-f99.google.com [209.85.216.99]) by mails.dpdk.org (Postfix) with ESMTP id 7F3A942DBD for ; Mon, 18 Dec 2023 19:13:07 +0100 (CET) Received: by mail-pj1-f99.google.com with SMTP id 98e67ed59e1d1-28ba05b28adso559405a91.3 for ; Mon, 18 Dec 2023 10:13:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1702923187; x=1703527987; 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=pevtUiibpYkj+q7d6fx0I7sMOIG/sZC5tn+zdVPUPY8=; b=hRQRnHmXbXcxe+xWqfuEhJV0Dq2fjnj7YLTFZPCvuJmX0VgdhNBhsbrFJAxnY9db0G acURakP0aHTICYRxR+TU0LCoQn3Rf3hlQyrg2PqIBgmEO0Ir7+974QzKj5phoYh2SKTn 1vSlNUBzF4mz4/R19N/xAIH+HQwEEH1l5xkLs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702923187; x=1703527987; 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=pevtUiibpYkj+q7d6fx0I7sMOIG/sZC5tn+zdVPUPY8=; b=bgxSJO7gCl2+m9ZGOW5iulfGnUExO2YCuVriLLfeKT7Ng3flkZrMSovVw4kniYIJ/a d4OUjvS7vM2Jt2O5KwqJnjK+QEdareLyZ3A+MqHcfS8wGIjX0tbjPhV9nJzBd8D9JwGn fgzXasuo6uRcOBsJoLLayOxSLaSAb4YnyALcYDMgHJ9mbH/gXpizN1BJYbAEniopKUCu Z4f/qmF442PVy30nc1a2UUV9YYzQi3K6bxLoTxAFyEFzIbNSLxeGKzz6fObnRSChXGAt Mk+F5nLAKiTq+kWwnKohXRdPFCCI5GT+dZj5UJYUlmzM4G9qXKxRsS+0kYznQSzyhHJ2 2SCA== X-Gm-Message-State: AOJu0YzVodF1vWevMDXglRuqAXXQ4O2k73SCdkVeBfUJL2jOc7au487l /H4dHdXYIknBizvc2FuJSwGmX0V39JAsQ0Dl6Y86YxPKLgS3NQ== X-Google-Smtp-Source: AGHT+IH8iJL0wGbutiWnVJkQnhaC23DFtkmzYG2QppjU9+97qa7wA+ZHuSSM9vUV59thqtPyCR2vzDUnyDEX X-Received: by 2002:a17:90b:354b:b0:28b:8e37:4e62 with SMTP id lt11-20020a17090b354b00b0028b8e374e62mr832983pjb.10.1702923186678; Mon, 18 Dec 2023 10:13:06 -0800 (PST) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [132.177.123.84]) by smtp-relay.gmail.com with ESMTPS id oe4-20020a17090b394400b0028b736f8790sm264665pjb.4.2023.12.18.10.13.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2023 10:13:06 -0800 (PST) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1271:90f9:1b64:f6e6:867f]) by postal.iol.unh.edu (Postfix) with ESMTP id A4885605C312; Mon, 18 Dec 2023 13:13:05 -0500 (EST) From: jspewock@iol.unh.edu To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v4 7/7] dts: add scatter test suite Date: Mon, 18 Dec 2023 13:12:21 -0500 Message-ID: <20231218181221.10057-8-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231218181221.10057-1-jspewock@iol.unh.edu> References: <20231218181221.10057-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 test suite provides testing the support of scattered packets by Poll Mode Drivers using testpmd. It incorporates 5 different test cases which test the sending and receiving of packets with lengths that are less than the mbuf data buffer size, the same as the mbuf data buffer size, and the mbuf data buffer size plus 1, 4, and 5. The goal of this test suite is to align with the existing dts test plan for scattered packets within DTS. Signed-off-by: Jeremy Spewock --- dts/tests/TestSuite_pmd_buffer_scatter.py | 105 ++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 dts/tests/TestSuite_pmd_buffer_scatter.py diff --git a/dts/tests/TestSuite_pmd_buffer_scatter.py b/dts/tests/TestSuite_pmd_buffer_scatter.py new file mode 100644 index 0000000000..8e2a32a1aa --- /dev/null +++ b/dts/tests/TestSuite_pmd_buffer_scatter.py @@ -0,0 +1,105 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2023 University of New Hampshire + +"""Multi-segment packet scattering testing suite. + +Configure the Rx queues to have mbuf data buffers whose sizes are smaller than the maximum packet +size (currently set to 2048 to fit a full 1512-byte ethernet frame) and send a total of 5 packets +with lengths less than, equal to, and greater than the mbuf size (CRC included). +""" +import struct + +from scapy.layers.inet import IP # type: ignore[import] +from scapy.layers.l2 import Ether # type: ignore[import] +from scapy.packet import Raw # type: ignore[import] +from scapy.utils import hexstr # type: ignore[import] + +from framework.remote_session.remote.testpmd_shell import ( + TestPmdForwardingModes, + TestPmdShell, +) +from framework.test_suite import TestSuite + + +class PmdBufferScatter(TestSuite): + """DPDK packet scattering test suite. + + Attributes: + mbsize: The size to se the mbuf to be. + """ + + mbsize: int + + def set_up_suite(self) -> None: + self.verify( + len(self._port_links) > 1, + "Must have at least two port links to run scatter", + ) + + self.tg_node.main_session.configure_port_mtu(9000, self._tg_port_egress) + self.tg_node.main_session.configure_port_mtu(9000, self._tg_port_ingress) + + def scatter_pktgen_send_packet(self, pktsize: int) -> str: + """Generate and send packet to the SUT. + + Functional test for scatter packets. + + Args: + pktsize: Size of the packet to generate and send. + """ + packet = Ether() / IP() / Raw() + packet.getlayer(2).load = "" + payload_len = pktsize - len(packet) - 4 + payload = ["58"] * payload_len + # pack the payload + for X_in_hex in payload: + packet.load += struct.pack("=B", int("%s%s" % (X_in_hex[0], X_in_hex[1]), 16)) + load = hexstr(packet.getlayer(2), onlyhex=1) + received_packets = self.send_packet_and_capture(packet) + self.verify(len(received_packets) > 0, "Did not receive any packets.") + load = hexstr(received_packets[0].getlayer(2), onlyhex=1) + + return load + + def pmd_scatter(self) -> None: + """Testpmd support of receiving and sending scattered multi-segment packets. + + Support for scattered packets is shown by sending 5 packets of differing length + where the length of the packet is calculated by taking mbuf-size + an offset. The + offsets used in the test case are -1, 0, 1, 4, 5 respectively. + + Test: + Start testpmd and run functional test with preset mbsize. + """ + testpmd = self.sut_node.create_interactive_shell( + TestPmdShell, + app_parameters=( + "--mbcache=200 " + f"--mbuf-size={self.mbsize} " + "--max-pkt-len=9000 " + "--port-topology=paired " + "--tx-offloads=0x00008000" + ), + privileged=True, + ) + testpmd.set_forward_mode(TestPmdForwardingModes.mac) + testpmd.start() + link_is_up = testpmd.wait_link_status_up(0) and testpmd.wait_link_status_up(1) + self.verify(link_is_up, "Links never came up in TestPMD.") + + for offset in [-1, 0, 1, 4, 5]: + recv_payload = self.scatter_pktgen_send_packet(self.mbsize + offset) + self.verify( + ("58 " * 8).strip() in recv_payload, + "Received packet had incorrect payload", + ) + testpmd.stop() + + def test_scatter_mbuf_2048(self) -> None: + """Run :func:`~PmdBufferScatter.pmd_scatter` function after setting the `mbsize` to 2048.""" + self.mbsize = 2048 + self.pmd_scatter() + + def tear_down_suite(self) -> None: + self.tg_node.main_session.configure_port_mtu(1500, self._tg_port_egress) + self.tg_node.main_session.configure_port_mtu(1500, self._tg_port_ingress) -- 2.43.0