aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dpdk/buffer.c')
-rw-r--r--src/plugins/dpdk/buffer.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index a1c1ea1ca46..d7a79161386 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -40,7 +40,7 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp)
struct rte_mempool *mp, *nmp;
struct rte_pktmbuf_pool_private priv;
enum rte_iova_mode iova_mode;
- u32 *bi;
+ u32 i;
u8 *name = 0;
u32 elt_size =
@@ -54,7 +54,7 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp)
/* normal mempool */
name = format (name, "vpp pool %u%c", bp->index, 0);
- mp = rte_mempool_create_empty ((char *) name, vec_len (bp->buffers),
+ mp = rte_mempool_create_empty ((char *) name, bp->n_buffers,
elt_size, 512, sizeof (priv),
bp->numa_node, 0);
if (!mp)
@@ -68,7 +68,7 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp)
/* non-cached mempool */
name = format (name, "vpp pool %u (no cache)%c", bp->index, 0);
- nmp = rte_mempool_create_empty ((char *) name, vec_len (bp->buffers),
+ nmp = rte_mempool_create_empty ((char *) name, bp->n_buffers,
elt_size, 0, sizeof (priv),
bp->numa_node, 0);
if (!nmp)
@@ -99,11 +99,10 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp)
iova_mode = rte_eal_iova_mode ();
/* populate mempool object buffer header */
- /* *INDENT-OFF* */
- vec_foreach (bi, bp->buffers)
+ for (i = 0; i < bp->n_buffers; i++)
{
struct rte_mempool_objhdr *hdr;
- vlib_buffer_t *b = vlib_get_buffer (vm, *bi);
+ vlib_buffer_t *b = vlib_get_buffer (vm, bp->buffers[i]);
struct rte_mbuf *mb = rte_mbuf_from_vlib_buffer (b);
hdr = (struct rte_mempool_objhdr *) RTE_PTR_SUB (mb, sizeof (*hdr));
hdr->mp = mp;
@@ -114,7 +113,6 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp)
mp->populated_size++;
nmp->populated_size++;
}
- /* *INDENT-ON* */
/* call the object initializers */
rte_mempool_obj_iter (mp, rte_pktmbuf_init, 0);
@@ -127,14 +125,12 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp)
(buffer_mem_start, *bp->buffers,
0)), sizeof (struct rte_mbuf));
- /* *INDENT-OFF* */
- vec_foreach (bi, bp->buffers)
+ for (i = 0; i < bp->n_buffers; i++)
{
vlib_buffer_t *b;
- b = vlib_buffer_ptr_from_index (buffer_mem_start, *bi, 0);
+ b = vlib_buffer_ptr_from_index (buffer_mem_start, bp->buffers[i], 0);
vlib_buffer_copy_template (b, &bp->buffer_template);
}
- /* *INDENT-ON* */
/* map DMA pages if at least one physical device exists */
if (rte_eth_dev_count_avail ())