diff options
author | Damjan Marion <damarion@cisco.com> | 2023-10-13 09:59:00 +0000 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2023-10-17 17:44:41 +0000 |
commit | bf236630f518ae94bc2ef76f83b269b98dd109d4 (patch) | |
tree | 91cf566e0eb108e919011c6d912b5b01a7a5c441 /src/plugins | |
parent | 0094fe0190b623dbef0e57b7f4032ba3cf5f36b0 (diff) |
buffers: introduce vlib_buffer_template_t
Type: improvement
Change-Id: Ie86a5edf2ada21355543e9a0382052b16ff86927
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/dpdk/buffer.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c index 8b4b4a926b3..2379a9aa7d0 100644 --- a/src/plugins/dpdk/buffer.c +++ b/src/plugins/dpdk/buffer.c @@ -135,7 +135,7 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp) { vlib_buffer_t *b; b = vlib_buffer_ptr_from_index (buffer_mem_start, bp->buffers[i], 0); - vlib_buffer_copy_template (b, &bp->buffer_template); + b->template = bp->buffer_template; } /* map DMA pages if at least one physical device exists */ @@ -197,7 +197,7 @@ dpdk_ops_vpp_free (struct rte_mempool *mp) #endif static_always_inline void -dpdk_ops_vpp_enqueue_one (vlib_buffer_t * bt, void *obj) +dpdk_ops_vpp_enqueue_one (vlib_buffer_template_t *bt, void *obj) { /* Only non-replicated packets (b->ref_count == 1) expected */ @@ -205,7 +205,7 @@ dpdk_ops_vpp_enqueue_one (vlib_buffer_t * bt, void *obj) vlib_buffer_t *b = vlib_buffer_from_rte_mbuf (mb); ASSERT (b->ref_count == 1); ASSERT (b->buffer_pool_index == bt->buffer_pool_index); - vlib_buffer_copy_template (b, bt); + b->template = *bt; } int @@ -214,14 +214,14 @@ CLIB_MULTIARCH_FN (dpdk_ops_vpp_enqueue) (struct rte_mempool * mp, { const int batch_size = 32; vlib_main_t *vm = vlib_get_main (); - vlib_buffer_t bt; + vlib_buffer_template_t bt; u8 buffer_pool_index = mp->pool_id; vlib_buffer_pool_t *bp = vlib_get_buffer_pool (vm, buffer_pool_index); u32 bufs[batch_size]; u32 n_left = n; void *const *obj = obj_table; - vlib_buffer_copy_template (&bt, &bp->buffer_template); + bt = bp->buffer_template; while (n_left >= 4) { @@ -263,9 +263,9 @@ CLIB_MULTIARCH_FN (dpdk_ops_vpp_enqueue) (struct rte_mempool * mp, CLIB_MARCH_FN_REGISTRATION (dpdk_ops_vpp_enqueue); static_always_inline void -dpdk_ops_vpp_enqueue_no_cache_one (vlib_main_t * vm, struct rte_mempool *old, +dpdk_ops_vpp_enqueue_no_cache_one (vlib_main_t *vm, struct rte_mempool *old, struct rte_mempool *new, void *obj, - vlib_buffer_t * bt) + vlib_buffer_template_t *bt) { struct rte_mbuf *mb = obj; vlib_buffer_t *b = vlib_buffer_from_rte_mbuf (mb); @@ -273,7 +273,7 @@ dpdk_ops_vpp_enqueue_no_cache_one (vlib_main_t * vm, struct rte_mempool *old, if (clib_atomic_sub_fetch (&b->ref_count, 1) == 0) { u32 bi = vlib_get_buffer_index (vm, b); - vlib_buffer_copy_template (b, bt); + b->template = *bt; vlib_buffer_pool_put (vm, bt->buffer_pool_index, &bi, 1); return; } @@ -285,12 +285,12 @@ CLIB_MULTIARCH_FN (dpdk_ops_vpp_enqueue_no_cache) (struct rte_mempool * cmp, unsigned n) { vlib_main_t *vm = vlib_get_main (); - vlib_buffer_t bt; + vlib_buffer_template_t bt; struct rte_mempool *mp; mp = dpdk_mempool_by_buffer_pool_index[cmp->pool_id]; u8 buffer_pool_index = cmp->pool_id; vlib_buffer_pool_t *bp = vlib_get_buffer_pool (vm, buffer_pool_index); - vlib_buffer_copy_template (&bt, &bp->buffer_template); + bt = bp->buffer_template; while (n >= 4) { |