DPDK usage discussions
 help / color / mirror / Atom feed
From: longtb5@viettel.com.vn
To: <users@dpdk.org>
Cc: <olivier.matz@6wind.com>
Subject: [dpdk-users] librte_cmdline usage
Date: Mon, 22 Jan 2018 17:15:22 +0700 (ICT)	[thread overview]
Message-ID: <001501d3936a$5ad21450$10763cf0$@viettel.com.vn> (raw)

Hi all,

I'm writing an application where there already exists a cmdline. Users can
issue commands by typing from stdin. I want to support another user
interface where commands are read from sources other than stdin, saved into
a string buffer, then executed using the already existed cmd_parse_ctx_t.

So far I have implemented this functionality using the cmdline_interact()
API like so (pseudo code).

/* Initialization */
/* cmds_ctx is the existing command context
 * that I wish to reuse
 */
new_cl = cmdline_new(cmds_ctx, "", cmdbuf_fd, 1); 

/* Polling */
for ( ; ; ) {
	snprintf(cmdbuf, cmdlen + 2, "%s\n", raw_string);
	lseek(cmdbuf_fd, 0 , SEEK_SET);
	cmdline_interact(new_cl);
}

There are a couple of questions:

1. Using cmdline_interact() seems to be quite expensive. How can I reduce
this cost. Is there a leaner/more elegant way to implement this using DPDK
API or do I have to write my own code/change the lib?

2. How can I disable the behavior where every interaction is written to
stdout, i.e., to have no output what so ever. Again this is to improve
performance since writing to stdout is costly.

Thanks and best regards,
--BL

             reply	other threads:[~2018-01-22 10:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-22 10:15 longtb5 [this message]
2018-01-22 13:38 ` Olivier Matz
2018-01-23  2:03   ` longtb5

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='001501d3936a$5ad21450$10763cf0$@viettel.com.vn' \
    --to=longtb5@viettel.com.vn \
    --cc=olivier.matz@6wind.com \
    --cc=users@dpdk.org \
    /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).