From: Cyril Chemparathy <cchemparathy@tilera.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 2/6] test-pmd: add support for auto-start when interactive
Date: Thu, 3 Apr 2014 10:30:12 -0700 [thread overview]
Message-ID: <1396546216-29200-3-git-send-email-cchemparathy@tilera.com> (raw)
In-Reply-To: <1396546216-29200-1-git-send-email-cchemparathy@tilera.com>
This patch adds support for a command-line argument --auto-start (-a). When
running in interactive mode, this allows us to start traffic without user
intervention before dropping to the prompt.
Signed-off-by: Cyril Chemparathy <cchemparathy@tilera.com>
---
app/test-pmd/parameters.c | 20 ++++++++++++++++----
app/test-pmd/testpmd.c | 9 +++++++--
app/test-pmd/testpmd.h | 1 +
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index d47d020..18b52cc 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -85,7 +85,7 @@ usage(char* progname)
#ifdef RTE_LIBRTE_CMDLINE
"[--interactive|-i] "
#endif
- "[--help|-h] | ["
+ "[--help|-h] | [--auto-start|-a] | ["
"--coremask=COREMASK --portmask=PORTMASK --numa "
"--mbuf-size= | --total-num-mbufs= | "
"--nb-cores= | --nb-ports= | "
@@ -102,6 +102,8 @@ usage(char* progname)
#ifdef RTE_LIBRTE_CMDLINE
printf(" --interactive: run in interactive mode.\n");
#endif
+ printf(" --auto-start: start forwarding on init "
+ "[always when non-interactive].\n");
printf(" --help: display this message and quit.\n");
printf(" --nb-cores=N: set the number of forwarding cores "
"(1 <= N <= %d).\n", nb_lcores);
@@ -485,6 +487,7 @@ launch_args_parse(int argc, char** argv)
{ "help", 0, 0, 0 },
#ifdef RTE_LIBRTE_CMDLINE
{ "interactive", 0, 0, 0 },
+ { "auto-start", 0, 0, 0 },
{ "eth-peers-configfile", 1, 0, 0 },
{ "eth-peer", 1, 0, 0 },
#endif
@@ -539,11 +542,11 @@ launch_args_parse(int argc, char** argv)
argvopt = argv;
#ifdef RTE_LIBRTE_CMDLINE
-#define SHORTOPTS "ih"
+#define SHORTOPTS "i"
#else
-#define SHORTOPTS "h"
+#define SHORTOPTS ""
#endif
- while ((opt = getopt_long(argc, argvopt, SHORTOPTS,
+ while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ah",
lgopts, &opt_idx)) != EOF) {
switch (opt) {
#ifdef RTE_LIBRTE_CMDLINE
@@ -552,6 +555,11 @@ launch_args_parse(int argc, char** argv)
interactive = 1;
break;
#endif
+ case 'a':
+ printf("Auto-start selected\n");
+ auto_start = 1;
+ break;
+
case 0: /*long options */
if (!strcmp(lgopts[opt_idx].name, "help")) {
usage(argv[0]);
@@ -562,6 +570,10 @@ launch_args_parse(int argc, char** argv)
printf("Interactive-mode selected\n");
interactive = 1;
}
+ if (!strcmp(lgopts[opt_idx].name, "auto-start")) {
+ printf("Auto-start selected\n");
+ auto_start = 1;
+ }
if (!strcmp(lgopts[opt_idx].name,
"eth-peers-configfile")) {
if (init_peer_eth_addrs(optarg) != 0)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 04dca57..cde9c2b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -83,6 +83,7 @@ uint16_t verbose_level = 0; /**< Silent by default. */
/* use master core for command line ? */
uint8_t interactive = 0;
+uint8_t auto_start = 0;
/*
* NUMA support configuration.
@@ -1794,9 +1795,13 @@ main(int argc, char** argv)
rte_eth_promiscuous_enable(port_id);
#ifdef RTE_LIBRTE_CMDLINE
- if (interactive == 1)
+ if (interactive == 1) {
+ if (auto_start) {
+ printf("Start automatic packet forwarding\n");
+ start_packet_forwarding(0);
+ }
prompt();
- else
+ } else
#endif
{
char c;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index a4842ec..52d3543 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -270,6 +270,7 @@ extern uint16_t nb_rx_queue_stats_mappings;
/* globals used for configuration */
extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
extern uint8_t interactive;
+extern uint8_t auto_start;
extern uint8_t numa_support; /**< set by "--numa" parameter */
extern uint16_t port_topology; /**< set by "--port-topology" parameter */
extern uint8_t no_flush_rx; /**<set by "--no-flush-rx" parameter */
--
1.8.3.1
next prev parent reply other threads:[~2014-04-03 17:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-03 17:30 [dpdk-dev] [PATCH 0/6] Extensions to test-pmd Cyril Chemparathy
2014-04-03 17:30 ` [dpdk-dev] [PATCH 1/6] test-pmd: add support for single port loopback topology Cyril Chemparathy
2014-04-03 17:30 ` Cyril Chemparathy [this message]
2014-04-03 17:30 ` [dpdk-dev] [PATCH 3/6] test-pmd: allow command line selection of forwarding mode Cyril Chemparathy
2014-04-04 8:21 ` Richardson, Bruce
2014-05-14 17:05 ` [dpdk-dev] [PATCH] app/testpmd: list forwarding modes Thomas Monjalon
2014-05-15 9:35 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2014-05-15 16:08 ` [dpdk-dev] [PATCH v3] app/testpmd: list forwarding engines Thomas Monjalon
2014-05-16 7:21 ` Ivan Boule
2014-05-16 14:24 ` Thomas Monjalon
2014-04-03 17:30 ` [dpdk-dev] [PATCH 4/6] test-pmd: allow txpkts to be setup via command line Cyril Chemparathy
2014-04-03 17:30 ` [dpdk-dev] [PATCH 5/6] test-pmd: add mac swap forwarding mode Cyril Chemparathy
2014-04-03 17:30 ` [dpdk-dev] [PATCH 6/6] test-pmd: add flowgen forwarding engine Cyril Chemparathy
2014-05-16 14:22 ` [dpdk-dev] [PATCH 0/6] Extensions to test-pmd Thomas Monjalon
2014-05-16 16:55 ` Cyril Chemparathy
2014-05-19 9:31 ` 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=1396546216-29200-3-git-send-email-cchemparathy@tilera.com \
--to=cchemparathy@tilera.com \
--cc=dev@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).