dpdk: populate mempool mem_list
Mellanox driver needs it
Change-Id: I28423805f977089d18d32e85cf08e9e7e1fcf5b2
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index 4c82dfc..7f6c118 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -117,6 +117,7 @@
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 @@
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++;
}
}