summaryrefslogtreecommitdiffstats
path: root/src/vcl/vppcom.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-09-25 16:37:43 -0700
committerDave Wallace <dwallacelf@gmail.com>2019-10-22 17:03:23 +0000
commitdbc9c599b9d4453c7433ac59dd21f088778e024b (patch)
tree8d8f7dfbddce1bd8ffa46839ad8616aa6b39e672 /src/vcl/vppcom.c
parentd747c3c36242ef4ebcbfd4cf3657ad8e70ba62d5 (diff)
vcl: handle segment map errors
Type: fix Change-Id: Ibd122a4565c067627c4bbc8cac7df2d5b6497392 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r--src/vcl/vppcom.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 10cf17a5185..a8273997a63 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -449,19 +449,23 @@ vcl_session_connected_handler (vcl_worker_t * wrk,
{
VDBG (0, "ERROR: session index %u: connect failed! %U",
session_index, format_api_error, ntohl (mp->retval));
- session->session_state = STATE_FAILED;
+ session->session_state = STATE_FAILED | STATE_DISCONNECT;
session->vpp_handle = mp->handle;
return session_index;
}
+ session->vpp_handle = mp->handle;
+ session->vpp_evt_q = uword_to_pointer (mp->vpp_event_queue_address,
+ svm_msg_q_t *);
rx_fifo = uword_to_pointer (mp->server_rx_fifo, svm_fifo_t *);
tx_fifo = uword_to_pointer (mp->server_tx_fifo, svm_fifo_t *);
if (vcl_wait_for_segment (mp->segment_handle))
{
VDBG (0, "segment for session %u couldn't be mounted!",
session->session_index);
- session->session_state = STATE_FAILED;
- return VCL_INVALID_SESSION_INDEX;
+ session->session_state = STATE_FAILED | STATE_DISCONNECT;
+ vcl_send_session_disconnect (wrk, session);
+ return session_index;
}
rx_fifo->client_session_index = session_index;
@@ -469,8 +473,6 @@ vcl_session_connected_handler (vcl_worker_t * wrk,
rx_fifo->client_thread_index = vcl_get_worker_index ();
tx_fifo->client_thread_index = vcl_get_worker_index ();
- session->vpp_evt_q = uword_to_pointer (mp->vpp_event_queue_address,
- svm_msg_q_t *);
vpp_wrk_index = tx_fifo->master_thread_index;
vec_validate (wrk->vpp_event_queues, vpp_wrk_index);
wrk->vpp_event_queues[vpp_wrk_index] = session->vpp_evt_q;
@@ -483,14 +485,14 @@ vcl_session_connected_handler (vcl_worker_t * wrk,
{
VDBG (0, "ct segment for session %u couldn't be mounted!",
session->session_index);
- session->session_state = STATE_FAILED;
- return VCL_INVALID_SESSION_INDEX;
+ session->session_state = STATE_FAILED | STATE_DISCONNECT;
+ vcl_send_session_disconnect (wrk, session);
+ return session_index;
}
}
session->rx_fifo = rx_fifo;
session->tx_fifo = tx_fifo;
- session->vpp_handle = mp->handle;
session->vpp_thread_index = rx_fifo->master_thread_index;
session->transport.is_ip4 = mp->lcl.is_ip4;
clib_memcpy_fast (&session->transport.lcl_ip, &mp->lcl.ip,
@@ -2634,6 +2636,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
add_event = 1;
events[*num_ev].events |= EPOLLOUT;
session_evt_data = session->vep.ev.data.u64;
+ if (session->session_state & STATE_FAILED)
+ events[*num_ev].events |= EPOLLHUP;
break;
case SESSION_CTRL_EVT_DISCONNECTED:
disconnected_msg = (session_disconnected_msg_t *) e->data;