From: YU DAPENG <dapengx...@intel.com>

In interactive mode, if testpmd exit by calling rte_exit without cmdline
resource release, terminal will not echo keyboard input. So add code to
just show error message, but not exit testpmd when unexpected happens
on starting packet forwarding in interactive mode. User can type "quit"
to exit testpmd later.

Fixes: 5a8fb55c48ab ("app/testpmd: support unidirectional configuration")
Cc: sta...@dpdk.org

Signed-off-by: YU DAPENG <dapengx...@intel.com>
---
 app/test-pmd/testpmd.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 33fc0fddf..0071c7235 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2194,10 +2194,18 @@ start_packet_forwarding(int with_tx_first)
 
        if ((strcmp(cur_fwd_eng->fwd_mode_name, "rxonly") != 0 &&
                strcmp(cur_fwd_eng->fwd_mode_name, "txonly") != 0) &&
-               (!nb_rxq || !nb_txq))
+               (!nb_rxq || !nb_txq)) {
+#ifdef RTE_LIB_CMDLINE
+               if (interactive == 1) {
+                       printf("Either rxq or txq are 0, cannot use %s fwd 
mode\n",
+                               cur_fwd_eng->fwd_mode_name);
+                       return;
+               }
+#endif
                rte_exit(EXIT_FAILURE,
                        "Either rxq or txq are 0, cannot use %s fwd mode\n",
                        cur_fwd_eng->fwd_mode_name);
+       }
 
        if (all_ports_started() == 0) {
                printf("Not all ports were started\n");
-- 
2.27.0

Reply via email to