summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_api.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-09-28 10:35:45 -0700
committerDamjan Marion <dmarion@me.com>2018-09-29 07:17:02 +0000
commit537b17ef954b68d09b6f559dc05672cf7acfbe7c (patch)
treea84a4d6c6348ef04527923dd4c3d48ef4b194dad /src/vnet/session/session_api.c
parent6648fc7e4292a36d17851b48758028f494fd8bd8 (diff)
session: lock msg queues while generating control events
Change-Id: I229ce9c306a97956c87ccb8f7a1c5c9dac94ab31 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session_api.c')
-rwxr-xr-xsrc/vnet/session/session_api.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index b88438c267f..fc63428277e 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -293,14 +293,13 @@ mq_send_local_session_disconnected_cb (u32 app_wrk_index,
app_mq = app_wrk->event_queue;
svm_msg_q_lock_and_alloc_msg_w_ring (app_mq, SESSION_MQ_CTRL_EVT_RING,
SVM_Q_WAIT, msg);
- svm_msg_q_unlock (app_mq);
evt = svm_msg_q_msg_data (app_mq, msg);
memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_DISCONNECTED;
mp = (session_disconnected_msg_t *) evt->data;
mp->handle = application_local_session_handle (ls);
mp->context = app->api_client_index;
- svm_msg_q_add (app_mq, msg, SVM_Q_WAIT);
+ svm_msg_q_add_and_unlock (app_mq, msg);
}
static void
@@ -439,7 +438,6 @@ mq_send_session_accepted_cb (stream_session_t * s)
app_mq = app_wrk->event_queue;
svm_msg_q_lock_and_alloc_msg_w_ring (app_mq, SESSION_MQ_CTRL_EVT_RING,
SVM_Q_WAIT, msg);
- svm_msg_q_unlock (app_mq);
evt = svm_msg_q_msg_data (app_mq, msg);
memset (evt, 0, sizeof (*evt));
@@ -508,7 +506,7 @@ mq_send_session_accepted_cb (stream_session_t * s)
mp->client_event_queue_address = ls->client_evt_q;
mp->server_event_queue_address = ls->server_evt_q;
}
- svm_msg_q_add (app_mq, msg, SVM_Q_WAIT);
+ svm_msg_q_add_and_unlock (app_mq, msg);
return 0;
}
@@ -527,14 +525,13 @@ mq_send_session_disconnected_cb (stream_session_t * s)
app_mq = app_wrk->event_queue;
svm_msg_q_lock_and_alloc_msg_w_ring (app_mq, SESSION_MQ_CTRL_EVT_RING,
SVM_Q_WAIT, msg);
- svm_msg_q_unlock (app_mq);
evt = svm_msg_q_msg_data (app_mq, msg);
memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_DISCONNECTED;
mp = (session_disconnected_msg_t *) evt->data;
mp->handle = session_handle (s);
mp->context = app->api_client_index;
- svm_msg_q_add (app_mq, msg, SVM_Q_WAIT);
+ svm_msg_q_add_and_unlock (app_mq, msg);
}
static void
@@ -549,13 +546,12 @@ mq_send_session_reset_cb (stream_session_t * s)
app_mq = app->event_queue;
svm_msg_q_lock_and_alloc_msg_w_ring (app_mq, SESSION_MQ_CTRL_EVT_RING,
SVM_Q_WAIT, msg);
- svm_msg_q_unlock (app_mq);
evt = svm_msg_q_msg_data (app_mq, msg);
memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_RESET;
mp = (session_reset_msg_t *) evt->data;
mp->handle = session_handle (s);
- svm_msg_q_add (app_mq, msg, SVM_Q_WAIT);
+ svm_msg_q_add_and_unlock (app_mq, msg);
}
static int
@@ -582,7 +578,6 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
svm_msg_q_lock_and_alloc_msg_w_ring (app_mq, SESSION_MQ_CTRL_EVT_RING,
SVM_Q_WAIT, msg);
- svm_msg_q_unlock (app_mq);
evt = svm_msg_q_msg_data (app_mq, msg);
memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_CONNECTED;
@@ -634,7 +629,7 @@ done:
mp->retval = is_fail ?
clib_host_to_net_u32 (VNET_API_ERROR_SESSION_CONNECT) : 0;
- svm_msg_q_add (app_mq, msg, SVM_Q_WAIT);
+ svm_msg_q_add_and_unlock (app_mq, msg);
return 0;
}
@@ -663,7 +658,6 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
svm_msg_q_lock_and_alloc_msg_w_ring (app_mq, SESSION_MQ_CTRL_EVT_RING,
SVM_Q_WAIT, msg);
- svm_msg_q_unlock (app_mq);
evt = svm_msg_q_msg_data (app_mq, msg);
memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_BOUND;
@@ -700,7 +694,7 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
done:
mp->retval = rv;
- svm_msg_q_add (app_mq, msg, SVM_Q_WAIT);
+ svm_msg_q_add_and_unlock (app_mq, msg);
return 0;
}