summaryrefslogtreecommitdiffstats
path: root/src/plugins/acl
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/acl
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/acl')
-rw-r--r--src/plugins/acl/dataplane_node.c2
-rw-r--r--src/plugins/acl/sess_mgmt_node.c11
-rw-r--r--src/plugins/acl/session_inlines.h2
3 files changed, 8 insertions, 7 deletions
diff --git a/src/plugins/acl/dataplane_node.c b/src/plugins/acl/dataplane_node.c
index 77aaa0e4402..25fa4e9410b 100644
--- a/src/plugins/acl/dataplane_node.c
+++ b/src/plugins/acl/dataplane_node.c
@@ -418,7 +418,7 @@ acl_fa_inner_node_fn (vlib_main_t * vm,
{
trace_bitmap |= 0x80000000;
}
- ASSERT (f_sess_id.thread_index < vec_len (vlib_mains));
+ ASSERT (f_sess_id.thread_index < vlib_get_n_threads ());
b[0]->error = no_error_existing_session;
acl_check_needed = 0;
pkts_exist_session += 1;
diff --git a/src/plugins/acl/sess_mgmt_node.c b/src/plugins/acl/sess_mgmt_node.c
index ea969274052..3fc4f5e1982 100644
--- a/src/plugins/acl/sess_mgmt_node.c
+++ b/src/plugins/acl/sess_mgmt_node.c
@@ -361,8 +361,9 @@ send_one_worker_interrupt (vlib_main_t * vm, acl_main_t * am,
if (!pw->interrupt_is_pending)
{
pw->interrupt_is_pending = 1;
- vlib_node_set_interrupt_pending (vlib_mains[thread_index],
- acl_fa_worker_session_cleaner_process_node.index);
+ vlib_node_set_interrupt_pending (
+ vlib_get_main_by_index (thread_index),
+ acl_fa_worker_session_cleaner_process_node.index);
elog_acl_maybe_trace_X1 (am,
"send_one_worker_interrupt: send interrupt to worker %u",
"i4", ((u32) thread_index));
@@ -560,7 +561,7 @@ send_interrupts_to_workers (vlib_main_t * vm, acl_main_t * am)
{
int i;
/* Can't use vec_len(am->per_worker_data) since the threads might not have come up yet; */
- int n_threads = vec_len (vlib_mains);
+ int n_threads = vlib_get_n_threads ();
for (i = 0; i < n_threads; i++)
{
send_one_worker_interrupt (vm, am, i);
@@ -600,7 +601,7 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
*
* Also, while we are at it, calculate the earliest we need to wake up.
*/
- for (ti = 0; ti < vec_len (vlib_mains); ti++)
+ for (ti = 0; ti < vlib_get_n_threads (); ti++)
{
if (ti >= vec_len (am->per_worker_data))
{
@@ -746,7 +747,7 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
/* now wait till they all complete */
acl_log_info ("CLEANER mains len: %u per-worker len: %d",
- vec_len (vlib_mains),
+ vlib_get_n_threads (),
vec_len (am->per_worker_data));
vec_foreach (pw0, am->per_worker_data)
{
diff --git a/src/plugins/acl/session_inlines.h b/src/plugins/acl/session_inlines.h
index 7a8b7cecd5e..edc8a7057ee 100644
--- a/src/plugins/acl/session_inlines.h
+++ b/src/plugins/acl/session_inlines.h
@@ -466,7 +466,7 @@ acl_fa_can_add_session (acl_main_t * am, int is_input, u32 sw_if_index)
{
u64 curr_sess_count;
curr_sess_count = am->fa_session_total_adds - am->fa_session_total_dels;
- return (curr_sess_count + vec_len (vlib_mains) <
+ return (curr_sess_count + vlib_get_n_threads () <
am->fa_conn_table_max_entries);
}