FD.io VPP  v18.07-34-g55fbdb9
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 foreach_vlib_module_reference
 

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 *head, int call_once)
 

Macro Definition Documentation

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

Definition at line 289 of file init.h.

#define vlib_call_config_function (   vm,
 
)
Value:
({ \
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:112
#define hash_get(h, key)
Definition: hash.h:249
uword * init_functions_called
Definition: main.h:173
vlib_main_t * vm
Definition: buffer.c:294
#define hash_set1(h, key)
Definition: hash.h:258
struct vlib_config_function_runtime_t vlib_config_function_runtime_t

Definition at line 261 of file init.h.

#define vlib_call_init_function (   vm,
 
)
Value:
({ \
clib_error_t * _error = 0; \
{ \
_error = _f (vm); \
} \
_error; \
})
#define hash_get(h, key)
Definition: hash.h:249
uword * init_functions_called
Definition: main.h:173
vlib_main_t * vm
Definition: buffer.c:294
clib_error_t *( vlib_init_function_t)(struct vlib_main_t *vm)
Definition: init.h:51
#define hash_set1(h, key)
Definition: hash.h:258
#define VLIB_INIT_FUNCTION_SYMBOL(x)
Definition: init.h:106

Definition at line 227 of file init.h.

#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; \
{ \
_error = _f (vm); \
} \
_error; \
})
#define hash_get(h, key)
Definition: hash.h:249
uword * init_functions_called
Definition: main.h:173
vlib_main_t * vm
Definition: buffer.c:294
clib_error_t *( vlib_init_function_t)(struct vlib_main_t *vm)
Definition: init.h:51
#define hash_set1(h, key)
Definition: hash.h:258

Definition at line 248 of file init.h.

#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_CONFIG_FUNCTION_SYMBOL(x).next_registration \
= vm->config_function_registrations; \
} \
static void __vlib_rm_config_function_##x (void) \
__attribute__((__destructor__)) ; \
static void __vlib_rm_config_function_##x (void) \
{ \
(vm->config_function_registrations, p, next_registration);\
} \
= { \
.name = n, \
.function = x, \
.is_early = 0, \
}
#define VLIB_CONFIG_FUNCTION_SYMBOL(x)
Definition: init.h:112
#define VLIB_REMOVE_FROM_LINKED_LIST(first, p, next)
Definition: init.h:82
struct vlib_main_t vlib_main_t
vlib_main_t * vm
Definition: buffer.c:294
struct vlib_config_function_runtime_t vlib_config_function_runtime_t
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23
vlib_config_function_runtime_t * config_function_registrations
Definition: main.h:184

Definition at line 164 of file init.h.

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

Definition at line 112 of file init.h.

#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 void __vlib_add_##tag##_function_##x (void) \
{ \
static _vlib_init_function_list_elt_t _vlib_init_function; \
_vlib_init_function.next_init_function \
= vm->tag##_function_registrations; \
vm->tag##_function_registrations = &_vlib_init_function; \
_vlib_init_function.f = &x; \
} \
static void __vlib_rm_##tag##_function_##x (void) \
__attribute__((__destructor__)) ; \
static void __vlib_rm_##tag##_function_##x (void) \
{ \
_vlib_init_function_list_elt_t *next; \
if (vm->tag##_function_registrations->f == &x) \
{ \
vm->tag##_function_registrations = \
vm->tag##_function_registrations->next_init_function; \
return; \
} \
next = vm->tag##_function_registrations; \
while (next->next_init_function) \
{ \
if (next->next_init_function->f == &x) \
{ \
next->next_init_function = \
next->next_init_function->next_init_function; \
return; \
} \
next = next->next_init_function; \
} \
}
struct vlib_main_t vlib_main_t
vlib_main_t * vm
Definition: buffer.c:294
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 118 of file init.h.

#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_CONFIG_FUNCTION_SYMBOL(x).next_registration \
= vm->config_function_registrations; \
} \
static void __vlib_rm_config_function_##x (void) \
__attribute__((__destructor__)) ; \
static void __vlib_rm_config_function_##x (void) \
{ \
(vm->config_function_registrations, p, next_registration);\
} \
= { \
.name = n, \
.function = x, \
.is_early = 1, \
}
#define VLIB_CONFIG_FUNCTION_SYMBOL(x)
Definition: init.h:112
#define VLIB_REMOVE_FROM_LINKED_LIST(first, p, next)
Definition: init.h:82
struct vlib_main_t vlib_main_t
vlib_main_t * vm
Definition: buffer.c:294
struct vlib_config_function_runtime_t vlib_config_function_runtime_t
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23
vlib_config_function_runtime_t * config_function_registrations
Definition: main.h:184

Definition at line 195 of file init.h.

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

Definition at line 156 of file init.h.

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

Definition at line 106 of file init.h.

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

Definition at line 159 of file init.h.

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

Definition at line 108 of file init.h.

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

Definition at line 161 of file init.h.

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

Definition at line 110 of file init.h.

#define vlib_mark_init_function_complete (   vm,
 
)
Value:
({ \
})
uword * init_functions_called
Definition: main.h:173
vlib_main_t * vm
Definition: buffer.c:294
clib_error_t *( vlib_init_function_t)(struct vlib_main_t *vm)
Definition: init.h:51
#define hash_set1(h, key)
Definition: hash.h:258
#define VLIB_INIT_FUNCTION_SYMBOL(x)
Definition: init.h:106

Definition at line 241 of file init.h.

#define VLIB_REMOVE_FROM_LINKED_LIST (   first,
  p,
  next 
)
Value:
{ \
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
#define ASSERT(truth)

Definition at line 82 of file init.h.

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

Definition at line 157 of file init.h.

Typedef Documentation

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

Definition at line 61 of file init.h.

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

Definition at line 51 of file init.h.

Function Documentation

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

Definition at line 94 of file init.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* vlib_call_all_init_functions ( struct vlib_main_t vm)

Definition at line 67 of file init.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* vlib_call_all_main_loop_enter_functions ( struct vlib_main_t vm)

Definition at line 80 of file init.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* vlib_call_all_main_loop_exit_functions ( struct vlib_main_t vm)

Definition at line 87 of file init.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 43 of file init.c.

+ Here is the caller graph for this function: