[ofa-general] [RFC][PATCH] IPoIB: release RC QP resource during connection establishment

Shirley Ma mashirle at us.ibm.com
Mon Jul 28 13:48:40 PDT 2008


Repost with the right format.

Signed-off-by: Shirley Ma <xma at us.ibm.com>
------

 drivers/infiniband/ulp/ipoib/ipoib_cm.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 0f2d304..90b8668 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -480,8 +480,10 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
 	ret = ipoib_cm_send_rep(dev, cm_id, p->qp, &event->param.req_rcvd, psn);
 	if (ret) {
 		ipoib_warn(priv, "failed to send REP: %d\n", ret);
-		if (ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE))
-			ipoib_warn(priv, "unable to move qp to error state\n");
+		spin_lock_irqsave(&priv->lock, flags);
+		list_move(&p->list, &priv->cm.rx_reap_list);
+		spin_unlock_irqrestore(&priv->lock, flags);
+		queue_work(ipoib_workqueue, &priv->cm.rx_reap_task);
 	}
 	return 0;
 
@@ -497,19 +499,22 @@ static int ipoib_cm_rx_handler(struct ib_cm_id *cm_id,
 {
 	struct ipoib_cm_rx *p;
 	struct ipoib_dev_priv *priv;
+	p = cm_id->context;
+	priv = netdev_priv(p->dev);
 
 	switch (event->event) {
 	case IB_CM_REQ_RECEIVED:
 		return ipoib_cm_req_handler(cm_id, event);
 	case IB_CM_DREQ_RECEIVED:
-		p = cm_id->context;
 		ib_send_cm_drep(cm_id, NULL, 0);
-		/* Fall through */
-	case IB_CM_REJ_RECEIVED:
-		p = cm_id->context;
-		priv = netdev_priv(p->dev);
 		if (ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE))
 			ipoib_warn(priv, "unable to move qp to error state\n");
+		return 0;
+	case IB_CM_REJ_RECEIVED:
+		spin_lock_irqsave(&priv->lock, flags);
+		list_move(&p->list, &priv->cm.rx_reap_list);
+		spin_unlock_irqrestore(&priv->lock, flags);
+		queue_work(ipoib_workqueue, &priv->cm.rx_reap_task);
 		/* Fall through */
 	default:
 		return 0;





More information about the general mailing list