From patchwork Tue Jan 26 17:25:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hunt, David" X-Patchwork-Id: 10099 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 84E9F93A4; Tue, 26 Jan 2016 18:26:19 +0100 (CET) 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) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 26 Jan 2016 09:26:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,350,1449561600"; d="scan'208";a="36514394" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga004.fm.intel.com with ESMTP; 26 Jan 2016 09:26:11 -0800 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u0QHQ9mc007663; Tue, 26 Jan 2016 17:26:09 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u0QHQ9Et001447; Tue, 26 Jan 2016 17:26:09 GMT Received: (from dhunt5@localhost) by sivswdev02.ir.intel.com with id u0QHQ9Qq001443; Tue, 26 Jan 2016 17:26:09 GMT From: David Hunt To: dev@dpdk.org Date: Tue, 26 Jan 2016 17:25:55 +0000 Message-Id: <1453829155-1366-6-git-send-email-david.hunt@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1453829155-1366-1-git-send-email-david.hunt@intel.com> References: <1453829155-1366-1-git-send-email-david.hunt@intel.com> Subject: [dpdk-dev] [PATCH 5/5] mempool: allow rte_pktmbuf_pool_create switch between memool handlers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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 */