STRUCT_OFFSET_OF (vlib_node_runtime_t, runtime_data));
if (vec_len (n->runtime_data) > 0)
- clib_memcpy (r->runtime_data, n->runtime_data, vec_len (n->runtime_data));
+ clib_memcpy_fast (r->runtime_data, n->runtime_data,
+ vec_len (n->runtime_data));
}
/** \brief Set node dispatch state.
return vec_elt (nm->processes, node->runtime_index);
}
-/* Fetches frame with given handle. */
always_inline vlib_frame_t *
-vlib_get_frame_no_check (vlib_main_t * vm, uword frame_index)
+vlib_get_frame (vlib_main_t * vm, vlib_frame_t * f)
{
- vlib_frame_t *f;
- f = vm->heap_aligned_base + (frame_index * VLIB_FRAME_ALIGN);
+ ASSERT (f != NULL);
+ ASSERT (f->frame_flags & VLIB_FRAME_IS_ALLOCATED);
return f;
}
-always_inline u32
-vlib_frame_index_no_check (vlib_main_t * vm, vlib_frame_t * f)
-{
- uword i;
-
- ASSERT (((uword) f & (VLIB_FRAME_ALIGN - 1)) == 0);
-
- i = ((u8 *) f - (u8 *) vm->heap_aligned_base);
- ASSERT ((i / VLIB_FRAME_ALIGN) <= 0xFFFFFFFFULL);
-
- return i / VLIB_FRAME_ALIGN;
-}
-
-always_inline vlib_frame_t *
-vlib_get_frame (vlib_main_t * vm, uword frame_index)
-{
- vlib_frame_t *f = vlib_get_frame_no_check (vm, frame_index);
- ASSERT (f->flags & VLIB_FRAME_IS_ALLOCATED);
- return f;
-}
-
-always_inline u32
-vlib_frame_index (vlib_main_t * vm, vlib_frame_t * f)
+always_inline void
+vlib_frame_no_append (vlib_frame_t * f)
{
- uword i = vlib_frame_index_no_check (vm, f);
- ASSERT (vlib_get_frame (vm, i) == f);
- return i;
+ f->frame_flags |= VLIB_FRAME_NO_APPEND;
}
/* Byte alignment for vector arguments. */
/** \brief Get pointer to frame scalar data.
- @warning This is almost certainly not the function you wish to call.
- See @ref vlib_frame_vector_args instead.
-
@param f vlib_frame_t pointer
@return arbitrary node scalar data
@sa vlib_frame_vector_args
*/
always_inline void *
-vlib_frame_args (vlib_frame_t * f)
+vlib_frame_scalar_args (vlib_frame_t * f)
{
return vlib_frame_vector_args (f) - f->scalar_size;
}
{
vlib_process_signal_one_time_event (vm, p->node_index, p->one_time_event,
/* data */ ~0);
- memset (p, ~0, sizeof (p[0]));
+ clib_memset (p, ~0, sizeof (p[0]));
}
always_inline void
em->counters[node_counter_base_index + counter_index] += increment;
}
+/** @brief Create a vlib process
+ * @param vm &vlib_global_main
+ * @param f the process node function
+ * @param log2_n_stack_bytes size of the process stack, defaults to 16K
+ * @return newly-create node index
+ * @warning call only on the main thread. Barrier sync required
+ */
+u32 vlib_process_create (vlib_main_t * vm, char *name,
+ vlib_node_function_t * f, u32 log2_n_stack_bytes);
+
#endif /* included_vlib_node_funcs_h */
/*