Remove c-11 memcpy checks from perf-critical code
[vpp.git] / src / examples / sample-plugin / sample / node.c
index 009968b..1f0a2e9 100644 (file)
@@ -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