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 AED8843866; Mon, 8 Jan 2024 16:47:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2BA7B402EF; Mon, 8 Jan 2024 16:47:29 +0100 (CET) Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by mails.dpdk.org (Postfix) with ESMTP id 6A6394027E for ; Mon, 8 Jan 2024 16:47:27 +0100 (CET) Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a2a360dbc11so158909366b.2 for ; Mon, 08 Jan 2024 07:47:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1704728847; x=1705333647; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8FH4DO8X/K5z01o4MUqWfLtIipcXBFzWqAqRQWeW17c=; b=NA16Ltv3vTpC3ROiiS+5YDipTlsvrKEbH6DCIh3xEcY2omhLtQK3f6QE0/dMs6rQeB 2uGQEs5EVmTHscqLeL1IU8MFX2mXB9bB5ExQHPf83wZQJ7urtTzxZhssUx/PsR0Sf48M jzc9YllU5PwTgCB5QFtfFBeF53lC7U942gB72cLei93RUf0RnIzrmVjVLFyrAj+XAaeq w0O+IQocEJOS1AxnMnQ9+MhB2f7vryQ+uFrpMkeH33WNQ7D3R9kbQofqrEmZPyRzwg8W aKPufvGGo5mUjQxNiJYs5LIeyllhi+DtyMzrLuWjlJ/rGodBA9dQyz05T7ma2tGSwMIn rQZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704728847; x=1705333647; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8FH4DO8X/K5z01o4MUqWfLtIipcXBFzWqAqRQWeW17c=; b=iOWfHQ41Nkwfen+EU+IwziAXWwHRgBQGLRGhnYFB8uC3qdmsR9B5i5DlUKMEc8U3MH BgPfWWALUaCGEdStWXaLiAxMaV4kj9d3HkgkeouVfwpiDc1439C8GSO22x2Y3n0CHeyL s7ZvmkY7VqZqWPUYRZYO/+Vx71VFjlieN8nYUd463q8ohoqSA9wNb3r3RsZmbSLy5jtG w5rdZFKKMVc5qQtuN8peAzHHrUdUnCaNyVifvERtN2JnHYJvlKIA2k/DtJSIKWyKyEoA E+WsMxNj3AuU/S5NfKWX5zgR8MVFHdS3cGa+CUwvPyV5lUGT8e0IkKrF9XNgefcmhdam Zwig== X-Gm-Message-State: AOJu0Yx4hq82KPFxte1QD0wym+v5zI9WE1+wDtl941mkVX3d+a9NZNUc /HOdjxm3WbUvQb3kPRXazRgS5IZw0u88AlAYA+/Hh3/EofACbQ== X-Google-Smtp-Source: AGHT+IFpTXzhaZ5yHRm1go2f0qQraERphhnLqhH/gbHQgSF7+nT3TfNC5Z2ZVhONJ9bUN34ChrDb6U7GKk4ovAtmsPU= X-Received: by 2002:a17:907:786:b0:a27:f4de:b78f with SMTP id xd6-20020a170907078600b00a27f4deb78fmr1982561ejb.116.1704728846947; Mon, 08 Jan 2024 07:47:26 -0800 (PST) MIME-Version: 1.0 References: <20240103221217.18954-1-jspewock@iol.unh.edu> <20240103223206.23129-1-jspewock@iol.unh.edu> <20240103223206.23129-8-jspewock@iol.unh.edu> In-Reply-To: <20240103223206.23129-8-jspewock@iol.unh.edu> From: =?UTF-8?Q?Juraj_Linke=C5=A1?= Date: Mon, 8 Jan 2024 16:47:16 +0100 Message-ID: Subject: Re: [PATCH v6 7/7] dts: add pmd_buffer_scatter test suite To: jspewock@iol.unh.edu Cc: Honnappa.Nagarahalli@arm.com, thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, lylavoie@iol.unh.edu, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Wed, Jan 3, 2024 at 11:33=E2=80=AFPM wrote: > > From: Jeremy Spewock > > This test suite provides testing of the support of scattered packets by > Poll Mode Drivers using testpmd, verifying the ability to receive and > transmit scattered multi-segment packets made up of multiple > non-contiguous memory buffers. This is tested through 5 different cases > in which the length of the packets sent are less than the mbuf size, > equal to the mbuf size, and 1, 4, and 5 bytes greater than the mbuf size > in order to show both the CRC and the packet data are capable of > existing in the first, second, or both buffers. > > Naturally, if the PMD is capable of forwarding scattered packets which > it receives as input, this shows it is capable of both receiving and > transmitting scattered packets. > > Signed-off-by: Jeremy Spewock > --- > dts/tests/TestSuite_pmd_buffer_scatter.py | 126 ++++++++++++++++++++++ > 1 file changed, 126 insertions(+) > create mode 100644 dts/tests/TestSuite_pmd_buffer_scatter.py > > diff --git a/dts/tests/TestSuite_pmd_buffer_scatter.py b/dts/tests/TestSu= ite_pmd_buffer_scatter.py > new file mode 100644 > index 0000000000..8838c3404f > --- /dev/null > +++ b/dts/tests/TestSuite_pmd_buffer_scatter.py > @@ -0,0 +1,126 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2023-2024 University of New Hampshire > + > +"""Multi-segment packet scattering testing suite. Test suite - I guess this is a copy-paste? > + > +This testing suite tests the support of transmitting and receiving scatt= ered packets. This is shown > +by the Poll Mode Driver being able to forward scattered multi-segment pa= ckets composed of multiple > +non-contiguous memory buffers. To ensure the receipt of scattered packet= s, the DMA rings of the > +port's RX queues must be configured with mbuf data buffers whose size is= less than the maximum > +length. > + > +If it is the case that the Poll Mode Driver can forward scattered packet= s which it receives, then > +this suffices to show the Poll Mode Driver is capable of both receiving = and transmitting scattered > +packets. > +""" We have a newline between the docstring and the import everywhere. > +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.testpmd_shell import TestPmdForwardingMode= s, TestPmdShell > +from framework.test_suite import TestSuite > + > + > +class PmdBufferScatter(TestSuite): > + """DPDK PMD packet scattering test suite. > + > + Configure the Rx queues to have mbuf data buffers whose sizes are sm= aller than the maximum > + packet size. Specifically, set mbuf data buffers to have a size of 2= 048 to fit a full 1512-byte > + (CRC included) ethernet frame in a mono-segment packet. The testing = of scattered packets is > + done by sending a packet whose length is greater than the size of th= e configured size of mbuf > + data buffers. There are a total of 5 packets sent within test cases = which have lengths less > + than, equal to, and greater than the mbuf size. There are multiple p= ackets sent with lengths > + greater than the mbuf size in order to test cases such as: > + > + 1. A single byte of the CRC being in a second buffer while the remai= ning 3 bytes are stored in > + the first buffer alongside packet data. > + 2. The entire CRC being stored in a second buffer while all of the p= acket data is stored in the > + first. > + 3. Most of the packet data being stored in the first buffer and a si= ngle byte of packet data > + stored in a second buffer alongside the CRC. > + """ > + > + def set_up_suite(self) -> None: > + """Set up the test suite. > + > + Setup: > + Verify they we have at least 2 port links in the current exe= cution and increase the MTU Typo - they. > + of both ports on the tg_node to 9000 to support larger packe= t sizes. The description should be code agnostic, so let's use traffic generator node instead of tg_node. > + """ > + self.verify( > + len(self._port_links) > 1, > + "Must have at least two port links to run scatter", I'd like this to be at least "Must have at least two port links to run the scatter test suite" so that it's immediately obvious where this comes from. I'm also debating which of these is better: "Must have at least" or "There must be at least", but I'm not sure. > + ) > + > + 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. send a packet But this also captures a packet, so let's mention that. > + > + Functional test for scatter packets. This is just part of the test. The actual test is the pmd_scatter method with test cases being the callers of pmd_scatter. We should improve this. We mentioned a packet, so let's describe it. > + > + Args: > + pktsize: Size of the packet to generate and send. > + """ > + packet =3D Ether() / IP() / Raw() > + packet.getlayer(2).load =3D "" > + payload_len =3D pktsize - len(packet) - 4 > + payload =3D ["58"] * payload_len > + # pack the payload > + for X_in_hex in payload: > + packet.load +=3D struct.pack("=3DB", int("%s%s" % (X_in_hex[= 0], X_in_hex[1]), 16)) > + received_packets =3D self.send_packet_and_capture(packet) > + self.verify(len(received_packets) > 0, "Did not receive any pack= ets.") > + load =3D hexstr(received_packets[0].getlayer(2), onlyhex=3D1) > + > + return load > + > + def pmd_scatter(self, mbsize: int) -> None: > + """Testpmd support of receiving and sending scattered multi-segm= ent packets. > + > + Support for scattered packets is shown by sending 5 packets of d= iffering 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. > + In the test. > + Test: > + Start testpmd and run functional test with preset mbsize. > + """ > + testpmd =3D self.sut_node.create_interactive_shell( > + TestPmdShell, > + app_parameters=3D( > + "--mbcache=3D200 " > + f"--mbuf-size=3D{mbsize} " > + "--max-pkt-len=3D9000 " > + "--port-topology=3Dpaired " > + "--tx-offloads=3D0x00008000" > + ), > + privileged=3DTrue, > + ) > + testpmd.set_forward_mode(TestPmdForwardingModes.mac) > + testpmd.start() > + > + for offset in [-1, 0, 1, 4, 5]: > + recv_payload =3D self.scatter_pktgen_send_packet(mbsize + of= fset) > + self._logger.debug(f"Payload of scattered packet after forwa= rding: \n{recv_payload}") > + self.verify( > + ("58 " * 8).strip() in recv_payload, > + f"Payload of scattered packet did not match expected pay= load with offset {offset}.", > + ) > + testpmd.stop() > + > + def test_scatter_mbuf_2048(self) -> None: > + """Run :func:`~PmdBufferScatter.pmd_scatter` function with `mbsi= ze` set to 2048.""" This would probably read better as "Run the pmd_scatter test" > + self.pmd_scatter(mbsize=3D2048) > + > + def tear_down_suite(self) -> None: > + """Tear down the test suite. > + > + Teardown: > + Set the MTU of the tg_node back to a more standard size of 1= 500 > + """ > + 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 >