app/testpmd: add --flow-isolate-all option

Providing this parameter requests flow API isolated mode on all ports at
initialization time. It ensures all traffic is received through the
configured flow rules only (see flow command).

Ports that do not support this mode are automatically discarded.

Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This commit is contained in:
Vasily Philipov 2017-07-09 11:08:05 +03:00 committed by Thomas Monjalon
parent 722de4c3e7
commit 7ee3e94462
4 changed files with 28 additions and 0 deletions

View File

@ -215,6 +215,8 @@ usage(char* progname)
"enable print of designated event or all of them."); "enable print of designated event or all of them.");
printf(" --mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|all>: " printf(" --mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|all>: "
"disable print of designated event or all of them."); "disable print of designated event or all of them.");
printf(" --flow-isolate-all: "
"requests flow API isolated mode on all ports at initialization time.");
} }
#ifdef RTE_LIBRTE_CMDLINE #ifdef RTE_LIBRTE_CMDLINE
@ -630,6 +632,7 @@ launch_args_parse(int argc, char** argv)
{ "tx-queue-stats-mapping", 1, 0, 0 }, { "tx-queue-stats-mapping", 1, 0, 0 },
{ "rx-queue-stats-mapping", 1, 0, 0 }, { "rx-queue-stats-mapping", 1, 0, 0 },
{ "no-flush-rx", 0, 0, 0 }, { "no-flush-rx", 0, 0, 0 },
{ "flow-isolate-all", 0, 0, 0 },
{ "txpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 },
{ "disable-link-check", 0, 0, 0 }, { "disable-link-check", 0, 0, 0 },
{ "no-lsc-interrupt", 0, 0, 0 }, { "no-lsc-interrupt", 0, 0, 0 },
@ -1105,6 +1108,8 @@ launch_args_parse(int argc, char** argv)
lsc_interrupt = 0; lsc_interrupt = 0;
if (!strcmp(lgopts[opt_idx].name, "no-rmv-interrupt")) if (!strcmp(lgopts[opt_idx].name, "no-rmv-interrupt"))
rmv_interrupt = 0; rmv_interrupt = 0;
if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all"))
flow_isolate_all = 1;
if (!strcmp(lgopts[opt_idx].name, "print-event")) if (!strcmp(lgopts[opt_idx].name, "print-event"))
if (parse_event_printing_config(optarg, 1)) { if (parse_event_printing_config(optarg, 1)) {
rte_exit(EXIT_FAILURE, rte_exit(EXIT_FAILURE,

View File

@ -271,6 +271,11 @@ uint16_t port_topology = PORT_TOPOLOGY_PAIRED; /* Ports are paired by default */
*/ */
uint8_t no_flush_rx = 0; /* flush by default */ uint8_t no_flush_rx = 0; /* flush by default */
/*
* Flow API isolated mode.
*/
uint8_t flow_isolate_all;
/* /*
* Avoids to check link status when starting/stopping a port. * Avoids to check link status when starting/stopping a port.
*/ */
@ -1429,6 +1434,15 @@ start_port(portid_t pid)
if (port->need_reconfig > 0) { if (port->need_reconfig > 0) {
port->need_reconfig = 0; port->need_reconfig = 0;
if (flow_isolate_all) {
int ret = port_flow_isolate(pi, 1);
if (ret) {
printf("Failed to apply isolated"
" mode on port %d\n", pi);
return -1;
}
}
printf("Configuring Port %d (socket %u)\n", pi, printf("Configuring Port %d (socket %u)\n", pi,
port->socket_id); port->socket_id);
/* configure port */ /* configure port */

View File

@ -307,6 +307,7 @@ extern char cmdline_filename[PATH_MAX]; /**< offline commands file */
extern uint8_t numa_support; /**< set by "--numa" parameter */ extern uint8_t numa_support; /**< set by "--numa" parameter */
extern uint16_t port_topology; /**< set by "--port-topology" 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 no_flush_rx; /**<set by "--no-flush-rx" parameter */
extern uint8_t flow_isolate_all; /**< set by "--flow-isolate-all */
extern uint8_t mp_anon; /**< set by "--mp-anon" parameter */ extern uint8_t mp_anon; /**< set by "--mp-anon" parameter */
extern uint8_t no_link_check; /**<set by "--disable-link-check" parameter */ extern uint8_t no_link_check; /**<set by "--disable-link-check" parameter */
extern volatile int test_done; /* stop packet forwarding when set to 1. */ extern volatile int test_done; /* stop packet forwarding when set to 1. */

View File

@ -500,3 +500,11 @@ The commandline options are:
Disable printing the occurrence of the designated event. Using all will Disable printing the occurrence of the designated event. Using all will
disable all of them. disable all of them.
* ``--flow-isolate-all``
Providing this parameter requests flow API isolated mode on all ports at
initialization time. It ensures all traffic is received through the
configured flow rules only (see flow command).
Ports that do not support this mode are automatically discarded.