DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] fix Rx split in testpmd
@ 2026-06-24 23:03 Thomas Monjalon
  2026-06-24 23:03 ` [PATCH 1/2] dts: simplify packet check in Rx split Thomas Monjalon
  2026-06-24 23:03 ` [PATCH 2/2] app/testpmd: fix runtime config of " Thomas Monjalon
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Monjalon @ 2026-06-24 23:03 UTC (permalink / raw)
  To: dev; +Cc: Song Jiale

Adding selective Rx in DPDK 26.07-rc1
introduced a regression when configuring Rx split
at runtime with mempools defined on start.

While fixing it, a test is added in DTS,
and a refactoring in DTS is added as first patch
to make the second change smaller.

Thomas Monjalon (2):
  dts: simplify packet check in Rx split
  app/testpmd: fix runtime config of Rx split

 app/test-pmd/testpmd.c          |  3 +-
 dts/tests/TestSuite_rx_split.py | 59 +++++++++++++++++++++++----------
 2 files changed, 43 insertions(+), 19 deletions(-)

-- 
2.54.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] dts: simplify packet check in Rx split
  2026-06-24 23:03 [PATCH 0/2] fix Rx split in testpmd Thomas Monjalon
@ 2026-06-24 23:03 ` Thomas Monjalon
  2026-06-24 23:03 ` [PATCH 2/2] app/testpmd: fix runtime config of " Thomas Monjalon
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2026-06-24 23:03 UTC (permalink / raw)
  To: dev; +Cc: Song Jiale, Luca Vizzarro, Patrick Robb

Add shortcuts to the function verifying a received packet
match its expected content.
Previous version worked with a callback function defining
the expected received packet based on the sent packet.
This new version allows to pass a header length,
so only the header is expected, or directly the expected bytes.
If the parameter is None, the full packet is expected.
This is shorter than defining a callback in many cases.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 dts/tests/TestSuite_rx_split.py | 35 +++++++++++++++++----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/dts/tests/TestSuite_rx_split.py b/dts/tests/TestSuite_rx_split.py
index 5f5a2e6187..633ba0bf1e 100644
--- a/dts/tests/TestSuite_rx_split.py
+++ b/dts/tests/TestSuite_rx_split.py
@@ -56,11 +56,24 @@ def _build_packet(self) -> Packet:
         packet = Ether() / IP() / Raw(load=PAYLOAD)
         return adjust_addresses([packet])[0]
 
-    def _start_and_verify(self, testpmd: TestPmd, expected: Callable[[bytes], bytes]) -> None:
+    def _start_and_verify(
+        self,
+        testpmd: TestPmd,
+        expected: Callable[[bytes], bytes] | bytes | int | None = None,
+    ) -> None:
         """Start testpmd, send the default packet, and verify received bytes."""
         testpmd.start()
         packet = self._build_packet()
-        self._send_and_verify(testpmd, packet, expected(bytes(packet)))
+        raw = bytes(packet)
+        if expected is None:
+            raw_expected = raw
+        elif isinstance(expected, int):
+            raw_expected = raw[:expected]
+        elif isinstance(expected, bytes):
+            raw_expected = expected
+        else:
+            raw_expected = expected(raw)
+        self._send_and_verify(testpmd, packet, raw_expected)
 
     def _send_and_verify(self, testpmd: TestPmd, tg_packet: Packet, expected: bytes) -> None:
         """Clear stats, send a packet, and verify received content and stats.
@@ -128,11 +141,7 @@ def selective_rx_headers(self) -> None:
             rx_segments_length=[ETHER_IP_HDR_LEN, 0],
             mbuf_size=[256, 0],
         ) as testpmd:
-
-            def expected(packet: bytes) -> bytes:
-                return packet[:ETHER_IP_HDR_LEN]
-
-            self._start_and_verify(testpmd, expected)
+            self._start_and_verify(testpmd, ETHER_IP_HDR_LEN)
 
     @func_test
     def selective_rx_headers_discard_length(self) -> None:
@@ -151,11 +160,7 @@ def selective_rx_headers_discard_length(self) -> None:
             rx_segments_length=[ETHER_IP_HDR_LEN, len(PAYLOAD)],
             mbuf_size=[256, 0],
         ) as testpmd:
-
-            def expected(packet: bytes) -> bytes:
-                return packet[:ETHER_IP_HDR_LEN]
-
-            self._start_and_verify(testpmd, expected)
+            self._start_and_verify(testpmd, ETHER_IP_HDR_LEN)
 
     @func_test
     def selective_rx_payload_only(self) -> None:
@@ -173,11 +178,7 @@ def selective_rx_payload_only(self) -> None:
             rx_segments_length=[ETHER_IP_HDR_LEN, len(PAYLOAD)],
             mbuf_size=[0, 512],
         ) as testpmd:
-
-            def expected(_: bytes) -> bytes:
-                return PAYLOAD
-
-            self._start_and_verify(testpmd, expected)
+            self._start_and_verify(testpmd, PAYLOAD)
 
     @func_test
     def selective_rx_two_segments(self) -> None:
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] app/testpmd: fix runtime config of Rx split
  2026-06-24 23:03 [PATCH 0/2] fix Rx split in testpmd Thomas Monjalon
  2026-06-24 23:03 ` [PATCH 1/2] dts: simplify packet check in Rx split Thomas Monjalon
@ 2026-06-24 23:03 ` Thomas Monjalon
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2026-06-24 23:03 UTC (permalink / raw)
  To: dev; +Cc: Song Jiale, Aman Singh, Luca Vizzarro, Patrick Robb,
	Gregory Etelson

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 <thomas@monjalon.net>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-24 23:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-24 23:03 [PATCH 0/2] fix Rx split in testpmd Thomas Monjalon
2026-06-24 23:03 ` [PATCH 1/2] dts: simplify packet check in Rx split Thomas Monjalon
2026-06-24 23:03 ` [PATCH 2/2] app/testpmd: fix runtime config of " Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox