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 /src/vnet/session/session.c | |
parent | 1f952d386d14b8f5a64ebaed3fb61bfb7e7cb308 (diff) |
session: convert evt q segment to fifo segment
Type: refactor
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I63a44e11322f6fe27255820524e022f6d710b083
Diffstat (limited to 'src/vnet/session/session.c')
-rw-r--r-- | src/vnet/session/session.c | 25 |
1 files changed, 13 insertions, 12 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; |