aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-03-01 13:00:58 -0800
committerDave Barach <openvpp@barachs.net>2019-03-02 23:40:04 +0000
commit31c9955a4e83578422b3328ef0d7b2b248536644 (patch)
tree51dbc9de2cac22ca190ec394d6bf29e4ebb72d54 /src
parentf6c4313b6aa7746fe97afd398ce68c2efbef0600 (diff)
session: cleanup/rename functions
- remove unused functions - rename old "stream" functions Change-Id: Icbb03daa9f9f1c58b5be5c38aa8a9cbcf9159b47 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/unittest/tcp_test.c2
-rw-r--r--src/vnet/sctp/sctp_input.c4
-rw-r--r--src/vnet/sctp/sctp_output.c6
-rw-r--r--src/vnet/session-apps/echo_client.c4
-rw-r--r--src/vnet/session-apps/echo_server.c10
-rw-r--r--src/vnet/session-apps/http_server.c2
-rw-r--r--src/vnet/session-apps/proxy.c7
-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
-rw-r--r--src/vnet/tcp/tcp.c4
-rw-r--r--src/vnet/tcp/tcp.h2
-rw-r--r--src/vnet/tcp/tcp_input.c27
-rw-r--r--src/vnet/tcp/tcp_output.c25
-rw-r--r--src/vnet/udp/udp_input.c2
22 files changed, 189 insertions, 262 deletions
diff --git a/src/plugins/unittest/tcp_test.c b/src/plugins/unittest/tcp_test.c
index 842f28a6e0a..c144de4398d 100644
--- a/src/plugins/unittest/tcp_test.c
+++ b/src/plugins/unittest/tcp_test.c
@@ -1635,7 +1635,7 @@ tcp_test_fifo (vlib_main_t * vm, unformat_input_t * input)
static int
tcp_test_lookup (vlib_main_t * vm, unformat_input_t * input)
{
- session_manager_main_t *smm = &session_manager_main;
+ session_main_t *smm = &session_main;
tcp_main_t *tm = &tcp_main;
transport_connection_t _tc1, *tc1 = &_tc1, _tc2, *tc2 = &_tc2, *tconn;
tcp_connection_t *tc;
diff --git a/src/vnet/sctp/sctp_input.c b/src/vnet/sctp/sctp_input.c
index 95e27ee9a05..0b24bf79896 100644
--- a/src/vnet/sctp/sctp_input.c
+++ b/src/vnet/sctp/sctp_input.c
@@ -1970,8 +1970,8 @@ sctp46_established_phase_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
- errors = session_manager_flush_enqueue_events (TRANSPORT_PROTO_SCTP,
- my_thread_index);
+ errors = session_main_flush_enqueue_events (TRANSPORT_PROTO_SCTP,
+ my_thread_index);
sctp_node_inc_counter (vm, is_ip4, sctp4_established_phase_node.index,
sctp6_established_phase_node.index,
diff --git a/src/vnet/sctp/sctp_output.c b/src/vnet/sctp/sctp_output.c
index 8fea714f6a2..dbd4ef21918 100644
--- a/src/vnet/sctp/sctp_output.c
+++ b/src/vnet/sctp/sctp_output.c
@@ -1483,7 +1483,7 @@ sctp_prepare_data_retransmit (sctp_connection_t * sctp_conn,
* Make sure we can retransmit something
*/
available_bytes =
- session_tx_fifo_max_dequeue (&sctp_conn->sub_conn[idx].connection);
+ transport_max_tx_dequeue (&sctp_conn->sub_conn[idx].connection);
ASSERT (available_bytes >= offset);
available_bytes -= offset;
if (!available_bytes)
@@ -1506,8 +1506,8 @@ sctp_prepare_data_retransmit (sctp_connection_t * sctp_conn,
if (PREDICT_TRUE (seg_size <= tm->bytes_per_buffer))
{
n_bytes =
- stream_session_peek_bytes (&sctp_conn->sub_conn[idx].connection, data,
- offset, max_deq_bytes);
+ session_tx_fifo_peek_bytes (&sctp_conn->sub_conn[idx].connection,
+ data, offset, max_deq_bytes);
ASSERT (n_bytes == max_deq_bytes);
b[0]->current_length = n_bytes;
sctp_push_hdr_i (sctp_conn, *b, sctp_conn->state);
diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c
index 44e6ffce842..4d8089cde1b 100644
--- a/src/vnet/session-apps/echo_client.c
+++ b/src/vnet/session-apps/echo_client.c
@@ -380,7 +380,7 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
if (!ecm->vpp_event_queue[thread_index])
ecm->vpp_event_queue[thread_index] =
- session_manager_get_vpp_event_queue (thread_index);
+ session_main_get_vpp_event_queue (thread_index);
/*
* Setup session
@@ -428,7 +428,7 @@ echo_clients_session_reset_callback (session_t * s)
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
if (s->session_state == SESSION_STATE_READY)
- clib_warning ("Reset active connection %U", format_stream_session, s, 2);
+ clib_warning ("Reset active connection %U", format_session, s, 2);
a->handle = session_handle (s);
a->app_index = ecm->app_index;
diff --git a/src/vnet/session-apps/echo_server.c b/src/vnet/session-apps/echo_server.c
index 1d99ff17a0f..2762347d441 100644
--- a/src/vnet/session-apps/echo_server.c
+++ b/src/vnet/session-apps/echo_server.c
@@ -61,7 +61,7 @@ echo_server_session_accept_callback (session_t * s)
echo_server_main_t *esm = &echo_server_main;
esm->vpp_queue[s->thread_index] =
- session_manager_get_vpp_event_queue (s->thread_index);
+ session_main_get_vpp_event_queue (s->thread_index);
s->session_state = SESSION_STATE_READY;
esm->byte_index = 0;
ASSERT (vec_len (esm->rx_retries) > s->thread_index);
@@ -86,7 +86,7 @@ echo_server_session_reset_callback (session_t * s)
{
echo_server_main_t *esm = &echo_server_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
- clib_warning ("Reset session %U", format_stream_session, s, 2);
+ clib_warning ("Reset session %U", format_session, s, 2);
a->handle = session_handle (s);
a->app_index = esm->app_index;
vnet_disconnect_session (a);
@@ -174,7 +174,7 @@ echo_server_rx_callback (session_t * s)
if (!esm->vpp_queue[s->thread_index])
{
svm_msg_q_t *mq;
- mq = session_manager_get_vpp_event_queue (s->thread_index);
+ mq = session_main_get_vpp_event_queue (s->thread_index);
esm->vpp_queue[s->thread_index] = mq;
}
max_enqueue -= sizeof (session_dgram_hdr_t);
@@ -202,7 +202,7 @@ echo_server_rx_callback (session_t * s)
vec_validate (esm->rx_retries[s->thread_index], s->session_index);
if (esm->rx_retries[thread_index][s->session_index] == 500000)
{
- clib_warning ("session stuck: %U", format_stream_session, s, 2);
+ clib_warning ("session stuck: %U", format_session, s, 2);
}
if (esm->rx_retries[thread_index][s->session_index] < 500001)
esm->rx_retries[thread_index][s->session_index]++;
@@ -395,7 +395,7 @@ echo_server_create (vlib_main_t * vm, u8 * appns_id, u64 appns_flags,
vec_validate (esm->rx_retries, num_threads - 1);
for (i = 0; i < vec_len (esm->rx_retries); i++)
vec_validate (esm->rx_retries[i],
- pool_elts (session_manager_main.wrk[i].sessions));
+ pool_elts (session_main.wrk[i].sessions));
esm->rcv_buffer_size = clib_max (esm->rcv_buffer_size, esm->fifo_size);
for (i = 0; i < num_threads; i++)
vec_validate (esm->rx_buf[i], esm->rcv_buffer_size);
diff --git a/src/vnet/session-apps/http_server.c b/src/vnet/session-apps/http_server.c
index f702b741f95..b33a086f99a 100644
--- a/src/vnet/session-apps/http_server.c
+++ b/src/vnet/session-apps/http_server.c
@@ -585,7 +585,7 @@ http_server_session_accept_callback (session_t * s)
http_session_t *hs;
hsm->vpp_queue[s->thread_index] =
- session_manager_get_vpp_event_queue (s->thread_index);
+ session_main_get_vpp_event_queue (s->thread_index);
if (!hsm->is_static)
http_server_sessions_writer_lock ();
diff --git a/src/vnet/session-apps/proxy.c b/src/vnet/session-apps/proxy.c
index 92a3910efbf..1ee5f5a741c 100644
--- a/src/vnet/session-apps/proxy.c
+++ b/src/vnet/session-apps/proxy.c
@@ -163,7 +163,7 @@ proxy_disconnect_callback (session_t * s)
static void
proxy_reset_callback (session_t * s)
{
- clib_warning ("Reset session %U", format_stream_session, s, 2);
+ clib_warning ("Reset session %U", format_session, s, 2);
delete_proxy_session (s, 0 /* is_active_open */ );
}
@@ -507,12 +507,11 @@ proxy_server_create (vlib_main_t * vm)
for (i = 0; i < num_threads; i++)
{
- pm->active_open_event_queue[i] =
- session_manager_get_vpp_event_queue (i);
+ pm->active_open_event_queue[i] = session_main_get_vpp_event_queue (i);
ASSERT (pm->active_open_event_queue[i]);
- pm->server_event_queue[i] = session_manager_get_vpp_event_queue (i);
+ pm->server_event_queue[i] = session_main_get_vpp_event_queue (i);
}
return 0;
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)
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 8969f7bc980..7b28dd3b70c 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -350,7 +350,7 @@ tcp_connection_close (tcp_connection_t * tc)
tcp_timer_update (tc, TCP_TIMER_WAITCLOSE, TCP_FINWAIT1_TIME);
break;
case TCP_STATE_ESTABLISHED:
- if (!session_tx_fifo_max_dequeue (&tc->connection))
+ if (!transport_max_tx_dequeue (&tc->connection))
tcp_send_fin (tc);
else
tc->flags |= TCP_CONN_FINPNDG;
@@ -361,7 +361,7 @@ tcp_connection_close (tcp_connection_t * tc)
tcp_timer_set (tc, TCP_TIMER_WAITCLOSE, TCP_FINWAIT1_TIME);
break;
case TCP_STATE_CLOSE_WAIT:
- if (!session_tx_fifo_max_dequeue (&tc->connection))
+ if (!transport_max_tx_dequeue (&tc->connection))
{
tcp_send_fin (tc);
tcp_connection_timers_reset (tc);
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index 65182c493b6..7ab7ee681c5 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -934,7 +934,7 @@ tcp_timer_is_active (tcp_connection_t * tc, tcp_timers_e timer)
#define tcp_validate_txf_size(_tc, _a) \
ASSERT(_tc->state != TCP_STATE_ESTABLISHED \
- || session_tx_fifo_max_dequeue (&_tc->connection) >= _a)
+ || transport_max_tx_dequeue (&_tc->connection) >= _a)
void tcp_rcv_sacks (tcp_connection_t * tc, u32 ack);
u8 *tcp_scoreboard_replay (u8 * s, tcp_connection_t * tc, u8 verbose);
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index 88bd7a5d858..e31fbac1bb0 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -564,7 +564,7 @@ tcp_handle_postponed_dequeues (tcp_worker_ctx_t * wrk)
continue;
/* Dequeue the newly ACKed bytes */
- session_dequeue_drop (&tc->connection, tc->burst_acked);
+ session_tx_fifo_dequeue_drop (&tc->connection, tc->burst_acked);
tc->burst_acked = 0;
tcp_validate_txf_size (tc, tc->snd_una_max - tc->snd_una);
@@ -2192,8 +2192,8 @@ tcp46_established_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
tcp_inc_err_counter (err_counters, error0, 1);
}
- errors = session_manager_flush_enqueue_events (TRANSPORT_PROTO_TCP,
- thread_index);
+ errors = session_main_flush_enqueue_events (TRANSPORT_PROTO_TCP,
+ thread_index);
err_counters[TCP_ERROR_MSG_QUEUE_FULL] = errors;
tcp_store_err_counters (established, err_counters);
tcp_handle_postponed_dequeues (wrk);
@@ -2589,8 +2589,8 @@ tcp46_syn_sent_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
}
}
- errors = session_manager_flush_enqueue_events (TRANSPORT_PROTO_TCP,
- my_thread_index);
+ errors = session_main_flush_enqueue_events (TRANSPORT_PROTO_TCP,
+ my_thread_index);
tcp_inc_counter (syn_sent, TCP_ERROR_MSG_QUEUE_FULL, errors);
vlib_buffer_free (vm, first_buffer, from_frame->n_vectors);
@@ -2795,7 +2795,7 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (tc0->flags & TCP_CONN_FINPNDG)
{
/* TX fifo finally drained */
- max_dequeue = session_tx_fifo_max_dequeue (&tc0->connection);
+ max_dequeue = transport_max_tx_dequeue (&tc0->connection);
if (max_dequeue <= tc0->burst_acked)
tcp_send_fin (tc0);
}
@@ -2812,7 +2812,8 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
/* Don't try to deq the FIN acked */
if (tc0->burst_acked > 1)
- session_dequeue_drop (&tc0->connection, tc0->burst_acked - 1);
+ session_tx_fifo_dequeue_drop (&tc0->connection,
+ tc0->burst_acked - 1);
tc0->burst_acked = 0;
}
break;
@@ -2832,7 +2833,7 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (tc0->flags & TCP_CONN_FINPNDG)
{
/* TX fifo finally drained */
- if (!session_tx_fifo_max_dequeue (&tc0->connection))
+ if (!transport_max_tx_dequeue (&tc0->connection))
{
tcp_send_fin (tc0);
tcp_connection_timers_reset (tc0);
@@ -2958,9 +2959,9 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (tc0->flags & TCP_CONN_FINPNDG)
{
/* Drop all outstanding tx data. */
- session_dequeue_drop (&tc0->connection,
- transport_max_tx_dequeue
- (&tc0->connection));
+ session_tx_fifo_dequeue_drop (&tc0->connection,
+ transport_max_tx_dequeue
+ (&tc0->connection));
tcp_send_fin (tc0);
}
else
@@ -2995,8 +2996,8 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
}
}
- errors = session_manager_flush_enqueue_events (TRANSPORT_PROTO_TCP,
- thread_index);
+ errors = session_main_flush_enqueue_events (TRANSPORT_PROTO_TCP,
+ thread_index);
tcp_inc_counter (rcv_process, TCP_ERROR_MSG_QUEUE_FULL, errors);
tcp_handle_postponed_dequeues (wrk);
vlib_buffer_free (vm, first_buffer, from_frame->n_vectors);
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 4de479c344b..2e9fc58cefb 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -1340,8 +1340,8 @@ tcp_prepare_segment (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
return 0;
*b = vlib_get_buffer (vm, bi);
data = tcp_init_buffer (vm, *b);
- n_bytes = stream_session_peek_bytes (&tc->connection, data, offset,
- max_deq_bytes);
+ n_bytes = session_tx_fifo_peek_bytes (&tc->connection, data, offset,
+ max_deq_bytes);
ASSERT (n_bytes == max_deq_bytes);
b[0]->current_length = n_bytes;
tcp_push_hdr_i (tc, *b, tc->state, /* compute opts */ 0, /* burst */ 0);
@@ -1370,9 +1370,9 @@ tcp_prepare_segment (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
*b = vlib_get_buffer (vm, wrk->tx_buffers[--n_bufs]);
data = tcp_init_buffer (vm, *b);
- n_bytes = stream_session_peek_bytes (&tc->connection, data, offset,
- bytes_per_buffer -
- TRANSPORT_MAX_HDRS_LEN);
+ n_bytes = session_tx_fifo_peek_bytes (&tc->connection, data, offset,
+ bytes_per_buffer -
+ TRANSPORT_MAX_HDRS_LEN);
b[0]->current_length = n_bytes;
b[0]->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
b[0]->total_length_not_including_first_buffer = 0;
@@ -1387,8 +1387,9 @@ tcp_prepare_segment (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
chain_b = vlib_get_buffer (vm, chain_bi);
chain_b->current_data = 0;
data = vlib_buffer_get_current (chain_b);
- n_peeked = stream_session_peek_bytes (&tc->connection, data,
- offset + n_bytes, len_to_deq);
+ n_peeked = session_tx_fifo_peek_bytes (&tc->connection, data,
+ offset + n_bytes,
+ len_to_deq);
ASSERT (n_peeked == len_to_deq);
n_bytes += n_peeked;
chain_b->current_length = n_peeked;
@@ -1439,7 +1440,7 @@ tcp_prepare_retransmit_segment (tcp_worker_ctx_t * wrk,
/*
* Make sure we can retransmit something
*/
- available_bytes = session_tx_fifo_max_dequeue (&tc->connection);
+ available_bytes = transport_max_tx_dequeue (&tc->connection);
ASSERT (available_bytes >= offset);
available_bytes -= offset;
if (!available_bytes)
@@ -1716,7 +1717,7 @@ tcp_timer_persist_handler (u32 index)
|| tc->snd_wnd > tc->snd_mss)
return;
- available_bytes = session_tx_fifo_max_dequeue (&tc->connection);
+ available_bytes = transport_max_tx_dequeue (&tc->connection);
offset = tc->snd_una_max - tc->snd_una;
/* Reprogram persist if no new bytes available to send. We may have data
@@ -1753,7 +1754,7 @@ tcp_timer_persist_handler (u32 index)
max_snd_bytes =
clib_min (tc->snd_mss, tm->bytes_per_buffer - TRANSPORT_MAX_HDRS_LEN);
n_bytes =
- stream_session_peek_bytes (&tc->connection, data, offset, max_snd_bytes);
+ session_tx_fifo_peek_bytes (&tc->connection, data, offset, max_snd_bytes);
b->current_length = n_bytes;
ASSERT (n_bytes != 0 && (tcp_timer_is_active (tc, TCP_TIMER_RETRANSMIT)
|| tc->snd_nxt == tc->snd_una_max
@@ -1855,7 +1856,7 @@ tcp_fast_retransmit_sack (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
sb = &tc->sack_sb;
hole = scoreboard_get_hole (sb, sb->cur_rxt_hole);
- max_deq = session_tx_fifo_max_dequeue (&tc->connection);
+ max_deq = transport_max_tx_dequeue (&tc->connection);
max_deq -= tc->snd_una_max - tc->snd_una;
while (snd_space > 0 && n_segs < burst_size)
@@ -1982,7 +1983,7 @@ send_unsent:
if (snd_space < tc->snd_mss || tc->snd_mss == 0)
goto done;
- max_deq = session_tx_fifo_max_dequeue (&tc->connection);
+ max_deq = transport_max_tx_dequeue (&tc->connection);
max_deq -= tc->snd_una_max - tc->snd_una;
if (max_deq)
{
diff --git a/src/vnet/udp/udp_input.c b/src/vnet/udp/udp_input.c
index 1adefab23f4..d720f17cb7e 100644
--- a/src/vnet/udp/udp_input.c
+++ b/src/vnet/udp/udp_input.c
@@ -289,7 +289,7 @@ udp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
- errors = session_manager_flush_all_enqueue_events (TRANSPORT_PROTO_UDP);
+ errors = session_main_flush_all_enqueue_events (TRANSPORT_PROTO_UDP);
udp_input_inc_counter (vm, is_ip4, UDP_ERROR_EVENT_FIFO_FULL, errors);
return frame->n_vectors;
}