net/bnxt: check initialization before accessing stats
Maintain state of PMD initialization and check it before checking stats. In certain cases, we might end up accessing stats before the required HWRM commands are processed by FW. Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
This commit is contained in:
parent
ff947c6ce1
commit
ed2ced6fe9
@ -245,6 +245,7 @@ struct bnxt {
|
||||
#define BNXT_FLAG_UPDATE_HASH (1 << 5)
|
||||
#define BNXT_FLAG_PTP_SUPPORTED (1 << 6)
|
||||
#define BNXT_FLAG_MULTI_HOST (1 << 7)
|
||||
#define BNXT_FLAG_INIT_DONE (1 << 31)
|
||||
#define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF))
|
||||
#define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF)
|
||||
#define BNXT_NPAR(bp) ((bp)->port_partition_type)
|
||||
|
@ -590,6 +590,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
|
||||
if (rc)
|
||||
goto error;
|
||||
|
||||
bp->flags |= BNXT_FLAG_INIT_DONE;
|
||||
return 0;
|
||||
|
||||
error:
|
||||
@ -635,6 +636,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
|
||||
}
|
||||
bnxt_set_hwrm_link_config(bp, false);
|
||||
bnxt_hwrm_port_clr_stats(bp);
|
||||
bp->flags &= ~BNXT_FLAG_INIT_DONE;
|
||||
bnxt_shutdown_nic(bp);
|
||||
bp->dev_stopped = 1;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user