Re: [PATCH for-next 1/1] IB/{hw,sw}: remove 'uobject->context' dependency in object creation APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 1/17/2019 1:11 PM, Shamir Rabinovitch wrote:
> 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/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
> index 07c20cd07f33..b692cd2bbe92 100644
> --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
> +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
> @@ -796,6 +796,7 @@ static struct ib_qp *iwch_create_qp(struct ib_pd *pd,
>  	struct iwch_cq *schp;
>  	struct iwch_cq *rchp;
>  	struct iwch_create_qp_resp uresp;
> +	struct ib_ucontext *ib_ucontext;
>  	int wqsize, sqsize, rqsize;
>  	struct iwch_ucontext *ucontext;
>  
> @@ -836,7 +837,8 @@ static struct ib_qp *iwch_create_qp(struct ib_pd *pd,
>  	 * Kernel users need more wq space for fastreg WRs which can take
>  	 * 2 WR fragments.
>  	 */
> -	ucontext = udata ? to_iwch_ucontext(pd->uobject->context) : NULL;
> +	ib_ucontext = rdma_get_ucontext(udata);
> +	ucontext = IS_ERR(ib_ucontext) ? NULL : to_iwch_ucontext(ib_ucontext);
>  	if (!ucontext && wqsize < (rqsize + (2 * sqsize)))
>  		wqsize = roundup_pow_of_two(rqsize +
>  				roundup_pow_of_two(attrs->cap.max_send_wr * 2));
> diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
> index 03f4c66c2659..d2c452b4282c 100644
> --- a/drivers/infiniband/hw/cxgb4/qp.c
> +++ b/drivers/infiniband/hw/cxgb4/qp.c
> @@ -2137,6 +2137,7 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
>  	struct c4iw_create_qp_resp uresp;
>  	unsigned int sqsize, rqsize = 0;
>  	struct c4iw_ucontext *ucontext;
> +	struct ib_ucontext *ib_ucontext;
>  	int ret;
>  	struct c4iw_mm_entry *sq_key_mm, *rq_key_mm = NULL, *sq_db_key_mm;
>  	struct c4iw_mm_entry *rq_db_key_mm = NULL, *ma_sync_key_mm = NULL;
> @@ -2170,7 +2171,8 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
>  	if (sqsize < 8)
>  		sqsize = 8;
>  
> -	ucontext = udata ? to_c4iw_ucontext(pd->uobject->context) : NULL;
> +	ib_ucontext = rdma_get_ucontext(udata);
> +	ucontext = IS_ERR(ib_ucontext) ? NULL : to_c4iw_ucontext(ib_ucontext);
>  
>  	qhp = kzalloc(sizeof(*qhp), GFP_KERNEL);
>  	if (!qhp)
> @@ -2697,6 +2699,7 @@ struct ib_srq *c4iw_create_srq(struct ib_pd *pd, struct ib_srq_init_attr *attrs,
>  	struct c4iw_create_srq_resp uresp;
>  	struct c4iw_ucontext *ucontext;
>  	struct c4iw_mm_entry *srq_key_mm, *srq_db_key_mm;
> +	struct ib_ucontext *ib_ucontext;
>  	int rqsize;
>  	int ret;
>  	int wr_len;
> @@ -2719,7 +2722,8 @@ struct ib_srq *c4iw_create_srq(struct ib_pd *pd, struct ib_srq_init_attr *attrs,
>  	rqsize = attrs->attr.max_wr + 1;
>  	rqsize = roundup_pow_of_two(max_t(u16, rqsize, 16));
>  
> -	ucontext = udata ? to_c4iw_ucontext(pd->uobject->context) : NULL;
> +	ib_ucontext = rdma_get_ucontext(udata);
> +	ucontext = IS_ERR(ib_ucontext) ? NULL : to_c4iw_ucontext(ib_ucontext);
>  
>  	srq = kzalloc(sizeof(*srq), GFP_KERNEL);
>  	if (!srq)

For cxgb*, looks ok.

Reviewed-by: Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx>



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux