summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-03-17 15:47:03 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-04-11 16:44:15 +0200
commitbece7b6cf6849331c1817e1034c03fab251952a7 (patch)
tree1c8184d77076fbdf685ab611b1d9942419b9261e
parentfe671356ed0d9b349bd257b8fcb30adf7da103e1 (diff)
downloaddpdk-bece7b6cf6849331c1817e1034c03fab251952a7.zip
dpdk-bece7b6cf6849331c1817e1034c03fab251952a7.tar.gz
dpdk-bece7b6cf6849331c1817e1034c03fab251952a7.tar.xz
app/testpmd: fix running without Xen whereas enabled
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 Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
-rw-r--r--app/test-pmd/testpmd.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 1398c6c..26a174c 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);