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/global_funcs.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/global_funcs.h')
-rw-r--r-- | src/vlib/global_funcs.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/vlib/global_funcs.h b/src/vlib/global_funcs.h index 63f8115a181..3c0fdb78364 100644 --- a/src/vlib/global_funcs.h +++ b/src/vlib/global_funcs.h @@ -22,14 +22,14 @@ always_inline u32 vlib_get_n_threads () { - return vec_len (vlib_mains); + return vec_len (vlib_global_main.vlib_mains); } always_inline vlib_main_t * vlib_get_main_by_index (u32 thread_index) { vlib_main_t *vm; - vm = vlib_mains[thread_index]; + vm = vlib_global_main.vlib_mains[thread_index]; ASSERT (vm); return vm; } @@ -46,6 +46,12 @@ vlib_get_first_main (void) return vlib_get_main_by_index (0); } +always_inline vlib_global_main_t * +vlib_get_global_main (void) +{ + return &vlib_global_main; +} + always_inline vlib_thread_main_t * vlib_get_thread_main () { @@ -55,8 +61,8 @@ vlib_get_thread_main () always_inline elog_main_t * vlib_get_elog_main () { - vlib_main_t *vm = vlib_get_first_main (); - return &vm->elog_main; + vlib_global_main_t *vgm = vlib_get_global_main (); + return &vgm->elog_main; } #endif /* included_vlib_global_funcs_h_ */ |