event/dpaa2: replace static with dynamic logging
[dpdk.git] / drivers / net / bnxt / bnxt_stats.c
index fe83d37..470c643 100644 (file)
@@ -236,6 +236,10 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
        struct bnxt *bp = eth_dev->data->dev_private;
 
        memset(bnxt_stats, 0, sizeof(*bnxt_stats));
+       if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
+               RTE_LOG(ERR, PMD, "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];
@@ -267,6 +271,11 @@ 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)) {
+               RTE_LOG(ERR, PMD, "Device Initialization not complete!\n");
+               return;
+       }
+
        bnxt_clear_all_hwrm_stat_ctxs(bp);
        rte_atomic64_clear(&bp->rx_mbuf_alloc_fail);
 }
@@ -358,12 +367,12 @@ 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))
+       if (!BNXT_SINGLE_PF(bp))
                RTE_LOG(ERR, PMD, "Operation not supported on a MF device\n");
        if (!(bp->flags & BNXT_FLAG_PORT_STATS))
                RTE_LOG(ERR, PMD, "Operation not supported\n");