Commit f3cca4b1 authored by Shlomo Pongratz's avatar Shlomo Pongratz Committed by Roland Dreier

IB/mlx4: Fetch XRC SRQ in the CQ polling code

An XRC target QP may redirect to more than one XRC SRQ.  This means
that for work completions associated with a XRC TGT QP, the srq field
in the QP has no usage and the real XRC SRQ need to be retrived using
the information from the XRCETH placed into the CQE, do that.
Signed-off-by: default avatarShlomo Pongratz <shlomop@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 9f550553
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/mlx4/cq.h> #include <linux/mlx4/cq.h>
#include <linux/mlx4/qp.h> #include <linux/mlx4/qp.h>
#include <linux/mlx4/srq.h>
#include <linux/slab.h> #include <linux/slab.h>
#include "mlx4_ib.h" #include "mlx4_ib.h"
...@@ -585,6 +586,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, ...@@ -585,6 +586,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
struct mlx4_qp *mqp; struct mlx4_qp *mqp;
struct mlx4_ib_wq *wq; struct mlx4_ib_wq *wq;
struct mlx4_ib_srq *srq; struct mlx4_ib_srq *srq;
struct mlx4_srq *msrq = NULL;
int is_send; int is_send;
int is_error; int is_error;
u32 g_mlpath_rqpn; u32 g_mlpath_rqpn;
...@@ -653,6 +655,20 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, ...@@ -653,6 +655,20 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
wc->qp = &(*cur_qp)->ibqp; wc->qp = &(*cur_qp)->ibqp;
if (wc->qp->qp_type == IB_QPT_XRC_TGT) {
u32 srq_num;
g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn);
srq_num = g_mlpath_rqpn & 0xffffff;
/* SRQ is also in the radix tree */
msrq = mlx4_srq_lookup(to_mdev(cq->ibcq.device)->dev,
srq_num);
if (unlikely(!msrq)) {
pr_warn("CQ %06x with entry for unknown SRQN %06x\n",
cq->mcq.cqn, srq_num);
return -EINVAL;
}
}
if (is_send) { if (is_send) {
wq = &(*cur_qp)->sq; wq = &(*cur_qp)->sq;
if (!(*cur_qp)->sq_signal_bits) { if (!(*cur_qp)->sq_signal_bits) {
...@@ -666,6 +682,11 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, ...@@ -666,6 +682,11 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
wqe_ctr = be16_to_cpu(cqe->wqe_index); wqe_ctr = be16_to_cpu(cqe->wqe_index);
wc->wr_id = srq->wrid[wqe_ctr]; wc->wr_id = srq->wrid[wqe_ctr];
mlx4_ib_free_srq_wqe(srq, wqe_ctr); mlx4_ib_free_srq_wqe(srq, wqe_ctr);
} else if (msrq) {
srq = to_mibsrq(msrq);
wqe_ctr = be16_to_cpu(cqe->wqe_index);
wc->wr_id = srq->wrid[wqe_ctr];
mlx4_ib_free_srq_wqe(srq, wqe_ctr);
} else { } else {
wq = &(*cur_qp)->rq; wq = &(*cur_qp)->rq;
tail = wq->tail & (wq->wqe_cnt - 1); tail = wq->tail & (wq->wqe_cnt - 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment