Add clib_memcpy macro based on DPDK rte_memcpy implementation

Change-Id: I22cb443c4bd0bf298abb6f06e8e4ca65a44a2854
Signed-off-by: Damjan Marion <damarion@cisco.com>
This commit is contained in:
Damjan Marion
2016-03-13 02:22:06 +01:00
parent 2b836cf4d1
commit f1213b8277
142 changed files with 1407 additions and 803 deletions
+1 -1
View File
@@ -188,7 +188,7 @@ int vnet_" encap_stack "_add_del_tunnel
/* $$$$ 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);
+3 -3
View File
@@ -306,7 +306,7 @@ static void local_set_variable_nolock (svmdb_client_t *client,
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 {
@@ -315,7 +315,7 @@ static void local_set_variable_nolock (svmdb_client_t *client,
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);
@@ -448,7 +448,7 @@ void *svmdb_local_get_vec_variable (svmdb_client_t *client, char *var,
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);
+3 -3
View File
@@ -102,7 +102,7 @@ void vl_msg_api_trace(api_main_t *am, vl_api_trace_t *tp, void *msg)
}
vec_validate(msg_copy, cfgp->size - 1);
memcpy(msg_copy, msg, cfgp->size);
clib_memcpy(msg_copy, msg, cfgp->size);
*this_trace = msg_copy;
}
@@ -772,7 +772,7 @@ static void vl_msg_api_process_file (vlib_main_t *vm, u8 *filename,
/* 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));
/*
@@ -870,7 +870,7 @@ static void vl_msg_api_process_file (vlib_main_t *vm, u8 *filename,
}
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);
}
+2 -2
View File
@@ -422,7 +422,7 @@ memclnt_process (vlib_main_t * vm,
}
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);
@@ -1174,7 +1174,7 @@ void vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length)
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;
@@ -134,7 +134,7 @@ int unix_shared_memory_queue_add_nolock (unix_shared_memory_queue_t *q,
}
tailp = (i8 *)(&q->data[0] + q->elsize*q->tail);
memcpy(tailp, elem, q->elsize);
clib_memcpy(tailp, elem, q->elsize);
q->tail++;
q->cursize++;
@@ -163,7 +163,7 @@ int unix_shared_memory_queue_add_raw (unix_shared_memory_queue_t *q,
}
tailp = (i8 *)(&q->data[0] + q->elsize*q->tail);
memcpy(tailp, elem, q->elsize);
clib_memcpy(tailp, elem, q->elsize);
q->tail++;
q->cursize++;
@@ -202,7 +202,7 @@ int unix_shared_memory_queue_add (unix_shared_memory_queue_t *q,
}
tailp = (i8 *)(&q->data[0] + q->elsize*q->tail);
memcpy(tailp, elem, q->elsize);
clib_memcpy(tailp, elem, q->elsize);
q->tail++;
q->cursize++;
@@ -250,7 +250,7 @@ int unix_shared_memory_queue_sub(unix_shared_memory_queue_t *q,
}
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)
@@ -280,7 +280,7 @@ int unix_shared_memory_queue_sub_raw (unix_shared_memory_queue_t *q,
}
headp = (i8 *)(&q->data[0] + q->elsize*q->head);
memcpy(elem, headp, q->elsize);
clib_memcpy(elem, headp, q->elsize);
q->head++;
q->cursize--;
+1 -1
View File
@@ -301,7 +301,7 @@ clib_error_t * vl_socket_read_ready (unix_file_t * uf)
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;
+4 -4
View File
@@ -1086,7 +1086,7 @@ vlib_packet_template_buffer_init (vlib_main_t * vm,
{
vlib_buffer_t * b = vlib_get_buffer (vm, buffers[i]);
ASSERT (b->current_length == vec_len (t->packet_data));
memcpy (vlib_buffer_get_current (b), t->packet_data, b->current_length);
clib_memcpy (vlib_buffer_get_current (b), t->packet_data, b->current_length);
}
}
@@ -1143,7 +1143,7 @@ vlib_packet_template_get_packet (vlib_main_t * vm,
*bi_result = bi;
b = vlib_get_buffer (vm, bi);
memcpy (vlib_buffer_get_current (b),
clib_memcpy (vlib_buffer_get_current (b),
t->packet_data, vec_len(t->packet_data));
b->current_length = vec_len(t->packet_data);
@@ -1198,7 +1198,7 @@ u32 vlib_buffer_add_data (vlib_main_t * vm,
ASSERT (n_buffer_bytes >= b->current_length);
n_left_this_buffer = n_buffer_bytes - (b->current_data + b->current_length);
n = clib_min (n_left_this_buffer, n_left);
memcpy (vlib_buffer_get_current (b) + b->current_length, d, n);
clib_memcpy (vlib_buffer_get_current (b) + b->current_length, d, n);
b->current_length += n;
n_left -= n;
if (n_left == 0)
@@ -1240,7 +1240,7 @@ vlib_buffer_chain_append_data_with_alloc(vlib_main_t *vm,
}
u16 len = (data_len > max)?max:data_len;
memcpy(vlib_buffer_get_current (l) + l->current_length, data + copied, len);
clib_memcpy(vlib_buffer_get_current (l) + l->current_length, data + copied, len);
vlib_buffer_chain_increase_length(first, l, len);
data_len -= len;
copied += len;
+3 -4
View File
@@ -46,7 +46,6 @@
#undef always_inline // dpdk and clib use conflicting always_inline macros.
#include <rte_config.h>
#include <rte_mbuf.h>
#include <rte_memcpy.h>
#if CLIB_DEBUG > 0
#define always_inline static inline
@@ -151,7 +150,7 @@ vlib_buffer_contents (vlib_main_t * vm, u32 buffer_index, u8 * contents)
{
b = vlib_get_buffer (vm, buffer_index);
l = b->current_length;
memcpy (contents + content_len, b->data + b->current_data, l);
clib_memcpy (contents + content_len, b->data + b->current_data, l);
content_len += l;
if (! (b->flags & VLIB_BUFFER_NEXT_PRESENT))
break;
@@ -493,9 +492,9 @@ vlib_buffer_chain_append_data(vlib_main_t *vm,
ASSERT(n_buffer_bytes >= last->current_length + last->current_data);
u16 len = clib_min(data_len, n_buffer_bytes - last->current_length - last->current_data);
#if DPDK == 1
rte_memcpy(vlib_buffer_get_current (last) + last->current_length, data, len);
clib_memcpy(vlib_buffer_get_current (last) + last->current_length, data, len);
#else
memcpy(vlib_buffer_get_current (last) + last->current_length, data, len);
clib_memcpy(vlib_buffer_get_current (last) + last->current_length, data, len);
#endif
vlib_buffer_chain_increase_length(first, last, len);
return len;
+4 -5
View File
@@ -42,7 +42,6 @@
#include <rte_common.h>
#include <rte_log.h>
#include <rte_memory.h>
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_tailq.h>
#include <rte_eal.h>
@@ -771,7 +770,7 @@ vlib_packet_template_buffer_init (vlib_main_t * vm,
{
vlib_buffer_t * b = vlib_get_buffer (vm, buffers[i]);
ASSERT (b->current_length == vec_len (t->packet_data));
memcpy (vlib_buffer_get_current (b), t->packet_data, b->current_length);
clib_memcpy (vlib_buffer_get_current (b), t->packet_data, b->current_length);
}
}
@@ -812,7 +811,7 @@ vlib_packet_template_get_packet (vlib_main_t * vm,
*bi_result = bi;
b = vlib_get_buffer (vm, bi);
memcpy (vlib_buffer_get_current (b),
clib_memcpy (vlib_buffer_get_current (b),
t->packet_data, vec_len(t->packet_data));
b->current_length = vec_len(t->packet_data);
@@ -858,7 +857,7 @@ u32 vlib_buffer_add_data (vlib_main_t * vm,
ASSERT (n_buffer_bytes >= b->current_length);
n_left_this_buffer = n_buffer_bytes - (b->current_data + b->current_length);
n = clib_min (n_left_this_buffer, n_left);
memcpy (vlib_buffer_get_current (b) + b->current_length, d, n);
clib_memcpy (vlib_buffer_get_current (b) + b->current_length, d, n);
b->current_length += n;
n_left -= n;
if (n_left == 0)
@@ -900,7 +899,7 @@ vlib_buffer_chain_append_data_with_alloc(vlib_main_t *vm,
}
u16 len = (data_len > max)?max:data_len;
rte_memcpy(vlib_buffer_get_current (l) + l->current_length, data + copied, len);
clib_memcpy(vlib_buffer_get_current (l) + l->current_length, data + copied, len);
vlib_buffer_chain_increase_length(first, l, len);
data_len -= len;
copied += len;
+2 -2
View File
@@ -169,7 +169,7 @@ void vlib_register_errors (vlib_main_t * vm,
l = vec_len (em->error_strings_heap);
memcpy (vec_elt_at_index (em->error_strings_heap, n->error_heap_index),
clib_memcpy (vec_elt_at_index (em->error_strings_heap, n->error_heap_index),
error_strings,
n_errors * sizeof (error_strings[0]));
@@ -179,7 +179,7 @@ void vlib_register_errors (vlib_main_t * vm,
/* Zero counters for re-registrations of errors. */
if (n->error_heap_index + n_errors <= vec_len (em->counters_last_clear))
memcpy (em->counters + n->error_heap_index,
clib_memcpy (em->counters + n->error_heap_index,
em->counters_last_clear + n->error_heap_index,
n_errors * sizeof (em->counters[0]));
else
+2 -2
View File
@@ -1463,10 +1463,10 @@ static void vlib_main_loop (vlib_main_t * vm)
void * data;
data = vlib_process_signal_event_helper (nm, n, p, te->event_type_index, te->n_data_elts, te->n_data_elt_bytes);
if (te->n_data_bytes < sizeof (te->inline_event_data))
memcpy (data, te->inline_event_data, te->n_data_bytes);
clib_memcpy (data, te->inline_event_data, te->n_data_bytes);
else
{
memcpy (data, te->event_data_as_vector, te->n_data_bytes);
clib_memcpy (data, te->event_data_as_vector, te->n_data_bytes);
vec_free (te->event_data_as_vector);
}
pool_put (nm->signal_timed_event_data_pool, te);
+3 -3
View File
@@ -541,7 +541,7 @@ static void serialize_mc_register_stream_name (serialize_main_t * m, va_list * v
static void elog_stream_name (char * buf, int n_buf_bytes, char * v)
{
memcpy (buf, v, clib_min (n_buf_bytes - 1, vec_len (v)));
clib_memcpy (buf, v, clib_min (n_buf_bytes - 1, vec_len (v)));
buf[n_buf_bytes - 1] = 0;
}
@@ -1307,7 +1307,7 @@ static void serialize_mc_stream (serialize_main_t * m, va_list * va)
serialize_integer (m, pool_elts (s->peers), sizeof (u32));
pool_foreach (p, s->peers, ({
u8 * x = serialize_get (m, sizeof (p->id));
memcpy (x, p->id.as_u8, sizeof (p->id));
clib_memcpy (x, p->id.as_u8, sizeof (p->id));
serialize_integer (m, p->last_sequence_received,
sizeof (p->last_sequence_received));
}));
@@ -1327,7 +1327,7 @@ void unserialize_mc_stream (serialize_main_t * m, va_list * va)
u8 * x;
pool_get (s->peers, p);
x = unserialize_get (m, sizeof (p->id));
memcpy (p->id.as_u8, x, sizeof (p->id));
clib_memcpy (p->id.as_u8, x, sizeof (p->id));
unserialize_integer (m, &p->last_sequence_received, sizeof (p->last_sequence_received));
mhash_set (&s->peer_index_by_id, &p->id, p - s->peers, /* old_value */ 0);
}
+2 -2
View File
@@ -339,7 +339,7 @@ static void register_node (vlib_main_t * vm,
{
vec_resize (n->runtime_data, r->runtime_data_bytes);
if (r->runtime_data)
memcpy (n->runtime_data, r->runtime_data, r->runtime_data_bytes);
clib_memcpy (n->runtime_data, r->runtime_data, r->runtime_data_bytes);
}
vec_resize (n->next_node_names, r->n_next_nodes);
@@ -438,7 +438,7 @@ static void register_node (vlib_main_t * vm,
ASSERT (vec_len (n->runtime_data) <= sizeof (rt->runtime_data));
if (vec_len (n->runtime_data) > 0)
memcpy (rt->runtime_data, n->runtime_data, vec_len (n->runtime_data));
clib_memcpy (rt->runtime_data, n->runtime_data, vec_len (n->runtime_data));
vec_free (n->runtime_data);
}
+1 -1
View File
@@ -93,7 +93,7 @@ vlib_node_set_runtime_data (vlib_main_t * vm, u32 node_index,
ASSERT (vec_len (n->runtime_data) <= sizeof (r->runtime_data));
if (vec_len (n->runtime_data) > 0)
memcpy (r->runtime_data, n->runtime_data, vec_len (n->runtime_data));
clib_memcpy (r->runtime_data, n->runtime_data, vec_len (n->runtime_data));
}
always_inline void
+6 -6
View File
@@ -639,7 +639,7 @@ static clib_error_t * start_workers (vlib_main_t * vm)
oldheap = clib_mem_set_heap (w->thread_mheap);
vm_clone = clib_mem_alloc (sizeof (*vm_clone));
memcpy (vm_clone, vlib_mains[0], sizeof (*vm_clone));
clib_memcpy (vm_clone, vlib_mains[0], sizeof (*vm_clone));
vm_clone->cpu_index = worker_thread_index;
vm_clone->heap_base = w->thread_mheap;
@@ -674,7 +674,7 @@ static clib_error_t * start_workers (vlib_main_t * vm)
{
vlib_node_t *n;
n = clib_mem_alloc_no_fail (sizeof(*n));
memcpy (n, nm->nodes[j], sizeof (*n));
clib_memcpy (n, nm->nodes[j], sizeof (*n));
/* none of the copied nodes have enqueue rights given out */
n->owner_node_index = VLIB_INVALID_NODE_INDEX;
memset (&n->stats_total, 0, sizeof (n->stats_total));
@@ -854,7 +854,7 @@ void vlib_worker_thread_node_runtime_update(void)
/* Re-clone error heap */
u64 * old_counters = vm_clone->error_main.counters;
u64 * old_counters_all_clear = vm_clone->error_main.counters_last_clear;
memcpy (&vm_clone->error_main, &vm->error_main, sizeof (vm->error_main));
clib_memcpy (&vm_clone->error_main, &vm->error_main, sizeof (vm->error_main));
j = vec_len(vm->error_main.counters) - 1;
vec_validate_aligned(old_counters, j, CLIB_CACHE_LINE_BYTES);
vec_validate_aligned(old_counters_all_clear, j, CLIB_CACHE_LINE_BYTES);
@@ -890,7 +890,7 @@ void vlib_worker_thread_node_runtime_update(void)
old_n_clone = old_nodes_clone[j];
new_n_clone = clib_mem_alloc_no_fail (sizeof(*new_n_clone));
memcpy (new_n_clone, new_n, sizeof (*new_n));
clib_memcpy (new_n_clone, new_n, sizeof (*new_n));
/* none of the copied nodes have enqueue rights given out */
new_n_clone->owner_node_index = VLIB_INVALID_NODE_INDEX;
@@ -905,10 +905,10 @@ void vlib_worker_thread_node_runtime_update(void)
else
{
/* Copy stats if the old data is valid */
memcpy (&new_n_clone->stats_total,
clib_memcpy (&new_n_clone->stats_total,
&old_n_clone->stats_total,
sizeof (new_n_clone->stats_total));
memcpy (&new_n_clone->stats_last_clear,
clib_memcpy (&new_n_clone->stats_last_clear,
&old_n_clone->stats_last_clear,
sizeof (new_n_clone->stats_last_clear));
+3 -3
View File
@@ -73,13 +73,13 @@ vlib_trace_frame_buffers_only (vlib_main_t * vm,
if (b0->flags & VLIB_BUFFER_IS_TRACED)
{
t0 = vlib_add_trace (vm, node, b0, n_buffer_data_bytes_in_trace);
memcpy (t0, b0->data + b0->current_data,
clib_memcpy (t0, b0->data + b0->current_data,
n_buffer_data_bytes_in_trace);
}
if (b1->flags & VLIB_BUFFER_IS_TRACED)
{
t1 = vlib_add_trace (vm, node, b1, n_buffer_data_bytes_in_trace);
memcpy (t1, b1->data + b1->current_data,
clib_memcpy (t1, b1->data + b1->current_data,
n_buffer_data_bytes_in_trace);
}
from += 2;
@@ -99,7 +99,7 @@ vlib_trace_frame_buffers_only (vlib_main_t * vm,
if (b0->flags & VLIB_BUFFER_IS_TRACED)
{
t0 = vlib_add_trace (vm, node, b0, n_buffer_data_bytes_in_trace);
memcpy (t0, b0->data + b0->current_data,
clib_memcpy (t0, b0->data + b0->current_data,
n_buffer_data_bytes_in_trace);
}
from += 1;
+3 -3
View File
@@ -240,7 +240,7 @@ static int unix_cli_line_edit (unix_main_t * um, unix_cli_file_t * cf)
prev = cf->command_history [cf->excursion];
vec_validate (cf->current_command, vec_len(prev)-1);
memcpy (cf->current_command, prev, vec_len(prev));
clib_memcpy (cf->current_command, prev, vec_len(prev));
_vec_len (cf->current_command) = vec_len(prev);
unix_cli_add_pending_output (uf, cf, cf->current_command,
vec_len (cf->current_command));
@@ -271,7 +271,7 @@ static int unix_cli_line_edit (unix_main_t * um, unix_cli_file_t * cf)
unix_cli_add_pending_output (uf, cf, (u8 *) "\b\b \b\b\r\n", 8);
vec_validate (cf->input_vector, vec_len(cf->current_command)-1);
memcpy (cf->input_vector, cf->current_command,
clib_memcpy (cf->input_vector, cf->current_command,
vec_len(cf->current_command));
_vec_len(cf->input_vector) = _vec_len (cf->current_command);
@@ -342,7 +342,7 @@ static int unix_cli_line_edit (unix_main_t * um, unix_cli_file_t * cf)
vec_validate (cf->current_command, vec_len(item)-1);
memcpy (cf->current_command, item, vec_len(item));
clib_memcpy (cf->current_command, item, vec_len(item));
_vec_len (cf->current_command) = vec_len(item);
unix_cli_add_pending_output (uf, cf, cf->current_command,
vec_len (cf->current_command));
+1 -1
View File
@@ -893,7 +893,7 @@ find_interface_ip4_address (char * if_name, u32 * ip4_address, u32 * mtu)
}
sa = (void *) &ifr.ifr_addr;
memcpy (ip4_address, &sa->sin_addr.s_addr, sizeof (ip4_address[0]));
clib_memcpy (ip4_address, &sa->sin_addr.s_addr, sizeof (ip4_address[0]));
if (ioctl (fd, SIOCGIFMTU, &ifr) < 0)
return -1;
+1 -1
View File
@@ -154,7 +154,7 @@ static clib_error_t * test_lisp_msg_parse_mapping_record ()
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);
+1 -1
View File
@@ -94,7 +94,7 @@ static clib_error_t * test_format_unformat_gid_address (void)
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);
+1 -1
View File
@@ -86,7 +86,7 @@ cdp_node_fn (vlib_main_t * vm,
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);
+7 -7
View File
@@ -34,7 +34,7 @@ static void add_device_name_tlv (vnet_hw_interface_t *hw, u8 **t0p)
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);
}
@@ -45,7 +45,7 @@ static void add_port_id_tlv (vnet_hw_interface_t *hw, u8 **t0p)
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);
}
@@ -55,7 +55,7 @@ static void add_version_tlv (vnet_hw_interface_t *hw, u8 **t0p)
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);
}
@@ -65,7 +65,7 @@ static void add_platform_tlv (vnet_hw_interface_t *hw, u8 **t0p)
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);
}
@@ -78,7 +78,7 @@ static void add_capability_tlv (vnet_hw_interface_t *hw, u8 **t0p)
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);
}
@@ -122,7 +122,7 @@ send_ethernet_hello (cdp_main_t *cm, cdp_neighbor_t *n, int count)
/* 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;
@@ -250,7 +250,7 @@ send_srp_hello (cdp_main_t *cm, cdp_neighbor_t *n, int count)
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 */
+12 -12
View File
@@ -110,7 +110,7 @@ vnet_classify_new_table (vnet_classify_main_t *cm,
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;
@@ -292,7 +292,7 @@ static inline void make_working_copy
{
#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)); \
@@ -348,7 +348,7 @@ split_and_rehash (vnet_classify_table_t * t,
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;
@@ -405,7 +405,7 @@ int vnet_classify_add_del (vnet_classify_table_t * t,
}
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);
@@ -436,7 +436,7 @@ int vnet_classify_add_del (vnet_classify_table_t * t,
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);
@@ -452,7 +452,7 @@ int vnet_classify_add_del (vnet_classify_table_t * t,
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();
@@ -513,7 +513,7 @@ int vnet_classify_add_del (vnet_classify_table_t * t,
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;
@@ -1464,10 +1464,10 @@ uword unformat_ip6_match (unformat_input_t * input, va_list * args)
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;
@@ -1584,10 +1584,10 @@ uword unformat_l2_match (unformat_input_t * input, va_list * args)
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)
{
@@ -1723,7 +1723,7 @@ int vnet_classify_add_del_session (vnet_classify_main_t * cm,
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 */
+1 -1
View File
@@ -149,7 +149,7 @@ find_config_with_features (vlib_main_t * vm,
/* 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. */
+2 -2
View File
@@ -225,7 +225,7 @@ af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set)
/*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);
@@ -233,7 +233,7 @@ af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set)
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;
}
+1 -1
View File
@@ -106,7 +106,7 @@ af_packet_interface_tx (vlib_main_t * vm,
{
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;
}
+2 -2
View File
@@ -180,7 +180,7 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
/* 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;
@@ -222,7 +222,7 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
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,
+7 -7
View File
@@ -135,7 +135,7 @@ static struct rte_mbuf * dpdk_replicate_packet_mb (vlib_buffer_t * b)
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;
@@ -165,9 +165,9 @@ dpdk_tx_trace_buffer (dpdk_main_t * dm,
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));
}
@@ -841,8 +841,8 @@ static void dpdk_clear_hw_interface_counters (u32 instance)
*/
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]));
}
@@ -1256,6 +1256,6 @@ dpdk_get_hw_interface_stats (u32 hw_if_index, struct rte_eth_stats* dest)
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);
}
-1
View File
@@ -24,7 +24,6 @@
#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>
+1 -1
View File
@@ -183,7 +183,7 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now)
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 */

Some files were not shown because too many files have changed in this diff Show More