/* Delete from the main lookup table. */
if ((rv = session_lookup_del_session (s)))
- clib_warning ("hash delete error, rv %d", rv);
+ clib_warning ("session %u hash delete rv %d", s->session_index, rv);
session_free_w_fifos (s);
}
return session_enqueue_notify_inline (s);
}
+static void
+session_enqueue_notify_rpc (void *arg)
+{
+ session_handle_t sh = (session_handle_t) arg;
+ session_t *s;
+
+ s = session_get_from_handle_if_valid (sh);
+ if (!s)
+ return;
+
+ session_enqueue_notify (s);
+}
+
+/**
+ * Like session_enqueue_notify, but can be called from a thread that does not
+ * own the session.
+ */
+void
+session_enqueue_notify_thread (session_handle_t sh)
+{
+ u32 thread_index = session_thread_from_handle (sh);
+ session_send_rpc_evt_to_thread (thread_index,
+ session_enqueue_notify_rpc, (void *) sh);
+}
+
int
session_dequeue_notify (session_t * s)
{
u32 new_session_index;
} session_switch_pool_args_t;
+/**
+ * Notify old thread of the session pool switch
+ */
static void
session_switch_pool (void *cb_args)
{
session_switch_pool_args_t *args = (session_switch_pool_args_t *) cb_args;
+ app_worker_t *app_wrk;
session_t *s;
+
ASSERT (args->thread_index == vlib_get_thread_index ());
s = session_get (args->session_index, args->thread_index);
s->tx_fifo->master_session_index = args->new_session_index;
s->tx_fifo->master_thread_index = args->new_thread_index;
transport_cleanup (session_get_transport_proto (s), s->connection_index,
s->thread_index);
+
+ app_wrk = app_worker_get_if_valid (s->app_wrk_index);
+ if (app_wrk)
+ {
+ session_handle_t new_sh;
+ new_sh = session_make_handle (args->new_session_index,
+ args->new_thread_index);
+ app_worker_migrate_notify (app_wrk, s, new_sh);
+
+ /* Trigger app read on the new thread */
+ session_enqueue_notify_thread (new_sh);
+ }
+
session_free (s);
clib_mem_free (cb_args);
}