From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Song Jiale <songx.jiale@intel.com>,
Luca Vizzarro <luca.vizzarro@arm.com>,
Patrick Robb <patrickrobb1997@gmail.com>
Subject: [PATCH 1/2] dts: simplify packet check in Rx split
Date: Thu, 25 Jun 2026 01:03:22 +0200 [thread overview]
Message-ID: <20260624230656.2172633-2-thomas@monjalon.net> (raw)
In-Reply-To: <20260624230656.2172633-1-thomas@monjalon.net>
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
next prev parent reply other threads:[~2026-06-24 23:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 23:03 [PATCH 0/2] fix Rx split in testpmd Thomas Monjalon
2026-06-24 23:03 ` Thomas Monjalon [this message]
2026-06-24 23:03 ` [PATCH 2/2] app/testpmd: fix runtime config of Rx split Thomas Monjalon
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=20260624230656.2172633-2-thomas@monjalon.net \
--to=thomas@monjalon.net \
--cc=dev@dpdk.org \
--cc=luca.vizzarro@arm.com \
--cc=patrickrobb1997@gmail.com \
--cc=songx.jiale@intel.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