Add clib_memcpy macro based on DPDK rte_memcpy implementation 46/846/3
authorDamjan Marion <damarion@cisco.com>
Sun, 13 Mar 2016 01:22:06 +0000 (02:22 +0100)
committerDamjan Marion <damarion@cisco.com>
Fri, 22 Apr 2016 15:29:47 +0000 (17:29 +0200)
Change-Id: I22cb443c4bd0bf298abb6f06e8e4ca65a44a2854
Signed-off-by: Damjan Marion <damarion@cisco.com>
142 files changed:
build-root/emacs-lisp/tunnel-c-skel.el
svm/svmdb.c
vlib-api/vlibapi/api_shared.c
vlib-api/vlibmemory/memory_vlib.c
vlib-api/vlibmemory/unix_shared_memory_queue.c
vlib-api/vlibsocket/socksvr_vlib.c
vlib/vlib/buffer.c
vlib/vlib/buffer_funcs.h
vlib/vlib/dpdk_buffer.c
vlib/vlib/error.c
vlib/vlib/main.c
vlib/vlib/mc.c
vlib/vlib/node.c
vlib/vlib/node_funcs.h
vlib/vlib/threads.c
vlib/vlib/trace.c
vlib/vlib/unix/cli.c
vlib/vlib/unix/mc_socket.c
vnet/test/lisp-cp/test_cp_serdes.c
vnet/test/lisp-cp/test_lisp_types.c
vnet/vnet/cdp/cdp_node.c
vnet/vnet/cdp/cdp_periodic.c
vnet/vnet/classify/vnet_classify.c
vnet/vnet/config.c
vnet/vnet/devices/af_packet/af_packet.c
vnet/vnet/devices/af_packet/device.c
vnet/vnet/devices/af_packet/node.c
vnet/vnet/devices/dpdk/device.c
vnet/vnet/devices/dpdk/dpdk.h
vnet/vnet/devices/dpdk/dpdk_priv.h
vnet/vnet/devices/dpdk/init.c
vnet/vnet/devices/dpdk/node.c
vnet/vnet/devices/dpdk/vhost_user.c
vnet/vnet/devices/ssvm/node.c
vnet/vnet/devices/ssvm/ssvm_eth.c
vnet/vnet/devices/virtio/vhost-user.c
vnet/vnet/dhcp/client.c
vnet/vnet/dhcp/proxy_node.c
vnet/vnet/dhcpv6/proxy_node.c
vnet/vnet/dpdk_replication.h
vnet/vnet/ethernet/arp.c
vnet/vnet/ethernet/format.c
vnet/vnet/ethernet/interface.c
vnet/vnet/ethernet/mac_swap.c
vnet/vnet/flow/flow_report.c
vnet/vnet/flow/flow_report_sample.c
vnet/vnet/gre/gre.c
vnet/vnet/gre/interface.c
vnet/vnet/hdlc/hdlc.c
vnet/vnet/interface_output.c
vnet/vnet/ip/icmp6.c
vnet/vnet/ip/ip4_forward.c
vnet/vnet/ip/ip4_packet.h
vnet/vnet/ip/ip6_forward.c
vnet/vnet/ip/ip6_hop_by_hop.c
vnet/vnet/ip/ip6_neighbor.c
vnet/vnet/ip/ip_frag.c
vnet/vnet/ip/lookup.c
vnet/vnet/ip/udp.h
vnet/vnet/ipsec/esp_encrypt.c
vnet/vnet/ipsec/ikev2.c
vnet/vnet/ipsec/ikev2_cli.c
vnet/vnet/ipsec/ikev2_payload.c
vnet/vnet/ipsec/ipsec.c
vnet/vnet/ipsec/ipsec_if.c
vnet/vnet/l2/l2_efp_filter.c
vnet/vnet/l2/l2_flood.c
vnet/vnet/l2/l2_fwd.c
vnet/vnet/l2/l2_input.c
vnet/vnet/l2/l2_input_vtr.c
vnet/vnet/l2/l2_learn.c
vnet/vnet/l2/l2_output.c
vnet/vnet/l2/l2_output_acl.c
vnet/vnet/l2/l2_rw.c
vnet/vnet/l2tp/l2tp.c
vnet/vnet/lisp-cp/control.c
vnet/vnet/lisp-cp/gid_dictionary.c
vnet/vnet/lisp-cp/lisp_types.c
vnet/vnet/lisp-cp/packets.c
vnet/vnet/llc/llc.c
vnet/vnet/map/ip4_map.c
vnet/vnet/map/ip4_map_t.c
vnet/vnet/map/ip6_map.c
vnet/vnet/map/ip6_map_t.c
vnet/vnet/map/map.c
vnet/vnet/mpls-gre/interface.c
vnet/vnet/mpls-gre/mpls.c
vnet/vnet/mpls-gre/policy_encap.c
vnet/vnet/nsh-gre/encap.c
vnet/vnet/nsh-gre/nsh_gre.c
vnet/vnet/nsh-vxlan-gpe/encap.c
vnet/vnet/nsh-vxlan-gpe/nsh_vxlan_gpe.c
vnet/vnet/osi/osi.c
vnet/vnet/pg/input.c
vnet/vnet/pg/stream.c
vnet/vnet/policer/policer.c
vnet/vnet/ppp/ppp.c
vnet/vnet/replication.c
vnet/vnet/rewrite.c
vnet/vnet/rewrite.h
vnet/vnet/snap/snap.c
vnet/vnet/sr/sr.c
vnet/vnet/srp/interface.c
vnet/vnet/srp/node.c
vnet/vnet/unix/pcap.h
vnet/vnet/unix/tapcli.c
vnet/vnet/unix/tuntap.c
vnet/vnet/vcgn/cnat_cli_handler.c
vnet/vnet/vcgn/cnat_debug_msg_handler.c
vnet/vnet/vcgn/cnat_logging.c
vnet/vnet/vcgn/cnat_syslog.c
vnet/vnet/vcgn/vcgn_classify.c
vpp-api-test/vat/api_format.c
vpp-api/java/japi/vppjni.c
vpp/api/api.c
vpp/api/test_client.c
vpp/app/l2t.c
vpp/app/sticky_hash.c
vpp/app/vpe_cli.c
vpp/stats/stats.c
vppinfra/Makefile.am
vppinfra/tools/elftool.c
vppinfra/vppinfra/bihash_template.c
vppinfra/vppinfra/elf.c
vppinfra/vppinfra/elf.h
vppinfra/vppinfra/elog.c
vppinfra/vppinfra/fifo.c
vppinfra/vppinfra/fifo.h
vppinfra/vppinfra/hash.c
vppinfra/vppinfra/heap.h
vppinfra/vppinfra/mem.h
vppinfra/vppinfra/memcpy_avx.h [new file with mode: 0644]
vppinfra/vppinfra/memcpy_sse3.h [new file with mode: 0644]
vppinfra/vppinfra/mhash.c
vppinfra/vppinfra/pfhash.c
vppinfra/vppinfra/serialize.c
vppinfra/vppinfra/socket.c
vppinfra/vppinfra/string.h
vppinfra/vppinfra/test_elf.c
vppinfra/vppinfra/test_elog.c
vppinfra/vppinfra/vec.c
vppinfra/vppinfra/vec.h

index 199e27f..aa260e5 100644 (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);
index 08da4b3..481224a 100644 (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);
index 8b8698b..308f002 100644 (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);
     }
index 8aa0fe4..0cac49d 100644 (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;
index 62fb240..b818265 100644 (file)
@@ -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--;
index 91dff22..d65646a 100644 (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;
index c28a0c5..b7ae0a6 100644 (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;
index f7bdb12..1c3ffe2 100644 (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;
index db1fde1..358d366 100644 (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;
index 6615308..e738036 100644 (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
index 07cf7fb..18273bf 100644 (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);
index d311e8e..0942666 100644 (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);
     }
index 573b3a7..1df786f 100644 (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);
   }
index 80dc3c6..18342e2 100644 (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
index efbef37..a2ab0d8 100644 (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));
 
index 4a611ee..d430460 100644 (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;
index 2cdd476..2e6e059 100644 (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));
index 1169203..be68a13 100644 (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;
index 9e89dd9..d77c294 100644 (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);
index db12f18..efd8722 100644 (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);
index a826b12..7411ebe 100644 (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);
index dc631b3..14c4543 100644 (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 */
index 2a77701..11d3714 100644 (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 */
index 9f98778..d2bcdf7 100644 (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. */
index 542e5bc..20c6129 100644 (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;
     }
index fa43d7c..f0e9148 100644 (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;
        }
index ceb89ef..b622a22 100644 (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,
index 03c8d2e..9b742f0 100644 (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);
 }
index bfe2279..af12d52 100644 (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>
index 54d3803..102a761 100644 (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 */
index de141a5..8f24e7b 100644 (file)
@@ -312,7 +312,7 @@ dpdk_lib_init (dpdk_main_t * dm)
       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)
         {
@@ -325,7 +325,7 @@ dpdk_lib_init (dpdk_main_t * dm)
           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);
 
@@ -520,7 +520,7 @@ dpdk_lib_init (dpdk_main_t * dm)
           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;
         }
@@ -689,7 +689,7 @@ dpdk_lib_init (dpdk_main_t * dm)
         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;
       }
@@ -1436,8 +1436,8 @@ dpdk_process (vlib_main_t * vm,
                  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] = 
index 4f5a84a..3b4b82a 100644 (file)
@@ -375,9 +375,9 @@ void dpdk_rx_trace (dpdk_main_t * dm,
       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
       /*
index 9cdf664..61a206c 100644 (file)
@@ -342,14 +342,14 @@ dpdk_create_vhost_user_if_internal (u32 * hw_if_index, u32 if_id, u8 *hwaddr)
    * 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;
   }
@@ -949,7 +949,7 @@ static clib_error_t * dpdk_vhost_user_socket_read (unix_file_t * uf)
       (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*/
index 3a5709d..8462569 100644 (file)
@@ -173,7 +173,7 @@ ssvm_eth_device_input (ssvm_eth_main_t * em,
               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))
@@ -274,7 +274,7 @@ ssvm_eth_device_input (ssvm_eth_main_t * em,
   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);
index 23ec026..49f2d5f 100644 (file)
@@ -298,7 +298,7 @@ ssvm_eth_interface_tx (vlib_main_t * vm,
 
       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);
        }
@@ -346,7 +346,7 @@ ssvm_eth_interface_tx (vlib_main_t * vm,
           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;
index 13a8fe1..9747b92 100644 (file)
@@ -320,7 +320,7 @@ static clib_error_t * vhost_user_socket_read (unix_file_t * uf)
       (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*/
@@ -399,7 +399,7 @@ static clib_error_t * vhost_user_socket_read (unix_file_t * uf)
       }
       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]);
@@ -838,7 +838,7 @@ void vhost_user_rx_trace (vlib_main_t * vm,
     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;
@@ -997,7 +997,7 @@ static u32 vhost_user_if_input ( vlib_main_t * vm,
 
 #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) {
@@ -1294,7 +1294,7 @@ vhost_user_intfc_tx (vlib_main_t * vm,
         }
 
         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;
@@ -1555,14 +1555,14 @@ static void vhost_user_create_ethernet(vnet_main_t * vnm, vlib_main_t * vm,
 
   /* 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;
   }
index 727b516..5916cfd 100644 (file)
@@ -163,7 +163,7 @@ int dhcp_client_for_us (u32 bi, vlib_buffer_t * b,
             /* 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;
 
@@ -297,7 +297,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c,
     {
       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));
     }
@@ -344,7 +344,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c,
   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)
@@ -385,7 +385,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c,
     {
       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));
     }
 
@@ -394,7 +394,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c,
     {
       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));
     }
 
@@ -403,7 +403,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c,
     {
       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));
     }
 
@@ -417,7 +417,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c,
    */
   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 */
index 2f86022..69edae7 100644 (file)
@@ -633,7 +633,7 @@ dhcp_proxy_to_client_input (vlib_main_t * vm,
 
       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);
index e41fe9a..01f5965 100644 (file)
@@ -202,7 +202,7 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
        
           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;
@@ -346,7 +346,7 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
                                                       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) {
@@ -639,7 +639,7 @@ dhcpv6_proxy_to_client_input (vlib_main_t * vm,
 
       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);
index 6259c44..bf9bf99 100644 (file)
@@ -56,7 +56,7 @@ vlib_dpdk_clone_buffer (vlib_main_t * vm, vlib_buffer_t * b)
 
       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;
@@ -90,7 +90,7 @@ vlib_dpdk_clone_buffer (vlib_main_t * vm, vlib_buffer_t * b)
   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;
index a5b015c..220d0d2 100644 (file)
@@ -278,7 +278,7 @@ ethernet_arp_sw_interface_up_down (vnet_main_t * vnm,
           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,
@@ -347,7 +347,7 @@ vnet_arp_set_ip4_over_ethernet (vnet_main_t * vnm,
   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));
@@ -452,7 +452,7 @@ vnet_arp_set_ip4_over_ethernet_internal (vnet_main_t * vnm,
     }
 
   /* 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;
@@ -696,7 +696,7 @@ static void unset_random_arp_entry (void)
 
   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,
@@ -724,7 +724,7 @@ static void arp_unnumbered (vlib_buffer_t * p0,
   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;
@@ -753,7 +753,7 @@ static void arp_unnumbered (vlib_buffer_t * p0,
           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] =
@@ -776,7 +776,7 @@ static void arp_unnumbered (vlib_buffer_t * p0,
       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);
@@ -817,8 +817,8 @@ static void arp_unnumbered (vlib_buffer_t * p0,
       }
       
       /* 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)
@@ -986,14 +986,14 @@ arp_input (vlib_main_t * vm,
 
          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)
@@ -1390,7 +1390,7 @@ vnet_arp_unset_ip4_over_ethernet (vnet_main_t * vnm,
   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));
@@ -1600,7 +1600,7 @@ vnet_arp_glean_add(u32 fib_index, void * next_hop_arg)
   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;
@@ -1828,7 +1828,7 @@ arp_term_l2bd (vlib_main_t * vm,
            {
              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  (
@@ -1907,9 +1907,9 @@ arp_term_l2bd (vlib_main_t * vm,
          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 
index be456d5..f6fc6e2 100644 (file)
@@ -294,7 +294,7 @@ unformat_ethernet_header (unformat_input_t * input, va_list * args)
     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;
index 7a4f067..bb8c753 100644 (file)
@@ -89,9 +89,9 @@ static uword ethernet_set_rewrite (vnet_main_t * vnm,
   }
 
   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 */
 
@@ -188,7 +188,7 @@ ethernet_register_interface (vnet_main_t * vnm,
   /* 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));
 
@@ -277,7 +277,7 @@ simulated_ethernet_interface_tx (vlib_main_t * vm,
 
       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++)
@@ -341,7 +341,7 @@ int vnet_create_loopback_interface (u32 * sw_if_indexp, u8 *mac_address)
    * 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;
index 6bb7f5b..f394939 100644 (file)
@@ -235,16 +235,16 @@ mac_swap_node_fn (vlib_main_t * vm,
                 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;
                   }
@@ -317,8 +317,8 @@ mac_swap_node_fn (vlib_main_t * vm,
             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;
             }
index 9c0cbb6..0cb2585 100644 (file)
@@ -61,7 +61,7 @@ int send_template_packet (flow_report_main_t *frm,
 
   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;
index eb2fbfc..e024055 100644 (file)
@@ -191,7 +191,7 @@ static vlib_frame_t * send_flows (flow_report_main_t * frm,
                     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;
@@ -226,7 +226,7 @@ static vlib_frame_t * send_flows (flow_report_main_t * frm,
 #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;                                \
                 }                                                       \
@@ -237,7 +237,7 @@ static vlib_frame_t * send_flows (flow_report_main_t * frm,
               /* 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++;
index c09816a..aad7645 100644 (file)
@@ -160,7 +160,7 @@ unformat_gre_header (unformat_input_t * input, va_list * args)
     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;
index 0eb395b..69c1583 100644 (file)
@@ -70,8 +70,8 @@ gre_register_interface (vnet_main_t * vnm,
   /* 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);
 
index bdbe894..9997ddc 100644 (file)
@@ -161,7 +161,7 @@ unformat_hdlc_header (unformat_input_t * input, va_list * args)
     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;
index 033e9fc..f19b915 100644 (file)
@@ -98,14 +98,14 @@ vnet_interface_output_trace (vlib_main_t * vm,
        {
          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;
@@ -126,7 +126,7 @@ vnet_interface_output_trace (vlib_main_t * vm,
        {
          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;
index e6022ad..313ab98 100644 (file)
@@ -335,9 +335,9 @@ ip6_icmp_echo_request (vlib_main_t * vm,
               *  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;
@@ -359,9 +359,9 @@ ip6_icmp_echo_request (vlib_main_t * vm,
               *  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;
@@ -435,9 +435,9 @@ ip6_icmp_echo_request (vlib_main_t * vm,
               *  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;
index ef3624a..720450f 100644 (file)
@@ -181,7 +181,7 @@ ip4_fib_set_adj_index (ip4_main_t * im,
                        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));
     }
 }
 
@@ -545,7 +545,7 @@ void ip4_maybe_remap_adjacencies (ip4_main_t * im,
            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;
@@ -1450,7 +1450,7 @@ ip4_forward_next_trace (vlib_main_t * vm,
          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));
        }
@@ -1461,7 +1461,7 @@ ip4_forward_next_trace (vlib_main_t * vm,
          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));
        }
@@ -1486,7 +1486,7 @@ ip4_forward_next_trace (vlib_main_t * vm,
          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));
        }
@@ -2197,7 +2197,7 @@ ip4_arp (vlib_main_t * vm,
            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);
@@ -2310,7 +2310,7 @@ ip4_probe_neighbor (vlib_main_t * vm, ip4_address_t * dst, u32 sw_if_index)
 
   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];
index ba00eed..78db01a 100644 (file)
@@ -64,7 +64,7 @@ always_inline void
 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;
 }
 
index 4a161e7..c8b9df0 100644 (file)
@@ -480,7 +480,7 @@ ip6_get_route (ip6_main_t * im,
   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];
@@ -1253,7 +1253,7 @@ ip6_forward_next_trace (vlib_main_t * vm,
           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));
        }
@@ -1264,7 +1264,7 @@ ip6_forward_next_trace (vlib_main_t * vm,
           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));
        }
@@ -1289,7 +1289,7 @@ ip6_forward_next_trace (vlib_main_t * vm,
           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));
        }
@@ -1913,7 +1913,7 @@ ip6_discover_neighbor (vlib_main_t * vm,
 
            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? */
@@ -2018,7 +2018,7 @@ ip6_probe_neighbor (vlib_main_t * vm, ip6_address_t * dst, u32 sw_if_index)
   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);
index 62f22e4..2282e8c 100644 (file)
@@ -472,8 +472,7 @@ ip6_hop_by_hop_node_fn (vlib_main_t * vm,
               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++;
@@ -683,7 +682,7 @@ ip6_add_hop_by_hop_node_fn (vlib_main_t * vm,
 
           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;
index 957e35b..acb1d8d 100644 (file)
@@ -300,8 +300,8 @@ static void set_unset_ip6_neighbor_rpc
   
   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));
@@ -376,7 +376,7 @@ vnet_set_ip6_ethernet_neighbor (vlib_main_t * vm,
     }
 
   /* 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? */
@@ -722,7 +722,7 @@ icmp6_neighbor_solicitation_or_advertisement (vlib_main_t * vm,
              eth_if0 = ethernet_get_interface (&ethernet_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;
                }
@@ -741,8 +741,8 @@ icmp6_neighbor_solicitation_or_advertisement (vlib_main_t * vm,
                * 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);
@@ -1013,7 +1013,7 @@ icmp6_router_solicitation(vlib_main_t * vm,
                          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,
@@ -1081,7 +1081,7 @@ icmp6_router_solicitation(vlib_main_t * vm,
                                  }
                                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); 
 
@@ -1131,8 +1131,8 @@ icmp6_router_solicitation(vlib_main_t * vm,
                            * 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;
@@ -1568,7 +1568,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
         /* 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);
@@ -1666,7 +1666,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
             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,
@@ -1688,7 +1688,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
             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,
@@ -1710,7 +1710,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
             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));
           } 
        }
    } 
@@ -1824,7 +1824,7 @@ ip6_neighbor_send_mldpv2_report(u32 sw_if_index)
        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++;
 
@@ -2270,7 +2270,7 @@ ip6_neighbor_ra_prefix(vlib_main_t * vm, u32 sw_if_index,
          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 */
@@ -2775,7 +2775,7 @@ enable_ip6_interface(vlib_main_t * vm,
                      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];
                      
@@ -3028,7 +3028,7 @@ ip6_neighbor_add_del_interface_address (ip6_main_t * im,
              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));
            } 
        }
     }
index 3436090..5437c26 100644 (file)
@@ -114,9 +114,9 @@ ip4_frag_do_fragment(vlib_main_t *vm, u32 pi, u32 **buffer, ip_frag_error_t *err
       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);
@@ -321,8 +321,8 @@ ip6_frag_do_fragment(vlib_main_t *vm, u32 pi, u32 **buffer, ip_frag_error_t *err
       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;
index 010e9e9..9e3cdc0 100644 (file)
@@ -244,8 +244,8 @@ ip_update_adjacency (ip_lookup_main_t * lm,
   adj->lookup_next_index = IP_LOOKUP_NEXT_ARP;
   CLIB_MEMORY_BARRIER();
 
-  memcpy (&adj->rewrite_header, &copy_adj->rewrite_header,
-         VLIB_BUFFER_PRE_DATA_SIZE);
+  clib_memcpy (&adj->rewrite_header, &copy_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);
@@ -343,7 +343,7 @@ static u32 ip_multipath_normalize_next_hops (ip_lookup_main_t * lm,
     }
   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);
     }
 
@@ -471,7 +471,7 @@ ip_multipath_adjacency_get (ip_lookup_main_t * lm,
   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,
@@ -482,7 +482,7 @@ ip_multipath_adjacency_get (ip_lookup_main_t * lm,
   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);
index 2b82139..26056bd 100644 (file)
@@ -124,11 +124,7 @@ ip4_udp_encap_one (vlib_main_t * vm, vlib_buffer_t * b0, u8 * ec0, word ec_len)
   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;
@@ -167,13 +163,8 @@ ip4_udp_encap_two (vlib_main_t * vm, vlib_buffer_t * b0, vlib_buffer_t * b1,
   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;
index 68add4c..7194399 100644 (file)
@@ -303,7 +303,7 @@ esp_encrypt_node_fn (vlib_main_t * vm,
             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,
index 541ba0b..17b297b 100644 (file)
@@ -154,7 +154,7 @@ ikev2_select_proposal(ikev2_sa_proposal_t *proposals, ikev2_protocol_id_t prot_i
             {
               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);
             }
         }
@@ -383,37 +383,37 @@ ikev2_calc_keys(ikev2_sa_t *sa)
 
   /* 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);
@@ -440,22 +440,22 @@ ikev2_calc_child_keys(ikev2_sa_t *sa, ikev2_child_sa_t * child)
 
   /* 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);
@@ -887,7 +887,7 @@ ikev2_process_create_child_sa_req(vlib_main_t * vm, ikev2_sa_t *sa, ike_header_t
         }
       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)
         {
@@ -1453,7 +1453,7 @@ ikev2_generate_resp(ikev2_sa_t *sa, ike_header_t * ike)
       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);
@@ -1484,7 +1484,7 @@ ikev2_generate_resp(ikev2_sa_t *sa, ike_header_t * ike)
       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 */
@@ -1539,7 +1539,7 @@ ikev2_retransmit_sa_init (ike_header_t * ike,
                       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,
@@ -1590,7 +1590,7 @@ ikev2_retransmit_resp (ikev2_sa_t * sa, ike_header_t * ike)
       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,
@@ -1711,7 +1711,7 @@ ikev2_node_fn (vlib_main_t * vm,
                     {
                       /* 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
index 1e6009f..e42f16d 100644 (file)
@@ -217,7 +217,7 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm,
                        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;
         }
@@ -242,7 +242,7 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm,
                        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;
         }
index a1ee519..4ad8699 100644 (file)
@@ -171,7 +171,7 @@ ikev2_payload_add_sa(ikev2_payload_chain_t * c, ikev2_sa_proposal_t * proposals)
           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,
@@ -238,7 +238,7 @@ ikev2_payload_add_delete(ikev2_payload_chain_t *c, ikev2_delete_t * d)
         {
           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);
         }
@@ -422,7 +422,7 @@ ikev2_parse_notify_payload(ike_payload_header_t * ikep)
 
   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);
     }
index c6a8355..47beafc 100644 (file)
@@ -191,7 +191,7 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add)
       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)
@@ -199,14 +199,14 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add)
           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);
             }
@@ -219,7 +219,7 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add)
                 {
                   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);
@@ -228,7 +228,7 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add)
                 {
                   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);
@@ -240,7 +240,7 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add)
                 {
                   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);
@@ -249,7 +249,7 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add)
                 {
                   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);
@@ -432,7 +432,7 @@ ipsec_add_del_sa(vlib_main_t * vm, ipsec_sa_t * new_sa, int is_add)
   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);
     }
@@ -457,14 +457,14 @@ ipsec_set_sa_key(vlib_main_t * vm, ipsec_sa_t * sa_update)
   /* 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;
     }
 
index f4c5358..30631b6 100644 (file)
@@ -155,28 +155,28 @@ ipsec_set_interface_key(vnet_main_t * vnm, u32 hw_if_index,
       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;
index a8bceca..b865c37 100644 (file)
@@ -347,18 +347,18 @@ l2_efp_filter_node_fn (vlib_main_t * vm,
               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));
             }
           }
 
@@ -462,9 +462,9 @@ l2_efp_filter_node_fn (vlib_main_t * vm,
             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 */
index e0c4bb7..ca8c171 100644 (file)
@@ -350,8 +350,8 @@ l2flood_node_fn (vlib_main_t * vm,
                  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))
                 {
@@ -359,8 +359,8 @@ l2flood_node_fn (vlib_main_t * vm,
                  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);
                 }
             }
 
@@ -406,8 +406,8 @@ l2flood_node_fn (vlib_main_t * vm,
              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 */
index 089d400..88a6b69 100644 (file)
@@ -250,8 +250,8 @@ l2fwd_node_fn (vlib_main_t * vm,
                       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) 
                   {
@@ -259,8 +259,8 @@ l2fwd_node_fn (vlib_main_t * vm,
                       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);
                   }
               }
 
@@ -320,8 +320,8 @@ l2fwd_node_fn (vlib_main_t * vm,
                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 */
index 3d3d51f..ee8f788 100644 (file)
@@ -338,16 +338,16 @@ l2input_node_fn (vlib_main_t * vm,
               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);
             }
           }
 
@@ -398,8 +398,8 @@ l2input_node_fn (vlib_main_t * vm,
                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;
index d07a028..bbef33a 100644 (file)
@@ -189,18 +189,18 @@ l2_invtr_node_fn (vlib_main_t * vm,
                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));
             }
           }
 
@@ -257,9 +257,9 @@ l2_invtr_node_fn (vlib_main_t * vm,
                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 */
index 29315be..a891cb3 100644 (file)
@@ -291,8 +291,8 @@ l2learn_node_fn (vlib_main_t * vm,
                     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) 
                 {
@@ -300,8 +300,8 @@ l2learn_node_fn (vlib_main_t * vm,
                     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);
                 }
             }
 
@@ -366,8 +366,8 @@ l2learn_node_fn (vlib_main_t * vm,
                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 */
index bea640c..a550d07 100644 (file)
@@ -192,16 +192,16 @@ l2output_node_fn (vlib_main_t * vm,
                     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);
                   }
               }
 
@@ -329,8 +329,8 @@ l2output_node_fn (vlib_main_t * vm,
                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;
index 2f6c1dc..f75345f 100644 (file)
@@ -165,8 +165,8 @@ l2_outacl_node_fn (vlib_main_t * vm,
                       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) 
                   {
@@ -174,8 +174,8 @@ l2_outacl_node_fn (vlib_main_t * vm,
                       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);
                   }
               }
 
@@ -217,8 +217,8 @@ l2_outacl_node_fn (vlib_main_t * vm,
             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;
index c325ece..8c62b88 100644 (file)
@@ -331,8 +331,8 @@ int l2_rw_mod_entry(u32 *index,
   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++) {
index 36567f9..d359a50 100644 (file)
@@ -334,8 +334,8 @@ int create_l2tpv3_ipv6_tunnel (l2t_main_t * lm,
 
   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;
@@ -350,13 +350,13 @@ int create_l2tpv3_ipv6_tunnel (l2t_main_t * lm,
   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;
index f60405e..3448fb3 100644 (file)
@@ -894,7 +894,7 @@ get_local_iface_ip_for_dst (lisp_cp_main_t *lcm, ip_address_t * dst,
     }
   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
@@ -1069,9 +1069,9 @@ get_src_and_dst (void *hdr, ip_address_t * src, ip_address_t *dst)
   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;
     }
 }
@@ -1132,7 +1132,7 @@ lisp_cp_lookup (vlib_main_t * vm, vlib_node_runtime_t * node,
               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));
             }
index dd10856..4da5203 100644 (file)
@@ -132,7 +132,7 @@ add_del_ip4_key (gid_dictionary_t *db, u32 vni, ip_prefix_t * pref, u32 val,
   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)
     {
@@ -197,7 +197,7 @@ add_del_ip6_key (gid_dictionary_t *db, u32 vni, ip_prefix_t *pref, u32 val,
   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)
     {
index c65745d..6c9cb7d 100644 (file)
@@ -218,7 +218,7 @@ ip4_address_put (u8 * b, ip4_address_t * a)
 {
   *(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();
 }
 
@@ -227,7 +227,7 @@ ip6_address_put (u8 * b, ip6_address_t * a)
 {
   *(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();
 }
 
@@ -237,7 +237,7 @@ ip_address_put (u8 * b, ip_address_t * a)
   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));
 }
 
@@ -246,7 +246,7 @@ ip_address_parse(void * offset, u16 iana_afi, ip_address_t *dst)
 {
   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);
 }
 
@@ -304,7 +304,7 @@ ip_prefix_length (void *a)
 void
 ip_prefix_copy (void * dst , void * src)
 {
-  memcpy (dst, src, sizeof (ip_prefix_t));
+  clib_memcpy (dst, src, sizeof (ip_prefix_t));
 }
 
 int
@@ -463,7 +463,7 @@ void
 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
index e3e006b..aa246a9 100644 (file)
@@ -182,8 +182,8 @@ pkt_push_ipv6 (vlib_main_t * vm, vlib_buffer_t *b, ip6_address_t *src,
 //    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);
 }
 
index f3b464f..b6827d0 100644 (file)
@@ -147,7 +147,7 @@ unformat_llc_header (unformat_input_t * input, va_list * args)
     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;
index adbc72e..85b72e1 100644 (file)
@@ -566,11 +566,11 @@ ip4_map_reass (vlib_main_t *vm,
         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;
         }
index 7a72068..78cfae7 100644 (file)
@@ -263,7 +263,7 @@ _ip4_map_t_icmp (map_domain_t *d, vlib_buffer_t *p, u8 *error)
 
       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);
 
@@ -276,7 +276,7 @@ _ip4_map_t_icmp (map_domain_t *d, vlib_buffer_t *p, u8 *error)
     } 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));
index 208f45f..694d249 100644 (file)
@@ -453,7 +453,7 @@ ip6_map_ip6_reass_prepare(vlib_main_t *vm, vlib_node_runtime_t *node, map_ip6_re
 
     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
@@ -462,7 +462,7 @@ ip6_map_ip6_reass_prepare(vlib_main_t *vm, vlib_node_runtime_t *node, map_ip6_re
 
     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);
     }
@@ -760,11 +760,11 @@ ip6_map_ip4_reass (vlib_main_t *vm,
         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;
         }
index b2c102a..39e8e0a 100644 (file)
@@ -337,7 +337,7 @@ _ip6_map_t_icmp (map_domain_t *d, vlib_buffer_t *p, u8 *error)
 
     //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
index deeab4d..f91a871 100644 (file)
@@ -1420,7 +1420,7 @@ map_ip6_reass_add_fragment(map_ip6_reass_t *r, u32 pi,
     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 {
@@ -1428,7 +1428,7 @@ map_ip6_reass_add_fragment(map_ip6_reass_t *r, u32 pi,
       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) {
index 259211a..408ca75 100644 (file)
@@ -129,8 +129,8 @@ mpls_gre_interface_tx (vlib_main_t * vm,
           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;
@@ -197,7 +197,7 @@ mpls_gre_interface_tx (vlib_main_t * vm,
 
           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;
@@ -378,8 +378,8 @@ mpls_eth_interface_tx (vlib_main_t * vm,
           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;
@@ -399,7 +399,7 @@ mpls_eth_interface_tx (vlib_main_t * vm,
               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)) 
             {
@@ -411,7 +411,7 @@ mpls_eth_interface_tx (vlib_main_t * vm,
               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,
@@ -447,7 +447,7 @@ mpls_eth_interface_tx (vlib_main_t * vm,
 
           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;
@@ -465,7 +465,7 @@ mpls_eth_interface_tx (vlib_main_t * vm,
               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,
@@ -1394,7 +1394,7 @@ int vnet_mpls_ethernet_add_del_tunnel (u8 *dst,
   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;
@@ -1436,7 +1436,7 @@ int vnet_mpls_ethernet_add_del_tunnel (u8 *dst,
    * 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);
@@ -1619,7 +1619,7 @@ int vnet_mpls_policy_tunnel_add_rewrite (mpls_main_t * mm,
   
   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);
@@ -1762,7 +1762,7 @@ int vnet_mpls_ethernet_add_del_policy_tunnel (u8 *dst,
   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;
index 1e1a097..067f799 100644 (file)
@@ -127,10 +127,10 @@ unformat_mpls_gre_header (unformat_input_t * input, va_list * args)
     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;
index 850cdc1..b443919 100644 (file)
@@ -109,7 +109,7 @@ mpls_policy_encap (vlib_main_t * vm,
 
           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;
 
index 875e831..8521aea 100644 (file)
@@ -152,11 +152,11 @@ nsh_gre_encap (vlib_main_t * vm,
           
           /* If there are TLVs to copy, do so */
           if (PREDICT_FALSE (_vec_len(t0->rewrite) > 24))
-            memcpy (&copy_dst0[3], t0->rewrite + 24 , 
+            clib_memcpy (&copy_dst0[3], t0->rewrite + 24 , 
                     _vec_len (t0->rewrite)-24);
 
           if (PREDICT_FALSE (_vec_len(t1->rewrite) > 24))
-            memcpy (&copy_dst1[3], t1->rewrite + 24 , 
+            clib_memcpy (&copy_dst1[3], t1->rewrite + 24 , 
                     _vec_len (t1->rewrite)-24);
 
           /* fix the <bleep>ing outer-IP checksums */
@@ -246,7 +246,7 @@ nsh_gre_encap (vlib_main_t * vm,
           
           /* If there are TLVs to copy, do so */
           if (PREDICT_FALSE (_vec_len(t0->rewrite) > 24))
-            memcpy (&copy_dst0[3], t0->rewrite + 24 , 
+            clib_memcpy (&copy_dst0[3], t0->rewrite + 24 , 
                     _vec_len (t0->rewrite)-24);
 
           /* fix the <bleep>ing outer-IP checksum */
index f85e71a..7f773e6 100644 (file)
@@ -214,7 +214,7 @@ static int nsh_gre_rewrite (nsh_gre_tunnel_t * t)
 
   /* 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);
index b5ff585..af520b2 100644 (file)
@@ -179,11 +179,11 @@ nsh_vxlan_gpe_encap (vlib_main_t * vm,
 
           /* If there are TLVs to copy, do so */
           if (PREDICT_FALSE (_vec_len(t0->rewrite) > 64))
-            memcpy (&copy_dst0[3], t0->rewrite + 64 , 
+            clib_memcpy (&copy_dst0[3], t0->rewrite + 64 , 
                     _vec_len (t0->rewrite)-64);
 
           if (PREDICT_FALSE (_vec_len(t1->rewrite) > 64))
-            memcpy (&copy_dst0[3], t1->rewrite + 64 , 
+            clib_memcpy (&copy_dst0[3], t1->rewrite + 64 , 
                     _vec_len (t1->rewrite)-64);
 
           /* fix the <bleep>ing outer-IP checksum */
@@ -331,7 +331,7 @@ nsh_vxlan_gpe_encap (vlib_main_t * vm,
 
           /* If there are TLVs to copy, do so */
           if (PREDICT_FALSE (_vec_len(t0->rewrite) > 64))
-            memcpy (&copy_dst0[3], t0->rewrite + 64 , 
+            clib_memcpy (&copy_dst0[3], t0->rewrite + 64 , 
                     _vec_len (t0->rewrite)-64);
 
           /* fix the <bleep>ing outer-IP checksum */
index 308824e..0d24684 100644 (file)
@@ -218,7 +218,7 @@ static int nsh_vxlan_gpe_rewrite (nsh_vxlan_gpe_tunnel_t * t)
 
   /* 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);
@@ -271,7 +271,7 @@ int vnet_nsh_vxlan_gpe_add_del_tunnel
         }
 
       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);
index 81b9f66..5398fce 100644 (file)
@@ -141,7 +141,7 @@ unformat_osi_header (unformat_input_t * input, va_list * args)
     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;
index 38402c2..e3bd9f2 100644 (file)
@@ -1182,7 +1182,7 @@ init_replay_buffers_inline (vlib_main_t * vm,
 
       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;
     }
 }
@@ -1242,8 +1242,8 @@ init_buffers_inline (vlib_main_t * vm,
 
       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
        {
@@ -1267,7 +1267,7 @@ init_buffers_inline (vlib_main_t * vm,
       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));
     }
@@ -1578,11 +1578,11 @@ pg_input_trace (pg_main_t * pg,
       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)
@@ -1602,8 +1602,8 @@ pg_input_trace (pg_main_t * pg,
 
       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));
     }
 }
 
index 1dd5624..7146914 100644 (file)
@@ -258,8 +258,8 @@ void pg_edit_group_get_fixed_packet_data (pg_stream_t * s,
   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)
index a43dc75..2dbd02b 100644 (file)
@@ -287,8 +287,8 @@ configure_policer_command_fn (vlib_main_t * vm,
 
       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);
     }
index 1537c9a..e124e11 100644 (file)
@@ -161,7 +161,7 @@ unformat_ppp_header (unformat_input_t * input, va_list * args)
     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;
index 6842684..9e614ad 100644 (file)
@@ -57,7 +57,7 @@ replication_prep (vlib_main_t * vm,
   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;
@@ -98,7 +98,7 @@ replication_recycle (vlib_main_t * vm,
   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);
index 6c33a2e..a538eef 100644 (file)
@@ -249,7 +249,7 @@ void serialize_vnet_rewrite (serialize_main_t * m, va_list * va)
   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)
@@ -266,5 +266,5 @@ 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);
 }
index 2e5b7f4..7ae33ba 100644 (file)
@@ -97,7 +97,7 @@ vnet_rewrite_set_data_internal (vnet_rewrite_header_t * rw,
   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);
 }
 
@@ -152,7 +152,7 @@ _vnet_rewrite_one_header (vnet_rewrite_header_t * h0,
       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;
     }
       
@@ -205,10 +205,10 @@ _vnet_rewrite_two_headers (vnet_rewrite_header_t * h0,
       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;
     }
 
index df15f86..fb5b031 100644 (file)
@@ -164,7 +164,7 @@ unformat_snap_header (unformat_input_t * input, va_list * args)
     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;
index cb74a16..699df99 100644 (file)
@@ -51,7 +51,7 @@ static void sr_fix_hmac (ip6_sr_main_t * sm, ip6_header_t * ip,
 
   /* 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);
@@ -75,7 +75,7 @@ static void sr_fix_hmac (ip6_sr_main_t * sm, ip6_header_t * ip,
   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++;
     }
 
@@ -380,7 +380,7 @@ sr_rewrite (vlib_main_t * vm,
               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 */
@@ -428,7 +428,7 @@ sr_rewrite (vlib_main_t * vm,
               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) +
@@ -459,26 +459,26 @@ sr_rewrite (vlib_main_t * vm,
               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,
@@ -554,7 +554,7 @@ sr_rewrite (vlib_main_t * vm,
               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 */
@@ -587,13 +587,13 @@ sr_rewrite (vlib_main_t * vm,
               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,
@@ -752,8 +752,8 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a)
   /* 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);
 
@@ -790,7 +790,7 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a)
   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;
@@ -848,7 +848,7 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a)
 
   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--;
     }
 
@@ -857,12 +857,12 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a)
 
   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));
@@ -890,7 +890,7 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a)
   
   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);
@@ -947,13 +947,13 @@ sr_add_del_tunnel_command_fn (vlib_main_t * vm,
                          &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;
@@ -1300,11 +1300,11 @@ sr_fix_dst_addr (vlib_main_t * vm,
               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));
                 }
             }
 
@@ -1488,7 +1488,7 @@ static int sr_validate_hmac (ip6_sr_main_t * sm, ip6_header_t * ip,
 
   /* 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);
@@ -1512,7 +1512,7 @@ static int sr_validate_hmac (ip6_sr_main_t * sm, ip6_header_t * ip,
   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++;
     }
 
@@ -1699,15 +1699,15 @@ sr_local (vlib_main_t * vm,
             {
               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);
@@ -1804,15 +1804,15 @@ sr_local (vlib_main_t * vm,
             {
               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,
@@ -1930,15 +1930,15 @@ sr_local (vlib_main_t * vm,
             {
               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,
index 4c14b74..46c091d 100644 (file)
@@ -69,9 +69,9 @@ static uword srp_set_rewrite (vnet_main_t * vnm,
     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 */
 
@@ -190,7 +190,7 @@ static void srp_register_interface_helper (u32 * hw_if_indices_by_side, u32 redi
     }
 
   /* 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. */
@@ -373,7 +373,7 @@ simulated_srp_interface_tx (vlib_main_t * vm,
 
       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++)
index 0ffd401..897be25 100644 (file)
@@ -307,7 +307,7 @@ srp_topology_packet (vlib_main_t * vm, u32 sw_if_index, u8 ** contents)
     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));
@@ -319,7 +319,7 @@ srp_topology_packet (vlib_main_t * vm, u32 sw_if_index, u8 ** contents)
   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,
@@ -586,7 +586,7 @@ static void init_ips_packet (srp_interface_t * si,
   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. */
@@ -594,7 +594,7 @@ static void init_ips_packet (srp_interface_t * si,
   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,
@@ -655,7 +655,7 @@ static void serialize_srp_interface_state_msg (serialize_main_t * m, va_list * v
       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)
@@ -681,7 +681,7 @@ static void unserialize_srp_interface_state_msg (serialize_main_t * m, va_list *
       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)
@@ -736,7 +736,7 @@ void srp_ips_rx_packet (u32 sw_if_index, srp_ips_header_t * h)
          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)
index 6e8e691..e7bb218 100644 (file)
@@ -169,7 +169,7 @@ pcap_add_buffer (pcap_main_t * pm,
   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;
index 7776b9e..d17d09d 100644 (file)
@@ -520,7 +520,7 @@ static u32 tapcli_flag_change (vnet_main_t * vnm,
 
   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)
@@ -757,7 +757,7 @@ int vnet_tap_connect (vlib_main_t * vm, u8 * intfc_name, u8 *hwaddr_arg,
   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,
@@ -782,7 +782,7 @@ int vnet_tap_connect (vlib_main_t * vm, u8 * intfc_name, u8 *hwaddr_arg,
     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));
   }
   
   {
@@ -1117,7 +1117,7 @@ tap_connect_command_fn (vlib_main_t * vm,
       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;
@@ -1142,7 +1142,7 @@ tap_connect_command_fn (vlib_main_t * vm,
     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));
   }
   
   {
index 7ea0b70..28b2584 100644 (file)
@@ -139,7 +139,7 @@ tuntap_tx (vlib_main_t * vm,
       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. */
@@ -583,7 +583,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input)
           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)
@@ -664,7 +664,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im,
   /* 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);
 
@@ -690,7 +690,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im,
 
       /* 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");
     
@@ -756,7 +756,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
   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);
 
@@ -786,7 +786,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
 
       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");
@@ -804,7 +804,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
 
       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");
index e0fb91b..46c8493 100644 (file)
@@ -341,12 +341,12 @@ void cnat_nat44_handle_show_config(vlib_main_t *vm)
 
                 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, 
index 9c84ac1..519f4b6 100644 (file)
@@ -1646,7 +1646,7 @@ void spp_api_cnat_generic_command_request_t_handler
         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
@@ -1672,7 +1672,7 @@ void spp_api_cnat_generic_command_request_t_handler
                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;
 
index 45cfbe8..d404c59 100644 (file)
@@ -780,7 +780,7 @@ void cnat_nfv9_create_logging_context (
        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));
 
@@ -928,7 +928,7 @@ static void cnat_nfv9_insert_add_record(
 
     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] 
@@ -1009,7 +1009,7 @@ static void cnat_nfv9_ds_lite_insert_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] 
@@ -1084,7 +1084,7 @@ static void cnat_nfv9_ds_lite_insert_del_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] += 
@@ -1135,7 +1135,7 @@ static void cnat_nfv9_insert_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[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] 
@@ -1210,7 +1210,7 @@ static void cnat_nfv9_ds_lite_insert_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] 
@@ -1272,7 +1272,7 @@ static void cnat_nfv9_ds_lite_insert_bulk_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[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] += 
@@ -1323,7 +1323,7 @@ static void cnat_nfv9_insert_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] 
@@ -1367,7 +1367,7 @@ static void cnat_nfv9_insert_bulk_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] 
@@ -1605,7 +1605,7 @@ void cnat_nfv9_bib_mapping_create (nat64_bib_entry_t *db,
     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] += 
@@ -1752,7 +1752,7 @@ void cnat_nfv9_session_mapping_create (nat64_bib_entry_t *bdb,
     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] +=
@@ -1850,7 +1850,7 @@ void cnat_nfv9_bib_mapping_delete (nat64_bib_entry_t *db,
     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] +=
@@ -1982,7 +1982,7 @@ void cnat_nfv9_session_mapping_delete (nat64_bib_entry_t *bdb,
            ((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] +=
@@ -2106,7 +2106,7 @@ void cnat_nfv9_nat44_log_session_create(cnat_main_db_entry_t *db,
             ((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);
 
@@ -2224,7 +2224,7 @@ void cnat_nfv9_nat44_log_session_delete(cnat_main_db_entry_t *db,
 
     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);
 
@@ -2494,7 +2494,7 @@ void cnat_nfv9_ds_lite_log_session_create(
                    ((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]
@@ -2624,7 +2624,7 @@ void cnat_nfv9_ds_lite_log_session_delete(
                    ((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]
@@ -2734,10 +2734,10 @@ static void cnat_nfv9_insert_ingress_vrfid_name_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);
 
index 9c69d4a..65fde4c 100644 (file)
@@ -804,7 +804,7 @@ static int syslog_get_timestamp(unsigned char *ts)
     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);
@@ -870,7 +870,7 @@ inline static int syslog_fill_header(const cnat_syslog_logging_info_t *log_info,
     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 */
@@ -879,7 +879,7 @@ inline static int syslog_fill_header(const cnat_syslog_logging_info_t *log_info,
     *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 */
@@ -1078,7 +1078,7 @@ void cnat_syslog_insert_nat44_record(
     *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;
@@ -1110,7 +1110,7 @@ void cnat_syslog_insert_nat44_record(
     *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;
     
@@ -1197,7 +1197,7 @@ void cnat_syslog_insert_record(
     *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;
@@ -1234,7 +1234,7 @@ void cnat_syslog_insert_record(
      *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;
     
@@ -1521,7 +1521,7 @@ void cnat_syslog_dslite_insert_port_exceeded(
     *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;
@@ -1543,7 +1543,7 @@ void cnat_syslog_dslite_insert_port_exceeded(
     *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;
     
@@ -1621,7 +1621,7 @@ void cnat_syslog_nat44_insert_port_exceeded(
     *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;
@@ -1643,7 +1643,7 @@ void cnat_syslog_nat44_insert_port_exceeded(
     *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;
 
@@ -1715,7 +1715,7 @@ void cnat_syslog_nat44_insert_tcp_seq_mismatch(
     *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;
@@ -1729,7 +1729,7 @@ void cnat_syslog_nat44_insert_tcp_seq_mismatch(
     *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;
 
index 8db229e..8a1e9ac 100644 (file)
@@ -882,7 +882,7 @@ static u16 nfv9_get_server_instance(
         /* 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
index 704237b..a93a6c5 100644 (file)
@@ -1403,7 +1403,7 @@ static void vl_api_ip_address_details_t_handler
 
     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
 }
@@ -1424,10 +1424,10 @@ static void vl_api_ip_address_details_t_handler_json
 
     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);
@@ -1479,11 +1479,11 @@ static void vl_api_map_domain_details_t_handler_json
     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);
@@ -1532,7 +1532,7 @@ static void vl_api_map_rule_details_t_handler_json
     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);
 }
 
@@ -1688,7 +1688,7 @@ static void vl_api_vnet_ip4_fib_counters_t_handler_json
     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);
@@ -1731,7 +1731,7 @@ static void vl_api_vnet_ip6_fib_counters_t_handler_json
     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);
@@ -1932,10 +1932,10 @@ vl_api_lisp_local_eid_table_details_t_handler_json (
     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);
@@ -2016,14 +2016,14 @@ vl_api_lisp_gpe_tunnel_details_t_handler_json (
     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));
@@ -2067,10 +2067,10 @@ vl_api_lisp_map_resolver_details_t_handler_json (
 
     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);
     }
 }
@@ -2700,7 +2700,7 @@ int exec (vat_main_t * vam)
     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);
@@ -2749,7 +2749,7 @@ static int api_create_loopback (vat_main_t * vam)
     /* 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;
 }
@@ -3050,9 +3050,9 @@ static int api_sw_interface_add_del_address (vat_main_t * vam)
     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;
 
@@ -3561,9 +3561,9 @@ static int api_bd_ip_mac_add_del (vat_main_t * vam)
     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;
@@ -3607,8 +3607,8 @@ static int api_tap_connect (vat_main_t * vam)
     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... */
@@ -3667,8 +3667,8 @@ static int api_tap_modify (vat_main_t * vam)
 
     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... */
@@ -3879,15 +3879,15 @@ static int api_ip_add_del_route (vat_main_t * vam)
         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];
@@ -3970,8 +3970,8 @@ static int api_proxy_arp_add_del (vat_main_t * vam)
 
     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 */
@@ -4097,10 +4097,10 @@ static int api_mpls_add_del_encap (vat_main_t * vam)
        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);
 
@@ -4150,9 +4150,9 @@ static int api_mpls_gre_add_del_tunnel (vat_main_t * vam)
 
     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;
@@ -4214,9 +4214,9 @@ static int api_mpls_ethernet_add_del_tunnel (vat_main_t * vam)
     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;
@@ -4288,9 +4288,9 @@ static int api_mpls_ethernet_add_del_tunnel_2 (vat_main_t * vam)
     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;
@@ -4406,13 +4406,13 @@ static int api_ip_neighbor_add_del (vat_main_t * vam)
     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... */
@@ -4621,8 +4621,8 @@ static int api_oam_add_del (vat_main_t * vam)
 
     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 */
@@ -4737,11 +4737,11 @@ static int api_dhcp_proxy_config (vat_main_t * vam)
     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... */
@@ -4830,11 +4830,11 @@ static int api_dhcp_proxy_config_2 (vat_main_t * vam)
     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... */
@@ -4944,7 +4944,7 @@ static int api_dhcp_client_config (vat_main_t * vam)
     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;
@@ -5096,7 +5096,7 @@ static int api_sw_interface_ip6_set_link_local_address (vat_main_t * vam)
       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... */
@@ -5174,7 +5174,7 @@ static int api_sw_interface_ip6nd_ra_prefix (vat_main_t * vam)
     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;
@@ -5465,7 +5465,7 @@ static int api_trace_profile_apply (vat_main_t *vam)
     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);
@@ -5534,13 +5534,13 @@ static int api_sr_tunnel_add_del (vat_main_t * vam)
                          &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;
@@ -5594,16 +5594,16 @@ static int api_sr_tunnel_add_del (vat_main_t * vam)
      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);
@@ -6128,7 +6128,7 @@ static int api_classify_add_del_table (vat_main_t * vam)
   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);
 
@@ -6286,10 +6286,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;
@@ -6405,10 +6405,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)
     {
@@ -6578,7 +6578,7 @@ static int api_classify_add_del_session (vat_main_t * vam)
     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;
@@ -6695,7 +6695,7 @@ static int api_get_node_index (vat_main_t * vam)
     }
 
     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;
@@ -6737,8 +6737,8 @@ static int api_add_node_next (vat_main_t * vam)
     }
     
     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);
     
@@ -6794,10 +6794,10 @@ static int api_l2tpv3_create_tunnel (vat_main_t * vam)
 
     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);
@@ -6959,9 +6959,9 @@ static void vl_api_sw_if_l2tpv3_tunnel_details_t_handler_json
 
     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");
@@ -7155,9 +7155,9 @@ static void vl_api_vxlan_tunnel_details_t_handler_json
 
     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));
@@ -7363,14 +7363,14 @@ static int api_create_vhost_user_if (vat_main_t * vam)
     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 */
@@ -7425,7 +7425,7 @@ static int api_modify_vhost_user_if (vat_main_t * vam)
 
     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;
@@ -8493,15 +8493,15 @@ api_ipsec_spd_add_del_entry (vat_main_t * vam)
 
     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);
@@ -8611,16 +8611,16 @@ api_ipsec_sad_add_del_entry (vat_main_t * vam)
     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));
       }
     }
 
@@ -8668,8 +8668,8 @@ api_ipsec_sa_set_key (vat_main_t * vam)
     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 */
@@ -8715,7 +8715,7 @@ api_ikev2_profile_add_del (vat_main_t * vam)
 
     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);
 
@@ -8783,8 +8783,8 @@ api_ikev2_profile_set_auth (vat_main_t * vam)
     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);
 
@@ -8821,7 +8821,7 @@ api_ikev2_profile_set_id (vat_main_t * vam)
         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))
             ;
@@ -8862,8 +8862,8 @@ api_ikev2_profile_set_id (vat_main_t * vam)
     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);
 
@@ -8934,7 +8934,7 @@ api_ikev2_profile_set_ts (vat_main_t * vam)
     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;
@@ -8976,7 +8976,7 @@ api_ikev2_set_local_key (vat_main_t * vam)
 
     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;
@@ -9042,13 +9042,13 @@ static int api_map_add_domain (vat_main_t * vam)
   /* 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;
@@ -9128,7 +9128,7 @@ static int api_map_add_del_rule (vat_main_t * vam)
 
   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... */
@@ -9253,7 +9253,7 @@ api_get_first_msg_id (vat_main_t * vam)
     }
 
     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;
@@ -9392,7 +9392,7 @@ api_lisp_add_del_locator_set(vat_main_t * vam)
     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);
 
@@ -9488,7 +9488,7 @@ api_lisp_add_del_locator(vat_main_t * vam)
     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);
 
@@ -9566,13 +9566,13 @@ api_lisp_add_del_local_eid(vat_main_t * vam)
     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);
 
@@ -9665,20 +9665,20 @@ api_lisp_gpe_add_del_fwd_entry(vat_main_t * vam)
     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... */
@@ -9731,10 +9731,10 @@ api_lisp_add_del_map_resolver(vat_main_t * vam)
     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... */
@@ -10129,8 +10129,8 @@ static int script (vat_main_t * vam)
         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;
@@ -10140,8 +10140,8 @@ static int script (vat_main_t * vam)
     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;
index 9c9437d..adbc631 100644 (file)
@@ -420,7 +420,7 @@ void vl_api_generic_reply_handler (vl_api_generic_reply_t *mp)
 
     /* 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);
@@ -836,7 +836,7 @@ static void vl_api_sw_interface_details_t_handler
     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);
@@ -1263,7 +1263,7 @@ vl_api_l2_fib_table_entry_t_handler (vl_api_l2_fib_table_entry_t * mp)
 
 #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);
@@ -1419,12 +1419,12 @@ static void vl_api_ip_address_details_t_handler (vl_api_ip_address_details_t * m
     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;
     }
 }
index cf2b8f4..4956a43 100644 (file)
@@ -600,7 +600,7 @@ void handle_ip4_arp_event (u32 pool_index)
     
     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;
@@ -843,7 +843,7 @@ static int ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t *mp)
                             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 */
@@ -860,7 +860,7 @@ static int ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t *mp)
             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);
@@ -910,7 +910,7 @@ static int ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t *mp)
     }
 
     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;
 
@@ -1038,7 +1038,7 @@ static int ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t *mp)
                             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 */
@@ -1055,7 +1055,7 @@ static int ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t *mp)
             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);
@@ -1104,7 +1104,7 @@ static int ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t *mp)
     }
 
     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;
     
@@ -1212,7 +1212,7 @@ void api_config_default_ip_route (u8 is_ipv6, u8 is_add, u32 vrf_id,
     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);
@@ -2029,7 +2029,7 @@ static int mpls_ethernet_add_del_tunnel_2_t_handler
             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);
@@ -2253,8 +2253,8 @@ vl_api_ip_neighbor_add_del_t_handler (vl_api_ip_neighbor_add_del_t *mp, vlib_mai
             }
         }
 
-        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), 
@@ -2294,10 +2294,10 @@ vl_api_is_address_reachable_t_handler (vl_api_is_address_reachable_t *mp)
     }
 
     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 = 
@@ -2460,7 +2460,7 @@ static void send_sw_interface_details (vpe_api_main_t * am,
         
         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;
@@ -2590,7 +2590,7 @@ void send_oam_event (oam_target_t * t)
         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);
         }
@@ -3001,11 +3001,11 @@ void dhcp_compl_event_callback (u32 client_index, u32 pid, u8 * hostname,
     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);
 
@@ -3286,7 +3286,7 @@ static void shmem_cli_output (uword arg, u8 * buffer, uword buffer_bytes)
     
     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);
@@ -3388,12 +3388,12 @@ static void vl_api_sr_tunnel_add_del_t_handler
     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++;
     }
 
@@ -3765,8 +3765,8 @@ static void send_sw_if_l2tpv3_tunnel_details (vpe_api_main_t * am,
     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);
@@ -3785,7 +3785,7 @@ static void send_ip_address_details (vpe_api_main_t * am,
     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);
@@ -4556,11 +4556,11 @@ vl_api_lisp_add_del_local_eid_t_handler(
     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;
     }
@@ -4602,28 +4602,28 @@ lisp_gpe_add_del_fwd_entry_set_address(
     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;
     }
@@ -4669,11 +4669,11 @@ vl_api_lisp_add_del_map_resolver_t_handler(
     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;
     }
@@ -4771,13 +4771,13 @@ send_lisp_local_eid_table_details (mapping_t *mapit,
     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;
 
@@ -4825,9 +4825,9 @@ send_lisp_gpe_tunnel_details (lisp_gpe_tunnel_t *tunnel,
     /*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);
@@ -4878,12 +4878,12 @@ send_lisp_map_resolver_details (ip_address_t *ip,
     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:
@@ -4942,7 +4942,7 @@ static int arp_change_data_callback (u32 pool_index, u8 * new_mac,
 
     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) || 
@@ -5093,10 +5093,10 @@ static void vl_api_ipsec_spd_add_del_entry_t_handler
     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);
@@ -5159,7 +5159,7 @@ static void vl_api_ipsec_sad_add_del_entry_t_handler
     }
     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) {
@@ -5170,12 +5170,12 @@ static void vl_api_ipsec_sad_add_del_entry_t_handler
     }
     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
@@ -5221,7 +5221,7 @@ vl_api_ikev2_profile_set_auth_t_handler
     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);
@@ -5246,7 +5246,7 @@ vl_api_ikev2_profile_set_id_t_handler
     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);
@@ -5372,11 +5372,11 @@ vl_api_map_domain_dump_t_handler
     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);
@@ -5419,7 +5419,7 @@ vl_api_map_rule_dump_t_handler
     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);
   }
 }
@@ -5485,9 +5485,9 @@ static void vl_api_ipsec_sa_set_key_t_handler
     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
index cfb133c..b3bf02e 100644 (file)
@@ -673,10 +673,10 @@ void oam_add_del (test_main_t *tm, int is_add)
     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);
@@ -718,11 +718,11 @@ void add_del_ip4_route (test_main_t *tm, int enable_disable)
 
     /* 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);
@@ -748,13 +748,13 @@ void add_del_ip6_route (test_main_t *tm, int enable_disable)
 
     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);
 }
@@ -774,7 +774,7 @@ void add_del_interface_address (test_main_t *tm, int enable_disable)
     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);
 }
@@ -796,8 +796,8 @@ void add_del_v6_interface_address (test_main_t *tm, int enable_disable)
     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);
 }
@@ -842,7 +842,7 @@ void connect_unix_tap (test_main_t *tm, char *name)
     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);
 }
@@ -892,7 +892,7 @@ void create_mpls_gre_tunnel (test_main_t *tm, u32 vrf_id, u32 label,
     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);
 
@@ -907,13 +907,13 @@ void create_mpls_gre_tunnel (test_main_t *tm, u32 vrf_id, u32 label,
 
     /* 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);
@@ -934,10 +934,10 @@ void add_del_proxy_arp (test_main_t *tm, int is_add)
 
     /* 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);
 }
@@ -974,7 +974,7 @@ void add_ip4_neighbor (test_main_t *tm, int add_del)
     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);
 }
@@ -999,8 +999,8 @@ void add_ip6_neighbor (test_main_t *tm, int add_del)
     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);
 }
@@ -1151,8 +1151,8 @@ void ip6nd_ra_prefix(test_main_t *tm, int is_no)
     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;
 
@@ -1205,8 +1205,8 @@ void ip6_set_link_local_address(test_main_t *tm)
     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;
 
index c230e05..eb6848f 100644 (file)
@@ -42,7 +42,7 @@ void get_interface_ethernet_address (l2t_main_t *lm,
 
     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 */
@@ -326,8 +326,8 @@ l2tp_session_add_command_fn (vlib_main_t * vm,
     
     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);
@@ -348,13 +348,13 @@ l2tp_session_add_command_fn (vlib_main_t * vm,
     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;
index 63b65d5..d6d3551 100644 (file)
@@ -169,8 +169,8 @@ sticky_hash_miss_node_fn (vlib_main_t * vm,
           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);
 
@@ -406,8 +406,8 @@ ip4_sticky_hash_init_command_fn (vlib_main_t * vm,
   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,
index 23aa3cf..32b6d03 100644 (file)
@@ -50,7 +50,7 @@ virtual_ip_cmd_fn_command_fn (vlib_main_t * vm,
         {
             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'",
index daaced4..cd53a20 100644 (file)
@@ -666,7 +666,7 @@ static void vl_api_vnet_interface_counters_t_handler (
         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;
             }
@@ -776,7 +776,7 @@ static void vl_api_vnet_ip4_fib_counters_t_handler (
         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;
             }
@@ -809,7 +809,7 @@ static void vl_api_vnet_ip6_fib_counters_t_handler (
         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;
             }
index adcd32c..1b4d627 100644 (file)
@@ -189,6 +189,8 @@ nobase_include_HEADERS = \
   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 \
index b8acd05..f5d70b5 100644 (file)
@@ -101,7 +101,7 @@ static clib_error_t * elf_set_interpreter (elf_main_t * em,
 
   /* 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;
 }
@@ -336,11 +336,11 @@ set_interpreter_rpath (elf_tool_main_t * tm)
     }
   
   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... */
index 6242e0f..3ed3dca 100644 (file)
@@ -129,7 +129,7 @@ BV(make_working_copy)
 
   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();
@@ -167,7 +167,7 @@ static BVT(clib_bihash_value) *
                 {
                   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;
                     }
@@ -243,7 +243,7 @@ int BV(clib_bihash_add_del)
         {
           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;
@@ -254,7 +254,7 @@ int BV(clib_bihash_add_del)
         {
           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;
@@ -301,7 +301,7 @@ int BV(clib_bihash_add_del)
     {
       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;
         }
     }
index bbd321b..8a09cd4 100644 (file)
@@ -818,7 +818,7 @@ add_relocation_table (elf_main_t * em, elf_section_t * s)
        }
 
       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
@@ -1909,7 +1909,7 @@ elf_create_section_with_contents (elf_main_t * em,
   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;
index 1a0102d..5298916 100644 (file)
@@ -951,7 +951,7 @@ elf_get_section_contents (elf_main_t * em,
                            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;
index b748963..06b97d8 100644 (file)
@@ -263,7 +263,7 @@ static u8 * fixed_format (u8 * s, char * fmt, char * result, uword * result_len)
 
   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:
@@ -836,7 +836,7 @@ unserialize_elog_event (serialize_main_t * m, va_list * va)
          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;
        }
index 3b8349d..fc287a2 100644 (file)
@@ -111,11 +111,11 @@ void * _clib_fifo_resize (void * v_old, uword n_new_elts, uword elt_bytes)
       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. */
index 54aa8f2..10c7b65 100644 (file)
@@ -210,9 +210,9 @@ do {                                                                        \
   _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. */
index adadf01..86231b4 100644 (file)
@@ -348,7 +348,7 @@ set_indirect_is_user (void * v,
       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)
@@ -428,7 +428,7 @@ static void unset_indirect (void * v, uword i, hash_pair_t * q)
 
       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
@@ -443,7 +443,7 @@ static void unset_indirect (void * v, uword i, hash_pair_t * q)
     {
       /* 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)
@@ -484,7 +484,7 @@ static hash_pair_t * lookup (void * v, uword key, enum lookup_opcode op,
            {
              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);
            }
        }
@@ -517,7 +517,7 @@ static hash_pair_t * lookup (void * v, uword key, enum lookup_opcode op,
          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);
 
@@ -532,8 +532,8 @@ static hash_pair_t * lookup (void * v, uword key, enum lookup_opcode op,
     {
       /* 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)
index 912e865..c6605da 100644 (file)
@@ -180,7 +180,7 @@ always_inline void * _heap_dup (void * v_old, uword v_bytes)
                       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;
 }
 
index 301bcdd..a4c679c 100644 (file)
@@ -171,7 +171,7 @@ always_inline void * clib_mem_realloc (void * p, uword new_size, uword old_size)
        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;
diff --git a/vppinfra/vppinfra/memcpy_avx.h b/vppinfra/vppinfra/memcpy_avx.h
new file mode 100644 (file)
index 0000000..0ec6032
--- /dev/null
@@ -0,0 +1,261 @@
+/*
+ * 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 */
+
diff --git a/vppinfra/vppinfra/memcpy_sse3.h b/vppinfra/vppinfra/memcpy_sse3.h
new file mode 100644 (file)
index 0000000..12748f7
--- /dev/null
@@ -0,0 +1,330 @@
+/*
+ * 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 */
+
index 7d2dc36..a7ff858 100644 (file)
@@ -288,7 +288,7 @@ uword mhash_set_mem (mhash_t * h, void * key, uword * new_value, uword * old_val
       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]);
@@ -309,7 +309,7 @@ uword mhash_set_mem (mhash_t * h, void * key, uword * new_value, uword * old_val
        }
 
       n_key_bytes = h->n_key_bytes;
-      memcpy (k, key, n_key_bytes);
+      clib_memcpy (k, key, n_key_bytes);
     }
   ikey = i;
 
index 4bea068..81a5f49 100644 (file)
@@ -79,7 +79,7 @@ u8 * format_pfhash (u8 * s, va_list * args)
                   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];
                     }
                 }
@@ -93,7 +93,7 @@ u8 * format_pfhash (u8 * s, va_list * args)
                       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];
                         }
                     }
@@ -106,7 +106,7 @@ u8 * format_pfhash (u8 * s, va_list * args)
                       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];
                         }
                     }
@@ -120,7 +120,7 @@ u8 * format_pfhash (u8 * s, va_list * args)
                   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];
                     }
                 }
@@ -131,7 +131,7 @@ u8 * format_pfhash (u8 * s, va_list * args)
       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];
       }));      
 
@@ -408,7 +408,7 @@ void pfhash_set (pfhash_t * p, u32 bucket, void * key, void * value)
           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++;
@@ -462,7 +462,7 @@ void pfhash_set (pfhash_t * p, u32 bucket, void * key, void * value)
         {
           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;
             }
@@ -471,13 +471,13 @@ void pfhash_set (pfhash_t * p, u32 bucket, void * key, void * value)
       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++;
@@ -491,7 +491,7 @@ void pfhash_set (pfhash_t * p, u32 bucket, void * key, void * value)
             {
               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;
                 }
@@ -500,7 +500,7 @@ void pfhash_set (pfhash_t * p, u32 bucket, void * key, void * value)
           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++;
             }
@@ -511,7 +511,7 @@ void pfhash_set (pfhash_t * p, u32 bucket, void * key, void * value)
             {
               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;
                 }
@@ -520,7 +520,7 @@ void pfhash_set (pfhash_t * p, u32 bucket, void * key, void * value)
           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++;
             }
@@ -528,7 +528,7 @@ void pfhash_set (pfhash_t * p, u32 bucket, void * key, void * value)
         }
       /* 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++;
@@ -540,7 +540,7 @@ void pfhash_set (pfhash_t * p, u32 bucket, void * key, void * value)
         {
           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;
             }
@@ -549,13 +549,13 @@ void pfhash_set (pfhash_t * p, u32 bucket, void * key, void * value)
       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++;
index ab533e8..4025b70 100644 (file)
@@ -141,7 +141,7 @@ void serialize_cstring (serialize_main_t * m, char * s)
   if (len > 0) 
     {
       p = serialize_get (m, len);
-      memcpy (p, s, len);
+      clib_memcpy (p, s, len);
     }
 }
 
@@ -161,7 +161,7 @@ void unserialize_cstring (serialize_main_t * m, char ** s)
     {
       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;
@@ -175,7 +175,7 @@ void serialize_vec_8 (serialize_main_t * m, va_list * va)
   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)
@@ -183,7 +183,7 @@ 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)                                                      \
@@ -582,7 +582,7 @@ void serialize_magic (serialize_main_t * m, void * magic, u32 magic_bytes)
   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,
@@ -664,7 +664,7 @@ static void * serialize_write_not_inline (serialize_main_header_t * m,
     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;
index ae55dc6..44ceb65 100644 (file)
@@ -100,7 +100,7 @@ socket_config (char * config,
     {
       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]);
     }
@@ -157,7 +157,7 @@ socket_config (char * config,
              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
index 1b4d766..1249821 100644 (file)
@@ -1,3 +1,17 @@
+/*
+ * 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 */
index 914513a..afdb470 100644 (file)
@@ -70,7 +70,7 @@ static clib_error_t * elf_set_interpreter (elf_main_t * em, char * interp)
 
   /* 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;
 }
index b109e99..bb82c27 100644 (file)
@@ -188,7 +188,7 @@ int test_elog_main (unformat_input_t * input)
 
            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)));
          }
 
          {
index 58ffb34..912038d 100644 (file)
@@ -87,7 +87,7 @@ void * vec_resize_allocate_memory (void * v,
     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;
 
index 0608006..0c3237d 100644 (file)
@@ -319,7 +319,7 @@ do {                                                \
   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);                                               \
 })
@@ -346,7 +346,8 @@ do {                                                \
     @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.
@@ -543,7 +544,7 @@ do {                                                                                \
   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)
@@ -705,7 +706,8 @@ do {                                                        \
   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, 
@@ -779,7 +781,7 @@ do {                                                                        \
                                                                        \
   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.
@@ -795,7 +797,7 @@ do {                                                                        \
                                                                        \
   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.
@@ -811,7 +813,7 @@ do {                                                                    \
   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
@@ -828,7 +830,7 @@ do {                                                                    \
   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)
 
 
@@ -909,7 +911,7 @@ do {                                                                \
     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)