From patchwork Wed Jul 17 20:31:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 142494 X-Patchwork-Delegate: thomas@monjalon.net 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 54D624563B; Wed, 17 Jul 2024 22:31:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 42AA140669; Wed, 17 Jul 2024 22:31:53 +0200 (CEST) Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) by mails.dpdk.org (Postfix) with ESMTP id EA279402E6 for ; Wed, 17 Jul 2024 22:31:51 +0200 (CEST) Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3cabac56b38so78288b6e.3 for ; Wed, 17 Jul 2024 13:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1721248311; x=1721853111; 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=HLHYeZLkVrwFcu9DsWdvp/T47LAWZxrYlS/FXoGthAw=; b=PSlZqIIH1D0bHCZjIdWvV1IW+WwAQ27e5PkB1+yBpCEwpIYKirHzsSccfye+y8hmIz Jes3H8oKLR37j+7xXwV8QnBqHFij7M82W2xYZ8v92mUiLaVg6bGUL3ep2AFBn++iobYV nw3VTnSJsIjhLWa2ShZXKFP4ha9ZXI31ApVwk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721248311; x=1721853111; 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=HLHYeZLkVrwFcu9DsWdvp/T47LAWZxrYlS/FXoGthAw=; b=dqAU0FUcn13LEYajE6dsGRq8Eg1ty9KBbghRl68qM5kq7Gndr29hCX6jL1RU/8Cl6x 5t29JeSjSsVMY/apeGFMfT251Hr3M/xxAWobOLIAcuNWIHCg7NVxhf1u1oHcRClA/Y5Y PQvp2eKXuGsncrw4EMAeiTo5n7cjxGd8BT9LXuBOEyKuqw4sU4YIXl1UnUNsrEDzu1lC rWViXpKOQaYmnC91AOqTVJRIfABcsFz92xLXRBv0N0rXPgsZNXZ41PuqFTYbZwDJ5tq3 AQt/IEUCXkI5Ras2VPY6uQlSmUcQbjjKDzEDpfqawNyMTMbkTlk3X1CPfY/TTANhX1E2 3kiA== X-Gm-Message-State: AOJu0YxjEjSDK95FdtXGkD+O6jyoeJmHWF3d/nz3lIAv6E4eFyzffrEw PC1NlzZKAALKR+flko9PNwodtf8kDOHcttRCrLQQX2V2cy8V8omS4Sg7UM3HkvY= X-Google-Smtp-Source: AGHT+IGL4d/nzA04CpuCmhpjRlH3nHEgWmtxnPmcPBkNrA1JxKM3YvtzQO4hlWTph6K42tY2OpSlMQ== X-Received: by 2002:a05:6870:8a1f:b0:254:a0ca:6dd1 with SMTP id 586e51a60fabf-260d9196626mr2249434fac.12.1721248310328; Wed, 17 Jul 2024 13:31:50 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a160ba271dsm446430785a.19.2024.07.17.13.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jul 2024 13:31:49 -0700 (PDT) From: Dean Marx To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, jspewock@iol.unh.edu, bruce.richardson@intel.com, luca.vizzarro@arm.com Cc: dev@dpdk.org, Dean Marx Subject: [PATCH v11 1/3] dts: add VLAN methods to testpmd shell Date: Wed, 17 Jul 2024 16:31:39 -0400 Message-ID: <20240717203141.30524-1-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240614150238.26374-1-dmarx@iol.unh.edu> References: <20240614150238.26374-1-dmarx@iol.unh.edu> 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 added the following methods to testpmd shell class: vlan set filter on/off, rx vlan add/rm, vlan set strip on/off, port stop/start all/port, tx vlan set/reset, set promisc/verbose fixed: bug in vlan_offload for show port info, removed $ at end of regex Signed-off-by: Dean Marx --- dts/framework/remote_session/testpmd_shell.py | 245 +++++++++++++++++- 1 file changed, 244 insertions(+), 1 deletion(-) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index ec22f72221..09d3bda5d6 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -98,7 +98,7 @@ def make_parser(cls) -> ParserFn: r"strip (?Pon|off), " r"filter (?Pon|off), " r"extend (?Pon|off), " - r"qinq strip (?Pon|off)$", + r"qinq strip (?Pon|off)", re.MULTILINE, named=True, ), @@ -806,6 +806,249 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats: return TestPmdPortStats.parse(output) + def vlan_filter_set(self, port: int, on: bool, verify: bool = True): + """Set vlan filter on. + + Args: + port: The port number to enable VLAN filter on, should be within 0-32. + on: Sets filter on if :data:`True`, otherwise turns off. + verify: If :data:`True`, the output of the command and show port info + is scanned to verify that vlan filtering was enabled successfully. + If not, it is considered an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the filter + fails to update. + """ + filter_cmd_output = self.send_command(f"vlan set filter {'on' if on else 'off'} {port}") + if verify: + if on ^ ("FILTER" in str(self.show_port_info(port_id=port).vlan_offload)): + self._logger.debug(f"Failed to set filter on port {port}: \n{filter_cmd_output}") + raise InteractiveCommandExecutionError( + f"Testpmd failed to set VLAN filter on port {port}." + ) + + def rx_vlan(self, vlan: int, port: int, add: bool, verify: bool = True): + """Add specified vlan tag to the filter list on a port. + + Args: + vlan: The vlan tag to add, should be within 1-1005, 1-4094 extended. + port: The port number to add the tag on, should be within 0-32. + add: adds the tag if :data:`True`, otherwise removes tag. + verify: If :data:`True`, the output of the command is scanned to verify that + the vlan tag was added to the filter list on the specified port. If not, it is + considered an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the tag + is not added. + """ + rx_output = self.send_command(f"rx_vlan {'add' if add else 'rm'} {vlan} {port}") + if verify: + if ( + "VLAN-filtering disabled" in rx_output + or "Invalid vlan_id" in rx_output + or "Bad arguments" in rx_output + ): + self._logger.debug( + f"Failed to {'add' if add else 'remove'} tag {vlan} port {port}: \n{rx_output}" + ) + raise InteractiveCommandExecutionError( + f"Testpmd failed to {'add' if add else 'remove'} tag {vlan} on port {port}." + ) + + def vlan_strip_set(self, port: int, on: bool, verify: bool = True): + """Enable vlan stripping on the specified port. + + Args: + port: The port number to use, should be within 0-32. + on: If :data:`True`, will turn strip on, otherwise will turn off. + verify: If :data:`True`, the output of the command and show port info + is scanned to verify that vlan stripping was enabled on the specified port. + If not, it is considered an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and stripping + fails to update. + """ + strip_output = self.send_command(f"vlan set strip {'on' if on else 'off'} {port}") + if verify: + if on ^ ("STRIP" in str(self.show_port_info(port_id=port).vlan_offload)): + self._logger.debug( + f"Failed to set strip {'on' if on else 'off'} port {port}: \n{strip_output}" + ) + raise InteractiveCommandExecutionError( + f"Testpmd failed to set strip {'on' if on else 'off'} port {port}." + ) + + def port_stop_all(self, verify: bool = True): + """Stop all ports. + + Args: + port: Specifies the port number to use, must be between 0-32. + verify: If :data:`True`, the output of the command is scanned + to ensure all ports are stopped. If not, it is considered an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and all ports + fail to stop. + """ + port_output = self.send_command("port stop all") + if verify: + if "Done" not in port_output: + self._logger.debug(f"Failed to stop all ports: \n{port_output}") + raise InteractiveCommandExecutionError("Testpmd failed to stop all ports.") + + def port_stop(self, port: int, verify: bool = True): + """Stop specified port. + + Args: + port: Specifies the port number to use, must be between 0-32. + verify: If :data:`True`, the output of the command is scanned + to ensure specified port is stopped. If not, it is considered an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the port + is not stopped. + """ + port_output = self.send_command(f"port stop {port}") + if verify: + if "Done" not in port_output: + self._logger.debug(f"Failed to stop port {port}: \n{port_output}") + raise InteractiveCommandExecutionError(f"Testpmd failed to stop port {port}.") + + def port_start_all(self, verify: bool = True): + """Start all ports. + + Args: + port: Specifies the port number to use, must be between 0-32. + verify: If :data:`True`, the output of the command is scanned + to ensure all ports are started. If not, it is considered an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and all ports + fail to start. + """ + port_output = self.send_command("port start all") + if verify: + if "Done" not in port_output: + self._logger.debug(f"Failed to start all ports: \n{port_output}") + raise InteractiveCommandExecutionError("Testpmd failed to start all ports.") + + def port_start(self, port: int, verify: bool = True): + """Start specified port. + + Args: + port: Specifies the port number to use, must be between 0-32. + verify: If :data:`True`, the output of the command is scanned + to ensure specified port is started. If not, it is considered an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the port + is not started. + """ + port_output = self.send_command(f"port start {port}") + if verify: + if "Done" not in port_output: + self._logger.debug(f"Failed to start port {port}: \n{port_output}") + raise InteractiveCommandExecutionError(f"Testpmd failed to start port {port}.") + + def tx_vlan_set(self, port: int, vlan: int, verify: bool = True): + """Set hardware insertion of vlan tags in packets sent on a port. + + Args: + port: The port number to use, should be within 0-32. + vlan: The vlan tag to insert, should be within 1-4094. + verify: If :data:`True`, the output of the command is scanned to verify that + vlan insertion was enabled on the specified port. If not, it is + considered an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the insertion + tag is not set. + """ + vlan_insert_output = self.send_command(f"tx_vlan set {port} {vlan}") + if verify: + if ( + "Please stop port" in vlan_insert_output + or "Invalid vlan_id" in vlan_insert_output + or "Invalid port" in vlan_insert_output + ): + self._logger.debug( + f"Failed to set vlan tag {vlan} on port {port}:\n{vlan_insert_output}" + ) + raise InteractiveCommandExecutionError( + f"Testpmd failed to set vlan insertion tag {vlan} on port {port}." + ) + + def tx_vlan_reset(self, port: int, verify: bool = True): + """Disable hardware insertion of vlan tags in packets sent on a port. + + Args: + port: The port number to use, should be within 0-32. + verify: If :data:`True`, the output of the command is scanned to verify that + vlan insertion was disabled on the specified port. If not, it is + considered an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the insertion + tag is not reset. + """ + vlan_insert_output = self.send_command(f"tx_vlan set {port}") + if verify: + if "Please stop port" in vlan_insert_output or "Invalid port" in vlan_insert_output: + self._logger.debug( + f"Failed to reset vlan insertion on port {port}: \n{vlan_insert_output}" + ) + raise InteractiveCommandExecutionError( + f"Testpmd failed to reset vlan insertion on port {port}." + ) + + def set_promisc(self, port: int, on: bool, verify: bool = True): + """Turns promiscuous mode on/off for the specified port. + + Args: + port: Port number to use, should be within 0-32. + on: If :data:`True`, turn promisc mode on, otherwise turn off. + verify: If :data:`True` an additional command will be sent to verify that promisc mode + is properly set. Defaults to :data:`True`. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and promisc mode + is not correctly set. + """ + promisc_output = self.send_command(f"set promisc {port} {'on' if on else 'off'}") + if verify: + stats = self.show_port_info(port_id=port) + if on ^ stats.is_promiscuous_mode_enabled: + self._logger.debug(f"Failed to set promisc mode on port {port}: \n{promisc_output}") + raise InteractiveCommandExecutionError( + f"Testpmd failed to set promisc mode on port {port}." + ) + + def set_verbose(self, level: int, verify: bool = True): + """Set debug verbosity level. + + Args: + level: 0 - silent except for error + 1 - fully verbose except for Tx packets + 2 - fully verbose except for Rx packets + >2 - fully verbose + verify: If :data:`True` the command output will be scanned to verify that verbose level + is properly set. Defaults to :data:`True`. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and verbose level + is not correctly set. + """ + verbose_output = self.send_command(f"set verbose {level}") + if verify: + if "Change verbose level" not in verbose_output: + self._logger.debug(f"Failed to set verbose level to {level}: \n{verbose_output}") + raise InteractiveCommandExecutionError( + f"Testpmd failed to set verbose level to {level}." + ) + def close(self) -> None: """Overrides :meth:`~.interactive_shell.close`.""" self.send_command("quit", "") From patchwork Wed Jul 17 20:31:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 142495 X-Patchwork-Delegate: thomas@monjalon.net 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 A526D4563B; Wed, 17 Jul 2024 22:32:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E302540DCB; Wed, 17 Jul 2024 22:31:54 +0200 (CEST) Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by mails.dpdk.org (Postfix) with ESMTP id CC788402E6 for ; Wed, 17 Jul 2024 22:31:52 +0200 (CEST) Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-79f178351d4so2909185a.0 for ; Wed, 17 Jul 2024 13:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1721248312; x=1721853112; 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=ODkeSMIvguugS9pETftjaDi1KlZbezGvPLp59I5c/ik=; b=ZoZ9+hqZdLCC/WZjbXGbnTPi289iBDW1OGyRvnjM17shRAV3luqAd4KlGYvOdUxYS/ kdJbcMwUpiS9rCDZjKrwU3tWAOQCREpOic5enVXAwaJFJU7k7BOHleTiwRZP441CW1he sbxDeGh64JfuPYiihskZZdwD7Gg/hl286Gyik= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721248312; x=1721853112; 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=ODkeSMIvguugS9pETftjaDi1KlZbezGvPLp59I5c/ik=; b=hd3UoVOYN7zrb9ksRgERZFjyJu4Tyj6Fx3R1i31ViEsgxl5bVXUchUUhWKFdKXYzRb xu1cxoAuzvsZ+WhCY/D4hUu9UQ6pR2424/9AB6TpU91hW79FIEm/sp+jr91FcCs8qFUL uUanZLvQ/JpnVwhecrVyCbXVs8/8uLW/NmrkOJVwGoNYOY0FfsWqO+el5RShyl4ZvvUv TRW//E07NgHUrDsxfXDQKE7y9Hs2sCZx2l3642vXAD7kKor9oRgzhEh64cfVpMtMtjuV eHkvvnxmbqB8Cy2E31aFgj7wzMd8siVZLixk0uAxueUJmJ61/2UadNpXH1pNkNua8nIt g1IA== X-Gm-Message-State: AOJu0Yyz8+4bKMaw9cwAN063RlAU8qAcPlSHOIInA8lG0lG79kBw2oVz /fE4ku8qiATf5XFDuwDP8WA6+rLOQs3u4HhP7tuFbGZbjOvxyzT+Euv95CrVIIE= X-Google-Smtp-Source: AGHT+IHw68uflIcd4DeyffhEDEscS6U9+N6tj/tKbSFQ+9xs5kQ/olw2Ls/yf+It8RH303jRorzERQ== X-Received: by 2002:a05:620a:2687:b0:79e:ff38:5806 with SMTP id af79cd13be357-7a1874d90bcmr362524285a.46.1721248311993; Wed, 17 Jul 2024 13:31:51 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a160ba271dsm446430785a.19.2024.07.17.13.31.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jul 2024 13:31:51 -0700 (PDT) From: Dean Marx To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, jspewock@iol.unh.edu, bruce.richardson@intel.com, luca.vizzarro@arm.com Cc: dev@dpdk.org, Dean Marx Subject: [PATCH v11 2/3] dts: VLAN test suite implementation Date: Wed, 17 Jul 2024 16:31:40 -0400 Message-ID: <20240717203141.30524-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240717203141.30524-1-dmarx@iol.unh.edu> References: <20240614150238.26374-1-dmarx@iol.unh.edu> <20240717203141.30524-1-dmarx@iol.unh.edu> 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 Test suite for verifying VLAN filtering, stripping, and insertion functionality on Poll Mode Driver. Signed-off-by: Dean Marx Reviewed-by: Jeremy Spewock --- dts/tests/TestSuite_vlan.py | 170 ++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 dts/tests/TestSuite_vlan.py diff --git a/dts/tests/TestSuite_vlan.py b/dts/tests/TestSuite_vlan.py new file mode 100644 index 0000000000..eef94678a1 --- /dev/null +++ b/dts/tests/TestSuite_vlan.py @@ -0,0 +1,170 @@ +# 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. +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. +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 + + +class TestVlan(TestSuite): + """DPDK VLAN test suite. + + Ensures VLAN packet reception, stripping, and insertion on the Poll Mode Driver + when the appropriate conditions are met. The suite contains four test cases: + + 1. VLAN reception no stripping - verifies that a vlan packet with a tag + within the filter list is received. + 2. VLAN reception stripping - verifies that a vlan packet with a tag + within the filter list is received without the vlan tag. + 3. VLAN no reception - verifies that a vlan packet with a tag not within + the filter list is dropped. + 4. VLAN insertion - verifies that a non vlan packet is received with a vlan + tag when insertion is enabled. + """ + + def set_up_suite(self) -> None: + """Set up the test suite. + + Setup: + 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, strip: bool, vlan_id: int) -> None: + """Generate a vlan packet, send and verify packet with same payload is received on the dut. + + Args: + should_receive: Indicate whether the packet should be successfully received. + strip: Indicates whether stripping is on or off, and when the vlan tag is + checked for a match. + vlan_id: Expected vlan ID. + """ + packet = Ether() / Dot1Q(vlan=vlan_id) / Raw(load="xxxxx") + received_packets = self.send_packet_and_capture(packet) + test_packet = None + for packet in received_packets: + if b"xxxxx" in packet.load: + test_packet = packet + break + if should_receive: + self.verify( + test_packet is not None, "Packet was dropped when it should have been received" + ) + if test_packet is not None: + if strip: + self.verify( + not test_packet.haslayer(Dot1Q), "Vlan tag was not stripped successfully" + ) + else: + self.verify( + test_packet.vlan == 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 send_packet_and_verify_insertion(self, expected_id: int) -> None: + """Generate a packet with no vlan tag, send and verify on the dut. + + Args: + expected_id: The vlan id that is being inserted through tx_offload configuration. + """ + packet = Ether() / Raw(load="xxxxx") + received_packets = self.send_packet_and_capture(packet) + test_packet = None + for packet in received_packets: + if b"xxxxx" in packet.load: + test_packet = packet + break + self.verify(test_packet is not None, "Packet was dropped when it should have been received") + if test_packet is not None: + self.verify(test_packet.haslayer(Dot1Q), "The received packet did not have a vlan tag") + self.verify( + test_packet.vlan == expected_id, "The received tag did not match the expected tag" + ) + + def vlan_setup(self, port_id: int, filtered_id: int) -> TestPmdShell: + """Setup method for all test cases. + + Args: + port_id: Number of port to use for setup. + filtered_id: ID to be added to the vlan filter list. + """ + testpmd = TestPmdShell(node=self.sut_node) + testpmd.set_forward_mode(SimpleForwardingModes.mac) + testpmd.set_promisc(port_id, False) + testpmd.vlan_filter_set(port=port_id, on=True) + testpmd.rx_vlan(vlan=filtered_id, port=port_id, add=True) + return testpmd + + def test_vlan_receipt_no_stripping(self) -> None: + """Ensure vlan packet is dropped when receipts are enabled and header stripping is disabled. + + Test: + Create an interactive testpmd shell and verify a vlan packet. + """ + testpmd = self.vlan_setup(port_id=0, filtered_id=1) + testpmd.start() + + self.send_vlan_packet_and_verify(True, strip=False, vlan_id=1) + testpmd.close() + + def test_vlan_receipt_stripping(self) -> None: + """Ensure vlan packet received with no tag when receipts and header stripping are enabled. + + Test: + Create an interactive testpmd shell and verify a vlan packet. + """ + testpmd = self.vlan_setup(port_id=0, filtered_id=1) + testpmd.vlan_strip_set(port=0, on=True) + testpmd.start() + + self.send_vlan_packet_and_verify(should_receive=True, strip=True, vlan_id=1) + 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 = self.vlan_setup(port_id=0, filtered_id=1) + testpmd.start() + + self.send_vlan_packet_and_verify(should_receive=False, strip=False, vlan_id=2) + 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 packet. + """ + testpmd = TestPmdShell(node=self.sut_node) + testpmd.set_forward_mode(SimpleForwardingModes.mac) + testpmd.set_promisc(port=0, on=False) + testpmd.port_stop_all() + testpmd.tx_vlan_set(port=1, vlan=51) + testpmd.port_start_all() + testpmd.start() + + self.send_packet_and_verify_insertion(expected_id=51) + testpmd.close() From patchwork Wed Jul 17 20:31:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 142496 X-Patchwork-Delegate: thomas@monjalon.net 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 3E0DC4563B; Wed, 17 Jul 2024 22:32:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5403040B9D; Wed, 17 Jul 2024 22:31:56 +0200 (CEST) Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by mails.dpdk.org (Postfix) with ESMTP id 755E640A82 for ; Wed, 17 Jul 2024 22:31:54 +0200 (CEST) Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-79efd2151d9so2969585a.0 for ; Wed, 17 Jul 2024 13:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1721248314; x=1721853114; 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=sg2zx+CIYHjFy76a7R6A0yvVBJHB2VUX7uRpPSIbaoU=; b=cwD0yx4HxcOMgVEBg4Wvp4LZzh0Ekgu4drBR7i1l1QfHMkm0DB+oP3UF+IvltOqc65 R0BPN/NlAStUCGWaFV4Xr+dWXES2LaOZisJ7Myy5oQyeMhxnfvvlEYBW762Sicxj/9MN hvrfO5VPJVoB8lA3yW2NobcwerI2yFHNnNcoo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721248314; x=1721853114; 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=sg2zx+CIYHjFy76a7R6A0yvVBJHB2VUX7uRpPSIbaoU=; b=A+pK63lqPkYXSh0UykOShu+nj2GhFjzxHiFNiy9nCifYTkx/lbDr4JQ4mymPlaiU2S c1hZe1xE3Wa2eWBJs+/25OC9JON5kV7Xbu9S5gqDedJVF/5BkJcbee9ORjlXoQwpZUpf yvesgELpmbh/f/rxczlN1BHKM5NY0WxZKQhEKfwXpKnJjcyzVVKcxMHqruNXSUn5mUMn Gd74McJFS3/2zVGv6NOEYNwVn6YMB86hlDXRpn5nvUPyTsINq+SrlHEZcikwNq2Oe4fE KTyljhIm+c+7PGvPFKUGLkwOJN5hqUWlFE4q44FPi2fGG2XWa3WiYQVMw+whHT5oY/kM Ta3A== X-Gm-Message-State: AOJu0YzZ1QWxSPrykNevKCA/QA+C5emTL1OM1f0qw6UHxoUS6OuUw2N2 mAaIyDzLcLPAk1LknF59LRxzFdZ/ZL0cCFwsvPfwtuDi/y4cB/X7UUm7HGvDa/OXlOAB+PK9nUm Y X-Google-Smtp-Source: AGHT+IFZgjSupyCIc88mnDF3jihq5UqwGJz9ZaJTF8BwrFsysKVqLIriyHSpBtIzc6k04aOmrhcbSQ== X-Received: by 2002:a05:620a:4305:b0:79f:41f:ee20 with SMTP id af79cd13be357-7a187419cf4mr329947285a.3.1721248313814; Wed, 17 Jul 2024 13:31:53 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a160ba271dsm446430785a.19.2024.07.17.13.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jul 2024 13:31:53 -0700 (PDT) From: Dean Marx To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, jspewock@iol.unh.edu, bruce.richardson@intel.com, luca.vizzarro@arm.com Cc: dev@dpdk.org, Dean Marx Subject: [PATCH v11 3/3] dts: config schema Date: Wed, 17 Jul 2024 16:31:41 -0400 Message-ID: <20240717203141.30524-3-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240717203141.30524-1-dmarx@iol.unh.edu> References: <20240614150238.26374-1-dmarx@iol.unh.edu> <20240717203141.30524-1-dmarx@iol.unh.edu> 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 Configuration to run vlan test suite Signed-off-by: Dean Marx Reviewed-by: Jeremy Spewock --- dts/framework/config/conf_yaml_schema.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json index f02a310bb5..cd45902cc4 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", + "vlan" ] }, "test_target": {