RDMA/bnxt_re: Update create_qp to use QP buffer umem attrs
Subsystems (2)
PATCH 1/1 RDMA/bnxt_re: Update create_qp to use QP buffer umem attrs
Use ib_umem_get_attr_or_va() helper to pin QP buffer umems. Pass attribute ids SQ_BUF_UMEM and RQ_BUF_UMEM for respective buffers.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +13 -9
@@ -1195,7 +1195,8 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd, struct bnxt_re_qp *qp, struct bnxt_re_ucontext *cntx, struct bnxt_re_qp_req *ureq, bool fixed_que_attr, - struct bnxt_re_dbr_obj *dbr_obj) + struct bnxt_re_dbr_obj *dbr_obj, + struct uverbs_attr_bundle *attrs) { struct bnxt_qplib_qp *qplib_qp;struct ib_umem *umem;
@@ -1210,8 +1211,9 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd, bytes +=bnxt_re_get_psn_bytes (rdev, cntx, qplib_qp, ureq, fixed_que_attr); bytes =PAGE_ALIGN (bytes); - umem =ib_umem_get_va (&rdev->ibdev, ureq->qpsva, bytes, -IB_ACCESS_LOCAL_WRITE ); + umem =ib_umem_get_attr_or_va (&rdev->ibdev, attrs, +UVERBS_ATTR_CREATE_QP_SQ_BUF_UMEM , + ureq->qpsva, bytes,IB_ACCESS_LOCAL_WRITE );if (IS_ERR (umem))return PTR_ERR (umem);
@@ -1225,8 +1227,9 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd, bytes = (qplib_qp->rq.max_wqe * qplib_qp->rq.wqe_size); bytes =PAGE_ALIGN (bytes); - umem =ib_umem_get_va (&rdev->ibdev, ureq->qprva, bytes, -IB_ACCESS_LOCAL_WRITE ); + umem =ib_umem_get_attr_or_va (&rdev->ibdev, attrs, +UVERBS_ATTR_CREATE_QP_RQ_BUF_UMEM , + ureq->qprva, bytes,IB_ACCESS_LOCAL_WRITE );if (IS_ERR (umem)) { rc =PTR_ERR (umem); goto fail;
@@ -1718,7 +1721,8 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,struct bnxt_re_ucontext *uctx, struct bnxt_re_qp_req *ureq, struct bnxt_re_dbr_obj *dbr_obj, - bool fixed_que_attr) + bool fixed_que_attr, + struct uverbs_attr_bundle *attrs) { struct bnxt_qplib_dev_attr *dev_attr;struct bnxt_qplib_qp *qplqp;
@@ -1792,7 +1796,7 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,if (uctx) {/* This will update DPI and qp_handle */ rc =bnxt_re_init_user_qp (rdev, pd, qp, uctx, ureq, fixed_que_attr, - dbr_obj); + dbr_obj, attrs);if (rc)return rc; }
@@ -1928,9 +1932,9 @@ static int bnxt_re_add_unique_gid(struct bnxt_re_dev *rdev)int bnxt_re_create_qp (struct ib_qp *ib_qp,struct ib_qp_init_attr *qp_init_attr,struct ib_udata *udata) { +struct uverbs_attr_bundle *attrs =NULL ;struct bnxt_re_dbr_obj *dbr_obj =NULL ;struct bnxt_qplib_dev_attr *dev_attr; -struct uverbs_attr_bundle *attrs;struct bnxt_re_ucontext *uctx;bool fixed_que_attr = false;struct bnxt_re_qp_req ureq;
@@ -1976,7 +1980,7 @@ int bnxt_re_create_qp(struct ib_qp *ib_qp, struct ib_qp_init_attr *qp_init_attr, qp->rdev = rdev; rc =bnxt_re_init_qp_attr (qp, pd, qp_init_attr, uctx, &ureq, - dbr_obj, fixed_que_attr); + dbr_obj, fixed_que_attr, attrs);if (rc) goto fail;
Signature · 1 line
2.51.2.636.ga99f379adf
Quoted 9 lines · Sriharsha Basavapatna
Use
ib_umem_get_attr_or_va()helper to pin QP buffer umems. Pass attribute idsSQ_BUF_UMEMandRQ_BUF_UMEMfor respective buffers.Signed-off-by Sriharsha Basavapatna <[email protected]>Reviewed-by Selvin Xavier <[email protected]>--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
Applied, but please read the sashiko report and send a patch fixing all the maths overflows in this driver for the uapi. Any maths from a udata should be done with checked arithmetic.
Jason
Quoted 12 lines · Jason Gunthorpe
Quoted 9 lines · Sriharsha Basavapatna
Use
ib_umem_get_attr_or_va()helper to pin QP buffer umems. Pass attribute idsSQ_BUF_UMEMandRQ_BUF_UMEMfor respective buffers.Signed-off-by Sriharsha Basavapatna <[email protected]>Reviewed-by Selvin Xavier <[email protected]>--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
Quoted 3 lines
Applied, but please read the sashiko report and send a patch fixing all the maths overflows in this driver for the uapi. Any maths from a udata should be done with checked arithmetic.
Selvin is preparing a bug-fix series that includes the fix for this issue pointed out by Sashiko.
Thanks,
-Harsha
Quoted 2 lines
Jason