From: Dean Marx <dmarx@iol.unh.edu>
To: probb@iol.unh.edu, npratte@iol.unh.edu, luca.vizzarro@arm.com,
yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com,
paul.szczepanek@arm.com
Cc: dev@dpdk.org, Dean Marx <dmarx@iol.unh.edu>
Subject: [PATCH v4 1/2] dts: add csum HW offload to testpmd shell
Date: Mon, 14 Oct 2024 14:23:19 -0400 [thread overview]
Message-ID: <20241014182320.31125-2-dmarx@iol.unh.edu> (raw)
In-Reply-To: <20241014182320.31125-1-dmarx@iol.unh.edu>
Add csum_set_hw method to testpmd shell class.
Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
---
dts/framework/remote_session/testpmd_shell.py | 58 +++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
index 16b41a7814..aa1f2a58ca 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -126,6 +126,23 @@ def make_parser(cls) -> ParserFn:
)
+class ChecksumOffloadOptions(Flag):
+ """Flag representing checksum hardware offload layer options."""
+
+ #:
+ ip = auto()
+ #:
+ udp = auto()
+ #:
+ tcp = auto()
+ #:
+ sctp = auto()
+ #:
+ outer_ip = auto()
+ #:
+ outer_udp = auto()
+
+
class RSSOffloadTypesFlag(Flag):
"""Flag representing the RSS offload flow types supported by the NIC port."""
@@ -1702,6 +1719,47 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats:
return TestPmdPortStats.parse(output)
+ @requires_stopped_ports
+ def csum_set_hw(
+ self, layers: ChecksumOffloadOptions, port_id: int, verify: bool = True
+ ) -> None:
+ """Enables hardware checksum offloading on the specified layer.
+
+ Args:
+ layers: The layer/layers that checksum offloading should be enabled on.
+ port_id: The port number to enable checksum offloading on, should be within 0-32.
+ verify: If :data:`True` the output of the command will be scanned in an attempt to
+ verify that checksum offloading was enabled on the port.
+
+ Raises:
+ InteractiveCommandExecutionError: If checksum offload is not enabled successfully.
+ """
+ for name, offload in ChecksumOffloadOptions.__members__.items():
+ if offload in layers:
+ name = name.replace("_", "-")
+ csum_output = self.send_command(f"csum set {name} hw {port_id}")
+ if verify:
+ if (
+ "Bad arguments" in csum_output
+ or f"Please stop port {port_id} first" in csum_output
+ or f"checksum offload is not supported by port {port_id}" in csum_output
+ ):
+ self._logger.debug(f"Csum set hw error:\n{csum_output}")
+ raise InteractiveCommandExecutionError(
+ f"Failed to set csum hw {name} mode on port {port_id}"
+ )
+ success = False
+ if f"{name} checksum offload is hw" in csum_output.lower():
+ success = True
+ if not success and verify:
+ self._logger.debug(
+ f"Failed to set csum hw mode on port {port_id}:\n{csum_output}"
+ )
+ raise InteractiveCommandExecutionError(
+ f"""Failed to set csum hw mode on port
+ {port_id}:\n{csum_output}"""
+ )
+
@requires_stopped_ports
def set_port_mtu(self, port_id: int, mtu: int, verify: bool = True) -> None:
"""Change the MTU of a port using testpmd.
--
2.44.0
next prev parent reply other threads:[~2024-10-14 18:23 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 14:20 [PATCH v1 0/2] dts: port over checksum offload suite Dean Marx
2024-08-16 14:20 ` [PATCH v1 1/2] dts: add csum HW offload to testpmd shell Dean Marx
2024-08-16 14:20 ` [PATCH v1 2/2] dts: checksum offload test suite Dean Marx
2024-08-19 14:28 ` Alex Chapman
2024-08-19 17:01 ` Dean Marx
2024-08-19 14:28 ` [PATCH v1 0/2] dts: port over checksum offload suite Alex Chapman
2024-08-19 17:02 ` Dean Marx
2024-08-21 16:25 ` [PATCH v2 " Dean Marx
2024-08-21 16:25 ` [PATCH v2 1/2] dts: add csum HW offload to testpmd shell Dean Marx
2024-08-23 14:53 ` Jeremy Spewock
2024-08-26 21:04 ` Dean Marx
2024-08-21 16:25 ` [PATCH v2 2/2] dts: checksum offload test suite Dean Marx
2024-08-23 14:54 ` Jeremy Spewock
2024-08-26 21:17 ` Dean Marx
2024-08-23 14:53 ` [PATCH v2 0/2] dts: port over checksum offload suite Jeremy Spewock
2024-08-26 21:22 ` [PATCH v3 " Dean Marx
2024-08-26 21:22 ` [PATCH v3 1/2] dts: add csum HW offload to testpmd shell Dean Marx
2024-09-04 21:18 ` Jeremy Spewock
2024-08-26 21:22 ` [PATCH v3 2/2] dts: checksum offload test suite Dean Marx
2024-09-04 21:18 ` Jeremy Spewock
2024-10-14 18:23 ` [PATCH v4 0/2] dts: port over checksum offload suite Dean Marx
2024-10-14 18:23 ` Dean Marx [this message]
2024-10-14 18:23 ` [PATCH v4 2/2] dts: checksum offload test suite Dean Marx
2024-10-15 19:13 ` [PATCH v5 0/2] dts: port over checksum offload suite Dean Marx
2024-10-15 19:13 ` [PATCH v5 1/2] dts: add csum HW offload to testpmd shell Dean Marx
2024-11-19 16:07 ` Patrick Robb
2024-11-19 16:31 ` Patrick Robb
2024-10-15 19:13 ` [PATCH v5 2/2] dts: checksum offload test suite Dean Marx
2024-11-19 16:11 ` Patrick Robb
2024-11-19 16:30 ` 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=20241014182320.31125-2-dmarx@iol.unh.edu \
--to=dmarx@iol.unh.edu \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=dev@dpdk.org \
--cc=luca.vizzarro@arm.com \
--cc=npratte@iol.unh.edu \
--cc=paul.szczepanek@arm.com \
--cc=probb@iol.unh.edu \
--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).