summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2019-06-13 10:14:28 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-06-17 14:05:37 +0000
commit2f0f96b9dbcb198dede1e5ebd4d880129d5d52c8 (patch)
tree41dc5f84d8fadda65234f5c990dbdc78392b0d91 /src/vnet
parent8a2fa3b482b2f32da8e0b634fd09c9bdef2e9443 (diff)
session: use listener_handle instead of listener_index
Type: refactor Change-Id: I97fa59a0ba0b6b7a98698926020ffffcf6ae6ba3 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/sctp/sctp_input.c4
-rw-r--r--src/vnet/session/application_local.c4
-rw-r--r--src/vnet/session/application_worker.c2
-rw-r--r--src/vnet/session/session.c5
-rw-r--r--src/vnet/session/session.h2
-rwxr-xr-xsrc/vnet/session/session_api.c4
-rw-r--r--src/vnet/session/session_types.h2
-rw-r--r--src/vnet/tcp/tcp_input.c2
-rw-r--r--src/vnet/tls/tls.c5
-rw-r--r--src/vnet/udp/udp_input.c3
10 files changed, 19 insertions, 14 deletions
diff --git a/src/vnet/sctp/sctp_input.c b/src/vnet/sctp/sctp_input.c
index c41e9ccdcae..b102d51083a 100644
--- a/src/vnet/sctp/sctp_input.c
+++ b/src/vnet/sctp/sctp_input.c
@@ -1747,7 +1747,9 @@ sctp46_listen_process_inline (vlib_main_t * vm,
(&child_conn->
sub_conn[SCTP_PRIMARY_PATH_IDX].connection,
sctp_listener->
- sub_conn[SCTP_PRIMARY_PATH_IDX].c_s_index, 0))
+ sub_conn[SCTP_PRIMARY_PATH_IDX].c_s_index,
+ sctp_listener->
+ sub_conn[SCTP_PRIMARY_PATH_IDX].c_thread_index, 0))
{
clib_warning ("session accept fail");
sctp_connection_cleanup (child_conn);
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index f868e1964cc..2fcf070767c 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -128,7 +128,7 @@ ct_session_connect_notify (session_t * ss)
ss = session_get (ss_index, 0);
cs->session_type = ss->session_type;
cs->connection_index = sct->c_c_index;
- cs->listener_index = SESSION_INVALID_INDEX;
+ cs->listener_handle = SESSION_INVALID_HANDLE;
cs->session_state = SESSION_STATE_CONNECTING;
cs->app_wrk_index = client_wrk->wrk_index;
cs->connection_index = cct->c_c_index;
@@ -280,7 +280,7 @@ ct_connect (app_worker_t * client_wrk, session_t * ll,
ss->session_type = session_type_from_proto_and_ip (TRANSPORT_PROTO_NONE,
sct->c_is_ip4);
ss->connection_index = sct->c_c_index;
- ss->listener_index = ll->session_index;
+ ss->listener_handle = listen_session_get_handle (ll);
ss->session_state = SESSION_STATE_CREATED;
server_wrk = application_listener_select_worker (ll);
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index 6f137e91e55..69b19909b56 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -275,7 +275,7 @@ app_worker_init_accepted (session_t * s)
segment_manager_t *sm;
session_t *listener;
- listener = listen_session_get (s->listener_index);
+ listener = listen_session_get_from_handle (s->listener_handle);
app_wrk = application_listener_select_worker (listener);
s->app_wrk_index = app_wrk->wrk_index;
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 298d8d8bb06..4b3ce016be5 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -168,6 +168,7 @@ session_alloc (u32 thread_index)
clib_memset (s, 0, sizeof (*s));
s->session_index = s - wrk->sessions;
s->thread_index = thread_index;
+ s->app_index = APP_INVALID_INDEX;
return s;
}
@@ -877,13 +878,13 @@ session_stream_accept_notify (transport_connection_t * tc)
*/
int
session_stream_accept (transport_connection_t * tc, u32 listener_index,
- u8 notify)
+ u32 thread_index, u8 notify)
{
session_t *s;
int rv;
s = session_alloc_for_connection (tc);
- s->listener_index = listener_index;
+ s->listener_handle = ((u64) thread_index << 32) | (u64) listener_index;
s->session_state = SESSION_STATE_CREATED;
if ((rv = app_worker_init_accepted (s)))
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 4e63d42de83..d1268188962 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -367,7 +367,7 @@ void session_transport_delete_notify (transport_connection_t * tc);
void session_transport_closed_notify (transport_connection_t * tc);
void session_transport_reset_notify (transport_connection_t * tc);
int session_stream_accept (transport_connection_t * tc, u32 listener_index,
- u8 notify);
+ u32 thread_index, u8 notify);
void session_register_transport (transport_proto_t transport_proto,
const transport_proto_vft_t * vft, u8 is_ip4,
u32 output_node);
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index da62c8598b6..9e7a42d2d39 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -196,7 +196,7 @@ mq_send_session_accepted_cb (session_t * s)
if (session_has_transport (s))
{
- listener = listen_session_get (s->listener_index);
+ listener = listen_session_get_from_handle (s->listener_handle);
mp->listener_handle = app_listen_session_handle (listener);
if (application_is_proxy (app))
{
@@ -217,7 +217,7 @@ mq_send_session_accepted_cb (session_t * s)
ct_connection_t *ct;
ct = (ct_connection_t *) session_get_transport (s);
- listener = listen_session_get (s->listener_index);
+ listener = listen_session_get_from_handle (s->listener_handle);
mp->listener_handle = app_listen_session_handle (listener);
mp->rmt.is_ip4 = session_type_is_ip4 (listener->session_type);
mp->rmt.port = ct->c_rmt_port;
diff --git a/src/vnet/session/session_types.h b/src/vnet/session/session_types.h
index 4a8e97ecf89..ae5d4db2296 100644
--- a/src/vnet/session/session_types.h
+++ b/src/vnet/session/session_types.h
@@ -167,7 +167,7 @@ typedef struct session_
union
{
/** Parent listener session index if the result of an accept */
- u32 listener_index;
+ session_handle_t listener_handle;
/** App listener index in app's listener pool if a listener */
u32 al_index;
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index 304f725cd32..6c78af0fc88 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -3190,7 +3190,7 @@ tcp46_listen_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
child0->rto = TCP_RTO_MIN;
if (session_stream_accept (&child0->connection, lc0->c_s_index,
- 0 /* notify */ ))
+ lc0->c_thread_index, 0 /* notify */ ))
{
tcp_connection_cleanup (child0);
error0 = TCP_ERROR_CREATE_SESSION_FAIL;
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index 520ac7b7dda..e4e8d43e1a1 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -201,7 +201,7 @@ tls_notify_app_accept (tls_ctx_t * ctx)
app_session->app_wrk_index = ctx->parent_app_wrk_index;
app_session->connection_index = ctx->tls_ctx_handle;
app_session->session_type = app_listener->session_type;
- app_session->listener_index = app_listener->session_index;
+ app_session->listener_handle = listen_session_get_handle (app_listener);
app_session->session_state = SESSION_STATE_ACCEPTING;
if ((rv = app_worker_init_accepted (app_session)))
@@ -391,7 +391,8 @@ tls_session_accept_callback (session_t * tls_session)
tls_ctx_t *lctx, *ctx;
u32 ctx_handle;
- tls_listener = listen_session_get (tls_session->listener_index);
+ tls_listener =
+ listen_session_get_from_handle (tls_session->listener_handle);
lctx = tls_listener_ctx_get (tls_listener->opaque);
ctx_handle = tls_ctx_alloc (lctx->tls_ctx_engine);
diff --git a/src/vnet/udp/udp_input.c b/src/vnet/udp/udp_input.c
index c6b9167aff6..cc5ae2bd0eb 100644
--- a/src/vnet/udp/udp_input.c
+++ b/src/vnet/udp/udp_input.c
@@ -210,7 +210,8 @@ udp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
child0->is_connected = 1;
if (session_stream_accept (&child0->connection,
- tc0->s_index, 1))
+ tc0->s_index, tc0->thread_index,
+ 1))
{
error0 = UDP_ERROR_CREATE_SESSION;
goto trace0;