vlib: fixed the issue of vpp crash caused by interface up/down
[vpp.git] / src / vlib / node_funcs.h
index 386e916..b1d5c7b 100644 (file)
@@ -224,6 +224,27 @@ vlib_node_get_state (vlib_main_t * vm, u32 node_index)
   return n->state;
 }
 
+always_inline void
+vlib_node_set_flag (vlib_main_t *vm, u32 node_index, u16 flag, u8 enable)
+{
+  vlib_node_runtime_t *r;
+  vlib_node_t *n;
+
+  n = vlib_get_node (vm, node_index);
+  r = vlib_node_get_runtime (vm, node_index);
+
+  if (enable)
+    {
+      n->flags |= flag;
+      r->flags |= flag;
+    }
+  else
+    {
+      n->flags &= ~flag;
+      r->flags &= ~flag;
+    }
+}
+
 always_inline void
 vlib_node_set_interrupt_pending (vlib_main_t *vm, u32 node_index)
 {
@@ -827,7 +848,7 @@ vlib_process_signal_event_helper (vlib_node_main_t * nm,
     if (!data_vec && vec_len (nm->recycled_event_data_vectors))
       {
        data_vec = vec_pop (nm->recycled_event_data_vectors);
-       _vec_len (data_vec) = 0;
+       vec_reset_length (data_vec);
       }
 
     l = vec_len (data_vec);
@@ -1200,6 +1221,12 @@ void vlib_start_process (vlib_main_t * vm, uword process_index);
 
 /* Sync up runtime and main node stats. */
 void vlib_node_sync_stats (vlib_main_t * vm, vlib_node_t * n);
+void vlib_node_runtime_sync_stats (vlib_main_t *vm, vlib_node_runtime_t *r,
+                                  uword n_calls, uword n_vectors,
+                                  uword n_clocks);
+void vlib_node_runtime_sync_stats_node (vlib_node_t *n, vlib_node_runtime_t *r,
+                                       uword n_calls, uword n_vectors,
+                                       uword n_clocks);
 
 /* Node graph initialization function. */
 clib_error_t *vlib_node_main_init (vlib_main_t * vm);