Skip to content

Commit

Permalink
app/testpmd: fix forwarding stats for Tx dropped
Browse files Browse the repository at this point in the history
[ upstream commit c3fd1e6089cce14ad3f941ab5df0501e03b3356c ]

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: 5332497 ("app/testpmd: display/clear forwarding stats on demand")

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>
  • Loading branch information
ferruhy authored and bluca committed Feb 22, 2023
1 parent 7b89a68 commit 632cf72
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/test-pmd/testpmd.c
Expand Up @@ -1845,6 +1845,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];

Expand All @@ -1866,8 +1868,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",
Expand All @@ -1891,8 +1894,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)
Expand Down

0 comments on commit 632cf72

Please sign in to comment.