diff options
author | Florin Coras <fcoras@cisco.com> | 2018-05-31 17:14:10 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-06-01 21:18:45 +0000 |
commit | b2371c25fed6b2e751163df590bb9d9a93a75a0f (patch) | |
tree | ae528ef4d8f64ca3b8fdc977ce74671f5b344334 /src/vnet/session/session_node.c | |
parent | 7dbd7265daf6fa0f522870586036c89a99bc4958 (diff) |
session: improve disconnect handling
If the caller is the session owning thread or the main thread with a
worker barrier sync (cli/api) add an event to the pending disconnects
vector in the session node and entirely avoid using the event queue.
Useful for bursts of disconnects (like an app detach).
If disconnects come from a processes, be willing to retry enqueueing the
disconnect to the event queue multiple times.
Change-Id: Ieece1f1091b713f94c41c703b6e805bc8498816a
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session_node.c')
-rw-r--r-- | src/vnet/session/session_node.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index e046efba81f..b6c1b2f04f3 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -692,7 +692,7 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { session_manager_main_t *smm = vnet_get_session_manager_main (); - session_fifo_event_t *my_pending_event_vector, *pending_disconnects, *e; + session_fifo_event_t *my_pending_event_vector, *e; session_fifo_event_t *my_fifo_events; u32 n_to_dequeue, n_events; svm_queue_t *q; @@ -722,10 +722,9 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, /* min number of events we can dequeue without blocking */ n_to_dequeue = q->cursize; my_pending_event_vector = smm->pending_event_vector[thread_index]; - pending_disconnects = smm->pending_disconnects[thread_index]; if (!n_to_dequeue && !vec_len (my_pending_event_vector) - && !vec_len (pending_disconnects)) + && !vec_len (smm->pending_disconnects[thread_index])) return 0; SESSION_EVT_DBG (SESSION_EVT_DEQ_NODE, 0); @@ -802,12 +801,20 @@ skip_dequeue: case FIFO_EVENT_DISCONNECT: /* Make sure stream disconnects run after the pending list is drained */ s0 = session_get_from_handle (e0->session_handle); - if (!e0->postponed || svm_fifo_max_dequeue (s0->server_tx_fifo)) + if (!e0->postponed) { e0->postponed = 1; vec_add1 (smm->pending_disconnects[thread_index], *e0); continue; } + /* If tx queue is still not empty, wait a bit */ + if (svm_fifo_max_dequeue (s0->server_tx_fifo) + && e0->postponed < 200) + { + e0->postponed += 1; + vec_add1 (smm->pending_disconnects[thread_index], *e0); + continue; + } stream_session_disconnect_transport (s0); break; |