diff mbox series

app/testpmd: fix forwarding stats for Tx dropped

Message ID 20230131115603.640254-1-ferruh.yigit@amd.com (mailing list archive)
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series app/testpmd: fix forwarding stats for Tx dropped | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Ferruh Yigit Jan. 31, 2023, 11:56 a.m. UTC
There is an inconsistency at displaying Tx dropped value for per port
forwarding stats and accumulated forwarding stats.

While displaying per port TX-dropped value, it only takes
'ports_stats[pt_id].tx_dropped' into account,
but for accumulated TX-dropped results it takes both
'ports_stats[pt_id].tx_dropped' & 'stats.oerrors' into account.

To fix, make both per port and accumulated stats display 'tx_dropped'
and 'stats.oerrors' (ports_stats[pt_id].tx_dropped + stats.oerrors).

Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on demand")
Cc: stable@dpdk.org

Reported-by: Joshua Washington <joshwash@google.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
---

Cc: david.marchand@redhat.com

Mail list reference:
https://inbox.dpdk.org/dev/a440ab60-9624-f21e-396a-239bdf2aa1a1@amd.com/
---
 app/test-pmd/testpmd.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

lihuisong (C) Feb. 1, 2023, 1:14 a.m. UTC | #1
Maybe many PMDs do not support oerrors statistics, which cause this 
problem isn't found.

LGTM
Acked-by: Huisong Li <lihuisong@huawei.com>

在 2023/1/31 19:56, Ferruh Yigit 写道:
> There is an inconsistency at displaying Tx dropped value for per port
> forwarding stats and accumulated forwarding stats.
>
> While displaying per port TX-dropped value, it only takes
> 'ports_stats[pt_id].tx_dropped' into account,
> but for accumulated TX-dropped results it takes both
> 'ports_stats[pt_id].tx_dropped' & 'stats.oerrors' into account.
>
> To fix, make both per port and accumulated stats display 'tx_dropped'
> and 'stats.oerrors' (ports_stats[pt_id].tx_dropped + stats.oerrors).
>
> Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on demand")
> Cc: stable@dpdk.org
>
> Reported-by: Joshua Washington <joshwash@google.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
> ---
>
> Cc: david.marchand@redhat.com
>
> Mail list reference:
> https://inbox.dpdk.org/dev/a440ab60-9624-f21e-396a-239bdf2aa1a1@amd.com/
> ---
>   app/test-pmd/testpmd.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 60eb9579ded1..6f4749b8af0c 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2057,6 +2057,8 @@ fwd_stats_display(void)
>   			fwd_cycles += fs->core_cycles;
>   	}
>   	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
> +		uint64_t tx_dropped = 0;
> +
>   		pt_id = fwd_ports_ids[i];
>   		port = &ports[pt_id];
>   
> @@ -2078,8 +2080,9 @@ fwd_stats_display(void)
>   		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;
> +		tx_dropped += ports_stats[pt_id].tx_dropped;
> +		tx_dropped += stats.oerrors;
> +		total_tx_dropped += tx_dropped;
>   		total_rx_nombuf  += stats.rx_nombuf;
>   
>   		printf("\n  %s Forward statistics for port %-2d %s\n",
> @@ -2106,8 +2109,8 @@ fwd_stats_display(void)
>   
>   		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);
> +		       stats.opackets, tx_dropped,
> +		       stats.opackets + tx_dropped);
>   
>   		if (record_burst_stats) {
>   			if (ports_stats[pt_id].rx_stream)
Singh, Aman Deep Feb. 7, 2023, 10:10 a.m. UTC | #2
On 1/31/2023 5:26 PM, Ferruh Yigit wrote:
> There is an inconsistency at displaying Tx dropped value for per port
> forwarding stats and accumulated forwarding stats.
>
> While displaying per port TX-dropped value, it only takes
> 'ports_stats[pt_id].tx_dropped' into account,
> but for accumulated TX-dropped results it takes both
> 'ports_stats[pt_id].tx_dropped' & 'stats.oerrors' into account.
>
> To fix, make both per port and accumulated stats display 'tx_dropped'
> and 'stats.oerrors' (ports_stats[pt_id].tx_dropped + stats.oerrors).
>
> Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on demand")
> Cc: stable@dpdk.org
>
> Reported-by: Joshua Washington <joshwash@google.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>

Acked-by: Aman Singh <aman.deep.singh@intel.com>

> ---
>
> Cc: david.marchand@redhat.com
>
> Mail list reference:
> https://inbox.dpdk.org/dev/a440ab60-9624-f21e-396a-239bdf2aa1a1@amd.com/
> ---

<snip>
Ferruh Yigit Feb. 8, 2023, 2:07 a.m. UTC | #3
On 2/7/2023 10:10 AM, Singh, Aman Deep wrote:
> 
> On 1/31/2023 5:26 PM, Ferruh Yigit wrote:
>> There is an inconsistency at displaying Tx dropped value for per port
>> forwarding stats and accumulated forwarding stats.
>>
>> While displaying per port TX-dropped value, it only takes
>> 'ports_stats[pt_id].tx_dropped' into account,
>> but for accumulated TX-dropped results it takes both
>> 'ports_stats[pt_id].tx_dropped' & 'stats.oerrors' into account.
>>
>> To fix, make both per port and accumulated stats display 'tx_dropped'
>> and 'stats.oerrors' (ports_stats[pt_id].tx_dropped + stats.oerrors).
>>
>> Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on
>> demand")
>> Cc: stable@dpdk.org
>>
>> Reported-by: Joshua Washington <joshwash@google.com>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
> 
> Acked-by: Huisong Li <lihuisong@huawei.com>
>
> Acked-by: Aman Singh <aman.deep.singh@intel.com>
> 

Applied to dpdk-next-net/main, thanks.
diff mbox series

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 60eb9579ded1..6f4749b8af0c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2057,6 +2057,8 @@  fwd_stats_display(void)
 			fwd_cycles += fs->core_cycles;
 	}
 	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
+		uint64_t tx_dropped = 0;
+
 		pt_id = fwd_ports_ids[i];
 		port = &ports[pt_id];
 
@@ -2078,8 +2080,9 @@  fwd_stats_display(void)
 		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;
+		tx_dropped += ports_stats[pt_id].tx_dropped;
+		tx_dropped += stats.oerrors;
+		total_tx_dropped += tx_dropped;
 		total_rx_nombuf  += stats.rx_nombuf;
 
 		printf("\n  %s Forward statistics for port %-2d %s\n",
@@ -2106,8 +2109,8 @@  fwd_stats_display(void)
 
 		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);
+		       stats.opackets, tx_dropped,
+		       stats.opackets + tx_dropped);
 
 		if (record_burst_stats) {
 			if (ports_stats[pt_id].rx_stream)