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 AF43B4545F; Fri, 14 Jun 2024 18:19:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 459C740B95; Fri, 14 Jun 2024 18:19:51 +0200 (CEST) Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) by mails.dpdk.org (Postfix) with ESMTP id 987AF402D0 for ; Fri, 14 Jun 2024 18:19:49 +0200 (CEST) Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5babfde1c04so1070262eaf.2 for ; Fri, 14 Jun 2024 09:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1718381988; x=1718986788; 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=STQr76QHdPdrvxhZk2f1Oi3vhPnZKyJFkPobFb0s6bo=; b=MKk2qcRphAs8LKj8DAPNpaWU6jMHKLxeeUclph2siIRtbOeCMa4c+DwZNLQU4KLvj/ hTPshtB63t82KQRyNwiZhEgCt1/C5TVaQmqRBl9lAwa/e0MxTKoXtR4MYMXIheR6OzLW gwySLo473ax4t0JMVSs04jEH9jD23fhbstRIs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718381988; x=1718986788; 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=STQr76QHdPdrvxhZk2f1Oi3vhPnZKyJFkPobFb0s6bo=; b=Fs9jcXM67T7s++bvg7t5mHUE6HS5SQzVJYRBLeig40MoGcixNdIVxaDUxpPMgAOSWX +tV/JHDNTyndkjQGpm9s54xKf5/6C309pr+F9ONdHzGhsReOLnAvmVu5wZ866aK3NA1Y Ck2ROrDo2UZf7z3L+pvp+l5RhAwMDhPEYV5tKpgpg2tWJddE1Gu3RumSI/dILsYrvfLq IFrEmrY1p7rnMD/Rq4hWfIVbo4xDfO2gXpqEgjfQGx6jiAi4hxgU3ClUvdnwE3XQjU4d wAmjwgBTYvPSEe9oP03Cwf07fZd0QM9cxzoEy124bY5gUe53Q9kQ65OHibeSFvbLwL4X DM6Q== X-Forwarded-Encrypted: i=1; AJvYcCXnYeKfJFGNmmI8YejIhuDIJbGCnPY7ABPfOgIrm6CevHX6iWuhXUp1Zp45BlGB0eDaYlhL54GgnXP3o20= X-Gm-Message-State: AOJu0Yx1XMQaeshsfpp1QK/5Jbg7aoyu+odk+VcZA1MWcdIznKyCv/wd 4wc/vhRbTsElLlokYeYcOIw8qZ7m/wwC3X7xi+Mv4P5cm4V6bCZ7i/mWAXWxedeQbVn8P1/hClo TqX8gi593E5i0EsPg0Maj7KbEvyEGpjIiTfiSZQ== X-Google-Smtp-Source: AGHT+IHLfVTP0q53J2wSHmC3UimCU8v7VIuUlkl76d3Tk5kdbRUDrperl/5iDxoG++Na3HM9HaZe4n7xLx/94276CAs= X-Received: by 2002:a05:6820:1c99:b0:5bb:288:e955 with SMTP id 006d021491bc7-5bdadc9c2a2mr3313634eaf.8.1718381988463; Fri, 14 Jun 2024 09:19:48 -0700 (PDT) MIME-Version: 1.0 References: <20240611161606.23881-2-dmarx@iol.unh.edu> <20240614150238.26374-1-dmarx@iol.unh.edu> <20240614150238.26374-3-dmarx@iol.unh.edu> In-Reply-To: <20240614150238.26374-3-dmarx@iol.unh.edu> From: Patrick Robb Date: Fri, 14 Jun 2024 12:19:37 -0400 Message-ID: Subject: Re: [PATCH v3 2/3] Initial implementation for VLAN test suite To: Dean Marx Cc: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, jspewock@iol.unh.edu, bruce.richardson@intel.com, luca.vizzarro@arm.com, 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 Looks promising thanks - some comments below. On Fri, Jun 14, 2024 at 11:03=E2=80=AFAM Dean Marx wrot= e: > +class TestVlan(TestSuite): > + """DPDK VLAN test suite. > + > + Ensures VLAN packet reception on the Poll Mode Driver when certain c= onditions are met. > + If one or more of these conditions are not met, the packet reception= should be unsuccessful. > + """ > + > + def set_up_suite(self) -> None: > + """Set up the test suite. > + > + Setup: > + Create a testpmd session and set up tg nodes > + verify that at least two ports are open for session > + """ > + self.verify(len(self._port_links) > 1, "Not enough ports") > + > + def send_vlan_packet_and_verify( > + self, should_receive: bool =3D True, strip: bool =3D False, vlan= _id: int =3D -1 > + ) -> None: > + """Generate a vlan packet, send and verify on the dut. > + > + Args: > + should_receive: indicate whether the packet should be succes= sfully received > + vlan_id: expected vlan ID > + strip: indicates whether stripping is on or off, > + and when the vlan tag is checked for a match > + """ > + data =3D "P" * 10 packing payload with "X" was some kind of convention with old DTS, which we have adopted in other suites in new DTS too. Unless you have a specific reason to not do this, we should probably use "X". Juraj has also suggested that this be made a standard practice in new DTS and document that (which is outside of the scope of this patch, just figured I'd mention it). > + packet =3D Ether() / Dot1Q(vlan=3Dvlan_id) / Raw(load=3Ddata) > + received_packets =3D self.send_packet_and_capture(packet) > + received_packets =3D [ > + packets > + for packets in received_packets > + if hasattr(packets, "load") and data in str((packets.load)) > + ] > + if should_receive: > + self.verify( > + len(received_packets) =3D=3D 1, "Packet was dropped when= it should have been received" > + ) We do not rely on a quiet wire (LLDP packets and such may be happening) and we have no need for relying on a quiet wire. I think: If should_receive =3D=3D true, we validate with "do any of the packets in received have the expected load/data" If should_receive =3D=3D false we validate with "do none of the packets in received have the expected load/data / do we have no packets at all" > + received =3D received_packets[0] We aren't going to use this assumption (which came from old dts) that the packet we want to validate is the one at index 0. The scatter suite (which is where I'm guessing this idea comes from as it is a kind of reference testsuite currently) is being refactored to check all the packets in received, instead of just received[0]. > + def test_vlan_receipt_no_stripping(self) -> None: > + """Ensure vlan packet is dropped when receipts are enabled and h= eader stripping is disabled. > + > + Test: > + Create an interactive testpmd shell and verify a vlan packet= . > + """ > + testpmd =3D self.sut_node.create_interactive_shell(TestPmdShell,= privileged=3DTrue) > + testpmd.set_forward_mode(TestPmdForwardingModes.mac) > + testpmd.send_command("set verbose 1", "testpmd>") > + testpmd.send_command("set promisc 0 off", "testpmd>") > + testpmd.vlan_filter_set_on(0) > + testpmd.rx_vlan_add(1, 0) > + testpmd.start() Why does the testsuite add testpmd methods for setting vlan ids, but not for setting promisc mode, verbose mode, etc? I think chatting with Jeremy about this makes sense. > + > + filtered_vlan =3D 1 > + self.send_vlan_packet_and_verify(True, vlan_id=3Dfiltered_vlan) > + testpmd.close() > + > + def test_vlan_receipt_stripping(self) -> None: > + """Ensure vlan packet received with no tag when receipts and hea= der stripping are enabled. > + > + Test: > + Create an interactive testpmd shell and verify a vlan packet= . > + """ > + testpmd =3D self.sut_node.create_interactive_shell(TestPmdShell,= privileged=3DTrue) > + testpmd.set_forward_mode(TestPmdForwardingModes.mac) > + testpmd.send_command("set verbose 1", "testpmd>") > + testpmd.send_command("set promisc 0 off", "testpmd>") > + testpmd.vlan_filter_set_on(0) > + testpmd.rx_vlan_add(1, 0) > + testpmd.vlan_strip_set_on(0) > + testpmd.start() > + > + self.send_vlan_packet_and_verify(should_receive=3DTrue, strip=3D= True, vlan_id=3D1) > + testpmd.close() > + > + def test_vlan_no_receipt(self) -> None: > + """Ensure vlan packet dropped when filter is on and sent tag not= in the filter list. > + > + Test: > + Create an interactive testpmd shell and verify a vlan packet= . > + """ > + testpmd =3D self.sut_node.create_interactive_shell(TestPmdShell,= privileged=3DTrue) > + testpmd.set_forward_mode(TestPmdForwardingModes.mac) > + testpmd.send_command("set verbose 1", "testpmd>") > + testpmd.send_command("set promisc 0 off", "testpmd>") > + testpmd.vlan_filter_set_on(0) > + testpmd.rx_vlan_add(1, 0) > + testpmd.start() > + > + filtered_vlan =3D 1 > + self.send_vlan_packet_and_verify(should_receive=3DFalse, vlan_id= =3Dfiltered_vlan + 1) > + testpmd.close() > + > + def test_vlan_header_insertion(self) -> None: > + """Ensure that vlan packet is received with the correct inserted= vlan tag. > + > + Test: > + Create an interactive testpmd shell and verify a non-vlan pa= cket. > + """ > + testpmd =3D self.sut_node.create_interactive_shell(TestPmdShell,= privileged=3DTrue) > + testpmd.set_forward_mode(TestPmdForwardingModes.mac) > + testpmd.send_command("set verbose 1", "testpmd>") > + testpmd.send_command("set promisc 0 off", "testpmd>") > + testpmd.port_stop_all() > + testpmd.tx_vlan_set(1, 51) > + testpmd.port_start_all() > + testpmd.start() > + > + self.send_packet_and_verify_insertion(expected_id=3D51) > + testpmd.close() > + > + def tear_down_suite(self) -> None: > + """Tear down the suite.""" > -- > 2.44.0 >