diff options
author | Florin Coras <fcoras@cisco.com> | 2020-01-21 18:33:23 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-01-23 19:21:57 +0000 |
commit | 68b7e5888cbfc1fafd38971c725ce10268ad3841 (patch) | |
tree | 91dc18e56d813e2dcc6ee95c21eebf41aceb282f /src/vcl/vppcom.c | |
parent | 87e64c929fa534ebd29b18f38fc6c15fd216e7e4 (diff) |
vcl session: udp session migration notifications
Type: feature
Change-Id: I402549818ba6e078802e914293304174dc6625c2
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r-- | src/vcl/vppcom.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 5eea71e143f..15313fd286c 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -629,6 +629,36 @@ vcl_session_unlisten_reply_handler (vcl_worker_t * wrk, void *data) vcl_session_free (wrk, s); } +static void +vcl_session_migrated_handler (vcl_worker_t * wrk, void *data) +{ + session_migrated_msg_t *mp = (session_migrated_msg_t *) data; + vcl_session_t *s; + + s = vcl_session_get_w_vpp_handle (wrk, mp->handle); + if (!s) + { + VDBG (0, "Migrated notification with wrong handle %llx", mp->handle); + return; + } + + s->vpp_thread_index = mp->vpp_thread_index; + s->vpp_evt_q = uword_to_pointer (mp->vpp_evt_q, svm_msg_q_t *); + + vec_validate (wrk->vpp_event_queues, s->vpp_thread_index); + wrk->vpp_event_queues[s->vpp_thread_index] = s->vpp_evt_q; + + vcl_session_table_del_vpp_handle (wrk, mp->handle); + vcl_session_table_add_vpp_handle (wrk, mp->new_handle, s->session_index); + + /* Generate new tx event if we have outstanding data */ + if (svm_fifo_has_event (s->tx_fifo)) + app_send_io_evt_to_vpp (s->vpp_evt_q, s->tx_fifo->master_session_index, + SESSION_IO_EVT_TX, SVM_Q_WAIT); + + VDBG (0, "Migrated 0x%x to thread %u", mp->handle, s->vpp_thread_index); +} + static vcl_session_t * vcl_session_accepted (vcl_worker_t * wrk, session_accepted_msg_t * msg) { @@ -812,6 +842,9 @@ vcl_handle_mq_event (vcl_worker_t * wrk, session_event_t * e) case SESSION_CTRL_EVT_UNLISTEN_REPLY: vcl_session_unlisten_reply_handler (wrk, e->data); break; + case SESSION_CTRL_EVT_MIGRATED: + vcl_session_migrated_handler (wrk, e->data); + break; case SESSION_CTRL_EVT_REQ_WORKER_UPDATE: vcl_session_req_worker_update_handler (wrk, e->data); break; @@ -2127,6 +2160,9 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e, case SESSION_CTRL_EVT_UNLISTEN_REPLY: vcl_session_unlisten_reply_handler (wrk, e->data); break; + case SESSION_CTRL_EVT_MIGRATED: + vcl_session_migrated_handler (wrk, e->data); + break; case SESSION_CTRL_EVT_WORKER_UPDATE_REPLY: vcl_session_worker_update_reply_handler (wrk, e->data); break; @@ -2739,6 +2775,9 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e, case SESSION_CTRL_EVT_UNLISTEN_REPLY: vcl_session_unlisten_reply_handler (wrk, e->data); break; + case SESSION_CTRL_EVT_MIGRATED: + vcl_session_migrated_handler (wrk, e->data); + break; case SESSION_CTRL_EVT_REQ_WORKER_UPDATE: vcl_session_req_worker_update_handler (wrk, e->data); break; |