diff mbox series

[v2,15/20] mempool/dpaa2: support stats for secondary process

Message ID 20210211141620.12482-16-hemant.agrawal@nxp.com
State Superseded
Headers show
Series NXP DPAAx ethernet PMD changes | expand

Commit Message

Hemant Agrawal Feb. 11, 2021, 2:16 p.m. UTC
DPAA2 DPBP object access need availability of MCP object
pointer. In case of secondary process, we need to use local
MCP pointer instead of primary process.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index ca49a8d42a..bc146e4ce1 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -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)",