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 4D90B4415E; Wed, 12 Jun 2024 22:04:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CD989402C6; Wed, 12 Jun 2024 22:04:55 +0200 (CEST) Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) by mails.dpdk.org (Postfix) with ESMTP id 57C3D402B9 for ; Wed, 12 Jun 2024 22:04:54 +0200 (CEST) Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-7954f8b818fso11972785a.1 for ; Wed, 12 Jun 2024 13:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1718222693; x=1718827493; darn=dpdk.org; h=content-transfer-encoding:signed-off-by:mime-version:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=XqMhSFgOWbOMu0EEt8m9L/PwHUuC9isbl/fgoSmqiIg=; b=SvE0wlna/1dBRaNEvZT+0HwRHRbPNT0D04aMvpf+qtBRF8Ox4mx0gq6eK1cBLvqrNV RWIlTIQxtVxiDOnzzyZI/55FXqdKy7RX0yHt6iBF9b5fHNwlFziCco4hjvoU1BLy+W5S 2aPaMa5utXur222rEVEKsQr39NUnjqNGDzcM4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718222693; x=1718827493; h=content-transfer-encoding:signed-off-by:mime-version:message-id :date:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XqMhSFgOWbOMu0EEt8m9L/PwHUuC9isbl/fgoSmqiIg=; b=uJ7vM1nMXunTvy9nvD6Dp8RDxspVxWz/C82FdjEmLC+h+VwK0Ss59egF5qYMw2Pl6R 8y7ye8+TN/9TnMxVC9CW2bJYQnt4ADIhIMOMn8a8QoZQ7o9i39Ro6ALGNaOq5/ELYtva nLGeBCJUB4Axu/X+j97EuD9OpxIxHHgJXz2kovvb2/6Ex1yPj8omj/aV96EKbYp84IlR Ka2SuwMBd2BV/5KT8polftCrMgEYE5TrU/E9qUAKI7DTuS8AYtFOiySdZS8kuPt+M0iZ Lqwro1WyyZbc5YCkQVWi2BnIWUtb+SCihU3MOhZCb5Q4E8S9P75LLLjjtlfCu0Scx1GL 4wrA== X-Gm-Message-State: AOJu0YxMwgvpS7G7HBR8G91ql2lRTzc85pk+OLALhdnsKPRDgCUI3rGW QvZKRHt2lqQ113Va7qWzNZRoOSyM1FbQ3n4+deuEWyEtOKAMZkJAGsIhDjme+xs= X-Google-Smtp-Source: AGHT+IEfYOsmMuQG/MzHuaY7RSL22As21zydK90JLSNbPCGcc/yuJmoo6ogMWx9jN5Nvix0L2m1sOQ== X-Received: by 2002:a05:620a:24c6:b0:795:5a78:46a9 with SMTP id af79cd13be357-797f61036abmr327296185a.52.1718222693388; Wed, 12 Jun 2024 13:04: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 d75a77b69052e-44038a77ad7sm57355471cf.33.2024.06.12.13.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 13:04:52 -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 v1] Initial implementation queue start stop suite Date: Wed, 12 Jun 2024 16:03:38 -0400 Message-ID: <20240612200337.19338-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Signed-off-by: Dean Marx 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 diff --git a/dts/tests/TestSuite_queue_start_stop.py b/dts/tests/TestSuite_queue_start_stop.py new file mode 100644 index 0000000000..8c60687d1b --- /dev/null +++ b/dts/tests/TestSuite_queue_start_stop.py @@ -0,0 +1,88 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 University of New Hampshire + +"""Rx/Tx queue start and stop functionality suite. + +This suite tests the ability of testpmd to start and stop +either the Rx or Tx queue during runtime, and verify that +packets are not received when one is disabled. + +Given a paired port topology, the Rx queue will be disabled on port 0, +and the Tx queue will be disabled on port 1. + +""" + +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 framework.remote_session.testpmd_shell import TestPmdForwardingModes, TestPmdShell +from framework.test_suite import TestSuite + +class TestQueueStartStop(TestSuite): + """DPDK Queue start/stop test suite. + + Ensures Rx/Tx queue can be disabled and enabled during testpmd runtime. + Verifies packets are not received when either queue is disabled. + """ + + 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_packet_and_verify(self, should_receive: bool = True): + """Generate a packet, send to the DUT, and verify it is forwarded back. + + Args: + should_receive: indicate whether the packet should be received + """ + packet = Ether()/IP()/Raw() + received = self.send_packet_and_capture(packet) + if should_receive: + self.verify(len(received) == 1, "Packet was dropped when it should have been received") + else: + self.verify(len(received) == 0, "Packet was received when it should have been dropped") + + def test_all_queues_enabled(self) -> None: + """Ensure packets are received when both Tx and Rx queues are enabled. + + Test: + Create a testpmd session and verify packets are received.""" + testpmd = self.sut_node.create_interactive_shell(TestPmdShell, privileged=True) + testpmd.set_forward_mode(TestPmdForwardingModes.mac) + testpmd.send_command("set verbose 1", "testpmd>") + testpmd.start() + + self.send_packet_and_verify(True) + testpmd.close() + + def test_queue_start_stop(self) -> None: + """Ensure packets are not received when either Rx/Tx queue is disabled. + + Test: + Create an interactive testpmd session, stop Rx queue on port 0, verify + packets are dropped. Then start port 0 Rx queue, stop port 1 Tx queue, and + verify packets are dropped.""" + testpmd = self.sut_node.create_interactive_shell(TestPmdShell, privileged=True) + testpmd.set_forward_mode(TestPmdForwardingModes.mac) + testpmd.send_command("set verbose 1", "testpmd>") + testpmd.send_command("port 0 rxq 0 stop", "testpmd>") + + testpmd.start() + self.send_packet_and_verify(False) + testpmd.close() + + testpmd.send_command("port 0 rxq 0 start", "testpmd>") + testpmd.send_command("port 1 txq 0 stop", "testpmd>") + + testpmd.start() + self.send_packet_and_verify(False) + testpmd.close() + + def tear_down_suite(self) -> None: + """Tear down the suite.""" \ No newline at end of file -- 2.44.0