X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlib%2Fmain.c;h=6783068b42bf59f7b17e4b16b9bc25d8bef25de5;hb=e3248989586ade29baba635aae66b06995917221;hp=7da519241bb3163bcb9144fff703d1aca4cc2e8b;hpb=fd542f1085d3a06066168c2d38e7f328b5b26ee3;p=vpp.git diff --git a/src/vlib/main.c b/src/vlib/main.c index 7da519241bb..6783068b42b 100644 --- a/src/vlib/main.c +++ b/src/vlib/main.c @@ -1547,6 +1547,13 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main) } } } + /* Input nodes may have added work to the pending vector. + Process pending vector until there is nothing left. + All pending vectors will be processed from input -> output. */ + for (i = 0; i < _vec_len (nm->pending_frames); i++) + cpu_time_now = dispatch_pending_node (vm, i, cpu_time_now); + /* Reset pending vector for next iteration. */ + _vec_len (nm->pending_frames) = 0; if (is_main) { @@ -1565,7 +1572,6 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main) { uword i; - processes_timing_wheel_data: for (i = 0; i < _vec_len (nm->data_from_advancing_timing_wheel); i++) { @@ -1608,19 +1614,6 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main) _vec_len (nm->data_from_advancing_timing_wheel) = 0; } } - - /* Input nodes may have added work to the pending vector. - Process pending vector until there is nothing left. - All pending vectors will be processed from input -> output. */ - for (i = 0; i < _vec_len (nm->pending_frames); i++) - cpu_time_now = dispatch_pending_node (vm, i, cpu_time_now); - /* Reset pending vector for next iteration. */ - _vec_len (nm->pending_frames) = 0; - - /* Pending internal nodes may resume processes. */ - if (is_main && _vec_len (nm->data_from_advancing_timing_wheel) > 0) - goto processes_timing_wheel_data; - vlib_increment_main_loop_counter (vm); /* Record time stamp in case there are no enabled nodes and above @@ -1678,6 +1671,18 @@ dummy_queue_signal_callback (vlib_main_t * vm) { } +#define foreach_weak_reference_stub \ +_(vlib_map_stat_segment_init) \ +_(vpe_api_init) \ +_(vlibmemory_init) \ +_(map_api_segment_init) + +#define _(name) \ +clib_error_t *name (vlib_main_t *vm) __attribute__((weak)); \ +clib_error_t *name (vlib_main_t *vm) { return 0; } +foreach_weak_reference_stub; +#undef _ + /* Main function. */ int vlib_main (vlib_main_t * volatile vm, unformat_input_t * input) @@ -1717,6 +1722,12 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input) goto done; } + if ((error = vlib_map_stat_segment_init (vm))) + { + clib_error_report (error); + goto done; + } + /* Register static nodes so that init functions may use them. */ vlib_register_all_static_nodes (vm); @@ -1736,6 +1747,25 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input) goto done; } + /* Direct call / weak reference, for vlib standalone use-cases */ + if ((error = vpe_api_init (vm))) + { + clib_error_report (error); + goto done; + } + + if ((error = vlibmemory_init (vm))) + { + clib_error_report (error); + goto done; + } + + if ((error = map_api_segment_init (vm))) + { + clib_error_report (error); + goto done; + } + /* See unix/main.c; most likely already set up */ if (vm->init_functions_called == 0) vm->init_functions_called = hash_create (0, /* value bytes */ 0);