[PATCH v2 1/2] dts: add start Tx first method to testpmd shell
Dean Marx
dmarx at iol.unh.edu
Fri Oct 3 21:27:15 CEST 2025
Add start tx_first method to testpmd shell, which sends
a specified number of burst packets prior to starting
packet forwarding.
Signed-off-by: Dean Marx <dmarx at iol.unh.edu>
Reviewed-by: Luca Vizzarro <luca.vizzarro at arm.com>
---
dts/api/testpmd/__init__.py | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/dts/api/testpmd/__init__.py b/dts/api/testpmd/__init__.py
index a060ab5639..5cf1ae7fac 100644
--- a/dts/api/testpmd/__init__.py
+++ b/dts/api/testpmd/__init__.py
@@ -199,6 +199,27 @@ def start(self, verify: bool = True) -> None:
self._logger.debug(f"Failed to start packet forwarding: \n{start_cmd_output}")
raise InteractiveCommandExecutionError("Testpmd failed to start packet forwarding.")
+ @_requires_started_ports
+ def start_tx_first(self, burst_num: int, verify: bool = True) -> None:
+ """Start packet forwarding after sending specified number of bursts of packets.
+
+ Args:
+ burst_num: Number of packets to send before stopping transmission.
+ verify: If :data:`True` , a second start command will be sent in an attempt to verify
+ packet forwarding started as expected.
+
+ Raises:
+ InteractiveCommandExecutionError: If `verify` is :data:`True` and forwarding fails to
+ start or ports fail to come up.
+ """
+ self.send_command(f"start tx_first {burst_num if burst_num is not None else ""}")
+ if verify:
+ # If forwarding was already started, sending "start" again should tell us
+ start_cmd_output = self.send_command("start")
+ if "Packet forwarding already started" not in start_cmd_output:
+ self._logger.debug(f"Failed to start packet forwarding: \n{start_cmd_output}")
+ raise InteractiveCommandExecutionError("Testpmd failed to start packet forwarding.")
+
def stop(self, verify: bool = True) -> str:
"""Stop packet forwarding.
--
2.51.0
More information about the dev
mailing list