summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-01-22 15:05:14 -0800
committerDave Barach <openvpp@barachs.net>2021-01-25 15:34:21 +0000
commit86f1232ddee5b1751c6ff683892072111d0e2dee (patch)
treebfa213f887f6c4142531b7585df7b6707a40feb9 /src/vnet
parent15036ad0bc0b41e42d924e6b1cd897cca8f98c3c (diff)
svm: add custom q implementation for mq
Add separate queue implementation for the message queue as it's custom tailored for fifo segments as opposed to binary api. Also move eventfds to the private data structures. Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I6df0c824ecd94c7904516373f92a9fffc6b04736
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/segment_manager.c2
-rw-r--r--src/vnet/session/session.c3
-rw-r--r--src/vnet/session/session_api.c8
-rw-r--r--src/vnet/session/session_debug.c20
4 files changed, 17 insertions, 16 deletions
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index 61108326abc..ffac4e0bc26 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -870,7 +870,7 @@ segment_manager_alloc_queue (fifo_segment_t * segment,
if (props->use_mq_eventfd)
{
- if (svm_msg_q_alloc_producer_eventfd (q))
+ if (svm_msg_q_alloc_eventfd (q))
clib_warning ("failed to alloc eventfd");
}
return q;
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index d1f21dafdd6..169cca5efe8 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1548,9 +1548,6 @@ session_vpp_event_queues_allocate (session_main_t * smm)
cfg->ring_cfgs = rc;
smm->wrk[i].vpp_event_queue = fifo_segment_msg_q_alloc (eqs, i, cfg);
-
- if (svm_msg_q_alloc_consumer_eventfd (smm->wrk[i].vpp_event_queue))
- clib_warning ("eventfd returned");
}
}
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 2e215f76051..0116a7ece66 100644
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -667,7 +667,7 @@ vl_api_app_attach_t_handler (vl_api_app_attach_t * mp)
if (a->options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD)
{
fd_flags |= SESSION_FD_F_MQ_EVENTFD;
- fds[n_fds] = svm_msg_q_get_producer_eventfd (a->app_evt_q);
+ fds[n_fds] = svm_msg_q_get_eventfd (a->app_evt_q);
n_fds += 1;
}
@@ -751,7 +751,7 @@ vl_api_app_worker_add_del_t_handler (vl_api_app_worker_add_del_t * mp)
if (application_segment_manager_properties (app)->use_mq_eventfd)
{
fd_flags |= SESSION_FD_F_MQ_EVENTFD;
- fds[n_fds] = svm_msg_q_get_producer_eventfd (args.evt_q);
+ fds[n_fds] = svm_msg_q_get_eventfd (args.evt_q);
n_fds += 1;
}
@@ -1317,7 +1317,7 @@ session_api_attach_handler (app_namespace_t * app_ns, clib_socket_t * cs,
if (a->options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD)
{
fd_flags |= SESSION_FD_F_MQ_EVENTFD;
- fds[n_fds] = svm_msg_q_get_producer_eventfd (a->app_evt_q);
+ fds[n_fds] = svm_msg_q_get_eventfd (a->app_evt_q);
n_fds += 1;
}
@@ -1426,7 +1426,7 @@ sapi_add_del_worker_handler (app_namespace_t * app_ns,
if (application_segment_manager_properties (app)->use_mq_eventfd)
{
fd_flags |= SESSION_FD_F_MQ_EVENTFD;
- fds[n_fds] = svm_msg_q_get_producer_eventfd (args.evt_q);
+ fds[n_fds] = svm_msg_q_get_eventfd (args.evt_q);
n_fds += 1;
}
diff --git a/src/vnet/session/session_debug.c b/src/vnet/session/session_debug.c
index cd4198c5da8..c042e9e53db 100644
--- a/src/vnet/session/session_debug.c
+++ b/src/vnet/session/session_debug.c
@@ -123,6 +123,7 @@ dump_thread_0_event_queue (void)
vlib_main_t *vm = &vlib_global_main;
u32 my_thread_index = vm->thread_index;
session_event_t _e, *e = &_e;
+ svm_msg_q_shared_queue_t *sq;
svm_msg_q_ring_t *ring;
session_t *s0;
svm_msg_q_msg_t *msg;
@@ -130,11 +131,12 @@ dump_thread_0_event_queue (void)
int i, index;
mq = session_main_get_vpp_event_queue (my_thread_index);
- index = mq->q->head;
+ sq = mq->q.shr;
+ index = sq->head;
- for (i = 0; i < mq->q->cursize; i++)
+ for (i = 0; i < sq->cursize; i++)
{
- msg = (svm_msg_q_msg_t *) (&mq->q->data[0] + mq->q->elsize * index);
+ msg = (svm_msg_q_msg_t *) (&sq->data[0] + sq->elsize * index);
ring = svm_msg_q_ring (mq, msg->ring_index);
clib_memcpy_fast (e, svm_msg_q_msg_data (mq, msg), ring->elsize);
@@ -170,7 +172,7 @@ dump_thread_0_event_queue (void)
index++;
- if (index == mq->q->maxsize)
+ if (index == sq->maxsize)
index = 0;
}
}
@@ -210,6 +212,7 @@ session_node_cmp_event (session_event_t * e, svm_fifo_t * f)
u8
session_node_lookup_fifo_event (svm_fifo_t * f, session_event_t * e)
{
+ svm_msg_q_shared_queue_t *sq;
session_evt_elt_t *elt;
session_worker_t *wrk;
int i, index, found = 0;
@@ -226,16 +229,17 @@ session_node_lookup_fifo_event (svm_fifo_t * f, session_event_t * e)
* Search evt queue
*/
mq = wrk->vpp_event_queue;
- index = mq->q->head;
- for (i = 0; i < mq->q->cursize; i++)
+ sq = mq->q.shr;
+ index = sq->head;
+ for (i = 0; i < sq->cursize; i++)
{
- msg = (svm_msg_q_msg_t *) (&mq->q->data[0] + mq->q->elsize * index);
+ msg = (svm_msg_q_msg_t *) (&sq->data[0] + sq->elsize * index);
ring = svm_msg_q_ring (mq, msg->ring_index);
clib_memcpy_fast (e, svm_msg_q_msg_data (mq, msg), ring->elsize);
found = session_node_cmp_event (e, f);
if (found)
return 1;
- index = (index + 1) % mq->q->maxsize;
+ index = (index + 1) % sq->maxsize;
}
/*
* Search pending events vector