[PATCH for-next 03/23] RDMA/rdmavt: Correct multi-port QP iteration

Dennis Dalessandro
2025-06-30T17:58:13Z

From: Dean Luick <dean.luick@cornelisnetworks.com>

When finding special QPs, the iterator makes an incorrect port
index calculation. Fix the calculation.

Signed-off-by: Dean Luick <dean.luick@cornelisnetworks.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
---
drivers/infiniband/sw/rdmavt/qp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 583debe4b9a2..464005c74750 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -2708,7 +2708,7 @@ int rvt_qp_iter_next(struct rvt_qp_iter *iter)
struct rvt_ibport *rvp;
int pidx;

- pidx = n % rdi->ibdev.phys_port_cnt;
+ pidx = n / 2; /* QP0 and QP1 */
rvp = rdi->ports[pidx];
qp = rcu_dereference(rvp->qp[n & 1]);
} else {