summaryrefslogtreecommitdiffstats
path: root/src/vnet/bfd
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/vnet/bfd
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/vnet/bfd')
-rw-r--r--src/vnet/bfd/bfd_api.c27
-rw-r--r--src/vnet/bfd/bfd_udp.c16
2 files changed, 22 insertions, 21 deletions
diff --git a/src/vnet/bfd/bfd_api.c b/src/vnet/bfd/bfd_api.c
index bb852256ad7..ea6730fb8b9 100644
--- a/src/vnet/bfd/bfd_api.c
+++ b/src/vnet/bfd/bfd_api.c
@@ -72,13 +72,13 @@ pub_sub_handler (bfd_events, BFD_EVENTS);
clib_memset (&peer_addr, 0, sizeof (peer_addr)); \
if (mp->is_ipv6) \
{ \
- clib_memcpy (&local_addr.ip6, mp->local_addr, sizeof (local_addr.ip6)); \
- clib_memcpy (&peer_addr.ip6, mp->peer_addr, sizeof (peer_addr.ip6)); \
+ clib_memcpy_fast (&local_addr.ip6, mp->local_addr, sizeof (local_addr.ip6)); \
+ clib_memcpy_fast (&peer_addr.ip6, mp->peer_addr, sizeof (peer_addr.ip6)); \
} \
else \
{ \
- clib_memcpy (&local_addr.ip4, mp->local_addr, sizeof (local_addr.ip4)); \
- clib_memcpy (&peer_addr.ip4, mp->peer_addr, sizeof (peer_addr.ip4)); \
+ clib_memcpy_fast (&local_addr.ip4, mp->local_addr, sizeof (local_addr.ip4)); \
+ clib_memcpy_fast (&peer_addr.ip4, mp->peer_addr, sizeof (peer_addr.ip4)); \
}
#define BFD_UDP_API_PARAM_FROM_MP(mp) \
@@ -176,16 +176,17 @@ send_bfd_udp_session_details (vl_api_registration_t * reg, u32 context,
}
if (mp->is_ipv6)
{
- clib_memcpy (mp->local_addr, &key->local_addr,
- sizeof (key->local_addr));
- clib_memcpy (mp->peer_addr, &key->peer_addr, sizeof (key->peer_addr));
+ clib_memcpy_fast (mp->local_addr, &key->local_addr,
+ sizeof (key->local_addr));
+ clib_memcpy_fast (mp->peer_addr, &key->peer_addr,
+ sizeof (key->peer_addr));
}
else
{
- clib_memcpy (mp->local_addr, key->local_addr.ip4.data,
- sizeof (key->local_addr.ip4.data));
- clib_memcpy (mp->peer_addr, key->peer_addr.ip4.data,
- sizeof (key->peer_addr.ip4.data));
+ clib_memcpy_fast (mp->local_addr, key->local_addr.ip4.data,
+ sizeof (key->local_addr.ip4.data));
+ clib_memcpy_fast (mp->peer_addr, key->peer_addr.ip4.data,
+ sizeof (key->peer_addr.ip4.data));
}
mp->required_min_rx =
@@ -387,7 +388,7 @@ vl_api_bfd_udp_get_echo_source_t_handler (vl_api_bfd_udp_get_echo_source_t *
if (have_usable_ip4)
{
rmp->have_usable_ip4 = 1;
- clib_memcpy (rmp->ip4_addr, &ip4, sizeof (ip4));
+ clib_memcpy_fast (rmp->ip4_addr, &ip4, sizeof (ip4));
}
else
{
@@ -396,7 +397,7 @@ vl_api_bfd_udp_get_echo_source_t_handler (vl_api_bfd_udp_get_echo_source_t *
if (have_usable_ip6)
{
rmp->have_usable_ip6 = 1;
- clib_memcpy (rmp->ip6_addr, &ip6, sizeof (ip6));
+ clib_memcpy_fast (rmp->ip6_addr, &ip6, sizeof (ip6));
}
else
{
diff --git a/src/vnet/bfd/bfd_udp.c b/src/vnet/bfd/bfd_udp.c
index 0da19bdb630..d35c6dee5e1 100644
--- a/src/vnet/bfd/bfd_udp.c
+++ b/src/vnet/bfd/bfd_udp.c
@@ -330,17 +330,17 @@ bfd_add_udp6_transport (vlib_main_t * vm, u32 bi, const bfd_session_t * bs,
{
return rv;
}
- clib_memcpy (&headers->ip6.dst_address, &key->local_addr.ip6,
- sizeof (headers->ip6.dst_address));
+ clib_memcpy_fast (&headers->ip6.dst_address, &key->local_addr.ip6,
+ sizeof (headers->ip6.dst_address));
headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd_echo6);
}
else
{
- clib_memcpy (&headers->ip6.src_address, &key->local_addr.ip6,
- sizeof (headers->ip6.src_address));
- clib_memcpy (&headers->ip6.dst_address, &key->peer_addr.ip6,
- sizeof (headers->ip6.dst_address));
+ clib_memcpy_fast (&headers->ip6.src_address, &key->local_addr.ip6,
+ sizeof (headers->ip6.src_address));
+ clib_memcpy_fast (&headers->ip6.dst_address, &key->peer_addr.ip6,
+ sizeof (headers->ip6.dst_address));
headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd6);
}
@@ -1211,7 +1211,7 @@ bfd_udp_input (vlib_main_t * vm, vlib_node_runtime_t * rt,
len = (b0->current_length < sizeof (t0->data)) ? b0->current_length
: sizeof (t0->data);
t0->len = len;
- clib_memcpy (t0->data, vlib_buffer_get_current (b0), len);
+ clib_memcpy_fast (t0->data, vlib_buffer_get_current (b0), len);
}
/* scan this bfd pkt. error0 is the counter index to bmp */
@@ -1369,7 +1369,7 @@ bfd_udp_echo_input (vlib_main_t * vm, vlib_node_runtime_t * rt,
len = (b0->current_length < sizeof (t0->data)) ? b0->current_length
: sizeof (t0->data);
t0->len = len;
- clib_memcpy (t0->data, vlib_buffer_get_current (b0), len);
+ clib_memcpy_fast (t0->data, vlib_buffer_get_current (b0), len);
}
bfd_lock (bm);