summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-07-15 13:15:18 -0700
committerDave Barach <openvpp@barachs.net>2019-07-17 12:20:23 +0000
commit2062ec0d67fb83fa25fc938c992a8e882612c777 (patch)
treee74828ba6f90b5bee0e37183c3664682cd17d4bb /src/vnet/session/session.c
parent0dfbce6b76c40976beca671da57c773c6e8944b9 (diff)
session: use llist in session node evt handling
Type: refactor Change-Id: I24159e0a848f552b4e27acfb5fe6f2cd91b50a19 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session.c')
-rw-r--r--src/vnet/session/session.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index e7542aef901..9769c013e2f 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -122,18 +122,19 @@ static void
session_program_transport_close (session_t * s)
{
u32 thread_index = vlib_get_thread_index ();
+ session_evt_elt_t *elt;
session_worker_t *wrk;
- session_event_t *evt;
/* If we are in the handler thread, or being called with the worker barrier
* held, just append a new event to pending disconnects vector. */
if (vlib_thread_is_main_w_barrier () || thread_index == s->thread_index)
{
wrk = session_main_get_worker (s->thread_index);
- vec_add2 (wrk->pending_disconnects, evt, 1);
- clib_memset (evt, 0, sizeof (*evt));
- evt->session_handle = session_handle (s);
- evt->event_type = SESSION_CTRL_EVT_CLOSE;
+ elt = session_evt_elt_alloc (wrk);
+ clib_memset (&elt->evt, 0, sizeof (session_event_t));
+ elt->evt.session_handle = session_handle (s);
+ elt->evt.event_type = SESSION_CTRL_EVT_CLOSE;
+ session_evt_add_pending_disconnects (wrk, elt);
}
else
session_send_ctrl_evt_to_thread (s, SESSION_CTRL_EVT_CLOSE);
@@ -1380,15 +1381,11 @@ session_manager_main_enable (vlib_main_t * vm)
for (i = 0; i < num_threads; i++)
{
wrk = &smm->wrk[i];
- vec_validate (wrk->free_event_vector, 128);
- _vec_len (wrk->free_event_vector) = 0;
- vec_validate (wrk->pending_event_vector, 128);
- _vec_len (wrk->pending_event_vector) = 0;
- vec_validate (wrk->pending_disconnects, 128);
- _vec_len (wrk->pending_disconnects) = 0;
- vec_validate (wrk->postponed_event_vector, 128);
- _vec_len (wrk->postponed_event_vector) = 0;
-
+ wrk->new_head = clib_llist_make_head (wrk->event_elts, evt_list);
+ wrk->pending_head = clib_llist_make_head (wrk->event_elts, evt_list);
+ wrk->postponed_head = clib_llist_make_head (wrk->event_elts, evt_list);
+ wrk->disconnects_head = clib_llist_make_head (wrk->event_elts,
+ evt_list);
wrk->last_vlib_time = vlib_time_now (vlib_mains[i]);
wrk->dispatch_period = 500e-6;