summaryrefslogtreecommitdiffstats
path: root/src/svm/svm_fifo_segment.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/svm/svm_fifo_segment.c')
-rw-r--r--src/svm/svm_fifo_segment.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/svm/svm_fifo_segment.c b/src/svm/svm_fifo_segment.c
index e377160f6d8..94bf6a5e73e 100644
--- a/src/svm/svm_fifo_segment.c
+++ b/src/svm/svm_fifo_segment.c
@@ -381,7 +381,12 @@ svm_fifo_segment_alloc_fifo (svm_fifo_segment_private_t * fs,
fsh->free_fifos[freelist_index] = f->next;
/* (re)initialize the fifo, as in svm_fifo_create */
clib_memset (f, 0, sizeof (*f));
- f->nitems = data_size_in_bytes;
+ f->size = (1 << (max_log2 (data_size_in_bytes)));
+ /*
+ * usable size of the fifo set to rounded_data_size - 1
+ * to differentiate between free fifo and empty fifo.
+ */
+ f->nitems = f->size - 1;
f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
f->ct_session_index = SVM_FIFO_INVALID_SESSION_INDEX;
f->refcnt = 1;