[v2,10/16] net/dpaa: return error on multiple mp config

Message ID 20200306095742.18080-11-hemant.agrawal@nxp.com
State New
Headers show
Series
  • NXP DPAAx fixes and enhancements
Related show

Commit Message

Hemant Agrawal March 6, 2020, 9:57 a.m.
From: Nipun Gupta <nipun.gupta@nxp.com>


multiple buffer pools are not supported on a single device.

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

---
 drivers/mempool/dpaa/dpaa_mempool.c | 1 +
 drivers/net/dpaa/dpaa_ethdev.c      | 6 ++++++
 2 files changed, 7 insertions(+)

-- 
2.17.1

Patch

diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c
index 3a2528331..00db6f9bc 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.c
+++ b/drivers/mempool/dpaa/dpaa_mempool.c
@@ -132,6 +132,7 @@  dpaa_mbuf_free_pool(struct rte_mempool *mp)
 		DPAA_MEMPOOL_INFO("BMAN pool freed for bpid =%d",
 				  bp_info->bpid);
 		rte_free(mp->pool_data);
+		bp_info->bp = NULL;
 		mp->pool_data = NULL;
 	}
 }
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index fce9ce2fe..0384532d2 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -587,6 +587,12 @@  int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	DPAA_PMD_INFO("Rx queue setup for queue index: %d fq_id (0x%x)",
 			queue_idx, rxq->fqid);
 
+	if (dpaa_intf->bp_info && dpaa_intf->bp_info->bp &&
+	    dpaa_intf->bp_info->mp != mp) {
+		DPAA_PMD_WARN("Multiple pools on same interface not supported");
+		return -EINVAL;
+	}
+
 	/* Max packet can fit in single buffer */
 	if (dev->data->dev_conf.rxmode.max_rx_pkt_len <= buffsz) {
 		;