From patchwork Tue Feb 16 14:48:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hunt, David" X-Patchwork-Id: 10551 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 6E0C9C33C; Tue, 16 Feb 2016 15:48:59 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id A0EF2C30E for ; Tue, 16 Feb 2016 15:48:54 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 16 Feb 2016 06:48:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,455,1449561600"; d="scan'208";a="913407186" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 16 Feb 2016 06:48:53 -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 u1GEmqEL011246; Tue, 16 Feb 2016 14:48:52 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u1GEmqM1004293; Tue, 16 Feb 2016 14:48:52 GMT Received: (from dhunt5@localhost) by sivswdev02.ir.intel.com with id u1GEmqY6004285; Tue, 16 Feb 2016 14:48:52 GMT From: David Hunt To: dev@dpdk.org Date: Tue, 16 Feb 2016 14:48:14 +0000 Message-Id: <1455634095-4183-6-git-send-email-david.hunt@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1455634095-4183-1-git-send-email-david.hunt@intel.com> References: <1453829155-1366-1-git-send-email-david.hunt@intel.com> <1455634095-4183-1-git-send-email-david.hunt@intel.com> Subject: [dpdk-dev] [PATCH 5/6] 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" v2 changes: added to linux and bsd config files: If the user wants to have rte_pktmbuf_pool_create() use an external mempool handler, they define RTE_MEMPOOL_HANDLER_NAME to be the name of the mempool handler they wish to use, and change RTE_MEMPOOL_HANDLER_EXT to 'y' Applies to both linux and bsd config files Signed-off-by: David Hunt --- config/common_bsdapp | 2 ++ config/common_linuxapp | 2 ++ lib/librte_mbuf/rte_mbuf.c | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index 696382c..e0c812a 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -347,6 +347,8 @@ CONFIG_RTE_RING_PAUSE_REP_COUNT=0 CONFIG_RTE_LIBRTE_MEMPOOL=y CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE=512 CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n +CONFIG_RTE_MEMPOOL_HANDLER_EXT=n +CONFIG_RTE_MEMPOOL_HANDLER_NAME="custom_handler" # # Compile librte_mbuf diff --git a/config/common_linuxapp b/config/common_linuxapp index f1638db..9aa62ca 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -363,6 +363,8 @@ CONFIG_RTE_RING_PAUSE_REP_COUNT=0 CONFIG_RTE_LIBRTE_MEMPOOL=y CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE=512 CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n +CONFIG_RTE_MEMPOOL_HANDLER_EXT=n +CONFIG_RTE_MEMPOOL_HANDLER_NAME="custom_handler" # # Compile librte_mbuf diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c18b438..42b0cd1 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -167,10 +167,18 @@ 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; +#ifdef RTE_MEMPOOL_HANDLER_EXT + 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, + RTE_MEMPOOL_HANDLER_NAME); +#else 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); +#endif } /* do some sanity checks on a mbuf: panic if it fails */