summaryrefslogtreecommitdiffstats
path: root/src/vnet/unix
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/unix
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/unix')
-rw-r--r--src/vnet/unix/pcap.h2
-rw-r--r--src/vnet/unix/tuntap.c15
2 files changed, 9 insertions, 8 deletions
diff --git a/src/vnet/unix/pcap.h b/src/vnet/unix/pcap.h
index 2c174fbedf9..0706aace496 100644
--- a/src/vnet/unix/pcap.h
+++ b/src/vnet/unix/pcap.h
@@ -221,7 +221,7 @@ pcap_add_buffer (pcap_main_t * pm,
while (1)
{
u32 copy_length = clib_min ((u32) n_left, b->current_length);
- clib_memcpy (d, b->data + b->current_data, copy_length);
+ clib_memcpy_fast (d, b->data + b->current_data, copy_length);
n_left -= b->current_length;
if (n_left <= 0)
break;
diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c
index d663d9698a0..e002a248ce4 100644
--- a/src/vnet/unix/tuntap.c
+++ b/src/vnet/unix/tuntap.c
@@ -166,7 +166,8 @@ tuntap_tx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
if (tm->is_ether && (!tm->have_normal_interface))
{
vlib_buffer_reset (b);
- clib_memcpy (vlib_buffer_get_current (b), tm->ether_dst_mac, 6);
+ clib_memcpy_fast (vlib_buffer_get_current (b), tm->ether_dst_mac,
+ 6);
}
/* Re-set iovecs if present. */
@@ -626,7 +627,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input)
goto done;
}
else
- clib_memcpy (tm->ether_dst_mac, ifr.ifr_hwaddr.sa_data, 6);
+ clib_memcpy_fast (tm->ether_dst_mac, ifr.ifr_hwaddr.sa_data, 6);
}
if (have_normal_interface)
@@ -721,7 +722,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im,
/** See if we already know about this subif */
clib_memset (&subif_addr, 0, sizeof (subif_addr));
subif_addr.sw_if_index = sw_if_index;
- clib_memcpy (&subif_addr.addr, address, sizeof (*address));
+ clib_memcpy_fast (&subif_addr.addr, address, sizeof (*address));
p = mhash_get (&tm->subif_mhash, &subif_addr);
@@ -753,7 +754,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im,
/* Set ipv4 address, netmask. */
sin->sin_family = AF_INET;
- clib_memcpy (&sin->sin_addr.s_addr, address, 4);
+ clib_memcpy_fast (&sin->sin_addr.s_addr, address, 4);
if (ioctl (tm->dev_tap_fd, SIOCSIFADDR, &ifr) < 0)
clib_unix_warning ("ioctl SIOCSIFADDR");
@@ -838,7 +839,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
clib_memset (&subif_addr, 0, sizeof (subif_addr));
subif_addr.sw_if_index = sw_if_index;
subif_addr.is_v6 = 1;
- clib_memcpy (&subif_addr.addr, address, sizeof (*address));
+ clib_memcpy_fast (&subif_addr.addr, address, sizeof (*address));
p = mhash_get (&tm->subif_mhash, &subif_addr);
@@ -874,7 +875,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
ifr6.ifr6_ifindex = ifr.ifr_ifindex;
ifr6.ifr6_prefixlen = address_length;
- clib_memcpy (&ifr6.ifr6_addr, address, 16);
+ clib_memcpy_fast (&ifr6.ifr6_addr, address, 16);
if (ioctl (sockfd, SIOCSIFADDR, &ifr6) < 0)
clib_unix_warning ("set address");
@@ -893,7 +894,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
ifr6.ifr6_ifindex = ifr.ifr_ifindex;
ifr6.ifr6_prefixlen = address_length;
- clib_memcpy (&ifr6.ifr6_addr, address, 16);
+ clib_memcpy_fast (&ifr6.ifr6_addr, address, 16);
if (ioctl (sockfd, SIOCDIFADDR, &ifr6) < 0)
clib_unix_warning ("del address");