diff options
author | 2016-03-13 02:22:06 +0100 | |
---|---|---|
committer | 2016-04-22 17:29:47 +0200 | |
commit | f1213b82771ce929c076339c24a777cfd59690e6 (patch) | |
tree | 3c74305e8848047d8ccd1228ee511d57cbf1b1a6 /vpp | |
parent | 2b836cf4d1e4e59ca34229a9fdf49d79216da20e (diff) |
Add clib_memcpy macro based on DPDK rte_memcpy implementation
Change-Id: I22cb443c4bd0bf298abb6f06e8e4ca65a44a2854
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vpp')
-rw-r--r-- | vpp/api/api.c | 116 | ||||
-rw-r--r-- | vpp/api/test_client.c | 50 | ||||
-rw-r--r-- | vpp/app/l2t.c | 10 | ||||
-rw-r--r-- | vpp/app/sticky_hash.c | 8 | ||||
-rw-r--r-- | vpp/app/vpe_cli.c | 2 | ||||
-rw-r--r-- | vpp/stats/stats.c | 6 |
6 files changed, 96 insertions, 96 deletions
diff --git a/vpp/api/api.c b/vpp/api/api.c index cf2b8f4413e..4956a43a297 100644 --- a/vpp/api/api.c +++ b/vpp/api/api.c @@ -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 diff --git a/vpp/api/test_client.c b/vpp/api/test_client.c index cfb133c7e60..b3bf02eae83 100644 --- a/vpp/api/test_client.c +++ b/vpp/api/test_client.c @@ -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; diff --git a/vpp/app/l2t.c b/vpp/app/l2t.c index c230e059802..eb6848ff91d 100644 --- a/vpp/app/l2t.c +++ b/vpp/app/l2t.c @@ -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; diff --git a/vpp/app/sticky_hash.c b/vpp/app/sticky_hash.c index 63b65d5e87c..d6d355123bf 100644 --- a/vpp/app/sticky_hash.c +++ b/vpp/app/sticky_hash.c @@ -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, diff --git a/vpp/app/vpe_cli.c b/vpp/app/vpe_cli.c index 23aa3cf7ba2..32b6d03d6bb 100644 --- a/vpp/app/vpe_cli.c +++ b/vpp/app/vpe_cli.c @@ -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'", diff --git a/vpp/stats/stats.c b/vpp/stats/stats.c index daaced43dd8..cd53a205fcc 100644 --- a/vpp/stats/stats.c +++ b/vpp/stats/stats.c @@ -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; } |