diff options
author | Florin Coras <fcoras@cisco.com> | 2018-07-12 14:48:06 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-07-17 09:02:17 +0000 |
commit | 52207f1b7b60cb0784d5241f0a4d40eef531c67e (patch) | |
tree | b83a1f01bd08872a2ae27e17f2fd0ddeb3f571b6 /src/vnet/session/application.c | |
parent | 3c2fed5145d9e40a9ecd178c2866c813eddc6203 (diff) |
session: send ctrl msg over mq
Change-Id: I242056bc46ddb671064665916b2687860292dcb2
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/application.c')
-rw-r--r-- | src/vnet/session/application.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c index 6041b49712d..1dc04f0afa7 100644 --- a/src/vnet/session/application.c +++ b/src/vnet/session/application.c @@ -810,22 +810,7 @@ application_get_segment_manager_properties (u32 app_index) static inline int app_enqueue_evt (svm_msg_q_t * mq, svm_msg_q_msg_t * msg, u8 lock) { - if (PREDICT_TRUE (!svm_msg_q_is_full (mq))) - { - if (lock) - { - svm_msg_q_add_w_lock (mq, msg); - svm_msg_q_unlock (mq); - } - else if (svm_msg_q_add (mq, msg, SVM_Q_WAIT)) - { - clib_warning ("msg q add returned"); - if (lock) - svm_msg_q_unlock (mq); - return -1; - } - } - else + if (PREDICT_FALSE (svm_msg_q_is_full (mq))) { clib_warning ("evt q full"); svm_msg_q_free_msg (mq, msg); @@ -833,13 +818,26 @@ app_enqueue_evt (svm_msg_q_t * mq, svm_msg_q_msg_t * msg, u8 lock) svm_msg_q_unlock (mq); return -1; } + + if (lock) + { + svm_msg_q_add_and_unlock (mq, msg); + return 0; + } + + /* Even when not locking the ring, we must wait for queue mutex */ + if (svm_msg_q_add (mq, msg, SVM_Q_WAIT)) + { + clib_warning ("msg q add returned"); + return -1; + } return 0; } static inline int app_send_io_evt_rx (application_t * app, stream_session_t * s, u8 lock) { - session_fifo_event_t *evt; + session_event_t *evt; svm_msg_q_msg_t msg; svm_msg_q_t *mq; @@ -873,7 +871,7 @@ app_send_io_evt_rx (application_t * app, stream_session_t * s, u8 lock) msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING); ASSERT (!svm_msg_q_msg_is_invalid (&msg)); - evt = (session_fifo_event_t *) svm_msg_q_msg_data (mq, &msg); + evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg); evt->fifo = s->server_rx_fifo; evt->event_type = FIFO_EVENT_APP_RX; @@ -884,7 +882,7 @@ static inline int app_send_io_evt_tx (application_t * app, stream_session_t * s, u8 lock) { svm_msg_q_t *mq; - session_fifo_event_t *evt; + session_event_t *evt; svm_msg_q_msg_t msg; if (application_is_builtin (app)) @@ -905,7 +903,7 @@ app_send_io_evt_tx (application_t * app, stream_session_t * s, u8 lock) msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING); ASSERT (!svm_msg_q_msg_is_invalid (&msg)); - evt = (session_fifo_event_t *) svm_msg_q_msg_data (mq, &msg); + evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg); evt->event_type = FIFO_EVENT_APP_TX; evt->fifo = s->server_tx_fifo; |