summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-02-03 15:26:14 -0800
committerDave Barach <openvpp@barachs.net>2019-02-04 22:00:54 +0000
commit288eaab5964b9211350acad8d742fae4789577fe (patch)
treebdc12155958c6fedf4e976791529fc8a6590d70e
parent8d991d923b52a2692370bfa33902d29ff5d2f826 (diff)
session: cleanup part 1
Rename core data structures. This will break compatibility for out of tree builtin apps. - stream_session_t to session_t - server_rx/tx_fifo to rx/tx_fifo - stream_session.h to session_types.h - update copyright Change-Id: I414097c6e28bcbea866fbf13b8773c7db3f49325 Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r--src/plugins/tlsmbedtls/tls_mbedtls.c33
-rw-r--r--src/plugins/tlsopenssl/tls_async.c2
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.c36
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.h3
-rw-r--r--src/plugins/unittest/session_test.c18
-rw-r--r--src/plugins/unittest/tcp_test.c2
-rw-r--r--src/vcl/vcl_private.c4
-rw-r--r--src/vcl/vcl_private.h4
-rw-r--r--src/vcl/vppcom.c10
-rw-r--r--src/vnet/CMakeLists.txt2
-rw-r--r--src/vnet/session-apps/echo_client.c28
-rw-r--r--src/vnet/session-apps/echo_server.c18
-rw-r--r--src/vnet/session-apps/http_server.c16
-rw-r--r--src/vnet/session-apps/proxy.c52
-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
-rw-r--r--src/vnet/tcp/tcp_input.c10
-rw-r--r--src/vnet/tls/tls.c62
-rw-r--r--src/vnet/tls/tls.h14
-rw-r--r--src/vnet/udp/udp_input.c7
46 files changed, 536 insertions, 555 deletions
diff --git a/src/plugins/tlsmbedtls/tls_mbedtls.c b/src/plugins/tlsmbedtls/tls_mbedtls.c
index 52d124eb84e..93beebe418c 100644
--- a/src/plugins/tlsmbedtls/tls_mbedtls.c
+++ b/src/plugins/tlsmbedtls/tls_mbedtls.c
@@ -158,7 +158,7 @@ tls_get_ctr_drbg ()
static int
tls_net_send (void *ctx_indexp, const unsigned char *buf, size_t len)
{
- stream_session_t *tls_session;
+ session_t *tls_session;
uword ctx_index;
tls_ctx_t *ctx;
int rv;
@@ -166,7 +166,7 @@ tls_net_send (void *ctx_indexp, const unsigned char *buf, size_t len)
ctx_index = pointer_to_uword (ctx_indexp);
ctx = mbedtls_ctx_get (ctx_index);
tls_session = session_get_from_handle (ctx->tls_session_handle);
- rv = svm_fifo_enqueue_nowait (tls_session->server_tx_fifo, len, buf);
+ rv = svm_fifo_enqueue_nowait (tls_session->tx_fifo, len, buf);
if (rv < 0)
return MBEDTLS_ERR_SSL_WANT_WRITE;
tls_add_vpp_q_tx_evt (tls_session);
@@ -176,7 +176,7 @@ tls_net_send (void *ctx_indexp, const unsigned char *buf, size_t len)
static int
tls_net_recv (void *ctx_indexp, unsigned char *buf, size_t len)
{
- stream_session_t *tls_session;
+ session_t *tls_session;
uword ctx_index;
tls_ctx_t *ctx;
int rv;
@@ -184,7 +184,7 @@ tls_net_recv (void *ctx_indexp, unsigned char *buf, size_t len)
ctx_index = pointer_to_uword (ctx_indexp);
ctx = mbedtls_ctx_get (ctx_index);
tls_session = session_get_from_handle (ctx->tls_session_handle);
- rv = svm_fifo_dequeue_nowait (tls_session->server_rx_fifo, len, buf);
+ rv = svm_fifo_dequeue_nowait (tls_session->rx_fifo, len, buf);
return (rv < 0) ? 0 : rv;
}
@@ -427,23 +427,23 @@ mbedtls_ctx_handshake_rx (tls_ctx_t * ctx)
}
static int
-mbedtls_ctx_write (tls_ctx_t * ctx, stream_session_t * app_session)
+mbedtls_ctx_write (tls_ctx_t * ctx, session_t * app_session)
{
mbedtls_ctx_t *mc = (mbedtls_ctx_t *) ctx;
u8 thread_index = ctx->c_thread_index;
mbedtls_main_t *mm = &mbedtls_main;
u32 enq_max, deq_max, deq_now;
- stream_session_t *tls_session;
+ session_t *tls_session;
int wrote;
ASSERT (mc->ssl.state == MBEDTLS_SSL_HANDSHAKE_OVER);
- deq_max = svm_fifo_max_dequeue (app_session->server_tx_fifo);
+ deq_max = svm_fifo_max_dequeue (app_session->tx_fifo);
if (!deq_max)
return 0;
tls_session = session_get_from_handle (ctx->tls_session_handle);
- enq_max = svm_fifo_max_enqueue (tls_session->server_tx_fifo);
+ enq_max = svm_fifo_max_enqueue (tls_session->tx_fifo);
deq_now = clib_min (deq_max, TLS_CHUNK_SIZE);
if (PREDICT_FALSE (enq_max == 0))
@@ -453,8 +453,7 @@ mbedtls_ctx_write (tls_ctx_t * ctx, stream_session_t * app_session)
}
vec_validate (mm->tx_bufs[thread_index], deq_now);
- svm_fifo_peek (app_session->server_tx_fifo, 0, deq_now,
- mm->tx_bufs[thread_index]);
+ svm_fifo_peek (app_session->tx_fifo, 0, deq_now, mm->tx_bufs[thread_index]);
wrote = mbedtls_ssl_write (&mc->ssl, mm->tx_bufs[thread_index], deq_now);
if (wrote <= 0)
@@ -463,7 +462,7 @@ mbedtls_ctx_write (tls_ctx_t * ctx, stream_session_t * app_session)
return 0;
}
- svm_fifo_dequeue_drop (app_session->server_tx_fifo, wrote);
+ svm_fifo_dequeue_drop (app_session->tx_fifo, wrote);
vec_reset_length (mm->tx_bufs[thread_index]);
tls_add_vpp_q_tx_evt (tls_session);
@@ -474,13 +473,13 @@ mbedtls_ctx_write (tls_ctx_t * ctx, stream_session_t * app_session)
}
static int
-mbedtls_ctx_read (tls_ctx_t * ctx, stream_session_t * tls_session)
+mbedtls_ctx_read (tls_ctx_t * ctx, session_t * tls_session)
{
mbedtls_ctx_t *mc = (mbedtls_ctx_t *) ctx;
mbedtls_main_t *mm = &mbedtls_main;
u8 thread_index = ctx->c_thread_index;
u32 deq_max, enq_max, enq_now;
- stream_session_t *app_session;
+ session_t *app_session;
int read, enq;
if (PREDICT_FALSE (mc->ssl.state != MBEDTLS_SSL_HANDSHAKE_OVER))
@@ -489,12 +488,12 @@ mbedtls_ctx_read (tls_ctx_t * ctx, stream_session_t * tls_session)
return 0;
}
- deq_max = svm_fifo_max_dequeue (tls_session->server_rx_fifo);
+ deq_max = svm_fifo_max_dequeue (tls_session->rx_fifo);
if (!deq_max)
return 0;
app_session = session_get_from_handle (ctx->app_session_handle);
- enq_max = svm_fifo_max_enqueue (app_session->server_rx_fifo);
+ enq_max = svm_fifo_max_enqueue (app_session->rx_fifo);
enq_now = clib_min (enq_max, TLS_CHUNK_SIZE);
if (PREDICT_FALSE (enq_now == 0))
@@ -511,12 +510,12 @@ mbedtls_ctx_read (tls_ctx_t * ctx, stream_session_t * tls_session)
return 0;
}
- enq = svm_fifo_enqueue_nowait (app_session->server_rx_fifo, read,
+ enq = svm_fifo_enqueue_nowait (app_session->rx_fifo, read,
mm->rx_bufs[thread_index]);
ASSERT (enq == read);
vec_reset_length (mm->rx_bufs[thread_index]);
- if (svm_fifo_max_dequeue (tls_session->server_rx_fifo))
+ if (svm_fifo_max_dequeue (tls_session->rx_fifo))
tls_add_vpp_q_builtin_rx_evt (tls_session);
if (enq > 0)
diff --git a/src/plugins/tlsopenssl/tls_async.c b/src/plugins/tlsopenssl/tls_async.c
index facb94ec253..ade073c66bc 100644
--- a/src/plugins/tlsopenssl/tls_async.c
+++ b/src/plugins/tlsopenssl/tls_async.c
@@ -342,7 +342,7 @@ event_handler (void *tls_async)
openssl_resume_handler *handler;
openssl_evt_t *callback;
- stream_session_t *tls_session;
+ session_t *tls_session;
int thread_index;
tls_ctx_t *ctx;
diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c
index 9585e3f828b..0a25ecfa943 100644
--- a/src/plugins/tlsopenssl/tls_openssl.c
+++ b/src/plugins/tlsopenssl/tls_openssl.c
@@ -105,14 +105,13 @@ openssl_lctx_get (u32 lctx_index)
}
static int
-openssl_try_handshake_read (openssl_ctx_t * oc,
- stream_session_t * tls_session)
+openssl_try_handshake_read (openssl_ctx_t * oc, session_t * tls_session)
{
u32 deq_max, deq_now;
svm_fifo_t *f;
int wrote, rv;
- f = tls_session->server_rx_fifo;
+ f = tls_session->rx_fifo;
deq_max = svm_fifo_max_dequeue (f);
if (!deq_max)
return 0;
@@ -137,8 +136,7 @@ openssl_try_handshake_read (openssl_ctx_t * oc,
}
static int
-openssl_try_handshake_write (openssl_ctx_t * oc,
- stream_session_t * tls_session)
+openssl_try_handshake_write (openssl_ctx_t * oc, session_t * tls_session)
{
u32 enq_max, deq_now;
svm_fifo_t *f;
@@ -147,7 +145,7 @@ openssl_try_handshake_write (openssl_ctx_t * oc,
if (BIO_ctrl_pending (oc->rbio) <= 0)
return 0;
- f = tls_session->server_tx_fifo;
+ f = tls_session->tx_fifo;
enq_max = svm_fifo_max_enqueue (f);
if (!enq_max)
return 0;
@@ -207,7 +205,7 @@ vpp_ssl_async_retry_func (tls_ctx_t * ctx, openssl_resume_handler * handler)
#endif
int
-openssl_ctx_handshake_rx (tls_ctx_t * ctx, stream_session_t * tls_session)
+openssl_ctx_handshake_rx (tls_ctx_t * ctx, session_t * tls_session)
{
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
int rv = 0, err;
@@ -299,15 +297,15 @@ openssl_ctx_handshake_rx (tls_ctx_t * ctx, stream_session_t * tls_session)
}
static inline int
-openssl_ctx_write (tls_ctx_t * ctx, stream_session_t * app_session)
+openssl_ctx_write (tls_ctx_t * ctx, session_t * app_session)
{
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
int wrote = 0, rv, read, max_buf = 100 * TLS_CHUNK_SIZE, max_space;
u32 enq_max, deq_max, deq_now, to_write;
- stream_session_t *tls_session;
+ session_t *tls_session;
svm_fifo_t *f;
- f = app_session->server_tx_fifo;
+ f = app_session->tx_fifo;
deq_max = svm_fifo_max_dequeue (f);
if (!deq_max)
goto check_tls_fifo;
@@ -322,14 +320,14 @@ openssl_ctx_write (tls_ctx_t * ctx, stream_session_t * app_session)
tls_add_vpp_q_builtin_tx_evt (app_session);
goto check_tls_fifo;
}
- svm_fifo_dequeue_drop (app_session->server_tx_fifo, wrote);
+ svm_fifo_dequeue_drop (app_session->tx_fifo, wrote);
if (wrote < deq_now)
{
to_write = clib_min (svm_fifo_max_read_chunk (f), deq_now - wrote);
rv = SSL_write (oc->ssl, svm_fifo_head (f), to_write);
if (rv > 0)
{
- svm_fifo_dequeue_drop (app_session->server_tx_fifo, rv);
+ svm_fifo_dequeue_drop (app_session->tx_fifo, rv);
wrote += rv;
}
}
@@ -343,7 +341,7 @@ check_tls_fifo:
return wrote;
tls_session = session_get_from_handle (ctx->tls_session_handle);
- f = tls_session->server_tx_fifo;
+ f = tls_session->tx_fifo;
enq_max = svm_fifo_max_enqueue (f);
if (!enq_max)
{
@@ -377,12 +375,12 @@ check_tls_fifo:
}
static inline int
-openssl_ctx_read (tls_ctx_t * ctx, stream_session_t * tls_session)
+openssl_ctx_read (tls_ctx_t * ctx, session_t * tls_session)
{
int read, wrote = 0, max_space, max_buf = 100 * TLS_CHUNK_SIZE, rv;
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
u32 deq_max, enq_max, deq_now, to_read;
- stream_session_t *app_session;
+ session_t *app_session;
svm_fifo_t *f;
if (PREDICT_FALSE (SSL_in_init (oc->ssl)))
@@ -391,7 +389,7 @@ openssl_ctx_read (tls_ctx_t * ctx, stream_session_t * tls_session)
return 0;
}
- f = tls_session->server_rx_fifo;
+ f = tls_session->rx_fifo;
deq_max = svm_fifo_max_dequeue (f);
max_space = max_buf - BIO_ctrl_pending (oc->wbio);
max_space = max_space < 0 ? 0 : max_space;
@@ -426,7 +424,7 @@ check_app_fifo:
return wrote;
app_session = session_get_from_handle (ctx->app_session_handle);
- f = app_session->server_rx_fifo;
+ f = app_session->rx_fifo;
enq_max = svm_fifo_max_enqueue (f);
if (!enq_max)
{
@@ -463,7 +461,7 @@ openssl_ctx_init_client (tls_ctx_t * ctx)
long flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION;
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
openssl_main_t *om = &openssl_main;
- stream_session_t *tls_session;
+ session_t *tls_session;
const SSL_METHOD *method;
int rv, err;
#ifdef HAVE_OPENSSL_ASYNC
@@ -662,7 +660,7 @@ openssl_ctx_init_server (tls_ctx_t * ctx)
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
u32 olc_index = ctx->tls_ssl_ctx;
openssl_listen_ctx_t *olc;
- stream_session_t *tls_session;
+ session_t *tls_session;
int rv, err;
#ifdef HAVE_OPENSSL_ASYNC
openssl_resume_handler *handler;
diff --git a/src/plugins/tlsopenssl/tls_openssl.h b/src/plugins/tlsopenssl/tls_openssl.h
index 712b4cac628..66e0b364cba 100644
--- a/src/plugins/tlsopenssl/tls_openssl.h
+++ b/src/plugins/tlsopenssl/tls_openssl.h
@@ -57,8 +57,7 @@ typedef struct openssl_tls_callback_
void *arg;
} openssl_tls_callback_t;
-typedef int openssl_resume_handler (tls_ctx_t * ctx,
- stream_session_t * tls_session);
+typedef int openssl_resume_handler (tls_ctx_t * ctx, session_t * tls_session);
tls_ctx_t *openssl_ctx_get_w_thread (u32 ctx_index, u8 thread_index);
openssl_tls_callback_t *vpp_add_async_pending_event (tls_ctx_t * ctx,
diff --git a/src/plugins/unittest/session_test.c b/src/plugins/unittest/session_test.c
index cc273321d32..1689709728e 100644
--- a/src/plugins/unittest/session_test.c
+++ b/src/plugins/unittest/session_test.c
@@ -41,7 +41,7 @@
}
void
-dummy_session_reset_callback (stream_session_t * s)
+dummy_session_reset_callback (session_t * s)
{
clib_warning ("called...");
}
@@ -50,7 +50,7 @@ volatile u32 connected_session_index = ~0;
volatile u32 connected_session_thread = ~0;
int
dummy_session_connected_callback (u32 app_index, u32 api_context,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
if (s)
{
@@ -77,7 +77,7 @@ dummy_del_segment_callback (u32 client_index, u64 segment_handle)
}
void
-dummy_session_disconnect_callback (stream_session_t * s)
+dummy_session_disconnect_callback (session_t * s)
{
clib_warning ("called...");
}
@@ -87,7 +87,7 @@ volatile u32 accepted_session_index;
volatile u32 accepted_session_thread;
int
-dummy_session_accept_callback (stream_session_t * s)
+dummy_session_accept_callback (session_t * s)
{
dummy_accept = 1;
accepted_session_index = s->session_index;
@@ -97,7 +97,7 @@ dummy_session_accept_callback (stream_session_t * s)
}
int
-dummy_server_rx_callback (stream_session_t * s)
+dummy_server_rx_callback (session_t * s)
{
clib_warning ("called...");
return -1;
@@ -276,7 +276,7 @@ session_test_endpoint_cfg (vlib_main_t * vm, unformat_input_t * input)
session_endpoint_t server_sep = SESSION_ENDPOINT_NULL;
ip4_address_t intf_addr[3];
transport_connection_t *tc;
- stream_session_t *s;
+ session_t *s;
clib_error_t *error;
u8 *appns_id;
@@ -428,7 +428,7 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input)
u8 *ns_id = format (0, "appns1");
app_namespace_t *app_ns;
application_t *server;
- stream_session_t *s;
+ session_t *s;
u64 handle;
int code;
@@ -1025,7 +1025,7 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input)
u32 dummy_port = 1111;
clib_error_t *error = 0;
u8 is_filtered = 0, *ns_id = format (0, "appns1");
- stream_session_t *listener, *s;
+ session_t *listener, *s;
app_namespace_t *default_ns = app_namespace_get_default ();
u32 local_ns_index = default_ns->local_table_index;
int verbose = 0, rv;
@@ -1589,7 +1589,7 @@ session_test_proxy (vlib_main_t * vm, unformat_input_t * input)
u32 dummy_server_api_index = ~0, sw_if_index = 0;
clib_error_t *error = 0;
u8 is_filtered = 0;
- stream_session_t *s;
+ session_t *s;
transport_connection_t *tc;
u16 lcl_port = 1234, rmt_port = 4321;
app_namespace_t *app_ns;
diff --git a/src/plugins/unittest/tcp_test.c b/src/plugins/unittest/tcp_test.c
index 66260df2ff6..5905dc2adab 100644
--- a/src/plugins/unittest/tcp_test.c
+++ b/src/plugins/unittest/tcp_test.c
@@ -1639,7 +1639,7 @@ tcp_test_lookup (vlib_main_t * vm, unformat_input_t * input)
tcp_main_t *tm = &tcp_main;
transport_connection_t _tc1, *tc1 = &_tc1, _tc2, *tc2 = &_tc2, *tconn;
tcp_connection_t *tc;
- stream_session_t *s, *s1;
+ session_t *s, *s1;
u8 cmp = 0, is_filtered = 0;
u32 sidx;
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index 5f9ce270508..6c364e376f7 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -404,7 +404,7 @@ vcl_session_read_ready (vcl_session_t * session)
if (PREDICT_FALSE (!(session->session_state & (STATE_OPEN | STATE_LISTEN))))
{
- session_state_t state = session->session_state;
+ vcl_session_state_t state = session->session_state;
int rv;
rv = ((state & STATE_DISCONNECT) ? VPPCOM_ECONNRESET : VPPCOM_ENOTCONN);
@@ -442,7 +442,7 @@ vcl_session_write_ready (vcl_session_t * session)
if (PREDICT_FALSE (!(session->session_state & STATE_OPEN)))
{
- session_state_t state = session->session_state;
+ vcl_session_state_t state = session->session_state;
int rv;
rv = ((state & STATE_DISCONNECT) ? VPPCOM_ECONNRESET : VPPCOM_ENOTCONN);
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 39c9e7207c7..d55ecd4c72d 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -72,7 +72,7 @@ typedef enum
STATE_FAILED = 0x20,
STATE_UPDATED = 0x40,
STATE_LISTEN_NO_MQ = 0x80,
-} session_state_t;
+} vcl_session_state_t;
#define SERVER_STATE_OPEN (STATE_ACCEPT|STATE_VPP_CLOSING)
#define CLIENT_STATE_OPEN (STATE_CONNECT|STATE_VPP_CLOSING)
@@ -496,7 +496,7 @@ vcl_session_table_lookup_listener (vcl_worker_t * wrk, u64 listener_handle)
return session;
}
-const char *vppcom_session_state_str (session_state_t state);
+const char *vppcom_session_state_str (vcl_session_state_t state);
static inline u8
vcl_session_is_ct (vcl_session_t * s)
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 3c3e15d146c..eecb2f48ce2 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -60,7 +60,7 @@ vcl_mq_dequeue_batch (vcl_worker_t * wrk, svm_msg_q_t * mq)
}
const char *
-vppcom_session_state_str (session_state_t state)
+vppcom_session_state_str (vcl_session_state_t state)
{
char *st;
@@ -684,7 +684,7 @@ vcl_handle_mq_event (vcl_worker_t * wrk, session_event_t * e)
static int
vppcom_wait_for_session_state_change (u32 session_index,
- session_state_t state,
+ vcl_session_state_t state,
f64 wait_for_time)
{
vcl_worker_t *wrk = vcl_worker_get_current ();
@@ -730,7 +730,7 @@ vppcom_wait_for_session_state_change (u32 session_index,
static void
vcl_handle_pending_wrk_updates (vcl_worker_t * wrk)
{
- session_state_t state;
+ vcl_session_state_t state;
vcl_session_t *s;
u32 *sip;
@@ -840,7 +840,7 @@ vppcom_session_disconnect (u32 session_handle)
vcl_worker_t *wrk = vcl_worker_get_current ();
svm_msg_q_t *vpp_evt_q;
vcl_session_t *session;
- session_state_t state;
+ vcl_session_state_t state;
u64 vpp_handle;
session = vcl_session_get_w_handle (wrk, session_handle);
@@ -1027,7 +1027,7 @@ int
vcl_session_cleanup (vcl_worker_t * wrk, vcl_session_t * session,
vcl_session_handle_t sh, u8 do_disconnect)
{
- session_state_t state;
+ vcl_session_state_t state;
u32 next_sh, vep_sh;
int rv = VPPCOM_OK;
u64 vpp_handle;
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index bc581620488..e14f0877bd5 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -1049,7 +1049,7 @@ list(APPEND VNET_HEADERS
session/session.h
session/session_table.h
session/session_rules_table.h
- session/stream_session.h
+ session/session_types.h
session/session_lookup.h
session/application.h
session/transport.h
diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c
index d100aae5c2a..c39f787c093 100644
--- a/src/vnet/session-apps/echo_client.c
+++ b/src/vnet/session-apps/echo_client.c
@@ -263,7 +263,7 @@ echo_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
}
if (PREDICT_FALSE (delete_session == 1))
{
- stream_session_t *s;
+ session_t *s;
clib_atomic_fetch_add (&ecm->tx_total, sp->bytes_sent);
clib_atomic_fetch_add (&ecm->rx_total, sp->bytes_received);
@@ -356,7 +356,7 @@ echo_clients_init (vlib_main_t * vm)
static int
echo_clients_session_connected_callback (u32 app_index, u32 api_context,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
echo_client_main_t *ecm = &echo_client_main;
eclient_session_t *session;
@@ -393,9 +393,9 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
session_index = session - ecm->sessions;
session->bytes_to_send = ecm->bytes_to_send;
session->bytes_to_receive = ecm->no_return ? 0ULL : ecm->bytes_to_send;
- session->data.rx_fifo = s->server_rx_fifo;
+ session->data.rx_fifo = s->rx_fifo;
session->data.rx_fifo->client_session_index = session_index;
- session->data.tx_fifo = s->server_tx_fifo;
+ session->data.tx_fifo = s->tx_fifo;
session->data.tx_fifo->client_session_index = session_index;
session->data.vpp_evt_q = ecm->vpp_event_queue[thread_index];
session->vpp_session_handle = session_handle (s);
@@ -422,7 +422,7 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
}
static void
-echo_clients_session_reset_callback (stream_session_t * s)
+echo_clients_session_reset_callback (session_t * s)
{
echo_client_main_t *ecm = &echo_client_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -437,13 +437,13 @@ echo_clients_session_reset_callback (stream_session_t * s)
}
static int
-echo_clients_session_create_callback (stream_session_t * s)
+echo_clients_session_create_callback (session_t * s)
{
return 0;
}
static void
-echo_clients_session_disconnect_callback (stream_session_t * s)
+echo_clients_session_disconnect_callback (session_t * s)
{
echo_client_main_t *ecm = &echo_client_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -454,7 +454,7 @@ echo_clients_session_disconnect_callback (stream_session_t * s)
}
void
-echo_clients_session_disconnect (stream_session_t * s)
+echo_clients_session_disconnect (session_t * s)
{
echo_client_main_t *ecm = &echo_client_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -464,7 +464,7 @@ echo_clients_session_disconnect (stream_session_t * s)
}
static int
-echo_clients_rx_callback (stream_session_t * s)
+echo_clients_rx_callback (session_t * s)
{
echo_client_main_t *ecm = &echo_client_main;
eclient_session_t *sp;
@@ -475,15 +475,13 @@ echo_clients_rx_callback (stream_session_t * s)
return -1;
}
- sp = pool_elt_at_index (ecm->sessions,
- s->server_rx_fifo->client_session_index);
+ sp = pool_elt_at_index (ecm->sessions, s->rx_fifo->client_session_index);
receive_data_chunk (ecm, sp);
- if (svm_fifo_max_dequeue (s->server_rx_fifo))
+ if (svm_fifo_max_dequeue (s->rx_fifo))
{
- if (svm_fifo_set_event (s->server_rx_fifo))
- session_send_io_evt_to_thread (s->server_rx_fifo,
- FIFO_EVENT_BUILTIN_RX);
+ if (svm_fifo_set_event (s->rx_fifo))
+ session_send_io_evt_to_thread (s->rx_fifo, FIFO_EVENT_BUILTIN_RX);
}
return 0;
}
diff --git a/src/vnet/session-apps/echo_server.c b/src/vnet/session-apps/echo_server.c
index c0fdb131603..0229da35624 100644
--- a/src/vnet/session-apps/echo_server.c
+++ b/src/vnet/session-apps/echo_server.c
@@ -55,7 +55,7 @@ typedef struct
echo_server_main_t echo_server_main;
int
-echo_server_session_accept_callback (stream_session_t * s)
+echo_server_session_accept_callback (session_t * s)
{
echo_server_main_t *esm = &echo_server_main;
@@ -70,7 +70,7 @@ echo_server_session_accept_callback (stream_session_t * s)
}
void
-echo_server_session_disconnect_callback (stream_session_t * s)
+echo_server_session_disconnect_callback (session_t * s)
{
echo_server_main_t *esm = &echo_server_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -81,7 +81,7 @@ echo_server_session_disconnect_callback (stream_session_t * s)
}
void
-echo_server_session_reset_callback (stream_session_t * s)
+echo_server_session_reset_callback (session_t * s)
{
echo_server_main_t *esm = &echo_server_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -93,7 +93,7 @@ echo_server_session_reset_callback (stream_session_t * s)
int
echo_server_session_connected_callback (u32 app_index, u32 api_context,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
clib_warning ("called...");
return -1;
@@ -135,15 +135,15 @@ test_bytes (echo_server_main_t * esm, int actual_transfer)
* If no-echo, just drop the data and be done with it.
*/
int
-echo_server_builtin_server_rx_callback_no_echo (stream_session_t * s)
+echo_server_builtin_server_rx_callback_no_echo (session_t * s)
{
- svm_fifo_t *rx_fifo = s->server_rx_fifo;
+ svm_fifo_t *rx_fifo = s->rx_fifo;
svm_fifo_dequeue_drop (rx_fifo, svm_fifo_max_dequeue (rx_fifo));
return 0;
}
int
-echo_server_rx_callback (stream_session_t * s)
+echo_server_rx_callback (session_t * s)
{
u32 n_written, max_dequeue, max_enqueue, max_transfer;
int actual_transfer;
@@ -154,8 +154,8 @@ echo_server_rx_callback (stream_session_t * s)
ASSERT (s->thread_index == thread_index);
- rx_fifo = s->server_rx_fifo;
- tx_fifo = s->server_tx_fifo;
+ rx_fifo = s->rx_fifo;
+ tx_fifo = s->tx_fifo;
ASSERT (rx_fifo->master_thread_index == thread_index);
ASSERT (tx_fifo->master_thread_index == thread_index);
diff --git a/src/vnet/session-apps/http_server.c b/src/vnet/session-apps/http_server.c
index 719608a79d1..25d83214112 100644
--- a/src/vnet/session-apps/http_server.c
+++ b/src/vnet/session-apps/http_server.c
@@ -475,7 +475,7 @@ session_rx_request (http_session_t * hs)
}
static int
-http_server_rx_callback (stream_session_t * s)
+http_server_rx_callback (session_t * s)
{
http_server_args *args;
http_session_t *hs;
@@ -507,7 +507,7 @@ http_server_rx_callback (stream_session_t * s)
}
static int
-http_server_rx_callback_static (stream_session_t * s)
+http_server_rx_callback_static (session_t * s)
{
http_server_main_t *hsm = &http_server_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -578,7 +578,7 @@ wait_for_data:
}
static int
-http_server_session_accept_callback (stream_session_t * s)
+http_server_session_accept_callback (session_t * s)
{
http_server_main_t *hsm = &http_server_main;
http_session_t *hs;
@@ -592,8 +592,8 @@ http_server_session_accept_callback (stream_session_t * s)
hs = http_server_session_alloc (s->thread_index);
http_server_session_lookup_add (s->thread_index, s->session_index,
hs->session_index);
- hs->rx_fifo = s->server_rx_fifo;
- hs->tx_fifo = s->server_tx_fifo;
+ hs->rx_fifo = s->rx_fifo;
+ hs->tx_fifo = s->tx_fifo;
hs->vpp_session_index = s->session_index;
hs->vpp_session_handle = session_handle (s);
hs->session_state = HTTP_STATE_ESTABLISHED;
@@ -606,7 +606,7 @@ http_server_session_accept_callback (stream_session_t * s)
}
static void
-http_server_session_disconnect_callback (stream_session_t * s)
+http_server_session_disconnect_callback (session_t * s)
{
http_server_main_t *hsm = &http_server_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -627,7 +627,7 @@ http_server_session_disconnect_callback (stream_session_t * s)
}
static void
-http_server_session_reset_callback (stream_session_t * s)
+http_server_session_reset_callback (session_t * s)
{
http_server_main_t *hsm = &http_server_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -649,7 +649,7 @@ http_server_session_reset_callback (stream_session_t * s)
static int
http_server_session_connected_callback (u32 app_index, u32 api_context,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
clib_warning ("called...");
return -1;
diff --git a/src/vnet/session-apps/proxy.c b/src/vnet/session-apps/proxy.c
index 06c095440bc..063c13cda35 100644
--- a/src/vnet/session-apps/proxy.c
+++ b/src/vnet/session-apps/proxy.c
@@ -59,13 +59,13 @@ proxy_call_main_thread (vnet_connect_args_t * a)
}
static void
-delete_proxy_session (stream_session_t * s, int is_active_open)
+delete_proxy_session (session_t * s, int is_active_open)
{
proxy_main_t *pm = &proxy_main;
proxy_session_t *ps = 0;
vnet_disconnect_args_t _a, *a = &_a;
- stream_session_t *active_open_session = 0;
- stream_session_t *server_session = 0;
+ session_t *active_open_session = 0;
+ session_t *server_session = 0;
uword *p;
u64 handle;
@@ -143,7 +143,7 @@ delete_proxy_session (stream_session_t * s, int is_active_open)
}
static int
-proxy_accept_callback (stream_session_t * s)
+proxy_accept_callback (session_t * s)
{
proxy_main_t *pm = &proxy_main;
@@ -155,13 +155,13 @@ proxy_accept_callback (stream_session_t * s)
}
static void
-proxy_disconnect_callback (stream_session_t * s)
+proxy_disconnect_callback (session_t * s)
{
delete_proxy_session (s, 0 /* is_active_open */ );
}
static void
-proxy_reset_callback (stream_session_t * s)
+proxy_reset_callback (session_t * s)
{
clib_warning ("Reset session %U", format_stream_session, s, 2);
delete_proxy_session (s, 0 /* is_active_open */ );
@@ -169,7 +169,7 @@ proxy_reset_callback (stream_session_t * s)
static int
proxy_connected_callback (u32 app_index, u32 api_context,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
clib_warning ("called...");
return -1;
@@ -183,7 +183,7 @@ proxy_add_segment_callback (u32 client_index, u64 segment_handle)
}
static int
-proxy_rx_callback (stream_session_t * s)
+proxy_rx_callback (session_t * s)
{
u32 max_dequeue;
int actual_transfer __attribute__ ((unused));
@@ -204,7 +204,7 @@ proxy_rx_callback (stream_session_t * s)
if (PREDICT_TRUE (p != 0))
{
clib_spinlock_unlock_if_init (&pm->sessions_lock);
- active_open_tx_fifo = s->server_rx_fifo;
+ active_open_tx_fifo = s->rx_fifo;
/*
* Send event for active open tx fifo
@@ -220,13 +220,13 @@ proxy_rx_callback (stream_session_t * s)
}
else
{
- rx_fifo = s->server_rx_fifo;
- tx_fifo = s->server_tx_fifo;
+ rx_fifo = s->rx_fifo;
+ tx_fifo = s->tx_fifo;
ASSERT (rx_fifo->master_thread_index == thread_index);
ASSERT (tx_fifo->master_thread_index == thread_index);
- max_dequeue = svm_fifo_max_dequeue (s->server_rx_fifo);
+ max_dequeue = svm_fifo_max_dequeue (s->rx_fifo);
if (PREDICT_FALSE (max_dequeue == 0))
return 0;
@@ -272,7 +272,7 @@ static session_cb_vft_t proxy_session_cb_vft = {
static int
active_open_connected_callback (u32 app_index, u32 opaque,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
proxy_main_t *pm = &proxy_main;
proxy_session_t *ps;
@@ -292,23 +292,23 @@ active_open_connected_callback (u32 app_index, u32 opaque,
ps = pool_elt_at_index (pm->sessions, opaque);
ps->vpp_active_open_handle = session_handle (s);
- s->server_tx_fifo = ps->server_rx_fifo;
- s->server_rx_fifo = ps->server_tx_fifo;
+ s->tx_fifo = ps->server_rx_fifo;
+ s->rx_fifo = ps->server_tx_fifo;
/*
* Reset the active-open tx-fifo master indices so the active-open session
* will receive data, etc.
*/
- s->server_tx_fifo->master_session_index = s->session_index;
- s->server_tx_fifo->master_thread_index = s->thread_index;
+ s->tx_fifo->master_session_index = s->session_index;
+ s->tx_fifo->master_thread_index = s->thread_index;
/*
* Account for the active-open session's use of the fifos
* so they won't disappear until the last session which uses
* them disappears
*/
- s->server_tx_fifo->refcnt++;
- s->server_rx_fifo->refcnt++;
+ s->tx_fifo->refcnt++;
+ s->rx_fifo->refcnt++;
hash_set (pm->proxy_session_by_active_open_handle,
ps->vpp_active_open_handle, opaque);
@@ -319,36 +319,36 @@ active_open_connected_callback (u32 app_index, u32 opaque,
* Send event for active open tx fifo
*/
ASSERT (s->thread_index == thread_index);
- if (svm_fifo_set_event (s->server_tx_fifo))
- session_send_io_evt_to_thread (s->server_tx_fifo, FIFO_EVENT_APP_TX);
+ if (svm_fifo_set_event (s->tx_fifo))
+ session_send_io_evt_to_thread (s->tx_fifo, FIFO_EVENT_APP_TX);
return 0;
}
static void
-active_open_reset_callback (stream_session_t * s)
+active_open_reset_callback (session_t * s)
{
delete_proxy_session (s, 1 /* is_active_open */ );
}
static int
-active_open_create_callback (stream_session_t * s)
+active_open_create_callback (session_t * s)
{
return 0;
}
static void
-active_open_disconnect_callback (stream_session_t * s)
+active_open_disconnect_callback (session_t * s)
{
delete_proxy_session (s, 1 /* is_active_open */ );
}
static int
-active_open_rx_callback (stream_session_t * s)
+active_open_rx_callback (session_t * s)
{
svm_fifo_t *proxy_tx_fifo;
- proxy_tx_fifo = s->server_rx_fifo;
+ proxy_tx_fifo = s->rx_fifo;
/*
* Send event for server tx fifo
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:
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index 6a376350595..84a286b0b5e 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -1798,7 +1798,7 @@ static int
tcp_session_enqueue_ooo (tcp_connection_t * tc, vlib_buffer_t * b,
u16 data_len)
{
- stream_session_t *s0;
+ session_t *s0;
int rv, offset;
ASSERT (seq_gt (vnet_buffer (b)->tcp.seq_number, tc->rcv_nxt));
@@ -1828,15 +1828,15 @@ tcp_session_enqueue_ooo (tcp_connection_t * tc, vlib_buffer_t * b,
s0 = session_get (tc->c_s_index, tc->c_thread_index);
/* Get the newest segment from the fifo */
- newest = svm_fifo_newest_ooo_segment (s0->server_rx_fifo);
+ newest = svm_fifo_newest_ooo_segment (s0->rx_fifo);
if (newest)
{
- offset = ooo_segment_offset (s0->server_rx_fifo, newest);
+ offset = ooo_segment_offset (s0->rx_fifo, newest);
ASSERT (offset <= vnet_buffer (b)->tcp.seq_number - tc->rcv_nxt);
start = tc->rcv_nxt + offset;
- end = start + ooo_segment_length (s0->server_rx_fifo, newest);
+ end = start + ooo_segment_length (s0->rx_fifo, newest);
tcp_update_sack_list (tc, start, end);
- svm_fifo_newest_ooo_segment_reset (s0->server_rx_fifo);
+ svm_fifo_newest_ooo_segment_reset (s0->rx_fifo);
TCP_EVT_DBG (TCP_EVT_CC_SACKS, tc);
}
}
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index d51d5dbaa38..3f21e6e3cb2 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -51,40 +51,40 @@ tls_get_available_engine (void)
}
int
-tls_add_vpp_q_rx_evt (stream_session_t * s)
+tls_add_vpp_q_rx_evt (session_t * s)
{
- if (svm_fifo_set_event (s->server_rx_fifo))
- session_send_io_evt_to_thread (s->server_rx_fifo, FIFO_EVENT_APP_RX);
+ if (svm_fifo_set_event (s->rx_fifo))
+ session_send_io_evt_to_thread (s->rx_fifo, FIFO_EVENT_APP_RX);
return 0;
}
int
-tls_add_vpp_q_builtin_rx_evt (stream_session_t * s)
+tls_add_vpp_q_builtin_rx_evt (session_t * s)
{
- if (svm_fifo_set_event (s->server_rx_fifo))
- session_send_io_evt_to_thread (s->server_rx_fifo, FIFO_EVENT_BUILTIN_RX);
+ if (svm_fifo_set_event (s->rx_fifo))
+ session_send_io_evt_to_thread (s->rx_fifo, FIFO_EVENT_BUILTIN_RX);
return 0;
}
int
-tls_add_vpp_q_tx_evt (stream_session_t * s)
+tls_add_vpp_q_tx_evt (session_t * s)
{
- if (svm_fifo_set_event (s->server_tx_fifo))
- session_send_io_evt_to_thread (s->server_tx_fifo, FIFO_EVENT_APP_TX);
+ if (svm_fifo_set_event (s->tx_fifo))
+ session_send_io_evt_to_thread (s->tx_fifo, FIFO_EVENT_APP_TX);
return 0;
}
int
-tls_add_vpp_q_builtin_tx_evt (stream_session_t * s)
+tls_add_vpp_q_builtin_tx_evt (session_t * s)
{
- if (svm_fifo_set_event (s->server_tx_fifo))
+ if (svm_fifo_set_event (s->tx_fifo))
session_send_io_evt_to_thread_custom (s, s->thread_index,
FIFO_EVENT_BUILTIN_TX);
return 0;
}
static inline int
-tls_add_app_q_evt (app_worker_t * app, stream_session_t * app_session)
+tls_add_app_q_evt (app_worker_t * app, session_t * app_session)
{
return app_worker_lock_and_send_event (app, app_session, FIFO_EVENT_APP_RX);
}
@@ -178,7 +178,7 @@ tls_ctx_half_open_index (tls_ctx_t * ctx)
}
void
-tls_notify_app_enqueue (tls_ctx_t * ctx, stream_session_t * app_session)
+tls_notify_app_enqueue (tls_ctx_t * ctx, session_t * app_session)
{
app_worker_t *app;
app = app_worker_get_if_valid (app_session->app_wrk_index);
@@ -189,7 +189,7 @@ tls_notify_app_enqueue (tls_ctx_t * ctx, stream_session_t * app_session)
int
tls_notify_app_accept (tls_ctx_t * ctx)
{
- stream_session_t *app_listener, *app_session;
+ session_t *app_listener, *app_session;
segment_manager_t *sm;
app_worker_t *app_wrk;
application_t *app;
@@ -230,8 +230,8 @@ tls_notify_app_accept (tls_ctx_t * ctx)
int
tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed)
{
- int (*cb_fn) (u32, u32, stream_session_t *, u8);
- stream_session_t *app_session;
+ int (*cb_fn) (u32, u32, session_t *, u8);
+ session_t *app_session;
segment_manager_t *sm;
app_worker_t *app_wrk;
application_t *app;
@@ -341,13 +341,13 @@ tls_ctx_init_client (tls_ctx_t * ctx)
}
static inline int
-tls_ctx_write (tls_ctx_t * ctx, stream_session_t * app_session)
+tls_ctx_write (tls_ctx_t * ctx, session_t * app_session)
{
return tls_vfts[ctx->tls_ctx_engine].ctx_write (ctx, app_session);
}
static inline int
-tls_ctx_read (tls_ctx_t * ctx, stream_session_t * tls_session)
+tls_ctx_read (tls_ctx_t * ctx, session_t * tls_session)
{
return tls_vfts[ctx->tls_ctx_engine].ctx_read (ctx, tls_session);
}
@@ -359,7 +359,7 @@ tls_ctx_handshake_is_over (tls_ctx_t * ctx)
}
void
-tls_session_reset_callback (stream_session_t * s)
+tls_session_reset_callback (session_t * s)
{
clib_warning ("called...");
}
@@ -378,9 +378,9 @@ tls_del_segment_callback (u32 client_index, u64 segment_handle)
}
void
-tls_session_disconnect_callback (stream_session_t * tls_session)
+tls_session_disconnect_callback (session_t * tls_session)
{
- stream_session_t *app_session;
+ session_t *app_session;
tls_ctx_t *ctx;
app_worker_t *app_wrk;
application_t *app;
@@ -399,9 +399,9 @@ tls_session_disconnect_callback (stream_session_t * tls_session)
}
int
-tls_session_accept_callback (stream_session_t * tls_session)
+tls_session_accept_callback (session_t * tls_session)
{
- stream_session_t *tls_listener, *app_session;
+ session_t *tls_listener, *app_session;
tls_ctx_t *lctx, *ctx;
u32 ctx_handle;
@@ -431,7 +431,7 @@ tls_session_accept_callback (stream_session_t * tls_session)
}
int
-tls_app_tx_callback (stream_session_t * app_session)
+tls_app_tx_callback (session_t * app_session)
{
tls_ctx_t *ctx;
if (PREDICT_FALSE (app_session->session_state == SESSION_STATE_CLOSED))
@@ -442,7 +442,7 @@ tls_app_tx_callback (stream_session_t * app_session)
}
int
-tls_app_rx_callback (stream_session_t * tls_session)
+tls_app_rx_callback (session_t * tls_session)
{
tls_ctx_t *ctx;
@@ -453,9 +453,9 @@ tls_app_rx_callback (stream_session_t * tls_session)
int
tls_session_connected_callback (u32 tls_app_index, u32 ho_ctx_index,
- stream_session_t * tls_session, u8 is_fail)
+ session_t * tls_session, u8 is_fail)
{
- stream_session_t *app_session;
+ session_t *app_session;
tls_ctx_t *ho_ctx, *ctx;
u32 ctx_handle;
@@ -463,7 +463,7 @@ tls_session_connected_callback (u32 tls_app_index, u32 ho_ctx_index,
if (is_fail)
{
- int (*cb_fn) (u32, u32, stream_session_t *, u8), rv = 0;
+ int (*cb_fn) (u32, u32, session_t *, u8), rv = 0;
u32 wrk_index, api_context;
app_worker_t *app_wrk;
application_t *app;
@@ -591,8 +591,8 @@ tls_start_listen (u32 app_listener_index, transport_endpoint_t * tep)
tls_main_t *tm = &tls_main;
session_handle_t tls_handle;
session_endpoint_cfg_t *sep;
- stream_session_t *tls_listener;
- stream_session_t *app_listener;
+ session_t *tls_listener;
+ session_t *app_listener;
tls_engine_type_t engine_type;
application_t *app;
tls_ctx_t *lctx;
@@ -705,7 +705,7 @@ format_tls_connection (u8 * s, va_list * args)
s = format (s, "%-50U", format_tls_ctx, ctx, thread_index);
if (verbose)
{
- stream_session_t *ts;
+ session_t *ts;
ts = session_get_from_handle (ctx->app_session_handle);
s = format (s, "state: %-7u", ts->session_state);
if (verbose > 1)
diff --git a/src/vnet/tls/tls.h b/src/vnet/tls/tls.h
index c4f04673f2e..b9b0e0baa83 100644
--- a/src/vnet/tls/tls.h
+++ b/src/vnet/tls/tls.h
@@ -101,8 +101,8 @@ typedef struct tls_engine_vft_
tls_ctx_t *(*ctx_get_w_thread) (u32 ctx_index, u8 thread_index);
int (*ctx_init_client) (tls_ctx_t * ctx);
int (*ctx_init_server) (tls_ctx_t * ctx);
- int (*ctx_read) (tls_ctx_t * ctx, stream_session_t * tls_session);
- int (*ctx_write) (tls_ctx_t * ctx, stream_session_t * app_session);
+ int (*ctx_read) (tls_ctx_t * ctx, session_t * tls_session);
+ int (*ctx_write) (tls_ctx_t * ctx, session_t * app_session);
u8 (*ctx_handshake_is_over) (tls_ctx_t * ctx);
int (*ctx_start_listen) (tls_ctx_t * ctx);
int (*ctx_stop_listen) (tls_ctx_t * ctx);
@@ -119,13 +119,13 @@ typedef enum tls_engine_type_
tls_main_t *vnet_tls_get_main (void);
void tls_register_engine (const tls_engine_vft_t * vft,
tls_engine_type_t type);
-int tls_add_vpp_q_rx_evt (stream_session_t * s);
-int tls_add_vpp_q_tx_evt (stream_session_t * s);
-int tls_add_vpp_q_builtin_tx_evt (stream_session_t * s);
-int tls_add_vpp_q_builtin_rx_evt (stream_session_t * s);
+int tls_add_vpp_q_rx_evt (session_t * s);
+int tls_add_vpp_q_tx_evt (session_t * s);
+int tls_add_vpp_q_builtin_tx_evt (session_t * s);
+int tls_add_vpp_q_builtin_rx_evt (session_t * s);
int tls_notify_app_accept (tls_ctx_t * ctx);
int tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed);
-void tls_notify_app_enqueue (tls_ctx_t * ctx, stream_session_t * app_session);
+void tls_notify_app_enqueue (tls_ctx_t * ctx, session_t * app_session);
#endif /* SRC_VNET_TLS_TLS_H_ */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/udp/udp_input.c b/src/vnet/udp/udp_input.c
index ad469f69667..bbfee571969 100644
--- a/src/vnet/udp/udp_input.c
+++ b/src/vnet/udp/udp_input.c
@@ -104,7 +104,7 @@ udp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
ip4_header_t *ip40;
ip6_header_t *ip60;
u8 *data0;
- stream_session_t *s0;
+ session_t *s0;
udp_connection_t *uc0, *child0, *new_uc0;
transport_connection_t *tc0;
int wrote0;
@@ -229,7 +229,7 @@ udp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (!uc0->is_connected)
{
- if (svm_fifo_max_enqueue (s0->server_rx_fifo)
+ if (svm_fifo_max_enqueue (s0->rx_fifo)
< b0->current_length + sizeof (session_dgram_hdr_t))
{
error0 = UDP_ERROR_FIFO_FULL;
@@ -255,8 +255,7 @@ udp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
}
else
{
- if (svm_fifo_max_enqueue (s0->server_rx_fifo)
- < b0->current_length)
+ if (svm_fifo_max_enqueue (s0->rx_fifo) < b0->current_length)
{
error0 = UDP_ERROR_FIFO_FULL;
goto trace0;