>Subject: [PATCH for-next 1/1] IB/{hw,sw}: remove 'uobject->context' dependency in >object creation APIs > >Now when we have the udata passed to all the ib_xxx object creation APIs and the >additional function 'rdma_get_ucontext' to get the ib_ucontext from ib_udata stored >in uverbs_attr_bundle, we can finally start to remove the dependency of the drivers >in the ib_xxx->uobject->context. > >Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@xxxxxxxxxx> >--- > drivers/infiniband/hw/bnxt_re/ib_verbs.c | 33 +++++-- > drivers/infiniband/hw/cxgb3/iwch_provider.c | 4 +- > drivers/infiniband/hw/cxgb4/qp.c | 8 +- > drivers/infiniband/hw/hns/hns_roce_qp.c | 15 +++- > drivers/infiniband/hw/i40iw/i40iw_verbs.c | 15 +++- > drivers/infiniband/hw/mlx4/doorbell.c | 6 ++ > drivers/infiniband/hw/mlx4/mr.c | 9 +- > drivers/infiniband/hw/mlx4/qp.c | 92 +++++++++++++------- > drivers/infiniband/hw/mlx4/srq.c | 13 ++- > drivers/infiniband/hw/mlx5/qp.c | 68 +++++++++++---- > drivers/infiniband/hw/mlx5/srq.c | 13 ++- > drivers/infiniband/hw/mthca/mthca_provider.c | 28 ++++-- > drivers/infiniband/hw/mthca/mthca_qp.c | 19 ++-- > drivers/infiniband/hw/mthca/mthca_srq.c | 25 ++++-- > drivers/infiniband/hw/nes/nes_verbs.c | 13 ++- > drivers/infiniband/hw/qedr/verbs.c | 8 +- > drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 7 +- > drivers/infiniband/sw/rdmavt/qp.c | 10 ++- > drivers/infiniband/sw/rdmavt/srq.c | 10 ++- > drivers/infiniband/sw/rxe/rxe_qp.c | 5 +- > drivers/infiniband/sw/rxe/rxe_verbs.c | 5 +- > 21 files changed, 287 insertions(+), 119 deletions(-) > [....] >diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c >b/drivers/infiniband/hw/i40iw/i40iw_verbs.c >index 12b31a8440be..194cd911c9de 100644 >--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c >+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c >@@ -580,11 +580,16 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd, > struct i40iw_create_qp_info *qp_info; > struct i40iw_cqp_request *cqp_request; > struct cqp_commands_info *cqp_info; >+ struct ib_ucontext *ib_ucontext; > > struct i40iw_qp_host_ctx_info *ctx_info; > struct i40iwarp_offload_info *iwarp_info; > unsigned long flags; > >+ ib_ucontext = rdma_get_ucontext(udata); >+ if (udata && IS_ERR(ib_ucontext)) >+ return ERR_CAST(ib_ucontext); >+ > if (iwdev->closing) > return ERR_PTR(-ENODEV); > >@@ -674,7 +679,7 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd, > } > iwqp->ctx_info.qp_compl_ctx = req.user_compl_ctx; > iwqp->user_mode = 1; >- ucontext = to_ucontext(ibpd->uobject->context); >+ ucontext = to_ucontext(ib_ucontext); > > if (req.user_wqe_buffers) { > struct i40iw_pbl *iwpbl; >@@ -1832,6 +1837,7 @@ static struct ib_mr *i40iw_reg_user_mr(struct ib_pd *pd, > struct i40iw_pd *iwpd = to_iwpd(pd); > struct i40iw_device *iwdev = to_iwdev(pd->device); > struct i40iw_ucontext *ucontext; >+ struct ib_ucontext *ib_ucontext; > struct i40iw_pble_alloc *palloc; > struct i40iw_pbl *iwpbl; > struct i40iw_mr *iwmr; >@@ -1847,6 +1853,12 @@ static struct ib_mr *i40iw_reg_user_mr(struct ib_pd *pd, > int ret; > int pg_shift; > >+ ib_ucontext = rdma_get_ucontext(udata); >+ if (IS_ERR(ib_ucontext)) >+ return ERR_CAST(ib_ucontext); >+ >+ ucontext = to_ucontext(ib_ucontext); >+ > if (iwdev->closing) > return ERR_PTR(-ENODEV); > >@@ -1872,7 +1884,6 @@ static struct ib_mr *i40iw_reg_user_mr(struct ib_pd *pd, > iwmr->region = region; > iwmr->ibmr.pd = pd; > iwmr->ibmr.device = pd->device; >- ucontext = to_ucontext(pd->uobject->context); > > iwmr->page_size = PAGE_SIZE; > iwmr->page_msk = PAGE_MASK; QP. > */ > if (new_state == IB_QPS_RESET) { >- if (!ibuobject) { >+ if (!udata) { > mlx4_ib_cq_clean(recv_cq, qp->mqp.qpn, > ibsrq ? to_msrq(ibsrq) : NULL); > if (send_cq != recv_cq) I think you missed one in i40iw_dereg_mr? https://elixir.bootlin.com/linux/v5.0-rc2/source/drivers/infiniband/hw/i40iw/i40iw_verbs.c#L2097 Shiraz