aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session-apps
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/session-apps
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/session-apps')
-rw-r--r--src/vnet/session-apps/echo_client.c18
-rw-r--r--src/vnet/session-apps/echo_server.c4
-rw-r--r--src/vnet/session-apps/http_server.c6
3 files changed, 15 insertions, 13 deletions
diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c
index 7935eb8b242..faf8521ce8c 100644
--- a/src/vnet/session-apps/echo_client.c
+++ b/src/vnet/session-apps/echo_client.c
@@ -86,10 +86,12 @@ send_data_chunk (echo_client_main_t * ecm, eclient_session_t * s)
hdr.data_length = rv;
hdr.data_offset = 0;
- clib_memcpy (&hdr.rmt_ip, &at->rmt_ip, sizeof (ip46_address_t));
+ clib_memcpy_fast (&hdr.rmt_ip, &at->rmt_ip,
+ sizeof (ip46_address_t));
hdr.is_ip4 = at->is_ip4;
hdr.rmt_port = at->rmt_port;
- clib_memcpy (&hdr.lcl_ip, &at->lcl_ip, sizeof (ip46_address_t));
+ clib_memcpy_fast (&hdr.lcl_ip, &at->lcl_ip,
+ sizeof (ip46_address_t));
hdr.lcl_port = at->lcl_port;
svm_fifo_enqueue_nowait (f, sizeof (hdr), (u8 *) & hdr);
svm_fifo_enqueue_nocopy (f, rv);
@@ -221,10 +223,10 @@ echo_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
ASSERT (nconnections_this_batch > 0);
vec_validate (connections_this_batch, nconnections_this_batch - 1);
- clib_memcpy (connections_this_batch,
- connection_indices + vec_len (connection_indices)
- - nconnections_this_batch,
- nconnections_this_batch * sizeof (u32));
+ clib_memcpy_fast (connections_this_batch,
+ connection_indices + vec_len (connection_indices)
+ - nconnections_this_batch,
+ nconnections_this_batch * sizeof (u32));
_vec_len (connection_indices) -= nconnections_this_batch;
}
@@ -402,8 +404,8 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
{
transport_connection_t *tc;
tc = session_get_transport (s);
- clib_memcpy (&session->data.transport, tc,
- sizeof (session->data.transport));
+ clib_memcpy_fast (&session->data.transport, tc,
+ sizeof (session->data.transport));
session->data.is_dgram = 1;
}
diff --git a/src/vnet/session-apps/echo_server.c b/src/vnet/session-apps/echo_server.c
index 77710752a16..a4afc5d512f 100644
--- a/src/vnet/session-apps/echo_server.c
+++ b/src/vnet/session-apps/echo_server.c
@@ -330,13 +330,13 @@ echo_server_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret)
clib_memset (a_cert, 0, sizeof (*a_cert));
a_cert->app_index = a->app_index;
vec_validate (a_cert->cert, test_srv_crt_rsa_len);
- clib_memcpy (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len);
+ clib_memcpy_fast (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len);
vnet_app_add_tls_cert (a_cert);
clib_memset (a_key, 0, sizeof (*a_key));
a_key->app_index = a->app_index;
vec_validate (a_key->key, test_srv_key_rsa_len);
- clib_memcpy (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len);
+ clib_memcpy_fast (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len);
vnet_app_add_tls_key (a_key);
return 0;
}
diff --git a/src/vnet/session-apps/http_server.c b/src/vnet/session-apps/http_server.c
index 8501cb4ee70..79c2d4a7bfc 100644
--- a/src/vnet/session-apps/http_server.c
+++ b/src/vnet/session-apps/http_server.c
@@ -132,7 +132,7 @@ http_cli_output (uword arg, u8 * buffer, uword buffer_bytes)
offset = vec_len (output_vec);
vec_validate (output_vec, offset + buffer_bytes - 1);
- clib_memcpy (output_vec + offset, buffer, buffer_bytes);
+ clib_memcpy_fast (output_vec + offset, buffer, buffer_bytes);
*output_vecp = output_vec;
}
@@ -525,13 +525,13 @@ server_attach ()
clib_memset (a_cert, 0, sizeof (*a_cert));
a_cert->app_index = a->app_index;
vec_validate (a_cert->cert, test_srv_crt_rsa_len);
- clib_memcpy (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len);
+ clib_memcpy_fast (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len);
vnet_app_add_tls_cert (a_cert);
clib_memset (a_key, 0, sizeof (*a_key));
a_key->app_index = a->app_index;
vec_validate (a_key->key, test_srv_key_rsa_len);
- clib_memcpy (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len);
+ clib_memcpy_fast (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len);
vnet_app_add_tls_key (a_key);
return 0;