X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnat%2Fnat44%2Finlines.h;h=d7c355490cc79c0c4f1caf16a313b6e5e2a6cc5e;hb=edf777272b211de3d54f5dc7b211ee84cdb31373;hp=a7bb469b464bfcfa0474439c59cd95090499f744;hpb=b71ef86c7429e81921997e54a526bf666a2e4089;p=vpp.git diff --git a/src/plugins/nat/nat44/inlines.h b/src/plugins/nat/nat44/inlines.h index a7bb469b464..d7c355490cc 100644 --- a/src/plugins/nat/nat44/inlines.h +++ b/src/plugins/nat/nat44/inlines.h @@ -108,6 +108,43 @@ nat44_session_try_cleanup (ip4_address_t * addr, thread_index, now); } +static_always_inline void +nat44_force_session_cleanup (void) +{ + snat_user_t *u = 0; + + snat_main_t *sm = &snat_main; + snat_main_per_thread_data_t *tsm; + + vlib_main_t *vm = vlib_get_main (); + f64 now = vlib_time_now (vm); + + // TODO: consider own timeouts + + if (sm->num_workers > 1) + { + /* *INDENT-OFF* */ + vec_foreach (tsm, sm->per_thread_data) + { + pool_foreach (u, tsm->users, + ({ + nat44_user_try_cleanup (u, tsm->thread_index, now); + })); + } + /* *INDENT-ON* */ + } + else + { + tsm = vec_elt_at_index (sm->per_thread_data, sm->num_workers); + /* *INDENT-OFF* */ + pool_foreach (u, tsm->users, + ({ + nat44_user_try_cleanup (u, tsm->thread_index, now); + })); + /* *INDENT-ON* */ + } +} + #endif /* included_nat44_inlines_h__ */ /*