diff options
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_cm.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 076a0bbb63d7..c64249f7caed 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -309,6 +309,11 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even | |||
309 | return -ENOMEM; | 309 | return -ENOMEM; |
310 | p->dev = dev; | 310 | p->dev = dev; |
311 | p->id = cm_id; | 311 | p->id = cm_id; |
312 | cm_id->context = p; | ||
313 | p->state = IPOIB_CM_RX_LIVE; | ||
314 | p->jiffies = jiffies; | ||
315 | INIT_LIST_HEAD(&p->list); | ||
316 | |||
312 | p->qp = ipoib_cm_create_rx_qp(dev, p); | 317 | p->qp = ipoib_cm_create_rx_qp(dev, p); |
313 | if (IS_ERR(p->qp)) { | 318 | if (IS_ERR(p->qp)) { |
314 | ret = PTR_ERR(p->qp); | 319 | ret = PTR_ERR(p->qp); |
@@ -320,24 +325,24 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even | |||
320 | if (ret) | 325 | if (ret) |
321 | goto err_modify; | 326 | goto err_modify; |
322 | 327 | ||
328 | spin_lock_irq(&priv->lock); | ||
329 | queue_delayed_work(ipoib_workqueue, | ||
330 | &priv->cm.stale_task, IPOIB_CM_RX_DELAY); | ||
331 | /* Add this entry to passive ids list head, but do not re-add it | ||
332 | * if IB_EVENT_QP_LAST_WQE_REACHED has moved it to flush list. */ | ||
333 | p->jiffies = jiffies; | ||
334 | if (p->state == IPOIB_CM_RX_LIVE) | ||
335 | list_move(&p->list, &priv->cm.passive_ids); | ||
336 | spin_unlock_irq(&priv->lock); | ||
337 | |||
323 | ret = ipoib_cm_send_rep(dev, cm_id, p->qp, &event->param.req_rcvd, psn); | 338 | ret = ipoib_cm_send_rep(dev, cm_id, p->qp, &event->param.req_rcvd, psn); |
324 | if (ret) { | 339 | if (ret) { |
325 | ipoib_warn(priv, "failed to send REP: %d\n", ret); | 340 | ipoib_warn(priv, "failed to send REP: %d\n", ret); |
326 | goto err_rep; | 341 | if (ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE)) |
342 | ipoib_warn(priv, "unable to move qp to error state\n"); | ||
327 | } | 343 | } |
328 | |||
329 | cm_id->context = p; | ||
330 | p->jiffies = jiffies; | ||
331 | p->state = IPOIB_CM_RX_LIVE; | ||
332 | spin_lock_irq(&priv->lock); | ||
333 | if (list_empty(&priv->cm.passive_ids)) | ||
334 | queue_delayed_work(ipoib_workqueue, | ||
335 | &priv->cm.stale_task, IPOIB_CM_RX_DELAY); | ||
336 | list_add(&p->list, &priv->cm.passive_ids); | ||
337 | spin_unlock_irq(&priv->lock); | ||
338 | return 0; | 344 | return 0; |
339 | 345 | ||
340 | err_rep: | ||
341 | err_modify: | 346 | err_modify: |
342 | ib_destroy_qp(p->qp); | 347 | ib_destroy_qp(p->qp); |
343 | err_qp: | 348 | err_qp: |