[ofa-general] [RFC][PATCH] IPoIB: release RC QP resource during connection establishment
Shirley Ma
mashirle at us.ibm.com
Mon Jul 28 11:51:37 PDT 2008
Hello Roland,
Here is a patch to release QP resources in the context of before RC QP
establishement. Since the send QP hasn't set to RTU, there will be no
incoming packets to the receive QP, so it's safe to release this kind of
QP resource immediately. It replaces current approach: putting QP in
error status and waiting for all WQEs flushing in CQ to free QP
resource.
This approach reduces flushing CQEs overhead and also avoid potential
resource leakage: like modify_qp failure, failed to put QP in RTS
status, thus no drain WRs being generated...
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