summaryrefslogtreecommitdiffstats
path: root/src/vcl/vppcom.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-09-09 09:40:51 -0700
committerFlorin Coras <florin.coras@gmail.com>2018-09-10 03:15:16 +0000
commit2179513b71963a0b42ca6f1f2b641e79ce89447b (patch)
tree049f4f13ad1aa81d59be4a153b501288be497e10 /src/vcl/vppcom.c
parent97f592f474ebaeba0c9a0f50db8f5627cc444aca (diff)
session: lock app worker mq for io events
Also fixes vcl client/server stats and closing procedure. Change-Id: I7d5a274ea0a3c8ea13062bf61bf402248dfe1a19 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r--src/vcl/vppcom.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 645550812b1..3acd1c41e70 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -285,6 +285,8 @@ vcl_session_accepted_handler (vcl_worker_t * wrk, session_accepted_msg_t * mp)
vcl_wait_for_memory (session->vpp_evt_q);
rx_fifo->master_session_index = session->session_index;
tx_fifo->master_session_index = session->session_index;
+ rx_fifo->master_thread_index = vcl_get_worker_index ();
+ tx_fifo->master_thread_index = vcl_get_worker_index ();
vec_validate (wrk->vpp_event_queues, 0);
evt_q = uword_to_pointer (mp->vpp_event_queue_address, svm_msg_q_t *);
wrk->vpp_event_queues[0] = evt_q;
@@ -295,7 +297,8 @@ vcl_session_accepted_handler (vcl_worker_t * wrk, session_accepted_msg_t * mp)
svm_msg_q_t *);
rx_fifo->client_session_index = session->session_index;
tx_fifo->client_session_index = session->session_index;
-
+ rx_fifo->client_thread_index = vcl_get_worker_index ();
+ tx_fifo->client_thread_index = vcl_get_worker_index ();
vpp_wrk_index = tx_fifo->master_thread_index;
vec_validate (wrk->vpp_event_queues, vpp_wrk_index);
wrk->vpp_event_queues[vpp_wrk_index] = session->vpp_evt_q;
@@ -349,8 +352,7 @@ vcl_session_connected_handler (vcl_worker_t * wrk,
if (mp->retval)
{
clib_warning ("VCL<%d>: ERROR: sid %u: connect failed! %U", getpid (),
- mp->handle, session_index, format_api_error,
- ntohl (mp->retval));
+ session_index, format_api_error, ntohl (mp->retval));
session->session_state = STATE_FAILED;
session->vpp_handle = mp->handle;
return session_index;
@@ -361,6 +363,8 @@ vcl_session_connected_handler (vcl_worker_t * wrk,
vcl_wait_for_memory (rx_fifo);
rx_fifo->client_session_index = session_index;
tx_fifo->client_session_index = session_index;
+ rx_fifo->client_thread_index = vcl_get_worker_index ();
+ tx_fifo->client_thread_index = vcl_get_worker_index ();
if (mp->client_event_queue_address)
{
@@ -648,6 +652,9 @@ vppcom_session_disconnect (u32 session_handle)
u64 vpp_handle;
session = vcl_session_get_w_handle (wrk, session_handle);
+ if (!session)
+ return VPPCOM_EBADFD;
+
vpp_handle = session->vpp_handle;
state = session->session_state;
@@ -2233,6 +2240,7 @@ vcl_epoll_wait_handle_mq (vcl_worker_t * wrk, svm_msg_q_t * mq,
switch (e->event_type)
{
case FIFO_EVENT_APP_RX:
+ ASSERT (e->fifo->client_thread_index == vcl_get_worker_index ());
vcl_fifo_rx_evt_valid_or_break (e->fifo);
sid = e->fifo->client_session_index;
session = vcl_session_get (wrk, sid);