aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/session_cli.c42
-rw-r--r--src/vnet/session/session_node.c30
2 files changed, 51 insertions, 21 deletions
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index 4d4141da375..aba1c610e18 100644
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -439,6 +439,39 @@ session_cli_show_session_filter (vlib_main_t * vm, u32 thread_index,
count);
}
+void
+session_cli_show_events_thread (vlib_main_t * vm, u32 thread_index)
+{
+ session_worker_t *wrk;
+
+ wrk = session_main_get_worker_if_valid (thread_index);
+ if (!wrk)
+ {
+ vlib_cli_output (vm, "invalid thread index %u", thread_index);
+ return;
+ }
+
+ vlib_cli_output (vm, "Thread %d:\n", thread_index);
+ vlib_cli_output (vm, " evt elements alloc: %u",
+ pool_elts (wrk->event_elts));
+ vlib_cli_output (vm, " ctrl evt elt data alloc: %d",
+ pool_elts (wrk->ctrl_evts_data));
+}
+
+static void
+session_cli_show_events (vlib_main_t * vm, u32 thread_index)
+{
+ session_main_t *smm = &session_main;
+ if (!thread_index)
+ {
+ session_cli_show_events_thread (vm, thread_index);
+ return;
+ }
+
+ for (thread_index = 0; thread_index < vec_len (smm->wrk); thread_index++)
+ session_cli_show_events_thread (vm, thread_index);
+}
+
static void
session_cli_print_transport_protos (vlib_main_t * vm)
{
@@ -469,6 +502,7 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
app_worker_t *app_wrk;
u32 transport_index;
const u8 *app_name;
+ u8 do_events = 0;
int verbose = 0;
session_t *s;
@@ -559,6 +593,8 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
session_cli_print_session_states (vm);
goto done;
}
+ else if (unformat (line_input, "events"))
+ do_events = 1;
else
{
error = clib_error_return (0, "unknown input `%U'",
@@ -607,6 +643,12 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
goto done;
}
+ if (do_events)
+ {
+ session_cli_show_events (vm, thread_index);
+ goto done;
+ }
+
if (do_filter)
{
if (end < start)
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index bc22cc0a98c..c3570791898 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -1257,8 +1257,8 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 thread_index = vm->thread_index, n_to_dequeue;
session_worker_t *wrk = &smm->wrk[thread_index];
session_evt_elt_t *elt, *ctrl_he, *new_he, *old_he;
+ clib_llist_index_t ei, next_ei, old_ti;
svm_msg_q_msg_t _msg, *msg = &_msg;
- clib_llist_index_t old_ti;
int i, n_tx_packets = 0;
session_event_t *evt;
svm_msg_q_t *mq;
@@ -1314,24 +1314,14 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
old_he = pool_elt_at_index (wrk->event_elts, wrk->old_head);
old_ti = clib_llist_prev_index (old_he, evt_list);
- /* *INDENT-OFF* */
- clib_llist_foreach_safe (wrk->event_elts, evt_list, new_he, elt, ({
- session_evt_type_t et;
-
- et = elt->evt.event_type;
- clib_llist_remove (wrk->event_elts, evt_list, elt);
-
- /* Postpone tx events if we can't handle them this dispatch cycle */
- if (n_tx_packets >= VLIB_FRAME_SIZE
- && (et == SESSION_IO_EVT_TX || et == SESSION_IO_EVT_TX_FLUSH))
- {
- clib_llist_add (wrk->event_elts, evt_list, elt, new_he);
- continue;
- }
-
- session_event_dispatch_io (wrk, node, elt, thread_index, &n_tx_packets);
- }));
- /* *INDENT-ON* */
+ ei = clib_llist_next_index (new_he, evt_list);
+ while (ei != wrk->new_head && n_tx_packets < VLIB_FRAME_SIZE)
+ {
+ elt = pool_elt_at_index (wrk->event_elts, ei);
+ ei = clib_llist_next_index (elt, evt_list);
+ clib_llist_remove (wrk->event_elts, evt_list, elt);
+ session_event_dispatch_io (wrk, node, elt, thread_index, &n_tx_packets);
+ }
/*
* Handle the old io events, if we had any prior to processing the new ones
@@ -1339,8 +1329,6 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
if (old_ti != wrk->old_head)
{
- clib_llist_index_t ei, next_ei;
-
old_he = pool_elt_at_index (wrk->event_elts, wrk->old_head);
ei = clib_llist_next_index (old_he, evt_list);