[openib-general] [PATCH] [CM] use MAD retry functionality

Sean Hefty sean.hefty at intel.com
Wed May 11 15:19:37 PDT 2005


>The following patch expands the automatic retry ability in the MAD
>layer to be usable by all clients, not just RMPP.  Retries are done
>using a linear timeout.

This patch converts the CM to make use of the MAD retry functionality.
Neither of these patches has been committed yet.

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



Index: core/cm.c
===================================================================
--- core/cm.c	(revision 2306)
+++ core/cm.c	(working copy)
@@ -91,7 +91,6 @@ struct cm_msg {
 	struct ib_send_wr send_wr;
 	struct ib_sge sge;
 	enum ib_cm_state sent_state;
-	u8 retry;
 	DECLARE_PCI_UNMAP_ADDR(mapping)
 	struct ib_mad mad;
 };
@@ -202,6 +201,7 @@ static int cm_alloc_msg(struct cm_id_pri
 	m->send_wr.wr.ud.remote_qpn = 1;
 	m->send_wr.wr.ud.remote_qkey = IB_QP1_QKEY;
 	/* Timeout set by caller if response is expected. */
+	m->send_wr.wr.ud.retries = cm_id_priv->max_cm_retries;
 	m->send_wr.wr.ud.pkey_index = cm_id_priv->av.pkey_index;
 
 	atomic_inc(&cm_id_priv->refcount);
@@ -2564,33 +2564,6 @@ discard:
 	cm_free_msg(msg);
 }
 
-static void cm_process_send_timeout(struct cm_msg *msg)
-{
-	struct cm_id_private *cm_id_priv;
-	struct ib_send_wr *bad_send_wr;
-	unsigned long flags;
-	int ret;
-
-	cm_id_priv = msg->cm_id_priv;
-
-	/* Discard old sends. */
-	spin_lock_irqsave(&cm_id_priv->lock, flags);
-	if (msg != cm_id_priv->msg || msg->sent_state != cm_id_priv->id.state) {
-		spin_unlock_irqrestore(&cm_id_priv->lock, flags);
-		cm_free_msg(msg);
-		return;
-	}
-	spin_unlock_irqrestore(&cm_id_priv->lock, flags);
-
-	if (msg->retry++ < cm_id_priv->max_cm_retries) {
-		ret = ib_post_send_mad(cm_id_priv->av.port->mad_agent,
-				       &msg->send_wr, &bad_send_wr);
-		if (ret)
-			cm_process_send_error(msg, IB_WC_GENERAL_ERR);
-	} else
-		cm_process_send_error(msg, IB_WC_RESP_TIMEOUT_ERR);
-}
-
 static void cm_send_handler(struct ib_mad_agent *mad_agent,
 			    struct ib_mad_send_wc *mad_send_wc)
 {
@@ -2603,9 +2576,6 @@ static void cm_send_handler(struct ib_ma
 	case IB_WC_WR_FLUSH_ERR:
 		cm_free_msg(msg);
 		break;
-	case IB_WC_RESP_TIMEOUT_ERR:
-		cm_process_send_timeout(msg);
-		break;
 	default:
 		cm_process_send_error(msg, mad_send_wc->status);
 		break;
Index: include/ib_cm.h
===================================================================
--- include/ib_cm.h	(revision 2306)
+++ include/ib_cm.h	(working copy)
@@ -285,8 +285,8 @@ struct ib_cm_id {
 	void			*context;
 	u64			service_id;
 	u64			service_mask;
-	enum ib_cm_state	state;
-	enum ib_cm_lap_state	lap_state;
+	enum ib_cm_state	state;		/* internal CM/debug use */
+	enum ib_cm_lap_state	lap_state;	/* internal CM/debug use */
 	u32			local_id;
 	u32			remote_id;
 };






More information about the general mailing list