- out0 = format(out0, "\n\nPer-worker data:\n");
- for (wk = 0; wk < vec_len (am->per_worker_data); wk++) {
- acl_fa_per_worker_data_t *pw = &am->per_worker_data[wk];
- out0 = format(out0, "Worker #%d:\n", wk);
- out0 = format(out0, " Next expiry time: %lu\n", pw->next_expiry_time);
- out0 = format(out0, " Requeue until time: %lu\n", pw->requeue_until_time);
- out0 = format(out0, " Current time wait interval: %lu\n", pw->current_time_wait_interval);
- out0 = format(out0, " Count of deleted sessions: %lu\n", pw->cnt_deleted_sessions);
- out0 = format(out0, " Delete already deleted: %lu\n", pw->cnt_already_deleted_sessions);
- out0 = format(out0, " Session timers restarted: %lu\n", pw->cnt_session_timer_restarted);
- out0 = format(out0, " Swipe until this time: %lu\n", pw->swipe_end_time);
- out0 = format(out0, " sw_if_index serviced bitmap: %U\n", format_bitmap_hex, pw->serviced_sw_if_index_bitmap);
- out0 = format(out0, " pending clear intfc bitmap : %U\n", format_bitmap_hex, pw->pending_clear_sw_if_index_bitmap);
- out0 = format(out0, " clear in progress: %u\n", pw->clear_in_process);
- out0 = format(out0, " interrupt is pending: %d\n", pw->interrupt_is_pending);
- out0 = format(out0, " interrupt is needed: %d\n", pw->interrupt_is_needed);
- out0 = format(out0, " interrupt is unwanted: %d\n", pw->interrupt_is_unwanted);
+ }
+
+ if ((swi < vec_len(am->output_acl_vec_by_sw_if_index)) &&
+ (vec_len(am->output_acl_vec_by_sw_if_index[swi]) > 0)) {
+ vlib_cli_output(vm, " output acl(s): %U", format_vec32, am->output_acl_vec_by_sw_if_index[swi], "%d");
+ if (show_acl) {
+ vlib_cli_output(vm, "\n");
+ vec_foreach(pj, am->output_acl_vec_by_sw_if_index[swi]) {
+ acl_print_acl(vm, am, *pj);
+ }
+ vlib_cli_output(vm, "\n");
+ }
+ }
+ }
+
+}
+
+static clib_error_t *
+acl_show_aclplugin_interface_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ clib_error_t *error = 0;
+ acl_main_t *am = &acl_main;
+
+ u32 sw_if_index = ~0;
+ unformat (input, "sw_if_index %u", &sw_if_index);
+ int show_acl = unformat(input, "acl");
+
+ acl_plugin_show_interface(am, sw_if_index, show_acl);
+ return error;
+}
+
+static clib_error_t *
+acl_show_aclplugin_memory_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ clib_error_t *error = 0;
+ acl_main_t *am = &acl_main;
+
+ vlib_cli_output (vm, "ACL plugin main heap statistics:\n");
+ if (am->acl_mheap) {
+ vlib_cli_output (vm, " %U\n", format_mheap, am->acl_mheap, 1);
+ } else {
+ vlib_cli_output (vm, " Not initialized\n");
+ }
+ vlib_cli_output (vm, "ACL hash lookup support heap statistics:\n");
+ if (am->hash_lookup_mheap) {
+ vlib_cli_output (vm, " %U\n", format_mheap, am->hash_lookup_mheap, 1);
+ } else {
+ vlib_cli_output (vm, " Not initialized\n");
+ }
+ return error;
+}
+
+static void
+acl_plugin_show_sessions(acl_main_t *am,
+ u32 show_session_thread_id, u32 show_session_session_index)
+{
+ vlib_main_t *vm = am->vlib_main;
+ u16 wk;
+ vnet_interface_main_t *im = &am->vnet_main->interface_main;
+ vnet_sw_interface_t *swif;
+
+ {
+ u64 n_adds = am->fa_session_total_adds;
+ u64 n_dels = am->fa_session_total_dels;
+ vlib_cli_output(vm, "Sessions total: add %lu - del %lu = %lu", n_adds, n_dels, n_adds - n_dels);
+ }
+ vlib_cli_output(vm, "\n\nPer-thread data:");
+ for (wk = 0; wk < vec_len (am->per_worker_data); wk++) {
+ acl_fa_per_worker_data_t *pw = &am->per_worker_data[wk];
+ vlib_cli_output(vm, "Thread #%d:", wk);
+ if (show_session_thread_id == wk && show_session_session_index < pool_len(pw->fa_sessions_pool)) {
+ vlib_cli_output(vm, " session index %u:", show_session_session_index);
+ fa_session_t *sess = pw->fa_sessions_pool + show_session_session_index;
+ u64 *m = (u64 *)&sess->info;
+ vlib_cli_output(vm, " info: %016llx %016llx %016llx %016llx %016llx %016llx", m[0], m[1], m[2], m[3], m[4], m[5]);
+ vlib_cli_output(vm, " sw_if_index: %u", sess->sw_if_index);
+ vlib_cli_output(vm, " tcp_flags_seen: %x", sess->tcp_flags_seen.as_u16);
+ vlib_cli_output(vm, " last active time: %lu", sess->last_active_time);
+ vlib_cli_output(vm, " thread index: %u", sess->thread_index);
+ vlib_cli_output(vm, " link enqueue time: %lu", sess->link_enqueue_time);
+ vlib_cli_output(vm, " link next index: %u", sess->link_next_idx);
+ vlib_cli_output(vm, " link prev index: %u", sess->link_prev_idx);
+ vlib_cli_output(vm, " link list id: %u", sess->link_list_id);
+ }
+ vlib_cli_output(vm, " connection add/del stats:", wk);
+ pool_foreach (swif, im->sw_interfaces,
+ ({
+ u32 sw_if_index = swif->sw_if_index;
+ u64 n_adds = sw_if_index < vec_len(pw->fa_session_adds_by_sw_if_index) ? pw->fa_session_adds_by_sw_if_index[sw_if_index] : 0;
+ u64 n_dels = sw_if_index < vec_len(pw->fa_session_dels_by_sw_if_index) ? pw->fa_session_dels_by_sw_if_index[sw_if_index] : 0;
+ vlib_cli_output(vm, " sw_if_index %d: add %lu - del %lu = %lu", sw_if_index, n_adds, n_dels, n_adds - n_dels);
+ }));
+
+ vlib_cli_output(vm, " connection timeout type lists:", wk);
+ u8 tt = 0;
+ for(tt = 0; tt < ACL_N_TIMEOUTS; tt++) {
+ u32 head_session_index = pw->fa_conn_list_head[tt];
+ vlib_cli_output(vm, " fa_conn_list_head[%d]: %d", tt, head_session_index);
+ if (~0 != head_session_index) {
+ fa_session_t *sess = pw->fa_sessions_pool + head_session_index;
+ vlib_cli_output(vm, " last active time: %lu", sess->last_active_time);
+ vlib_cli_output(vm, " link enqueue time: %lu", sess->link_enqueue_time);