From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id F404A1B45F for ; Thu, 14 Feb 2019 16:43:15 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B46E81DF9; Thu, 14 Feb 2019 15:43:15 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-16.brq.redhat.com [10.40.204.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C8F0600C4; Thu, 14 Feb 2019 15:43:12 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com Date: Thu, 14 Feb 2019 16:42:52 +0100 Message-Id: <1550158972-21895-6-git-send-email-david.marchand@redhat.com> In-Reply-To: <1550158972-21895-1-git-send-email-david.marchand@redhat.com> References: <1550158972-21895-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 14 Feb 2019 15:43:15 +0000 (UTC) Subject: [dpdk-dev] [PATCH 5/5] app/testpmd: display/clear forwarding stats on demand X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2019 15:43:16 -0000 Add a new "show/clear fwd stats all" command to display fwd and port statistics on the fly. To be able to do so, rte_port can't be used to maintain any statistics. Moved the stats dump parts from stop_packet_forwarding() and merge with fwd_port_stats_display() into fwd_stats_display(). fwd engine statistics are then aggregated into a local per port array. Signed-off-by: David Marchand --- app/test-pmd/cmdline.c | 44 +++ app/test-pmd/testpmd.c | 426 +++++++++++++++------------- app/test-pmd/testpmd.h | 9 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 36 +++ 4 files changed, 306 insertions(+), 209 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index db53cc0..58b11b7 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -7386,6 +7386,49 @@ struct cmd_showqueue_result { }, }; +/* show/clear fwd engine statistics */ +struct fwd_result { + cmdline_fixed_string_t action; + cmdline_fixed_string_t fwd; + cmdline_fixed_string_t stats; + cmdline_fixed_string_t all; +}; + +cmdline_parse_token_string_t cmd_fwd_action = + TOKEN_STRING_INITIALIZER(struct fwd_result, action, "show#clear"); +cmdline_parse_token_string_t cmd_fwd_fwd = + TOKEN_STRING_INITIALIZER(struct fwd_result, fwd, "fwd"); +cmdline_parse_token_string_t cmd_fwd_stats = + TOKEN_STRING_INITIALIZER(struct fwd_result, stats, "stats"); +cmdline_parse_token_string_t cmd_fwd_all = + TOKEN_STRING_INITIALIZER(struct fwd_result, all, "all"); + +static void +cmd_fwd_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ + struct fwd_result *res = parsed_result; + + if (!strcmp(res->action, "show")) + fwd_stats_display(); + else + fwd_stats_reset(); +} + +static cmdline_parse_inst_t cmd_fwdall = { + .f = cmd_fwd_parsed, + .data = NULL, + .help_str = "show|clear fwd stats all", + .tokens = { + (void *)&cmd_fwd_action, + (void *)&cmd_fwd_fwd, + (void *)&cmd_fwd_stats, + (void *)&cmd_fwd_all, + NULL, + }, +}; + /* *** READ PORT REGISTER *** */ struct cmd_read_reg_result { cmdline_fixed_string_t read; @@ -18559,6 +18602,7 @@ struct cmd_show_tx_metadata_result { (cmdline_parse_inst_t *)&cmd_showqueue, (cmdline_parse_inst_t *)&cmd_showportall, (cmdline_parse_inst_t *)&cmd_showcfg, + (cmdline_parse_inst_t *)&cmd_fwdall, (cmdline_parse_inst_t *)&cmd_start, (cmdline_parse_inst_t *)&cmd_start_tx_first, (cmdline_parse_inst_t *)&cmd_start_tx_first_n, diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index ab110b0..e70ad20 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1361,91 +1361,6 @@ struct extmem_param { #endif /* RTE_TEST_PMD_RECORD_BURST_STATS */ static void -fwd_port_stats_display(portid_t port_id, struct rte_eth_stats *stats) -{ - struct rte_port *port; - uint8_t i; - - static const char *fwd_stats_border = "----------------------"; - - port = &ports[port_id]; - printf("\n %s Forward statistics for port %-2d %s\n", - fwd_stats_border, port_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", - port->rx_bad_ip_csum, port->rx_bad_l4_csum, - port->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, 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, - 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", - port->rx_bad_ip_csum, port->rx_bad_l4_csum, - port->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, port->tx_dropped, - stats->opackets + port->tx_dropped); - } - -#ifdef RTE_TEST_PMD_RECORD_BURST_STATS - if (port->rx_stream) - pkt_burst_stats_display("RX", - &port->rx_stream->rx_burst_stats); - if (port->tx_stream) - pkt_burst_stats_display("TX", - &port->tx_stream->tx_burst_stats); -#endif - - 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:%14"PRIu64 - " RX-errors:%14"PRIu64 - " RX-bytes:%14"PRIu64"\n", - i, stats->q_ipackets[i], stats->q_errors[i], stats->q_ibytes[i]); - } - printf("\n"); - } - if (port->tx_queue_stats_mapping_enabled) { - for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) { - printf(" Stats reg %2d TX-packets:%14"PRIu64 - " TX-bytes:%14"PRIu64"\n", - i, stats->q_opackets[i], stats->q_obytes[i]); - } - } - - printf(" %s--------------------------------%s\n", - fwd_stats_border, fwd_stats_border); -} - -static void fwd_stream_stats_display(streamid_t stream_id) { struct fwd_stream *fs; @@ -1478,6 +1393,225 @@ struct extmem_param { #endif } +void +fwd_stats_display(void) +{ + static const char *fwd_stats_border = "----------------------"; + static const char *acc_stats_border = "+++++++++++++++"; + struct { + struct fwd_stream *rx_stream; + struct fwd_stream *tx_stream; + uint64_t tx_dropped; + uint64_t rx_bad_ip_csum; + uint64_t rx_bad_l4_csum; + uint64_t rx_bad_outer_l4_csum; + } ports_stats[RTE_MAX_ETHPORTS]; + uint64_t total_rx_dropped = 0; + uint64_t total_tx_dropped = 0; + uint64_t total_rx_nombuf = 0; + struct rte_eth_stats stats; +#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES + uint64_t fwd_cycles = 0; +#endif + uint64_t total_recv = 0; + uint64_t total_xmit = 0; + struct rte_port *port; + streamid_t sm_id; + portid_t pt_id; + int i; + + memset(ports_stats, 0, sizeof(ports_stats)); + + 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); + } else { + ports_stats[fs->tx_port].tx_stream = fs; + ports_stats[fs->rx_port].rx_stream = fs; + } + + ports_stats[fs->tx_port].tx_dropped += fs->fwd_dropped; + + ports_stats[fs->rx_port].rx_bad_ip_csum += fs->rx_bad_ip_csum; + ports_stats[fs->rx_port].rx_bad_l4_csum += fs->rx_bad_l4_csum; + ports_stats[fs->rx_port].rx_bad_outer_l4_csum += + fs->rx_bad_outer_l4_csum; + +#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES + fwd_cycles += fs->core_cycles; +#endif + } + for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { + uint8_t j; + + pt_id = fwd_ports_ids[i]; + port = &ports[pt_id]; + + rte_eth_stats_get(pt_id, &stats); + stats.ipackets -= port->stats.ipackets; + stats.opackets -= port->stats.opackets; + stats.ibytes -= port->stats.ibytes; + stats.obytes -= port->stats.obytes; + stats.imissed -= port->stats.imissed; + stats.oerrors -= port->stats.oerrors; + stats.rx_nombuf -= port->stats.rx_nombuf; + + total_recv += stats.ipackets; + total_xmit += stats.opackets; + total_rx_dropped += stats.imissed; + ports_stats[pt_id].tx_dropped += stats.oerrors; + total_tx_dropped += ports_stats[pt_id].tx_dropped; + total_tx_dropped += stats.oerrors; + total_rx_nombuf += stats.rx_nombuf; + + 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); + } + +#ifdef RTE_TEST_PMD_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); +#endif + + 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]); + } + } + + printf(" %s--------------------------------%s\n", + fwd_stats_border, fwd_stats_border); + } + + printf("\n %s Accumulated forward statistics for all ports" + "%s\n", + acc_stats_border, acc_stats_border); + printf(" RX-packets: %-14"PRIu64" RX-dropped: %-14"PRIu64"RX-total: " + "%-"PRIu64"\n" + " TX-packets: %-14"PRIu64" TX-dropped: %-14"PRIu64"TX-total: " + "%-"PRIu64"\n", + total_recv, total_rx_dropped, total_recv + total_rx_dropped, + total_xmit, total_tx_dropped, total_xmit + total_tx_dropped); + if (total_rx_nombuf > 0) + printf(" RX-nombufs: %-14"PRIu64"\n", total_rx_nombuf); + printf(" %s++++++++++++++++++++++++++++++++++++++++++++++" + "%s\n", + acc_stats_border, acc_stats_border); +#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES + if (total_recv > 0) + printf("\n CPU cycles/packet=%u (total cycles=" + "%"PRIu64" / total RX packets=%"PRIu64")\n", + (unsigned int)(fwd_cycles / total_recv), + fwd_cycles, total_recv); +#endif +} + +void +fwd_stats_reset(void) +{ + streamid_t sm_id; + portid_t pt_id; + int i; + + for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { + pt_id = fwd_ports_ids[i]; + rte_eth_stats_get(pt_id, &ports[pt_id].stats); + } + for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) { + struct fwd_stream *fs = fwd_streams[sm_id]; + + fs->rx_packets = 0; + fs->tx_packets = 0; + fs->fwd_dropped = 0; + fs->rx_bad_ip_csum = 0; + fs->rx_bad_l4_csum = 0; + fs->rx_bad_outer_l4_csum = 0; + +#ifdef RTE_TEST_PMD_RECORD_BURST_STATS + memset(&fs->rx_burst_stats, 0, sizeof(fs->rx_burst_stats)); + memset(&fs->tx_burst_stats, 0, sizeof(fs->tx_burst_stats)); +#endif +#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES + fs->core_cycles = 0; +#endif + } +} + static void flush_fwd_rx_queues(void) { @@ -1633,7 +1767,6 @@ struct extmem_param { struct rte_port *port; unsigned int i; portid_t pt_id; - streamid_t sm_id; if (strcmp(cur_fwd_eng->fwd_mode_name, "rxonly") == 0 && !nb_rxq) rte_exit(EXIT_FAILURE, "rxq are 0, cannot use rxonly fwd mode\n"); @@ -1684,32 +1817,12 @@ struct extmem_param { pkt_fwd_config_display(&cur_fwd_config); 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]; - rte_eth_stats_get(pt_id, &port->stats); - port->tx_dropped = 0; - map_port_queue_stats_mapping_registers(pt_id, port); } - for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) { - fwd_streams[sm_id]->rx_packets = 0; - fwd_streams[sm_id]->tx_packets = 0; - fwd_streams[sm_id]->fwd_dropped = 0; - fwd_streams[sm_id]->rx_bad_ip_csum = 0; - fwd_streams[sm_id]->rx_bad_l4_csum = 0; - fwd_streams[sm_id]->rx_bad_outer_l4_csum = 0; - -#ifdef RTE_TEST_PMD_RECORD_BURST_STATS - memset(&fwd_streams[sm_id]->rx_burst_stats, 0, - sizeof(fwd_streams[sm_id]->rx_burst_stats)); - memset(&fwd_streams[sm_id]->tx_burst_stats, 0, - sizeof(fwd_streams[sm_id]->tx_burst_stats)); -#endif -#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES - fwd_streams[sm_id]->core_cycles = 0; -#endif - } if (with_tx_first) { port_fwd_begin = tx_only_engine.port_fwd_begin; if (port_fwd_begin != NULL) { @@ -1733,23 +1846,10 @@ struct extmem_param { void stop_packet_forwarding(void) { - struct rte_eth_stats stats; - struct rte_port *port; - port_fwd_end_t port_fwd_end; + port_fwd_end_t port_fwd_end; + lcoreid_t lc_id; + portid_t pt_id; int i; - portid_t pt_id; - streamid_t sm_id; - lcoreid_t lc_id; - uint64_t total_recv; - uint64_t total_xmit; - uint64_t total_rx_dropped; - uint64_t total_tx_dropped; - uint64_t total_rx_nombuf; -#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES - uint64_t fwd_cycles; -#endif - - static const char *acc_stats_border = "+++++++++++++++"; if (test_done) { printf("Packet forwarding not started\n"); @@ -1767,87 +1867,9 @@ struct extmem_param { (*port_fwd_end)(pt_id); } } -#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES - 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[fs->tx_port].tx_stream = NULL; - ports[fs->rx_port].rx_stream = NULL; - } else { - 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 += fs->core_cycles; -#endif - } - total_recv = 0; - total_xmit = 0; - total_rx_dropped = 0; - total_tx_dropped = 0; - total_rx_nombuf = 0; - for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { - pt_id = fwd_ports_ids[i]; - - port = &ports[pt_id]; - rte_eth_stats_get(pt_id, &stats); - stats.ipackets -= port->stats.ipackets; - port->stats.ipackets = 0; - stats.opackets -= port->stats.opackets; - port->stats.opackets = 0; - stats.ibytes -= port->stats.ibytes; - port->stats.ibytes = 0; - stats.obytes -= port->stats.obytes; - port->stats.obytes = 0; - stats.imissed -= port->stats.imissed; - port->stats.imissed = 0; - stats.oerrors -= port->stats.oerrors; - port->stats.oerrors = 0; - stats.rx_nombuf -= port->stats.rx_nombuf; - port->stats.rx_nombuf = 0; - - total_recv += stats.ipackets; - total_xmit += stats.opackets; - total_rx_dropped += stats.imissed; - port->tx_dropped += stats.oerrors; - total_tx_dropped += port->tx_dropped; - total_rx_nombuf += stats.rx_nombuf; - fwd_port_stats_display(pt_id, &stats); - } + fwd_stats_display(); - printf("\n %s Accumulated forward statistics for all ports" - "%s\n", - acc_stats_border, acc_stats_border); - printf(" RX-packets: %-14"PRIu64" RX-dropped: %-14"PRIu64"RX-total: " - "%-"PRIu64"\n" - " TX-packets: %-14"PRIu64" TX-dropped: %-14"PRIu64"TX-total: " - "%-"PRIu64"\n", - total_recv, total_rx_dropped, total_recv + total_rx_dropped, - total_xmit, total_tx_dropped, total_xmit + total_tx_dropped); - if (total_rx_nombuf > 0) - printf(" RX-nombufs: %-14"PRIu64"\n", total_rx_nombuf); - printf(" %s++++++++++++++++++++++++++++++++++++++++++++++" - "%s\n", - acc_stats_border, acc_stats_border); -#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES - if (total_recv > 0) - printf("\n CPU cycles/packet=%u (total cycles=" - "%"PRIu64" / total RX packets=%"PRIu64")\n", - (unsigned int)(fwd_cycles / total_recv), - fwd_cycles, total_recv); -#endif printf("\nDone.\n"); test_done = 1; } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 4f4a48f..f43b1a7 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -164,19 +164,12 @@ struct rte_port { struct rte_eth_conf dev_conf; /**< Port configuration. */ struct ether_addr eth_addr; /**< Port ethernet address */ struct rte_eth_stats stats; /**< Last port statistics */ - uint64_t tx_dropped; /**< If no descriptor in TX ring */ - 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 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 */ uint16_t tx_vlan_id_outer;/**< The outer tag ID */ - 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; - /**< rx pkts with bad outer l4 checksum */ uint8_t tx_queue_stats_mapping_enabled; uint8_t rx_queue_stats_mapping_enabled; volatile uint16_t port_status; /**< port started or not */ @@ -767,6 +760,8 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type, char *list_pkt_forwarding_retry_modes(void); void set_pkt_forwarding_mode(const char *fwd_mode); void start_packet_forwarding(int with_tx_first); +void fwd_stats_display(void); +void fwd_stats_reset(void); void stop_packet_forwarding(void); void dev_set_link_up(portid_t pid); void dev_set_link_down(portid_t pid); diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 0291480..a20c2c9 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -336,6 +336,42 @@ Example:: Set rxonly packet forwarding mode +show fwd +~~~~~~~~ + +When running, forwarding engines maintain statistics from the time they have been started. +Example for the io forwarding engine, with some packet drops on the tx side:: + + testpmd> show fwd stats all + + ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 ------- + RX-packets: 274293770 TX-packets: 274293642 TX-dropped: 128 + + ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 ------- + RX-packets: 274301850 TX-packets: 274301850 TX-dropped: 0 + + ---------------------- Forward statistics for port 0 ---------------------- + RX-packets: 274293802 RX-dropped: 0 RX-total: 274293802 + TX-packets: 274301862 TX-dropped: 0 TX-total: 274301862 + ---------------------------------------------------------------------------- + + ---------------------- Forward statistics for port 1 ---------------------- + RX-packets: 274301894 RX-dropped: 0 RX-total: 274301894 + TX-packets: 274293706 TX-dropped: 128 TX-total: 274293834 + ---------------------------------------------------------------------------- + + +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++ + RX-packets: 548595696 RX-dropped: 0 RX-total: 548595696 + TX-packets: 548595568 TX-dropped: 128 TX-total: 548595696 + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +clear fwd +~~~~~~~~~ + +Clear the forwarding engines statistics:: + + testpmd> clear fwd stats all + read rxd ~~~~~~~~ -- 1.8.3.1