summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-03-18 09:06:35 -0700
committerDave Barach <openvpp@barachs.net>2019-03-18 22:07:37 +0000
commitd5c604d6872bdb5576a900d51b96f2e6736b63a5 (patch)
treec4237b278cebc4603e8cfc7efeeeeebd28709ba2 /src/vnet/session/session.c
parent1ee346a0a61b454a1ce879f97cb9c06267d1e107 (diff)
session: add session flags
- use flag instead of enqueue_epoch for enqueueing rx events. - use flag for proxy sessions Change-Id: Iec3eee55a68d02536ece6329348a3369c7c7412e Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session.c')
-rw-r--r--src/vnet/session/session.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index c9eea1d2aad..cd8da50a5c9 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -207,7 +207,6 @@ session_alloc_for_connection (transport_connection_t * tc)
s = session_alloc (thread_index);
s->session_type = session_type_from_proto_and_ip (tc->proto, tc->is_ip4);
- s->enqueue_epoch = (u64) ~ 0;
s->session_state = SESSION_STATE_CLOSED;
/* Attach transport to session and vice versa */
@@ -382,9 +381,9 @@ session_enqueue_stream_connection (transport_connection_t * tc,
session_worker_t *wrk;
wrk = session_main_get_worker (s->thread_index);
- if (s->enqueue_epoch != wrk->current_enqueue_epoch[tc->proto])
+ if (!(s->flags & SESSION_F_RX_EVT))
{
- s->enqueue_epoch = wrk->current_enqueue_epoch[tc->proto];
+ s->flags |= SESSION_F_RX_EVT;
vec_add1 (wrk->session_to_enqueue[tc->proto], s->session_index);
}
}
@@ -420,9 +419,9 @@ session_enqueue_dgram_connection (session_t * s,
session_worker_t *wrk;
wrk = session_main_get_worker (s->thread_index);
- if (s->enqueue_epoch != wrk->current_enqueue_epoch[proto])
+ if (!(s->flags & SESSION_F_RX_EVT))
{
- s->enqueue_epoch = wrk->current_enqueue_epoch[proto];
+ s->flags |= SESSION_F_RX_EVT;
vec_add1 (wrk->session_to_enqueue[proto], s->session_index);
}
}
@@ -495,6 +494,7 @@ session_enqueue_notify_inline (session_t * s)
}));
/* *INDENT-ON* */
+ s->flags &= ~SESSION_F_RX_EVT;
if (PREDICT_FALSE (app_worker_lock_and_send_event (app_wrk, s,
SESSION_IO_EVT_RX)))
return -1;
@@ -570,7 +570,6 @@ session_main_flush_enqueue_events (u8 transport_proto, u32 thread_index)
vec_reset_length (indices);
wrk->session_to_enqueue[transport_proto] = indices;
- wrk->current_enqueue_epoch[transport_proto]++;
return errors;
}
@@ -1294,7 +1293,7 @@ session_manager_main_enable (vlib_main_t * vm)
vlib_thread_main_t *vtm = vlib_get_thread_main ();
u32 num_threads, preallocated_sessions_per_worker;
session_worker_t *wrk;
- int i, j;
+ int i;
num_threads = 1 /* main thread */ + vtm->n_threads;
@@ -1304,12 +1303,6 @@ session_manager_main_enable (vlib_main_t * vm)
/* Allocate cache line aligned worker contexts */
vec_validate_aligned (smm->wrk, num_threads - 1, CLIB_CACHE_LINE_BYTES);
- for (i = 0; i < TRANSPORT_N_PROTO; i++)
- {
- for (j = 0; j < num_threads; j++)
- smm->wrk[j].current_enqueue_epoch[i] = 1;
- }
-
for (i = 0; i < num_threads; i++)
{
wrk = &smm->wrk[i];