diff options
author | Damjan Marion <damarion@cisco.com> | 2017-10-12 13:09:26 +0200 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2017-10-25 19:04:06 +0000 |
commit | 149ba779cff4ffc48d87ca67a2a8d4afd49b05f5 (patch) | |
tree | bc0467669b33b745fe4f44d4d0c787cf53900536 /src/plugins/dpdk/buffer.c | |
parent | a19d7b822ae9584cde522aefba36915e2af58846 (diff) |
vlib: add support for multiple buffer pools
Change-Id: Icaf7d7ad47284aea7a56e8006b69f45874d64202
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/dpdk/buffer.c')
-rw-r--r-- | src/plugins/dpdk/buffer.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c index a44428a4592..b3dca95227c 100644 --- a/src/plugins/dpdk/buffer.c +++ b/src/plugins/dpdk/buffer.c @@ -193,6 +193,8 @@ fill_free_list (vlib_main_t * vm, if (rte_mempool_get_bulk (rmp, vm->mbuf_alloc_list, n) < 0) return 0; + dpdk_mempool_private_t *privp = rte_mempool_get_priv (rmp); + _vec_len (vm->mbuf_alloc_list) = n; i = 0; @@ -233,6 +235,11 @@ fill_free_list (vlib_main_t * vm, vlib_buffer_init_for_free_list (b2, fl); vlib_buffer_init_for_free_list (b3, fl); + b0->buffer_pool_index = privp->buffer_pool_index; + b1->buffer_pool_index = privp->buffer_pool_index; + b2->buffer_pool_index = privp->buffer_pool_index; + b3->buffer_pool_index = privp->buffer_pool_index; + if (fl->buffer_init_function) { fl->buffer_init_function (vm, fl, &bi0, 1); @@ -253,6 +260,7 @@ fill_free_list (vlib_main_t * vm, vec_add1_aligned (fl->buffers, bi0, CLIB_CACHE_LINE_BYTES); vlib_buffer_init_for_free_list (b0, fl); + b0->buffer_pool_index = privp->buffer_pool_index; if (fl->buffer_init_function) fl->buffer_init_function (vm, fl, &bi0, 1); @@ -409,13 +417,6 @@ dpdk_packet_template_init (vlib_main_t * vm, vlib_worker_thread_barrier_release (vm); } -typedef struct -{ - /* must be first */ - struct rte_pktmbuf_pool_private mbp_priv; - vlib_physmem_region_index_t region_index; -} dpdk_mempool_private_t; - clib_error_t * dpdk_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs, unsigned socket_id) @@ -446,9 +447,8 @@ dpdk_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs, size = rte_mempool_xmem_size (num_mbufs, obj_size, 21); clib_error_t *error = 0; - error = - vlib_physmem_region_alloc (vm, (char *) pool_name, size, socket_id, - VLIB_PHYSMEM_F_HAVE_BUFFERS, &pri); + error = vlib_physmem_region_alloc (vm, (char *) pool_name, size, socket_id, + 0, &pri); if (error) clib_error_report (error); @@ -487,7 +487,7 @@ dpdk_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs, rte_mempool_obj_iter (rmp, rte_pktmbuf_init, 0); dpdk_mempool_private_t *privp = rte_mempool_get_priv (rmp); - privp->region_index = pri; + privp->buffer_pool_index = vlib_buffer_add_physmem_region (vm, pri); dm->pktmbuf_pools[socket_id] = rmp; |