[openib-general] [PATCH] CM: move setting message sent state outside of locks

Sean Hefty mshefty at ichips.intel.com
Thu Jan 20 15:10:41 PST 2005


Subject pretty much says it all...

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

Index: core/cm.c
===================================================================
--- core/cm.c	(revision 1606)
+++ core/cm.c	(working copy)
@@ -1021,6 +1021,7 @@ int ib_send_cm_rep(struct ib_cm_id *cm_i
 
 	cm_format_rep((struct cm_rep_msg *)&msg->mad, cm_id_priv, param);
 	msg->send_wr.wr.ud.timeout_ms = cm_id_priv->timeout_ms;
+	msg->sent_state = IB_CM_REP_SENT;
 
 	spin_lock_irqsave(&cm_id_priv->lock, flags);
 	if (cm_id->state == IB_CM_REQ_RCVD ||
@@ -1037,7 +1038,6 @@ int ib_send_cm_rep(struct ib_cm_id *cm_i
 	}
 
 	cm_id->state = IB_CM_REP_SENT;
-	msg->sent_state = IB_CM_REP_SENT;
 	cm_id_priv->msg = msg;
 	spin_unlock_irqrestore(&cm_id_priv->lock, flags);
 out:
@@ -1271,6 +1271,7 @@ int ib_send_cm_dreq(struct ib_cm_id *cm_
 		cm_format_dreq((struct cm_dreq_msg *)&msg->mad, cm_id_priv,
 			       private_data, private_data_len);
 		msg->send_wr.wr.ud.timeout_ms = cm_id_priv->timeout_ms;
+		msg->sent_state = IB_CM_DREQ_SENT;
 	}
 
 	spin_lock_irqsave(&cm_id_priv->lock, flags);
@@ -1285,7 +1286,6 @@ int ib_send_cm_dreq(struct ib_cm_id *cm_
 	if (!ret) {
 		cm_id->state = IB_CM_DREQ_SENT;
 		cm_id_priv->msg = msg;
-		msg->sent_state = IB_CM_DREQ_SENT;
 	} else
 		cm_id->state = IB_CM_TIMEWAIT;
 	spin_unlock_irqrestore(&cm_id_priv->lock, flags);
@@ -1686,6 +1686,7 @@ int ib_send_cm_lap(struct ib_cm_id *cm_i
 	cm_format_lap((struct cm_lap_msg *)&msg->mad, cm_id_priv,
 		      alternate_path, private_data, private_data_len);
 	msg->send_wr.wr.ud.timeout_ms = cm_id_priv->timeout_ms;
+	msg->sent_state = IB_CM_ESTABLISHED;
 
 	spin_lock_irqsave(&cm_id_priv->lock, flags);
 	if (cm_id->state == IB_CM_ESTABLISHED &&
@@ -1702,7 +1703,6 @@ int ib_send_cm_lap(struct ib_cm_id *cm_i
 	}
 
 	cm_id->lap_state = IB_CM_LAP_SENT;
-	msg->sent_state = IB_CM_ESTABLISHED;
 	cm_id_priv->msg = msg;
 	spin_unlock_irqrestore(&cm_id_priv->lock, flags);
 out:
@@ -1929,6 +1929,7 @@ int ib_send_cm_sidr_req(struct ib_cm_id 
 	cm_format_sidr_req((struct cm_sidr_req_msg *)&msg->mad, cm_id_priv,
 			   param);
 	msg->send_wr.wr.ud.timeout_ms = cm_id_priv->timeout_ms;
+	msg->sent_state = IB_CM_SIDR_REQ_SENT;
 
 	spin_lock_irqsave(&cm_id_priv->lock, flags);
 	if (cm_id->state == IB_CM_IDLE)
@@ -1943,7 +1944,6 @@ int ib_send_cm_sidr_req(struct ib_cm_id 
 		goto out;
 	}
 	cm_id->state = IB_CM_SIDR_REQ_SENT;
-	msg->sent_state = IB_CM_SIDR_REQ_SENT;
 	cm_id_priv->msg = msg;
 	spin_unlock_irqrestore(&cm_id_priv->lock, flags);
 out:



More information about the general mailing list