aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm/svm_fifo.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-11-13 16:34:13 -0500
committerFlorin Coras <florin.coras@gmail.com>2018-11-14 15:54:01 +0000
commit178cf493d009995b28fdf220f04c98860ff79a9b (patch)
tree097c1be82b8f6fa9bc04b9b1e193158e2e4997eb /src/svm/svm_fifo.c
parent6917b94f2146aa51195a6a2a1ccd8416a1d74bf3 (diff)
Remove c-11 memcpy checks from perf-critical code
Change-Id: Id4f37f5d4a03160572954a416efa1ef9b3d79ad1 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/svm/svm_fifo.c')
-rw-r--r--src/svm/svm_fifo.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c
index 817cb8d2639..fb942a63d43 100644
--- a/src/svm/svm_fifo.c
+++ b/src/svm/svm_fifo.c
@@ -485,7 +485,7 @@ CLIB_MARCH_FN (svm_fifo_enqueue_nowait, int, svm_fifo_t * f, u32 max_bytes,
first_copy_bytes = ((nitems - f->tail) < total_copy_bytes)
? (nitems - f->tail) : total_copy_bytes;
- _clib_memcpy (&f->data[f->tail], copy_from_here, first_copy_bytes);
+ clib_memcpy_fast (&f->data[f->tail], copy_from_here, first_copy_bytes);
f->tail += first_copy_bytes;
f->tail = (f->tail == nitems) ? 0 : f->tail;
@@ -493,8 +493,9 @@ CLIB_MARCH_FN (svm_fifo_enqueue_nowait, int, svm_fifo_t * f, u32 max_bytes,
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- _clib_memcpy (&f->data[f->tail], copy_from_here + first_copy_bytes,
- second_copy_bytes);
+ clib_memcpy_fast (&f->data[f->tail],
+ copy_from_here + first_copy_bytes,
+ second_copy_bytes);
f->tail += second_copy_bytes;
f->tail = (f->tail == nitems) ? 0 : f->tail;
}
@@ -571,8 +572,8 @@ CLIB_MARCH_FN (svm_fifo_enqueue_with_offset, int, svm_fifo_t * f,
first_copy_bytes = ((nitems - normalized_offset) < total_copy_bytes)
? (nitems - normalized_offset) : total_copy_bytes;
- _clib_memcpy (&f->data[normalized_offset], copy_from_here,
- first_copy_bytes);
+ clib_memcpy_fast (&f->data[normalized_offset], copy_from_here,
+ first_copy_bytes);
/* Number of bytes in second copy segment, if any */
second_copy_bytes = total_copy_bytes - first_copy_bytes;
@@ -583,8 +584,8 @@ CLIB_MARCH_FN (svm_fifo_enqueue_with_offset, int, svm_fifo_t * f,
ASSERT (normalized_offset == 0);
- _clib_memcpy (&f->data[normalized_offset],
- copy_from_here + first_copy_bytes, second_copy_bytes);
+ clib_memcpy_fast (&f->data[normalized_offset],
+ copy_from_here + first_copy_bytes, second_copy_bytes);
}
return (0);
@@ -608,11 +609,11 @@ svm_fifo_overwrite_head (svm_fifo_t * f, u8 * data, u32 len)
first_chunk = f->nitems - f->head;
ASSERT (len <= f->nitems);
if (len <= first_chunk)
- _clib_memcpy (&f->data[f->head], data, len);
+ clib_memcpy_fast (&f->data[f->head], data, len);
else
{
- _clib_memcpy (&f->data[f->head], data, first_chunk);
- _clib_memcpy (&f->data[0], data + first_chunk, len - first_chunk);
+ clib_memcpy_fast (&f->data[f->head], data, first_chunk);
+ clib_memcpy_fast (&f->data[0], data + first_chunk, len - first_chunk);
}
}
#endif
@@ -638,7 +639,7 @@ CLIB_MARCH_FN (svm_fifo_dequeue_nowait, int, svm_fifo_t * f, u32 max_bytes,
/* Number of bytes in first copy segment */
first_copy_bytes = ((nitems - f->head) < total_copy_bytes)
? (nitems - f->head) : total_copy_bytes;
- _clib_memcpy (copy_here, &f->data[f->head], first_copy_bytes);
+ clib_memcpy_fast (copy_here, &f->data[f->head], first_copy_bytes);
f->head += first_copy_bytes;
f->head = (f->head == nitems) ? 0 : f->head;
@@ -646,8 +647,8 @@ CLIB_MARCH_FN (svm_fifo_dequeue_nowait, int, svm_fifo_t * f, u32 max_bytes,
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- _clib_memcpy (copy_here + first_copy_bytes,
- &f->data[f->head], second_copy_bytes);
+ clib_memcpy_fast (copy_here + first_copy_bytes,
+ &f->data[f->head], second_copy_bytes);
f->head += second_copy_bytes;
f->head = (f->head == nitems) ? 0 : f->head;
}
@@ -705,14 +706,14 @@ CLIB_MARCH_FN (svm_fifo_peek, int, svm_fifo_t * f, u32 relative_offset,
first_copy_bytes =
((nitems - real_head) < total_copy_bytes) ?
(nitems - real_head) : total_copy_bytes;
- _clib_memcpy (copy_here, &f->data[real_head], first_copy_bytes);
+ clib_memcpy_fast (copy_here, &f->data[real_head], first_copy_bytes);
/* Number of bytes in second copy segment, if any */
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- _clib_memcpy (copy_here + first_copy_bytes, &f->data[0],
- second_copy_bytes);
+ clib_memcpy_fast (copy_here + first_copy_bytes, &f->data[0],
+ second_copy_bytes);
}
}
return total_copy_bytes;