From 178cf493d009995b28fdf220f04c98860ff79a9b Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Tue, 13 Nov 2018 16:34:13 -0500 Subject: Remove c-11 memcpy checks from perf-critical code Change-Id: Id4f37f5d4a03160572954a416efa1ef9b3d79ad1 Signed-off-by: Dave Barach --- src/plugins/ioam/export-common/ioam_export.h | 2 +- src/plugins/ioam/ip6/ioam_cache.h | 18 +++++++++--------- src/plugins/ioam/ip6/ioam_cache_node.c | 18 +++++++++--------- src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c | 6 +++--- src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c | 2 +- src/plugins/ioam/udp-ping/udp_ping_util.c | 2 +- 6 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src/plugins/ioam') diff --git a/src/plugins/ioam/export-common/ioam_export.h b/src/plugins/ioam/export-common/ioam_export.h index 511cb88a73b..672576ebded 100644 --- a/src/plugins/ioam/export-common/ioam_export.h +++ b/src/plugins/ioam/export-common/ioam_export.h @@ -117,7 +117,7 @@ ioam_export_get_my_buffer (ioam_export_main_t * em, u32 thread_id) inline static int ioam_export_buffer_add_header (ioam_export_main_t * em, vlib_buffer_t * b0) { - clib_memcpy (b0->data, em->record_header, vec_len (em->record_header)); + clib_memcpy_fast (b0->data, em->record_header, vec_len (em->record_header)); b0->current_data = 0; b0->current_length = vec_len (em->record_header); b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID; diff --git a/src/plugins/ioam/ip6/ioam_cache.h b/src/plugins/ioam/ip6/ioam_cache.h index 717aaf11b8f..e75deba73f7 100644 --- a/src/plugins/ioam/ip6/ioam_cache.h +++ b/src/plugins/ioam/ip6/ioam_cache.h @@ -374,10 +374,10 @@ ioam_cache_add (vlib_buffer_t * b0, clib_memset (entry, 0, sizeof (*entry)); pool_index = entry - cm->ioam_rewrite_pool; - clib_memcpy (entry->dst_address.as_u64, ip0->dst_address.as_u64, - sizeof (ip6_address_t)); - clib_memcpy (entry->src_address.as_u64, ip0->src_address.as_u64, - sizeof (ip6_address_t)); + clib_memcpy_fast (entry->dst_address.as_u64, ip0->dst_address.as_u64, + sizeof (ip6_address_t)); + clib_memcpy_fast (entry->src_address.as_u64, ip0->src_address.as_u64, + sizeof (ip6_address_t)); entry->src_port = src_port; entry->dst_port = dst_port; entry->seq_no = seq_no; @@ -395,7 +395,7 @@ ioam_cache_add (vlib_buffer_t * b0, } e2e_id_offset = (u8 *) e2e - (u8 *) hbh0; /* setup e2e id option to insert v6 address of the node caching it */ - clib_memcpy (entry->ioam_rewrite_string, hbh0, rewrite_len); + clib_memcpy_fast (entry->ioam_rewrite_string, hbh0, rewrite_len); hbh0 = (ip6_hop_by_hop_header_t *) entry->ioam_rewrite_string; /* suffix rewrite string with e2e ID option */ @@ -657,10 +657,10 @@ ioam_cache_ts_add (ip6_header_t * ip0, clib_memset (entry, 0, sizeof (*entry)); *pool_index = entry - cm->ioam_ts_pool[thread_id]; - clib_memcpy (entry->dst_address.as_u64, ip0->dst_address.as_u64, - sizeof (ip6_address_t)); - clib_memcpy (entry->src_address.as_u64, ip0->src_address.as_u64, - sizeof (ip6_address_t)); + clib_memcpy_fast (entry->dst_address.as_u64, ip0->dst_address.as_u64, + sizeof (ip6_address_t)); + clib_memcpy_fast (entry->src_address.as_u64, ip0->src_address.as_u64, + sizeof (ip6_address_t)); entry->src_port = src_port; entry->dst_port = dst_port; entry->seq_no = seq_no; diff --git a/src/plugins/ioam/ip6/ioam_cache_node.c b/src/plugins/ioam/ip6/ioam_cache_node.c index dd27e127a09..59bc1a64811 100644 --- a/src/plugins/ioam/ip6/ioam_cache_node.c +++ b/src/plugins/ioam/ip6/ioam_cache_node.c @@ -344,17 +344,17 @@ ip6_add_from_cache_hbh_node_fn (vlib_main_t * vm, hbh0 = (ip6_hop_by_hop_header_t *) (ip0 + 1); srh0 = (ip6_sr_header_t *) ((u8 *) hbh0 + rewrite_len); /* $$$ tune, rewrite_len is a multiple of 8 */ - clib_memcpy (hbh0, rewrite, rewrite_len); - clib_memcpy (srh0, cm->sr_rewrite_template, sr_rewrite_len); + clib_memcpy_fast (hbh0, rewrite, rewrite_len); + clib_memcpy_fast (srh0, cm->sr_rewrite_template, sr_rewrite_len); /* Copy dst address into the DA slot in the segment list */ - clib_memcpy (srh0->segments, ip0->dst_address.as_u64, - sizeof (ip6_address_t)); + clib_memcpy_fast (srh0->segments, ip0->dst_address.as_u64, + sizeof (ip6_address_t)); /* Rewrite the ip6 dst address with the first hop */ - clib_memcpy (ip0->dst_address.as_u64, entry->next_hop.as_u64, - sizeof (ip6_address_t)); - clib_memcpy (&srh0->segments[1], - (u8 *) hbh0 + entry->my_address_offset, - sizeof (ip6_address_t)); + clib_memcpy_fast (ip0->dst_address.as_u64, entry->next_hop.as_u64, + sizeof (ip6_address_t)); + clib_memcpy_fast (&srh0->segments[1], + (u8 *) hbh0 + entry->my_address_offset, + sizeof (ip6_address_t)); ioam_cache_entry_free (entry); /* Patch the protocol chain, insert the h-b-h (type 0) header */ diff --git a/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c b/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c index 79ee58eccda..63bcaff14b2 100644 --- a/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c +++ b/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c @@ -415,7 +415,7 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, hbh0 = (ip6_hop_by_hop_header_t *) (ip0 + 1); /* $$$ tune, rewrite_length is a multiple of 8 */ - clib_memcpy (hbh0, rewrite, rewrite_length); + clib_memcpy_fast (hbh0, rewrite, rewrite_length); e2e = (ioam_e2e_cache_option_t *) ((u8 *) hbh0 + cm->rewrite_pool_index_offset); @@ -475,7 +475,7 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, hbh1 = (ip6_hop_by_hop_header_t *) (ip1 + 1); /* $$$ tune, rewrite_length is a multiple of 8 */ - clib_memcpy (hbh1, rewrite, rewrite_length); + clib_memcpy_fast (hbh1, rewrite, rewrite_length); e2e = (ioam_e2e_cache_option_t *) ((u8 *) hbh1 + cm->rewrite_pool_index_offset); @@ -581,7 +581,7 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, hbh0 = (ip6_hop_by_hop_header_t *) (ip0 + 1); /* $$$ tune, rewrite_length is a multiple of 8 */ - clib_memcpy (hbh0, rewrite, rewrite_length); + clib_memcpy_fast (hbh0, rewrite, rewrite_length); e2e = (ioam_e2e_cache_option_t *) ((u8 *) hbh0 + cm->rewrite_pool_index_offset); diff --git a/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c b/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c index 7a4580d804f..84900eb7e01 100644 --- a/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c +++ b/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c @@ -203,7 +203,7 @@ trace00: option_data) ? trace_len : ARRAY_LEN (t->fmt_trace. option_data); t->fmt_trace.trace_len = trace_len; - clib_memcpy (&(t->fmt_trace.option_data), gpe_ioam0, trace_len); + clib_memcpy_fast (&(t->fmt_trace.option_data), gpe_ioam0, trace_len); } /* Remove the iOAM header inside the VxLAN-GPE header */ diff --git a/src/plugins/ioam/udp-ping/udp_ping_util.c b/src/plugins/ioam/udp-ping/udp_ping_util.c index 55f48ea4999..d3612cd01e0 100644 --- a/src/plugins/ioam/udp-ping/udp_ping_util.c +++ b/src/plugins/ioam/udp-ping/udp_ping_util.c @@ -266,7 +266,7 @@ udp_ping_send_ip6_pak (vlib_main_t * vm, ip46_udp_ping_flow * flow) int bogus; b0 = vlib_get_buffer (vm, buffers[i]); stats = flow->udp_data.stats + i; - clib_memcpy (b0->data, stats->ping_rewrite, stats->rewrite_len); + clib_memcpy_fast (b0->data, stats->ping_rewrite, stats->rewrite_len); b0->current_data = 0; b0->current_length = stats->rewrite_len; b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID; -- cgit 1.2.3-korg