summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-01-31 22:12:19 +0100
committerDamjan Marion <damarion@cisco.com>2019-01-31 22:13:57 +0100
commit6f70e913c58b81ff40bb980359cfa1f3c88ff150 (patch)
tree75567dd0a43950f3b82b04089bff38f9366cb990
parent31392ac15027d9190e1bb16545bdede5be449bdd (diff)
dpdk: populate mempool mem_list
Mellanox driver needs it Change-Id: I28423805f977089d18d32e85cf08e9e7e1fcf5b2 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/plugins/dpdk/buffer.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index 4c82dfcbb71..7f6c118a4a5 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -117,6 +117,7 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp)
uword i;
size_t page_sz;
vlib_physmem_map_t *pm;
+ int do_vfio_map = 1;
pm = vlib_physmem_get_map (vm, bp->physmem_map_index);
page_sz = 1ULL << pm->log2_page_size;
@@ -127,8 +128,21 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp)
uword pa = (iova_mode == RTE_IOVA_VA) ?
pointer_to_uword (va) : pm->page_table[i];
- if (rte_vfio_dma_map (pointer_to_uword (va), pa, page_sz))
- break;
+ if (do_vfio_map &&
+ rte_vfio_dma_map (pointer_to_uword (va), pa, page_sz))
+ do_vfio_map = 0;
+
+ struct rte_mempool_memhdr *memhdr;
+ memhdr = clib_mem_alloc (sizeof (*memhdr));
+ memhdr->mp = mp;
+ memhdr->addr = va;
+ memhdr->iova = pa;
+ memhdr->len = page_sz;
+ memhdr->free_cb = 0;
+ memhdr->opaque = 0;
+
+ STAILQ_INSERT_TAIL (&mp->mem_list, memhdr, next);
+ mp->nb_mem_chunks++;
}
}