- if (fs_try_alloc_fifo_batch (fs, rx_fl_index, pairs_to_alloc))
- clib_warning ("rx prealloc failed: pairs %u", pairs_to_alloc);
- if (fs_try_alloc_fifo_batch (fs, tx_fl_index, pairs_to_alloc))
- clib_warning ("tx prealloc failed: pairs %u", pairs_to_alloc);
-
- /* Account for the pairs allocated */
- *n_fifo_pairs -= pairs_to_alloc;
-}
-
-int
-fifo_segment_grow_fifo (fifo_segment_t * fs, svm_fifo_t * f, u32 chunk_size)
-{
- ssvm_shared_header_t *sh;
- svm_fifo_chunk_t *c;
- void *oldheap;
- int fl_index;
-
- if (!fs_chunk_size_is_valid (chunk_size))
- {
- clib_warning ("chunk size out of range %d", chunk_size);
- return -1;
- }
-
- fl_index = fs_freelist_for_size (chunk_size);
-
- sh = fs->ssvm.sh;
- ssvm_lock_non_recursive (sh, 1);
-
- vec_validate_init_empty (fs->h->free_chunks, fl_index, 0);
- c = fs->h->free_chunks[fl_index];
-
- oldheap = ssvm_push_heap (sh);
-
- if (!c)
- {
- c = svm_fifo_chunk_alloc (chunk_size);
- if (!c)
- {
- ssvm_pop_heap (oldheap);
- ssvm_unlock_non_recursive (sh);
- return -1;
- }
- }
- else
- {
- fs->h->free_chunks[fl_index] = c->next;
- c->next = 0;
- fs->h->n_fl_chunk_bytes -= fs_freelist_index_to_size (fl_index);
- }
-
- svm_fifo_add_chunk (f, c);
-
- ssvm_pop_heap (oldheap);
- ssvm_unlock_non_recursive (sh);
- return 0;
-}
-
-int
-fifo_segment_collect_fifo_chunks (fifo_segment_t * fs, svm_fifo_t * f)
-{
- svm_fifo_chunk_t *cur, *next;
- ssvm_shared_header_t *sh;
- void *oldheap;
- int fl_index;
-
- sh = fs->ssvm.sh;
- ssvm_lock_non_recursive (sh, 1);
-
- oldheap = ssvm_push_heap (sh);
- cur = svm_fifo_collect_chunks (f);
-
- while (cur)