diff options
author | Florin Coras <fcoras@cisco.com> | 2021-01-25 20:31:27 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2021-02-05 17:28:34 +0000 |
commit | 5398dfb2592d525018997a991a4f7bfde515adc4 (patch) | |
tree | d986e2bac410e8b630a0d5907b729550a28838da /src/vnet | |
parent | 2b97f597c6705809201ce6a6846d46c47c0933ba (diff) |
session svm: non blocking mq
Avoid synchronizing producers and the consumer. Instead, only use mutex
or spinlock (if eventfds are configured) to synchronize producers.
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ie2aafbdc2e07fced5d5e46ee2df6b30a186faa2f
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/session/application_interface.h | 2 | ||||
-rw-r--r-- | src/vnet/session/session_node.c | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index b2e0ef9da84..87bcd902254 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -600,7 +600,7 @@ app_send_io_evt_to_vpp (svm_msg_q_t * mq, u32 session_index, u8 evt_type, 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 (mq); + svm_msg_q_wait (mq, SVM_MQ_WAIT_FULL); 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_node.c b/src/vnet/session/session_node.c index 37df0c450f8..2c91a2fe092 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -1425,16 +1425,15 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, * XXX: we may need priorities here */ mq = wrk->vpp_event_queue; n_to_dequeue = svm_msg_q_size (mq); - if (n_to_dequeue && svm_msg_q_try_lock (mq) == 0) + if (n_to_dequeue) { for (i = 0; i < n_to_dequeue; i++) { - svm_msg_q_sub_w_lock (mq, msg); + svm_msg_q_sub_raw (mq, msg); evt = svm_msg_q_msg_data (mq, msg); session_evt_add_to_list (wrk, evt); svm_msg_q_free_msg (mq, msg); } - svm_msg_q_unlock (mq); } SESSION_EVT (SESSION_EVT_DSP_CNTRS, MQ_DEQ, wrk, n_to_dequeue, !i); |