diff options
author | Florin Coras <fcoras@cisco.com> | 2022-04-19 18:57:24 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2022-04-21 16:48:15 +0000 |
commit | 80d100cd59015d91c4f0abfaf07b6876088ecbf1 (patch) | |
tree | 5b0d949fcf012b359c0af8b4371afbe6d10c7a29 /src/vnet | |
parent | 5297447bd64ab253ab3ab3e144605dd39f995f12 (diff) |
session svm: fix mq producer wait on q and ring
Make sure producer drops lock when it waits for empty ring slot.
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Id77d54ee8c01bed20c9eaf5ad372ed4b1e9fa712
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/session/application_interface.h | 9 | ||||
-rw-r--r-- | src/vnet/session/session.c | 3 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index 733a4627c2e..b1dab322dd7 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -613,8 +613,8 @@ app_send_io_evt_to_vpp (svm_msg_q_t * mq, u32 session_index, u8 evt_type, { if (svm_msg_q_try_lock (mq)) return -1; - if (PREDICT_FALSE (svm_msg_q_ring_is_full (mq, SESSION_MQ_IO_EVT_RING) - || svm_msg_q_is_full (mq))) + if (PREDICT_FALSE ( + svm_msg_q_or_ring_is_full (mq, SESSION_MQ_IO_EVT_RING))) { svm_msg_q_unlock (mq); return -2; @@ -629,9 +629,8 @@ app_send_io_evt_to_vpp (svm_msg_q_t * mq, u32 session_index, u8 evt_type, else { svm_msg_q_lock (mq); - while (svm_msg_q_ring_is_full (mq, SESSION_MQ_IO_EVT_RING) - || svm_msg_q_is_full (mq)) - svm_msg_q_wait_prod (mq); + while (svm_msg_q_or_ring_is_full (mq, SESSION_MQ_IO_EVT_RING)) + svm_msg_q_or_ring_wait_prod (mq, SESSION_MQ_IO_EVT_RING); msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING); evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg); evt->session_index = session_index; diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index 256760079ee..d791c463f90 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -36,8 +36,7 @@ session_send_evt_to_thread (void *data, void *args, u32 thread_index, mq = wrk->vpp_event_queue; if (PREDICT_FALSE (svm_msg_q_lock (mq))) return -1; - if (PREDICT_FALSE (svm_msg_q_is_full (mq) - || svm_msg_q_ring_is_full (mq, SESSION_MQ_IO_EVT_RING))) + if (PREDICT_FALSE (svm_msg_q_or_ring_is_full (mq, SESSION_MQ_IO_EVT_RING))) { svm_msg_q_unlock (mq); return -2; |