diff options
Diffstat (limited to 'src/vnet/session')
-rw-r--r-- | src/vnet/session/segment_manager.c | 14 | ||||
-rw-r--r-- | src/vnet/session/segment_manager.h | 6 | ||||
-rw-r--r-- | src/vnet/session/session.c | 29 |
3 files changed, 25 insertions, 24 deletions
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c index 2d20d9cc1e4..61108326abc 100644 --- a/src/vnet/session/segment_manager.c +++ b/src/vnet/session/segment_manager.c @@ -800,27 +800,27 @@ segment_manager_dealloc_fifos (svm_fifo_t * rx_fifo, svm_fifo_t * tx_fifo) } void -segment_manager_detach_fifo (segment_manager_t * sm, svm_fifo_t * f) +segment_manager_detach_fifo (segment_manager_t *sm, svm_fifo_t **f) { fifo_segment_t *fs; - fs = segment_manager_get_segment_w_lock (sm, f->segment_index); + fs = segment_manager_get_segment_w_lock (sm, (*f)->segment_index); fifo_segment_detach_fifo (fs, f); segment_manager_segment_reader_unlock (sm); } void -segment_manager_attach_fifo (segment_manager_t * sm, svm_fifo_t * f, - session_t * s) +segment_manager_attach_fifo (segment_manager_t *sm, svm_fifo_t **f, + session_t *s) { fifo_segment_t *fs; - fs = segment_manager_get_segment_w_lock (sm, f->segment_index); + fs = segment_manager_get_segment_w_lock (sm, (*f)->segment_index); fifo_segment_attach_fifo (fs, f, s->thread_index); segment_manager_segment_reader_unlock (sm); - f->shr->master_session_index = s->session_index; - f->master_thread_index = s->thread_index; + (*f)->shr->master_session_index = s->session_index; + (*f)->master_thread_index = s->thread_index; } u32 diff --git a/src/vnet/session/segment_manager.h b/src/vnet/session/segment_manager.h index 454fef87967..7c3434b70d3 100644 --- a/src/vnet/session/segment_manager.h +++ b/src/vnet/session/segment_manager.h @@ -131,9 +131,9 @@ int segment_manager_try_alloc_fifos (fifo_segment_t * fs, svm_fifo_t ** tx_fifo); void segment_manager_dealloc_fifos (svm_fifo_t * rx_fifo, svm_fifo_t * tx_fifo); -void segment_manager_detach_fifo (segment_manager_t * sm, svm_fifo_t * f); -void segment_manager_attach_fifo (segment_manager_t * sm, svm_fifo_t * f, - session_t * s); +void segment_manager_detach_fifo (segment_manager_t *sm, svm_fifo_t **f); +void segment_manager_attach_fifo (segment_manager_t *sm, svm_fifo_t **f, + session_t *s); void segment_manager_set_watermarks (segment_manager_t * sm, u8 high_watermark, u8 low_watermark); diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index 90f2fdeba0c..d1f21dafdd6 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -854,23 +854,12 @@ static void session_switch_pool_reply (void *arg) { u32 session_index = pointer_to_uword (arg); - segment_manager_t *sm; - app_worker_t *app_wrk; session_t *s; s = session_get_if_valid (session_index, vlib_get_thread_index ()); if (!s) return; - app_wrk = app_worker_get_if_valid (s->app_wrk_index); - if (!app_wrk) - return; - - /* Attach fifos to the right session and segment slice */ - sm = app_worker_get_connect_segment_manager (app_wrk); - segment_manager_attach_fifo (sm, s->rx_fifo, s); - segment_manager_attach_fifo (sm, s->tx_fifo, s); - /* Notify app that it has data on the new session */ session_enqueue_notify (s); } @@ -910,8 +899,8 @@ session_switch_pool (void *cb_args) { /* Cleanup fifo segment slice state for fifos */ sm = app_worker_get_connect_segment_manager (app_wrk); - segment_manager_detach_fifo (sm, s->rx_fifo); - segment_manager_detach_fifo (sm, s->tx_fifo); + segment_manager_detach_fifo (sm, &s->rx_fifo); + segment_manager_detach_fifo (sm, &s->tx_fifo); /* Notify app, using old session, about the migration event */ app_worker_migrate_notify (app_wrk, s, new_sh); @@ -935,6 +924,8 @@ session_dgram_connect_notify (transport_connection_t * tc, { session_t *new_s; session_switch_pool_args_t *rpc_args; + segment_manager_t *sm; + app_worker_t *app_wrk; /* * Clone half-open session to the right thread. @@ -944,7 +935,17 @@ session_dgram_connect_notify (transport_connection_t * tc, new_s->session_state = SESSION_STATE_READY; new_s->flags |= SESSION_F_IS_MIGRATING; - session_lookup_add_connection (tc, session_handle (new_s)); + if (!(tc->flags & TRANSPORT_CONNECTION_F_NO_LOOKUP)) + session_lookup_add_connection (tc, session_handle (new_s)); + + app_wrk = app_worker_get_if_valid (new_s->app_wrk_index); + if (app_wrk) + { + /* New set of fifos attached to the same shared memory */ + sm = app_worker_get_connect_segment_manager (app_wrk); + segment_manager_attach_fifo (sm, &new_s->rx_fifo, new_s); + segment_manager_attach_fifo (sm, &new_s->tx_fifo, new_s); + } /* * Ask thread owning the old session to clean it up and make us the tx |