Remove c-11 memcpy checks from perf-critical code
[vpp.git] / src / vlib / main.c
index 14d8914..964feb0 100644 (file)
@@ -157,6 +157,7 @@ vlib_frame_alloc_to_node (vlib_main_t * vm, u32 to_node_index,
   f->n_vectors = 0;
   f->scalar_size = scalar_size;
   f->vector_size = vector_size;
+  f->flags = 0;
 
   fs->n_alloc_frames += 1;
 
@@ -1416,9 +1417,8 @@ dispatch_suspended_process (vlib_main_t * vm,
   ASSERT (p->flags & (VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK
                      | VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT));
 
-  pf =
-    pool_elt_at_index (nm->suspended_process_frames,
-                      p->suspended_process_frame_index);
+  pf = pool_elt_at_index (nm->suspended_process_frames,
+                         p->suspended_process_frame_index);
 
   node_runtime = &p->node_runtime;
   node = vlib_get_node (vm, node_runtime->node_index);
@@ -1454,8 +1454,9 @@ dispatch_suspended_process (vlib_main_t * vm,
   else
     {
       p->flags &= ~VLIB_PROCESS_IS_RUNNING;
+      pool_put_index (nm->suspended_process_frames,
+                     p->suspended_process_frame_index);
       p->suspended_process_frame_index = ~0;
-      pool_put (nm->suspended_process_frames, pf);
     }
 
   t = clib_cpu_time_now ();
@@ -1534,7 +1535,10 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
       vlib_node_runtime_t *n;
 
       if (PREDICT_FALSE (_vec_len (vm->pending_rpc_requests) > 0))
-       vl_api_send_pending_rpc_requests (vm);
+       {
+         if (!is_main)
+           vl_api_send_pending_rpc_requests (vm);
+       }
 
       if (!is_main)
        {
@@ -1646,12 +1650,12 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
                                                          te->n_data_elts,
                                                          te->n_data_elt_bytes);
                      if (te->n_data_bytes < sizeof (te->inline_event_data))
-                       clib_memcpy (data, te->inline_event_data,
-                                    te->n_data_bytes);
+                       clib_memcpy_fast (data, te->inline_event_data,
+                                         te->n_data_bytes);
                      else
                        {
-                         clib_memcpy (data, te->event_data_as_vector,
-                                      te->n_data_bytes);
+                         clib_memcpy_fast (data, te->event_data_as_vector,
+                                           te->n_data_bytes);
                          vec_free (te->event_data_as_vector);
                        }
                      pool_put (nm->signal_timed_event_data_pool, te);
@@ -1756,7 +1760,7 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input)
   if (!vm->name)
     vm->name = "VLIB";
 
-  if ((error = unix_physmem_init (vm)))
+  if ((error = vlib_physmem_init (vm)))
     {
       clib_error_report (error);
       goto done;
@@ -1842,6 +1846,8 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input)
 
   vec_validate (vm->pending_rpc_requests, 0);
   _vec_len (vm->pending_rpc_requests) = 0;
+  vec_validate (vm->processing_rpc_requests, 0);
+  _vec_len (vm->processing_rpc_requests) = 0;
 
   switch (clib_setjmp (&vm->main_loop_exit, VLIB_MAIN_LOOP_EXIT_NONE))
     {