Re: [PATCH rdma-next 15/15] RDMA: Convert CQ allocations to be under core responsibility

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

 



On Mon, May 20, 2019 at 04:31:22PM +0300, Gal Pressman wrote:
> On 20/05/2019 9:54, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> >
> > Ensure that CQ is allocated and freed by IB/core and not by drivers.
> >
> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> > ---
> > diff --git a/drivers/infiniband/hw/efa/efa.h b/drivers/infiniband/hw/efa/efa.h
> > index 8d8d3bd47c35..2ceb8067b99a 100644
> > --- a/drivers/infiniband/hw/efa/efa.h
> > +++ b/drivers/infiniband/hw/efa/efa.h
> > @@ -137,9 +137,8 @@ struct ib_qp *efa_create_qp(struct ib_pd *ibpd,
> >  			    struct ib_qp_init_attr *init_attr,
> >  			    struct ib_udata *udata);
> >  void efa_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata);
> > -struct ib_cq *efa_create_cq(struct ib_device *ibdev,
> > -			    const struct ib_cq_init_attr *attr,
> > -			    struct ib_udata *udata);
> > +int efa_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
> > +		  struct ib_udata *udata);
> >  struct ib_mr *efa_reg_mr(struct ib_pd *ibpd, u64 start, u64 length,
> >  			 u64 virt_addr, int access_flags,
> >  			 struct ib_udata *udata);
> > diff --git a/drivers/infiniband/hw/efa/efa_main.c b/drivers/infiniband/hw/efa/efa_main.c
> > index db974caf1eb1..27f8a473bde9 100644
> > --- a/drivers/infiniband/hw/efa/efa_main.c
> > +++ b/drivers/infiniband/hw/efa/efa_main.c
> > @@ -220,6 +220,7 @@ static const struct ib_device_ops efa_dev_ops = {
> >  	.reg_user_mr = efa_reg_mr,
> >
> >  	INIT_RDMA_OBJ_SIZE(ib_ah, efa_ah, ibah),
> > +	INIT_RDMA_OBJ_SIZE(ib_cq, efa_cq, ibcq),
> >  	INIT_RDMA_OBJ_SIZE(ib_pd, efa_pd, ibpd),
> >  	INIT_RDMA_OBJ_SIZE(ib_ucontext, efa_ucontext, ibucontext),
> >  };
> > diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
> > index e57f8adde174..6ccb85950439 100644
> > --- a/drivers/infiniband/hw/efa/efa_verbs.c
> > +++ b/drivers/infiniband/hw/efa/efa_verbs.c
> > @@ -859,8 +859,6 @@ void efa_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)
> >  	efa_destroy_cq_idx(dev, cq->cq_idx);
> >  	dma_unmap_single(&dev->pdev->dev, cq->dma_addr, cq->size,
> >  			 DMA_FROM_DEVICE);
> > -
> > -	kfree(cq);
> >  }
> >
> >  static int cq_mmap_entries_setup(struct efa_dev *dev, struct efa_cq *cq,
> > @@ -876,20 +874,23 @@ static int cq_mmap_entries_setup(struct efa_dev *dev, struct efa_cq *cq,
> >  	return 0;
> >  }
> >
> > -static struct ib_cq *do_create_cq(struct ib_device *ibdev, int entries,
> > -				  int vector, struct ib_ucontext *ibucontext,
> > -				  struct ib_udata *udata)
> > +int efa_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
> > +		  struct ib_udata *udata)
> >  {
> > +	struct efa_ucontext *ucontext = rdma_udata_to_drv_context(
> > +		udata, struct efa_ucontext, ibucontext);
> > +	struct ib_device *ibdev = ibcq->device;
> > +	struct efa_dev *dev = to_edev(ibdev);
>
> Nit, can we please keep the existing reverse xmas tree?

<...>

> >
> > -	ibdev_dbg(ibdev, "create_cq entries %d\n", entries);
> > +	ibdev_dbg(ibcq->device, "create_cq entries %d\n", entries);
>
> No need to change, we can keep using 'ibdev'. Same applies for other prints.
>

Thanks for the review, I changed it locally, will send it in v1.



[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