aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/map
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-11-13 16:34:13 -0500
committerFlorin Coras <florin.coras@gmail.com>2018-11-14 15:54:01 +0000
commit178cf493d009995b28fdf220f04c98860ff79a9b (patch)
tree097c1be82b8f6fa9bc04b9b1e193158e2e4997eb /src/plugins/map
parent6917b94f2146aa51195a6a2a1ccd8416a1d74bf3 (diff)
Remove c-11 memcpy checks from perf-critical code
Change-Id: Id4f37f5d4a03160572954a416efa1ef9b3d79ad1 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/plugins/map')
-rw-r--r--src/plugins/map/ip4_map.c11
-rw-r--r--src/plugins/map/ip6_map.c17
-rw-r--r--src/plugins/map/map.c4
-rw-r--r--src/plugins/map/map.h2
4 files changed, 16 insertions, 18 deletions
diff --git a/src/plugins/map/ip4_map.c b/src/plugins/map/ip4_map.c
index 44392e820ba..fc47d0fee46 100644
--- a/src/plugins/map/ip4_map.c
+++ b/src/plugins/map/ip4_map.c
@@ -666,17 +666,16 @@ ip4_map_reass (vlib_main_t * vm,
u32 len = vec_len (fragments_to_loopback);
if (len <= VLIB_FRAME_SIZE)
{
- clib_memcpy (from, fragments_to_loopback,
- sizeof (u32) * len);
+ clib_memcpy_fast (from, fragments_to_loopback,
+ sizeof (u32) * len);
n_left_from = len;
vec_reset_length (fragments_to_loopback);
}
else
{
- clib_memcpy (from,
- fragments_to_loopback + (len -
- VLIB_FRAME_SIZE),
- sizeof (u32) * VLIB_FRAME_SIZE);
+ clib_memcpy_fast (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;
}
diff --git a/src/plugins/map/ip6_map.c b/src/plugins/map/ip6_map.c
index 5b80209ae0a..35b58110876 100644
--- a/src/plugins/map/ip6_map.c
+++ b/src/plugins/map/ip6_map.c
@@ -583,7 +583,7 @@ ip6_map_ip6_reass_prepare (vlib_main_t * vm, vlib_node_runtime_t * node,
if (ip6_frag_hdr_offset (frag0))
{
//Not first fragment, add the IPv4 header
- clib_memcpy (ip40, &r->ip4_header, 20);
+ clib_memcpy_fast (ip40, &r->ip4_header, 20);
}
#ifdef MAP_IP6_REASS_COUNT_BYTES
@@ -594,8 +594,8 @@ ip6_map_ip6_reass_prepare (vlib_main_t * vm, vlib_node_runtime_t * node,
if (ip6_frag_hdr_more (frag0))
{
//Not last fragment, we copy end of next
- clib_memcpy (u8_ptr_add (ip60, p0->current_length),
- r->fragments[i].next_data, 20);
+ clib_memcpy_fast (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);
}
@@ -976,17 +976,16 @@ ip6_map_ip4_reass (vlib_main_t * vm,
u32 len = vec_len (fragments_to_loopback);
if (len <= VLIB_FRAME_SIZE)
{
- clib_memcpy (from, fragments_to_loopback,
- sizeof (u32) * len);
+ clib_memcpy_fast (from, fragments_to_loopback,
+ sizeof (u32) * len);
n_left_from = len;
vec_reset_length (fragments_to_loopback);
}
else
{
- clib_memcpy (from,
- fragments_to_loopback + (len -
- VLIB_FRAME_SIZE),
- sizeof (u32) * VLIB_FRAME_SIZE);
+ clib_memcpy_fast (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;
}
diff --git a/src/plugins/map/map.c b/src/plugins/map/map.c
index 13caa368322..49796e47a8e 100644
--- a/src/plugins/map/map.c
+++ b/src/plugins/map/map.c
@@ -1807,7 +1807,7 @@ map_ip6_reass_add_fragment (map_ip6_reass_t * r, u32 pi,
if (!prev_f)
return -1;
- clib_memcpy (prev_f->next_data, data_start, copied_len);
+ clib_memcpy_fast (prev_f->next_data, data_start, copied_len);
prev_f->next_data_len = copied_len;
prev_f->next_data_offset = data_offset;
}
@@ -1817,7 +1817,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)
- clib_memcpy (&r->ip4_header, data_start, sizeof (ip4_header_t));
+ clib_memcpy_fast (&r->ip4_header, data_start, sizeof (ip4_header_t));
}
if (data_len > 20)
diff --git a/src/plugins/map/map.h b/src/plugins/map/map.h
index 1e07b59f762..c4cc855d2e2 100644
--- a/src/plugins/map/map.h
+++ b/src/plugins/map/map.h
@@ -538,7 +538,7 @@ ip4_map_t_embedded_address (map_domain_t *d,
u8 offset = d->ip6_src_len == 64 ? 9 : 12;
ip6->as_u64[0] = d->ip6_src.as_u64[0];
ip6->as_u64[1] = d->ip6_src.as_u64[1];
- clib_memcpy(&ip6->as_u8[offset], ip4, 4);
+ clib_memcpy_fast(&ip6->as_u8[offset], ip4, 4);
}
static_always_inline u32