DPDK patches and discussions
 help / color / mirror / Atom feed
From: Patrick Robb <probb@iol.unh.edu>
To: Paul.Szczepanek@arm.com
Cc: dev@dpdk.org, Luca.Vizzarro@arm.com, npratte@iol.unh.edu,
	thomas.wilks@arm.com, dmarx@iol.unh.edu,
	Jeremy Spewock <jspewock@iol.unh.edu>,
	Patrick Robb <probb@iol.unh.edu>
Subject: [PATCH 1/2] dts: add method for closing ports to testpmd
Date: Wed, 23 Apr 2025 21:44:11 -0400	[thread overview]
Message-ID: <20250424014412.3849896-2-probb@iol.unh.edu> (raw)
In-Reply-To: <20250424014412.3849896-1-probb@iol.unh.edu>

From: Jeremy Spewock <jspewock@iol.unh.edu>

Closing ports is a standard configuration feature that is available in
testpmd but the framework lacks the ability to access this command
through the testpmd API. This patch adds a method that performs this
action and verifies the results of sending the command to allow
developers to have more control over the state of the ports that
testpmd is aware of.

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
Signed-off-by: Patrick Robb <probb@iol.unh.edu>
Tested-by: Patrick Robb <probb@iol.unh.edu>
---
 dts/framework/remote_session/testpmd_shell.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
index 1f291fcb68..c9c95be4b2 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -1723,6 +1723,24 @@ def set_ports_queues(self, number_of: int) -> None:
         self.send_command(f"port config all rxq {number_of}")
         self.send_command(f"port config all txq {number_of}")
 
+    @requires_stopped_ports
+    def close_all_ports(self, verify: bool = True) -> None:
+        """Close all ports.
+
+        Args:
+            verify: If :data:`True` the output of the close command will be scanned in an attempt
+                to verify that all ports were stopped successfully. Defaults to :data:`True`.
+
+        Raises:
+            InteractiveCommandExecutionError: If `verify` is :data:`True` and at lease one port
+                failed to close.
+        """
+        port_close_output = self.send_command("port close all")
+        if verify:
+            num_ports = len(self.ports)
+            if not all(f"Port {p_id} is closed" in port_close_output for p_id in range(num_ports)):
+                raise InteractiveCommandExecutionError("Ports were not closed successfully.")
+
     def show_port_info_all(self) -> list[TestPmdPort]:
         """Returns the information of all the ports.
 
-- 
2.48.1


  reply	other threads:[~2025-04-24  1:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14 18:20 [PATCH v1 0/2] dts: port over port_control testing suite jspewock
2024-08-14 18:20 ` [PATCH v1 1/2] dts: add methods for closing ports to testpmd jspewock
2024-08-14 18:20 ` [PATCH v1 2/2] dts: add port control testing suite jspewock
2024-09-23 16:44 ` [PATCH v2 0/2] dts: port over port_control " jspewock
2024-09-23 16:44   ` [PATCH v2 1/2] dts: add method for closing ports to testpmd jspewock
2024-09-23 16:44   ` [PATCH v2 2/2] dts: add port control testing suite jspewock
2025-04-24  1:44 ` [PATCH 0/2] dts: port over port_control " Patrick Robb
2025-04-24  1:44   ` Patrick Robb [this message]
2025-04-24  1:44   ` [PATCH 2/2] dts: add port control " Patrick Robb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250424014412.3849896-2-probb@iol.unh.edu \
    --to=probb@iol.unh.edu \
    --cc=Luca.Vizzarro@arm.com \
    --cc=Paul.Szczepanek@arm.com \
    --cc=dev@dpdk.org \
    --cc=dmarx@iol.unh.edu \
    --cc=jspewock@iol.unh.edu \
    --cc=npratte@iol.unh.edu \
    --cc=thomas.wilks@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).