[PATCH] app/testpmd: fix forwarding stats for Tx dropped

lihuisong (C) lihuisong at huawei.com
Wed Feb 1 02:14:27 CET 2023


Maybe many PMDs do not support oerrors statistics, which cause this 
problem isn't found.

LGTM
Acked-by: Huisong Li <lihuisong at 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 at dpdk.org
>
> Reported-by: Joshua Washington <joshwash at google.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit at amd.com>
> ---
>
> Cc: david.marchand at 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)


More information about the stable mailing list