- else
- {
- rv = VNET_API_ERROR_INVALID_VALUE;
- clib_warning ("VCL<%d>: ERROR: vpp handle 0x%llx: session lookup "
- "failed! returning %d %U",
- getpid (), mp->handle, rv, format_api_error, rv);
- }
-
- rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_RESET_SESSION_REPLY);
- rmp->retval = htonl (rv);
- rmp->handle = mp->handle;
- vl_msg_api_send_shmem (vcm->vl_input_queue, (u8 *) & rmp);
-}
-
-static void
-vl_api_connect_session_reply_t_handler (vl_api_connect_session_reply_t * mp)
-{
- vcl_session_t *session = 0;
- u32 session_index;
- svm_fifo_t *rx_fifo, *tx_fifo;
- int rv = VPPCOM_OK;
-
- session_index = mp->context;
- VCL_SESSION_LOCK_AND_GET (session_index, &session);
-done:
- if (mp->retval)
- {
- clib_warning ("VCL<%d>: ERROR: vpp handle 0x%llx, sid %u: "
- "connect failed! %U",
- getpid (), mp->handle, session_index,
- format_api_error, ntohl (mp->retval));
- if (session)
- {
- session->session_state = STATE_FAILED;
- session->vpp_handle = mp->handle;
- }
- else
- {
- clib_warning ("[%s] ERROR: vpp handle 0x%llx, sid %u: "
- "Invalid session index (%u)!",
- getpid (), mp->handle, session_index);
- }
- goto done_unlock;
- }
-
- if (rv)
- goto done_unlock;
-
- /*
- * Setup session
- */
- if (vcm->session_io_thread.io_sessions_lockp)
- {
- // Add this connection to the active io sessions list
- VCL_IO_SESSIONS_LOCK ();
- u32 *active_session_index;
- pool_get (vcm->session_io_thread.active_session_indexes,
- active_session_index);
- *active_session_index = session_index;
- VCL_IO_SESSIONS_UNLOCK ();
- }
- session->vpp_evt_q = uword_to_pointer (mp->vpp_event_queue_address,
- svm_queue_t *);
-
- rx_fifo = uword_to_pointer (mp->server_rx_fifo, svm_fifo_t *);
- rx_fifo->client_session_index = session_index;
- tx_fifo = uword_to_pointer (mp->server_tx_fifo, svm_fifo_t *);
- tx_fifo->client_session_index = session_index;
-
- session->rx_fifo = rx_fifo;
- session->tx_fifo = tx_fifo;
- session->vpp_handle = mp->handle;
- session->transport.is_ip4 = mp->is_ip4;
- clib_memcpy (&session->transport.lcl_ip, mp->lcl_ip,
- sizeof (session->transport.rmt_ip));
- session->transport.lcl_port = mp->lcl_port;
- session->session_state = STATE_CONNECT;
-
- /* Add it to lookup table */
- hash_set (vcm->session_index_by_vpp_handles, mp->handle, session_index);
-
- VDBG (1, "VCL<%d>: vpp handle 0x%llx, sid %u: connect succeeded! "
- "session_rx_fifo %p, refcnt %d, session_tx_fifo %p, refcnt %d",
- getpid (), mp->handle, session_index, session->rx_fifo,
- session->rx_fifo->refcnt, session->tx_fifo, session->tx_fifo->refcnt);
-done_unlock:
- VCL_SESSION_UNLOCK ();