X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Fbnxt_stats.c;h=bd93cc834da38680cad16316b05a70e8e0dc8a02;hb=e940646b20fa;hp=225f9883082cada6c8d6d4f74484f16e8c6a9fb8;hpb=88920136688c5d0175957fc412b505652b1bc349;p=dpdk.git diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c index 225f988308..bd93cc834d 100644 --- a/drivers/net/bnxt/bnxt_stats.c +++ b/drivers/net/bnxt/bnxt_stats.c @@ -228,35 +228,54 @@ void bnxt_free_stats(struct bnxt *bp) } } -void bnxt_stats_get_op(struct rte_eth_dev *eth_dev, +int bnxt_stats_get_op(struct rte_eth_dev *eth_dev, struct rte_eth_stats *bnxt_stats) { + int rc = 0; unsigned int i; struct bnxt *bp = eth_dev->data->dev_private; memset(bnxt_stats, 0, sizeof(*bnxt_stats)); + if (!(bp->flags & BNXT_FLAG_INIT_DONE)) { + PMD_DRV_LOG(ERR, "Device Initialization not complete!\n"); + return 0; + } for (i = 0; i < bp->rx_cp_nr_rings; i++) { struct bnxt_rx_queue *rxq = bp->rx_queues[i]; struct bnxt_cp_ring_info *cpr = rxq->cp_ring; - bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i, bnxt_stats); + rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i, + bnxt_stats, 1); + if (unlikely(rc)) + return rc; } for (i = 0; i < bp->tx_cp_nr_rings; i++) { struct bnxt_tx_queue *txq = bp->tx_queues[i]; struct bnxt_cp_ring_info *cpr = txq->cp_ring; - bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i, bnxt_stats); + rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i, + bnxt_stats, 0); + if (unlikely(rc)) + return rc; } - bnxt_hwrm_func_qstats(bp, 0xffff, bnxt_stats); + rc = bnxt_hwrm_func_qstats(bp, 0xffff, bnxt_stats); + if (unlikely(rc)) + return rc; bnxt_stats->rx_nombuf = rte_atomic64_read(&bp->rx_mbuf_alloc_fail); + return rc; } void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; + if (!(bp->flags & BNXT_FLAG_INIT_DONE)) { + PMD_DRV_LOG(ERR, "Device Initialization not complete!\n"); + return; + } + bnxt_clear_all_hwrm_stat_ctxs(bp); rte_atomic64_clear(&bp->rx_mbuf_alloc_fail); } @@ -270,7 +289,7 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev, uint64_t tx_drop_pkts; if (!(bp->flags & BNXT_FLAG_PORT_STATS)) { - RTE_LOG(ERR, PMD, "xstats not supported for VF\n"); + PMD_DRV_LOG(ERR, "xstats not supported for VF\n"); return 0; } @@ -348,15 +367,15 @@ void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; - if (bp->flags & BNXT_FLAG_PORT_STATS && !BNXT_NPAR_PF(bp)) + if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp)) bnxt_hwrm_port_clr_stats(bp); if (BNXT_VF(bp)) - RTE_LOG(ERR, PMD, "Operation not supported on a VF device\n"); - if (BNXT_NPAR_PF(bp)) - RTE_LOG(ERR, PMD, "Operation not supported on a MF device\n"); + PMD_DRV_LOG(ERR, "Operation not supported on a VF device\n"); + if (!BNXT_SINGLE_PF(bp)) + PMD_DRV_LOG(ERR, "Operation not supported on a MF device\n"); if (!(bp->flags & BNXT_FLAG_PORT_STATS)) - RTE_LOG(ERR, PMD, "Operation not supported\n"); + PMD_DRV_LOG(ERR, "Operation not supported\n"); } int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids, @@ -375,7 +394,7 @@ int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids, bnxt_dev_xstats_get_by_id_op(dev, NULL, values_copy, stat_cnt); for (i = 0; i < limit; i++) { if (ids[i] >= stat_cnt) { - RTE_LOG(ERR, PMD, "id value isn't valid"); + PMD_DRV_LOG(ERR, "id value isn't valid"); return -1; } values[i] = values_copy[ids[i]]; @@ -401,7 +420,7 @@ int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev, for (i = 0; i < limit; i++) { if (ids[i] >= stat_cnt) { - RTE_LOG(ERR, PMD, "id value isn't valid"); + PMD_DRV_LOG(ERR, "id value isn't valid"); return -1; } strcpy(xstats_names[i].name,