summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44-ei/nat44_ei_ha.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-03-26 13:06:13 +0100
committerDamjan Marion <damarion@cisco.com>2021-03-26 16:33:21 +0100
commit6ffb7c61899eb782416cbd2f117042a583f189f7 (patch)
treef6bd132d53b0aded6b235d13200dba2864afc7d8 /src/plugins/nat/nat44-ei/nat44_ei_ha.c
parent83f13e45bcd4b1018aa29bb6f32324c32f3a11a8 (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/plugins/nat/nat44-ei/nat44_ei_ha.c')
-rw-r--r--src/plugins/nat/nat44-ei/nat44_ei_ha.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/nat/nat44-ei/nat44_ei_ha.c b/src/plugins/nat/nat44-ei/nat44_ei_ha.c
index ca99efcf8ca..3d634dc61f2 100644
--- a/src/plugins/nat/nat44-ei/nat44_ei_ha.c
+++ b/src/plugins/nat/nat44-ei/nat44_ei_ha.c
@@ -711,7 +711,7 @@ nat_ha_send (vlib_frame_t * f, vlib_buffer_t * b, u8 is_resync,
nat_ha_message_header_t *h;
ip4_header_t *ip;
udp_header_t *udp;
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main_by_index (thread_index);
ip = vlib_buffer_get_current (b);
udp = ip4_next_header (ip);
@@ -737,7 +737,7 @@ nat_ha_event_add (nat_ha_event_t * event, u8 do_flush, u32 thread_index,
nat44_ei_main_t *nm = &nat44_ei_main;
nat_ha_main_t *ha = &nat_ha_main;
nat_ha_per_thread_data_t *td = &ha->per_thread_data[thread_index];
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main_by_index (thread_index);
vlib_buffer_t *b = 0;
vlib_frame_t *f;
u32 bi = ~0, offset;
@@ -967,12 +967,12 @@ nat_ha_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
vlib_process_wait_for_event_or_clock (vm, 1.0);
event_type = vlib_process_get_events (vm, &event_data);
vec_reset_length (event_data);
- for (ti = 0; ti < vec_len (vlib_mains); ti++)
+ for (ti = 0; ti < vlib_get_n_threads (); ti++)
{
if (ti >= vec_len (ha->per_thread_data))
continue;
- vlib_node_set_interrupt_pending (vlib_mains[ti],
+ vlib_node_set_interrupt_pending (vlib_get_main_by_index (ti),
nat_ha_worker_node.index);
}
}