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 2FAF14577B; Fri, 9 Aug 2024 19:23:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 56C5B42F41; Fri, 9 Aug 2024 19:23:36 +0200 (CEST) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id 80EE142FF7 for ; Fri, 9 Aug 2024 19:23:34 +0200 (CEST) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1ff4568676eso22327105ad.0 for ; Fri, 09 Aug 2024 10:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1723224213; x=1723829013; 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=T0/Kn04t1wd4m+NUkGISd8c9DW0GhrBU46vSVMqocVk=; b=ZVaaYWvtwRI8p488GFxShpbcX2ojq0+fomk2ABZRmOTiEJNB06DEWkEehXJJ6w1TcP E4OjSBBt4RbriRVsZqOMHS0oSPG+xr+2o9Ym0TV8BdNjzHbFShlIJe+3G0B/PZw4uWp2 8HiPPgayrurmr6FZrhrKn98aVcP4v7i5ceAlQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723224213; x=1723829013; 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=T0/Kn04t1wd4m+NUkGISd8c9DW0GhrBU46vSVMqocVk=; b=aJ9A4m5OZ6Yw0cNkXjE+P7SaDLXC1PKCp7gzgXz6Xyiclf+v39YAvuQ6D8PeLLNYPe h3Xq5sgCSMD9wCLBlLKyQxB9XyZ2Rvpa6y8DgimXaTUoYlqTWYMemhlO+j6pgym0QeH/ x4+kQBw3p8D7HOZAsjdHyN8qUzs/LyrH8R0wGvGkHy54NXL6T66Efbiggf+Vkq9y01la PsaID8n9uhSb1r4Z5VSAFI4bwWfgtwVunl6wUS7R0HquP74l1Fg4qeAYOuLzyUFuXAgn 6lkIajqjMy/vUnQdE5KOKnnageCWpwneGWEkMCtt7j5sD+9iNzxLxmYwStehCyo9lMBR oU/w== X-Forwarded-Encrypted: i=1; AJvYcCWddnTChnTuGwF9esNidPuyeJtT49w7FChsi+nXumHbE7A0eTW2BznS4DAgWo6IQR/wXZyIdTDGL7qiggs= X-Gm-Message-State: AOJu0Yww8Z77Dh/QFJJhTyGOyOdf60fWI1Mi8XTzF0++d/O8QJIeBCE9 DU6lWgSeMNy+ti9/TyIAa5OskV21msCNYFTsfyCgSenN45smz34DYoEUhrAz+NadWRTGrHICk1m I2mWJLpKi5X09r8BXhYX5HdPHpClqpeZEZzomhg== X-Google-Smtp-Source: AGHT+IGoBI/gD0Fz/42ErDcB3ViytG1Ue67DVMk350Glr1krTvRF6PGlTYt4qObD5sRBDUq2kMzpe1zzS7/2MvkqdaM= X-Received: by 2002:a17:902:d507:b0:1fd:8e8b:b2d1 with SMTP id d9443c01a7336-200ae5858c9mr27073015ad.33.1723224213248; Fri, 09 Aug 2024 10:23:33 -0700 (PDT) MIME-Version: 1.0 References: <20240724163004.5681-1-dmarx@iol.unh.edu> <20240807194341.26102-1-dmarx@iol.unh.edu> <20240807194341.26102-3-dmarx@iol.unh.edu> In-Reply-To: <20240807194341.26102-3-dmarx@iol.unh.edu> From: Jeremy Spewock Date: Fri, 9 Aug 2024 13:23:22 -0400 Message-ID: Subject: Re: [PATCH v13 2/2] dts: VLAN test suite implementation To: Dean Marx Cc: probb@iol.unh.edu, npratte@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech, 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, Aug 7, 2024 at 3:43=E2=80=AFPM Dean Marx wrote: > > Test suite for verifying VLAN filtering, stripping, and insertion > functionality on Poll Mode Driver. > > Signed-off-by: Dean Marx > --- > +++ b/dts/tests/TestSuite_vlan.py > @@ -0,0 +1,168 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2024 University of New Hampshire > + > +"""Test the support of VLAN Offload Features by Poll Mode Drivers. > + > +The test suite ensures that with the correct configuration, a port > +will not drop a VLAN tagged packet. In order for this to be successful, > +packet header stripping and packet receipts must be enabled on the Poll = Mode Driver. This sentence is a little confusing to me. I'm not sure exactly what you mean by packet receipts being enabled, and it's probably better to not specify that stripping must be enabled since there are cases tested where it isn't and we still expect to get the packets. It seems like the main thing you are testing for in the suite is whether the VLAN functions perform their expected behavior, so maybe it would be better to focus more on that in this doc-string than if the packet is received. > +The test suite checks that when these conditions are met, the packet is = received without issue. > +The suite also checks to ensure that when these conditions are not met, = as in the cases where > +stripping is disabled, or VLAN packet receipts are disabled, the packet = is not received. There are test cases where we also test that a packet is received even when the stripping is disabled, so we should likely remove that from here as well. > +Additionally, it checks the case where VLAN header insertion is enabled = in transmitted packets, > +which should be successful if the previous cases pass. > + > +""" > + > +from scapy.layers.l2 import Dot1Q, Ether # type: ignore[import-untyped] > +from scapy.packet import Raw # type: ignore[import-untyped] > + > +from framework.remote_session.testpmd_shell import SimpleForwardingModes= , TestPmdShell > +from framework.test_suite import TestSuite > + > + > + def send_vlan_packet_and_verify(self, should_receive: bool, strip: b= ool, vlan_id: int) -> None: > + """Generate a vlan packet, send and verify packet with same payl= oad is received on the dut. > + > + Args: > + should_receive: Indicate whether the packet should be succes= sfully received. > + strip: Indicates whether stripping is on or off, and when th= e vlan tag is > + checked for a match. Reading the code it makes more sense what you mean in the second part of this sentence, but it might be better here to be more explicit and say that, when strip is false, we expect there to be a vlan tag on the received packet and said tag will be checked against `vlan_id`. > + vlan_id: Expected vlan ID. > + """ > + packet =3D Ether() / Dot1Q(vlan=3Dvlan_id) / Raw(load=3D"xxxxx") > + received_packets =3D self.send_packet_and_capture(packet) > + test_packet =3D None > + for packet in received_packets: > + if b"xxxxx" in packet.load: I believe there could be cases where this "load" attribute might not exist on some noise packets and that's why oftentimes this check in other suites will have a `hasattr()` check in it. If that's not the case and all packets do have a load attribute that would be great, but it might be better to add the hasattr check just for certainty. > + test_packet =3D packet > + break > + if should_receive: > + self.verify( > + test_packet is not None, "Packet was dropped when it sho= uld have been received" > + ) > + if test_packet is not None: > + if strip: > + self.verify( > + not test_packet.haslayer(Dot1Q), "Vlan tag was n= ot stripped successfully" > + ) > + else: > + self.verify( > + test_packet.vlan =3D=3D vlan_id, > + "The received tag did not match the expected tag= ", > + ) > + else: > + self.verify( > + test_packet is None, > + "Packet was received when it should have been dropped", > + ) > + > + def vlan_setup(self, testpmd: TestPmdShell, port_id: int, filtered_i= d: int) -> TestPmdShell: > + """Setup method for all test cases. > + > + Args: > + testpmd: Testpmd shell session to send commands to. > + port_id: Number of port to use for setup. > + filtered_id: ID to be added to the vlan filter list. > + > + Returns: > + TestPmdShell: Testpmd session being configured. > + """ > + testpmd.set_forward_mode(SimpleForwardingModes.mac) > + testpmd.set_promisc(port_id, False) > + testpmd.vlan_filter_set(port=3Dport_id, on=3DTrue) > + testpmd.rx_vlan(vlan=3Dfiltered_id, port=3Dport_id, add=3DTrue) > + return testpmd > + > + def test_vlan_receipt_no_stripping(self) -> None: > + """Ensure vlan packet is dropped when receipts are enabled and h= eader stripping is disabled. This test case isn't testing for a packet being dropped, we should probably adjust the doc-string accordingly. > + > + Test: > + Create an interactive testpmd shell and verify a vlan packet= . > + """ > + with TestPmdShell(node=3Dself.sut_node) as testpmd: > + testpmd =3D self.vlan_setup(testpmd=3Dtestpmd, port_id=3D0, = filtered_id=3D1) > + testpmd.start() > + self.send_vlan_packet_and_verify(True, strip=3DFalse, vlan_i= d=3D1) > + > 2.44.0 >