diff options
author | Damjan Marion <damarion@cisco.com> | 2021-03-26 13:06:13 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2021-03-26 16:33:21 +0100 |
commit | 6ffb7c61899eb782416cbd2f117042a583f189f7 (patch) | |
tree | f6bd132d53b0aded6b235d13200dba2864afc7d8 /src/vlib/node.c | |
parent | 83f13e45bcd4b1018aa29bb6f32324c32f3a11a8 (diff) |
vlib: introduce vlib_get_main_by_index(), vlib_get_n_threads()
Type: improvement
Change-Id: If3da7d4338470912f37ff1794620418d928fb77f
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/node.c')
-rw-r--r-- | src/vlib/node.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/vlib/node.c b/src/vlib/node.c index 618baecfde0..3c96d9d2a04 100644 --- a/src/vlib/node.c +++ b/src/vlib/node.c @@ -613,9 +613,9 @@ vlib_node_get_nodes (vlib_main_t * vm, u32 max_threads, int include_stats, if (vec_len (stat_vms) == 0) { - for (i = 0; i < vec_len (vlib_mains); i++) + for (i = 0; i < vlib_get_n_threads (); i++) { - stat_vm = vlib_mains[i]; + stat_vm = vlib_get_main_by_index (i); if (stat_vm) vec_add1 (stat_vms, stat_vm); } @@ -837,10 +837,11 @@ vlib_node_set_march_variant (vlib_main_t *vm, u32 node_index, { n->function = fnr->function; - for (int i = 0; i < vec_len (vlib_mains); i++) + for (int i = 0; i < vlib_get_n_threads (); i++) { vlib_node_runtime_t *nrt; - nrt = vlib_node_get_runtime (vlib_mains[i], n->index); + nrt = + vlib_node_get_runtime (vlib_get_main_by_index (i), n->index); nrt->function = fnr->function; } return 0; |