summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk
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/dpdk
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/dpdk')
-rw-r--r--src/plugins/dpdk/device/device.c21
-rw-r--r--src/plugins/dpdk/device/dpdk_priv.h2
-rw-r--r--src/plugins/dpdk/device/flow.c12
-rw-r--r--src/plugins/dpdk/device/node.c15
-rw-r--r--src/plugins/dpdk/ipsec/esp_decrypt.c10
-rw-r--r--src/plugins/dpdk/ipsec/esp_encrypt.c4
6 files changed, 33 insertions, 31 deletions
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index ea00df25a25..9b54f34a5b2 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -80,12 +80,13 @@ dpdk_tx_trace_buffer (dpdk_main_t * dm, vlib_node_runtime_t * node,
t0->queue_index = queue_id;
t0->device_index = xd->device_index;
t0->buffer_index = vlib_get_buffer_index (vm, buffer);
- clib_memcpy (&t0->mb, mb, sizeof (t0->mb));
- clib_memcpy (&t0->buffer, buffer,
- sizeof (buffer[0]) - sizeof (buffer->pre_data));
- clib_memcpy (t0->buffer.pre_data, buffer->data + buffer->current_data,
- sizeof (t0->buffer.pre_data));
- clib_memcpy (&t0->data, mb->buf_addr + mb->data_off, sizeof (t0->data));
+ clib_memcpy_fast (&t0->mb, mb, sizeof (t0->mb));
+ clib_memcpy_fast (&t0->buffer, buffer,
+ sizeof (buffer[0]) - sizeof (buffer->pre_data));
+ clib_memcpy_fast (t0->buffer.pre_data, buffer->data + buffer->current_data,
+ sizeof (t0->buffer.pre_data));
+ clib_memcpy_fast (&t0->data, mb->buf_addr + mb->data_off,
+ sizeof (t0->data));
}
static_always_inline void
@@ -430,10 +431,10 @@ dpdk_clear_hw_interface_counters (u32 instance)
*/
dpdk_update_counters (xd, vlib_time_now (dm->vlib_main));
- clib_memcpy (&xd->last_cleared_stats, &xd->stats, sizeof (xd->stats));
- clib_memcpy (xd->last_cleared_xstats, xd->xstats,
- vec_len (xd->last_cleared_xstats) *
- sizeof (xd->last_cleared_xstats[0]));
+ clib_memcpy_fast (&xd->last_cleared_stats, &xd->stats, sizeof (xd->stats));
+ clib_memcpy_fast (xd->last_cleared_xstats, xd->xstats,
+ vec_len (xd->last_cleared_xstats) *
+ sizeof (xd->last_cleared_xstats[0]));
}
diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h
index e5db674ca6d..b44cd49142c 100644
--- a/src/plugins/dpdk/device/dpdk_priv.h
+++ b/src/plugins/dpdk/device/dpdk_priv.h
@@ -97,7 +97,7 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now)
return;
xd->time_last_stats_update = now ? now : xd->time_last_stats_update;
- clib_memcpy (&xd->last_stats, &xd->stats, sizeof (xd->last_stats));
+ clib_memcpy_fast (&xd->last_stats, &xd->stats, sizeof (xd->last_stats));
rte_eth_stats_get (xd->port_id, &xd->stats);
/* maybe bump interface rx no buffer counter */
diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c
index 6612ce4e1ad..63f04b8323d 100644
--- a/src/plugins/dpdk/device/flow.c
+++ b/src/plugins/dpdk/device/flow.c
@@ -84,10 +84,10 @@ dpdk_flow_add (dpdk_device_t * xd, vnet_flow_t * f, dpdk_flow_entry_t * fe)
if (f->type == VNET_FLOW_TYPE_IP6_N_TUPLE)
{
vnet_flow_ip6_n_tuple_t *t6 = &f->ip6_n_tuple;
- clib_memcpy (ip6[0].hdr.src_addr, &t6->src_addr.addr, 16);
- clib_memcpy (ip6[1].hdr.src_addr, &t6->src_addr.mask, 16);
- clib_memcpy (ip6[0].hdr.dst_addr, &t6->dst_addr.addr, 16);
- clib_memcpy (ip6[1].hdr.dst_addr, &t6->dst_addr.mask, 16);
+ clib_memcpy_fast (ip6[0].hdr.src_addr, &t6->src_addr.addr, 16);
+ clib_memcpy_fast (ip6[1].hdr.src_addr, &t6->src_addr.mask, 16);
+ clib_memcpy_fast (ip6[0].hdr.dst_addr, &t6->dst_addr.addr, 16);
+ clib_memcpy_fast (ip6[1].hdr.dst_addr, &t6->dst_addr.mask, 16);
item->type = RTE_FLOW_ITEM_TYPE_IPV6;
item->spec = ip6;
item->mask = ip6 + 1;
@@ -183,9 +183,9 @@ dpdk_flow_add (dpdk_device_t * xd, vnet_flow_t * f, dpdk_flow_entry_t * fe)
raw[0].item.relative = 1;
raw[0].item.length = vxlan_hdr_sz;
- clib_memcpy (raw[0].val + raw_sz, &spec_hdr, vxlan_hdr_sz);
+ clib_memcpy_fast (raw[0].val + raw_sz, &spec_hdr, vxlan_hdr_sz);
raw[0].item.pattern = raw[0].val + raw_sz;
- clib_memcpy (raw[1].val + raw_sz, &mask_hdr, vxlan_hdr_sz);
+ clib_memcpy_fast (raw[1].val + raw_sz, &mask_hdr, vxlan_hdr_sz);
raw[1].item.pattern = raw[1].val + raw_sz;
vec_add2 (items, item, 1);
diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c
index e28ad7f7108..6a3c1c936fc 100644
--- a/src/plugins/dpdk/device/node.c
+++ b/src/plugins/dpdk/device/node.c
@@ -304,7 +304,7 @@ dpdk_process_rx_burst (vlib_main_t * vm, dpdk_per_thread_data_t * ptd,
while (n_left)
{
b[0] = vlib_buffer_from_rte_mbuf (mb[0]);
- clib_memcpy (b[0], &ptd->buffer_template, 64);
+ clib_memcpy_fast (b[0], &ptd->buffer_template, 64);
or_flags |= dpdk_ol_flags_extract (mb, flags, 1);
flags += 1;
@@ -549,12 +549,13 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd,
t0->device_index = xd->device_index;
t0->buffer_index = vlib_get_buffer_index (vm, b0);
- clib_memcpy (&t0->mb, mb[0], sizeof t0->mb);
- clib_memcpy (&t0->buffer, b0, sizeof b0[0] - sizeof b0->pre_data);
- clib_memcpy (t0->buffer.pre_data, b0->data,
- sizeof t0->buffer.pre_data);
- clib_memcpy (&t0->data, mb[0]->buf_addr + mb[0]->data_off,
- sizeof t0->data);
+ clib_memcpy_fast (&t0->mb, mb[0], sizeof t0->mb);
+ clib_memcpy_fast (&t0->buffer, b0,
+ sizeof b0[0] - sizeof b0->pre_data);
+ clib_memcpy_fast (t0->buffer.pre_data, b0->data,
+ sizeof t0->buffer.pre_data);
+ clib_memcpy_fast (&t0->data, mb[0]->buf_addr + mb[0]->data_off,
+ sizeof t0->data);
n_trace--;
n_left--;
buffers++;
diff --git a/src/plugins/dpdk/ipsec/esp_decrypt.c b/src/plugins/dpdk/ipsec/esp_decrypt.c
index 6d8d6bbeaf0..f0fa506debb 100644
--- a/src/plugins/dpdk/ipsec/esp_decrypt.c
+++ b/src/plugins/dpdk/ipsec/esp_decrypt.c
@@ -304,7 +304,7 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm,
mb0->buf_physaddr + digest - ((u8 *) mb0->buf_addr);
if (!is_aead && cipher_alg->alg == RTE_CRYPTO_CIPHER_AES_CBC)
- clib_memcpy(icb, iv, 16);
+ clib_memcpy_fast(icb, iv, 16);
else /* CTR/GCM */
{
u32 *_iv = (u32 *) iv;
@@ -316,7 +316,7 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm,
{
aad = priv->aad;
u32 * _aad = (u32 *) aad;
- clib_memcpy (aad, esp0, 8);
+ clib_memcpy_fast (aad, esp0, 8);
/* _aad[3] should always be 0 */
if (PREDICT_FALSE (sa0->use_esn))
@@ -330,7 +330,7 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm,
if (sa0->use_esn)
{
- clib_memcpy (priv->icv, digest, trunc_size);
+ clib_memcpy_fast (priv->icv, digest, trunc_size);
u32 *_digest = (u32 *) digest;
_digest[0] = clib_host_to_net_u32 (sa0->seq_hi);
auth_len += sizeof(sa0->seq_hi);
@@ -349,7 +349,7 @@ trace:
esp_decrypt_trace_t *tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
tr->crypto_alg = sa0->crypto_alg;
tr->integ_alg = sa0->integ_alg;
- clib_memcpy (tr->packet_data, vlib_buffer_get_current (b0),
+ clib_memcpy_fast (tr->packet_data, vlib_buffer_get_current (b0),
sizeof (esp_header_t));
}
}
@@ -647,7 +647,7 @@ dpdk_esp_decrypt_post_inline (vlib_main_t * vm,
tr->crypto_alg = sa0->crypto_alg;
tr->integ_alg = sa0->integ_alg;
ih4 = vlib_buffer_get_current (b0);
- clib_memcpy (tr->packet_data, ih4, sizeof (ip6_header_t));
+ clib_memcpy_fast (tr->packet_data, ih4, sizeof (ip6_header_t));
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
diff --git a/src/plugins/dpdk/ipsec/esp_encrypt.c b/src/plugins/dpdk/ipsec/esp_encrypt.c
index fb3f2a41b48..2259b1b7b81 100644
--- a/src/plugins/dpdk/ipsec/esp_encrypt.c
+++ b/src/plugins/dpdk/ipsec/esp_encrypt.c
@@ -444,7 +444,7 @@ dpdk_esp_encrypt_inline (vlib_main_t * vm,
/* The extra pad bytes would be overwritten by the digest */
if (pad_bytes)
- clib_memcpy (padding, pad_data, 16);
+ clib_memcpy_fast (padding, pad_data, 16);
f0 = (esp_footer_t *) (padding + pad_bytes);
f0->pad_length = pad_bytes;
@@ -538,7 +538,7 @@ dpdk_esp_encrypt_inline (vlib_main_t * vm,
u8 *p = vlib_buffer_get_current (b0);
if (!sa0->is_tunnel)
p += vnet_buffer (b0)->ip.save_rewrite_length;
- clib_memcpy (tr->packet_data, p, sizeof (tr->packet_data));
+ clib_memcpy_fast (tr->packet_data, p, sizeof (tr->packet_data));
}
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);