+CLIB_MARCH_FN (svm_fifo_copy_to_chunk, void, svm_fifo_t * f,
+ svm_fifo_chunk_t * c, u32 tail_idx, const u8 * src, u32 len,
+ u8 update_tail)
+{
+ u32 n_chunk;
+
+ ASSERT (tail_idx >= c->start_byte && tail_idx < c->start_byte + c->length);
+
+ tail_idx -= c->start_byte;
+ n_chunk = c->length - tail_idx;
+ if (n_chunk < len)
+ {
+ u32 to_copy = len;
+ clib_memcpy_fast (&c->data[tail_idx], src, n_chunk);
+ while ((to_copy -= n_chunk))
+ {
+ c = c->next;
+ n_chunk = clib_min (c->length, to_copy);
+ clib_memcpy_fast (&c->data[0], src + (len - to_copy), n_chunk);
+ }
+ if (update_tail)
+ f->tail_chunk = c;
+ }
+ else
+ {
+ clib_memcpy_fast (&c->data[tail_idx], src, len);
+ }
+}
+
+CLIB_MARCH_FN (svm_fifo_copy_from_chunk, void, svm_fifo_t * f,
+ svm_fifo_chunk_t * c, u32 head_idx, u8 * dst, u32 len,
+ u8 update_head)
+{
+ u32 n_chunk;
+
+ head_idx -= c->start_byte;
+ n_chunk = c->length - head_idx;
+ if (n_chunk < len)
+ {
+ u32 to_copy = len;
+ clib_memcpy_fast (dst, &c->data[head_idx], n_chunk);
+ while ((to_copy -= n_chunk))
+ {
+ c = c->next;
+ n_chunk = clib_min (c->length, to_copy);
+ clib_memcpy_fast (dst + (len - to_copy), &c->data[0], n_chunk);
+ }
+ if (update_head)
+ f->head_chunk = c;
+ }
+ else
+ {
+ clib_memcpy_fast (dst, &c->data[head_idx], len);
+ }
+}
+
+#ifndef CLIB_MARCH_VARIANT
+
+static inline void
+svm_fifo_copy_to_chunk (svm_fifo_t * f, svm_fifo_chunk_t * c, u32 tail_idx,
+ const u8 * src, u32 len, u8 update_tail)
+{
+ CLIB_MARCH_FN_SELECT (svm_fifo_copy_to_chunk) (f, c, tail_idx, src, len,
+ update_tail);
+}
+
+static inline void
+svm_fifo_copy_from_chunk (svm_fifo_t * f, svm_fifo_chunk_t * c, u32 head_idx,
+ u8 * dst, u32 len, u8 update_head)
+{
+ CLIB_MARCH_FN_SELECT (svm_fifo_copy_from_chunk) (f, c, head_idx, dst, len,
+ update_head);
+}
+