summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application.c4
-rw-r--r--src/vnet/session/application.h1
-rw-r--r--src/vnet/session/application_worker.c6
-rw-r--r--src/vnet/session/session.c126
-rw-r--r--src/vnet/session/session.h119
-rwxr-xr-xsrc/vnet/session/session_api.c46
-rwxr-xr-xsrc/vnet/session/session_cli.c22
-rw-r--r--src/vnet/session/session_node.c26
-rw-r--r--src/vnet/session/session_table.c4
-rw-r--r--src/vnet/session/transport.c2
10 files changed, 141 insertions, 215 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 86e0e6b1919..09111e6339d 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -477,14 +477,14 @@ application_verify_cfg (ssvm_segment_type_t st)
u8 is_valid;
if (st == SSVM_SEGMENT_MEMFD)
{
- is_valid = (session_manager_get_evt_q_segment () != 0);
+ is_valid = (session_main_get_evt_q_segment () != 0);
if (!is_valid)
clib_warning ("memfd seg: vpp's event qs IN binary api svm region");
return is_valid;
}
else if (st == SSVM_SEGMENT_SHM)
{
- is_valid = (session_manager_get_evt_q_segment () == 0);
+ is_valid = (session_main_get_evt_q_segment () == 0);
if (!is_valid)
clib_warning ("shm seg: vpp's event qs NOT IN binary api svm region");
return is_valid;
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index 0904c232f30..d96ae117332 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -237,7 +237,6 @@ int app_worker_del_segment_notify (app_worker_t * app_wrk,
u32 app_worker_n_listeners (app_worker_t * app);
session_t *app_worker_first_listener (app_worker_t * app,
u8 fib_proto, u8 transport_proto);
-u8 app_worker_application_is_builtin (app_worker_t * app_wrk);
int app_worker_send_event (app_worker_t * app, session_t * s, u8 evt);
int app_worker_lock_and_send_event (app_worker_t * app, session_t * s,
u8 evt_type);
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index 2717ef01870..662c65ba05b 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -489,7 +489,7 @@ app_worker_del_segment_notify (app_worker_t * app_wrk, u64 segment_handle)
segment_handle);
}
-u8
+static inline u8
app_worker_application_is_builtin (app_worker_t * app_wrk)
{
return app_wrk->app_is_builtin;
@@ -666,7 +666,7 @@ format_app_worker_listener (u8 * s, va_list * args)
app_name = application_name_from_index (app_wrk->app_index);
listener = listen_session_get_from_handle (handle);
- str = format (0, "%U", format_stream_session, listener, verbose);
+ str = format (0, "%U", format_session, listener, verbose);
if (verbose)
{
@@ -737,7 +737,7 @@ app_worker_format_connects (app_worker_t * app_wrk, int verbose)
thread_index = fifo->master_thread_index;
session = session_get (session_index, thread_index);
- str = format (0, "%U", format_stream_session, session, verbose);
+ str = format (0, "%U", format_session, session, verbose);
if (verbose)
s = format (s, "%-40s%-20s%-15u%-10u", str, app_name,
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 97636a7ac8e..fced034df85 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -23,7 +23,7 @@
#include <vnet/dpo/load_balance.h>
#include <vnet/fib/ip4_fib.h>
-session_manager_main_t session_manager_main;
+session_main_t session_main;
static inline int
session_send_evt_to_thread (void *data, void *args, u32 thread_index,
@@ -34,7 +34,7 @@ session_send_evt_to_thread (void *data, void *args, u32 thread_index,
svm_msg_q_t *mq;
u32 tries = 0, max_tries;
- mq = session_manager_get_vpp_event_queue (thread_index);
+ mq = session_main_get_vpp_event_queue (thread_index);
while (svm_msg_q_try_lock (mq))
{
max_tries = vlib_get_current_process (vlib_get_main ())? 1e6 : 3;
@@ -121,7 +121,7 @@ static void
session_program_transport_close (session_t * s)
{
u32 thread_index = vlib_get_thread_index ();
- session_manager_worker_t *wrk;
+ session_worker_t *wrk;
session_event_t *evt;
if (!session_has_transport (s))
@@ -135,7 +135,7 @@ session_program_transport_close (session_t * s)
* held, just append a new event to pending disconnects vector. */
if (vlib_thread_is_main_w_barrier () || thread_index == s->thread_index)
{
- wrk = session_manager_get_worker (s->thread_index);
+ wrk = session_main_get_worker (s->thread_index);
vec_add2 (wrk->pending_disconnects, evt, 1);
clib_memset (evt, 0, sizeof (*evt));
evt->session_handle = session_handle (s);
@@ -148,7 +148,7 @@ session_program_transport_close (session_t * s)
session_t *
session_alloc (u32 thread_index)
{
- session_manager_worker_t *wrk = &session_manager_main.wrk[thread_index];
+ session_worker_t *wrk = &session_main.wrk[thread_index];
session_t *s;
u8 will_expand = 0;
pool_get_aligned_will_expand (wrk->sessions, will_expand,
@@ -173,7 +173,7 @@ session_alloc (u32 thread_index)
void
session_free (session_t * s)
{
- pool_put (session_manager_main.wrk[s->thread_index].sessions, s);
+ pool_put (session_main.wrk[s->thread_index].sessions, s);
if (CLIB_DEBUG)
clib_memset (s, 0xFA, sizeof (*s));
}
@@ -386,9 +386,9 @@ session_enqueue_stream_connection (transport_connection_t * tc,
{
/* Queue RX event on this fifo. Eventually these will need to be flushed
* by calling stream_server_flush_enqueue_events () */
- session_manager_worker_t *wrk;
+ session_worker_t *wrk;
- wrk = session_manager_get_worker (s->thread_index);
+ wrk = session_main_get_worker (s->thread_index);
if (s->enqueue_epoch != wrk->current_enqueue_epoch[tc->proto])
{
s->enqueue_epoch = wrk->current_enqueue_epoch[tc->proto];
@@ -424,9 +424,9 @@ session_enqueue_dgram_connection (session_t * s,
{
/* Queue RX event on this fifo. Eventually these will need to be flushed
* by calling stream_server_flush_enqueue_events () */
- session_manager_worker_t *wrk;
+ session_worker_t *wrk;
- wrk = session_manager_get_worker (s->thread_index);
+ wrk = session_main_get_worker (s->thread_index);
if (s->enqueue_epoch != wrk->current_enqueue_epoch[proto])
{
s->enqueue_epoch = wrk->current_enqueue_epoch[proto];
@@ -436,41 +436,16 @@ session_enqueue_dgram_connection (session_t * s,
return enqueued;
}
-/** Check if we have space in rx fifo to push more bytes */
-u8
-stream_session_no_space (transport_connection_t * tc, u32 thread_index,
- u16 data_len)
-{
- session_t *s = session_get (tc->s_index, thread_index);
-
- if (PREDICT_FALSE (s->session_state != SESSION_STATE_READY))
- return 1;
-
- if (data_len > svm_fifo_max_enqueue (s->rx_fifo))
- return 1;
-
- return 0;
-}
-
-u32
-session_tx_fifo_max_dequeue (transport_connection_t * tc)
-{
- session_t *s = session_get (tc->s_index, tc->thread_index);
- if (!s->tx_fifo)
- return 0;
- return svm_fifo_max_dequeue (s->tx_fifo);
-}
-
int
-stream_session_peek_bytes (transport_connection_t * tc, u8 * buffer,
- u32 offset, u32 max_bytes)
+session_tx_fifo_peek_bytes (transport_connection_t * tc, u8 * buffer,
+ u32 offset, u32 max_bytes)
{
session_t *s = session_get (tc->s_index, tc->thread_index);
return svm_fifo_peek (s->tx_fifo, offset, max_bytes, buffer);
}
u32
-session_dequeue_drop (transport_connection_t * tc, u32 max_bytes)
+session_tx_fifo_dequeue_drop (transport_connection_t * tc, u32 max_bytes)
{
session_t *s = session_get (tc->s_index, tc->thread_index);
return svm_fifo_dequeue_drop (s->tx_fifo, max_bytes);
@@ -569,9 +544,9 @@ session_dequeue_notify (session_t * s)
* failures due to API queue being full.
*/
int
-session_manager_flush_enqueue_events (u8 transport_proto, u32 thread_index)
+session_main_flush_enqueue_events (u8 transport_proto, u32 thread_index)
{
- session_manager_worker_t *wrk = session_manager_get_worker (thread_index);
+ session_worker_t *wrk = session_main_get_worker (thread_index);
session_t *s;
int i, errors = 0;
u32 *indices;
@@ -598,30 +573,15 @@ session_manager_flush_enqueue_events (u8 transport_proto, u32 thread_index)
}
int
-session_manager_flush_all_enqueue_events (u8 transport_proto)
+session_main_flush_all_enqueue_events (u8 transport_proto)
{
vlib_thread_main_t *vtm = vlib_get_thread_main ();
int i, errors = 0;
for (i = 0; i < 1 + vtm->n_threads; i++)
- errors += session_manager_flush_enqueue_events (transport_proto, i);
+ errors += session_main_flush_enqueue_events (transport_proto, i);
return errors;
}
-/**
- * Init fifo tail and head pointers
- *
- * Useful if transport uses absolute offsets for tracking ooo segments.
- */
-void
-stream_session_init_fifos_pointers (transport_connection_t * tc,
- u32 rx_pointer, u32 tx_pointer)
-{
- session_t *s;
- s = session_get (tc->s_index, tc->thread_index);
- svm_fifo_init_pointers (s->rx_fifo, rx_pointer);
- svm_fifo_init_pointers (s->tx_fifo, tx_pointer);
-}
-
int
session_stream_connect_notify (transport_connection_t * tc, u8 is_fail)
{
@@ -1173,7 +1133,7 @@ session_transport_cleanup (session_t * s)
* vpp uses api svm region for event queues.
*/
void
-session_vpp_event_queues_allocate (session_manager_main_t * smm)
+session_vpp_event_queues_allocate (session_main_t * smm)
{
u32 evt_q_length = 2048, evt_size = sizeof (session_event_t);
ssvm_private_t *eqs = &smm->evt_qs_segment;
@@ -1236,14 +1196,27 @@ session_vpp_event_queues_allocate (session_manager_main_t * smm)
}
ssvm_private_t *
-session_manager_get_evt_q_segment (void)
+session_main_get_evt_q_segment (void)
{
- session_manager_main_t *smm = &session_manager_main;
+ session_main_t *smm = &session_main;
if (smm->evt_qs_use_memfd_seg)
return &smm->evt_qs_segment;
return 0;
}
+u64
+session_segment_handle (session_t * s)
+{
+ svm_fifo_t *f;
+
+ if (s->session_state == SESSION_STATE_LISTENING)
+ return SESSION_INVALID_HANDLE;
+
+ f = s->rx_fifo;
+ return segment_manager_make_segment_handle (f->segment_manager,
+ f->segment_index);
+}
+
/* *INDENT-OFF* */
static session_fifo_rx_fn *session_tx_fns[TRANSPORT_TX_N_FNS] = {
session_tx_fifo_peek_and_snd,
@@ -1264,7 +1237,7 @@ session_register_transport (transport_proto_t transport_proto,
const transport_proto_vft_t * vft, u8 is_ip4,
u32 output_node)
{
- session_manager_main_t *smm = &session_manager_main;
+ session_main_t *smm = &session_main;
session_type_t session_type;
u32 next_index = ~0;
@@ -1306,25 +1279,6 @@ listen_session_get_transport (session_t * s)
s->connection_index);
}
-int
-listen_session_get_local_session_endpoint (session_t * listener,
- session_endpoint_t * sep)
-{
- transport_connection_t *tc;
- tc = listen_session_get_transport (listener);
- if (!tc)
- {
- clib_warning ("no transport");
- return -1;
- }
-
- /* N.B. The ip should not be copied because this is the local endpoint */
- sep->port = tc->lcl_port;
- sep->transport_proto = tc->proto;
- sep->is_ip4 = tc->is_ip4;
- return 0;
-}
-
void
session_flush_frames_main_thread (vlib_main_t * vm)
{
@@ -1337,10 +1291,10 @@ static clib_error_t *
session_manager_main_enable (vlib_main_t * vm)
{
segment_manager_main_init_args_t _sm_args = { 0 }, *sm_args = &_sm_args;
- session_manager_main_t *smm = &session_manager_main;
+ session_main_t *smm = &session_main;
vlib_thread_main_t *vtm = vlib_get_thread_main ();
u32 num_threads, preallocated_sessions_per_worker;
- session_manager_worker_t *wrk;
+ session_worker_t *wrk;
int i, j;
num_threads = 1 /* main thread */ + vtm->n_threads;
@@ -1462,7 +1416,7 @@ vnet_session_enable_disable (vlib_main_t * vm, u8 is_en)
clib_error_t *error = 0;
if (is_en)
{
- if (session_manager_main.is_enabled)
+ if (session_main.is_enabled)
return 0;
session_node_enable_disable (is_en);
@@ -1470,7 +1424,7 @@ vnet_session_enable_disable (vlib_main_t * vm, u8 is_en)
}
else
{
- session_manager_main.is_enabled = 0;
+ session_main.is_enabled = 0;
session_node_enable_disable (is_en);
}
@@ -1480,7 +1434,7 @@ vnet_session_enable_disable (vlib_main_t * vm, u8 is_en)
clib_error_t *
session_manager_main_init (vlib_main_t * vm)
{
- session_manager_main_t *smm = &session_manager_main;
+ session_main_t *smm = &session_main;
smm->session_baseva = HIGH_SEGMENT_BASEVA;
#if (HIGH_SEGMENT_BASEVA > (4ULL << 30))
smm->session_va_space_size = 128ULL << 30;
@@ -1498,7 +1452,7 @@ VLIB_INIT_FUNCTION (session_manager_main_init);
static clib_error_t *
session_config_fn (vlib_main_t * vm, unformat_input_t * input)
{
- session_manager_main_t *smm = &session_manager_main;
+ session_main_t *smm = &session_main;
u32 nitems;
uword tmp;
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 92fd5fafe7a..a7c91949eb3 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -18,8 +18,8 @@
#include <vnet/session/session_types.h>
#include <vnet/session/session_lookup.h>
#include <vnet/session/session_debug.h>
-#include <vnet/session/segment_manager.h>
#include <svm/message_queue.h>
+#include <svm/ssvm.h>
#define SESSION_PROXY_LISTENER_INDEX ((u8)~0 - 1)
@@ -64,7 +64,7 @@ typedef struct session_tx_context_
session_dgram_hdr_t hdr;
} session_tx_context_t;
-typedef struct session_manager_worker_
+typedef struct session_worker_
{
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
@@ -109,11 +109,11 @@ typedef struct session_manager_worker_
u32 last_tx_packets;
-} session_manager_worker_t;
+} session_worker_t;
typedef int (session_fifo_rx_fn) (vlib_main_t * vm,
vlib_node_runtime_t * node,
- session_manager_worker_t * wrk,
+ session_worker_t * wrk,
session_event_t * e, int *n_tx_pkts);
extern session_fifo_rx_fn session_tx_fifo_peek_and_snd;
@@ -122,10 +122,10 @@ extern session_fifo_rx_fn session_tx_fifo_dequeue_internal;
u8 session_node_lookup_fifo_event (svm_fifo_t * f, session_event_t * e);
-typedef struct session_manager_main_
+typedef struct session_main_
{
/** Worker contexts */
- session_manager_worker_t *wrk;
+ session_worker_t *wrk;
/** Event queues memfd segment initialized only if so configured */
ssvm_private_t evt_qs_segment;
@@ -182,9 +182,9 @@ typedef struct session_manager_main_
f64 *last_event_poll_by_thread;
#endif
-} session_manager_main_t;
+} session_main_t;
-extern session_manager_main_t session_manager_main;
+extern session_main_t session_main;
extern vlib_node_registration_t session_queue_node;
extern vlib_node_registration_t session_queue_process_node;
@@ -192,15 +192,11 @@ extern vlib_node_registration_t session_queue_process_node;
#define SESSION_Q_PROCESS_STOP 2
always_inline u8
-stream_session_is_valid (u32 si, u8 thread_index)
+session_is_valid (u32 si, u8 thread_index)
{
session_t *s;
- s = pool_elt_at_index (session_manager_main.wrk[thread_index].sessions, si);
- if (s->thread_index != thread_index || s->session_index != si
- /* || s->server_rx_fifo->master_session_index != si
- || s->server_tx_fifo->master_session_index != si
- || s->server_rx_fifo->master_thread_index != thread_index
- || s->server_tx_fifo->master_thread_index != thread_index */ )
+ s = pool_elt_at_index (session_main.wrk[thread_index].sessions, si);
+ if (s->thread_index != thread_index || s->session_index != si)
return 0;
return 1;
}
@@ -212,30 +208,27 @@ void session_free_w_fifos (session_t * s);
always_inline session_t *
session_get (u32 si, u32 thread_index)
{
- ASSERT (stream_session_is_valid (si, thread_index));
- return pool_elt_at_index (session_manager_main.wrk[thread_index].sessions,
- si);
+ ASSERT (session_is_valid (si, thread_index));
+ return pool_elt_at_index (session_main.wrk[thread_index].sessions, si);
}
always_inline session_t *
session_get_if_valid (u64 si, u32 thread_index)
{
- if (thread_index >= vec_len (session_manager_main.wrk))
+ if (thread_index >= vec_len (session_main.wrk))
return 0;
- if (pool_is_free_index (session_manager_main.wrk[thread_index].sessions,
- si))
+ if (pool_is_free_index (session_main.wrk[thread_index].sessions, si))
return 0;
- ASSERT (stream_session_is_valid (si, thread_index));
- return pool_elt_at_index (session_manager_main.wrk[thread_index].sessions,
- si);
+ ASSERT (session_is_valid (si, thread_index));
+ return pool_elt_at_index (session_main.wrk[thread_index].sessions, si);
}
always_inline session_t *
session_get_from_handle (session_handle_t handle)
{
- session_manager_main_t *smm = &session_manager_main;
+ session_main_t *smm = &session_main;
u32 session_index, thread_index;
session_parse_handle (handle, &session_index, &thread_index);
return pool_elt_at_index (smm->wrk[thread_index].sessions, session_index);
@@ -249,18 +242,7 @@ session_get_from_handle_if_valid (session_handle_t handle)
return session_get_if_valid (session_index, thread_index);
}
-always_inline u64
-session_segment_handle (session_t * s)
-{
- svm_fifo_t *f;
-
- if (s->session_state == SESSION_STATE_LISTENING)
- return SESSION_INVALID_HANDLE;
-
- f = s->rx_fifo;
- return segment_manager_make_segment_handle (f->segment_manager,
- f->segment_index);
-}
+u64 session_segment_handle (session_t * s);
/**
* Acquires a lock that blocks a session pool from expanding.
@@ -275,7 +257,7 @@ session_segment_handle (session_t * s)
always_inline void
session_pool_add_peeker (u32 thread_index)
{
- session_manager_worker_t *wrk = &session_manager_main.wrk[thread_index];
+ session_worker_t *wrk = &session_main.wrk[thread_index];
if (thread_index == vlib_get_thread_index ())
return;
clib_rwlock_reader_lock (&wrk->peekers_rw_locks);
@@ -284,7 +266,7 @@ session_pool_add_peeker (u32 thread_index)
always_inline void
session_pool_remove_peeker (u32 thread_index)
{
- session_manager_worker_t *wrk = &session_manager_main.wrk[thread_index];
+ session_worker_t *wrk = &session_main.wrk[thread_index];
if (thread_index == vlib_get_thread_index ())
return;
clib_rwlock_reader_unlock (&wrk->peekers_rw_locks);
@@ -299,7 +281,7 @@ always_inline session_t *
session_get_from_handle_safe (u64 handle)
{
u32 thread_index = session_thread_from_handle (handle);
- session_manager_worker_t *wrk = &session_manager_main.wrk[thread_index];
+ session_worker_t *wrk = &session_main.wrk[thread_index];
if (thread_index == vlib_get_thread_index ())
{
@@ -317,7 +299,7 @@ session_get_from_handle_safe (u64 handle)
always_inline u32
session_get_index (session_t * s)
{
- return (s - session_manager_main.wrk[s->thread_index].sessions);
+ return (s - session_main.wrk[s->thread_index].sessions);
}
always_inline session_t *
@@ -333,7 +315,7 @@ session_clone_safe (u32 session_index, u32 thread_index)
*/
session_pool_add_peeker (thread_index);
new_s = session_alloc (current_thread_index);
- old_s = session_manager_main.wrk[thread_index].sessions + session_index;
+ old_s = session_main.wrk[thread_index].sessions + session_index;
clib_memcpy_fast (new_s, old_s, sizeof (*new_s));
session_pool_remove_peeker (thread_index);
new_s->thread_index = current_thread_index;
@@ -357,8 +339,8 @@ void session_send_rpc_evt_to_thread (u32 thread_index, void *fp,
transport_connection_t *session_get_transport (session_t * s);
-u8 *format_stream_session (u8 * s, va_list * args);
-uword unformat_stream_session (unformat_input_t * input, va_list * args);
+u8 *format_session (u8 * s, va_list * args);
+uword unformat_session (unformat_input_t * input, va_list * args);
uword unformat_transport_connection (unformat_input_t * input,
va_list * args);
@@ -373,17 +355,10 @@ int session_enqueue_dgram_connection (session_t * s,
session_dgram_hdr_t * hdr,
vlib_buffer_t * b, u8 proto,
u8 queue_event);
-int stream_session_peek_bytes (transport_connection_t * tc, u8 * buffer,
- u32 offset, u32 max_bytes);
-u32 session_dequeue_drop (transport_connection_t * tc, u32 max_bytes);
-
int session_stream_connect_notify (transport_connection_t * tc, u8 is_fail);
int session_dgram_connect_notify (transport_connection_t * tc,
u32 old_thread_index,
session_t ** new_session);
-void stream_session_init_fifos_pointers (transport_connection_t * tc,
- u32 rx_pointer, u32 tx_pointer);
-
int session_stream_accept_notify (transport_connection_t * tc);
void session_transport_closing_notify (transport_connection_t * tc);
void session_transport_delete_notify (transport_connection_t * tc);
@@ -391,10 +366,12 @@ void session_transport_closed_notify (transport_connection_t * tc);
void session_transport_reset_notify (transport_connection_t * tc);
int session_stream_accept (transport_connection_t * tc, u32 listener_index,
u8 notify);
-u32 session_tx_fifo_max_dequeue (transport_connection_t * tc);
void session_register_transport (transport_proto_t transport_proto,
const transport_proto_vft_t * vft, u8 is_ip4,
u32 output_node);
+int session_tx_fifo_peek_bytes (transport_connection_t * tc, u8 * buffer,
+ u32 offset, u32 max_bytes);
+u32 session_tx_fifo_dequeue_drop (transport_connection_t * tc, u32 max_bytes);
always_inline u32
transport_max_rx_enqueue (transport_connection_t * tc)
@@ -434,13 +411,13 @@ transport_rx_fifo_has_ooo_data (transport_connection_t * tc)
always_inline f64
transport_dispatch_period (u32 thread_index)
{
- return session_manager_main.wrk[thread_index].dispatch_period;
+ return session_main.wrk[thread_index].dispatch_period;
}
always_inline f64
transport_time_now (u32 thread_index)
{
- return session_manager_main.wrk[thread_index].last_vlib_time;
+ return session_main.wrk[thread_index].last_vlib_time;
}
always_inline void
@@ -500,48 +477,44 @@ listen_session_free (session_t * s)
transport_connection_t *listen_session_get_transport (session_t * s);
-int
-listen_session_get_local_session_endpoint (session_t * listener,
- session_endpoint_t * sep);
-
/*
- * Session manager functions
+ * Session layer functions
*/
-always_inline session_manager_main_t *
-vnet_get_session_manager_main ()
+always_inline session_main_t *
+vnet_get_session_main ()
{
- return &session_manager_main;
+ return &session_main;
}
-always_inline session_manager_worker_t *
-session_manager_get_worker (u32 thread_index)
+always_inline session_worker_t *
+session_main_get_worker (u32 thread_index)
{
- return &session_manager_main.wrk[thread_index];
+ return &session_main.wrk[thread_index];
}
always_inline svm_msg_q_t *
-session_manager_get_vpp_event_queue (u32 thread_index)
+session_main_get_vpp_event_queue (u32 thread_index)
{
- return session_manager_main.wrk[thread_index].vpp_event_queue;
+ return session_main.wrk[thread_index].vpp_event_queue;
}
always_inline u8
-session_manager_is_enabled ()
+session_main_is_enabled ()
{
- return session_manager_main.is_enabled == 1;
+ return session_main.is_enabled == 1;
}
#define session_cli_return_if_not_enabled() \
do { \
- if (!session_manager_main.is_enabled) \
+ if (!session_main.is_enabled) \
return clib_error_return(0, "session layer is not enabled"); \
} while (0)
-int session_manager_flush_enqueue_events (u8 proto, u32 thread_index);
-int session_manager_flush_all_enqueue_events (u8 transport_proto);
+int session_main_flush_enqueue_events (u8 proto, u32 thread_index);
+int session_main_flush_all_enqueue_events (u8 transport_proto);
void session_flush_frames_main_thread (vlib_main_t * vm);
-ssvm_private_t *session_manager_get_evt_q_segment (void);
+ssvm_private_t *session_main_get_evt_q_segment (void);
void session_node_enable_disable (u8 is_en);
clib_error_t *vnet_session_enable_disable (vlib_main_t * vm, u8 is_en);
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 81654e426b5..c4be556f637 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -241,7 +241,7 @@ send_session_accept_callback (session_t * s)
if (listener)
mp->listener_handle = listen_session_get_handle (listener);
}
- vpp_queue = session_manager_get_vpp_event_queue (s->thread_index);
+ vpp_queue = session_main_get_vpp_event_queue (s->thread_index);
mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
mp->handle = session_handle (s);
tc = transport_get_connection (session_get_transport_proto (s),
@@ -345,7 +345,7 @@ send_session_connected_callback (u32 app_wrk_index, u32 api_context,
goto done;
}
- vpp_queue = session_manager_get_vpp_event_queue (s->thread_index);
+ vpp_queue = session_main_get_vpp_event_queue (s->thread_index);
mp->handle = session_handle (s);
mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
clib_memcpy_fast (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
@@ -442,7 +442,7 @@ mq_send_session_accepted_cb (session_t * s)
if (listener)
mp->listener_handle = listen_session_get_handle (listener);
}
- vpp_queue = session_manager_get_vpp_event_queue (s->thread_index);
+ vpp_queue = session_main_get_vpp_event_queue (s->thread_index);
mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
mp->handle = session_handle (s);
tc = transport_get_connection (session_get_transport_proto (s),
@@ -468,7 +468,7 @@ mq_send_session_accepted_cb (session_t * s)
mp->is_ip4 = session_type_is_ip4 (listener->session_type);
mp->handle = session_handle (s);
mp->port = ct->c_rmt_port;
- vpp_queue = session_manager_get_vpp_event_queue (main_thread);
+ vpp_queue = session_main_get_vpp_event_queue (main_thread);
mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
mp->client_event_queue_address = ct->client_evt_q;
mp->server_event_queue_address = ct->server_evt_q;
@@ -588,7 +588,7 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
goto done;
}
- vpp_mq = session_manager_get_vpp_event_queue (s->thread_index);
+ vpp_mq = session_main_get_vpp_event_queue (s->thread_index);
mp->handle = session_handle (s);
mp->vpp_event_queue_address = pointer_to_uword (vpp_mq);
clib_memcpy_fast (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
@@ -612,7 +612,7 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
mp->handle = session_handle (s);
mp->lcl_port = cct->c_lcl_port;
- vpp_mq = session_manager_get_vpp_event_queue (main_thread);
+ vpp_mq = session_main_get_vpp_event_queue (main_thread);
mp->vpp_event_queue_address = pointer_to_uword (vpp_mq);
mp->client_event_queue_address = cct->client_evt_q;
mp->server_event_queue_address = cct->server_evt_q;
@@ -675,7 +675,7 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
mp->lcl_is_ip4 = tc->is_ip4;
clib_memcpy_fast (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
- vpp_evt_q = session_manager_get_vpp_event_queue (0);
+ vpp_evt_q = session_main_get_vpp_event_queue (0);
mp->vpp_evt_q = pointer_to_uword (vpp_evt_q);
if (session_transport_service_type (ls) == TRANSPORT_SERVICE_CL)
@@ -724,7 +724,7 @@ vl_api_application_attach_t_handler (vl_api_application_attach_t * mp)
if (!reg)
return;
- if (session_manager_is_enabled () == 0)
+ if (session_main_is_enabled () == 0)
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -765,7 +765,7 @@ vl_api_application_attach_t_handler (vl_api_application_attach_t * mp)
vec_free (a->namespace_id);
/* Send event queues segment */
- if ((evt_q_segment = session_manager_get_evt_q_segment ()))
+ if ((evt_q_segment = session_main_get_evt_q_segment ()))
{
fd_flags |= SESSION_FD_F_VPP_MQ_SEGMENT;
fds[n_fds] = evt_q_segment->fd;
@@ -820,7 +820,7 @@ vl_api_application_detach_t_handler (vl_api_application_detach_t * mp)
vnet_app_detach_args_t _a, *a = &_a;
application_t *app;
- if (session_manager_is_enabled () == 0)
+ if (session_main_is_enabled () == 0)
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -850,7 +850,7 @@ vl_api_bind_uri_t_handler (vl_api_bind_uri_t * mp)
app_worker_t *app_wrk;
int rv;
- if (session_manager_is_enabled () == 0)
+ if (session_main_is_enabled () == 0)
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -888,7 +888,7 @@ done:
{
rmp->rx_fifo = pointer_to_uword (s->rx_fifo);
rmp->tx_fifo = pointer_to_uword (s->tx_fifo);
- vpp_evt_q = session_manager_get_vpp_event_queue (0);
+ vpp_evt_q = session_main_get_vpp_event_queue (0);
rmp->vpp_evt_q = pointer_to_uword (vpp_evt_q);
}
}
@@ -913,7 +913,7 @@ vl_api_unbind_uri_t_handler (vl_api_unbind_uri_t * mp)
vnet_unlisten_args_t _a, *a = &_a;
int rv;
- if (session_manager_is_enabled () == 0)
+ if (session_main_is_enabled () == 0)
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -943,7 +943,7 @@ vl_api_connect_uri_t_handler (vl_api_connect_uri_t * mp)
application_t *app;
int rv = 0;
- if (session_manager_is_enabled () == 0)
+ if (session_main_is_enabled () == 0)
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -986,7 +986,7 @@ vl_api_disconnect_session_t_handler (vl_api_disconnect_session_t * mp)
application_t *app;
int rv = 0;
- if (session_manager_is_enabled () == 0)
+ if (session_main_is_enabled () == 0)
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -1128,7 +1128,7 @@ vl_api_bind_sock_t_handler (vl_api_bind_sock_t * mp)
session_t *s;
int rv = 0;
- if (session_manager_is_enabled () == 0)
+ if (session_main_is_enabled () == 0)
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -1173,7 +1173,7 @@ done:
{
rmp->rx_fifo = pointer_to_uword (s->rx_fifo);
rmp->tx_fifo = pointer_to_uword (s->tx_fifo);
- vpp_evt_q = session_manager_get_vpp_event_queue (0);
+ vpp_evt_q = session_main_get_vpp_event_queue (0);
rmp->vpp_evt_q = pointer_to_uword (vpp_evt_q);
}
}
@@ -1199,7 +1199,7 @@ vl_api_unbind_sock_t_handler (vl_api_unbind_sock_t * mp)
application_t *app = 0;
int rv = 0;
- if (session_manager_is_enabled () == 0)
+ if (session_main_is_enabled () == 0)
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -1255,7 +1255,7 @@ vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp)
application_t *app = 0;
int rv = 0;
- if (session_manager_is_enabled () == 0)
+ if (session_main_is_enabled () == 0)
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -1318,7 +1318,7 @@ vl_api_app_worker_add_del_t_handler (vl_api_app_worker_add_del_t * mp)
application_t *app;
u8 fd_flags = 0;
- if (!session_manager_is_enabled ())
+ if (!session_main_is_enabled ())
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -1397,7 +1397,7 @@ vl_api_app_namespace_add_del_t_handler (vl_api_app_namespace_add_del_t * mp)
u32 appns_index = 0;
u8 *ns_id = 0;
int rv = 0;
- if (!session_manager_is_enabled ())
+ if (!session_main_is_enabled ())
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -1624,7 +1624,7 @@ vl_api_application_tls_cert_add_t_handler (vl_api_application_tls_cert_add_t *
application_t *app;
u32 cert_len;
int rv = 0;
- if (!session_manager_is_enabled ())
+ if (!session_main_is_enabled ())
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
@@ -1664,7 +1664,7 @@ vl_api_application_tls_key_add_t_handler (vl_api_application_tls_key_add_t *
application_t *app;
u32 key_len;
int rv = 0;
- if (!session_manager_is_enabled ())
+ if (!session_main_is_enabled ())
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index e92d432c8a8..d8e504e5fb3 100755
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -52,7 +52,7 @@ format_session_fifos (u8 * s, va_list * args)
* "Connection"
*/
u8 *
-format_stream_session (u8 * s, va_list * args)
+format_session (u8 * s, va_list * args)
{
session_t *ss = va_arg (*args, session_t *);
int verbose = va_arg (*args, int);
@@ -160,7 +160,7 @@ unformat_stream_session_id (unformat_input_t * input, va_list * args)
}
uword
-unformat_stream_session (unformat_input_t * input, va_list * args)
+unformat_session (unformat_input_t * input, va_list * args)
{
session_t **result = va_arg (*args, session_t **);
u32 lcl_port = 0, rmt_port = 0, fib_index = 0;
@@ -230,7 +230,7 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
{
u8 one_session = 0, do_listeners = 0, sst, do_elog = 0;
- session_manager_main_t *smm = &session_manager_main;
+ session_main_t *smm = &session_main;
u32 transport_proto = ~0, track_index;
session_t *pool, *s;
transport_connection_t *tc;
@@ -252,7 +252,7 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
else if (unformat (input, "listeners %U", unformat_transport_proto,
&transport_proto))
do_listeners = 1;
- else if (unformat (input, "%U", unformat_stream_session, &s))
+ else if (unformat (input, "%U", unformat_session, &s))
{
one_session = 1;
}
@@ -265,7 +265,7 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (one_session)
{
- u8 *str = format (0, "%U", format_stream_session, s, 3);
+ u8 *str = format (0, "%U", format_session, s, 3);
if (do_elog && s->session_state != SESSION_STATE_LISTENING)
{
elog_main_t *em = &vm->elog_main;
@@ -295,7 +295,7 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
continue;
app_wrk = app_worker_get (s->app_wrk_index);
app_name = application_name_from_index (app_wrk->app_index);
- vlib_cli_output (vm, "%U%-25v%", format_stream_session, s, 0,
+ vlib_cli_output (vm, "%U%-25v%", format_session, s, 0,
app_name);
}));
/* *INDENT-ON* */
@@ -333,7 +333,7 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
n_closed += 1;
continue;
}
- vlib_cli_output (vm, "%U", format_stream_session, s, verbose);
+ vlib_cli_output (vm, "%U", format_session, s, verbose);
}));
/* *INDENT-ON* */
@@ -371,9 +371,9 @@ static clib_error_t *
clear_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
{
- session_manager_main_t *smm = &session_manager_main;
+ session_main_t *smm = &session_main;
u32 thread_index = 0, clear_all = 0;
- session_manager_worker_t *wrk;
+ session_worker_t *wrk;
u32 session_index = ~0;
session_t *session;
@@ -441,7 +441,7 @@ show_session_fifo_trace_command_fn (vlib_main_t * vm,
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (input, "%U", unformat_stream_session, &s))
+ if (unformat (input, "%U", unformat_session, &s))
;
else if (unformat (input, "rx"))
is_rx = 1;
@@ -490,7 +490,7 @@ session_replay_fifo_command_fn (vlib_main_t * vm, unformat_input_t * input,
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (input, "%U", unformat_stream_session, &s))
+ if (unformat (input, "%U", unformat_session, &s))
;
else if (unformat (input, "rx"))
is_rx = 1;
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 974c28a7210..d0936c7e13d 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -365,11 +365,11 @@ session_tx_fifo_chain_tail (vlib_main_t * vm, session_tx_context_t * ctx,
{
vlib_buffer_t *chain_b, *prev_b;
u32 chain_bi0, to_deq, left_from_seg;
- session_manager_worker_t *wrk;
+ session_worker_t *wrk;
u16 len_to_deq, n_bytes_read;
u8 *data, j;
- wrk = session_manager_get_worker (ctx->s->thread_index);
+ wrk = session_main_get_worker (ctx->s->thread_index);
b->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
b->total_length_not_including_first_buffer = 0;
@@ -622,13 +622,13 @@ session_tx_set_dequeue_params (vlib_main_t * vm, session_tx_context_t * ctx,
always_inline int
session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
- session_manager_worker_t * wrk,
+ session_worker_t * wrk,
session_event_t * e, int *n_tx_packets,
u8 peek_data)
{
u32 next_index, next0, next1, *to_next, n_left_to_next, n_left, pbi;
u32 n_trace = vlib_get_trace_count (vm, node), n_bufs_needed = 0;
- session_manager_main_t *smm = &session_manager_main;
+ session_main_t *smm = &session_main;
session_tx_context_t *ctx = &wrk->ctx;
transport_proto_t tp;
vlib_buffer_t *pb;
@@ -798,7 +798,7 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
int
session_tx_fifo_peek_and_snd (vlib_main_t * vm, vlib_node_runtime_t * node,
- session_manager_worker_t * wrk,
+ session_worker_t * wrk,
session_event_t * e, int *n_tx_pkts)
{
return session_tx_fifo_read_and_snd_i (vm, node, wrk, e, n_tx_pkts, 1);
@@ -806,7 +806,7 @@ session_tx_fifo_peek_and_snd (vlib_main_t * vm, vlib_node_runtime_t * node,
int
session_tx_fifo_dequeue_and_snd (vlib_main_t * vm, vlib_node_runtime_t * node,
- session_manager_worker_t * wrk,
+ session_worker_t * wrk,
session_event_t * e, int *n_tx_pkts)
{
return session_tx_fifo_read_and_snd_i (vm, node, wrk, e, n_tx_pkts, 0);
@@ -815,7 +815,7 @@ session_tx_fifo_dequeue_and_snd (vlib_main_t * vm, vlib_node_runtime_t * node,
int
session_tx_fifo_dequeue_internal (vlib_main_t * vm,
vlib_node_runtime_t * node,
- session_manager_worker_t * wrk,
+ session_worker_t * wrk,
session_event_t * e, int *n_tx_pkts)
{
session_t *s = wrk->ctx.s;
@@ -835,7 +835,7 @@ session_event_get_session (session_event_t * e, u8 thread_index)
}
static void
-session_update_dispatch_period (session_manager_worker_t * wrk, f64 now,
+session_update_dispatch_period (session_worker_t * wrk, f64 now,
u32 thread_index)
{
if (wrk->last_tx_packets)
@@ -850,9 +850,9 @@ static uword
session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
- session_manager_main_t *smm = vnet_get_session_manager_main ();
+ session_main_t *smm = vnet_get_session_main ();
u32 thread_index = vm->thread_index, n_to_dequeue, n_events;
- session_manager_worker_t *wrk = &smm->wrk[thread_index];
+ session_worker_t *wrk = &smm->wrk[thread_index];
session_event_t *e, *fifo_events;
svm_msg_q_msg_t _msg, *msg = &_msg;
f64 now = vlib_time_now (vm);
@@ -1038,7 +1038,7 @@ VLIB_REGISTER_NODE (session_queue_node) =
void
dump_thread_0_event_queue (void)
{
- session_manager_main_t *smm = vnet_get_session_manager_main ();
+ session_main_t *smm = vnet_get_session_main ();
vlib_main_t *vm = &vlib_global_main;
u32 my_thread_index = vm->thread_index;
session_event_t _e, *e = &_e;
@@ -1128,7 +1128,7 @@ u8
session_node_lookup_fifo_event (svm_fifo_t * f, session_event_t * e)
{
session_event_t *pending_event_vector, *evt;
- session_manager_worker_t *wrk;
+ session_worker_t *wrk;
int i, index, found = 0;
svm_msg_q_msg_t *msg;
svm_msg_q_ring_t *ring;
@@ -1137,7 +1137,7 @@ session_node_lookup_fifo_event (svm_fifo_t * f, session_event_t * e)
ASSERT (e);
thread_index = f->master_thread_index;
- wrk = session_manager_get_worker (thread_index);
+ wrk = session_main_get_worker (thread_index);
/*
* Search evt queue
diff --git a/src/vnet/session/session_table.c b/src/vnet/session/session_table.c
index da3e4cd4096..3722e0f63be 100644
--- a/src/vnet/session/session_table.c
+++ b/src/vnet/session/session_table.c
@@ -78,9 +78,9 @@ session_table_init (session_table_t * slt, u8 fib_proto)
#undef _
#define _(af,table,parm,value) \
- if (session_manager_main.configured_##af##_##table##_table_##parm) \
+ if (session_main.configured_##af##_##table##_table_##parm) \
configured_##af##_##table##_table_##parm = \
- session_manager_main.configured_##af##_##table##_table_##parm;
+ session_main.configured_##af##_##table##_table_##parm;
foreach_hash_table_parameter;
#undef _
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index 2c4efe15806..ddeb6d4b621 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -677,7 +677,7 @@ void
transport_init (void)
{
vlib_thread_main_t *vtm = vlib_get_thread_main ();
- session_manager_main_t *smm = vnet_get_session_manager_main ();
+ session_main_t *smm = vnet_get_session_main ();
u32 num_threads;
if (smm->local_endpoints_table_buckets == 0)