On Thu, 23 Jul 2026 at 22:30, Stephen Hemminger
<[email protected]> wrote:
> diff --git a/drivers/net/cnxk/cnxk_stats.c b/drivers/net/cnxk/cnxk_stats.c
> index d57659ef51..e5d29a78b3 100644
> --- a/drivers/net/cnxk/cnxk_stats.c
> +++ b/drivers/net/cnxk/cnxk_stats.c
> @@ -14,7 +14,8 @@ cnxk_nix_stats_get(struct rte_eth_dev *eth_dev, struct
> rte_eth_stats *stats,
> struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
> struct roc_nix *nix = &dev->nix;
> struct roc_nix_stats nix_stats;
> - int rc = 0, i;
> + unsigned int i;
> + int rc = 0;
Nit: rc is set the line after.
>
> rc = roc_nix_stats_get(nix, &nix_stats);
> if (rc)
> @@ -33,31 +34,35 @@ cnxk_nix_stats_get(struct rte_eth_dev *eth_dev, struct
> rte_eth_stats *stats,
> stats->ibytes = nix_stats.rx_octs;
> stats->ierrors = nix_stats.rx_err;
>
> - if (qstats != NULL) {
> - for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
> - struct roc_nix_stats_queue qstats_data;
> - uint16_t qidx;
> -
> - if (dev->txq_stat_map[i] & (1U << 31)) {
> - qidx = dev->txq_stat_map[i] & 0xFFFF;
> - rc = roc_nix_stats_queue_get(nix, qidx, 0,
> &qstats_data);
> - if (rc)
> - goto exit;
> - qstats->q_opackets[i] = qstats_data.tx_pkts;
> - qstats->q_obytes[i] = qstats_data.tx_octs;
> - qstats->q_errors[i] =
> qstats_data.tx_drop_pkts;
> - }
> -
> - if (dev->rxq_stat_map[i] & (1U << 31)) {
> - qidx = dev->rxq_stat_map[i] & 0xFFFF;
> - rc = roc_nix_stats_queue_get(nix, qidx, 1,
> &qstats_data);
> - if (rc)
> - goto exit;
> - qstats->q_ipackets[i] = qstats_data.rx_pkts;
> - qstats->q_ibytes[i] = qstats_data.rx_octs;
> - qstats->q_errors[i] +=
> qstats_data.rx_drop_pkts;
> - }
> - }
> + if (qstats == NULL)
> + goto exit;
> +
> + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
> + struct roc_nix_stats_queue qstats_data;
> +
> + if (i >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
> + break;
> +
> + rc = roc_nix_stats_queue_get(nix, i, 0, &qstats_data);
> + if (rc)
> + goto exit;
> + qstats->q_opackets[i] = qstats_data.tx_pkts;
> + qstats->q_obytes[i] = qstats_data.tx_octs;
> + qstats->q_errors[i] = qstats_data.tx_drop_pkts;
> + }
> +
> + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
> + struct roc_nix_stats_queue qstats_data;
> +
> + if (i >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
> + break;
> +
> + rc = roc_nix_stats_queue_get(nix, i, 1, &qstats_data);
> + if (rc)
> + goto exit;
> + qstats->q_ipackets[i] = qstats_data.rx_pkts;
> + qstats->q_ibytes[i] = qstats_data.rx_octs;
> + qstats->q_errors[i] += qstats_data.rx_drop_pkts;
It was already there, but I find it suspicious that only Rx errors are
handled like those are reset on read.
--
David Marchand