[openib-general] RFC: CMA backlog (was Re: CMA backlog)
Michael S. Tsirkin
mst at mellanox.co.il
Tue Jun 27 11:18:27 PDT 2006
Quoting r. Sean Hefty <mshefty at ichips.intel.com>:
> Subject: Re: RFC: CMA backlog (was Re: CMA backlog)
>
> Michael S. Tsirkin wrote:
> > I'm just saying that we can use exactly the code in ib_destroy_cm_id, but
> > avoid calling ib_send_cm_rej in this one case:
>
> Ah... yes, something like that should work.
Like this then (untested)?
Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
Index: linux-2.6.17-2.6.18/drivers/infiniband/core/cm.c
===================================================================
--- linux-2.6.17-2.6.18.orig/drivers/infiniband/core/cm.c 2006-06-27 12:21:34.000000000 +0300
+++ linux-2.6.17-2.6.18/drivers/infiniband/core/cm.c 2006-06-27 21:16:49.000000000 +0300
@@ -701,7 +701,7 @@ static void cm_reset_to_idle(struct cm_i
}
}
-void ib_destroy_cm_id(struct ib_cm_id *cm_id)
+static void cm_destroy_id(struct ib_cm_id *cm_id, int reject)
{
struct cm_id_private *cm_id_priv;
struct cm_work *work;
@@ -731,9 +731,9 @@ retest:
ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg);
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
ib_send_cm_rej(cm_id, IB_CM_REJ_TIMEOUT,
- &cm_id_priv->av.port->cm_dev->ca_guid,
- sizeof cm_id_priv->av.port->cm_dev->ca_guid,
- NULL, 0);
+ &cm_id_priv->av.port->cm_dev->ca_guid,
+ sizeof cm_id_priv->av.port->cm_dev->ca_guid,
+ NULL, 0);
break;
case IB_CM_MRA_REQ_RCVD:
case IB_CM_REP_SENT:
@@ -744,9 +744,14 @@ retest:
case IB_CM_MRA_REQ_SENT:
case IB_CM_REP_RCVD:
case IB_CM_MRA_REP_SENT:
- spin_unlock_irqrestore(&cm_id_priv->lock, flags);
- ib_send_cm_rej(cm_id, IB_CM_REJ_CONSUMER_DEFINED,
- NULL, 0, NULL, 0);
+ if (reject) {
+ spin_unlock_irqrestore(&cm_id_priv->lock, flags);
+ ib_send_cm_rej(cm_id, IB_CM_REJ_CONSUMER_DEFINED,
+ NULL, 0, NULL, 0);
+ } else {
+ cm_reset_to_idle(cm_id_priv);
+ spin_unlock_irqrestore(&cm_id_priv->lock, flags);
+ }
break;
case IB_CM_ESTABLISHED:
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
@@ -775,6 +780,12 @@ retest:
kfree(cm_id_priv->private_data);
kfree(cm_id_priv);
}
+
+void ib_destroy_cm_id(struct ib_cm_id *cm_id)
+{
+ cm_destroy_id(cm_id, 1);
+}
+
EXPORT_SYMBOL(ib_destroy_cm_id);
int ib_cm_listen(struct ib_cm_id *cm_id, __be64 service_id, __be64 service_mask,
@@ -1163,7 +1174,7 @@ static void cm_process_work(struct cm_id
}
cm_deref_id(cm_id_priv);
if (ret)
- ib_destroy_cm_id(&cm_id_priv->id);
+ cm_destroy_id(&cm_id_priv->id, ret != -ENOMEM);
}
static void cm_format_mra(struct cm_mra_msg *mra_msg,
--
MST
More information about the general
mailing list