vlib: use index to free suspended frame
[vpp.git] / src / vlib / main.c
index 273ae52..1b9eb39 100644 (file)
@@ -143,7 +143,7 @@ vlib_frame_alloc_to_node (vlib_main_t * vm, u32 to_node_index,
 
   /* Poison frame when debugging. */
   if (CLIB_DEBUG > 0)
-    memset (f, 0xfe, n);
+    clib_memset (f, 0xfe, n);
 
   /* Insert magic number. */
   {
@@ -1416,9 +1416,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 +1453,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 +1534,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)
        {
@@ -1756,7 +1759,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 +1845,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))
     {