summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device
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/device
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/device')
-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
4 files changed, 26 insertions, 24 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++;