[openib-general] Re: Re: [PATCH] [SDP] change CM event processing

Sean Hefty sean.hefty at intel.com
Wed Sep 7 11:32:58 PDT 2005


>> I believe that once SDP is fixed, these can be moved into the internal
>> structure to avoid this issue in the future.
>
>I agree. In fact, if you post a separate patch for just the cm state
>I'm ready to apply that right away.

I think that all you need is the diff from sdp_event.c (extracted below).

Signed-off-by: Sean Hefty <sean.hefty at intel.com>


Index: sdp_event.c
===================================================================
--- sdp_event.c	(revision 3295)
+++ sdp_event.c	(working copy)
@@ -384,45 +384,45 @@ int sdp_cm_event_handler(struct ib_cm_id
 	struct sdp_sock *conn = NULL;
 	int result = 0;
 
-	sdp_dbg_ctrl(NULL, "CM state <%d> event <%d> commID <%08x> ID <%d>",
-		     cm_id->state, event->event, cm_id->local_id, hashent);
-	/*
-	 * lookup the connection, on a REQ_RECV the sk will be empty.
-	 */
-	conn = sdp_conn_table_lookup(hashent);
-	if (conn)
-		sdp_conn_lock(conn);
-	else
-		if (cm_id->state != IB_CM_REQ_RCVD) {
-			sdp_dbg_warn(NULL,
-				     "No conn <%d> CM state <%d> event <%d>",
-				     hashent, cm_id->state, event->event);
+	sdp_dbg_ctrl(NULL, "event <%d> commID <%08x> ID <%d>",
+		     event->event, cm_id->local_id, hashent);
+
+	if (event->event != IB_CM_REQ_RECEIVED) {
+		conn = sdp_conn_table_lookup(hashent);
+		if (conn)
+			sdp_conn_lock(conn);
+		else
 			return -EINVAL;
-		}
+	}
 
-	switch (cm_id->state) {
-	case IB_CM_REQ_RCVD:
+	switch (event->event) {
+	case IB_CM_REQ_RECEIVED:
 		result = sdp_cm_req_handler(cm_id, event);
 		break;
-	case IB_CM_REP_RCVD:
+	case IB_CM_REP_RECEIVED:
 		result = sdp_cm_rep_handler(cm_id, event, conn);
 		break;
-	case IB_CM_IDLE:
+	case IB_CM_REQ_ERROR:
+	case IB_CM_REP_ERROR:
+	case IB_CM_REJ_RECEIVED:
+	case IB_CM_TIMEWAIT_EXIT:
 		result = sdp_cm_idle(cm_id, event, conn);
 		break;
-	case IB_CM_ESTABLISHED:
+	case IB_CM_RTU_RECEIVED:
+	case IB_CM_USER_ESTABLISHED:
 		result = sdp_cm_established(cm_id, event, conn);
 		break;
-	case IB_CM_DREQ_RCVD:
+	case IB_CM_DREQ_RECEIVED:
 		result = sdp_cm_dreq_rcvd(cm_id, event, conn);
 		if (result)
 			break;
 		/* fall through on success to handle state transition */
-	case IB_CM_TIMEWAIT:
+	case IB_CM_DREQ_ERROR:
+	case IB_CM_DREP_RECEIVED:
 		result = sdp_cm_timewait(cm_id, event, conn);
 		break;
 	default:
-		sdp_dbg_warn(conn, "Unexpected CM state <%d>", cm_id->state);
+		sdp_dbg_warn(conn, "Unhandled CM event <%d>", event->event);
 		result = -EINVAL;
 	}
 	/*






More information about the general mailing list