DPDK patches and discussions
 help / color / mirror / Atom feed
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, maxime.coquelin@redhat.com,
	ferruh.yigit@intel.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v5 2/4] app/testpmd: extend fwd statistics to 64bits
Date: Mon, 25 Mar 2019 09:51:44 +0100	[thread overview]
Message-ID: <1553503906-1508-3-git-send-email-david.marchand@redhat.com> (raw)
Message-ID: <20190325085144.-bo77GwyW--XqvngfSqFw0HXqLHUjpx4z3QjTVz84KA@z> (raw)
In-Reply-To: <1553503906-1508-1-git-send-email-david.marchand@redhat.com>

fwd engine statistics are stored as unsigned int (32bits) and can wrap
quite quickly.
Example: sending 7mpps for 614s gives us 4298000000 packets =>
0x1002e4680 larger than 32bits.

testpmd reports forwarding stats as:
RX-packets: 3500381        TX-packets: 3500010        TX-dropped: 371

While the port and accumulated stats are reported as 64bits:
RX-packets: 4298467677     RX-dropped: 0             RX-total: 4298467677
TX-packets: 4298467306     TX-dropped: 371           TX-total: 4298467677

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
Changelog since v4:
- rebased following patch 1 update

Changelog since v2:
- split out of the previous patch with a dedicated commitlog
- Cc'd stable

---
 app/test-pmd/testpmd.c | 51 +++++++++++++++++---------------------------------
 app/test-pmd/testpmd.h | 12 ++++++------
 2 files changed, 23 insertions(+), 40 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 7715844..05a3dce 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1459,13 +1459,15 @@ struct extmem_param {
 	       "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 {
@@ -1745,9 +1747,6 @@ struct extmem_param {
 	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
@@ -1774,38 +1773,22 @@ struct extmem_param {
 	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 +
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 85b791b..4f4a48f 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
-- 
1.8.3.1


  parent reply	other threads:[~2019-03-25  8:52 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     ` [dpdk-dev] [PATCH v3 4/4] app/testpmd: display/clear forwarding stats on demand David Marchand
2019-03-20 10:02       ` 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         ` David Marchand [this message]
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         ` [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=1553503906-1508-3-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=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=ramirose@gmail.com \
    --cc=stable@dpdk.org \
    --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).