From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: wenzhuo.lu@intel.com, jingjing.wu@intel.com,
bernard.iremonger@intel.com, ramirose@gmail.com,
arybchenko@solarflare.com
Subject: [dpdk-dev] [PATCH v3 4/4] app/testpmd: display/clear forwarding stats on demand
Date: Wed, 20 Mar 2019 11:02:34 +0100 [thread overview]
Message-ID: <1553076154-3907-5-git-send-email-david.marchand@redhat.com> (raw)
Message-ID: <20190320100234.naFo_Uqp-i5XZ60Vs-AOon54V0f5kx33dWxYjiiKjIw@z> (raw)
In-Reply-To: <1553076154-3907-1-git-send-email-david.marchand@redhat.com>
Add a new "show/clear fwd stats all" command to display fwd and port
statistics on the fly.
To be able to do so, the (testpmd only) rte_port structure 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 <david.marchand@redhat.com>
---
Changelog since v1:
- removed hunk from now deleted patch 3
---
app/test-pmd/cmdline.c | 44 +++
app/test-pmd/testpmd.c | 425 +++++++++++++++-------------
app/test-pmd/testpmd.h | 9 +-
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 36 +++
4 files changed, 305 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 103319f..b466217 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,224 @@ 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;
+ 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 +1766,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 +1816,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 +1845,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 +1866,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 = (uint64_t) (fwd_cycles +
- fwd_streams[sm_id]->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;
- 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 1a12da4..06c8b2a 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
next prev parent reply other threads:[~2019-03-20 10:03 UTC|newest]
Thread overview: 109+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 15:42 [dpdk-dev] [PATCH 0/5] display testpmd forwarding engine stats on the fly David Marchand
2019-02-14 15:42 ` [dpdk-dev] [PATCH 1/5] app/testpmd: remove unused fwd_ctx field David Marchand
2019-02-18 19:55 ` Rami Rosen
2019-02-14 15:42 ` [dpdk-dev] [PATCH 2/5] app/testpmd: add missing newline when showing statistics David Marchand
2019-02-19 5:48 ` Rami Rosen
2019-02-14 15:42 ` [dpdk-dev] [PATCH 3/5] app/testpmd: add missing transmit errors stats David Marchand
2019-02-14 16:30 ` Bruce Richardson
2019-02-14 17:39 ` David Marchand
2019-02-14 18:51 ` David Marchand
2019-02-15 8:57 ` Thomas Monjalon
2019-02-15 9:33 ` David Marchand
2019-02-15 14:05 ` Bruce Richardson
2019-02-15 14:13 ` Wiles, Keith
2019-02-15 15:04 ` David Marchand
2019-02-15 16:19 ` Thomas Monjalon
2019-02-15 17:32 ` David Marchand
2019-02-15 18:15 ` Ananyev, Konstantin
2019-02-15 18:31 ` David Marchand
2019-02-15 18:42 ` Ananyev, Konstantin
2019-02-15 19:38 ` Thomas Monjalon
2019-02-16 0:37 ` Stephen Hemminger
2019-02-16 13:23 ` Ananyev, Konstantin
2019-02-16 12:50 ` Ananyev, Konstantin
2019-02-20 8:33 ` David Marchand
2019-02-24 11:55 ` Ananyev, Konstantin
2019-02-14 15:42 ` [dpdk-dev] [PATCH 4/5] app/testpmd: remove useless casts on statistics David Marchand
2019-02-14 15:42 ` [dpdk-dev] [PATCH 5/5] app/testpmd: display/clear forwarding stats on demand David Marchand
2019-03-11 15:35 ` [dpdk-dev] [PATCH v2 0/4] display testpmd forwarding engine stats on the fly David Marchand
2019-03-11 15:35 ` [dpdk-dev] [PATCH v2 1/4] app/testpmd: remove unused fwd_ctx field David Marchand
2019-03-19 18:29 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2019-03-19 18:29 ` Ferruh Yigit
2019-03-11 15:35 ` [dpdk-dev] [PATCH v2 2/4] app/testpmd: add missing newline when showing statistics David Marchand
2019-03-11 15:53 ` Andrew Rybchenko
2019-03-11 15:35 ` [dpdk-dev] [PATCH v2 3/4] app/testpmd: remove useless casts on statistics David Marchand
2019-03-11 15:57 ` Andrew Rybchenko
2019-03-11 16:03 ` David Marchand
2019-03-11 15:35 ` [dpdk-dev] [PATCH v2 4/4] app/testpmd: display/clear forwarding stats on demand David Marchand
2019-03-20 10:02 ` [dpdk-dev] [PATCH v3 0/4] display testpmd forwarding engine stats on the fly David Marchand
2019-03-20 10:02 ` David Marchand
2019-03-20 10:02 ` [dpdk-dev] [PATCH v3 1/4] app/testpmd: add missing newline when showing statistics David Marchand
2019-03-20 10:02 ` David Marchand
2019-03-20 13:49 ` Andrew Rybchenko
2019-03-20 13:49 ` Andrew Rybchenko
2019-03-20 10:02 ` [dpdk-dev] [PATCH v3 2/4] app/testpmd: extend fwd statistics to 64bits David Marchand
2019-03-20 10:02 ` David Marchand
2019-03-20 13:55 ` Andrew Rybchenko
2019-03-20 13:55 ` Andrew Rybchenko
2019-03-20 10:02 ` [dpdk-dev] [PATCH v3 3/4] app/testpmd: remove useless casts on statistics David Marchand
2019-03-20 10:02 ` David Marchand
2019-03-20 13:58 ` Andrew Rybchenko
2019-03-20 13:58 ` Andrew Rybchenko
2019-03-20 10:02 ` David Marchand [this message]
2019-03-20 10:02 ` [dpdk-dev] [PATCH v3 4/4] app/testpmd: display/clear forwarding stats on demand David Marchand
2019-03-20 12:25 ` Ferruh Yigit
2019-03-20 12:25 ` Ferruh Yigit
2019-03-20 12:44 ` David Marchand
2019-03-20 12:44 ` David Marchand
2019-03-20 13:29 ` Ferruh Yigit
2019-03-20 13:29 ` Ferruh Yigit
2019-03-21 18:50 ` Ferruh Yigit
2019-03-21 18:50 ` Ferruh Yigit
2019-03-21 20:34 ` David Marchand
2019-03-21 20:34 ` David Marchand
2019-03-22 13:37 ` [dpdk-dev] [PATCH v4 0/4] display testpmd forwarding engine stats on the fly David Marchand
2019-03-22 13:37 ` David Marchand
2019-03-22 13:37 ` [dpdk-dev] [PATCH v4 1/4] app/testpmd: add missing newline when showing statistics David Marchand
2019-03-22 13:37 ` David Marchand
2019-03-22 17:03 ` Maxime Coquelin
2019-03-22 17:03 ` Maxime Coquelin
2019-03-22 17:17 ` Maxime Coquelin
2019-03-22 17:17 ` Maxime Coquelin
2019-03-22 17:23 ` David Marchand
2019-03-22 17:23 ` David Marchand
2019-03-22 17:31 ` Andrew Rybchenko
2019-03-22 17:31 ` Andrew Rybchenko
2019-03-22 17:35 ` Andrew Rybchenko
2019-03-22 17:35 ` Andrew Rybchenko
2019-03-22 17:43 ` David Marchand
2019-03-22 17:43 ` David Marchand
2019-03-23 19:12 ` David Marchand
2019-03-23 19:12 ` David Marchand
2019-03-25 6:34 ` Andrew Rybchenko
2019-03-25 6:34 ` Andrew Rybchenko
2019-03-22 13:37 ` [dpdk-dev] [PATCH v4 2/4] app/testpmd: extend fwd statistics to 64bits David Marchand
2019-03-22 13:37 ` David Marchand
2019-03-22 17:06 ` Maxime Coquelin
2019-03-22 17:06 ` Maxime Coquelin
2019-03-22 13:37 ` [dpdk-dev] [PATCH v4 3/4] app/testpmd: remove useless casts on statistics David Marchand
2019-03-22 13:37 ` David Marchand
2019-03-22 17:11 ` Maxime Coquelin
2019-03-22 17:11 ` Maxime Coquelin
2019-03-22 13:37 ` [dpdk-dev] [PATCH v4 4/4] app/testpmd: display/clear forwarding stats on demand David Marchand
2019-03-22 13:37 ` David Marchand
2019-03-22 17:22 ` Maxime Coquelin
2019-03-22 17:22 ` Maxime Coquelin
2019-03-25 8:51 ` [dpdk-dev] [PATCH v5 0/4] display testpmd forwarding engine stats on the fly David Marchand
2019-03-25 8:51 ` David Marchand
2019-03-25 8:51 ` [dpdk-dev] [PATCH v5 1/4] app/testpmd: add missing newline when showing statistics David Marchand
2019-03-25 8:51 ` David Marchand
2019-03-25 8:55 ` Andrew Rybchenko
2019-03-25 8:55 ` Andrew Rybchenko
2019-03-25 8:51 ` [dpdk-dev] [PATCH v5 2/4] app/testpmd: extend fwd statistics to 64bits David Marchand
2019-03-25 8:51 ` David Marchand
2019-03-25 8:51 ` [dpdk-dev] [PATCH v5 3/4] app/testpmd: remove useless casts on statistics David Marchand
2019-03-25 8:51 ` David Marchand
2019-03-25 8:51 ` [dpdk-dev] [PATCH v5 4/4] app/testpmd: display/clear forwarding stats on demand David Marchand
2019-03-25 8:51 ` David Marchand
2019-03-25 14:05 ` [dpdk-dev] [PATCH v5 0/4] display testpmd forwarding engine stats on the fly Ferruh Yigit
2019-03-25 14:05 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1553076154-3907-5-git-send-email-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=arybchenko@solarflare.com \
--cc=bernard.iremonger@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=ramirose@gmail.com \
--cc=wenzhuo.lu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).