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;
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);
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;
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;
}
}
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))
}
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)
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);
}
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))
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))
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)
openssl_resume_handler *handler;
openssl_evt_t *callback;
- stream_session_t *tls_session;
+ session_t *tls_session;
int thread_index;
tls_ctx_t *ctx;
}
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;
}
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;
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;
#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;
}
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;
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;
}
}
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)
{
}
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)))
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;
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)
{
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
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;
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,
}
void
-dummy_session_reset_callback (stream_session_t * s)
+dummy_session_reset_callback (session_t * s)
{
clib_warning ("called...");
}
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)
{
}
void
-dummy_session_disconnect_callback (stream_session_t * s)
+dummy_session_disconnect_callback (session_t * s)
{
clib_warning ("called...");
}
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;
}
int
-dummy_server_rx_callback (stream_session_t * s)
+dummy_server_rx_callback (session_t * s)
{
clib_warning ("called...");
return -1;
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;
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;
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;
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;
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;
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);
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);
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)
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)
}
const char *
-vppcom_session_state_str (session_state_t state)
+vppcom_session_state_str (vcl_session_state_t state)
{
char *st;
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 ();
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;
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);
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;
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
}
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);
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;
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);
}
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;
}
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;
}
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;
}
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;
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;
}
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;
}
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;
}
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;
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;
* 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;
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);
}
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;
}
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;
}
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;
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;
}
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;
}
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;
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;
}
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;
}
static int
-proxy_accept_callback (stream_session_t * s)
+proxy_accept_callback (session_t * s)
{
proxy_main_t *pm = &proxy_main;
}
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 */ );
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;
}
static int
-proxy_rx_callback (stream_session_t * s)
+proxy_rx_callback (session_t * s)
{
u32 max_dequeue;
int actual_transfer __attribute__ ((unused));
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
}
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;
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;
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);
* 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
/*
- * 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:
}
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;
}
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;
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))
}
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;
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))
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);
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;
session_handle_t handle)
{
app_listener_t *app_listener;
- stream_session_t *listener;
+ session_t *listener;
app_worker_t *app_wrk;
application_t *app;
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));
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);
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;
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;
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 */
}
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;
{
/* 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;
}
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;
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;
}
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;
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,
* 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 */ );
* 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 */ );
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;
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 */
}
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;
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");
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;
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;
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);
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;
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,
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;
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;
/*
- * 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:
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;
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);
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);
/*
- * 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:
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;
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)
{
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;
{
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,
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;
else
{
app_worker_t *app_wrk;
- stream_session_t *s;
+ session_t *s;
s = session_get_from_handle_if_valid (a->handle);
if (!s)
/*
- * 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:
/*
- * 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:
/*
- * 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:
/*
- * 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:
/*
- * 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:
/*
- * 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:
/*
- * 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:
/*
- * 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:
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);
/*
- * 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:
/*
- * 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:
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!");
}
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);
}
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;
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);
}
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)
}
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);
}
* Transport connection must still be valid.
*/
static void
-session_delete (stream_session_t * s)
+session_delete (session_t * s)
{
int rv;
}
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;
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 ()
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);
* 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;
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;
}
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");
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)
}
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))
}
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))
{
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;
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;
* @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;
/* *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* */
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;
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;
}
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;
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;
{
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);
*/
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;
/*
*/
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));
{
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);
{
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)
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)
{
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;
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;
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;
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;
* @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;
* @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;
* requests are served before transport is notified.
*/
void
-session_close (stream_session_t * s)
+session_close (session_t * s)
{
if (!s)
return;
/* 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;
}
* 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)
* 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;
* closed.
*/
void
-session_transport_cleanup (stream_session_t * s)
+session_transport_cleanup (session_t * s)
{
s->session_state = SESSION_STATE_CLOSED;
}
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);
}
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);
}
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);
}
}
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)
}
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);
/*
- * 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:
#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
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;
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;
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
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));
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))
}
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;
}
*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;
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;
}
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);
}
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.
*
* 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);
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
}
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
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);
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);
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);
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,
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);
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);
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);
/*
- * 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:
}
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;
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))
{
}
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;
}
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;
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;
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
{
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:
}
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;
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))
}
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);
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);
}
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;
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
{
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:
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;
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:
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;
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);
}
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);
{
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)
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;
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);
}
/*
- * 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:
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");
}
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;
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);
}
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;
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;
/* *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);
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)
{
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)
}
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;
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)
}
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;
/*
- * 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:
/*
- * 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:
}
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;
}
}
-static stream_session_t *
+static session_t *
session_lookup_app_listen_session (u32 app_index, u8 fib_proto,
u8 transport_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)
{
}
/** 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)
}
/** 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)
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)
{
return 0;
}
-stream_session_t *
+session_t *
session_lookup_listener4 (u32 fib_index, ip4_address_t * lcl, u16 lcl_port,
u8 proto)
{
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)
{
return 0;
}
-stream_session_t *
+session_t *
session_lookup_listener6 (u32 fib_index, ip6_address_t * lcl, u16 lcl_port,
u8 proto)
{
/**
* 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;
{
session_table_t *st;
session_kv4_t kv4;
- stream_session_t *s;
+ session_t *s;
u32 action_index;
int rv;
{
session_table_t *st;
session_kv4_t kv4;
- stream_session_t *s;
+ session_t *s;
u32 action_index;
int rv;
*
* 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;
u8 * result)
{
session_table_t *st;
- stream_session_t *s;
+ session_t *s;
session_kv6_t kv6;
u32 action_index;
int rv;
u8 proto)
{
session_table_t *st;
- stream_session_t *s;
+ session_t *s;
session_kv6_t kv6;
u32 action_index;
int rv;
*
* 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;
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;
/*
- * 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:
#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,
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,
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);
/*
- * 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:
{
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)
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 */
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;
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;
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);
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)
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;
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;
}
{
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,
}
}
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);
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
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;
}
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);
}
}
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)
{
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 */
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;
}
/* 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,
/* 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;
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);
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;
&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);
* 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);
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);
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;
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:
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:
};
/* *INDENT-ON* */
-
/*
* fd.io coding-style-patch-verification: ON
*
/*
- * 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:
/*
- * 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:
/*
- * 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:
/*
- * 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:
/*
- * 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:
* 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>
SESSION_STATE_TRANSPORT_CLOSED,
SESSION_STATE_CLOSED,
SESSION_STATE_N_STATES,
-} stream_session_state_t;
+} session_state_t;
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;
};
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;
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
/*
- * 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:
/*
- * 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:
/*
- * 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:
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));
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);
}
}
}
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);
}
}
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);
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;
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;
}
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);
}
}
void
-tls_session_reset_callback (stream_session_t * s)
+tls_session_reset_callback (session_t * s)
{
clib_warning ("called...");
}
}
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;
}
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;
}
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))
}
int
-tls_app_rx_callback (stream_session_t * tls_session)
+tls_app_rx_callback (session_t * tls_session)
{
tls_ctx_t *ctx;
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;
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;
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;
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)
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);
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
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;
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;
}
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;