diff options
author | Florin Coras <fcoras@cisco.com> | 2020-12-25 11:45:40 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-12-28 19:40:03 +0000 |
commit | 04943b4c42db300d0d895644f32da79a6d411c51 (patch) | |
tree | 68dcd62cb3b1a9ac414f19d885258ce26955e01d | |
parent | 1f952d386d14b8f5a64ebaed3fb61bfb7e7cb308 (diff) |
session: convert evt q segment to fifo segment
Type: refactor
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I63a44e11322f6fe27255820524e022f6d710b083
-rw-r--r-- | src/vnet/session/session.c | 25 | ||||
-rw-r--r-- | src/vnet/session/session.h | 6 | ||||
-rw-r--r-- | src/vnet/session/session_api.c | 9 |
3 files changed, 21 insertions, 19 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index 962df556de9..259e212e1a3 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -1505,10 +1505,10 @@ void session_vpp_event_queues_allocate (session_main_t * smm) { u32 evt_q_length = 2048, evt_size = sizeof (session_event_t); - ssvm_private_t *eqs = &smm->evt_qs_segment; + fifo_segment_t *eqs = &smm->evt_qs_segment; uword eqs_size = 64 << 20; pid_t vpp_pid = getpid (); - void *oldheap; + void *base; int i; if (smm->configured_event_queue_length) @@ -1517,19 +1517,19 @@ session_vpp_event_queues_allocate (session_main_t * smm) if (smm->evt_qs_segment_size) eqs_size = smm->evt_qs_segment_size; - eqs->ssvm_size = eqs_size; - eqs->my_pid = vpp_pid; - eqs->name = format (0, "%s%c", "session: evt-qs-segment", 0); + eqs->ssvm.ssvm_size = eqs_size; + eqs->ssvm.my_pid = vpp_pid; + eqs->ssvm.name = format (0, "%s%c", "session: evt-qs-segment", 0); /* clib_mem_vm_map_shared consumes first page before requested_va */ - eqs->requested_va = smm->session_baseva + clib_mem_get_page_size (); + eqs->ssvm.requested_va = smm->session_baseva + clib_mem_get_page_size (); - if (ssvm_server_init (eqs, SSVM_SEGMENT_MEMFD)) + if (ssvm_server_init (&eqs->ssvm, SSVM_SEGMENT_MEMFD)) { clib_warning ("failed to initialize queue segment"); return; } - oldheap = ssvm_push_heap (eqs->sh); + fifo_segment_init (eqs); for (i = 0; i < vec_len (smm->wrk); i++) { @@ -1543,15 +1543,16 @@ session_vpp_event_queues_allocate (session_main_t * smm) cfg->n_rings = 2; cfg->q_nitems = evt_q_length; cfg->ring_cfgs = rc; - smm->wrk[i].vpp_event_queue = svm_msg_q_alloc (cfg); + + base = fifo_segment_alloc (eqs, svm_msg_q_size_to_alloc (cfg)); + smm->wrk[i].vpp_event_queue = svm_msg_q_init (base, cfg); + if (svm_msg_q_alloc_consumer_eventfd (smm->wrk[i].vpp_event_queue)) clib_warning ("eventfd returned"); } - - ssvm_pop_heap (oldheap); } -ssvm_private_t * +fifo_segment_t * session_main_get_evt_q_segment (void) { return &session_main.evt_qs_segment; diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h index e62aea483cf..e8afcd03d69 100644 --- a/src/vnet/session/session.h +++ b/src/vnet/session/session.h @@ -20,7 +20,7 @@ #include <vnet/session/session_lookup.h> #include <vnet/session/session_debug.h> #include <svm/message_queue.h> -#include <svm/ssvm.h> +#include <svm/fifo_segment.h> #define foreach_session_input_error \ _(NO_SESSION, "No session drops") \ @@ -143,7 +143,7 @@ typedef struct session_main_ session_worker_t *wrk; /** Event queues memfd segment */ - ssvm_private_t evt_qs_segment; + fifo_segment_t evt_qs_segment; /** Unique segment name counter */ u32 unique_segment_name_counter; @@ -679,7 +679,7 @@ session_add_pending_tx_buffer (u32 thread_index, u32 bi, u32 next_node) vec_add1 (wrk->pending_tx_nexts, next_node); } -ssvm_private_t *session_main_get_evt_q_segment (void); +fifo_segment_t *session_main_get_evt_q_segment (void); void session_node_enable_disable (u8 is_en); clib_error_t *vnet_session_enable_disable (vlib_main_t * vm, u8 is_en); diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index a8f92c3cc00..8fe1acf6a6e 100644 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -601,8 +601,9 @@ vl_api_app_attach_t_handler (vl_api_app_attach_t * mp) { int rv = 0, fds[SESSION_N_FD_TYPE], n_fds = 0; vl_api_app_attach_reply_t *rmp; - ssvm_private_t *segp, *evt_q_segment; + ssvm_private_t *segp; vnet_app_attach_args_t _a, *a = &_a; + fifo_segment_t *evt_q_segment; u8 fd_flags = 0, ctrl_thread; vl_api_registration_t *reg; svm_msg_q_t *ctrl_mq; @@ -645,7 +646,7 @@ vl_api_app_attach_t_handler (vl_api_app_attach_t * mp) if ((evt_q_segment = session_main_get_evt_q_segment ())) { fd_flags |= SESSION_FD_F_VPP_MQ_SEGMENT; - fds[n_fds] = evt_q_segment->fd; + fds[n_fds] = evt_q_segment->ssvm.fd; n_fds += 1; } /* Send fifo segment fd if needed */ @@ -1335,7 +1336,7 @@ session_api_attach_handler (app_namespace_t * app_ns, clib_socket_t * cs, int rv = 0, fds[SESSION_N_FD_TYPE], n_fds = 0; vnet_app_attach_args_t _a, *a = &_a; app_sapi_attach_reply_msg_t *rmp; - ssvm_private_t *evt_q_segment; + fifo_segment_t *evt_q_segment; u8 fd_flags = 0, ctrl_thread; app_ns_api_handle_t *handle; app_sapi_msg_t msg = { 0 }; @@ -1364,7 +1365,7 @@ session_api_attach_handler (app_namespace_t * app_ns, clib_socket_t * cs, if ((evt_q_segment = session_main_get_evt_q_segment ())) { fd_flags |= SESSION_FD_F_VPP_MQ_SEGMENT; - fds[n_fds] = evt_q_segment->fd; + fds[n_fds] = evt_q_segment->ssvm.fd; n_fds += 1; } /* Send fifo segment fd if needed */ |