DPDK patches and discussions
 help / color / mirror / Atom feed
From: jspewock@iol.unh.edu
To: alex.chapman@arm.com, Luca.Vizzarro@arm.com,
	Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech,
	paul.szczepanek@arm.com, npratte@iol.unh.edu, probb@iol.unh.edu,
	yoan.picchi@foss.arm.com, wathsala.vithanage@arm.com,
	thomas@monjalon.net
Cc: dev@dpdk.org, Jeremy Spewock <jspewock@iol.unh.edu>
Subject: [RFC PATCH v1 1/3] dts: add ability to modify number of queues on a port to testpmd
Date: Tue,  6 Aug 2024 14:56:29 -0400	[thread overview]
Message-ID: <20240806185631.335737-2-jspewock@iol.unh.edu> (raw)
In-Reply-To: <20240806185631.335737-1-jspewock@iol.unh.edu>

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

The ability to change the configuration of a port at runtime is a
crucial aspect of DPDK. This patch adds both the steps required to
modify the number of queues on a port at runtime and also the
verification steps to ensure that the command behaved as expected.

Depends-on: patch-142762 ("dts: add text parser for testpmd verbose
 output")
Depends-on: patch-142696 ("dts: add VLAN methods to testpmd shell")

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

diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
index 6bde7f536f..6eb6360bf7 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -1191,6 +1191,42 @@ def set_verbose(self, level: int, verify: bool = True) -> None:
                     f"Testpmd failed to set verbose level to {level}."
                 )
 
+    def set_num_queues_all(self, num_queues: int, is_rx: bool, verify: bool = True) -> None:
+        """Modify the number of Rx/Tx queues configured on all ports.
+
+        Args:
+            num_queues: Number of queues to set on all ports.
+            is_rx: If :data:`True` then the number of Rx queues will be modified, otherwise the
+                number of Tx queues will be modified.
+            verify: If :data:`True` then an additional command will be sent to check the info of
+                `port_id` and verify that the number of queues is equal to `num_queues`.
+
+        Raises:
+            InteractiveCommandExecutionError: If `verify` is :data:`True` and testpmd failed to
+                update the number of queues on the ports.
+        """
+        queue_type = "rxq" if is_rx else "txq"
+        self.port_stop_all(verify=verify)
+        port_config_output = self.send_command(f"port config all {queue_type} {num_queues}")
+        # ports have to be started before the output can be verified.
+        self.port_start_all(verify=verify)
+        if verify:
+            all_ports_modified = all(
+                queues == num_queues
+                for queues in map(
+                    lambda info: info.rx_queues_num if is_rx else info.tx_queues_num,
+                    self.show_port_info_all(),
+                )
+            )
+            if not all_ports_modified:
+                self._logger.debug(
+                    f"Failed to set number of queues on all ports to "
+                    f"{num_queues}:\n{port_config_output}"
+                )
+                raise InteractiveCommandExecutionError(
+                    "Testpmd failed to update the number of queues on all ports."
+                )
+
     def _close(self) -> None:
         """Overrides :meth:`~.interactive_shell.close`."""
         self.stop()
-- 
2.45.2


  reply	other threads:[~2024-08-06 18:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 18:56 [RFC PATCH v1 0/3] dts: pf_smoke port jspewock
2024-08-06 18:56 ` jspewock [this message]
2024-08-06 18:56 ` [RFC PATCH v1 2/3] dts: add pf smoke testing suite jspewock
2024-08-06 18:56 ` [RFC PATCH v1 3/3] dts: added pf_smoke_tests to yaml schema jspewock
2024-09-06 16:51 ` [PATCH v2 0/2] dts: pf_smoke port jspewock
2024-09-06 16:51   ` [PATCH v2 1/2] dts: add ability to modify number of queues on a port to testpmd jspewock
2024-09-06 16:51   ` [PATCH v2 2/2] dts: add pf smoke testing suite jspewock

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=20240806185631.335737-2-jspewock@iol.unh.edu \
    --to=jspewock@iol.unh.edu \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=Luca.Vizzarro@arm.com \
    --cc=alex.chapman@arm.com \
    --cc=dev@dpdk.org \
    --cc=juraj.linkes@pantheon.tech \
    --cc=npratte@iol.unh.edu \
    --cc=paul.szczepanek@arm.com \
    --cc=probb@iol.unh.edu \
    --cc=thomas@monjalon.net \
    --cc=wathsala.vithanage@arm.com \
    --cc=yoan.picchi@foss.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).