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>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
#ifdef RTE_LIBRTE_CMDLINE
"[--interactive|-i] "
#endif
#ifdef RTE_LIBRTE_CMDLINE
"[--interactive|-i] "
#endif
+ "[--help|-h] | [--auto-start|-a] | ["
"--coremask=COREMASK --portmask=PORTMASK --numa "
"--mbuf-size= | --total-num-mbufs= | "
"--nb-cores= | --nb-ports= | "
"--coremask=COREMASK --portmask=PORTMASK --numa "
"--mbuf-size= | --total-num-mbufs= | "
"--nb-cores= | --nb-ports= | "
#ifdef RTE_LIBRTE_CMDLINE
printf(" --interactive: run in interactive mode.\n");
#endif
#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);
printf(" --help: display this message and quit.\n");
printf(" --nb-cores=N: set the number of forwarding cores "
"(1 <= N <= %d).\n", nb_lcores);
{ "help", 0, 0, 0 },
#ifdef RTE_LIBRTE_CMDLINE
{ "interactive", 0, 0, 0 },
{ "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
{ "eth-peers-configfile", 1, 0, 0 },
{ "eth-peer", 1, 0, 0 },
#endif
argvopt = argv;
#ifdef RTE_LIBRTE_CMDLINE
argvopt = argv;
#ifdef RTE_LIBRTE_CMDLINE
- 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
lgopts, &opt_idx)) != EOF) {
switch (opt) {
#ifdef RTE_LIBRTE_CMDLINE
interactive = 1;
break;
#endif
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]);
case 0: /*long options */
if (!strcmp(lgopts[opt_idx].name, "help")) {
usage(argv[0]);
printf("Interactive-mode selected\n");
interactive = 1;
}
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)
if (!strcmp(lgopts[opt_idx].name,
"eth-peers-configfile")) {
if (init_peer_eth_addrs(optarg) != 0)
/* use master core for command line ? */
uint8_t interactive = 0;
/* use master core for command line ? */
uint8_t interactive = 0;
/*
* NUMA support configuration.
/*
* NUMA support configuration.
rte_eth_promiscuous_enable(port_id);
#ifdef RTE_LIBRTE_CMDLINE
rte_eth_promiscuous_enable(port_id);
#ifdef RTE_LIBRTE_CMDLINE
+ if (interactive == 1) {
+ if (auto_start) {
+ printf("Start automatic packet forwarding\n");
+ start_packet_forwarding(0);
+ }
/* globals used for configuration */
extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
extern uint8_t interactive;
/* 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 */
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 */