app/testpmd: enable warnings for possibly invalid config
PATCH 1/1 app/testpmd: enable warnings for possibly invalid config
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.
--- app/test-pmd/parameters.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
app/test-pmd/parameters.c +21 -0
@@ -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;
Signature · 1 line
2.48.1
Quoted 8 lines · On Fri, 12 Sep 2025 17:02:10 +0100 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 <[email protected]>---
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?
Quoted 9 lines · Stephen Hemminger
Quoted 6 lines · On Fri, 12 Sep 2025 17:02:10 +0100 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.
Quoted 9 lines
Quoted 2 lines
Signed-off-by Bruce Richardson <[email protected]>---
Should also check for
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITwhich should require multiple segment support.Could testpmd also check the descriptor limits of the device? Does it validate
nb_seg_maxfor TSO, andnb_mtu_seg_maxfor 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
Stephen Hemminger
AppliedQuoted 8 lines · On Fri, 12 Sep 2025 17:02:10 +0100 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 <[email protected]>---
Queued to next-net