[PATCH v11 3/3] dts: add Rx Tx offload test suite

Patrick Robb probb at iol.unh.edu
Tue Oct 28 23:33:18 CET 2025


Applied to next-dts with a commit reword, thanks.

On Tue, Oct 28, 2025 at 8:22 AM Andrew Bailey <abailey at iol.unh.edu> wrote:

> Add mbuf_fast_free portion of rxtx offload testsuite from legacy dts
> to next dts. The testsuite expects mbuf fast free to be enabled by
> default and verifies configuration of this Tx offload capability.
>
> Signed-off-by: Andrew Bailey <abailey at iol.unh.edu>
> ---
>  doc/api/dts/tests.TestSuite_rx_tx_offload.rst |   8 ++
>  dts/tests/TestSuite_rx_tx_offload.py          | 134 ++++++++++++++++++
>  2 files changed, 142 insertions(+)
>  create mode 100644 doc/api/dts/tests.TestSuite_rx_tx_offload.rst
>  create mode 100644 dts/tests/TestSuite_rx_tx_offload.py
>
> diff --git a/doc/api/dts/tests.TestSuite_rx_tx_offload.rst
> b/doc/api/dts/tests.TestSuite_rx_tx_offload.rst
> new file mode 100644
> index 0000000000..27834a74da
> --- /dev/null
> +++ b/doc/api/dts/tests.TestSuite_rx_tx_offload.rst
> @@ -0,0 +1,8 @@
> +.. SPDX-License-Identifier: BSD-3-Clause
> +
> +rx_tx_offload Test Suite
> +========================
> +
> +.. automodule:: tests.TestSuite_rx_tx_offload
> +   :members:
> +   :show-inheritance:
> diff --git a/dts/tests/TestSuite_rx_tx_offload.py
> b/dts/tests/TestSuite_rx_tx_offload.py
> new file mode 100644
> index 0000000000..b0da627d3c
> --- /dev/null
> +++ b/dts/tests/TestSuite_rx_tx_offload.py
> @@ -0,0 +1,134 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2025 University of New Hampshire
> +
> +"""RX TX offload test suite.
> +
> +Test the testpmd feature of configuring RX and TX offloads.
> +"""
> +
> +from api.capabilities import (
> +    LinkTopology,
> +    NicCapability,
> +    requires_link_topology,
> +    requires_nic_capability,
> +)
> +from api.test import verify
> +from api.testpmd import TestPmd
> +from api.testpmd.types import (
> +    OffloadConfiguration,
> +    RxTxLiteralSwitch,
> +)
> +from framework.test_suite import TestSuite, func_test
> +
> +
> + at requires_link_topology(LinkTopology.ONE_LINK)
> +class TestRxTxOffload(TestSuite):
> +    """RX/TX offload test suite."""
> +
> +    def _check_config(
> +        self,
> +        testpmd: TestPmd,
> +        port_id: int,
> +        port_offload: str | None,
> +        rxtx: RxTxLiteralSwitch,
> +        /,
> +        queue_offload: list[str | None] | None = None,
> +    ) -> bool:
> +        config: OffloadConfiguration =
> testpmd.get_offload_config(port_id, rxtx)
> +        if config.port_config.name != port_offload:
> +            return False
> +
> +        if queue_offload:
> +            for i, q in enumerate(config.queue_configs):
> +                if q.name != queue_offload[i]:
> +                    return False
> +        return True
> +
> +    def _set_all_queues_mbuf_fast_free(
> +        self,
> +        testpmd: TestPmd,
> +        port_id: int,
> +        on: bool,
> +        num_queues: int,
> +    ) -> None:
> +        for i in range(num_queues):
> +            testpmd.set_queue_mbuf_fast_free(port_id, on, i)
> +
> +    @requires_nic_capability(NicCapability.PORT_TX_OFFLOAD_MBUF_FAST_FREE)
> +    @func_test
> +    def test_mbuf_fast_free_configuration_per_port(self) -> None:
> +        """Ensure mbuf_fast_free can be configured with testpmd per port.
> +
> +        Steps:
> +            * Start up testpmd shell.
> +            * Toggle mbuf_fast_free off per port.
> +            * Toggle mbuf_fast_free on per port.
> +
> +        Verify:
> +            * Mbuf_fast_free starts enabled.
> +            * Mbuf_fast_free can be configured off per port.
> +            * Mbuf_fast_free can be configured on per port.
> +        """
> +        with TestPmd() as testpmd:
> +            port_id = 0
> +            testpmd.start_all_ports()
> +
> +            # Ensure MBUF_FAST_FREE is enabled by default and verify
> +            verify(
> +                self._check_config(testpmd, port_id, "MBUF_FAST_FREE",
> "tx"),
> +                "MBUF_FAST_FREE disabled on port start.",
> +            )
> +            # disable MBUF_FAST_FREE per port and verify
> +            testpmd.set_port_mbuf_fast_free(port_id, False)
> +            verify(
> +                self._check_config(testpmd, port_id, None, "tx"),
> +                "Failed to enable MBUF_FAST_FREE on port.",
> +            )
> +            # Enable MBUF_FAST_FREE per port and verify
> +            testpmd.set_port_mbuf_fast_free(port_id, True)
> +            verify(
> +                self._check_config(testpmd, port_id, "MBUF_FAST_FREE",
> "tx"),
> +                "Failed to disable MBUF_FAST_FREE on port.",
> +            )
> +
> +
> @requires_nic_capability(NicCapability.QUEUE_TX_OFFLOAD_MBUF_FAST_FREE)
> +    @func_test
> +    def test_mbuf_fast_free_configuration_per_queue(self) -> None:
> +        """Ensure mbuf_fast_free can be configured with testpmd.
> +
> +        Steps:
> +            * Start up testpmd shell.
> +            * Toggle mbuf_fast_free off per queue.
> +            * Toggle mbuf_fast_free on per queue.
> +
> +        Verify:
> +            * Mbuf_fast_free starts disabled.
> +            * Mbuf_fast_free can be configured off per queue.
> +            * Mbuf_fast_free can be configured on per queue.
> +        """
> +        with TestPmd() as testpmd:
> +            port_id = 0
> +            num_queues = 4
> +            queue_off: list[str | None] | None = [None] * num_queues
> +            queue_on: list[str | None] | None = ["MBUF_FAST_FREE"] *
> num_queues
> +
> +            testpmd.set_ports_queues(num_queues)
> +            testpmd.start_all_ports()
> +
> +            # Ensure mbuf_fast_free is enabled by default on port and
> queues
> +            verify(
> +                self._check_config(testpmd, port_id, "MBUF_FAST_FREE",
> "tx", queue_on),
> +                "MBUF_FAST_FREE disabled on queue start.",
> +            )
> +            # Disable mbuf_fast_free per queue and verify
> +            self._set_all_queues_mbuf_fast_free(testpmd, port_id, False,
> num_queues)
> +            verify(
> +                self._check_config(testpmd, port_id, "MBUF_FAST_FREE",
> "tx", queue_off),
> +                "Failed to disable MBUF_FAST_FREE on all queues.",
> +            )
> +            # Disable mbuf_fast_free per queue and verify
> +            self._set_all_queues_mbuf_fast_free(testpmd, port_id, True,
> num_queues)
> +            verify(
> +                self._check_config(testpmd, port_id, "MBUF_FAST_FREE",
> "tx", queue_on),
> +                "Failed to enable MBUF_FAST_FREE on all queues.",
> +            )
> --
> 2.50.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20251028/ae803a5e/attachment.htm>


More information about the dev mailing list