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

Michael S. Tsirkin mst at mellanox.co.il
Sun Sep 11 01:04:38 PDT 2005


Quoting Sean Hefty <sean.hefty at intel.com>:
> >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).

Thanks for looking into this.
This is what I checked in rev 3363:

---

The state of the cm_id is controlled by the CM and can change at any time as
a result of processing a received MAD.  It's only exposed for debug purposes.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
Signed-off-by: Sean Hefty <sean.hefty at intel.com>

Index: linux-kernel/drivers/infiniband/ulp/sdp/sdp_event.c
===================================================================
--- linux-kernel/drivers/infiniband/ulp/sdp/sdp_event.c	(revision 3359)
+++ linux-kernel/drivers/infiniband/ulp/sdp/sdp_event.c	(working copy)
@@ -384,45 +384,48 @@ 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 {
+			sdp_dbg_warn(NULL, "No conn <%d> CM event <%d>",
+				     hashent, event->event);
 			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;
 	}
 	/*

-- 
MST



More information about the general mailing list