diff options
author | Dotan Barak <dotanb@dev.mellanox.co.il> | 2008-04-17 00:09:34 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-17 00:09:34 -0400 |
commit | 5121df3ae45731ce98374a1b0b4d48f072643f42 (patch) | |
tree | f0eba075bae9fde2dd37cadfe4ee96b62496732b /drivers | |
parent | 9285faa1e7c8ffcc8901c40f6e1cc06d93e92431 (diff) |
IB/mthca: Update QP state if query QP succeeds
If the QP was moved to another state (such as SQE) by the hardware,
then after this change the user won't have to set the IBV_QP_CUR_STATE
mask in order to execute modify QP in order to recover from this state.
Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_qp.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index b3fd6b05d79d..09dc3614cf2c 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -437,29 +437,34 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m | |||
437 | int mthca_state; | 437 | int mthca_state; |
438 | u8 status; | 438 | u8 status; |
439 | 439 | ||
440 | mutex_lock(&qp->mutex); | ||
441 | |||
440 | if (qp->state == IB_QPS_RESET) { | 442 | if (qp->state == IB_QPS_RESET) { |
441 | qp_attr->qp_state = IB_QPS_RESET; | 443 | qp_attr->qp_state = IB_QPS_RESET; |
442 | goto done; | 444 | goto done; |
443 | } | 445 | } |
444 | 446 | ||
445 | mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); | 447 | mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); |
446 | if (IS_ERR(mailbox)) | 448 | if (IS_ERR(mailbox)) { |
447 | return PTR_ERR(mailbox); | 449 | err = PTR_ERR(mailbox); |
450 | goto out; | ||
451 | } | ||
448 | 452 | ||
449 | err = mthca_QUERY_QP(dev, qp->qpn, 0, mailbox, &status); | 453 | err = mthca_QUERY_QP(dev, qp->qpn, 0, mailbox, &status); |
450 | if (err) | 454 | if (err) |
451 | goto out; | 455 | goto out_mailbox; |
452 | if (status) { | 456 | if (status) { |
453 | mthca_warn(dev, "QUERY_QP returned status %02x\n", status); | 457 | mthca_warn(dev, "QUERY_QP returned status %02x\n", status); |
454 | err = -EINVAL; | 458 | err = -EINVAL; |
455 | goto out; | 459 | goto out_mailbox; |
456 | } | 460 | } |
457 | 461 | ||
458 | qp_param = mailbox->buf; | 462 | qp_param = mailbox->buf; |
459 | context = &qp_param->context; | 463 | context = &qp_param->context; |
460 | mthca_state = be32_to_cpu(context->flags) >> 28; | 464 | mthca_state = be32_to_cpu(context->flags) >> 28; |
461 | 465 | ||
462 | qp_attr->qp_state = to_ib_qp_state(mthca_state); | 466 | qp->state = to_ib_qp_state(mthca_state); |
467 | qp_attr->qp_state = qp->state; | ||
463 | qp_attr->path_mtu = context->mtu_msgmax >> 5; | 468 | qp_attr->path_mtu = context->mtu_msgmax >> 5; |
464 | qp_attr->path_mig_state = | 469 | qp_attr->path_mig_state = |
465 | to_ib_mig_state((be32_to_cpu(context->flags) >> 11) & 0x3); | 470 | to_ib_mig_state((be32_to_cpu(context->flags) >> 11) & 0x3); |
@@ -506,8 +511,11 @@ done: | |||
506 | 511 | ||
507 | qp_init_attr->cap = qp_attr->cap; | 512 | qp_init_attr->cap = qp_attr->cap; |
508 | 513 | ||
509 | out: | 514 | out_mailbox: |
510 | mthca_free_mailbox(dev, mailbox); | 515 | mthca_free_mailbox(dev, mailbox); |
516 | |||
517 | out: | ||
518 | mutex_unlock(&qp->mutex); | ||
511 | return err; | 519 | return err; |
512 | } | 520 | } |
513 | 521 | ||