diff options
-rw-r--r-- | drivers/infiniband/hw/mlx4/cq.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index ae67df35dd4d..dab4b5188a27 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include <linux/mlx4/cq.h> | 34 | #include <linux/mlx4/cq.h> |
35 | #include <linux/mlx4/qp.h> | 35 | #include <linux/mlx4/qp.h> |
36 | #include <linux/mlx4/srq.h> | ||
36 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
37 | 38 | ||
38 | #include "mlx4_ib.h" | 39 | #include "mlx4_ib.h" |
@@ -585,6 +586,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, | |||
585 | struct mlx4_qp *mqp; | 586 | struct mlx4_qp *mqp; |
586 | struct mlx4_ib_wq *wq; | 587 | struct mlx4_ib_wq *wq; |
587 | struct mlx4_ib_srq *srq; | 588 | struct mlx4_ib_srq *srq; |
589 | struct mlx4_srq *msrq = NULL; | ||
588 | int is_send; | 590 | int is_send; |
589 | int is_error; | 591 | int is_error; |
590 | u32 g_mlpath_rqpn; | 592 | u32 g_mlpath_rqpn; |
@@ -653,6 +655,20 @@ repoll: | |||
653 | 655 | ||
654 | wc->qp = &(*cur_qp)->ibqp; | 656 | wc->qp = &(*cur_qp)->ibqp; |
655 | 657 | ||
658 | if (wc->qp->qp_type == IB_QPT_XRC_TGT) { | ||
659 | u32 srq_num; | ||
660 | g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn); | ||
661 | srq_num = g_mlpath_rqpn & 0xffffff; | ||
662 | /* SRQ is also in the radix tree */ | ||
663 | msrq = mlx4_srq_lookup(to_mdev(cq->ibcq.device)->dev, | ||
664 | srq_num); | ||
665 | if (unlikely(!msrq)) { | ||
666 | pr_warn("CQ %06x with entry for unknown SRQN %06x\n", | ||
667 | cq->mcq.cqn, srq_num); | ||
668 | return -EINVAL; | ||
669 | } | ||
670 | } | ||
671 | |||
656 | if (is_send) { | 672 | if (is_send) { |
657 | wq = &(*cur_qp)->sq; | 673 | wq = &(*cur_qp)->sq; |
658 | if (!(*cur_qp)->sq_signal_bits) { | 674 | if (!(*cur_qp)->sq_signal_bits) { |
@@ -666,6 +682,11 @@ repoll: | |||
666 | wqe_ctr = be16_to_cpu(cqe->wqe_index); | 682 | wqe_ctr = be16_to_cpu(cqe->wqe_index); |
667 | wc->wr_id = srq->wrid[wqe_ctr]; | 683 | wc->wr_id = srq->wrid[wqe_ctr]; |
668 | mlx4_ib_free_srq_wqe(srq, wqe_ctr); | 684 | mlx4_ib_free_srq_wqe(srq, wqe_ctr); |
685 | } else if (msrq) { | ||
686 | srq = to_mibsrq(msrq); | ||
687 | wqe_ctr = be16_to_cpu(cqe->wqe_index); | ||
688 | wc->wr_id = srq->wrid[wqe_ctr]; | ||
689 | mlx4_ib_free_srq_wqe(srq, wqe_ctr); | ||
669 | } else { | 690 | } else { |
670 | wq = &(*cur_qp)->rq; | 691 | wq = &(*cur_qp)->rq; |
671 | tail = wq->tail & (wq->wqe_cnt - 1); | 692 | tail = wq->tail & (wq->wqe_cnt - 1); |