diff mbox

uDAPL v2 - ucm: inbound DREQ/DREP handshake should transition QP.

Message ID E3280858FA94444CA49D2BA02341C983619D3FD9@orsmsx506.amr.corp.intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Arlin Davis Nov. 19, 2009, 12:22 a.m. UTC
None
diff mbox

Patch

diff --git a/dapl/openib_ucm/cm.c b/dapl/openib_ucm/cm.c
index 2b7471e..b51556a 100644
--- a/dapl/openib_ucm/cm.c
+++ b/dapl/openib_ucm/cm.c
@@ -711,7 +711,8 @@  static void ucm_ud_free(DAPL_EP *ep)
 void dapls_ib_cm_free(dp_ib_cm_handle_t cm, DAPL_EP *ep)
 {
 	dapl_dbg_log(DAPL_DBG_TYPE_CM,
-		     " cm_destroy: cm %p ep %p\n", cm, ep);
+		     " cm_destroy: %s cm %p ep %p\n",
+		     cm ? dapl_cm_state_str(cm->state) : "", cm, ep);
 
 	if (!cm && ep) {
 		ucm_ud_free(ep);
@@ -813,6 +814,10 @@  DAT_RETURN dapli_cm_disconnect(dp_ib_cm_handle_t cm)
 	dapl_os_lock(&cm->lock);
 	switch (cm->state) {
 	case DCM_CONNECTED:
+		/* CONSUMER: move to err state to flush, if not UD */
+		if (cm->ep->qp_handle->qp_type != IBV_QPT_UD) 
+			dapls_modify_qp_state(cm->ep->qp_handle, IBV_QPS_ERR,0,0,0);
+
 		/* send DREQ, event after DREP or DREQ timeout */
 		cm->state = DCM_DISC_PENDING;
 		cm->msg.op = htons(DCM_DREQ);
@@ -836,6 +841,10 @@  DAT_RETURN dapli_cm_disconnect(dp_ib_cm_handle_t cm)
 		}
 		break;
 	case DCM_DISC_RECV:
+		/* CM_THREAD: move to err state to flush, if not UD */
+		if (cm->ep->qp_handle->qp_type != IBV_QPT_UD) 
+			dapls_modify_qp_state(cm->ep->qp_handle, IBV_QPS_ERR,0,0,0);
+
 		/* DREQ received, send DREP and schedule event */
 		cm->msg.op = htons(DCM_DREP);
 		break;
@@ -1547,10 +1556,6 @@  dapls_ib_disconnect(IN DAPL_EP *ep, IN DAT_CLOSE_FLAGS close_flags)
 	dapl_dbg_log(DAPL_DBG_TYPE_EP,
 		     "dapls_ib_disconnect(ep_handle %p ....)\n", ep);
 
-	/* move to err state to flush, if not UD */
-	if (ep->qp_handle->qp_type != IBV_QPT_UD) 
-		dapls_modify_qp_state(ep->qp_handle, IBV_QPS_ERR,0,0,0);
-	
 	if (ep->cm_handle == NULL ||
 	    ep->param.ep_state == DAT_EP_STATE_DISCONNECTED)
 		return DAT_SUCCESS;