2 * Copyright (c) 2016-2019 Cisco and/or its affiliates.
3 * Copyright (c) 2019 Arm Limited
4 * Copyright (c) 2010-2017 Intel Corporation and/or its affiliates.
5 * Copyright (c) 2007-2009 Kip Macy kmacy@freebsd.org
6 * Inspired from DPDK rte_ring.h (SPSC only) (derived from freebsd bufring.h).
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at:
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 #include <svm/svm_fifo.h>
21 #include <vppinfra/cpu.h>
24 position_lt (svm_fifo_t * f, u32 a, u32 b, u32 tail)
26 return (ooo_segment_distance_from_tail (f, a, tail)
27 < ooo_segment_distance_from_tail (f, b, tail));
31 position_leq (svm_fifo_t * f, u32 a, u32 b, u32 tail)
33 return (ooo_segment_distance_from_tail (f, a, tail)
34 <= ooo_segment_distance_from_tail (f, b, tail));
38 position_gt (svm_fifo_t * f, u32 a, u32 b, u32 tail)
40 return (ooo_segment_distance_from_tail (f, a, tail)
41 > ooo_segment_distance_from_tail (f, b, tail));
45 position_diff (svm_fifo_t * f, u32 posa, u32 posb, u32 tail)
47 return ooo_segment_distance_from_tail (f, posa, tail)
48 - ooo_segment_distance_from_tail (f, posb, tail);
52 ooo_segment_end_pos (svm_fifo_t * f, ooo_segment_t * s)
54 return s->start + s->length;
57 #ifndef CLIB_MARCH_VARIANT
60 format_ooo_segment (u8 * s, va_list * args)
62 svm_fifo_t *f = va_arg (*args, svm_fifo_t *);
63 ooo_segment_t *seg = va_arg (*args, ooo_segment_t *);
64 u32 normalized_start = (seg->start + f->nitems - f->tail) % f->size;
65 s = format (s, "[%u, %u], len %u, next %d, prev %d", normalized_start,
66 (normalized_start + seg->length) % f->size, seg->length,
67 seg->next, seg->prev);
72 svm_fifo_dump_trace (u8 * s, svm_fifo_t * f)
75 svm_fifo_trace_elem_t *seg = 0;
80 vec_foreach (seg, f->trace)
82 s = format (s, "{%u, %u, %u}, ", seg->offset, seg->len, seg->action);
96 svm_fifo_replay (u8 * s, svm_fifo_t * f, u8 no_read, u8 verbose)
100 svm_fifo_trace_elem_t *trace;
102 svm_fifo_t *dummy_fifo;
109 trace_len = vec_len (trace);
115 dummy_fifo = svm_fifo_create (f->size);
116 clib_memset (f->data, 0xFF, f->nitems);
118 vec_validate (data, f->nitems);
119 for (i = 0; i < vec_len (data); i++)
122 for (i = 0; i < trace_len; i++)
124 offset = trace[i].offset;
125 if (trace[i].action == 1)
128 s = format (s, "adding [%u, %u]:", trace[i].offset,
129 (trace[i].offset + trace[i].len) % dummy_fifo->size);
130 svm_fifo_enqueue_with_offset (dummy_fifo, trace[i].offset,
131 trace[i].len, &data[offset]);
133 else if (trace[i].action == 2)
136 s = format (s, "adding [%u, %u]:", 0, trace[i].len);
137 svm_fifo_enqueue_nowait (dummy_fifo, trace[i].len, &data[offset]);
142 s = format (s, "read: %u", trace[i].len);
143 svm_fifo_dequeue_drop (dummy_fifo, trace[i].len);
146 s = format (s, "%U", format_svm_fifo, dummy_fifo, 1);
149 s = format (s, "result: %U", format_svm_fifo, dummy_fifo, 1);
155 format_ooo_list (u8 * s, va_list * args)
157 svm_fifo_t *f = va_arg (*args, svm_fifo_t *);
158 u32 indent = va_arg (*args, u32);
159 u32 ooo_segment_index = f->ooos_list_head;
162 while (ooo_segment_index != OOO_SEGMENT_INVALID_INDEX)
164 seg = pool_elt_at_index (f->ooo_segments, ooo_segment_index);
165 s = format (s, "%U%U\n", format_white_space, indent, format_ooo_segment,
167 ooo_segment_index = seg->next;
174 format_svm_fifo (u8 * s, va_list * args)
176 svm_fifo_t *f = va_arg (*args, svm_fifo_t *);
177 int verbose = va_arg (*args, int);
183 indent = format_get_indent (s);
184 s = format (s, "cursize %u nitems %u has_event %d\n",
185 svm_fifo_max_dequeue (f), f->nitems, f->has_event);
186 s = format (s, "%Uhead %u tail %u segment manager %u\n", format_white_space,
187 indent, (f->head % f->size), (f->tail % f->size),
191 s = format (s, "%Uvpp session %d thread %d app session %d thread %d\n",
192 format_white_space, indent, f->master_session_index,
193 f->master_thread_index, f->client_session_index,
194 f->client_thread_index);
198 s = format (s, "%Uooo pool %d active elts newest %u\n",
199 format_white_space, indent, pool_elts (f->ooo_segments),
201 if (svm_fifo_has_ooo_data (f))
202 s = format (s, " %U", format_ooo_list, f, indent, verbose);
207 /** create an svm fifo, in the current heap. Fails vs blow up the process */
209 svm_fifo_create (u32 data_size_in_bytes)
212 u32 rounded_data_size;
214 /* always round fifo data size to the next highest power-of-two */
215 rounded_data_size = (1 << (max_log2 (data_size_in_bytes)));
216 f = clib_mem_alloc_aligned_or_null (sizeof (*f) + rounded_data_size,
217 CLIB_CACHE_LINE_BYTES);
221 clib_memset (f, 0, sizeof (*f));
222 f->size = rounded_data_size;
224 * usable size of the fifo set to rounded_data_size - 1
225 * to differentiate between free fifo and empty fifo.
227 f->nitems = f->size - 1;
228 f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
229 f->ct_session_index = SVM_FIFO_INVALID_SESSION_INDEX;
230 f->segment_index = SVM_FIFO_INVALID_INDEX;
236 svm_fifo_free (svm_fifo_t * f)
238 ASSERT (f->refcnt > 0);
240 if (--f->refcnt == 0)
242 pool_free (f->ooo_segments);
248 always_inline ooo_segment_t *
249 ooo_segment_new (svm_fifo_t * f, u32 start, u32 length)
253 pool_get (f->ooo_segments, s);
258 s->prev = s->next = OOO_SEGMENT_INVALID_INDEX;
264 ooo_segment_del (svm_fifo_t * f, u32 index)
266 ooo_segment_t *cur, *prev = 0, *next = 0;
267 cur = pool_elt_at_index (f->ooo_segments, index);
269 if (cur->next != OOO_SEGMENT_INVALID_INDEX)
271 next = pool_elt_at_index (f->ooo_segments, cur->next);
272 next->prev = cur->prev;
275 if (cur->prev != OOO_SEGMENT_INVALID_INDEX)
277 prev = pool_elt_at_index (f->ooo_segments, cur->prev);
278 prev->next = cur->next;
282 f->ooos_list_head = cur->next;
285 pool_put (f->ooo_segments, cur);
289 * Add segment to fifo's out-of-order segment list. Takes care of merging
290 * adjacent segments and removing overlapping ones.
293 ooo_segment_add (svm_fifo_t * f, u32 offset, u32 head, u32 tail, u32 length)
295 ooo_segment_t *s, *new_s, *prev, *next, *it;
296 u32 new_index, s_end_pos, s_index;
297 u32 offset_pos, offset_end_pos;
299 ASSERT (offset + length <= ooo_segment_distance_from_tail (f, head, tail));
300 offset_pos = tail + offset;
301 offset_end_pos = tail + offset + length;
303 f->ooos_newest = OOO_SEGMENT_INVALID_INDEX;
305 if (f->ooos_list_head == OOO_SEGMENT_INVALID_INDEX)
307 s = ooo_segment_new (f, offset_pos, length);
308 f->ooos_list_head = s - f->ooo_segments;
309 f->ooos_newest = f->ooos_list_head;
313 /* Find first segment that starts after new segment */
314 s = pool_elt_at_index (f->ooo_segments, f->ooos_list_head);
315 while (s->next != OOO_SEGMENT_INVALID_INDEX
316 && position_lt (f, s->start, offset_pos, tail))
317 s = pool_elt_at_index (f->ooo_segments, s->next);
319 /* If we have a previous and we overlap it, use it as starting point */
320 prev = ooo_segment_get_prev (f, s);
322 && position_leq (f, offset_pos, ooo_segment_end_pos (f, prev), tail))
325 s_end_pos = ooo_segment_end_pos (f, s);
327 /* Since we have previous, offset start position cannot be smaller
328 * than prev->start. Check tail */
329 ASSERT (position_lt (f, s->start, offset_pos, tail));
333 s_index = s - f->ooo_segments;
334 s_end_pos = ooo_segment_end_pos (f, s);
336 /* No overlap, add before current segment */
337 if (position_lt (f, offset_end_pos, s->start, tail))
339 new_s = ooo_segment_new (f, offset_pos, length);
340 new_index = new_s - f->ooo_segments;
342 /* Pool might've moved, get segment again */
343 s = pool_elt_at_index (f->ooo_segments, s_index);
344 if (s->prev != OOO_SEGMENT_INVALID_INDEX)
346 new_s->prev = s->prev;
347 prev = pool_elt_at_index (f->ooo_segments, new_s->prev);
348 prev->next = new_index;
353 f->ooos_list_head = new_index;
356 new_s->next = s_index;
358 f->ooos_newest = new_index;
361 /* No overlap, add after current segment */
362 else if (position_gt (f, offset_pos, s_end_pos, tail))
364 new_s = ooo_segment_new (f, offset_pos, length);
365 new_index = new_s - f->ooo_segments;
367 /* Pool might've moved, get segment again */
368 s = pool_elt_at_index (f->ooo_segments, s_index);
370 /* Needs to be last */
371 ASSERT (s->next == OOO_SEGMENT_INVALID_INDEX);
373 new_s->prev = s_index;
375 f->ooos_newest = new_index;
385 if (position_lt (f, offset_pos, s->start, tail))
387 s->start = offset_pos;
388 s->length = position_diff (f, s_end_pos, s->start, tail);
389 f->ooos_newest = s - f->ooo_segments;
394 /* Overlapping tail */
395 if (position_gt (f, offset_end_pos, s_end_pos, tail))
397 s->length = position_diff (f, offset_end_pos, s->start, tail);
399 /* Remove the completely overlapped segments in the tail */
400 it = ooo_segment_next (f, s);
401 while (it && position_leq (f, ooo_segment_end_pos (f, it),
402 offset_end_pos, tail))
404 next = ooo_segment_next (f, it);
405 ooo_segment_del (f, it - f->ooo_segments);
409 /* If partial overlap with last, merge */
410 if (it && position_leq (f, it->start, offset_end_pos, tail))
412 s->length = position_diff (f, ooo_segment_end_pos (f, it),
414 ooo_segment_del (f, it - f->ooo_segments);
416 f->ooos_newest = s - f->ooo_segments;
421 * Removes segments that can now be enqueued because the fifo's tail has
422 * advanced. Returns the number of bytes added to tail.
425 ooo_segment_try_collect (svm_fifo_t * f, u32 n_bytes_enqueued, u32 * tail)
428 u32 index, bytes = 0;
431 s = pool_elt_at_index (f->ooo_segments, f->ooos_list_head);
432 diff = ooo_segment_distance_to_tail (f, s->start, *tail);
434 ASSERT (diff != n_bytes_enqueued);
436 if (diff > n_bytes_enqueued)
439 /* If last tail update overlaps one/multiple ooo segments, remove them */
440 while (0 <= diff && diff < n_bytes_enqueued)
442 index = s - f->ooo_segments;
444 /* Segment end is beyond the tail. Advance tail and remove segment */
445 if (s->length > diff)
447 bytes = s->length - diff;
448 *tail = *tail + bytes;
449 ooo_segment_del (f, index);
453 /* If we have next go on */
454 if (s->next != OOO_SEGMENT_INVALID_INDEX)
456 s = pool_elt_at_index (f->ooo_segments, s->next);
457 diff = ooo_segment_distance_to_tail (f, s->start, *tail);
458 ooo_segment_del (f, index);
463 ooo_segment_del (f, index);
468 ASSERT (bytes <= f->nitems);
472 CLIB_MARCH_FN (svm_fifo_enqueue_nowait, int, svm_fifo_t * f, u32 max_bytes,
473 const u8 * copy_from_here)
475 u32 total_copy_bytes, first_copy_bytes, second_copy_bytes;
476 u32 tail, head, free_count, tail_idx;
478 f_load_head_tail_prod (f, &head, &tail);
480 /* free space in fifo can only increase during enqueue: SPSC */
481 free_count = f_free_count (f, head, tail);
483 f->ooos_newest = OOO_SEGMENT_INVALID_INDEX;
485 if (PREDICT_FALSE (free_count == 0))
486 return SVM_FIFO_FULL;
488 /* number of bytes we're going to copy */
489 total_copy_bytes = free_count < max_bytes ? free_count : max_bytes;
491 tail_idx = tail % f->size;
493 if (PREDICT_TRUE (copy_from_here != 0))
495 first_copy_bytes = f->size - tail_idx;
496 if (first_copy_bytes < total_copy_bytes)
498 clib_memcpy_fast (&f->data[tail_idx], copy_from_here,
500 /* number of bytes in second copy segment */
501 second_copy_bytes = total_copy_bytes - first_copy_bytes;
503 clib_memcpy_fast (&f->data[0],
504 copy_from_here + first_copy_bytes,
509 clib_memcpy_fast (&f->data[tail_idx], copy_from_here,
512 tail += total_copy_bytes;
517 /* Account for a zero-copy enqueue done elsewhere */
521 svm_fifo_trace_add (f, head, total_copy_bytes, 2);
523 /* collect out-of-order segments */
524 if (PREDICT_FALSE (f->ooos_list_head != OOO_SEGMENT_INVALID_INDEX))
525 total_copy_bytes += ooo_segment_try_collect (f, total_copy_bytes, &tail);
527 ASSERT (total_copy_bytes <= free_count);
529 /* store-rel: producer owned index (paired with load-acq in consumer) */
530 clib_atomic_store_rel_n (&f->tail, tail);
532 return total_copy_bytes;
535 #ifndef CLIB_MARCH_VARIANT
537 svm_fifo_enqueue_nowait (svm_fifo_t * f, u32 max_bytes,
538 const u8 * copy_from_here)
540 return CLIB_MARCH_FN_SELECT (svm_fifo_enqueue_nowait) (f, max_bytes,
546 * Enqueue a future segment.
548 * Two choices: either copies the entire segment, or copies nothing
549 * Returns 0 of the entire segment was copied
550 * Returns -1 if none of the segment was copied due to lack of space
552 CLIB_MARCH_FN (svm_fifo_enqueue_with_offset, int, svm_fifo_t * f,
553 u32 offset, u32 required_bytes, u8 * copy_from_here)
555 u32 total_copy_bytes, first_copy_bytes, second_copy_bytes;
557 u32 tail, head, free_count, tail_offset_idx;
559 f_load_head_tail_prod (f, &head, &tail);
561 /* free space in fifo can only increase during enqueue: SPSC */
562 free_count = f_free_count (f, head, tail);
564 /* will this request fit? */
565 if ((required_bytes + offset) > free_count)
568 f->ooos_newest = OOO_SEGMENT_INVALID_INDEX;
570 ASSERT (required_bytes < f->nitems);
572 tail_offset = tail + offset;
573 tail_offset_idx = tail_offset % f->size;
575 svm_fifo_trace_add (f, offset, required_bytes, 1);
577 ooo_segment_add (f, offset, head, tail, required_bytes);
579 /* number of bytes we're going to copy */
580 total_copy_bytes = required_bytes;
582 /* number of bytes in first copy segment */
583 first_copy_bytes = f->size - tail_offset_idx;
585 if (first_copy_bytes < total_copy_bytes)
587 clib_memcpy_fast (&f->data[tail_offset_idx], copy_from_here,
590 /* number of bytes in second copy segment */
591 second_copy_bytes = total_copy_bytes - first_copy_bytes;
593 clib_memcpy_fast (&f->data[0],
594 copy_from_here + first_copy_bytes, second_copy_bytes);
598 clib_memcpy_fast (&f->data[tail_offset_idx], copy_from_here,
605 #ifndef CLIB_MARCH_VARIANT
608 svm_fifo_enqueue_with_offset (svm_fifo_t * f, u32 offset, u32 required_bytes,
611 return CLIB_MARCH_FN_SELECT (svm_fifo_enqueue_with_offset) (f, offset,
617 svm_fifo_overwrite_head (svm_fifo_t * f, u8 * data, u32 len)
620 u32 head, tail, head_idx;
622 f_load_head_tail_cons (f, &head, &tail);
623 head_idx = head % f->size;
624 first_chunk = f->size - (head_idx);
625 ASSERT (len <= f->nitems);
626 if (len <= first_chunk)
627 clib_memcpy_fast (&f->data[head_idx], data, len);
630 clib_memcpy_fast (&f->data[head_idx], data, first_chunk);
631 clib_memcpy_fast (&f->data[0], data + first_chunk, len - first_chunk);
636 CLIB_MARCH_FN (svm_fifo_dequeue_nowait, int, svm_fifo_t * f, u32 max_bytes,
639 u32 total_copy_bytes, first_copy_bytes, second_copy_bytes;
640 u32 tail, head, cursize, head_idx;
642 f_load_head_tail_cons (f, &head, &tail);
644 /* current size of fifo can only increase during dequeue: SPSC */
645 cursize = f_cursize (f, head, tail);
647 if (PREDICT_FALSE (cursize == 0))
648 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 head_idx = head % f->size;
655 if (PREDICT_TRUE (copy_here != 0))
657 /* number of bytes in first copy segment */
658 first_copy_bytes = f->size - head_idx;
659 if (first_copy_bytes < total_copy_bytes)
661 clib_memcpy_fast (copy_here, &f->data[head_idx], first_copy_bytes);
662 /* number of bytes in second copy segment */
663 second_copy_bytes = total_copy_bytes - first_copy_bytes;
665 clib_memcpy_fast (copy_here + first_copy_bytes,
666 &f->data[0], second_copy_bytes);
670 clib_memcpy_fast (copy_here, &f->data[head_idx], total_copy_bytes);
672 head += total_copy_bytes;
677 /* Account for a zero-copy dequeue done elsewhere */
681 ASSERT (cursize >= total_copy_bytes);
682 /* store-rel: consumer owned index (paired with load-acq in producer) */
683 clib_atomic_store_rel_n (&f->head, head);
685 return total_copy_bytes;
688 #ifndef CLIB_MARCH_VARIANT
691 svm_fifo_dequeue_nowait (svm_fifo_t * f, u32 max_bytes, u8 * copy_here)
693 return CLIB_MARCH_FN_SELECT (svm_fifo_dequeue_nowait) (f, max_bytes,
698 CLIB_MARCH_FN (svm_fifo_peek, int, svm_fifo_t * f, u32 relative_offset,
699 u32 max_bytes, u8 * copy_here)
701 u32 total_copy_bytes, first_copy_bytes, second_copy_bytes;
702 u32 tail, head, cursize;
703 u32 relative_head_idx;
705 f_load_head_tail_cons (f, &head, &tail);
707 /* current size of fifo can only increase during peek: SPSC */
708 cursize = f_cursize (f, head, tail);
710 if (PREDICT_FALSE (cursize < relative_offset))
711 return -2; /* nothing in the fifo */
713 relative_head_idx = (head + relative_offset) % f->size;
715 /* number of bytes we're going to copy */
716 total_copy_bytes = ((cursize - relative_offset) < max_bytes) ?
717 cursize - relative_offset : max_bytes;
719 if (PREDICT_TRUE (copy_here != 0))
721 /* number of bytes in first copy segment */
722 first_copy_bytes = f->size - relative_head_idx;
723 if (first_copy_bytes < total_copy_bytes)
725 clib_memcpy_fast (copy_here, &f->data[relative_head_idx],
728 /* number of bytes in second copy segment */
729 second_copy_bytes = total_copy_bytes - first_copy_bytes;
730 clib_memcpy_fast (copy_here + first_copy_bytes, &f->data[0],
735 clib_memcpy_fast (copy_here, &f->data[relative_head_idx],
739 return total_copy_bytes;
742 #ifndef CLIB_MARCH_VARIANT
745 svm_fifo_peek (svm_fifo_t * f, u32 relative_offset, u32 max_bytes,
748 return CLIB_MARCH_FN_SELECT (svm_fifo_peek) (f, relative_offset, max_bytes,
753 svm_fifo_dequeue_drop (svm_fifo_t * f, u32 max_bytes)
755 u32 total_drop_bytes;
756 u32 tail, head, cursize;
758 f_load_head_tail_cons (f, &head, &tail);
760 /* number of bytes we're going to drop */
761 cursize = f_cursize (f, head, tail);
763 if (PREDICT_FALSE (cursize == 0))
764 return -2; /* nothing in the fifo */
766 svm_fifo_trace_add (f, tail, total_drop_bytes, 3);
768 /* number of bytes we're going to drop */
769 total_drop_bytes = (cursize < max_bytes) ? cursize : max_bytes;
772 head += total_drop_bytes;
774 ASSERT (cursize >= total_drop_bytes);
775 /* store-rel: consumer owned index (paired with load-acq in producer) */
776 clib_atomic_store_rel_n (&f->head, head);
778 return total_drop_bytes;
782 svm_fifo_dequeue_drop_all (svm_fifo_t * f)
784 /* consumer foreign index */
785 u32 tail = clib_atomic_load_acq_n (&f->tail);
786 /* store-rel: consumer owned index (paired with load-acq in producer) */
787 clib_atomic_store_rel_n (&f->head, tail);
791 svm_fifo_segments (svm_fifo_t * f, svm_fifo_segment_t * fs)
793 u32 cursize, head, tail, head_idx;
795 f_load_head_tail_cons (f, &head, &tail);
797 /* consumer function, cursize can only increase while we're working */
798 cursize = f_cursize (f, head, tail);
800 if (PREDICT_FALSE (cursize == 0))
801 return -2; /* nothing in the fifo */
803 head_idx = head % f->size;
807 fs[0].len = f->size - head_idx;
808 fs[0].data = f->data + head_idx;
809 fs[1].len = cursize - fs[0].len;
810 fs[1].data = f->data;
815 fs[0].data = f->data + head_idx;
823 svm_fifo_segments_free (svm_fifo_t * f, svm_fifo_segment_t * fs)
827 /* consumer owned index */
829 head_idx = head % f->size;
831 ASSERT (fs[0].data == f->data + head_idx);
832 head += fs[0].len + fs[1].len;
833 /* store-rel: consumer owned index (paired with load-acq in producer) */
834 clib_atomic_store_rel_n (&f->head, head);
837 /* Assumption: no prod and cons are accessing either dest or src fifo */
839 svm_fifo_clone (svm_fifo_t * df, svm_fifo_t * sf)
842 clib_memcpy_fast (df->data, sf->data, sf->size);
844 f_load_head_tail_all_acq (sf, &head, &tail);
845 clib_atomic_store_rel_n (&df->head, head);
846 clib_atomic_store_rel_n (&df->tail, tail);
850 svm_fifo_number_ooo_segments (svm_fifo_t * f)
852 return pool_elts (f->ooo_segments);
856 svm_fifo_first_ooo_segment (svm_fifo_t * f)
858 return pool_elt_at_index (f->ooo_segments, f->ooos_list_head);
862 * Set fifo pointers to requested offset
865 svm_fifo_init_pointers (svm_fifo_t * f, u32 pointer)
867 clib_atomic_store_rel_n (&f->head, pointer);
868 clib_atomic_store_rel_n (&f->tail, pointer);
872 svm_fifo_add_subscriber (svm_fifo_t * f, u8 subscriber)
874 if (f->n_subscribers >= SVM_FIFO_MAX_EVT_SUBSCRIBERS)
876 f->subscribers[f->n_subscribers++] = subscriber;
880 svm_fifo_del_subscriber (svm_fifo_t * f, u8 subscriber)
884 for (i = 0; i < f->n_subscribers; i++)
886 if (f->subscribers[i] != subscriber)
888 f->subscribers[i] = f->subscribers[f->n_subscribers - 1];
896 * fd.io coding-style-patch-verification: ON
899 * eval: (c-set-style "gnu")