/* $$$$ use a simple hash if you can ... */
key_copy = clib_mem_alloc (sizeof (*key_copy));
- memcpy (key_copy, &key, sizeof (*key_copy));
+ clib_memcpy (key_copy, &key, sizeof (*key_copy));
hash_set_mem (ngm->" encap_stack "_tunnel_by_key, key_copy,
t - ngm->tunnels);
svmdb_value_t * oldvalue;
oldvalue = pool_elt_at_index (client->shm->values, hp->value[0]);
vec_alloc (oldvalue->value, vec_len(val)*elsize);
- memcpy (oldvalue->value, val, vec_len(val)*elsize);
+ clib_memcpy (oldvalue->value, val, vec_len(val)*elsize);
_vec_len (oldvalue->value) = vec_len(val);
notify_value (oldvalue, SVMDB_ACTION_SET);
} else {
memset (newvalue, 0, sizeof (*newvalue));
newvalue->elsize = elsize;
vec_alloc (newvalue->value, vec_len(val)*elsize);
- memcpy (newvalue->value, val, vec_len(val)*elsize);
+ clib_memcpy (newvalue->value, val, vec_len(val)*elsize);
_vec_len (newvalue->value) = vec_len(val);
name = format (0, "%s%c", var, 0);
hash_set_mem (h, name, newvalue - shm->values);
if (rv && vec_len(rv)) {
/* Make a copy in process-local memory */
vec_alloc (copy, vec_len(rv)*elsize);
- memcpy (copy, rv, vec_len(rv)*elsize);
+ clib_memcpy (copy, rv, vec_len(rv)*elsize);
_vec_len(copy) = vec_len(rv);
region_unlock (client->db_rp);
return (copy);
}
vec_validate(msg_copy, cfgp->size - 1);
- memcpy(msg_copy, msg, cfgp->size);
+ clib_memcpy(msg_copy, msg, cfgp->size);
*this_trace = msg_copy;
}
/* Copy the buffer (from the read-only mmap'ed file) */
vec_validate (tmpbuf, size-1 + sizeof(uword));
- memcpy (tmpbuf+sizeof(uword), msg, size);
+ clib_memcpy (tmpbuf+sizeof(uword), msg, size);
memset (tmpbuf, 0xf, sizeof(uword));
/*
}
if (saved_print_handlers) {
- memcpy (am->msg_print_handlers, saved_print_handlers,
+ clib_memcpy (am->msg_print_handlers, saved_print_handlers,
vec_len(am->msg_print_handlers) * sizeof (void *));
vec_free (saved_print_handlers);
}
}
headp = (i8 *) (q->data + sizeof(uword)*q->head);
- memcpy (&mp, headp, sizeof(uword));
+ clib_memcpy (&mp, headp, sizeof(uword));
q->head++;
need_broadcast = (q->cursize == q->maxsize/2);
mp = vl_msg_api_alloc_as_if_client (sizeof (*mp) + data_length);
memset (mp, 0, sizeof (*mp));
- memcpy (mp->data, data, data_length);
+ clib_memcpy (mp->data, data, data_length);
mp->_vl_msg_id = ntohs (VL_API_RPC_CALL);
mp->function = pointer_to_uword(fp);
mp->need_barrier_sync = 1;
}
tailp = (i8 *)(&q->data[0] + q->elsize*q->tail);
- memcpy(tailp, elem, q->elsize);
+ clib_memcpy(tailp, elem, q->elsize);
q->tail++;
q->cursize++;
}
tailp = (i8 *)(&q->data[0] + q->elsize*q->tail);
- memcpy(tailp, elem, q->elsize);
+ clib_memcpy(tailp, elem, q->elsize);
q->tail++;
q->cursize++;
}
tailp = (i8 *)(&q->data[0] + q->elsize*q->tail);
- memcpy(tailp, elem, q->elsize);
+ clib_memcpy(tailp, elem, q->elsize);
q->tail++;
q->cursize++;
}
headp = (i8 *)(&q->data[0] + q->elsize*q->head);
- memcpy(elem, headp, q->elsize);
+ clib_memcpy(elem, headp, q->elsize);
q->head++;
if (q->cursize == q->maxsize)
}
headp = (i8 *)(&q->data[0] + q->elsize*q->head);
- memcpy(elem, headp, q->elsize);
+ clib_memcpy(elem, headp, q->elsize);
q->head++;
q->cursize--;
if (msg_buffer == socket_main.input_buffer) {
ASSERT(vec_len(rp->unprocessed_input) == 0);
vec_validate (rp->unprocessed_input, vec_len (msg_buffer)-1);
- memcpy (rp->unprocessed_input, msg_buffer, vec_len(msg_buffer));
+ clib_memcpy (rp->unprocessed_input, msg_buffer, vec_len(msg_buffer));
_vec_len (rp->unprocessed_input) = vec_len (msg_buffer);
}
_vec_len(socket_main.input_buffer) = save_input_buffer_length;
{
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);
}
}
*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);
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)
}
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;
#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
{
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;
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;
#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>
{
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);
}
}
*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);
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)
}
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;
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]));
/* 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
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);
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;
}
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));
}));
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);
}
{
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);
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);
}
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
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;
{
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));
/* 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);
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;
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));
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;
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;
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));
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);
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));
}
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;
0xaa, 0xbb, 0xcc, 0xdd, /* Loator */
};
b->current_length = buff_len;
- memcpy(b->data, map_reply_records, sizeof(map_reply_records));
+ clib_memcpy(b->data, map_reply_records, sizeof(map_reply_records));
lisp_msg_parse_mapping_record (b, &eid, &locs, &probed);
_assert(vec_len (locs) == 1);
gid_address_ippref_len(gid_addr) = 64;
ip_prefix_version(&gid_addr->ippref) = IP6;
u8 ipv6[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
- memcpy(gid_addr->ippref.addr.ip.v6.as_u8, ipv6, sizeof(ipv6));
+ clib_memcpy(gid_addr->ippref.addr.ip.v6.as_u8, ipv6, sizeof(ipv6));
s = format(0, "%U", format_gid_address, gid_addr);
vec_add1(s, 0);
len = (b0->current_length < sizeof (t0->data))
? b0->current_length : sizeof (t0->data);
t0->len = len;
- memcpy (t0->data, vlib_buffer_get_current (b0), len);
+ clib_memcpy (t0->data, vlib_buffer_get_current (b0), len);
}
/* push this pkt to the next graph node, always error-drop */
vlib_set_next_frame_buffer (vm, node, next0, bi0);
t->t = htons(CDP_TLV_device_name);
t->l = htons(3 + sizeof (*t));
- memcpy (&t->v, "VPP", 3);
+ clib_memcpy (&t->v, "VPP", 3);
*t0p += ntohs(t->l);
}
t->t = htons(CDP_TLV_port_id);
t->l = htons(vec_len(hw->name) + sizeof (*t));
- memcpy (&t->v, hw->name, vec_len (hw->name));
+ clib_memcpy (&t->v, hw->name, vec_len (hw->name));
*t0p += ntohs(t->l);
}
t->t = htons(CDP_TLV_version);
t->l = htons(12 + sizeof (*t));
- memcpy (&t->v, "VPP Software", 12);
+ clib_memcpy (&t->v, "VPP Software", 12);
*t0p += ntohs(t->l);
}
t->t = htons(CDP_TLV_platform);
t->l = htons(2 + sizeof (*t));
- memcpy (&t->v, "SW", 2);
+ clib_memcpy (&t->v, "SW", 2);
*t0p += ntohs(t->l);
}
t->l = htons(4 + sizeof (*t));
capabilities = CDP_ROUTER_DEVICE;
capabilities = htonl (capabilities);
- memcpy (&t->v, &capabilities, sizeof (capabilities));
+ clib_memcpy (&t->v, &capabilities, sizeof (capabilities));
*t0p += ntohs(t->l);
}
/* Add the interface's ethernet source address */
hw = vnet_get_sup_hw_interface (vnm, n->sw_if_index);
- memcpy (h0->ethernet.src_address, hw->hw_address,
+ clib_memcpy (h0->ethernet.src_address, hw->hw_address,
vec_len (hw->hw_address));
t0 = (u8 *) &h0->cdp.data;
add_tlvs (cm, hw, &t0);
/* Add the interface's ethernet source address */
- memcpy (h0->ethernet.src_address, hw->hw_address,
+ clib_memcpy (h0->ethernet.src_address, hw->hw_address,
vec_len (hw->hw_address));
/* add the cdp packet checksum */
memset(t, 0, sizeof (*t));
vec_validate_aligned (t->mask, match_n_vectors - 1, sizeof(u32x4));
- memcpy (t->mask, mask, match_n_vectors * sizeof (u32x4));
+ clib_memcpy (t->mask, mask, match_n_vectors * sizeof (u32x4));
t->next_table_index = ~0;
t->nbuckets = nbuckets;
{
#define _(size) \
case size: \
- memcpy (working_copy, v, \
+ clib_memcpy (working_copy, v, \
sizeof (vnet_classify_entry_##size##_t) \
* (1<<b->log2_pages) \
* (t->entries_per_page)); \
if (vnet_classify_entry_is_free (new_v))
{
- memcpy (new_v, v, sizeof (vnet_classify_entry_t)
+ clib_memcpy (new_v, v, sizeof (vnet_classify_entry_t)
+ (t->match_n_vectors * sizeof (u32x4)));
new_v->flags &= ~(VNET_CLASSIFY_ENTRY_FREE);
goto doublebreak;
}
v = vnet_classify_entry_alloc (t, 0 /* new_log2_pages */);
- memcpy (v, add_v, sizeof (vnet_classify_entry_t) +
+ clib_memcpy (v, add_v, sizeof (vnet_classify_entry_t) +
t->match_n_vectors * sizeof (u32x4));
v->flags &= ~(VNET_CLASSIFY_ENTRY_FREE);
if (!memcmp (v->key, add_v->key, t->match_n_vectors * sizeof (u32x4)))
{
- memcpy (v, add_v, sizeof (vnet_classify_entry_t) +
+ clib_memcpy (v, add_v, sizeof (vnet_classify_entry_t) +
t->match_n_vectors * sizeof(u32x4));
v->flags &= ~(VNET_CLASSIFY_ENTRY_FREE);
if (vnet_classify_entry_is_free (v))
{
- memcpy (v, add_v, sizeof (vnet_classify_entry_t) +
+ clib_memcpy (v, add_v, sizeof (vnet_classify_entry_t) +
t->match_n_vectors * sizeof(u32x4));
v->flags &= ~(VNET_CLASSIFY_ENTRY_FREE);
CLIB_MEMORY_BARRIER();
if (vnet_classify_entry_is_free (new_v))
{
- memcpy (new_v, add_v, sizeof (vnet_classify_entry_t) +
+ clib_memcpy (new_v, add_v, sizeof (vnet_classify_entry_t) +
t->match_n_vectors * sizeof(u32x4));
new_v->flags &= ~(VNET_CLASSIFY_ENTRY_FREE);
goto expand_ok;
ip = (ip6_header_t *) match;
if (src)
- memcpy (&ip->src_address, &src_val, sizeof (ip->src_address));
+ clib_memcpy (&ip->src_address, &src_val, sizeof (ip->src_address));
if (dst)
- memcpy (&ip->dst_address, &dst_val, sizeof (ip->dst_address));
+ clib_memcpy (&ip->dst_address, &dst_val, sizeof (ip->dst_address));
if (proto)
ip->protocol = proto_val;
vec_validate_aligned (match, len-1, sizeof(u32x4));
if (dst)
- memcpy (match, dst_val, 6);
+ clib_memcpy (match, dst_val, 6);
if (src)
- memcpy (match + 6, src_val, 6);
+ clib_memcpy (match + 6, src_val, 6);
if (tag2)
{
e->flags = 0;
/* Copy key data, honoring skip_n_vectors */
- memcpy (&e->key, match + t->skip_n_vectors * sizeof (u32x4),
+ clib_memcpy (&e->key, match + t->skip_n_vectors * sizeof (u32x4),
t->match_n_vectors * sizeof (u32x4));
/* Clear don't-care bits; likely when dynamically creating sessions */
/* First element in heap points back to pool index. */
d = vec_elt_at_index (cm->config_string_heap, c->config_string_heap_index);
d[0] = c->index;
- memcpy (d + 1, config_string, vec_bytes (config_string));
+ clib_memcpy (d + 1, config_string, vec_bytes (config_string));
hash_set_mem (cm->config_string_hash, config_string, c->index);
c->reference_count = 0; /* will be incremented by caller. */
/*use configured or generate random MAC address */
if (hw_addr_set)
- memcpy(hw_addr, hw_addr_set, 6);
+ clib_memcpy(hw_addr, hw_addr_set, 6);
else
{
f64 now = vlib_time_now(vm);
rnd = (u32) (now * 1e6);
rnd = random_u32 (&rnd);
- memcpy (hw_addr+2, &rnd, sizeof(rnd));
+ clib_memcpy (hw_addr+2, &rnd, sizeof(rnd));
hw_addr[0] = 2;
hw_addr[1] = 0xfe;
}
{
b0 = vlib_get_buffer (vm, bi);
len = b0->current_length;
- memcpy((u8 *) tph + TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + offset,
+ clib_memcpy((u8 *) tph + TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + offset,
vlib_buffer_get_current(b0), len);
offset += len;
}
/* copy data */
u32 bytes_to_copy = data_len > n_buffer_bytes ? n_buffer_bytes : data_len;
b0->current_data = 0;
- memcpy (vlib_buffer_get_current (b0), (u8 *) tph + tph->tp_mac + offset, bytes_to_copy);
+ clib_memcpy (vlib_buffer_get_current (b0), (u8 *) tph + tph->tp_mac + offset, bytes_to_copy);
/* fill buffer header */
b0->clone_count = 0;
tr = vlib_add_trace (vm, node, first_b0, sizeof (*tr));
tr->next_index = next0;
tr->hw_if_index = apif->hw_if_index;
- memcpy(&tr->tph, tph, sizeof(struct tpacket2_hdr));
+ clib_memcpy(&tr->tph, tph, sizeof(struct tpacket2_hdr));
}
/* enque and take next packet */
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
rte_pktmbuf_data_len (new_mb) = pkt_mb->data_len;
copy_bytes = pkt_mb->data_len + RTE_PKTMBUF_HEADROOM;
ASSERT(copy_bytes <= pkt_mb->buf_len);
- memcpy(new_mb->buf_addr, pkt_mb->buf_addr, copy_bytes);
+ clib_memcpy(new_mb->buf_addr, pkt_mb->buf_addr, copy_bytes);
prev_mb_next = &new_mb->next;
pkt_mb = pkt_mb->next;
t0->queue_index = queue_id;
t0->device_index = xd->device_index;
t0->buffer_index = buffer_index;
- memcpy (&t0->mb, mb, sizeof (t0->mb));
- memcpy (&t0->buffer, buffer, sizeof (buffer[0]) - sizeof (buffer->pre_data));
- memcpy (t0->buffer.pre_data, buffer->data + buffer->current_data,
+ clib_memcpy (&t0->mb, mb, sizeof (t0->mb));
+ clib_memcpy (&t0->buffer, buffer, sizeof (buffer[0]) - sizeof (buffer->pre_data));
+ clib_memcpy (t0->buffer.pre_data, buffer->data + buffer->current_data,
sizeof (t0->buffer.pre_data));
}
*/
dpdk_update_counters (xd, vlib_time_now (dm->vlib_main));
- memcpy (&xd->last_cleared_stats, &xd->stats, sizeof(xd->stats));
- memcpy (xd->last_cleared_xstats, xd->xstats,
+ clib_memcpy (&xd->last_cleared_stats, &xd->stats, sizeof(xd->stats));
+ clib_memcpy (xd->last_cleared_xstats, xd->xstats,
vec_len(xd->last_cleared_xstats) *
sizeof(xd->last_cleared_xstats[0]));
}
dpdk_update_counters (xd, vlib_time_now (dm->vlib_main));
- memcpy(dest, &xd->stats, sizeof(xd->stats));
+ clib_memcpy(dest, &xd->stats, sizeof(xd->stats));
return (0);
}
#include <rte_dev.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>
if (xd->admin_up != 0xff)
{
xd->time_last_stats_update = now ? now : xd->time_last_stats_update;
- memcpy (&xd->last_stats, &xd->stats, sizeof (xd->last_stats));
+ clib_memcpy (&xd->last_stats, &xd->stats, sizeof (xd->last_stats));
rte_eth_stats_get (xd->device_index, &xd->stats);
/* maybe bump interface rx no buffer counter */
xd->cpu_socket = (i8) rte_eth_dev_socket_id(i);
rte_eth_dev_info_get(i, &dev_info);
- memcpy(&xd->tx_conf, &dev_info.default_txconf,
+ clib_memcpy(&xd->tx_conf, &dev_info.default_txconf,
sizeof(struct rte_eth_txconf));
if (dm->no_multi_seg)
{
port_conf_template.rxmode.jumbo_frame = 1;
}
- memcpy(&xd->port_conf, &port_conf_template, sizeof(struct rte_eth_conf));
+ clib_memcpy(&xd->port_conf, &port_conf_template, sizeof(struct rte_eth_conf));
xd->tx_q_used = clib_min(dev_info.max_tx_queues, tm->n_vlib_mains);
u32 rnd;
rnd = (u32) (now * 1e6);
rnd = random_u32 (&rnd);
- memcpy (addr+2, &rnd, sizeof(rnd));
+ clib_memcpy (addr+2, &rnd, sizeof(rnd));
addr[0] = 2;
addr[1] = 0xfe;
}
rnd = (u32) (now * 1e6);
rnd = random_u32 (&rnd);
- memcpy (addr+2, &rnd, sizeof(rnd));
+ clib_memcpy (addr+2, &rnd, sizeof(rnd));
addr[0] = 2;
addr[1] = 0xfe;
}
bhi = vnet_get_hw_interface(
vnm, dm->devices[i].vlib_hw_if_index);
bei = pool_elt_at_index(em->interfaces, bhi->hw_instance);
- memcpy(bhi->hw_address, addr, 6);
- memcpy(bei->address, addr, 6);
+ clib_memcpy(bhi->hw_address, addr, 6);
+ clib_memcpy(bei->address, addr, 6);
/* Init l3 packet size allowed on bonded interface */
bhi->max_l3_packet_bytes[VLIB_RX] =
bhi->max_l3_packet_bytes[VLIB_TX] =
t0->device_index = xd->device_index;
t0->buffer_index = bi0;
- memcpy (&t0->mb, mb, sizeof (t0->mb));
- memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data));
- memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data));
+ clib_memcpy (&t0->mb, mb, sizeof (t0->mb));
+ clib_memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data));
+ clib_memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data));
#ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS
/*
* Generate random MAC address for the interface
*/
if (hwaddr) {
- memcpy(addr, hwaddr, sizeof(addr));
+ clib_memcpy(addr, hwaddr, sizeof(addr));
} else {
f64 now = vlib_time_now(vm);
u32 rnd;
rnd = (u32) (now * 1e6);
rnd = random_u32 (&rnd);
- memcpy (addr+2, &rnd, sizeof(rnd));
+ clib_memcpy (addr+2, &rnd, sizeof(rnd));
addr[0] = 2;
addr[1] = 0xfe;
}
(cmsg->cmsg_type == SCM_RIGHTS) &&
(cmsg->cmsg_len - CMSG_LEN(0) <= VHOST_MEMORY_MAX_NREGIONS * sizeof(int))) {
number_of_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
- memcpy(fds, CMSG_DATA(cmsg), number_of_fds * sizeof(int));
+ clib_memcpy(fds, CMSG_DATA(cmsg), number_of_fds * sizeof(int));
}
/* version 1, no reply bit set*/
b0->total_length_not_including_first_buffer =
elt->total_length_not_including_first_buffer;
- memcpy (b0->data + b0->current_data, elt->data,
+ clib_memcpy (b0->data + b0->current_data, elt->data,
b0->current_length);
if (PREDICT_FALSE(prev != 0))
n_available = (u32)pointer_to_uword(sh->opaque[CHUNK_POOL_NFREE]);
elt_indices = (u32 *)(sh->opaque[CHUNK_POOL_FREELIST_INDEX]);
- memcpy (&elt_indices[n_available], intfc->rx_queue,
+ clib_memcpy (&elt_indices[n_available], intfc->rx_queue,
vec_len (intfc->rx_queue) * sizeof (u32));
n_available += vec_len (intfc->rx_queue);
if (PREDICT_TRUE(n_allocated > 0))
{
- memcpy (&em->chunk_cache[n_present_in_cache],
+ clib_memcpy (&em->chunk_cache[n_present_in_cache],
&elt_indices[n_available - n_allocated],
sizeof(u32) * n_allocated);
}
elt->owner = !i_am_master;
elt->tag = 1;
- memcpy (elt->data, b0->data + b0->current_data, b0->current_length);
+ clib_memcpy (elt->data, b0->data + b0->current_data, b0->current_length);
if (PREDICT_FALSE (prev_elt != 0))
prev_elt->next_index = elt - elts;
(cmsg->cmsg_type == SCM_RIGHTS) &&
(cmsg->cmsg_len - CMSG_LEN(0) <= VHOST_MEMORY_MAX_NREGIONS * sizeof(int))) {
number_of_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
- memcpy(fds, CMSG_DATA(cmsg), number_of_fds * sizeof(int));
+ clib_memcpy(fds, CMSG_DATA(cmsg), number_of_fds * sizeof(int));
}
/* version 1, no reply bit set*/
}
unmap_all_mem_regions(vui);
for(i=0; i < msg.memory.nregions; i++) {
- memcpy(&(vui->regions[i]), &msg.memory.regions[i],
+ clib_memcpy(&(vui->regions[i]), &msg.memory.regions[i],
sizeof(vhost_user_memory_region_t));
long page_sz = get_huge_page_size(fds[i]);
t0->virtqueue = virtqueue;
t0->device_index = vui - vum->vhost_user_interfaces;
#if VHOST_USER_COPY_TX_HDR == 1
- rte_memcpy(&t0->hdr, b0->pre_data, sizeof(virtio_net_hdr_t));
+ clib_memcpy(&t0->hdr, b0->pre_data, sizeof(virtio_net_hdr_t));
#endif
b+=1;
#if VHOST_USER_COPY_TX_HDR == 1
if (PREDICT_TRUE(offset))
- rte_memcpy(b->pre_data, buffer_addr, sizeof(virtio_net_hdr_t)); /* 12 byte hdr is not used on tx */
+ clib_memcpy(b->pre_data, buffer_addr, sizeof(virtio_net_hdr_t)); /* 12 byte hdr is not used on tx */
#endif
if (txvq->desc[desc_current].len > offset) {
}
u16 bytes_to_copy = bytes_left > (rxvq->desc[desc_current].len - offset) ? (rxvq->desc[desc_current].len - offset) : bytes_left;
- rte_memcpy(buffer_addr, vlib_buffer_get_current (current_b0) + current_b0->current_length - bytes_left, bytes_to_copy);
+ clib_memcpy(buffer_addr, vlib_buffer_get_current (current_b0) + current_b0->current_length - bytes_left, bytes_to_copy);
vhost_user_log_dirty_pages(vui, rxvq->desc[desc_current].addr + offset, bytes_to_copy);
bytes_left -= bytes_to_copy;
/* create hw and sw interface */
if (hwaddress) {
- memcpy(hwaddr, hwaddress, 6);
+ clib_memcpy(hwaddr, hwaddress, 6);
} else {
f64 now = vlib_time_now(vm);
u32 rnd;
rnd = (u32) (now * 1e6);
rnd = random_u32 (&rnd);
- memcpy (hwaddr+2, &rnd, sizeof(rnd));
+ clib_memcpy (hwaddr+2, &rnd, sizeof(rnd));
hwaddr[0] = 2;
hwaddr[1] = 0xfe;
}
/* Replace the existing hostname if necessary */
vec_free (c->hostname);
vec_validate (c->hostname, o->length - 1);
- memcpy (c->hostname, o->data, o->length);
+ clib_memcpy (c->hostname, o->data, o->length);
}
break;
{
f = vlib_get_frame_to_node (vm, hw->output_node_index);
vnet_buffer(b)->sw_if_index[VLIB_TX] = c->sw_if_index;
- memcpy (b->data, c->l2_rewrite, vec_len(c->l2_rewrite));
+ clib_memcpy (b->data, c->l2_rewrite, vec_len(c->l2_rewrite));
ip = (void *)
(((u8 *)vlib_buffer_get_current (b)) + vec_len (c->l2_rewrite));
}
udp->dst_port = clib_host_to_net_u16 (UDP_DST_PORT_dhcp_to_server);
/* Send the interface MAC address */
- memcpy (dhcp->client_hardware_address, c->l2_rewrite + 6, 6);
+ clib_memcpy (dhcp->client_hardware_address, c->l2_rewrite + 6, 6);
/* Lease renewal, set up client_ip_address */
if (is_broadcast == 0)
{
o->option = 54;
o->length = 4;
- memcpy (o->data, &c->dhcp_server.as_u32, 4);
+ clib_memcpy (o->data, &c->dhcp_server.as_u32, 4);
o = (dhcp_option_t *) (((uword) o) + (o->length + 2));
}
{
o->option = 50;
o->length = 4;
- memcpy (o->data, &c->leased_address.as_u32, 4);
+ clib_memcpy (o->data, &c->leased_address.as_u32, 4);
o = (dhcp_option_t *) (((uword) o) + (o->length + 2));
}
{
o->option = 12;
o->length = vec_len (c->hostname);
- memcpy (o->data, c->hostname, vec_len (c->hostname));
+ clib_memcpy (o->data, c->hostname, vec_len (c->hostname));
o = (dhcp_option_t *) (((uword) o) + (o->length + 2));
}
*/
o->option = 55;
o->length = vec_len (c->option_55_data);
- memcpy (o->data, c->option_55_data, vec_len(c->option_55_data));
+ clib_memcpy (o->data, c->option_55_data, vec_len(c->option_55_data));
o = (dhcp_option_t *) (((uword) o) + (o->length + 2));
/* End of list */
hi0 = vnet_get_sup_hw_interface (vnm, original_sw_if_index);
ei0 = pool_elt_at_index (em->interfaces, hi0->hw_instance);
- memcpy (mac0->src_address, ei0->address, sizeof (ei0->address));
+ clib_memcpy (mac0->src_address, ei0->address, sizeof (ei0->address));
memset (mac0->dst_address, 0xff, sizeof (mac0->dst_address));
mac0->type = (si0->type == VNET_SW_INTERFACE_TYPE_SUB) ?
clib_net_to_host_u16(0x8100) : clib_net_to_host_u16 (0x0800);
h0 = vlib_buffer_get_current (b0);
e_h0 = (ethernet_header_t *)b0->data;
- memcpy(client_src_mac, e_h0->src_address, 6);
+ clib_memcpy(client_src_mac, e_h0->src_address, 6);
/* Send to DHCPV6 server via the configured FIB */
vnet_buffer(b0)->sw_if_index[VLIB_TX] =
dpm->server_fib_index;
sizeof(cmac->opt));
cmac->opt.option = clib_host_to_net_u16(DHCPV6_OPTION_CLIENT_LINK_LAYER_ADDRESS);
cmac->link_type = clib_host_to_net_u16(1); // ethernet
- memcpy(cmac->data, client_src_mac, 6);
+ clib_memcpy(cmac->data, client_src_mac, 6);
u1->length += sizeof(*cmac);
}
if (oui1 || fib_id1) {
hi0 = vnet_get_sup_hw_interface (vnm, original_sw_if_index);
ei0 = pool_elt_at_index (em->interfaces, hi0->hw_instance);
- memcpy (mac0->src_address, ei0->address, sizeof (ei0->address));
+ clib_memcpy (mac0->src_address, ei0->address, sizeof (ei0->address));
memset (&mac0->dst_address, 0xff, sizeof (mac0->dst_address));
mac0->type = (si0->type == VNET_SW_INTERFACE_TYPE_SUB) ?
clib_net_to_host_u16(0x8100) : clib_net_to_host_u16 (0x86dd);
for (i = 0; i < new_buffers_needed; i++)
{
- memcpy (copy_src, copy_dst, src_buf->current_length);
+ clib_memcpy (copy_src, copy_dst, src_buf->current_length);
dst_buf->current_data = src_buf->current_data;
dst_buf->current_length = src_buf->current_length;
dst_buf->flags = src_buf->flags;
rv = vlib_buffer_from_rte_mbuf(rte_mbufs[0]);
vlib_buffer_init_for_free_list (rv, fl);
- memcpy(rv->data + b->current_data, b->data + b->current_data,
+ clib_memcpy(rv->data + b->current_data, b->data + b->current_data,
b->current_length);
rv->current_data = b->current_data;
rv->current_length = b->current_length;
ethernet_arp_ip4_over_ethernet_address_t delme;
e = pool_elt_at_index (am->ip4_entry_pool, to_delete[i]);
- memcpy (&delme.ethernet, e->ethernet_address, 6);
+ clib_memcpy (&delme.ethernet, e->ethernet_address, 6);
delme.ip4.as_u32 = e->key.ip4_address.as_u32;
vnet_arp_unset_ip4_over_ethernet (vnm, e->key.sw_if_index,
args.fib_index = fib_index;
args.is_static = is_static;
args.is_remove = 0;
- memcpy (&args.a, a, sizeof (*a));
+ clib_memcpy (&args.a, a, sizeof (*a));
vl_api_rpc_call_main_thread (set_ip4_over_ethernet_rpc_callback,
(u8 *) &args, sizeof (args));
}
/* Update time stamp and ethernet address. */
- memcpy (e->ethernet_address, a->ethernet, sizeof (e->ethernet_address));
+ clib_memcpy (e->ethernet_address, a->ethernet, sizeof (e->ethernet_address));
e->cpu_time_last_updated = clib_cpu_time_now ();
if (is_static)
e->flags |= ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC;
e = pool_elt_at_index (am->ip4_entry_pool, index);
- memcpy (&delme.ethernet, e->ethernet_address, 6);
+ clib_memcpy (&delme.ethernet, e->ethernet_address, 6);
delme.ip4.as_u32 = e->key.ip4_address.as_u32;
vnet_arp_unset_ip4_over_ethernet (vnm, e->key.sw_if_index,
ethernet_arp_header_t * arp0;
/* Save the dst mac address */
- memcpy(dst_mac_address, eth0->dst_address, sizeof (dst_mac_address));
+ clib_memcpy(dst_mac_address, eth0->dst_address, sizeof (dst_mac_address));
/* Figure out which sw_if_index supplied the address */
unnum_src_sw_if_index = ifa0->sw_if_index;
b0 = vlib_get_buffer (vm, buffers[i]);
/* xerox (partially built) ARP pkt */
- memcpy (b0->data, p0->data, p0->current_length + p0->current_data);
+ clib_memcpy (b0->data, p0->data, p0->current_length + p0->current_data);
b0->current_data = p0->current_data;
b0->current_length = p0->current_length;
vnet_buffer(b0)->sw_if_index[VLIB_RX] =
vnet_buffer(b0)->sw_if_index[VLIB_TX] = hi->sw_if_index;
/* Fix ARP pkt src address */
- memcpy (arp0->ip4_over_ethernet[0].ethernet, hi->hw_address, 6);
+ clib_memcpy (arp0->ip4_over_ethernet[0].ethernet, hi->hw_address, 6);
/* Build L2 encaps for this swif */
header_size = sizeof (ethernet_header_t);
}
/* Restore the original dst address, set src address */
- memcpy (eth0->dst_address, dst_mac_address, sizeof (eth0->dst_address));
- memcpy (eth0->src_address, hi->hw_address, sizeof (eth0->src_address));
+ clib_memcpy (eth0->dst_address, dst_mac_address, sizeof (eth0->dst_address));
+ clib_memcpy (eth0->src_address, hi->hw_address, sizeof (eth0->src_address));
/* Transmit replicas */
if (i > 0)
arp0->ip4_over_ethernet[1] = arp0->ip4_over_ethernet[0];
- memcpy (arp0->ip4_over_ethernet[0].ethernet, hw_if0->hw_address, 6);
+ clib_memcpy (arp0->ip4_over_ethernet[0].ethernet, hw_if0->hw_address, 6);
clib_mem_unaligned (&arp0->ip4_over_ethernet[0].ip4.data_u32, u32) = if_addr0->data_u32;
/* Hardware must be ethernet-like. */
ASSERT (vec_len (hw_if0->hw_address) == 6);
- memcpy (eth0->dst_address, eth0->src_address, 6);
- memcpy (eth0->src_address, hw_if0->hw_address, 6);
+ clib_memcpy (eth0->dst_address, eth0->src_address, 6);
+ clib_memcpy (eth0->src_address, hw_if0->hw_address, 6);
/* Figure out how much to rewind current data from adjacency. */
if (ifa0)
args.sw_if_index = sw_if_index;
args.fib_index = fib_index;
args.is_remove = 1;
- memcpy (&args.a, a, sizeof (*a));
+ clib_memcpy (&args.a, a, sizeof (*a));
vl_api_rpc_call_main_thread (set_ip4_over_ethernet_rpc_callback,
(u8 *) &args, sizeof (args));
e->flags = ETHERNET_ARP_IP4_ENTRY_FLAG_GLEAN;
memset(&args, 0, sizeof(args));
- memcpy(&add_adj, adj, sizeof(add_adj));
+ clib_memcpy(&add_adj, adj, sizeof(add_adj));
add_adj.arp.next_hop.ip4.as_u32 = next_hop->as_u32; /* install neighbor /32 route */
args.table_index_or_table_id = fib_index;
args.flags = IP4_ROUTE_FLAG_FIB_INDEX | IP4_ROUTE_FLAG_ADD| IP4_ROUTE_FLAG_NEIGHBOR;
{
u8 *t0 = vlib_add_trace (
vm, node, p0, sizeof(ethernet_arp_input_trace_t));
- memcpy (t0, l3h0, sizeof(ethernet_arp_input_trace_t));
+ clib_memcpy (t0, l3h0, sizeof(ethernet_arp_input_trace_t));
}
if (PREDICT_FALSE (
arp0->opcode = clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply);
arp0->ip4_over_ethernet[1] = arp0->ip4_over_ethernet[0];
arp0->ip4_over_ethernet[0].ip4.as_u32 = ip0;
- memcpy (arp0->ip4_over_ethernet[0].ethernet, macp0, 6);
- memcpy (eth0->dst_address, eth0->src_address, 6);
- memcpy (eth0->src_address, macp0, 6);
+ clib_memcpy (arp0->ip4_over_ethernet[0].ethernet, macp0, 6);
+ clib_memcpy (eth0->dst_address, eth0->src_address, 6);
+ clib_memcpy (eth0->src_address, macp0, 6);
n_replies_sent += 1;
// For BVI, need to use l2-fwd node to send ARP reply as
u32 n_bytes = sizeof (e[0]) + n_vlan * sizeof (m->vlan[0]);
vec_add2 (*result, p, n_bytes);
- memcpy (p, m, n_bytes);
+ clib_memcpy (p, m, n_bytes);
}
return 1;
}
ei = pool_elt_at_index (em->interfaces, hw->hw_instance);
- memcpy (h->src_address, ei->address, sizeof (h->src_address));
+ clib_memcpy (h->src_address, ei->address, sizeof (h->src_address));
if (dst_address)
- memcpy (h->dst_address, dst_address, sizeof (h->dst_address));
+ clib_memcpy (h->dst_address, dst_address, sizeof (h->dst_address));
else
memset (h->dst_address, ~0, sizeof (h->dst_address)); /* broadcast */
/* Standard default ethernet MTU. */
hi->max_l3_packet_bytes[VLIB_RX] = hi->max_l3_packet_bytes[VLIB_TX] = 9000;
- memcpy (ei->address, address, sizeof (ei->address));
+ clib_memcpy (ei->address, address, sizeof (ei->address));
vec_free (hi->hw_address);
vec_add (hi->hw_address, address, sizeof (ei->address));
n_copy = clib_min (n_left_from, n_left_to_next);
- memcpy (to_next, from, n_copy * sizeof (from[0]));
+ clib_memcpy (to_next, from, n_copy * sizeof (from[0]));
n_left_to_next -= n_copy;
n_left_from -= n_copy;
for (i = 0; i < n_copy; i++)
* address is programmed on the loopback interface.
*/
if (memcmp (address, mac_address, sizeof (address)))
- memcpy (address, mac_address, sizeof (address));
+ clib_memcpy (address, mac_address, sizeof (address));
else
{
address[0] = 0xde;
if (b0->flags & VLIB_BUFFER_IS_TRACED)
{
swap_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t));
- memcpy (t->src, h0->src_address, 6);
- memcpy (t->dst, h0->dst_address, 6);
+ clib_memcpy (t->src, h0->src_address, 6);
+ clib_memcpy (t->dst, h0->dst_address, 6);
t->sw_if_index = sw_if_index0;
t->next_index = next0;
}
if (b1->flags & VLIB_BUFFER_IS_TRACED)
{
swap_trace_t *t = vlib_add_trace (vm, node, b1, sizeof (*t));
- memcpy (t->src, h1->src_address, 6);
- memcpy (t->dst, h1->dst_address, 6);
+ clib_memcpy (t->src, h1->src_address, 6);
+ clib_memcpy (t->dst, h1->dst_address, 6);
t->sw_if_index = sw_if_index1;
t->next_index = next1;
}
if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
&& (b0->flags & VLIB_BUFFER_IS_TRACED))) {
swap_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t));
- memcpy (t->src, h0->src_address, 6);
- memcpy (t->dst, h0->dst_address, 6);
+ clib_memcpy (t->src, h0->src_address, 6);
+ clib_memcpy (t->dst, h0->dst_address, 6);
t->sw_if_index = sw_if_index0;
t->next_index = next0;
}
ASSERT (vec_len (fr->rewrite) < VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES);
- memcpy (b0->data, fr->rewrite, vec_len (fr->rewrite));
+ clib_memcpy (b0->data, fr->rewrite, vec_len (fr->rewrite));
b0->current_data = 0;
b0->current_length = vec_len (fr->rewrite);
b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
goto flush;
b0 = vlib_get_buffer (vm, bi0);
- memcpy (b0->data, fr->rewrite, vec_len (fr->rewrite));
+ clib_memcpy (b0->data, fr->rewrite, vec_len (fr->rewrite));
b0->current_data = 0;
b0->current_length = vec_len (fr->rewrite);
b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
#define _(field,mask,item,length) \
if (clib_bitmap_get (fr->fields_to_send, field_index)) \
{ \
- memcpy (b0->data + next_offset, &field, \
+ clib_memcpy (b0->data + next_offset, &field, \
length); \
next_offset += length; \
} \
/* Add packetTotalCount manually */
{
u64 packets = clib_host_to_net_u64 (v->hits);
- memcpy (b0->data + next_offset, &packets, sizeof (packets));
+ clib_memcpy (b0->data + next_offset, &packets, sizeof (packets));
next_offset += sizeof (packets);
}
records_this_buffer++;
u32 n_bytes = sizeof (h[0]);
vec_add2 (*result, p, n_bytes);
- memcpy (p, h, n_bytes);
+ clib_memcpy (p, h, n_bytes);
}
return 1;
/* Standard default gre MTU. */
hi->max_l3_packet_bytes[VLIB_RX] = hi->max_l3_packet_bytes[VLIB_TX] = 9000;
- memcpy (&t->tunnel_src, tunnel_src, sizeof (t->tunnel_src));
- memcpy (&t->tunnel_dst, tunnel_dst, sizeof (t->tunnel_dst));
+ clib_memcpy (&t->tunnel_src, tunnel_src, sizeof (t->tunnel_src));
+ clib_memcpy (&t->tunnel_dst, tunnel_dst, sizeof (t->tunnel_dst));
hash_set (gm->tunnel_by_key, key, t - gm->tunnels);
u32 n_bytes = sizeof (h[0]);
vec_add2 (*result, p, n_bytes);
- memcpy (p, h, n_bytes);
+ clib_memcpy (p, h, n_bytes);
}
return 1;
{
t0 = vlib_add_trace (vm, node, b0, sizeof (t0[0]));
t0->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_TX];
- memcpy (t0->data, vlib_buffer_get_current (b0),
+ clib_memcpy (t0->data, vlib_buffer_get_current (b0),
sizeof (t0->data));
}
if (b1->flags & VLIB_BUFFER_IS_TRACED)
{
t1 = vlib_add_trace (vm, node, b1, sizeof (t1[0]));
t1->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_TX];
- memcpy (t1->data, vlib_buffer_get_current (b1),
+ clib_memcpy (t1->data, vlib_buffer_get_current (b1),
sizeof (t1->data));
}
from += 2;
{
t0 = vlib_add_trace (vm, node, b0, sizeof (t0[0]));
t0->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_TX];
- memcpy (t0->data, vlib_buffer_get_current (b0),
+ clib_memcpy (t0->data, vlib_buffer_get_current (b0),
sizeof (t0->data));
}
from += 1;
* is not in the IP6 FIB */
vlib_buffer_reset (p0);
eth0 = vlib_buffer_get_current (p0);
- memcpy (tmp_mac, eth0->dst_address, 6);
- memcpy (eth0->dst_address, eth0->src_address, 6);
- memcpy (eth0->src_address, tmp_mac, 6);
+ clib_memcpy (tmp_mac, eth0->dst_address, 6);
+ clib_memcpy (eth0->dst_address, eth0->src_address, 6);
+ clib_memcpy (eth0->src_address, tmp_mac, 6);
vnet_buffer(p0)->sw_if_index[VLIB_TX] =
vnet_buffer (p0)->sw_if_index[VLIB_RX];
next0 = ICMP6_ECHO_REQUEST_NEXT_OUTPUT;
* is not in the IP6 FIB */
vlib_buffer_reset (p1);
eth1 = vlib_buffer_get_current (p1);
- memcpy (tmp_mac, eth1->dst_address, 6);
- memcpy (eth1->dst_address, eth1->src_address, 6);
- memcpy (eth1->src_address, tmp_mac, 6);
+ clib_memcpy (tmp_mac, eth1->dst_address, 6);
+ clib_memcpy (eth1->dst_address, eth1->src_address, 6);
+ clib_memcpy (eth1->src_address, tmp_mac, 6);
vnet_buffer(p1)->sw_if_index[VLIB_TX] =
vnet_buffer (p1)->sw_if_index[VLIB_RX];
next1 = ICMP6_ECHO_REQUEST_NEXT_OUTPUT;
* is not in the IP6 FIB */
vlib_buffer_reset (p0);
eth0 = vlib_buffer_get_current (p0);
- memcpy (tmp_mac, eth0->dst_address, 6);
- memcpy (eth0->dst_address, eth0->src_address, 6);
- memcpy (eth0->src_address, tmp_mac, 6);
+ clib_memcpy (tmp_mac, eth0->dst_address, 6);
+ clib_memcpy (eth0->dst_address, eth0->src_address, 6);
+ clib_memcpy (eth0->src_address, tmp_mac, 6);
vnet_buffer(p0)->sw_if_index[VLIB_TX] =
vnet_buffer (p0)->sw_if_index[VLIB_RX];
next0 = ICMP6_ECHO_REQUEST_NEXT_OUTPUT;
fib->new_hash_values);
p = hash_get (hash, dst_address_u32);
- memcpy (p, fib->new_hash_values, vec_bytes (fib->new_hash_values));
+ clib_memcpy (p, fib->new_hash_values, vec_bytes (fib->new_hash_values));
}
}
else
{
/* Remap to new adjacency. */
- memcpy (fib->old_hash_values, p->value, vec_bytes (fib->old_hash_values));
+ clib_memcpy (fib->old_hash_values, p->value, vec_bytes (fib->old_hash_values));
/* Set new adjacency value. */
fib->new_hash_values[0] = p->value[0] = m - 1;
t0->flow_hash = vnet_buffer (b0)->ip.flow_hash;
t0->fib_index = vec_elt (im->fib_index_by_sw_if_index,
vnet_buffer(b0)->sw_if_index[VLIB_RX]);
- memcpy (t0->packet_data,
+ clib_memcpy (t0->packet_data,
vlib_buffer_get_current (b0),
sizeof (t0->packet_data));
}
t1->flow_hash = vnet_buffer (b1)->ip.flow_hash;
t1->fib_index = vec_elt (im->fib_index_by_sw_if_index,
vnet_buffer(b1)->sw_if_index[VLIB_RX]);
- memcpy (t1->packet_data,
+ clib_memcpy (t1->packet_data,
vlib_buffer_get_current (b1),
sizeof (t1->packet_data));
}
t0->flow_hash = vnet_buffer (b0)->ip.flow_hash;
t0->fib_index = vec_elt (im->fib_index_by_sw_if_index,
vnet_buffer(b0)->sw_if_index[VLIB_RX]);
- memcpy (t0->packet_data,
+ clib_memcpy (t0->packet_data,
vlib_buffer_get_current (b0),
sizeof (t0->packet_data));
}
hw_if0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
/* Src ethernet address in ARP header. */
- memcpy (h0->ip4_over_ethernet[0].ethernet, hw_if0->hw_address,
+ clib_memcpy (h0->ip4_over_ethernet[0].ethernet, hw_if0->hw_address,
sizeof (h0->ip4_over_ethernet[0].ethernet));
ip4_src_address_for_packet (im, p0, &h0->ip4_over_ethernet[0].ip4, sw_if_index0);
hi = vnet_get_sup_hw_interface (vnm, sw_if_index);
- memcpy (h->ip4_over_ethernet[0].ethernet, hi->hw_address, sizeof (h->ip4_over_ethernet[0].ethernet));
+ clib_memcpy (h->ip4_over_ethernet[0].ethernet, hi->hw_address, sizeof (h->ip4_over_ethernet[0].ethernet));
h->ip4_over_ethernet[0].ip4 = src[0];
h->ip4_over_ethernet[1].ip4 = dst[0];
ip4_addr_fib_init (ip4_address_fib_t * addr_fib, ip4_address_t * address,
u32 fib_index)
{
- memcpy (&addr_fib->ip4_addr, address, sizeof (addr_fib->ip4_addr));
+ clib_memcpy (&addr_fib->ip4_addr, address, sizeof (addr_fib->ip4_addr));
addr_fib->fib_index = fib_index;
}
BVT(clib_bihash_kv) kv, value;
ASSERT (address_length < ARRAY_LEN (im->fib_masks));
- memcpy (&masked_address, address, sizeof (masked_address));
+ clib_memcpy (&masked_address, address, sizeof (masked_address));
ip6_address_mask (&masked_address, &im->fib_masks[address_length]);
kv.key[0] = masked_address.as_u64[0];
t0->flow_hash = vnet_buffer (b0)->ip.flow_hash;
t0->fib_index = vec_elt (im->fib_index_by_sw_if_index,
vnet_buffer(b0)->sw_if_index[VLIB_RX]);
- memcpy (t0->packet_data,
+ clib_memcpy (t0->packet_data,
vlib_buffer_get_current (b0),
sizeof (t0->packet_data));
}
t1->flow_hash = vnet_buffer (b1)->ip.flow_hash;
t1->fib_index = vec_elt (im->fib_index_by_sw_if_index,
vnet_buffer(b1)->sw_if_index[VLIB_RX]);
- memcpy (t1->packet_data,
+ clib_memcpy (t1->packet_data,
vlib_buffer_get_current (b1),
sizeof (t1->packet_data));
}
t0->flow_hash = vnet_buffer (b0)->ip.flow_hash;
t0->fib_index = vec_elt (im->fib_index_by_sw_if_index,
vnet_buffer(b0)->sw_if_index[VLIB_RX]);
- memcpy (t0->packet_data,
+ clib_memcpy (t0->packet_data,
vlib_buffer_get_current (b0),
sizeof (t0->packet_data));
}
h0->neighbor.target_address = ip0->dst_address;
- memcpy (h0->link_layer_option.ethernet_address,
+ clib_memcpy (h0->link_layer_option.ethernet_address,
hw_if0->hw_address, vec_len (hw_if0->hw_address));
/* $$$$ appears we need this; why is the checksum non-zero? */
h->ip.src_address = src[0];
h->neighbor.target_address = dst[0];
- memcpy (h->link_layer_option.ethernet_address, hi->hw_address, vec_len (hi->hw_address));
+ clib_memcpy (h->link_layer_option.ethernet_address, hi->hw_address, vec_len (hi->hw_address));
h->neighbor.icmp.checksum =
ip6_tcp_udp_icmp_compute_checksum (vm, 0, &h->ip, &bogus_length);
trace_len = trace_len < ARRAY_LEN(t->option_data) ?
trace_len : ARRAY_LEN(t->option_data);
t->trace_len = trace_len;
- t->timestamp_msbs = time_u64.as_u32[1];
- memcpy (t->option_data, hbh0, trace_len);
+ clib_memcpy (t->option_data, hbh0, trace_len);
}
processed++;
hbh0 = (ip6_hop_by_hop_header_t *)(ip0 + 1);
/* $$$ tune, rewrite_length is a multiple of 8 */
- memcpy (hbh0, rewrite, rewrite_length);
+ clib_memcpy (hbh0, rewrite, rewrite_length);
/* Patch the protocol chain, insert the h-b-h (type 0) header */
hbh0->protocol = ip0->protocol;
ip0->protocol = 0;
args.sw_if_index = sw_if_index;
args.is_add = is_add;
- memcpy (&args.addr, a, sizeof (*a));
- memcpy (args.link_layer_address, link_layer_addreess, 6);
+ clib_memcpy (&args.addr, a, sizeof (*a));
+ clib_memcpy (args.link_layer_address, link_layer_addreess, 6);
vl_api_rpc_call_main_thread (ip6_neighbor_set_unset_rpc_callback,
(u8 *) &args, sizeof (args));
}
/* Update time stamp and ethernet address. */
- memcpy (n->link_layer_address, link_layer_address, n_bytes_link_layer_address);
+ clib_memcpy (n->link_layer_address, link_layer_address, n_bytes_link_layer_address);
n->cpu_time_last_updated = clib_cpu_time_now ();
/* Customer(s) waiting for this address to be resolved? */
eth_if0 = ethernet_get_interface (ðernet_main, sw_if0->hw_if_index);
if (eth_if0 && o0)
{
- memcpy (o0->ethernet_address, eth_if0->address, 6);
+ clib_memcpy (o0->ethernet_address, eth_if0->address, 6);
o0->header.type =
ICMP6_NEIGHBOR_DISCOVERY_OPTION_target_link_layer_address;
}
* interface MAC to SMAC */
vlib_buffer_reset (p0);
eth0 = vlib_buffer_get_current(p0);
- memcpy(eth0->dst_address, eth0->src_address, 6);
- memcpy(eth0->src_address, eth_if0->address, 6);
+ clib_memcpy(eth0->dst_address, eth0->src_address, 6);
+ clib_memcpy(eth0->src_address, eth_if0->address, 6);
/* Setup input and output sw_if_index for packet */
ASSERT(vnet_buffer(p0)->sw_if_index[VLIB_RX] == sw_if_index0);
h.header.n_data_u64s = 1;
/* copy ll address */
- memcpy(&h.ethernet_address[0], eth_if0->address, 6);
+ clib_memcpy(&h.ethernet_address[0], eth_if0->address, 6);
vlib_buffer_add_data (vm,
p0->free_list_index,
}
h.unused = 0;
- memcpy(&h.dst_address, &pr_info->prefix, sizeof(ip6_address_t));
+ clib_memcpy(&h.dst_address, &pr_info->prefix, sizeof(ip6_address_t));
payload_length += sizeof( icmp6_neighbor_discovery_prefix_information_option_t);
* interface MAC to SMAC */
vlib_buffer_reset (p0);
eth0 = vlib_buffer_get_current(p0);
- memcpy(eth0->dst_address, eth0->src_address, 6);
- memcpy(eth0->src_address, eth_if0->address, 6);
+ clib_memcpy(eth0->dst_address, eth0->src_address, 6);
+ clib_memcpy(eth0->src_address, eth_if0->address, 6);
next0 = is_dropped ?
next0 : ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_TX;
vnet_buffer(p0)->sw_if_index[VLIB_TX] = sw_if_index0;
/* fill in radv_info for this interface that will be needed later */
a->adv_link_mtu = hw_if0->max_l3_packet_bytes[VLIB_RX];
- memcpy (a->link_layer_address, eth_if0->address, 6);
+ clib_memcpy (a->link_layer_address, eth_if0->address, 6);
/* fill in default link-local address (this may be overridden) */
ip6_link_local_address_from_ethernet_address (&a->link_local_address, eth_if0->address);
mcast_group_info->type = 4;
mcast_group_info->mcast_source_address_pool = 0;
mcast_group_info->num_sources = 0;
- memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t));
+ clib_memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t));
}
ip6_set_reserved_multicast_address (&addr,
mcast_group_info->type = 4;
mcast_group_info->mcast_source_address_pool = 0;
mcast_group_info->num_sources = 0;
- memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t));
+ clib_memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t));
}
ip6_set_reserved_multicast_address (&addr,
mcast_group_info->type = 4;
mcast_group_info->mcast_source_address_pool = 0;
mcast_group_info->num_sources = 0;
- memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t));
+ clib_memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t));
}
}
}
rr.type = m->type;
rr.aux_data_len_u32s = 0;
rr.num_sources = clib_host_to_net_u16 (m->num_sources);
- memcpy(&rr.mcast_addr, &m->mcast_address, sizeof(ip6_address_t));
+ clib_memcpy(&rr.mcast_addr, &m->mcast_address, sizeof(ip6_address_t));
num_addr_records++;
memset(prefix, 0x0, sizeof(ip6_radv_prefix_t));
prefix->prefix_len = prefix_len;
- memcpy(&prefix->prefix, prefix_addr, sizeof(ip6_address_t));
+ clib_memcpy(&prefix->prefix, prefix_addr, sizeof(ip6_address_t));
/* initialize default values */
prefix->adv_on_link_flag = 1; /* L bit set */
md5_add (&m, &link_local_address, 16);
md5_finish (&m, digest);
- memcpy(&link_local_address, digest, 16);
+ clib_memcpy(&link_local_address, digest, 16);
radv_info->randomizer = link_local_address.as_u64[0];
mcast_group_info->type = 4;
mcast_group_info->mcast_source_address_pool = 0;
mcast_group_info->num_sources = 0;
- memcpy(&mcast_group_info->mcast_address, &a, sizeof(ip6_address_t));
+ clib_memcpy(&mcast_group_info->mcast_address, &a, sizeof(ip6_address_t));
}
}
}
fip4 = (ip4_header_t *)(vlib_buffer_get_current(b) + offset);
//Copy offset and ip4 header
- memcpy(b->data, packet, offset + sizeof(*ip4));
+ clib_memcpy(b->data, packet, offset + sizeof(*ip4));
//Copy data
- memcpy(((u8*)(fip4)) + sizeof(*fip4),
+ clib_memcpy(((u8*)(fip4)) + sizeof(*fip4),
packet + offset + sizeof(*fip4) + ptr, len);
}
b->current_length = offset + len + sizeof(*fip4);
b = vlib_get_buffer(vm, bi);
vnet_buffer(b)->sw_if_index[VLIB_RX] = vnet_buffer(p)->sw_if_index[VLIB_RX];
vnet_buffer(b)->sw_if_index[VLIB_TX] = vnet_buffer(p)->sw_if_index[VLIB_TX];
- memcpy(vlib_buffer_get_current(b), vlib_buffer_get_current(p), headers_len);
- memcpy(vlib_buffer_get_current(b) + headers_len, payload + ptr, len);
+ clib_memcpy(vlib_buffer_get_current(b), vlib_buffer_get_current(p), headers_len);
+ clib_memcpy(vlib_buffer_get_current(b) + headers_len, payload + ptr, len);
frag_hdr = vlib_buffer_get_current(b) + headers_len - sizeof(*frag_hdr);
} else {
bi = pi;
adj->lookup_next_index = IP_LOOKUP_NEXT_ARP;
CLIB_MEMORY_BARRIER();
- memcpy (&adj->rewrite_header, ©_adj->rewrite_header,
- VLIB_BUFFER_PRE_DATA_SIZE);
+ clib_memcpy (&adj->rewrite_header, ©_adj->rewrite_header,
+ VLIB_BUFFER_PRE_DATA_SIZE);
adj->lookup_next_index = copy_adj->lookup_next_index;
ip_share_adjacency(lm, adj_index);
ip_call_add_del_adjacency_callbacks (lm, adj_index, /* is_del */ 0);
}
else
{
- memcpy (nhs, raw_next_hops, n_nhs * sizeof (raw_next_hops[0]));
+ clib_memcpy (nhs, raw_next_hops, n_nhs * sizeof (raw_next_hops[0]));
qsort (nhs, n_nhs, sizeof (nhs[0]), (void *) next_hop_sort_by_weight);
}
madj->normalized_next_hops.heap_offset
= heap_alloc (lm->next_hop_heap, vec_len (nhs),
madj->normalized_next_hops.heap_handle);
- memcpy (lm->next_hop_heap + madj->normalized_next_hops.heap_offset,
+ clib_memcpy (lm->next_hop_heap + madj->normalized_next_hops.heap_offset,
nhs, vec_bytes (nhs));
hash_set (lm->multipath_adjacency_by_next_hops,
madj->unnormalized_next_hops.heap_offset
= heap_alloc (lm->next_hop_heap, vec_len (raw_next_hops),
madj->unnormalized_next_hops.heap_handle);
- memcpy (lm->next_hop_heap + madj->unnormalized_next_hops.heap_offset,
+ clib_memcpy (lm->next_hop_heap + madj->unnormalized_next_hops.heap_offset,
raw_next_hops, vec_bytes (raw_next_hops));
ip_call_add_del_adjacency_callbacks (lm, adj_index, /* is_del */ 0);
ip0 = vlib_buffer_get_current(b0);
/* Apply the encap string. */
-#if DPDK > 0
- rte_memcpy(ip0, ec0, ec_len);
-#else
- memcpy(ip0, ec0, ec_len);
-#endif
+ clib_memcpy(ip0, ec0, ec_len);
/* fix the <bleep>ing outer-IP checksum */
sum0 = ip0->checksum;
ip1 = vlib_buffer_get_current (b1);
/* Apply the encap string */
-#if DPDK > 0
- rte_memcpy (ip0, ec0, ec_len);
- rte_memcpy (ip1, ec1, ec_len);
-#else
- memcpy (ip0, ec0, ec_len);
- memcpy (ip1, ec1, ec_len);
-#endif
+ clib_memcpy (ip0, ec0, ec_len);
+ clib_memcpy (ip1, ec1, ec_len);
/* fix the <bleep>ing outer-IP checksum */
sum0 = ip0->checksum;
u8 iv[16];
RAND_bytes(iv, sizeof(iv));
- memcpy((u8 *) vlib_buffer_get_current (o_b0) + ip_hdr_size +
+ clib_memcpy((u8 *) vlib_buffer_get_current (o_b0) + ip_hdr_size +
sizeof(esp_header_t), iv, 16 );
esp_encrypt_aes_cbc(sa0->crypto_alg,
{
bitmap |= 1 << transform->type;
vec_add2(rv->transforms, new_t, 1);
- memcpy(new_t, transform, sizeof(*new_t));
+ clib_memcpy(new_t, transform, sizeof(*new_t));
new_t->attrs = vec_dup(transform->attrs);
}
}
/* SK_d */
sa->sk_d = vec_new(u8, tr_prf->key_trunc);
- memcpy(sa->sk_d, keymat + pos, tr_prf->key_trunc);
+ clib_memcpy(sa->sk_d, keymat + pos, tr_prf->key_trunc);
pos += tr_prf->key_trunc;
/* SK_ai */
sa->sk_ai = vec_new(u8, tr_integ->key_len);
- memcpy(sa->sk_ai, keymat + pos, tr_integ->key_len);
+ clib_memcpy(sa->sk_ai, keymat + pos, tr_integ->key_len);
pos += tr_integ->key_len;
/* SK_ar */
sa->sk_ar = vec_new(u8, tr_integ->key_len);
- memcpy(sa->sk_ar, keymat + pos, tr_integ->key_len);
+ clib_memcpy(sa->sk_ar, keymat + pos, tr_integ->key_len);
pos += tr_integ->key_len;
/* SK_ei */
sa->sk_ei = vec_new(u8, tr_encr->key_len);
- memcpy(sa->sk_ei, keymat + pos, tr_encr->key_len);
+ clib_memcpy(sa->sk_ei, keymat + pos, tr_encr->key_len);
pos += tr_encr->key_len;
/* SK_er */
sa->sk_er = vec_new(u8, tr_encr->key_len);
- memcpy(sa->sk_er, keymat + pos, tr_encr->key_len);
+ clib_memcpy(sa->sk_er, keymat + pos, tr_encr->key_len);
pos += tr_encr->key_len;
/* SK_pi */
sa->sk_pi = vec_new(u8, tr_prf->key_len);
- memcpy(sa->sk_pi, keymat + pos, tr_prf->key_len);
+ clib_memcpy(sa->sk_pi, keymat + pos, tr_prf->key_len);
pos += tr_prf->key_len;
/* SK_pr */
sa->sk_pr = vec_new(u8, tr_prf->key_len);
- memcpy(sa->sk_pr, keymat + pos, tr_prf->key_len);
+ clib_memcpy(sa->sk_pr, keymat + pos, tr_prf->key_len);
pos += tr_prf->key_len;
vec_free(keymat);
/* SK_ei */
child->sk_ei = vec_new(u8, ctr_encr->key_len);
- memcpy(child->sk_ei, keymat + pos, ctr_encr->key_len);
+ clib_memcpy(child->sk_ei, keymat + pos, ctr_encr->key_len);
pos += ctr_encr->key_len;
/* SK_ai */
child->sk_ai = vec_new(u8, ctr_integ->key_len);
- memcpy(child->sk_ai, keymat + pos, ctr_integ->key_len);
+ clib_memcpy(child->sk_ai, keymat + pos, ctr_integ->key_len);
pos += ctr_integ->key_len;
/* SK_er */
child->sk_er = vec_new(u8, ctr_encr->key_len);
- memcpy(child->sk_er, keymat + pos, ctr_encr->key_len);
+ clib_memcpy(child->sk_er, keymat + pos, ctr_encr->key_len);
pos += ctr_encr->key_len;
/* SK_ar */
child->sk_ar = vec_new(u8, ctr_integ->key_len);
- memcpy(child->sk_ar, keymat + pos, ctr_integ->key_len);
+ clib_memcpy(child->sk_ar, keymat + pos, ctr_integ->key_len);
pos += ctr_integ->key_len;
ASSERT(pos == len);
}
else if (payload == IKEV2_PAYLOAD_NONCE)
{
- memcpy(i_nonce, ikep->payload, plen - sizeof(*ikep));
+ clib_memcpy(i_nonce, ikep->payload, plen - sizeof(*ikep));
}
else if (payload == IKEV2_PAYLOAD_TSI)
{
tlen += vec_len(chain->data);
ike->nextpayload = chain->first_payload_type;
ike->length = clib_host_to_net_u32(tlen);
- memcpy(ike->payload, chain->data, vec_len(chain->data));
+ clib_memcpy(ike->payload, chain->data, vec_len(chain->data));
/* store whole IKE payload - needed for PSK auth */
vec_free(sa->last_sa_init_res_packet_data);
integ = ikev2_calc_integr(tr_integ, sa->sk_ar, (u8 *) ike,
tlen - tr_integ->key_trunc);
- memcpy(ike->payload + tlen - tr_integ->key_trunc - sizeof(*ike),
+ clib_memcpy(ike->payload + tlen - tr_integ->key_trunc - sizeof(*ike),
integ, tr_integ->key_trunc);
/* store whole IKE payload - needed for retransmit */
ike->flags = tmp->flags;
ike->msgid = tmp->msgid;
ike->length = tmp->length;
- memcpy(ike->payload, tmp->payload,
+ clib_memcpy(ike->payload, tmp->payload,
clib_net_to_host_u32(tmp->length) - sizeof(*ike));
clib_warning("IKE_SA_INIT retransmit from %U to %U",
format_ip4_address, &raddr,
ike->flags = tmp->flags;
ike->msgid = tmp->msgid;
ike->length = tmp->length;
- memcpy(ike->payload, tmp->payload,
+ clib_memcpy(ike->payload, tmp->payload,
clib_net_to_host_u32(tmp->length) - sizeof(*ike));
clib_warning("IKE msgid %u retransmit from %U to %U",
msg_id,
{
/* add SA to the pool */
pool_get (km->sas, sa0);
- memcpy(sa0, &sa, sizeof(*sa0));
+ clib_memcpy(sa0, &sa, sizeof(*sa0));
hash_set (km->sa_by_rspi, sa0->rspi, sa0 - km->sas);
}
else
unformat_ip4_address, &ip4))
{
data = vec_new(u8, 4);
- memcpy(data, ip4.as_u8, 4);
+ clib_memcpy(data, ip4.as_u8, 4);
r = ikev2_set_profile_id(vm, name, (u8) id_type, data, /*local*/ 1);
goto done;
}
unformat_ip4_address, &ip4))
{
data = vec_new(u8, 4);
- memcpy(data, ip4.as_u8, 4);
+ clib_memcpy(data, ip4.as_u8, 4);
r = ikev2_set_profile_id(vm, name, (u8) id_type, data, /*remote*/ 0);
goto done;
}
tr->transform_len = clib_host_to_net_u16(sizeof(*tr) + vec_len(t->attrs));
if (vec_len(t->attrs) > 0)
- memcpy(tr->attributes, t->attrs, vec_len(t->attrs));
+ clib_memcpy(tr->attributes, t->attrs, vec_len(t->attrs));
DBG_PLD("transform type %U transform_id %u last_or_more %u attr_size %u%s%U",
format_ikev2_transform_type, tr->transform_type,
{
u8 * data = vec_new(u8, 4);
u32 spi = clib_host_to_net_u32(d2->spi);
- memcpy(data, &spi, 4);
+ clib_memcpy(data, &spi, 4);
ikev2_payload_add_data(c, data);
vec_free(data);
}
if (n->spi_size == 4)
{
- memcpy(&spi, n->payload, n->spi_size);
+ clib_memcpy(&spi, n->payload, n->spi_size);
r->spi = clib_net_to_host_u32(spi);
DBG_PLD("spi %lx", r->spi);
}
u32 policy_index;
pool_get (spd->policies, vp);
- memcpy (vp, policy, sizeof (*vp));
+ clib_memcpy (vp, policy, sizeof (*vp));
policy_index = vp - spd->policies;
if (policy->is_outbound)
if (policy->is_ipv6)
{
vec_add1 (spd->ipv6_outbound_policies, policy_index);
- memcpy(vp, policy, sizeof(ipsec_policy_t));
+ clib_memcpy(vp, policy, sizeof(ipsec_policy_t));
vec_sort_with_function (spd->ipv6_outbound_policies,
ipsec_spd_entry_sort);
}
else
{
vec_add1 (spd->ipv4_outbound_policies, policy_index);
- memcpy(vp, policy, sizeof(ipsec_policy_t));
+ clib_memcpy(vp, policy, sizeof(ipsec_policy_t));
vec_sort_with_function (spd->ipv4_outbound_policies,
ipsec_spd_entry_sort);
}
{
vec_add1 (spd->ipv6_inbound_protect_policy_indices,
policy_index);
- memcpy(vp, policy, sizeof(ipsec_policy_t));
+ clib_memcpy(vp, policy, sizeof(ipsec_policy_t));
vec_sort_with_function (
spd->ipv6_inbound_protect_policy_indices,
ipsec_spd_entry_sort);
{
vec_add1 (spd->ipv6_inbound_policy_discard_and_bypass_indices,
policy_index);
- memcpy(vp, policy, sizeof(ipsec_policy_t));
+ clib_memcpy(vp, policy, sizeof(ipsec_policy_t));
vec_sort_with_function (
spd->ipv6_inbound_policy_discard_and_bypass_indices,
ipsec_spd_entry_sort);
{
vec_add1 (spd->ipv4_inbound_protect_policy_indices,
policy_index);
- memcpy(vp, policy, sizeof(ipsec_policy_t));
+ clib_memcpy(vp, policy, sizeof(ipsec_policy_t));
vec_sort_with_function (
spd->ipv4_inbound_protect_policy_indices,
ipsec_spd_entry_sort);
{
vec_add1 (spd->ipv4_inbound_policy_discard_and_bypass_indices,
policy_index);
- memcpy(vp, policy, sizeof(ipsec_policy_t));
+ clib_memcpy(vp, policy, sizeof(ipsec_policy_t));
vec_sort_with_function (
spd->ipv4_inbound_policy_discard_and_bypass_indices,
ipsec_spd_entry_sort);
else /* create new SA */
{
pool_get (im->sad, sa);
- memcpy (sa, new_sa, sizeof (*sa));
+ clib_memcpy (sa, new_sa, sizeof (*sa));
sa_index = sa - im->sad;
hash_set (im->sa_index_by_sa_id, sa->id, sa_index);
}
/* new crypto key */
if (0 < sa_update->crypto_key_len)
{
- memcpy(sa->crypto_key, sa_update->crypto_key, sa_update->crypto_key_len);
+ clib_memcpy(sa->crypto_key, sa_update->crypto_key, sa_update->crypto_key_len);
sa->crypto_key_len = sa_update->crypto_key_len;
}
/* new integ key */
if (0 < sa_update->integ_key_len)
{
- memcpy(sa->integ_key, sa_update->integ_key, sa_update->integ_key_len);
+ clib_memcpy(sa->integ_key, sa_update->integ_key, sa_update->integ_key_len);
sa->integ_key_len = sa_update->integ_key_len;
}
sa = pool_elt_at_index(im->sad, t->output_sa_index);
sa->crypto_alg = alg;
sa->crypto_key_len = vec_len(key);
- memcpy(sa->crypto_key, key, vec_len(key));
+ clib_memcpy(sa->crypto_key, key, vec_len(key));
}
else if (type == IPSEC_IF_SET_KEY_TYPE_LOCAL_INTEG)
{
sa = pool_elt_at_index(im->sad, t->output_sa_index);
sa->integ_alg = alg;
sa->integ_key_len = vec_len(key);
- memcpy(sa->integ_key, key, vec_len(key));
+ clib_memcpy(sa->integ_key, key, vec_len(key));
}
else if (type == IPSEC_IF_SET_KEY_TYPE_REMOTE_CRYPTO)
{
sa = pool_elt_at_index(im->sad, t->input_sa_index);
sa->crypto_alg = alg;
sa->crypto_key_len = vec_len(key);
- memcpy(sa->crypto_key, key, vec_len(key));
+ clib_memcpy(sa->crypto_key, key, vec_len(key));
}
else if (type == IPSEC_IF_SET_KEY_TYPE_REMOTE_INTEG)
{
sa = pool_elt_at_index(im->sad, t->input_sa_index);
sa->integ_alg = alg;
sa->integ_key_len = vec_len(key);
- memcpy(sa->integ_key, key, vec_len(key));
+ clib_memcpy(sa->integ_key, key, vec_len(key));
}
else
return VNET_API_ERROR_INVALID_VALUE;
l2_efp_filter_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
- memcpy(t->raw, &h0->type, sizeof(t->raw));
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->raw, &h0->type, sizeof(t->raw));
}
if (b1->flags & VLIB_BUFFER_IS_TRACED) {
ethernet_header_t * h1 = vlib_buffer_get_current (b1);
l2_efp_filter_trace_t *t =
vlib_add_trace (vm, node, b1, sizeof (*t));
t->sw_if_index = sw_if_index1;
- memcpy(t->src, h1->src_address, 6);
- memcpy(t->dst, h1->dst_address, 6);
- memcpy(t->raw, &h1->type, sizeof(t->raw));
+ clib_memcpy(t->src, h1->src_address, 6);
+ clib_memcpy(t->dst, h1->dst_address, 6);
+ clib_memcpy(t->raw, &h1->type, sizeof(t->raw));
}
}
l2_efp_filter_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
- memcpy(t->raw, &h0->type, sizeof(t->raw));
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->raw, &h0->type, sizeof(t->raw));
}
/* verify speculative enqueue, maybe switch current next frame */
ethernet_header_t * h0 = vlib_buffer_get_current (b0);
t->sw_if_index = sw_if_index0;
t->bd_index = vnet_buffer(b0)->l2.bd_index;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
if (PREDICT_FALSE(b1->flags & VLIB_BUFFER_IS_TRACED))
{
ethernet_header_t * h1 = vlib_buffer_get_current (b1);
t->sw_if_index = sw_if_index1;
t->bd_index = vnet_buffer(b1)->l2.bd_index;
- memcpy(t->src, h1->src_address, 6);
- memcpy(t->dst, h1->dst_address, 6);
+ clib_memcpy(t->src, h1->src_address, 6);
+ clib_memcpy(t->dst, h1->dst_address, 6);
}
}
ethernet_header_t * h0 = vlib_buffer_get_current (b0);
t->sw_if_index = sw_if_index0;
t->bd_index = vnet_buffer(b0)->l2.bd_index;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
/* verify speculative enqueue, maybe switch current next frame */
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
t->bd_index = vnet_buffer(b0)->l2.bd_index;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
if (b1->flags & VLIB_BUFFER_IS_TRACED)
{
vlib_add_trace (vm, node, b1, sizeof (*t));
t->sw_if_index = sw_if_index1;
t->bd_index = vnet_buffer(b1)->l2.bd_index;
- memcpy(t->src, h1->src_address, 6);
- memcpy(t->dst, h1->dst_address, 6);
+ clib_memcpy(t->src, h1->src_address, 6);
+ clib_memcpy(t->dst, h1->dst_address, 6);
}
}
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
t->bd_index = vnet_buffer(b0)->l2.bd_index;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
/* process 1 pkt */
l2input_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
if (b1->flags & VLIB_BUFFER_IS_TRACED) {
ethernet_header_t * h1 = vlib_buffer_get_current (b1);
l2input_trace_t *t =
vlib_add_trace (vm, node, b1, sizeof (*t));
t->sw_if_index = sw_if_index1;
- memcpy(t->src, h1->src_address, 6);
- memcpy(t->dst, h1->dst_address, 6);
+ clib_memcpy(t->src, h1->src_address, 6);
+ clib_memcpy(t->dst, h1->dst_address, 6);
}
}
vlib_add_trace (vm, node, b0, sizeof (*t));
sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
t->sw_if_index = sw_if_index0;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
em->counters[node_counter_base_index + L2INPUT_ERROR_L2INPUT] += 1;
vlib_add_trace (vm, node, b0, sizeof (*t));
ethernet_header_t * h0 = vlib_buffer_get_current (b0);
t->sw_if_index = sw_if_index0;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
- memcpy(t->raw, &h0->type, sizeof(t->raw));
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->raw, &h0->type, sizeof(t->raw));
}
if (b1->flags & VLIB_BUFFER_IS_TRACED) {
l2_invtr_trace_t *t =
vlib_add_trace (vm, node, b1, sizeof (*t));
ethernet_header_t * h1 = vlib_buffer_get_current (b1);
t->sw_if_index = sw_if_index0;
- memcpy(t->src, h1->src_address, 6);
- memcpy(t->dst, h1->dst_address, 6);
- memcpy(t->raw, &h1->type, sizeof(t->raw));
+ clib_memcpy(t->src, h1->src_address, 6);
+ clib_memcpy(t->dst, h1->dst_address, 6);
+ clib_memcpy(t->raw, &h1->type, sizeof(t->raw));
}
}
vlib_add_trace (vm, node, b0, sizeof (*t));
ethernet_header_t * h0 = vlib_buffer_get_current (b0);
t->sw_if_index = sw_if_index0;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
- memcpy(t->raw, &h0->type, sizeof(t->raw));
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->raw, &h0->type, sizeof(t->raw));
}
/* verify speculative enqueue, maybe switch current next frame */
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
t->bd_index = vnet_buffer(b0)->l2.bd_index;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
if (b1->flags & VLIB_BUFFER_IS_TRACED)
{
vlib_add_trace (vm, node, b1, sizeof (*t));
t->sw_if_index = sw_if_index1;
t->bd_index = vnet_buffer(b1)->l2.bd_index;
- memcpy(t->src, h1->src_address, 6);
- memcpy(t->dst, h1->dst_address, 6);
+ clib_memcpy(t->src, h1->src_address, 6);
+ clib_memcpy(t->dst, h1->dst_address, 6);
}
}
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
t->bd_index = vnet_buffer(b0)->l2.bd_index;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
/* process 1 pkt */
l2output_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
if (b1->flags & VLIB_BUFFER_IS_TRACED)
{
l2output_trace_t *t =
vlib_add_trace (vm, node, b1, sizeof (*t));
t->sw_if_index = sw_if_index1;
- memcpy(t->src, h1->src_address, 6);
- memcpy(t->dst, h1->dst_address, 6);
+ clib_memcpy(t->src, h1->src_address, 6);
+ clib_memcpy(t->dst, h1->dst_address, 6);
}
}
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
h0 = vlib_buffer_get_current (b0);
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
em->counters[node_counter_base_index + L2OUTPUT_ERROR_L2OUTPUT] += 1;
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
t->next_index = next0;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
if (b1->flags & VLIB_BUFFER_IS_TRACED)
{
vlib_add_trace (vm, node, b1, sizeof (*t));
t->sw_if_index = sw_if_index1;
t->next_index = next1;
- memcpy(t->src, h1->src_address, 6);
- memcpy(t->dst, h1->dst_address, 6);
+ clib_memcpy(t->src, h1->src_address, 6);
+ clib_memcpy(t->dst, h1->dst_address, 6);
}
}
l2_outacl_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
- memcpy(t->src, h0->src_address, 6);
- memcpy(t->dst, h0->dst_address, 6);
+ clib_memcpy(t->src, h0->src_address, 6);
+ clib_memcpy(t->dst, h0->dst_address, 6);
}
em->counters[node_counter_base_index + L2_OUTACL_ERROR_L2_OUTACL] += 1;
vec_alloc_aligned(e->value, e->rewrite_n_vectors, sizeof(u32x4));
memset(e->value, 0, e->rewrite_n_vectors * sizeof(u32x4));
- memcpy(((u8 *)e->value) + skip, value, len);
- memcpy(((u8 *)e->mask) + skip, mask, len);
+ clib_memcpy(((u8 *)e->value) + skip, value, len);
+ clib_memcpy(((u8 *)e->mask) + skip, mask, len);
int i;
for (i = 0; i < e->rewrite_n_vectors; i++) {
pool_get (lm->sessions, s);
memset (s, 0, sizeof (*s));
- memcpy (&s->our_address, our_address, sizeof (s->our_address));
- memcpy (&s->client_address, client_address, sizeof (s->client_address));
+ clib_memcpy (&s->our_address, our_address, sizeof (s->our_address));
+ clib_memcpy (&s->client_address, client_address, sizeof (s->client_address));
s->local_cookie[0] = clib_host_to_net_u64 (local_cookie);
s->remote_cookie = clib_host_to_net_u64 (remote_cookie);
s->local_session_id = local_session_id;
switch (lm->lookup_type) {
case L2T_LOOKUP_SRC_ADDRESS:
src_address_copy = clib_mem_alloc (sizeof (*src_address_copy));
- memcpy (src_address_copy, client_address, sizeof (*src_address_copy));
+ clib_memcpy (src_address_copy, client_address, sizeof (*src_address_copy));
hash_set_mem (lm->session_by_src_address, src_address_copy,
s - lm->sessions);
break;
case L2T_LOOKUP_DST_ADDRESS:
dst_address_copy = clib_mem_alloc (sizeof (*dst_address_copy));
- memcpy (dst_address_copy, our_address, sizeof (*dst_address_copy));
+ clib_memcpy (dst_address_copy, our_address, sizeof (*dst_address_copy));
hash_set_mem (lm->session_by_dst_address, dst_address_copy,
s - lm->sessions);
break;
}
else if (l6)
{
- memcpy (&ip_addr_v6(sloc), l6, sizeof(*l6));
+ clib_memcpy (&ip_addr_v6(sloc), l6, sizeof(*l6));
ip_addr_version(sloc) = IP6;
}
else
else
{
ip6 = hdr;
- memcpy (&ip_addr_v6(src), &ip6->src_address, sizeof(ip6->src_address));
+ clib_memcpy (&ip_addr_v6(src), &ip6->src_address, sizeof(ip6->src_address));
ip_addr_version(src) = IP6;
- memcpy (&ip_addr_v6(dst), &ip6->dst_address, sizeof(ip6->dst_address));
+ clib_memcpy (&ip_addr_v6(dst), &ip6->dst_address, sizeof(ip6->dst_address));
ip_addr_version(dst) = IP6;
}
}
lisp_cp_lookup_trace_t *tr = vlib_add_trace (vm, node, p0,
sizeof(*tr));
gid_address_copy (&tr->dst_eid, &dst);
- memcpy (&tr->map_resolver_ip,
+ clib_memcpy (&tr->map_resolver_ip,
vec_elt_at_index(lcm->map_resolvers, 0),
sizeof(ip_address_t));
}
ip4_address_t key;
u8 plen = ip_prefix_len (pref);
- memcpy (&key, &ip_prefix_v4(pref), sizeof(key));
+ clib_memcpy (&key, &ip_prefix_v4(pref), sizeof(key));
key.as_u32 &= db->ip4_fib_masks[plen].as_u32;
if (is_add)
{
ip6_address_t key;
u8 plen = ip_prefix_len (pref);
- memcpy (&key, &ip_prefix_v6(pref), sizeof(key));
+ clib_memcpy (&key, &ip_prefix_v6(pref), sizeof(key));
ip6_address_mask (&key, &db->ip6_fib_masks[plen]);
if (is_add)
{
{
*(u16 *)b = clib_host_to_net_u16(ip_version_to_iana_afi(IP4));
u8 *p = b + sizeof (u16);
- memcpy (p, a, sizeof(*a));
+ clib_memcpy (p, a, sizeof(*a));
return ip4_address_size_to_put();
}
{
*(u16 *)b = clib_host_to_net_u16(ip_version_to_iana_afi(IP6));
u8 *p = b + sizeof (u16);
- memcpy (p, a, sizeof(*a));
+ clib_memcpy (p, a, sizeof(*a));
return ip6_address_size_to_put();
}
u32 len = ip_address_size (a);
*(u16 *) b = clib_host_to_net_u16(ip_address_iana_afi (a));
u8 * p = b + sizeof (u16);
- memcpy (p, &ip_addr_addr (a), len);
+ clib_memcpy (p, &ip_addr_addr (a), len);
return (len + sizeof (u16));
}
{
ip_addr_version(dst) = ip_iana_afi_to_version (iana_afi);
u8 size = ip_version_to_size (ip_addr_version(dst));
- memcpy (&ip_addr_addr(dst), offset + sizeof(u16), size);
+ clib_memcpy (&ip_addr_addr(dst), offset + sizeof(u16), size);
return(sizeof(u16) + size);
}
void
ip_prefix_copy (void * dst , void * src)
{
- memcpy (dst, src, sizeof (ip_prefix_t));
+ clib_memcpy (dst, src, sizeof (ip_prefix_t));
}
int
locator_copy (locator_t * dst, locator_t * src)
{
/* TODO if gid become more complex, this will need to be changed! */
- memcpy (dst, src, sizeof(*dst));
+ clib_memcpy (dst, src, sizeof(*dst));
}
u32
// ip6h->ip6_vfc = (IP6VERSION << 4);
// ip6h->ip6_nxt = proto;
// ip6h->ip6_plen = clib_host_to_net_u16(len);
-// memcpy(ip6h->ip6_src.s6_addr, src->s6_addr, sizeof(struct in6_addr));
-// memcpy(ip6h->ip6_dst.s6_addr, dst->s6_addr, sizeof(struct in6_addr));
+// clib_memcpy(ip6h->ip6_src.s6_addr, src->s6_addr, sizeof(struct in6_addr));
+// clib_memcpy(ip6h->ip6_dst.s6_addr, dst->s6_addr, sizeof(struct in6_addr));
// return(ip6h);
}
u32 n_bytes = sizeof (h[0]);
vec_add2 (*result, p, n_bytes);
- memcpy (p, h, n_bytes);
+ clib_memcpy (p, h, n_bytes);
}
return 1;
from = vlib_frame_vector_args(frame);
u32 len = vec_len(fragments_to_loopback);
if(len <= VLIB_FRAME_SIZE) {
- memcpy(from, fragments_to_loopback, sizeof(u32)*len);
+ clib_memcpy(from, fragments_to_loopback, sizeof(u32)*len);
n_left_from = len;
vec_reset_length(fragments_to_loopback);
} else {
- memcpy(from, fragments_to_loopback + (len - VLIB_FRAME_SIZE), sizeof(u32)*VLIB_FRAME_SIZE);
+ clib_memcpy(from, fragments_to_loopback + (len - VLIB_FRAME_SIZE), sizeof(u32)*VLIB_FRAME_SIZE);
n_left_from = VLIB_FRAME_SIZE;
_vec_len(fragments_to_loopback) = len - VLIB_FRAME_SIZE;
}
vlib_buffer_advance(p, - 2*(sizeof(*ip6) - sizeof(*ip4)) - sizeof(*inner_frag));
ip6 = vlib_buffer_get_current(p);
- memcpy(u8_ptr_add(ip6, sizeof(*ip6) - sizeof(*ip4)), ip4, 20 + 8);
+ clib_memcpy(u8_ptr_add(ip6, sizeof(*ip6) - sizeof(*ip4)), ip4, 20 + 8);
ip4 = (ip4_header_t *) u8_ptr_add(ip6, sizeof(*ip6) - sizeof(*ip4));
icmp = (icmp46_header_t *) (ip4 + 1);
} else {
vlib_buffer_advance(p, - 2*(sizeof(*ip6) - sizeof(*ip4)));
ip6 = vlib_buffer_get_current(p);
- memcpy(u8_ptr_add(ip6, sizeof(*ip6) - sizeof(*ip4)), ip4, 20 + 8);
+ clib_memcpy(u8_ptr_add(ip6, sizeof(*ip6) - sizeof(*ip4)), ip4, 20 + 8);
ip4 = (ip4_header_t *) u8_ptr_add(ip6, sizeof(*ip6) - sizeof(*ip4));
icmp = (icmp46_header_t *) u8_ptr_add(ip4, sizeof(*ip4));
inner_ip6 = (ip6_header_t *) u8_ptr_add(inner_ip4, sizeof(*ip4) - sizeof(*ip6));
if (ip6_frag_hdr_offset(frag0)) {
//Not first fragment, add the IPv4 header
- memcpy(ip40, &r->ip4_header, 20);
+ clib_memcpy(ip40, &r->ip4_header, 20);
}
#ifdef MAP_IP6_REASS_COUNT_BYTES
if (ip6_frag_hdr_more(frag0)) {
//Not last fragment, we copy end of next
- memcpy(u8_ptr_add(ip60, p0->current_length), r->fragments[i].next_data, 20);
+ clib_memcpy(u8_ptr_add(ip60, p0->current_length), r->fragments[i].next_data, 20);
p0->current_length += 20;
ip60->payload_length = u16_net_add(ip60->payload_length, 20);
}
from = vlib_frame_vector_args(frame);
u32 len = vec_len(fragments_to_loopback);
if(len <= VLIB_FRAME_SIZE) {
- memcpy(from, fragments_to_loopback, sizeof(u32)*len);
+ clib_memcpy(from, fragments_to_loopback, sizeof(u32)*len);
n_left_from = len;
vec_reset_length(fragments_to_loopback);
} else {
- memcpy(from, fragments_to_loopback + (len - VLIB_FRAME_SIZE), sizeof(u32)*VLIB_FRAME_SIZE);
+ clib_memcpy(from, fragments_to_loopback + (len - VLIB_FRAME_SIZE), sizeof(u32)*VLIB_FRAME_SIZE);
n_left_from = VLIB_FRAME_SIZE;
_vec_len(fragments_to_loopback) = len - VLIB_FRAME_SIZE;
}
//Move up icmp header
ip4 = (ip4_header_t *) u8_ptr_add(inner_l4, - 2 * sizeof(*ip4) - 8);
- memcpy(u8_ptr_add(inner_l4, - sizeof(*ip4) - 8), icmp, 8);
+ clib_memcpy(u8_ptr_add(inner_l4, - sizeof(*ip4) - 8), icmp, 8);
icmp = (icmp46_header_t *) u8_ptr_add(inner_l4, - sizeof(*ip4) - 8);
} else {
//Only one header to translate
if (!prev_f)
return -1;
- memcpy(prev_f->next_data, data_start, copied_len);
+ clib_memcpy(prev_f->next_data, data_start, copied_len);
prev_f->next_data_len = copied_len;
prev_f->next_data_offset = data_offset;
} else {
return -1;
if (r->ip4_header.ip_version_and_header_length == 0)
- memcpy(&r->ip4_header, data_start, sizeof(ip4_header_t));
+ clib_memcpy(&r->ip4_header, data_start, sizeof(ip4_header_t));
}
if(data_len > 20) {
dst0 = vlib_buffer_get_current (b0);
dst1 = vlib_buffer_get_current (b1);
- memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data));
- memcpy (dst1, t1->rewrite_data, vec_len(t1->rewrite_data));
+ clib_memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data));
+ clib_memcpy (dst1, t1->rewrite_data, vec_len(t1->rewrite_data));
/* Fix TX fib indices */
vnet_buffer(b0)->sw_if_index [VLIB_TX] = t0->outer_fib_index;
dst0 = vlib_buffer_get_current (b0);
- memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data));
+ clib_memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data));
/* Fix the TX fib index */
vnet_buffer(b0)->sw_if_index [VLIB_TX] = t0->outer_fib_index;
dst0 = vlib_buffer_get_current (b0);
dst1 = vlib_buffer_get_current (b1);
- memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data));
- memcpy (dst1, t1->rewrite_data, vec_len(t1->rewrite_data));
+ clib_memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data));
+ clib_memcpy (dst1, t1->rewrite_data, vec_len(t1->rewrite_data));
/* Fix TX fib indices */
vnet_buffer(b0)->sw_if_index [VLIB_TX] = t0->tx_sw_if_index;
tr->mpls_encap_index = t0->encap_index;
tr->length = b0->current_length;
hi0 = vnet_get_sup_hw_interface (vnm, t0->tx_sw_if_index);
- memcpy (tr->dst, hi0->hw_address, sizeof (tr->dst));
+ clib_memcpy (tr->dst, hi0->hw_address, sizeof (tr->dst));
}
if (PREDICT_FALSE(b1->flags & VLIB_BUFFER_IS_TRACED))
{
tr->mpls_encap_index = t1->encap_index;
tr->length = b0->current_length;
hi1 = vnet_get_sup_hw_interface (vnm, t1->tx_sw_if_index);
- memcpy (tr->dst, hi1->hw_address, sizeof (tr->dst));
+ clib_memcpy (tr->dst, hi1->hw_address, sizeof (tr->dst));
}
vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
dst0 = vlib_buffer_get_current (b0);
- memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data));
+ clib_memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data));
/* Fix the TX interface */
vnet_buffer(b0)->sw_if_index [VLIB_TX] = t0->tx_sw_if_index;
tr->mpls_encap_index = t0->encap_index;
tr->length = b0->current_length;
hi0 = vnet_get_sup_hw_interface (vnm, t0->tx_sw_if_index);
- memcpy (tr->dst, hi0->hw_address, sizeof (tr->dst));
+ clib_memcpy (tr->dst, hi0->hw_address, sizeof (tr->dst));
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
tp->hw_if_index = hw_if_index;
reinstall_it:
- memcpy(tp->tunnel_dst, dst, sizeof (tp->tunnel_dst));
+ clib_memcpy(tp->tunnel_dst, dst, sizeof (tp->tunnel_dst));
tp->intfc_address.as_u32 = intfc->as_u32;
tp->mask_width = mask_width;
tp->inner_fib_index = inner_fib_index;
* we just built to the mpls header stack
*/
vec_insert (rewrite_data, adj.rewrite_header.data_bytes, 0);
- memcpy(rewrite_data,
+ clib_memcpy(rewrite_data,
vnet_rewrite_get_data_internal(&adj.rewrite_header,
sizeof (adj.rewrite_data)),
adj.rewrite_header.data_bytes);
vec_validate (rewrite_data, adj.rewrite_header.data_bytes -1);
- memcpy(rewrite_data,
+ clib_memcpy(rewrite_data,
vnet_rewrite_get_data_internal(&adj.rewrite_header,
sizeof (adj.rewrite_data)),
adj.rewrite_header.data_bytes);
tp->hw_if_index = hw_if_index;
reinstall_it:
- memcpy(tp->tunnel_dst, dst, sizeof (tp->tunnel_dst));
+ clib_memcpy(tp->tunnel_dst, dst, sizeof (tp->tunnel_dst));
tp->intfc_address.as_u32 = intfc->as_u32;
tp->mask_width = mask_width;
tp->inner_fib_index = inner_fib_index;
u32 h_n_bytes = sizeof (h[0]);
vec_add2 (*result, p, g_n_bytes);
- memcpy (p, g, g_n_bytes);
+ clib_memcpy (p, g, g_n_bytes);
vec_add2 (*result, p, h_n_bytes);
- memcpy (p, h, h_n_bytes);
+ clib_memcpy (p, h, h_n_bytes);
}
return 1;
vlib_buffer_advance (b0, -(word)vec_len(e0->rewrite));
h0 = vlib_buffer_get_current (b0);
- memcpy (h0, e0->rewrite, vec_len(e0->rewrite));
+ clib_memcpy (h0, e0->rewrite, vec_len(e0->rewrite));
next0 = e0->output_next_index;
/* If there are TLVs to copy, do so */
if (PREDICT_FALSE (_vec_len(t0->rewrite) > 24))
- memcpy (©_dst0[3], t0->rewrite + 24 ,
+ clib_memcpy (©_dst0[3], t0->rewrite + 24 ,
_vec_len (t0->rewrite)-24);
if (PREDICT_FALSE (_vec_len(t1->rewrite) > 24))
- memcpy (©_dst1[3], t1->rewrite + 24 ,
+ clib_memcpy (©_dst1[3], t1->rewrite + 24 ,
_vec_len (t1->rewrite)-24);
/* fix the <bleep>ing outer-IP checksums */
/* If there are TLVs to copy, do so */
if (PREDICT_FALSE (_vec_len(t0->rewrite) > 24))
- memcpy (©_dst0[3], t0->rewrite + 24 ,
+ clib_memcpy (©_dst0[3], t0->rewrite + 24 ,
_vec_len (t0->rewrite)-24);
/* fix the <bleep>ing outer-IP checksum */
/* Copy any TLVs */
if (vec_len(t->tlvs))
- memcpy (nsh0->tlvs, t->tlvs, 4*vec_len(t->tlvs));
+ clib_memcpy (nsh0->tlvs, t->tlvs, 4*vec_len(t->tlvs));
t->rewrite = rw;
return (0);
/* If there are TLVs to copy, do so */
if (PREDICT_FALSE (_vec_len(t0->rewrite) > 64))
- memcpy (©_dst0[3], t0->rewrite + 64 ,
+ clib_memcpy (©_dst0[3], t0->rewrite + 64 ,
_vec_len (t0->rewrite)-64);
if (PREDICT_FALSE (_vec_len(t1->rewrite) > 64))
- memcpy (©_dst0[3], t1->rewrite + 64 ,
+ clib_memcpy (©_dst0[3], t1->rewrite + 64 ,
_vec_len (t1->rewrite)-64);
/* fix the <bleep>ing outer-IP checksum */
/* If there are TLVs to copy, do so */
if (PREDICT_FALSE (_vec_len(t0->rewrite) > 64))
- memcpy (©_dst0[3], t0->rewrite + 64 ,
+ clib_memcpy (©_dst0[3], t0->rewrite + 64 ,
_vec_len (t0->rewrite)-64);
/* fix the <bleep>ing outer-IP checksum */
/* Copy any TLVs */
if (vec_len(t->tlvs))
- memcpy (nsh0->tlvs, t->tlvs, 4*vec_len(t->tlvs));
+ clib_memcpy (nsh0->tlvs, t->tlvs, 4*vec_len(t->tlvs));
t->rewrite = rw;
return (0);
}
key_copy = clib_mem_alloc (sizeof (*key_copy));
- memcpy (key_copy, &key, sizeof (*key_copy));
+ clib_memcpy (key_copy, &key, sizeof (*key_copy));
hash_set_mem (ngm->nsh_vxlan_gpe_tunnel_by_key, key_copy,
t - ngm->tunnels);
u32 n_bytes = sizeof (h[0]);
vec_add2 (*result, p, n_bytes);
- memcpy (p, h, n_bytes);
+ clib_memcpy (p, h, n_bytes);
}
return 1;
b0->current_length = n0;
- memcpy (b0->data, d0 + data_offset, n0);
+ clib_memcpy (b0->data, d0 + data_offset, n0);
i = i + 1 == l ? 0 : i + 1;
}
}
if (set_data)
{
- memcpy (b0->data, data, n_data);
- memcpy (b1->data, data, n_data);
+ clib_memcpy (b0->data, data, n_data);
+ clib_memcpy (b1->data, data, n_data);
}
else
{
vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32)~0;
if (set_data)
- memcpy (b0->data, data, n_data);
+ clib_memcpy (b0->data, data, n_data);
else
ASSERT (validate_buffer_data2 (b0, s, data_offset, n_data));
}
t0->packet_length = vlib_buffer_length_in_chain (vm, b0);
t1->packet_length = vlib_buffer_length_in_chain (vm, b1);
- memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data));
- memcpy (&t1->buffer, b1, sizeof (b1[0]) - sizeof (b1->pre_data));
+ clib_memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data));
+ clib_memcpy (&t1->buffer, b1, sizeof (b1[0]) - sizeof (b1->pre_data));
- memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data));
- memcpy (t1->buffer.pre_data, b1->data, sizeof (t1->buffer.pre_data));
+ clib_memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data));
+ clib_memcpy (t1->buffer.pre_data, b1->data, sizeof (t1->buffer.pre_data));
}
while (n_left >= 1)
t0->stream_index = stream_index;
t0->packet_length = vlib_buffer_length_in_chain (vm, b0);
- memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data));
- memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data));
+ clib_memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data));
+ clib_memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data));
}
}
vec_foreach (e, g->edits)
do_edit (s, g, e, /* want_commit */ 0);
- memcpy (packet_data, g->fixed_packet_data, vec_len (g->fixed_packet_data));
- memcpy (packet_data_mask, g->fixed_packet_data_mask, vec_len (g->fixed_packet_data_mask));
+ clib_memcpy (packet_data, g->fixed_packet_data, vec_len (g->fixed_packet_data));
+ clib_memcpy (packet_data_mask, g->fixed_packet_data_mask, vec_len (g->fixed_packet_data_mask));
}
static void perform_fixed_edits (pg_stream_t * s)
ASSERT (cp - pm->configs == pp - pm->policer_templates);
- memcpy (cp, &c, sizeof (*cp));
- memcpy (pp, &test_policer, sizeof (*pp));
+ clib_memcpy (cp, &c, sizeof (*cp));
+ clib_memcpy (pp, &test_policer, sizeof (*pp));
hash_set_mem (pm->policer_config_by_name, name, cp - pm->configs);
}
u32 n_bytes = sizeof (h[0]);
vec_add2 (*result, p, n_bytes);
- memcpy (p, h, n_bytes);
+ clib_memcpy (p, h, n_bytes);
}
return 1;
ctx->recycle_node_index = recycle_node_index;
// Save vnet state
- memcpy (ctx->vnet_buffer, vnet_buffer(b0), sizeof(vnet_buffer_opaque_t));
+ clib_memcpy (ctx->vnet_buffer, vnet_buffer(b0), sizeof(vnet_buffer_opaque_t));
// Save packet contents
ctx->l2_packet = l2_packet;
ctx = pool_elt_at_index (rm->contexts[cpu_number], b0->clone_count);
// Restore vnet buffer state
- memcpy (vnet_buffer(b0), ctx->vnet_buffer, sizeof(vnet_buffer_opaque_t));
+ clib_memcpy (vnet_buffer(b0), ctx->vnet_buffer, sizeof(vnet_buffer_opaque_t));
// Restore the packet start (current_data) and length
vlib_buffer_advance(b0, ctx->current_data - b0->current_data);
serialize_integer (m, rw->data_bytes, sizeof (rw->data_bytes));
serialize_integer (m, rw->max_l3_packet_bytes, sizeof (rw->max_l3_packet_bytes));
p = serialize_get (m, rw->data_bytes);
- memcpy (p, vnet_rewrite_get_data_internal (rw, max_data_bytes), rw->data_bytes);
+ clib_memcpy (p, vnet_rewrite_get_data_internal (rw, max_data_bytes), rw->data_bytes);
}
void unserialize_vnet_rewrite (serialize_main_t * m, va_list * va)
unserialize_integer (m, &rw->data_bytes, sizeof (rw->data_bytes));
unserialize_integer (m, &rw->max_l3_packet_bytes, sizeof (rw->max_l3_packet_bytes));
p = unserialize_get (m, rw->data_bytes);
- memcpy (vnet_rewrite_get_data_internal (rw, max_data_bytes), p, rw->data_bytes);
+ clib_memcpy (vnet_rewrite_get_data_internal (rw, max_data_bytes), p, rw->data_bytes);
}
ASSERT ((data_bytes >= 0) && (data_bytes < max_size));
rw->data_bytes = data_bytes;
- memcpy (rw->data + max_size - data_bytes, data, data_bytes);
+ clib_memcpy (rw->data + max_size - data_bytes, data, data_bytes);
memset (rw->data, 0xfe, max_size - data_bytes);
}
eh_copy_t * s, * d;
s = (eh_copy_t *)(h0->data + max_size - sizeof (eh_copy_t));
d = (eh_copy_t *)(((u8 *)packet0) - sizeof (eh_copy_t));
- __builtin_memcpy (d, s, sizeof (eh_copy_t));
+ clib_memcpy (d, s, sizeof (eh_copy_t));
return;
}
eh_copy_t * s0, * d0, * s1, * d1;
s0 = (eh_copy_t *)(h0->data + max_size - sizeof (eh_copy_t));
d0 = (eh_copy_t *)(((u8 *)packet0) - sizeof (eh_copy_t));
- __builtin_memcpy (d0, s0, sizeof (eh_copy_t));
+ clib_memcpy (d0, s0, sizeof (eh_copy_t));
s1 = (eh_copy_t *)(h1->data + max_size - sizeof (eh_copy_t));
d1 = (eh_copy_t *)(((u8 *)packet1) - sizeof (eh_copy_t));
- __builtin_memcpy (d1, s1, sizeof (eh_copy_t));
+ clib_memcpy (d1, s1, sizeof (eh_copy_t));
return;
}
u32 n_bytes = sizeof (h[0]);
vec_add2 (*result, p, n_bytes);
- memcpy (p, h, n_bytes);
+ clib_memcpy (p, h, n_bytes);
}
return 1;
/* pkt ip6 src address */
vec_add2 (keybuf, copy_target, sizeof (ip6_address_t));
- memcpy (copy_target, ip->src_address.as_u8, sizeof (ip6_address_t));
+ clib_memcpy (copy_target, ip->src_address.as_u8, sizeof (ip6_address_t));
/* first segment */
vec_add2 (keybuf, copy_target, 1);
for (i = 0; i <= first_segment; i++)
{
vec_add2 (keybuf, copy_target, sizeof (ip6_address_t));
- memcpy (copy_target, addrp->as_u8, sizeof (ip6_address_t));
+ clib_memcpy (copy_target, addrp->as_u8, sizeof (ip6_address_t));
addrp++;
}
ip0 = vlib_buffer_get_current (b0);
sr0 = (ip6_sr_header_t *) (ip0+1);
/* $$$ tune */
- memcpy (sr0, t0->rewrite, vec_len (t0->rewrite));
+ clib_memcpy (sr0, t0->rewrite, vec_len (t0->rewrite));
/* Fix the next header chain */
sr0->protocol = ip0->protocol;
ip0->protocol = 43; /* routing extension header */
vlib_buffer_advance (b1, - (word) vec_len(t1->rewrite));
ip1 = vlib_buffer_get_current (b1);
sr1 = (ip6_sr_header_t *) (ip1+1);
- memcpy (sr1, t1->rewrite, vec_len (t1->rewrite));
+ clib_memcpy (sr1, t1->rewrite, vec_len (t1->rewrite));
sr1->protocol = ip1->protocol;
ip1->protocol = 43;
new_l1 = clib_net_to_host_u16(ip1->payload_length) +
sr_rewrite_trace_t *tr = vlib_add_trace (vm, node,
b0, sizeof (*tr));
tr->tunnel_index = t0 - sm->tunnels;
- memcpy (tr->src.as_u8, ip0->src_address.as_u8,
+ clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
sizeof (tr->src.as_u8));
- memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
+ clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
sizeof (tr->dst.as_u8));
tr->length = new_l0;
tr->next_index = next0;
- memcpy (tr->sr, sr0, sizeof (tr->sr));
+ clib_memcpy (tr->sr, sr0, sizeof (tr->sr));
}
if (PREDICT_FALSE(b1->flags & VLIB_BUFFER_IS_TRACED))
{
sr_rewrite_trace_t *tr = vlib_add_trace (vm, node,
b1, sizeof (*tr));
tr->tunnel_index = t1 - sm->tunnels;
- memcpy (tr->src.as_u8, ip1->src_address.as_u8,
+ clib_memcpy (tr->src.as_u8, ip1->src_address.as_u8,
sizeof (tr->src.as_u8));
- memcpy (tr->dst.as_u8, ip1->dst_address.as_u8,
+ clib_memcpy (tr->dst.as_u8, ip1->dst_address.as_u8,
sizeof (tr->dst.as_u8));
tr->length = new_l1;
tr->next_index = next1;
- memcpy (tr->sr, sr1, sizeof (tr->sr));
+ clib_memcpy (tr->sr, sr1, sizeof (tr->sr));
}
vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
ip0 = vlib_buffer_get_current (b0);
sr0 = (ip6_sr_header_t *) (ip0+1);
/* $$$ tune */
- memcpy (sr0, t0->rewrite, vec_len (t0->rewrite));
+ clib_memcpy (sr0, t0->rewrite, vec_len (t0->rewrite));
/* Fix the next header chain */
sr0->protocol = ip0->protocol;
ip0->protocol = 43; /* routing extension header */
sr_rewrite_trace_t *tr = vlib_add_trace (vm, node,
b0, sizeof (*tr));
tr->tunnel_index = t0 - sm->tunnels;
- memcpy (tr->src.as_u8, ip0->src_address.as_u8,
+ clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
sizeof (tr->src.as_u8));
- memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
+ clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
sizeof (tr->dst.as_u8));
tr->length = new_l0;
tr->next_index = next0;
- memcpy (tr->sr, sr0, sizeof (tr->sr));
+ clib_memcpy (tr->sr, sr0, sizeof (tr->sr));
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
/* remember the FIB index */
tx_fib_index = p[0];
- memcpy (key.src.as_u8, a->src_address->as_u8, sizeof (key.src));
- memcpy (key.dst.as_u8, a->dst_address->as_u8, sizeof (key.dst));
+ clib_memcpy (key.src.as_u8, a->src_address->as_u8, sizeof (key.src));
+ clib_memcpy (key.dst.as_u8, a->dst_address->as_u8, sizeof (key.dst));
p = hash_get_mem (sm->tunnel_index_by_key, &key);
pool_get (sm->tunnels, t);
memset (t, 0, sizeof (*t));
- memcpy (&t->key, &key, sizeof (t->key));
+ clib_memcpy (&t->key, &key, sizeof (t->key));
t->dst_mask_width = a->dst_mask_width;
t->rx_fib_index = rx_fib_index;
t->tx_fib_index = tx_fib_index;
vec_foreach (this_address, a->segments)
{
- memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t));
+ clib_memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t));
addrp--;
}
vec_foreach (this_address, a->tags)
{
- memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t));
+ clib_memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t));
addrp++;
}
key_copy = vec_new (ip6_sr_tunnel_key_t, 1);
- memcpy (key_copy, &key, sizeof (ip6_sr_tunnel_key_t));
+ clib_memcpy (key_copy, &key, sizeof (ip6_sr_tunnel_key_t));
hash_set_mem (sm->tunnel_index_by_key, key_copy, t - sm->tunnels);
memset(&adj, 0, sizeof (adj));
vec_add1 (add_adj, ap[0]);
- memcpy (aa.dst_address.as_u8, a->dst_address, sizeof (aa.dst_address.as_u8));
+ clib_memcpy (aa.dst_address.as_u8, a->dst_address, sizeof (aa.dst_address.as_u8));
aa.dst_address_length = a->dst_mask_width;
aa.flags = (a->is_del ? IP6_ROUTE_FLAG_DEL : IP6_ROUTE_FLAG_ADD);
&next_address))
{
vec_add2 (segments, this_seg, 1);
- memcpy (this_seg->as_u8, next_address.as_u8, sizeof (*this_seg));
+ clib_memcpy (this_seg->as_u8, next_address.as_u8, sizeof (*this_seg));
}
else if (unformat (input, "tag %U", unformat_ip6_address,
&tag))
{
vec_add2 (tags, this_tag, 1);
- memcpy (this_tag->as_u8, tag.as_u8, sizeof (*this_tag));
+ clib_memcpy (this_tag->as_u8, tag.as_u8, sizeof (*this_tag));
}
else if (unformat (input, "clean"))
flags |= IP6_SR_HEADER_FLAG_CLEANUP;
if (next0 != SR_FIX_DST_ADDR_NEXT_DROP)
{
t->adj_index = vnet_buffer(b0)->ip.adj_index[VLIB_TX];
- memcpy (t->src.as_u8, ip0->src_address.as_u8,
+ clib_memcpy (t->src.as_u8, ip0->src_address.as_u8,
sizeof (t->src.as_u8));
- memcpy (t->dst.as_u8, ip0->dst_address.as_u8,
+ clib_memcpy (t->dst.as_u8, ip0->dst_address.as_u8,
sizeof (t->dst.as_u8));
- memcpy (t->sr, sr0, sizeof (t->sr));
+ clib_memcpy (t->sr, sr0, sizeof (t->sr));
}
}
/* pkt ip6 src address */
vec_add2 (keybuf, copy_target, sizeof (ip6_address_t));
- memcpy (copy_target, ip->src_address.as_u8, sizeof (ip6_address_t));
+ clib_memcpy (copy_target, ip->src_address.as_u8, sizeof (ip6_address_t));
/* last segment */
vec_add2 (keybuf, copy_target, 1);
for (i = 0; i <= first_segment; i++)
{
vec_add2 (keybuf, copy_target, sizeof (ip6_address_t));
- memcpy (copy_target, addrp->as_u8, sizeof (ip6_address_t));
+ clib_memcpy (copy_target, addrp->as_u8, sizeof (ip6_address_t));
addrp++;
}
{
sr_local_trace_t *tr = vlib_add_trace (vm, node,
b0, sizeof (*tr));
- memcpy (tr->src.as_u8, ip0->src_address.as_u8,
+ clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
sizeof (tr->src.as_u8));
- memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
+ clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
sizeof (tr->dst.as_u8));
tr->length = vlib_buffer_length_in_chain (vm, b0);
tr->next_index = next0;
tr->sr_valid = sr0 != 0;
if (tr->sr_valid)
- memcpy (tr->sr, sr0, sizeof (tr->sr));
+ clib_memcpy (tr->sr, sr0, sizeof (tr->sr));
}
b1 = vlib_get_buffer (vm, bi1);
{
sr_local_trace_t *tr = vlib_add_trace (vm, node,
b1, sizeof (*tr));
- memcpy (tr->src.as_u8, ip1->src_address.as_u8,
+ clib_memcpy (tr->src.as_u8, ip1->src_address.as_u8,
sizeof (tr->src.as_u8));
- memcpy (tr->dst.as_u8, ip1->dst_address.as_u8,
+ clib_memcpy (tr->dst.as_u8, ip1->dst_address.as_u8,
sizeof (tr->dst.as_u8));
tr->length = vlib_buffer_length_in_chain (vm, b1);
tr->next_index = next1;
tr->sr_valid = sr1 != 0;
if (tr->sr_valid)
- memcpy (tr->sr, sr1, sizeof (tr->sr));
+ clib_memcpy (tr->sr, sr1, sizeof (tr->sr));
}
vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
{
sr_local_trace_t *tr = vlib_add_trace (vm, node,
b0, sizeof (*tr));
- memcpy (tr->src.as_u8, ip0->src_address.as_u8,
+ clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8,
sizeof (tr->src.as_u8));
- memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
+ clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8,
sizeof (tr->dst.as_u8));
tr->length = vlib_buffer_length_in_chain (vm, b0);
tr->next_index = next0;
tr->sr_valid = sr0 != 0;
if (tr->sr_valid)
- memcpy (tr->sr, sr0, sizeof (tr->sr));
+ clib_memcpy (tr->sr, sr0, sizeof (tr->sr));
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
return 0;
}
- memcpy (h->ethernet.src_address, hw->hw_address, sizeof (h->ethernet.src_address));
+ clib_memcpy (h->ethernet.src_address, hw->hw_address, sizeof (h->ethernet.src_address));
if (dst_address)
- memcpy (h->ethernet.dst_address, dst_address, sizeof (h->ethernet.dst_address));
+ clib_memcpy (h->ethernet.dst_address, dst_address, sizeof (h->ethernet.dst_address));
else
memset (h->ethernet.dst_address, ~0, sizeof (h->ethernet.dst_address)); /* broadcast */
}
/* Inherit MAC address from outer ring. */
- memcpy (si->my_address, hws[SRP_RING_OUTER]->hw_address,
+ clib_memcpy (si->my_address, hws[SRP_RING_OUTER]->hw_address,
vec_len (hws[SRP_RING_OUTER]->hw_address));
/* Default time to wait to restore signal. */
n_copy = clib_min (n_left_from, n_left_to_next);
- memcpy (to_next, from, n_copy * sizeof (from[0]));
+ clib_memcpy (to_next, from, n_copy * sizeof (from[0]));
n_left_to_next -= n_copy;
n_left_from -= n_copy;
for (i = 0; i < n_copy; i++)
return SRP_ERROR_TOPOLOGY_BAD_LENGTH;
/* Fill in our source MAC address. */
- memcpy (t->ethernet.src_address, hi->hw_address, vec_len (hi->hw_address));
+ clib_memcpy (t->ethernet.src_address, hi->hw_address, vec_len (hi->hw_address));
/* Make space for our MAC binding. */
vec_resize (*contents, sizeof (srp_topology_mac_binding_t));
mb->flags =
((t->srp.is_inner_ring ? SRP_TOPOLOGY_MAC_BINDING_FLAG_IS_INNER_RING : 0)
| (/* is wrapped FIXME */ 0));
- memcpy (mb->address, hi->hw_address, vec_len (hi->hw_address));
+ clib_memcpy (mb->address, hi->hw_address, vec_len (hi->hw_address));
t->control.checksum
= ~ip_csum_fold (ip_incremental_checksum (0, &t->control,
i->srp.mode = SRP_MODE_control_locally_buffered_for_host;
srp_header_compute_parity (&i->srp);
- memcpy (&i->ethernet.src_address, &si->my_address, sizeof (si->my_address));
+ clib_memcpy (&i->ethernet.src_address, &si->my_address, sizeof (si->my_address));
i->ethernet.type = clib_host_to_net_u16 (ETHERNET_TYPE_SRP_CONTROL);
/* Checksum will be filled in later. */
i->control.type = SRP_CONTROL_PACKET_TYPE_ips;
i->control.ttl = 255;
- memcpy (&i->originator_address, &si->my_address, sizeof (si->my_address));
+ clib_memcpy (&i->originator_address, &si->my_address, sizeof (si->my_address));
}
static void tx_ips_packet (srp_interface_t * si,
if (ir->rx_neighbor_address_valid)
{
p = serialize_get (m, sizeof (ir->rx_neighbor_address));
- memcpy (p, ir->rx_neighbor_address, sizeof (ir->rx_neighbor_address));
+ clib_memcpy (p, ir->rx_neighbor_address, sizeof (ir->rx_neighbor_address));
}
serialize_likely_small_unsigned_integer (m, ir->waiting_to_restore);
if (ir->waiting_to_restore)
if (ir->rx_neighbor_address_valid)
{
p = unserialize_get (m, sizeof (ir->rx_neighbor_address));
- memcpy (ir->rx_neighbor_address, p, sizeof (ir->rx_neighbor_address));
+ clib_memcpy (ir->rx_neighbor_address, p, sizeof (ir->rx_neighbor_address));
}
ir->waiting_to_restore = unserialize_likely_small_unsigned_integer (m);
if (ir->waiting_to_restore)
ASSERT (0);
}
ir->rx_neighbor_address_valid = 1;
- memcpy (ir->rx_neighbor_address, h->originator_address, sizeof (ir->rx_neighbor_address));
+ clib_memcpy (ir->rx_neighbor_address, h->originator_address, sizeof (ir->rx_neighbor_address));
}
switch (si->current_ips_state)
d = pcap_add_packet (pm, time_now, n_bytes_in_trace, n_left);
while (1)
{
- memcpy (d, b->data + b->current_data, b->current_length);
+ clib_memcpy (d, b->data + b->current_data, b->current_length);
n_left -= b->current_length;
if (n_left <= 0)
break;
ti = vec_elt_at_index (tm->tapcli_interfaces, hw->dev_instance);
- memcpy (&ifr, &ti->ifr, sizeof (ifr));
+ clib_memcpy (&ifr, &ti->ifr, sizeof (ifr));
/* get flags, modify to bring up interface... */
if (ioctl (ti->provision_fd, SIOCGIFFLAGS, &ifr) < 0)
ti = tapcli_get_new_tapif();
if (hwaddr_arg != 0)
- memcpy(hwaddr, hwaddr_arg, 6);
+ clib_memcpy(hwaddr, hwaddr_arg, 6);
error = ethernet_register_interface
(tm->vnet_main,
ti->unix_file_index = unix_file_add (&unix_main, &template);
ti->unix_fd = dev_net_tun_fd;
ti->provision_fd = dev_tap_fd;
- memcpy (&ti->ifr, &ifr, sizeof (ifr));
+ clib_memcpy (&ti->ifr, &ifr, sizeof (ifr));
}
{
rnd = (u32) (now * 1e6);
rnd = random_u32 (&rnd);
- memcpy (hwaddr+2, &rnd, sizeof(rnd));
+ clib_memcpy (hwaddr+2, &rnd, sizeof(rnd));
hwaddr[0] = 2;
hwaddr[1] = 0xfe;
user_hwaddr = 1;
ti->unix_file_index = unix_file_add (&unix_main, &template);
ti->unix_fd = dev_net_tun_fd;
ti->provision_fd = dev_tap_fd;
- memcpy (&ti->ifr, &ifr, sizeof (ifr));
+ clib_memcpy (&ti->ifr, &ifr, sizeof (ifr));
}
{
if (tm->is_ether && (!tm->have_normal_interface))
{
vlib_buffer_reset(b);
- memcpy (vlib_buffer_get_current (b), tm->ether_dst_mac, 6);
+ clib_memcpy (vlib_buffer_get_current (b), tm->ether_dst_mac, 6);
}
/* Re-set iovecs if present. */
goto done;
}
else
- memcpy (tm->ether_dst_mac, ifr.ifr_hwaddr.sa_data, 6);
+ clib_memcpy (tm->ether_dst_mac, ifr.ifr_hwaddr.sa_data, 6);
}
if (have_normal_interface)
/* See if we already know about this subif */
memset (&subif_addr, 0, sizeof (subif_addr));
subif_addr.sw_if_index = sw_if_index;
- memcpy (&subif_addr.addr, address, sizeof (*address));
+ clib_memcpy (&subif_addr.addr, address, sizeof (*address));
p = mhash_get (&tm->subif_mhash, &subif_addr);
/* Set ipv4 address, netmask. */
sin->sin_family = AF_INET;
- memcpy (&sin->sin_addr.s_addr, address, 4);
+ clib_memcpy (&sin->sin_addr.s_addr, address, 4);
if (ioctl (tm->dev_tap_fd, SIOCSIFADDR, &ifr) < 0)
clib_unix_warning ("ioctl SIOCSIFADDR");
memset (&subif_addr, 0, sizeof (subif_addr));
subif_addr.sw_if_index = sw_if_index;
subif_addr.is_v6 = 1;
- memcpy (&subif_addr.addr, address, sizeof (*address));
+ clib_memcpy (&subif_addr.addr, address, sizeof (*address));
p = mhash_get (&tm->subif_mhash, &subif_addr);
ifr6.ifr6_ifindex = ifr.ifr_ifindex;
ifr6.ifr6_prefixlen = address_length;
- memcpy (&ifr6.ifr6_addr, address, 16);
+ clib_memcpy (&ifr6.ifr6_addr, address, 16);
if (ioctl (sockfd, SIOCSIFADDR, &ifr6) < 0)
clib_unix_warning ("set address");
ifr6.ifr6_ifindex = ifr.ifr_ifindex;
ifr6.ifr6_prefixlen = address_length;
- memcpy (&ifr6.ifr6_addr, address, 16);
+ clib_memcpy (&ifr6.ifr6_addr, address, 16);
if (ioctl (sockfd, SIOCDIFADDR, &ifr6) < 0)
clib_unix_warning ("del address");
memset(status_str, 0x00, sizeof(status_str));
switch(my_vrfmap->status) {
- case S_WAO: memcpy(status_str, "S_WAO", 5); break;
- case S_WA: memcpy(status_str, "S_WA", 4); break;
- case S_WO: memcpy(status_str, "S_WO", 4); break;
- case S_RUN: memcpy(status_str, "ONLINE", 6); break;
- case S_DEL: memcpy(status_str, "S_DEL", 5); break;
- default: memcpy(status_str, "Invalid state", 13);
+ case S_WAO: clib_memcpy(status_str, "S_WAO", 5); break;
+ case S_WA: clib_memcpy(status_str, "S_WA", 4); break;
+ case S_WO: clib_memcpy(status_str, "S_WO", 4); break;
+ case S_RUN: clib_memcpy(status_str, "ONLINE", 6); break;
+ case S_DEL: clib_memcpy(status_str, "S_DEL", 5); break;
+ default: clib_memcpy(status_str, "Invalid state", 13);
}
vlib_cli_output(vm,
case CNAT_DEBUG_GENERIC_COMMAND_READ_MEM:
start_locn = spp_net_to_host_byte_order_32(&mp->params[1]);
num_bytes = spp_net_to_host_byte_order_32(&mp->params[2]);
- memcpy(&(resp_ptr->raw_data[0]), (u8 *) start_locn, num_bytes);
+ clib_memcpy(&(resp_ptr->raw_data[0]), (u8 *) start_locn, num_bytes);
resp_ptr->num_bytes = spp_host_to_net_byte_order_32(num_bytes);
#ifdef SHOW_DEBUG
return;
}
- memcpy((u8 *) start_locn, &(mp->params[3]), num_bytes);
+ clib_memcpy((u8 *) start_locn, &(mp->params[3]), num_bytes);
resp_ptr->num_bytes = 0;
break;
nfv9_logging_info->nfv9_template_header =
(cnat_nfv9_template_t *) nfv9_logging_info->next_data_ptr;
- memcpy(nfv9_logging_info->nfv9_template_header,
+ clib_memcpy(nfv9_logging_info->nfv9_template_header,
&cnat_nfv9_template_info,
sizeof(cnat_nfv9_template_info));
nfv9_logging_add_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[NAT44_ADD_RECORD],
+ clib_memcpy(nfv9_logging_info->record[NAT44_ADD_RECORD],
&nfv9_logging_add_record, CNAT_NFV9_ADD_RECORD_LENGTH);
nfv9_logging_info->record_length[NAT44_ADD_RECORD]
((my_proto_mask == CNAT_ICMP) ? ICMP_PROT : 0)));
nfv9_logging_add_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[DS_LITE_ADD_RECORD],
+ clib_memcpy(nfv9_logging_info->record[DS_LITE_ADD_RECORD],
&nfv9_logging_add_record, CNAT_NFV9_DS_LITE_ADD_RECORD_LENGTH);
nfv9_logging_info->record_length[DS_LITE_ADD_RECORD]
((my_proto_mask == CNAT_ICMP) ? ICMP_PROT : 0)));
nfv9_logging_del_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[DS_LITE_DEL_RECORD],
+ clib_memcpy(nfv9_logging_info->record[DS_LITE_DEL_RECORD],
&nfv9_logging_del_record, CNAT_NFV9_DS_LITE_DEL_RECORD_LENGTH);
nfv9_logging_info->record_length[DS_LITE_DEL_RECORD] +=
nfv9_logging_bulk_add_record.outside_ip_port_end =
clib_host_to_net_u16(bulk_alloc_start_port + bulk_size -1);
- memcpy(nfv9_logging_info->record[NAT44_BULK_ADD_RECORD],
+ clib_memcpy(nfv9_logging_info->record[NAT44_BULK_ADD_RECORD],
&nfv9_logging_bulk_add_record, CNAT_NFV9_BULK_ADD_RECORD_LENGTH);
nfv9_logging_info->record_length[NAT44_BULK_ADD_RECORD]
nfv9_logging_bulk_add_record.outside_ip_port_end =
clib_host_to_net_u16(bulk_alloc_start_port + bulk_size -1);
- memcpy(nfv9_logging_info->record[DS_LITE_BULK_ADD_RECORD],
+ clib_memcpy(nfv9_logging_info->record[DS_LITE_BULK_ADD_RECORD],
&nfv9_logging_bulk_add_record, CNAT_NFV9_DS_LITE_BULK_ADD_RECORD_LENGTH);
nfv9_logging_info->record_length[DS_LITE_BULK_ADD_RECORD]
nfv9_logging_bulk_del_record.outside_ip_port_start =
clib_host_to_net_u16(bulk_alloc_start_port);
- memcpy(nfv9_logging_info->record[DS_LITE_BULK_DEL_RECORD],
+ clib_memcpy(nfv9_logging_info->record[DS_LITE_BULK_DEL_RECORD],
&nfv9_logging_bulk_del_record,
CNAT_NFV9_DS_LITE_BULK_DEL_RECORD_LENGTH);
nfv9_logging_info->record_length[DS_LITE_BULK_DEL_RECORD] +=
nfv9_logging_del_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[NAT44_DEL_RECORD],
+ clib_memcpy(nfv9_logging_info->record[NAT44_DEL_RECORD],
&nfv9_logging_del_record, CNAT_NFV9_DEL_RECORD_LENGTH);
nfv9_logging_info->record_length[NAT44_DEL_RECORD]
nfv9_logging_bulk_del_record.outside_ip_port_start =
clib_host_to_net_u16(bulk_alloc_start_port);
- memcpy(nfv9_logging_info->record[NAT44_BULK_DEL_RECORD],
+ clib_memcpy(nfv9_logging_info->record[NAT44_BULK_DEL_RECORD],
&nfv9_logging_bulk_del_record, CNAT_NFV9_BULK_DEL_RECORD_LENGTH);
nfv9_logging_info->record_length[NAT44_BULK_DEL_RECORD]
nfv9_logging_add_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[NAT64_ADD_BIB_RECORD],
+ clib_memcpy(nfv9_logging_info->record[NAT64_ADD_BIB_RECORD],
&nfv9_logging_add_record, CNAT_NFV9_NAT64_ADD_BIB_RECORD_LENGTH);
nfv9_logging_info->record_length[NAT64_ADD_BIB_RECORD] +=
nfv9_logging_add_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[NAT64_ADD_SESSION_RECORD],
+ clib_memcpy(nfv9_logging_info->record[NAT64_ADD_SESSION_RECORD],
&nfv9_logging_add_record, CNAT_NFV9_NAT64_ADD_SESSION_RECORD_LENGTH);
nfv9_logging_info->record_length[NAT64_ADD_SESSION_RECORD] +=
nfv9_logging_del_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[NAT64_DEL_BIB_RECORD],
+ clib_memcpy(nfv9_logging_info->record[NAT64_DEL_BIB_RECORD],
&nfv9_logging_del_record, CNAT_NFV9_NAT64_DEL_BIB_RECORD_LENGTH);
nfv9_logging_info->record_length[NAT64_DEL_BIB_RECORD] +=
((my_proto_mask == CNAT_ICMP) ? IPV6_PROTO_ICMPV6 : 0)));
nfv9_logging_del_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[NAT64_DEL_SESSION_RECORD],
+ clib_memcpy(nfv9_logging_info->record[NAT64_DEL_SESSION_RECORD],
&nfv9_logging_del_record, CNAT_NFV9_NAT64_DEL_SESSION_RECORD_LENGTH);
nfv9_logging_info->record_length[NAT64_DEL_SESSION_RECORD] +=
((my_proto_mask == CNAT_ICMP) ? ICMP_PROT : GRE_PROT)));
nfv9_logging_add_session_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[NAT44_ADD_SESSION_RECORD],
+ clib_memcpy(nfv9_logging_info->record[NAT44_ADD_SESSION_RECORD],
&nfv9_logging_add_session_record,
CNAT_NFV9_NAT44_ADD_SESSION_RECORD_LENGTH);
nfv9_logging_del_session_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[NAT44_DEL_SESSION_RECORD],
+ clib_memcpy(nfv9_logging_info->record[NAT44_DEL_SESSION_RECORD],
&nfv9_logging_del_session_record,
CNAT_NFV9_NAT44_DEL_SESSION_RECORD_LENGTH);
((my_proto_mask == CNAT_ICMP) ? ICMP_PROT : 0)));
nfv9_logging_add_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[DS_LITE_ADD_SESSION_RECORD],
+ clib_memcpy(nfv9_logging_info->record[DS_LITE_ADD_SESSION_RECORD],
&nfv9_logging_add_record, CNAT_NFV9_DS_LITE_ADD_SESSION_RECORD_LENGTH);
nfv9_logging_info->record_length[DS_LITE_ADD_SESSION_RECORD]
((my_proto_mask == CNAT_ICMP) ? ICMP_PROT : 0)));
nfv9_logging_add_record.protocol = my_protocol;
- memcpy(nfv9_logging_info->record[DS_LITE_DEL_SESSION_RECORD],
+ clib_memcpy(nfv9_logging_info->record[DS_LITE_DEL_SESSION_RECORD],
&nfv9_logging_add_record, CNAT_NFV9_DS_LITE_DEL_SESSION_RECORD_LENGTH);
nfv9_logging_info->record_length[DS_LITE_DEL_SESSION_RECORD]
nfv9_ingress_vrfid_name_record.ingress_vrf_id =
clib_host_to_net_u32(vrfid_name_map[index].vrf_id);
- memcpy(nfv9_ingress_vrfid_name_record.ingress_vrf_name,
+ clib_memcpy(nfv9_ingress_vrfid_name_record.ingress_vrf_name,
vrfid_name_map[index].vrf_name, NFV9_VRF_NAME_LEN);
- memcpy(nfv9_logging_info->record[INGRESS_VRF_ID_NAME_RECORD],
+ clib_memcpy(nfv9_logging_info->record[INGRESS_VRF_ID_NAME_RECORD],
&nfv9_ingress_vrfid_name_record,
CNAT_NFV9_INGRESS_VRFID_NAME_RECORD_LENGTH);
ts += u16_to_ascii_decimal_unaligned(ts, (tm1.tm_year + 1900));
*ts++ = SYSLOG_DELIMITER;
/* Month */
- memcpy(ts, months[tm1.tm_mon], 4);
+ clib_memcpy(ts, months[tm1.tm_mon], 4);
ts += 4; /* DELIMITER taken care */
/* day */
ts += u16_to_ascii_decimal_unaligned(ts, tm1.tm_mday);
temp += syslog_get_timestamp(temp);
*temp++ = SYSLOG_DELIMITER;
count = strlen(log_info->header_hostname);
- memcpy(temp, log_info->header_hostname, count);
+ clib_memcpy(temp, log_info->header_hostname, count);
temp += count;
*temp++ = SYSLOG_DELIMITER;
*temp++ = SYSLOG_FIELD_ABSENT; /* App name - nil value */
*temp++ = SYSLOG_DELIMITER;
/* Now the msg id */
count = strlen(syslog_service_string[s_type]);
- memcpy(temp, syslog_service_string[s_type], count);
+ clib_memcpy(temp, syslog_service_string[s_type], count);
temp += count;
*temp++ = SYSLOG_DELIMITER;
*temp++ = SYSLOG_FIELD_ABSENT; /* No structured elements */
*record++ = '['; /* Open the record */
/* Copy the record type */
- memcpy(record, sys_log_event[e_type].event_name,
+ clib_memcpy(record, sys_log_event[e_type].event_name,
sys_log_event[e_type].name_length);
record += sys_log_event[e_type].name_length;
*record++ = SYSLOG_DELIMITER;
*record++ = SYSLOG_DELIMITER;
/* copy configured VRF NAME */
- memcpy(record, log_info->vrf_name, log_info->vrf_name_len);
+ clib_memcpy(record, log_info->vrf_name, log_info->vrf_name_len);
record += log_info->vrf_name_len;
*record++ = SYSLOG_DELIMITER;
*record++ = '['; /* Open the record */
/* Copy the record type */
- memcpy(record, sys_log_event[e_type].event_name,
+ clib_memcpy(record, sys_log_event[e_type].event_name,
sys_log_event[e_type].name_length);
record += sys_log_event[e_type].name_length;
*record++ = SYSLOG_DELIMITER;
*record++ = SYSLOG_DELIMITER;
/* copy configured VRF NAME */
- memcpy(record, log_info->vrf_name, log_info->vrf_name_len);
+ clib_memcpy(record, log_info->vrf_name, log_info->vrf_name_len);
record += log_info->vrf_name_len;
*record++ = SYSLOG_DELIMITER;
*record++ = '['; /* Open the record */
/* Copy the record type */
- memcpy(record, sys_log_event[port_block_runout].event_name,
+ clib_memcpy(record, sys_log_event[port_block_runout].event_name,
sys_log_event[port_block_runout].name_length);
record += sys_log_event[port_block_runout].name_length;
*record++ = SYSLOG_DELIMITER;
*record++ = SYSLOG_DELIMITER;
/* copy configured VRF NAME */
- memcpy(record, log_info->vrf_name, log_info->vrf_name_len);
+ clib_memcpy(record, log_info->vrf_name, log_info->vrf_name_len);
record += log_info->vrf_name_len;
*record++ = SYSLOG_DELIMITER;
*record++ = '['; /* Open the record */
/* Copy the record type */
- memcpy(record, sys_log_event[port_block_runout].event_name,
+ clib_memcpy(record, sys_log_event[port_block_runout].event_name,
sys_log_event[port_block_runout].name_length);
record += sys_log_event[port_block_runout].name_length;
*record++ = SYSLOG_DELIMITER;
*record++ = SYSLOG_DELIMITER;
/* copy configured VRF NAME */
- memcpy(record, log_info->vrf_name, log_info->vrf_name_len);
+ clib_memcpy(record, log_info->vrf_name, log_info->vrf_name_len);
record += log_info->vrf_name_len;
*record++ = SYSLOG_DELIMITER;
*record++ = '['; /* Open the record */
/* Copy the record type */
- memcpy(record, sys_log_event[tcp_seq_mismatch].event_name,
+ clib_memcpy(record, sys_log_event[tcp_seq_mismatch].event_name,
sys_log_event[tcp_seq_mismatch].name_length);
record += sys_log_event[tcp_seq_mismatch].name_length;
*record++ = SYSLOG_DELIMITER;
*record++ = SYSLOG_DELIMITER;
/* copy configured VRF NAME */
- memcpy(record, log_info->vrf_name, log_info->vrf_name_len);
+ clib_memcpy(record, log_info->vrf_name, log_info->vrf_name_len);
record += log_info->vrf_name_len;
*record++ = SYSLOG_DELIMITER;
/* Create a new one, initialize and return */
server = 0;
pool_get(nfv9_server_info_pool, server);
- memcpy(server, new_server_info, sizeof(nfv9_server_info_t));
+ clib_memcpy(server, new_server_info, sizeof(nfv9_server_info_t));
server->ref_count = 1;
nfv9_info->server_index = server - nfv9_server_info_pool;
#ifdef DEBUG_NF_SERVER_CONFIG
address = vec_elt_at_index(addresses, vec_len(addresses) - 1);
- memcpy(&address->ip, &mp->ip, sizeof(address->ip));
+ clib_memcpy(&address->ip, &mp->ip, sizeof(address->ip));
address->prefix_length = mp->prefix_length;
#undef addresses
}
vat_json_init_object(node);
if (vam->is_ipv6) {
- memcpy(&ip6, mp->ip, sizeof(ip6));
+ clib_memcpy(&ip6, mp->ip, sizeof(ip6));
vat_json_object_add_ip6(node, "ip", ip6);
} else {
- memcpy(&ip4, mp->ip, sizeof(ip4));
+ clib_memcpy(&ip4, mp->ip, sizeof(ip4));
vat_json_object_add_ip4(node, "ip", ip4);
}
vat_json_object_add_uint(node, "prefix_length", mp->prefix_length);
vat_json_init_object(node);
vat_json_object_add_uint(node, "domain_index", clib_net_to_host_u32(mp->domain_index));
- memcpy(&ip6, mp->ip6_prefix, sizeof(ip6));
+ clib_memcpy(&ip6, mp->ip6_prefix, sizeof(ip6));
vat_json_object_add_ip6(node, "ip6_prefix", ip6);
- memcpy(&ip4, mp->ip4_prefix, sizeof(ip4));
+ clib_memcpy(&ip4, mp->ip4_prefix, sizeof(ip4));
vat_json_object_add_ip4(node, "ip4_prefix", ip4);
- memcpy(&ip6, mp->ip6_src, sizeof(ip6));
+ clib_memcpy(&ip6, mp->ip6_src, sizeof(ip6));
vat_json_object_add_ip6(node, "ip6_src", ip6);
vat_json_object_add_int(node, "ip6_prefix_len", mp->ip6_prefix_len);
vat_json_object_add_int(node, "ip4_prefix_len", mp->ip4_prefix_len);
vat_json_init_object(node);
vat_json_object_add_uint(node, "psid", clib_net_to_host_u16(mp->psid));
- memcpy(&ip6, mp->ip6_dst, sizeof(ip6));
+ clib_memcpy(&ip6, mp->ip6_dst, sizeof(ip6));
vat_json_object_add_ip6(node, "ip6_dst", ip6);
}
for (i = 0; i < count; i++) {
vec_validate(vam->ip4_fib_counters[vrf_index], i);
counter = &vam->ip4_fib_counters[vrf_index][i];
- memcpy(&ip4, &v->address, sizeof(ip4));
+ clib_memcpy(&ip4, &v->address, sizeof(ip4));
counter->address = ip4;
counter->address_length = v->address_length;
counter->packets = clib_net_to_host_u64(v->packets);
for (i = 0; i < count; i++) {
vec_validate(vam->ip6_fib_counters[vrf_index], i);
counter = &vam->ip6_fib_counters[vrf_index][i];
- memcpy(&ip6, &v->address, sizeof(ip6));
+ clib_memcpy(&ip6, &v->address, sizeof(ip6));
counter->address = ip6;
counter->address_length = v->address_length;
counter->packets = clib_net_to_host_u64(v->packets);
vat_json_init_object(node);
vat_json_object_add_string_copy(node, "locator-set", mp->locator_set_name);
if (mp->eid_is_ipv6) {
- memcpy(&ip6, mp->eid_ip_address, sizeof(ip6));
+ clib_memcpy(&ip6, mp->eid_ip_address, sizeof(ip6));
vat_json_object_add_ip6(node, "eid address", ip6);
} else {
- memcpy(&ip4, mp->eid_ip_address, sizeof(ip4));
+ clib_memcpy(&ip4, mp->eid_ip_address, sizeof(ip4));
vat_json_object_add_ip4(node, "eid address", ip4);
}
vat_json_object_add_uint(node, "eid prefix len", mp->eid_prefix_len);
vat_json_init_object(node);
vat_json_object_add_uint(node, "tunel", mp->tunnels);
if (mp->is_ipv6) {
- memcpy(&ip6, mp->source_ip, sizeof(ip6));
+ clib_memcpy(&ip6, mp->source_ip, sizeof(ip6));
vat_json_object_add_ip6(node, "source address", ip6);
- memcpy(&ip6, mp->destination_ip, sizeof(ip6));
+ clib_memcpy(&ip6, mp->destination_ip, sizeof(ip6));
vat_json_object_add_ip6(node, "destination address", ip6);
} else {
- memcpy(&ip4, mp->source_ip, sizeof(ip4));
+ clib_memcpy(&ip4, mp->source_ip, sizeof(ip4));
vat_json_object_add_ip4(node, "source address", ip4);
- memcpy(&ip4, mp->destination_ip, sizeof(ip4));
+ clib_memcpy(&ip4, mp->destination_ip, sizeof(ip4));
vat_json_object_add_ip4(node, "destination address", ip4);
}
vat_json_object_add_uint(node, "fib encap", ntohl(mp->encap_fib_id));
vat_json_init_object(node);
if (mp->is_ipv6) {
- memcpy(&ip6, mp->ip_address, sizeof(ip6));
+ clib_memcpy(&ip6, mp->ip_address, sizeof(ip6));
vat_json_object_add_ip6(node, "map resolver", ip6);
} else {
- memcpy(&ip4, mp->ip_address, sizeof(ip4));
+ clib_memcpy(&ip4, mp->ip_address, sizeof(ip4));
vat_json_object_add_ip4(node, "map resolver", ip4);
}
}
oldheap = svm_push_data_heap (am->vlib_rp);
vec_validate (cmd, vec_len(vam->input->buffer)-1);
- memcpy (cmd, vam->input->buffer, vec_len(vam->input->buffer));
+ clib_memcpy (cmd, vam->input->buffer, vec_len(vam->input->buffer));
svm_pop_heap (oldheap);
pthread_mutex_unlock (&am->vlib_rp->mutex);
/* Construct the API message */
M(CREATE_LOOPBACK, create_loopback);
if (mac_set)
- memcpy (mp->mac_address, mac_address, sizeof (mac_address));
+ clib_memcpy (mp->mac_address, mac_address, sizeof (mac_address));
S; W;
}
mp->del_all = del_all;
if (v6_address_set) {
mp->is_ipv6 = 1;
- memcpy (mp->address, &v6address, sizeof (v6address));
+ clib_memcpy (mp->address, &v6address, sizeof (v6address));
} else {
- memcpy (mp->address, &v4address, sizeof (v4address));
+ clib_memcpy (mp->address, &v4address, sizeof (v4address));
}
mp->address_length = address_length;
mp->is_ipv6 = is_ipv6;
mp->is_add = is_add;
if (is_ipv6)
- memcpy (mp->ip_address, &v6addr, sizeof (v6addr));
- else memcpy (mp->ip_address, &v4addr, sizeof (v4addr));
- memcpy (mp->mac_address, macaddr, 6);
+ clib_memcpy (mp->ip_address, &v6addr, sizeof (v6addr));
+ else clib_memcpy (mp->ip_address, &v4addr, sizeof (v4addr));
+ clib_memcpy (mp->mac_address, macaddr, 6);
S; W;
/* NOTREACHED */
return 0;
M(TAP_CONNECT, tap_connect);
mp->use_random_mac = random_mac;
- memcpy (mp->mac_address, mac_address, 6);
- memcpy (mp->tap_name, tap_name, vec_len (tap_name));
+ clib_memcpy (mp->mac_address, mac_address, 6);
+ clib_memcpy (mp->tap_name, tap_name, vec_len (tap_name));
vec_free (tap_name);
/* send it... */
mp->use_random_mac = random_mac;
mp->sw_if_index = ntohl(sw_if_index);
- memcpy (mp->mac_address, mac_address, 6);
- memcpy (mp->tap_name, tap_name, vec_len (tap_name));
+ clib_memcpy (mp->mac_address, mac_address, 6);
+ clib_memcpy (mp->tap_name, tap_name, vec_len (tap_name));
vec_free (tap_name);
/* send it... */
mp->classify_table_index = ntohl(classify_table_index);
if (is_ipv6){
- memcpy (mp->dst_address, &v6_dst_address, sizeof (v6_dst_address));
+ clib_memcpy (mp->dst_address, &v6_dst_address, sizeof (v6_dst_address));
if (next_hop_set)
- memcpy (mp->next_hop_address, &v6_next_hop_address,
+ clib_memcpy (mp->next_hop_address, &v6_next_hop_address,
sizeof (v6_next_hop_address));
increment_v6_address (&v6_dst_address);
} else {
- memcpy (mp->dst_address, &v4_dst_address, sizeof (v4_dst_address));
+ clib_memcpy (mp->dst_address, &v4_dst_address, sizeof (v4_dst_address));
if (next_hop_set)
- memcpy (mp->next_hop_address, &v4_next_hop_address,
+ clib_memcpy (mp->next_hop_address, &v4_next_hop_address,
sizeof (v4_next_hop_address));
if (random_add_del)
v4_dst_address.as_u32 = random_vector[j+1];
mp->vrf_id = ntohl(vrf_id);
mp->is_add = is_add;
- memcpy(mp->low_address, &lo, sizeof (mp->low_address));
- memcpy(mp->hi_address, &hi, sizeof (mp->hi_address));
+ clib_memcpy(mp->low_address, &lo, sizeof (mp->low_address));
+ clib_memcpy(mp->hi_address, &hi, sizeof (mp->hi_address));
S; W;
/* NOTREACHED */
sizeof (u32) * vec_len (labels));
mp->vrf_id = ntohl(vrf_id);
- memcpy(mp->dst_address, &dst_address, sizeof (dst_address));
+ clib_memcpy(mp->dst_address, &dst_address, sizeof (dst_address));
mp->is_add = is_add;
mp->nlabels = vec_len (labels);
- memcpy(mp->labels, labels, sizeof(u32)*mp->nlabels);
+ clib_memcpy(mp->labels, labels, sizeof(u32)*mp->nlabels);
vec_free(labels);
mp->inner_vrf_id = ntohl(inner_vrf_id);
mp->outer_vrf_id = ntohl(outer_vrf_id);
- memcpy(mp->src_address, &src_address, sizeof (src_address));
- memcpy(mp->dst_address, &dst_address, sizeof (dst_address));
- memcpy(mp->intfc_address, &intfc_address, sizeof (intfc_address));
+ clib_memcpy(mp->src_address, &src_address, sizeof (src_address));
+ clib_memcpy(mp->dst_address, &dst_address, sizeof (dst_address));
+ clib_memcpy(mp->intfc_address, &intfc_address, sizeof (intfc_address));
mp->intfc_address_length = intfc_address_length;
mp->l2_only = l2_only;
mp->is_add = is_add;
M(MPLS_ETHERNET_ADD_DEL_TUNNEL, mpls_ethernet_add_del_tunnel);
mp->vrf_id = ntohl(inner_vrf_id);
- memcpy (mp->adj_address, &intfc_address, sizeof (intfc_address));
+ clib_memcpy (mp->adj_address, &intfc_address, sizeof (intfc_address));
mp->adj_address_length = intfc_address_length;
- memcpy (mp->dst_mac_address, dst_mac_address, sizeof (dst_mac_address));
+ clib_memcpy (mp->dst_mac_address, dst_mac_address, sizeof (dst_mac_address));
mp->tx_sw_if_index = ntohl(tx_sw_if_index);
mp->l2_only = l2_only;
mp->is_add = is_add;
mp->resolve_if_needed = resolve_if_needed;
mp->is_add = is_add;
mp->l2_only = l2_only;
- memcpy (mp->adj_address, &adj_address, sizeof (adj_address));
+ clib_memcpy (mp->adj_address, &adj_address, sizeof (adj_address));
mp->adj_address_length = adj_address_length;
- memcpy (mp->next_hop_ip4_address_in_outer_vrf, &next_hop_address,
+ clib_memcpy (mp->next_hop_ip4_address_in_outer_vrf, &next_hop_address,
sizeof (next_hop_address));
S; W;
mp->vrf_id = ntohl (vrf_id);
mp->is_static = is_static;
if (mac_set)
- memcpy (mp->mac_address, mac_address, 6);
+ clib_memcpy (mp->mac_address, mac_address, 6);
if (v6_address_set) {
mp->is_ipv6 = 1;
- memcpy (mp->dst_address, &v6address, sizeof (v6address));
+ clib_memcpy (mp->dst_address, &v6address, sizeof (v6address));
} else {
/* mp->is_ipv6 = 0; via memset in M macro above */
- memcpy (mp->dst_address, &v4address, sizeof (v4address));
+ clib_memcpy (mp->dst_address, &v4address, sizeof (v4address));
}
/* send it... */
mp->vrf_id = ntohl(vrf_id);
mp->is_add = is_add;
- memcpy(mp->src_address, &src, sizeof (mp->src_address));
- memcpy(mp->dst_address, &dst, sizeof (mp->dst_address));
+ clib_memcpy(mp->src_address, &src, sizeof (mp->src_address));
+ clib_memcpy(mp->dst_address, &dst, sizeof (mp->dst_address));
S; W;
/* NOTREACHED */
mp->vrf_id = ntohl (vrf_id);
if (v6_address_set) {
mp->is_ipv6 = 1;
- memcpy (mp->dhcp_server, &v6address, sizeof (v6address));
- memcpy (mp->dhcp_src_address, &v6srcaddress, sizeof (v6address));
+ clib_memcpy (mp->dhcp_server, &v6address, sizeof (v6address));
+ clib_memcpy (mp->dhcp_src_address, &v6srcaddress, sizeof (v6address));
} else {
- memcpy (mp->dhcp_server, &v4address, sizeof (v4address));
- memcpy (mp->dhcp_src_address, &v4srcaddress, sizeof (v4address));
+ clib_memcpy (mp->dhcp_server, &v4address, sizeof (v4address));
+ clib_memcpy (mp->dhcp_src_address, &v4srcaddress, sizeof (v4address));
}
/* send it... */
mp->server_vrf_id = ntohl (server_vrf_id);
if (v6_address_set) {
mp->is_ipv6 = 1;
- memcpy (mp->dhcp_server, &v6address, sizeof (v6address));
- memcpy (mp->dhcp_src_address, &v6srcaddress, sizeof (v6address));
+ clib_memcpy (mp->dhcp_server, &v6address, sizeof (v6address));
+ clib_memcpy (mp->dhcp_src_address, &v6srcaddress, sizeof (v6address));
} else {
- memcpy (mp->dhcp_server, &v4address, sizeof (v4address));
- memcpy (mp->dhcp_src_address, &v4srcaddress, sizeof (v4address));
+ clib_memcpy (mp->dhcp_server, &v4address, sizeof (v4address));
+ clib_memcpy (mp->dhcp_src_address, &v4srcaddress, sizeof (v4address));
}
/* send it... */
M(DHCP_CLIENT_CONFIG, dhcp_client_config);
mp->sw_if_index = ntohl (sw_if_index);
- memcpy (mp->hostname, hostname, vec_len (hostname));
+ clib_memcpy (mp->hostname, hostname, vec_len (hostname));
vec_free (hostname);
mp->is_add = is_add;
mp->want_dhcp_event = disable_event ? 0 : 1;
sw_interface_ip6_set_link_local_address);
mp->sw_if_index = ntohl (sw_if_index);
- memcpy (mp->address, &v6address, sizeof (v6address));
+ clib_memcpy (mp->address, &v6address, sizeof (v6address));
mp->address_length = address_length;
/* send it... */
M(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix);
mp->sw_if_index = ntohl (sw_if_index);
- memcpy (mp->address, &v6address, sizeof (v6address));
+ clib_memcpy (mp->address, &v6address, sizeof (v6address));
mp->address_length = address_length;
mp->use_default = use_default;
mp->no_advertise = no_advertise;
return -99;
}
M(TRACE_PROFILE_APPLY, trace_profile_apply);
- memcpy(mp->dest_ipv6, &addr, sizeof(mp->dest_ipv6));
+ clib_memcpy(mp->dest_ipv6, &addr, sizeof(mp->dest_ipv6));
mp->id = htons(id);
mp->prefix_length = htonl(mask_width);
mp->vrf_id = htonl(vrf_id);
&next_address))
{
vec_add2 (segments, this_seg, 1);
- memcpy (this_seg->as_u8, next_address.as_u8, sizeof (*this_seg));
+ clib_memcpy (this_seg->as_u8, next_address.as_u8, sizeof (*this_seg));
}
else if (unformat (i, "tag %U", unformat_ip6_address,
&tag))
{
vec_add2 (tags, this_tag, 1);
- memcpy (this_tag->as_u8, tag.as_u8, sizeof (*this_tag));
+ clib_memcpy (this_tag->as_u8, tag.as_u8, sizeof (*this_tag));
}
else if (unformat (i, "clean"))
flags |= IP6_SR_HEADER_FLAG_CLEANUP;
vec_len(segments) * sizeof (ip6_address_t)
+ vec_len(tags) * sizeof (ip6_address_t));
- memcpy (mp->src_address, &src_address, sizeof (mp->src_address));
- memcpy (mp->dst_address, &dst_address, sizeof (mp->dst_address));
+ clib_memcpy (mp->src_address, &src_address, sizeof (mp->src_address));
+ clib_memcpy (mp->dst_address, &dst_address, sizeof (mp->dst_address));
mp->dst_mask_width = dst_mask_width;
mp->flags_net_byte_order = clib_host_to_net_u16 (flags);
mp->n_segments = vec_len (segments);
mp->n_tags = vec_len (tags);
mp->is_add = is_del == 0;
- memcpy (mp->segs_and_tags, segments,
+ clib_memcpy (mp->segs_and_tags, segments,
vec_len(segments)* sizeof (ip6_address_t));
- memcpy (mp->segs_and_tags + vec_len(segments)*sizeof (ip6_address_t),
+ clib_memcpy (mp->segs_and_tags + vec_len(segments)*sizeof (ip6_address_t),
tags, vec_len(tags)* sizeof (ip6_address_t));
mp->outer_vrf_id = ntohl (rx_table_id);
mp->match_n_vectors = ntohl(match);
mp->next_table_index = ntohl(next_table_index);
mp->miss_next_index = ntohl(miss_next_index);
- memcpy (mp->mask, mask, vec_len(mask));
+ clib_memcpy (mp->mask, mask, vec_len(mask));
vec_free(mask);
ip = (ip6_header_t *) match;
if (src)
- memcpy (&ip->src_address, &src_val, sizeof (ip->src_address));
+ clib_memcpy (&ip->src_address, &src_val, sizeof (ip->src_address));
if (dst)
- memcpy (&ip->dst_address, &dst_val, sizeof (ip->dst_address));
+ clib_memcpy (&ip->dst_address, &dst_val, sizeof (ip->dst_address));
if (proto)
ip->protocol = proto_val;
vec_validate_aligned (match, len-1, sizeof(u32x4));
if (dst)
- memcpy (match, dst_val, 6);
+ clib_memcpy (match, dst_val, 6);
if (src)
- memcpy (match + 6, src_val, 6);
+ clib_memcpy (match + 6, src_val, 6);
if (tag2)
{
mp->hit_next_index = ntohl(hit_next_index);
mp->opaque_index = ntohl(opaque_index);
mp->advance = ntohl(advance);
- memcpy (mp->match, match, vec_len(match));
+ clib_memcpy (mp->match, match, vec_len(match));
vec_free(match);
S; W;
}
M(GET_NODE_INDEX, get_node_index);
- memcpy (mp->node_name, name, vec_len(name));
+ clib_memcpy (mp->node_name, name, vec_len(name));
vec_free(name);
S; W;
}
M(ADD_NODE_NEXT, add_node_next);
- memcpy (mp->node_name, name, vec_len(name));
- memcpy (mp->next_name, next, vec_len(next));
+ clib_memcpy (mp->node_name, name, vec_len(name));
+ clib_memcpy (mp->next_name, next, vec_len(next));
vec_free(name);
vec_free(next);
M(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel);
- memcpy (mp->client_address, client_address.as_u8,
+ clib_memcpy (mp->client_address, client_address.as_u8,
sizeof (mp->client_address));
- memcpy (mp->our_address, our_address.as_u8,
+ clib_memcpy (mp->our_address, our_address.as_u8,
sizeof (mp->our_address));
mp->local_session_id = ntohl (local_session_id);
vat_json_init_object(node);
- memcpy(&addr, mp->our_address, sizeof(addr));
+ clib_memcpy(&addr, mp->our_address, sizeof(addr));
vat_json_object_add_ip6(node, "our_address", addr);
- memcpy(&addr, mp->client_address, sizeof(addr));
+ clib_memcpy(&addr, mp->client_address, sizeof(addr));
vat_json_object_add_ip6(node, "client_address", addr);
vat_json_node_t * lc = vat_json_object_add(node, "local_cookie");
vat_json_init_object(node);
vat_json_object_add_uint(node, "sw_if_index", ntohl(mp->sw_if_index));
- memcpy(&ip4, &mp->src_address, sizeof(ip4));
+ clib_memcpy(&ip4, &mp->src_address, sizeof(ip4));
vat_json_object_add_ip4(node, "src_address", ip4);
- memcpy(&ip4, &mp->dst_address, sizeof(ip4));
+ clib_memcpy(&ip4, &mp->dst_address, sizeof(ip4));
vat_json_object_add_ip4(node, "dst_address", ip4);
vat_json_object_add_uint(node, "encap_vrf_id", ntohl(mp->encap_vrf_id));
vat_json_object_add_uint(node, "decap_next_index", ntohl(mp->decap_next_index));
M(CREATE_VHOST_USER_IF, create_vhost_user_if);
mp->is_server = is_server;
- memcpy(mp->sock_filename, file_name, vec_len(file_name));
+ clib_memcpy(mp->sock_filename, file_name, vec_len(file_name));
vec_free(file_name);
if (custom_dev_instance != ~0) {
mp->renumber = 1;
mp->custom_dev_instance = ntohl(custom_dev_instance);
}
mp->use_custom_mac = use_custom_mac;
- memcpy(mp->mac_address, hwaddr, 6);
+ clib_memcpy(mp->mac_address, hwaddr, 6);
S; W;
/* NOTREACHED */
mp->sw_if_index = ntohl(sw_if_index);
mp->is_server = is_server;
- memcpy(mp->sock_filename, file_name, vec_len(file_name));
+ clib_memcpy(mp->sock_filename, file_name, vec_len(file_name));
vec_free(file_name);
if (custom_dev_instance != ~0) {
mp->renumber = 1;
mp->is_ipv6 = is_ipv6;
if (is_ipv6 || is_ip_any) {
- memcpy (mp->remote_address_start, &raddr6_start, sizeof(ip6_address_t));
- memcpy (mp->remote_address_stop, &raddr6_stop, sizeof(ip6_address_t));
- memcpy (mp->local_address_start, &laddr6_start, sizeof(ip6_address_t));
- memcpy (mp->local_address_stop, &laddr6_stop, sizeof(ip6_address_t));
+ clib_memcpy (mp->remote_address_start, &raddr6_start, sizeof(ip6_address_t));
+ clib_memcpy (mp->remote_address_stop, &raddr6_stop, sizeof(ip6_address_t));
+ clib_memcpy (mp->local_address_start, &laddr6_start, sizeof(ip6_address_t));
+ clib_memcpy (mp->local_address_stop, &laddr6_stop, sizeof(ip6_address_t));
} else {
- memcpy (mp->remote_address_start, &raddr4_start, sizeof(ip4_address_t));
- memcpy (mp->remote_address_stop, &raddr4_stop, sizeof(ip4_address_t));
- memcpy (mp->local_address_start, &laddr4_start, sizeof(ip4_address_t));
- memcpy (mp->local_address_stop, &laddr4_stop, sizeof(ip4_address_t));
+ clib_memcpy (mp->remote_address_start, &raddr4_start, sizeof(ip4_address_t));
+ clib_memcpy (mp->remote_address_stop, &raddr4_stop, sizeof(ip4_address_t));
+ clib_memcpy (mp->local_address_start, &laddr4_start, sizeof(ip4_address_t));
+ clib_memcpy (mp->local_address_stop, &laddr4_stop, sizeof(ip4_address_t));
}
mp->protocol = (u8) protocol;
mp->local_port_start = ntohs((u16) lport_start);
if (mp->integrity_key_length > sizeof(mp->integrity_key))
mp->integrity_key_length = sizeof(mp->integrity_key);
- memcpy (mp->crypto_key, ck, mp->crypto_key_length);
- memcpy (mp->integrity_key, ik, mp->integrity_key_length);
+ clib_memcpy (mp->crypto_key, ck, mp->crypto_key_length);
+ clib_memcpy (mp->integrity_key, ik, mp->integrity_key_length);
if (is_tunnel) {
if (is_tunnel_ipv6) {
- memcpy (mp->tunnel_src_address, &tun_src6, sizeof(ip6_address_t));
- memcpy (mp->tunnel_dst_address, &tun_dst6, sizeof(ip6_address_t));
+ clib_memcpy (mp->tunnel_src_address, &tun_src6, sizeof(ip6_address_t));
+ clib_memcpy (mp->tunnel_dst_address, &tun_dst6, sizeof(ip6_address_t));
} else {
- memcpy (mp->tunnel_src_address, &tun_src4, sizeof(ip4_address_t));
- memcpy (mp->tunnel_dst_address, &tun_dst4, sizeof(ip4_address_t));
+ clib_memcpy (mp->tunnel_src_address, &tun_src4, sizeof(ip4_address_t));
+ clib_memcpy (mp->tunnel_dst_address, &tun_dst4, sizeof(ip4_address_t));
}
}
if (mp->integrity_key_length > sizeof(mp->integrity_key))
mp->integrity_key_length = sizeof(mp->integrity_key);
- memcpy (mp->crypto_key, ck, mp->crypto_key_length);
- memcpy (mp->integrity_key, ik, mp->integrity_key_length);
+ clib_memcpy (mp->crypto_key, ck, mp->crypto_key_length);
+ clib_memcpy (mp->integrity_key, ik, mp->integrity_key_length);
S; W;
/* NOTREACHED */
M(IKEV2_PROFILE_ADD_DEL, ikev2_profile_add_del);
- memcpy(mp->name, name, vec_len (name));
+ clib_memcpy(mp->name, name, vec_len (name));
mp->is_add = is_add;
vec_free (name);
mp->is_hex = is_hex;
mp->auth_method = (u8) auth_method;
mp->data_len = vec_len (data);
- memcpy (mp->name, name, vec_len (name));
- memcpy (mp->data, data, vec_len (data));
+ clib_memcpy (mp->name, name, vec_len (name));
+ clib_memcpy (mp->data, data, vec_len (data));
vec_free (name);
vec_free (data);
else if (unformat (i, "id_data %U", unformat_ip4_address, &ip4))
{
data = vec_new(u8, 4);
- memcpy(data, ip4.as_u8, 4);
+ clib_memcpy(data, ip4.as_u8, 4);
}
else if (unformat (i, "id_data 0x%U", unformat_hex_string, &data))
;
mp->is_local = is_local;
mp->id_type = (u8) id_type;
mp->data_len = vec_len (data);
- memcpy (mp->name, name, vec_len (name));
- memcpy (mp->data, data, vec_len (data));
+ clib_memcpy (mp->name, name, vec_len (name));
+ clib_memcpy (mp->data, data, vec_len (data));
vec_free (name);
vec_free (data);
mp->end_port = (u16) end_port;
mp->start_addr = start_addr.as_u32;
mp->end_addr = end_addr.as_u32;
- memcpy (mp->name, name, vec_len (name));
+ clib_memcpy (mp->name, name, vec_len (name));
vec_free (name);
S; W;
M(IKEV2_SET_LOCAL_KEY, ikev2_set_local_key);
- memcpy (mp->key_file, file, vec_len (file));
+ clib_memcpy (mp->key_file, file, vec_len (file));
vec_free (file);
S; W;
/* Construct the API message */
M(MAP_ADD_DOMAIN, map_add_domain);
- memcpy(mp->ip4_prefix, &ip4_prefix, sizeof(ip4_prefix));
+ clib_memcpy(mp->ip4_prefix, &ip4_prefix, sizeof(ip4_prefix));
mp->ip4_prefix_len = ip4_prefix_len;
- memcpy(mp->ip6_prefix, &ip6_prefix, sizeof(ip6_prefix));
+ clib_memcpy(mp->ip6_prefix, &ip6_prefix, sizeof(ip6_prefix));
mp->ip6_prefix_len = ip6_prefix_len;
- memcpy(mp->ip6_src, &ip6_src, sizeof(ip6_src));
+ clib_memcpy(mp->ip6_src, &ip6_src, sizeof(ip6_src));
mp->ip6_src_prefix_len = ip6_src_len;
mp->ea_bits_len = ea_bits_len;
mp->index = ntohl(index);
mp->is_add = is_add;
- memcpy(mp->ip6_dst, &ip6_dst, sizeof(ip6_dst));
+ clib_memcpy(mp->ip6_dst, &ip6_dst, sizeof(ip6_dst));
mp->psid = ntohs(psid);
/* send it... */
}
M(GET_FIRST_MSG_ID, get_first_msg_id);
- memcpy (mp->name, name, vec_len(name));
+ clib_memcpy (mp->name, name, vec_len(name));
S; W;
/* NOTREACHED */
return 0;
M(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set);
mp->is_add = is_add;
- memcpy(mp->locator_set_name, locator_set_name,
+ clib_memcpy(mp->locator_set_name, locator_set_name,
vec_len(locator_set_name));
vec_free(locator_set_name);
mp->sw_if_index = ntohl(sw_if_index);
mp->priority = priority;
mp->weight = weight;
- memcpy(mp->locator_set_name, locator_set_name,
+ clib_memcpy(mp->locator_set_name, locator_set_name,
vec_len(locator_set_name));
vec_free(locator_set_name);
mp->is_add = is_add;
if (eidv6_set) {
mp->is_ipv6 = 1;
- memcpy(mp->ip_address, &eidv6, sizeof(eidv6));
+ clib_memcpy(mp->ip_address, &eidv6, sizeof(eidv6));
} else {
mp->is_ipv6 = 0;
- memcpy(mp->ip_address, &eidv4, sizeof(eidv4));
+ clib_memcpy(mp->ip_address, &eidv4, sizeof(eidv4));
}
mp->prefix_len = eid_lenght;
- memcpy(mp->locator_set_name, locator_set_name,
+ clib_memcpy(mp->locator_set_name, locator_set_name,
vec_len(locator_set_name));
vec_free(locator_set_name);
mp->is_add = is_add;
if (eidv6_set) {
mp->eid_is_ipv6 = 1;
- memcpy(mp->eid_ip_address, &eidv6, sizeof(eidv6));
+ clib_memcpy(mp->eid_ip_address, &eidv6, sizeof(eidv6));
} else {
mp->eid_is_ipv6 = 0;
- memcpy(mp->eid_ip_address, &eidv4, sizeof(eidv4));
+ clib_memcpy(mp->eid_ip_address, &eidv4, sizeof(eidv4));
}
mp->eid_prefix_len = eid_lenght;
if (slocv6_set) {
mp->address_is_ipv6 = 1;
- memcpy(mp->source_ip_address, &slocv6, sizeof(slocv6));
- memcpy(mp->destination_ip_address, &dlocv6, sizeof(dlocv6));
+ clib_memcpy(mp->source_ip_address, &slocv6, sizeof(slocv6));
+ clib_memcpy(mp->destination_ip_address, &dlocv6, sizeof(dlocv6));
} else {
mp->address_is_ipv6 = 0;
- memcpy(mp->source_ip_address, &slocv4, sizeof(slocv4));
- memcpy(mp->destination_ip_address, &dlocv4, sizeof(dlocv4));
+ clib_memcpy(mp->source_ip_address, &slocv4, sizeof(slocv4));
+ clib_memcpy(mp->destination_ip_address, &dlocv4, sizeof(dlocv4));
}
/* send it... */
mp->is_add = is_add;
if (ipv6_set) {
mp->is_ipv6 = 1;
- memcpy(mp->ip_address, &ipv6, sizeof(ipv6));
+ clib_memcpy(mp->ip_address, &ipv6, sizeof(ipv6));
} else {
mp->is_ipv6 = 0;
- memcpy(mp->ip_address, &ipv4, sizeof(ipv4));
+ clib_memcpy(mp->ip_address, &ipv4, sizeof(ipv4));
}
/* send it... */
return -99;
}
- memcpy (&save_input, &vam->input, sizeof (save_input));
- memcpy (&save_jump_buf, &vam->jump_buf, sizeof (save_jump_buf));
+ clib_memcpy (&save_input, &vam->input, sizeof (save_input));
+ clib_memcpy (&save_jump_buf, &vam->jump_buf, sizeof (save_jump_buf));
save_ifp = vam->ifp;
save_line_number = vam->input_line_number;
save_current_file = (char *) vam->current_file;
vam->current_file = s;
do_one_file (vam);
- memcpy (&vam->input, &save_input, sizeof (vam->input));
- memcpy (&vam->jump_buf, &save_jump_buf, sizeof (save_jump_buf));
+ clib_memcpy (&vam->input, &save_input, sizeof (vam->input));
+ clib_memcpy (&vam->jump_buf, &save_jump_buf, sizeof (save_jump_buf));
vam->ifp = save_ifp;
vam->input_line_number = save_line_number;
vam->current_file = (u8 *) save_current_file;
/* Save the reply */
vec_validate (saved_reply, total_bytes - 1);
- memcpy (saved_reply, mp, total_bytes);
+ clib_memcpy (saved_reply, mp, total_bytes);
vppjni_lock (jm, 2);
hash_set (jm->reply_hash, context, saved_reply);
sw_if_details->sup_sw_if_index = ntohl(mp->sup_sw_if_index);
sw_if_details->l2_address_length = ntohl (mp->l2_address_length);
ASSERT(sw_if_details->l2_address_length <= sizeof(sw_if_details->l2_address));
- memcpy(sw_if_details->l2_address, mp->l2_address,
+ clib_memcpy(sw_if_details->l2_address, mp->l2_address,
sw_if_details->l2_address_length);
sw_if_details->sub_id = ntohl (mp->sub_id);
sw_if_details->sub_outer_vlan_id = ntohl (mp->sub_outer_vlan_id);
#if 0
vec_validate (mac_addr, MAC_ADDRESS_SIZE);
- memcpy (mac_addr, l2fe_u64_mac->fields.mac, MAC_ADDRESS_SIZE);
+ clib_memcpy (mac_addr, l2fe_u64_mac->fields.mac, MAC_ADDRESS_SIZE);
mhash_val_l2fi = vec_len (bd_oper->l2fib_oper);
if (mhash_elts (&bd_oper->l2fib_index_by_mac) == 0)
mhash_init (&bd_oper->l2fib_index_by_mac, sizeof (u32), MAC_ADDRESS_SIZE);
if (!jm->is_ipv6) {
ipv4_address_t *address = 0;
vec_add2(jm->ipv4_addresses, address, 1);
- memcpy(&address->ip, mp->ip, 4);
+ clib_memcpy(&address->ip, mp->ip, 4);
address->prefix_length = mp->prefix_length;
} else {
ipv6_address_t *address = 0;
vec_add2(jm->ipv6_addresses, address, 1);
- memcpy(address->ip, mp->ip, 16);
+ clib_memcpy(address->ip, mp->ip, 16);
address->prefix_length = mp->prefix_length;
}
}
if (q->cursize < q->maxsize) {
mp = vl_msg_api_alloc (sizeof (*mp));
- memcpy (mp, event, sizeof (*mp));
+ clib_memcpy (mp, event, sizeof (*mp));
vl_msg_api_send_shmem (q, (u8 *)&mp);
} else {
static f64 last_time;
ntohl(mp->next_hop_sw_if_index)))
return VNET_API_ERROR_NO_MATCHING_INTERFACE;
- memcpy (next_hop_address.data, mp->next_hop_address,
+ clib_memcpy (next_hop_address.data, mp->next_hop_address,
sizeof (next_hop_address.data));
/* Arp for the next_hop if necessary */
pool_get (vam->pending_routes, pr);
pr->resolve_type = RESOLVE_IP4_ADD_DEL_ROUTE;
adr = &pr->r;
- memcpy (adr, mp, sizeof (*adr));
+ clib_memcpy (adr, mp, sizeof (*adr));
/* recursion block, "just in case" */
adr->resolve_if_needed = 0;
adr->resolve_attempts = ntohl(mp->resolve_attempts);
}
memset (&a, 0, sizeof (a));
- memcpy (a.dst_address.data, mp->dst_address, sizeof (a.dst_address.data));
+ clib_memcpy (a.dst_address.data, mp->dst_address, sizeof (a.dst_address.data));
a.dst_address_length = mp->dst_address_length;
ntohl(mp->next_hop_sw_if_index)))
return VNET_API_ERROR_NO_MATCHING_INTERFACE;
- memcpy (next_hop_address.as_u8, mp->next_hop_address,
+ clib_memcpy (next_hop_address.as_u8, mp->next_hop_address,
sizeof (next_hop_address.as_u8));
/* Arp for the next_hop if necessary */
pool_get (vam->pending_routes, pr);
adr = &pr->r;
pr->resolve_type = RESOLVE_IP6_ADD_DEL_ROUTE;
- memcpy (adr, mp, sizeof (*adr));
+ clib_memcpy (adr, mp, sizeof (*adr));
/* recursion block, "just in case" */
adr->resolve_if_needed = 0;
adr->resolve_attempts = ntohl(mp->resolve_attempts);
}
memset (&a, 0, sizeof (a));
- memcpy (a.dst_address.as_u8, mp->dst_address, sizeof (a.dst_address.as_u8));
+ clib_memcpy (a.dst_address.as_u8, mp->dst_address, sizeof (a.dst_address.as_u8));
a.dst_address_length = mp->dst_address_length;
mp.is_ipv6 = is_ipv6;
mp.next_hop_weight = 1;
- memcpy (&mp.next_hop_address[0], next_hop_addr, 16);
+ clib_memcpy (&mp.next_hop_address[0], next_hop_addr, 16);
if (is_ipv6)
rv = ip6_add_del_route_t_handler (&mp);
pool_get (vam->pending_routes, pr);
pr->resolve_type = RESOLVE_MPLS_ETHERNET_ADD_DEL;
pme = &pr->t;
- memcpy (pme, mp, sizeof (*pme));
+ clib_memcpy (pme, mp, sizeof (*pme));
/* recursion block, "just in case" */
pme->resolve_if_needed = 0;
pme->resolve_attempts = ntohl(mp->resolve_attempts);
}
}
- memcpy (&a.ethernet, mp->mac_address, 6);
- memcpy (&a.ip4, mp->dst_address, 4);
+ clib_memcpy (&a.ethernet, mp->mac_address, 6);
+ clib_memcpy (&a.ip4, mp->dst_address, 4);
if (mp->is_add)
rv = vnet_arp_set_ip4_over_ethernet (vnm, ntohl(mp->sw_if_index),
}
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memcpy (rmp, mp, sizeof (*rmp));
+ clib_memcpy (rmp, mp, sizeof (*rmp));
sw_if_index = mp->next_hop_sw_if_index;
- memcpy (&addr, mp->address, sizeof (addr));
+ clib_memcpy (&addr, mp->address, sizeof (addr));
if (mp->is_ipv6) {
lm = &im6->lookup_main;
adj_index =
ei = pool_elt_at_index (em->interfaces, hi->hw_instance);
ASSERT (sizeof (mp->l2_address) >= sizeof (ei->address));
- memcpy (mp->l2_address, ei->address, sizeof (ei->address));
+ clib_memcpy (mp->l2_address, ei->address, sizeof (ei->address));
mp->l2_address_length = ntohl(sizeof (ei->address));
} else if (swif->sup_sw_if_index != swif->sw_if_index) {
vnet_sub_interface_t *sub = &swif->sub;
if (q) {
mp = vl_msg_api_alloc (sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_OAM_EVENT);
- memcpy (mp->dst_address, &t->dst_address, sizeof (mp->dst_address));
+ clib_memcpy (mp->dst_address, &t->dst_address, sizeof (mp->dst_address));
mp->state = t->state;
vl_msg_api_send_shmem (q, (u8 *)&mp);
}
mp->client_index = client_index;
mp->pid = pid;
mp->is_ipv6 = is_ipv6;
- memcpy (&mp->hostname, hostname, vec_len(hostname));
+ clib_memcpy (&mp->hostname, hostname, vec_len(hostname));
mp->hostname[vec_len(hostname) + 1] = '\n';
- memcpy (&mp->host_address[0], host_address, 16);
- memcpy (&mp->router_address[0], router_address, 16);
- memcpy (&mp->host_mac[0], host_mac, 6);
+ clib_memcpy (&mp->host_address[0], host_address, 16);
+ clib_memcpy (&mp->router_address[0], router_address, 16);
+ clib_memcpy (&mp->host_mac[0], host_mac, 6);
mp->_vl_msg_id = ntohs (VL_API_DHCP_COMPL_EVENT);
vec_validate (shmem_vec, offset + buffer_bytes - 1);
- memcpy (shmem_vec + offset, buffer, buffer_bytes);
+ clib_memcpy (shmem_vec + offset, buffer, buffer_bytes);
svm_pop_heap (oldheap);
pthread_mutex_unlock (&am->vlib_rp->mutex);
this_address = (ip6_address_t *)mp->segs_and_tags;
for (i = 0; i < mp->n_segments; i++) {
vec_add2 (segments, seg, 1);
- memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
+ clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
this_address++;
}
for (i = 0; i < mp->n_tags; i++) {
vec_add2 (tags, tag, 1);
- memcpy (tag->as_u8, this_address->as_u8, sizeof (*this_address));
+ clib_memcpy (tag->as_u8, this_address->as_u8, sizeof (*this_address));
this_address++;
}
mp->local_cookie[0] = s->local_cookie[0];
mp->local_cookie[1] = s->local_cookie[1];
mp->remote_cookie = s->remote_cookie;
- memcpy(mp->client_address, &s->client_address, sizeof(s->client_address));
- memcpy(mp->our_address, &s->our_address, sizeof(s->our_address));
+ clib_memcpy(mp->client_address, &s->client_address, sizeof(s->client_address));
+ clib_memcpy(mp->our_address, &s->our_address, sizeof(s->our_address));
mp->l2_sublayer_present = s->l2_sublayer_present;
vl_msg_api_send_shmem (q, (u8 *)&mp);
mp->_vl_msg_id = ntohs(VL_API_IP_ADDRESS_DETAILS);
if (is_ipv6) {
- memcpy(&mp->ip, ip, sizeof(mp->ip));
+ clib_memcpy(&mp->ip, ip, sizeof(mp->ip));
} else {
u32 * tp = (u32 *)mp->ip;
*tp = ntohl(*(u32*)ip);
gid_address_type (&eid) = IP_PREFIX;
if (mp->is_ipv6) {
- memcpy(&ip_addr_v6(ip_eid), mp->ip_address,
+ clib_memcpy(&ip_addr_v6(ip_eid), mp->ip_address,
sizeof(ip_addr_v6(ip_eid)));
ip_addr_version(ip_eid) = IP6;
} else {
- memcpy(&ip_addr_v4(ip_eid), mp->ip_address,
+ clib_memcpy(&ip_addr_v4(ip_eid), mp->ip_address,
sizeof(ip_addr_v4(ip_eid)));
ip_addr_version(ip_eid) = IP4;
}
ip_eid = &ip_prefix_addr(prefp);
if (mp->eid_is_ipv6) {
- memcpy(&ip_addr_v6(ip_eid), mp->eid_ip_address,
+ clib_memcpy(&ip_addr_v6(ip_eid), mp->eid_ip_address,
sizeof(ip_addr_v6(ip_eid)));
ip_addr_version(ip_eid) = IP6;
} else {
- memcpy(&ip_addr_v4(ip_eid), mp->eid_ip_address,
+ clib_memcpy(&ip_addr_v4(ip_eid), mp->eid_ip_address,
sizeof(ip_addr_v4(ip_eid)));
ip_addr_version(ip_eid) = IP4;
}
ip_prefix_len(prefp) = mp->eid_prefix_len;
if (mp->address_is_ipv6) {
- memcpy(&ip_addr_v6(slocator), mp->source_ip_address,
+ clib_memcpy(&ip_addr_v6(slocator), mp->source_ip_address,
sizeof(ip_addr_v6(slocator)));
ip_addr_version(slocator) = IP6;
- memcpy(&ip_addr_v6(dlocator), mp->destination_ip_address,
+ clib_memcpy(&ip_addr_v6(dlocator), mp->destination_ip_address,
sizeof(ip_addr_v6(dlocator)));
ip_addr_version(dlocator) = IP6;
} else {
- memcpy(&ip_addr_v4(slocator), mp->source_ip_address,
+ clib_memcpy(&ip_addr_v4(slocator), mp->source_ip_address,
sizeof(ip_addr_v4(slocator)));
ip_addr_version(slocator) = IP4;
- memcpy(&ip_addr_v4(dlocator), mp->destination_ip_address,
+ clib_memcpy(&ip_addr_v4(dlocator), mp->destination_ip_address,
sizeof(ip_addr_v4(dlocator)));
ip_addr_version(dlocator) = IP4;
}
ip_addr = &a->address;
if (mp->is_ipv6) {
- memcpy(&ip_addr_v6(ip_addr), mp->ip_address,
+ clib_memcpy(&ip_addr_v6(ip_addr), mp->ip_address,
sizeof(ip_addr_v6(ip_addr)));
ip_addr_version(ip_addr) = IP6;
} else {
- memcpy(&ip_addr_v4(ip_addr), mp->ip_address,
+ clib_memcpy(&ip_addr_v4(ip_addr), mp->ip_address,
sizeof(ip_addr_v4(ip_addr)));
ip_addr_version(ip_addr) = IP4;
}
switch (ip_prefix_version(ip_prefix)) {
case IP4:
rmp->eid_is_ipv6 = 0;
- memcpy(rmp->eid_ip_address, &ip_prefix_v4(ip_prefix),
+ clib_memcpy(rmp->eid_ip_address, &ip_prefix_v4(ip_prefix),
sizeof(ip_prefix_v4(ip_prefix)));
break;
case IP6:
rmp->eid_is_ipv6 = 1;
- memcpy(rmp->eid_ip_address, &ip_prefix_v6(ip_prefix),
+ clib_memcpy(rmp->eid_ip_address, &ip_prefix_v6(ip_prefix),
sizeof(ip_prefix_v6(ip_prefix)));
break;
/*list_gpe_tunnel now support only IPv4*/
rmp->is_ipv6 = 0;
ip4 = &tunnel->src;
- memcpy(rmp->source_ip, ip4, sizeof(*ip4));
+ clib_memcpy(rmp->source_ip, ip4, sizeof(*ip4));
ip4 = &tunnel->dst;
- memcpy(rmp->destination_ip, ip4, sizeof(*ip4));
+ clib_memcpy(rmp->destination_ip, ip4, sizeof(*ip4));
rmp->encap_fib_id = htonl(tunnel->encap_fib_index);
rmp->decap_fib_id = htonl(tunnel->decap_fib_index);
switch (ip_addr_version(ip)) {
case IP4:
rmp->is_ipv6 = 0;
- memcpy(rmp->ip_address, &ip_addr_v4(ip), sizeof(ip_addr_v4(ip)));
+ clib_memcpy(rmp->ip_address, &ip_addr_v4(ip), sizeof(ip_addr_v4(ip)));
break;
case IP6:
rmp->is_ipv6 = 1;
- memcpy(rmp->ip_address, &ip_addr_v6(ip), sizeof(ip_addr_v6(ip)));
+ clib_memcpy(rmp->ip_address, &ip_addr_v6(ip), sizeof(ip_addr_v6(ip)));
break;
default:
event = pool_elt_at_index (am->arp_events, pool_index);
if (memcmp (&event->new_mac, new_mac, sizeof (event->new_mac))) {
- memcpy (event->new_mac, new_mac, sizeof(event->new_mac));
+ clib_memcpy (event->new_mac, new_mac, sizeof(event->new_mac));
} else { /* same mac */
if ((sw_if_index == event->sw_if_index) &&
((address == 0) ||
p.is_outbound = mp->is_outbound;
p.is_ipv6 = mp->is_ipv6;
- memcpy(&p.raddr.start, mp->remote_address_start, 16);
- memcpy(&p.raddr.stop, mp->remote_address_stop, 16);
- memcpy(&p.laddr.start, mp->local_address_start, 16);
- memcpy(&p.laddr.stop, mp->local_address_stop, 16);
+ clib_memcpy(&p.raddr.start, mp->remote_address_start, 16);
+ clib_memcpy(&p.raddr.stop, mp->remote_address_stop, 16);
+ clib_memcpy(&p.laddr.start, mp->local_address_start, 16);
+ clib_memcpy(&p.laddr.stop, mp->local_address_stop, 16);
p.protocol = mp->protocol;
p.rport.start = ntohs(mp->remote_port_start);
}
sa.crypto_alg = mp->crypto_algorithm;
sa.crypto_key_len = mp->crypto_key_length;
- memcpy(&sa.crypto_key, mp->crypto_key, sizeof(sa.crypto_key));
+ clib_memcpy(&sa.crypto_key, mp->crypto_key, sizeof(sa.crypto_key));
/* check for unsupported integ-alg */
if (mp->integrity_algorithm < IPSEC_INTEG_ALG_SHA1_96 ||
mp->integrity_algorithm > IPSEC_INTEG_ALG_SHA_512_256) {
}
sa.integ_alg = mp->integrity_algorithm;
sa.integ_key_len = mp->integrity_key_length;
- memcpy(&sa.integ_key, mp->integrity_key, sizeof(sa.integ_key));
+ clib_memcpy(&sa.integ_key, mp->integrity_key, sizeof(sa.integ_key));
sa.use_esn = mp->use_extended_sequence_number;
sa.is_tunnel = mp->is_tunnel;
sa.is_tunnel_ip6 = mp->is_tunnel_ipv6;
- memcpy(&sa.tunnel_src_addr, mp->tunnel_src_address, 16);
- memcpy(&sa.tunnel_dst_addr, mp->tunnel_dst_address, 16);
+ clib_memcpy(&sa.tunnel_src_addr, mp->tunnel_src_address, 16);
+ clib_memcpy(&sa.tunnel_dst_addr, mp->tunnel_dst_address, 16);
rv = ipsec_add_del_sa(vm, &sa, mp->is_add);
#else
clib_error_t * error;
u8 * tmp = format(0, "%s", mp->name);
u8 * data = vec_new (u8, mp->data_len);
- memcpy(data, mp->data, mp->data_len);
+ clib_memcpy(data, mp->data, mp->data_len);
error = ikev2_set_profile_auth(vm, tmp, mp->auth_method, data, mp->is_hex);
vec_free (tmp);
vec_free (data);
clib_error_t * error;
u8 * tmp = format(0, "%s", mp->name);
u8 * data = vec_new (u8, mp->data_len);
- memcpy(data, mp->data, mp->data_len);
+ clib_memcpy(data, mp->data, mp->data_len);
error = ikev2_set_profile_id(vm, tmp, mp->id_type, data, mp->is_local);
vec_free (tmp);
vec_free (data);
rmp->ea_bits_len = d->ea_bits_len;
rmp->psid_offset = d->psid_offset;
rmp->psid_length = d->psid_length;
- memcpy(rmp->ip4_prefix, &d->ip4_prefix, sizeof(rmp->ip4_prefix));
+ clib_memcpy(rmp->ip4_prefix, &d->ip4_prefix, sizeof(rmp->ip4_prefix));
rmp->ip4_prefix_len = d->ip4_prefix_len;
- memcpy(rmp->ip6_prefix, &d->ip6_prefix, sizeof(rmp->ip6_prefix));
+ clib_memcpy(rmp->ip6_prefix, &d->ip6_prefix, sizeof(rmp->ip6_prefix));
rmp->ip6_prefix_len = d->ip6_prefix_len;
- memcpy(rmp->ip6_src, &d->ip6_src, sizeof(rmp->ip6_src));
+ clib_memcpy(rmp->ip6_src, &d->ip6_src, sizeof(rmp->ip6_src));
rmp->ip6_src_len = d->ip6_src_len;
rmp->mtu = htons(d->mtu);
rmp->is_translation = (d->flags & MAP_DOMAIN_TRANSLATION);
memset(rmp, 0, sizeof(*rmp));
rmp->_vl_msg_id = ntohs(VL_API_MAP_RULE_DETAILS);
rmp->psid = htons(i);
- memcpy(rmp->ip6_dst, &dst, sizeof(rmp->ip6_dst));
+ clib_memcpy(rmp->ip6_dst, &dst, sizeof(rmp->ip6_dst));
vl_msg_api_send_shmem(q, (u8 *)&rmp);
}
}
ipsec_sa_t sa;
sa.id = ntohl(mp->sa_id);
sa.crypto_key_len = mp->crypto_key_length;
- memcpy(&sa.crypto_key, mp->crypto_key, sizeof(sa.crypto_key));
+ clib_memcpy(&sa.crypto_key, mp->crypto_key, sizeof(sa.crypto_key));
sa.integ_key_len = mp->integrity_key_length;
- memcpy(&sa.integ_key, mp->integrity_key, sizeof(sa.integ_key));
+ clib_memcpy(&sa.integ_key, mp->integrity_key, sizeof(sa.integ_key));
rv = ipsec_set_sa_key(vm, &sa);
#else
mp->is_add = is_add;
tmp.as_u32 = ntohl (0xc0a80101); /* 192.168.1.1 */
- memcpy (mp->src_address, tmp.as_u8, 4);
+ clib_memcpy (mp->src_address, tmp.as_u8, 4);
tmp.as_u32 = ntohl (0xc0a80103); /* 192.168.1.3 */
- memcpy (mp->dst_address, tmp.as_u8, 4);
+ clib_memcpy (mp->dst_address, tmp.as_u8, 4);
mp->vrf_id = 0;
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *)&mp);
/* Next hop: 6.0.0.1 */
tmp = ntohl(0x06000001);
- memcpy (mp->next_hop_address, &tmp, sizeof (tmp));
+ clib_memcpy (mp->next_hop_address, &tmp, sizeof (tmp));
/* Destination: 10.0.0.1/32 */
tmp = ntohl(0x0);
- memcpy (mp->dst_address, &tmp, sizeof (tmp));
+ clib_memcpy (mp->dst_address, &tmp, sizeof (tmp));
mp->dst_address_length = 0;
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *)&mp);
tmp[0] = clib_host_to_net_u64 (0xdabe000000000000ULL);
tmp[1] = clib_host_to_net_u64 (0x0ULL);
- memcpy (mp->dst_address, &tmp[0], 8);
- memcpy (&mp->dst_address[8], &tmp[1], 8);
+ clib_memcpy (mp->dst_address, &tmp[0], 8);
+ clib_memcpy (&mp->dst_address[8], &tmp[1], 8);
tmp[0] = clib_host_to_net_u64(0xdb01000000000000ULL);
tmp[1] = clib_host_to_net_u64 (0x11ULL);
- memcpy (mp->next_hop_address, &tmp[0], 8);
- memcpy (&mp->next_hop_address[8], &tmp[1], 8);
+ clib_memcpy (mp->next_hop_address, &tmp[0], 8);
+ clib_memcpy (&mp->next_hop_address[8], &tmp[1], 8);
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *)&mp);
}
mp->address_length = 8;
tmp = ntohl (0x01020304);
- memcpy (mp->address, &tmp, 4);
+ clib_memcpy (mp->address, &tmp, 4);
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *)&mp);
}
tmp[0] = clib_host_to_net_u64(0xdb01000000000000ULL);
tmp[1] = clib_host_to_net_u64 (0x11ULL);
- memcpy (mp->address, &tmp[0], 8);
- memcpy (&mp->address[8], &tmp[1], 8);
+ clib_memcpy (mp->address, &tmp[0], 8);
+ clib_memcpy (&mp->address[8], &tmp[1], 8);
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *)&mp);
}
mp->_vl_msg_id = ntohs (VL_API_TAP_CONNECT);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
- memcpy (mp->tap_name, name, strlen(name));
+ clib_memcpy (mp->tap_name, name, strlen(name));
mp->use_random_mac = 1;
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *)&mp);
}
lp->is_add = is_add;
/* dst: 5.0.0.1 */
tmp = ntohl (0x05000001);
- memcpy (lp->dst_address, &tmp, 4);
+ clib_memcpy (lp->dst_address, &tmp, 4);
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *)&lp);
/* src: 6.0.0.1 */
tmp = ntohl (0x06000001);
- memcpy (mp->src_address, &tmp, 4);
+ clib_memcpy (mp->src_address, &tmp, 4);
/* dst: 5.0.0.1 */
tmp = ntohl (0x05000001);
- memcpy (mp->dst_address, &tmp, 4);
+ clib_memcpy (mp->dst_address, &tmp, 4);
/* intfc: 5.0.0.1/24 */
tmp = ntohl (0x05000001);
- memcpy (mp->intfc_address, &tmp, 4);
+ clib_memcpy (mp->intfc_address, &tmp, 4);
mp->intfc_address_length = 24;
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *)&mp);
/* proxy fib 11, 1.1.1.1 -> 1.1.1.10 */
tmp = ntohl (0x01010101);
- memcpy (mp->low_address, &tmp, 4);
+ clib_memcpy (mp->low_address, &tmp, 4);
tmp = ntohl (0x0101010a);
- memcpy (mp->hi_address, &tmp, 4);
+ clib_memcpy (mp->hi_address, &tmp, 4);
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *)&mp);
}
memset (mp->mac_address, 0xbe, sizeof (mp->mac_address));
tmp = ntohl (0x0101010a);
- memcpy (mp->dst_address, &tmp, 4);
+ clib_memcpy (mp->dst_address, &tmp, 4);
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *)&mp);
}
tmp[0] = clib_host_to_net_u64(0xdb01000000000000ULL);
tmp[1] = clib_host_to_net_u64 (0x11ULL);
- memcpy (mp->dst_address, &tmp[0], 8);
- memcpy (&mp->dst_address[8], &tmp[1], 8);
+ clib_memcpy (mp->dst_address, &tmp[0], 8);
+ clib_memcpy (&mp->dst_address[8], &tmp[1], 8);
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *)&mp);
}
tmp[1] = clib_host_to_net_u64 (0x11ULL);
- memcpy (mp->address, &tmp[0], 8);
- memcpy (&mp->address[8], &tmp[1], 8);
+ clib_memcpy (mp->address, &tmp[0], 8);
+ clib_memcpy (&mp->address[8], &tmp[1], 8);
mp->address_length = 64;
tmp[0] = clib_host_to_net_u64(0xfe80000000000000ULL);
tmp[1] = clib_host_to_net_u64 (0x11ULL);
- memcpy (mp->address, &tmp[0], 8);
- memcpy (&mp->address[8], &tmp[1], 8);
+ clib_memcpy (mp->address, &tmp[0], 8);
+ clib_memcpy (&mp->address[8], &tmp[1], 8);
mp->address_length = 64;
hi = vnet_get_sup_hw_interface (lm->vnet_main, sw_if_index);
ei = pool_elt_at_index (em->interfaces, hi->hw_instance);
- memcpy (dst, ei->address, sizeof (ei->address));
+ clib_memcpy (dst, ei->address, sizeof (ei->address));
}
/* packet trace format function */
pool_get (lm->sessions, s);
memset (s, 0, sizeof (*s));
- memcpy (&s->our_address, &our_address, sizeof (s->our_address));
- memcpy (&s->client_address, &client_address, sizeof (s->client_address));
+ clib_memcpy (&s->our_address, &our_address, sizeof (s->our_address));
+ clib_memcpy (&s->client_address, &client_address, sizeof (s->client_address));
s->sw_if_index = sw_if_index;
s->vlan_id = clib_host_to_net_u16 (vlan_id);
s->local_cookie = clib_host_to_net_u64 (local_cookie);
switch (lm->lookup_type) {
case L2T_LOOKUP_SRC_ADDRESS:
src_address_copy = clib_mem_alloc (sizeof (*src_address_copy));
- memcpy (src_address_copy, &client_address, sizeof (*src_address_copy));
+ clib_memcpy (src_address_copy, &client_address, sizeof (*src_address_copy));
hash_set_mem (lm->session_by_src_address, src_address_copy,
s - lm->sessions);
break;
case L2T_LOOKUP_DST_ADDRESS:
dst_address_copy = clib_mem_alloc (sizeof (*dst_address_copy));
- memcpy (dst_address_copy, &our_address, sizeof (*dst_address_copy));
+ clib_memcpy (dst_address_copy, &our_address, sizeof (*dst_address_copy));
hash_set_mem (lm->session_by_dst_address, dst_address_copy,
s - lm->sessions);
break;
h0 = vlib_buffer_get_current (b0);
/* Add forward and reverse entries for this flow */
- memcpy (mp->fdata, h0, sizeof (mp->fdata));
- memcpy (mp->rdata, h0, sizeof (mp->rdata));
+ clib_memcpy (mp->fdata, h0, sizeof (mp->fdata));
+ clib_memcpy (mp->rdata, h0, sizeof (mp->rdata));
h0 = (classify_data_or_mask_t *)(mp->rdata);
vec_validate (fm, 3 * sizeof(u32x4) - 1);
vec_validate (rm, 3 * sizeof(u32x4) - 1);
- memcpy (fm, &fwd_mask, sizeof (fwd_mask));
- memcpy (rm, &rev_mask, sizeof (rev_mask));
+ clib_memcpy (fm, &fwd_mask, sizeof (fwd_mask));
+ clib_memcpy (rm, &rev_mask, sizeof (rev_mask));
rv = ip4_sticky_hash_enable_disable (mp, fwd_sw_if_index, fm,
rev_sw_if_index, rm,
{
mac_addr_t *ma;
vec_add2 (mac_addrs, ma, 1);
- memcpy(ma, mac_addr, sizeof (mac_addr));
+ clib_memcpy(ma, mac_addr, sizeof (mac_addr));
} else {
barf:
return clib_error_return (0, "unknown input `%U'",
if (q) {
if (q_prev && (q_prev->cursize < q_prev->maxsize)) {
mp_copy = vl_msg_api_alloc_as_if_client(mp_size);
- memcpy(mp_copy, mp, mp_size);
+ clib_memcpy(mp_copy, mp, mp_size);
vl_msg_api_send_shmem (q_prev, (u8 *)&mp);
mp = mp_copy;
}
if (q) {
if (q_prev && (q_prev->cursize < q_prev->maxsize)) {
mp_copy = vl_msg_api_alloc_as_if_client(mp_size);
- memcpy(mp_copy, mp, mp_size);
+ clib_memcpy(mp_copy, mp, mp_size);
vl_msg_api_send_shmem (q_prev, (u8 *)&mp);
mp = mp_copy;
}
if (q) {
if (q_prev && (q_prev->cursize < q_prev->maxsize)) {
mp_copy = vl_msg_api_alloc_as_if_client(mp_size);
- memcpy(mp_copy, mp, mp_size);
+ clib_memcpy(mp_copy, mp, mp_size);
vl_msg_api_send_shmem (q_prev, (u8 *)&mp);
mp = mp_copy;
}
vppinfra/math.h \
vppinfra/md5.h \
vppinfra/mem.h \
+ vppinfra/memcpy_sse3.h \
+ vppinfra/memcpy_avx.h \
vppinfra/mhash.h \
vppinfra/mheap.h \
vppinfra/mheap_bootstrap.h \
/* Put in new null terminated string. */
memset (s->contents, 0, vec_len (s->contents));
- memcpy (s->contents, interp, strlen (interp));
+ clib_memcpy (s->contents, interp, strlen (interp));
return 0;
}
}
if (tm->interpreter_offset)
- memcpy (&idp[tm->interpreter_offset], tm->set_interpreter,
+ clib_memcpy (&idp[tm->interpreter_offset], tm->set_interpreter,
strlen (tm->set_interpreter)+1);
if (tm->rpath_offset)
- memcpy (&idp[tm->rpath_offset], tm->set_rpath,
+ clib_memcpy (&idp[tm->rpath_offset], tm->set_rpath,
strlen (tm->set_rpath)+1);
/* Write the output file... */
v = BV(clib_bihash_get_value) (h, b->offset);
- memcpy (working_copy, v, sizeof (*v)*(1<<b->log2_pages));
+ clib_memcpy (working_copy, v, sizeof (*v)*(1<<b->log2_pages));
working_bucket.as_u64 = b->as_u64;
working_bucket.offset = BV(clib_bihash_get_offset) (h, working_copy);
CLIB_MEMORY_BARRIER();
{
if (BV(clib_bihash_is_free)(&(new_v->kvp[k])))
{
- memcpy (&(new_v->kvp[k]), &(v->kvp[j]),
+ clib_memcpy (&(new_v->kvp[k]), &(v->kvp[j]),
sizeof (new_v->kvp[k]));
goto doublebreak;
}
{
if (!memcmp(&(v->kvp[i]), &add_v->key, sizeof (add_v->key)))
{
- memcpy (&(v->kvp[i]), add_v, sizeof (*add_v));
+ clib_memcpy (&(v->kvp[i]), add_v, sizeof (*add_v));
CLIB_MEMORY_BARRIER();
/* Restore the previous (k,v) pairs */
b->as_u64 = h->saved_bucket.as_u64;
{
if (BV(clib_bihash_is_free)(&(v->kvp[i])))
{
- memcpy (&(v->kvp[i]), add_v, sizeof (*add_v));
+ clib_memcpy (&(v->kvp[i]), add_v, sizeof (*add_v));
CLIB_MEMORY_BARRIER();
b->as_u64 = h->saved_bucket.as_u64;
goto unlock;
{
if (BV(clib_bihash_is_free)(&(new_v->kvp[i])))
{
- memcpy (&(new_v->kvp[i]), add_v, sizeof (*add_v));
+ clib_memcpy (&(new_v->kvp[i]), add_v, sizeof (*add_v));
goto expand_ok;
}
}
}
vec_resize (t->relocations, vec_len (rs));
- memcpy (t->relocations, rs, vec_bytes (t->relocations));
+ clib_memcpy (t->relocations, rs, vec_bytes (t->relocations));
vec_free (rs);
}
else
sts->contents = st;
vec_resize (c, n_content_bytes);
- memcpy (c, contents, n_content_bytes);
+ clib_memcpy (c, contents, n_content_bytes);
s->contents = c;
em->file_header.section_header_count += is_new_section && s->header.type != ~0;
vec_len (s->contents),
/* header_bytes */ 0,
/* align */ 0);
- memcpy (result, s->contents, vec_len (s->contents));
+ clib_memcpy (result, s->contents, vec_len (s->contents));
}
return result;
ASSERT (*result_len > f - percent);
l = clib_min (f - percent, *result_len - 1);
- memcpy (result, percent, l);
+ clib_memcpy (result, percent, l);
result[l] = 0;
done:
unserialize_cstring (m, &t);
if (n_bytes == 0)
n_bytes = strlen (t) + 1;
- memcpy (d, t, clib_min (n_bytes, vec_len (t)));
+ clib_memcpy (d, t, clib_min (n_bytes, vec_len (t)));
vec_free (t);
break;
}
if (head + n_copy_bytes >= end)
{
uword n = end - head;
- memcpy (v_new, head, n);
- memcpy (v_new + n, v_old, n_copy_bytes - n);
+ clib_memcpy (v_new, head, n);
+ clib_memcpy (v_new + n, v_old, n_copy_bytes - n);
}
else
- memcpy (v_new, head, n_copy_bytes);
+ clib_memcpy (v_new, head, n_copy_bytes);
}
/* Zero empty space. */
_n1 = _i + _n0 - _l; \
_n1 = _n1 < 0 ? 0 : _n1; \
_n0 -= _n1; \
- memcpy ((f) + _i, (e), _n0 * sizeof ((f)[0])); \
+ clib_memcpy ((f) + _i, (e), _n0 * sizeof ((f)[0])); \
if (_n1) \
- memcpy ((f) + 0, (e) + _n0, _n1 * sizeof ((f)[0])); \
+ clib_memcpy ((f) + 0, (e) + _n0, _n1 * sizeof ((f)[0])); \
} while (0)
/* Subtract element from fifo. */
log2_bytes = 1 + hash_pair_log2_bytes (h);
q = clib_mem_alloc (1 << log2_bytes);
}
- memcpy (q, &p->direct, hash_pair_bytes (h));
+ clib_memcpy (q, &p->direct, hash_pair_bytes (h));
pi->pairs = q;
if (h->log2_pair_size > 0)
if (len == 2)
{
- memcpy (p, q == r ? hash_forward1 (h, r) : r, hash_pair_bytes (h));
+ clib_memcpy (p, q == r ? hash_forward1 (h, r) : r, hash_pair_bytes (h));
set_is_user (v, i, 1);
}
else
{
/* If deleting a pair we need to keep non-null pairs together. */
if (q < e)
- memcpy (q, e, hash_pair_bytes (h));
+ clib_memcpy (q, e, hash_pair_bytes (h));
else
zero_pair (h, q);
if (is_vec)
{
set_is_user (v, i, 0);
if (old_value)
- memcpy (old_value, p->direct.value, hash_value_bytes (h));
+ clib_memcpy (old_value, p->direct.value, hash_value_bytes (h));
zero_pair (h, &p->direct);
}
}
if (found_key && op == UNSET)
{
if (old_value)
- memcpy (old_value, &p->direct.value, hash_value_bytes (h));
+ clib_memcpy (old_value, &p->direct.value, hash_value_bytes (h));
unset_indirect (v, i, &p->direct);
{
/* Save away old value for caller. */
if (old_value && found_key)
- memcpy (old_value, &p->direct.value, hash_value_bytes (h));
- memcpy (&p->direct.value, new_value, hash_value_bytes (h));
+ clib_memcpy (old_value, &p->direct.value, hash_value_bytes (h));
+ clib_memcpy (&p->direct.value, new_value, hash_value_bytes (h));
}
if (op == SET)
HEAP_DATA_ALIGN);
h_new = heap_header (v_new);
heap_dup_header (h_old, h_new);
- memcpy (v_new, v_old, v_bytes);
+ clib_memcpy (v_new, v_old, v_bytes);
return v_new;
}
copy_size = old_size;
else
copy_size = new_size;
- memcpy (q, p, copy_size);
+ clib_memcpy (q, p, copy_size);
clib_mem_free (p);
}
return q;
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef included_clib_memcpy_avx_h
+#define included_clib_memcpy_avx_h
+
+#include <stdint.h>
+#include <x86intrin.h>
+
+static inline void
+clib_mov16(u8 *dst, const u8 *src)
+{
+ __m128i xmm0;
+
+ xmm0 = _mm_loadu_si128((const __m128i *)src);
+ _mm_storeu_si128((__m128i *)dst, xmm0);
+}
+
+static inline void
+clib_mov32(u8 *dst, const u8 *src)
+{
+ __m256i ymm0;
+
+ ymm0 = _mm256_loadu_si256((const __m256i *)src);
+ _mm256_storeu_si256((__m256i *)dst, ymm0);
+}
+
+static inline void
+clib_mov64(u8 *dst, const u8 *src)
+{
+ clib_mov32((u8 *)dst + 0 * 32, (const u8 *)src + 0 * 32);
+ clib_mov32((u8 *)dst + 1 * 32, (const u8 *)src + 1 * 32);
+}
+
+static inline void
+clib_mov128(u8 *dst, const u8 *src)
+{
+ clib_mov64((u8 *)dst + 0 * 64, (const u8 *)src + 0 * 64);
+ clib_mov64((u8 *)dst + 1 * 64, (const u8 *)src + 1 * 64);
+}
+
+static inline void
+clib_mov256(u8 *dst, const u8 *src)
+{
+ clib_mov128((u8 *)dst + 0 * 128, (const u8 *)src + 0 * 128);
+ clib_mov128((u8 *)dst + 1 * 128, (const u8 *)src + 1 * 128);
+}
+
+static inline void
+clib_mov64blocks(u8 *dst, const u8 *src, size_t n)
+{
+ __m256i ymm0, ymm1;
+
+ while (n >= 64) {
+ ymm0 = _mm256_loadu_si256((const __m256i *)((const u8 *)src + 0 * 32));
+ n -= 64;
+ ymm1 = _mm256_loadu_si256((const __m256i *)((const u8 *)src + 1 * 32));
+ src = (const u8 *)src + 64;
+ _mm256_storeu_si256((__m256i *)((u8 *)dst + 0 * 32), ymm0);
+ _mm256_storeu_si256((__m256i *)((u8 *)dst + 1 * 32), ymm1);
+ dst = (u8 *)dst + 64;
+ }
+}
+
+static inline void
+clib_mov256blocks(u8 *dst, const u8 *src, size_t n)
+{
+ __m256i ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7;
+
+ while (n >= 256) {
+ ymm0 = _mm256_loadu_si256((const __m256i *)((const u8 *)src + 0 * 32));
+ n -= 256;
+ ymm1 = _mm256_loadu_si256((const __m256i *)((const u8 *)src + 1 * 32));
+ ymm2 = _mm256_loadu_si256((const __m256i *)((const u8 *)src + 2 * 32));
+ ymm3 = _mm256_loadu_si256((const __m256i *)((const u8 *)src + 3 * 32));
+ ymm4 = _mm256_loadu_si256((const __m256i *)((const u8 *)src + 4 * 32));
+ ymm5 = _mm256_loadu_si256((const __m256i *)((const u8 *)src + 5 * 32));
+ ymm6 = _mm256_loadu_si256((const __m256i *)((const u8 *)src + 6 * 32));
+ ymm7 = _mm256_loadu_si256((const __m256i *)((const u8 *)src + 7 * 32));
+ src = (const u8 *)src + 256;
+ _mm256_storeu_si256((__m256i *)((u8 *)dst + 0 * 32), ymm0);
+ _mm256_storeu_si256((__m256i *)((u8 *)dst + 1 * 32), ymm1);
+ _mm256_storeu_si256((__m256i *)((u8 *)dst + 2 * 32), ymm2);
+ _mm256_storeu_si256((__m256i *)((u8 *)dst + 3 * 32), ymm3);
+ _mm256_storeu_si256((__m256i *)((u8 *)dst + 4 * 32), ymm4);
+ _mm256_storeu_si256((__m256i *)((u8 *)dst + 5 * 32), ymm5);
+ _mm256_storeu_si256((__m256i *)((u8 *)dst + 6 * 32), ymm6);
+ _mm256_storeu_si256((__m256i *)((u8 *)dst + 7 * 32), ymm7);
+ dst = (u8 *)dst + 256;
+ }
+}
+
+static inline void *
+clib_memcpy(void *dst, const void *src, size_t n)
+{
+ uword dstu = (uword)dst;
+ uword srcu = (uword)src;
+ void *ret = dst;
+ size_t dstofss;
+ size_t bits;
+
+ /**
+ * Copy less than 16 bytes
+ */
+ if (n < 16) {
+ if (n & 0x01) {
+ *(u8 *)dstu = *(const u8 *)srcu;
+ srcu = (uword)((const u8 *)srcu + 1);
+ dstu = (uword)((u8 *)dstu + 1);
+ }
+ if (n & 0x02) {
+ *(uint16_t *)dstu = *(const uint16_t *)srcu;
+ srcu = (uword)((const uint16_t *)srcu + 1);
+ dstu = (uword)((uint16_t *)dstu + 1);
+ }
+ if (n & 0x04) {
+ *(uint32_t *)dstu = *(const uint32_t *)srcu;
+ srcu = (uword)((const uint32_t *)srcu + 1);
+ dstu = (uword)((uint32_t *)dstu + 1);
+ }
+ if (n & 0x08) {
+ *(uint64_t *)dstu = *(const uint64_t *)srcu;
+ }
+ return ret;
+ }
+
+ /**
+ * Fast way when copy size doesn't exceed 512 bytes
+ */
+ if (n <= 32) {
+ clib_mov16((u8 *)dst, (const u8 *)src);
+ clib_mov16((u8 *)dst - 16 + n, (const u8 *)src - 16 + n);
+ return ret;
+ }
+ if (n <= 64) {
+ clib_mov32((u8 *)dst, (const u8 *)src);
+ clib_mov32((u8 *)dst - 32 + n, (const u8 *)src - 32 + n);
+ return ret;
+ }
+ if (n <= 512) {
+ if (n >= 256) {
+ n -= 256;
+ clib_mov256((u8 *)dst, (const u8 *)src);
+ src = (const u8 *)src + 256;
+ dst = (u8 *)dst + 256;
+ }
+ if (n >= 128) {
+ n -= 128;
+ clib_mov128((u8 *)dst, (const u8 *)src);
+ src = (const u8 *)src + 128;
+ dst = (u8 *)dst + 128;
+ }
+ if (n >= 64) {
+ n -= 64;
+ clib_mov64((u8 *)dst, (const u8 *)src);
+ src = (const u8 *)src + 64;
+ dst = (u8 *)dst + 64;
+ }
+COPY_BLOCK_64_BACK31:
+ if (n > 32) {
+ clib_mov32((u8 *)dst, (const u8 *)src);
+ clib_mov32((u8 *)dst - 32 + n, (const u8 *)src - 32 + n);
+ return ret;
+ }
+ if (n > 0) {
+ clib_mov32((u8 *)dst - 32 + n, (const u8 *)src - 32 + n);
+ }
+ return ret;
+ }
+
+ /**
+ * Make store aligned when copy size exceeds 512 bytes
+ */
+ dstofss = (uword)dst & 0x1F;
+ if (dstofss > 0) {
+ dstofss = 32 - dstofss;
+ n -= dstofss;
+ clib_mov32((u8 *)dst, (const u8 *)src);
+ src = (const u8 *)src + dstofss;
+ dst = (u8 *)dst + dstofss;
+ }
+
+ /**
+ * Copy 256-byte blocks.
+ * Use copy block function for better instruction order control,
+ * which is important when load is unaligned.
+ */
+ clib_mov256blocks((u8 *)dst, (const u8 *)src, n);
+ bits = n;
+ n = n & 255;
+ bits -= n;
+ src = (const u8 *)src + bits;
+ dst = (u8 *)dst + bits;
+
+ /**
+ * Copy 64-byte blocks.
+ * Use copy block function for better instruction order control,
+ * which is important when load is unaligned.
+ */
+ if (n >= 64) {
+ clib_mov64blocks((u8 *)dst, (const u8 *)src, n);
+ bits = n;
+ n = n & 63;
+ bits -= n;
+ src = (const u8 *)src + bits;
+ dst = (u8 *)dst + bits;
+ }
+
+ /**
+ * Copy whatever left
+ */
+ goto COPY_BLOCK_64_BACK31;
+}
+
+
+#endif /* included_clib_mamcpy_avx_h */
+
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef included_clib_memcpy_sse3_h
+#define included_clib_memcpy_sse3_h
+
+#include <stdint.h>
+#include <x86intrin.h>
+
+static inline void
+clib_mov16(u8 *dst, const u8 *src)
+{
+ __m128i xmm0;
+
+ xmm0 = _mm_loadu_si128((const __m128i *)src);
+ _mm_storeu_si128((__m128i *)dst, xmm0);
+}
+
+static inline void
+clib_mov32(u8 *dst, const u8 *src)
+{
+ clib_mov16((u8 *)dst + 0 * 16, (const u8 *)src + 0 * 16);
+ clib_mov16((u8 *)dst + 1 * 16, (const u8 *)src + 1 * 16);
+}
+
+static inline void
+clib_mov64(u8 *dst, const u8 *src)
+{
+ clib_mov32((u8 *)dst + 0 * 32, (const u8 *)src + 0 * 32);
+ clib_mov32((u8 *)dst + 1 * 32, (const u8 *)src + 1 * 32);
+}
+
+static inline void
+clib_mov128(u8 *dst, const u8 *src)
+{
+ clib_mov64((u8 *)dst + 0 * 64, (const u8 *)src + 0 * 64);
+ clib_mov64((u8 *)dst + 1 * 64, (const u8 *)src + 1 * 64);
+}
+
+static inline void
+clib_mov256(u8 *dst, const u8 *src)
+{
+ clib_mov128((u8 *)dst + 0 * 128, (const u8 *)src + 0 * 128);
+ clib_mov128((u8 *)dst + 1 * 128, (const u8 *)src + 1 * 128);
+}
+
+/**
+ * Macro for copying unaligned block from one location to another with constant load offset,
+ * 47 bytes leftover maximum,
+ * locations should not overlap.
+ * Requirements:
+ * - Store is aligned
+ * - Load offset is <offset>, which must be immediate value within [1, 15]
+ * - For <src>, make sure <offset> bit backwards & <16 - offset> bit forwards are available for loading
+ * - <dst>, <src>, <len> must be variables
+ * - __m128i <xmm0> ~ <xmm8> must be pre-defined
+ */
+#define CLIB_MVUNALIGN_LEFT47_IMM(dst, src, len, offset) \
+({ \
+ int tmp; \
+ while (len >= 128 + 16 - offset) { \
+ xmm0 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 0 * 16)); \
+ len -= 128; \
+ xmm1 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 1 * 16)); \
+ xmm2 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 2 * 16)); \
+ xmm3 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 3 * 16)); \
+ xmm4 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 4 * 16)); \
+ xmm5 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 5 * 16)); \
+ xmm6 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 6 * 16)); \
+ xmm7 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 7 * 16)); \
+ xmm8 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 8 * 16)); \
+ src = (const u8 *)src + 128; \
+ _mm_storeu_si128((__m128i *)((u8 *)dst + 0 * 16), _mm_alignr_epi8(xmm1, xmm0, offset)); \
+ _mm_storeu_si128((__m128i *)((u8 *)dst + 1 * 16), _mm_alignr_epi8(xmm2, xmm1, offset)); \
+ _mm_storeu_si128((__m128i *)((u8 *)dst + 2 * 16), _mm_alignr_epi8(xmm3, xmm2, offset)); \
+ _mm_storeu_si128((__m128i *)((u8 *)dst + 3 * 16), _mm_alignr_epi8(xmm4, xmm3, offset)); \
+ _mm_storeu_si128((__m128i *)((u8 *)dst + 4 * 16), _mm_alignr_epi8(xmm5, xmm4, offset)); \
+ _mm_storeu_si128((__m128i *)((u8 *)dst + 5 * 16), _mm_alignr_epi8(xmm6, xmm5, offset)); \
+ _mm_storeu_si128((__m128i *)((u8 *)dst + 6 * 16), _mm_alignr_epi8(xmm7, xmm6, offset)); \
+ _mm_storeu_si128((__m128i *)((u8 *)dst + 7 * 16), _mm_alignr_epi8(xmm8, xmm7, offset)); \
+ dst = (u8 *)dst + 128; \
+ } \
+ tmp = len; \
+ len = ((len - 16 + offset) & 127) + 16 - offset; \
+ tmp -= len; \
+ src = (const u8 *)src + tmp; \
+ dst = (u8 *)dst + tmp; \
+ if (len >= 32 + 16 - offset) { \
+ while (len >= 32 + 16 - offset) { \
+ xmm0 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 0 * 16)); \
+ len -= 32; \
+ xmm1 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 1 * 16)); \
+ xmm2 = _mm_loadu_si128((const __m128i *)((const u8 *)src - offset + 2 * 16)); \
+ src = (const u8 *)src + 32; \
+ _mm_storeu_si128((__m128i *)((u8 *)dst + 0 * 16), _mm_alignr_epi8(xmm1, xmm0, offset)); \
+ _mm_storeu_si128((__m128i *)((u8 *)dst + 1 * 16), _mm_alignr_epi8(xmm2, xmm1, offset)); \
+ dst = (u8 *)dst + 32; \
+ } \
+ tmp = len; \
+ len = ((len - 16 + offset) & 31) + 16 - offset; \
+ tmp -= len; \
+ src = (const u8 *)src + tmp; \
+ dst = (u8 *)dst + tmp; \
+ } \
+})
+
+/**
+ * Macro for copying unaligned block from one location to another,
+ * 47 bytes leftover maximum,
+ * locations should not overlap.
+ * Use switch here because the aligning instruction requires immediate value for shift count.
+ * Requirements:
+ * - Store is aligned
+ * - Load offset is <offset>, which must be within [1, 15]
+ * - For <src>, make sure <offset> bit backwards & <16 - offset> bit forwards are available for loading
+ * - <dst>, <src>, <len> must be variables
+ * - __m128i <xmm0> ~ <xmm8> used in CLIB_MVUNALIGN_LEFT47_IMM must be pre-defined
+ */
+#define CLIB_MVUNALIGN_LEFT47(dst, src, len, offset) \
+({ \
+ switch (offset) { \
+ case 0x01: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x01); break; \
+ case 0x02: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x02); break; \
+ case 0x03: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x03); break; \
+ case 0x04: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x04); break; \
+ case 0x05: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x05); break; \
+ case 0x06: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x06); break; \
+ case 0x07: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x07); break; \
+ case 0x08: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x08); break; \
+ case 0x09: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x09); break; \
+ case 0x0A: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x0A); break; \
+ case 0x0B: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x0B); break; \
+ case 0x0C: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x0C); break; \
+ case 0x0D: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x0D); break; \
+ case 0x0E: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x0E); break; \
+ case 0x0F: CLIB_MVUNALIGN_LEFT47_IMM(dst, src, n, 0x0F); break; \
+ default:; \
+ } \
+})
+
+static inline void *
+clib_memcpy(void *dst, const void *src, size_t n)
+{
+ __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
+ uword dstu = (uword)dst;
+ uword srcu = (uword)src;
+ void *ret = dst;
+ size_t dstofss;
+ size_t srcofs;
+
+ /**
+ * Copy less than 16 bytes
+ */
+ if (n < 16) {
+ if (n & 0x01) {
+ *(u8 *)dstu = *(const u8 *)srcu;
+ srcu = (uword)((const u8 *)srcu + 1);
+ dstu = (uword)((u8 *)dstu + 1);
+ }
+ if (n & 0x02) {
+ *(u16 *)dstu = *(const u16 *)srcu;
+ srcu = (uword)((const u16 *)srcu + 1);
+ dstu = (uword)((u16 *)dstu + 1);
+ }
+ if (n & 0x04) {
+ *(u32 *)dstu = *(const u32 *)srcu;
+ srcu = (uword)((const u32 *)srcu + 1);
+ dstu = (uword)((u32 *)dstu + 1);
+ }
+ if (n & 0x08) {
+ *(u64 *)dstu = *(const u64 *)srcu;
+ }
+ return ret;
+ }
+
+ /**
+ * Fast way when copy size doesn't exceed 512 bytes
+ */
+ if (n <= 32) {
+ clib_mov16((u8 *)dst, (const u8 *)src);
+ clib_mov16((u8 *)dst - 16 + n, (const u8 *)src - 16 + n);
+ return ret;
+ }
+ if (n <= 48) {
+ clib_mov32((u8 *)dst, (const u8 *)src);
+ clib_mov16((u8 *)dst - 16 + n, (const u8 *)src - 16 + n);
+ return ret;
+ }
+ if (n <= 64) {
+ clib_mov32((u8 *)dst, (const u8 *)src);
+ clib_mov16((u8 *)dst + 32, (const u8 *)src + 32);
+ clib_mov16((u8 *)dst - 16 + n, (const u8 *)src - 16 + n);
+ return ret;
+ }
+ if (n <= 128) {
+ goto COPY_BLOCK_128_BACK15;
+ }
+ if (n <= 512) {
+ if (n >= 256) {
+ n -= 256;
+ clib_mov128((u8 *)dst, (const u8 *)src);
+ clib_mov128((u8 *)dst + 128, (const u8 *)src + 128);
+ src = (const u8 *)src + 256;
+ dst = (u8 *)dst + 256;
+ }
+COPY_BLOCK_255_BACK15:
+ if (n >= 128) {
+ n -= 128;
+ clib_mov128((u8 *)dst, (const u8 *)src);
+ src = (const u8 *)src + 128;
+ dst = (u8 *)dst + 128;
+ }
+COPY_BLOCK_128_BACK15:
+ if (n >= 64) {
+ n -= 64;
+ clib_mov64((u8 *)dst, (const u8 *)src);
+ src = (const u8 *)src + 64;
+ dst = (u8 *)dst + 64;
+ }
+COPY_BLOCK_64_BACK15:
+ if (n >= 32) {
+ n -= 32;
+ clib_mov32((u8 *)dst, (const u8 *)src);
+ src = (const u8 *)src + 32;
+ dst = (u8 *)dst + 32;
+ }
+ if (n > 16) {
+ clib_mov16((u8 *)dst, (const u8 *)src);
+ clib_mov16((u8 *)dst - 16 + n, (const u8 *)src - 16 + n);
+ return ret;
+ }
+ if (n > 0) {
+ clib_mov16((u8 *)dst - 16 + n, (const u8 *)src - 16 + n);
+ }
+ return ret;
+ }
+
+ /**
+ * Make store aligned when copy size exceeds 512 bytes,
+ * and make sure the first 15 bytes are copied, because
+ * unaligned copy functions require up to 15 bytes
+ * backwards access.
+ */
+ dstofss = 16 - ((uword)dst & 0x0F) + 16;
+ n -= dstofss;
+ clib_mov32((u8 *)dst, (const u8 *)src);
+ src = (const u8 *)src + dstofss;
+ dst = (u8 *)dst + dstofss;
+ srcofs = ((uword)src & 0x0F);
+
+ /**
+ * For aligned copy
+ */
+ if (srcofs == 0) {
+ /**
+ * Copy 256-byte blocks
+ */
+ for (; n >= 256; n -= 256) {
+ clib_mov256((u8 *)dst, (const u8 *)src);
+ dst = (u8 *)dst + 256;
+ src = (const u8 *)src + 256;
+ }
+
+ /**
+ * Copy whatever left
+ */
+ goto COPY_BLOCK_255_BACK15;
+ }
+
+ /**
+ * For copy with unaligned load
+ */
+ CLIB_MVUNALIGN_LEFT47(dst, src, n, srcofs);
+
+ /**
+ * Copy whatever left
+ */
+ goto COPY_BLOCK_64_BACK15;
+}
+
+
+#undef CLIB_MVUNALIGN_LEFT47_IMM
+#undef CLIB_MVUNALIGN_LEFT47
+
+#endif /* included_clib_memcpy_sse3_h */
+
sk = (void *) (h->key_vector_or_heap + i);
sk->heap_handle = handle;
sk->vec.len = n_key_bytes;
- memcpy (sk->vec.vector_data, key, n_key_bytes);
+ clib_memcpy (sk->vec.vector_data, key, n_key_bytes);
/* Advance key past vector header. */
i += sizeof (sk[0]);
}
n_key_bytes = h->n_key_bytes;
- memcpy (k, key, n_key_bytes);
+ clib_memcpy (k, key, n_key_bytes);
}
ikey = i;
if (kv16->values[j] != (u32)~0)
{
vec_add2 (shs, sh, 1);
- memcpy (sh->key, &kv16->kb.k_u32x4[j], p->key_size);
+ clib_memcpy (sh->key, &kv16->kb.k_u32x4[j], p->key_size);
sh->value = kv16->values[j];
}
}
if (kv8->values[j] != (u32)~0)
{
vec_add2 (shs, sh, 1);
- memcpy (sh->key, &kv8->kb.k_u64[j], p->key_size);
+ clib_memcpy (sh->key, &kv8->kb.k_u64[j], p->key_size);
sh->value = kv8->values[j];
}
}
if (kv8v8->values[j] != (u64)~0)
{
vec_add2 (shs, sh, 1);
- memcpy (sh->key, &kv8v8->kb.k_u64[j], p->key_size);
+ clib_memcpy (sh->key, &kv8v8->kb.k_u64[j], p->key_size);
sh->value = kv8v8->values[j];
}
}
if (kv4->values[j] != (u32)~0)
{
vec_add2 (shs, sh, 1);
- memcpy (sh->key, &kv4->kb.kb[j], p->key_size);
+ clib_memcpy (sh->key, &kv4->kb.kb[j], p->key_size);
sh->value = kv4->values[j];
}
}
hash_foreach_pair (hp, p->overflow_hash,
({
vec_add2 (shs, sh, 1);
- memcpy (sh->key, (u8 *)hp->key, p->key_size);
+ clib_memcpy (sh->key, (u8 *)hp->key, p->key_size);
sh->value = hp->value[0];
}));
return;
}
kcopy = clib_mem_alloc (p->key_size);
- memcpy (kcopy, key, p->key_size);
+ clib_memcpy (kcopy, key, p->key_size);
hash_set_mem (p->overflow_hash, kcopy, value);
p->nitems++;
p->nitems_in_overflow++;
{
if (kv16->values[i] == (u32)~0)
{
- memcpy (&kv16->kb.k_u32x4[i], key, p->key_size);
+ clib_memcpy (&kv16->kb.k_u32x4[i], key, p->key_size);
kv16->values[i] = (u32)(u64) value;
return;
}
for (i = 0; i < 3; i++)
{
kcopy = clib_mem_alloc (p->key_size);
- memcpy (kcopy, &kv16->kb.k_u32x4[i], p->key_size);
+ clib_memcpy (kcopy, &kv16->kb.k_u32x4[i], p->key_size);
hash_set_mem (p->overflow_hash, kcopy, kv16->values[i]);
p->nitems_in_overflow++;
}
/* Add new key to overflow */
kcopy = clib_mem_alloc (p->key_size);
- memcpy (kcopy, key, p->key_size);
+ clib_memcpy (kcopy, key, p->key_size);
hash_set_mem (p->overflow_hash, kcopy, value);
p->buckets[bucket] = PFHASH_BUCKET_OVERFLOW;
p->overflow_count++;
{
if (kv8->values[i] == (u32)~0)
{
- memcpy (&kv8->kb.k_u64[i], key, 8);
+ clib_memcpy (&kv8->kb.k_u64[i], key, 8);
kv8->values[i] = (u32)(u64) value;
return;
}
for (i = 0; i < 5; i++)
{
kcopy = clib_mem_alloc (p->key_size);
- memcpy (kcopy, &kv8->kb.k_u64[i], 8);
+ clib_memcpy (kcopy, &kv8->kb.k_u64[i], 8);
hash_set_mem (p->overflow_hash, kcopy, kv8->values[i]);
p->nitems_in_overflow++;
}
{
if (kv8v8->values[i] == (u64)~0)
{
- memcpy (&kv8v8->kb.k_u64[i], key, 8);
+ clib_memcpy (&kv8v8->kb.k_u64[i], key, 8);
kv8v8->values[i] = (u64) value;
return;
}
for (i = 0; i < 4; i++)
{
kcopy = clib_mem_alloc (p->key_size);
- memcpy (kcopy, &kv8v8->kb.k_u64[i], 8);
+ clib_memcpy (kcopy, &kv8v8->kb.k_u64[i], 8);
hash_set_mem (p->overflow_hash, kcopy, kv8v8->values[i]);
p->nitems_in_overflow++;
}
}
/* Add new key to overflow */
kcopy = clib_mem_alloc (p->key_size);
- memcpy (kcopy, key, p->key_size);
+ clib_memcpy (kcopy, key, p->key_size);
hash_set_mem (p->overflow_hash, kcopy, value);
p->buckets[bucket] = PFHASH_BUCKET_OVERFLOW;
p->overflow_count++;
{
if (kv4->values[i] == (u32)~0)
{
- memcpy (&kv4->kb.kb[i], key, 4);
+ clib_memcpy (&kv4->kb.kb[i], key, 4);
kv4->values[i] = (u32)(u64) value;
return;
}
for (i = 0; i < 8; i++)
{
kcopy = clib_mem_alloc (p->key_size);
- memcpy (kcopy, &kv4->kb.kb[i], 4);
+ clib_memcpy (kcopy, &kv4->kb.kb[i], 4);
hash_set_mem (p->overflow_hash, kcopy, kv4->values[i]);
p->nitems_in_overflow++;
}
/* Add new key to overflow */
kcopy = clib_mem_alloc (p->key_size);
- memcpy (kcopy, key, p->key_size);
+ clib_memcpy (kcopy, key, p->key_size);
hash_set_mem (p->overflow_hash, kcopy, value);
p->buckets[bucket] = PFHASH_BUCKET_OVERFLOW;
p->overflow_count++;
if (len > 0)
{
p = serialize_get (m, len);
- memcpy (p, s, len);
+ clib_memcpy (p, s, len);
}
}
{
r = vec_new (char, len + 1);
p = unserialize_get (m, len);
- memcpy (r, p, len);
+ clib_memcpy (r, p, len);
/* Null terminate. */
r[len] = 0;
u8 * s = va_arg (*va, u8 *);
u32 n = va_arg (*va, u32);
u8 * p = serialize_get (m, n * sizeof (u8));
- memcpy (p, s, n * sizeof (u8));
+ clib_memcpy (p, s, n * sizeof (u8));
}
void unserialize_vec_8 (serialize_main_t * m, va_list * va)
u8 * s = va_arg (*va, u8 *);
u32 n = va_arg (*va, u32);
u8 * p = unserialize_get (m, n);
- memcpy (s, p, n);
+ clib_memcpy (s, p, n);
}
#define _(n_bits) \
void * p;
serialize_integer (m, magic_bytes, sizeof (magic_bytes));
p = serialize_get (m, magic_bytes);
- memcpy (p, magic, magic_bytes);
+ clib_memcpy (p, magic, magic_bytes);
}
void unserialize_check_magic (serialize_main_t * m, void * magic,
if (n_left_o > 0 && n_left_b > 0)
{
uword n = clib_min (n_left_b, n_left_o);
- memcpy (s->buffer + cur_bi, s->overflow_buffer, n);
+ clib_memcpy (s->buffer + cur_bi, s->overflow_buffer, n);
cur_bi += n;
n_left_b -= n;
n_left_o -= n;
{
struct sockaddr_un * su = addr;
su->sun_family = PF_LOCAL;
- memcpy (&su->sun_path, config,
+ clib_memcpy (&su->sun_path, config,
clib_min (sizeof (su->sun_path), 1 + strlen (config)));
*addr_len = sizeof (su[0]);
}
if (! host)
error = clib_error_return (0, "unknown host `%s'", config);
else
- memcpy (&sa->sin_addr.s_addr, host->h_addr_list[0], host->h_length);
+ clib_memcpy (&sa->sin_addr.s_addr, host->h_addr_list[0], host->h_length);
}
else
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
/*
Copyright (c) 2001, 2002, 2003 Eliot Dresselhaus
/* Exchanges source and destination. */
void clib_memswap (void * _a, void * _b, uword bytes);
+#if __AVX__
+#include <vppinfra/memcpy_avx.h>
+#elif __SSE3__
+#include <vppinfra/memcpy_sse3.h>
+#else
+#define clib_memcpy(a,b,c) memcpy(a,b,c)
+#endif
+
#endif /* included_clib_string_h */
/* Put in new null terminated string. */
memset (s->contents, 0, vec_len (s->contents));
- memcpy (s->contents, interp, strlen (interp));
+ clib_memcpy (s->contents, interp, strlen (interp));
return 0;
}
d = ELOG_DATA (em, e);
v = format (0, "foo %d%c", i, 0);
- memcpy (d->s, v, clib_min (vec_len (v), sizeof (d->s)));
+ clib_memcpy (d->s, v, clib_min (vec_len (v), sizeof (d->s)));
}
{
clib_panic ("vec_resize fails, length increment %d, data bytes %d, alignment %d",
length_increment, data_bytes, data_align);
- memcpy (new, old, old_alloc_bytes);
+ clib_memcpy (new, old, old_alloc_bytes);
clib_mem_free (old);
v = new;
if (_v(l) > 0) \
{ \
vec_resize_ha (_v(v), _v(l), (H), (A)); \
- memcpy (_v(v), (V), _v(l) * sizeof ((V)[0])); \
+ clib_memcpy (_v(v), (V), _v(l) * sizeof ((V)[0]));\
} \
_v(v); \
})
@param DST destination
@param SRC source
*/
-#define vec_copy(DST,SRC) memcpy (DST, SRC, vec_len (DST) * sizeof ((DST)[0]))
+#define vec_copy(DST,SRC) clib_memcpy (DST, SRC, vec_len (DST) * \
+ sizeof ((DST)[0]))
/** \brief Clone a vector. Make a new vector with the
same size as a given vector but possibly with a different type.
word _v(n) = (N); \
word _v(l) = vec_len (V); \
V = _vec_resize ((V), _v(n), (_v(l) + _v(n)) * sizeof ((V)[0]), (H), (A)); \
- memcpy ((V) + _v(l), (E), _v(n) * sizeof ((V)[0])); \
+ clib_memcpy ((V) + _v(l), (E), _v(n) * sizeof ((V)[0])); \
} while (0)
/** \brief Add N elements to end of vector V (no header, unspecified alignment)
memmove ((V) + _v(m) + _v(n), \
(V) + _v(m), \
(_v(l) - _v(m)) * sizeof ((V)[0])); \
- memcpy ((V) + _v(m), (E), _v(n) * sizeof ((V)[0])); \
+ clib_memcpy ((V) + _v(m), (E), \
+ _v(n) * sizeof ((V)[0])); \
} while (0)
/** \brief Insert N vector elements starting at element M,
\
v1 = _vec_resize ((v1), _v(l2), \
(_v(l1) + _v(l2)) * sizeof ((v1)[0]), 0, 0); \
- memcpy ((v1) + _v(l1), (v2), _v(l2) * sizeof ((v2)[0])); \
+ clib_memcpy ((v1) + _v(l1), (v2), _v(l2) * sizeof ((v2)[0])); \
} while (0)
/** \brief Append v2 after v1. Result in v1. Specified alignment.
\
v1 = _vec_resize ((v1), _v(l2), \
(_v(l1) + _v(l2)) * sizeof ((v1)[0]), 0, align); \
- memcpy ((v1) + _v(l1), (v2), _v(l2) * sizeof ((v2)[0])); \
+ clib_memcpy ((v1) + _v(l1), (v2), _v(l2) * sizeof ((v2)[0])); \
} while (0)
/** \brief Prepend v2 before v1. Result in v1.
v1 = _vec_resize ((v1), _v(l2), \
(_v(l1) + _v(l2)) * sizeof ((v1)[0]), 0, 0); \
memmove ((v1) + _v(l2), (v1), _v(l1) * sizeof ((v1)[0])); \
- memcpy ((v1), (v2), _v(l2) * sizeof ((v2)[0])); \
+ clib_memcpy ((v1), (v2), _v(l2) * sizeof ((v2)[0])); \
} while (0)
/** \brief Prepend v2 before v1. Result in v1. Specified alignment
v1 = _vec_resize ((v1), _v(l2), \
(_v(l1) + _v(l2)) * sizeof ((v1)[0]), 0, align); \
memmove ((v1) + _v(l2), (v1), _v(l1) * sizeof ((v1)[0])); \
- memcpy ((v1), (v2), _v(l2) * sizeof ((v2)[0])); \
+ clib_memcpy ((v1), (v2), _v(l2) * sizeof ((v2)[0])); \
} while (0)
vec_reset_length (V); \
vec_validate ((V), (L)); \
if ((S) && (L)) \
- memcpy ((V), (S), (L)); \
+ clib_memcpy ((V), (S), (L)); \
(V)[(L)] = 0; \
} while (0)