aboutsummaryrefslogtreecommitdiffstats
path: root/app/test-pmd
diff options
context:
space:
mode:
Diffstat (limited to 'app/test-pmd')
-rw-r--r--app/test-pmd/Makefile41
-rw-r--r--app/test-pmd/cmdline.c1077
-rw-r--r--app/test-pmd/cmdline_flow.c65
-rw-r--r--app/test-pmd/cmdline_mtr.c691
-rw-r--r--app/test-pmd/cmdline_mtr.h39
-rw-r--r--app/test-pmd/cmdline_tm.c33
-rw-r--r--app/test-pmd/cmdline_tm.h33
-rw-r--r--app/test-pmd/config.c344
-rw-r--r--app/test-pmd/csumonly.c84
-rw-r--r--app/test-pmd/flowgen.c12
-rw-r--r--app/test-pmd/icmpecho.c34
-rw-r--r--app/test-pmd/ieee1588fwd.c33
-rw-r--r--app/test-pmd/iofwd.c33
-rw-r--r--app/test-pmd/macfwd.c41
-rw-r--r--app/test-pmd/macswap.c8
-rw-r--r--app/test-pmd/meson.build53
-rw-r--r--app/test-pmd/parameters.c131
-rw-r--r--app/test-pmd/rxonly.c33
-rw-r--r--app/test-pmd/testpmd.c259
-rw-r--r--app/test-pmd/testpmd.h83
-rw-r--r--app/test-pmd/tm.c37
-rw-r--r--app/test-pmd/txonly.c42
22 files changed, 1996 insertions, 1210 deletions
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index d21308fc..ed588ab6 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -1,33 +1,5 @@
-# BSD LICENSE
-#
-# Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2010-2015 Intel Corporation
include $(RTE_SDK)/mk/rte.vars.mk
@@ -38,6 +10,7 @@ ifeq ($(CONFIG_RTE_TEST_PMD),y)
#
APP = testpmd
+CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
@@ -71,6 +44,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
LDLIBS += -lrte_pmd_bond
endif
+ifeq ($(CONFIG_RTE_LIBRTE_DPAA_PMD),y)
+LDLIBS += -lrte_pmd_dpaa
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
LDLIBS += -lrte_pmd_ixgbe
endif
@@ -83,10 +60,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD),y)
LDLIBS += -lrte_pmd_bnxt
endif
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y)
-LDLIBS += -lrte_pmd_xenvirt
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_PMD_SOFTNIC),y)
LDLIBS += -lrte_pmd_softnic
endif
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f71d9630..d1dc1de6 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1,35 +1,6 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
- * Copyright(c) 2014 6WIND S.A.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2016 Intel Corporation.
+ * Copyright(c) 2014 6WIND S.A.
*/
#include <stdarg.h>
@@ -89,6 +60,9 @@
#include <rte_eth_bond.h>
#include <rte_eth_bond_8023ad.h>
#endif
+#ifdef RTE_LIBRTE_DPAA_PMD
+#include <rte_pmd_dpaa.h>
+#endif
#ifdef RTE_LIBRTE_IXGBE_PMD
#include <rte_pmd_ixgbe.h>
#endif
@@ -271,6 +245,9 @@ static void cmd_help_long_parsed(void *parsed_result,
"set verbose (level)\n"
" Set the debug verbosity level X.\n\n"
+ "set log global|(type) (level)\n"
+ " Set the log level.\n\n"
+
"set nbport (num)\n"
" Set number of ports.\n\n"
@@ -486,6 +463,9 @@ static void cmd_help_long_parsed(void *parsed_result,
"set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)\n"
" Set the MAC address for a VF from the PF.\n\n"
+ "set eth-peer (port_id) (peer_addr)\n"
+ " set the peer address for certain port.\n\n"
+
"set port (port_id) uta (mac_address|all) (on|off)\n"
" Add/Remove a or all unicast hash filter(s)"
"from port X.\n\n"
@@ -665,10 +645,10 @@ static void cmd_help_long_parsed(void *parsed_result,
" Set default traffic Management hierarchy on a port\n\n"
#endif
- "ddp add (port_id) (profile_path[,output_path])\n"
+ "ddp add (port_id) (profile_path[,backup_profile_path])\n"
" Load a profile package on a port\n\n"
- "ddp del (port_id) (profile_path)\n"
+ "ddp del (port_id) (backup_profile_path)\n"
" Delete a profile package from a port\n\n"
"ptype mapping get (port_id) (valid_only)\n"
@@ -698,7 +678,10 @@ static void cmd_help_long_parsed(void *parsed_result,
"set port (port_id) queue-region flush (on|off)\n"
" flush all queue region related configuration\n\n"
- "add port meter profile srtcm_rfc2697 (port_id) (profile_id) (cir) (cbs) (ebs) (color_aware)\n"
+ "show port meter cap (port_id)\n"
+ " Show port meter capability information\n\n"
+
+ "add port meter profile srtcm_rfc2697 (port_id) (profile_id) (cir) (cbs) (ebs)\n"
" meter profile add - srtcm rfc 2697\n\n"
"add port meter profile trtcm_rfc2698 (port_id) (profile_id) (cir) (pir) (cbs) (pbs)\n"
@@ -710,16 +693,30 @@ static void cmd_help_long_parsed(void *parsed_result,
"del port meter profile (port_id) (profile_id)\n"
" meter profile delete\n\n"
- "set port meter (port_id) (mtr_id) (profile_id) (g_action) (y_action) (r_action) (stats_mask) (shared)\n"
+ "create port meter (port_id) (mtr_id) (profile_id) (meter_enable)\n"
+ "(g_action) (y_action) (r_action) (stats_mask) (shared)\n"
+ "(use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\n"
+ "(dscp_tbl_entry63)]\n"
" meter create\n\n"
+ "enable port meter (port_id) (mtr_id)\n"
+ " meter enable\n\n"
+
+ "disable port meter (port_id) (mtr_id)\n"
+ " meter disable\n\n"
+
"del port meter (port_id) (mtr_id)\n"
" meter delete\n\n"
"set port meter profile (port_id) (mtr_id) (profile_id)\n"
" meter update meter profile\n\n"
- "set port meter policer action (port_id) (mtr_id) (color) (action)\n"
+ "set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0)\n"
+ "(dscp_tbl_entry1)...(dscp_tbl_entry63)]\n"
+ " update meter dscp table entries\n\n"
+
+ "set port meter policer action (port_id) (mtr_id) (action_mask)\n"
+ "(action0) [(action1) (action2)]\n"
" meter update policer action\n\n"
"set port meter stats mask (port_id) (mtr_id) (stats_mask)\n"
@@ -864,6 +861,15 @@ static void cmd_help_long_parsed(void *parsed_result,
"port config (port_id) pctype mapping update"
" (pctype_id_0[,pctype_id_1]*) (flow_type_id)\n"
" Update a flow type to pctype mapping item on a port\n\n"
+
+ "port config (port_id) pctype (pctype_id) hash_inset|"
+ "fdir_inset|fdir_flx_inset get|set|clear field\n"
+ " (field_idx)\n"
+ " Configure RSS|FDIR|FDIR_FLX input set for some pctype\n\n"
+
+ "port config (port_id) pctype (pctype_id) hash_inset|"
+ "fdir_inset|fdir_flx_inset clear all"
+ " Clear RSS|FDIR|FDIR_FLX input set completely for some pctype\n\n"
);
}
@@ -979,6 +985,11 @@ static void cmd_help_long_parsed(void *parsed_result,
" queue (queue_id) fd_id (fd_id_value)\n"
" Add/Del a Tunnel flow director filter.\n\n"
+ "flow_director_filter (port_id) mode raw (add|del|update)"
+ " flow (flow_id) (drop|fwd) queue (queue_id)"
+ " fd_id (fd_id_value) packet (packet file name)\n"
+ " Add/Del a raw type flow director filter.\n\n"
+
"flush_flow_director (port_id)\n"
" Flush all flow director entries of a device.\n\n"
@@ -1501,6 +1512,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
printf("Warning: Either rx or tx queues should be non zero\n");
return;
}
+ if (check_nb_rxq(res->value) != 0)
+ return;
nb_rxq = res->value;
}
else if (!strcmp(res->name, "txq")) {
@@ -1508,6 +1521,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
printf("Warning: Either rx or tx queues should be non zero\n");
return;
}
+ if (check_nb_txq(res->value) != 0)
+ return;
nb_txq = res->value;
}
else if (!strcmp(res->name, "rxd")) {
@@ -1577,29 +1592,36 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
__attribute__((unused)) void *data)
{
struct cmd_config_max_pkt_len_result *res = parsed_result;
+ portid_t pid;
if (!all_ports_stopped()) {
printf("Please stop all ports first\n");
return;
}
- if (!strcmp(res->name, "max-pkt-len")) {
- if (res->value < ETHER_MIN_LEN) {
- printf("max-pkt-len can not be less than %d\n",
- ETHER_MIN_LEN);
+ RTE_ETH_FOREACH_DEV(pid) {
+ struct rte_port *port = &ports[pid];
+ uint64_t rx_offloads = port->dev_conf.rxmode.offloads;
+
+ if (!strcmp(res->name, "max-pkt-len")) {
+ if (res->value < ETHER_MIN_LEN) {
+ printf("max-pkt-len can not be less than %d\n",
+ ETHER_MIN_LEN);
+ return;
+ }
+ if (res->value == port->dev_conf.rxmode.max_rx_pkt_len)
+ return;
+
+ port->dev_conf.rxmode.max_rx_pkt_len = res->value;
+ if (res->value > ETHER_MAX_LEN)
+ rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+ else
+ rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
+ port->dev_conf.rxmode.offloads = rx_offloads;
+ } else {
+ printf("Unknown parameter\n");
return;
}
- if (res->value == rx_mode.max_rx_pkt_len)
- return;
-
- rx_mode.max_rx_pkt_len = res->value;
- if (res->value > ETHER_MAX_LEN)
- rx_mode.jumbo_frame = 1;
- else
- rx_mode.jumbo_frame = 0;
- } else {
- printf("Unknown parameter\n");
- return;
}
init_port_config();
@@ -1703,100 +1725,107 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result,
__attribute__((unused)) void *data)
{
struct cmd_config_rx_mode_flag *res = parsed_result;
+ portid_t pid;
if (!all_ports_stopped()) {
printf("Please stop all ports first\n");
return;
}
- if (!strcmp(res->name, "crc-strip")) {
- if (!strcmp(res->value, "on"))
- rx_mode.hw_strip_crc = 1;
- else if (!strcmp(res->value, "off"))
- rx_mode.hw_strip_crc = 0;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "scatter")) {
- if (!strcmp(res->value, "on"))
- rx_mode.enable_scatter = 1;
- else if (!strcmp(res->value, "off"))
- rx_mode.enable_scatter = 0;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "rx-cksum")) {
- if (!strcmp(res->value, "on"))
- rx_mode.hw_ip_checksum = 1;
- else if (!strcmp(res->value, "off"))
- rx_mode.hw_ip_checksum = 0;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "rx-timestamp")) {
- if (!strcmp(res->value, "on"))
- rx_mode.hw_timestamp = 1;
- else if (!strcmp(res->value, "off"))
- rx_mode.hw_timestamp = 0;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "hw-vlan")) {
- if (!strcmp(res->value, "on")) {
- rx_mode.hw_vlan_filter = 1;
- rx_mode.hw_vlan_strip = 1;
- }
- else if (!strcmp(res->value, "off")) {
- rx_mode.hw_vlan_filter = 0;
- rx_mode.hw_vlan_strip = 0;
- }
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "hw-vlan-filter")) {
- if (!strcmp(res->value, "on"))
- rx_mode.hw_vlan_filter = 1;
- else if (!strcmp(res->value, "off"))
- rx_mode.hw_vlan_filter = 0;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "hw-vlan-strip")) {
- if (!strcmp(res->value, "on"))
- rx_mode.hw_vlan_strip = 1;
- else if (!strcmp(res->value, "off"))
- rx_mode.hw_vlan_strip = 0;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "hw-vlan-extend")) {
- if (!strcmp(res->value, "on"))
- rx_mode.hw_vlan_extend = 1;
- else if (!strcmp(res->value, "off"))
- rx_mode.hw_vlan_extend = 0;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "drop-en")) {
- if (!strcmp(res->value, "on"))
- rx_drop_en = 1;
- else if (!strcmp(res->value, "off"))
- rx_drop_en = 0;
- else {
+ RTE_ETH_FOREACH_DEV(pid) {
+ struct rte_port *port;
+ uint64_t rx_offloads;
+
+ port = &ports[pid];
+ rx_offloads = port->dev_conf.rxmode.offloads;
+ if (!strcmp(res->name, "crc-strip")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "scatter")) {
+ if (!strcmp(res->value, "on")) {
+ rx_offloads |= DEV_RX_OFFLOAD_SCATTER;
+ } else if (!strcmp(res->value, "off")) {
+ rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER;
+ } else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "rx-cksum")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "rx-timestamp")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "hw-vlan")) {
+ if (!strcmp(res->value, "on")) {
+ rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER |
+ DEV_RX_OFFLOAD_VLAN_STRIP);
+ } else if (!strcmp(res->value, "off")) {
+ rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER |
+ DEV_RX_OFFLOAD_VLAN_STRIP);
+ } else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "hw-vlan-filter")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "hw-vlan-strip")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "hw-vlan-extend")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "drop-en")) {
+ if (!strcmp(res->value, "on"))
+ rx_drop_en = 1;
+ else if (!strcmp(res->value, "off"))
+ rx_drop_en = 0;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else {
printf("Unknown parameter\n");
return;
}
- } else {
- printf("Unknown parameter\n");
- return;
+ port->dev_conf.rxmode.offloads = rx_offloads;
}
init_port_config();
@@ -3000,6 +3029,55 @@ cmdline_parse_inst_t cmd_set_numbers = {
},
};
+/* *** SET LOG LEVEL CONFIGURATION *** */
+
+struct cmd_set_log_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t log;
+ cmdline_fixed_string_t type;
+ uint32_t level;
+};
+
+static void
+cmd_set_log_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_set_log_result *res;
+ int ret;
+
+ res = parsed_result;
+ if (!strcmp(res->type, "global"))
+ rte_log_set_global_level(res->level);
+ else {
+ ret = rte_log_set_level_regexp(res->type, res->level);
+ if (ret < 0)
+ printf("Unable to set log level\n");
+ }
+}
+
+cmdline_parse_token_string_t cmd_set_log_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_log_result, set, "set");
+cmdline_parse_token_string_t cmd_set_log_log =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_log_result, log, "log");
+cmdline_parse_token_string_t cmd_set_log_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_log_result, type, NULL);
+cmdline_parse_token_num_t cmd_set_log_level =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_log_result, level, UINT32);
+
+cmdline_parse_inst_t cmd_set_log = {
+ .f = cmd_set_log_parsed,
+ .data = NULL,
+ .help_str = "set log global|<type> <level>",
+ .tokens = {
+ (void *)&cmd_set_log_set,
+ (void *)&cmd_set_log_log,
+ (void *)&cmd_set_log_type,
+ (void *)&cmd_set_log_level,
+ NULL,
+ },
+};
+
/* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */
struct cmd_set_txpkts_result {
@@ -3087,74 +3165,6 @@ cmdline_parse_inst_t cmd_set_txsplit = {
},
};
-/* *** CONFIG TX QUEUE FLAGS *** */
-
-struct cmd_config_txqflags_result {
- cmdline_fixed_string_t port;
- cmdline_fixed_string_t config;
- cmdline_fixed_string_t all;
- cmdline_fixed_string_t what;
- int32_t hexvalue;
-};
-
-static void cmd_config_txqflags_parsed(void *parsed_result,
- __attribute__((unused)) struct cmdline *cl,
- __attribute__((unused)) void *data)
-{
- struct cmd_config_txqflags_result *res = parsed_result;
-
- if (!all_ports_stopped()) {
- printf("Please stop all ports first\n");
- return;
- }
-
- if (strcmp(res->what, "txqflags")) {
- printf("Unknown parameter\n");
- return;
- }
-
- if (res->hexvalue >= 0) {
- txq_flags = res->hexvalue;
- } else {
- printf("txqflags must be >= 0\n");
- return;
- }
-
- init_port_config();
-
- cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);
-}
-
-cmdline_parse_token_string_t cmd_config_txqflags_port =
- TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, port,
- "port");
-cmdline_parse_token_string_t cmd_config_txqflags_config =
- TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, config,
- "config");
-cmdline_parse_token_string_t cmd_config_txqflags_all =
- TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, all,
- "all");
-cmdline_parse_token_string_t cmd_config_txqflags_what =
- TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, what,
- "txqflags");
-cmdline_parse_token_num_t cmd_config_txqflags_value =
- TOKEN_NUM_INITIALIZER(struct cmd_config_txqflags_result,
- hexvalue, INT32);
-
-cmdline_parse_inst_t cmd_config_txqflags = {
- .f = cmd_config_txqflags_parsed,
- .data = NULL,
- .help_str = "port config all txqflags <value>",
- .tokens = {
- (void *)&cmd_config_txqflags_port,
- (void *)&cmd_config_txqflags_config,
- (void *)&cmd_config_txqflags_all,
- (void *)&cmd_config_txqflags_what,
- (void *)&cmd_config_txqflags_value,
- NULL,
- },
-};
-
/* *** ADD/REMOVE ALL VLAN IDENTIFIERS TO/FROM A PORT VLAN RX FILTER *** */
struct cmd_rx_vlan_filter_all_result {
cmdline_fixed_string_t rx_vlan;
@@ -3352,7 +3362,7 @@ cmdline_parse_token_num_t cmd_vlan_tpid_tpid =
tp_id, UINT16);
cmdline_parse_token_num_t cmd_vlan_tpid_portid =
TOKEN_NUM_INITIALIZER(struct cmd_vlan_tpid_result,
- port_id, UINT8);
+ port_id, UINT16);
cmdline_parse_inst_t cmd_vlan_tpid = {
.f = cmd_vlan_tpid_parsed,
@@ -3434,7 +3444,14 @@ cmd_tx_vlan_set_parsed(void *parsed_result,
{
struct cmd_tx_vlan_set_result *res = parsed_result;
+ if (!port_is_stopped(res->port_id)) {
+ printf("Please stop port %d first\n", res->port_id);
+ return;
+ }
+
tx_vlan_set(res->port_id, res->vlan_id);
+
+ cmd_reconfig_device_queue(res->port_id, 1, 1);
}
cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan =
@@ -3481,7 +3498,14 @@ cmd_tx_vlan_set_qinq_parsed(void *parsed_result,
{
struct cmd_tx_vlan_set_qinq_result *res = parsed_result;
+ if (!port_is_stopped(res->port_id)) {
+ printf("Please stop port %d first\n", res->port_id);
+ return;
+ }
+
tx_qinq_set(res->port_id, res->vlan_id, res->vlan_id_outer);
+
+ cmd_reconfig_device_queue(res->port_id, 1, 1);
}
cmdline_parse_token_string_t cmd_tx_vlan_set_qinq_tx_vlan =
@@ -3587,7 +3611,14 @@ cmd_tx_vlan_reset_parsed(void *parsed_result,
{
struct cmd_tx_vlan_reset_result *res = parsed_result;
+ if (!port_is_stopped(res->port_id)) {
+ printf("Please stop port %d first\n", res->port_id);
+ return;
+ }
+
tx_vlan_reset(res->port_id);
+
+ cmd_reconfig_device_queue(res->port_id, 1, 1);
}
cmdline_parse_token_string_t cmd_tx_vlan_reset_tx_vlan =
@@ -3627,45 +3658,45 @@ static void
csum_show(int port_id)
{
struct rte_eth_dev_info dev_info;
- uint16_t ol_flags;
+ uint64_t tx_offloads;
- ol_flags = ports[port_id].tx_ol_flags;
+ tx_offloads = ports[port_id].dev_conf.txmode.offloads;
printf("Parse tunnel is %s\n",
- (ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) ? "on" : "off");
+ (ports[port_id].parse_tunnel) ? "on" : "off");
printf("IP checksum offload is %s\n",
- (ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) ? "hw" : "sw");
+ (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ? "hw" : "sw");
printf("UDP checksum offload is %s\n",
- (ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw");
+ (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw");
printf("TCP checksum offload is %s\n",
- (ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw");
+ (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw");
printf("SCTP checksum offload is %s\n",
- (ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw");
+ (tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw");
printf("Outer-Ip checksum offload is %s\n",
- (ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ? "hw" : "sw");
+ (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ? "hw" : "sw");
/* display warnings if configuration is not supported by the NIC */
rte_eth_dev_info_get(port_id, &dev_info);
- if ((ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) &&
+ if ((tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) &&
(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) {
printf("Warning: hardware IP checksum enabled but not "
"supported by port %d\n", port_id);
}
- if ((ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) &&
+ if ((tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) &&
(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) == 0) {
printf("Warning: hardware UDP checksum enabled but not "
"supported by port %d\n", port_id);
}
- if ((ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) &&
+ if ((tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) &&
(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) {
printf("Warning: hardware TCP checksum enabled but not "
"supported by port %d\n", port_id);
}
- if ((ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) &&
+ if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) == 0) {
printf("Warning: hardware SCTP checksum enabled but not "
"supported by port %d\n", port_id);
}
- if ((ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) &&
+ if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) &&
(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) == 0) {
printf("Warning: hardware outer IP checksum enabled but not "
"supported by port %d\n", port_id);
@@ -3679,36 +3710,78 @@ cmd_csum_parsed(void *parsed_result,
{
struct cmd_csum_result *res = parsed_result;
int hw = 0;
- uint16_t mask = 0;
+ uint64_t csum_offloads = 0;
+ struct rte_eth_dev_info dev_info;
if (port_id_is_invalid(res->port_id, ENABLED_WARN)) {
printf("invalid port %d\n", res->port_id);
return;
}
+ if (!port_is_stopped(res->port_id)) {
+ printf("Please stop port %d first\n", res->port_id);
+ return;
+ }
+ rte_eth_dev_info_get(res->port_id, &dev_info);
if (!strcmp(res->mode, "set")) {
if (!strcmp(res->hwsw, "hw"))
hw = 1;
if (!strcmp(res->proto, "ip")) {
- mask = TESTPMD_TX_OFFLOAD_IP_CKSUM;
+ if (hw == 0 || (dev_info.tx_offload_capa &
+ DEV_TX_OFFLOAD_IPV4_CKSUM)) {
+ csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM;
+ } else {
+ printf("IP checksum offload is not supported "
+ "by port %u\n", res->port_id);
+ }
} else if (!strcmp(res->proto, "udp")) {
- mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM;
+ if (hw == 0 || (dev_info.tx_offload_capa &
+ DEV_TX_OFFLOAD_UDP_CKSUM)) {
+ csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
+ } else {
+ printf("UDP checksum offload is not supported "
+ "by port %u\n", res->port_id);
+ }
} else if (!strcmp(res->proto, "tcp")) {
- mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM;
+ if (hw == 0 || (dev_info.tx_offload_capa &
+ DEV_TX_OFFLOAD_TCP_CKSUM)) {
+ csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
+ } else {
+ printf("TCP checksum offload is not supported "
+ "by port %u\n", res->port_id);
+ }
} else if (!strcmp(res->proto, "sctp")) {
- mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM;
+ if (hw == 0 || (dev_info.tx_offload_capa &
+ DEV_TX_OFFLOAD_SCTP_CKSUM)) {
+ csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM;
+ } else {
+ printf("SCTP checksum offload is not supported "
+ "by port %u\n", res->port_id);
+ }
} else if (!strcmp(res->proto, "outer-ip")) {
- mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM;
+ if (hw == 0 || (dev_info.tx_offload_capa &
+ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)) {
+ csum_offloads |=
+ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM;
+ } else {
+ printf("Outer IP checksum offload is not "
+ "supported by port %u\n", res->port_id);
+ }
}
- if (hw)
- ports[res->port_id].tx_ol_flags |= mask;
- else
- ports[res->port_id].tx_ol_flags &= (~mask);
+ if (hw) {
+ ports[res->port_id].dev_conf.txmode.offloads |=
+ csum_offloads;
+ } else {
+ ports[res->port_id].dev_conf.txmode.offloads &=
+ (~csum_offloads);
+ }
}
csum_show(res->port_id);
+
+ cmd_reconfig_device_queue(res->port_id, 1, 1);
}
cmdline_parse_token_string_t cmd_csum_csum =
@@ -3778,11 +3851,9 @@ cmd_csum_tunnel_parsed(void *parsed_result,
return;
if (!strcmp(res->onoff, "on"))
- ports[res->port_id].tx_ol_flags |=
- TESTPMD_TX_OFFLOAD_PARSE_TUNNEL;
+ ports[res->port_id].parse_tunnel = 1;
else
- ports[res->port_id].tx_ol_flags &=
- (~TESTPMD_TX_OFFLOAD_PARSE_TUNNEL);
+ ports[res->port_id].parse_tunnel = 0;
csum_show(res->port_id);
}
@@ -3832,15 +3903,32 @@ cmd_tso_set_parsed(void *parsed_result,
if (port_id_is_invalid(res->port_id, ENABLED_WARN))
return;
+ if (!port_is_stopped(res->port_id)) {
+ printf("Please stop port %d first\n", res->port_id);
+ return;
+ }
if (!strcmp(res->mode, "set"))
ports[res->port_id].tso_segsz = res->tso_segsz;
- if (ports[res->port_id].tso_segsz == 0)
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+ if ((ports[res->port_id].tso_segsz != 0) &&
+ (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0) {
+ printf("Error: TSO is not supported by port %d\n",
+ res->port_id);
+ return;
+ }
+
+ if (ports[res->port_id].tso_segsz == 0) {
+ ports[res->port_id].dev_conf.txmode.offloads &=
+ ~DEV_TX_OFFLOAD_TCP_TSO;
printf("TSO for non-tunneled packets is disabled\n");
- else
+ } else {
+ ports[res->port_id].dev_conf.txmode.offloads |=
+ DEV_TX_OFFLOAD_TCP_TSO;
printf("TSO segment size for non-tunneled packets is %d\n",
ports[res->port_id].tso_segsz);
+ }
/* display warnings if configuration is not supported by the NIC */
rte_eth_dev_info_get(res->port_id, &dev_info);
@@ -3849,6 +3937,8 @@ cmd_tso_set_parsed(void *parsed_result,
printf("Warning: TSO enabled but not "
"supported by port %d\n", res->port_id);
}
+
+ cmd_reconfig_device_queue(res->port_id, 1, 1);
}
cmdline_parse_token_string_t cmd_tso_set_tso =
@@ -3905,24 +3995,25 @@ struct cmd_tunnel_tso_set_result {
portid_t port_id;
};
-static void
+static struct rte_eth_dev_info
check_tunnel_tso_nic_support(portid_t port_id)
{
struct rte_eth_dev_info dev_info;
rte_eth_dev_info_get(port_id, &dev_info);
if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO))
- printf("Warning: TSO enabled but VXLAN TUNNEL TSO not "
- "supported by port %d\n", port_id);
+ printf("Warning: VXLAN TUNNEL TSO not supported therefore "
+ "not enabled for port %d\n", port_id);
if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO))
- printf("Warning: TSO enabled but GRE TUNNEL TSO not "
- "supported by port %d\n", port_id);
+ printf("Warning: GRE TUNNEL TSO not supported therefore "
+ "not enabled for port %d\n", port_id);
if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO))
- printf("Warning: TSO enabled but IPIP TUNNEL TSO not "
- "supported by port %d\n", port_id);
+ printf("Warning: IPIP TUNNEL TSO not supported therefore "
+ "not enabled for port %d\n", port_id);
if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO))
- printf("Warning: TSO enabled but GENEVE TUNNEL TSO not "
- "supported by port %d\n", port_id);
+ printf("Warning: GENEVE TUNNEL TSO not supported therefore "
+ "not enabled for port %d\n", port_id);
+ return dev_info;
}
static void
@@ -3931,16 +4022,34 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,
__attribute__((unused)) void *data)
{
struct cmd_tunnel_tso_set_result *res = parsed_result;
+ struct rte_eth_dev_info dev_info;
if (port_id_is_invalid(res->port_id, ENABLED_WARN))
return;
+ if (!port_is_stopped(res->port_id)) {
+ printf("Please stop port %d first\n", res->port_id);
+ return;
+ }
if (!strcmp(res->mode, "set"))
ports[res->port_id].tunnel_tso_segsz = res->tso_segsz;
- if (ports[res->port_id].tunnel_tso_segsz == 0)
+ dev_info = check_tunnel_tso_nic_support(res->port_id);
+ if (ports[res->port_id].tunnel_tso_segsz == 0) {
+ ports[res->port_id].dev_conf.txmode.offloads &=
+ ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+ DEV_TX_OFFLOAD_GRE_TNL_TSO |
+ DEV_TX_OFFLOAD_IPIP_TNL_TSO |
+ DEV_TX_OFFLOAD_GENEVE_TNL_TSO);
printf("TSO for tunneled packets is disabled\n");
- else {
+ } else {
+ uint64_t tso_offloads = (DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+ DEV_TX_OFFLOAD_GRE_TNL_TSO |
+ DEV_TX_OFFLOAD_IPIP_TNL_TSO |
+ DEV_TX_OFFLOAD_GENEVE_TNL_TSO);
+
+ ports[res->port_id].dev_conf.txmode.offloads |=
+ (tso_offloads & dev_info.tx_offload_capa);
printf("TSO segment size for tunneled packets is %d\n",
ports[res->port_id].tunnel_tso_segsz);
@@ -3955,17 +4064,17 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,
* is not necessary for IPv6 tunneled pkts because there's no
* checksum in IP header anymore.
*/
- check_tunnel_tso_nic_support(res->port_id);
- if (!(ports[res->port_id].tx_ol_flags &
- TESTPMD_TX_OFFLOAD_PARSE_TUNNEL))
+ if (!ports[res->port_id].parse_tunnel)
printf("Warning: csum parse_tunnel must be set "
"so that tunneled packets are recognized\n");
- if (!(ports[res->port_id].tx_ol_flags &
- TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM))
+ if (!(ports[res->port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM))
printf("Warning: csum set outer-ip must be set to hw "
"if outer L3 is IPv4; not necessary for IPv6\n");
}
+
+ cmd_reconfig_device_queue(res->port_id, 1, 1);
}
cmdline_parse_token_string_t cmd_tunnel_tso_set_tso =
@@ -5751,7 +5860,7 @@ cmdline_parse_token_string_t cmd_setpromisc_portall =
"all");
cmdline_parse_token_num_t cmd_setpromisc_portnum =
TOKEN_NUM_INITIALIZER(struct cmd_set_promisc_mode_result, port_num,
- UINT8);
+ UINT16);
cmdline_parse_token_string_t cmd_setpromisc_mode =
TOKEN_STRING_INITIALIZER(struct cmd_set_promisc_mode_result, mode,
"on#off");
@@ -7120,6 +7229,50 @@ cmdline_parse_inst_t cmd_mac_addr = {
},
};
+/* *** SET THE PEER ADDRESS FOR CERTAIN PORT *** */
+struct cmd_eth_peer_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t eth_peer;
+ portid_t port_id;
+ cmdline_fixed_string_t peer_addr;
+};
+
+static void cmd_set_eth_peer_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_eth_peer_result *res = parsed_result;
+
+ if (test_done == 0) {
+ printf("Please stop forwarding first\n");
+ return;
+ }
+ if (!strcmp(res->eth_peer, "eth-peer")) {
+ set_fwd_eth_peer(res->port_id, res->peer_addr);
+ fwd_config_setup();
+ }
+}
+cmdline_parse_token_string_t cmd_eth_peer_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, set, "set");
+cmdline_parse_token_string_t cmd_eth_peer =
+ TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, eth_peer, "eth-peer");
+cmdline_parse_token_num_t cmd_eth_peer_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_eth_peer_result, port_id, UINT16);
+cmdline_parse_token_string_t cmd_eth_peer_addr =
+ TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, peer_addr, NULL);
+
+cmdline_parse_inst_t cmd_set_fwd_eth_peer = {
+ .f = cmd_set_eth_peer_parsed,
+ .data = NULL,
+ .help_str = "set eth-peer <port_id> <peer_mac>",
+ .tokens = {
+ (void *)&cmd_eth_peer_set,
+ (void *)&cmd_eth_peer,
+ (void *)&cmd_eth_peer_port_id,
+ (void *)&cmd_eth_peer_addr,
+ NULL,
+ },
+};
/* *** CONFIGURE QUEUE STATS COUNTER MAPPINGS *** */
struct cmd_set_qmap_result {
@@ -9747,11 +9900,11 @@ struct cmd_flow_director_result {
uint16_t port_dst;
cmdline_fixed_string_t verify_tag;
uint32_t verify_tag_value;
- cmdline_ipaddr_t tos;
+ cmdline_fixed_string_t tos;
uint8_t tos_value;
- cmdline_ipaddr_t proto;
+ cmdline_fixed_string_t proto;
uint8_t proto_value;
- cmdline_ipaddr_t ttl;
+ cmdline_fixed_string_t ttl;
uint8_t ttl_value;
cmdline_fixed_string_t vlan;
uint16_t vlan_value;
@@ -9769,6 +9922,8 @@ struct cmd_flow_director_result {
cmdline_fixed_string_t tunnel_type;
cmdline_fixed_string_t tunnel_id;
uint32_t tunnel_id_value;
+ cmdline_fixed_string_t packet;
+ char filepath[];
};
static inline int
@@ -9918,8 +10073,62 @@ cmd_flow_director_filter_parsed(void *parsed_result,
return;
}
} else {
- if (strcmp(res->mode_value, "IP")) {
- printf("Please set mode to IP.\n");
+ if (!strcmp(res->mode_value, "raw")) {
+#ifdef RTE_LIBRTE_I40E_PMD
+ struct rte_pmd_i40e_flow_type_mapping
+ mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
+ struct rte_pmd_i40e_pkt_template_conf conf;
+ uint16_t flow_type = str2flowtype(res->flow_type);
+ uint16_t i, port = res->port_id;
+ uint8_t add;
+
+ memset(&conf, 0, sizeof(conf));
+
+ if (flow_type == RTE_ETH_FLOW_UNKNOWN) {
+ printf("Invalid flow type specified.\n");
+ return;
+ }
+ ret = rte_pmd_i40e_flow_type_mapping_get(res->port_id,
+ mapping);
+ if (ret)
+ return;
+ if (mapping[flow_type].pctype == 0ULL) {
+ printf("Invalid flow type specified.\n");
+ return;
+ }
+ for (i = 0; i < RTE_PMD_I40E_PCTYPE_MAX; i++) {
+ if (mapping[flow_type].pctype & (1ULL << i)) {
+ conf.input.pctype = i;
+ break;
+ }
+ }
+
+ conf.input.packet = open_file(res->filepath,
+ &conf.input.length);
+ if (!conf.input.packet)
+ return;
+ if (!strcmp(res->drop, "drop"))
+ conf.action.behavior =
+ RTE_PMD_I40E_PKT_TEMPLATE_REJECT;
+ else
+ conf.action.behavior =
+ RTE_PMD_I40E_PKT_TEMPLATE_ACCEPT;
+ conf.action.report_status =
+ RTE_PMD_I40E_PKT_TEMPLATE_REPORT_ID;
+ conf.action.rx_queue = res->queue_id;
+ conf.soft_id = res->fd_id_value;
+ add = strcmp(res->ops, "del") ? 1 : 0;
+ ret = rte_pmd_i40e_flow_add_del_packet_template(port,
+ &conf,
+ add);
+ if (ret < 0)
+ printf("flow director config error: (%s)\n",
+ strerror(-ret));
+ close_file(conf.input.packet);
+#endif
+ return;
+ } else if (strcmp(res->mode_value, "IP")) {
+ printf("Please set mode to IP or raw.\n");
return;
}
entry.input.flow_type = str2flowtype(res->flow_type);
@@ -10091,8 +10300,7 @@ cmdline_parse_token_string_t cmd_flow_director_flow =
flow, "flow");
cmdline_parse_token_string_t cmd_flow_director_flow_type =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- flow_type, "ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
- "ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#l2_payload");
+ flow_type, NULL);
cmdline_parse_token_string_t cmd_flow_director_ether =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
ether, "ether");
@@ -10184,6 +10392,9 @@ cmdline_parse_token_string_t cmd_flow_director_mode_mac_vlan =
cmdline_parse_token_string_t cmd_flow_director_mode_tunnel =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
mode_value, "Tunnel");
+cmdline_parse_token_string_t cmd_flow_director_mode_raw =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "raw");
cmdline_parse_token_string_t cmd_flow_director_mac =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
mac, "mac");
@@ -10202,6 +10413,12 @@ cmdline_parse_token_string_t cmd_flow_director_tunnel_id =
cmdline_parse_token_num_t cmd_flow_director_tunnel_id_value =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
tunnel_id_value, UINT32);
+cmdline_parse_token_string_t cmd_flow_director_packet =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ packet, "packet");
+cmdline_parse_token_string_t cmd_flow_director_filepath =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ filepath, NULL);
cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
.f = cmd_flow_director_filter_parsed,
@@ -10298,7 +10515,7 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
(void *)&cmd_flow_director_flow_type,
(void *)&cmd_flow_director_src,
(void *)&cmd_flow_director_ip_src,
- (void *)&cmd_flow_director_port_dst,
+ (void *)&cmd_flow_director_port_src,
(void *)&cmd_flow_director_dst,
(void *)&cmd_flow_director_ip_dst,
(void *)&cmd_flow_director_port_dst,
@@ -10405,6 +10622,30 @@ cmdline_parse_inst_t cmd_add_del_tunnel_flow_director = {
},
};
+cmdline_parse_inst_t cmd_add_del_raw_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "flow_director_filter ... : Add or delete a raw flow "
+ "director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_raw,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_flow,
+ (void *)&cmd_flow_director_flow_type,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ (void *)&cmd_flow_director_packet,
+ (void *)&cmd_flow_director_filepath,
+ NULL,
+ },
+};
+
struct cmd_flush_flow_director_result {
cmdline_fixed_string_t flush_flow_director;
portid_t port_id;
@@ -10681,7 +10922,7 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
struct rte_eth_fdir_info fdir_info;
struct rte_eth_fdir_flex_mask flex_mask;
struct rte_port *port;
- uint32_t flow_type_mask;
+ uint64_t flow_type_mask;
uint16_t i;
int ret;
@@ -10734,7 +10975,7 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
return;
}
for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
- if (flow_type_mask & (1 << i)) {
+ if (flow_type_mask & (1ULL << i)) {
flex_mask.flow_type = i;
fdir_set_flex_mask(res->port_id, &flex_mask);
}
@@ -10743,7 +10984,7 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
return;
}
flex_mask.flow_type = str2flowtype(res->flow_type);
- if (!(flow_type_mask & (1 << flex_mask.flow_type))) {
+ if (!(flow_type_mask & (1ULL << flex_mask.flow_type))) {
printf("Flow type %s not supported on port %d\n",
res->flow_type, res->port_id);
return;
@@ -11105,10 +11346,10 @@ cmd_get_hash_global_config_parsed(void *parsed_result,
}
for (i = 0; i < RTE_ETH_FLOW_MAX; i++) {
- idx = i / UINT32_BIT;
- offset = i % UINT32_BIT;
+ idx = i / UINT64_BIT;
+ offset = i % UINT64_BIT;
if (!(info.info.global_conf.valid_bit_mask[idx] &
- (1UL << offset)))
+ (1ULL << offset)))
continue;
str = flowtype_to_str(i);
if (!str)
@@ -11116,7 +11357,7 @@ cmd_get_hash_global_config_parsed(void *parsed_result,
printf("Symmetric hash is %s globally for flow type %s "
"by port %d\n",
((info.info.global_conf.sym_hash_enable_mask[idx] &
- (1UL << offset)) ? "enabled" : "disabled"), str,
+ (1ULL << offset)) ? "enabled" : "disabled"), str,
res->port_id);
}
}
@@ -11177,12 +11418,12 @@ cmd_set_hash_global_config_parsed(void *parsed_result,
RTE_ETH_HASH_FUNCTION_DEFAULT;
ftype = str2flowtype(res->flow_type);
- idx = ftype / (CHAR_BIT * sizeof(uint32_t));
- offset = ftype % (CHAR_BIT * sizeof(uint32_t));
- info.info.global_conf.valid_bit_mask[idx] |= (1UL << offset);
+ idx = ftype / UINT64_BIT;
+ offset = ftype % UINT64_BIT;
+ info.info.global_conf.valid_bit_mask[idx] |= (1ULL << offset);
if (!strcmp(res->enable, "enable"))
info.info.global_conf.sym_hash_enable_mask[idx] |=
- (1UL << offset);
+ (1ULL << offset);
ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_HASH,
RTE_ETH_FILTER_SET, &info);
if (ret < 0)
@@ -12620,6 +12861,10 @@ cmd_set_tx_loopback_parsed(
if (ret == -ENOTSUP)
ret = rte_pmd_bnxt_set_tx_loopback(res->port_id, is_on);
#endif
+#ifdef RTE_LIBRTE_DPAA_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_dpaa_set_tx_loopback(res->port_id, is_on);
+#endif
switch (ret) {
case 0:
@@ -13004,19 +13249,29 @@ cmd_set_macsec_offload_on_parsed(
portid_t port_id = res->port_id;
int en = (strcmp(res->en_on_off, "on") == 0) ? 1 : 0;
int rp = (strcmp(res->rp_on_off, "on") == 0) ? 1 : 0;
+ struct rte_eth_dev_info dev_info;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
+ if (!port_is_stopped(port_id)) {
+ printf("Please stop port %d first\n", port_id);
+ return;
+ }
- ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC;
+ rte_eth_dev_info_get(port_id, &dev_info);
+ if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) {
#ifdef RTE_LIBRTE_IXGBE_PMD
- ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp);
+ ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp);
#endif
+ }
RTE_SET_USED(en);
RTE_SET_USED(rp);
switch (ret) {
case 0:
+ ports[port_id].dev_conf.txmode.offloads |=
+ DEV_TX_OFFLOAD_MACSEC_INSERT;
+ cmd_reconfig_device_queue(port_id, 1, 1);
break;
case -ENODEV:
printf("invalid port_id %d\n", port_id);
@@ -13087,18 +13342,27 @@ cmd_set_macsec_offload_off_parsed(
{
struct cmd_macsec_offload_off_result *res = parsed_result;
int ret = -ENOTSUP;
+ struct rte_eth_dev_info dev_info;
portid_t port_id = res->port_id;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
+ if (!port_is_stopped(port_id)) {
+ printf("Please stop port %d first\n", port_id);
+ return;
+ }
- ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC;
+ rte_eth_dev_info_get(port_id, &dev_info);
+ if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) {
#ifdef RTE_LIBRTE_IXGBE_PMD
- ret = rte_pmd_ixgbe_macsec_disable(port_id);
+ ret = rte_pmd_ixgbe_macsec_disable(port_id);
#endif
-
+ }
switch (ret) {
case 0:
+ ports[port_id].dev_conf.txmode.offloads &=
+ ~DEV_TX_OFFLOAD_MACSEC_INSERT;
+ cmd_reconfig_device_queue(port_id, 1, 1);
break;
case -ENODEV:
printf("invalid port_id %d\n", port_id);
@@ -14220,7 +14484,7 @@ cmd_ddp_add_parsed(
}
file_num = rte_strsplit(filepath, strlen(filepath), file_fld, 2, ',');
- buff = open_ddp_package_file(file_fld[0], &size);
+ buff = open_file(file_fld[0], &size);
if (!buff) {
free((void *)filepath);
return;
@@ -14238,16 +14502,16 @@ cmd_ddp_add_parsed(
else if (ret < 0)
printf("Failed to load profile.\n");
else if (file_num == 2)
- save_ddp_package_file(file_fld[1], buff, size);
+ save_file(file_fld[1], buff, size);
- close_ddp_package_file(buff);
+ close_file(buff);
free((void *)filepath);
}
cmdline_parse_inst_t cmd_ddp_add = {
.f = cmd_ddp_add_parsed,
.data = NULL,
- .help_str = "ddp add <port_id> <profile_path[,output_path]>",
+ .help_str = "ddp add <port_id> <profile_path[,backup_profile_path]>",
.tokens = {
(void *)&cmd_ddp_add_ddp,
(void *)&cmd_ddp_add_add,
@@ -14295,7 +14559,7 @@ cmd_ddp_del_parsed(
return;
}
- buff = open_ddp_package_file(res->filepath, &size);
+ buff = open_file(res->filepath, &size);
if (!buff)
return;
@@ -14311,13 +14575,13 @@ cmd_ddp_del_parsed(
else if (ret < 0)
printf("Failed to delete profile.\n");
- close_ddp_package_file(buff);
+ close_file(buff);
}
cmdline_parse_inst_t cmd_ddp_del = {
.f = cmd_ddp_del_parsed,
.data = NULL,
- .help_str = "ddp del <port_id> <profile_path>",
+ .help_str = "ddp del <port_id> <backup_profile_path>",
.tokens = {
(void *)&cmd_ddp_del_ddp,
(void *)&cmd_ddp_del_del,
@@ -14371,7 +14635,7 @@ cmd_ddp_info_parsed(
#endif
- pkg = open_ddp_package_file(res->filepath, &pkg_size);
+ pkg = open_file(res->filepath, &pkg_size);
if (!pkg)
return;
@@ -14548,7 +14812,7 @@ no_print_return:
#endif
if (ret == -ENOTSUP)
printf("Function not supported in PMD driver\n");
- close_ddp_package_file(pkg);
+ close_file(pkg);
}
cmdline_parse_inst_t cmd_ddp_get_info = {
@@ -14652,6 +14916,237 @@ cmdline_parse_inst_t cmd_ddp_get_list = {
},
};
+/* Configure input set */
+struct cmd_cfg_input_set_result {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t cfg;
+ portid_t port_id;
+ cmdline_fixed_string_t pctype;
+ uint8_t pctype_id;
+ cmdline_fixed_string_t inset_type;
+ cmdline_fixed_string_t opt;
+ cmdline_fixed_string_t field;
+ uint8_t field_idx;
+};
+
+static void
+cmd_cfg_input_set_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_cfg_input_set_result *res = parsed_result;
+#ifdef RTE_LIBRTE_I40E_PMD
+ enum rte_pmd_i40e_inset_type inset_type = INSET_NONE;
+ struct rte_pmd_i40e_inset inset;
+#endif
+ int ret = -ENOTSUP;
+
+ if (res->port_id > nb_ports) {
+ printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
+ return;
+ }
+
+ if (!all_ports_stopped()) {
+ printf("Please stop all ports first\n");
+ return;
+ }
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (!strcmp(res->inset_type, "hash_inset"))
+ inset_type = INSET_HASH;
+ else if (!strcmp(res->inset_type, "fdir_inset"))
+ inset_type = INSET_FDIR;
+ else if (!strcmp(res->inset_type, "fdir_flx_inset"))
+ inset_type = INSET_FDIR_FLX;
+ ret = rte_pmd_i40e_inset_get(res->port_id, res->pctype_id,
+ &inset, inset_type);
+ if (ret) {
+ printf("Failed to get input set.\n");
+ return;
+ }
+
+ if (!strcmp(res->opt, "get")) {
+ ret = rte_pmd_i40e_inset_field_get(inset.inset,
+ res->field_idx);
+ if (ret)
+ printf("Field index %d is enabled.\n", res->field_idx);
+ else
+ printf("Field index %d is disabled.\n", res->field_idx);
+ return;
+ } else if (!strcmp(res->opt, "set"))
+ ret = rte_pmd_i40e_inset_field_set(&inset.inset,
+ res->field_idx);
+ else if (!strcmp(res->opt, "clear"))
+ ret = rte_pmd_i40e_inset_field_clear(&inset.inset,
+ res->field_idx);
+ if (ret) {
+ printf("Failed to configure input set field.\n");
+ return;
+ }
+
+ ret = rte_pmd_i40e_inset_set(res->port_id, res->pctype_id,
+ &inset, inset_type);
+ if (ret) {
+ printf("Failed to set input set.\n");
+ return;
+ }
+#endif
+
+ if (ret == -ENOTSUP)
+ printf("Function not supported\n");
+}
+
+cmdline_parse_token_string_t cmd_cfg_input_set_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ port, "port");
+cmdline_parse_token_string_t cmd_cfg_input_set_cfg =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ cfg, "config");
+cmdline_parse_token_num_t cmd_cfg_input_set_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
+ port_id, UINT16);
+cmdline_parse_token_string_t cmd_cfg_input_set_pctype =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ pctype, "pctype");
+cmdline_parse_token_num_t cmd_cfg_input_set_pctype_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
+ pctype_id, UINT8);
+cmdline_parse_token_string_t cmd_cfg_input_set_inset_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ inset_type,
+ "hash_inset#fdir_inset#fdir_flx_inset");
+cmdline_parse_token_string_t cmd_cfg_input_set_opt =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ opt, "get#set#clear");
+cmdline_parse_token_string_t cmd_cfg_input_set_field =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ field, "field");
+cmdline_parse_token_num_t cmd_cfg_input_set_field_idx =
+ TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
+ field_idx, UINT8);
+
+cmdline_parse_inst_t cmd_cfg_input_set = {
+ .f = cmd_cfg_input_set_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> pctype <pctype_id> hash_inset|"
+ "fdir_inset|fdir_flx_inset get|set|clear field <field_idx>",
+ .tokens = {
+ (void *)&cmd_cfg_input_set_port,
+ (void *)&cmd_cfg_input_set_cfg,
+ (void *)&cmd_cfg_input_set_port_id,
+ (void *)&cmd_cfg_input_set_pctype,
+ (void *)&cmd_cfg_input_set_pctype_id,
+ (void *)&cmd_cfg_input_set_inset_type,
+ (void *)&cmd_cfg_input_set_opt,
+ (void *)&cmd_cfg_input_set_field,
+ (void *)&cmd_cfg_input_set_field_idx,
+ NULL,
+ },
+};
+
+/* Clear input set */
+struct cmd_clear_input_set_result {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t cfg;
+ portid_t port_id;
+ cmdline_fixed_string_t pctype;
+ uint8_t pctype_id;
+ cmdline_fixed_string_t inset_type;
+ cmdline_fixed_string_t clear;
+ cmdline_fixed_string_t all;
+};
+
+static void
+cmd_clear_input_set_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_clear_input_set_result *res = parsed_result;
+#ifdef RTE_LIBRTE_I40E_PMD
+ enum rte_pmd_i40e_inset_type inset_type = INSET_NONE;
+ struct rte_pmd_i40e_inset inset;
+#endif
+ int ret = -ENOTSUP;
+
+ if (res->port_id > nb_ports) {
+ printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
+ return;
+ }
+
+ if (!all_ports_stopped()) {
+ printf("Please stop all ports first\n");
+ return;
+ }
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (!strcmp(res->inset_type, "hash_inset"))
+ inset_type = INSET_HASH;
+ else if (!strcmp(res->inset_type, "fdir_inset"))
+ inset_type = INSET_FDIR;
+ else if (!strcmp(res->inset_type, "fdir_flx_inset"))
+ inset_type = INSET_FDIR_FLX;
+
+ memset(&inset, 0, sizeof(inset));
+
+ ret = rte_pmd_i40e_inset_set(res->port_id, res->pctype_id,
+ &inset, inset_type);
+ if (ret) {
+ printf("Failed to clear input set.\n");
+ return;
+ }
+
+#endif
+
+ if (ret == -ENOTSUP)
+ printf("Function not supported\n");
+}
+
+cmdline_parse_token_string_t cmd_clear_input_set_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ port, "port");
+cmdline_parse_token_string_t cmd_clear_input_set_cfg =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ cfg, "config");
+cmdline_parse_token_num_t cmd_clear_input_set_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_clear_input_set_result,
+ port_id, UINT16);
+cmdline_parse_token_string_t cmd_clear_input_set_pctype =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ pctype, "pctype");
+cmdline_parse_token_num_t cmd_clear_input_set_pctype_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_clear_input_set_result,
+ pctype_id, UINT8);
+cmdline_parse_token_string_t cmd_clear_input_set_inset_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ inset_type,
+ "hash_inset#fdir_inset#fdir_flx_inset");
+cmdline_parse_token_string_t cmd_clear_input_set_clear =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ clear, "clear");
+cmdline_parse_token_string_t cmd_clear_input_set_all =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ all, "all");
+
+cmdline_parse_inst_t cmd_clear_input_set = {
+ .f = cmd_clear_input_set_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> pctype <pctype_id> hash_inset|"
+ "fdir_inset|fdir_flx_inset clear all",
+ .tokens = {
+ (void *)&cmd_clear_input_set_port,
+ (void *)&cmd_clear_input_set_cfg,
+ (void *)&cmd_clear_input_set_port_id,
+ (void *)&cmd_clear_input_set_pctype,
+ (void *)&cmd_clear_input_set_pctype_id,
+ (void *)&cmd_clear_input_set_inset_type,
+ (void *)&cmd_clear_input_set_clear,
+ (void *)&cmd_clear_input_set_all,
+ NULL,
+ },
+};
+
/* show vf stats */
/* Common result structure for show vf stats */
@@ -15554,6 +16049,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_set_link_down,
(cmdline_parse_inst_t *)&cmd_reset,
(cmdline_parse_inst_t *)&cmd_set_numbers,
+ (cmdline_parse_inst_t *)&cmd_set_log,
(cmdline_parse_inst_t *)&cmd_set_txpkts,
(cmdline_parse_inst_t *)&cmd_set_txsplit,
(cmdline_parse_inst_t *)&cmd_set_fwd_list,
@@ -15625,6 +16121,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_read_rxd_txd,
(cmdline_parse_inst_t *)&cmd_stop,
(cmdline_parse_inst_t *)&cmd_mac_addr,
+ (cmdline_parse_inst_t *)&cmd_set_fwd_eth_peer,
(cmdline_parse_inst_t *)&cmd_set_qmap,
(cmdline_parse_inst_t *)&cmd_set_xstats_hide_zero,
(cmdline_parse_inst_t *)&cmd_operate_port,
@@ -15639,7 +16136,6 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_config_rx_mode_flag,
(cmdline_parse_inst_t *)&cmd_config_rss,
(cmdline_parse_inst_t *)&cmd_config_rxtx_queue,
- (cmdline_parse_inst_t *)&cmd_config_txqflags,
(cmdline_parse_inst_t *)&cmd_config_rss_reta,
(cmdline_parse_inst_t *)&cmd_showport_reta,
(cmdline_parse_inst_t *)&cmd_config_burst,
@@ -15672,6 +16168,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_add_del_l2_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_mac_vlan_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_tunnel_flow_director,
+ (cmdline_parse_inst_t *)&cmd_add_del_raw_flow_director,
(cmdline_parse_inst_t *)&cmd_flush_flow_director,
(cmdline_parse_inst_t *)&cmd_set_flow_director_ip_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_mac_vlan_mask,
@@ -15685,12 +16182,16 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_set_hash_input_set,
(cmdline_parse_inst_t *)&cmd_set_fdir_input_set,
(cmdline_parse_inst_t *)&cmd_flow,
+ (cmdline_parse_inst_t *)&cmd_show_port_meter_cap,
(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm,
(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_trtcm,
(cmdline_parse_inst_t *)&cmd_del_port_meter_profile,
- (cmdline_parse_inst_t *)&cmd_set_port_meter,
+ (cmdline_parse_inst_t *)&cmd_create_port_meter,
+ (cmdline_parse_inst_t *)&cmd_enable_port_meter,
+ (cmdline_parse_inst_t *)&cmd_disable_port_meter,
(cmdline_parse_inst_t *)&cmd_del_port_meter,
(cmdline_parse_inst_t *)&cmd_set_port_meter_profile,
+ (cmdline_parse_inst_t *)&cmd_set_port_meter_dscp_table,
(cmdline_parse_inst_t *)&cmd_set_port_meter_policer_action,
(cmdline_parse_inst_t *)&cmd_set_port_meter_stats_mask,
(cmdline_parse_inst_t *)&cmd_show_port_meter_stats,
@@ -15737,6 +16238,8 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_ddp_del,
(cmdline_parse_inst_t *)&cmd_ddp_get_list,
(cmdline_parse_inst_t *)&cmd_ddp_get_info,
+ (cmdline_parse_inst_t *)&cmd_cfg_input_set,
+ (cmdline_parse_inst_t *)&cmd_clear_input_set,
(cmdline_parse_inst_t *)&cmd_show_vf_stats,
(cmdline_parse_inst_t *)&cmd_clear_vf_stats,
(cmdline_parse_inst_t *)&cmd_ptype_mapping_get,
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index df16d2ab..a5cf84f7 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -1,34 +1,6 @@
-/*-
- * BSD LICENSE
- *
- * Copyright 2016 6WIND S.A.
- * Copyright 2016 Mellanox.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of 6WIND S.A. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2016 6WIND S.A.
+ * Copyright 2016 Mellanox.
*/
#include <stddef.h>
@@ -175,6 +147,9 @@ enum index {
ITEM_GTP_TEID,
ITEM_GTPC,
ITEM_GTPU,
+ ITEM_GENEVE,
+ ITEM_GENEVE_VNI,
+ ITEM_GENEVE_PROTO,
/* Validate/create actions. */
ACTIONS,
@@ -460,6 +435,7 @@ static const enum index next_item[] = {
ITEM_GTP,
ITEM_GTPC,
ITEM_GTPU,
+ ITEM_GENEVE,
ZERO,
};
@@ -603,6 +579,13 @@ static const enum index item_gtp[] = {
ZERO,
};
+static const enum index item_geneve[] = {
+ ITEM_GENEVE_VNI,
+ ITEM_GENEVE_PROTO,
+ ITEM_NEXT,
+ ZERO,
+};
+
static const enum index next_action[] = {
ACTION_END,
ACTION_VOID,
@@ -1470,6 +1453,26 @@ static const struct token token_list[] = {
.next = NEXT(item_gtp),
.call = parse_vc,
},
+ [ITEM_GENEVE] = {
+ .name = "geneve",
+ .help = "match GENEVE header",
+ .priv = PRIV_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)),
+ .next = NEXT(item_geneve),
+ .call = parse_vc,
+ },
+ [ITEM_GENEVE_VNI] = {
+ .name = "vni",
+ .help = "virtual network identifier",
+ .next = NEXT(item_geneve, NEXT_ENTRY(UNSIGNED), item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_geneve, vni)),
+ },
+ [ITEM_GENEVE_PROTO] = {
+ .name = "protocol",
+ .help = "GENEVE protocol type",
+ .next = NEXT(item_geneve, NEXT_ENTRY(UNSIGNED), item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_geneve,
+ protocol)),
+ },
/* Validate/create actions. */
[ACTIONS] = {
diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index d8d806d7..f908fb35 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2017 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017 Intel Corporation
*/
#include <cmdline_parse.h>
@@ -42,6 +13,9 @@
#include "testpmd.h"
#include "cmdline_mtr.h"
+#define PARSE_DELIMITER " \f\n\r\t\v"
+#define MAX_DSCP_TABLE_ENTRIES 64
+
/** Display Meter Error Message */
static void
print_err_msg(struct rte_mtr_error *error)
@@ -83,23 +57,272 @@ print_err_msg(struct rte_mtr_error *error)
}
static int
+parse_uint(uint64_t *value, const char *str)
+{
+ char *next = NULL;
+ uint64_t n;
+
+ errno = 0;
+ /* Parse number string */
+ n = strtol(str, &next, 10);
+ if (errno != 0 || str == next || *next != '\0')
+ return -1;
+
+ *value = n;
+
+ return 0;
+}
+
+static int
+parse_dscp_table_entries(char *str, enum rte_mtr_color *dscp_table)
+{
+ char *token;
+ int i = 0;
+
+ token = strtok_r(str, PARSE_DELIMITER, &str);
+ if (token == NULL)
+ return 0;
+
+ /* Allocate memory for dscp table */
+ dscp_table = (enum rte_mtr_color *)malloc(MAX_DSCP_TABLE_ENTRIES *
+ sizeof(enum rte_mtr_color));
+ if (dscp_table == NULL)
+ return -1;
+
+ while (1) {
+ if (strcmp(token, "G") == 0 ||
+ strcmp(token, "g") == 0)
+ dscp_table[i++] = RTE_MTR_GREEN;
+ else if (strcmp(token, "Y") == 0 ||
+ strcmp(token, "y") == 0)
+ dscp_table[i++] = RTE_MTR_YELLOW;
+ else if (strcmp(token, "R") == 0 ||
+ strcmp(token, "r") == 0)
+ dscp_table[i++] = RTE_MTR_RED;
+ else {
+ free(dscp_table);
+ return -1;
+ }
+ if (i == MAX_DSCP_TABLE_ENTRIES)
+ break;
+
+ token = strtok_r(str, PARSE_DELIMITER, &str);
+ if (token == NULL) {
+ free(dscp_table);
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int
+parse_meter_color_str(char *c_str, uint32_t *use_prev_meter_color,
+ enum rte_mtr_color *dscp_table)
+{
+ char *token;
+ uint64_t previous_mtr_color = 0;
+ int ret;
+
+ /* First token: use previous meter color */
+ token = strtok_r(c_str, PARSE_DELIMITER, &c_str);
+ if (token == NULL)
+ return -1;
+
+ ret = parse_uint(&previous_mtr_color, token);
+ if (ret != 0)
+ return -1;
+
+ /* Check if previous meter color to be used */
+ if (previous_mtr_color) {
+ *use_prev_meter_color = previous_mtr_color;
+ return 0;
+ }
+
+ /* Parse dscp table entries */
+ ret = parse_dscp_table_entries(c_str, dscp_table);
+ if (ret != 0)
+ return -1;
+
+ return 0;
+}
+
+static int
string_to_policer_action(char *s)
{
- if (strcmp(s, "G") == 0)
+ if ((strcmp(s, "G") == 0) || (strcmp(s, "g") == 0))
return MTR_POLICER_ACTION_COLOR_GREEN;
- if (strcmp(s, "Y") == 0)
+ if ((strcmp(s, "Y") == 0) || (strcmp(s, "y") == 0))
return MTR_POLICER_ACTION_COLOR_YELLOW;
- if (strcmp(s, "R") == 0)
+ if ((strcmp(s, "R") == 0) || (strcmp(s, "r") == 0))
return MTR_POLICER_ACTION_COLOR_RED;
- if (strcmp(s, "D") == 0)
+ if ((strcmp(s, "D") == 0) || (strcmp(s, "d") == 0))
return MTR_POLICER_ACTION_DROP;
return -1;
}
+static int
+parse_policer_action_string(char *p_str, uint32_t action_mask,
+ enum rte_mtr_policer_action actions[])
+{
+ char *token;
+ int count = __builtin_popcount(action_mask);
+ int g_color = 0, y_color = 0, action, i;
+
+ for (i = 0; i < count; i++) {
+ token = strtok_r(p_str, PARSE_DELIMITER, &p_str);
+ if (token == NULL)
+ return -1;
+
+ action = string_to_policer_action(token);
+ if (action == -1)
+ return -1;
+
+ if (g_color == 0 && (action_mask & 0x1)) {
+ actions[RTE_MTR_GREEN] = action;
+ g_color = 1;
+ } else if (y_color == 0 && (action_mask & 0x2)) {
+ actions[RTE_MTR_YELLOW] = action;
+ y_color = 1;
+ } else
+ actions[RTE_MTR_RED] = action;
+ }
+ return 0;
+}
+
+static int
+parse_multi_token_string(char *t_str, uint16_t *port_id,
+ uint32_t *mtr_id, enum rte_mtr_color *dscp_table)
+{
+ char *token;
+ uint64_t val;
+ int ret;
+
+ /* First token: port id */
+ token = strtok_r(t_str, PARSE_DELIMITER, &t_str);
+ if (token == NULL)
+ return -1;
+
+ ret = parse_uint(&val, token);
+ if (ret != 0 || val > UINT16_MAX)
+ return -1;
+
+ *port_id = val;
+
+ /* Second token: meter id */
+ token = strtok_r(t_str, PARSE_DELIMITER, &t_str);
+ if (token == NULL)
+ return 0;
+
+ ret = parse_uint(&val, token);
+ if (ret != 0 || val > UINT32_MAX)
+ return -1;
+
+ *mtr_id = val;
+
+ ret = parse_dscp_table_entries(t_str, dscp_table);
+ if (ret != 0)
+ return -1;
+
+ return 0;
+}
+
+/* *** Show Port Meter Capabilities *** */
+struct cmd_show_port_meter_cap_result {
+ cmdline_fixed_string_t show;
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t meter;
+ cmdline_fixed_string_t cap;
+ uint16_t port_id;
+};
+
+cmdline_parse_token_string_t cmd_show_port_meter_cap_show =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_show_port_meter_cap_result, show, "show");
+cmdline_parse_token_string_t cmd_show_port_meter_cap_port =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_show_port_meter_cap_result, port, "port");
+cmdline_parse_token_string_t cmd_show_port_meter_cap_meter =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_show_port_meter_cap_result, meter, "meter");
+cmdline_parse_token_string_t cmd_show_port_meter_cap_cap =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_show_port_meter_cap_result, cap, "cap");
+cmdline_parse_token_num_t cmd_show_port_meter_cap_port_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_show_port_meter_cap_result, port_id, UINT16);
+
+static void cmd_show_port_meter_cap_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_show_port_meter_cap_result *res = parsed_result;
+ struct rte_mtr_capabilities cap;
+ struct rte_mtr_error error;
+ uint16_t port_id = res->port_id;
+ int ret;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN))
+ return;
+
+ memset(&cap, 0, sizeof(struct rte_mtr_capabilities));
+ ret = rte_mtr_capabilities_get(port_id, &cap, &error);
+ if (ret) {
+ print_err_msg(&error);
+ return;
+ }
+
+ printf("\n**** Port Meter Object Capabilities ****\n\n");
+ printf("cap.n_max %" PRIu32 "\n", cap.n_max);
+ printf("cap.n_shared_max %" PRIu32 "\n", cap.n_shared_max);
+ printf("cap.identical %" PRId32 "\n", cap.identical);
+ printf("cap.shared_identical %" PRId32 "\n",
+ cap.shared_identical);
+ printf("cap.shared_n_flows_per_mtr_max %" PRIu32 "\n",
+ cap.shared_n_flows_per_mtr_max);
+ printf("cap.chaining_n_mtrs_per_flow_max %" PRIu32 "\n",
+ cap.chaining_n_mtrs_per_flow_max);
+ printf("cap.chaining_use_prev_mtr_color_supported %" PRId32 "\n",
+ cap.chaining_use_prev_mtr_color_supported);
+ printf("cap.chaining_use_prev_mtr_color_enforced %" PRId32 "\n",
+ cap.chaining_use_prev_mtr_color_enforced);
+ printf("cap.meter_srtcm_rfc2697_n_max %" PRIu32 "\n",
+ cap.meter_srtcm_rfc2697_n_max);
+ printf("cap.meter_trtcm_rfc2698_n_max %" PRIu32 "\n",
+ cap.meter_trtcm_rfc2698_n_max);
+ printf("cap.meter_trtcm_rfc4115_n_max %" PRIu32 "\n",
+ cap.meter_trtcm_rfc4115_n_max);
+ printf("cap.meter_rate_max %" PRIu64 "\n", cap.meter_rate_max);
+ printf("cap.color_aware_srtcm_rfc2697_supported %" PRId32 "\n",
+ cap.color_aware_srtcm_rfc2697_supported);
+ printf("cap.color_aware_trtcm_rfc2698_supported %" PRId32 "\n",
+ cap.color_aware_trtcm_rfc2698_supported);
+ printf("cap.color_aware_trtcm_rfc4115_supported %" PRId32 "\n",
+ cap.color_aware_trtcm_rfc4115_supported);
+ printf("cap.policer_action_recolor_supported %" PRId32 "\n",
+ cap.policer_action_recolor_supported);
+ printf("cap.policer_action_drop_supported %" PRId32 "\n",
+ cap.policer_action_drop_supported);
+ printf("cap.stats_mask %" PRIx64 "\n", cap.stats_mask);
+}
+
+cmdline_parse_inst_t cmd_show_port_meter_cap = {
+ .f = cmd_show_port_meter_cap_parsed,
+ .data = NULL,
+ .help_str = "Show port meter cap",
+ .tokens = {
+ (void *)&cmd_show_port_meter_cap_show,
+ (void *)&cmd_show_port_meter_cap_port,
+ (void *)&cmd_show_port_meter_cap_meter,
+ (void *)&cmd_show_port_meter_cap_cap,
+ (void *)&cmd_show_port_meter_cap_port_id,
+ NULL,
+ },
+};
+
/* *** Add Port Meter Profile srtcm_rfc2697 *** */
struct cmd_add_port_meter_profile_srtcm_result {
cmdline_fixed_string_t add;
@@ -112,7 +335,6 @@ struct cmd_add_port_meter_profile_srtcm_result {
uint64_t cir;
uint64_t cbs;
uint64_t ebs;
- uint8_t color_aware;
};
cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcm_add =
@@ -171,7 +393,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
/* Private shaper profile params */
memset(&mp, 0, sizeof(struct rte_mtr_meter_profile));
- mp.alg = 0;
+ mp.alg = RTE_MTR_SRTCM_RFC2697;
mp.srtcm_rfc2697.cir = res->cir;
mp.srtcm_rfc2697.cbs = res->cbs;
mp.srtcm_rfc2697.ebs = res->ebs;
@@ -277,7 +499,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
/* Private shaper profile params */
memset(&mp, 0, sizeof(struct rte_mtr_meter_profile));
- mp.alg = 0;
+ mp.alg = RTE_MTR_TRTCM_RFC2698;
mp.trtcm_rfc2698.cir = res->cir;
mp.trtcm_rfc2698.pir = res->pir;
mp.trtcm_rfc2698.cbs = res->cbs;
@@ -389,7 +611,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
/* Private shaper profile params */
memset(&mp, 0, sizeof(struct rte_mtr_meter_profile));
- mp.alg = 0;
+ mp.alg = RTE_MTR_TRTCM_RFC4115;
mp.trtcm_rfc4115.cir = res->cir;
mp.trtcm_rfc4115.eir = res->eir;
mp.trtcm_rfc4115.cbs = res->cbs;
@@ -493,65 +715,75 @@ cmdline_parse_inst_t cmd_del_port_meter_profile = {
};
/* *** Create Port Meter Object *** */
-struct cmd_set_port_meter_result {
- cmdline_fixed_string_t set;
+struct cmd_create_port_meter_result {
+ cmdline_fixed_string_t create;
cmdline_fixed_string_t port;
cmdline_fixed_string_t meter;
uint16_t port_id;
uint32_t mtr_id;
uint32_t profile_id;
+ cmdline_fixed_string_t meter_enable;
cmdline_fixed_string_t g_action;
cmdline_fixed_string_t y_action;
cmdline_fixed_string_t r_action;
uint64_t statistics_mask;
uint32_t shared;
+ cmdline_multi_string_t meter_input_color;
};
-cmdline_parse_token_string_t cmd_set_port_meter_set =
+cmdline_parse_token_string_t cmd_create_port_meter_create =
TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_meter_result, set, "set");
-cmdline_parse_token_string_t cmd_set_port_meter_port =
+ struct cmd_create_port_meter_result, create, "create");
+cmdline_parse_token_string_t cmd_create_port_meter_port =
TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_meter_result, port, "port");
-cmdline_parse_token_string_t cmd_set_port_meter_meter =
+ struct cmd_create_port_meter_result, port, "port");
+cmdline_parse_token_string_t cmd_create_port_meter_meter =
TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_meter_result, meter, "meter");
-cmdline_parse_token_num_t cmd_set_port_meter_port_id =
+ struct cmd_create_port_meter_result, meter, "meter");
+cmdline_parse_token_num_t cmd_create_port_meter_port_id =
TOKEN_NUM_INITIALIZER(
- struct cmd_set_port_meter_result, port_id, UINT16);
-cmdline_parse_token_num_t cmd_set_port_meter_mtr_id =
+ struct cmd_create_port_meter_result, port_id, UINT16);
+cmdline_parse_token_num_t cmd_create_port_meter_mtr_id =
TOKEN_NUM_INITIALIZER(
- struct cmd_set_port_meter_result, mtr_id, UINT32);
-cmdline_parse_token_num_t cmd_set_port_meter_profile_id =
+ struct cmd_create_port_meter_result, mtr_id, UINT32);
+cmdline_parse_token_num_t cmd_create_port_meter_profile_id =
TOKEN_NUM_INITIALIZER(
- struct cmd_set_port_meter_result, profile_id, UINT32);
-cmdline_parse_token_string_t cmd_set_port_meter_g_action =
- TOKEN_STRING_INITIALIZER(struct cmd_set_port_meter_result,
- g_action, "R#Y#G#D");
-cmdline_parse_token_string_t cmd_set_port_meter_y_action =
- TOKEN_STRING_INITIALIZER(struct cmd_set_port_meter_result,
- y_action, "R#Y#G#D");
-cmdline_parse_token_string_t cmd_set_port_meter_r_action =
- TOKEN_STRING_INITIALIZER(struct cmd_set_port_meter_result,
- r_action, "R#Y#G#D");
-cmdline_parse_token_num_t cmd_set_port_meter_statistics_mask =
- TOKEN_NUM_INITIALIZER(struct cmd_set_port_meter_result,
+ struct cmd_create_port_meter_result, profile_id, UINT32);
+cmdline_parse_token_string_t cmd_create_port_meter_meter_enable =
+ TOKEN_STRING_INITIALIZER(struct cmd_create_port_meter_result,
+ meter_enable, "yes#no");
+cmdline_parse_token_string_t cmd_create_port_meter_g_action =
+ TOKEN_STRING_INITIALIZER(struct cmd_create_port_meter_result,
+ g_action, "R#Y#G#D#r#y#g#d");
+cmdline_parse_token_string_t cmd_create_port_meter_y_action =
+ TOKEN_STRING_INITIALIZER(struct cmd_create_port_meter_result,
+ y_action, "R#Y#G#D#r#y#g#d");
+cmdline_parse_token_string_t cmd_create_port_meter_r_action =
+ TOKEN_STRING_INITIALIZER(struct cmd_create_port_meter_result,
+ r_action, "R#Y#G#D#r#y#g#d");
+cmdline_parse_token_num_t cmd_create_port_meter_statistics_mask =
+ TOKEN_NUM_INITIALIZER(struct cmd_create_port_meter_result,
statistics_mask, UINT64);
-cmdline_parse_token_num_t cmd_set_port_meter_shared =
- TOKEN_NUM_INITIALIZER(struct cmd_set_port_meter_result,
+cmdline_parse_token_num_t cmd_create_port_meter_shared =
+ TOKEN_NUM_INITIALIZER(struct cmd_create_port_meter_result,
shared, UINT32);
+cmdline_parse_token_string_t cmd_create_port_meter_input_color =
+ TOKEN_STRING_INITIALIZER(struct cmd_create_port_meter_result,
+ meter_input_color, TOKEN_STRING_MULTI);
-static void cmd_set_port_meter_parsed(void *parsed_result,
+static void cmd_create_port_meter_parsed(void *parsed_result,
__attribute__((unused)) struct cmdline *cl,
__attribute__((unused)) void *data)
{
- struct cmd_set_port_meter_result *res = parsed_result;
+ struct cmd_create_port_meter_result *res = parsed_result;
struct rte_mtr_error error;
struct rte_mtr_params params;
uint32_t mtr_id = res->mtr_id;
uint32_t shared = res->shared;
+ uint32_t use_prev_meter_color = 0;
uint16_t port_id = res->port_id;
-
+ enum rte_mtr_color *dscp_table = NULL;
+ char *c_str = res->meter_input_color;
int ret;
if (port_id_is_invalid(port_id, ENABLED_WARN))
@@ -560,9 +792,22 @@ static void cmd_set_port_meter_parsed(void *parsed_result,
/* Meter params */
memset(&params, 0, sizeof(struct rte_mtr_params));
params.meter_profile_id = res->profile_id;
- params.use_prev_mtr_color = 1;
- params.dscp_table = NULL;
- params.meter_enable = 1;
+
+ /* Parse meter input color string params */
+ ret = parse_meter_color_str(c_str, &use_prev_meter_color, dscp_table);
+ if (ret) {
+ printf(" Meter input color params string parse error\n");
+ return;
+ }
+
+ params.use_prev_mtr_color = use_prev_meter_color;
+ params.dscp_table = dscp_table;
+
+ if (strcmp(res->meter_enable, "yes") == 0)
+ params.meter_enable = 1;
+ else
+ params.meter_enable = 0;
+
params.action[RTE_MTR_GREEN] =
string_to_policer_action(res->g_action);
params.action[RTE_MTR_YELLOW] =
@@ -573,27 +818,152 @@ static void cmd_set_port_meter_parsed(void *parsed_result,
ret = rte_mtr_create(port_id, mtr_id, &params, shared, &error);
if (ret != 0) {
+ free(dscp_table);
+ print_err_msg(&error);
+ return;
+ }
+}
+
+cmdline_parse_inst_t cmd_create_port_meter = {
+ .f = cmd_create_port_meter_parsed,
+ .data = NULL,
+ .help_str = "Create port meter",
+ .tokens = {
+ (void *)&cmd_create_port_meter_create,
+ (void *)&cmd_create_port_meter_port,
+ (void *)&cmd_create_port_meter_meter,
+ (void *)&cmd_create_port_meter_port_id,
+ (void *)&cmd_create_port_meter_mtr_id,
+ (void *)&cmd_create_port_meter_profile_id,
+ (void *)&cmd_create_port_meter_meter_enable,
+ (void *)&cmd_create_port_meter_g_action,
+ (void *)&cmd_create_port_meter_y_action,
+ (void *)&cmd_create_port_meter_r_action,
+ (void *)&cmd_create_port_meter_statistics_mask,
+ (void *)&cmd_create_port_meter_shared,
+ (void *)&cmd_create_port_meter_input_color,
+ NULL,
+ },
+};
+
+/* *** Enable Meter of MTR Object *** */
+struct cmd_enable_port_meter_result {
+ cmdline_fixed_string_t enable;
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t meter;
+ uint16_t port_id;
+ uint32_t mtr_id;
+};
+
+cmdline_parse_token_string_t cmd_enable_port_meter_enable =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_enable_port_meter_result, enable, "enable");
+cmdline_parse_token_string_t cmd_enable_port_meter_port =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_enable_port_meter_result, port, "port");
+cmdline_parse_token_string_t cmd_enable_port_meter_meter =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_enable_port_meter_result, meter, "meter");
+cmdline_parse_token_num_t cmd_enable_port_meter_port_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_enable_port_meter_result, port_id, UINT16);
+cmdline_parse_token_num_t cmd_enable_port_meter_mtr_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_enable_port_meter_result, mtr_id, UINT32);
+
+static void cmd_enable_port_meter_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_enable_port_meter_result *res = parsed_result;
+ struct rte_mtr_error error;
+ uint32_t mtr_id = res->mtr_id;
+ uint16_t port_id = res->port_id;
+
+ int ret;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN))
+ return;
+
+ /* Enable Meter */
+ ret = rte_mtr_meter_enable(port_id, mtr_id, &error);
+ if (ret != 0) {
+ print_err_msg(&error);
+ return;
+ }
+}
+
+cmdline_parse_inst_t cmd_enable_port_meter = {
+ .f = cmd_enable_port_meter_parsed,
+ .data = NULL,
+ .help_str = "Enable port meter",
+ .tokens = {
+ (void *)&cmd_enable_port_meter_enable,
+ (void *)&cmd_enable_port_meter_port,
+ (void *)&cmd_enable_port_meter_meter,
+ (void *)&cmd_enable_port_meter_port_id,
+ (void *)&cmd_enable_port_meter_mtr_id,
+ NULL,
+ },
+};
+
+/* *** Disable Meter of MTR Object *** */
+struct cmd_disable_port_meter_result {
+ cmdline_fixed_string_t disable;
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t meter;
+ uint16_t port_id;
+ uint32_t mtr_id;
+};
+
+cmdline_parse_token_string_t cmd_disable_port_meter_disable =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_disable_port_meter_result, disable, "disable");
+cmdline_parse_token_string_t cmd_disable_port_meter_port =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_disable_port_meter_result, port, "port");
+cmdline_parse_token_string_t cmd_disable_port_meter_meter =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_disable_port_meter_result, meter, "meter");
+cmdline_parse_token_num_t cmd_disable_port_meter_port_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_disable_port_meter_result, port_id, UINT16);
+cmdline_parse_token_num_t cmd_disable_port_meter_mtr_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_disable_port_meter_result, mtr_id, UINT32);
+
+static void cmd_disable_port_meter_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_disable_port_meter_result *res = parsed_result;
+ struct rte_mtr_error error;
+ uint32_t mtr_id = res->mtr_id;
+ uint16_t port_id = res->port_id;
+
+ int ret;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN))
+ return;
+
+ /* Disable Meter */
+ ret = rte_mtr_meter_disable(port_id, mtr_id, &error);
+ if (ret != 0) {
print_err_msg(&error);
return;
}
}
-cmdline_parse_inst_t cmd_set_port_meter = {
- .f = cmd_set_port_meter_parsed,
+cmdline_parse_inst_t cmd_disable_port_meter = {
+ .f = cmd_disable_port_meter_parsed,
.data = NULL,
- .help_str = "Set port meter",
+ .help_str = "Disable port meter",
.tokens = {
- (void *)&cmd_set_port_meter_set,
- (void *)&cmd_set_port_meter_port,
- (void *)&cmd_set_port_meter_meter,
- (void *)&cmd_set_port_meter_port_id,
- (void *)&cmd_set_port_meter_mtr_id,
- (void *)&cmd_set_port_meter_profile_id,
- (void *)&cmd_set_port_meter_g_action,
- (void *)&cmd_set_port_meter_y_action,
- (void *)&cmd_set_port_meter_r_action,
- (void *)&cmd_set_port_meter_statistics_mask,
- (void *)&cmd_set_port_meter_shared,
+ (void *)&cmd_disable_port_meter_disable,
+ (void *)&cmd_disable_port_meter_port,
+ (void *)&cmd_disable_port_meter_meter,
+ (void *)&cmd_disable_port_meter_port_id,
+ (void *)&cmd_disable_port_meter_mtr_id,
NULL,
},
};
@@ -732,6 +1102,78 @@ cmdline_parse_inst_t cmd_set_port_meter_profile = {
},
};
+/* *** Set Port Meter DSCP Table *** */
+struct cmd_set_port_meter_dscp_table_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t meter;
+ cmdline_fixed_string_t dscp_table;
+ cmdline_multi_string_t token_string;
+};
+
+cmdline_parse_token_string_t cmd_set_port_meter_dscp_table_set =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_set_port_meter_dscp_table_result, set, "set");
+cmdline_parse_token_string_t cmd_set_port_meter_dscp_table_port =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_set_port_meter_dscp_table_result, port, "port");
+cmdline_parse_token_string_t cmd_set_port_meter_dscp_table_meter =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_set_port_meter_dscp_table_result, meter, "meter");
+cmdline_parse_token_string_t cmd_set_port_meter_dscp_table_dscp_table =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_set_port_meter_dscp_table_result,
+ dscp_table, "dscp table");
+cmdline_parse_token_string_t cmd_set_port_meter_dscp_table_token_string =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_port_meter_dscp_table_result,
+ token_string, TOKEN_STRING_MULTI);
+
+static void cmd_set_port_meter_dscp_table_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_set_port_meter_dscp_table_result *res = parsed_result;
+ struct rte_mtr_error error;
+ enum rte_mtr_color *dscp_table = NULL;
+ char *t_str = res->token_string;
+ uint32_t mtr_id = 0;
+ uint16_t port_id;
+ int ret;
+
+ /* Parse string */
+ ret = parse_multi_token_string(t_str, &port_id, &mtr_id, dscp_table);
+ if (ret) {
+ printf(" Multi token string parse error\n");
+ return;
+ }
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN))
+ return;
+
+ /* Update Meter DSCP Table*/
+ ret = rte_mtr_meter_dscp_table_update(port_id, mtr_id,
+ dscp_table, &error);
+ if (ret != 0) {
+ print_err_msg(&error);
+ return;
+ }
+ free(dscp_table);
+}
+
+cmdline_parse_inst_t cmd_set_port_meter_dscp_table = {
+ .f = cmd_set_port_meter_dscp_table_parsed,
+ .data = NULL,
+ .help_str = "Update port meter dscp table",
+ .tokens = {
+ (void *)&cmd_set_port_meter_dscp_table_set,
+ (void *)&cmd_set_port_meter_dscp_table_port,
+ (void *)&cmd_set_port_meter_dscp_table_meter,
+ (void *)&cmd_set_port_meter_dscp_table_dscp_table,
+ (void *)&cmd_set_port_meter_dscp_table_token_string,
+ NULL,
+ },
+};
+
/* *** Set Port Meter Policer Action *** */
struct cmd_set_port_meter_policer_action_result {
cmdline_fixed_string_t set;
@@ -741,8 +1183,8 @@ struct cmd_set_port_meter_policer_action_result {
cmdline_fixed_string_t action;
uint16_t port_id;
uint32_t mtr_id;
- cmdline_fixed_string_t color;
- cmdline_fixed_string_t policer_action;
+ uint32_t action_mask;
+ cmdline_multi_string_t policer_action;
};
cmdline_parse_token_string_t cmd_set_port_meter_policer_action_set =
@@ -771,56 +1213,60 @@ cmdline_parse_token_num_t cmd_set_port_meter_policer_action_mtr_id =
TOKEN_NUM_INITIALIZER(
struct cmd_set_port_meter_policer_action_result, mtr_id,
UINT32);
-cmdline_parse_token_string_t cmd_set_port_meter_policer_action_color =
- TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_meter_policer_action_result, color,
- "G#Y#R");
+cmdline_parse_token_num_t cmd_set_port_meter_policer_action_action_mask =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_set_port_meter_policer_action_result, action_mask,
+ UINT32);
cmdline_parse_token_string_t cmd_set_port_meter_policer_action_policer_action =
TOKEN_STRING_INITIALIZER(
struct cmd_set_port_meter_policer_action_result,
- policer_action, "G#Y#R#D");
+ policer_action, TOKEN_STRING_MULTI);
static void cmd_set_port_meter_policer_action_parsed(void *parsed_result,
__attribute__((unused)) struct cmdline *cl,
__attribute__((unused)) void *data)
{
struct cmd_set_port_meter_policer_action_result *res = parsed_result;
- enum rte_mtr_color color;
- enum rte_mtr_policer_action action[RTE_MTR_COLORS];
+ enum rte_mtr_policer_action *actions;
struct rte_mtr_error error;
uint32_t mtr_id = res->mtr_id;
+ uint32_t action_mask = res->action_mask;
uint16_t port_id = res->port_id;
- char *c = res->color;
- char *a = res->policer_action;
+ char *p_str = res->policer_action;
int ret;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
- /* Color */
- if (strcmp(c, "G") == 0)
- color = RTE_MTR_GREEN;
- else if (strcmp(c, "Y") == 0)
- color = RTE_MTR_YELLOW;
- else
- color = RTE_MTR_RED;
-
- /* Action */
- if (strcmp(a, "G") == 0)
- action[color] = MTR_POLICER_ACTION_COLOR_GREEN;
- else if (strcmp(a, "Y") == 0)
- action[color] = MTR_POLICER_ACTION_COLOR_YELLOW;
- else if (strcmp(a, "R") == 0)
- action[color] = MTR_POLICER_ACTION_COLOR_RED;
- else
- action[color] = MTR_POLICER_ACTION_DROP;
+ /* Check: action mask */
+ if (action_mask == 0 || (action_mask & (~0x7UL))) {
+ printf(" Policer action mask not correct (error)\n");
+ return;
+ }
+
+ /* Allocate memory for policer actions */
+ actions = (enum rte_mtr_policer_action *)malloc(RTE_MTR_COLORS *
+ sizeof(enum rte_mtr_policer_action));
+ if (actions == NULL) {
+ printf("Memory for policer actions not allocated (error)\n");
+ return;
+ }
+ /* Parse policer action string */
+ ret = parse_policer_action_string(p_str, action_mask, actions);
+ if (ret) {
+ printf(" Policer action string parse error\n");
+ free(actions);
+ return;
+ }
ret = rte_mtr_policer_actions_update(port_id, mtr_id,
- 1 << color, action, &error);
+ action_mask, actions, &error);
if (ret != 0) {
print_err_msg(&error);
return;
}
+
+ free(actions);
}
cmdline_parse_inst_t cmd_set_port_meter_policer_action = {
@@ -835,7 +1281,7 @@ cmdline_parse_inst_t cmd_set_port_meter_policer_action = {
(void *)&cmd_set_port_meter_policer_action_action,
(void *)&cmd_set_port_meter_policer_action_port_id,
(void *)&cmd_set_port_meter_policer_action_mtr_id,
- (void *)&cmd_set_port_meter_policer_action_color,
+ (void *)&cmd_set_port_meter_policer_action_action_mask,
(void *)&cmd_set_port_meter_policer_action_policer_action,
NULL,
},
@@ -925,7 +1371,7 @@ struct cmd_show_port_meter_stats_result {
cmdline_fixed_string_t stats;
uint16_t port_id;
uint32_t mtr_id;
- uint32_t clear;
+ cmdline_fixed_string_t clear;
};
cmdline_parse_token_string_t cmd_show_port_meter_stats_show =
@@ -946,9 +1392,9 @@ cmdline_parse_token_num_t cmd_show_port_meter_stats_port_id =
cmdline_parse_token_num_t cmd_show_port_meter_stats_mtr_id =
TOKEN_NUM_INITIALIZER(
struct cmd_show_port_meter_stats_result, mtr_id, UINT32);
-cmdline_parse_token_num_t cmd_show_port_meter_stats_clear =
- TOKEN_NUM_INITIALIZER(
- struct cmd_show_port_meter_stats_result, clear, UINT32);
+cmdline_parse_token_string_t cmd_show_port_meter_stats_clear =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_show_port_meter_stats_result, clear, "yes#no");
static void cmd_show_port_meter_stats_parsed(void *parsed_result,
__attribute__((unused)) struct cmdline *cl,
@@ -959,13 +1405,16 @@ static void cmd_show_port_meter_stats_parsed(void *parsed_result,
uint64_t stats_mask = 0;
struct rte_mtr_error error;
uint32_t mtr_id = res->mtr_id;
- uint32_t clear = res->clear;
+ uint32_t clear = 0;
uint16_t port_id = res->port_id;
int ret;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
+ if (strcmp(res->clear, "yes") == 0)
+ clear = 1;
+
memset(&stats, 0, sizeof(struct rte_mtr_stats));
ret = rte_mtr_stats_read(port_id, mtr_id, &stats,
&stats_mask, clear, &error);
diff --git a/app/test-pmd/cmdline_mtr.h b/app/test-pmd/cmdline_mtr.h
index 5d599efc..e69d6da0 100644
--- a/app/test-pmd/cmdline_mtr.h
+++ b/app/test-pmd/cmdline_mtr.h
@@ -1,47 +1,22 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2017 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017 Intel Corporation
*/
#ifndef _CMDLINE_MTR_H_
#define _CMDLINE_MTR_H_
/* Traffic Metering and Policing */
+extern cmdline_parse_inst_t cmd_show_port_meter_cap;
extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm;
extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm;
extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115;
extern cmdline_parse_inst_t cmd_del_port_meter_profile;
-extern cmdline_parse_inst_t cmd_set_port_meter;
+extern cmdline_parse_inst_t cmd_create_port_meter;
+extern cmdline_parse_inst_t cmd_enable_port_meter;
+extern cmdline_parse_inst_t cmd_disable_port_meter;
extern cmdline_parse_inst_t cmd_del_port_meter;
extern cmdline_parse_inst_t cmd_set_port_meter_profile;
+extern cmdline_parse_inst_t cmd_set_port_meter_dscp_table;
extern cmdline_parse_inst_t cmd_set_port_meter_policer_action;
extern cmdline_parse_inst_t cmd_set_port_meter_stats_mask;
extern cmdline_parse_inst_t cmd_show_port_meter_stats;
diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index 803fae44..35cad543 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2017 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017 Intel Corporation
*/
#include <cmdline_parse.h>
diff --git a/app/test-pmd/cmdline_tm.h b/app/test-pmd/cmdline_tm.h
index 9d5fdf0a..ba303607 100644
--- a/app/test-pmd/cmdline_tm.h
+++ b/app/test-pmd/cmdline_tm.h
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2017 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017 Intel Corporation
*/
#ifndef _CMDLINE_TM_H_
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cd2ac116..4bb255c6 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1,35 +1,6 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
- * Copyright 2013-2014 6WIND S.A.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2016 Intel Corporation.
+ * Copyright 2013-2014 6WIND S.A.
*/
#include <stdarg.h>
@@ -78,6 +49,7 @@
#include <rte_pmd_bnxt.h>
#endif
#include <rte_gro.h>
+#include <cmdline_parse_etheraddr.h>
#include "testpmd.h"
@@ -417,7 +389,6 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id)
printf("\nTX writeback threshold: %hhu", qinfo.conf.tx_thresh.wthresh);
printf("\nTX RS threshold: %hu", qinfo.conf.tx_rs_thresh);
printf("\nTX free threshold: %hu", qinfo.conf.tx_free_thresh);
- printf("\nTX flags: %#x", qinfo.conf.txq_flags);
printf("\nTX deferred start: %s",
(qinfo.conf.tx_deferred_start != 0) ? "on" : "off");
printf("\nNumber of TXDs: %hu", qinfo.nb_desc);
@@ -522,6 +493,16 @@ port_infos_display(portid_t port_id)
}
}
+ printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);
+ printf("Maximum configurable length of RX packet: %u\n",
+ dev_info.max_rx_pktlen);
+ if (dev_info.max_vfs)
+ printf("Maximum number of VFs: %u\n", dev_info.max_vfs);
+ if (dev_info.max_vmdq_pools)
+ printf("Maximum number of VMDq pools: %u\n",
+ dev_info.max_vmdq_pools);
+
+ printf("Current number of RX queues: %u\n", dev_info.nb_rx_queues);
printf("Max possible RX queues: %u\n", dev_info.max_rx_queues);
printf("Max possible number of RXDs per queue: %hu\n",
dev_info.rx_desc_lim.nb_max);
@@ -529,6 +510,7 @@ port_infos_display(portid_t port_id)
dev_info.rx_desc_lim.nb_min);
printf("RXDs number alignment: %hu\n", dev_info.rx_desc_lim.nb_align);
+ printf("Current number of TX queues: %u\n", dev_info.nb_tx_queues);
printf("Max possible TX queues: %u\n", dev_info.max_tx_queues);
printf("Max possible number of TXDs per queue: %hu\n",
dev_info.tx_desc_lim.nb_max);
@@ -540,14 +522,12 @@ port_infos_display(portid_t port_id)
void
port_offload_cap_display(portid_t port_id)
{
- struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
static const char *info_border = "************";
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
- dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
printf("\n%s Port %d supported offload features: %s\n",
@@ -555,7 +535,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) {
printf("VLAN stripped: ");
- if (dev->data->dev_conf.rxmode.hw_vlan_strip)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_VLAN_STRIP)
printf("on\n");
else
printf("off\n");
@@ -563,7 +544,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_QINQ_STRIP) {
printf("Double VLANs stripped: ");
- if (dev->data->dev_conf.rxmode.hw_vlan_extend)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_VLAN_EXTEND)
printf("on\n");
else
printf("off\n");
@@ -571,7 +553,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) {
printf("RX IPv4 checksum: ");
- if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_IPV4_CKSUM)
printf("on\n");
else
printf("off\n");
@@ -579,7 +562,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) {
printf("RX UDP checksum: ");
- if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_UDP_CKSUM)
printf("on\n");
else
printf("off\n");
@@ -587,18 +571,26 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) {
printf("RX TCP checksum: ");
- if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_TCP_CKSUM)
printf("on\n");
else
printf("off\n");
}
- if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM)
- printf("RX Outer IPv4 checksum: on");
+ if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) {
+ printf("RX Outer IPv4 checksum: ");
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM)
+ printf("on\n");
+ else
+ printf("off\n");
+ }
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) {
printf("Large receive offload: ");
- if (dev->data->dev_conf.rxmode.enable_lro)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_TCP_LRO)
printf("on\n");
else
printf("off\n");
@@ -606,8 +598,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) {
printf("VLAN insert: ");
- if (ports[port_id].tx_ol_flags &
- TESTPMD_TX_OFFLOAD_INSERT_VLAN)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_VLAN_INSERT)
printf("on\n");
else
printf("off\n");
@@ -615,7 +607,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) {
printf("HW timestamp: ");
- if (dev->data->dev_conf.rxmode.hw_timestamp)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_TIMESTAMP)
printf("on\n");
else
printf("off\n");
@@ -623,8 +616,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) {
printf("Double VLANs insert: ");
- if (ports[port_id].tx_ol_flags &
- TESTPMD_TX_OFFLOAD_INSERT_QINQ)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_QINQ_INSERT)
printf("on\n");
else
printf("off\n");
@@ -632,7 +625,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) {
printf("TX IPv4 checksum: ");
- if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_IPV4_CKSUM)
printf("on\n");
else
printf("off\n");
@@ -640,7 +634,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) {
printf("TX UDP checksum: ");
- if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_UDP_CKSUM)
printf("on\n");
else
printf("off\n");
@@ -648,7 +643,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) {
printf("TX TCP checksum: ");
- if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_TCP_CKSUM)
printf("on\n");
else
printf("off\n");
@@ -656,7 +652,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) {
printf("TX SCTP checksum: ");
- if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_SCTP_CKSUM)
printf("on\n");
else
printf("off\n");
@@ -664,8 +661,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) {
printf("TX Outer IPv4 checksum: ");
- if (ports[port_id].tx_ol_flags &
- TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)
printf("on\n");
else
printf("off\n");
@@ -673,7 +670,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) {
printf("TX TCP segmentation: ");
- if (ports[port_id].tso_segsz != 0)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_TCP_TSO)
printf("on\n");
else
printf("off\n");
@@ -681,7 +679,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TSO) {
printf("TX UDP segmentation: ");
- if (ports[port_id].tso_segsz != 0)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_UDP_TSO)
printf("on\n");
else
printf("off\n");
@@ -689,7 +688,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO) {
printf("TSO for VXLAN tunnel packet: ");
- if (ports[port_id].tunnel_tso_segsz)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_VXLAN_TNL_TSO)
printf("on\n");
else
printf("off\n");
@@ -697,7 +697,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO) {
printf("TSO for GRE tunnel packet: ");
- if (ports[port_id].tunnel_tso_segsz)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_GRE_TNL_TSO)
printf("on\n");
else
printf("off\n");
@@ -705,7 +706,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO) {
printf("TSO for IPIP tunnel packet: ");
- if (ports[port_id].tunnel_tso_segsz)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_IPIP_TNL_TSO)
printf("on\n");
else
printf("off\n");
@@ -713,7 +715,8 @@ port_offload_cap_display(portid_t port_id)
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO) {
printf("TSO for GENEVE tunnel packet: ");
- if (ports[port_id].tunnel_tso_segsz)
+ if (ports[port_id].dev_conf.txmode.offloads &
+ DEV_TX_OFFLOAD_GENEVE_TNL_TSO)
printf("on\n");
else
printf("off\n");
@@ -724,11 +727,14 @@ port_offload_cap_display(portid_t port_id)
int
port_id_is_invalid(portid_t port_id, enum print_warning warning)
{
+ uint16_t pid;
+
if (port_id == (portid_t)RTE_PORT_ALL)
return 0;
- if (rte_eth_dev_is_valid_port(port_id))
- return 0;
+ RTE_ETH_FOREACH_DEV(pid)
+ if (port_id == pid)
+ return 0;
if (warning == ENABLED_WARN)
printf("Invalid port %d\n", port_id);
@@ -973,6 +979,7 @@ static const struct {
MK_FLOW_ITEM(GTP, sizeof(struct rte_flow_item_gtp)),
MK_FLOW_ITEM(GTPC, sizeof(struct rte_flow_item_gtp)),
MK_FLOW_ITEM(GTPU, sizeof(struct rte_flow_item_gtp)),
+ MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)),
};
/** Compute storage space needed by item specification. */
@@ -1026,6 +1033,7 @@ static const struct {
MK_FLOW_ACTION(RSS, sizeof(struct rte_flow_action_rss)), /* +queue[] */
MK_FLOW_ACTION(PF, 0),
MK_FLOW_ACTION(VF, sizeof(struct rte_flow_action_vf)),
+ MK_FLOW_ACTION(METER, sizeof(struct rte_flow_action_meter)),
};
/** Compute storage space needed by action configuration. */
@@ -1655,33 +1663,46 @@ fwd_lcores_config_display(void)
void
rxtx_config_display(void)
{
- printf(" %s packet forwarding%s - CRC stripping %s - "
- "packets/burst=%d\n", cur_fwd_eng->fwd_mode_name,
+ portid_t pid;
+
+ printf(" %s packet forwarding%s packets/burst=%d\n",
+ cur_fwd_eng->fwd_mode_name,
retry_enabled == 0 ? "" : " with retry",
- rx_mode.hw_strip_crc ? "enabled" : "disabled",
nb_pkt_per_burst);
if (cur_fwd_eng == &tx_only_engine || cur_fwd_eng == &flow_gen_engine)
printf(" packet len=%u - nb packet segments=%d\n",
(unsigned)tx_pkt_length, (int) tx_pkt_nb_segs);
- struct rte_eth_rxconf *rx_conf = &ports[0].rx_conf;
- struct rte_eth_txconf *tx_conf = &ports[0].tx_conf;
-
printf(" nb forwarding cores=%d - nb forwarding ports=%d\n",
nb_fwd_lcores, nb_fwd_ports);
- printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n",
- nb_rxq, nb_rxd, rx_conf->rx_free_thresh);
- printf(" RX threshold registers: pthresh=%d hthresh=%d wthresh=%d\n",
- rx_conf->rx_thresh.pthresh, rx_conf->rx_thresh.hthresh,
- rx_conf->rx_thresh.wthresh);
- printf(" TX queues=%d - TX desc=%d - TX free threshold=%d\n",
- nb_txq, nb_txd, tx_conf->tx_free_thresh);
- printf(" TX threshold registers: pthresh=%d hthresh=%d wthresh=%d\n",
- tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh,
- tx_conf->tx_thresh.wthresh);
- printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n",
- tx_conf->tx_rs_thresh, tx_conf->txq_flags);
+
+ RTE_ETH_FOREACH_DEV(pid) {
+ struct rte_eth_rxconf *rx_conf = &ports[pid].rx_conf;
+ struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf;
+
+ printf(" port %d:\n", (unsigned int)pid);
+ printf(" CRC stripping %s\n",
+ (ports[pid].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_CRC_STRIP) ?
+ "enabled" : "disabled");
+ printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n",
+ nb_rxq, nb_rxd, rx_conf->rx_free_thresh);
+ printf(" RX threshold registers: pthresh=%d hthresh=%d "
+ " wthresh=%d\n",
+ rx_conf->rx_thresh.pthresh,
+ rx_conf->rx_thresh.hthresh,
+ rx_conf->rx_thresh.wthresh);
+ printf(" TX queues=%d - TX desc=%d - TX free threshold=%d\n",
+ nb_txq, nb_txd, tx_conf->tx_free_thresh);
+ printf(" TX threshold registers: pthresh=%d hthresh=%d "
+ " wthresh=%d\n",
+ tx_conf->tx_thresh.pthresh,
+ tx_conf->tx_thresh.hthresh,
+ tx_conf->tx_thresh.wthresh);
+ printf(" TX RS bit threshold=%d - TXQ offloads=0x%"PRIx64"\n",
+ tx_conf->tx_rs_thresh, tx_conf->offloads);
+ }
}
void
@@ -1861,23 +1882,40 @@ setup_fwd_config_of_each_lcore(struct fwd_config *cfg)
}
}
+static portid_t
+fwd_topology_tx_port_get(portid_t rxp)
+{
+ static int warning_once = 1;
+
+ RTE_ASSERT(rxp < cur_fwd_config.nb_fwd_ports);
+
+ switch (port_topology) {
+ default:
+ case PORT_TOPOLOGY_PAIRED:
+ if ((rxp & 0x1) == 0) {
+ if (rxp + 1 < cur_fwd_config.nb_fwd_ports)
+ return rxp + 1;
+ if (warning_once) {
+ printf("\nWarning! port-topology=paired"
+ " and odd forward ports number,"
+ " the last port will pair with"
+ " itself.\n\n");
+ warning_once = 0;
+ }
+ return rxp;
+ }
+ return rxp - 1;
+ case PORT_TOPOLOGY_CHAINED:
+ return (rxp + 1) % cur_fwd_config.nb_fwd_ports;
+ case PORT_TOPOLOGY_LOOP:
+ return rxp;
+ }
+}
+
static void
simple_fwd_config_setup(void)
{
portid_t i;
- portid_t j;
- portid_t inc = 2;
-
- if (port_topology == PORT_TOPOLOGY_CHAINED ||
- port_topology == PORT_TOPOLOGY_LOOP) {
- inc = 1;
- } else if (nb_fwd_ports % 2) {
- printf("\nWarning! Cannot handle an odd number of ports "
- "with the current port topology. Configuration "
- "must be changed to have an even number of ports, "
- "or relaunch application with "
- "--port-topology=chained\n\n");
- }
cur_fwd_config.nb_fwd_ports = (portid_t) nb_fwd_ports;
cur_fwd_config.nb_fwd_streams =
@@ -1896,26 +1934,14 @@ simple_fwd_config_setup(void)
(lcoreid_t) cur_fwd_config.nb_fwd_ports;
setup_fwd_config_of_each_lcore(&cur_fwd_config);
- for (i = 0; i < cur_fwd_config.nb_fwd_ports; i = (portid_t) (i + inc)) {
- if (port_topology != PORT_TOPOLOGY_LOOP)
- j = (portid_t) ((i + 1) % cur_fwd_config.nb_fwd_ports);
- else
- j = i;
+ for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
fwd_streams[i]->rx_port = fwd_ports_ids[i];
fwd_streams[i]->rx_queue = 0;
- fwd_streams[i]->tx_port = fwd_ports_ids[j];
+ fwd_streams[i]->tx_port =
+ fwd_ports_ids[fwd_topology_tx_port_get(i)];
fwd_streams[i]->tx_queue = 0;
fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
fwd_streams[i]->retry_enabled = retry_enabled;
-
- if (port_topology == PORT_TOPOLOGY_PAIRED) {
- fwd_streams[j]->rx_port = fwd_ports_ids[j];
- fwd_streams[j]->rx_queue = 0;
- fwd_streams[j]->tx_port = fwd_ports_ids[i];
- fwd_streams[j]->tx_queue = 0;
- fwd_streams[j]->peer_addr = fwd_streams[j]->tx_port;
- fwd_streams[j]->retry_enabled = retry_enabled;
- }
}
}
@@ -1923,11 +1949,6 @@ simple_fwd_config_setup(void)
* For the RSS forwarding test all streams distributed over lcores. Each stream
* being composed of a RX queue to poll on a RX port for input messages,
* associated with a TX queue of a TX port where to send forwarded packets.
- * All packets received on the RX queue of index "RxQj" of the RX port "RxPi"
- * are sent on the TX queue "TxQl" of the TX port "TxPk" according to the two
- * following rules:
- * - TxPk = (RxPi + 1) if RxPi is even, (RxPi - 1) if RxPi is odd
- * - TxQl = RxQj
*/
static void
rss_fwd_config_setup(void)
@@ -1959,18 +1980,7 @@ rss_fwd_config_setup(void)
struct fwd_stream *fs;
fs = fwd_streams[sm_id];
-
- if ((rxp & 0x1) == 0)
- txp = (portid_t) (rxp + 1);
- else
- txp = (portid_t) (rxp - 1);
- /*
- * if we are in loopback, simply send stuff out through the
- * ingress port
- */
- if (port_topology == PORT_TOPOLOGY_LOOP)
- txp = rxp;
-
+ txp = fwd_topology_tx_port_get(rxp);
fs->rx_port = fwd_ports_ids[rxp];
fs->rx_queue = rxq;
fs->tx_port = fwd_ports_ids[txp];
@@ -1985,11 +1995,7 @@ rss_fwd_config_setup(void)
* Restart from RX queue 0 on next RX port
*/
rxq = 0;
- if (numa_support && (nb_fwd_ports <= (nb_ports >> 1)))
- rxp = (portid_t)
- (rxp + ((nb_ports >> 1) / nb_fwd_ports));
- else
- rxp = (portid_t) (rxp + 1);
+ rxp++;
}
}
@@ -2194,6 +2200,24 @@ pkt_fwd_config_display(struct fwd_config *cfg)
printf("\n");
}
+void
+set_fwd_eth_peer(portid_t port_id, char *peer_addr)
+{
+ uint8_t c, new_peer_addr[6];
+ if (!rte_eth_dev_is_valid_port(port_id)) {
+ printf("Error: Invalid port number %i\n", port_id);
+ return;
+ }
+ if (cmdline_parse_etheraddr(NULL, peer_addr, &new_peer_addr,
+ sizeof(new_peer_addr)) < 0) {
+ printf("Error: Invalid ethernet address: %s\n", peer_addr);
+ return;
+ }
+ for (c = 0; c < 6; c++)
+ peer_eth_addrs[port_id].addr_bytes[c] =
+ new_peer_addr[c];
+}
+
int
set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc)
{
@@ -2631,21 +2655,26 @@ vlan_extend_set(portid_t port_id, int on)
{
int diag;
int vlan_offload;
+ uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
- if (on)
+ if (on) {
vlan_offload |= ETH_VLAN_EXTEND_OFFLOAD;
- else
+ port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
+ } else {
vlan_offload &= ~ETH_VLAN_EXTEND_OFFLOAD;
+ port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND;
+ }
diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
if (diag < 0)
printf("rx_vlan_extend_set(port_pi=%d, on=%d) failed "
"diag=%d\n", port_id, on, diag);
+ ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
}
void
@@ -2653,21 +2682,26 @@ rx_vlan_strip_set(portid_t port_id, int on)
{
int diag;
int vlan_offload;
+ uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
- if (on)
+ if (on) {
vlan_offload |= ETH_VLAN_STRIP_OFFLOAD;
- else
+ port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
+ } else {
vlan_offload &= ~ETH_VLAN_STRIP_OFFLOAD;
+ port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
+ }
diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
if (diag < 0)
printf("rx_vlan_strip_set(port_pi=%d, on=%d) failed "
"diag=%d\n", port_id, on, diag);
+ ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
}
void
@@ -2689,21 +2723,26 @@ rx_vlan_filter_set(portid_t port_id, int on)
{
int diag;
int vlan_offload;
+ uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
- if (on)
+ if (on) {
vlan_offload |= ETH_VLAN_FILTER_OFFLOAD;
- else
+ port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
+ } else {
vlan_offload &= ~ETH_VLAN_FILTER_OFFLOAD;
+ port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER;
+ }
diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
if (diag < 0)
printf("rx_vlan_filter_set(port_pi=%d, on=%d) failed "
"diag=%d\n", port_id, on, diag);
+ ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
}
int
@@ -2758,6 +2797,8 @@ void
tx_vlan_set(portid_t port_id, uint16_t vlan_id)
{
int vlan_offload;
+ struct rte_eth_dev_info dev_info;
+
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
if (vlan_id_is_invalid(vlan_id))
@@ -2768,9 +2809,15 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
printf("Error, as QinQ has been enabled.\n");
return;
}
+ rte_eth_dev_info_get(port_id, &dev_info);
+ if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) {
+ printf("Error: vlan insert is not supported by port %d\n",
+ port_id);
+ return;
+ }
tx_vlan_reset(port_id);
- ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN;
+ ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT;
ports[port_id].tx_vlan_id = vlan_id;
}
@@ -2778,6 +2825,8 @@ void
tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
{
int vlan_offload;
+ struct rte_eth_dev_info dev_info;
+
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
if (vlan_id_is_invalid(vlan_id))
@@ -2790,9 +2839,15 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
printf("Error, as QinQ hasn't been enabled.\n");
return;
}
+ rte_eth_dev_info_get(port_id, &dev_info);
+ if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) {
+ printf("Error: qinq insert not supported by port %d\n",
+ port_id);
+ return;
+ }
tx_vlan_reset(port_id);
- ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ;
+ ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT;
ports[port_id].tx_vlan_id = vlan_id;
ports[port_id].tx_vlan_id_outer = vlan_id_outer;
}
@@ -2802,8 +2857,9 @@ tx_vlan_reset(portid_t port_id)
{
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
- ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN |
- TESTPMD_TX_OFFLOAD_INSERT_QINQ);
+ ports[port_id].dev_conf.txmode.offloads &=
+ ~(DEV_TX_OFFLOAD_VLAN_INSERT |
+ DEV_TX_OFFLOAD_QINQ_INSERT);
ports[port_id].tx_vlan_id = 0;
ports[port_id].tx_vlan_id_outer = 0;
}
@@ -3401,7 +3457,7 @@ port_dcb_info_display(portid_t port_id)
}
uint8_t *
-open_ddp_package_file(const char *file_path, uint32_t *size)
+open_file(const char *file_path, uint32_t *size)
{
int fd = open(file_path, O_RDONLY);
off_t pkg_size;
@@ -3441,7 +3497,7 @@ open_ddp_package_file(const char *file_path, uint32_t *size)
if (ret < 0) {
close(fd);
printf("%s: File read operation failed\n", __func__);
- close_ddp_package_file(buf);
+ close_file(buf);
return NULL;
}
@@ -3454,7 +3510,7 @@ open_ddp_package_file(const char *file_path, uint32_t *size)
}
int
-save_ddp_package_file(const char *file_path, uint8_t *buf, uint32_t size)
+save_file(const char *file_path, uint8_t *buf, uint32_t size)
{
FILE *fh = fopen(file_path, "wb");
@@ -3475,7 +3531,7 @@ save_ddp_package_file(const char *file_path, uint8_t *buf, uint32_t size)
}
int
-close_ddp_package_file(uint8_t *buf)
+close_file(uint8_t *buf)
{
if (buf) {
free((void *)buf);
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index aa29f5fc..5f5ab64a 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -1,35 +1,6 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * Copyright 2014 6WIND S.A.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation.
+ * Copyright 2014 6WIND S.A.
*/
#include <stdarg.h>
@@ -316,7 +287,7 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info)
* depending on the testpmd command line configuration */
static uint64_t
process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
- uint16_t testpmd_ol_flags)
+ uint64_t tx_offloads)
{
struct ipv4_hdr *ipv4_hdr = l3_hdr;
struct udp_hdr *udp_hdr;
@@ -347,7 +318,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
if (info->l4_proto == IPPROTO_TCP && tso_segsz) {
ol_flags |= PKT_TX_IP_CKSUM;
} else {
- if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM)
+ if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)
ol_flags |= PKT_TX_IP_CKSUM;
else
ipv4_hdr->hdr_checksum =
@@ -363,7 +334,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
/* do not recalculate udp cksum if it was 0 */
if (udp_hdr->dgram_cksum != 0) {
udp_hdr->dgram_cksum = 0;
- if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM)
+ if (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM)
ol_flags |= PKT_TX_UDP_CKSUM;
else {
udp_hdr->dgram_cksum =
@@ -376,7 +347,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
tcp_hdr->cksum = 0;
if (tso_segsz)
ol_flags |= PKT_TX_TCP_SEG;
- else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM)
+ else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM)
ol_flags |= PKT_TX_TCP_CKSUM;
else {
tcp_hdr->cksum =
@@ -390,7 +361,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
sctp_hdr->cksum = 0;
/* sctp payload must be a multiple of 4 to be
* offloaded */
- if ((testpmd_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) &&
+ if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
((ipv4_hdr->total_length & 0x3) == 0)) {
ol_flags |= PKT_TX_SCTP_CKSUM;
} else {
@@ -405,7 +376,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
/* Calculate the checksum of outer header */
static uint64_t
process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,
- uint16_t testpmd_ol_flags, int tso_enabled)
+ uint64_t tx_offloads, int tso_enabled)
{
struct ipv4_hdr *ipv4_hdr = outer_l3_hdr;
struct ipv6_hdr *ipv6_hdr = outer_l3_hdr;
@@ -416,7 +387,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,
ipv4_hdr->hdr_checksum = 0;
ol_flags |= PKT_TX_OUTER_IPV4;
- if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)
+ if (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)
ol_flags |= PKT_TX_OUTER_IP_CKSUM;
else
ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr);
@@ -563,7 +534,7 @@ pkt_copy_split(const struct rte_mbuf *pkt)
while (i != 0) {
p = rte_pktmbuf_alloc(mp);
if (p == NULL) {
- RTE_LOG(ERR, USER1,
+ TESTPMD_LOG(ERR,
"failed to allocate %u-th of %u mbuf "
"from mempool: %s\n",
nb_seg - i, nb_seg, mp->name);
@@ -572,7 +543,7 @@ pkt_copy_split(const struct rte_mbuf *pkt)
md[--i] = p;
if (rte_pktmbuf_tailroom(md[i]) < seglen[i]) {
- RTE_LOG(ERR, USER1, "mempool %s, %u-th segment: "
+ TESTPMD_LOG(ERR, "mempool %s, %u-th segment: "
"expected seglen: %u, "
"actual mbuf tailroom: %u\n",
mp->name, i, seglen[i],
@@ -585,7 +556,7 @@ pkt_copy_split(const struct rte_mbuf *pkt)
if (i == 0) {
rc = mbuf_copy_split(pkt, md, seglen, nb_seg);
if (rc < 0)
- RTE_LOG(ERR, USER1,
+ TESTPMD_LOG(ERR,
"mbuf_copy_split for %p(len=%u, nb_seg=%u) "
"into %u segments failed with error code: %d\n",
pkt, pkt->pkt_len, pkt->nb_segs, nb_seg, rc);
@@ -646,7 +617,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
uint16_t nb_prep;
uint16_t i;
uint64_t rx_ol_flags, tx_ol_flags;
- uint16_t testpmd_ol_flags;
+ uint64_t tx_offloads;
uint32_t retry;
uint32_t rx_bad_ip_csum;
uint32_t rx_bad_l4_csum;
@@ -678,7 +649,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
gro_enable = gro_ports[fs->rx_port].enable;
txp = &ports[fs->tx_port];
- testpmd_ol_flags = txp->tx_ol_flags;
+ tx_offloads = txp->dev_conf.txmode.offloads;
memset(&info, 0, sizeof(info));
info.tso_segsz = txp->tso_segsz;
info.tunnel_tso_segsz = txp->tunnel_tso_segsz;
@@ -714,7 +685,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
l3_hdr = (char *)eth_hdr + info.l2_len;
/* check if it's a supported tunnel */
- if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) {
+ if (txp->parse_tunnel) {
if (info.l4_proto == IPPROTO_UDP) {
struct udp_hdr *udp_hdr;
@@ -754,14 +725,14 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
/* process checksums of inner headers first */
tx_ol_flags |= process_inner_cksums(l3_hdr, &info,
- testpmd_ol_flags);
+ tx_offloads);
/* Then process outer headers if any. Note that the software
* checksum will be wrong if one of the inner checksums is
* processed in hardware. */
if (info.is_tunnel == 1) {
tx_ol_flags |= process_outer_cksums(outer_l3_hdr, &info,
- testpmd_ol_flags,
+ tx_offloads,
!!(tx_ol_flags & PKT_TX_TCP_SEG));
}
@@ -769,8 +740,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
if (info.is_tunnel == 1) {
if (info.tunnel_tso_segsz ||
- (testpmd_ol_flags &
- TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ||
+ (tx_offloads &
+ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ||
(tx_ol_flags & PKT_TX_OUTER_IPV6)) {
m->outer_l2_len = info.outer_l2_len;
m->outer_l3_len = info.outer_l3_len;
@@ -832,17 +803,17 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
rte_be_to_cpu_16(info.outer_ethertype),
info.outer_l3_len);
/* dump tx packet info */
- if ((testpmd_ol_flags & (TESTPMD_TX_OFFLOAD_IP_CKSUM |
- TESTPMD_TX_OFFLOAD_UDP_CKSUM |
- TESTPMD_TX_OFFLOAD_TCP_CKSUM |
- TESTPMD_TX_OFFLOAD_SCTP_CKSUM)) ||
+ if ((tx_offloads & (DEV_TX_OFFLOAD_IPV4_CKSUM |
+ DEV_TX_OFFLOAD_UDP_CKSUM |
+ DEV_TX_OFFLOAD_TCP_CKSUM |
+ DEV_TX_OFFLOAD_SCTP_CKSUM)) ||
info.tso_segsz != 0)
printf("tx: m->l2_len=%d m->l3_len=%d "
"m->l4_len=%d\n",
m->l2_len, m->l3_len, m->l4_len);
if (info.is_tunnel == 1) {
- if ((testpmd_ol_flags &
- TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ||
+ if ((tx_offloads &
+ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ||
(tx_ol_flags & PKT_TX_OUTER_IPV6))
printf("tx: m->outer_l2_len=%d "
"m->outer_l3_len=%d\n",
@@ -895,8 +866,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
if (ret >= 0)
nb_segments += ret;
else {
- RTE_LOG(DEBUG, USER1,
- "Unable to segment packet");
+ TESTPMD_LOG(DEBUG, "Unable to segment packet");
rte_pktmbuf_free(pkts_burst[i]);
}
}
diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index acf9af94..0531b5d2 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -123,12 +123,13 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
struct ipv4_hdr *ip_hdr;
struct udp_hdr *udp_hdr;
uint16_t vlan_tci, vlan_tci_outer;
- uint16_t ol_flags;
+ uint64_t ol_flags;
uint16_t nb_rx;
uint16_t nb_tx;
uint16_t nb_pkt;
uint16_t i;
uint32_t retry;
+ uint64_t tx_offloads;
#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
uint64_t start_tsc;
uint64_t end_tsc;
@@ -151,7 +152,14 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
mbp = current_fwd_lcore()->mbp;
vlan_tci = ports[fs->tx_port].tx_vlan_id;
vlan_tci_outer = ports[fs->tx_port].tx_vlan_id_outer;
- ol_flags = ports[fs->tx_port].tx_ol_flags;
+
+ tx_offloads = ports[fs->tx_port].dev_conf.txmode.offloads;
+ if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT)
+ ol_flags = PKT_TX_VLAN_PKT;
+ if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT)
+ ol_flags |= PKT_TX_QINQ_PKT;
+ if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT)
+ ol_flags |= PKT_TX_MACSEC;
for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) {
pkt = rte_mbuf_raw_alloc(mbp);
diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c
index d4b4c9eb..55d266d7 100644
--- a/app/test-pmd/icmpecho.c
+++ b/app/test-pmd/icmpecho.c
@@ -1,35 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2013 6WIND
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of 6WIND S.A. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2013 6WIND S.A.
*/
#include <stdarg.h>
diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c
index 91ee7864..6ae802c8 100644
--- a/app/test-pmd/ieee1588fwd.c
+++ b/app/test-pmd/ieee1588fwd.c
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2015 Intel Corporation
*/
diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c
index ff6de45c..9dce76ef 100644
--- a/app/test-pmd/iofwd.c
+++ b/app/test-pmd/iofwd.c
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
*/
#include <stdarg.h>
diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c
index f4a4bf29..2adce701 100644
--- a/app/test-pmd/macfwd.c
+++ b/app/test-pmd/macfwd.c
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
*/
#include <stdarg.h>
@@ -84,6 +55,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
uint16_t nb_tx;
uint16_t i;
uint64_t ol_flags = 0;
+ uint64_t tx_offloads;
#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
uint64_t start_tsc;
uint64_t end_tsc;
@@ -107,11 +79,12 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
#endif
fs->rx_packets += nb_rx;
txp = &ports[fs->tx_port];
- if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN)
+ tx_offloads = txp->dev_conf.txmode.offloads;
+ if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT)
ol_flags = PKT_TX_VLAN_PKT;
- if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ)
+ if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT)
ol_flags |= PKT_TX_QINQ_PKT;
- if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC)
+ if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT)
ol_flags |= PKT_TX_MACSEC;
for (i = 0; i < nb_rx; i++) {
if (likely(i < nb_rx - 1))
diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
index 721865c9..e2cc4812 100644
--- a/app/test-pmd/macswap.c
+++ b/app/test-pmd/macswap.c
@@ -84,6 +84,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
uint16_t i;
uint32_t retry;
uint64_t ol_flags = 0;
+ uint64_t tx_offloads;
#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
uint64_t start_tsc;
uint64_t end_tsc;
@@ -107,11 +108,12 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
#endif
fs->rx_packets += nb_rx;
txp = &ports[fs->tx_port];
- if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN)
+ tx_offloads = txp->dev_conf.txmode.offloads;
+ if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT)
ol_flags = PKT_TX_VLAN_PKT;
- if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ)
+ if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT)
ol_flags |= PKT_TX_QINQ_PKT;
- if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC)
+ if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT)
ol_flags |= PKT_TX_MACSEC;
for (i = 0; i < nb_rx; i++) {
if (likely(i < nb_rx - 1))
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
new file mode 100644
index 00000000..7ed74db2
--- /dev/null
+++ b/app/test-pmd/meson.build
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2017 Intel Corporation
+
+sources = files('cmdline.c',
+ 'cmdline_flow.c',
+ 'cmdline_mtr.c',
+ 'cmdline_tm.c',
+ 'config.c',
+ 'csumonly.c',
+ 'flowgen.c',
+ 'icmpecho.c',
+ 'ieee1588fwd.c',
+ 'iofwd.c',
+ 'macfwd.c',
+ 'macswap.c',
+ 'parameters.c',
+ 'rxonly.c',
+ 'testpmd.c',
+ 'txonly.c')
+
+deps = ['ethdev', 'gro', 'gso', 'cmdline', 'metrics', 'meter', 'bus_pci']
+if dpdk_conf.has('RTE_LIBRTE_PDUMP')
+ deps += 'pdump'
+endif
+if dpdk_conf.has('RTE_LIBRTE_I40E_PMD')
+ deps += 'pmd_i40e'
+endif
+if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD')
+ deps += 'pmd_ixgbe'
+endif
+if dpdk_conf.has('RTE_LIBRTE_SOFTNIC_PMD')
+ sources += files('tm.c')
+ deps += 'pmd_softnic'
+endif
+
+dep_objs = []
+foreach d:deps
+ dep_objs += get_variable(get_option('default_library') + '_rte_' + d)
+endforeach
+dep_objs += cc.find_library('execinfo', required: false) # for BSD only
+
+link_libs = []
+if get_option('default_library') == 'static'
+ link_libs = dpdk_drivers
+endif
+
+executable('dpdk-testpmd',
+ sources,
+ c_args: [machine_args, '-DALLOW_EXPERIMENTAL_API'],
+ link_whole: link_libs,
+ dependencies: dep_objs,
+ install_rpath: join_paths(get_option('prefix'), driver_install_path),
+ install: true)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 84e7a63e..97d22b86 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2017 Intel Corporation
*/
#include <errno.h>
@@ -99,7 +70,7 @@ usage(char* progname)
"--rss-ip | --rss-udp | "
"--rxpt= | --rxht= | --rxwt= | --rxfreet= | "
"--txpt= | --txht= | --txwt= | --txfreet= | "
- "--txrst= | --txqflags= ]\n",
+ "--txrst= | --tx-offloads ]\n",
progname);
#ifdef RTE_LIBRTE_CMDLINE
printf(" --interactive: run in interactive mode.\n");
@@ -162,10 +133,10 @@ usage(char* progname)
printf(" --enable-lro: enable large receive offload.\n");
printf(" --enable-rx-cksum: enable rx hardware checksum offload.\n");
printf(" --enable-rx-timestamp: enable rx hardware timestamp offload.\n");
- printf(" --disable-hw-vlan: disable hardware vlan.\n");
- printf(" --disable-hw-vlan-filter: disable hardware vlan filter.\n");
- printf(" --disable-hw-vlan-strip: disable hardware vlan strip.\n");
- printf(" --disable-hw-vlan-extend: disable hardware vlan extend.\n");
+ printf(" --enable-hw-vlan: enable hardware vlan.\n");
+ printf(" --enable-hw-vlan-filter: enable hardware vlan filter.\n");
+ printf(" --enable-hw-vlan-strip: enable hardware vlan strip.\n");
+ printf(" --enable-hw-vlan-extend: enable hardware vlan extend.\n");
printf(" --enable-drop-en: enable per queue packet drop.\n");
printf(" --disable-rss: disable rss.\n");
printf(" --port-topology=N: set port topology (N: paired (default) or "
@@ -192,8 +163,6 @@ usage(char* progname)
"(0 <= N <= value of txd).\n");
printf(" --txrst=N: set the transmit RS bit threshold of TX rings to N "
"(0 <= N <= value of txd).\n");
- printf(" --txqflags=0xXXXXXXXX: hexadecimal bitmask of TX queue flags "
- "(0 <= N <= 0x7FFFFFFF).\n");
printf(" --tx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: "
"tx queues statistics counters mapping "
"(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
@@ -216,6 +185,7 @@ usage(char* progname)
"disable print of designated event or all of them.\n");
printf(" --flow-isolate-all: "
"requests flow API isolated mode on all ports at initialization time.\n");
+ printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n");
}
#ifdef RTE_LIBRTE_CMDLINE
@@ -546,6 +516,10 @@ parse_event_printing_config(const char *optarg, int enable)
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, "dev_probed"))
+ mask = UINT32_C(1) << RTE_ETH_EVENT_NEW;
+ else if (!strcmp(optarg, "dev_released"))
+ mask = UINT32_C(1) << RTE_ETH_EVENT_DESTROY;
else if (!strcmp(optarg, "all"))
mask = ~UINT32_C(0);
else {
@@ -565,7 +539,11 @@ launch_args_parse(int argc, char** argv)
int n, opt;
char **argvopt;
int opt_idx;
+ portid_t pid;
enum { TX, RX };
+ /* Default offloads for all ports. */
+ uint64_t rx_offloads = rx_mode.offloads;
+ uint64_t tx_offloads = tx_mode.offloads;
static struct option lgopts[] = {
{ "help", 0, 0, 0 },
@@ -607,10 +585,10 @@ launch_args_parse(int argc, char** argv)
{ "enable-rx-cksum", 0, 0, 0 },
{ "enable-rx-timestamp", 0, 0, 0 },
{ "enable-scatter", 0, 0, 0 },
- { "disable-hw-vlan", 0, 0, 0 },
- { "disable-hw-vlan-filter", 0, 0, 0 },
- { "disable-hw-vlan-strip", 0, 0, 0 },
- { "disable-hw-vlan-extend", 0, 0, 0 },
+ { "enable-hw-vlan", 0, 0, 0 },
+ { "enable-hw-vlan-filter", 0, 0, 0 },
+ { "enable-hw-vlan-strip", 0, 0, 0 },
+ { "enable-hw-vlan-extend", 0, 0, 0 },
{ "enable-drop-en", 0, 0, 0 },
{ "disable-rss", 0, 0, 0 },
{ "port-topology", 1, 0, 0 },
@@ -628,7 +606,6 @@ launch_args_parse(int argc, char** argv)
{ "txwt", 1, 0, 0 },
{ "txfreet", 1, 0, 0 },
{ "txrst", 1, 0, 0 },
- { "txqflags", 1, 0, 0 },
{ "rxpt", 1, 0, 0 },
{ "rxht", 1, 0, 0 },
{ "rxwt", 1, 0, 0 },
@@ -643,6 +620,7 @@ launch_args_parse(int argc, char** argv)
{ "no-rmv-interrupt", 0, 0, 0 },
{ "print-event", 1, 0, 0 },
{ "mask-event", 1, 0, 0 },
+ { "tx-offloads", 1, 0, 0 },
{ 0, 0, 0, 0 },
};
@@ -804,7 +782,8 @@ launch_args_parse(int argc, char** argv)
if (n >= ETHER_MIN_LEN) {
rx_mode.max_rx_pkt_len = (uint32_t) n;
if (n > ETHER_MAX_LEN)
- rx_mode.jumbo_frame = 1;
+ rx_offloads |=
+ DEV_RX_OFFLOAD_JUMBO_FRAME;
} else
rte_exit(EXIT_FAILURE,
"Invalid max-pkt-len=%d - should be > %d\n",
@@ -897,34 +876,30 @@ launch_args_parse(int argc, char** argv)
}
#endif
if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip"))
- rx_mode.hw_strip_crc = 0;
+ rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP;
if (!strcmp(lgopts[opt_idx].name, "enable-lro"))
- rx_mode.enable_lro = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO;
if (!strcmp(lgopts[opt_idx].name, "enable-scatter"))
- rx_mode.enable_scatter = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_SCATTER;
if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum"))
- rx_mode.hw_ip_checksum = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM;
if (!strcmp(lgopts[opt_idx].name,
"enable-rx-timestamp"))
- rx_mode.hw_timestamp = 1;
-
- if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) {
- rx_mode.hw_vlan_filter = 0;
- rx_mode.hw_vlan_strip = 0;
- rx_mode.hw_vlan_extend = 0;
- }
+ rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
+ if (!strcmp(lgopts[opt_idx].name, "enable-hw-vlan"))
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN;
if (!strcmp(lgopts[opt_idx].name,
- "disable-hw-vlan-filter"))
- rx_mode.hw_vlan_filter = 0;
+ "enable-hw-vlan-filter"))
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
if (!strcmp(lgopts[opt_idx].name,
- "disable-hw-vlan-strip"))
- rx_mode.hw_vlan_strip = 0;
+ "enable-hw-vlan-strip"))
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
if (!strcmp(lgopts[opt_idx].name,
- "disable-hw-vlan-extend"))
- rx_mode.hw_vlan_extend = 0;
+ "enable-hw-vlan-extend"))
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
if (!strcmp(lgopts[opt_idx].name, "enable-drop-en"))
rx_drop_en = 1;
@@ -951,21 +926,21 @@ launch_args_parse(int argc, char** argv)
rss_hf = ETH_RSS_UDP;
if (!strcmp(lgopts[opt_idx].name, "rxq")) {
n = atoi(optarg);
- if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+ if (n >= 0 && check_nb_rxq((queueid_t)n) == 0)
nb_rxq = (queueid_t) n;
else
rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
- " >= 0 && <= %d\n", n,
- (int) MAX_QUEUE_ID);
+ " >= 0 && <= %u\n", n,
+ get_allowed_max_nb_rxq(&pid));
}
if (!strcmp(lgopts[opt_idx].name, "txq")) {
n = atoi(optarg);
- if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+ if (n >= 0 && check_nb_txq((queueid_t)n) == 0)
nb_txq = (queueid_t) n;
else
rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
- " >= 0 && <= %d\n", n,
- (int) MAX_QUEUE_ID);
+ " >= 0 && <= %u\n", n,
+ get_allowed_max_nb_txq(&pid));
}
if (!nb_rxq && !nb_txq) {
rte_exit(EXIT_FAILURE, "Either rx or tx queues should "
@@ -1004,15 +979,6 @@ launch_args_parse(int argc, char** argv)
else
rte_exit(EXIT_FAILURE, "txrst must be >= 0\n");
}
- if (!strcmp(lgopts[opt_idx].name, "txqflags")) {
- char *end = NULL;
- n = strtoul(optarg, &end, 16);
- if (n >= 0)
- txq_flags = (int32_t)n;
- else
- rte_exit(EXIT_FAILURE,
- "txqflags must be >= 0\n");
- }
if (!strcmp(lgopts[opt_idx].name, "rxd")) {
n = atoi(optarg);
if (n > 0) {
@@ -1117,6 +1083,15 @@ launch_args_parse(int argc, char** argv)
rmv_interrupt = 0;
if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all"))
flow_isolate_all = 1;
+ if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) {
+ char *end = NULL;
+ n = strtoull(optarg, &end, 16);
+ if (n >= 0)
+ tx_offloads = (uint64_t)n;
+ else
+ rte_exit(EXIT_FAILURE,
+ "tx-offloads must be >= 0\n");
+ }
if (!strcmp(lgopts[opt_idx].name, "print-event"))
if (parse_event_printing_config(optarg, 1)) {
rte_exit(EXIT_FAILURE,
@@ -1140,4 +1115,8 @@ launch_args_parse(int argc, char** argv)
break;
}
}
+
+ /* Set offload configuration from command line parameters. */
+ rx_mode.offloads = rx_offloads;
+ tx_mode.offloads = tx_offloads;
}
diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index fb6e8e33..a93d8061 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
*/
#include <stdarg.h>
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index c3ab4484..4c0e2586 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2017 Intel Corporation
*/
#include <stdarg.h>
@@ -67,6 +38,7 @@
#include <rte_mempool.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
#include <rte_ether.h>
@@ -91,6 +63,7 @@
#include "testpmd.h"
uint16_t verbose_level = 0; /**< Silent by default. */
+int testpmd_logtype; /**< Log type for testpmd logs */
/* use master core for command line ? */
uint8_t interactive = 0;
@@ -119,6 +92,24 @@ uint8_t socket_num = UMA_NO_CONFIG;
uint8_t mp_anon = 0;
/*
+ * Store specified sockets on which memory pool to be used by ports
+ * is allocated.
+ */
+uint8_t port_numa[RTE_MAX_ETHPORTS];
+
+/*
+ * Store specified sockets on which RX ring to be used by ports
+ * is allocated.
+ */
+uint8_t rxring_numa[RTE_MAX_ETHPORTS];
+
+/*
+ * Store specified sockets on which TX ring to be used by ports
+ * is allocated.
+ */
+uint8_t txring_numa[RTE_MAX_ETHPORTS];
+
+/*
* Record the Ethernet address of peer target ports to which packets are
* forwarded.
* Must be instantiated with the ethernet addresses of peer traffic generator
@@ -220,8 +211,8 @@ queueid_t nb_txq = 1; /**< Number of TX queues per port. */
/*
* Configurable number of RX/TX ring descriptors.
*/
-#define RTE_TEST_RX_DESC_DEFAULT 128
-#define RTE_TEST_TX_DESC_DEFAULT 512
+#define RTE_TEST_RX_DESC_DEFAULT 1024
+#define RTE_TEST_TX_DESC_DEFAULT 1024
uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; /**< Number of RX descriptors. */
uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /**< Number of TX descriptors. */
@@ -259,11 +250,6 @@ int16_t tx_free_thresh = RTE_PMD_PARAM_UNSET;
int16_t tx_rs_thresh = RTE_PMD_PARAM_UNSET;
/*
- * Configurable value of TX queue flags.
- */
-int32_t txq_flags = RTE_PMD_PARAM_UNSET;
-
-/*
* Receive Side Scaling (RSS) configuration.
*/
uint64_t rss_hf = ETH_RSS_IP; /* RSS IP by default. */
@@ -338,15 +324,12 @@ lcoreid_t latencystats_lcore_id = -1;
*/
struct rte_eth_rxmode rx_mode = {
.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */
- .split_hdr_size = 0,
- .header_split = 0, /**< Header Split disabled. */
- .hw_ip_checksum = 0, /**< IP checksum offload disabled. */
- .hw_vlan_filter = 1, /**< VLAN filtering enabled. */
- .hw_vlan_strip = 1, /**< VLAN strip enabled. */
- .hw_vlan_extend = 0, /**< Extended VLAN disabled. */
- .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */
- .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */
- .hw_timestamp = 0, /**< HW timestamp enabled. */
+ .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
+ .ignore_offload_bitfield = 1,
+};
+
+struct rte_eth_txmode tx_mode = {
+ .offloads = DEV_TX_OFFLOAD_MBUF_FAST_FREE,
};
struct rte_fdir_conf fdir_conf = {
@@ -512,7 +495,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
mb_size = sizeof(struct rte_mbuf) + mbuf_seg_size;
mbuf_poolname_build(socket_id, pool_name, sizeof(pool_name));
- RTE_LOG(INFO, USER1,
+ TESTPMD_LOG(INFO,
"create a new mbuf pool <%s>: n=%u, size=%u, socket=%u\n",
pool_name, nb_mbuf, mbuf_seg_size, socket_id);
@@ -533,6 +516,8 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
} else {
/* wrapper to rte_mempool_create() */
+ TESTPMD_LOG(INFO, "preferred mempool ops selected: %s\n",
+ rte_mbuf_best_mempool_ops());
rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,
mb_mempool_cache, 0, mbuf_seg_size, socket_id);
}
@@ -568,6 +553,98 @@ check_socket_id(const unsigned int socket_id)
return 0;
}
+/*
+ * Get the allowed maximum number of RX queues.
+ * *pid return the port id which has minimal value of
+ * max_rx_queues in all ports.
+ */
+queueid_t
+get_allowed_max_nb_rxq(portid_t *pid)
+{
+ queueid_t allowed_max_rxq = MAX_QUEUE_ID;
+ portid_t pi;
+ struct rte_eth_dev_info dev_info;
+
+ RTE_ETH_FOREACH_DEV(pi) {
+ rte_eth_dev_info_get(pi, &dev_info);
+ if (dev_info.max_rx_queues < allowed_max_rxq) {
+ allowed_max_rxq = dev_info.max_rx_queues;
+ *pid = pi;
+ }
+ }
+ return allowed_max_rxq;
+}
+
+/*
+ * Check input rxq is valid or not.
+ * If input rxq is not greater than any of maximum number
+ * of RX queues of all ports, it is valid.
+ * if valid, return 0, else return -1
+ */
+int
+check_nb_rxq(queueid_t rxq)
+{
+ queueid_t allowed_max_rxq;
+ portid_t pid = 0;
+
+ allowed_max_rxq = get_allowed_max_nb_rxq(&pid);
+ if (rxq > allowed_max_rxq) {
+ printf("Fail: input rxq (%u) can't be greater "
+ "than max_rx_queues (%u) of port %u\n",
+ rxq,
+ allowed_max_rxq,
+ pid);
+ return -1;
+ }
+ return 0;
+}
+
+/*
+ * Get the allowed maximum number of TX queues.
+ * *pid return the port id which has minimal value of
+ * max_tx_queues in all ports.
+ */
+queueid_t
+get_allowed_max_nb_txq(portid_t *pid)
+{
+ queueid_t allowed_max_txq = MAX_QUEUE_ID;
+ portid_t pi;
+ struct rte_eth_dev_info dev_info;
+
+ RTE_ETH_FOREACH_DEV(pi) {
+ rte_eth_dev_info_get(pi, &dev_info);
+ if (dev_info.max_tx_queues < allowed_max_txq) {
+ allowed_max_txq = dev_info.max_tx_queues;
+ *pid = pi;
+ }
+ }
+ return allowed_max_txq;
+}
+
+/*
+ * Check input txq is valid or not.
+ * If input txq is not greater than any of maximum number
+ * of TX queues of all ports, it is valid.
+ * if valid, return 0, else return -1
+ */
+int
+check_nb_txq(queueid_t txq)
+{
+ queueid_t allowed_max_txq;
+ portid_t pid = 0;
+
+ allowed_max_txq = get_allowed_max_nb_txq(&pid);
+ if (txq > allowed_max_txq) {
+ printf("Fail: input txq (%u) can't be greater "
+ "than max_tx_queues (%u) of port %u\n",
+ txq,
+ allowed_max_txq,
+ pid);
+ return -1;
+ }
+ return 0;
+}
+
static void
init_config(void)
{
@@ -609,8 +686,14 @@ init_config(void)
RTE_ETH_FOREACH_DEV(pid) {
port = &ports[pid];
+ /* Apply default TxRx configuration for all ports */
+ port->dev_conf.txmode = tx_mode;
+ port->dev_conf.rxmode = rx_mode;
rte_eth_dev_info_get(pid, &port->dev_info);
-
+ if (!(port->dev_info.tx_offload_capa &
+ DEV_TX_OFFLOAD_MBUF_FAST_FREE))
+ port->dev_conf.txmode.offloads &=
+ ~DEV_TX_OFFLOAD_MBUF_FAST_FREE;
if (numa_support) {
if (port_numa[pid] != NUMA_NO_CONFIG)
port_per_socket[port_numa[pid]]++;
@@ -1399,15 +1482,23 @@ all_ports_started(void)
}
int
+port_is_stopped(portid_t port_id)
+{
+ struct rte_port *port = &ports[port_id];
+
+ if ((port->port_status != RTE_PORT_STOPPED) &&
+ (port->slave_flag == 0))
+ return 0;
+ return 1;
+}
+
+int
all_ports_stopped(void)
{
portid_t pi;
- struct rte_port *port;
RTE_ETH_FOREACH_DEV(pi) {
- port = &ports[pi];
- if ((port->port_status != RTE_PORT_STOPPED) &&
- (port->slave_flag == 0))
+ if (!port_is_stopped(pi))
return 0;
}
@@ -1495,6 +1586,9 @@ start_port(portid_t pid)
}
if (port->need_reconfig_queues > 0) {
port->need_reconfig_queues = 0;
+ port->tx_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE;
+ /* Apply Tx offloads configuration */
+ port->tx_conf.offloads = port->dev_conf.txmode.offloads;
/* setup tx queues */
for (qi = 0; qi < nb_txq; qi++) {
if ((numa_support) &&
@@ -1521,6 +1615,8 @@ start_port(portid_t pid)
port->need_reconfig_queues = 1;
return -1;
}
+ /* Apply Rx offloads configuration */
+ port->rx_conf.offloads = port->dev_conf.rxmode.offloads;
/* setup rx queues */
for (qi = 0; qi < nb_rxq; qi++) {
if ((numa_support) &&
@@ -1568,20 +1664,6 @@ start_port(portid_t pid)
}
}
- for (event_type = RTE_ETH_EVENT_UNKNOWN;
- event_type < RTE_ETH_EVENT_MAX;
- event_type++) {
- diag = rte_eth_dev_callback_register(pi,
- event_type,
- eth_event_callback,
- NULL);
- if (diag) {
- printf("Failed to setup even callback for event %d\n",
- event_type);
- return -1;
- }
- }
-
/* start port */
if (rte_eth_dev_start(pi) < 0) {
printf("Fail to start port %d\n", pi);
@@ -1608,6 +1690,20 @@ start_port(portid_t pid)
need_check_link_status = 1;
}
+ for (event_type = RTE_ETH_EVENT_UNKNOWN;
+ event_type < RTE_ETH_EVENT_MAX;
+ event_type++) {
+ diag = rte_eth_dev_callback_register(RTE_ETH_ALL,
+ event_type,
+ eth_event_callback,
+ NULL);
+ if (diag) {
+ printf("Failed to setup even callback for event %d\n",
+ event_type);
+ return -1;
+ }
+ }
+
if (need_check_link_status == 1 && !no_link_check)
check_all_ports_link_status(RTE_PORT_ALL);
else if (need_check_link_status == 0)
@@ -1804,7 +1900,7 @@ detach_port(portid_t port_id)
port_flow_flush(port_id);
if (rte_eth_dev_detach(port_id, name)) {
- RTE_LOG(ERR, USER1, "Failed to detach port '%s'\n", name);
+ TESTPMD_LOG(ERR, "Failed to detach port '%s'\n", name);
return;
}
@@ -1913,7 +2009,7 @@ rmv_event_callback(void *arg)
close_port(port_id);
printf("removing device %s\n", dev->device->name);
if (rte_eal_dev_detach(dev->device))
- RTE_LOG(ERR, USER1, "Failed to detach device %s\n",
+ TESTPMD_LOG(ERR, "Failed to detach device %s\n",
dev->device->name);
}
@@ -1930,6 +2026,8 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
[RTE_ETH_EVENT_VF_MBOX] = "VF Mbox",
[RTE_ETH_EVENT_MACSEC] = "MACsec",
[RTE_ETH_EVENT_INTR_RMV] = "device removal",
+ [RTE_ETH_EVENT_NEW] = "device probed",
+ [RTE_ETH_EVENT_DESTROY] = "device released",
[RTE_ETH_EVENT_MAX] = NULL,
};
@@ -1946,6 +2044,9 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
fflush(stdout);
}
+ if (port_id_is_invalid(port_id, DISABLED_WARN))
+ return 0;
+
switch (type) {
case RTE_ETH_EVENT_INTR_RMV:
if (rte_eal_alarm_set(100000,
@@ -2072,9 +2173,6 @@ rxtx_port_config(struct rte_port *port)
if (tx_free_thresh != RTE_PMD_PARAM_UNSET)
port->tx_conf.tx_free_thresh = tx_free_thresh;
-
- if (txq_flags != RTE_PMD_PARAM_UNSET)
- port->tx_conf.txq_flags = txq_flags;
}
void
@@ -2085,7 +2183,6 @@ init_port_config(void)
RTE_ETH_FOREACH_DEV(pid) {
port = &ports[pid];
- port->dev_conf.rxmode = rx_mode;
port->dev_conf.fdir_conf = fdir_conf;
if (nb_rxq > 1) {
port->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL;
@@ -2248,11 +2345,14 @@ init_port_dcb_config(portid_t pid,
/* Enter DCB configuration status */
dcb_config = 1;
+ port_conf.rxmode = rte_port->dev_conf.rxmode;
+ port_conf.txmode = rte_port->dev_conf.txmode;
+
/*set configuration of DCB in vt mode and DCB in non-vt mode*/
retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en);
if (retval < 0)
return retval;
- port_conf.rxmode.hw_vlan_filter = 1;
+ port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
/**
* Write the configuration into the device.
@@ -2301,7 +2401,7 @@ init_port_dcb_config(portid_t pid,
rxtx_port_config(rte_port);
/* VLAN filter */
- rte_port->dev_conf.rxmode.hw_vlan_filter = 1;
+ rte_port->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
for (i = 0; i < RTE_DIM(vlan_tags); i++)
rx_vft_set(pid, vlan_tags[i], 1);
@@ -2384,8 +2484,13 @@ main(int argc, char** argv)
if (diag < 0)
rte_panic("Cannot init EAL\n");
+ testpmd_logtype = rte_log_register("testpmd");
+ if (testpmd_logtype < 0)
+ rte_panic("Cannot register log type");
+ rte_log_set_level(testpmd_logtype, RTE_LOG_DEBUG);
+
if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
- RTE_LOG(NOTICE, USER1, "mlockall() failed with error \"%s\"\n",
+ TESTPMD_LOG(NOTICE, "mlockall() failed with error \"%s\"\n",
strerror(errno));
}
@@ -2396,7 +2501,7 @@ main(int argc, char** argv)
nb_ports = (portid_t) rte_eth_dev_count();
if (nb_ports == 0)
- RTE_LOG(WARNING, EAL, "No probed ethernet devices\n");
+ TESTPMD_LOG(WARNING, "No probed ethernet devices\n");
/* allocate port structures, and init them */
init_port();
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 1639d27e..153abea0 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2017 Intel Corporation
*/
#ifndef _TESTPMD_H_
@@ -138,26 +109,6 @@ struct fwd_stream {
#endif
};
-/** Offload IP checksum in csum forward engine */
-#define TESTPMD_TX_OFFLOAD_IP_CKSUM 0x0001
-/** Offload UDP checksum in csum forward engine */
-#define TESTPMD_TX_OFFLOAD_UDP_CKSUM 0x0002
-/** Offload TCP checksum in csum forward engine */
-#define TESTPMD_TX_OFFLOAD_TCP_CKSUM 0x0004
-/** Offload SCTP checksum in csum forward engine */
-#define TESTPMD_TX_OFFLOAD_SCTP_CKSUM 0x0008
-/** Offload outer IP checksum in csum forward engine for recognized tunnels */
-#define TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM 0x0010
-/** Parse tunnel in csum forward engine. If set, dissect tunnel headers
- * of rx packets. If not set, treat inner headers as payload. */
-#define TESTPMD_TX_OFFLOAD_PARSE_TUNNEL 0x0020
-/** Insert VLAN header in forward engine */
-#define TESTPMD_TX_OFFLOAD_INSERT_VLAN 0x0040
-/** Insert double VLAN header in forward engine */
-#define TESTPMD_TX_OFFLOAD_INSERT_QINQ 0x0080
-/** Offload MACsec in forward engine */
-#define TESTPMD_TX_OFFLOAD_MACSEC 0x0100
-
/** Descriptor for a single flow. */
struct port_flow {
size_t size; /**< Allocated space including data[]. */
@@ -215,7 +166,7 @@ struct rte_port {
struct fwd_stream *rx_stream; /**< Port RX stream, if unique */
struct fwd_stream *tx_stream; /**< Port TX stream, if unique */
unsigned int socket_id; /**< For NUMA support */
- uint16_t tx_ol_flags;/**< TX Offload Flags (TESTPMD_TX_OFFLOAD...). */
+ uint16_t parse_tunnel:1; /**< Parse internal headers */
uint16_t tso_segsz; /**< Segmentation offload MSS for non-tunneled packets. */
uint16_t tunnel_tso_segsz; /**< Segmentation offload MSS for tunneled pkts. */
uint16_t tx_vlan_id;/**< The tag ID */
@@ -353,6 +304,7 @@ extern uint8_t xstats_hide_zero; /**< Hide zero values for xstats display */
/* globals used for configuration */
extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
+extern int testpmd_logtype; /**< Log type for testpmd logs */
extern uint8_t interactive;
extern uint8_t auto_start;
extern uint8_t tx_first;
@@ -377,19 +329,19 @@ extern uint32_t bypass_timeout; /**< Store the NIC bypass watchdog timeout */
* Store specified sockets on which memory pool to be used by ports
* is allocated.
*/
-uint8_t port_numa[RTE_MAX_ETHPORTS];
+extern uint8_t port_numa[RTE_MAX_ETHPORTS];
/*
* Store specified sockets on which RX ring to be used by ports
* is allocated.
*/
-uint8_t rxring_numa[RTE_MAX_ETHPORTS];
+extern uint8_t rxring_numa[RTE_MAX_ETHPORTS];
/*
* Store specified sockets on which TX ring to be used by ports
* is allocated.
*/
-uint8_t txring_numa[RTE_MAX_ETHPORTS];
+extern uint8_t txring_numa[RTE_MAX_ETHPORTS];
extern uint8_t socket_num;
@@ -415,6 +367,8 @@ extern portid_t fwd_ports_ids[RTE_MAX_ETHPORTS];
extern struct rte_port *ports;
extern struct rte_eth_rxmode rx_mode;
+extern struct rte_eth_txmode tx_mode;
+
extern uint64_t rss_hf;
extern queueid_t nb_rxq;
@@ -427,11 +381,9 @@ extern int16_t rx_free_thresh;
extern int8_t rx_drop_en;
extern int16_t tx_free_thresh;
extern int16_t tx_rs_thresh;
-extern int32_t txq_flags;
extern uint8_t dcb_config;
extern uint8_t dcb_test;
-extern enum dcb_queue_mapping_mode dcb_q_mapping;
extern uint16_t mbuf_data_size; /**< Mbuf data space size. */
extern uint32_t param_total_num_mbufs;
@@ -600,6 +552,8 @@ void set_def_fwd_config(void);
void reconfig(portid_t new_port_id, unsigned socket_id);
int init_fwd_streams(void);
+void set_fwd_eth_peer(portid_t port_id, char *peer_addr);
+
void port_mtu_set(portid_t port_id, uint16_t mtu);
void port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_pos);
void port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
@@ -682,6 +636,7 @@ void reset_port(portid_t pid);
void attach_port(char *identifier);
void detach_port(portid_t port_id);
int all_ports_stopped(void);
+int port_is_stopped(portid_t port_id);
int port_is_started(portid_t port_id);
void pmd_test_exit(void);
void fdir_get_infos(portid_t port_id);
@@ -715,9 +670,9 @@ void mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr);
void mcast_addr_remove(portid_t port_id, struct ether_addr *mc_addr);
void port_dcb_info_display(portid_t port_id);
-uint8_t *open_ddp_package_file(const char *file_path, uint32_t *size);
-int save_ddp_package_file(const char *file_path, uint8_t *buf, uint32_t size);
-int close_ddp_package_file(uint8_t *buf);
+uint8_t *open_file(const char *file_path, uint32_t *size);
+int save_file(const char *file_path, uint8_t *buf, uint32_t size);
+int close_file(uint8_t *buf);
void port_queue_region_info_display(portid_t port_id, void *buf);
@@ -728,6 +683,11 @@ enum print_warning {
int port_id_is_invalid(portid_t port_id, enum print_warning warning);
int new_socket_id(unsigned int socket_id);
+queueid_t get_allowed_max_nb_rxq(portid_t *pid);
+int check_nb_rxq(queueid_t rxq);
+queueid_t get_allowed_max_nb_txq(portid_t *pid);
+int check_nb_txq(queueid_t txq);
+
/*
* Work-around of a compilation error with ICC on invocations of the
* rte_be_to_cpu_16() function.
@@ -747,4 +707,7 @@ int new_socket_id(unsigned int socket_id);
#endif
#endif /* __GCC__ */
+#define TESTPMD_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, testpmd_logtype, "testpmd: " fmt, ## args)
+
#endif /* _TESTPMD_H_ */
diff --git a/app/test-pmd/tm.c b/app/test-pmd/tm.c
index dd837cb8..7231552a 100644
--- a/app/test-pmd/tm.c
+++ b/app/test-pmd/tm.c
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2017 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017 Intel Corporation
*/
#include <stdio.h>
#include <sys/stat.h>
@@ -604,6 +575,10 @@ softport_tm_tc_node_add(portid_t port_id, struct tm_hierarchy *h,
tc_parent_node_id = h->pipe_node_id[i][j];
tnp.shared_shaper_id =
(uint32_t *)calloc(1, sizeof(uint32_t));
+ if (tnp.shared_shaper_id == NULL) {
+ printf("Shared shaper mem alloc err\n");
+ return -1;
+ }
tnp.shared_shaper_id[0] = k;
pos = j + (i * PIPE_NODES_PER_SUBPORT);
h->tc_node_id[pos][k] =
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index 309c7389..1f08b6ed 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -1,34 +1,5 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
*/
#include <stdarg.h>
@@ -104,6 +75,7 @@ copy_buf_to_pkt_segs(void* buf, unsigned len, struct rte_mbuf *pkt,
buf = ((char*) buf + copy_len);
seg = seg->next;
seg_buf = rte_pktmbuf_mtod(seg, char *);
+ copy_len = seg->data_len;
}
rte_memcpy(seg_buf, buf, (size_t) len);
}
@@ -193,6 +165,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
uint32_t retry;
uint64_t ol_flags = 0;
uint8_t i;
+ uint64_t tx_offloads;
#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
uint64_t start_tsc;
uint64_t end_tsc;
@@ -206,13 +179,14 @@ pkt_burst_transmit(struct fwd_stream *fs)
mbp = current_fwd_lcore()->mbp;
txp = &ports[fs->tx_port];
+ tx_offloads = txp->dev_conf.txmode.offloads;
vlan_tci = txp->tx_vlan_id;
vlan_tci_outer = txp->tx_vlan_id_outer;
- if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN)
+ if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT)
ol_flags = PKT_TX_VLAN_PKT;
- if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ)
+ if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT)
ol_flags |= PKT_TX_QINQ_PKT;
- if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC)
+ if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT)
ol_flags |= PKT_TX_MACSEC;
for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) {
pkt = rte_mbuf_raw_alloc(mbp);