From 178cf493d009995b28fdf220f04c98860ff79a9b Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Tue, 13 Nov 2018 16:34:13 -0500 Subject: Remove c-11 memcpy checks from perf-critical code Change-Id: Id4f37f5d4a03160572954a416efa1ef9b3d79ad1 Signed-off-by: Dave Barach --- src/examples/sample-plugin/sample/node.c | 56 ++++++++++++++++---------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'src/examples/sample-plugin/sample') diff --git a/src/examples/sample-plugin/sample/node.c b/src/examples/sample-plugin/sample/node.c index 009968b6099..1f0a2e9775b 100644 --- a/src/examples/sample-plugin/sample/node.c +++ b/src/examples/sample-plugin/sample/node.c @@ -183,10 +183,10 @@ VLIB_NODE_FN (sample_node) (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; t->next_index = next0; - clib_memcpy (t->new_src_mac, en0->src_address, - sizeof (t->new_src_mac)); - clib_memcpy (t->new_dst_mac, en0->dst_address, - sizeof (t->new_dst_mac)); + clib_memcpy_fast (t->new_src_mac, en0->src_address, + sizeof (t->new_src_mac)); + clib_memcpy_fast (t->new_dst_mac, en0->dst_address, + sizeof (t->new_dst_mac)); } if (b1->flags & VLIB_BUFFER_IS_TRACED) @@ -195,10 +195,10 @@ VLIB_NODE_FN (sample_node) (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_add_trace (vm, node, b1, sizeof (*t)); t->sw_if_index = sw_if_index1; t->next_index = next1; - clib_memcpy (t->new_src_mac, en1->src_address, - sizeof (t->new_src_mac)); - clib_memcpy (t->new_dst_mac, en1->dst_address, - sizeof (t->new_dst_mac)); + clib_memcpy_fast (t->new_src_mac, en1->src_address, + sizeof (t->new_src_mac)); + clib_memcpy_fast (t->new_dst_mac, en1->dst_address, + sizeof (t->new_dst_mac)); } } @@ -256,10 +256,10 @@ VLIB_NODE_FN (sample_node) (vlib_main_t * vm, vlib_node_runtime_t * node, sample_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; t->next_index = next0; - clib_memcpy (t->new_src_mac, en0->src_address, - sizeof (t->new_src_mac)); - clib_memcpy (t->new_dst_mac, en0->dst_address, - sizeof (t->new_dst_mac)); + clib_memcpy_fast (t->new_src_mac, en0->src_address, + sizeof (t->new_src_mac)); + clib_memcpy_fast (t->new_dst_mac, en0->dst_address, + sizeof (t->new_dst_mac)); } pkts_swapped += 1; @@ -367,10 +367,10 @@ VLIB_NODE_FN (sample_node) (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; t->next_index = next0; - clib_memcpy (t->new_src_mac, en0->src_address, - sizeof (t->new_src_mac)); - clib_memcpy (t->new_dst_mac, en0->dst_address, - sizeof (t->new_dst_mac)); + clib_memcpy_fast (t->new_src_mac, en0->src_address, + sizeof (t->new_src_mac)); + clib_memcpy_fast (t->new_dst_mac, en0->dst_address, + sizeof (t->new_dst_mac)); } if (b1->flags & VLIB_BUFFER_IS_TRACED) @@ -379,10 +379,10 @@ VLIB_NODE_FN (sample_node) (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_add_trace (vm, node, b1, sizeof (*t)); t->sw_if_index = sw_if_index1; t->next_index = next1; - clib_memcpy (t->new_src_mac, en1->src_address, - sizeof (t->new_src_mac)); - clib_memcpy (t->new_dst_mac, en1->dst_address, - sizeof (t->new_dst_mac)); + clib_memcpy_fast (t->new_src_mac, en1->src_address, + sizeof (t->new_src_mac)); + clib_memcpy_fast (t->new_dst_mac, en1->dst_address, + sizeof (t->new_dst_mac)); } } @@ -432,10 +432,10 @@ VLIB_NODE_FN (sample_node) (vlib_main_t * vm, vlib_node_runtime_t * node, sample_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; t->next_index = next0; - clib_memcpy (t->new_src_mac, en0->src_address, - sizeof (t->new_src_mac)); - clib_memcpy (t->new_dst_mac, en0->dst_address, - sizeof (t->new_dst_mac)); + clib_memcpy_fast (t->new_src_mac, en0->src_address, + sizeof (t->new_src_mac)); + clib_memcpy_fast (t->new_dst_mac, en0->dst_address, + sizeof (t->new_dst_mac)); } pkts_swapped += 1; @@ -585,10 +585,10 @@ VLIB_NODE_FN (sample_node) (vlib_main_t * vm, vlib_node_runtime_t * node, t->sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX]; t->next_index = SAMPLE_NEXT_INTERFACE_OUTPUT; en = vlib_buffer_get_current (b[0]); - clib_memcpy (t->new_src_mac, en->src_address, - sizeof (t->new_src_mac)); - clib_memcpy (t->new_dst_mac, en->dst_address, - sizeof (t->new_dst_mac)); + clib_memcpy_fast (t->new_src_mac, en->src_address, + sizeof (t->new_src_mac)); + clib_memcpy_fast (t->new_dst_mac, en->dst_address, + sizeof (t->new_dst_mac)); b++; } else -- cgit 1.2.3-korg