From 0a77040fa0f588f3c2d539aa1d3c500731520676 Mon Sep 17 00:00:00 2001 From: Sachin Saxena Date: Mon, 28 May 2018 14:45:34 +0530 Subject: dpdk: mempool priv intialization must be done before releasing buffers to pool - Currently mempool priv size is getting initialized after releasing buffers to pool. This is causing mismatch in expected & real metadata size value and buffers are getting released with wrong offset. (when metadata offset is in use for a given platform) - Since private data size is 0 initially, metadata size don't include space for VLIB_BUFFER_HDR. Change-Id: I780c4d518104631a3dcf192185bacf58b3598e65 Signed-off-by: Sachin Saxena --- src/plugins/dpdk/buffer.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/plugins/dpdk') diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c index 59015ff7d3d..452c47931ca 100644 --- a/src/plugins/dpdk/buffer.c +++ b/src/plugins/dpdk/buffer.c @@ -488,6 +488,7 @@ dpdk_pool_create (vlib_main_t * vm, u8 * pool_name, u32 elt_size, dpdk_buffer_main_t *dbm = &dpdk_buffer_main; struct rte_mempool *mp; vlib_physmem_region_t *pr; + dpdk_mempool_private_t priv; clib_error_t *error = 0; u32 size, obj_size; i32 ret; @@ -512,6 +513,12 @@ dpdk_pool_create (vlib_main_t * vm, u8 * pool_name, u32 elt_size, 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; + 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); @@ -562,7 +569,6 @@ dpdk_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs, { dpdk_main_t *dm = &dpdk_main; struct rte_mempool *rmp; - dpdk_mempool_private_t priv; vlib_physmem_region_index_t pri; clib_error_t *error = 0; u8 *pool_name; @@ -589,13 +595,6 @@ dpdk_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs, if (!error) { - priv.mbp_priv.mbuf_data_room_size = VLIB_BUFFER_PRE_DATA_SIZE + - VLIB_BUFFER_DATA_SIZE; - priv.mbp_priv.mbuf_priv_size = VLIB_BUFFER_HDR_SIZE; - - /* call the mempool priv initializer */ - rte_pktmbuf_pool_init (rmp, &priv); - /* call the object initializers */ rte_mempool_obj_iter (rmp, rte_pktmbuf_init, 0); -- cgit 1.2.3-korg