Skip to content

Commit ee30f7d

Browse files
Hariprasad Sdledford
authored andcommitted
iw_cxgb4: Max fastreg depth depends on DSGL support
The max depth of a fastreg mr depends on whether the device supports DSGL or not. So compute it dynamically based on the device support and the module use_dsgl option. Signed-off-by: Steve Wise <[email protected]> Signed-off-by: Hariprasad Shenai <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent ac8e4c6 commit ee30f7d

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

drivers/infiniband/hw/cxgb4/mem.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,12 +617,14 @@ struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd,
617617
int ret = 0;
618618
int length = roundup(max_num_sg * sizeof(u64), 32);
619619

620+
php = to_c4iw_pd(pd);
621+
rhp = php->rhp;
622+
620623
if (mr_type != IB_MR_TYPE_MEM_REG ||
621-
max_num_sg > t4_max_fr_depth(use_dsgl))
624+
max_num_sg > t4_max_fr_depth(&rhp->rdev.lldi.ulptx_memwrite_dsgl &&
625+
use_dsgl))
622626
return ERR_PTR(-EINVAL);
623627

624-
php = to_c4iw_pd(pd);
625-
rhp = php->rhp;
626628
mhp = kzalloc(sizeof(*mhp), GFP_KERNEL);
627629
if (!mhp) {
628630
ret = -ENOMEM;

drivers/infiniband/hw/cxgb4/provider.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ static int c4iw_query_device(struct ib_device *ibdev, struct ib_device_attr *pro
339339
props->max_mr = c4iw_num_stags(&dev->rdev);
340340
props->max_pd = T4_MAX_NUM_PD;
341341
props->local_ca_ack_delay = 0;
342-
props->max_fast_reg_page_list_len = t4_max_fr_depth(use_dsgl);
342+
props->max_fast_reg_page_list_len =
343+
t4_max_fr_depth(dev->rdev.lldi.ulptx_memwrite_dsgl && use_dsgl);
343344

344345
return 0;
345346
}

drivers/infiniband/hw/cxgb4/qp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ static int build_rdma_recv(struct c4iw_qp *qhp, union t4_recv_wr *wqe,
606606
}
607607

608608
static int build_memreg(struct t4_sq *sq, union t4_wr *wqe,
609-
struct ib_reg_wr *wr, u8 *len16, u8 t5dev)
609+
struct ib_reg_wr *wr, u8 *len16, bool dsgl_supported)
610610
{
611611
struct c4iw_mr *mhp = to_c4iw_mr(wr->mr);
612612
struct fw_ri_immd *imdp;
@@ -615,7 +615,7 @@ static int build_memreg(struct t4_sq *sq, union t4_wr *wqe,
615615
int pbllen = roundup(mhp->mpl_len * sizeof(u64), 32);
616616
int rem;
617617

618-
if (mhp->mpl_len > t4_max_fr_depth(use_dsgl))
618+
if (mhp->mpl_len > t4_max_fr_depth(dsgl_supported && use_dsgl))
619619
return -EINVAL;
620620

621621
wqe->fr.qpbinde_to_dcacpu = 0;
@@ -629,7 +629,7 @@ static int build_memreg(struct t4_sq *sq, union t4_wr *wqe,
629629
wqe->fr.va_lo_fbo = cpu_to_be32(mhp->ibmr.iova &
630630
0xffffffff);
631631

632-
if (t5dev && use_dsgl && (pbllen > max_fr_immd)) {
632+
if (dsgl_supported && use_dsgl && (pbllen > max_fr_immd)) {
633633
struct fw_ri_dsgl *sglp;
634634

635635
for (i = 0; i < mhp->mpl_len; i++)
@@ -808,9 +808,7 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
808808
fw_opcode = FW_RI_FR_NSMR_WR;
809809
swsqe->opcode = FW_RI_FAST_REGISTER;
810810
err = build_memreg(&qhp->wq.sq, wqe, reg_wr(wr), &len16,
811-
is_t5(
812-
qhp->rhp->rdev.lldi.adapter_type) ?
813-
1 : 0);
811+
qhp->rhp->rdev.lldi.ulptx_memwrite_dsgl);
814812
break;
815813
case IB_WR_LOCAL_INV:
816814
if (wr->send_flags & IB_SEND_FENCE)

0 commit comments

Comments
 (0)