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]>
---
 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

Reply via email to