summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_node.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-05-16 19:28:24 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2018-05-18 07:49:59 +0000
commitfd542f1085d3a06066168c2d38e7f328b5b26ee3 (patch)
tree6509d0115ff79f28175a747eef1b18ba6d807ce0 /src/vnet/session/session_node.c
parenta23b615aa4b7bf1eee6ad099f41c3c8f1c85d723 (diff)
session: add session process node
Add a session process node that handles main thread tx and retransmit in order to avoid having a polling input node. Change-Id: I3357e987c023a84b533b32793e37ab4204420f64 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session_node.c')
-rw-r--r--src/vnet/session/session_node.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 07cca6d46e7..46fc4dc8745 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -869,6 +869,51 @@ session_queue_exit (vlib_main_t * vm)
VLIB_MAIN_LOOP_EXIT_FUNCTION (session_queue_exit);
+static uword
+session_queue_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
+ vlib_frame_t * f)
+{
+ f64 now, timeout = 1.0;
+ uword *event_data = 0;
+ uword event_type;
+
+ while (1)
+ {
+ vlib_process_wait_for_event_or_clock (vm, timeout);
+ now = vlib_time_now (vm);
+ event_type = vlib_process_get_events (vm, (uword **) & event_data);
+
+ switch (event_type)
+ {
+ case SESSION_Q_PROCESS_FLUSH_FRAMES:
+ /* Flush the frames by updating all transports times */
+ transport_update_time (now, 0);
+ break;
+ case SESSION_Q_PROCESS_STOP:
+ timeout = 100000.0;
+ break;
+ case ~0:
+ /* Timed out. Update time for all transports to trigger all
+ * outstanding retransmits. */
+ transport_update_time (now, 0);
+ break;
+ }
+ vec_reset_length (event_data);
+ }
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_REGISTER_NODE (session_queue_process_node) =
+{
+ .function = session_queue_process,
+ .type = VLIB_NODE_TYPE_PROCESS,
+ .name = "session-queue-process",
+ .state = VLIB_NODE_STATE_DISABLED,
+};
+/* *INDENT-ON* */
+
+
/*
* fd.io coding-style-patch-verification: ON
*