DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: enable warnings for possibly invalid config
@ 2025-09-12 16:02 Bruce Richardson
  2025-09-15 17:53 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2025-09-12 16:02 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

When dealing with multi-segment packets, there are separate offload
flags which should be enabled on Rx (scattered flag) and on Tx
(multi-segment flag). Print warnings on testpmd startup if we detect a
situation where we suspect the user is missing these flags, e.g. we
allow scattered packets on Rx, but not on Tx.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/parameters.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index f7601df0bf..058e3c6826 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -1770,6 +1770,27 @@ launch_args_parse(int argc, char** argv)
 			TESTPMD_OPT_PROC_ID, proc_id,
 			TESTPMD_OPT_NUM_PROCS, num_procs);
 
+	/* check for multiple segments without scattered flag enabled */
+	if (mbuf_data_size_n > 1 && (rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) == 0)
+		TESTPMD_LOG(WARNING, "Warning: multiple mbuf sizes specified but scattered Rx not enabled\n");
+
+	/* check for max packet size greater than mbuf size, without scatter or multi-seg flags */
+	if (max_rx_pkt_len > mbuf_data_size[0]) {
+		if ((rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) == 0)
+			TESTPMD_LOG(WARNING, "Warning: max-pkt-len (%u) is greater than mbuf size (%u) without scattered Rx enabled\n",
+					max_rx_pkt_len, mbuf_data_size[0]);
+		if ((tx_offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS) == 0)
+			TESTPMD_LOG(WARNING, "Warning: max-pkt-len (%u) is greater than mbuf size (%u) without multi-segment Tx enabled\n",
+					max_rx_pkt_len, mbuf_data_size[0]);
+	}
+
+	/* check for scattered Rx enabled without also having multi-segment Tx */
+	if ((rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) != 0 &&
+			(tx_offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS) == 0) {
+		TESTPMD_LOG(WARNING, "Warning: Scattered RX offload enabled, but TX multi-segment support not enabled.\n");
+		TESTPMD_LOG(WARNING, "         Multi-segment packets can be received but not transmitted.\n");
+	}
+
 	/* Set offload configuration from command line parameters. */
 	rx_mode.offloads = rx_offloads;
 	tx_mode.offloads = tx_offloads;
-- 
2.48.1


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

* Re: [PATCH] app/testpmd: enable warnings for possibly invalid config
  2025-09-12 16:02 [PATCH] app/testpmd: enable warnings for possibly invalid config Bruce Richardson
@ 2025-09-15 17:53 ` Stephen Hemminger
  2025-09-16  7:47   ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2025-09-15 17:53 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Fri, 12 Sep 2025 17:02:10 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:

> When dealing with multi-segment packets, there are separate offload
> flags which should be enabled on Rx (scattered flag) and on Tx
> (multi-segment flag). Print warnings on testpmd startup if we detect a
> situation where we suspect the user is missing these flags, e.g. we
> allow scattered packets on Rx, but not on Tx.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

Should also check for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT which should require
multiple segment support.

Could testpmd also check the descriptor limits of the device?
Does it validate nb_seg_max for TSO, and nb_mtu_seg_max for all cases?


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

* Re: [PATCH] app/testpmd: enable warnings for possibly invalid config
  2025-09-15 17:53 ` Stephen Hemminger
@ 2025-09-16  7:47   ` Bruce Richardson
  0 siblings, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2025-09-16  7:47 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Mon, Sep 15, 2025 at 10:53:08AM -0700, Stephen Hemminger wrote:
> On Fri, 12 Sep 2025 17:02:10 +0100
> Bruce Richardson <bruce.richardson@intel.com> wrote:
> 
> > When dealing with multi-segment packets, there are separate offload
> > flags which should be enabled on Rx (scattered flag) and on Tx
> > (multi-segment flag). Print warnings on testpmd startup if we detect a
> > situation where we suspect the user is missing these flags, e.g. we
> > allow scattered packets on Rx, but not on Tx.
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> 
> Should also check for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT which should require
> multiple segment support.
> 
> Could testpmd also check the descriptor limits of the device?
> Does it validate nb_seg_max for TSO, and nb_mtu_seg_max for all cases?
> 

There are indeed lots of other checks that testpmd could do, but I'm not
going to try and implement them all in this one patch. The main reason for
doing these particular checks is that it's comparatively easy to enable
scattered support on Rx - since there is an explicit flag for it, and some
drivers enable the support automatically if they detect an MTU > mbuf size
- but it's awkward to enable on Tx, since you have to manually specify the
Tx offloads flags.

/Bruce

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

end of thread, other threads:[~2025-09-16  7:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-12 16:02 [PATCH] app/testpmd: enable warnings for possibly invalid config Bruce Richardson
2025-09-15 17:53 ` Stephen Hemminger
2025-09-16  7:47   ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).