X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlib%2Fnode_funcs.h;h=d848419cb3efefb64f539ab6dd05848d0391af8f;hb=e6446a3cd5f4b4faab87127c1a310e3c7fbf0e60;hp=3ae4e541a681e92a0df389a8260842cc67281963;hpb=609707ea530de6a0f9fa989b8269b973dd89174e;p=vpp.git diff --git a/src/vlib/node_funcs.h b/src/vlib/node_funcs.h index 3ae4e541a68..d848419cb3e 100644 --- a/src/vlib/node_funcs.h +++ b/src/vlib/node_funcs.h @@ -216,7 +216,7 @@ always_inline vlib_frame_t * vlib_get_frame_no_check (vlib_main_t * vm, uword frame_index) { vlib_frame_t *f; - f = vm->heap_base + (frame_index * VLIB_FRAME_ALIGN); + f = vm->heap_aligned_base + (frame_index * VLIB_FRAME_ALIGN); return f; } @@ -227,7 +227,7 @@ vlib_frame_index_no_check (vlib_main_t * vm, vlib_frame_t * f) ASSERT (((uword) f & (VLIB_FRAME_ALIGN - 1)) == 0); - i = ((u8 *) f - (u8 *) vm->heap_base); + i = ((u8 *) f - (u8 *) vm->heap_aligned_base); ASSERT ((i / VLIB_FRAME_ALIGN) <= 0xFFFFFFFFULL); return i / VLIB_FRAME_ALIGN; @@ -775,6 +775,8 @@ vlib_process_signal_event_helper (vlib_node_main_t * nm, uword p_flags, add_to_pending, delete_from_wheel; void *data_to_be_written_by_caller; + ASSERT (n->type == VLIB_NODE_TYPE_PROCESS); + ASSERT (!pool_is_free_index (p->event_type_pool, t)); vec_validate (p->pending_event_data_by_type_index, t); @@ -816,7 +818,15 @@ vlib_process_signal_event_helper (vlib_node_main_t * nm, { /* Waiting for both event and clock? */ if (p_flags & VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT) - delete_from_wheel = 1; + { + if (!TW (tw_timer_handle_is_free) + ((TWT (tw_timer_wheel) *) nm->timing_wheel, + p->stop_timer_handle)) + delete_from_wheel = 1; + else + /* timer just popped so process should already be on the list */ + add_to_pending = 0; + } else /* Waiting only for clock. Event will be queue and may be handled when timer expires. */ @@ -965,6 +975,29 @@ vlib_process_signal_event_pointer (vlib_main_t * vm, d[0] = data; } +/** + * Signal event to process from any thread. + * + * When in doubt, use this. + */ +always_inline void +vlib_process_signal_event_mt (vlib_main_t * vm, + uword node_index, uword type_opaque, uword data) +{ + if (vlib_get_thread_index () != 0) + { + vlib_process_signal_event_mt_args_t args = { + .node_index = node_index, + .type_opaque = type_opaque, + .data = data, + }; + vlib_rpc_call_main_thread (vlib_process_signal_event_mt_helper, + (u8 *) & args, sizeof (args)); + } + else + vlib_process_signal_event (vm, node_index, type_opaque, data); +} + always_inline void vlib_process_signal_one_time_event (vlib_main_t * vm, uword node_index, @@ -1099,6 +1132,14 @@ vlib_node_add_named_next (vlib_main_t * vm, uword node, char *name) return vlib_node_add_named_next_with_slot (vm, node, name, ~0); } +/** + * Get list of nodes + */ +void +vlib_node_get_nodes (vlib_main_t * vm, u32 max_threads, int include_stats, + int barrier_sync, vlib_node_t **** node_dupsp, + vlib_main_t *** stat_vmsp); + /* Query node given name. */ vlib_node_t *vlib_get_node_by_name (vlib_main_t * vm, u8 * name);