summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application.c107
-rw-r--r--src/vnet/session/application.h29
-rw-r--r--src/vnet/session/application_interface.c14
-rw-r--r--src/vnet/session/application_interface.h2
-rw-r--r--src/vnet/session/application_namespace.c2
-rw-r--r--src/vnet/session/application_namespace.h2
-rw-r--r--src/vnet/session/mma_16.h2
-rw-r--r--src/vnet/session/mma_40.h2
-rw-r--r--src/vnet/session/mma_template.c2
-rw-r--r--src/vnet/session/mma_template.h2
-rw-r--r--src/vnet/session/segment_manager.c4
-rw-r--r--src/vnet/session/segment_manager.h2
-rw-r--r--src/vnet/session/session.c163
-rw-r--r--src/vnet/session/session.h116
-rwxr-xr-xsrc/vnet/session/session_api.c80
-rwxr-xr-xsrc/vnet/session/session_cli.c48
-rw-r--r--src/vnet/session/session_debug.h2
-rw-r--r--src/vnet/session/session_lookup.c40
-rw-r--r--src/vnet/session/session_lookup.h39
-rw-r--r--src/vnet/session/session_node.c76
-rw-r--r--src/vnet/session/session_rules_table.c2
-rw-r--r--src/vnet/session/session_rules_table.h2
-rw-r--r--src/vnet/session/session_table.c2
-rw-r--r--src/vnet/session/session_table.h2
-rw-r--r--src/vnet/session/session_types.h (renamed from src/vnet/session/stream_session.h)22
-rw-r--r--src/vnet/session/transport.c2
-rw-r--r--src/vnet/session/transport.h2
-rw-r--r--src/vnet/session/transport_interface.h2
28 files changed, 379 insertions, 391 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 044ab293c7e..268816561a7 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -475,7 +475,7 @@ application_n_workers (application_t * app)
}
app_worker_t *
-application_listener_select_worker (stream_session_t * ls, u8 is_local)
+application_listener_select_worker (session_t * ls, u8 is_local)
{
app_listener_t *app_listener;
application_t *app;
@@ -672,7 +672,7 @@ app_worker_alloc_segment_manager (app_worker_t * app_wrk)
}
int
-app_worker_start_listen (app_worker_t * app_wrk, stream_session_t * ls)
+app_worker_start_listen (app_worker_t * app_wrk, session_t * ls)
{
segment_manager_t *sm;
@@ -686,7 +686,7 @@ app_worker_start_listen (app_worker_t * app_wrk, stream_session_t * ls)
hash_set (app_wrk->listeners_table, listen_session_get_handle (ls),
segment_manager_index (sm));
- if (!ls->server_rx_fifo
+ if (!ls->rx_fifo
&& session_transport_service_type (ls) == TRANSPORT_SERVICE_CL)
{
if (session_alloc_fifos (sm, ls))
@@ -725,7 +725,7 @@ app_worker_stop_listen (app_worker_t * app_wrk, session_handle_t handle)
}
int
-app_worker_own_session (app_worker_t * app_wrk, stream_session_t * s)
+app_worker_own_session (app_worker_t * app_wrk, session_t * s)
{
segment_manager_t *sm;
svm_fifo_t *rxf, *txf;
@@ -761,14 +761,14 @@ app_worker_own_session (app_worker_t * app_wrk, stream_session_t * s)
s->app_wrk_index = app_wrk->wrk_index;
- rxf = s->server_rx_fifo;
- txf = s->server_tx_fifo;
+ rxf = s->rx_fifo;
+ txf = s->tx_fifo;
if (!rxf || !txf)
return 0;
- s->server_rx_fifo = 0;
- s->server_tx_fifo = 0;
+ s->rx_fifo = 0;
+ s->tx_fifo = 0;
sm = app_worker_get_or_alloc_connect_segment_manager (app_wrk);
if (session_alloc_fifos (sm, s))
@@ -776,18 +776,18 @@ app_worker_own_session (app_worker_t * app_wrk, stream_session_t * s)
if (!svm_fifo_is_empty (rxf))
{
- clib_memcpy_fast (s->server_rx_fifo->data, rxf->data, rxf->nitems);
- s->server_rx_fifo->head = rxf->head;
- s->server_rx_fifo->tail = rxf->tail;
- s->server_rx_fifo->cursize = rxf->cursize;
+ clib_memcpy_fast (s->rx_fifo->data, rxf->data, rxf->nitems);
+ s->rx_fifo->head = rxf->head;
+ s->rx_fifo->tail = rxf->tail;
+ s->rx_fifo->cursize = rxf->cursize;
}
if (!svm_fifo_is_empty (txf))
{
- clib_memcpy_fast (s->server_tx_fifo->data, txf->data, txf->nitems);
- s->server_tx_fifo->head = txf->head;
- s->server_tx_fifo->tail = txf->tail;
- s->server_tx_fifo->cursize = txf->cursize;
+ clib_memcpy_fast (s->tx_fifo->data, txf->data, txf->nitems);
+ s->tx_fifo->head = txf->head;
+ s->tx_fifo->tail = txf->tail;
+ s->tx_fifo->cursize = txf->cursize;
}
segment_manager_dealloc_fifos (rxf->segment_index, rxf, txf);
@@ -811,7 +811,7 @@ application_start_listen (application_t * app,
u32 table_index, fib_proto;
session_endpoint_t *sep;
app_worker_t *app_wrk;
- stream_session_t *ls;
+ session_t *ls;
session_handle_t lh;
session_type_t sst;
@@ -889,7 +889,7 @@ application_stop_listen (u32 app_index, u32 app_wrk_index,
session_handle_t handle)
{
app_listener_t *app_listener;
- stream_session_t *listener;
+ session_t *listener;
app_worker_t *app_wrk;
application_t *app;
@@ -970,7 +970,7 @@ app_worker_get_or_alloc_connect_segment_manager (app_worker_t * app_wrk)
segment_manager_t *
app_worker_get_listen_segment_manager (app_worker_t * app,
- stream_session_t * listener)
+ session_t * listener)
{
uword *smp;
smp = hash_get (app->listeners_table, listen_session_get_handle (listener));
@@ -1040,7 +1040,7 @@ segment_manager_t *
application_get_local_segment_manager_w_session (app_worker_t * app,
local_session_t * ls)
{
- stream_session_t *listener;
+ session_t *listener;
if (application_local_session_listener_has_transport (ls))
{
listener = listen_session_get (ls->listener_index);
@@ -1103,11 +1103,11 @@ application_n_listeners (app_worker_t * app)
return hash_elts (app->listeners_table);
}
-stream_session_t *
+session_t *
app_worker_first_listener (app_worker_t * app, u8 fib_proto,
u8 transport_proto)
{
- stream_session_t *listener;
+ session_t *listener;
u64 handle;
u32 sm_index;
u8 sst;
@@ -1133,11 +1133,11 @@ app_worker_application_is_builtin (app_worker_t * app_wrk)
return app_wrk->app_is_builtin;
}
-stream_session_t *
+session_t *
application_proxy_listener (app_worker_t * app, u8 fib_proto,
u8 transport_proto)
{
- stream_session_t *listener;
+ session_t *listener;
u64 handle;
u32 sm_index;
u8 sst;
@@ -1166,7 +1166,7 @@ application_start_stop_proxy_fib_proto (application_t * app, u8 fib_proto,
session_endpoint_cfg_t sep = SESSION_ENDPOINT_CFG_NULL;
transport_connection_t *tc;
app_worker_t *app_wrk;
- stream_session_t *s;
+ session_t *s;
u64 handle;
/* TODO decide if we want proxy to be enabled for all workers */
@@ -1330,7 +1330,7 @@ app_enqueue_evt (svm_msg_q_t * mq, svm_msg_q_msg_t * msg, u8 lock)
}
static inline int
-app_send_io_evt_rx (app_worker_t * app_wrk, stream_session_t * s, u8 lock)
+app_send_io_evt_rx (app_worker_t * app_wrk, session_t * s, u8 lock)
{
session_event_t *evt;
svm_msg_q_msg_t msg;
@@ -1341,7 +1341,7 @@ app_send_io_evt_rx (app_worker_t * app_wrk, stream_session_t * s, u8 lock)
{
/* Session is closed so app will never clean up. Flush rx fifo */
if (s->session_state == SESSION_STATE_CLOSED)
- svm_fifo_dequeue_drop_all (s->server_rx_fifo);
+ svm_fifo_dequeue_drop_all (s->rx_fifo);
return 0;
}
@@ -1351,8 +1351,7 @@ app_send_io_evt_rx (app_worker_t * app_wrk, stream_session_t * s, u8 lock)
return app->cb_fns.builtin_app_rx_callback (s);
}
- if (svm_fifo_has_event (s->server_rx_fifo)
- || svm_fifo_is_empty (s->server_rx_fifo))
+ if (svm_fifo_has_event (s->rx_fifo) || svm_fifo_is_empty (s->rx_fifo))
return 0;
mq = app_wrk->event_queue;
@@ -1371,10 +1370,10 @@ app_send_io_evt_rx (app_worker_t * app_wrk, stream_session_t * s, u8 lock)
ASSERT (!svm_msg_q_msg_is_invalid (&msg));
evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg);
- evt->fifo = s->server_rx_fifo;
+ evt->fifo = s->rx_fifo;
evt->event_type = FIFO_EVENT_APP_RX;
- (void) svm_fifo_set_event (s->server_rx_fifo);
+ (void) svm_fifo_set_event (s->rx_fifo);
if (app_enqueue_evt (mq, &msg, lock))
return -1;
@@ -1382,7 +1381,7 @@ app_send_io_evt_rx (app_worker_t * app_wrk, stream_session_t * s, u8 lock)
}
static inline int
-app_send_io_evt_tx (app_worker_t * app_wrk, stream_session_t * s, u8 lock)
+app_send_io_evt_tx (app_worker_t * app_wrk, session_t * s, u8 lock)
{
svm_msg_q_t *mq;
session_event_t *evt;
@@ -1408,14 +1407,14 @@ app_send_io_evt_tx (app_worker_t * app_wrk, stream_session_t * s, u8 lock)
evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg);
evt->event_type = FIFO_EVENT_APP_TX;
- evt->fifo = s->server_tx_fifo;
+ evt->fifo = s->tx_fifo;
return app_enqueue_evt (mq, &msg, lock);
}
/* *INDENT-OFF* */
typedef int (app_send_evt_handler_fn) (app_worker_t *app,
- stream_session_t *s,
+ session_t *s,
u8 lock);
static app_send_evt_handler_fn * const app_send_evt_handler_fns[3] = {
app_send_io_evt_rx,
@@ -1431,7 +1430,7 @@ static app_send_evt_handler_fn * const app_send_evt_handler_fns[3] = {
* not enough space to enqueue a message, we return.
*/
int
-app_worker_send_event (app_worker_t * app, stream_session_t * s, u8 evt_type)
+app_worker_send_event (app_worker_t * app, session_t * s, u8 evt_type)
{
ASSERT (app && evt_type <= FIFO_EVENT_APP_TX);
return app_send_evt_handler_fns[evt_type] (app, s, 0 /* lock */ );
@@ -1444,7 +1443,7 @@ app_worker_send_event (app_worker_t * app, stream_session_t * s, u8 evt_type)
* we return.
*/
int
-app_worker_lock_and_send_event (app_worker_t * app, stream_session_t * s,
+app_worker_lock_and_send_event (app_worker_t * app, session_t * s,
u8 evt_type)
{
return app_send_evt_handler_fns[evt_type] (app, s, 1 /* lock */ );
@@ -1584,7 +1583,7 @@ application_stop_local_listen (u32 app_index, u32 wrk_map_index,
u32 table_index, ll_index, server_index;
app_listener_t *app_listener;
app_worker_t *server_wrk;
- stream_session_t *sl = 0;
+ session_t *sl = 0;
local_session_t *ll, *ls;
application_t *server;
@@ -1694,7 +1693,7 @@ application_local_session_connect (app_worker_t * client_wrk,
round_tx_fifo_sz = 1 << max_log2 (props->tx_fifo_size);
seg_size = round_rx_fifo_sz + round_tx_fifo_sz + evt_q_sz + margin;
- has_transport = session_has_transport ((stream_session_t *) ll);
+ has_transport = session_has_transport ((session_t *) ll);
if (!has_transport)
{
/* Local sessions don't have backing transport */
@@ -1703,7 +1702,7 @@ application_local_session_connect (app_worker_t * client_wrk,
}
else
{
- stream_session_t *sl = (stream_session_t *) ll;
+ session_t *sl = (session_t *) ll;
transport_connection_t *tc;
tc = listen_session_get_transport (sl);
ls->port = tc->lcl_port;
@@ -1727,8 +1726,7 @@ application_local_session_connect (app_worker_t * client_wrk,
ls->client_evt_q = pointer_to_uword (cq);
rv = segment_manager_try_alloc_fifos (seg, props->rx_fifo_size,
props->tx_fifo_size,
- &ls->server_rx_fifo,
- &ls->server_tx_fifo);
+ &ls->rx_fifo, &ls->tx_fifo);
if (rv)
{
clib_warning ("failed to add fifos in cut-through segment");
@@ -1736,12 +1734,12 @@ application_local_session_connect (app_worker_t * client_wrk,
goto failed;
}
sm_index = segment_manager_index (sm);
- ls->server_rx_fifo->ct_session_index = ls->session_index;
- ls->server_tx_fifo->ct_session_index = ls->session_index;
- ls->server_rx_fifo->segment_manager = sm_index;
- ls->server_tx_fifo->segment_manager = sm_index;
- ls->server_rx_fifo->segment_index = seg_index;
- ls->server_tx_fifo->segment_index = seg_index;
+ ls->rx_fifo->ct_session_index = ls->session_index;
+ ls->tx_fifo->ct_session_index = ls->session_index;
+ ls->rx_fifo->segment_manager = sm_index;
+ ls->tx_fifo->segment_manager = sm_index;
+ ls->rx_fifo->segment_index = seg_index;
+ ls->tx_fifo->segment_index = seg_index;
ls->svm_segment_index = seg_index;
ls->listener_index = ll->session_index;
ls->client_wrk_index = client_wrk->wrk_index;
@@ -1758,7 +1756,7 @@ application_local_session_connect (app_worker_t * client_wrk,
goto failed;
}
segment_manager_segment_reader_unlock (sm);
- if ((rv = server->cb_fns.session_accept_callback ((stream_session_t *) ls)))
+ if ((rv = server->cb_fns.session_accept_callback ((session_t *) ls)))
{
clib_warning ("failed to send accept cut-through notify to server");
goto failed;
@@ -1822,8 +1820,7 @@ application_local_session_connect_notify (local_session_t * ls)
client->cb_fns.session_connected_callback (client_wrk->wrk_index,
ls->client_opaque,
- (stream_session_t *) ls,
- is_fail);
+ (session_t *) ls, is_fail);
client_key = application_client_local_connect_key (ls);
hash_set (client_wrk->local_connects, client_key, client_key);
@@ -1836,7 +1833,7 @@ application_local_session_cleanup (app_worker_t * client_wrk,
local_session_t * ls)
{
svm_fifo_segment_private_t *seg;
- stream_session_t *listener;
+ session_t *listener;
segment_manager_t *sm;
u64 client_key;
u8 has_transport;
@@ -1924,7 +1921,7 @@ application_local_session_disconnect (u32 app_index, local_session_t * ls)
application_t *client = application_get (client_wrk->app_index);
client->cb_fns.session_connected_callback (client_wrk->wrk_index,
ls->client_opaque,
- (stream_session_t *) ls,
+ (session_t *) ls,
1 /* is_fail */ );
ls->session_state = SESSION_STATE_CLOSED;
return application_local_session_cleanup (client_wrk, server_wrk,
@@ -2032,7 +2029,7 @@ format_app_worker_listener (u8 * s, va_list * args)
u64 handle = va_arg (*args, u64);
u32 sm_index = va_arg (*args, u32);
int verbose = va_arg (*args, int);
- stream_session_t *listener;
+ session_t *listener;
const u8 *app_name;
u8 *str;
@@ -2130,7 +2127,7 @@ app_worker_format_connects (app_worker_t * app_wrk, int verbose)
while (fifo)
{
u32 session_index, thread_index;
- stream_session_t *session;
+ session_t *session;
session_index = fifo->master_session_index;
thread_index = fifo->master_thread_index;
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index 1d2064df62e..0f8dbe3909b 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -37,23 +37,23 @@ typedef struct _stream_session_cb_vft
int (*del_segment_callback) (u32 api_client_index, u64 segment_handle);
/** Notify server of newly accepted session */
- int (*session_accept_callback) (stream_session_t * new_session);
+ int (*session_accept_callback) (session_t * new_session);
/** Connection request callback */
int (*session_connected_callback) (u32 app_wrk_index, u32 opaque,
- stream_session_t * s, u8 code);
+ session_t * s, u8 code);
/** Notify app that session is closing */
- void (*session_disconnect_callback) (stream_session_t * s);
+ void (*session_disconnect_callback) (session_t * s);
/** Notify app that session was reset */
- void (*session_reset_callback) (stream_session_t * s);
+ void (*session_reset_callback) (session_t * s);
/** Direct RX callback for built-in application */
- int (*builtin_app_rx_callback) (stream_session_t * session);
+ int (*builtin_app_rx_callback) (session_t * session);
/** Direct TX callback for built-in application */
- int (*builtin_app_tx_callback) (stream_session_t * session);
+ int (*builtin_app_tx_callback) (session_t * session);
} session_cb_vft_t;
@@ -225,24 +225,23 @@ int app_worker_alloc_and_init (application_t * app, app_worker_t ** wrk);
app_worker_t *app_worker_get (u32 wrk_index);
app_worker_t *app_worker_get_if_valid (u32 wrk_index);
application_t *app_worker_get_app (u32 wrk_index);
-int app_worker_own_session (app_worker_t * app_wrk, stream_session_t * s);
+int app_worker_own_session (app_worker_t * app_wrk, session_t * s);
void app_worker_free (app_worker_t * app_wrk);
int app_worker_open_session (app_worker_t * app, session_endpoint_t * tep,
u32 api_context);
segment_manager_t *app_worker_get_listen_segment_manager (app_worker_t *,
- stream_session_t *);
+ session_t *);
segment_manager_t *app_worker_get_connect_segment_manager (app_worker_t *);
segment_manager_t
* app_worker_get_or_alloc_connect_segment_manager (app_worker_t *);
int app_worker_alloc_connects_segment_manager (app_worker_t * app);
int app_worker_add_segment_notify (u32 app_or_wrk, u64 segment_handle);
u32 app_worker_n_listeners (app_worker_t * app);
-stream_session_t *app_worker_first_listener (app_worker_t * app,
- u8 fib_proto,
- u8 transport_proto);
+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, stream_session_t * s, u8 evt);
-int app_worker_lock_and_send_event (app_worker_t * app, stream_session_t * s,
+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);
clib_error_t *vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a);
@@ -262,7 +261,7 @@ application_t *application_lookup (u32 api_client_index);
application_t *application_lookup_name (const u8 * name);
app_worker_t *application_get_worker (application_t * app, u32 wrk_index);
app_worker_t *application_get_default_worker (application_t * app);
-app_worker_t *application_listener_select_worker (stream_session_t * ls,
+app_worker_t *application_listener_select_worker (session_t * ls,
u8 is_local);
int application_is_proxy (application_t * app);
diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c
index c3c84fd8da9..0245f58d3b1 100644
--- a/src/vnet/session/application_interface.c
+++ b/src/vnet/session/application_interface.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Copyright (c) 2016-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -120,7 +120,7 @@ int
api_parse_session_handle (u64 handle, u32 * session_index, u32 * thread_index)
{
session_manager_main_t *smm = vnet_get_session_manager_main ();
- stream_session_t *pool;
+ session_t *pool;
*thread_index = handle & 0xFFFFFFFF;
*session_index = handle >> 32;
@@ -245,7 +245,7 @@ vnet_bind_inline (vnet_bind_args_t * a)
if (ll_handle != SESSION_INVALID_HANDLE)
{
local_session_t *ll;
- stream_session_t *tl;
+ session_t *tl;
ll = application_get_local_listener_w_handle (ll_handle);
tl = listen_session_get_from_handle (a->handle);
if (ll->transport_listener_index == ~0)
@@ -287,7 +287,7 @@ application_connect (vnet_connect_args_t * a)
{
app_worker_t *server_wrk, *client_wrk;
u32 table_index, server_index, li;
- stream_session_t *listener;
+ session_t *listener;
application_t *client, *server;
local_session_t *ll;
u8 fib_proto;
@@ -326,7 +326,7 @@ application_connect (vnet_connect_args_t * a)
{
server = application_get (server_index);
ll = application_get_local_listen_session (server, li);
- listener = (stream_session_t *) ll;
+ listener = (session_t *) ll;
server_wrk = application_listener_select_worker (listener,
1 /* is_local */ );
return application_local_session_connect (client_wrk,
@@ -603,7 +603,7 @@ int
vnet_unbind_uri (vnet_unbind_args_t * a)
{
session_endpoint_cfg_t sep = SESSION_ENDPOINT_CFG_NULL;
- stream_session_t *listener;
+ session_t *listener;
u32 table_index;
int rv;
@@ -657,7 +657,7 @@ vnet_disconnect_session (vnet_disconnect_args_t * a)
else
{
app_worker_t *app_wrk;
- stream_session_t *s;
+ session_t *s;
s = session_get_from_handle_if_valid (a->handle);
if (!s)
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index 9c48faa8abc..8ecb0050592 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Copyright (c) 2016-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/application_namespace.c b/src/vnet/session/application_namespace.c
index 1896a723115..9fbca26000b 100644
--- a/src/vnet/session/application_namespace.c
+++ b/src/vnet/session/application_namespace.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/application_namespace.h b/src/vnet/session/application_namespace.h
index 6eb9d53c864..8ba5a9878a8 100644
--- a/src/vnet/session/application_namespace.h
+++ b/src/vnet/session/application_namespace.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/mma_16.h b/src/vnet/session/mma_16.h
index 3e2e84d4a8b..3bd712d05b8 100644
--- a/src/vnet/session/mma_16.h
+++ b/src/vnet/session/mma_16.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/mma_40.h b/src/vnet/session/mma_40.h
index 773b7f08cca..2857fd445fe 100644
--- a/src/vnet/session/mma_40.h
+++ b/src/vnet/session/mma_40.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/mma_template.c b/src/vnet/session/mma_template.c
index 9dd7c76cb06..e66f2919720 100644
--- a/src/vnet/session/mma_template.c
+++ b/src/vnet/session/mma_template.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/mma_template.h b/src/vnet/session/mma_template.h
index fd5e3ea5717..dc3545a4ffe 100644
--- a/src/vnet/session/mma_template.h
+++ b/src/vnet/session/mma_template.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index a0d9a0959a5..a4438c7aeea 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -379,7 +379,7 @@ void
segment_manager_del_sessions (segment_manager_t * sm)
{
svm_fifo_segment_private_t *fifo_segment;
- stream_session_t *session;
+ session_t *session;
svm_fifo_t *fifo;
ASSERT (pool_elts (sm->segments) != 0);
diff --git a/src/vnet/session/segment_manager.h b/src/vnet/session/segment_manager.h
index 657a1fcc231..15fd067053f 100644
--- a/src/vnet/session/segment_manager.h
+++ b/src/vnet/session/segment_manager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index efd1d73c4a0..520d329f742 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -72,7 +72,7 @@ session_send_evt_to_thread (void *data, void *args, u32 thread_index,
break;
case FIFO_EVENT_BUILTIN_TX:
case FIFO_EVENT_DISCONNECT:
- evt->session_handle = session_handle ((stream_session_t *) data);
+ evt->session_handle = session_handle ((session_t *) data);
break;
default:
clib_warning ("evt unhandled!");
@@ -98,8 +98,7 @@ session_send_io_evt_to_thread_custom (void *data, u32 thread_index,
}
int
-session_send_ctrl_evt_to_thread (stream_session_t * s,
- session_evt_type_t evt_type)
+session_send_ctrl_evt_to_thread (session_t * s, session_evt_type_t evt_type)
{
/* only event supported for now is disconnect */
ASSERT (evt_type == FIFO_EVENT_DISCONNECT);
@@ -120,7 +119,7 @@ session_send_rpc_evt_to_thread (u32 thread_index, void *fp, void *rpc_args)
}
static void
-session_program_transport_close (stream_session_t * s)
+session_program_transport_close (session_t * s)
{
u32 thread_index = vlib_get_thread_index ();
session_manager_worker_t *wrk;
@@ -140,11 +139,11 @@ session_program_transport_close (stream_session_t * s)
session_send_ctrl_evt_to_thread (s, FIFO_EVENT_DISCONNECT);
}
-stream_session_t *
+session_t *
session_alloc (u32 thread_index)
{
session_manager_worker_t *wrk = &session_manager_main.wrk[thread_index];
- stream_session_t *s;
+ session_t *s;
u8 will_expand = 0;
pool_get_aligned_will_expand (wrk->sessions, will_expand,
CLIB_CACHE_LINE_BYTES);
@@ -166,7 +165,7 @@ session_alloc (u32 thread_index)
}
void
-session_free (stream_session_t * s)
+session_free (session_t * s)
{
pool_put (session_manager_main.wrk[s->thread_index].sessions, s);
if (CLIB_DEBUG)
@@ -174,10 +173,10 @@ session_free (stream_session_t * s)
}
void
-session_free_w_fifos (stream_session_t * s)
+session_free_w_fifos (session_t * s)
{
- segment_manager_dealloc_fifos (s->svm_segment_index, s->server_rx_fifo,
- s->server_tx_fifo);
+ segment_manager_dealloc_fifos (s->svm_segment_index, s->rx_fifo,
+ s->tx_fifo);
session_free (s);
}
@@ -187,7 +186,7 @@ session_free_w_fifos (stream_session_t * s)
* Transport connection must still be valid.
*/
static void
-session_delete (stream_session_t * s)
+session_delete (session_t * s)
{
int rv;
@@ -199,7 +198,7 @@ session_delete (stream_session_t * s)
}
int
-session_alloc_fifos (segment_manager_t * sm, stream_session_t * s)
+session_alloc_fifos (segment_manager_t * sm, session_t * s)
{
svm_fifo_t *server_rx_fifo = 0, *server_tx_fifo = 0;
u32 fifo_segment_index;
@@ -216,16 +215,16 @@ session_alloc_fifos (segment_manager_t * sm, stream_session_t * s)
server_tx_fifo->master_session_index = s->session_index;
server_tx_fifo->master_thread_index = s->thread_index;
- s->server_rx_fifo = server_rx_fifo;
- s->server_tx_fifo = server_tx_fifo;
+ s->rx_fifo = server_rx_fifo;
+ s->tx_fifo = server_tx_fifo;
s->svm_segment_index = fifo_segment_index;
return 0;
}
-static stream_session_t *
+static session_t *
session_alloc_for_connection (transport_connection_t * tc)
{
- stream_session_t *s;
+ session_t *s;
u32 thread_index = tc->thread_index;
ASSERT (thread_index == vlib_get_thread_index ()
@@ -244,9 +243,9 @@ session_alloc_for_connection (transport_connection_t * tc)
static int
session_alloc_and_init (segment_manager_t * sm, transport_connection_t * tc,
- u8 alloc_fifos, stream_session_t ** ret_s)
+ u8 alloc_fifos, session_t ** ret_s)
{
- stream_session_t *s;
+ session_t *s;
int rv;
s = session_alloc_for_connection (tc);
@@ -301,7 +300,7 @@ session_enqueue_discard_chain_bytes (vlib_main_t * vm, vlib_buffer_t * b,
* Enqueue buffer chain tail
*/
always_inline int
-session_enqueue_chain_tail (stream_session_t * s, vlib_buffer_t * b,
+session_enqueue_chain_tail (session_t * s, vlib_buffer_t * b,
u32 offset, u8 is_in_order)
{
vlib_buffer_t *chain_b;
@@ -332,7 +331,7 @@ session_enqueue_chain_tail (stream_session_t * s, vlib_buffer_t * b,
continue;
if (is_in_order)
{
- rv = svm_fifo_enqueue_nowait (s->server_rx_fifo, len, data);
+ rv = svm_fifo_enqueue_nowait (s->rx_fifo, len, data);
if (rv == len)
{
written += rv;
@@ -355,8 +354,7 @@ session_enqueue_chain_tail (stream_session_t * s, vlib_buffer_t * b,
}
else
{
- rv = svm_fifo_enqueue_with_offset (s->server_rx_fifo, offset, len,
- data);
+ rv = svm_fifo_enqueue_with_offset (s->rx_fifo, offset, len, data);
if (rv)
{
clib_warning ("failed to enqueue multi-buffer seg");
@@ -393,14 +391,14 @@ session_enqueue_stream_connection (transport_connection_t * tc,
vlib_buffer_t * b, u32 offset,
u8 queue_event, u8 is_in_order)
{
- stream_session_t *s;
+ session_t *s;
int enqueued = 0, rv, in_order_off;
s = session_get (tc->s_index, tc->thread_index);
if (is_in_order)
{
- enqueued = svm_fifo_enqueue_nowait (s->server_rx_fifo,
+ enqueued = svm_fifo_enqueue_nowait (s->rx_fifo,
b->current_length,
vlib_buffer_get_current (b));
if (PREDICT_FALSE ((b->flags & VLIB_BUFFER_NEXT_PRESENT)
@@ -414,7 +412,7 @@ session_enqueue_stream_connection (transport_connection_t * tc,
}
else
{
- rv = svm_fifo_enqueue_with_offset (s->server_rx_fifo, offset,
+ rv = svm_fifo_enqueue_with_offset (s->rx_fifo, offset,
b->current_length,
vlib_buffer_get_current (b));
if (PREDICT_FALSE ((b->flags & VLIB_BUFFER_NEXT_PRESENT) && !rv))
@@ -442,18 +440,18 @@ session_enqueue_stream_connection (transport_connection_t * tc,
}
int
-session_enqueue_dgram_connection (stream_session_t * s,
+session_enqueue_dgram_connection (session_t * s,
session_dgram_hdr_t * hdr,
vlib_buffer_t * b, u8 proto, u8 queue_event)
{
int enqueued = 0, rv, in_order_off;
- ASSERT (svm_fifo_max_enqueue (s->server_rx_fifo)
+ ASSERT (svm_fifo_max_enqueue (s->rx_fifo)
>= b->current_length + sizeof (*hdr));
- svm_fifo_enqueue_nowait (s->server_rx_fifo, sizeof (session_dgram_hdr_t),
+ svm_fifo_enqueue_nowait (s->rx_fifo, sizeof (session_dgram_hdr_t),
(u8 *) hdr);
- enqueued = svm_fifo_enqueue_nowait (s->server_rx_fifo, b->current_length,
+ enqueued = svm_fifo_enqueue_nowait (s->rx_fifo, b->current_length,
vlib_buffer_get_current (b));
if (PREDICT_FALSE ((b->flags & VLIB_BUFFER_NEXT_PRESENT) && enqueued >= 0))
{
@@ -483,12 +481,12 @@ u8
stream_session_no_space (transport_connection_t * tc, u32 thread_index,
u16 data_len)
{
- stream_session_t *s = session_get (tc->s_index, thread_index);
+ 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->server_rx_fifo))
+ if (data_len > svm_fifo_max_enqueue (s->rx_fifo))
return 1;
return 0;
@@ -497,29 +495,29 @@ stream_session_no_space (transport_connection_t * tc, u32 thread_index,
u32
session_tx_fifo_max_dequeue (transport_connection_t * tc)
{
- stream_session_t *s = session_get (tc->s_index, tc->thread_index);
- if (!s->server_tx_fifo)
+ session_t *s = session_get (tc->s_index, tc->thread_index);
+ if (!s->tx_fifo)
return 0;
- return svm_fifo_max_dequeue (s->server_tx_fifo);
+ return svm_fifo_max_dequeue (s->tx_fifo);
}
int
stream_session_peek_bytes (transport_connection_t * tc, u8 * buffer,
u32 offset, u32 max_bytes)
{
- stream_session_t *s = session_get (tc->s_index, tc->thread_index);
- return svm_fifo_peek (s->server_tx_fifo, offset, max_bytes, buffer);
+ session_t *s = session_get (tc->s_index, tc->thread_index);
+ return svm_fifo_peek (s->tx_fifo, offset, max_bytes, buffer);
}
u32
stream_session_dequeue_drop (transport_connection_t * tc, u32 max_bytes)
{
- stream_session_t *s = session_get (tc->s_index, tc->thread_index);
- return svm_fifo_dequeue_drop (s->server_tx_fifo, max_bytes);
+ session_t *s = session_get (tc->s_index, tc->thread_index);
+ return svm_fifo_dequeue_drop (s->tx_fifo, max_bytes);
}
static inline int
-session_notify_subscribers (u32 app_index, stream_session_t * s,
+session_notify_subscribers (u32 app_index, session_t * s,
svm_fifo_t * f, session_evt_type_t evt_type)
{
app_worker_t *app_wrk;
@@ -551,7 +549,7 @@ session_notify_subscribers (u32 app_index, stream_session_t * s,
* @return 0 on success or negative number if failed to send notification.
*/
static inline int
-session_enqueue_notify (stream_session_t * s)
+session_enqueue_notify (session_t * s)
{
app_worker_t *app_wrk;
@@ -565,7 +563,7 @@ session_enqueue_notify (stream_session_t * s)
/* *INDENT-OFF* */
SESSION_EVT_DBG(SESSION_EVT_ENQ, s, ({
ed->data[0] = FIFO_EVENT_APP_RX;
- ed->data[1] = svm_fifo_max_dequeue (s->server_rx_fifo);
+ ed->data[1] = svm_fifo_max_dequeue (s->rx_fifo);
}));
/* *INDENT-ON* */
@@ -573,15 +571,15 @@ session_enqueue_notify (stream_session_t * s)
FIFO_EVENT_APP_RX)))
return -1;
- if (PREDICT_FALSE (svm_fifo_n_subscribers (s->server_rx_fifo)))
+ if (PREDICT_FALSE (svm_fifo_n_subscribers (s->rx_fifo)))
return session_notify_subscribers (app_wrk->app_index, s,
- s->server_rx_fifo, FIFO_EVENT_APP_RX);
+ s->rx_fifo, FIFO_EVENT_APP_RX);
return 0;
}
int
-session_dequeue_notify (stream_session_t * s)
+session_dequeue_notify (session_t * s)
{
app_worker_t *app_wrk;
@@ -593,11 +591,11 @@ session_dequeue_notify (stream_session_t * s)
FIFO_EVENT_APP_TX)))
return -1;
- if (PREDICT_FALSE (s->server_tx_fifo->n_subscribers))
+ if (PREDICT_FALSE (s->tx_fifo->n_subscribers))
return session_notify_subscribers (app_wrk->app_index, s,
- s->server_tx_fifo, FIFO_EVENT_APP_TX);
+ s->tx_fifo, FIFO_EVENT_APP_TX);
- svm_fifo_clear_tx_ntf (s->server_tx_fifo);
+ svm_fifo_clear_tx_ntf (s->tx_fifo);
return 0;
}
@@ -614,7 +612,7 @@ int
session_manager_flush_enqueue_events (u8 transport_proto, u32 thread_index)
{
session_manager_worker_t *wrk = session_manager_get_worker (thread_index);
- stream_session_t *s;
+ session_t *s;
int i, errors = 0;
u32 *indices;
@@ -658,17 +656,17 @@ void
stream_session_init_fifos_pointers (transport_connection_t * tc,
u32 rx_pointer, u32 tx_pointer)
{
- stream_session_t *s;
+ session_t *s;
s = session_get (tc->s_index, tc->thread_index);
- svm_fifo_init_pointers (s->server_rx_fifo, rx_pointer);
- svm_fifo_init_pointers (s->server_tx_fifo, tx_pointer);
+ 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)
{
u32 opaque = 0, new_ti, new_si;
- stream_session_t *new_s = 0;
+ session_t *new_s = 0;
segment_manager_t *sm;
app_worker_t *app_wrk;
application_t *app;
@@ -755,11 +753,11 @@ session_switch_pool (void *cb_args)
{
session_switch_pool_args_t *args = (session_switch_pool_args_t *) cb_args;
transport_proto_t tp;
- stream_session_t *s;
+ session_t *s;
ASSERT (args->thread_index == vlib_get_thread_index ());
s = session_get (args->session_index, args->thread_index);
- s->server_tx_fifo->master_session_index = args->new_session_index;
- s->server_tx_fifo->master_thread_index = args->new_thread_index;
+ s->tx_fifo->master_session_index = args->new_session_index;
+ s->tx_fifo->master_thread_index = args->new_thread_index;
tp = session_get_transport_proto (s);
tp_vfts[tp].cleanup (s->connection_index, s->thread_index);
session_free (s);
@@ -771,10 +769,9 @@ session_switch_pool (void *cb_args)
*/
int
session_dgram_connect_notify (transport_connection_t * tc,
- u32 old_thread_index,
- stream_session_t ** new_session)
+ u32 old_thread_index, session_t ** new_session)
{
- stream_session_t *new_s;
+ session_t *new_s;
session_switch_pool_args_t *rpc_args;
/*
@@ -782,8 +779,8 @@ session_dgram_connect_notify (transport_connection_t * tc,
*/
new_s = session_clone_safe (tc->s_index, old_thread_index);
new_s->connection_index = tc->c_index;
- new_s->server_rx_fifo->master_session_index = new_s->session_index;
- new_s->server_rx_fifo->master_thread_index = new_s->thread_index;
+ new_s->rx_fifo->master_session_index = new_s->session_index;
+ new_s->rx_fifo->master_thread_index = new_s->thread_index;
new_s->session_state = SESSION_STATE_READY;
session_lookup_add_connection (tc, session_handle (new_s));
@@ -810,7 +807,7 @@ stream_session_accept_notify (transport_connection_t * tc)
{
app_worker_t *app_wrk;
application_t *app;
- stream_session_t *s;
+ session_t *s;
s = session_get (tc->s_index, tc->thread_index);
app_wrk = app_worker_get_if_valid (s->app_wrk_index);
@@ -833,7 +830,7 @@ session_transport_closing_notify (transport_connection_t * tc)
{
app_worker_t *app_wrk;
application_t *app;
- stream_session_t *s;
+ session_t *s;
s = session_get (tc->s_index, tc->thread_index);
if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSING)
@@ -857,14 +854,14 @@ session_transport_closing_notify (transport_connection_t * tc)
void
session_transport_delete_notify (transport_connection_t * tc)
{
- stream_session_t *s;
+ session_t *s;
/* App might've been removed already */
if (!(s = session_get_if_valid (tc->s_index, tc->thread_index)))
return;
/* Make sure we don't try to send anything more */
- svm_fifo_dequeue_drop_all (s->server_tx_fifo);
+ svm_fifo_dequeue_drop_all (s->tx_fifo);
switch (s->session_state)
{
@@ -912,7 +909,7 @@ session_transport_delete_notify (transport_connection_t * tc)
void
session_transport_closed_notify (transport_connection_t * tc)
{
- stream_session_t *s;
+ session_t *s;
if (!(s = session_get_if_valid (tc->s_index, tc->thread_index)))
return;
@@ -934,11 +931,11 @@ session_transport_closed_notify (transport_connection_t * tc)
void
session_transport_reset_notify (transport_connection_t * tc)
{
- stream_session_t *s;
+ session_t *s;
app_worker_t *app_wrk;
application_t *app;
s = session_get (tc->s_index, tc->thread_index);
- svm_fifo_dequeue_drop_all (s->server_tx_fifo);
+ svm_fifo_dequeue_drop_all (s->tx_fifo);
if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSING)
return;
s->session_state = SESSION_STATE_TRANSPORT_CLOSING;
@@ -954,7 +951,7 @@ int
stream_session_accept (transport_connection_t * tc, u32 listener_index,
u8 notify)
{
- stream_session_t *s, *listener;
+ session_t *s, *listener;
app_worker_t *app_wrk;
segment_manager_t *sm;
int rv;
@@ -987,7 +984,7 @@ session_open_cl (u32 app_wrk_index, session_endpoint_t * rmt, u32 opaque)
transport_endpoint_cfg_t *tep;
segment_manager_t *sm;
app_worker_t *app_wrk;
- stream_session_t *s;
+ session_t *s;
application_t *app;
int rv;
@@ -1104,7 +1101,7 @@ session_open (u32 app_wrk_index, session_endpoint_t * rmt, u32 opaque)
* @param sep Local endpoint to be listened on.
*/
int
-session_listen (stream_session_t * ls, session_endpoint_cfg_t * sep)
+session_listen (session_t * ls, session_endpoint_cfg_t * sep)
{
transport_connection_t *tc;
transport_endpoint_t *tep;
@@ -1134,7 +1131,7 @@ session_listen (stream_session_t * ls, session_endpoint_cfg_t * sep)
* @param s Session to stop listening on. It must be in state LISTENING.
*/
int
-session_stop_listen (stream_session_t * s)
+session_stop_listen (session_t * s)
{
transport_proto_t tp = session_get_transport_proto (s);
transport_connection_t *tc;
@@ -1163,7 +1160,7 @@ session_stop_listen (stream_session_t * s)
* requests are served before transport is notified.
*/
void
-session_close (stream_session_t * s)
+session_close (session_t * s)
{
if (!s)
return;
@@ -1177,7 +1174,7 @@ session_close (stream_session_t * s)
/* Session already closed. Clear the tx fifo */
if (s->session_state == SESSION_STATE_CLOSED)
- svm_fifo_dequeue_drop_all (s->server_tx_fifo);
+ svm_fifo_dequeue_drop_all (s->tx_fifo);
return;
}
@@ -1193,7 +1190,7 @@ session_close (stream_session_t * s)
* Must be called from the session's thread.
*/
void
-session_transport_close (stream_session_t * s)
+session_transport_close (session_t * s)
{
/* If transport is already closed, just free the session */
if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSED)
@@ -1208,7 +1205,7 @@ session_transport_close (stream_session_t * s)
* point, either after sending everything or after a timeout, call delete
* notify. This will finally lead to the complete cleanup of the session.
*/
- if (svm_fifo_max_dequeue (s->server_tx_fifo))
+ if (svm_fifo_max_dequeue (s->tx_fifo))
s->session_state = SESSION_STATE_CLOSED_WAITING;
else
s->session_state = SESSION_STATE_CLOSED;
@@ -1225,7 +1222,7 @@ session_transport_close (stream_session_t * s)
* closed.
*/
void
-session_transport_cleanup (stream_session_t * s)
+session_transport_cleanup (session_t * s)
{
s->session_state = SESSION_STATE_CLOSED;
@@ -1239,7 +1236,7 @@ session_transport_cleanup (stream_session_t * s)
}
transport_service_type_t
-session_transport_service_type (stream_session_t * s)
+session_transport_service_type (session_t * s)
{
transport_proto_t tp;
tp = session_get_transport_proto (s);
@@ -1247,7 +1244,7 @@ session_transport_service_type (stream_session_t * s)
}
transport_tx_fn_type_t
-session_transport_tx_fn_type (stream_session_t * s)
+session_transport_tx_fn_type (session_t * s)
{
transport_proto_t tp;
tp = session_get_transport_proto (s);
@@ -1255,7 +1252,7 @@ session_transport_tx_fn_type (stream_session_t * s)
}
u8
-session_tx_is_dgram (stream_session_t * s)
+session_tx_is_dgram (session_t * s)
{
return (session_transport_tx_fn_type (s) == TRANSPORT_TX_DGRAM);
}
@@ -1386,7 +1383,7 @@ session_register_transport (transport_proto_t transport_proto,
}
transport_connection_t *
-session_get_transport (stream_session_t * s)
+session_get_transport (session_t * s)
{
transport_proto_t tp;
if (s->session_state != SESSION_STATE_LISTENING)
@@ -1399,14 +1396,14 @@ session_get_transport (stream_session_t * s)
}
transport_connection_t *
-listen_session_get_transport (stream_session_t * s)
+listen_session_get_transport (session_t * s)
{
transport_proto_t tp = session_get_transport_proto (s);
return tp_vfts[tp].get_listener (s->connection_index);
}
int
-listen_session_get_local_session_endpoint (stream_session_t * listener,
+listen_session_get_local_session_endpoint (session_t * listener,
session_endpoint_t * sep)
{
transport_proto_t tp = session_get_transport_proto (listener);
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index babb002e07e..6ae901c656b 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -15,15 +15,13 @@
#ifndef __included_session_h__
#define __included_session_h__
-#include <vnet/session/stream_session.h>
+#include <vnet/session/session_types.h>
#include <vnet/session/session_lookup.h>
#include <vnet/session/transport_interface.h>
#include <vnet/session/session_debug.h>
#include <vnet/session/segment_manager.h>
-#include <svm/queue.h>
+#include <svm/message_queue.h>
-#define HALF_OPEN_LOOKUP_INVALID_VALUE ((u64)~0)
-#define INVALID_INDEX ((u32)~0)
#define SESSION_PROXY_LISTENER_INDEX ((u8)~0 - 1)
#define SESSION_LOCAL_HANDLE_PREFIX 0x7FFFFFFF
@@ -158,7 +156,7 @@ STATIC_ASSERT (sizeof (session_dgram_hdr_t) == (SESSION_CONN_ID_LEN + 8),
typedef struct session_tx_context_
{
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
- stream_session_t *s;
+ session_t *s;
transport_proto_vft_t *transport_vft;
transport_connection_t *tc;
vlib_buffer_t *b;
@@ -181,7 +179,7 @@ typedef struct session_manager_worker_
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
/** Worker session pool */
- stream_session_t *sessions;
+ session_t *sessions;
/** vpp event message queue for worker */
svm_msg_q_t *vpp_event_queue;
@@ -321,7 +319,7 @@ session_manager_get_worker (u32 thread_index)
always_inline u8
stream_session_is_valid (u32 si, u8 thread_index)
{
- stream_session_t *s;
+ 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
@@ -332,12 +330,12 @@ stream_session_is_valid (u32 si, u8 thread_index)
return 1;
}
-stream_session_t *session_alloc (u32 thread_index);
-int session_alloc_fifos (segment_manager_t * sm, stream_session_t * s);
-void session_free (stream_session_t * s);
-void session_free_w_fifos (stream_session_t * s);
+session_t *session_alloc (u32 thread_index);
+int session_alloc_fifos (segment_manager_t * sm, session_t * s);
+void session_free (session_t * s);
+void session_free_w_fifos (session_t * s);
-always_inline stream_session_t *
+always_inline session_t *
session_get (u32 si, u32 thread_index)
{
ASSERT (stream_session_is_valid (si, thread_index));
@@ -345,7 +343,7 @@ session_get (u32 si, u32 thread_index)
si);
}
-always_inline stream_session_t *
+always_inline session_t *
session_get_if_valid (u64 si, u32 thread_index)
{
if (thread_index >= vec_len (session_manager_main.wrk))
@@ -361,7 +359,7 @@ session_get_if_valid (u64 si, u32 thread_index)
}
always_inline session_handle_t
-session_handle (stream_session_t * s)
+session_handle (session_t * s)
{
return ((u64) s->thread_index << 32) | (u64) s->session_index;
}
@@ -386,7 +384,7 @@ session_parse_handle (session_handle_t handle, u32 * index,
*thread_index = session_thread_from_handle (handle);
}
-always_inline stream_session_t *
+always_inline session_t *
session_get_from_handle (session_handle_t handle)
{
session_manager_main_t *smm = &session_manager_main;
@@ -395,7 +393,7 @@ session_get_from_handle (session_handle_t handle)
return pool_elt_at_index (smm->wrk[thread_index].sessions, session_index);
}
-always_inline stream_session_t *
+always_inline session_t *
session_get_from_handle_if_valid (session_handle_t handle)
{
u32 session_index, thread_index;
@@ -424,13 +422,13 @@ session_type_is_ip4 (session_type_t st)
}
always_inline transport_proto_t
-session_get_transport_proto (stream_session_t * s)
+session_get_transport_proto (session_t * s)
{
return (s->session_type >> 1);
}
always_inline fib_protocol_t
-session_get_fib_proto (stream_session_t * s)
+session_get_fib_proto (session_t * s)
{
u8 is_ip4 = s->session_type & 1;
return (is_ip4 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
@@ -443,27 +441,27 @@ session_type_from_proto_and_ip (transport_proto_t proto, u8 is_ip4)
}
always_inline u64
-session_segment_handle (stream_session_t * s)
+session_segment_handle (session_t * s)
{
svm_fifo_t *f;
if (s->session_state == SESSION_STATE_LISTENING)
return SESSION_INVALID_HANDLE;
- f = s->server_rx_fifo;
+ f = s->rx_fifo;
return segment_manager_make_segment_handle (f->segment_manager,
f->segment_index);
}
always_inline u8
-session_has_transport (stream_session_t * s)
+session_has_transport (session_t * s)
{
return (session_get_transport_proto (s) != TRANSPORT_PROTO_NONE);
}
-transport_service_type_t session_transport_service_type (stream_session_t *);
-transport_tx_fn_type_t session_transport_tx_fn_type (stream_session_t *);
-u8 session_tx_is_dgram (stream_session_t * s);
+transport_service_type_t session_transport_service_type (session_t *);
+transport_tx_fn_type_t session_transport_tx_fn_type (session_t *);
+u8 session_tx_is_dgram (session_t * s);
/**
* Acquires a lock that blocks a session pool from expanding.
@@ -498,7 +496,7 @@ session_pool_remove_peeker (u32 thread_index)
*
* Caller should drop the peek 'lock' as soon as possible.
*/
-always_inline stream_session_t *
+always_inline session_t *
session_get_from_handle_safe (u64 handle)
{
u32 thread_index = session_thread_from_handle (handle);
@@ -520,36 +518,36 @@ session_get_from_handle_safe (u64 handle)
always_inline u32
transport_max_rx_enqueue (transport_connection_t * tc)
{
- stream_session_t *s = session_get (tc->s_index, tc->thread_index);
- return svm_fifo_max_enqueue (s->server_rx_fifo);
+ session_t *s = session_get (tc->s_index, tc->thread_index);
+ return svm_fifo_max_enqueue (s->rx_fifo);
}
always_inline u32
transport_max_tx_dequeue (transport_connection_t * tc)
{
- stream_session_t *s = session_get (tc->s_index, tc->thread_index);
- return svm_fifo_max_dequeue (s->server_tx_fifo);
+ session_t *s = session_get (tc->s_index, tc->thread_index);
+ return svm_fifo_max_dequeue (s->tx_fifo);
}
always_inline u32
transport_rx_fifo_size (transport_connection_t * tc)
{
- stream_session_t *s = session_get (tc->s_index, tc->thread_index);
- return s->server_rx_fifo->nitems;
+ session_t *s = session_get (tc->s_index, tc->thread_index);
+ return s->rx_fifo->nitems;
}
always_inline u32
transport_tx_fifo_size (transport_connection_t * tc)
{
- stream_session_t *s = session_get (tc->s_index, tc->thread_index);
- return s->server_tx_fifo->nitems;
+ session_t *s = session_get (tc->s_index, tc->thread_index);
+ return s->tx_fifo->nitems;
}
always_inline u8
transport_rx_fifo_has_ooo_data (transport_connection_t * tc)
{
- stream_session_t *s = session_get (tc->c_index, tc->thread_index);
- return svm_fifo_has_ooo_data (s->server_rx_fifo);
+ session_t *s = session_get (tc->c_index, tc->thread_index);
+ return svm_fifo_has_ooo_data (s->rx_fifo);
}
always_inline f64
@@ -565,15 +563,15 @@ transport_time_now (u32 thread_index)
}
always_inline u32
-session_get_index (stream_session_t * s)
+session_get_index (session_t * s)
{
return (s - session_manager_main.wrk[s->thread_index].sessions);
}
-always_inline stream_session_t *
+always_inline session_t *
session_clone_safe (u32 session_index, u32 thread_index)
{
- stream_session_t *old_s, *new_s;
+ session_t *old_s, *new_s;
u32 current_thread_index = vlib_get_thread_index ();
/* If during the memcpy pool is reallocated AND the memory allocator
@@ -591,7 +589,7 @@ session_clone_safe (u32 session_index, u32 thread_index)
return new_s;
}
-transport_connection_t *session_get_transport (stream_session_t * s);
+transport_connection_t *session_get_transport (session_t * s);
u32 session_tx_fifo_max_dequeue (transport_connection_t * tc);
@@ -599,7 +597,7 @@ int
session_enqueue_stream_connection (transport_connection_t * tc,
vlib_buffer_t * b, u32 offset,
u8 queue_event, u8 is_in_order);
-int session_enqueue_dgram_connection (stream_session_t * s,
+int session_enqueue_dgram_connection (session_t * s,
session_dgram_hdr_t * hdr,
vlib_buffer_t * b, u8 proto,
u8 queue_event);
@@ -610,8 +608,8 @@ u32 stream_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,
- stream_session_t ** new_session);
-int session_dequeue_notify (stream_session_t * s);
+ session_t ** new_session);
+int session_dequeue_notify (session_t * s);
void stream_session_init_fifos_pointers (transport_connection_t * tc,
u32 rx_pointer, u32 tx_pointer);
@@ -623,11 +621,11 @@ void session_transport_reset_notify (transport_connection_t * tc);
int stream_session_accept (transport_connection_t * tc, u32 listener_index,
u8 notify);
int session_open (u32 app_index, session_endpoint_t * tep, u32 opaque);
-int session_listen (stream_session_t * s, session_endpoint_cfg_t * sep);
-int session_stop_listen (stream_session_t * s);
-void session_close (stream_session_t * s);
-void session_transport_close (stream_session_t * s);
-void session_transport_cleanup (stream_session_t * s);
+int session_listen (session_t * s, session_endpoint_cfg_t * sep);
+int session_stop_listen (session_t * s);
+void session_close (session_t * s);
+void session_transport_close (session_t * s);
+void session_transport_cleanup (session_t * s);
int session_send_io_evt_to_thread (svm_fifo_t * f,
session_evt_type_t evt_type);
int session_send_io_evt_to_thread_custom (void *data, u32 thread_index,
@@ -649,10 +647,10 @@ void session_register_transport (transport_proto_t transport_proto,
always_inline void
transport_add_tx_event (transport_connection_t * tc)
{
- stream_session_t *s = session_get (tc->s_index, tc->thread_index);
- if (svm_fifo_has_event (s->server_tx_fifo))
+ session_t *s = session_get (tc->s_index, tc->thread_index);
+ if (svm_fifo_has_event (s->tx_fifo))
return;
- session_send_io_evt_to_thread (s->server_tx_fifo, FIFO_EVENT_APP_TX);
+ session_send_io_evt_to_thread (s->tx_fifo, FIFO_EVENT_APP_TX);
}
clib_error_t *vnet_session_enable_disable (vlib_main_t * vm, u8 is_en);
@@ -667,13 +665,13 @@ int session_manager_flush_enqueue_events (u8 proto, u32 thread_index);
int session_manager_flush_all_enqueue_events (u8 transport_proto);
always_inline u64
-listen_session_get_handle (stream_session_t * s)
+listen_session_get_handle (session_t * s)
{
ASSERT (s->session_state == SESSION_STATE_LISTENING);
return session_handle (s);
}
-always_inline stream_session_t *
+always_inline session_t *
listen_session_get_from_handle (session_handle_t handle)
{
return session_get_from_handle (handle);
@@ -686,32 +684,32 @@ listen_session_parse_handle (session_handle_t handle, u32 * index,
session_parse_handle (handle, index, thread_index);
}
-always_inline stream_session_t *
+always_inline session_t *
listen_session_new (u8 thread_index, session_type_t type)
{
- stream_session_t *s;
+ session_t *s;
s = session_alloc (thread_index);
s->session_type = type;
s->session_state = SESSION_STATE_LISTENING;
return s;
}
-always_inline stream_session_t *
+always_inline session_t *
listen_session_get (u32 index)
{
return session_get (index, 0);
}
always_inline void
-listen_session_del (stream_session_t * s)
+listen_session_del (session_t * s)
{
session_free (s);
}
-transport_connection_t *listen_session_get_transport (stream_session_t * s);
+transport_connection_t *listen_session_get_transport (session_t * s);
int
-listen_session_get_local_session_endpoint (stream_session_t * listener,
+listen_session_get_local_session_endpoint (session_t * listener,
session_endpoint_t * sep);
void session_flush_frames_main_thread (vlib_main_t * vm);
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 713d70b490b..6a0d77eed12 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2016 Cisco and/or its affiliates.
+ * Copyright (c) 2015-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -198,14 +198,14 @@ send_app_cut_through_registration_add (u32 api_client_index,
}
static int
-send_session_accept_callback (stream_session_t * s)
+send_session_accept_callback (session_t * s)
{
app_worker_t *server_wrk = app_worker_get (s->app_wrk_index);
transport_proto_vft_t *tp_vft;
vl_api_accept_session_t *mp;
vl_api_registration_t *reg;
transport_connection_t *tc;
- stream_session_t *listener;
+ session_t *listener;
svm_msg_q_t *vpp_queue;
application_t *server;
@@ -223,8 +223,8 @@ send_session_accept_callback (stream_session_t * s)
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_ACCEPT_SESSION);
mp->context = server_wrk->wrk_index;
- mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
+ mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
+ mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
if (session_has_transport (s))
{
@@ -283,7 +283,7 @@ send_session_accept_callback (stream_session_t * s)
}
static void
-send_session_disconnect_callback (stream_session_t * s)
+send_session_disconnect_callback (session_t * s)
{
app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
vl_api_disconnect_session_t *mp;
@@ -305,7 +305,7 @@ send_session_disconnect_callback (stream_session_t * s)
}
static void
-send_session_reset_callback (stream_session_t * s)
+send_session_reset_callback (session_t * s)
{
app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
vl_api_registration_t *reg;
@@ -327,7 +327,7 @@ send_session_reset_callback (stream_session_t * s)
int
send_session_connected_callback (u32 app_wrk_index, u32 api_context,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
vl_api_connect_session_reply_t *mp;
transport_connection_t *tc;
@@ -365,8 +365,8 @@ send_session_connected_callback (u32 app_wrk_index, u32 api_context,
clib_memcpy_fast (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
mp->is_ip4 = tc->is_ip4;
mp->lcl_port = tc->lcl_port;
- mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
+ mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
+ mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
}
else
{
@@ -375,8 +375,8 @@ send_session_connected_callback (u32 app_wrk_index, u32 api_context,
mp->lcl_port = ls->port;
mp->vpp_event_queue_address = ls->server_evt_q;
mp->client_event_queue_address = ls->client_evt_q;
- mp->server_rx_fifo = pointer_to_uword (s->server_tx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->server_rx_fifo);
+ mp->server_rx_fifo = pointer_to_uword (s->tx_fifo);
+ mp->server_tx_fifo = pointer_to_uword (s->rx_fifo);
}
done:
@@ -415,14 +415,14 @@ mq_try_lock_and_alloc_msg (svm_msg_q_t * app_mq, svm_msg_q_msg_t * msg)
}
static int
-mq_send_session_accepted_cb (stream_session_t * s)
+mq_send_session_accepted_cb (session_t * s)
{
app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
svm_msg_q_msg_t _msg, *msg = &_msg;
svm_msg_q_t *vpp_queue, *app_mq;
transport_proto_vft_t *tp_vft;
transport_connection_t *tc;
- stream_session_t *listener;
+ session_t *listener;
session_accepted_msg_t *mp;
session_event_t *evt;
application_t *app;
@@ -438,8 +438,8 @@ mq_send_session_accepted_cb (stream_session_t * s)
mp = (session_accepted_msg_t *) evt->data;
clib_memset (mp, 0, sizeof (*mp));
mp->context = app->app_index;
- mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
+ mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
+ mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
mp->segment_handle = session_segment_handle (s);
if (session_has_transport (s))
@@ -548,7 +548,7 @@ mq_notify_close_subscribers (u32 app_index, session_handle_t sh,
}
static void
-mq_send_session_disconnected_cb (stream_session_t * s)
+mq_send_session_disconnected_cb (session_t * s)
{
app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
session_handle_t sh = session_handle (s);
@@ -556,8 +556,8 @@ mq_send_session_disconnected_cb (stream_session_t * s)
mq_send_session_close_evt (app_wrk, session_handle (s),
SESSION_CTRL_EVT_DISCONNECTED);
- if (svm_fifo_n_subscribers (s->server_rx_fifo))
- mq_notify_close_subscribers (app_wrk->app_index, sh, s->server_rx_fifo,
+ if (svm_fifo_n_subscribers (s->rx_fifo))
+ mq_notify_close_subscribers (app_wrk->app_index, sh, s->rx_fifo,
SESSION_CTRL_EVT_DISCONNECTED);
}
@@ -570,27 +570,27 @@ mq_send_local_session_disconnected_cb (u32 app_wrk_index,
mq_send_session_close_evt (app_wrk, sh, SESSION_CTRL_EVT_DISCONNECTED);
- if (svm_fifo_n_subscribers (ls->server_rx_fifo))
- mq_notify_close_subscribers (app_wrk->app_index, sh, ls->server_rx_fifo,
+ if (svm_fifo_n_subscribers (ls->rx_fifo))
+ mq_notify_close_subscribers (app_wrk->app_index, sh, ls->rx_fifo,
SESSION_CTRL_EVT_DISCONNECTED);
}
static void
-mq_send_session_reset_cb (stream_session_t * s)
+mq_send_session_reset_cb (session_t * s)
{
app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
session_handle_t sh = session_handle (s);
mq_send_session_close_evt (app_wrk, sh, SESSION_CTRL_EVT_RESET);
- if (svm_fifo_n_subscribers (s->server_rx_fifo))
- mq_notify_close_subscribers (app_wrk->app_index, sh, s->server_rx_fifo,
+ if (svm_fifo_n_subscribers (s->rx_fifo))
+ mq_notify_close_subscribers (app_wrk->app_index, sh, s->rx_fifo,
SESSION_CTRL_EVT_RESET);
}
static int
mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
svm_msg_q_msg_t _msg, *msg = &_msg;
session_connected_msg_t *mp;
@@ -638,8 +638,8 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
clib_memcpy_fast (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
mp->is_ip4 = tc->is_ip4;
mp->lcl_port = tc->lcl_port;
- mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
+ mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
+ mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
}
else
{
@@ -657,8 +657,8 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
mp->vpp_event_queue_address = pointer_to_uword (vpp_mq);
mp->client_event_queue_address = ls->client_evt_q;
mp->server_event_queue_address = ls->server_evt_q;
- mp->server_rx_fifo = pointer_to_uword (s->server_tx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->server_rx_fifo);
+ mp->server_rx_fifo = pointer_to_uword (s->tx_fifo);
+ mp->server_tx_fifo = pointer_to_uword (s->rx_fifo);
}
done:
@@ -676,7 +676,7 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
svm_msg_q_msg_t _msg, *msg = &_msg;
svm_msg_q_t *app_mq, *vpp_evt_q;
transport_connection_t *tc;
- stream_session_t *ls = 0;
+ session_t *ls = 0;
session_bound_msg_t *mp;
app_worker_t *app_wrk;
session_event_t *evt;
@@ -726,8 +726,8 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
if (ls && session_transport_service_type (ls) == TRANSPORT_SERVICE_CL)
{
- mp->rx_fifo = pointer_to_uword (ls->server_rx_fifo);
- mp->tx_fifo = pointer_to_uword (ls->server_tx_fifo);
+ mp->rx_fifo = pointer_to_uword (ls->rx_fifo);
+ mp->tx_fifo = pointer_to_uword (ls->tx_fifo);
}
done:
@@ -892,7 +892,7 @@ vl_api_bind_uri_t_handler (vl_api_bind_uri_t * mp)
transport_connection_t *tc = 0;
vnet_bind_args_t _a, *a = &_a;
vl_api_bind_uri_reply_t *rmp;
- stream_session_t *s;
+ session_t *s;
application_t *app = 0;
svm_msg_q_t *vpp_evt_q;
app_worker_t *app_wrk;
@@ -933,8 +933,8 @@ done:
clib_memcpy_fast (rmp->lcl_ip, &tc->lcl_ip, sizeof(tc->lcl_ip));
if (session_transport_service_type (s) == TRANSPORT_SERVICE_CL)
{
- rmp->rx_fifo = pointer_to_uword (s->server_rx_fifo);
- rmp->tx_fifo = pointer_to_uword (s->server_tx_fifo);
+ 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);
rmp->vpp_evt_q = pointer_to_uword (vpp_evt_q);
}
@@ -1089,7 +1089,7 @@ vl_api_reset_session_reply_t_handler (vl_api_reset_session_reply_t * mp)
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
app_worker_t *app_wrk;
application_t *app;
- stream_session_t *s;
+ session_t *s;
u32 index, thread_index;
app = application_lookup (mp->context);
@@ -1131,7 +1131,7 @@ vl_api_accept_session_reply_t_handler (vl_api_accept_session_reply_t * mp)
{
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
local_session_t *ls;
- stream_session_t *s;
+ session_t *s;
/* Server isn't interested, kill the session */
if (mp->retval)
@@ -1188,7 +1188,7 @@ vl_api_bind_sock_t_handler (vl_api_bind_sock_t * mp)
clib_error_t *error;
application_t *app = 0;
app_worker_t *app_wrk;
- stream_session_t *s;
+ session_t *s;
transport_connection_t *tc = 0;
ip46_address_t *ip46;
svm_msg_q_t *vpp_evt_q;
@@ -1238,8 +1238,8 @@ done:
clib_memcpy_fast (rmp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
if (session_transport_service_type (s) == TRANSPORT_SERVICE_CL)
{
- rmp->rx_fifo = pointer_to_uword (s->server_rx_fifo);
- rmp->tx_fifo = pointer_to_uword (s->server_tx_fifo);
+ 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);
rmp->vpp_evt_q = pointer_to_uword (vpp_evt_q);
}
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index 99baf4431ac..e92d432c8a8 100755
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -18,27 +18,25 @@
u8 *
format_session_fifos (u8 * s, va_list * args)
{
- stream_session_t *ss = va_arg (*args, stream_session_t *);
+ session_t *ss = va_arg (*args, session_t *);
int verbose = va_arg (*args, int);
session_event_t _e, *e = &_e;
u8 found;
- if (!ss->server_rx_fifo || !ss->server_tx_fifo)
+ if (!ss->rx_fifo || !ss->tx_fifo)
return s;
- s = format (s, " Rx fifo: %U", format_svm_fifo, ss->server_rx_fifo,
- verbose);
- if (verbose > 2 && ss->server_rx_fifo->has_event)
+ s = format (s, " Rx fifo: %U", format_svm_fifo, ss->rx_fifo, verbose);
+ if (verbose > 2 && ss->rx_fifo->has_event)
{
- found = session_node_lookup_fifo_event (ss->server_rx_fifo, e);
+ found = session_node_lookup_fifo_event (ss->rx_fifo, e);
s = format (s, " session node event: %s\n",
found ? "found" : "not found");
}
- s = format (s, " Tx fifo: %U", format_svm_fifo, ss->server_tx_fifo,
- verbose);
- if (verbose > 2 && ss->server_tx_fifo->has_event)
+ s = format (s, " Tx fifo: %U", format_svm_fifo, ss->tx_fifo, verbose);
+ if (verbose > 2 && ss->tx_fifo->has_event)
{
- found = session_node_lookup_fifo_event (ss->server_tx_fifo, e);
+ found = session_node_lookup_fifo_event (ss->tx_fifo, e);
s = format (s, " session node event: %s\n",
found ? "found" : "not found");
}
@@ -56,7 +54,7 @@ format_session_fifos (u8 * s, va_list * args)
u8 *
format_stream_session (u8 * s, va_list * args)
{
- stream_session_t *ss = va_arg (*args, stream_session_t *);
+ session_t *ss = va_arg (*args, session_t *);
int verbose = va_arg (*args, int);
u32 tp = session_get_transport_proto (ss);
u8 *str = 0;
@@ -73,8 +71,8 @@ format_stream_session (u8 * s, va_list * args)
u8 hasf = post_accept | session_tx_is_dgram (ss);
u32 rxf, txf;
- rxf = hasf ? svm_fifo_max_dequeue (ss->server_rx_fifo) : 0;
- txf = hasf ? svm_fifo_max_dequeue (ss->server_tx_fifo) : 0;
+ rxf = hasf ? svm_fifo_max_dequeue (ss->rx_fifo) : 0;
+ txf = hasf ? svm_fifo_max_dequeue (ss->tx_fifo) : 0;
str = format (0, "%-10u%-10u", rxf, txf);
}
@@ -164,10 +162,10 @@ unformat_stream_session_id (unformat_input_t * input, va_list * args)
uword
unformat_stream_session (unformat_input_t * input, va_list * args)
{
- stream_session_t **result = va_arg (*args, stream_session_t **);
+ session_t **result = va_arg (*args, session_t **);
u32 lcl_port = 0, rmt_port = 0, fib_index = 0;
ip46_address_t lcl, rmt;
- stream_session_t *s;
+ session_t *s;
u8 proto = ~0;
u8 is_ip4 = 0;
@@ -234,7 +232,7 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
u8 one_session = 0, do_listeners = 0, sst, do_elog = 0;
session_manager_main_t *smm = &session_manager_main;
u32 transport_proto = ~0, track_index;
- stream_session_t *pool, *s;
+ session_t *pool, *s;
transport_connection_t *tc;
app_worker_t *app_wrk;
int verbose = 0, i;
@@ -361,7 +359,7 @@ VLIB_CLI_COMMAND (vlib_cli_show_session_command) =
/* *INDENT-ON* */
static int
-clear_session (stream_session_t * s)
+clear_session (session_t * s)
{
app_worker_t *server_wrk = app_worker_get (s->app_wrk_index);
application_t *server = application_get (server_wrk->app_index);
@@ -377,7 +375,7 @@ clear_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
u32 thread_index = 0, clear_all = 0;
session_manager_worker_t *wrk;
u32 session_index = ~0;
- stream_session_t *session;
+ session_t *session;
if (!smm->is_enabled)
{
@@ -438,7 +436,7 @@ show_session_fifo_trace_command_fn (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
- stream_session_t *s = 0;
+ session_t *s = 0;
u8 is_rx = 0, *str = 0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -467,8 +465,8 @@ show_session_fifo_trace_command_fn (vlib_main_t * vm,
}
str = is_rx ?
- svm_fifo_dump_trace (str, s->server_rx_fifo) :
- svm_fifo_dump_trace (str, s->server_tx_fifo);
+ svm_fifo_dump_trace (str, s->rx_fifo) :
+ svm_fifo_dump_trace (str, s->tx_fifo);
vlib_cli_output (vm, "%v", str);
return 0;
@@ -487,7 +485,7 @@ static clib_error_t *
session_replay_fifo_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
{
- stream_session_t *s = 0;
+ session_t *s = 0;
u8 is_rx = 0, *str = 0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -514,8 +512,8 @@ session_replay_fifo_command_fn (vlib_main_t * vm, unformat_input_t * input,
}
str = is_rx ?
- svm_fifo_replay (str, s->server_rx_fifo, 0, 1) :
- svm_fifo_replay (str, s->server_tx_fifo, 0, 1);
+ svm_fifo_replay (str, s->rx_fifo, 0, 1) :
+ svm_fifo_replay (str, s->tx_fifo, 0, 1);
vlib_cli_output (vm, "%v", str);
return 0;
diff --git a/src/vnet/session/session_debug.h b/src/vnet/session/session_debug.h
index 559f0bd6ed1..2912ae3828c 100644
--- a/src/vnet/session/session_debug.h
+++ b/src/vnet/session/session_debug.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/session_lookup.c b/src/vnet/session/session_lookup.c
index 931c3d0f9e2..33fcb4250ca 100644
--- a/src/vnet/session/session_lookup.c
+++ b/src/vnet/session/session_lookup.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -338,7 +338,7 @@ session_lookup_del_connection (transport_connection_t * tc)
}
int
-session_lookup_del_session (stream_session_t * s)
+session_lookup_del_session (session_t * s)
{
transport_proto_t tp = session_get_transport_proto (s);
transport_connection_t *ts;
@@ -371,7 +371,7 @@ session_lookup_action_to_handle (u32 action_index)
}
}
-static stream_session_t *
+static session_t *
session_lookup_app_listen_session (u32 app_index, u8 fib_proto,
u8 transport_proto)
{
@@ -384,7 +384,7 @@ session_lookup_app_listen_session (u32 app_index, u8 fib_proto,
fib_proto, transport_proto);
}
-static stream_session_t *
+static session_t *
session_lookup_action_to_session (u32 action_index, u8 fib_proto,
u8 transport_proto)
{
@@ -396,7 +396,7 @@ session_lookup_action_to_session (u32 action_index, u8 fib_proto,
}
/** UNUSED */
-stream_session_t *
+session_t *
session_lookup_rules_table_session4 (session_table_t * st, u8 proto,
ip4_address_t * lcl, u16 lcl_port,
ip4_address_t * rmt, u16 rmt_port)
@@ -412,7 +412,7 @@ session_lookup_rules_table_session4 (session_table_t * st, u8 proto,
}
/** UNUSED */
-stream_session_t *
+session_t *
session_lookup_rules_table_session6 (session_table_t * st, u8 proto,
ip6_address_t * lcl, u16 lcl_port,
ip6_address_t * rmt, u16 rmt_port)
@@ -614,7 +614,7 @@ session_lookup_local_endpoint (u32 table_index, session_endpoint_t * sep)
return SESSION_INVALID_HANDLE;
}
-static inline stream_session_t *
+static inline session_t *
session_lookup_listener4_i (session_table_t * st, ip4_address_t * lcl,
u16 lcl_port, u8 proto, u8 use_wildcard)
{
@@ -655,7 +655,7 @@ session_lookup_listener4_i (session_table_t * st, ip4_address_t * lcl,
return 0;
}
-stream_session_t *
+session_t *
session_lookup_listener4 (u32 fib_index, ip4_address_t * lcl, u16 lcl_port,
u8 proto)
{
@@ -666,7 +666,7 @@ session_lookup_listener4 (u32 fib_index, ip4_address_t * lcl, u16 lcl_port,
return session_lookup_listener4_i (st, lcl, lcl_port, proto, 0);
}
-static stream_session_t *
+static session_t *
session_lookup_listener6_i (session_table_t * st, ip6_address_t * lcl,
u16 lcl_port, u8 proto, u8 ip_wildcard)
{
@@ -698,7 +698,7 @@ session_lookup_listener6_i (session_table_t * st, ip6_address_t * lcl,
return 0;
}
-stream_session_t *
+session_t *
session_lookup_listener6 (u32 fib_index, ip6_address_t * lcl, u16 lcl_port,
u8 proto)
{
@@ -712,7 +712,7 @@ session_lookup_listener6 (u32 fib_index, ip6_address_t * lcl, u16 lcl_port,
/**
* Lookup listener, exact or proxy (inaddr_any:0) match
*/
-stream_session_t *
+session_t *
session_lookup_listener (u32 table_index, session_endpoint_t * sep)
{
session_table_t *st;
@@ -856,7 +856,7 @@ session_lookup_connection_wt4 (u32 fib_index, ip4_address_t * lcl,
{
session_table_t *st;
session_kv4_t kv4;
- stream_session_t *s;
+ session_t *s;
u32 action_index;
int rv;
@@ -938,7 +938,7 @@ session_lookup_connection4 (u32 fib_index, ip4_address_t * lcl,
{
session_table_t *st;
session_kv4_t kv4;
- stream_session_t *s;
+ session_t *s;
u32 action_index;
int rv;
@@ -1003,13 +1003,13 @@ session_lookup_connection4 (u32 fib_index, ip4_address_t * lcl,
*
* Typically used by dgram connections
*/
-stream_session_t *
+session_t *
session_lookup_safe4 (u32 fib_index, ip4_address_t * lcl, ip4_address_t * rmt,
u16 lcl_port, u16 rmt_port, u8 proto)
{
session_table_t *st;
session_kv4_t kv4;
- stream_session_t *s;
+ session_t *s;
u32 action_index;
int rv;
@@ -1079,7 +1079,7 @@ session_lookup_connection_wt6 (u32 fib_index, ip6_address_t * lcl,
u8 * result)
{
session_table_t *st;
- stream_session_t *s;
+ session_t *s;
session_kv6_t kv6;
u32 action_index;
int rv;
@@ -1154,7 +1154,7 @@ session_lookup_connection6 (u32 fib_index, ip6_address_t * lcl,
u8 proto)
{
session_table_t *st;
- stream_session_t *s;
+ session_t *s;
session_kv6_t kv6;
u32 action_index;
int rv;
@@ -1211,13 +1211,13 @@ session_lookup_connection6 (u32 fib_index, ip6_address_t * lcl,
*
* Typically used by dgram connections
*/
-stream_session_t *
+session_t *
session_lookup_safe6 (u32 fib_index, ip6_address_t * lcl, ip6_address_t * rmt,
u16 lcl_port, u16 rmt_port, u8 proto)
{
session_table_t *st;
session_kv6_t kv6;
- stream_session_t *s;
+ session_t *s;
u32 action_index;
int rv;
@@ -1316,7 +1316,7 @@ format_ip4_session_lookup_kvp (u8 * s, va_list * args)
clib_bihash_kv_16_8_t *kvp = va_arg (*args, clib_bihash_kv_16_8_t *);
u32 is_local = va_arg (*args, u32), app_wrk_index, session_index;
v4_connection_key_t *key = (v4_connection_key_t *) kvp->key;
- stream_session_t *session;
+ session_t *session;
app_worker_t *app_wrk;
const u8 *app_name;
u8 *str = 0;
diff --git a/src/vnet/session/session_lookup.h b/src/vnet/session/session_lookup.h
index 212a11833a3..5efb1f41025 100644
--- a/src/vnet/session/session_lookup.h
+++ b/src/vnet/session/session_lookup.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -17,10 +17,12 @@
#define SRC_VNET_SESSION_SESSION_LOOKUP_H_
#include <vnet/session/session_table.h>
-#include <vnet/session/stream_session.h>
+#include <vnet/session/session_types.h>
#include <vnet/session/transport.h>
#include <vnet/session/application_namespace.h>
+#define HALF_OPEN_LOOKUP_INVALID_VALUE ((u64)~0)
+
typedef enum session_lookup_result_
{
SESSION_LOOKUP_RESULT_NONE,
@@ -28,12 +30,12 @@ typedef enum session_lookup_result_
SESSION_LOOKUP_RESULT_FILTERED
} session_lookup_result_t;
-stream_session_t *session_lookup_safe4 (u32 fib_index, ip4_address_t * lcl,
- ip4_address_t * rmt, u16 lcl_port,
- u16 rmt_port, u8 proto);
-stream_session_t *session_lookup_safe6 (u32 fib_index, ip6_address_t * lcl,
- ip6_address_t * rmt, u16 lcl_port,
- u16 rmt_port, u8 proto);
+session_t *session_lookup_safe4 (u32 fib_index, ip4_address_t * lcl,
+ ip4_address_t * rmt, u16 lcl_port,
+ u16 rmt_port, u8 proto);
+session_t *session_lookup_safe6 (u32 fib_index, ip6_address_t * lcl,
+ ip6_address_t * rmt, u16 lcl_port,
+ u16 rmt_port, u8 proto);
transport_connection_t *session_lookup_connection_wt4 (u32 fib_index,
ip4_address_t * lcl,
ip4_address_t * rmt,
@@ -58,27 +60,26 @@ transport_connection_t *session_lookup_connection6 (u32 fib_index,
ip6_address_t * rmt,
u16 lcl_port,
u16 rmt_port, u8 proto);
-stream_session_t *session_lookup_listener4 (u32 fib_index,
- ip4_address_t * lcl, u16 lcl_port,
- u8 proto);
-stream_session_t *session_lookup_listener6 (u32 fib_index,
- ip6_address_t * lcl, u16 lcl_port,
- u8 proto);
-stream_session_t *session_lookup_listener (u32 table_index,
- session_endpoint_t * sep);
+session_t *session_lookup_listener4 (u32 fib_index,
+ ip4_address_t * lcl, u16 lcl_port,
+ u8 proto);
+session_t *session_lookup_listener6 (u32 fib_index,
+ ip6_address_t * lcl, u16 lcl_port,
+ u8 proto);
+session_t *session_lookup_listener (u32 table_index,
+ session_endpoint_t * sep);
int session_lookup_add_connection (transport_connection_t * tc, u64 value);
int session_lookup_del_connection (transport_connection_t * tc);
u64 session_lookup_endpoint_listener (u32 table_index,
session_endpoint_t * sepi,
u8 use_rules);
u64 session_lookup_local_endpoint (u32 table_index, session_endpoint_t * sep);
-stream_session_t *session_lookup_global_session_endpoint (session_endpoint_t
- *);
+session_t *session_lookup_global_session_endpoint (session_endpoint_t *);
int session_lookup_add_session_endpoint (u32 table_index,
session_endpoint_t * sep, u64 value);
int session_lookup_del_session_endpoint (u32 table_index,
session_endpoint_t * sep);
-int session_lookup_del_session (stream_session_t * s);
+int session_lookup_del_session (session_t * s);
int session_lookup_del_half_open (transport_connection_t * tc);
int session_lookup_add_half_open (transport_connection_t * tc, u64 value);
u64 session_lookup_half_open_handle (transport_connection_t * tc);
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 57445a34c2d..fe7f652a98a 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -29,10 +29,10 @@ session_mq_accepted_reply_handler (void *data)
{
session_accepted_reply_msg_t *mp = (session_accepted_reply_msg_t *) data;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
- stream_session_state_t old_state;
+ session_state_t old_state;
app_worker_t *app_wrk;
local_session_t *ls;
- stream_session_t *s;
+ session_t *s;
/* Server isn't interested, kill the session */
if (mp->retval)
@@ -77,7 +77,7 @@ session_mq_accepted_reply_handler (void *data)
old_state = s->session_state;
s->session_state = SESSION_STATE_READY;
- if (!svm_fifo_is_empty (s->server_rx_fifo))
+ if (!svm_fifo_is_empty (s->rx_fifo))
app_worker_lock_and_send_event (app_wrk, s, FIFO_EVENT_APP_RX);
/* Closed while waiting for app to reply. Resend disconnect */
@@ -97,7 +97,7 @@ session_mq_reset_reply_handler (void *data)
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
session_reset_reply_msg_t *mp;
app_worker_t *app_wrk;
- stream_session_t *s;
+ session_t *s;
application_t *app;
u32 index, thread_index;
@@ -144,7 +144,7 @@ session_mq_disconnected_handler (void *data)
session_disconnected_msg_t *mp;
app_worker_t *app_wrk;
session_event_t *evt;
- stream_session_t *s;
+ session_t *s;
application_t *app;
int rv = 0;
@@ -216,7 +216,7 @@ session_mq_worker_update_handler (void *data)
app_worker_t *app_wrk;
u32 owner_app_wrk_map;
session_event_t *evt;
- stream_session_t *s;
+ session_t *s;
application_t *app;
app = application_lookup (mp->client_index);
@@ -269,18 +269,18 @@ session_mq_worker_update_handler (void *data)
evt->event_type = SESSION_CTRL_EVT_WORKER_UPDATE_REPLY;
rmp = (session_worker_update_reply_msg_t *) evt->data;
rmp->handle = mp->handle;
- rmp->rx_fifo = pointer_to_uword (s->server_rx_fifo);
- rmp->tx_fifo = pointer_to_uword (s->server_tx_fifo);
+ rmp->rx_fifo = pointer_to_uword (s->rx_fifo);
+ rmp->tx_fifo = pointer_to_uword (s->tx_fifo);
rmp->segment_handle = session_segment_handle (s);
svm_msg_q_add (app_wrk->event_queue, msg, SVM_Q_WAIT);
/*
* Retransmit messages that may have been lost
*/
- if (s->server_tx_fifo && !svm_fifo_is_empty (s->server_tx_fifo))
- session_send_io_evt_to_thread (s->server_tx_fifo, FIFO_EVENT_APP_TX);
+ if (s->tx_fifo && !svm_fifo_is_empty (s->tx_fifo))
+ session_send_io_evt_to_thread (s->tx_fifo, FIFO_EVENT_APP_TX);
- if (s->server_rx_fifo && !svm_fifo_is_empty (s->server_rx_fifo))
+ if (s->rx_fifo && !svm_fifo_is_empty (s->rx_fifo))
app_worker_lock_and_send_event (app_wrk, s, FIFO_EVENT_APP_RX);
if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSING)
@@ -337,7 +337,7 @@ enum
static void
session_tx_trace_frame (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 next_index, u32 * to_next, u16 n_segs,
- stream_session_t * s, u32 n_trace)
+ session_t * s, u32 n_trace)
{
session_queue_trace_t *t;
vlib_buffer_t *b;
@@ -384,7 +384,7 @@ session_tx_fifo_chain_tail (vlib_main_t * vm, session_tx_context_t * ctx,
data = vlib_buffer_get_current (chain_b);
if (peek_data)
{
- n_bytes_read = svm_fifo_peek (ctx->s->server_tx_fifo,
+ n_bytes_read = svm_fifo_peek (ctx->s->tx_fifo,
ctx->tx_offset, len_to_deq, data);
ctx->tx_offset += n_bytes_read;
}
@@ -392,7 +392,7 @@ session_tx_fifo_chain_tail (vlib_main_t * vm, session_tx_context_t * ctx,
{
if (ctx->transport_vft->tx_type == TRANSPORT_TX_DGRAM)
{
- svm_fifo_t *f = ctx->s->server_tx_fifo;
+ svm_fifo_t *f = ctx->s->tx_fifo;
session_dgram_hdr_t *hdr = &ctx->hdr;
u16 deq_now;
deq_now = clib_min (hdr->data_length - hdr->data_offset,
@@ -409,7 +409,7 @@ session_tx_fifo_chain_tail (vlib_main_t * vm, session_tx_context_t * ctx,
}
}
else
- n_bytes_read = svm_fifo_dequeue_nowait (ctx->s->server_tx_fifo,
+ n_bytes_read = svm_fifo_dequeue_nowait (ctx->s->tx_fifo,
len_to_deq, data);
}
ASSERT (n_bytes_read == len_to_deq);
@@ -452,7 +452,7 @@ session_tx_fill_buffer (vlib_main_t * vm, session_tx_context_t * ctx,
if (peek_data)
{
- n_bytes_read = svm_fifo_peek (ctx->s->server_tx_fifo, ctx->tx_offset,
+ n_bytes_read = svm_fifo_peek (ctx->s->tx_fifo, ctx->tx_offset,
len_to_deq, data0);
ASSERT (n_bytes_read > 0);
/* Keep track of progress locally, transport is also supposed to
@@ -464,7 +464,7 @@ session_tx_fill_buffer (vlib_main_t * vm, session_tx_context_t * ctx,
if (ctx->transport_vft->tx_type == TRANSPORT_TX_DGRAM)
{
session_dgram_hdr_t *hdr = &ctx->hdr;
- svm_fifo_t *f = ctx->s->server_tx_fifo;
+ svm_fifo_t *f = ctx->s->tx_fifo;
u16 deq_now;
u32 offset;
@@ -489,7 +489,7 @@ session_tx_fill_buffer (vlib_main_t * vm, session_tx_context_t * ctx,
}
else
{
- n_bytes_read = svm_fifo_dequeue_nowait (ctx->s->server_tx_fifo,
+ n_bytes_read = svm_fifo_dequeue_nowait (ctx->s->tx_fifo,
len_to_deq, data0);
ASSERT (n_bytes_read > 0);
}
@@ -514,7 +514,7 @@ session_tx_fill_buffer (vlib_main_t * vm, session_tx_context_t * ctx,
}
always_inline u8
-session_tx_not_ready (stream_session_t * s, u8 peek_data)
+session_tx_not_ready (session_t * s, u8 peek_data)
{
if (peek_data)
{
@@ -553,7 +553,7 @@ session_tx_set_dequeue_params (vlib_main_t * vm, session_tx_context_t * ctx,
u32 max_segs, u8 peek_data)
{
u32 n_bytes_per_buf, n_bytes_per_seg;
- ctx->max_dequeue = svm_fifo_max_dequeue (ctx->s->server_tx_fifo);
+ ctx->max_dequeue = svm_fifo_max_dequeue (ctx->s->tx_fifo);
if (peek_data)
{
/* Offset in rx fifo from where to peek data */
@@ -574,7 +574,7 @@ session_tx_set_dequeue_params (vlib_main_t * vm, session_tx_context_t * ctx,
ctx->max_len_to_snd = 0;
return;
}
- svm_fifo_peek (ctx->s->server_tx_fifo, 0, sizeof (ctx->hdr),
+ svm_fifo_peek (ctx->s->tx_fifo, 0, sizeof (ctx->hdr),
(u8 *) & ctx->hdr);
ASSERT (ctx->hdr.data_length > ctx->hdr.data_offset);
ctx->max_dequeue = ctx->hdr.data_length - ctx->hdr.data_offset;
@@ -660,7 +660,7 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
}
/* Allow enqueuing of a new event */
- svm_fifo_unset_event (ctx->s->server_tx_fifo);
+ svm_fifo_unset_event (ctx->s->tx_fifo);
/* Check how much we can pull. */
session_tx_set_dequeue_params (vm, ctx, VLIB_FRAME_SIZE - *n_tx_packets,
@@ -773,18 +773,18 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
/* If we couldn't dequeue all bytes mark as partially read */
ASSERT (ctx->left_to_snd == 0);
if (ctx->max_len_to_snd < ctx->max_dequeue)
- if (svm_fifo_set_event (ctx->s->server_tx_fifo))
+ if (svm_fifo_set_event (ctx->s->tx_fifo))
vec_add1 (wrk->pending_event_vector, *e);
if (!peek_data && ctx->transport_vft->tx_type == TRANSPORT_TX_DGRAM)
{
/* Fix dgram pre header */
if (ctx->max_len_to_snd < ctx->max_dequeue)
- svm_fifo_overwrite_head (ctx->s->server_tx_fifo, (u8 *) & ctx->hdr,
+ svm_fifo_overwrite_head (ctx->s->tx_fifo, (u8 *) & ctx->hdr,
sizeof (session_dgram_pre_hdr_t));
/* More data needs to be read */
- else if (svm_fifo_max_dequeue (ctx->s->server_tx_fifo) > 0)
- if (svm_fifo_set_event (ctx->s->server_tx_fifo))
+ else if (svm_fifo_max_dequeue (ctx->s->tx_fifo) > 0)
+ if (svm_fifo_set_event (ctx->s->tx_fifo))
vec_add1 (wrk->pending_event_vector, *e);
}
return SESSION_TX_OK;
@@ -812,17 +812,17 @@ session_tx_fifo_dequeue_internal (vlib_main_t * vm,
session_manager_worker_t * wrk,
session_event_t * e, int *n_tx_pkts)
{
- stream_session_t *s = wrk->ctx.s;
+ session_t *s = wrk->ctx.s;
application_t *app;
if (PREDICT_FALSE (s->session_state == SESSION_STATE_CLOSED))
return 0;
app = application_get (s->t_app_index);
- svm_fifo_unset_event (s->server_tx_fifo);
+ svm_fifo_unset_event (s->tx_fifo);
return app->cb_fns.builtin_app_tx_callback (s);
}
-always_inline stream_session_t *
+always_inline session_t *
session_event_get_session (session_event_t * e, u8 thread_index)
{
return session_get_if_valid (e->fifo->master_session_index, thread_index);
@@ -902,7 +902,7 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
for (i = 0; i < n_events; i++)
{
- stream_session_t *s; /* $$$ prefetch 1 ahead maybe */
+ session_t *s; /* $$$ prefetch 1 ahead maybe */
session_event_t *e;
u8 need_tx_ntf;
@@ -931,7 +931,7 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
&n_tx_packets);
if (PREDICT_TRUE (rv == SESSION_TX_OK))
{
- need_tx_ntf = svm_fifo_needs_tx_ntf (s->server_tx_fifo,
+ need_tx_ntf = svm_fifo_needs_tx_ntf (s->tx_fifo,
wrk->ctx.max_len_to_snd);
if (PREDICT_FALSE (need_tx_ntf))
session_dequeue_notify (s);
@@ -953,8 +953,7 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
* and the tx queue is still not empty, try to wait for some
* dispatch cycles */
if (!e->postponed
- || (e->postponed < 200
- && svm_fifo_max_dequeue (s->server_tx_fifo)))
+ || (e->postponed < 200 && svm_fifo_max_dequeue (s->tx_fifo)))
{
e->postponed += 1;
vec_add1 (wrk->pending_disconnects, *e);
@@ -967,7 +966,7 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
s = session_event_get_session (e, thread_index);
if (PREDICT_FALSE (!s || s->session_state >= SESSION_STATE_CLOSING))
continue;
- svm_fifo_unset_event (s->server_rx_fifo);
+ svm_fifo_unset_event (s->rx_fifo);
app_wrk = app_worker_get (s->app_wrk_index);
app = application_get (app_wrk->app_index);
app->cb_fns.builtin_app_rx_callback (s);
@@ -1038,7 +1037,7 @@ dump_thread_0_event_queue (void)
u32 my_thread_index = vm->thread_index;
session_event_t _e, *e = &_e;
svm_msg_q_ring_t *ring;
- stream_session_t *s0;
+ session_t *s0;
svm_msg_q_msg_t *msg;
svm_msg_q_t *mq;
int i, index;
@@ -1092,7 +1091,7 @@ dump_thread_0_event_queue (void)
static u8
session_node_cmp_event (session_event_t * e, svm_fifo_t * f)
{
- stream_session_t *s;
+ session_t *s;
switch (e->event_type)
{
case FIFO_EVENT_APP_RX:
@@ -1110,7 +1109,7 @@ session_node_cmp_event (session_event_t * e, svm_fifo_t * f)
clib_warning ("session has event but doesn't exist!");
break;
}
- if (s->server_rx_fifo == f || s->server_tx_fifo == f)
+ if (s->rx_fifo == f || s->tx_fifo == f)
return 1;
break;
default:
@@ -1229,7 +1228,6 @@ VLIB_REGISTER_NODE (session_queue_process_node) =
};
/* *INDENT-ON* */
-
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/vnet/session/session_rules_table.c b/src/vnet/session/session_rules_table.c
index 6304606ca43..43698408c5d 100644
--- a/src/vnet/session/session_rules_table.c
+++ b/src/vnet/session/session_rules_table.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/session_rules_table.h b/src/vnet/session/session_rules_table.h
index 9088afcca27..2f0554de323 100644
--- a/src/vnet/session/session_rules_table.h
+++ b/src/vnet/session/session_rules_table.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/session_table.c b/src/vnet/session/session_table.c
index c74e290bda7..da3e4cd4096 100644
--- a/src/vnet/session/session_table.c
+++ b/src/vnet/session/session_table.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/session_table.h b/src/vnet/session/session_table.h
index f7f8c91b26c..bf33d50dda6 100644
--- a/src/vnet/session/session_table.h
+++ b/src/vnet/session/session_table.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/stream_session.h b/src/vnet/session/session_types.h
index 63adc2b909b..ec5841f5ea4 100644
--- a/src/vnet/session/stream_session.h
+++ b/src/vnet/session/session_types.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -13,8 +13,8 @@
* limitations under the License.
*/
-#ifndef SRC_VNET_SESSION_STREAM_SESSION_H_
-#define SRC_VNET_SESSION_STREAM_SESSION_H_
+#ifndef SRC_VNET_SESSION_SESSION_TYPES_H_
+#define SRC_VNET_SESSION_SESSION_TYPES_H_
#include <svm/svm_fifo.h>
#include <vnet/session/transport.h>
@@ -37,7 +37,7 @@ typedef enum
SESSION_STATE_TRANSPORT_CLOSED,
SESSION_STATE_CLOSED,
SESSION_STATE_N_STATES,
-} stream_session_state_t;
+} session_state_t;
typedef struct generic_session_
{
@@ -48,11 +48,11 @@ typedef struct generic_session_
u32 session_index; /**< index in owning pool */
} generic_session_t;
-typedef struct _stream_session_t
+typedef struct session_
{
/** fifo pointers. Once allocated, these do not move */
- svm_fifo_t *server_rx_fifo;
- svm_fifo_t *server_tx_fifo;
+ svm_fifo_t *rx_fifo;
+ svm_fifo_t *tx_fifo;
/** Type */
session_type_t session_type;
@@ -99,13 +99,13 @@ typedef struct _stream_session_t
};
CLIB_CACHE_LINE_ALIGN_MARK (pad);
-} stream_session_t;
+} session_t;
typedef struct local_session_
{
/** fifo pointers. Once allocated, these do not move */
- svm_fifo_t *server_rx_fifo;
- svm_fifo_t *server_tx_fifo;
+ svm_fifo_t *rx_fifo;
+ svm_fifo_t *tx_fifo;
/** Type */
session_type_t session_type;
@@ -224,7 +224,7 @@ session_endpoint_fib_proto (session_endpoint_t * sep)
return sep->is_ip4 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6;
}
-#endif /* SRC_VNET_SESSION_STREAM_SESSION_H_ */
+#endif /* SRC_VNET_SESSION_SESSION_TYPES_H_ */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index 0d4ccb549b7..0f86f9e916a 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h
index 952f97d9ac3..71e70e14289 100644
--- a/src/vnet/session/transport.h
+++ b/src/vnet/session/transport.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Copyright (c) 2016-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
diff --git a/src/vnet/session/transport_interface.h b/src/vnet/session/transport_interface.h
index e8a6dbccee8..a287e4f27d5 100644
--- a/src/vnet/session/transport_interface.h
+++ b/src/vnet/session/transport_interface.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at: