From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 24D0CA0524 for ; Fri, 5 Feb 2021 12:20:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E18C4067B; Fri, 5 Feb 2021 12:20:42 +0100 (CET) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mails.dpdk.org (Postfix) with ESMTP id F2A304067B for ; Fri, 5 Feb 2021 12:20:40 +0100 (CET) Received: by mail-wr1-f44.google.com with SMTP id l12so7302639wry.2 for ; Fri, 05 Feb 2021 03:20:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kb2nCWr71GZzG8gScaMD2GSedVp7s/t1IDtdJQc1UT4=; b=sp66a+cY3mDjXIyp3IdA5334tYsiQjKTqOqWT9Vws9lnnPRBLq3S624mV0MaXJY+pL G/yeDl1GR+SeqS8SGiSO7Bu3yry4xYWuPHNeUMc4U88bsrfIfOaQnjaBBHmV+iVHF8F4 RWWbJ3vpPlUUhUQUO34VrSmB624cODxHAI3M5mljcniAnNs4dBxg1UQwEWvqzA3yPac/ 1GoXMSWovcbXoObJjvuX166YeHqeYkAPCmv1lOmbvrvnhxH4ku8gdyZSrMEyG6y9BykJ Av0g0XuBybwmsz77lvdY0C79om573PLLNurHncmRf4nrtj2qmCHLkoTl2dQ46G+UD0/s GM1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kb2nCWr71GZzG8gScaMD2GSedVp7s/t1IDtdJQc1UT4=; b=OIlgfD2IJUcxtOSWMzq9P3ZfJy8oLXDm38fk5CI1PYJ6jAlFrKm/LU3qIy1NKXSMZF Xb+HWCypqHwckj4jYy7Kjdb49FAKYWIJY0jHMzf35z+EbdhlIdvnJPtp3lSGiBiUv2j5 tfyMi7rVRr3hXOnsL7387Zn8otwXqW7a61CHC49RLMZt2g9W4TXMxUfl4hybfkD9aI3H QM+jWUcroT1L4vBwSi5+wuMdHHkse/JctXk3JCAGTGrdwD1ryMMYEetc2LU7GERXR+SW D8hYU9srzSFUo0KoaDdBR0LaNyYiyc073GaXR6LglT6YxQF8m7TFsAFQzZHZ87MGlejM qWoA== X-Gm-Message-State: AOAM532rK0u1RQ5xbHNBdwKCgZcS52mpJdjVByKMv/oipoBObvEEA/OO AJJcykX7H7kfZEdUSw8GtlxzD5DeUDKk+Q== X-Google-Smtp-Source: ABdhPJxC5NDQAMbg1tOh1/z1XzLWpA5/V6rLprdtqDfeRj5cWM4rwdZRU527zGSN8BKddhIcsKB30A== X-Received: by 2002:a5d:470f:: with SMTP id y15mr4415209wrq.187.1612524040657; Fri, 05 Feb 2021 03:20:40 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id l14sm12032931wrq.87.2021.02.05.03.20.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:20:39 -0800 (PST) From: luca.boccassi@gmail.com To: Huisong Li Cc: Ferruh Yigit , dpdk stable Date: Fri, 5 Feb 2021 11:15:11 +0000 Message-Id: <20210205111920.1272063-25-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'app/testpmd: fix queue stats mapping configuration' has been queued to stable release 20.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/07/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/ed18af72c56f6c4c2b517844f44b8d330b0318e2 Thanks. Luca Boccassi --- >From ed18af72c56f6c4c2b517844f44b8d330b0318e2 Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Wed, 2 Dec 2020 20:48:55 +0800 Subject: [PATCH] app/testpmd: fix queue stats mapping configuration [ upstream commit 08dcd187068666c96e8a16604a1c96160ed310e9 ] Currently, the queue stats mapping has the following problems: 1) Many PMD drivers don't support queue stats mapping. But there is no failure message after executing the command "set stat_qmap rx 0 2 2". 2) Once queue mapping is set, unrelated and unmapped queues are also displayed. 3) The configuration result does not take effect or can not be queried in real time. 4) The mapping arrays, "tx_queue_stats_mappings_array" & "rx_queue_stats_mappings_array" are global and their sizes are based on fixed max port and queue size assumptions. 5) These record structures, 'map_port_queue_stats_mapping_registers()' and its sub functions are redundant for majority of drivers. 6) The display of the queue stats and queue stats mapping is mixed together. Since xstats is used to obtain queue statistics, we have made the following simplifications and adjustments: 1) If PMD requires and supports queue stats mapping, configure to driver in real time by calling ethdev API after executing the command "set stat_qmap rx/tx ...". If not, the command can not be accepted. 2) Based on the above adjustments, these record structures, 'map_port_queue_stats_mapping_registers()' and its sub functions can be removed. "tx-queue-stats-mapping" & "rx-queue-stats-mapping" parameters, and 'parse_queue_stats_mapping_config()' can be removed too. 3) remove display of queue stats mapping in 'fwd_stats_display()' & 'nic_stats_display()', and obtain queue stats by xstats. Since the record structures are removed, 'nic_stats_mapping_display()' can be deleted. Fixes: 4dccdc789bf4 ("app/testpmd: simplify handling of stats mappings error") Fixes: 013af9b6b64f ("app/testpmd: various updates") Fixes: ed30d9b691b2 ("app/testpmd: add stats per queue") Signed-off-by: Huisong Li Reviewed-by: Ferruh Yigit --- app/test-pmd/cmdline.c | 17 ++-- app/test-pmd/config.c | 144 +++++----------------------- app/test-pmd/parameters.c | 107 --------------------- app/test-pmd/testpmd.c | 193 ++++---------------------------------- app/test-pmd/testpmd.h | 22 ----- 5 files changed, 47 insertions(+), 436 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 0d2d6aad05..2ccbaa039e 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -163,7 +163,7 @@ static void cmd_help_long_parsed(void *parsed_result, "Display:\n" "--------\n\n" - "show port (info|stats|summary|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)\n" + "show port (info|stats|summary|xstats|fdir|dcb_tc|cap) (port_id|all)\n" " Display information for port_id, or all.\n\n" "show port port_id (module_eeprom|eeprom)\n" @@ -177,7 +177,7 @@ static void cmd_help_long_parsed(void *parsed_result, "show port (port_id) rss-hash [key]\n" " Display the RSS hash functions and RSS hash key of port\n\n" - "clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)\n" + "clear port (info|stats|xstats|fdir) (port_id|all)\n" " Clear information for port_id, or all.\n\n" "show (rxq|txq) info (port_id) (queue_id)\n" @@ -7555,9 +7555,6 @@ static void cmd_showportall_parsed(void *parsed_result, RTE_ETH_FOREACH_DEV(i) fdir_get_infos(i); #endif - else if (!strcmp(res->what, "stat_qmap")) - RTE_ETH_FOREACH_DEV(i) - nic_stats_mapping_display(i); else if (!strcmp(res->what, "dcb_tc")) RTE_ETH_FOREACH_DEV(i) port_dcb_info_display(i); @@ -7573,14 +7570,14 @@ cmdline_parse_token_string_t cmd_showportall_port = TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, port, "port"); cmdline_parse_token_string_t cmd_showportall_what = TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, what, - "info#summary#stats#xstats#fdir#stat_qmap#dcb_tc#cap"); + "info#summary#stats#xstats#fdir#dcb_tc#cap"); cmdline_parse_token_string_t cmd_showportall_all = TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, all, "all"); cmdline_parse_inst_t cmd_showportall = { .f = cmd_showportall_parsed, .data = NULL, .help_str = "show|clear port " - "info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap all", + "info|summary|stats|xstats|fdir|dcb_tc|cap all", .tokens = { (void *)&cmd_showportall_show, (void *)&cmd_showportall_port, @@ -7622,8 +7619,6 @@ static void cmd_showport_parsed(void *parsed_result, else if (!strcmp(res->what, "fdir")) fdir_get_infos(res->portnum); #endif - else if (!strcmp(res->what, "stat_qmap")) - nic_stats_mapping_display(res->portnum); else if (!strcmp(res->what, "dcb_tc")) port_dcb_info_display(res->portnum); else if (!strcmp(res->what, "cap")) @@ -7637,7 +7632,7 @@ cmdline_parse_token_string_t cmd_showport_port = TOKEN_STRING_INITIALIZER(struct cmd_showport_result, port, "port"); cmdline_parse_token_string_t cmd_showport_what = TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what, - "info#summary#stats#xstats#fdir#stat_qmap#dcb_tc#cap"); + "info#summary#stats#xstats#fdir#dcb_tc#cap"); cmdline_parse_token_num_t cmd_showport_portnum = TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, RTE_UINT16); @@ -7645,7 +7640,7 @@ cmdline_parse_inst_t cmd_showport = { .f = cmd_showport_parsed, .data = NULL, .help_str = "show|clear port " - "info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap " + "info|summary|stats|xstats|fdir|dcb_tc|cap " "", .tokens = { (void *)&cmd_showport_show, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index b51de59e1e..3f6c8642b1 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -183,8 +183,6 @@ nic_stats_display(portid_t port_id) diff_ns; uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx; struct rte_eth_stats stats; - struct rte_port *port = &ports[port_id]; - uint8_t i; static const char *nic_stats_border = "########################"; @@ -196,46 +194,12 @@ nic_stats_display(portid_t port_id) printf("\n %s NIC statistics for port %-2d %s\n", nic_stats_border, port_id, nic_stats_border); - if ((!port->rx_queue_stats_mapping_enabled) && (!port->tx_queue_stats_mapping_enabled)) { - printf(" RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" RX-bytes: " - "%-"PRIu64"\n", - stats.ipackets, stats.imissed, stats.ibytes); - printf(" RX-errors: %-"PRIu64"\n", stats.ierrors); - printf(" RX-nombuf: %-10"PRIu64"\n", - stats.rx_nombuf); - printf(" TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" TX-bytes: " - "%-"PRIu64"\n", - stats.opackets, stats.oerrors, stats.obytes); - } - else { - printf(" RX-packets: %10"PRIu64" RX-errors: %10"PRIu64 - " RX-bytes: %10"PRIu64"\n", - stats.ipackets, stats.ierrors, stats.ibytes); - printf(" RX-errors: %10"PRIu64"\n", stats.ierrors); - printf(" RX-nombuf: %10"PRIu64"\n", - stats.rx_nombuf); - printf(" TX-packets: %10"PRIu64" TX-errors: %10"PRIu64 - " TX-bytes: %10"PRIu64"\n", - stats.opackets, stats.oerrors, stats.obytes); - } - - if (port->rx_queue_stats_mapping_enabled) { - printf("\n"); - for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) { - printf(" Stats reg %2d RX-packets: %10"PRIu64 - " RX-errors: %10"PRIu64 - " RX-bytes: %10"PRIu64"\n", - i, stats.q_ipackets[i], stats.q_errors[i], stats.q_ibytes[i]); - } - } - if (port->tx_queue_stats_mapping_enabled) { - printf("\n"); - for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) { - printf(" Stats reg %2d TX-packets: %10"PRIu64 - " TX-bytes: %10"PRIu64"\n", - i, stats.q_opackets[i], stats.q_obytes[i]); - } - } + printf(" RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" RX-bytes: " + "%-"PRIu64"\n", stats.ipackets, stats.imissed, stats.ibytes); + printf(" RX-errors: %-"PRIu64"\n", stats.ierrors); + printf(" RX-nombuf: %-10"PRIu64"\n", stats.rx_nombuf); + printf(" TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" TX-bytes: " + "%-"PRIu64"\n", stats.opackets, stats.oerrors, stats.obytes); diff_ns = 0; if (clock_gettime(CLOCK_TYPE_ID, &cur_time) == 0) { @@ -398,54 +362,6 @@ nic_xstats_clear(portid_t port_id) } } -void -nic_stats_mapping_display(portid_t port_id) -{ - struct rte_port *port = &ports[port_id]; - uint16_t i; - - static const char *nic_stats_mapping_border = "########################"; - - if (port_id_is_invalid(port_id, ENABLED_WARN)) { - print_valid_ports(); - return; - } - - if ((!port->rx_queue_stats_mapping_enabled) && (!port->tx_queue_stats_mapping_enabled)) { - printf("Port id %d - either does not support queue statistic mapping or" - " no queue statistic mapping set\n", port_id); - return; - } - - printf("\n %s NIC statistics mapping for port %-2d %s\n", - nic_stats_mapping_border, port_id, nic_stats_mapping_border); - - if (port->rx_queue_stats_mapping_enabled) { - for (i = 0; i < nb_rx_queue_stats_mappings; i++) { - if (rx_queue_stats_mappings[i].port_id == port_id) { - printf(" RX-queue %2d mapped to Stats Reg %2d\n", - rx_queue_stats_mappings[i].queue_id, - rx_queue_stats_mappings[i].stats_counter_id); - } - } - printf("\n"); - } - - - if (port->tx_queue_stats_mapping_enabled) { - for (i = 0; i < nb_tx_queue_stats_mappings; i++) { - if (tx_queue_stats_mappings[i].port_id == port_id) { - printf(" TX-queue %2d mapped to Stats Reg %2d\n", - tx_queue_stats_mappings[i].queue_id, - tx_queue_stats_mappings[i].stats_counter_id); - } - } - } - - printf(" %s####################################%s\n", - nic_stats_mapping_border, nic_stats_mapping_border); -} - void rx_queue_infos_display(portid_t port_id, uint16_t queue_id) { @@ -2573,7 +2489,7 @@ tx_queue_id_is_invalid(queueid_t txq_id) { if (txq_id < nb_txq) return 0; - printf("Invalid TX queue %d (must be < nb_rxq=%d)\n", txq_id, nb_txq); + printf("Invalid TX queue %d (must be < nb_txq=%d)\n", txq_id, nb_txq); return 1; } @@ -4528,8 +4444,7 @@ tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on) void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value) { - uint16_t i; - uint8_t existing_mapping_found = 0; + int ret; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -4539,40 +4454,23 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value) if (map_value >= RTE_ETHDEV_QUEUE_STAT_CNTRS) { printf("map_value not in required range 0..%d\n", - RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); + RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); return; } - if (!is_rx) { /*then tx*/ - for (i = 0; i < nb_tx_queue_stats_mappings; i++) { - if ((tx_queue_stats_mappings[i].port_id == port_id) && - (tx_queue_stats_mappings[i].queue_id == queue_id)) { - tx_queue_stats_mappings[i].stats_counter_id = map_value; - existing_mapping_found = 1; - break; - } + if (!is_rx) { /* tx */ + ret = rte_eth_dev_set_tx_queue_stats_mapping(port_id, queue_id, + map_value); + if (ret) { + printf("failed to set tx queue stats mapping.\n"); + return; } - if (!existing_mapping_found) { /* A new additional mapping... */ - tx_queue_stats_mappings[nb_tx_queue_stats_mappings].port_id = port_id; - tx_queue_stats_mappings[nb_tx_queue_stats_mappings].queue_id = queue_id; - tx_queue_stats_mappings[nb_tx_queue_stats_mappings].stats_counter_id = map_value; - nb_tx_queue_stats_mappings++; - } - } - else { /*rx*/ - for (i = 0; i < nb_rx_queue_stats_mappings; i++) { - if ((rx_queue_stats_mappings[i].port_id == port_id) && - (rx_queue_stats_mappings[i].queue_id == queue_id)) { - rx_queue_stats_mappings[i].stats_counter_id = map_value; - existing_mapping_found = 1; - break; - } - } - if (!existing_mapping_found) { /* A new additional mapping... */ - rx_queue_stats_mappings[nb_rx_queue_stats_mappings].port_id = port_id; - rx_queue_stats_mappings[nb_rx_queue_stats_mappings].queue_id = queue_id; - rx_queue_stats_mappings[nb_rx_queue_stats_mappings].stats_counter_id = map_value; - nb_rx_queue_stats_mappings++; + } else { /* rx */ + ret = rte_eth_dev_set_rx_queue_stats_mapping(port_id, queue_id, + map_value); + if (ret) { + printf("failed to set rx queue stats mapping.\n"); + return; } } } diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index bbb68a55ff..414a0068fb 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -176,12 +176,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(" --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); - printf(" --rx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: " - "rx queues statistics counters mapping " - "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); printf(" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n"); printf(" --rxoffs=X[,Y]*: set RX segment offsets for split.\n"); @@ -300,93 +294,6 @@ parse_fwd_portmask(const char *portmask) set_fwd_ports_mask((uint64_t) pm); } - -static int -parse_queue_stats_mapping_config(const char *q_arg, int is_rx) -{ - char s[256]; - const char *p, *p0 = q_arg; - char *end; - enum fieldnames { - FLD_PORT = 0, - FLD_QUEUE, - FLD_STATS_COUNTER, - _NUM_FLD - }; - unsigned long int_fld[_NUM_FLD]; - char *str_fld[_NUM_FLD]; - int i; - unsigned size; - - /* reset from value set at definition */ - is_rx ? (nb_rx_queue_stats_mappings = 0) : (nb_tx_queue_stats_mappings = 0); - - while ((p = strchr(p0,'(')) != NULL) { - ++p; - if((p0 = strchr(p,')')) == NULL) - return -1; - - size = p0 - p; - if(size >= sizeof(s)) - return -1; - - snprintf(s, sizeof(s), "%.*s", size, p); - if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD) - return -1; - for (i = 0; i < _NUM_FLD; i++){ - errno = 0; - int_fld[i] = strtoul(str_fld[i], &end, 0); - if (errno != 0 || end == str_fld[i] || int_fld[i] > 255) - return -1; - } - /* Check mapping field is in correct range (0..RTE_ETHDEV_QUEUE_STAT_CNTRS-1) */ - if (int_fld[FLD_STATS_COUNTER] >= RTE_ETHDEV_QUEUE_STAT_CNTRS) { - printf("Stats counter not in the correct range 0..%d\n", - RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); - return -1; - } - - if (!is_rx) { - if ((nb_tx_queue_stats_mappings >= - MAX_TX_QUEUE_STATS_MAPPINGS)) { - printf("exceeded max number of TX queue " - "statistics mappings: %hu\n", - nb_tx_queue_stats_mappings); - return -1; - } - tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].port_id = - (uint8_t)int_fld[FLD_PORT]; - tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].queue_id = - (uint8_t)int_fld[FLD_QUEUE]; - tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].stats_counter_id = - (uint8_t)int_fld[FLD_STATS_COUNTER]; - ++nb_tx_queue_stats_mappings; - } - else { - if ((nb_rx_queue_stats_mappings >= - MAX_RX_QUEUE_STATS_MAPPINGS)) { - printf("exceeded max number of RX queue " - "statistics mappings: %hu\n", - nb_rx_queue_stats_mappings); - return -1; - } - rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].port_id = - (uint8_t)int_fld[FLD_PORT]; - rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].queue_id = - (uint8_t)int_fld[FLD_QUEUE]; - rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].stats_counter_id = - (uint8_t)int_fld[FLD_STATS_COUNTER]; - ++nb_rx_queue_stats_mappings; - } - - } -/* Reassign the rx/tx_queue_stats_mappings pointer to point to this newly populated array rather */ -/* than to the default array (that was set at its definition) */ - is_rx ? (rx_queue_stats_mappings = rx_queue_stats_mappings_array) : - (tx_queue_stats_mappings = tx_queue_stats_mappings_array); - return 0; -} - static void print_invalid_socket_id_error(void) { @@ -664,8 +571,6 @@ launch_args_parse(int argc, char** argv) { "rxht", 1, 0, 0 }, { "rxwt", 1, 0, 0 }, { "rxfreet", 1, 0, 0 }, - { "tx-queue-stats-mapping", 1, 0, 0 }, - { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, { "rxoffs", 1, 0, 0 }, @@ -1279,18 +1184,6 @@ launch_args_parse(int argc, char** argv) else rte_exit(EXIT_FAILURE, "rxfreet must be >= 0\n"); } - if (!strcmp(lgopts[opt_idx].name, "tx-queue-stats-mapping")) { - if (parse_queue_stats_mapping_config(optarg, TX)) { - rte_exit(EXIT_FAILURE, - "invalid TX queue statistics mapping config entered\n"); - } - } - if (!strcmp(lgopts[opt_idx].name, "rx-queue-stats-mapping")) { - if (parse_queue_stats_mapping_config(optarg, RX)) { - rte_exit(EXIT_FAILURE, - "invalid RX queue statistics mapping config entered\n"); - } - } if (!strcmp(lgopts[opt_idx].name, "rxoffs")) { unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT]; unsigned int nb_offs; diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 33fc0fddf5..33a060dffd 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -476,15 +476,6 @@ struct rte_fdir_conf fdir_conf = { volatile int test_done = 1; /* stop packet forwarding when set to 1. */ -struct queue_stats_mappings tx_queue_stats_mappings_array[MAX_TX_QUEUE_STATS_MAPPINGS]; -struct queue_stats_mappings rx_queue_stats_mappings_array[MAX_RX_QUEUE_STATS_MAPPINGS]; - -struct queue_stats_mappings *tx_queue_stats_mappings = tx_queue_stats_mappings_array; -struct queue_stats_mappings *rx_queue_stats_mappings = rx_queue_stats_mappings_array; - -uint16_t nb_tx_queue_stats_mappings = 0; -uint16_t nb_rx_queue_stats_mappings = 0; - /* * Display zero values by default for xstats */ @@ -520,8 +511,6 @@ enum rte_eth_rx_mq_mode rx_mq_mode = ETH_MQ_RX_VMDQ_DCB_RSS; /* Forward function declarations */ static void setup_attached_port(portid_t pi); -static void map_port_queue_stats_mapping_registers(portid_t pi, - struct rte_port *port); static void check_all_ports_link_status(uint32_t port_mask); static int eth_event_callback(portid_t port_id, enum rte_eth_event_type type, @@ -1857,8 +1846,6 @@ fwd_stats_display(void) fwd_cycles += fs->core_cycles; } for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { - uint8_t j; - pt_id = fwd_ports_ids[i]; port = &ports[pt_id]; @@ -1881,88 +1868,34 @@ fwd_stats_display(void) printf("\n %s Forward statistics for port %-2d %s\n", fwd_stats_border, pt_id, fwd_stats_border); - if (!port->rx_queue_stats_mapping_enabled && - !port->tx_queue_stats_mapping_enabled) { - printf(" RX-packets: %-14"PRIu64 - " RX-dropped: %-14"PRIu64 - "RX-total: %-"PRIu64"\n", - 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", - ports_stats[pt_id].rx_bad_ip_csum, - ports_stats[pt_id].rx_bad_l4_csum, - ports_stats[pt_id].rx_bad_outer_l4_csum); - if (stats.ierrors + stats.rx_nombuf > 0) { - printf(" RX-error: %-"PRIu64"\n", - stats.ierrors); - printf(" RX-nombufs: %-14"PRIu64"\n", - stats.rx_nombuf); - } - - printf(" TX-packets: %-14"PRIu64 - " TX-dropped: %-14"PRIu64 - "TX-total: %-"PRIu64"\n", - stats.opackets, ports_stats[pt_id].tx_dropped, - stats.opackets + ports_stats[pt_id].tx_dropped); - } else { - printf(" RX-packets: %14"PRIu64 - " RX-dropped:%14"PRIu64 - " RX-total:%14"PRIu64"\n", - 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", - ports_stats[pt_id].rx_bad_ip_csum, - ports_stats[pt_id].rx_bad_l4_csum, - ports_stats[pt_id].rx_bad_outer_l4_csum); - if ((stats.ierrors + stats.rx_nombuf) > 0) { - printf(" RX-error:%"PRIu64"\n", stats.ierrors); - printf(" RX-nombufs: %14"PRIu64"\n", - stats.rx_nombuf); - } - - printf(" TX-packets: %14"PRIu64 - " TX-dropped:%14"PRIu64 - " TX-total:%14"PRIu64"\n", - stats.opackets, ports_stats[pt_id].tx_dropped, - stats.opackets + ports_stats[pt_id].tx_dropped); + printf(" RX-packets: %-14"PRIu64" RX-dropped: %-14"PRIu64 + "RX-total: %-"PRIu64"\n", 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", + ports_stats[pt_id].rx_bad_ip_csum, + ports_stats[pt_id].rx_bad_l4_csum, + ports_stats[pt_id].rx_bad_outer_l4_csum); + if (stats.ierrors + stats.rx_nombuf > 0) { + printf(" RX-error: %-"PRIu64"\n", stats.ierrors); + printf(" RX-nombufs: %-14"PRIu64"\n", stats.rx_nombuf); } + printf(" TX-packets: %-14"PRIu64" TX-dropped: %-14"PRIu64 + "TX-total: %-"PRIu64"\n", + stats.opackets, ports_stats[pt_id].tx_dropped, + stats.opackets + ports_stats[pt_id].tx_dropped); + if (record_burst_stats) { if (ports_stats[pt_id].rx_stream) pkt_burst_stats_display("RX", &ports_stats[pt_id].rx_stream->rx_burst_stats); if (ports_stats[pt_id].tx_stream) pkt_burst_stats_display("TX", - &ports_stats[pt_id].tx_stream->tx_burst_stats); - } - - if (port->rx_queue_stats_mapping_enabled) { - printf("\n"); - for (j = 0; j < RTE_ETHDEV_QUEUE_STAT_CNTRS; j++) { - printf(" Stats reg %2d RX-packets:%14"PRIu64 - " RX-errors:%14"PRIu64 - " RX-bytes:%14"PRIu64"\n", - j, stats.q_ipackets[j], - stats.q_errors[j], stats.q_ibytes[j]); - } - printf("\n"); - } - if (port->tx_queue_stats_mapping_enabled) { - for (j = 0; j < RTE_ETHDEV_QUEUE_STAT_CNTRS; j++) { - printf(" Stats reg %2d TX-packets:%14"PRIu64 - " TX-bytes:%14" - PRIu64"\n", - j, stats.q_opackets[j], - stats.q_obytes[j]); - } + &ports_stats[pt_id].tx_stream->tx_burst_stats); } printf(" %s--------------------------------%s\n", @@ -2236,11 +2169,6 @@ start_packet_forwarding(int with_tx_first) rxtx_config_display(); fwd_stats_reset(); - for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { - pt_id = fwd_ports_ids[i]; - port = &ports[pt_id]; - map_port_queue_stats_mapping_registers(pt_id, port); - } if (with_tx_first) { port_fwd_begin = tx_only_engine.port_fwd_begin; if (port_fwd_begin != NULL) { @@ -3352,84 +3280,6 @@ dev_event_callback(const char *device_name, enum rte_dev_event_type type, } } -static int -set_tx_queue_stats_mapping_registers(portid_t port_id, struct rte_port *port) -{ - uint16_t i; - int diag; - uint8_t mapping_found = 0; - - for (i = 0; i < nb_tx_queue_stats_mappings; i++) { - if ((tx_queue_stats_mappings[i].port_id == port_id) && - (tx_queue_stats_mappings[i].queue_id < nb_txq )) { - diag = rte_eth_dev_set_tx_queue_stats_mapping(port_id, - tx_queue_stats_mappings[i].queue_id, - tx_queue_stats_mappings[i].stats_counter_id); - if (diag != 0) - return diag; - mapping_found = 1; - } - } - if (mapping_found) - port->tx_queue_stats_mapping_enabled = 1; - return 0; -} - -static int -set_rx_queue_stats_mapping_registers(portid_t port_id, struct rte_port *port) -{ - uint16_t i; - int diag; - uint8_t mapping_found = 0; - - for (i = 0; i < nb_rx_queue_stats_mappings; i++) { - if ((rx_queue_stats_mappings[i].port_id == port_id) && - (rx_queue_stats_mappings[i].queue_id < nb_rxq )) { - diag = rte_eth_dev_set_rx_queue_stats_mapping(port_id, - rx_queue_stats_mappings[i].queue_id, - rx_queue_stats_mappings[i].stats_counter_id); - if (diag != 0) - return diag; - mapping_found = 1; - } - } - if (mapping_found) - port->rx_queue_stats_mapping_enabled = 1; - return 0; -} - -static void -map_port_queue_stats_mapping_registers(portid_t pi, struct rte_port *port) -{ - int diag = 0; - - diag = set_tx_queue_stats_mapping_registers(pi, port); - if (diag != 0) { - if (diag == -ENOTSUP) { - port->tx_queue_stats_mapping_enabled = 0; - printf("TX queue stats mapping not supported port id=%d\n", pi); - } - else - rte_exit(EXIT_FAILURE, - "set_tx_queue_stats_mapping_registers " - "failed for port id=%d diag=%d\n", - pi, diag); - } - - diag = set_rx_queue_stats_mapping_registers(pi, port); - if (diag != 0) { - if (diag == -ENOTSUP) { - port->rx_queue_stats_mapping_enabled = 0; - printf("RX queue stats mapping not supported port id=%d\n", pi); - } - else - rte_exit(EXIT_FAILURE, - "set_rx_queue_stats_mapping_registers " - "failed for port id=%d diag=%d\n", - pi, diag); - } -} - static void rxtx_port_config(struct rte_port *port) { @@ -3526,7 +3376,6 @@ init_port_config(void) if (ret != 0) return; - map_port_queue_stats_mapping_registers(pid, port); #if defined RTE_NET_IXGBE && defined RTE_LIBRTE_IXGBE_BYPASS rte_pmd_ixgbe_bypass_init(pid); #endif @@ -3737,8 +3586,6 @@ init_port_dcb_config(portid_t pid, if (retval != 0) return retval; - map_port_queue_stats_mapping_registers(pid, rte_port); - rte_port->dcb_flag = 1; return 0; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 6b901a894f..5f23162107 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -206,8 +206,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 */ - uint8_t tx_queue_stats_mapping_enabled; - uint8_t rx_queue_stats_mapping_enabled; volatile uint16_t port_status; /**< port started or not */ uint8_t need_setup; /**< port just attached */ uint8_t need_reconfig; /**< need reconfiguring port or not */ @@ -326,25 +324,6 @@ enum dcb_mode_enable DCB_ENABLED }; -#define MAX_TX_QUEUE_STATS_MAPPINGS 1024 /* MAX_PORT of 32 @ 32 tx_queues/port */ -#define MAX_RX_QUEUE_STATS_MAPPINGS 4096 /* MAX_PORT of 32 @ 128 rx_queues/port */ - -struct queue_stats_mappings { - portid_t port_id; - uint16_t queue_id; - uint8_t stats_counter_id; -} __rte_cache_aligned; - -extern struct queue_stats_mappings tx_queue_stats_mappings_array[]; -extern struct queue_stats_mappings rx_queue_stats_mappings_array[]; - -/* Assign both tx and rx queue stats mappings to the same default values */ -extern struct queue_stats_mappings *tx_queue_stats_mappings; -extern struct queue_stats_mappings *rx_queue_stats_mappings; - -extern uint16_t nb_tx_queue_stats_mappings; -extern uint16_t nb_rx_queue_stats_mappings; - extern uint8_t xstats_hide_zero; /**< Hide zero values for xstats display */ /* globals used for configuration */ @@ -790,7 +769,6 @@ void nic_stats_display(portid_t port_id); void nic_stats_clear(portid_t port_id); void nic_xstats_display(portid_t port_id); void nic_xstats_clear(portid_t port_id); -void nic_stats_mapping_display(portid_t port_id); void device_infos_display(const char *identifier); void port_infos_display(portid_t port_id); void port_summary_display(portid_t port_id); -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-05 11:18:30.420030612 +0000 +++ 0025-app-testpmd-fix-queue-stats-mapping-configuration.patch 2021-02-05 11:18:28.630687761 +0000 @@ -1 +1 @@ -From 08dcd187068666c96e8a16604a1c96160ed310e9 Mon Sep 17 00:00:00 2001 +From ed18af72c56f6c4c2b517844f44b8d330b0318e2 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 08dcd187068666c96e8a16604a1c96160ed310e9 ] + @@ -39 +40,0 @@ -Cc: stable@dpdk.org