summaryrefslogtreecommitdiffstats
path: root/src/svm
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
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')
-rw-r--r--src/svm/queue.c16
-rw-r--r--src/svm/svm_fifo.c33
2 files changed, 25 insertions, 24 deletions
diff --git a/src/svm/queue.c b/src/svm/queue.c
index 6972f14cd33..3577c783dba 100644
--- a/src/svm/queue.c
+++ b/src/svm/queue.c
@@ -201,7 +201,7 @@ svm_queue_add_nolock (svm_queue_t * q, u8 * elem)
}
tailp = (i8 *) (&q->data[0] + q->elsize * q->tail);
- clib_memcpy (tailp, elem, q->elsize);
+ clib_memcpy_fast (tailp, elem, q->elsize);
q->tail++;
q->cursize++;
@@ -222,7 +222,7 @@ svm_queue_add_raw (svm_queue_t * q, u8 * elem)
i8 *tailp;
tailp = (i8 *) (&q->data[0] + q->elsize * q->tail);
- clib_memcpy (tailp, elem, q->elsize);
+ clib_memcpy_fast (tailp, elem, q->elsize);
q->tail = (q->tail + 1) % q->maxsize;
q->cursize++;
@@ -264,7 +264,7 @@ svm_queue_add (svm_queue_t * q, u8 * elem, int nowait)
}
tailp = (i8 *) (&q->data[0] + q->elsize * q->tail);
- clib_memcpy (tailp, elem, q->elsize);
+ clib_memcpy_fast (tailp, elem, q->elsize);
q->tail++;
q->cursize++;
@@ -314,7 +314,7 @@ svm_queue_add2 (svm_queue_t * q, u8 * elem, u8 * elem2, int nowait)
}
tailp = (i8 *) (&q->data[0] + q->elsize * q->tail);
- clib_memcpy (tailp, elem, q->elsize);
+ clib_memcpy_fast (tailp, elem, q->elsize);
q->tail++;
q->cursize++;
@@ -325,7 +325,7 @@ svm_queue_add2 (svm_queue_t * q, u8 * elem, u8 * elem2, int nowait)
need_broadcast = (q->cursize == 1);
tailp = (i8 *) (&q->data[0] + q->elsize * q->tail);
- clib_memcpy (tailp, elem2, q->elsize);
+ clib_memcpy_fast (tailp, elem2, q->elsize);
q->tail++;
q->cursize++;
@@ -389,7 +389,7 @@ svm_queue_sub (svm_queue_t * q, u8 * elem, svm_q_conditional_wait_t cond,
}
headp = (i8 *) (&q->data[0] + q->elsize * q->head);
- clib_memcpy (elem, headp, q->elsize);
+ clib_memcpy_fast (elem, headp, q->elsize);
q->head++;
/* $$$$ JFC shouldn't this be == 0? */
@@ -423,7 +423,7 @@ svm_queue_sub2 (svm_queue_t * q, u8 * elem)
}
headp = (i8 *) (&q->data[0] + q->elsize * q->head);
- clib_memcpy (elem, headp, q->elsize);
+ clib_memcpy_fast (elem, headp, q->elsize);
q->head++;
need_broadcast = (q->cursize == q->maxsize / 2);
@@ -451,7 +451,7 @@ svm_queue_sub_raw (svm_queue_t * q, u8 * elem)
}
headp = (i8 *) (&q->data[0] + q->elsize * q->head);
- clib_memcpy (elem, headp, q->elsize);
+ clib_memcpy_fast (elem, headp, q->elsize);
q->head = (q->head + 1) % q->maxsize;
q->cursize--;
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;