When adding selective Rx, it was assumed that the queue configuration
was set when starting testpmd via the command line options.
But it should be possible to configure mempools with --mbuf-size,
start Rx, stop, and configure later a split in the testpmd CLI.
In such a scenario, a regression prevented to start
with more than 1 mempool without configuring a split:

        Configuring Port 0 (socket 0)
        ETHDEV: No Rx segmentation offload configured
        Fail to configure port 0 rx queues

It is fixed by considering having multiple mempools
is not a condition to trigger Rx split.

A test is added in DTS to validate this use case.

Bugzilla ID: 1956
Fixes: 0be0ad196b52 ("app/testpmd: support selective Rx")

Signed-off-by: Thomas Monjalon <[email protected]>
---
 app/test-pmd/testpmd.c          |  3 +--
 dts/tests/TestSuite_rx_split.py | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index fcd8a90967..b241a7025b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2750,8 +2750,7 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
        uint32_t prev_hdrs = 0;
        int ret;
 
-       if (multi_rx_mempool == 0 &&
-           (rx_pkt_nb_segs > 1 || mbuf_data_size_n > 1)) {
+       if (multi_rx_mempool == 0 && rx_pkt_nb_segs > 1) {
                unsigned int nb_segs = RTE_MAX(rx_pkt_nb_segs, 
(uint8_t)mbuf_data_size_n);
 
                /* multi-segment configuration */
diff --git a/dts/tests/TestSuite_rx_split.py b/dts/tests/TestSuite_rx_split.py
index 633ba0bf1e..5117a569e2 100644
--- a/dts/tests/TestSuite_rx_split.py
+++ b/dts/tests/TestSuite_rx_split.py
@@ -210,6 +210,30 @@ def expected(packet: bytes) -> bytes:
 
             self._start_and_verify(testpmd, expected)
 
+    @func_test
+    def selective_rx_runtime_config(self) -> None:
+        """Configure selective Rx at runtime after initial startup.
+
+        Steps:
+            Start testpmd with two mbuf-size pools but no rxpkts/rxhdrs.
+            Stop ports, configure buffer split offload, set rxpkts, restart 
ports.
+            Send an Ether/IP/payload packet.
+
+        Verify:
+            Initial startup succeeds without error.
+            Received packet has Ether + IP headers only after runtime config.
+            Port stats show expected rx_packets and rx_bytes.
+        """
+        with self._create_testpmd(
+            mbuf_size=[512, 0],
+        ) as testpmd:
+            self._start_and_verify(testpmd)
+            testpmd.stop()
+            testpmd.stop_all_ports()
+            testpmd.send_command("port config 0 rx_offload buffer_split on")
+            testpmd.send_command(f"set rxpkts {ETHER_IP_HDR_LEN},0")
+            self._start_and_verify(testpmd, ETHER_IP_HDR_LEN)
+
     @func_test
     def selective_rx_no_offload(self) -> None:
         """Configure selective Rx with buffer split disabled.
-- 
2.54.0

Reply via email to