FD.io VPP  v21.01.1
Vector Packet Processing
init.h File Reference
+ Include dependency graph for init.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vlib_config_function_runtime_t
 

Macros

#define VLIB_REMOVE_FROM_LINKED_LIST(first, p, next)
 
#define VLIB_INIT_FUNCTION_SYMBOL(x)   _VLIB_INIT_FUNCTION_SYMBOL(x, init)
 
#define VLIB_MAIN_LOOP_ENTER_FUNCTION_SYMBOL(x)   _VLIB_INIT_FUNCTION_SYMBOL(x, main_loop_enter)
 
#define VLIB_MAIN_LOOP_EXIT_FUNCTION_SYMBOL(x)   _VLIB_INIT_FUNCTION_SYMBOL(x, main_loop_exit)
 
#define VLIB_CONFIG_FUNCTION_SYMBOL(x)   _VLIB_INIT_FUNCTION_SYMBOL(x, config)
 
#define VLIB_DECLARE_INIT_FUNCTION(x, tag)
 
#define VLIB_INIT_FUNCTION(x)   VLIB_DECLARE_INIT_FUNCTION(x,init)
 
#define VLIB_WORKER_INIT_FUNCTION(x)   VLIB_DECLARE_INIT_FUNCTION(x,worker_init)
 
#define VLIB_MAIN_LOOP_ENTER_FUNCTION(x)   VLIB_DECLARE_INIT_FUNCTION(x,main_loop_enter)
 
#define VLIB_MAIN_LOOP_EXIT_FUNCTION(x)   VLIB_DECLARE_INIT_FUNCTION(x,main_loop_exit)
 
#define VLIB_CONFIG_FUNCTION(x, n, ...)
 
#define VLIB_EARLY_CONFIG_FUNCTION(x, n, ...)
 
#define vlib_call_init_function(vm, x)
 
#define vlib_mark_init_function_complete(vm, x)
 
#define vlib_call_post_graph_init_function(vm, x)
 
#define vlib_call_config_function(vm, x)
 
#define vlib_call_main_loop_enter_function(vm, x)
 
#define foreach_vlib_module_reference
 
#define VLIB_INITS(...)   (char*[]) { __VA_ARGS__, 0}
 

Typedefs

typedef clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
 
typedef clib_error_t *() vlib_config_function_t(struct vlib_main_t *vm, unformat_input_t *input)
 
typedef struct vlib_config_function_runtime_t vlib_config_function_runtime_t
 

Functions

clib_error_tvlib_call_all_init_functions (struct vlib_main_t *vm)
 
clib_error_tvlib_call_all_config_functions (struct vlib_main_t *vm, unformat_input_t *input, int is_early)
 
clib_error_tvlib_call_all_main_loop_enter_functions (struct vlib_main_t *vm)
 
clib_error_tvlib_call_all_main_loop_exit_functions (struct vlib_main_t *vm)
 
clib_error_tvlib_call_init_exit_functions (struct vlib_main_t *vm, _vlib_init_function_list_elt_t **headp, int call_once)
 
clib_error_tvlib_call_init_exit_functions_no_sort (struct vlib_main_t *vm, _vlib_init_function_list_elt_t **headp, int call_once)
 
clib_error_tvlib_sort_init_exit_functions (_vlib_init_function_list_elt_t **)
 Topological sorter for init function chains. More...
 

Macro Definition Documentation

◆ foreach_vlib_module_reference

#define foreach_vlib_module_reference
Value:
_ (node_cli) \
_ (trace_cli)

Definition at line 349 of file init.h.

◆ vlib_call_config_function

#define vlib_call_config_function (   vm,
 
)
Value:
({ \
vlib_config_function_runtime_t * _r; \
clib_error_t * _error = 0; \
\
if (! hash_get (vm->init_functions_called, _r->function)) \
{ \
hash_set1 (vm->init_functions_called, _r->function); \
_error = _r->function (vm, &_r->input); \
} \
_error; \
})
#define VLIB_CONFIG_FUNCTION_SYMBOL(x)
Definition: init.h:116
vlib_main_t * vm
Definition: in2out_ed.c:1580
#define hash_get(h, key)
Definition: hash.h:249
uword * init_functions_called
Definition: main.h:247

Definition at line 304 of file init.h.

◆ vlib_call_init_function

#define vlib_call_init_function (   vm,
 
)
Value:
({ \
vlib_init_function_t * _f = VLIB_INIT_FUNCTION_SYMBOL (x); \
clib_error_t * _error = 0; \
{ \
hash_set1 (vm->init_functions_called, _f); \
_error = _f (vm); \
} \
_error; \
})
vlib_main_t * vm
Definition: in2out_ed.c:1580
#define hash_get(h, key)
Definition: hash.h:249
uword * init_functions_called
Definition: main.h:247
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
#define VLIB_INIT_FUNCTION_SYMBOL(x)
Definition: init.h:110

Definition at line 270 of file init.h.

◆ vlib_call_main_loop_enter_function

#define vlib_call_main_loop_enter_function (   vm,
 
)
Value:
({ \
vlib_init_function_t * _f = VLIB_MAIN_LOOP_ENTER_FUNCTION_SYMBOL (x); \
clib_error_t * _error = 0; \
{ \
hash_set1 (vm->init_functions_called, _f); \
_error = _f (vm); \
} \
_error; \
})
#define VLIB_MAIN_LOOP_ENTER_FUNCTION_SYMBOL(x)
Definition: init.h:112
vlib_main_t * vm
Definition: in2out_ed.c:1580
#define hash_get(h, key)
Definition: hash.h:249
uword * init_functions_called
Definition: main.h:247
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51

Definition at line 320 of file init.h.

◆ vlib_call_post_graph_init_function

#define vlib_call_post_graph_init_function (   vm,
 
)
Value:
({ \
extern vlib_init_function_t * VLIB_POST_GRAPH_INIT_FUNCTION_SYMBOL (x); \
vlib_init_function_t * _f = VLIB_POST_GRAPH_INIT_FUNCTION_SYMBOL (x); \
clib_error_t * _error = 0; \
{ \
hash_set1 (vm->init_functions_called, _f); \
_error = _f (vm); \
} \
_error; \
})
vlib_main_t * vm
Definition: in2out_ed.c:1580
#define hash_get(h, key)
Definition: hash.h:249
uword * init_functions_called
Definition: main.h:247
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51

Definition at line 291 of file init.h.

◆ VLIB_CONFIG_FUNCTION

#define VLIB_CONFIG_FUNCTION (   x,
  n,
  ... 
)
Value:
static void __vlib_add_config_function_##x (void) \
__attribute__((__constructor__)) ; \
static void __vlib_add_config_function_##x (void) \
{ \
vlib_main_t * vm = vlib_get_main(); \
VLIB_CONFIG_FUNCTION_SYMBOL(x).next_registration \
= vm->config_function_registrations; \
vm->config_function_registrations \
} \
static void __vlib_rm_config_function_##x (void) \
__attribute__((__destructor__)) ; \
static void __vlib_rm_config_function_##x (void) \
{ \
vlib_main_t * vm = vlib_get_main(); \
vlib_config_function_runtime_t *p = \
VLIB_REMOVE_FROM_LINKED_LIST \
(vm->config_function_registrations, p, next_registration);\
} \
= { \
.name = n, \
.function = x, \
.is_early = 0, \
}
#define VLIB_CONFIG_FUNCTION_SYMBOL(x)
Definition: init.h:116
vlib_main_t * vm
Definition: in2out_ed.c:1580
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23

Definition at line 182 of file init.h.

◆ VLIB_CONFIG_FUNCTION_SYMBOL

#define VLIB_CONFIG_FUNCTION_SYMBOL (   x)    _VLIB_INIT_FUNCTION_SYMBOL(x, config)

Definition at line 116 of file init.h.

◆ VLIB_DECLARE_INIT_FUNCTION

#define VLIB_DECLARE_INIT_FUNCTION (   x,
  tag 
)
Value:
vlib_init_function_t * _VLIB_INIT_FUNCTION_SYMBOL (x, tag) = x; \
static void __vlib_add_##tag##_function_##x (void) \
__attribute__((__constructor__)) ; \
static _vlib_init_function_list_elt_t _vlib_init_function_##tag##_##x; \
static void __vlib_add_##tag##_function_##x (void) \
{ \
vlib_main_t * vm = vlib_get_main(); \
_vlib_init_function_##tag##_##x.next_init_function \
= vm->tag##_function_registrations; \
vm->tag##_function_registrations = &_vlib_init_function_##tag##_##x; \
_vlib_init_function_##tag##_##x.f = &x; \
_vlib_init_function_##tag##_##x.name = #x; \
} \
static void __vlib_rm_##tag##_function_##x (void) \
__attribute__((__destructor__)) ; \
static void __vlib_rm_##tag##_function_##x (void) \
{ \
vlib_main_t * vm = vlib_get_main(); \
_vlib_init_function_list_elt_t *this, *prev; \
this = vm->tag##_function_registrations; \
if (this == 0) \
return; \
if (this->f == &x) \
{ \
vm->tag##_function_registrations = this->next_init_function; \
return; \
} \
prev = this; \
this = this->next_init_function; \
while (this) \
{ \
if (this->f == &x) \
{ \
prev->next_init_function = \
this->next_init_function; \
return; \
} \
prev = this; \
this = this->next_init_function; \
} \
} \
static _vlib_init_function_list_elt_t _vlib_init_function_##tag##_##x
vlib_main_t * vm
Definition: in2out_ed.c:1580
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23

Definition at line 123 of file init.h.

◆ VLIB_EARLY_CONFIG_FUNCTION

#define VLIB_EARLY_CONFIG_FUNCTION (   x,
  n,
  ... 
)
Value:
static void __vlib_add_config_function_##x (void) \
__attribute__((__constructor__)) ; \
static void __vlib_add_config_function_##x (void) \
{ \
vlib_main_t * vm = vlib_get_main(); \
VLIB_CONFIG_FUNCTION_SYMBOL(x).next_registration \
= vm->config_function_registrations; \
vm->config_function_registrations \
} \
static void __vlib_rm_config_function_##x (void) \
__attribute__((__destructor__)) ; \
static void __vlib_rm_config_function_##x (void) \
{ \
vlib_main_t * vm = vlib_get_main(); \
vlib_config_function_runtime_t *p = \
VLIB_REMOVE_FROM_LINKED_LIST \
(vm->config_function_registrations, p, next_registration);\
} \
= { \
.name = n, \
.function = x, \
.is_early = 1, \
}
#define VLIB_CONFIG_FUNCTION_SYMBOL(x)
Definition: init.h:116
vlib_main_t * vm
Definition: in2out_ed.c:1580
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23

Definition at line 226 of file init.h.

◆ VLIB_INIT_FUNCTION

#define VLIB_INIT_FUNCTION (   x)    VLIB_DECLARE_INIT_FUNCTION(x,init)

Definition at line 173 of file init.h.

◆ VLIB_INIT_FUNCTION_SYMBOL

#define VLIB_INIT_FUNCTION_SYMBOL (   x)    _VLIB_INIT_FUNCTION_SYMBOL(x, init)

Definition at line 110 of file init.h.

◆ VLIB_INITS

#define VLIB_INITS (   ...)    (char*[]) { __VA_ARGS__, 0}

Definition at line 357 of file init.h.

◆ VLIB_MAIN_LOOP_ENTER_FUNCTION

#define VLIB_MAIN_LOOP_ENTER_FUNCTION (   x)    VLIB_DECLARE_INIT_FUNCTION(x,main_loop_enter)

Definition at line 176 of file init.h.

◆ VLIB_MAIN_LOOP_ENTER_FUNCTION_SYMBOL

#define VLIB_MAIN_LOOP_ENTER_FUNCTION_SYMBOL (   x)    _VLIB_INIT_FUNCTION_SYMBOL(x, main_loop_enter)

Definition at line 112 of file init.h.

◆ VLIB_MAIN_LOOP_EXIT_FUNCTION

#define VLIB_MAIN_LOOP_EXIT_FUNCTION (   x)    VLIB_DECLARE_INIT_FUNCTION(x,main_loop_exit)

Definition at line 178 of file init.h.

◆ VLIB_MAIN_LOOP_EXIT_FUNCTION_SYMBOL

#define VLIB_MAIN_LOOP_EXIT_FUNCTION_SYMBOL (   x)    _VLIB_INIT_FUNCTION_SYMBOL(x, main_loop_exit)

Definition at line 114 of file init.h.

◆ vlib_mark_init_function_complete

#define vlib_mark_init_function_complete (   vm,
 
)
Value:
({ \
vlib_init_function_t * _f = VLIB_INIT_FUNCTION_SYMBOL (x); \
hash_set1 (vm->init_functions_called, _f); \
})
vlib_main_t * vm
Definition: in2out_ed.c:1580
uword * init_functions_called
Definition: main.h:247
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
#define VLIB_INIT_FUNCTION_SYMBOL(x)
Definition: init.h:110

Definition at line 284 of file init.h.

◆ VLIB_REMOVE_FROM_LINKED_LIST

#define VLIB_REMOVE_FROM_LINKED_LIST (   first,
  p,
  next 
)
Value:
{ \
ASSERT (first); \
if (first == p) \
first = (p)->next; \
else \
{ \
__typeof__ (p) current = first; \
while (current->next) \
{ \
if (current->next == p) \
{ \
current->next = current->next->next; \
break; \
} \
current = current->next; \
} \
ASSERT (current); \
} \
}
i32 next
Definition: heap.h:78
static heap_elt_t * first(heap_header_t *h)
Definition: heap.c:59

Definition at line 86 of file init.h.

◆ VLIB_WORKER_INIT_FUNCTION

#define VLIB_WORKER_INIT_FUNCTION (   x)    VLIB_DECLARE_INIT_FUNCTION(x,worker_init)

Definition at line 174 of file init.h.

Typedef Documentation

◆ vlib_config_function_runtime_t

◆ vlib_config_function_t

typedef clib_error_t*() vlib_config_function_t(struct vlib_main_t *vm, unformat_input_t *input)

Definition at line 65 of file init.h.

◆ vlib_init_function_t

typedef clib_error_t*() vlib_init_function_t(struct vlib_main_t *vm)

Definition at line 51 of file init.h.

Function Documentation

◆ vlib_call_all_config_functions()

clib_error_t* vlib_call_all_config_functions ( struct vlib_main_t vm,
unformat_input_t input,
int  is_early 
)

Definition at line 405 of file init.c.

+ Here is the caller graph for this function:

◆ vlib_call_all_init_functions()

clib_error_t* vlib_call_all_init_functions ( struct vlib_main_t vm)

Definition at line 378 of file init.c.

+ Here is the caller graph for this function:

◆ vlib_call_all_main_loop_enter_functions()

clib_error_t* vlib_call_all_main_loop_enter_functions ( struct vlib_main_t vm)

Definition at line 391 of file init.c.

◆ vlib_call_all_main_loop_exit_functions()

clib_error_t* vlib_call_all_main_loop_exit_functions ( struct vlib_main_t vm)

Definition at line 398 of file init.c.

◆ vlib_call_init_exit_functions()

clib_error_t* vlib_call_init_exit_functions ( struct vlib_main_t vm,
_vlib_init_function_list_elt_t **  headp,
int  call_once 
)

Definition at line 360 of file init.c.

+ Here is the caller graph for this function:

◆ vlib_call_init_exit_functions_no_sort()

clib_error_t* vlib_call_init_exit_functions_no_sort ( struct vlib_main_t vm,
_vlib_init_function_list_elt_t **  headp,
int  call_once 
)

Definition at line 369 of file init.c.

+ Here is the caller graph for this function:

◆ vlib_sort_init_exit_functions()

clib_error_t* vlib_sort_init_exit_functions ( _vlib_init_function_list_elt_t **  head)

Topological sorter for init function chains.

Parameters
head[in/out] address of the listhead to be sorted
Returns
0 on success, otherwise a clib_error_t *.

Definition at line 76 of file init.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: