DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xueming Li <xuemingl@mellanox.com>
Cc: Xueming Li <xuemingl@mellanox.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	dev@dpdk.org, Olivier MATZ <olivier.matz@6wind.com>,
	Burakov Anatoly <anatoly.burakov@intel.com>
Subject: [dpdk-dev] [PATCH v1] app/testpmd: support command echo in CLI batch loading
Date: Tue, 26 Dec 2017 22:25:55 +0800	[thread overview]
Message-ID: <20171226142555.156122-1-xuemingl@mellanox.com> (raw)
In-Reply-To: <20171115154545.8936-2-xuemingl@mellanox.com>

Use first bit of verbose_level to enable CLI echo of batch loading.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
---
 app/test-pmd/cmdline.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f71d96301..0c58dea7b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -40,6 +40,7 @@
 #include <termios.h>
 #include <unistd.h>
 #include <inttypes.h>
+#include <fcntl.h>
 #ifndef __linux__
 #ifndef __FreeBSD__
 #include <net/socket.h>
@@ -15776,9 +15777,19 @@ cmdline_parse_ctx_t main_ctx[] = {
 void
 cmdline_read_from_file(const char *filename)
 {
+	int fd;
 	struct cmdline *cl;
 
-	cl = cmdline_file_new(main_ctx, "testpmd> ", filename);
+	if (!filename)
+		return;
+	fd = open(filename, O_RDONLY, 0);
+	if (fd < 0) {
+		printf("File open() failed\n");
+		return;
+	}
+
+	cl = cmdline_new(main_ctx, "testpmd> ", fd,
+			 verbose_level & 0x8000 ? STDOUT_FILENO : -1);
 	if (cl == NULL) {
 		printf("Failed to create file based cmdline context: %s\n",
 		       filename);
-- 
2.13.3

  parent reply	other threads:[~2017-12-26 14:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 15:45 [dpdk-dev] [PATCH 0/3] enable echo when CLI loading from file Xueming Li
2017-11-15 15:45 ` [dpdk-dev] [PATCH 1/3] lib/cmdline: add echo support in batch " Xueming Li
2017-12-11 12:29   ` Burakov, Anatoly
2017-12-19 10:30   ` Olivier MATZ
2017-12-19 11:20     ` Xueming(Steven) Li
2017-12-26 14:25   ` Xueming Li [this message]
2018-01-10  8:35     ` [dpdk-dev] [PATCH v1] app/testpmd: support command echo in CLI batch loading Lu, Wenzhuo
2018-01-10  8:51       ` Xueming(Steven) Li
2018-01-10 12:25         ` Lu, Wenzhuo
2018-01-10 14:14           ` Xueming(Steven) Li
2017-11-15 15:45 ` [dpdk-dev] [PATCH 2/3] " Xueming Li
2017-12-11 12:36   ` Burakov, Anatoly
2017-11-15 15:45 ` [dpdk-dev] [PATCH 3/3] test: update batch loading test Xueming Li
2017-12-11 12:33   ` Burakov, Anatoly

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=20171226142555.156122-1-xuemingl@mellanox.com \
    --to=xuemingl@mellanox.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=olivier.matz@6wind.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).