summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-04-28 20:40:57 +0000
committerDamjan Marion <dmarion@me.com>2020-04-28 21:50:55 +0000
commit635f5068f0802ec1fe34c998b72fb2f626259050 (patch)
tree3c56c62b5715f056698579632e5f498d2aa84df5 /src
parent049d0b438ef2971181549f195c7e0338cd1c60f4 (diff)
svm: fix fifo alignemnt in batch prealloc
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I5cdf3cff820a0679f78b212a277d1873c2cfb980
Diffstat (limited to 'src')
-rw-r--r--src/svm/fifo_segment.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c
index d9ca3a2afe3..3fd7d9d6ede 100644
--- a/src/svm/fifo_segment.c
+++ b/src/svm/fifo_segment.c
@@ -572,21 +572,27 @@ fs_try_alloc_fifo_batch (fifo_segment_header_t * fsh,
if (fmem == 0)
return -1;
- /* Carve fifo + chunk space */
+ /* Carve fifo hdr space */
for (i = 0; i < batch_size; i++)
{
f = (svm_fifo_t *) fmem;
memset (f, 0, sizeof (*f));
f->next = fss->free_fifos;
fss->free_fifos = f;
- c = (svm_fifo_chunk_t *) (fmem + sizeof (*f));
+ fmem += sizeof (*f);
+ }
+
+ /* Carve chunk space */
+ for (i = 0; i < batch_size; i++)
+ {
+ c = (svm_fifo_chunk_t *) fmem;
c->start_byte = 0;
c->length = rounded_data_size;
c->enq_rb_index = RBTREE_TNIL_INDEX;
c->deq_rb_index = RBTREE_TNIL_INDEX;
c->next = fss->free_chunks[fl_index];
fss->free_chunks[fl_index] = c;
- fmem += hdrs + rounded_data_size;
+ fmem += sizeof (svm_fifo_chunk_t) + rounded_data_size;
}
fss->num_chunks[fl_index] += batch_size;