diff options
author | Dotan Barak <dotanb@dev.mellanox.co.il> | 2006-12-27 08:46:06 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-01-09 17:14:28 -0500 |
commit | f5e10529a9a835a267f6aa7806e291d6df845e14 (patch) | |
tree | b3b1fcd83d891da9046d68f57b0341863dadc3ad | |
parent | f2d9136133de257abbd97fec6f624d3a73d1e1fd (diff) |
IB/mthca: Don't execute QUERY_QP firmware command for QP in RESET state
If a QP being queried is in the RESET state, don't execute the
QUERY_QP firmware command (because it will fail).
Signed-off-by: Dotan Barak <dotanb@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_qp.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index d844a2569b47..5f5214c0337d 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -429,13 +429,18 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m | |||
429 | { | 429 | { |
430 | struct mthca_dev *dev = to_mdev(ibqp->device); | 430 | struct mthca_dev *dev = to_mdev(ibqp->device); |
431 | struct mthca_qp *qp = to_mqp(ibqp); | 431 | struct mthca_qp *qp = to_mqp(ibqp); |
432 | int err; | 432 | int err = 0; |
433 | struct mthca_mailbox *mailbox; | 433 | struct mthca_mailbox *mailbox = NULL; |
434 | struct mthca_qp_param *qp_param; | 434 | struct mthca_qp_param *qp_param; |
435 | struct mthca_qp_context *context; | 435 | struct mthca_qp_context *context; |
436 | int mthca_state; | 436 | int mthca_state; |
437 | u8 status; | 437 | u8 status; |
438 | 438 | ||
439 | if (qp->state == IB_QPS_RESET) { | ||
440 | qp_attr->qp_state = IB_QPS_RESET; | ||
441 | goto done; | ||
442 | } | ||
443 | |||
439 | mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); | 444 | mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); |
440 | if (IS_ERR(mailbox)) | 445 | if (IS_ERR(mailbox)) |
441 | return PTR_ERR(mailbox); | 446 | return PTR_ERR(mailbox); |
@@ -454,7 +459,6 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m | |||
454 | mthca_state = be32_to_cpu(context->flags) >> 28; | 459 | mthca_state = be32_to_cpu(context->flags) >> 28; |
455 | 460 | ||
456 | qp_attr->qp_state = to_ib_qp_state(mthca_state); | 461 | qp_attr->qp_state = to_ib_qp_state(mthca_state); |
457 | qp_attr->cur_qp_state = qp_attr->qp_state; | ||
458 | qp_attr->path_mtu = context->mtu_msgmax >> 5; | 462 | qp_attr->path_mtu = context->mtu_msgmax >> 5; |
459 | qp_attr->path_mig_state = | 463 | qp_attr->path_mig_state = |
460 | to_ib_mig_state((be32_to_cpu(context->flags) >> 11) & 0x3); | 464 | to_ib_mig_state((be32_to_cpu(context->flags) >> 11) & 0x3); |
@@ -464,11 +468,6 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m | |||
464 | qp_attr->dest_qp_num = be32_to_cpu(context->remote_qpn) & 0xffffff; | 468 | qp_attr->dest_qp_num = be32_to_cpu(context->remote_qpn) & 0xffffff; |
465 | qp_attr->qp_access_flags = | 469 | qp_attr->qp_access_flags = |
466 | to_ib_qp_access_flags(be32_to_cpu(context->params2)); | 470 | to_ib_qp_access_flags(be32_to_cpu(context->params2)); |
467 | qp_attr->cap.max_send_wr = qp->sq.max; | ||
468 | qp_attr->cap.max_recv_wr = qp->rq.max; | ||
469 | qp_attr->cap.max_send_sge = qp->sq.max_gs; | ||
470 | qp_attr->cap.max_recv_sge = qp->rq.max_gs; | ||
471 | qp_attr->cap.max_inline_data = qp->max_inline_data; | ||
472 | 471 | ||
473 | if (qp->transport == RC || qp->transport == UC) { | 472 | if (qp->transport == RC || qp->transport == UC) { |
474 | to_ib_ah_attr(dev, &qp_attr->ah_attr, &context->pri_path); | 473 | to_ib_ah_attr(dev, &qp_attr->ah_attr, &context->pri_path); |
@@ -495,7 +494,16 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m | |||
495 | qp_attr->retry_cnt = (be32_to_cpu(context->params1) >> 16) & 0x7; | 494 | qp_attr->retry_cnt = (be32_to_cpu(context->params1) >> 16) & 0x7; |
496 | qp_attr->rnr_retry = context->pri_path.rnr_retry >> 5; | 495 | qp_attr->rnr_retry = context->pri_path.rnr_retry >> 5; |
497 | qp_attr->alt_timeout = context->alt_path.ackto >> 3; | 496 | qp_attr->alt_timeout = context->alt_path.ackto >> 3; |
498 | qp_init_attr->cap = qp_attr->cap; | 497 | |
498 | done: | ||
499 | qp_attr->cur_qp_state = qp_attr->qp_state; | ||
500 | qp_attr->cap.max_send_wr = qp->sq.max; | ||
501 | qp_attr->cap.max_recv_wr = qp->rq.max; | ||
502 | qp_attr->cap.max_send_sge = qp->sq.max_gs; | ||
503 | qp_attr->cap.max_recv_sge = qp->rq.max_gs; | ||
504 | qp_attr->cap.max_inline_data = qp->max_inline_data; | ||
505 | |||
506 | qp_init_attr->cap = qp_attr->cap; | ||
499 | 507 | ||
500 | out: | 508 | out: |
501 | mthca_free_mailbox(dev, mailbox); | 509 | mthca_free_mailbox(dev, mailbox); |