From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hemant Agrawal Subject: [PATCH v2 2/2] mempool:pktmbuf pool default fallback for mempool ops error Date: Thu, 15 Sep 2016 22:43:27 +0530 Message-ID: <1473959607-1951-2-git-send-email-hemant.agrawal@nxp.com> References: <1473346213-6038-1-git-send-email-hemant.agrawal@nxp.com> <1473959607-1951-1-git-send-email-hemant.agrawal@nxp.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , , Hemant Agrawal To: Return-path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0047.outbound.protection.outlook.com [104.47.33.47]) by dpdk.org (Postfix) with ESMTP id 62886568A for ; Thu, 15 Sep 2016 13:39:38 +0200 (CEST) In-Reply-To: <1473959607-1951-1-git-send-email-hemant.agrawal@nxp.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In the rte_pktmbuf_pool_create, if the default external mempool is not available, the implementation can default to "ring_mp_mc", which is an software implementation. Signed-off-by: Hemant Agrawal --- lib/librte_mbuf/rte_mbuf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 4846b89..4adb4f5 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -176,6 +176,11 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, rte_errno = rte_mempool_set_ops_byname(mp, RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL); + + /* on error, try falling back to the software based default pool */ + if (rte_errno == -EOPNOTSUPP) + rte_errno = rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL); + if (rte_errno != 0) { RTE_LOG(ERR, MBUF, "error setting mempool handler\n"); return NULL; -- 1.9.1