Fix testpmd app exit by pressing ctrl+d, End-of-Transmission character (EOT) on the empty command line. Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
Reported-by: Mordechay Haimovsky <mo...@mellanox.com> Signed-off-by: Jasvinder Singh <jasvinder.si...@intel.com> --- app/test-pmd/cmdline.c | 10 ++++++---- lib/librte_cmdline/cmdline.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 5885289..edaf0e6 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -17581,12 +17581,14 @@ prompt(void) for (;;) { status = cmdline_poll(testpmd_cl); - if (status < 0) - rte_panic("CLI poll error (%" PRId32 ")\n", status); - else if (status == RDLINE_EXITED) { + if (status == RDLINE_EXITED || status == RDLINE_RES_EOF) { + if (status == RDLINE_RES_EOF) + pmd_test_exit(); + cmdline_stdin_exit(testpmd_cl); rte_exit(0, "\n"); - } + } else if (status < 0) + rte_panic("CLI poll error (%" PRId32 ")\n", status); #if defined RTE_LIBRTE_PMD_SOFTNIC diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c index 591b78b..47b0f6a 100644 --- a/lib/librte_cmdline/cmdline.c +++ b/lib/librte_cmdline/cmdline.c @@ -187,7 +187,7 @@ cmdline_in(struct cmdline *cl, const char *buf, int size) rdline_newline(&cl->rdl, cl->prompt); } else if (ret == RDLINE_RES_EOF) - return -1; + return RDLINE_RES_EOF; else if (ret == RDLINE_RES_EXITED) return -1; } -- 2.9.3