]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/bnxt_re: Pass correct flag for dma mr creation
authorSelvin Xavier <selvin.xavier@broadcom.com>
Thu, 20 Nov 2025 07:36:55 +0000 (23:36 -0800)
committerLeon Romanovsky <leon@kernel.org>
Mon, 24 Nov 2025 07:58:30 +0000 (02:58 -0500)
DMA MR doesn't use the unified MR model. So the lkey passed
on to the reg_mr command to FW should contain the correct
lkey. Driver is incorrectly over writing the lkey with pdid
and firmware commands fails due to this.

Avoid passing the wrong key for cases where the unified MR
registration is not used.

Fixes: f786eebbbefa ("RDMA/bnxt_re: Avoid an extra hwrm per MR creation")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Link: https://patch.msgid.link/1763624215-10382-2-git-send-email-selvin.xavier@broadcom.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/bnxt_re/ib_verbs.c
drivers/infiniband/hw/bnxt_re/qplib_sp.c
drivers/infiniband/hw/bnxt_re/qplib_sp.h

index 4dab5ca7362b56d592ad515b63fd487c8cc97507..13e9667ee04ac49559b1a7db810069e8564be680 100644 (file)
@@ -601,7 +601,8 @@ static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd)
        mr->qplib_mr.va = (u64)(unsigned long)fence->va;
        mr->qplib_mr.total_size = BNXT_RE_FENCE_BYTES;
        rc = bnxt_qplib_reg_mr(&rdev->qplib_res, &mr->qplib_mr, NULL,
-                              BNXT_RE_FENCE_PBL_SIZE, PAGE_SIZE);
+                              BNXT_RE_FENCE_PBL_SIZE, PAGE_SIZE,
+                              _is_alloc_mr_unified(rdev->dev_attr->dev_cap_flags));
        if (rc) {
                ibdev_err(&rdev->ibdev, "Failed to register fence-MR\n");
                goto fail;
@@ -4032,7 +4033,7 @@ struct ib_mr *bnxt_re_get_dma_mr(struct ib_pd *ib_pd, int mr_access_flags)
        mr->qplib_mr.hwq.level = PBL_LVL_MAX;
        mr->qplib_mr.total_size = -1; /* Infinte length */
        rc = bnxt_qplib_reg_mr(&rdev->qplib_res, &mr->qplib_mr, NULL, 0,
-                              PAGE_SIZE);
+                              PAGE_SIZE, false);
        if (rc)
                goto fail_mr;
 
@@ -4262,7 +4263,8 @@ static struct ib_mr *__bnxt_re_user_reg_mr(struct ib_pd *ib_pd, u64 length, u64
 
        umem_pgs = ib_umem_num_dma_blocks(umem, page_size);
        rc = bnxt_qplib_reg_mr(&rdev->qplib_res, &mr->qplib_mr, umem,
-                              umem_pgs, page_size);
+                              umem_pgs, page_size,
+                              _is_alloc_mr_unified(rdev->dev_attr->dev_cap_flags));
        if (rc) {
                ibdev_err(&rdev->ibdev, "Failed to register user MR - rc = %d\n", rc);
                rc = -EIO;
index a9afac2cbb7cfd186c82f758cf3043f6dc31d8a6..408a34df266721b67996e4dcf25c81f8220d1ead 100644 (file)
@@ -578,7 +578,7 @@ int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw,
 }
 
 int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
-                     struct ib_umem *umem, int num_pbls, u32 buf_pg_size)
+                     struct ib_umem *umem, int num_pbls, u32 buf_pg_size, bool unified_mr)
 {
        struct bnxt_qplib_rcfw *rcfw = res->rcfw;
        struct bnxt_qplib_hwq_attr hwq_attr = {};
@@ -640,7 +640,7 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
        req.access = (mr->access_flags & BNXT_QPLIB_MR_ACCESS_MASK);
        req.va = cpu_to_le64(mr->va);
        req.key = cpu_to_le32(mr->lkey);
-       if (_is_alloc_mr_unified(res->dattr->dev_cap_flags))
+       if (unified_mr)
                req.key = cpu_to_le32(mr->pd->id);
        req.flags = cpu_to_le16(mr->flags);
        req.mr_size = cpu_to_le64(mr->total_size);
@@ -651,7 +651,7 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
        if (rc)
                goto fail;
 
-       if (_is_alloc_mr_unified(res->dattr->dev_cap_flags)) {
+       if (unified_mr) {
                mr->lkey = le32_to_cpu(resp.xid);
                mr->rkey = mr->lkey;
        }
index 147b5d9c03138b31bcca06936ccd19969bb6a687..5a45c55c6464c9b0ec59acf56b9d3738f7916192 100644 (file)
@@ -341,7 +341,7 @@ int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res,
 int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw,
                         bool block);
 int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
-                     struct ib_umem *umem, int num_pbls, u32 buf_pg_size);
+                     struct ib_umem *umem, int num_pbls, u32 buf_pg_size, bool unified_mr);
 int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr);
 int bnxt_qplib_alloc_fast_reg_mr(struct bnxt_qplib_res *res,
                                 struct bnxt_qplib_mrw *mr, int max);