From patchwork Thu Mar 17 14:47:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Ehrhardt X-Patchwork-Id: 11558 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 EA09256A0; Thu, 17 Mar 2016 15:47:16 +0100 (CET) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by dpdk.org (Postfix) with ESMTP id A4F55569F for ; Thu, 17 Mar 2016 15:47:15 +0100 (CET) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1agZCj-00081H-7N; Thu, 17 Mar 2016 14:47:13 +0000 From: Christian Ehrhardt To: dev@dpdk.org, pablo.de.lara.guarch@intel.com Cc: Christian Ehrhardt Date: Thu, 17 Mar 2016 15:47:03 +0100 Message-Id: <1458226023-23873-1-git-send-email-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1456849970-1847-1-git-send-email-christian.ehrhardt@canonical.com> References: <1456849970-1847-1-git-send-email-christian.ehrhardt@canonical.com> Subject: [dpdk-dev] [PATCH v2] testpmd: avoid only working in XEN when LIBRTE_PMD_XENVIRT is configured 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" With LIBRTE_PMD_XENVIRT enabled testpmd is built in a way to ONLY work in XEN environments. It will surface as: PMD: gntalloc: ioctl error EAL: Error - exiting with code: 1 Cause: Creation of mbuf pool for socket 0 failed With LIBRTE_PMD_XENVIRT enabled this now tries the xen style grant table allocation, but falls back gracefully for the normal allocation. The only thing left in the log will be the PMD: gntalloc: ioctl error Updates in v2 - adding missing Signed-off-by and set Pablo on --to with the patch directly Signed-off-by: Christian Ehrhardt --- app/test-pmd/testpmd.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 1319917..b008df3 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -410,7 +410,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, unsigned int socket_id) { char pool_name[RTE_MEMPOOL_NAMESIZE]; - struct rte_mempool *rte_mp; + struct rte_mempool *rte_mp = NULL; uint32_t mb_size; mb_size = sizeof(struct rte_mbuf) + mbuf_seg_size; @@ -423,24 +423,23 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, socket_id, 0); - - - -#else - if (mp_anon != 0) - rte_mp = mempool_anon_create(pool_name, nb_mbuf, mb_size, - (unsigned) mb_mempool_cache, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socket_id, 0); - else - /* wrapper to rte_mempool_create() */ - rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf, - mb_mempool_cache, 0, mbuf_seg_size, socket_id); - #endif + /* if the former XEN allocation failed fall back to normal allocation */ + if (rte_mp == NULL) { + if (mp_anon != 0) + rte_mp = mempool_anon_create(pool_name, nb_mbuf, + mb_size, (unsigned) mb_mempool_cache, + sizeof(struct rte_pktmbuf_pool_private), + rte_pktmbuf_pool_init, NULL, + rte_pktmbuf_init, NULL, + socket_id, 0); + else + /* wrapper to rte_mempool_create() */ + rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf, + mb_mempool_cache, 0, mbuf_seg_size, socket_id); + } + if (rte_mp == NULL) { rte_exit(EXIT_FAILURE, "Creation of mbuf pool for socket %u " "failed\n", socket_id);