@@ -393,6 +393,7 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp)
unsigned int num_of_bufs = 0;
struct dpaa2_bp_info *bp_info;
struct dpaa2_dpbp_dev *dpbp_node;
+ struct fsl_mc_io mc_io;
if (!mp || !mp->pool_data) {
DPAA2_MEMPOOL_ERR("Invalid mempool provided");
@@ -402,7 +403,12 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp)
bp_info = (struct dpaa2_bp_info *)mp->pool_data;
dpbp_node = bp_info->bp_list->buf_pool.dpbp_node;
- ret = dpbp_get_num_free_bufs(&dpbp_node->dpbp, CMD_PRI_LOW,
+ /* In case as secondary process access stats, MCP portal in priv-hw may
+ * have primary process address. Need the secondary process based MCP
+ * portal address for this object.
+ */
+ mc_io.regs = dpaa2_get_mcp_ptr(MC_PORTAL_INDEX);
+ ret = dpbp_get_num_free_bufs(&mc_io, CMD_PRI_LOW,
dpbp_node->token, &num_of_bufs);
if (ret) {
DPAA2_MEMPOOL_ERR("Unable to obtain free buf count (err=%d)",