DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jasvinder Singh <jasvinder.singh@intel.com>
To: dev@dpdk.org
Cc: bernard.iremonger@intel.com, reshma.pattan@intel.com
Subject: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
Date: Mon, 23 Jul 2018 11:44:25 +0100	[thread overview]
Message-ID: <20180723104425.10090-1-jasvinder.singh@intel.com> (raw)

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 <motih@mellanox.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@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

             reply	other threads:[~2018-07-23 10:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 10:44 Jasvinder Singh [this message]
2018-07-24  9:25 ` Iremonger, Bernard
2018-07-24 11:25 ` Thomas Monjalon
2018-07-24 12:33   ` Thomas Monjalon
2018-07-24 12:39     ` Pattan, Reshma
2018-07-24 12:41     ` Iremonger, Bernard
2018-07-24 13:39       ` Thomas Monjalon
2018-07-24 14:37     ` Mordechay Haimovsky
2018-07-24 16:59       ` Dumitrescu, Cristian
2018-07-25  8:18         ` Thomas Monjalon
2018-07-25  8:30           ` Singh, Jasvinder
2018-07-25  8:49             ` Dumitrescu, Cristian
2018-07-25  8:53             ` Mordechay Haimovsky
2018-07-25  9:04         ` Ananyev, Konstantin
2018-07-25  9:36           ` Dumitrescu, Cristian
2018-07-25 11:39             ` Ananyev, Konstantin
2018-07-25 11:55               ` Mordechay Haimovsky
2018-07-25 11:56               ` Dumitrescu, Cristian
2018-07-25 12:18                 ` Ananyev, Konstantin
2018-07-25 12:27                   ` Van Haaren, Harry
2018-07-25 13:21                     ` Dumitrescu, Cristian
2018-07-25 12:41                   ` Dumitrescu, Cristian
2018-07-25 13:34                     ` Ananyev, Konstantin
2018-07-24 14:17 ` [dpdk-dev] [PATCH v2] app/testpmd: fix testpmd exit for ctrl+d Reshma Pattan
2018-07-24 14:46   ` Pattan, Reshma
2018-07-24 15:31     ` Pattan, Reshma
2018-07-24 15:31     ` Iremonger, Bernard
2018-07-26 14:14     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180723104425.10090-1-jasvinder.singh@intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=reshma.pattan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).