diff options
author | Damjan Marion <damarion@cisco.com> | 2021-03-06 12:26:28 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2021-03-26 16:33:42 +0100 |
commit | fd8deb48c7ad63b47c5d7465ceefcadef0316f93 (patch) | |
tree | 3e5f319c7c57f526a6e571fd96847563bedf2706 /src/vlib/node.h | |
parent | f553a2cbbb8cca84ebf033335ebd2cd26dc19d69 (diff) |
vlib: split vlib_main_t into global and per-thread
Type: refactor
Change-Id: I8b273bc3bf16aa360f031f1b2692f766e5fc4613
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/node.h')
-rw-r--r-- | src/vlib/node.h | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/vlib/node.h b/src/vlib/node.h index aae5103908d..21a2022858f 100644 --- a/src/vlib/node.h +++ b/src/vlib/node.h @@ -166,25 +166,25 @@ typedef struct _vlib_node_registration } vlib_node_registration_t; #ifndef CLIB_MARCH_VARIANT -#define VLIB_REGISTER_NODE(x,...) \ - __VA_ARGS__ vlib_node_registration_t x; \ -static void __vlib_add_node_registration_##x (void) \ - __attribute__((__constructor__)) ; \ -static void __vlib_add_node_registration_##x (void) \ -{ \ - vlib_main_t * vm = vlib_get_main(); \ - x.next_registration = vm->node_main.node_registrations; \ - vm->node_main.node_registrations = &x; \ -} \ -static void __vlib_rm_node_registration_##x (void) \ - __attribute__((__destructor__)) ; \ -static void __vlib_rm_node_registration_##x (void) \ -{ \ - vlib_main_t * vm = vlib_get_main(); \ - VLIB_REMOVE_FROM_LINKED_LIST (vm->node_main.node_registrations, \ - &x, next_registration); \ -} \ -__VA_ARGS__ vlib_node_registration_t x +#define VLIB_REGISTER_NODE(x, ...) \ + __VA_ARGS__ vlib_node_registration_t x; \ + static void __vlib_add_node_registration_##x (void) \ + __attribute__ ((__constructor__)); \ + static void __vlib_add_node_registration_##x (void) \ + { \ + vlib_global_main_t *vgm = vlib_get_global_main (); \ + x.next_registration = vgm->node_registrations; \ + vgm->node_registrations = &x; \ + } \ + static void __vlib_rm_node_registration_##x (void) \ + __attribute__ ((__destructor__)); \ + static void __vlib_rm_node_registration_##x (void) \ + { \ + vlib_global_main_t *vgm = vlib_get_global_main (); \ + VLIB_REMOVE_FROM_LINKED_LIST (vgm->node_registrations, &x, \ + next_registration); \ + } \ + __VA_ARGS__ vlib_node_registration_t x #else #define VLIB_REGISTER_NODE(x,...) \ STATIC_ASSERT (sizeof(# __VA_ARGS__) != 7,"node " #x " must not be declared as static"); \ @@ -730,9 +730,6 @@ typedef struct /* Time of last node runtime stats clear. */ f64 time_last_runtime_stats_clear; - /* Node registrations added by constructors */ - vlib_node_registration_t *node_registrations; - /* Node index from error code */ u32 *node_by_error; |