[RFC v1 1/2] dts: add csum HW offload to testpmd shell
Jeremy Spewock
jspewock at iol.unh.edu
Mon Aug 12 22:55:00 CEST 2024
On Mon, Aug 12, 2024 at 9:41 AM Dean Marx <dmarx at iol.unh.edu> wrote:
>
> add csum_set_hw method to testpmd shell class. Port over
> set_verbose and port start/stop from queue start/stop suite.
>
> Signed-off-by: Dean Marx <dmarx at iol.unh.edu>
> ---
<snip>
> + def csum_set_hw(self, layer: str, port_id: int, verify: bool = True) -> None:
> + """Enables hardware checksum offloading on the specified layer.
> +
> + Args:
> + layer: The layer that checksum offloading should be enabled on.
> + options: tcp, ip, udp, sctp, outer-ip, outer-udp.
If there are specific options like this, it might be worth making this
parameter into a flag where users can specify one or more of the
options and testpmd can handle setting them all. That way users don't
have to even read the doc-string for the options, it will be apparent
in the class they have to use.
> + 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.
> + """
> + csum_output = self.send_command(f"csum set {layer} hw {port_id}")
> + if (verify and ("Bad arguments" in csum_output or f"Please stop port {port_id} first")):
> + 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}"
> + )
> + if verify and f"checksum offload is not supported by port {port_id}" in csum_output:
> + self._logger.debug(f"Checksum {layer} offload is not supported by port {port_id}:\n{csum_output}")
> +
> + success = False
> + if "outer-ip" in layer:
> + if "Outer-Ip checksum offload is hw" in csum_output:
> + success = True
> + if "outer-udp" in layer:
> + if "Outer-Udp checksum offload is hw" in csum_output:
> + success = True
> + else:
> + if f"{layer.upper} checksum offload is hw" in csum_output:
> + success = True
> + if not success and verify:
> + self._logger.debug(f"Failed to set csum hw mode on port {port_id}:\n{csum_output}")
> +
<snip>
> --
> 2.44.0
>
More information about the dev
mailing list