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 474624CC5; Wed, 20 Mar 2019 11:03:00 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7908659467; Wed, 20 Mar 2019 10:02:59 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id C37685D9D4; Wed, 20 Mar 2019 10:02:56 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com, ramirose@gmail.com, arybchenko@solarflare.com, stable@dpdk.org Date: Wed, 20 Mar 2019 11:02:32 +0100 Message-Id: <1553076154-3907-3-git-send-email-david.marchand@redhat.com> In-Reply-To: <1553076154-3907-1-git-send-email-david.marchand@redhat.com> References: <1552318522-18777-1-git-send-email-david.marchand@redhat.com> <1553076154-3907-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 20 Mar 2019 10:02:59 +0000 (UTC) Subject: [dpdk-dev] [PATCH v3 2/4] app/testpmd: extend fwd statistics to 64bits 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: Wed, 20 Mar 2019 10:03:01 -0000 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 --- 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 78206f6..af9a765 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\n", + printf(" RX-packets: %-14"PRIu64" TX-packets: %-14"PRIu64 + " TX-dropped: %-14"PRIu64"\n", 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); } @@ -1743,9 +1745,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 @@ -1772,38 +1771,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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9768BA00E6 for ; Wed, 20 Mar 2019 11:03:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 907EA4F93; Wed, 20 Mar 2019 11:03:02 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 474624CC5; Wed, 20 Mar 2019 11:03:00 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7908659467; Wed, 20 Mar 2019 10:02:59 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id C37685D9D4; Wed, 20 Mar 2019 10:02:56 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com, ramirose@gmail.com, arybchenko@solarflare.com, stable@dpdk.org Date: Wed, 20 Mar 2019 11:02:32 +0100 Message-Id: <1553076154-3907-3-git-send-email-david.marchand@redhat.com> In-Reply-To: <1553076154-3907-1-git-send-email-david.marchand@redhat.com> References: <1552318522-18777-1-git-send-email-david.marchand@redhat.com> <1553076154-3907-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 20 Mar 2019 10:02:59 +0000 (UTC) Subject: [dpdk-dev] [PATCH v3 2/4] app/testpmd: extend fwd statistics to 64bits 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190320100232.X4nJZt4LSXMLFHLd0syZMJO3kOo2iknXgqphelldngM@z> 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 --- 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 78206f6..af9a765 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\n", + printf(" RX-packets: %-14"PRIu64" TX-packets: %-14"PRIu64 + " TX-dropped: %-14"PRIu64"\n", 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); } @@ -1743,9 +1745,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 @@ -1772,38 +1771,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