diff options
Diffstat (limited to 'src/svm/fifo_segment.c')
-rw-r--r-- | src/svm/fifo_segment.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c index 815c5a29e8d..00e51cfce7d 100644 --- a/src/svm/fifo_segment.c +++ b/src/svm/fifo_segment.c @@ -485,6 +485,8 @@ fsh_try_alloc_fifo_hdr_batch (fifo_segment_header_t * fsh, u8 *fmem; int i; + ASSERT (batch_size != 0); + size = (uword) sizeof (*f) * batch_size; oldheap = ssvm_push_heap (fsh->ssvm_sh); @@ -522,6 +524,8 @@ fsh_try_alloc_chunk_batch (fifo_segment_header_t * fsh, u8 *cmem; int i; + ASSERT (batch_size != 0); + rounded_data_size = fs_freelist_index_to_size (fl_index); total_chunk_bytes = (uword) batch_size *rounded_data_size; size = (uword) (sizeof (*c) + rounded_data_size) * batch_size; @@ -986,8 +990,11 @@ fifo_segment_preallocate_fifo_pairs (fifo_segment_t * fs, for (i = 0; i < fs->n_slices; i++) { - fss = fsh_slice_get (fsh, i); alloc_now = clib_min (pairs_per_slice, *n_fifo_pairs); + if (0 == alloc_now) + break; + + fss = fsh_slice_get (fsh, i); if (fs_try_alloc_fifo_batch (fsh, fss, rx_fl_index, alloc_now)) clib_warning ("rx prealloc failed: pairs %u", alloc_now); if (fs_try_alloc_fifo_batch (fsh, fss, tx_fl_index, alloc_now)) |