Re: [PATCH V2 for-next] RDMA/hns: Update the kernel header file of hns

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

 



On Tue, Jan 22, 2019 at 07:48:11PM +0200, Leon Romanovsky wrote:
> On Tue, Jan 22, 2019 at 09:05:26AM -0700, Jason Gunthorpe wrote:
> > On Tue, Jan 22, 2019 at 04:39:17PM +0800, Lijun Ou wrote:
> > > The hns_roce_ib_create_srq_resp is used to interact with the
> > > user for data. As a result, it is added to tranfer the srqn
> > > to the user.
> > >
> > > Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx>
> > > V1->V2:
> > > - Use hns_roce_ib_create_srq_resp to transfer srqn
> > >  drivers/infiniband/hw/hns/hns_roce_srq.c | 4 +++-
> > >  include/uapi/rdma/hns-abi.h              | 5 +++++
> > >  2 files changed, 8 insertions(+), 1 deletion(-)
> >
> > Yes, okay, this is better
> >
> > > diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c
> > > index 8975f85..8492153 100644
> > > +++ b/drivers/infiniband/hw/hns/hns_roce_srq.c
> > > @@ -210,6 +210,7 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd,
> > >  				   struct ib_udata *udata)
> > >  {
> > >  	struct hns_roce_dev *hr_dev = to_hr_dev(pd->device);
> > > +	struct hns_roce_ib_create_srq_resp resp = {};
> > >  	struct hns_roce_srq *srq;
> > >  	int srq_desc_size;
> > >  	int srq_buf_size;
> > > @@ -377,9 +378,10 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd,
> > >
> > >  	srq->event = hns_roce_ib_srq_event;
> > >  	srq->ibsrq.ext.xrc.srq_num = srq->srqn;
> > > +	resp.srqn = srq->srqn;
> > >
> > >  	if (udata) {
> > > -		if (ib_copy_to_udata(udata, &srq->srqn, sizeof(__u32))) {
> > > +		if (ib_copy_to_udata(udata, &resp, sizeof(resp))) {
> >
> > min(udata->outlen, sizeof(resp))
> 
> IMHO, we should update ib_copy_to_udata() to have 4 parameters instead
> of 3 and do min() internally.

Yes.. I fixed all the core code, the drivers need to have the same
API.

Jason



[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