From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Hunt Subject: [PATCH 5/5] mempool: allow rte_pktmbuf_pool_create switch between memool handlers Date: Tue, 26 Jan 2016 17:25:55 +0000 Message-ID: <1453829155-1366-6-git-send-email-david.hunt@intel.com> References: <1453829155-1366-1-git-send-email-david.hunt@intel.com> To: dev@dpdk.org Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 7C77F926B for ; Tue, 26 Jan 2016 18:26:12 +0100 (CET) In-Reply-To: <1453829155-1366-1-git-send-email-david.hunt@intel.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" if the user wants to have rte_pktmbuf_pool_create() use an external mempool handler, they simply define MEMPOOL_HANDLER_NAME to be the name of the mempool handler they wish to use. May move this to config Signed-off-by: David Hunt --- lib/librte_mbuf/rte_mbuf.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c18b438..362396e 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -167,10 +167,21 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, mbp_priv.mbuf_data_room_size = data_room_size; mbp_priv.mbuf_priv_size = priv_size; +/* #define MEMPOOL_HANDLER_NAME "custom_handler" */ +#undef MEMPOOL_HANDLER_NAME + +#ifndef MEMPOOL_HANDLER_NAME return rte_mempool_create(name, n, elt_size, cache_size, sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init, &mbp_priv, rte_pktmbuf_init, NULL, socket_id, 0); +#else + return rte_mempool_create_ext(name, n, elt_size, + cache_size, sizeof(struct rte_pktmbuf_pool_private), + rte_pktmbuf_pool_init, &mbp_priv, rte_pktmbuf_init, NULL, + socket_id, 0, + MEMPOOL_HANDLER_NAME); +#endif } /* do some sanity checks on a mbuf: panic if it fails */ -- 1.9.3