Refactor control path of bnxt_re driver
Subsystems (2)
v3 cover Refactor control path of bnxt_re driver
This is the first series out of few more forthcoming series to refactor Broadcom's RoCE driver. This series contains patches to refactor control path. Since this is first series, there may be few code section which may look redundant or overkill but those will be taken care in future patch series.
These patches apply clean on tip of for-next branch.
Each patch in this series is tested against user and kernel functionality.
v2->v3
-- Rebased the series on tip of for-nxt, linux-5.6-rc1
v1->v2
patch 0001
-- removed unwind logic when qp destroy fails.
-- removed atomic dec out of mutex lock
patch 0003
-- saved memset by using default initializer for hwq_attr and sginfo
patch 0004
-- saved memset by using default initializer for rattr.
patch 0008
-- a new patch to remove dev_err/dbg/warn/info from driver.
Devesh Sharma (8):
RDMA/bnxt_re: Refactor queue pair creation code RDMA/bnxt_re: Replace chip context structure with pointer RDMA/bnxt_re: Refactor hardware queue memory allocation RDMA/bnxt_re: Refactor net ring allocation function RDMA/bnxt_re: Refactor command queue management code RDMA/bnxt_re: Refactor notification queue management code RDMA/bnxt_re: Refactor doorbell management functions RDMA/bnxt_re: use ibdev based message printing functions
drivers/infiniband/hw/bnxt_re/bnxt_re.h | 24 +- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 900 ++++++++++++++++++----------- drivers/infiniband/hw/bnxt_re/main.c | 264 +++++---- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 416 ++++++------- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 94 +-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 467 +++++++++------ drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 85 +-- drivers/infiniband/hw/bnxt_re/qplib_res.c | 470 +++++++++------ drivers/infiniband/hw/bnxt_re/qplib_res.h | 145 ++++- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 48 +- 10 files changed, 1737 insertions(+), 1176 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v3 1/8 RDMA/bnxt_re: Refactor queue pair creation code
Restructuring the bnxt_re_create_qp function. Listing below the major changes:
--Monolithic central part of create_qp where attributes are
initialized is now enclosed in one function and this new function has few more sub-functions.
--Top level qp limit checking code moved to a function. --GSI QP creation and GSI Shadow qp creation code is handled
in a sub function.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 13 +- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 629 ++++++++++++++++++++----------- drivers/infiniband/hw/bnxt_re/main.c | 3 +- 3 files changed, 428 insertions(+), 217 deletions(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +9 -4
@@ -104,6 +104,14 @@ struct bnxt_re_sqp_entries {struct bnxt_re_qp *qp1_qp; }; +#define BNXT_RE_MAX_GSI_SQP_ENTRIES 1024 +struct bnxt_re_gsi_context { +struct bnxt_re_qp *gsi_qp; +struct bnxt_re_qp *gsi_sqp; +struct bnxt_re_ah *gsi_sah; +struct bnxt_re_sqp_entries *sqp_tbl; +}; +#define BNXT_RE_MIN_MSIX 2#define BNXT_RE_MAX_MSIX 9#define BNXT_RE_AEQ_IDX 0
@@ -165,10 +173,7 @@ struct bnxt_re_dev {u16 cosq[2 ];/* QP for for handling QP1 packets */ -u32 sqp_id; -struct bnxt_re_qp *qp1_sqp; -struct bnxt_re_ah *sqp_ah; -struct bnxt_re_sqp_entries sqp_tbl[1024 ]; +struct bnxt_re_gsi_context gsi_ctx;atomic_t nq_alloc_cnt;u32 is_virtfn;u32 num_vfs;
drivers/infiniband/hw/bnxt_re/ib_verbs.c +417 -212
832 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/main.c +2 -1
@@ -1125,7 +1125,8 @@ static int bnxt_re_query_hwrm_pri2cos(struct bnxt_re_dev *rdev, u8 dir,static bool bnxt_re_is_qp1_or_shadow_qp (struct bnxt_re_dev *rdev,struct bnxt_re_qp *qp) { -return (qp->ib_qp.qp_type ==IB_QPT_GSI ) || (qp == rdev->qp1_sqp); +return (qp->ib_qp.qp_type ==IB_QPT_GSI ) || + (qp == rdev->gsi_ctx.gsi_sqp); }static void bnxt_re_dev_stop (struct bnxt_re_dev *rdev)
Signature · 1 line
1.8.3.1
PATCH v3 2/8 RDMA/bnxt_re: Replace chip context structure with pointer
In reply to Devesh SharmaThe chip_ctx member in bnxt_re_dev structure is now a pointer to struct bnxt_qplib_chip_ctx. Since the member type has changed there are changes in rest of the code wherever dev->chip_ctx is used.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 +- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 13 ++++++----- drivers/infiniband/hw/bnxt_re/main.c | 40 +++++++++++++++++++++----------- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 2 +- 4 files changed, 36 insertions(+), 21 deletions(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +1 -1
@@ -133,7 +133,7 @@ struct bnxt_re_dev {#define BNXT_RE_FLAG_ISSUE_ROCE_STATS 29struct net_device *netdev;unsigned int version, major, minor; -struct bnxt_qplib_chip_ctx chip_ctx; +struct bnxt_qplib_chip_ctx *chip_ctx;struct bnxt_en_dev *en_dev;struct bnxt_msix_entry msix_entries[BNXT_RE_MAX_MSIX ];int num_msix;
drivers/infiniband/hw/bnxt_re/ib_verbs.c +7 -6
@@ -859,7 +859,7 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd, bytes = (qplib_qp->sq.max_wqe *BNXT_QPLIB_MAX_SQE_ENTRY_SIZE );/* Consider mapping PSN search memory only for RC QPs. */ if (qplib_qp->type ==CMDQ_CREATE_QP_TYPE_RC ) { - psn_sz =bnxt_qplib_is_chip_gen_p5 (&rdev->chip_ctx) ? + psn_sz =bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx) ?sizeof (struct sq_psn_search_ext ) :sizeof (struct sq_psn_search ); bytes += (qplib_qp->sq.max_wqe * psn_sz);
@@ -1060,6 +1060,7 @@ static void bnxt_re_adjust_gsi_rq_attr(struct bnxt_re_qp *qp) qplqp->rq.max_sge = dev_attr->max_qp_sges;if (qplqp->rq.max_sge > dev_attr->max_qp_sges) qplqp->rq.max_sge = dev_attr->max_qp_sges; + qplqp->rq.max_sge =6 ; } static void bnxt_re_init_sq_attr(struct bnxt_re_qp *qp,
@@ -1123,7 +1124,7 @@ static int bnxt_re_init_qp_type(struct bnxt_re_dev *rdev,struct bnxt_qplib_chip_ctx *chip_ctx;int qptype; - chip_ctx = &rdev->chip_ctx; + chip_ctx = rdev->chip_ctx; qptype =__from_ib_qp_type (init_attr->qp_type);if (qptype ==IB_QPT_MAX ) {
@@ -1343,7 +1344,7 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, goto fail;if (qp_init_attr->qp_type ==IB_QPT_GSI && - !(bnxt_qplib_is_chip_gen_p5 (&rdev->chip_ctx))) { + !(bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx))) { rc =bnxt_re_create_gsi_qp (qp, pd, qp_init_attr);if (rc == -ENODEV ) goto qp_destroy;
@@ -3819,10 +3820,10 @@ int bnxt_re_alloc_ucontext(struct ib_ucontext *ctx, struct ib_udata *udata)spin_lock_init (&uctx->sh_lock); resp.comp_mask =BNXT_RE_UCNTX_CMASK_HAVE_CCTX ; - chip_met_rev_num = rdev->chip_ctx.chip_num; - chip_met_rev_num |= ((u32 )rdev->chip_ctx.chip_rev &0xFF ) << + chip_met_rev_num = rdev->chip_ctx->chip_num; + chip_met_rev_num |= ((u32 )rdev->chip_ctx->chip_rev &0xFF ) <<BNXT_RE_CHIP_ID0_CHIP_REV_SFT ; - chip_met_rev_num |= ((u32 )rdev->chip_ctx.chip_metal &0xFF ) << + chip_met_rev_num |= ((u32 )rdev->chip_ctx->chip_metal &0xFF ) <<BNXT_RE_CHIP_ID0_CHIP_MET_SFT ; resp.chip_id0 = chip_met_rev_num;/* Future extension of chip info */
drivers/infiniband/hw/bnxt_re/main.c +27 -13
@@ -82,22 +82,35 @@static void bnxt_re_destroy_chip_ctx (struct bnxt_re_dev *rdev) { +struct bnxt_qplib_chip_ctx *chip_ctx; + +if (!rdev->chip_ctx) +return ; + chip_ctx = rdev->chip_ctx; + rdev->chip_ctx =NULL ; rdev->rcfw.res =NULL ; rdev->qplib_res.cctx =NULL ; +kfree (chip_ctx); }static int bnxt_re_setup_chip_ctx (struct bnxt_re_dev *rdev) { +struct bnxt_qplib_chip_ctx *chip_ctx;struct bnxt_en_dev *en_dev;struct bnxt *bp; en_dev = rdev->en_dev; bp =netdev_priv (en_dev->net); - rdev->chip_ctx.chip_num = bp->chip_num; + chip_ctx =kzalloc (sizeof (*chip_ctx),GFP_KERNEL ); +if (!chip_ctx) +return -ENOMEM ; + chip_ctx->chip_num = bp->chip_num; + + rdev->chip_ctx = chip_ctx;/* rest members to follow eventually */ - rdev->qplib_res.cctx = &rdev->chip_ctx; + rdev->qplib_res.cctx = rdev->chip_ctx; rdev->rcfw.res = &rdev->qplib_res;return 0 ;
@@ -136,7 +149,7 @@ static void bnxt_re_limit_pf_res(struct bnxt_re_dev *rdev) ctx->srqc_count =min_t (u32,BNXT_RE_MAX_SRQC_COUNT , attr->max_srq); ctx->cq_count =min_t (u32,BNXT_RE_MAX_CQ_COUNT , attr->max_cq); -if (!bnxt_qplib_is_chip_gen_p5 (&rdev->chip_ctx)) +if (!bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx))for (i =0 ; i <MAX_TQM_ALLOC_REQ ; i++) rdev->qplib_ctx.tqm_count[i] = rdev->dev_attr.tqm_alloc_reqs[i];
@@ -185,7 +198,7 @@ static void bnxt_re_set_resource_limits(struct bnxt_re_dev *rdev)memset (&rdev->qplib_ctx.vf_res,0 ,sizeof (struct bnxt_qplib_vf_res ));bnxt_re_limit_pf_res (rdev); - num_vfs =bnxt_qplib_is_chip_gen_p5 (&rdev->chip_ctx) ? + num_vfs =bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx) ?BNXT_RE_GEN_P5_MAX_VF : rdev->num_vfs;if (num_vfs)bnxt_re_limit_vf_res (&rdev->qplib_ctx, num_vfs);
@@ -208,7 +221,7 @@ static void bnxt_re_sriov_config(void *p, int num_vfs)return ; rdev->num_vfs = num_vfs; -if (!bnxt_qplib_is_chip_gen_p5 (&rdev->chip_ctx)) { +if (!bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx)) {bnxt_re_set_resource_limits (rdev);bnxt_qplib_set_func_resources (&rdev->qplib_res, &rdev->rcfw, &rdev->qplib_ctx);
@@ -916,7 +929,7 @@ static int bnxt_re_cqn_handler(struct bnxt_qplib_nq *nq,#define BNXT_RE_GEN_P5_VF_NQ_DB 0x4000static u32 bnxt_re_get_nqdb_offset (struct bnxt_re_dev *rdev,u16 indx) { -return bnxt_qplib_is_chip_gen_p5 (&rdev->chip_ctx) ? +return bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx) ? (rdev->is_virtfn ?BNXT_RE_GEN_P5_VF_NQ_DB :BNXT_RE_GEN_P5_PF_NQ_DB ) : rdev->msix_entries[indx].db_offset;
@@ -967,7 +980,7 @@ static void bnxt_re_free_nq_res(struct bnxt_re_dev *rdev)int i;for (i =0 ; i < rdev->num_msix -1 ; i++) { - type =bnxt_qplib_get_ring_type (&rdev->chip_ctx); + type =bnxt_qplib_get_ring_type (rdev->chip_ctx);bnxt_re_net_ring_free (rdev, rdev->nq[i].ring_id, type); rdev->nq[i].res =NULL ;bnxt_qplib_free_nq (&rdev->nq[i]);
@@ -1025,7 +1038,7 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) i, rc); goto free_nq; } - type =bnxt_qplib_get_ring_type (&rdev->chip_ctx); + type =bnxt_qplib_get_ring_type (rdev->chip_ctx); pg_map = rdev->nq[i].hwq.pbl[PBL_LVL_0 ].pg_map_arr; pages = rdev->nq[i].hwq.pbl[rdev->nq[i].hwq.level].pg_count; rc = bnxt_re_net_ring_alloc(rdev, pg_map, pages, type,
@@ -1044,7 +1057,7 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev)return 0 ; free_nq:for (i = num_vec_created; i >=0 ; i--) { - type =bnxt_qplib_get_ring_type (&rdev->chip_ctx); + type =bnxt_qplib_get_ring_type (rdev->chip_ctx);bnxt_re_net_ring_free (rdev, rdev->nq[i].ring_id, type);bnxt_qplib_free_nq (&rdev->nq[i]); }
@@ -1324,7 +1337,7 @@ static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev)bnxt_re_net_stats_ctx_free (rdev, rdev->qplib_ctx.stats.fw_id);bnxt_qplib_free_ctx (rdev->en_dev->pdev, &rdev->qplib_ctx);bnxt_qplib_disable_rcfw_channel (&rdev->rcfw); - type =bnxt_qplib_get_ring_type (&rdev->chip_ctx); + type =bnxt_qplib_get_ring_type (rdev->chip_ctx);bnxt_re_net_ring_free (rdev, rdev->rcfw.creq_ring_id, type);bnxt_qplib_free_rcfw_channel (&rdev->rcfw); }
@@ -1405,7 +1418,8 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)pr_err ("Failed to allocate RCFW Channel: %#x\n" , rc); goto fail; } - type =bnxt_qplib_get_ring_type (&rdev->chip_ctx); + + type =bnxt_qplib_get_ring_type (rdev->chip_ctx); pg_map = rdev->rcfw.creq.pbl[PBL_LVL_0 ].pg_map_arr; pages = rdev->rcfw.creq.pbl[rdev->rcfw.creq.level].pg_count; ridx = rdev->msix_entries[BNXT_RE_AEQ_IDX ].ring_idx;
@@ -1434,7 +1448,7 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)bnxt_re_set_resource_limits (rdev); rc =bnxt_qplib_alloc_ctx (rdev->en_dev->pdev, &rdev->qplib_ctx,0 , -bnxt_qplib_is_chip_gen_p5 (&rdev->chip_ctx)); +bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx));if (rc) {pr_err ("Failed to allocate QPLIB context: %#x\n" , rc); goto disable_rcfw;
@@ -1504,7 +1518,7 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) disable_rcfw:bnxt_qplib_disable_rcfw_channel (&rdev->rcfw); free_ring: - type =bnxt_qplib_get_ring_type (&rdev->chip_ctx); + type =bnxt_qplib_get_ring_type (rdev->chip_ctx);bnxt_re_net_ring_free (rdev, rdev->rcfw.creq_ring_id, type); free_rcfw:bnxt_qplib_free_rcfw_channel (&rdev->rcfw);
drivers/infiniband/hw/bnxt_re/qplib_fp.c +1 -1
@@ -2426,7 +2426,7 @@ static int bnxt_qplib_cq_process_res_ud(struct bnxt_qplib_cq *cq, } cqe = *pcqe; cqe->opcode = hwcqe->cqe_type_toggle &CQ_BASE_CQE_TYPE_MASK ; - cqe->length = (u32 )le16_to_cpu (hwcqe->length); + cqe->length =le16_to_cpu (hwcqe->length) &CQ_RES_UD_LENGTH_MASK ; cqe->cfa_meta =le16_to_cpu (hwcqe->cfa_metadata); cqe->invrkey =le32_to_cpu (hwcqe->imm_data); cqe->flags =le16_to_cpu (hwcqe->flags);
Signature · 1 line
1.8.3.1
PATCH v3 3/8 RDMA/bnxt_re: Refactor hardware queue memory allocation
In reply to Devesh SharmaAt top level there are three major data structure addition. viz bnxt_qplib_hwq_attr, bnxt_qplib_sg_info and bnxt_qplib_tqm_ctx
Intorduction of first data structure reduces the arguments list to bnxt_re_alloc_init_hwq() function. There are changes all over the driver code to incorporate this new structure. The caller needs to fill the attribute data structure and pass to this function.
The second data structure is to pass memory region description viz. sghead, page_size and page_shift. There are changes all over the driver code to initialize bnxt_re_sg_info data structure. The new data structure helps to reduce the argument list of __alloc_pbl() function call.
Till now the TQM rings related members were not collected under any specific data-structure making it hard to manage. The third data sctructure bnxt_qplib_tqm_ctx is added to refactor the TQM queue allocation and initialization.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 26 +- drivers/infiniband/hw/bnxt_re/main.c | 20 +- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 169 ++++++----- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 2 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 57 ++-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 5 +- drivers/infiniband/hw/bnxt_re/qplib_res.c | 470 ++++++++++++++++++----------- drivers/infiniband/hw/bnxt_re/qplib_res.h | 60 ++-- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 48 +-- 9 files changed, 525 insertions(+), 332 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +21 -5
@@ -871,9 +871,11 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd,return PTR_ERR (umem); qp->sumem = umem; - qplib_qp->sq.sg_info.sglist = umem->sg_head.sgl; + qplib_qp->sq.sg_info.sghead = umem->sg_head.sgl; qplib_qp->sq.sg_info.npages =ib_umem_num_pages (umem); qplib_qp->sq.sg_info.nmap = umem->nmap; + qplib_qp->sq.sg_info.pgsize =PAGE_SIZE ; + qplib_qp->sq.sg_info.pgshft =PAGE_SHIFT ; qplib_qp->qp_handle = ureq.qp_handle;if (!qp->qplib_qp.srq) {
@@ -884,9 +886,11 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd,if (IS_ERR (umem)) goto rqfail; qp->rumem = umem; - qplib_qp->rq.sg_info.sglist = umem->sg_head.sgl; + qplib_qp->rq.sg_info.sghead = umem->sg_head.sgl; qplib_qp->rq.sg_info.npages =ib_umem_num_pages (umem); qplib_qp->rq.sg_info.nmap = umem->nmap; + qplib_qp->rq.sg_info.pgsize =PAGE_SIZE ; + qplib_qp->rq.sg_info.pgshft =PAGE_SHIFT ; } qplib_qp->dpi = &cntx->dpi;
@@ -976,6 +980,8 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd, qp->qplib_qp.sq.max_sge =2 ;/* Q full delta can be 1 since it is internal QP */ qp->qplib_qp.sq.q_full_delta =1 ; + qp->qplib_qp.sq.sg_info.pgsize =PAGE_SIZE ; + qp->qplib_qp.sq.sg_info.pgshft =PAGE_SHIFT ; qp->qplib_qp.scq = qp1_qp->scq; qp->qplib_qp.rcq = qp1_qp->rcq;
@@ -984,6 +990,8 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd, qp->qplib_qp.rq.max_sge = qp1_qp->rq.max_sge;/* Q full delta can be 1 since it is internal QP */ qp->qplib_qp.rq.q_full_delta =1 ; + qp->qplib_qp.rq.sg_info.pgsize =PAGE_SIZE ; + qp->qplib_qp.rq.sg_info.pgshft =PAGE_SHIFT ; qp->qplib_qp.mtu = qp1_qp->mtu;
@@ -1043,6 +1051,8 @@ static int bnxt_re_init_rq_attr(struct bnxt_re_qp *qp,if (qplqp->rq.max_sge > dev_attr->max_qp_sges) qplqp->rq.max_sge = dev_attr->max_qp_sges; } + qplqp->rq.sg_info.pgsize =PAGE_SIZE ; + qplqp->rq.sg_info.pgshft =PAGE_SHIFT ;return 0 ; }
@@ -1095,6 +1105,8 @@ static void bnxt_re_init_sq_attr(struct bnxt_re_qp *qp,* unexpected Queue full condition */ qplqp->sq.q_full_delta -=1 ; + qplqp->sq.sg_info.pgsize =PAGE_SIZE ; + qplqp->sq.sg_info.pgshft =PAGE_SHIFT ; } static void bnxt_re_adjust_gsi_sq_attr(struct bnxt_re_qp *qp,
@@ -1511,9 +1523,11 @@ static int bnxt_re_init_user_srq(struct bnxt_re_dev *rdev,return PTR_ERR (umem); srq->umem = umem; - qplib_srq->sg_info.sglist = umem->sg_head.sgl; + qplib_srq->sg_info.sghead = umem->sg_head.sgl; qplib_srq->sg_info.npages =ib_umem_num_pages (umem); qplib_srq->sg_info.nmap = umem->nmap; + qplib_srq->sg_info.pgsize =PAGE_SIZE ; + qplib_srq->sg_info.pgshft =PAGE_SHIFT ; qplib_srq->srq_handle = ureq.srq_handle; qplib_srq->dpi = &cntx->dpi;
@@ -2367,7 +2381,7 @@ static int bnxt_re_build_reg_wqe(const struct ib_reg_wr *wr, wqe->frmr.pbl_dma_ptr = qplib_frpl->hwq.pbl_dma_ptr[0 ]; wqe->frmr.page_list = mr->pages; wqe->frmr.page_list_len = mr->npages; - wqe->frmr.levels = qplib_frpl->hwq.level +1 ; + wqe->frmr.levels = qplib_frpl->hwq.level; wqe->type =BNXT_QPLIB_SWQE_TYPE_REG_MR ;/* Need unconditional fence for reg_mr
@@ -2741,6 +2755,8 @@ int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,if (entries > dev_attr->max_cq_wqes +1 ) entries = dev_attr->max_cq_wqes +1 ; + cq->qplib_cq.sg_info.pgsize =PAGE_SIZE ; + cq->qplib_cq.sg_info.pgshft =PAGE_SHIFT ;if (udata) {struct bnxt_re_cq_req req; struct bnxt_re_ucontext *uctx = rdma_udata_to_drv_context(
@@ -2757,7 +2773,7 @@ int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, rc =PTR_ERR (cq->umem); goto fail; } - cq->qplib_cq.sg_info.sglist = cq->umem->sg_head.sgl; + cq->qplib_cq.sg_info.sghead = cq->umem->sg_head.sgl; cq->qplib_cq.sg_info.npages =ib_umem_num_pages (cq->umem); cq->qplib_cq.sg_info.nmap = cq->umem->nmap; cq->qplib_cq.dpi = &uctx->dpi;
drivers/infiniband/hw/bnxt_re/main.c +11 -9
@@ -90,6 +90,8 @@ static void bnxt_re_destroy_chip_ctx(struct bnxt_re_dev *rdev) rdev->chip_ctx =NULL ; rdev->rcfw.res =NULL ; rdev->qplib_res.cctx =NULL ; + rdev->qplib_res.pdev =NULL ; + rdev->qplib_res.netdev =NULL ;kfree (chip_ctx); }
@@ -151,7 +153,7 @@ static void bnxt_re_limit_pf_res(struct bnxt_re_dev *rdev) ctx->cq_count =min_t (u32,BNXT_RE_MAX_CQ_COUNT , attr->max_cq);if (!bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx))for (i =0 ; i <MAX_TQM_ALLOC_REQ ; i++) - rdev->qplib_ctx.tqm_count[i] = + rdev->qplib_ctx.tqm_ctx.qcount[i] = rdev->dev_attr.tqm_alloc_reqs[i]; }
@@ -982,8 +984,8 @@ static void bnxt_re_free_nq_res(struct bnxt_re_dev *rdev)for (i =0 ; i < rdev->num_msix -1 ; i++) { type =bnxt_qplib_get_ring_type (rdev->chip_ctx);bnxt_re_net_ring_free (rdev, rdev->nq[i].ring_id, type); - rdev->nq[i].res =NULL ;bnxt_qplib_free_nq (&rdev->nq[i]); + rdev->nq[i].res =NULL ; } }
@@ -1032,7 +1034,7 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) rdev->nq[i].res = &rdev->qplib_res; rdev->nq[i].hwq.max_elements =BNXT_RE_MAX_CQ_COUNT +BNXT_RE_MAX_SRQC_COUNT +2 ; - rc =bnxt_qplib_alloc_nq (rdev->en_dev->pdev, &rdev->nq[i]); + rc =bnxt_qplib_alloc_nq (&rdev->qplib_res, &rdev->nq[i]);if (rc) {dev_err (rdev_to_dev (rdev),"Alloc Failed NQ%d rc:%#x" , i, rc);
@@ -1056,7 +1058,7 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) }return 0 ; free_nq: -for (i = num_vec_created; i >=0 ; i--) { +for (i = num_vec_created -1 ; i >=0 ; i--) { type =bnxt_qplib_get_ring_type (rdev->chip_ctx);bnxt_re_net_ring_free (rdev, rdev->nq[i].ring_id, type);bnxt_qplib_free_nq (&rdev->nq[i]);
@@ -1335,7 +1337,7 @@ static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev)dev_warn (rdev_to_dev (rdev),"Failed to deinitialize RCFW: %#x" , rc);bnxt_re_net_stats_ctx_free (rdev, rdev->qplib_ctx.stats.fw_id); -bnxt_qplib_free_ctx (rdev->en_dev->pdev, &rdev->qplib_ctx); +bnxt_qplib_free_ctx (&rdev->qplib_res, &rdev->qplib_ctx);bnxt_qplib_disable_rcfw_channel (&rdev->rcfw); type =bnxt_qplib_get_ring_type (rdev->chip_ctx);bnxt_re_net_ring_free (rdev, rdev->rcfw.creq_ring_id, type);
@@ -1411,7 +1413,7 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)/* Establish RCFW Communication Channel to initialize the context * memory for the function and all child VFs */ - rc =bnxt_qplib_alloc_rcfw_channel (rdev->en_dev->pdev, &rdev->rcfw, + rc =bnxt_qplib_alloc_rcfw_channel (&rdev->qplib_res, &rdev->rcfw, &rdev->qplib_ctx,BNXT_RE_MAX_QPC_COUNT );if (rc) {
@@ -1432,7 +1434,7 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) } db_offt =bnxt_re_get_nqdb_offset (rdev,BNXT_RE_AEQ_IDX ); vid = rdev->msix_entries[BNXT_RE_AEQ_IDX ].vector; - rc =bnxt_qplib_enable_rcfw_channel (rdev->en_dev->pdev, &rdev->rcfw, + rc =bnxt_qplib_enable_rcfw_channel (&rdev->rcfw, vid, db_offt, rdev->is_virtfn, &bnxt_re_aeq_handler);if (rc) {
@@ -1447,7 +1449,7 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)bnxt_re_set_resource_limits (rdev); - rc =bnxt_qplib_alloc_ctx (rdev->en_dev->pdev, &rdev->qplib_ctx,0 , + rc =bnxt_qplib_alloc_ctx (&rdev->qplib_res, &rdev->qplib_ctx,0 ,bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx));if (rc) {pr_err ("Failed to allocate QPLIB context: %#x\n" , rc);
@@ -1514,7 +1516,7 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) free_sctx:bnxt_re_net_stats_ctx_free (rdev, rdev->qplib_ctx.stats.fw_id); free_ctx: -bnxt_qplib_free_ctx (rdev->en_dev->pdev, &rdev->qplib_ctx); +bnxt_qplib_free_ctx (&rdev->qplib_res, &rdev->qplib_ctx); disable_rcfw:bnxt_qplib_disable_rcfw_channel (&rdev->rcfw); free_ring:
drivers/infiniband/hw/bnxt_re/qplib_fp.c +98 -71
318 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_fp.h +1 -1
@@ -550,7 +550,7 @@ int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe,bool bnxt_qplib_is_cq_empty (struct bnxt_qplib_cq *cq);void bnxt_qplib_req_notify_cq (struct bnxt_qplib_cq *cq,u32 arm_type);void bnxt_qplib_free_nq (struct bnxt_qplib_nq *nq); -int bnxt_qplib_alloc_nq (struct pci_dev *pdev,struct bnxt_qplib_nq *nq); +int bnxt_qplib_alloc_nq (struct bnxt_qplib_res *res,struct bnxt_qplib_nq *nq);void bnxt_qplib_add_flush_qp (struct bnxt_qplib_qp *qp);void bnxt_qplib_acquire_cq_locks (struct bnxt_qplib_qp *qp,unsigned long *flags);
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +32 -25
104 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +2 -3
@@ -268,7 +268,7 @@ struct bnxt_qplib_rcfw { };void bnxt_qplib_free_rcfw_channel (struct bnxt_qplib_rcfw *rcfw); -int bnxt_qplib_alloc_rcfw_channel (struct pci_dev *pdev, +int bnxt_qplib_alloc_rcfw_channel (struct bnxt_qplib_res *res,struct bnxt_qplib_rcfw *rcfw,struct bnxt_qplib_ctx *ctx,int qp_tbl_sz);
@@ -276,8 +276,7 @@ int bnxt_qplib_alloc_rcfw_channel(struct pci_dev *pdev,void bnxt_qplib_disable_rcfw_channel (struct bnxt_qplib_rcfw *rcfw);int bnxt_qplib_rcfw_start_irq (struct bnxt_qplib_rcfw *rcfw,int msix_vector,bool need_init); -int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev, - struct bnxt_qplib_rcfw *rcfw, +int bnxt_qplib_enable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw, int msix_vector, int cp_bar_reg_off, int virt_fn, int (*aeq_handler)(struct bnxt_qplib_rcfw *,
drivers/infiniband/hw/bnxt_re/qplib_res.c +290 -180
650 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_res.h +40 -20
119 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_sp.c +30 -18
104 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 4/8 RDMA/bnxt_re: Refactor net ring allocation function
In reply to Devesh SharmaIntroducing a new attribute structure to reduce
the long list of arguments passed in bnxt_re_net_ring_alloc() function.
The caller of bnxt_re_net_ring_alloc should fill in the list of attributes in bnxt_re_ring_attr structure and then pass the pointer to the function.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 9 +++++ drivers/infiniband/hw/bnxt_re/main.c | 64 ++++++++++++++++++--------------- 2 files changed, 44 insertions(+), 29 deletions(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +9 -0
@@ -89,6 +89,15 @@#define BNXT_RE_DEFAULT_ACK_DELAY 16 +struct bnxt_re_ring_attr { +dma_addr_t *dma_arr; +int pages; +int type; +u32 depth; +u32 lrid;/* Logical ring id */ +u8 mode; +}; +struct bnxt_re_work {struct work_struct work;unsigned long event;
drivers/infiniband/hw/bnxt_re/main.c +35 -29
122 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 5/8 RDMA/bnxt_re: Refactor command queue management code
In reply to Devesh SharmaRefactoring the command queue (rcfw) management code. A new data-structure is introduced to describe the bar register. each object which deals with mmio space should have a descriptor structure. This structure specifically hold DB register information. Thus, slow path creq structure now hold a bar register descriptor.
Further cleanup the rcfw structure to introduce the command queue context and command response event queue context structures. Rest of the rcfw related code has been touched to incorporate these three structures.
--- drivers/infiniband/hw/bnxt_re/main.c | 12 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 419 +++++++++++++++++------------ drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 80 +++--- drivers/infiniband/hw/bnxt_re/qplib_res.h | 7 + 4 files changed, 313 insertions(+), 205 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +7 -5
@@ -1344,7 +1344,7 @@ static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev)bnxt_qplib_free_ctx (&rdev->qplib_res, &rdev->qplib_ctx);bnxt_qplib_disable_rcfw_channel (&rdev->rcfw); type =bnxt_qplib_get_ring_type (rdev->chip_ctx); -bnxt_re_net_ring_free (rdev, rdev->rcfw.creq_ring_id, type); +bnxt_re_net_ring_free (rdev, rdev->rcfw.creq.ring_id, type);bnxt_qplib_free_rcfw_channel (&rdev->rcfw); }if (test_and_clear_bit (BNXT_RE_FLAG_GOT_MSIX , &rdev->flags)) {
@@ -1375,6 +1375,7 @@ static void bnxt_re_worker(struct work_struct *work)static int bnxt_re_ib_reg (struct bnxt_re_dev *rdev) { +struct bnxt_qplib_creq_ctx *creq;struct bnxt_re_ring_attr rattr;u32 db_offt;bool locked;
@@ -1427,13 +1428,14 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) } type =bnxt_qplib_get_ring_type (rdev->chip_ctx); - rattr.dma_arr = rdev->rcfw.creq.pbl[PBL_LVL_0 ].pg_map_arr; - rattr.pages = rdev->rcfw.creq.pbl[rdev->rcfw.creq.level].pg_count; + creq = &rdev->rcfw.creq; + rattr.dma_arr = creq->hwq.pbl[PBL_LVL_0 ].pg_map_arr; + rattr.pages = creq->hwq.pbl[creq->hwq.level].pg_count; rattr.type = type; rattr.mode =RING_ALLOC_REQ_INT_MODE_MSIX ; rattr.depth =BNXT_QPLIB_CREQE_MAX_CNT -1 ; rattr.lrid = rdev->msix_entries[BNXT_RE_AEQ_IDX ].ring_idx; - rc =bnxt_re_net_ring_alloc (rdev, &rattr, &rdev->rcfw.creq_ring_id); + rc =bnxt_re_net_ring_alloc (rdev, &rattr, &creq->ring_id);if (rc) {pr_err ("Failed to allocate CREQ: %#x\n" , rc); goto free_rcfw;
@@ -1527,7 +1529,7 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)bnxt_qplib_disable_rcfw_channel (&rdev->rcfw); free_ring: type =bnxt_qplib_get_ring_type (rdev->chip_ctx); -bnxt_re_net_ring_free (rdev, rdev->rcfw.creq_ring_id, type); +bnxt_re_net_ring_free (rdev, rdev->rcfw.creq.ring_id, type); free_rcfw:bnxt_qplib_free_rcfw_channel (&rdev->rcfw); fail:
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +253 -166
730 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +46 -34
103 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_res.h +7 -0
@@ -80,6 +80,13 @@ enum bnxt_qplib_pbl_lvl {#define ROCE_PG_SIZE_8M (8 * 1024 * 1024)#define ROCE_PG_SIZE_1G (1024 * 1024 * 1024) +struct bnxt_qplib_reg_desc { +u8 bar_id; +resource_size_t bar_base; +void __iomem *bar_reg; +size_t len; +}; +struct bnxt_qplib_pbl {u32 pg_count;u32 pg_size;
Signature · 1 line
1.8.3.1
PATCH v3 6/8 RDMA/bnxt_re: Refactor notification queue management code
In reply to Devesh SharmaCleaning up the notification queue data structures and management code. The CQ and SRQ event handlers have been type defined instead of in-place declaration. NQ doorbell register descriptor has been added in base NQ structure. The nq->vector has been renamed to nq->msix_vec.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 114 ++++++++++++++++++------------- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 54 +++++++-------- 2 files changed, 94 insertions(+), 74 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +67 -47
@@ -236,16 +236,16 @@ static int bnxt_qplib_alloc_qp_hdr_buf(struct bnxt_qplib_res *res,static void bnxt_qplib_service_nq (unsigned long data) {struct bnxt_qplib_nq *nq = (struct bnxt_qplib_nq *)data; +bool gen_p5 =bnxt_qplib_is_chip_gen_p5 (nq->res->cctx);struct bnxt_qplib_hwq *hwq = &nq->hwq;struct nq_base *nqe, **nq_ptr;struct bnxt_qplib_cq *cq;int num_cqne_processed =0 ;int num_srqne_processed =0 ; -u32 sw_cons, raw_cons; -u16 type;int budget = nq->budget; +u32 sw_cons, raw_cons;uintptr_t q_handle; -bool gen_p5 =bnxt_qplib_is_chip_gen_p5 (nq->res->cctx); +u16 type;/* Service the NQ until empty */ raw_cons = hwq->cons;
@@ -314,7 +314,7 @@ static void bnxt_qplib_service_nq(unsigned long data) }if (hwq->cons != raw_cons) { hwq->cons = raw_cons; -bnxt_qplib_ring_nq_db_rearm (nq->bar_reg_iomem, hwq->cons, +bnxt_qplib_ring_nq_db_rearm (nq->nq_db.db, hwq->cons, hwq->max_elements, nq->ring_id, gen_p5); }
@@ -333,7 +333,7 @@ static irqreturn_t bnxt_qplib_nq_irq(int irq, void *dev_instance)prefetch (&nq_ptr[NQE_PG (sw_cons)][NQE_IDX (sw_cons)]);/* Fan out to CPU affinitized kthreads? */ -tasklet_schedule (&nq->worker); +tasklet_schedule (&nq->nq_tasklet);return IRQ_HANDLED ; }
@@ -341,17 +341,17 @@ static irqreturn_t bnxt_qplib_nq_irq(int irq, void *dev_instance)void bnxt_qplib_nq_stop_irq (struct bnxt_qplib_nq *nq,bool kill) {bool gen_p5 =bnxt_qplib_is_chip_gen_p5 (nq->res->cctx); -tasklet_disable (&nq->worker); +tasklet_disable (&nq->nq_tasklet);/* Mask h/w interrupt */ -bnxt_qplib_ring_nq_db (nq->bar_reg_iomem, nq->hwq.cons, +bnxt_qplib_ring_nq_db (nq->nq_db.db, nq->hwq.cons, nq->hwq.max_elements, nq->ring_id, gen_p5);/* Sync with last running IRQ handler */ -synchronize_irq (nq->vector); +synchronize_irq (nq->msix_vec);if (kill) -tasklet_kill (&nq->worker); +tasklet_kill (&nq->nq_tasklet);if (nq->requested) { -irq_set_affinity_hint (nq->vector,NULL ); -free_irq (nq->vector, nq); +irq_set_affinity_hint (nq->msix_vec,NULL ); +free_irq (nq->msix_vec, nq); nq->requested = false; } }
@@ -364,16 +364,17 @@ void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq) }/* Make sure the HW is stopped! */ -if (nq->requested) -bnxt_qplib_nq_stop_irq (nq, true); +bnxt_qplib_nq_stop_irq (nq, true); -if (nq->bar_reg_iomem) -iounmap (nq->bar_reg_iomem); - nq->bar_reg_iomem =NULL ; +if (nq->nq_db.reg.bar_reg) { +iounmap (nq->nq_db.reg.bar_reg); + nq->nq_db.reg.bar_reg =NULL ; + nq->nq_db.db =NULL ; + } nq->cqn_handler =NULL ; nq->srqn_handler =NULL ; - nq->vector =0 ; + nq->msix_vec =0 ; } int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx,
@@ -385,68 +386,87 @@ int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx,if (nq->requested)return -EFAULT ; - nq->vector = msix_vector; + nq->msix_vec = msix_vector;if (need_init) -tasklet_init (&nq->worker, bnxt_qplib_service_nq, +tasklet_init (&nq->nq_tasklet, bnxt_qplib_service_nq, (unsigned long )nq);else -tasklet_enable (&nq->worker); +tasklet_enable (&nq->nq_tasklet);snprintf (nq->name,sizeof (nq->name),"bnxt_qplib_nq-%d" , nq_indx); - rc =request_irq (nq->vector, bnxt_qplib_nq_irq,0 , nq->name, nq); + rc =request_irq (nq->msix_vec, bnxt_qplib_nq_irq,0 , nq->name, nq);if (rc)return rc;cpumask_clear (&nq->mask);cpumask_set_cpu (nq_indx, &nq->mask); - rc =irq_set_affinity_hint (nq->vector, &nq->mask); + rc =irq_set_affinity_hint (nq->msix_vec, &nq->mask);if (rc) {dev_warn (&nq->pdev->dev,"set affinity failed; vector: %d nq_idx: %d\n" , - nq->vector, nq_indx); + nq->msix_vec, nq_indx); } nq->requested = true; -bnxt_qplib_ring_nq_db_rearm (nq->bar_reg_iomem, nq->hwq.cons, +bnxt_qplib_ring_nq_db_rearm (nq->nq_db.db, nq->hwq.cons, nq->hwq.max_elements, nq->ring_id, gen_p5);return rc; } +static int bnxt_qplib_map_nq_db (struct bnxt_qplib_nq *nq,u32 reg_offt) +{ +resource_size_t reg_base; +struct bnxt_qplib_nq_db *nq_db; +struct pci_dev *pdev; +int rc =0 ; + + pdev = nq->pdev; + nq_db = &nq->nq_db; + + nq_db->reg.bar_id =NQ_CONS_PCI_BAR_REGION ; + nq_db->reg.bar_base =pci_resource_start (pdev, nq_db->reg.bar_id); +if (!nq_db->reg.bar_base) { +dev_err (&pdev->dev,"QPLIB: NQ BAR region %d resc start is 0!" , + nq_db->reg.bar_id); + rc = -ENOMEM ; + goto fail; + } + + reg_base = nq_db->reg.bar_base + reg_offt; +/* Unconditionally map 8 bytes to support 57500 series */ + nq_db->reg.len =8 ; + nq_db->reg.bar_reg =ioremap (reg_base, nq_db->reg.len); +if (!nq_db->reg.bar_reg) { +dev_err (&pdev->dev,"QPLIB: NQ BAR region %d mapping failed" , + nq_db->reg.bar_id); + rc = -ENOMEM ; + goto fail; + } + + nq_db->db = nq_db->reg.bar_reg; +fail: +return rc; +} +int bnxt_qplib_enable_nq (struct pci_dev *pdev,struct bnxt_qplib_nq *nq,int nq_idx,int msix_vector,int bar_reg_offset, -int (*cqn_handler)(struct bnxt_qplib_nq *nq, -struct bnxt_qplib_cq *), -int (*srqn_handler)(struct bnxt_qplib_nq *nq, -struct bnxt_qplib_srq *, -u8 event)) +cqn_handler_t cqn_handler, +srqn_handler_t srqn_handler) { -resource_size_t nq_base;int rc =-1 ; -if (cqn_handler) - nq->cqn_handler = cqn_handler; - -if (srqn_handler) - nq->srqn_handler = srqn_handler; + nq->pdev = pdev; + nq->cqn_handler = cqn_handler; + nq->srqn_handler = srqn_handler;/* Have a task to schedule CQ notifiers in post send case */ nq->cqn_wq =create_singlethread_workqueue ("bnxt_qplib_nq" );if (!nq->cqn_wq)return -ENOMEM ; - nq->bar_reg =NQ_CONS_PCI_BAR_REGION ; - nq->bar_reg_off = bar_reg_offset; - nq_base =pci_resource_start (pdev, nq->bar_reg); -if (!nq_base) { - rc = -ENOMEM ; - goto fail; - } -/* Unconditionally map 8 bytes to support 57500 series */ - nq->bar_reg_iomem =ioremap (nq_base + nq->bar_reg_off,8 ); -if (!nq->bar_reg_iomem) { - rc = -ENOMEM ; + rc =bnxt_qplib_map_nq_db (nq, bar_reg_offset); +if (rc) goto fail; - } rc =bnxt_qplib_nq_start_irq (nq, nq_idx, msix_vector, true);if (rc) {
drivers/infiniband/hw/bnxt_re/qplib_fp.h +27 -27
67 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 7/8 RDMA/bnxt_re: Refactor doorbell management functions
In reply to Devesh SharmaMoving all the fast path doorbell functions at one place under qplib_res.h. To pass doorbell record information a new structure bnxt_qplib_db_info has been introduced. Every roce object holds an instance of this structure and doorbell information is initialized during resource creation.
When DB is rung only the current queue index is read from hardware ring and rest of the data is taken from pre-initialized dbinfo structure.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 143 ++++++++++------------------- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 44 +-------- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 21 ++--- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 2 +- drivers/infiniband/hw/bnxt_re/qplib_res.h | 78 ++++++++++++++++ 5 files changed, 141 insertions(+), 147 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +50 -93
@@ -53,9 +53,7 @@#include "qplib_sp.h" #include "qplib_fp.h" -static void bnxt_qplib_arm_cq_enable (struct bnxt_qplib_cq *cq);static void __clean_cq (struct bnxt_qplib_cq *cq,u64 qp); -static void bnxt_qplib_arm_srq (struct bnxt_qplib_srq *srq,u32 arm_type);static void bnxt_qplib_cancel_phantom_processing (struct bnxt_qplib_qp *qp) {
@@ -236,7 +234,6 @@ static int bnxt_qplib_alloc_qp_hdr_buf(struct bnxt_qplib_res *res,static void bnxt_qplib_service_nq (unsigned long data) {struct bnxt_qplib_nq *nq = (struct bnxt_qplib_nq *)data; -bool gen_p5 =bnxt_qplib_is_chip_gen_p5 (nq->res->cctx);struct bnxt_qplib_hwq *hwq = &nq->hwq;struct nq_base *nqe, **nq_ptr;struct bnxt_qplib_cq *cq;
@@ -272,7 +269,8 @@ static void bnxt_qplib_service_nq(unsigned long data) q_handle |= (u64 )le32_to_cpu (nqcne->cq_handle_high) <<32 ; cq = (struct bnxt_qplib_cq *)(unsigned long )q_handle; -bnxt_qplib_arm_cq_enable (cq); +bnxt_qplib_armen_db (&cq->dbinfo, +DBC_DBC_TYPE_CQ_ARMENA );spin_lock_bh (&cq->compl_lock);atomic_set (&cq->arm_state,0 );if (!nq->cqn_handler (nq, (cq)))
@@ -285,14 +283,16 @@ static void bnxt_qplib_service_nq(unsigned long data) }case NQ_BASE_TYPE_SRQ_EVENT : { +struct bnxt_qplib_srq *srq;struct nq_srq_event *nqsrqe = (struct nq_srq_event *)nqe; q_handle =le32_to_cpu (nqsrqe->srq_handle_low); q_handle |= (u64 )le32_to_cpu (nqsrqe->srq_handle_high) <<32 ; -bnxt_qplib_arm_srq ((struct bnxt_qplib_srq *)q_handle, -DBC_DBC_TYPE_SRQ_ARMENA ); + srq = (struct bnxt_qplib_srq *)q_handle; +bnxt_qplib_armen_db (&srq->dbinfo, +DBC_DBC_TYPE_SRQ_ARMENA );if (!nq->srqn_handler (nq, (struct bnxt_qplib_srq *)q_handle, nqsrqe->event))
@@ -314,9 +314,7 @@ static void bnxt_qplib_service_nq(unsigned long data) }if (hwq->cons != raw_cons) { hwq->cons = raw_cons; -bnxt_qplib_ring_nq_db_rearm (nq->nq_db.db, hwq->cons, - hwq->max_elements, nq->ring_id, - gen_p5); +bnxt_qplib_ring_nq_db (&nq->nq_db.dbinfo, nq->res->cctx, true); } }
@@ -340,11 +338,9 @@ static irqreturn_t bnxt_qplib_nq_irq(int irq, void *dev_instance)void bnxt_qplib_nq_stop_irq (struct bnxt_qplib_nq *nq,bool kill) { -bool gen_p5 =bnxt_qplib_is_chip_gen_p5 (nq->res->cctx);tasklet_disable (&nq->nq_tasklet);/* Mask h/w interrupt */ -bnxt_qplib_ring_nq_db (nq->nq_db.db, nq->hwq.cons, - nq->hwq.max_elements, nq->ring_id, gen_p5); +bnxt_qplib_ring_nq_db (&nq->nq_db.dbinfo, nq->res->cctx, false);/* Sync with last running IRQ handler */ synchronize_irq (nq->msix_vec);if (kill)
@@ -369,7 +365,6 @@ void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq)if (nq->nq_db.reg.bar_reg) {iounmap (nq->nq_db.reg.bar_reg); nq->nq_db.reg.bar_reg =NULL ; - nq->nq_db.db =NULL ; } nq->cqn_handler =NULL ;
@@ -380,7 +375,6 @@ void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq)int bnxt_qplib_nq_start_irq (struct bnxt_qplib_nq *nq,int nq_indx,int msix_vector,bool need_init) { -bool gen_p5 =bnxt_qplib_is_chip_gen_p5 (nq->res->cctx);int rc;if (nq->requested)
@@ -407,8 +401,7 @@ int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx, nq->msix_vec, nq_indx); } nq->requested = true; -bnxt_qplib_ring_nq_db_rearm (nq->nq_db.db, nq->hwq.cons, - nq->hwq.max_elements, nq->ring_id, gen_p5); +bnxt_qplib_ring_nq_db (&nq->nq_db.dbinfo, nq->res->cctx, true);return rc; }
@@ -443,7 +436,9 @@ static int bnxt_qplib_map_nq_db(struct bnxt_qplib_nq *nq, u32 reg_offt) goto fail; } - nq_db->db = nq_db->reg.bar_reg; + nq_db->dbinfo.db = nq_db->reg.bar_reg; + nq_db->dbinfo.hwq = &nq->hwq; + nq_db->dbinfo.xid = nq->ring_id; fail:return rc; }
@@ -516,24 +511,6 @@ int bnxt_qplib_alloc_nq(struct bnxt_qplib_res *res, struct bnxt_qplib_nq *nq) }/* SRQ */ -static void bnxt_qplib_arm_srq (struct bnxt_qplib_srq *srq,u32 arm_type) -{ -struct bnxt_qplib_hwq *srq_hwq = &srq->hwq; -void __iomem *db; -u32 sw_prod; -u64 val =0 ; - -/* Ring DB */ - sw_prod = (arm_type ==DBC_DBC_TYPE_SRQ_ARM ) ? - srq->threshold :HWQ_CMP (srq_hwq->prod, srq_hwq); - db = (arm_type ==DBC_DBC_TYPE_SRQ_ARMENA ) ? srq->dbr_base : - srq->dpi->dbr; - val = ((srq->id <<DBC_DBC_XID_SFT ) &DBC_DBC_XID_MASK ) | arm_type; - val <<=32 ; - val |= (sw_prod <<DBC_DBC_INDEX_SFT ) &DBC_DBC_INDEX_MASK ; -writeq (val, db); -} -void bnxt_qplib_destroy_srq (struct bnxt_qplib_res *res,struct bnxt_qplib_srq *srq) {
@@ -624,9 +601,12 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res, srq->swq[srq->last_idx].next_idx =-1 ; srq->id =le32_to_cpu (resp.xid); - srq->dbr_base = res->dpi_tbl.dbr_bar_reg_iomem; + srq->dbinfo.hwq = &srq->hwq; + srq->dbinfo.xid = srq->id; + srq->dbinfo.db = srq->dpi->dbr; + srq->dbinfo.priv_db = res->dpi_tbl.dbr_bar_reg_iomem;if (srq->threshold) -bnxt_qplib_arm_srq (srq,DBC_DBC_TYPE_SRQ_ARMENA ); +bnxt_qplib_armen_db (&srq->dbinfo,DBC_DBC_TYPE_SRQ_ARMENA ); srq->arm_req = false;return 0 ;
@@ -650,7 +630,7 @@ int bnxt_qplib_modify_srq(struct bnxt_qplib_res *res, srq_hwq->max_elements - sw_cons + sw_prod;if (count > srq->threshold) { srq->arm_req = false; -bnxt_qplib_arm_srq (srq,DBC_DBC_TYPE_SRQ_ARM ); +bnxt_qplib_srq_arm_db (&srq->dbinfo, srq->threshold); }else {/* Deferred arming */ srq->arm_req = true;
@@ -738,10 +718,10 @@ int bnxt_qplib_post_srq_recv(struct bnxt_qplib_srq *srq, srq_hwq->max_elements - sw_cons + sw_prod;spin_unlock (&srq_hwq->lock);/* Ring DB */ -bnxt_qplib_arm_srq (srq,DBC_DBC_TYPE_SRQ ); +bnxt_qplib_ring_prod_db (&srq->dbinfo,DBC_DBC_TYPE_SRQ );if (srq->arm_req == true && count > srq->threshold) { srq->arm_req = false; -bnxt_qplib_arm_srq (srq,DBC_DBC_TYPE_SRQ_ARM ); +bnxt_qplib_srq_arm_db (&srq->dbinfo, srq->threshold); } done:return rc;
@@ -872,6 +852,15 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) qp->id =le32_to_cpu (resp.xid); qp->cur_qp_state =CMDQ_MODIFY_QP_NEW_STATE_RESET ; + qp->cctx = res->cctx; + sq->dbinfo.hwq = &sq->hwq; + sq->dbinfo.xid = qp->id; + sq->dbinfo.db = qp->dpi->dbr; +if (rq->max_wqe) { + rq->dbinfo.hwq = &rq->hwq; + rq->dbinfo.xid = qp->id; + rq->dbinfo.db = qp->dpi->dbr; + } rcfw->qp_tbl[qp->id].qp_id = qp->id; rcfw->qp_tbl[qp->id].qp_handle = (void *)qp;
@@ -1109,9 +1098,17 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) qp->id =le32_to_cpu (resp.xid); qp->cur_qp_state =CMDQ_MODIFY_QP_NEW_STATE_RESET ; - qp->cctx = res->cctx;INIT_LIST_HEAD (&qp->sq_flush);INIT_LIST_HEAD (&qp->rq_flush); + qp->cctx = res->cctx; + sq->dbinfo.hwq = &sq->hwq; + sq->dbinfo.xid = qp->id; + sq->dbinfo.db = qp->dpi->dbr; +if (rq->max_wqe) { + rq->dbinfo.hwq = &rq->hwq; + rq->dbinfo.xid = qp->id; + rq->dbinfo.db = qp->dpi->dbr; + } rcfw->qp_tbl[qp->id].qp_id = qp->id; rcfw->qp_tbl[qp->id].qp_handle = (void *)qp;
@@ -1551,16 +1548,8 @@ void *bnxt_qplib_get_qp1_rq_buf(struct bnxt_qplib_qp *qp,void bnxt_qplib_post_send_db (struct bnxt_qplib_qp *qp) {struct bnxt_qplib_q *sq = &qp->sq; -u32 sw_prod; -u64 val =0 ; - val = (((qp->id <<DBC_DBC_XID_SFT ) &DBC_DBC_XID_MASK ) | -DBC_DBC_TYPE_SQ ); - val <<=32 ; - sw_prod =HWQ_CMP (sq->hwq.prod, &sq->hwq); - val |= (sw_prod <<DBC_DBC_INDEX_SFT ) &DBC_DBC_INDEX_MASK ; -/* Flush all the WQE writes to HW */ -writeq (val, qp->dpi->dbr); +bnxt_qplib_ring_prod_db (&sq->dbinfo,DBC_DBC_TYPE_SQ ); } int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
@@ -1852,16 +1841,8 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,void bnxt_qplib_post_recv_db (struct bnxt_qplib_qp *qp) {struct bnxt_qplib_q *rq = &qp->rq; -u32 sw_prod; -u64 val =0 ; - val = (((qp->id <<DBC_DBC_XID_SFT ) &DBC_DBC_XID_MASK ) | -DBC_DBC_TYPE_RQ ); - val <<=32 ; - sw_prod =HWQ_CMP (rq->hwq.prod, &rq->hwq); - val |= (sw_prod <<DBC_DBC_INDEX_SFT ) &DBC_DBC_INDEX_MASK ; -/* Flush the writes to HW Rx WQE before the ringing Rx DB */ -writeq (val, qp->dpi->dbr); +bnxt_qplib_ring_prod_db (&rq->dbinfo,DBC_DBC_TYPE_RQ ); } int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp,
@@ -1941,34 +1922,6 @@ int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp, }/* CQ */ - -/* Spinlock must be held */ -static void bnxt_qplib_arm_cq_enable (struct bnxt_qplib_cq *cq) -{ -u64 val =0 ; - - val = ((cq->id <<DBC_DBC_XID_SFT ) &DBC_DBC_XID_MASK ) | -DBC_DBC_TYPE_CQ_ARMENA ; - val <<=32 ; -/* Flush memory writes before enabling the CQ */ -writeq (val, cq->dbr_base); -} - -static void bnxt_qplib_arm_cq (struct bnxt_qplib_cq *cq,u32 arm_type) -{ -struct bnxt_qplib_hwq *cq_hwq = &cq->hwq; -u32 sw_cons; -u64 val =0 ; - -/* Ring DB */ - val = ((cq->id <<DBC_DBC_XID_SFT ) &DBC_DBC_XID_MASK ) | arm_type; - val <<=32 ; - sw_cons =HWQ_CMP (cq_hwq->cons, cq_hwq); - val |= (sw_cons <<DBC_DBC_INDEX_SFT ) &DBC_DBC_INDEX_MASK ; -/* flush memory writes before arming the CQ */ -writeq (val, cq->dpi->dbr); -} -int bnxt_qplib_create_cq (struct bnxt_qplib_res *res,struct bnxt_qplib_cq *cq) {struct bnxt_qplib_rcfw *rcfw = res->rcfw;
@@ -2023,7 +1976,6 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) goto fail; cq->id =le32_to_cpu (resp.xid); - cq->dbr_base = res->dpi_tbl.dbr_bar_reg_iomem; cq->period =BNXT_QPLIB_QUEUE_START_PERIOD ;init_waitqueue_head (&cq->waitq);INIT_LIST_HEAD (&cq->sqf_head);
@@ -2031,7 +1983,13 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)spin_lock_init (&cq->compl_lock);spin_lock_init (&cq->flush_lock); -bnxt_qplib_arm_cq_enable (cq); + cq->dbinfo.hwq = &cq->hwq; + cq->dbinfo.xid = cq->id; + cq->dbinfo.db = cq->dpi->dbr; + cq->dbinfo.priv_db = res->dpi_tbl.dbr_bar_reg_iomem; + +bnxt_qplib_armen_db (&cq->dbinfo,DBC_DBC_TYPE_CQ_ARMENA ); +return 0 ; fail:
@@ -2188,8 +2146,7 @@ static int do_wa9060(struct bnxt_qplib_qp *qp, struct bnxt_qplib_cq *cq, sq->send_phantom = true;/* TODO: Only ARM if the previous SQE is ARMALL */ -bnxt_qplib_arm_cq (cq,DBC_DBC_TYPE_CQ_ARMALL ); - +bnxt_qplib_ring_db (&cq->dbinfo,DBC_DBC_TYPE_CQ_ARMALL ); rc = -EAGAIN ; goto out; }
@@ -2859,7 +2816,7 @@ int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe, }if (cq->hwq.cons != raw_cons) { cq->hwq.cons = raw_cons; -bnxt_qplib_arm_cq (cq,DBC_DBC_TYPE_CQ ); +bnxt_qplib_ring_db (&cq->dbinfo,DBC_DBC_TYPE_CQ ); } exit:return num_cqes - budget;
@@ -2868,7 +2825,7 @@ int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe,void bnxt_qplib_req_notify_cq (struct bnxt_qplib_cq *cq,u32 arm_type) {if (arm_type) -bnxt_qplib_arm_cq (cq, arm_type); +bnxt_qplib_ring_db (&cq->dbinfo, arm_type);/* Using cq->arm_state variable to track whether to issue cq handler */ atomic_set (&cq->arm_state,1 ); }
drivers/infiniband/hw/bnxt_re/qplib_fp.h +4 -40
70 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +8 -13
@@ -379,7 +379,6 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,static void bnxt_qplib_service_creq (unsigned long data) {struct bnxt_qplib_rcfw *rcfw = (struct bnxt_qplib_rcfw *)data; -bool gen_p5 =bnxt_qplib_is_chip_gen_p5 (rcfw->res->cctx);struct bnxt_qplib_creq_ctx *creq = &rcfw->creq;u32 type, budget =CREQ_ENTRY_POLL_BUDGET ;struct bnxt_qplib_hwq *hwq = &creq->hwq;
@@ -429,9 +428,8 @@ static void bnxt_qplib_service_creq(unsigned long data)if (hwq->cons != raw_cons) { hwq->cons = raw_cons; -bnxt_qplib_ring_creq_db_rearm (creq->creq_db.db, - raw_cons, hwq->max_elements, - creq->ring_id, gen_p5); +bnxt_qplib_ring_nq_db (&creq->creq_db.dbinfo, + rcfw->res->cctx, true); }spin_unlock_irqrestore (&hwq->lock, flags); }
@@ -660,15 +658,12 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,void bnxt_qplib_rcfw_stop_irq (struct bnxt_qplib_rcfw *rcfw,bool kill) { -bool gen_p5 =bnxt_qplib_is_chip_gen_p5 (rcfw->res->cctx);struct bnxt_qplib_creq_ctx *creq; creq = &rcfw->creq;tasklet_disable (&creq->creq_tasklet);/* Mask h/w interrupts */ -bnxt_qplib_ring_creq_db (creq->creq_db.db, creq->hwq.cons, - creq->hwq.max_elements, creq->ring_id, - gen_p5); +bnxt_qplib_ring_nq_db (&creq->creq_db.dbinfo, rcfw->res->cctx, false);/* Sync with last running IRQ-handler */ synchronize_irq (creq->msix_vec);if (kill)
@@ -708,7 +703,6 @@ void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)int bnxt_qplib_rcfw_start_irq (struct bnxt_qplib_rcfw *rcfw,int msix_vector,bool need_init) { -bool gen_p5 =bnxt_qplib_is_chip_gen_p5 (rcfw->res->cctx);struct bnxt_qplib_creq_ctx *creq;int rc;
@@ -728,9 +722,8 @@ int bnxt_qplib_rcfw_start_irq(struct bnxt_qplib_rcfw *rcfw, int msix_vector,if (rc)return rc; creq->requested = true; -bnxt_qplib_ring_creq_db_rearm (creq->creq_db.db, - creq->hwq.cons, creq->hwq.max_elements, - creq->ring_id, gen_p5); + +bnxt_qplib_ring_nq_db (&creq->creq_db.dbinfo, rcfw->res->cctx, true);return 0 ; }
@@ -799,7 +792,9 @@ static int bnxt_qplib_map_creq_db(struct bnxt_qplib_rcfw *rcfw, u32 reg_offt) creq_db->reg.bar_id);return -ENOMEM ; } - creq_db->db = creq_db->reg.bar_reg; + creq_db->dbinfo.db = creq_db->reg.bar_reg; + creq_db->dbinfo.hwq = &rcfw->creq.hwq; + creq_db->dbinfo.xid = rcfw->creq.ring_id;return 0 ; }
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +1 -1
@@ -247,7 +247,7 @@ struct bnxt_qplib_cmdq_ctx {struct bnxt_qplib_creq_db {struct bnxt_qplib_reg_desc reg; -void __iomem *db; +struct bnxt_qplib_db_info dbinfo; };struct bnxt_qplib_creq_stat {
drivers/infiniband/hw/bnxt_re/qplib_res.h +78 -0
88 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 8/8 RDMA/bnxt_re: use ibdev based message printing functions
In reply to Devesh SharmaReplacing the dev_err/dbg/warn with ibdev_err/dbg/warn. In the IB device provider driver these functions are recommended to use.
Currently qplib layer function calls has not been replaced due to unavailability of ib_device pointer at that layer.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 280 +++++++++++++++---------------- drivers/infiniband/hw/bnxt_re/main.c | 131 ++++++++------- 2 files changed, 208 insertions(+), 203 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +136 -144
@@ -313,8 +313,8 @@ int bnxt_re_del_gid(const struct ib_gid_attr *attr, void **context)if (ctx->idx ==0 &&rdma_link_local_addr ((struct in6_addr *)gid_to_del) && ctx->refcnt ==1 && rdev->gsi_ctx.gsi_sqp) { -dev_dbg (rdev_to_dev (rdev), -"Trying to delete GID0 while QP1 is alive\n" ); +ibdev_dbg (&rdev->ibdev, +"Trying to delete GID0 while QP1 is alive\n" );return -EFAULT ; } ctx->refcnt--;
@@ -322,8 +322,8 @@ int bnxt_re_del_gid(const struct ib_gid_attr *attr, void **context) rc =bnxt_qplib_del_sgid (sgid_tbl, gid_to_del, vlan_id, true);if (rc) { -dev_err (rdev_to_dev (rdev), -"Failed to remove GID: %#x" , rc); +ibdev_err (&rdev->ibdev, +"Failed to remove GID: %#x" , rc); }else { ctx_tbl = sgid_tbl->ctx; ctx_tbl[ctx->idx] =NULL ;
@@ -360,7 +360,7 @@ int bnxt_re_add_gid(const struct ib_gid_attr *attr, void **context) }if (rc <0 ) { -dev_err (rdev_to_dev (rdev),"Failed to add GID: %#x" , rc); +ibdev_err (&rdev->ibdev,"Failed to add GID: %#x" , rc);return rc; }
@@ -423,12 +423,12 @@ static int bnxt_re_bind_fence_mw(struct bnxt_qplib_qp *qplib_qp) wqe.bind.r_key = fence->bind_rkey; fence->bind_rkey =ib_inc_rkey (fence->bind_rkey); -dev_dbg (rdev_to_dev (qp->rdev), -"Posting bind fence-WQE: rkey: %#x QP: %d PD: %p\n" , +ibdev_dbg (&qp->rdev->ibdev, +"Posting bind fence-WQE: rkey: %#x QP: %d PD: %p\n" , wqe.bind.r_key, qp->qplib_qp.id, pd); rc =bnxt_qplib_post_send (&qp->qplib_qp, &wqe);if (rc) { -dev_err (rdev_to_dev (qp->rdev),"Failed to bind fence-WQE\n" ); +ibdev_err (&qp->rdev->ibdev,"Failed to bind fence-WQE\n" );return rc; }bnxt_qplib_post_send_db (&qp->qplib_qp);
@@ -479,7 +479,7 @@ static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd) DMA_BIDIRECTIONAL); rc =dma_mapping_error (dev, dma_addr);if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to dma-map fence-MR-mem\n" ); +ibdev_err (&rdev->ibdev,"Failed to dma-map fence-MR-mem\n" ); rc = -EIO ; fence->dma_addr =0 ; goto fail;
@@ -499,7 +499,7 @@ static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd) mr->qplib_mr.flags =__from_ib_access_flags (mr_access_flags); rc =bnxt_qplib_alloc_mrw (&rdev->qplib_res, &mr->qplib_mr);if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to alloc fence-HW-MR\n" ); +ibdev_err (&rdev->ibdev,"Failed to alloc fence-HW-MR\n" ); goto fail; }
@@ -511,7 +511,7 @@ static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd) rc =bnxt_qplib_reg_mr (&rdev->qplib_res, &mr->qplib_mr, &pbl_tbl,BNXT_RE_FENCE_PBL_SIZE , false,PAGE_SIZE );if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to register fence-MR\n" ); +ibdev_err (&rdev->ibdev,"Failed to register fence-MR\n" ); goto fail; } mr->ib_mr.rkey = mr->qplib_mr.rkey;
@@ -519,8 +519,8 @@ static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd)/* Create a fence MW only for kernel consumers */ mw =bnxt_re_alloc_mw (&pd->ib_pd,IB_MW_TYPE_1 ,NULL );if (IS_ERR (mw)) { -dev_err (rdev_to_dev (rdev), -"Failed to create fence-MW for PD: %p\n" , pd); +ibdev_err (&rdev->ibdev, +"Failed to create fence-MW for PD: %p\n" , pd); rc =PTR_ERR (mw); goto fail; }
@@ -558,7 +558,7 @@ int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) pd->rdev = rdev;if (bnxt_qplib_alloc_pd (&rdev->qplib_res.pd_tbl, &pd->qplib_pd)) { -dev_err (rdev_to_dev (rdev),"Failed to allocate HW PD" ); +ibdev_err (&rdev->ibdev,"Failed to allocate HW PD" ); rc = -ENOMEM ; goto fail; }
@@ -585,16 +585,16 @@ int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) rc =ib_copy_to_udata (udata, &resp,sizeof (resp));if (rc) { -dev_err (rdev_to_dev (rdev), -"Failed to copy user response\n" ); +ibdev_err (&rdev->ibdev, +"Failed to copy user response\n" ); goto dbfail; } }if (!udata)if (bnxt_re_create_fence_mr (pd)) -dev_warn (rdev_to_dev (rdev), -"Failed to create Fence-MR\n" ); +ibdev_warn (&rdev->ibdev, +"Failed to create Fence-MR\n" );return 0 ; dbfail: bnxt_qplib_dealloc_pd(&rdev->qplib_res, &rdev->qplib_res.pd_tbl,
@@ -644,7 +644,7 @@ int bnxt_re_create_ah(struct ib_ah *ib_ah, struct rdma_ah_attr *ah_attr,int rc;if (!(rdma_ah_get_ah_flags (ah_attr) &IB_AH_GRH )) { -dev_err (rdev_to_dev (rdev),"Failed to alloc AH: GRH not set" ); +ibdev_err (&rdev->ibdev,"Failed to alloc AH: GRH not set" );return -EINVAL ; }
@@ -675,7 +675,7 @@ int bnxt_re_create_ah(struct ib_ah *ib_ah, struct rdma_ah_attr *ah_attr, rc =bnxt_qplib_create_ah (&rdev->qplib_res, &ah->qplib_ah, !(flags &RDMA_CREATE_AH_SLEEPABLE ));if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to allocate HW AH" ); +ibdev_err (&rdev->ibdev,"Failed to allocate HW AH" );return rc; }
@@ -759,16 +759,16 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp)mutex_unlock (&rdev->qp_lock);atomic_dec (&rdev->qp_count); -dev_dbg (rdev_to_dev (rdev),"Destroy the shadow AH\n" ); +ibdev_dbg (&rdev->ibdev,"Destroy the shadow AH\n" );bnxt_qplib_destroy_ah (&rdev->qplib_res, &gsi_sah->qplib_ah, true);bnxt_qplib_clean_qp (&qp->qplib_qp); -dev_dbg (rdev_to_dev (rdev),"Destroy the shadow QP\n" ); +ibdev_dbg (&rdev->ibdev,"Destroy the shadow QP\n" ); rc =bnxt_qplib_destroy_qp (&rdev->qplib_res, &gsi_sqp->qplib_qp);if (rc) { -dev_err (rdev_to_dev (rdev),"Destroy Shadow QP failed" ); +ibdev_err (&rdev->ibdev,"Destroy Shadow QP failed" ); goto fail; }bnxt_qplib_free_qp_res (&rdev->qplib_res, &gsi_sqp->qplib_qp);
@@ -802,7 +802,7 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata) rc =bnxt_qplib_destroy_qp (&rdev->qplib_res, &qp->qplib_qp);if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to destroy HW QP" ); +ibdev_err (&rdev->ibdev,"Failed to destroy HW QP" );return rc; }
@@ -938,8 +938,8 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd, rc =bnxt_qplib_create_ah (&rdev->qplib_res, &ah->qplib_ah, false);if (rc) { -dev_err (rdev_to_dev (rdev), -"Failed to allocate HW AH for Shadow QP" ); +ibdev_err (&rdev->ibdev, +"Failed to allocate HW AH for Shadow QP" ); goto fail; }
@@ -1032,7 +1032,7 @@ static int bnxt_re_init_rq_attr(struct bnxt_re_qp *qp, srq = container_of(init_attr->srq, struct bnxt_re_srq, ib_srq);if (!srq) { -dev_err (rdev_to_dev (rdev),"SRQ not found" ); +ibdev_err (&rdev->ibdev,"SRQ not found" );return -EINVAL ; } qplqp->srq = &srq->qplib_srq;
@@ -1140,8 +1140,7 @@ static int bnxt_re_init_qp_type(struct bnxt_re_dev *rdev, qptype =__from_ib_qp_type (init_attr->qp_type);if (qptype ==IB_QPT_MAX ) { -dev_err (rdev_to_dev (rdev),"QP type 0x%x not supported" , - qptype); +ibdev_err (&rdev->ibdev,"QP type 0x%x not supported" , qptype); qptype = -EINVAL ; goto out; }
@@ -1188,15 +1187,15 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd, qplqp->mtu =ib_mtu_enum_to_int (iboe_get_mtu (rdev->netdev->mtu)); qplqp->dpi = &rdev->dpi_privileged;/* Doorbell page */ if (init_attr->create_flags) -dev_dbg (rdev_to_dev (rdev), -"QP create flags 0x%x not supported" , - init_attr->create_flags); +ibdev_dbg (&rdev->ibdev, +"QP create flags 0x%x not supported" , + init_attr->create_flags);/* Setup CQs */ if (init_attr->send_cq) { cq = container_of(init_attr->send_cq, struct bnxt_re_cq, ib_cq);if (!cq) { -dev_err (rdev_to_dev (rdev),"Send CQ not found" ); +ibdev_err (&rdev->ibdev,"Send CQ not found" ); rc = -EINVAL ; goto out; }
@@ -1207,7 +1206,7 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,if (init_attr->recv_cq) { cq = container_of(init_attr->recv_cq, struct bnxt_re_cq, ib_cq);if (!cq) { -dev_err (rdev_to_dev (rdev),"Receive CQ not found" ); +ibdev_err (&rdev->ibdev,"Receive CQ not found" ); rc = -EINVAL ; goto out; }
@@ -1253,8 +1252,7 @@ static int bnxt_re_create_shadow_gsi(struct bnxt_re_qp *qp, sqp =bnxt_re_create_shadow_qp (pd, &rdev->qplib_res, &qp->qplib_qp);if (!sqp) { rc = -ENODEV ; -dev_err (rdev_to_dev (rdev), -"Failed to create Shadow QP for QP1" ); +ibdev_err (&rdev->ibdev,"Failed to create Shadow QP for QP1" ); goto out; } rdev->gsi_ctx.gsi_sqp = sqp;
@@ -1267,8 +1265,8 @@ static int bnxt_re_create_shadow_gsi(struct bnxt_re_qp *qp,bnxt_qplib_destroy_qp (&rdev->qplib_res, &sqp->qplib_qp); rc = -ENODEV ; -dev_err (rdev_to_dev (rdev), -"Failed to create AH entry for ShadowQP" ); +ibdev_err (&rdev->ibdev, +"Failed to create AH entry for ShadowQP" ); goto out; } rdev->gsi_ctx.gsi_sah = sah;
@@ -1296,7 +1294,7 @@ static int bnxt_re_create_gsi_qp(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd, rc =bnxt_qplib_create_qp1 (&rdev->qplib_res, qplqp);if (rc) { -dev_err (rdev_to_dev (rdev),"create HW QP1 failed!" ); +ibdev_err (&rdev->ibdev,"create HW QP1 failed!" ); goto out; }
@@ -1316,14 +1314,14 @@ static bool bnxt_re_test_qp_limits(struct bnxt_re_dev *rdev, init_attr->cap.max_send_sge > dev_attr->max_qp_sges || init_attr->cap.max_recv_sge > dev_attr->max_qp_sges || init_attr->cap.max_inline_data > dev_attr->max_inline_data) { -dev_err (rdev_to_dev (rdev), -"Create QP failed - max exceeded! 0x%x/0x%x 0x%x/0x%x 0x%x/0x%x 0x%x/0x%x 0x%x/0x%x" , - init_attr->cap.max_send_wr, dev_attr->max_qp_wqes, - init_attr->cap.max_recv_wr, dev_attr->max_qp_wqes, - init_attr->cap.max_send_sge, dev_attr->max_qp_sges, - init_attr->cap.max_recv_sge, dev_attr->max_qp_sges, - init_attr->cap.max_inline_data, - dev_attr->max_inline_data); +ibdev_err (&rdev->ibdev, +"Create QP failed - max exceeded! 0x%x/0x%x 0x%x/0x%x 0x%x/0x%x 0x%x/0x%x 0x%x/0x%x" , + init_attr->cap.max_send_wr, dev_attr->max_qp_wqes, + init_attr->cap.max_recv_wr, dev_attr->max_qp_wqes, + init_attr->cap.max_send_sge, dev_attr->max_qp_sges, + init_attr->cap.max_recv_sge, dev_attr->max_qp_sges, + init_attr->cap.max_inline_data, + dev_attr->max_inline_data); rc = false; }return rc;
@@ -1365,7 +1363,7 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, }else { rc =bnxt_qplib_create_qp (&rdev->qplib_res, &qp->qplib_qp);if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to create HW QP" ); +ibdev_err (&rdev->ibdev,"Failed to create HW QP" ); goto free_umem; }if (udata) {
@@ -1375,7 +1373,7 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, resp.rsvd =0 ; rc =ib_copy_to_udata (udata, &resp,sizeof (resp));if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to copy QP udata" ); +ibdev_err (&rdev->ibdev,"Failed to copy QP udata" ); goto qp_destroy; } }
@@ -1548,7 +1546,7 @@ int bnxt_re_create_srq(struct ib_srq *ib_srq,int rc, entries;if (srq_init_attr->attr.max_wr >= dev_attr->max_srq_wqes) { -dev_err (rdev_to_dev (rdev),"Create CQ failed - max exceeded" ); +ibdev_err (&rdev->ibdev,"Create CQ failed - max exceeded" ); rc = -EINVAL ; goto exit; }
@@ -1583,7 +1581,7 @@ int bnxt_re_create_srq(struct ib_srq *ib_srq, rc =bnxt_qplib_create_srq (&rdev->qplib_res, &srq->qplib_srq);if (rc) { -dev_err (rdev_to_dev (rdev),"Create HW SRQ failed!" ); +ibdev_err (&rdev->ibdev,"Create HW SRQ failed!" ); goto fail; }
@@ -1593,7 +1591,7 @@ int bnxt_re_create_srq(struct ib_srq *ib_srq, resp.srqid = srq->qplib_srq.id; rc =ib_copy_to_udata (udata, &resp,sizeof (resp));if (rc) { -dev_err (rdev_to_dev (rdev),"SRQ copy to udata failed!" ); +ibdev_err (&rdev->ibdev,"SRQ copy to udata failed!" );bnxt_qplib_destroy_srq (&rdev->qplib_res, &srq->qplib_srq); goto fail;
@@ -1632,7 +1630,7 @@ int bnxt_re_modify_srq(struct ib_srq *ib_srq, struct ib_srq_attr *srq_attr, srq->qplib_srq.threshold = srq_attr->srq_limit; rc =bnxt_qplib_modify_srq (&rdev->qplib_res, &srq->qplib_srq);if (rc) { -dev_err (rdev_to_dev (rdev),"Modify HW SRQ failed!" ); +ibdev_err (&rdev->ibdev,"Modify HW SRQ failed!" );return rc; }/* On success, update the shadow */
@@ -1640,8 +1638,8 @@ int bnxt_re_modify_srq(struct ib_srq *ib_srq, struct ib_srq_attr *srq_attr,/* No need to Build and send response back to udata */ break ;default : -dev_err (rdev_to_dev (rdev), -"Unsupported srq_attr_mask 0x%x" , srq_attr_mask); +ibdev_err (&rdev->ibdev, +"Unsupported srq_attr_mask 0x%x" , srq_attr_mask);return -EINVAL ; }return 0 ;
@@ -1659,7 +1657,7 @@ int bnxt_re_query_srq(struct ib_srq *ib_srq, struct ib_srq_attr *srq_attr) tsrq.qplib_srq.id = srq->qplib_srq.id; rc =bnxt_qplib_query_srq (&rdev->qplib_res, &tsrq.qplib_srq);if (rc) { -dev_err (rdev_to_dev (rdev),"Query HW SRQ failed!" ); +ibdev_err (&rdev->ibdev,"Query HW SRQ failed!" );return rc; } srq_attr->max_wr = srq->qplib_srq.max_wqe;
@@ -1725,8 +1723,7 @@ static int bnxt_re_modify_shadow_qp(struct bnxt_re_dev *rdev, rc =bnxt_qplib_modify_qp (&rdev->qplib_res, &qp->qplib_qp);if (rc) -dev_err (rdev_to_dev (rdev), -"Failed to modify Shadow QP for QP1" ); +ibdev_err (&rdev->ibdev,"Failed to modify Shadow QP for QP1" );return rc; }
@@ -1747,15 +1744,15 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, new_qp_state = qp_attr->qp_state;if (!ib_modify_qp_is_ok (curr_qp_state, new_qp_state, ib_qp->qp_type, qp_attr_mask)) { -dev_err (rdev_to_dev (rdev), -"Invalid attribute mask: %#x specified " , - qp_attr_mask); -dev_err (rdev_to_dev (rdev), -"for qpn: %#x type: %#x" , - ib_qp->qp_num, ib_qp->qp_type); -dev_err (rdev_to_dev (rdev), -"curr_qp_state=0x%x, new_qp_state=0x%x\n" , - curr_qp_state, new_qp_state); +ibdev_err (&rdev->ibdev, +"Invalid attribute mask: %#x specified " , + qp_attr_mask); +ibdev_err (&rdev->ibdev, +"for qpn: %#x type: %#x" , + ib_qp->qp_num, ib_qp->qp_type); +ibdev_err (&rdev->ibdev, +"curr_qp_state=0x%x, new_qp_state=0x%x\n" , + curr_qp_state, new_qp_state);return -EINVAL ; } qp->qplib_qp.modify_flags |=CMDQ_MODIFY_QP_MODIFY_MASK_STATE ;
@@ -1763,18 +1760,16 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,if (!qp->sumem && qp->qplib_qp.state ==CMDQ_MODIFY_QP_NEW_STATE_ERR ) { -dev_dbg (rdev_to_dev (rdev), -"Move QP = %p to flush list\n" , - qp); +ibdev_dbg (&rdev->ibdev, +"Move QP = %p to flush list\n" , qp); flags =bnxt_re_lock_cqs (qp);bnxt_qplib_add_flush_qp (&qp->qplib_qp);bnxt_re_unlock_cqs (qp, flags); }if (!qp->sumem && qp->qplib_qp.state ==CMDQ_MODIFY_QP_NEW_STATE_RESET ) { -dev_dbg (rdev_to_dev (rdev), -"Move QP = %p out of flush list\n" , - qp); +ibdev_dbg (&rdev->ibdev, +"Move QP = %p out of flush list\n" , qp); flags =bnxt_re_lock_cqs (qp);bnxt_qplib_clean_qp (&qp->qplib_qp);bnxt_re_unlock_cqs (qp, flags);
@@ -1904,10 +1899,10 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,if (qp_attr_mask &IB_QP_MAX_DEST_RD_ATOMIC ) {if (qp_attr->max_dest_rd_atomic > dev_attr->max_qp_init_rd_atom) { -dev_err (rdev_to_dev (rdev), -"max_dest_rd_atomic requested%d is > dev_max%d" , - qp_attr->max_dest_rd_atomic, - dev_attr->max_qp_init_rd_atom); +ibdev_err (&rdev->ibdev, +"max_dest_rd_atomic requested%d is > dev_max%d" , + qp_attr->max_dest_rd_atomic, + dev_attr->max_qp_init_rd_atom);return -EINVAL ; }
@@ -1928,8 +1923,8 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, (qp_attr->cap.max_recv_sge >= dev_attr->max_qp_sges) || (qp_attr->cap.max_inline_data >= dev_attr->max_inline_data)) { -dev_err (rdev_to_dev (rdev), -"Create QP failed - max exceeded" ); +ibdev_err (&rdev->ibdev, +"Create QP failed - max exceeded" );return -EINVAL ; } entries =roundup_pow_of_two (qp_attr->cap.max_send_wr);
@@ -1962,7 +1957,7 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, } rc =bnxt_qplib_modify_qp (&rdev->qplib_res, &qp->qplib_qp);if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to modify HW QP" ); +ibdev_err (&rdev->ibdev,"Failed to modify HW QP" );return rc; }if (ib_qp->qp_type ==IB_QPT_GSI && rdev->gsi_ctx.gsi_sqp)
@@ -1987,7 +1982,7 @@ int bnxt_re_query_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, rc =bnxt_qplib_query_qp (&rdev->qplib_res, qplib_qp);if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to query HW QP" ); +ibdev_err (&rdev->ibdev,"Failed to query HW QP" ); goto out; } qp_attr->qp_state =__to_ib_qp_state (qplib_qp->state);
@@ -2192,7 +2187,7 @@ static int bnxt_re_build_qp1_send_v2(struct bnxt_re_qp *qp, wqe->num_sge++; }else { -dev_err (rdev_to_dev (qp->rdev),"QP1 buffer is empty!" ); +ibdev_err (&qp->rdev->ibdev,"QP1 buffer is empty!" ); rc = -ENOMEM ; }return rc;
@@ -2428,8 +2423,8 @@ static int bnxt_re_copy_inline_data(struct bnxt_re_dev *rdev,if ((sge_len + wqe->inline_len) >BNXT_QPLIB_SWQE_MAX_INLINE_LENGTH ) { -dev_err (rdev_to_dev (rdev), -"Inline data size requested > supported value" ); +ibdev_err (&rdev->ibdev, +"Inline data size requested > supported value" );return -EINVAL ; } sge_len = wr->sg_list[i].length;
@@ -2489,8 +2484,8 @@ static int bnxt_re_post_send_shadow_qp(struct bnxt_re_dev *rdev,/* Common */ wqe.num_sge = wr->num_sge;if (wr->num_sge > qp->qplib_qp.sq.max_sge) { -dev_err (rdev_to_dev (rdev), -"Limit exceeded for Send SGEs" ); +ibdev_err (&rdev->ibdev, +"Limit exceeded for Send SGEs" ); rc = -EINVAL ; goto bad; }
@@ -2509,9 +2504,9 @@ static int bnxt_re_post_send_shadow_qp(struct bnxt_re_dev *rdev, rc =bnxt_qplib_post_send (&qp->qplib_qp, &wqe); bad:if (rc) { -dev_err (rdev_to_dev (rdev), -"Post send failed opcode = %#x rc = %d" , - wr->opcode, rc); +ibdev_err (&rdev->ibdev, +"Post send failed opcode = %#x rc = %d" , + wr->opcode, rc);break ; } wr = wr->next;
@@ -2538,8 +2533,8 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, const struct ib_send_wr *wr,/* Common */ wqe.num_sge = wr->num_sge;if (wr->num_sge > qp->qplib_qp.sq.max_sge) { -dev_err (rdev_to_dev (qp->rdev), -"Limit exceeded for Send SGEs" ); +ibdev_err (&qp->rdev->ibdev, +"Limit exceeded for Send SGEs" ); rc = -EINVAL ; goto bad; }
@@ -2584,8 +2579,8 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, const struct ib_send_wr *wr, rc =bnxt_re_build_atomic_wqe (wr, &wqe);break ;case IB_WR_RDMA_READ_WITH_INV : -dev_err (rdev_to_dev (qp->rdev), -"RDMA Read with Invalidate is not supported" ); +ibdev_err (&qp->rdev->ibdev, +"RDMA Read with Invalidate is not supported" ); rc = -EINVAL ; goto bad;case IB_WR_LOCAL_INV :
@@ -2596,8 +2591,8 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, const struct ib_send_wr *wr,break ;default :/* Unsupported WRs */ -dev_err (rdev_to_dev (qp->rdev), -"WR (%#x) is not supported" , wr->opcode); +ibdev_err (&qp->rdev->ibdev, +"WR (%#x) is not supported" , wr->opcode); rc = -EINVAL ; goto bad; }
@@ -2605,9 +2600,9 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, const struct ib_send_wr *wr, rc =bnxt_qplib_post_send (&qp->qplib_qp, &wqe); bad:if (rc) { -dev_err (rdev_to_dev (qp->rdev), -"post_send failed op:%#x qps = %#x rc = %d\n" , - wr->opcode, qp->qplib_qp.state, rc); +ibdev_err (&qp->rdev->ibdev, +"post_send failed op:%#x qps = %#x rc = %d\n" , + wr->opcode, qp->qplib_qp.state, rc); *bad_wr = wr;break ; }
@@ -2635,8 +2630,8 @@ static int bnxt_re_post_recv_shadow_qp(struct bnxt_re_dev *rdev,/* Common */ wqe.num_sge = wr->num_sge;if (wr->num_sge > qp->qplib_qp.rq.max_sge) { -dev_err (rdev_to_dev (rdev), -"Limit exceeded for Receive SGEs" ); +ibdev_err (&rdev->ibdev, +"Limit exceeded for Receive SGEs" ); rc = -EINVAL ;break ; }
@@ -2672,8 +2667,8 @@ int bnxt_re_post_recv(struct ib_qp *ib_qp, const struct ib_recv_wr *wr,/* Common */ wqe.num_sge = wr->num_sge;if (wr->num_sge > qp->qplib_qp.rq.max_sge) { -dev_err (rdev_to_dev (qp->rdev), -"Limit exceeded for Receive SGEs" ); +ibdev_err (&qp->rdev->ibdev, +"Limit exceeded for Receive SGEs" ); rc = -EINVAL ; *bad_wr = wr;break ;
@@ -2744,7 +2739,7 @@ int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,/* Validate CQ fields */ if (cqe <1 || cqe > dev_attr->max_cq_wqes) { -dev_err (rdev_to_dev (rdev),"Failed to create CQ -max exceeded" ); +ibdev_err (&rdev->ibdev,"Failed to create CQ -max exceeded" );return -EINVAL ; }
@@ -2800,7 +2795,7 @@ int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, rc =bnxt_qplib_create_cq (&rdev->qplib_res, &cq->qplib_cq);if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to create HW CQ" ); +ibdev_err (&rdev->ibdev,"Failed to create HW CQ" ); goto fail; }
@@ -2820,7 +2815,7 @@ int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, resp.rsvd =0 ; rc =ib_copy_to_udata (udata, &resp,sizeof (resp));if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to copy CQ udata" ); +ibdev_err (&rdev->ibdev,"Failed to copy CQ udata" );bnxt_qplib_destroy_cq (&rdev->qplib_res, &cq->qplib_cq); goto c2fail; }
@@ -3099,7 +3094,7 @@ static int bnxt_re_process_raw_qp_pkt_rx(struct bnxt_re_qp *gsi_qp, pkt_type =bnxt_re_check_packet_type (cqe->raweth_qp1_flags, cqe->raweth_qp1_flags2);if (pkt_type <0 ) { -dev_err (rdev_to_dev (rdev),"Invalid packet\n" ); +ibdev_err (&rdev->ibdev,"Invalid packet\n" );return -EINVAL ; }
@@ -3148,8 +3143,8 @@ static int bnxt_re_process_raw_qp_pkt_rx(struct bnxt_re_qp *gsi_qp, rc =bnxt_re_post_recv_shadow_qp (rdev, gsi_sqp, &rwr);if (rc) { -dev_err (rdev_to_dev (rdev), -"Failed to post Rx buffers to shadow QP" ); +ibdev_err (&rdev->ibdev, +"Failed to post Rx buffers to shadow QP" );return -ENOMEM ; }
@@ -3304,11 +3299,11 @@ static int send_phantom_wqe(struct bnxt_re_qp *qp) rc =bnxt_re_bind_fence_mw (lib_qp);if (!rc) { lib_qp->sq.phantom_wqe_cnt++; -dev_dbg (&lib_qp->sq.hwq.pdev->dev, -"qp %#x sq->prod %#x sw_prod %#x phantom_wqe_cnt %d\n" , - lib_qp->id, lib_qp->sq.hwq.prod, -HWQ_CMP (lib_qp->sq.hwq.prod, &lib_qp->sq.hwq), - lib_qp->sq.phantom_wqe_cnt); +ibdev_dbg (&qp->rdev->ibdev, +"qp %#x sq->prod %#x sw_prod %#x phantom_wqe_cnt %d\n" , + lib_qp->id, lib_qp->sq.hwq.prod, +HWQ_CMP (lib_qp->sq.hwq.prod, &lib_qp->sq.hwq), + lib_qp->sq.phantom_wqe_cnt); }spin_unlock_irqrestore (&qp->sq_lock, flags);
@@ -3331,7 +3326,7 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc) budget =min_t (u32, num_entries, cq->max_cql); num_entries = budget;if (!cq->cql) { -dev_err (rdev_to_dev (cq->rdev),"POLL CQ : no CQL to use" ); +ibdev_err (&cq->rdev->ibdev,"POLL CQ : no CQL to use" ); goto exit; } cqe = &cq->cql[0 ];
@@ -3344,8 +3339,8 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc) qp =container_of (lib_qp, struct bnxt_re_qp, qplib_qp);if (send_phantom_wqe (qp) == -ENOMEM ) -dev_err (rdev_to_dev (cq->rdev), -"Phantom failed! Scheduled to send again\n" ); +ibdev_err (&cq->rdev->ibdev, +"Phantom failed! Scheduled to send again\n" );else sq->send_phantom = false; }
@@ -3369,8 +3364,7 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc) (unsigned long )(cqe->qp_handle), struct bnxt_re_qp, qplib_qp);if (!qp) { -dev_err (rdev_to_dev (cq->rdev), -"POLL CQ : bad QP handle" ); +ibdev_err (&cq->rdev->ibdev,"POLL CQ : bad QP handle" );continue ; } wc->qp = &qp->ib_qp;
@@ -3435,9 +3429,9 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc)bnxt_re_process_res_ud_wc (qp, wc, cqe);break ;default : -dev_err (rdev_to_dev (cq->rdev), -"POLL CQ : type 0x%x not handled" , - cqe->opcode); +ibdev_err (&cq->rdev->ibdev, +"POLL CQ : type 0x%x not handled" , + cqe->opcode);continue ; } wc++;
@@ -3530,7 +3524,7 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata) rc =bnxt_qplib_free_mrw (&rdev->qplib_res, &mr->qplib_mr);if (rc) { -dev_err (rdev_to_dev (rdev),"Dereg MR failed: %#x\n" , rc); +ibdev_err (&rdev->ibdev,"Dereg MR failed: %#x\n" , rc);return rc; }
@@ -3577,7 +3571,7 @@ struct ib_mr *bnxt_re_alloc_mr(struct ib_pd *ib_pd, enum ib_mr_type type,int rc;if (type !=IB_MR_TYPE_MEM_REG ) { -dev_dbg (rdev_to_dev (rdev),"MR type 0x%x not supported" , type); +ibdev_dbg (&rdev->ibdev,"MR type 0x%x not supported" , type);return ERR_PTR (-EINVAL ); }if (max_num_sg >MAX_PBL_LVL_1_PGS )
@@ -3607,8 +3601,8 @@ struct ib_mr *bnxt_re_alloc_mr(struct ib_pd *ib_pd, enum ib_mr_type type, rc =bnxt_qplib_alloc_fast_reg_page_list (&rdev->qplib_res, &mr->qplib_frpl, max_num_sg);if (rc) { -dev_err (rdev_to_dev (rdev), -"Failed to allocate HW FR page list" ); +ibdev_err (&rdev->ibdev, +"Failed to allocate HW FR page list" ); goto fail_mr; }
@@ -3643,7 +3637,7 @@ struct ib_mw *bnxt_re_alloc_mw(struct ib_pd *ib_pd, enum ib_mw_type type, CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B); rc =bnxt_qplib_alloc_mrw (&rdev->qplib_res, &mw->qplib_mw);if (rc) { -dev_err (rdev_to_dev (rdev),"Allocate MW failed!" ); +ibdev_err (&rdev->ibdev,"Allocate MW failed!" ); goto fail; } mw->ib_mw.rkey = mw->qplib_mw.rkey;
@@ -3664,7 +3658,7 @@ int bnxt_re_dealloc_mw(struct ib_mw *ib_mw) rc =bnxt_qplib_free_mrw (&rdev->qplib_res, &mw->qplib_mw);if (rc) { -dev_err (rdev_to_dev (rdev),"Free MW failed: %#x\n" , rc); +ibdev_err (&rdev->ibdev,"Free MW failed: %#x\n" , rc);return rc; }
@@ -3716,8 +3710,8 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length,int umem_pgs, page_shift, rc;if (length >BNXT_RE_MAX_MR_SIZE ) { -dev_err (rdev_to_dev (rdev),"MR Size: %lld > Max supported:%lld\n" , - length,BNXT_RE_MAX_MR_SIZE ); +ibdev_err (&rdev->ibdev,"MR Size: %lld > Max supported:%lld\n" , + length,BNXT_RE_MAX_MR_SIZE );return ERR_PTR (-ENOMEM ); }
@@ -3732,7 +3726,7 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length, rc =bnxt_qplib_alloc_mrw (&rdev->qplib_res, &mr->qplib_mr);if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to allocate MR" ); +ibdev_err (&rdev->ibdev,"Failed to allocate MR" ); goto free_mr; }/* The fixed portion of the rkey is the same as the lkey */
@@ -3740,7 +3734,7 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length, umem =ib_umem_get (&rdev->ibdev, start, length, mr_access_flags);if (IS_ERR (umem)) { -dev_err (rdev_to_dev (rdev),"Failed to get umem" ); +ibdev_err (&rdev->ibdev,"Failed to get umem" ); rc = -EFAULT ; goto free_mrw; }
@@ -3749,7 +3743,7 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length, mr->qplib_mr.va = virt_addr; umem_pgs =ib_umem_page_count (umem);if (!umem_pgs) { -dev_err (rdev_to_dev (rdev),"umem is invalid!" ); +ibdev_err (&rdev->ibdev,"umem is invalid!" ); rc = -EINVAL ; goto free_umem; }
@@ -3766,15 +3760,15 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length, virt_addr));if (!bnxt_re_page_size_ok (page_shift)) { -dev_err (rdev_to_dev (rdev),"umem page size unsupported!" ); +ibdev_err (&rdev->ibdev,"umem page size unsupported!" ); rc = -EFAULT ; goto fail; }if (page_shift ==BNXT_RE_PAGE_SHIFT_4K && length >BNXT_RE_MAX_MR_SIZE_LOW ) { -dev_err (rdev_to_dev (rdev),"Requested MR Sz:%llu Max sup:%llu" , - length, (u64 )BNXT_RE_MAX_MR_SIZE_LOW ); +ibdev_err (&rdev->ibdev,"Requested MR Sz:%llu Max sup:%llu" , + length, (u64 )BNXT_RE_MAX_MR_SIZE_LOW ); rc = -EINVAL ; goto fail; }
@@ -3784,7 +3778,7 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length, rc =bnxt_qplib_reg_mr (&rdev->qplib_res, &mr->qplib_mr, pbl_tbl, umem_pgs, false,1 << page_shift);if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to register user MR" ); +ibdev_err (&rdev->ibdev,"Failed to register user MR" ); goto fail; }
@@ -3817,12 +3811,11 @@ int bnxt_re_alloc_ucontext(struct ib_ucontext *ctx, struct ib_udata *udata)u32 chip_met_rev_num =0 ;int rc; -dev_dbg (rdev_to_dev (rdev),"ABI version requested %u" , - ibdev->ops.uverbs_abi_ver); +ibdev_dbg (ibdev,"ABI version requested %u" , ibdev->ops.uverbs_abi_ver);if (ibdev->ops.uverbs_abi_ver !=BNXT_RE_ABI_VERSION ) { -dev_dbg (rdev_to_dev (rdev)," is different from the device %d " , -BNXT_RE_ABI_VERSION ); +ibdev_dbg (ibdev," is different from the device %d " , +BNXT_RE_ABI_VERSION );return -EPERM ; }
@@ -3854,7 +3847,7 @@ int bnxt_re_alloc_ucontext(struct ib_ucontext *ctx, struct ib_udata *udata) rc =ib_copy_to_udata (udata, &resp,min (udata->outlen,sizeof (resp)));if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to copy user context" ); +ibdev_err (ibdev,"Failed to copy user context" ); rc = -EFAULT ; goto cfail; }
@@ -3904,15 +3897,14 @@ int bnxt_re_mmap(struct ib_ucontext *ib_uctx, struct vm_area_struct *vma) vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot);if (io_remap_pfn_range (vma, vma->vm_start, vma->vm_pgoff,PAGE_SIZE , vma->vm_page_prot)) { -dev_err (rdev_to_dev (rdev),"Failed to map DPI" ); +ibdev_err (&rdev->ibdev,"Failed to map DPI" );return -EAGAIN ; } }else { pfn =virt_to_phys (uctx->shpg) >>PAGE_SHIFT ;if (remap_pfn_range (vma, vma->vm_start, pfn,PAGE_SIZE , vma->vm_page_prot)) { -dev_err (rdev_to_dev (rdev), -"Failed to map shared page" ); +ibdev_err (&rdev->ibdev,"Failed to map shared page" );return -EAGAIN ; } }
drivers/infiniband/hw/bnxt_re/main.c +72 -59
349 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Quoted 46 lines · Devesh Sharma
This is the first series out of few more forthcoming series to refactor Broadcom's RoCE driver. This series contains patches to refactor control path. Since this is first series, there may be few code section which may look redundant or overkill but those will be taken care in future patch series.
These patches apply clean on tip of for-next branch.
Each patch in this series is tested against user and kernel functionality.
v2->v3
-- Rebased the series on tip of for-nxt, linux-5.6-rc1
v1->v2
patch 0001
-- removed unwind logic when qp destroy fails.
-- removed atomic dec out of mutex lock
patch 0003
-- saved memset by using default initializer forhwq_attrand sginfo
patch 0004
-- saved memset by using default initializer for rattr.
patch 0008
-- a new patch to remove dev_err/dbg/warn/info from driver.Devesh Sharma (8):
RDMA/bnxt_re: Refactor queue pair creation code RDMA/bnxt_re: Replace chip context structure with pointer RDMA/bnxt_re: Refactor hardware queue memory allocation RDMA/bnxt_re: Refactor net ring allocation function RDMA/bnxt_re: Refactor command queue management code RDMA/bnxt_re: Refactor notification queue management code RDMA/bnxt_re: Refactor doorbell management functions RDMA/bnxt_re: use ibdev based message printing functionsdrivers/infiniband/hw/bnxt_re/bnxt_re.h | 24 +- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 900 ++++++++++++++++++----------- drivers/infiniband/hw/bnxt_re/main.c | 264 +++++---- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 416 ++++++------- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 94 +-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 467 +++++++++------ drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 85 +-- drivers/infiniband/hw/bnxt_re/qplib_res.c | 470 +++++++++------ drivers/infiniband/hw/bnxt_re/qplib_res.h | 145 ++++- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 48 +- 10 files changed, 1737 insertions(+), 1176 deletions(-)
Quoted 2 lines
--
1.8.3.1
Hi Jason,
Could you pull this series, this was rebase since you had faced merge-conflict after 5.6-rc1 merge. Let me know if yet another respin is required.
Quoted 1 line
Jason Gunthorpe
AppliedQuoted 9 lines · Devesh Sharma
This is the first series out of few more forthcoming series to refactor Broadcom's RoCE driver. This series contains patches to refactor control path. Since this is first series, there may be few code section which may look redundant or overkill but those will be taken care in future patch series.
These patches apply clean on tip of for-next branch.
Each patch in this series is tested against user and kernel functionality.
Quoted 7 lines
v2->v3
v1->v2
patch 0001
patch 0003
patch 0004
patch 0008
Seems like something went wrong with this change log
Quoted 9 lines
Devesh Sharma (8):
RDMA/bnxt_re: Refactor queue pair creation code RDMA/bnxt_re: Replace chip context structure with pointer RDMA/bnxt_re: Refactor hardware queue memory allocation RDMA/bnxt_re: Refactor net ring allocation function RDMA/bnxt_re: Refactor command queue management code RDMA/bnxt_re: Refactor notification queue management code RDMA/bnxt_re: Refactor doorbell management functions RDMA/bnxt_re: use ibdev based message printing functions
Applied to for-next
Jason
Quoted 13 lines · Jason Gunthorpe
Quoted 11 lines · Devesh Sharma
This is the first series out of few more forthcoming series to refactor Broadcom's RoCE driver. This series contains patches to refactor control path. Since this is first series, there may be few code section which may look redundant or overkill but those will be taken care in future patch series.
These patches apply clean on tip of for-next branch.
Each patch in this series is tested against user and kernel functionality.
v2->v3
Quoted 7 lines
Quoted 5 lines
v1->v2
patch 0001
patch 0003
patch 0004
patch 0008Seems like something went wrong with this change log
Did "double-minus" (--) before each line played any role here?
Quoted 11 lines
Quoted 10 lines
Devesh Sharma (8):
RDMA/bnxt_re: Refactor queue pair creation code RDMA/bnxt_re: Replace chip context structure with pointer RDMA/bnxt_re: Refactor hardware queue memory allocation RDMA/bnxt_re: Refactor net ring allocation function RDMA/bnxt_re: Refactor command queue management code RDMA/bnxt_re: Refactor notification queue management code RDMA/bnxt_re: Refactor doorbell management functions RDMA/bnxt_re: use ibdev based message printing functions
Quoted 1 line
Applied to for-next
Thanks!
Quoted 2 lines
Jason