+ /* Through the VPP host stack...
+ */
+ else if (!is_cut_thru)
+ {
+ /* The peer has already initiated the close,
+ * so send the disconnect session reply.
+ */
+ if (state & STATE_CLOSE_ON_EMPTY)
+ {
+ vppcom_send_disconnect_session_reply (vpp_handle,
+ session_index, 0 /* rv */ );
+ if (VPPCOM_DEBUG > 1)
+ clib_warning ("[%d] vpp handle 0x%llx, sid %u: "
+ "sending disconnect REPLY...",
+ getpid (), vpp_handle, session_index);
+ }
+
+ /* Otherwise, send a disconnect session msg...
+ */
+ else
+ {
+ if (VPPCOM_DEBUG > 1)
+ clib_warning ("[%d] vpp handle 0x%llx, sid %u: "
+ "sending disconnect...",
+ getpid (), vpp_handle, session_index);
+
+ vppcom_send_disconnect_session (vpp_handle, session_index);
+ }
+ }
+
+ /* Cut-thru connections...
+ *
+ * server: free fifos and segment allocated during connect/redirect
+ * client: no cleanup required
+ */
+ else
+ {
+ if (is_server)
+ {
+ svm_fifo_segment_main_t *sm = &svm_fifo_segment_main;
+ svm_fifo_segment_private_t *seg;
+
+ VCL_LOCK_AND_GET_SESSION (session_index, &session);
+
+ if (VPPCOM_DEBUG > 1)
+ clib_warning ("[%d] sid %d: freeing cut-thru fifos in "
+ "sm_seg_index %d! "
+ " server_rx_fifo %p, refcnt = %d"
+ " server_tx_fifo %p, refcnt = %d",
+ getpid (), session_index, session->sm_seg_index,
+ session->server_rx_fifo,
+ session->server_rx_fifo->refcnt,
+ session->server_tx_fifo,
+ session->server_tx_fifo->refcnt);
+
+ seg = vec_elt_at_index (sm->segments, session->sm_seg_index);
+ svm_fifo_segment_free_fifo (seg, session->server_rx_fifo,
+ FIFO_SEGMENT_RX_FREELIST);
+ svm_fifo_segment_free_fifo (seg, session->server_tx_fifo,
+ FIFO_SEGMENT_TX_FREELIST);
+ svm_fifo_segment_delete (seg);
+
+ /* TBD: Send cut-thru disconnect event to client */
+
+ clib_spinlock_unlock (&vcm->sessions_lockp);
+ }
+ else
+ {
+ /* TBD: Send cut-thru disconnect event to server */
+ }
+ }
+
+done:
+ return rv;