summaryrefslogtreecommitdiffstats
path: root/app/test-pmd/parameters.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/test-pmd/parameters.c')
-rw-r--r--app/test-pmd/parameters.c158
1 files changed, 136 insertions, 22 deletions
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 08e5a76f..fbe6284c 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -76,6 +76,7 @@
#ifdef RTE_LIBRTE_PMD_BOND
#include <rte_eth_bond.h>
#endif
+#include <rte_flow.h>
#include "testpmd.h"
@@ -85,6 +86,7 @@ usage(char* progname)
printf("usage: %s "
#ifdef RTE_LIBRTE_CMDLINE
"[--interactive|-i] "
+ "[--cmdline-file=FILENAME] "
#endif
"[--help|-h] | [--auto-start|-a] | ["
"--coremask=COREMASK --portmask=PORTMASK --numa "
@@ -102,6 +104,7 @@ usage(char* progname)
progname);
#ifdef RTE_LIBRTE_CMDLINE
printf(" --interactive: run in interactive mode.\n");
+ printf(" --cmdline-file: execute cli commands before startup.\n");
#endif
printf(" --auto-start: start forwarding on init "
"[always when non-interactive].\n");
@@ -148,7 +151,11 @@ usage(char* progname)
"the packet will be enqueued into the rx drop-queue. "
"If the drop-queue doesn't exist, the packet is dropped. "
"By default drop-queue=127.\n");
- printf(" --crc-strip: enable CRC stripping by hardware.\n");
+#ifdef RTE_LIBRTE_LATENCY_STATS
+ printf(" --latencystats=N: enable latency and jitter statistcs "
+ "monitoring on forwarding lcore id N.\n");
+#endif
+ printf(" --disable-crc-strip: disable CRC stripping by hardware.\n");
printf(" --enable-lro: enable large receive offload.\n");
printf(" --enable-rx-cksum: enable rx hardware checksum offload.\n");
printf(" --disable-hw-vlan: disable hardware vlan.\n");
@@ -195,6 +202,14 @@ usage(char* progname)
" or total packet length.\n");
printf(" --disable-link-check: disable check on link status when "
"starting/stopping ports.\n");
+ printf(" --no-lsc-interrupt: disable link status change interrupt.\n");
+ printf(" --no-rmv-interrupt: disable device removal interrupt.\n");
+ printf(" --bitrate-stats=N: set the logical core N to perform "
+ "bit-rate calculation.\n");
+ printf(" --print-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|all>: "
+ "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>: "
+ "disable print of designated event or all of them.");
}
#ifdef RTE_LIBRTE_CMDLINE
@@ -354,6 +369,18 @@ parse_queue_stats_mapping_config(const char *q_arg, int is_rx)
return 0;
}
+static void
+print_invalid_socket_id_error(void)
+{
+ unsigned int i = 0;
+
+ printf("Invalid socket id, options are: ");
+ for (i = 0; i < num_sockets; i++) {
+ printf("%u%s", socket_ids[i],
+ (i == num_sockets - 1) ? "\n" : ",");
+ }
+}
+
static int
parse_portnuma_config(const char *q_arg)
{
@@ -393,15 +420,14 @@ parse_portnuma_config(const char *q_arg)
port_id = (uint8_t)int_fld[FLD_PORT];
if (port_id_is_invalid(port_id, ENABLED_WARN)) {
printf("Valid port range is [0");
- FOREACH_PORT(pid, ports)
+ RTE_ETH_FOREACH_DEV(pid)
printf(", %d", pid);
printf("]\n");
return -1;
}
socket_id = (uint8_t)int_fld[FLD_SOCKET];
- if(socket_id >= max_socket) {
- printf("Invalid socket id, range is [0, %d]\n",
- max_socket - 1);
+ if (new_socket_id(socket_id)) {
+ print_invalid_socket_id_error();
return -1;
}
port_numa[port_id] = socket_id;
@@ -453,15 +479,14 @@ parse_ringnuma_config(const char *q_arg)
port_id = (uint8_t)int_fld[FLD_PORT];
if (port_id_is_invalid(port_id, ENABLED_WARN)) {
printf("Valid port range is [0");
- FOREACH_PORT(pid, ports)
+ RTE_ETH_FOREACH_DEV(pid)
printf(", %d", pid);
printf("]\n");
return -1;
}
socket_id = (uint8_t)int_fld[FLD_SOCKET];
- if (socket_id >= max_socket) {
- printf("Invalid socket id, range is [0, %d]\n",
- max_socket - 1);
+ if (new_socket_id(socket_id)) {
+ print_invalid_socket_id_error();
return -1;
}
ring_flag = (uint8_t)int_fld[FLD_FLAG];
@@ -492,6 +517,38 @@ parse_ringnuma_config(const char *q_arg)
return 0;
}
+static int
+parse_event_printing_config(const char *optarg, int enable)
+{
+ uint32_t mask = 0;
+
+ if (!strcmp(optarg, "unknown"))
+ mask = UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN;
+ else if (!strcmp(optarg, "intr_lsc"))
+ mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_LSC;
+ else if (!strcmp(optarg, "queue_state"))
+ mask = UINT32_C(1) << RTE_ETH_EVENT_QUEUE_STATE;
+ else if (!strcmp(optarg, "intr_reset"))
+ mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RESET;
+ else if (!strcmp(optarg, "vf_mbox"))
+ mask = UINT32_C(1) << RTE_ETH_EVENT_VF_MBOX;
+ else if (!strcmp(optarg, "macsec"))
+ mask = UINT32_C(1) << RTE_ETH_EVENT_MACSEC;
+ else if (!strcmp(optarg, "intr_rmv"))
+ mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV;
+ else if (!strcmp(optarg, "all"))
+ mask = ~UINT32_C(0);
+ else {
+ fprintf(stderr, "Invalid event: %s\n", optarg);
+ return -1;
+ }
+ if (enable)
+ event_print_mask |= mask;
+ else
+ event_print_mask &= ~mask;
+ return 0;
+}
+
void
launch_args_parse(int argc, char** argv)
{
@@ -504,6 +561,7 @@ launch_args_parse(int argc, char** argv)
{ "help", 0, 0, 0 },
#ifdef RTE_LIBRTE_CMDLINE
{ "interactive", 0, 0, 0 },
+ { "cmdline-file", 1, 0, 0 },
{ "auto-start", 0, 0, 0 },
{ "eth-peers-configfile", 1, 0, 0 },
{ "eth-peer", 1, 0, 0 },
@@ -514,6 +572,7 @@ launch_args_parse(int argc, char** argv)
{ "coremask", 1, 0, 0 },
{ "portmask", 1, 0, 0 },
{ "numa", 0, 0, 0 },
+ { "no-numa", 0, 0, 0 },
{ "mp-anon", 0, 0, 0 },
{ "port-numa-config", 1, 0, 0 },
{ "ring-numa-config", 1, 0, 0 },
@@ -525,7 +584,13 @@ launch_args_parse(int argc, char** argv)
{ "pkt-filter-report-hash", 1, 0, 0 },
{ "pkt-filter-size", 1, 0, 0 },
{ "pkt-filter-drop-queue", 1, 0, 0 },
- { "crc-strip", 0, 0, 0 },
+#ifdef RTE_LIBRTE_LATENCY_STATS
+ { "latencystats", 1, 0, 0 },
+#endif
+#ifdef RTE_LIBRTE_BITRATE
+ { "bitrate-stats", 1, 0, 0 },
+#endif
+ { "disable-crc-strip", 0, 0, 0 },
{ "enable-lro", 0, 0, 0 },
{ "enable-rx-cksum", 0, 0, 0 },
{ "enable-scatter", 0, 0, 0 },
@@ -560,6 +625,10 @@ launch_args_parse(int argc, char** argv)
{ "no-flush-rx", 0, 0, 0 },
{ "txpkts", 1, 0, 0 },
{ "disable-link-check", 0, 0, 0 },
+ { "no-lsc-interrupt", 0, 0, 0 },
+ { "no-rmv-interrupt", 0, 0, 0 },
+ { "print-event", 1, 0, 0 },
+ { "mask-event", 1, 0, 0 },
{ 0, 0, 0, 0 },
};
@@ -594,6 +663,13 @@ launch_args_parse(int argc, char** argv)
printf("Interactive-mode selected\n");
interactive = 1;
}
+ if (!strcmp(lgopts[opt_idx].name, "cmdline-file")) {
+ printf("CLI commands to be read from %s\n",
+ optarg);
+ snprintf(cmdline_filename,
+ sizeof(cmdline_filename), "%s",
+ optarg);
+ }
if (!strcmp(lgopts[opt_idx].name, "auto-start")) {
printf("Auto-start selected\n");
auto_start = 1;
@@ -650,12 +726,10 @@ launch_args_parse(int argc, char** argv)
parse_fwd_coremask(optarg);
if (!strcmp(lgopts[opt_idx].name, "portmask"))
parse_fwd_portmask(optarg);
- if (!strcmp(lgopts[opt_idx].name, "numa")) {
+ if (!strcmp(lgopts[opt_idx].name, "no-numa"))
+ numa_support = 0;
+ if (!strcmp(lgopts[opt_idx].name, "numa"))
numa_support = 1;
- memset(port_numa,NUMA_NO_CONFIG,RTE_MAX_ETHPORTS);
- memset(rxring_numa,NUMA_NO_CONFIG,RTE_MAX_ETHPORTS);
- memset(txring_numa,NUMA_NO_CONFIG,RTE_MAX_ETHPORTS);
- }
if (!strcmp(lgopts[opt_idx].name, "mp-anon")) {
mp_anon = 1;
}
@@ -670,12 +744,13 @@ launch_args_parse(int argc, char** argv)
"invalid ring-numa configuration\n");
if (!strcmp(lgopts[opt_idx].name, "socket-num")) {
n = atoi(optarg);
- if((uint8_t)n < max_socket)
+ if (!new_socket_id((uint8_t)n)) {
socket_num = (uint8_t)n;
- else
+ } else {
+ print_invalid_socket_id_error();
rte_exit(EXIT_FAILURE,
- "The socket number should be < %d\n",
- max_socket);
+ "Invalid socket id");
+ }
}
if (!strcmp(lgopts[opt_idx].name, "mbuf-size")) {
n = atoi(optarg);
@@ -765,8 +840,33 @@ launch_args_parse(int argc, char** argv)
"drop queue %d invalid - must"
"be >= 0 \n", n);
}
- if (!strcmp(lgopts[opt_idx].name, "crc-strip"))
- rx_mode.hw_strip_crc = 1;
+#ifdef RTE_LIBRTE_LATENCY_STATS
+ if (!strcmp(lgopts[opt_idx].name,
+ "latencystats")) {
+ n = atoi(optarg);
+ if (n >= 0) {
+ latencystats_lcore_id = (lcoreid_t) n;
+ latencystats_enabled = 1;
+ } else
+ rte_exit(EXIT_FAILURE,
+ "invalid lcore id %d for latencystats"
+ " must be >= 0\n", n);
+ }
+#endif
+#ifdef RTE_LIBRTE_BITRATE
+ if (!strcmp(lgopts[opt_idx].name, "bitrate-stats")) {
+ n = atoi(optarg);
+ if (n >= 0) {
+ bitrate_lcore_id = (lcoreid_t) n;
+ bitrate_enabled = 1;
+ } else
+ rte_exit(EXIT_FAILURE,
+ "invalid lcore id %d for bitrate stats"
+ " must be >= 0\n", n);
+ }
+#endif
+ if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip"))
+ rx_mode.hw_strip_crc = 0;
if (!strcmp(lgopts[opt_idx].name, "enable-lro"))
rx_mode.enable_lro = 1;
if (!strcmp(lgopts[opt_idx].name, "enable-scatter"))
@@ -977,6 +1077,20 @@ launch_args_parse(int argc, char** argv)
no_flush_rx = 1;
if (!strcmp(lgopts[opt_idx].name, "disable-link-check"))
no_link_check = 1;
+ if (!strcmp(lgopts[opt_idx].name, "no-lsc-interrupt"))
+ lsc_interrupt = 0;
+ if (!strcmp(lgopts[opt_idx].name, "no-rmv-interrupt"))
+ rmv_interrupt = 0;
+ if (!strcmp(lgopts[opt_idx].name, "print-event"))
+ if (parse_event_printing_config(optarg, 1)) {
+ rte_exit(EXIT_FAILURE,
+ "invalid print-event argument\n");
+ }
+ if (!strcmp(lgopts[opt_idx].name, "mask-event"))
+ if (parse_event_printing_config(optarg, 0)) {
+ rte_exit(EXIT_FAILURE,
+ "invalid mask-event argument\n");
+ }
break;
case 'h':