From 8d53e9f3c6001dcb2865f6e894da5b54e1418f88 Mon Sep 17 00:00:00 2001 From: Christian Ehrhardt Date: Thu, 4 Jul 2019 10:40:06 +0200 Subject: New upstream version 18.11.2 Change-Id: I23eb4f9179abf1f9c659891f8fddb27ee68ad26b Signed-off-by: Christian Ehrhardt --- app/pdump/main.c | 17 ++- app/test-bbdev/test_bbdev.c | 10 +- app/test-crypto-perf/main.c | 5 + app/test-pmd/cmdline.c | 269 ++++++++++++++++++++++++++++++-------------- app/test-pmd/cmdline_flow.c | 128 ++++++++++++++++++++- app/test-pmd/config.c | 14 +-- app/test-pmd/csumonly.c | 2 +- app/test-pmd/testpmd.c | 92 +++++++-------- app/test-pmd/testpmd.h | 13 +-- 9 files changed, 391 insertions(+), 159 deletions(-) (limited to 'app') diff --git a/app/pdump/main.c b/app/pdump/main.c index 5e183ea9..ccf2a1d2 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -512,12 +512,19 @@ cleanup_pdump_resources(void) if (pt->dir & RTE_PDUMP_FLAG_TX) free_ring_data(pt->tx_ring, pt->tx_vdev_id, &pt->stats); - /* Remove the vdev created */ - rte_eth_dev_get_name_by_port(pt->rx_vdev_id, name); - rte_eal_hotplug_remove("vdev", name); + /* Remove the vdev(s) created */ + if (pt->dir & RTE_PDUMP_FLAG_RX) { + rte_eth_dev_get_name_by_port(pt->rx_vdev_id, name); + rte_eal_hotplug_remove("vdev", name); + } + + if (pt->single_pdump_dev) + continue; - rte_eth_dev_get_name_by_port(pt->tx_vdev_id, name); - rte_eal_hotplug_remove("vdev", name); + if (pt->dir & RTE_PDUMP_FLAG_TX) { + rte_eth_dev_get_name_by_port(pt->tx_vdev_id, name); + rte_eal_hotplug_remove("vdev", name); + } } cleanup_rings(); diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c index a914817b..137c74cd 100644 --- a/app/test-bbdev/test_bbdev.c +++ b/app/test-bbdev/test_bbdev.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include "main.h" @@ -788,14 +790,14 @@ test_bbdev_driver_init(void) /* Initialize the maximum amount of devices */ do { - sprintf(name_tmp, "%s%i", "name_", num_devs); + snprintf(name_tmp, sizeof(name_tmp), "%s%i", "name_", num_devs); dev2 = rte_bbdev_allocate(name_tmp); TEST_ASSERT(dev2 != NULL, "Failed to initialize bbdev driver"); ++num_devs; } while (num_devs < (RTE_BBDEV_MAX_DEVS - 1)); - sprintf(name_tmp, "%s%i", "name_", num_devs); + snprintf(name_tmp, sizeof(name_tmp), "%s%i", "name_", num_devs); dev2 = rte_bbdev_allocate(name_tmp); TEST_ASSERT(dev2 == NULL, "Failed to initialize bbdev driver number %d " "more drivers than RTE_BBDEV_MAX_DEVS: %d ", num_devs, @@ -804,7 +806,7 @@ test_bbdev_driver_init(void) num_devs--; while (num_devs >= num_devs_tmp) { - sprintf(name_tmp, "%s%i", "name_", num_devs); + snprintf(name_tmp, sizeof(name_tmp), "%s%i", "name_", num_devs); dev2 = rte_bbdev_get_named_dev(name_tmp); TEST_ASSERT_SUCCESS(rte_bbdev_release(dev2), "Failed to uninitialize bbdev driver %s ", @@ -825,7 +827,7 @@ test_bbdev_driver_init(void) TEST_ASSERT_FAIL(rte_bbdev_release(NULL), "Failed to uninitialize bbdev driver with NULL bbdev"); - sprintf(name_tmp, "%s", "invalid_name"); + strlcpy(name_tmp, "invalid_name", sizeof(name_tmp)); dev2 = rte_bbdev_get_named_dev(name_tmp); TEST_ASSERT_FAIL(rte_bbdev_release(dev2), "Failed to uninitialize bbdev driver with invalid name"); diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index 953e058c..0aa0de8b 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -129,6 +129,11 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs, struct rte_cryptodev_info cdev_info; uint8_t socket_id = rte_cryptodev_socket_id(cdev_id); + /* range check the socket_id - negative values become big + * positive ones due to use of unsigned value + */ + if (socket_id >= RTE_MAX_NUMA_NODES) + socket_id = 0; rte_cryptodev_info_get(cdev_id, &cdev_info); if (opts->nb_qps > cdev_info.max_nb_queue_pairs) { diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 51704b50..eeadb2de 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -94,14 +94,15 @@ static void cmd_help_brief_parsed(__attribute__((unused)) void *parsed_result, cl, "\n" "Help is available for the following sections:\n\n" - " help control : Start and stop forwarding.\n" - " help display : Displaying port, stats and config " + " help control : Start and stop forwarding.\n" + " help display : Displaying port, stats and config " "information.\n" - " help config : Configuration information.\n" - " help ports : Configuring ports.\n" - " help registers : Reading and setting port registers.\n" - " help filters : Filters configuration help.\n" - " help all : All of the above sections.\n\n" + " help config : Configuration information.\n" + " help ports : Configuring ports.\n" + " help registers : Reading and setting port registers.\n" + " help filters : Filters configuration help.\n" + " help traffic_management : Traffic Management commmands.\n" + " help all : All of the above sections.\n\n" ); } @@ -210,21 +211,32 @@ static void cmd_help_long_parsed(void *parsed_result, "show port meter stats (port_id) (meter_id) (clear)\n" " Get meter stats on a port\n\n" - "show port tm cap (port_id)\n" - " Display the port TM capability.\n\n" - "show port tm level cap (port_id) (level_id)\n" - " Display the port TM hierarchical level capability.\n\n" + "show fwd stats all\n" + " Display statistics for all fwd engines.\n\n" - "show port tm node cap (port_id) (node_id)\n" - " Display the port TM node capability.\n\n" + "clear fwd stats all\n" + " Clear statistics for all fwd engines.\n\n" - "show port tm node type (port_id) (node_id)\n" - " Display the port TM node type.\n\n" + "show port (port_id) rx_offload capabilities\n" + " List all per queue and per port Rx offloading" + " capabilities of a port\n\n" - "show port tm node stats (port_id) (node_id) (clear)\n" - " Display the port TM node stats.\n\n" + "show port (port_id) rx_offload configuration\n" + " List port level and all queue level" + " Rx offloading configuration\n\n" + "show port (port_id) tx_offload capabilities\n" + " List all per queue and per port" + " Tx offloading capabilities of a port\n\n" + + "show port (port_id) tx_offload configuration\n" + " List port level and all queue level" + " Tx offloading configuration\n\n" + + "show port (port_id) tx_metadata\n" + " Show Tx metadata value set" + " for a specific port\n\n" ); } @@ -642,11 +654,6 @@ static void cmd_help_long_parsed(void *parsed_result, "E-tag set filter del e-tag-id (value) port (port_id)\n" " Delete an E-tag forwarding filter on a port\n\n" -#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED - "set port tm hierarchy default (port_id)\n" - " Set default traffic Management hierarchy on a port\n\n" - -#endif "ddp add (port_id) (profile_path[,backup_profile_path])\n" " Load a profile package on a port\n\n" @@ -727,62 +734,6 @@ static void cmd_help_long_parsed(void *parsed_result, "show port (port_id) queue-region\n" " show all queue region related configuration info\n\n" - "add port tm node shaper profile (port_id) (shaper_profile_id)" - " (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size)" - " (packet_length_adjust)\n" - " Add port tm node private shaper profile.\n\n" - - "del port tm node shaper profile (port_id) (shaper_profile_id)\n" - " Delete port tm node private shaper profile.\n\n" - - "add port tm node shared shaper (port_id) (shared_shaper_id)" - " (shaper_profile_id)\n" - " Add/update port tm node shared shaper.\n\n" - - "del port tm node shared shaper (port_id) (shared_shaper_id)\n" - " Delete port tm node shared shaper.\n\n" - - "set port tm node shaper profile (port_id) (node_id)" - " (shaper_profile_id)\n" - " Set port tm node shaper profile.\n\n" - - "add port tm node wred profile (port_id) (wred_profile_id)" - " (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g)" - " (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y)" - " (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)\n" - " Add port tm node wred profile.\n\n" - - "del port tm node wred profile (port_id) (wred_profile_id)\n" - " Delete port tm node wred profile.\n\n" - - "add port tm nonleaf node (port_id) (node_id) (parent_node_id)" - " (priority) (weight) (level_id) (shaper_profile_id)" - " (n_sp_priorities) (stats_mask) (n_shared_shapers)" - " [(shared_shaper_id_0) (shared_shaper_id_1)...]\n" - " Add port tm nonleaf node.\n\n" - - "add port tm leaf node (port_id) (node_id) (parent_node_id)" - " (priority) (weight) (level_id) (shaper_profile_id)" - " (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers)" - " [(shared_shaper_id_0) (shared_shaper_id_1)...]\n" - " Add port tm leaf node.\n\n" - - "del port tm node (port_id) (node_id)\n" - " Delete port tm node.\n\n" - - "set port tm node parent (port_id) (node_id) (parent_node_id)" - " (priority) (weight)\n" - " Set port tm node parent.\n\n" - - "suspend port tm node (port_id) (node_id)" - " Suspend tm node.\n\n" - - "resume port tm node (port_id) (node_id)" - " Resume tm node.\n\n" - - "port tm hierarchy commit (port_id) (clean_on_fail)\n" - " Commit tm hierarchy.\n\n" - "vxlan ip-version (ipv4|ipv6) vni (vni) udp-src" " (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst" " (ip-dst) eth-src (eth-src) eth-dst (eth-dst)\n" @@ -918,6 +869,52 @@ static void cmd_help_long_parsed(void *parsed_result, "port config (port_id) udp_tunnel_port add|rm vxlan|geneve (udp_port)\n\n" " Add/remove UDP tunnel port for tunneling offload\n\n" + + "port config rx_offload vlan_strip|" + "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" + "outer_ipv4_cksum|macsec_strip|header_split|" + "vlan_filter|vlan_extend|jumbo_frame|crc_strip|" + "scatter|timestamp|security|keep_crc on|off\n" + " Enable or disable a per port Rx offloading" + " on all Rx queues of a port\n\n" + + "port (port_id) rxq (queue_id) rx_offload vlan_strip|" + "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" + "outer_ipv4_cksum|macsec_strip|header_split|" + "vlan_filter|vlan_extend|jumbo_frame|crc_strip|" + "scatter|timestamp|security|keep_crc on|off\n" + " Enable or disable a per queue Rx offloading" + " only on a specific Rx queue\n\n" + + "port config (port_id) tx_offload vlan_insert|" + "ipv4_cksum|udp_cksum|tcp_cksum|sctp_cksum|tcp_tso|" + "udp_tso|outer_ipv4_cksum|qinq_insert|vxlan_tnl_tso|" + "gre_tnl_tso|ipip_tnl_tso|geneve_tnl_tso|" + "macsec_insert|mt_lockfree|multi_segs|mbuf_fast_free|" + "security|match_metadata on|off\n" + " Enable or disable a per port Tx offloading" + " on all Tx queues of a port\n\n" + + "port (port_id) txq (queue_id) tx_offload vlan_insert|" + "ipv4_cksum|udp_cksum|tcp_cksum|sctp_cksum|tcp_tso|" + "udp_tso|outer_ipv4_cksum|qinq_insert|vxlan_tnl_tso|" + "gre_tnl_tso|ipip_tnl_tso|geneve_tnl_tso|macsec_insert" + "|mt_lockfree|multi_segs|mbuf_fast_free|security" + " on|off\n" + " Enable or disable a per queue Tx offloading" + " only on a specific Tx queue\n\n" + + "bpf-load rx|tx (port) (queue) (J|M|B) (file_name)\n" + " Load an eBPF program as a callback" + " for particular RX/TX queue\n\n" + + "bpf-unload rx|tx (port) (queue)\n" + " Unload previously loaded eBPF program" + " for particular RX/TX queue\n\n" + + "port config (port_id) tx_metadata (value)\n" + " Set Tx metadata value per port. Testpmd will add this value" + " to any Tx packet sent from this port\n\n" ); } @@ -1137,6 +1134,107 @@ static void cmd_help_long_parsed(void *parsed_result, " flow rules\n\n" ); } + + if (show_all || !strcmp(res->section, "traffic_management")) { + cmdline_printf( + cl, + "\n" + "Traffic Management:\n" + "--------------\n" + "show port tm cap (port_id)\n" + " Display the port TM capability.\n\n" + + "show port tm level cap (port_id) (level_id)\n" + " Display the port TM hierarchical level capability.\n\n" + + "show port tm node cap (port_id) (node_id)\n" + " Display the port TM node capability.\n\n" + + "show port tm node type (port_id) (node_id)\n" + " Display the port TM node type.\n\n" + + "show port tm node stats (port_id) (node_id) (clear)\n" + " Display the port TM node stats.\n\n" + +#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED + "set port tm hierarchy default (port_id)\n" + " Set default traffic Management hierarchy on a port\n\n" +#endif + + "add port tm node shaper profile (port_id) (shaper_profile_id)" + " (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size)" + " (packet_length_adjust)\n" + " Add port tm node private shaper profile.\n\n" + + "del port tm node shaper profile (port_id) (shaper_profile_id)\n" + " Delete port tm node private shaper profile.\n\n" + + "add port tm node shared shaper (port_id) (shared_shaper_id)" + " (shaper_profile_id)\n" + " Add/update port tm node shared shaper.\n\n" + + "del port tm node shared shaper (port_id) (shared_shaper_id)\n" + " Delete port tm node shared shaper.\n\n" + + "set port tm node shaper profile (port_id) (node_id)" + " (shaper_profile_id)\n" + " Set port tm node shaper profile.\n\n" + + "add port tm node wred profile (port_id) (wred_profile_id)" + " (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g)" + " (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y)" + " (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)\n" + " Add port tm node wred profile.\n\n" + + "del port tm node wred profile (port_id) (wred_profile_id)\n" + " Delete port tm node wred profile.\n\n" + + "add port tm nonleaf node (port_id) (node_id) (parent_node_id)" + " (priority) (weight) (level_id) (shaper_profile_id)" + " (n_sp_priorities) (stats_mask) (n_shared_shapers)" + " [(shared_shaper_id_0) (shared_shaper_id_1)...]\n" + " Add port tm nonleaf node.\n\n" + + "add port tm leaf node (port_id) (node_id) (parent_node_id)" + " (priority) (weight) (level_id) (shaper_profile_id)" + " (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers)" + " [(shared_shaper_id_0) (shared_shaper_id_1)...]\n" + " Add port tm leaf node.\n\n" + + "del port tm node (port_id) (node_id)\n" + " Delete port tm node.\n\n" + + "set port tm node parent (port_id) (node_id) (parent_node_id)" + " (priority) (weight)\n" + " Set port tm node parent.\n\n" + + "suspend port tm node (port_id) (node_id)" + " Suspend tm node.\n\n" + + "resume port tm node (port_id) (node_id)" + " Resume tm node.\n\n" + + "port tm hierarchy commit (port_id) (clean_on_fail)\n" + " Commit tm hierarchy.\n\n" + + "set port tm mark ip_ecn (port) (green) (yellow)" + " (red)\n" + " Enables/Disables the traffic management marking" + " for IP ECN (Explicit Congestion Notification)" + " packets on a given port\n\n" + + "set port tm mark ip_dscp (port) (green) (yellow)" + " (red)\n" + " Enables/Disables the traffic management marking" + " on the port for IP dscp packets\n\n" + + "set port tm mark vlan_dei (port) (green) (yellow)" + " (red)\n" + " Enables/Disables the traffic management marking" + " on the port for VLAN packets with DEI enabled\n\n" + ); + } + } cmdline_parse_token_string_t cmd_help_long_help = @@ -1145,12 +1243,13 @@ cmdline_parse_token_string_t cmd_help_long_help = cmdline_parse_token_string_t cmd_help_long_section = TOKEN_STRING_INITIALIZER(struct cmd_help_long_result, section, "all#control#display#config#" - "ports#registers#filters"); + "ports#registers#filters#traffic_management"); cmdline_parse_inst_t cmd_help_long = { .f = cmd_help_long_parsed, .data = NULL, - .help_str = "help all|control|display|config|ports|register|filters: " + .help_str = "help all|control|display|config|ports|register|" + "filters|traffic_management: " "Show help", .tokens = { (void *)&cmd_help_long_help, @@ -12070,7 +12169,7 @@ cmd_set_hash_global_config_parsed(void *parsed_result, res->port_id); else printf("Global hash configurations have been set " - "succcessfully by port %d\n", res->port_id); + "successfully by port %d\n", res->port_id); } cmdline_parse_token_string_t cmd_set_hash_global_config_all = @@ -17625,7 +17724,7 @@ print_rx_offloads(uint64_t offloads) begin = __builtin_ctzll(offloads); end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); - single_offload = 1 << begin; + single_offload = 1ULL << begin; for (bit = begin; bit < end; bit++) { if (offloads & single_offload) printf(" %s", @@ -18019,7 +18118,7 @@ print_tx_offloads(uint64_t offloads) begin = __builtin_ctzll(offloads); end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); - single_offload = 1 << begin; + single_offload = 1ULL << begin; for (bit = begin; bit < end; bit++) { if (offloads & single_offload) printf(" %s", @@ -18196,13 +18295,13 @@ search_tx_offload(const char *name) single_offload = 1; for (bit = 0; bit < sizeof(single_offload) * CHAR_BIT; bit++) { single_name = rte_eth_dev_tx_offload_name(single_offload); + if (single_name == NULL) + break; if (!strcasecmp(single_name, name)) { found = 1; break; } else if (!strcasecmp(single_name, "UNKNOWN")) break; - else if (single_name == NULL) - break; single_offload <<= 1; } diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 5c0108fa..d202566b 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -35,6 +35,7 @@ enum index { PREFIX, BOOLEAN, STRING, + HEX, MAC_ADDR, IPV4_ADDR, IPV6_ADDR, @@ -1122,6 +1123,9 @@ static int parse_boolean(struct context *, const struct token *, static int parse_string(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); +static int parse_hex(struct context *ctx, const struct token *token, + const char *str, unsigned int len, + void *buf, unsigned int size); static int parse_mac_addr(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -1198,6 +1202,13 @@ static const struct token token_list[] = { .call = parse_string, .comp = comp_none, }, + [HEX] = { + .name = "{hex}", + .type = "HEX", + .help = "fixed string", + .call = parse_hex, + .comp = comp_none, + }, [MAC_ADDR] = { .name = "{MAC address}", .type = "MAC-48", @@ -2306,7 +2317,7 @@ static const struct token token_list[] = { [ACTION_RSS_KEY] = { .name = "key", .help = "RSS hash key", - .next = NEXT(action_rss, NEXT_ENTRY(STRING)), + .next = NEXT(action_rss, NEXT_ENTRY(HEX)), .args = ARGS(ARGS_ENTRY_ARB(0, 0), ARGS_ENTRY_ARB (offsetof(struct action_rss_data, conf) + @@ -4441,6 +4452,121 @@ error: return -1; } +static int +parse_hex_string(const char *src, uint8_t *dst, uint32_t *size) +{ + char *c = NULL; + uint32_t i, len; + char tmp[3]; + + /* Check input parameters */ + if ((src == NULL) || + (dst == NULL) || + (size == NULL) || + (*size == 0)) + return -1; + + /* Convert chars to bytes */ + for (i = 0, len = 0; i < *size; i += 2) { + snprintf(tmp, 3, "%s", src + i); + dst[len++] = strtoul(tmp, &c, 16); + if (*c != 0) { + len--; + dst[len] = 0; + *size = len; + return -1; + } + } + dst[len] = 0; + *size = len; + + return 0; +} + +static int +parse_hex(struct context *ctx, const struct token *token, + const char *str, unsigned int len, + void *buf, unsigned int size) +{ + const struct arg *arg_data = pop_args(ctx); + const struct arg *arg_len = pop_args(ctx); + const struct arg *arg_addr = pop_args(ctx); + char tmp[16]; /* Ought to be enough. */ + int ret; + unsigned int hexlen = len; + unsigned int length = 256; + uint8_t hex_tmp[length]; + + /* Arguments are expected. */ + if (!arg_data) + return -1; + if (!arg_len) { + push_args(ctx, arg_data); + return -1; + } + if (!arg_addr) { + push_args(ctx, arg_len); + push_args(ctx, arg_data); + return -1; + } + size = arg_data->size; + /* Bit-mask fill is not supported. */ + if (arg_data->mask) + goto error; + if (!ctx->object) + return len; + + /* translate bytes string to array. */ + if (str[0] == '0' && ((str[1] == 'x') || + (str[1] == 'X'))) { + str += 2; + hexlen -= 2; + } + if (hexlen > length) + return -1; + ret = parse_hex_string(str, hex_tmp, &hexlen); + if (ret < 0) + goto error; + /* Let parse_int() fill length information first. */ + ret = snprintf(tmp, sizeof(tmp), "%u", hexlen); + if (ret < 0) + goto error; + push_args(ctx, arg_len); + ret = parse_int(ctx, token, tmp, ret, NULL, 0); + if (ret < 0) { + pop_args(ctx); + goto error; + } + buf = (uint8_t *)ctx->object + arg_data->offset; + /* Output buffer is not necessarily NUL-terminated. */ + memcpy(buf, hex_tmp, hexlen); + memset((uint8_t *)buf + hexlen, 0x00, size - hexlen); + if (ctx->objmask) + memset((uint8_t *)ctx->objmask + arg_data->offset, + 0xff, hexlen); + /* Save address if requested. */ + if (arg_addr->size) { + memcpy((uint8_t *)ctx->object + arg_addr->offset, + (void *[]){ + (uint8_t *)ctx->object + arg_data->offset + }, + arg_addr->size); + if (ctx->objmask) + memcpy((uint8_t *)ctx->objmask + arg_addr->offset, + (void *[]){ + (uint8_t *)ctx->objmask + arg_data->offset + }, + arg_addr->size); + } + return len; +error: + push_args(ctx, arg_addr); + push_args(ctx, arg_len); + push_args(ctx, arg_data); + return -1; + +} + /** * Parse a MAC address. * diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index b9e5dd92..4004e3a4 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2955,7 +2955,6 @@ vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type, uint16_t tp_id) 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)) @@ -2963,8 +2962,8 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) if (vlan_id_is_invalid(vlan_id)) return; - vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD) { + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_QINQ_INSERT) { printf("Error, as QinQ has been enabled.\n"); return; } @@ -2983,7 +2982,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) 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)) @@ -2993,11 +2991,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) if (vlan_id_is_invalid(vlan_id_outer)) return; - vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (!(vlan_offload & ETH_VLAN_EXTEND_OFFLOAD)) { - 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", @@ -3006,7 +2999,8 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) } tx_vlan_reset(port_id); - ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; + ports[port_id].dev_conf.txmode.offloads |= (DEV_TX_OFFLOAD_VLAN_INSERT | + DEV_TX_OFFLOAD_QINQ_INSERT); ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; } diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index ffeee205..f4f2a7b2 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -575,7 +575,7 @@ mbuf_copy_split(const struct rte_mbuf *ms, struct rte_mbuf *md[], /* * Allocate a new mbuf with up to tx_pkt_nb_segs segments. - * Copy packet contents and offload information into then new segmented mbuf. + * Copy packet contents and offload information into the new segmented mbuf. */ static struct rte_mbuf * pkt_copy_split(const struct rte_mbuf *pkt) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 7b0c8e68..cf983b16 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -188,6 +188,8 @@ struct fwd_engine * fwd_engines[] = { NULL, }; +struct rte_mempool *mempools[RTE_MAX_NUMA_NODES]; + struct fwd_config cur_fwd_config; struct fwd_engine *cur_fwd_eng = &io_fwd_engine; /**< IO mode by default. */ uint32_t retry_enabled; @@ -844,7 +846,7 @@ setup_extmem(uint32_t nb_mbufs, uint32_t mbuf_sz, bool huge) /* * Configuration initialisation done once at init time. */ -static void +static struct rte_mempool * mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, unsigned int socket_id) { @@ -922,6 +924,7 @@ err: } else if (verbose_level > 0) { rte_mempool_dump(stdout, rte_mp); } + return rte_mp; } /* @@ -1139,14 +1142,18 @@ init_config(void) uint8_t i; for (i = 0; i < num_sockets; i++) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, - socket_ids[i]); + mempools[i] = mbuf_pool_create(mbuf_data_size, + nb_mbuf_per_pool, + socket_ids[i]); } else { if (socket_num == UMA_NO_CONFIG) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0); + mempools[0] = mbuf_pool_create(mbuf_data_size, + nb_mbuf_per_pool, 0); else - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, - socket_num); + mempools[socket_num] = mbuf_pool_create + (mbuf_data_size, + nb_mbuf_per_pool, + socket_num); } init_port_config(); @@ -1388,7 +1395,7 @@ fwd_port_stats_display(portid_t port_id, struct rte_eth_stats *stats) printf(" RX-packets: %-14"PRIu64" RX-dropped: %-14"PRIu64"RX-total: " "%-"PRIu64"\n", stats->ipackets, stats->imissed, - (uint64_t) (stats->ipackets + stats->imissed)); + stats->ipackets + stats->imissed); if (cur_fwd_eng == &csum_fwd_engine) printf(" Bad-ipcsum: %-14"PRIu64" Bad-l4csum: %-14"PRIu64"Bad-outer-l4csum: %-14"PRIu64"\n", @@ -1402,13 +1409,13 @@ fwd_port_stats_display(portid_t port_id, struct rte_eth_stats *stats) printf(" TX-packets: %-14"PRIu64" TX-dropped: %-14"PRIu64"TX-total: " "%-"PRIu64"\n", stats->opackets, port->tx_dropped, - (uint64_t) (stats->opackets + port->tx_dropped)); + stats->opackets + port->tx_dropped); } else { printf(" RX-packets: %14"PRIu64" RX-dropped:%14"PRIu64" RX-total:" "%14"PRIu64"\n", stats->ipackets, stats->imissed, - (uint64_t) (stats->ipackets + stats->imissed)); + stats->ipackets + stats->imissed); if (cur_fwd_eng == &csum_fwd_engine) printf(" Bad-ipcsum:%14"PRIu64" Bad-l4csum:%14"PRIu64" Bad-outer-l4csum: %-14"PRIu64"\n", @@ -1423,7 +1430,7 @@ fwd_port_stats_display(portid_t port_id, struct rte_eth_stats *stats) printf(" TX-packets: %14"PRIu64" TX-dropped:%14"PRIu64" TX-total:" "%14"PRIu64"\n", stats->opackets, port->tx_dropped, - (uint64_t) (stats->opackets + port->tx_dropped)); + stats->opackets + port->tx_dropped); } #ifdef RTE_TEST_PMD_RECORD_BURST_STATS @@ -1471,15 +1478,19 @@ fwd_stream_stats_display(streamid_t stream_id) "TX Port=%2d/Queue=%2d %s\n", fwd_top_stats_border, fs->rx_port, fs->rx_queue, fs->tx_port, fs->tx_queue, fwd_top_stats_border); - printf(" RX-packets: %-14u TX-packets: %-14u TX-dropped: %-14u", + printf(" RX-packets: %-14"PRIu64" TX-packets: %-14"PRIu64 + " TX-dropped: %-14"PRIu64, fs->rx_packets, fs->tx_packets, fs->fwd_dropped); /* if checksum mode */ if (cur_fwd_eng == &csum_fwd_engine) { - printf(" RX- bad IP checksum: %-14u Rx- bad L4 checksum: " - "%-14u Rx- bad outer L4 checksum: %-14u\n", + printf(" RX- bad IP checksum: %-14"PRIu64 + " Rx- bad L4 checksum: %-14"PRIu64 + " Rx- bad outer L4 checksum: %-14"PRIu64"\n", fs->rx_bad_ip_csum, fs->rx_bad_l4_csum, fs->rx_bad_outer_l4_csum); + } else { + printf("\n"); } #ifdef RTE_TEST_PMD_RECORD_BURST_STATS @@ -1755,9 +1766,6 @@ stop_packet_forwarding(void) uint64_t total_rx_dropped; uint64_t total_tx_dropped; uint64_t total_rx_nombuf; - uint64_t tx_dropped; - uint64_t rx_bad_ip_csum; - uint64_t rx_bad_l4_csum; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t fwd_cycles; #endif @@ -1784,38 +1792,22 @@ stop_packet_forwarding(void) fwd_cycles = 0; #endif for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) { + struct fwd_stream *fs = fwd_streams[sm_id]; + if (cur_fwd_config.nb_fwd_streams > cur_fwd_config.nb_fwd_ports) { fwd_stream_stats_display(sm_id); - ports[fwd_streams[sm_id]->tx_port].tx_stream = NULL; - ports[fwd_streams[sm_id]->rx_port].rx_stream = NULL; + ports[fs->tx_port].tx_stream = NULL; + ports[fs->rx_port].rx_stream = NULL; } else { - ports[fwd_streams[sm_id]->tx_port].tx_stream = - fwd_streams[sm_id]; - ports[fwd_streams[sm_id]->rx_port].rx_stream = - fwd_streams[sm_id]; - } - tx_dropped = ports[fwd_streams[sm_id]->tx_port].tx_dropped; - tx_dropped = (uint64_t) (tx_dropped + - fwd_streams[sm_id]->fwd_dropped); - ports[fwd_streams[sm_id]->tx_port].tx_dropped = tx_dropped; - - rx_bad_ip_csum = - ports[fwd_streams[sm_id]->rx_port].rx_bad_ip_csum; - rx_bad_ip_csum = (uint64_t) (rx_bad_ip_csum + - fwd_streams[sm_id]->rx_bad_ip_csum); - ports[fwd_streams[sm_id]->rx_port].rx_bad_ip_csum = - rx_bad_ip_csum; - - rx_bad_l4_csum = - ports[fwd_streams[sm_id]->rx_port].rx_bad_l4_csum; - rx_bad_l4_csum = (uint64_t) (rx_bad_l4_csum + - fwd_streams[sm_id]->rx_bad_l4_csum); - ports[fwd_streams[sm_id]->rx_port].rx_bad_l4_csum = - rx_bad_l4_csum; - - ports[fwd_streams[sm_id]->rx_port].rx_bad_outer_l4_csum += - fwd_streams[sm_id]->rx_bad_outer_l4_csum; + ports[fs->tx_port].tx_stream = fs; + ports[fs->rx_port].rx_stream = fs; + } + ports[fs->tx_port].tx_dropped += fs->fwd_dropped; + ports[fs->rx_port].rx_bad_ip_csum += fs->rx_bad_ip_csum; + ports[fs->rx_port].rx_bad_l4_csum += fs->rx_bad_l4_csum; + ports[fs->rx_port].rx_bad_outer_l4_csum += + fs->rx_bad_outer_l4_csum; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES fwd_cycles = (uint64_t) (fwd_cycles + @@ -2399,6 +2391,7 @@ pmd_test_exit(void) struct rte_device *device; portid_t pt_id; int ret; + int i; if (test_done == 0) stop_packet_forwarding(); @@ -2452,6 +2445,10 @@ pmd_test_exit(void) return; } } + for (i = 0 ; i < RTE_MAX_NUMA_NODES ; i++) { + if (mempools[i]) + rte_mempool_free(mempools[i]); + } printf("\nBye...\n"); } @@ -2965,8 +2962,9 @@ init_port_dcb_config(portid_t pid, port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; /* re-configure the device . */ - rte_eth_dev_configure(pid, nb_rxq, nb_rxq, &port_conf); - + retval = rte_eth_dev_configure(pid, nb_rxq, nb_rxq, &port_conf); + if (retval < 0) + return retval; rte_eth_dev_info_get(pid, &rte_port->dev_info); /* If dev_info.vmdq_pool_base is greater than 0, @@ -3058,6 +3056,8 @@ print_stats(void) printf("\nPort statistics ===================================="); for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) nic_stats_display(fwd_ports_ids[i]); + + fflush(stdout); } static void diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 3ff11e64..37d61b80 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -119,12 +119,12 @@ struct fwd_stream { unsigned int retry_enabled; /* "read-write" results */ - unsigned int rx_packets; /**< received packets */ - unsigned int tx_packets; /**< received packets transmitted */ - unsigned int fwd_dropped; /**< received packets not forwarded */ - unsigned int rx_bad_ip_csum ; /**< received packets has bad ip checksum */ - unsigned int rx_bad_l4_csum ; /**< received packets has bad l4 checksum */ - unsigned int rx_bad_outer_l4_csum; + uint64_t rx_packets; /**< received packets */ + uint64_t tx_packets; /**< received packets transmitted */ + uint64_t fwd_dropped; /**< received packets not forwarded */ + uint64_t rx_bad_ip_csum ; /**< received packets has bad ip checksum */ + uint64_t rx_bad_l4_csum ; /**< received packets has bad l4 checksum */ + uint64_t rx_bad_outer_l4_csum; /**< received packets has bad outer l4 checksum */ unsigned int gro_times; /**< GRO operation times */ #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES @@ -173,7 +173,6 @@ struct rte_port { uint16_t tunnel_tso_segsz; /**< Segmentation offload MSS for tunneled pkts. */ uint16_t tx_vlan_id;/**< The tag ID */ uint16_t tx_vlan_id_outer;/**< The outer tag ID */ - void *fwd_ctx; /**< Forwarding mode context */ uint64_t rx_bad_ip_csum; /**< rx pkts with bad ip checksum */ uint64_t rx_bad_l4_csum; /**< rx pkts with bad l4 checksum */ uint64_t rx_bad_outer_l4_csum; -- cgit 1.2.3-korg