[dpdk-users] librte_cmdline usage

longtb5 at viettel.com.vn longtb5 at viettel.com.vn
Mon Jan 22 11:15:22 CET 2018


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


More information about the users mailing list