From 7ee3e9446290ba3f618d8cb93374e76994057057 Mon Sep 17 00:00:00 2001 From: Vasily Philipov Date: Sun, 9 Jul 2017 11:08:05 +0300 Subject: [PATCH] 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 Acked-by: Adrien Mazarguil --- app/test-pmd/parameters.c | 5 +++++ app/test-pmd/testpmd.c | 14 ++++++++++++++ app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/run_app.rst | 8 ++++++++ 4 files changed, 28 insertions(+) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 958b3d0485..c20ce65737 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -215,6 +215,8 @@ usage(char* progname) "enable print of designated event or all of them."); printf(" --mask-event : " "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 @@ -630,6 +632,7 @@ launch_args_parse(int argc, char** argv) { "tx-queue-stats-mapping", 1, 0, 0 }, { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, + { "flow-isolate-all", 0, 0, 0 }, { "txpkts", 1, 0, 0 }, { "disable-link-check", 0, 0, 0 }, { "no-lsc-interrupt", 0, 0, 0 }, @@ -1105,6 +1108,8 @@ launch_args_parse(int argc, char** argv) lsc_interrupt = 0; if (!strcmp(lgopts[opt_idx].name, "no-rmv-interrupt")) 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 (parse_event_printing_config(optarg, 1)) { rte_exit(EXIT_FAILURE, diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index e09b803832..e754d12aae 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -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 */ +/* + * Flow API isolated mode. + */ +uint8_t flow_isolate_all; + /* * Avoids to check link status when starting/stopping a port. */ @@ -1429,6 +1434,15 @@ start_port(portid_t pid) if (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, port->socket_id); /* configure port */ diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 73985c3e3e..c9d7739b81 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -307,6 +307,7 @@ extern char cmdline_filename[PATH_MAX]; /**< offline commands file */ 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; /**