summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/buffer.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-08-12 00:26:45 +0200
committerDamjan Marion <dmarion@me.com>2018-08-13 14:32:03 +0000
commit3bf6c2bfe59be62169a1245340722481b0b53870 (patch)
treeed84f92827078d29273ad5d06ff04c80a193f18b /src/plugins/dpdk/buffer.c
parent060c3a7e5a2d23189a8c6348e767cd2018a58dd6 (diff)
dpdk: support for DPDK 18.08
Change-Id: If1b93341c222160b9a08f127620c024620e55c37 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/dpdk/buffer.c')
-rw-r--r--src/plugins/dpdk/buffer.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index 2ce3d87fdff..10646de68a7 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -461,33 +461,33 @@ dpdk_pool_create (vlib_main_t * vm, u8 * pool_name, u32 elt_size,
vlib_physmem_region_t *pr;
dpdk_mempool_private_t priv;
clib_error_t *error = 0;
- u32 size, obj_size;
+ size_t min_chunk_size, align;
+ u32 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
+ 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);
+
+ rte_mempool_set_ops_byname (mp, RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL);
+
+ size = rte_mempool_op_calc_mem_size_default (mp, num_elts, 21,
+ &min_chunk_size, &align);
error = vlib_physmem_region_alloc (vm, (char *) pool_name, size, numa,
VLIB_PHYSMEM_F_HUGETLB |
VLIB_PHYSMEM_F_SHARED, pri);
if (error)
- return error;
+ {
+ rte_mempool_free (mp);
+ 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);
- if (!mp)
- return clib_error_return (0, "failed to create %s", pool_name);
-
- rte_mempool_set_ops_byname (mp, RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL);
-
/* Call the mempool priv initializer */
priv.mbp_priv.mbuf_data_room_size = VLIB_BUFFER_PRE_DATA_SIZE +
VLIB_BUFFER_DATA_SIZE;