summaryrefslogtreecommitdiffstats
path: root/vlib
diff options
context:
space:
mode:
Diffstat (limited to 'vlib')
-rw-r--r--vlib/vlib/buffer.c8
-rw-r--r--vlib/vlib/buffer_funcs.h7
-rw-r--r--vlib/vlib/dpdk_buffer.c9
-rw-r--r--vlib/vlib/error.c4
-rw-r--r--vlib/vlib/main.c4
-rw-r--r--vlib/vlib/mc.c6
-rw-r--r--vlib/vlib/node.c4
-rw-r--r--vlib/vlib/node_funcs.h2
-rw-r--r--vlib/vlib/threads.c12
-rw-r--r--vlib/vlib/trace.c6
-rw-r--r--vlib/vlib/unix/cli.c6
-rw-r--r--vlib/vlib/unix/mc_socket.c2
12 files changed, 34 insertions, 36 deletions
diff --git a/vlib/vlib/buffer.c b/vlib/vlib/buffer.c
index c28a0c54889..b7ae0a6fa34 100644
--- a/vlib/vlib/buffer.c
+++ b/vlib/vlib/buffer.c
@@ -1086,7 +1086,7 @@ vlib_packet_template_buffer_init (vlib_main_t * vm,
{
vlib_buffer_t * b = vlib_get_buffer (vm, buffers[i]);
ASSERT (b->current_length == vec_len (t->packet_data));
- memcpy (vlib_buffer_get_current (b), t->packet_data, b->current_length);
+ clib_memcpy (vlib_buffer_get_current (b), t->packet_data, b->current_length);
}
}
@@ -1143,7 +1143,7 @@ vlib_packet_template_get_packet (vlib_main_t * vm,
*bi_result = bi;
b = vlib_get_buffer (vm, bi);
- memcpy (vlib_buffer_get_current (b),
+ clib_memcpy (vlib_buffer_get_current (b),
t->packet_data, vec_len(t->packet_data));
b->current_length = vec_len(t->packet_data);
@@ -1198,7 +1198,7 @@ u32 vlib_buffer_add_data (vlib_main_t * vm,
ASSERT (n_buffer_bytes >= b->current_length);
n_left_this_buffer = n_buffer_bytes - (b->current_data + b->current_length);
n = clib_min (n_left_this_buffer, n_left);
- memcpy (vlib_buffer_get_current (b) + b->current_length, d, n);
+ clib_memcpy (vlib_buffer_get_current (b) + b->current_length, d, n);
b->current_length += n;
n_left -= n;
if (n_left == 0)
@@ -1240,7 +1240,7 @@ vlib_buffer_chain_append_data_with_alloc(vlib_main_t *vm,
}
u16 len = (data_len > max)?max:data_len;
- memcpy(vlib_buffer_get_current (l) + l->current_length, data + copied, len);
+ clib_memcpy(vlib_buffer_get_current (l) + l->current_length, data + copied, len);
vlib_buffer_chain_increase_length(first, l, len);
data_len -= len;
copied += len;
diff --git a/vlib/vlib/buffer_funcs.h b/vlib/vlib/buffer_funcs.h
index f7bdb12d680..1c3ffe2a6e8 100644
--- a/vlib/vlib/buffer_funcs.h
+++ b/vlib/vlib/buffer_funcs.h
@@ -46,7 +46,6 @@
#undef always_inline // dpdk and clib use conflicting always_inline macros.
#include <rte_config.h>
#include <rte_mbuf.h>
-#include <rte_memcpy.h>
#if CLIB_DEBUG > 0
#define always_inline static inline
@@ -151,7 +150,7 @@ vlib_buffer_contents (vlib_main_t * vm, u32 buffer_index, u8 * contents)
{
b = vlib_get_buffer (vm, buffer_index);
l = b->current_length;
- memcpy (contents + content_len, b->data + b->current_data, l);
+ clib_memcpy (contents + content_len, b->data + b->current_data, l);
content_len += l;
if (! (b->flags & VLIB_BUFFER_NEXT_PRESENT))
break;
@@ -493,9 +492,9 @@ vlib_buffer_chain_append_data(vlib_main_t *vm,
ASSERT(n_buffer_bytes >= last->current_length + last->current_data);
u16 len = clib_min(data_len, n_buffer_bytes - last->current_length - last->current_data);
#if DPDK == 1
- rte_memcpy(vlib_buffer_get_current (last) + last->current_length, data, len);
+ clib_memcpy(vlib_buffer_get_current (last) + last->current_length, data, len);
#else
- memcpy(vlib_buffer_get_current (last) + last->current_length, data, len);
+ clib_memcpy(vlib_buffer_get_current (last) + last->current_length, data, len);
#endif
vlib_buffer_chain_increase_length(first, last, len);
return len;
diff --git a/vlib/vlib/dpdk_buffer.c b/vlib/vlib/dpdk_buffer.c
index db1fde18c77..358d366f140 100644
--- a/vlib/vlib/dpdk_buffer.c
+++ b/vlib/vlib/dpdk_buffer.c
@@ -42,7 +42,6 @@
#include <rte_common.h>
#include <rte_log.h>
#include <rte_memory.h>
-#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_tailq.h>
#include <rte_eal.h>
@@ -771,7 +770,7 @@ vlib_packet_template_buffer_init (vlib_main_t * vm,
{
vlib_buffer_t * b = vlib_get_buffer (vm, buffers[i]);
ASSERT (b->current_length == vec_len (t->packet_data));
- memcpy (vlib_buffer_get_current (b), t->packet_data, b->current_length);
+ clib_memcpy (vlib_buffer_get_current (b), t->packet_data, b->current_length);
}
}
@@ -812,7 +811,7 @@ vlib_packet_template_get_packet (vlib_main_t * vm,
*bi_result = bi;
b = vlib_get_buffer (vm, bi);
- memcpy (vlib_buffer_get_current (b),
+ clib_memcpy (vlib_buffer_get_current (b),
t->packet_data, vec_len(t->packet_data));
b->current_length = vec_len(t->packet_data);
@@ -858,7 +857,7 @@ u32 vlib_buffer_add_data (vlib_main_t * vm,
ASSERT (n_buffer_bytes >= b->current_length);
n_left_this_buffer = n_buffer_bytes - (b->current_data + b->current_length);
n = clib_min (n_left_this_buffer, n_left);
- memcpy (vlib_buffer_get_current (b) + b->current_length, d, n);
+ clib_memcpy (vlib_buffer_get_current (b) + b->current_length, d, n);
b->current_length += n;
n_left -= n;
if (n_left == 0)
@@ -900,7 +899,7 @@ vlib_buffer_chain_append_data_with_alloc(vlib_main_t *vm,
}
u16 len = (data_len > max)?max:data_len;
- rte_memcpy(vlib_buffer_get_current (l) + l->current_length, data + copied, len);
+ clib_memcpy(vlib_buffer_get_current (l) + l->current_length, data + copied, len);
vlib_buffer_chain_increase_length(first, l, len);
data_len -= len;
copied += len;
diff --git a/vlib/vlib/error.c b/vlib/vlib/error.c
index 661530803b7..e7380364f48 100644
--- a/vlib/vlib/error.c
+++ b/vlib/vlib/error.c
@@ -169,7 +169,7 @@ void vlib_register_errors (vlib_main_t * vm,
l = vec_len (em->error_strings_heap);
- memcpy (vec_elt_at_index (em->error_strings_heap, n->error_heap_index),
+ clib_memcpy (vec_elt_at_index (em->error_strings_heap, n->error_heap_index),
error_strings,
n_errors * sizeof (error_strings[0]));
@@ -179,7 +179,7 @@ void vlib_register_errors (vlib_main_t * vm,
/* Zero counters for re-registrations of errors. */
if (n->error_heap_index + n_errors <= vec_len (em->counters_last_clear))
- memcpy (em->counters + n->error_heap_index,
+ clib_memcpy (em->counters + n->error_heap_index,
em->counters_last_clear + n->error_heap_index,
n_errors * sizeof (em->counters[0]));
else
diff --git a/vlib/vlib/main.c b/vlib/vlib/main.c
index 07cf7fb2e6b..18273bf6586 100644
--- a/vlib/vlib/main.c
+++ b/vlib/vlib/main.c
@@ -1463,10 +1463,10 @@ static void vlib_main_loop (vlib_main_t * vm)
void * data;
data = vlib_process_signal_event_helper (nm, n, p, te->event_type_index, te->n_data_elts, te->n_data_elt_bytes);
if (te->n_data_bytes < sizeof (te->inline_event_data))
- memcpy (data, te->inline_event_data, te->n_data_bytes);
+ clib_memcpy (data, te->inline_event_data, te->n_data_bytes);
else
{
- memcpy (data, te->event_data_as_vector, te->n_data_bytes);
+ clib_memcpy (data, te->event_data_as_vector, te->n_data_bytes);
vec_free (te->event_data_as_vector);
}
pool_put (nm->signal_timed_event_data_pool, te);
diff --git a/vlib/vlib/mc.c b/vlib/vlib/mc.c
index d311e8e0889..0942666713e 100644
--- a/vlib/vlib/mc.c
+++ b/vlib/vlib/mc.c
@@ -541,7 +541,7 @@ static void serialize_mc_register_stream_name (serialize_main_t * m, va_list * v
static void elog_stream_name (char * buf, int n_buf_bytes, char * v)
{
- memcpy (buf, v, clib_min (n_buf_bytes - 1, vec_len (v)));
+ clib_memcpy (buf, v, clib_min (n_buf_bytes - 1, vec_len (v)));
buf[n_buf_bytes - 1] = 0;
}
@@ -1307,7 +1307,7 @@ static void serialize_mc_stream (serialize_main_t * m, va_list * va)
serialize_integer (m, pool_elts (s->peers), sizeof (u32));
pool_foreach (p, s->peers, ({
u8 * x = serialize_get (m, sizeof (p->id));
- memcpy (x, p->id.as_u8, sizeof (p->id));
+ clib_memcpy (x, p->id.as_u8, sizeof (p->id));
serialize_integer (m, p->last_sequence_received,
sizeof (p->last_sequence_received));
}));
@@ -1327,7 +1327,7 @@ void unserialize_mc_stream (serialize_main_t * m, va_list * va)
u8 * x;
pool_get (s->peers, p);
x = unserialize_get (m, sizeof (p->id));
- memcpy (p->id.as_u8, x, sizeof (p->id));
+ clib_memcpy (p->id.as_u8, x, sizeof (p->id));
unserialize_integer (m, &p->last_sequence_received, sizeof (p->last_sequence_received));
mhash_set (&s->peer_index_by_id, &p->id, p - s->peers, /* old_value */ 0);
}
diff --git a/vlib/vlib/node.c b/vlib/vlib/node.c
index 573b3a79567..1df786f0c89 100644
--- a/vlib/vlib/node.c
+++ b/vlib/vlib/node.c
@@ -339,7 +339,7 @@ static void register_node (vlib_main_t * vm,
{
vec_resize (n->runtime_data, r->runtime_data_bytes);
if (r->runtime_data)
- memcpy (n->runtime_data, r->runtime_data, r->runtime_data_bytes);
+ clib_memcpy (n->runtime_data, r->runtime_data, r->runtime_data_bytes);
}
vec_resize (n->next_node_names, r->n_next_nodes);
@@ -438,7 +438,7 @@ static void register_node (vlib_main_t * vm,
ASSERT (vec_len (n->runtime_data) <= sizeof (rt->runtime_data));
if (vec_len (n->runtime_data) > 0)
- memcpy (rt->runtime_data, n->runtime_data, vec_len (n->runtime_data));
+ clib_memcpy (rt->runtime_data, n->runtime_data, vec_len (n->runtime_data));
vec_free (n->runtime_data);
}
diff --git a/vlib/vlib/node_funcs.h b/vlib/vlib/node_funcs.h
index 80dc3c602a1..18342e2661d 100644
--- a/vlib/vlib/node_funcs.h
+++ b/vlib/vlib/node_funcs.h
@@ -93,7 +93,7 @@ vlib_node_set_runtime_data (vlib_main_t * vm, u32 node_index,
ASSERT (vec_len (n->runtime_data) <= sizeof (r->runtime_data));
if (vec_len (n->runtime_data) > 0)
- memcpy (r->runtime_data, n->runtime_data, vec_len (n->runtime_data));
+ clib_memcpy (r->runtime_data, n->runtime_data, vec_len (n->runtime_data));
}
always_inline void
diff --git a/vlib/vlib/threads.c b/vlib/vlib/threads.c
index efbef379ba9..a2ab0d84750 100644
--- a/vlib/vlib/threads.c
+++ b/vlib/vlib/threads.c
@@ -639,7 +639,7 @@ static clib_error_t * start_workers (vlib_main_t * vm)
oldheap = clib_mem_set_heap (w->thread_mheap);
vm_clone = clib_mem_alloc (sizeof (*vm_clone));
- memcpy (vm_clone, vlib_mains[0], sizeof (*vm_clone));
+ clib_memcpy (vm_clone, vlib_mains[0], sizeof (*vm_clone));
vm_clone->cpu_index = worker_thread_index;
vm_clone->heap_base = w->thread_mheap;
@@ -674,7 +674,7 @@ static clib_error_t * start_workers (vlib_main_t * vm)
{
vlib_node_t *n;
n = clib_mem_alloc_no_fail (sizeof(*n));
- memcpy (n, nm->nodes[j], sizeof (*n));
+ clib_memcpy (n, nm->nodes[j], sizeof (*n));
/* none of the copied nodes have enqueue rights given out */
n->owner_node_index = VLIB_INVALID_NODE_INDEX;
memset (&n->stats_total, 0, sizeof (n->stats_total));
@@ -854,7 +854,7 @@ void vlib_worker_thread_node_runtime_update(void)
/* Re-clone error heap */
u64 * old_counters = vm_clone->error_main.counters;
u64 * old_counters_all_clear = vm_clone->error_main.counters_last_clear;
- memcpy (&vm_clone->error_main, &vm->error_main, sizeof (vm->error_main));
+ clib_memcpy (&vm_clone->error_main, &vm->error_main, sizeof (vm->error_main));
j = vec_len(vm->error_main.counters) - 1;
vec_validate_aligned(old_counters, j, CLIB_CACHE_LINE_BYTES);
vec_validate_aligned(old_counters_all_clear, j, CLIB_CACHE_LINE_BYTES);
@@ -890,7 +890,7 @@ void vlib_worker_thread_node_runtime_update(void)
old_n_clone = old_nodes_clone[j];
new_n_clone = clib_mem_alloc_no_fail (sizeof(*new_n_clone));
- memcpy (new_n_clone, new_n, sizeof (*new_n));
+ clib_memcpy (new_n_clone, new_n, sizeof (*new_n));
/* none of the copied nodes have enqueue rights given out */
new_n_clone->owner_node_index = VLIB_INVALID_NODE_INDEX;
@@ -905,10 +905,10 @@ void vlib_worker_thread_node_runtime_update(void)
else
{
/* Copy stats if the old data is valid */
- memcpy (&new_n_clone->stats_total,
+ clib_memcpy (&new_n_clone->stats_total,
&old_n_clone->stats_total,
sizeof (new_n_clone->stats_total));
- memcpy (&new_n_clone->stats_last_clear,
+ clib_memcpy (&new_n_clone->stats_last_clear,
&old_n_clone->stats_last_clear,
sizeof (new_n_clone->stats_last_clear));
diff --git a/vlib/vlib/trace.c b/vlib/vlib/trace.c
index 4a611ee97b1..d430460be32 100644
--- a/vlib/vlib/trace.c
+++ b/vlib/vlib/trace.c
@@ -73,13 +73,13 @@ vlib_trace_frame_buffers_only (vlib_main_t * vm,
if (b0->flags & VLIB_BUFFER_IS_TRACED)
{
t0 = vlib_add_trace (vm, node, b0, n_buffer_data_bytes_in_trace);
- memcpy (t0, b0->data + b0->current_data,
+ clib_memcpy (t0, b0->data + b0->current_data,
n_buffer_data_bytes_in_trace);
}
if (b1->flags & VLIB_BUFFER_IS_TRACED)
{
t1 = vlib_add_trace (vm, node, b1, n_buffer_data_bytes_in_trace);
- memcpy (t1, b1->data + b1->current_data,
+ clib_memcpy (t1, b1->data + b1->current_data,
n_buffer_data_bytes_in_trace);
}
from += 2;
@@ -99,7 +99,7 @@ vlib_trace_frame_buffers_only (vlib_main_t * vm,
if (b0->flags & VLIB_BUFFER_IS_TRACED)
{
t0 = vlib_add_trace (vm, node, b0, n_buffer_data_bytes_in_trace);
- memcpy (t0, b0->data + b0->current_data,
+ clib_memcpy (t0, b0->data + b0->current_data,
n_buffer_data_bytes_in_trace);
}
from += 1;
diff --git a/vlib/vlib/unix/cli.c b/vlib/vlib/unix/cli.c
index 2cdd47691cd..2e6e0593280 100644
--- a/vlib/vlib/unix/cli.c
+++ b/vlib/vlib/unix/cli.c
@@ -240,7 +240,7 @@ static int unix_cli_line_edit (unix_main_t * um, unix_cli_file_t * cf)
prev = cf->command_history [cf->excursion];
vec_validate (cf->current_command, vec_len(prev)-1);
- memcpy (cf->current_command, prev, vec_len(prev));
+ clib_memcpy (cf->current_command, prev, vec_len(prev));
_vec_len (cf->current_command) = vec_len(prev);
unix_cli_add_pending_output (uf, cf, cf->current_command,
vec_len (cf->current_command));
@@ -271,7 +271,7 @@ static int unix_cli_line_edit (unix_main_t * um, unix_cli_file_t * cf)
unix_cli_add_pending_output (uf, cf, (u8 *) "\b\b \b\b\r\n", 8);
vec_validate (cf->input_vector, vec_len(cf->current_command)-1);
- memcpy (cf->input_vector, cf->current_command,
+ clib_memcpy (cf->input_vector, cf->current_command,
vec_len(cf->current_command));
_vec_len(cf->input_vector) = _vec_len (cf->current_command);
@@ -342,7 +342,7 @@ static int unix_cli_line_edit (unix_main_t * um, unix_cli_file_t * cf)
vec_validate (cf->current_command, vec_len(item)-1);
- memcpy (cf->current_command, item, vec_len(item));
+ clib_memcpy (cf->current_command, item, vec_len(item));
_vec_len (cf->current_command) = vec_len(item);
unix_cli_add_pending_output (uf, cf, cf->current_command,
vec_len (cf->current_command));
diff --git a/vlib/vlib/unix/mc_socket.c b/vlib/vlib/unix/mc_socket.c
index 1169203f855..be68a13c1e2 100644
--- a/vlib/vlib/unix/mc_socket.c
+++ b/vlib/vlib/unix/mc_socket.c
@@ -893,7 +893,7 @@ find_interface_ip4_address (char * if_name, u32 * ip4_address, u32 * mtu)
}
sa = (void *) &ifr.ifr_addr;
- memcpy (ip4_address, &sa->sin_addr.s_addr, sizeof (ip4_address[0]));
+ clib_memcpy (ip4_address, &sa->sin_addr.s_addr, sizeof (ip4_address[0]));
if (ioctl (fd, SIOCGIFMTU, &ifr) < 0)
return -1;