2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <svm/svm_fifo.h>
17 #include <vppinfra/cpu.h>
20 position_lt (svm_fifo_t * f, u32 a, u32 b)
22 return (ooo_segment_distance_from_tail (f, a)
23 < ooo_segment_distance_from_tail (f, b));
27 position_leq (svm_fifo_t * f, u32 a, u32 b)
29 return (ooo_segment_distance_from_tail (f, a)
30 <= ooo_segment_distance_from_tail (f, b));
34 position_gt (svm_fifo_t * f, u32 a, u32 b)
36 return (ooo_segment_distance_from_tail (f, a)
37 > ooo_segment_distance_from_tail (f, b));
41 position_diff (svm_fifo_t * f, u32 posa, u32 posb)
43 return ooo_segment_distance_from_tail (f, posa)
44 - ooo_segment_distance_from_tail (f, posb);
48 ooo_segment_end_pos (svm_fifo_t * f, ooo_segment_t * s)
50 return (s->start + s->length) % f->nitems;
54 format_ooo_segment (u8 * s, va_list * args)
56 svm_fifo_t *f = va_arg (*args, svm_fifo_t *);
57 ooo_segment_t *seg = va_arg (*args, ooo_segment_t *);
58 u32 normalized_start = (seg->start + f->nitems - f->tail) % f->nitems;
59 s = format (s, "[%u, %u], len %u, next %d, prev %d", normalized_start,
60 (normalized_start + seg->length) % f->nitems, seg->length,
61 seg->next, seg->prev);
66 svm_fifo_dump_trace (u8 * s, svm_fifo_t * f)
69 svm_fifo_trace_elem_t *seg = 0;
74 vec_foreach (seg, f->trace)
76 s = format (s, "{%u, %u, %u}, ", seg->offset, seg->len, seg->action);
90 svm_fifo_replay (u8 * s, svm_fifo_t * f, u8 no_read, u8 verbose)
94 svm_fifo_trace_elem_t *trace;
96 svm_fifo_t *dummy_fifo;
103 trace_len = vec_len (trace);
109 dummy_fifo = svm_fifo_create (f->nitems);
110 memset (f->data, 0xFF, f->nitems);
112 vec_validate (data, f->nitems);
113 for (i = 0; i < vec_len (data); i++)
116 for (i = 0; i < trace_len; i++)
118 offset = trace[i].offset;
119 if (trace[i].action == 1)
122 s = format (s, "adding [%u, %u]:", trace[i].offset,
124 trace[i].len) % dummy_fifo->nitems);
125 svm_fifo_enqueue_with_offset (dummy_fifo, trace[i].offset,
126 trace[i].len, &data[offset]);
128 else if (trace[i].action == 2)
131 s = format (s, "adding [%u, %u]:", 0, trace[i].len);
132 svm_fifo_enqueue_nowait (dummy_fifo, trace[i].len, &data[offset]);
137 s = format (s, "read: %u", trace[i].len);
138 svm_fifo_dequeue_drop (dummy_fifo, trace[i].len);
141 s = format (s, "%U", format_svm_fifo, dummy_fifo, 1);
144 s = format (s, "result: %U", format_svm_fifo, dummy_fifo, 1);
150 format_ooo_list (u8 * s, va_list * args)
152 svm_fifo_t *f = va_arg (*args, svm_fifo_t *);
153 u32 ooo_segment_index = f->ooos_list_head;
156 while (ooo_segment_index != OOO_SEGMENT_INVALID_INDEX)
158 seg = pool_elt_at_index (f->ooo_segments, ooo_segment_index);
159 s = format (s, " %U\n", format_ooo_segment, f, seg);
160 ooo_segment_index = seg->next;
167 format_svm_fifo (u8 * s, va_list * args)
169 svm_fifo_t *f = va_arg (*args, svm_fifo_t *);
170 int verbose = va_arg (*args, int);
175 s = format (s, "cursize %u nitems %u has_event %d\n",
176 f->cursize, f->nitems, f->has_event);
177 s = format (s, " head %d tail %d segment manager %u\n", f->head, f->tail,
182 (s, " vpp session %d thread %d app session %d thread %d\n",
183 f->master_session_index, f->master_thread_index,
184 f->client_session_index, f->client_thread_index);
188 s = format (s, " ooo pool %d active elts newest %u\n",
189 pool_elts (f->ooo_segments), f->ooos_newest);
190 if (svm_fifo_has_ooo_data (f))
191 s = format (s, " %U", format_ooo_list, f, verbose);
196 /** create an svm fifo, in the current heap. Fails vs blow up the process */
198 svm_fifo_create (u32 data_size_in_bytes)
201 u32 rounded_data_size;
203 /* always round fifo data size to the next highest power-of-two */
204 rounded_data_size = (1 << (max_log2 (data_size_in_bytes)));
205 f = clib_mem_alloc_aligned_or_null (sizeof (*f) + rounded_data_size,
206 CLIB_CACHE_LINE_BYTES);
210 memset (f, 0, sizeof (*f));
211 f->nitems = data_size_in_bytes;
212 f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
218 svm_fifo_free (svm_fifo_t * f)
220 ASSERT (f->refcnt > 0);
222 if (--f->refcnt == 0)
224 pool_free (f->ooo_segments);
229 always_inline ooo_segment_t *
230 ooo_segment_new (svm_fifo_t * f, u32 start, u32 length)
234 pool_get (f->ooo_segments, s);
239 s->prev = s->next = OOO_SEGMENT_INVALID_INDEX;
245 ooo_segment_del (svm_fifo_t * f, u32 index)
247 ooo_segment_t *cur, *prev = 0, *next = 0;
248 cur = pool_elt_at_index (f->ooo_segments, index);
250 if (cur->next != OOO_SEGMENT_INVALID_INDEX)
252 next = pool_elt_at_index (f->ooo_segments, cur->next);
253 next->prev = cur->prev;
256 if (cur->prev != OOO_SEGMENT_INVALID_INDEX)
258 prev = pool_elt_at_index (f->ooo_segments, cur->prev);
259 prev->next = cur->next;
263 f->ooos_list_head = cur->next;
266 pool_put (f->ooo_segments, cur);
270 * Add segment to fifo's out-of-order segment list. Takes care of merging
271 * adjacent segments and removing overlapping ones.
274 ooo_segment_add (svm_fifo_t * f, u32 offset, u32 length)
276 ooo_segment_t *s, *new_s, *prev, *next, *it;
277 u32 new_index, s_end_pos, s_index;
278 u32 normalized_position, normalized_end_position;
280 ASSERT (offset + length <= ooo_segment_distance_from_tail (f, f->head));
281 normalized_position = (f->tail + offset) % f->nitems;
282 normalized_end_position = (f->tail + offset + length) % f->nitems;
284 f->ooos_newest = OOO_SEGMENT_INVALID_INDEX;
286 if (f->ooos_list_head == OOO_SEGMENT_INVALID_INDEX)
288 s = ooo_segment_new (f, normalized_position, length);
289 f->ooos_list_head = s - f->ooo_segments;
290 f->ooos_newest = f->ooos_list_head;
294 /* Find first segment that starts after new segment */
295 s = pool_elt_at_index (f->ooo_segments, f->ooos_list_head);
296 while (s->next != OOO_SEGMENT_INVALID_INDEX
297 && position_lt (f, s->start, normalized_position))
298 s = pool_elt_at_index (f->ooo_segments, s->next);
300 /* If we have a previous and we overlap it, use it as starting point */
301 prev = ooo_segment_get_prev (f, s);
303 && position_leq (f, normalized_position, ooo_segment_end_pos (f, prev)))
306 s_end_pos = ooo_segment_end_pos (f, s);
308 /* Since we have previous, normalized start position cannot be smaller
309 * than prev->start. Check tail */
310 ASSERT (position_lt (f, s->start, normalized_position));
314 s_index = s - f->ooo_segments;
315 s_end_pos = ooo_segment_end_pos (f, s);
317 /* No overlap, add before current segment */
318 if (position_lt (f, normalized_end_position, s->start))
320 new_s = ooo_segment_new (f, normalized_position, length);
321 new_index = new_s - f->ooo_segments;
323 /* Pool might've moved, get segment again */
324 s = pool_elt_at_index (f->ooo_segments, s_index);
325 if (s->prev != OOO_SEGMENT_INVALID_INDEX)
327 new_s->prev = s->prev;
328 prev = pool_elt_at_index (f->ooo_segments, new_s->prev);
329 prev->next = new_index;
334 f->ooos_list_head = new_index;
337 new_s->next = s_index;
339 f->ooos_newest = new_index;
342 /* No overlap, add after current segment */
343 else if (position_gt (f, normalized_position, s_end_pos))
345 new_s = ooo_segment_new (f, normalized_position, length);
346 new_index = new_s - f->ooo_segments;
348 /* Pool might've moved, get segment again */
349 s = pool_elt_at_index (f->ooo_segments, s_index);
351 /* Needs to be last */
352 ASSERT (s->next == OOO_SEGMENT_INVALID_INDEX);
354 new_s->prev = s_index;
356 f->ooos_newest = new_index;
366 if (position_lt (f, normalized_position, s->start))
368 s->start = normalized_position;
369 s->length = position_diff (f, s_end_pos, s->start);
370 f->ooos_newest = s - f->ooo_segments;
375 /* Overlapping tail */
376 if (position_gt (f, normalized_end_position, s_end_pos))
378 s->length = position_diff (f, normalized_end_position, s->start);
380 /* Remove the completely overlapped segments in the tail */
381 it = ooo_segment_next (f, s);
382 while (it && position_leq (f, ooo_segment_end_pos (f, it),
383 normalized_end_position))
385 next = ooo_segment_next (f, it);
386 ooo_segment_del (f, it - f->ooo_segments);
390 /* If partial overlap with last, merge */
391 if (it && position_leq (f, it->start, normalized_end_position))
393 s->length = position_diff (f, ooo_segment_end_pos (f, it),
395 ooo_segment_del (f, it - f->ooo_segments);
397 f->ooos_newest = s - f->ooo_segments;
402 * Removes segments that can now be enqueued because the fifo's tail has
403 * advanced. Returns the number of bytes added to tail.
406 ooo_segment_try_collect (svm_fifo_t * f, u32 n_bytes_enqueued)
409 u32 index, bytes = 0;
412 s = pool_elt_at_index (f->ooo_segments, f->ooos_list_head);
413 diff = ooo_segment_distance_to_tail (f, s->start);
415 ASSERT (diff != n_bytes_enqueued);
417 if (diff > n_bytes_enqueued)
420 /* If last tail update overlaps one/multiple ooo segments, remove them */
421 while (0 <= diff && diff < n_bytes_enqueued)
423 index = s - f->ooo_segments;
425 /* Segment end is beyond the tail. Advance tail and remove segment */
426 if (s->length > diff)
428 bytes = s->length - diff;
430 f->tail %= f->nitems;
431 ooo_segment_del (f, index);
435 /* If we have next go on */
436 if (s->next != OOO_SEGMENT_INVALID_INDEX)
438 s = pool_elt_at_index (f->ooo_segments, s->next);
439 diff = ooo_segment_distance_to_tail (f, s->start);
440 ooo_segment_del (f, index);
445 ooo_segment_del (f, index);
450 ASSERT (bytes <= f->nitems);
455 svm_fifo_enqueue_internal (svm_fifo_t * f, u32 max_bytes,
456 const u8 * copy_from_here)
458 u32 total_copy_bytes, first_copy_bytes, second_copy_bytes;
461 /* read cursize, which can only increase while we're working */
462 cursize = svm_fifo_max_dequeue (f);
463 f->ooos_newest = OOO_SEGMENT_INVALID_INDEX;
465 if (PREDICT_FALSE (cursize == f->nitems))
466 return SVM_FIFO_FULL;
470 /* Number of bytes we're going to copy */
471 total_copy_bytes = (nitems - cursize) < max_bytes ?
472 (nitems - cursize) : max_bytes;
474 if (PREDICT_TRUE (copy_from_here != 0))
476 /* Number of bytes in first copy segment */
477 first_copy_bytes = ((nitems - f->tail) < total_copy_bytes)
478 ? (nitems - f->tail) : total_copy_bytes;
480 clib_memcpy (&f->data[f->tail], copy_from_here, first_copy_bytes);
481 f->tail += first_copy_bytes;
482 f->tail = (f->tail == nitems) ? 0 : f->tail;
484 /* Number of bytes in second copy segment, if any */
485 second_copy_bytes = total_copy_bytes - first_copy_bytes;
486 if (second_copy_bytes)
488 clib_memcpy (&f->data[f->tail], copy_from_here + first_copy_bytes,
490 f->tail += second_copy_bytes;
491 f->tail = (f->tail == nitems) ? 0 : f->tail;
498 /* Account for a zero-copy enqueue done elsewhere */
499 ASSERT (max_bytes <= (nitems - cursize));
500 f->tail += max_bytes;
501 f->tail = f->tail % nitems;
502 total_copy_bytes = max_bytes;
505 svm_fifo_trace_add (f, f->head, total_copy_bytes, 2);
507 /* Any out-of-order segments to collect? */
508 if (PREDICT_FALSE (f->ooos_list_head != OOO_SEGMENT_INVALID_INDEX))
509 total_copy_bytes += ooo_segment_try_collect (f, total_copy_bytes);
511 /* Atomically increase the queue length */
512 ASSERT (cursize + total_copy_bytes <= nitems);
513 __sync_fetch_and_add (&f->cursize, total_copy_bytes);
515 return (total_copy_bytes);
518 #define SVM_ENQUEUE_CLONE_TEMPLATE(arch, fn, tgt) \
520 __attribute__ ((flatten)) \
521 __attribute__ ((target (tgt))) \
523 fn ## _ ## arch ( svm_fifo_t * f, u32 max_bytes, u8 * copy_from_here) \
524 { return fn (f, max_bytes, copy_from_here);}
527 svm_fifo_enqueue_nowait_ma (svm_fifo_t * f, u32 max_bytes,
528 const u8 * copy_from_here)
530 return svm_fifo_enqueue_internal (f, max_bytes, copy_from_here);
533 foreach_march_variant (SVM_ENQUEUE_CLONE_TEMPLATE,
534 svm_fifo_enqueue_nowait_ma);
535 CLIB_MULTIARCH_SELECT_FN (svm_fifo_enqueue_nowait_ma);
538 svm_fifo_enqueue_nowait (svm_fifo_t * f, u32 max_bytes,
539 const u8 * copy_from_here)
542 return svm_fifo_enqueue_nowait_ma (f, max_bytes, copy_from_here);
544 static int (*fp) (svm_fifo_t *, u32, const u8 *);
546 if (PREDICT_FALSE (fp == 0))
547 fp = (void *) svm_fifo_enqueue_nowait_ma_multiarch_select ();
549 return (*fp) (f, max_bytes, copy_from_here);
554 * Enqueue a future segment.
556 * Two choices: either copies the entire segment, or copies nothing
557 * Returns 0 of the entire segment was copied
558 * Returns -1 if none of the segment was copied due to lack of space
561 svm_fifo_enqueue_with_offset_internal (svm_fifo_t * f,
566 u32 total_copy_bytes, first_copy_bytes, second_copy_bytes;
567 u32 cursize, nitems, normalized_offset;
569 f->ooos_newest = OOO_SEGMENT_INVALID_INDEX;
571 /* read cursize, which can only increase while we're working */
572 cursize = svm_fifo_max_dequeue (f);
575 ASSERT (required_bytes < nitems);
577 normalized_offset = (f->tail + offset) % nitems;
579 /* Will this request fit? */
580 if ((required_bytes + offset) > (nitems - cursize))
583 svm_fifo_trace_add (f, offset, required_bytes, 1);
585 ooo_segment_add (f, offset, required_bytes);
587 /* Number of bytes we're going to copy */
588 total_copy_bytes = required_bytes;
590 /* Number of bytes in first copy segment */
591 first_copy_bytes = ((nitems - normalized_offset) < total_copy_bytes)
592 ? (nitems - normalized_offset) : total_copy_bytes;
594 clib_memcpy (&f->data[normalized_offset], copy_from_here, first_copy_bytes);
596 /* Number of bytes in second copy segment, if any */
597 second_copy_bytes = total_copy_bytes - first_copy_bytes;
598 if (second_copy_bytes)
600 normalized_offset += first_copy_bytes;
601 normalized_offset %= nitems;
603 ASSERT (normalized_offset == 0);
605 clib_memcpy (&f->data[normalized_offset],
606 copy_from_here + first_copy_bytes, second_copy_bytes);
614 svm_fifo_enqueue_with_offset (svm_fifo_t * f,
616 u32 required_bytes, u8 * copy_from_here)
618 return svm_fifo_enqueue_with_offset_internal (f, offset, required_bytes,
623 svm_fifo_overwrite_head (svm_fifo_t * f, u8 * data, u32 len)
626 first_chunk = f->nitems - f->head;
627 ASSERT (len <= f->nitems);
628 if (len <= first_chunk)
629 clib_memcpy (&f->data[f->head], data, len);
632 clib_memcpy (&f->data[f->head], data, first_chunk);
633 clib_memcpy (&f->data[0], data + first_chunk, len - first_chunk);
638 svm_fifo_dequeue_internal (svm_fifo_t * f, u32 max_bytes, u8 * copy_here)
640 u32 total_copy_bytes, first_copy_bytes, second_copy_bytes;
643 /* read cursize, which can only increase while we're working */
644 cursize = svm_fifo_max_dequeue (f);
645 if (PREDICT_FALSE (cursize == 0))
646 return -2; /* nothing in the fifo */
650 /* Number of bytes we're going to copy */
651 total_copy_bytes = (cursize < max_bytes) ? cursize : max_bytes;
653 if (PREDICT_TRUE (copy_here != 0))
655 /* Number of bytes in first copy segment */
656 first_copy_bytes = ((nitems - f->head) < total_copy_bytes)
657 ? (nitems - f->head) : total_copy_bytes;
658 clib_memcpy (copy_here, &f->data[f->head], first_copy_bytes);
659 f->head += first_copy_bytes;
660 f->head = (f->head == nitems) ? 0 : f->head;
662 /* Number of bytes in second copy segment, if any */
663 second_copy_bytes = total_copy_bytes - first_copy_bytes;
664 if (second_copy_bytes)
666 clib_memcpy (copy_here + first_copy_bytes,
667 &f->data[f->head], second_copy_bytes);
668 f->head += second_copy_bytes;
669 f->head = (f->head == nitems) ? 0 : f->head;
675 /* Account for a zero-copy dequeue done elsewhere */
676 ASSERT (max_bytes <= cursize);
677 f->head += max_bytes;
678 f->head = f->head % nitems;
679 cursize -= max_bytes;
680 total_copy_bytes = max_bytes;
683 ASSERT (f->head <= nitems);
684 ASSERT (cursize >= total_copy_bytes);
685 __sync_fetch_and_sub (&f->cursize, total_copy_bytes);
687 return (total_copy_bytes);
691 svm_fifo_dequeue_nowait_ma (svm_fifo_t * f, u32 max_bytes, u8 * copy_here)
693 return svm_fifo_dequeue_internal (f, max_bytes, copy_here);
696 #define SVM_FIFO_DEQUEUE_CLONE_TEMPLATE(arch, fn, tgt) \
698 __attribute__ ((flatten)) \
699 __attribute__ ((target (tgt))) \
701 fn ## _ ## arch ( svm_fifo_t * f, u32 max_bytes, \
703 { return fn (f, max_bytes, copy_here);}
705 foreach_march_variant (SVM_FIFO_DEQUEUE_CLONE_TEMPLATE,
706 svm_fifo_dequeue_nowait_ma);
707 CLIB_MULTIARCH_SELECT_FN (svm_fifo_dequeue_nowait_ma);
710 svm_fifo_dequeue_nowait (svm_fifo_t * f, u32 max_bytes, u8 * copy_here)
713 return svm_fifo_dequeue_nowait_ma (f, max_bytes, copy_here);
715 static int (*fp) (svm_fifo_t *, u32, u8 *);
717 if (PREDICT_FALSE (fp == 0))
718 fp = (void *) svm_fifo_dequeue_nowait_ma_multiarch_select ();
720 return (*fp) (f, max_bytes, copy_here);
725 svm_fifo_peek_ma (svm_fifo_t * f, u32 relative_offset, u32 max_bytes,
728 u32 total_copy_bytes, first_copy_bytes, second_copy_bytes;
729 u32 cursize, nitems, real_head;
731 /* read cursize, which can only increase while we're working */
732 cursize = svm_fifo_max_dequeue (f);
733 if (PREDICT_FALSE (cursize < relative_offset))
734 return -2; /* nothing in the fifo */
737 real_head = f->head + relative_offset;
738 real_head = real_head >= nitems ? real_head - nitems : real_head;
740 /* Number of bytes we're going to copy */
741 total_copy_bytes = (cursize - relative_offset < max_bytes) ?
742 cursize - relative_offset : max_bytes;
744 if (PREDICT_TRUE (copy_here != 0))
746 /* Number of bytes in first copy segment */
748 ((nitems - real_head) < total_copy_bytes) ?
749 (nitems - real_head) : total_copy_bytes;
750 clib_memcpy (copy_here, &f->data[real_head], first_copy_bytes);
752 /* Number of bytes in second copy segment, if any */
753 second_copy_bytes = total_copy_bytes - first_copy_bytes;
754 if (second_copy_bytes)
756 clib_memcpy (copy_here + first_copy_bytes, &f->data[0],
760 return total_copy_bytes;
763 #define SVM_FIFO_PEEK_CLONE_TEMPLATE(arch, fn, tgt) \
765 __attribute__ ((flatten)) \
766 __attribute__ ((target (tgt))) \
768 fn ## _ ## arch ( svm_fifo_t * f, u32 relative_offset, u32 max_bytes, \
770 { return fn (f, relative_offset, max_bytes, copy_here);}
772 foreach_march_variant (SVM_FIFO_PEEK_CLONE_TEMPLATE, svm_fifo_peek_ma);
773 CLIB_MULTIARCH_SELECT_FN (svm_fifo_peek_ma);
776 svm_fifo_peek (svm_fifo_t * f, u32 relative_offset, u32 max_bytes,
780 return svm_fifo_peek_ma (f, relative_offset, max_bytes, copy_here);
782 static int (*fp) (svm_fifo_t *, u32, u32, u8 *);
784 if (PREDICT_FALSE (fp == 0))
785 fp = (void *) svm_fifo_peek_ma_multiarch_select ();
787 return (*fp) (f, relative_offset, max_bytes, copy_here);
792 svm_fifo_dequeue_drop (svm_fifo_t * f, u32 max_bytes)
794 u32 total_drop_bytes, first_drop_bytes, second_drop_bytes;
797 /* read cursize, which can only increase while we're working */
798 cursize = svm_fifo_max_dequeue (f);
799 if (PREDICT_FALSE (cursize == 0))
800 return -2; /* nothing in the fifo */
804 /* Number of bytes we're going to drop */
805 total_drop_bytes = (cursize < max_bytes) ? cursize : max_bytes;
807 svm_fifo_trace_add (f, f->tail, total_drop_bytes, 3);
809 /* Number of bytes in first copy segment */
811 ((nitems - f->head) < total_drop_bytes) ?
812 (nitems - f->head) : total_drop_bytes;
813 f->head += first_drop_bytes;
814 f->head = (f->head == nitems) ? 0 : f->head;
816 /* Number of bytes in second drop segment, if any */
817 second_drop_bytes = total_drop_bytes - first_drop_bytes;
818 if (second_drop_bytes)
820 f->head += second_drop_bytes;
821 f->head = (f->head == nitems) ? 0 : f->head;
824 ASSERT (f->head <= nitems);
825 ASSERT (cursize >= total_drop_bytes);
826 __sync_fetch_and_sub (&f->cursize, total_drop_bytes);
828 return total_drop_bytes;
832 svm_fifo_dequeue_drop_all (svm_fifo_t * f)
835 __sync_fetch_and_sub (&f->cursize, f->cursize);
839 svm_fifo_number_ooo_segments (svm_fifo_t * f)
841 return pool_elts (f->ooo_segments);
845 svm_fifo_first_ooo_segment (svm_fifo_t * f)
847 return pool_elt_at_index (f->ooo_segments, f->ooos_list_head);
851 * Set fifo pointers to requested offset
854 svm_fifo_init_pointers (svm_fifo_t * f, u32 pointer)
856 f->head = f->tail = pointer % f->nitems;
860 * fd.io coding-style-patch-verification: ON
863 * eval: (c-set-style "gnu")