diff options
author | Damjan Marion <damarion@cisco.com> | 2018-06-06 14:23:42 +0200 |
---|---|---|
committer | Marco Varlese <marco.varlese@suse.de> | 2018-06-07 05:48:49 +0000 |
commit | 0e969ac8431c80ff4bca5f6985876b1c584eefcd (patch) | |
tree | 3860c4273c016bd23f2fa1e5cd51f854999c1274 /src/plugins/dpdk/buffer.c | |
parent | d018870d1b02109fc8b328446f15312fdd2fcd11 (diff) |
Add support for DPDK 18.05
Change-Id: I205932bc727c990011bbbe1dc6c0cf5349d19806
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/dpdk/buffer.c')
-rw-r--r-- | src/plugins/dpdk/buffer.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c index 31e8eee25a9..6afd20e06fe 100644 --- a/src/plugins/dpdk/buffer.c +++ b/src/plugins/dpdk/buffer.c @@ -463,22 +463,26 @@ dpdk_pool_create (vlib_main_t * vm, u8 * pool_name, u32 elt_size, clib_error_t *error = 0; u32 size, obj_size; i32 ret; + uword i; obj_size = rte_mempool_calc_obj_size (elt_size, 0, 0); + +#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0) size = rte_mempool_xmem_size (num_elts, obj_size, 21, 0); +#else + size = rte_mempool_calc_mem_size_helper (num_elts, obj_size, 21); +#endif - error = - vlib_physmem_region_alloc (vm, (char *) pool_name, size, numa, - VLIB_PHYSMEM_F_HUGETLB | VLIB_PHYSMEM_F_SHARED, - pri); + error = vlib_physmem_region_alloc (vm, (char *) pool_name, size, numa, + VLIB_PHYSMEM_F_HUGETLB | + VLIB_PHYSMEM_F_SHARED, pri); if (error) return error; pr = vlib_physmem_get_region (vm, pri[0]); - mp = - rte_mempool_create_empty ((char *) pool_name, num_elts, elt_size, - 512, pool_priv_size, numa, 0); + mp = rte_mempool_create_empty ((char *) pool_name, num_elts, elt_size, + 512, pool_priv_size, numa, 0); if (!mp) return clib_error_return (0, "failed to create %s", pool_name); @@ -490,13 +494,16 @@ dpdk_pool_create (vlib_main_t * vm, u8 * pool_name, u32 elt_size, priv.mbp_priv.mbuf_priv_size = VLIB_BUFFER_HDR_SIZE; rte_pktmbuf_pool_init (mp, &priv); - ret = - rte_mempool_populate_iova_tab (mp, pr->mem, pr->page_table, pr->n_pages, - pr->log2_page_size, NULL, NULL); - if (ret != (i32) mp->size) + for (i = 0; i < pr->n_pages; i++) { - rte_mempool_free (mp); - return clib_error_return (0, "failed to populate %s", pool_name); + size_t page_size = 1 << pr->log2_page_size; + ret = rte_mempool_populate_iova (mp, ((char *) pr->mem) + i * page_size, + pr->page_table[i], page_size, 0, 0); + if (ret < 0) + { + rte_mempool_free (mp); + return clib_error_return (0, "failed to populate %s", pool_name); + } } _mp[0] = mp; |