FreeBSD/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c
/* Like tcp_fin - called when SDP_MID_DISCONNECT is received */
Like tcp_fin - called when SDP_MID_DISCONNECT is received
Like tcp_fin - called when SDP_MID_DISCONNECT is received
static void
sdp_handle_disconn(struct sdp_sock *ssk)
{
	sdp_dbg(ssk->socket, "%s\n", __func__);
	SDP_WLOCK_ASSERT(ssk);
	if (TCPS_HAVERCVDFIN(ssk->state) == 0)
		socantrcvmore(ssk->socket);
	switch (ssk->state) {
	case TCPS_SYN_RECEIVED:
	case TCPS_ESTABLISHED:
		ssk->state = TCPS_CLOSE_WAIT;
		break;
	case TCPS_FIN_WAIT_1:
		sdp_dbg(ssk->socket,
		    "%s: Starting Infiniband tear down sending DREQ\n",
		    __func__);
		sdp_cancel_dreq_wait_timeout(ssk);
		ssk->qp_active = 0;
		if (ssk->id) {
			struct rdma_cm_id *id;
			id = ssk->id;
			SDP_WUNLOCK(ssk);
			rdma_disconnect(id);
			SDP_WLOCK(ssk);
		} else {
			sdp_warn(ssk->socket,
			    "%s: ssk->id is NULL\n", __func__);
			return;
		}
		break;
	case TCPS_TIME_WAIT:
		break;
	case TCPS_CLOSED:
		sdp_dbg(ssk->socket, "%s: fin in state %s\n",
		    __func__, sdp_state_str(ssk->state));
		return;
	default:
		sdp_warn(ssk->socket,
		    "%s: FIN in unexpected state. state=%d\n",
		    __func__, ssk->state);
		break;
	}
}
static void sdp_handle_disconn ( struct sdp_sock * ssk ) { sdp_dbg ( ssk -> socket , " \n " , __func__ ) ; SDP_WLOCK_ASSERT ( ssk ) ; if ( TCPS_HAVERCVDFIN ( ssk -> state ) == 0 ) socantrcvmore ( ssk -> socket ) ; switch ( ssk -> state ) { case TCPS_SYN_RECEIVED : case TCPS_ESTABLISHED : ssk -> state = TCPS_CLOSE_WAIT ; break ; case TCPS_FIN_WAIT_1 : sdp_dbg ( ssk -> socket , " \n " , __func__ ) ; sdp_cancel_dreq_wait_timeout ( ssk ) ; ssk -> qp_active = 0 ; if ( ssk -> id ) { struct rdma_cm_id * id ; id = ssk -> id ; SDP_WUNLOCK ( ssk ) ; rdma_disconnect ( id ) ; SDP_WLOCK ( ssk ) ; } else { sdp_warn ( ssk -> socket , " \n " , __func__ ) ; return ; } break ; case TCPS_TIME_WAIT : break ; case TCPS_CLOSED : sdp_dbg ( ssk -> socket , " \n " , __func__ , sdp_state_str ( ssk -> state ) ) ; return ; default : sdp_warn ( ssk -> socket , " \n " , __func__ , ssk -> state ) ; break ; } }
Like tcp_fin - called when SDP_MID_DISCONNECT is received
Like tcp_fin - called when SDP_MID_DISCONNECT is received
/* Received a reply FIN - start Infiniband tear down */ /* This is a mutual close situation and we've got the DREQ from
		   the peer before the SDP_MID_DISCONNECT */ /* FIN arrived after IB teardown started - do nothing */