From: Mike Baucom <michael.bau...@broadcom.com> The Rx queue stats are being reported incorrectly due to a workaround for ring counters sometimes being reported as zero. When a queue is stopped and started, the ring counter is reset to zero. The workaround interprets the zero as incorrect, and sets the reported ring count as the previously read value (from before the queue being restared). This shows up as negative counters in testpmd's "show fwd stats" command. The fix clears the prev counter for the queue when the queue is started.
Fixes: 219842b9990c ("net/bnxt: workaround spurious zero stats in Thor") Cc: sta...@dpdk.org Signed-off-by: Mike Baucom <michael.bau...@broadcom.com> Reviewed-by: Somnath Kotur <somnath.ko...@broadcom.com> Reviewed-by: Kishore Padmanabha <kishore.padmana...@broadcom.com> Reviewed-by: Randy Schacher <stuart.schac...@broadcom.com> Reviewed-by: Ajit Khaparde <ajit.khapa...@broadcom.com> --- drivers/net/bnxt/bnxt_rxq.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index fabbbd4..99758dd 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -471,6 +471,12 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) return -EINVAL; } + /* reset the previous stats for the rx_queue since the counters + * will be cleared when the queue is started. + */ + memset(&bp->prev_rx_ring_stats[rx_queue_id], 0, + sizeof(struct bnxt_ring_stats)); + /* Set the queue state to started here. * We check the status of the queue while posting buffer. * If queue is it started, we do not post buffers for Rx. -- 2.10.1