aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/pg
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/pg
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/pg')
-rw-r--r--src/vnet/pg/input.c29
-rw-r--r--src/vnet/pg/output.c7
-rw-r--r--src/vnet/pg/stream.c10
3 files changed, 25 insertions, 21 deletions
diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c
index 82c6c81cf18..8b46688929f 100644
--- a/src/vnet/pg/input.c
+++ b/src/vnet/pg/input.c
@@ -1091,7 +1091,7 @@ init_replay_buffers_inline (vlib_main_t * vm,
b0->current_length = n0;
- clib_memcpy (b0->data, d0 + data_offset, n0);
+ clib_memcpy_fast (b0->data, d0 + data_offset, n0);
i = i + 1 == l ? 0 : i + 1;
}
}
@@ -1148,8 +1148,8 @@ init_buffers_inline (vlib_main_t * vm,
if (set_data)
{
- clib_memcpy (b0->data, data, n_data);
- clib_memcpy (b1->data, data, n_data);
+ clib_memcpy_fast (b0->data, data, n_data);
+ clib_memcpy_fast (b1->data, data, n_data);
}
else
{
@@ -1173,7 +1173,7 @@ init_buffers_inline (vlib_main_t * vm,
vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0;
if (set_data)
- clib_memcpy (b0->data, data, n_data);
+ clib_memcpy_fast (b0->data, data, n_data);
else
ASSERT (validate_buffer_data2 (b0, s, data_offset, n_data));
}
@@ -1424,13 +1424,15 @@ pg_input_trace (pg_main_t * pg,
t0->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
t1->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX];
- clib_memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data));
- clib_memcpy (&t1->buffer, b1, sizeof (b1[0]) - sizeof (b1->pre_data));
+ clib_memcpy_fast (&t0->buffer, b0,
+ sizeof (b0[0]) - sizeof (b0->pre_data));
+ clib_memcpy_fast (&t1->buffer, b1,
+ sizeof (b1[0]) - sizeof (b1->pre_data));
- clib_memcpy (t0->buffer.pre_data, b0->data,
- sizeof (t0->buffer.pre_data));
- clib_memcpy (t1->buffer.pre_data, b1->data,
- sizeof (t1->buffer.pre_data));
+ clib_memcpy_fast (t0->buffer.pre_data, b0->data,
+ sizeof (t0->buffer.pre_data));
+ clib_memcpy_fast (t1->buffer.pre_data, b1->data,
+ sizeof (t1->buffer.pre_data));
}
while (n_left >= 1)
@@ -1451,9 +1453,10 @@ pg_input_trace (pg_main_t * pg,
t0->stream_index = stream_index;
t0->packet_length = vlib_buffer_length_in_chain (vm, b0);
t0->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
- 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_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));
}
}
diff --git a/src/vnet/pg/output.c b/src/vnet/pg/output.c
index 410a433621c..a84f30301dc 100644
--- a/src/vnet/pg/output.c
+++ b/src/vnet/pg/output.c
@@ -68,9 +68,10 @@ pg_output (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
{
pg_output_trace_t *t = vlib_add_trace (vm, node, b, sizeof (*t));
t->buffer_index = bi0;
- clib_memcpy (&t->buffer, b, sizeof (b[0]) - sizeof (b->pre_data));
- clib_memcpy (t->buffer.pre_data, b->data + b->current_data,
- sizeof (t->buffer.pre_data));
+ clib_memcpy_fast (&t->buffer, b,
+ sizeof (b[0]) - sizeof (b->pre_data));
+ clib_memcpy_fast (t->buffer.pre_data, b->data + b->current_data,
+ sizeof (t->buffer.pre_data));
}
if (pif->pcap_file_name != 0)
diff --git a/src/vnet/pg/stream.c b/src/vnet/pg/stream.c
index 2837d800421..bf0eac370aa 100644
--- a/src/vnet/pg/stream.c
+++ b/src/vnet/pg/stream.c
@@ -205,7 +205,7 @@ pg_interface_add_or_get (pg_main_t * pg, uword if_id)
rnd = (u32) (now * 1e6);
rnd = random_u32 (&rnd);
- clib_memcpy (hw_addr + 2, &rnd, sizeof (rnd));
+ clib_memcpy_fast (hw_addr + 2, &rnd, sizeof (rnd));
hw_addr[0] = 2;
hw_addr[1] = 0xfe;
@@ -333,10 +333,10 @@ pg_edit_group_get_fixed_packet_data (pg_stream_t * s,
vec_foreach (e, g->edits) do_edit (s, g, e, /* want_commit */ 0);
- clib_memcpy (packet_data, g->fixed_packet_data,
- vec_len (g->fixed_packet_data));
- clib_memcpy (packet_data_mask, g->fixed_packet_data_mask,
- vec_len (g->fixed_packet_data_mask));
+ clib_memcpy_fast (packet_data, g->fixed_packet_data,
+ vec_len (g->fixed_packet_data));
+ clib_memcpy_fast (packet_data_mask, g->fixed_packet_data_mask,
+ vec_len (g->fixed_packet_data_mask));
}
static void