From patchwork Mon Jun 20 13:08:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hunt, David" X-Patchwork-Id: 14029 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 A38619AA5; Mon, 20 Jun 2016 15:10:03 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 0AC818D38 for ; Mon, 20 Jun 2016 15:10:00 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 20 Jun 2016 06:09:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.26,498,1459839600"; d="scan'208"; a="1001534779" Received: from sie-lab-214-251.ir.intel.com (HELO silpixa373510.ir.intel.com) ([10.237.214.251]) by orsmga002.jf.intel.com with ESMTP; 20 Jun 2016 06:09:58 -0700 From: David Hunt To: dev@dpdk.org Cc: olivier.matz@6wind.com, viktorin@rehivetech.com, jerin.jacob@caviumnetworks.com, shreyansh.jain@nxp.com, David Hunt Date: Mon, 20 Jun 2016 14:08:11 +0100 Message-Id: <1466428091-115821-3-git-send-email-david.hunt@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466428091-115821-1-git-send-email-david.hunt@intel.com> References: <1463669335-30378-1-git-send-email-david.hunt@intel.com> <1466428091-115821-1-git-send-email-david.hunt@intel.com> Subject: [dpdk-dev] [PATCH v3 2/2] test: add autotest for external mempool stack handler 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" Signed-off-by: David Hunt --- app/test/test_mempool.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c index 31582d8..6cb2b14 100644 --- a/app/test/test_mempool.c +++ b/app/test/test_mempool.c @@ -573,6 +573,7 @@ test_mempool(void) struct rte_mempool *mp_cache = NULL; struct rte_mempool *mp_nocache = NULL; struct rte_mempool *mp_ext = NULL; + struct rte_mempool *mp_stack = NULL; rte_atomic32_init(&synchro); @@ -622,6 +623,27 @@ test_mempool(void) } rte_mempool_obj_iter(mp_ext, my_obj_init, NULL); + /* create a mempool with an external handler */ + mp_stack = rte_mempool_create_empty("test_stack", + MEMPOOL_SIZE, + MEMPOOL_ELT_SIZE, + RTE_MEMPOOL_CACHE_MAX_SIZE, 0, + SOCKET_ID_ANY, 0); + + if (mp_stack == NULL) { + printf("cannot allocate mp_stack mempool\n"); + goto err; + } + if (rte_mempool_set_ops_byname(mp_stack, "stack", NULL) < 0) { + printf("cannot set stack handler\n"); + goto err; + } + if (rte_mempool_populate_default(mp_stack) < 0) { + printf("cannot populate mp_stack mempool\n"); + goto err; + } + rte_mempool_obj_iter(mp_stack, my_obj_init, NULL); + /* retrieve the mempool from its name */ if (rte_mempool_lookup("test_nocache") != mp_nocache) { printf("Cannot lookup mempool from its name\n"); @@ -655,6 +677,10 @@ test_mempool(void) if (test_mempool_xmem_misc() < 0) goto err; + /* test the stack handler */ + if (test_mempool_basic(mp_stack) < 0) + goto err; + rte_mempool_list_dump(stdout); return 0;