From 0242d30fc717aeacb758281dad8e5b2e56bf6709 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Thu, 22 Dec 2022 15:03:44 -0800 Subject: session: async rx event notifications Move from synchronous flushing of io and ctrl events from transports to applications to an async model via a new session_input input node that runs in interrupt mode. Events are coalesced per application worker. On the one hand, this helps by minimizing message queue locking churn. And on the other, it opens the possibility for further optimizations of event message generation, obviates need for rx rescheduling rpcs and is a first step towards a fully async data/io rx path. Type: improvement Signed-off-by: Florin Coras Change-Id: Id6bebcb65fc9feef8aa02ddf1af6d9ba6f6745ce --- src/svm/message_queue.c | 10 +++++----- src/svm/message_queue.h | 11 +++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/svm') diff --git a/src/svm/message_queue.c b/src/svm/message_queue.c index 2880645b427..ab0d230b1f0 100644 --- a/src/svm/message_queue.c +++ b/src/svm/message_queue.c @@ -340,15 +340,15 @@ svm_msq_q_msg_is_valid (svm_msg_q_t * mq, svm_msg_q_msg_t * msg) return (dist1 < dist2); } -static void -svm_msg_q_add_raw (svm_msg_q_t *mq, u8 *elem) +void +svm_msg_q_add_raw (svm_msg_q_t *mq, svm_msg_q_msg_t *msg) { svm_msg_q_shared_queue_t *sq = mq->q.shr; i8 *tailp; u32 sz; tailp = (i8 *) (&sq->data[0] + sq->elsize * sq->tail); - clib_memcpy_fast (tailp, elem, sq->elsize); + clib_memcpy_fast (tailp, msg, sq->elsize); sq->tail = (sq->tail + 1) % sq->maxsize; @@ -381,7 +381,7 @@ svm_msg_q_add (svm_msg_q_t * mq, svm_msg_q_msg_t * msg, int nowait) svm_msg_q_wait_prod (mq); } - svm_msg_q_add_raw (mq, (u8 *) msg); + svm_msg_q_add_raw (mq, msg); svm_msg_q_unlock (mq); @@ -392,7 +392,7 @@ void svm_msg_q_add_and_unlock (svm_msg_q_t * mq, svm_msg_q_msg_t * msg) { ASSERT (svm_msq_q_msg_is_valid (mq, msg)); - svm_msg_q_add_raw (mq, (u8 *) msg); + svm_msg_q_add_raw (mq, msg); svm_msg_q_unlock (mq); } diff --git a/src/svm/message_queue.h b/src/svm/message_queue.h index 0780cca1c32..4473c44f4e3 100644 --- a/src/svm/message_queue.h +++ b/src/svm/message_queue.h @@ -190,6 +190,17 @@ int svm_msg_q_lock_and_alloc_msg_w_ring (svm_msg_q_t * mq, u32 ring_index, */ void svm_msg_q_free_msg (svm_msg_q_t * mq, svm_msg_q_msg_t * msg); +/** + * Producer enqueue one message to queue + * + * Must be called with mq locked. Prior to calling this, the producer should've + * obtained a message buffer from one of the rings. + * + * @param mq message queue + * @param msg message to be enqueued + */ +void svm_msg_q_add_raw (svm_msg_q_t *mq, svm_msg_q_msg_t *msg); + /** * Producer enqueue one message to queue * -- cgit 1.2.3-korg