]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/bnxt_re: Fix the locking while accessing the QP table
authorSelvin Xavier <selvin.xavier@broadcom.com>
Tue, 17 Dec 2024 10:26:49 +0000 (15:56 +0530)
committerLeon Romanovsky <leon@kernel.org>
Thu, 19 Dec 2024 11:57:19 +0000 (06:57 -0500)
QP table handling is synchronized with destroy QP and Async
event from the HW. The same needs to be synchronized
during create_qp also. Use the same lock in create_qp also.

Fixes: 76d3ddff7153 ("RDMA/bnxt_re: synchronize the qp-handle table array")
Fixes: f218d67ef004 ("RDMA/bnxt_re: Allow posting when QPs are in error")
Fixes: 84cf229f4001 ("RDMA/bnxt_re: Fix the qp table indexing")
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Link: https://patch.msgid.link/20241217102649.1377704-6-kalesh-anakkur.purayil@broadcom.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/bnxt_re/qplib_fp.c

index 951ad90f5aa9629edaed3c2744ebe2f38915e863..5336f74297f815b5ad3e46a27173085ff137fa7d 100644 (file)
@@ -1181,9 +1181,11 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
                rq->dbinfo.db = qp->dpi->dbr;
                rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size);
        }
+       spin_lock_bh(&rcfw->tbl_lock);
        tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw);
        rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
        rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp;
+       spin_unlock_bh(&rcfw->tbl_lock);
 
        return 0;
 fail: