RDMA/bnxt_re: Fix the inline size for GenP7 devices
Subsystems (2)
Selvin Xavier
maintainerPATCH 1/2 RDMA/bnxt_re: Fix the inline size for GenP7 devices
Inline size supported by the device is based on the number of SGEs supported by the adapter. Change the inline size calculation based on that.
--- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/qplib_sp.c +1 -1
@@ -162,7 +162,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw) attr->max_srq_wqes =le32_to_cpu (sb->max_srq_wr) -1 ; attr->max_srq_sges = sb->max_srq_sge; attr->max_pkey =1 ; - attr->max_inline_data =le32_to_cpu (sb->max_inline_data); + attr->max_inline_data = attr->max_qp_sges *sizeof (struct sq_sge );if (!bnxt_qplib_is_chip_gen_p7 (rcfw->res->cctx)) attr->l2_db_size = (sb->l2_db_space_size +1 ) * (0x01 <<RCFW_DBR_BASE_PAGE_SHIFT );
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 2/2 RDMA/bnxt_re: Pass correct flag for dma mr creation
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.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 8 +++++--- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 6 +++--- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +5 -3
@@ -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;
@@ -4027,7 +4028,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;
@@ -4257,7 +4258,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 ;
drivers/infiniband/hw/bnxt_re/qplib_sp.c +3 -3
@@ -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; }
drivers/infiniband/hw/bnxt_re/qplib_sp.h +1 -1
@@ -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);
Signature · 1 line
2.5.5
Leon Romanovsky
AppliedQuoted 5 lines · Selvin Xavier
Inline size supported by the device is based on the number of SGEs supported by the adapter. Change the inline size calculation based on that.
Applied, thanks!
[1/2] RDMA/bnxt_re: Fix the inline size for GenP7 devices
https://git.kernel.org/rdma/rdma/c/431d0339402d01 [2/2] RDMA/bnxt_re: Pass correct flag for dma mr creation https://git.kernel.org/rdma/rdma/c/9384e9a6e726cf
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>