summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-03-13 04:44:51 +0000
committerFlorin Coras <florin.coras@gmail.com>2020-03-25 18:56:27 +0000
commit07063b8ea39b05d5d7bb00ad2a2363b11792c571 (patch)
tree2df1cd5b5df869c729f534f093dea664eb059f3a /src/vnet/session/session.c
parent4e783b9c901cf90e58c3f921bb17170ab23e540a (diff)
session: api to add new transport types
Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: If4dee6dba1ea942daa921d566b35cdecdda680ee
Diffstat (limited to 'src/vnet/session/session.c')
-rw-r--r--src/vnet/session/session.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index bd69f752de4..fa4cd85e5e4 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1469,12 +1469,6 @@ static session_fifo_rx_fn *session_tx_fns[TRANSPORT_TX_N_FNS] = {
};
/* *INDENT-ON* */
-/**
- * Initialize session layer for given transport proto and ip version
- *
- * Allocates per session type (transport proto + ip version) data structures
- * and adds arc from session queue node to session type output node.
- */
void
session_register_transport (transport_proto_t transport_proto,
const transport_proto_vft_t * vft, u8 is_ip4,
@@ -1505,6 +1499,24 @@ session_register_transport (transport_proto_t transport_proto,
session_tx_fns[vft->transport_options.tx_type];
}
+transport_proto_t
+session_add_transport_proto (void)
+{
+ session_main_t *smm = &session_main;
+ session_worker_t *wrk;
+ u32 thread;
+
+ smm->last_transport_proto_type += 1;
+
+ for (thread = 0; thread < vec_len (smm->wrk); thread++)
+ {
+ wrk = session_main_get_worker (thread);
+ vec_validate (wrk->session_to_enqueue, smm->last_transport_proto_type);
+ }
+
+ return smm->last_transport_proto_type;
+}
+
transport_connection_t *
session_get_transport (session_t * s)
{
@@ -1558,6 +1570,7 @@ session_manager_main_enable (vlib_main_t * vm)
if (num_threads < 1)
return clib_error_return (0, "n_thread_stacks not set");
+ smm->last_transport_proto_type = TRANSPORT_PROTO_QUIC;
/* Allocate cache line aligned worker contexts */
vec_validate_aligned (smm->wrk, num_threads - 1, CLIB_CACHE_LINE_BYTES);
@@ -1570,6 +1583,7 @@ session_manager_main_enable (vlib_main_t * vm)
wrk->vm = vlib_mains[i];
wrk->last_vlib_time = vlib_time_now (vlib_mains[i]);
wrk->last_vlib_us_time = wrk->last_vlib_time * CLIB_US_TIME_FREQ;
+ vec_validate (wrk->session_to_enqueue, smm->last_transport_proto_type);
if (num_threads > 1)
clib_rwlock_init (&smm->wrk[i].peekers_rw_locks);