RE: [PATCH v10 rdma-next 3/7] RDMA/efa: Use the common mmap_xa helpers

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

 



> From: Gal Pressman <galpress@xxxxxxxxxx>
> Sent: Wednesday, September 4, 2019 4:24 PM
> 
> On 04/09/2019 10:15, Michal Kalderon wrote:
> >  static int __efa_mmap(struct efa_dev *dev, struct efa_ucontext
> *ucontext,
> > -		      struct vm_area_struct *vma, u64 key, u64 length)
> > +		      struct vm_area_struct *vma, u64 key, size_t length)
> >  {
> > -	struct efa_mmap_entry *entry;
> > +	struct rdma_user_mmap_entry *rdma_entry;
> > +	struct efa_user_mmap_entry *entry;
> >  	unsigned long va;
> >  	u64 pfn;
> >  	int err;
> >
> > -	entry = mmap_entry_get(dev, ucontext, key, length);
> > -	if (!entry) {
> > +	rdma_entry = rdma_user_mmap_entry_get(&ucontext-
> >ibucontext, key,
> > +					      length, vma);
> > +	if (!rdma_entry) {
> >  		ibdev_dbg(&dev->ibdev, "key[%#llx] does not have valid
> entry\n",
> >  			  key);
> >  		return -EINVAL;
> >  	}
> > +	entry = to_emmap(rdma_entry);
> > +	if (entry->length != length) {
> > +		ibdev_dbg(&dev->ibdev,
> > +			  "key[%#llx] does not have valid length[%#zx]
> expected[%#zx]\n",
> > +			  key, length, entry->length);
> > +		err = -EINVAL;
> > +		goto err;
> > +	}
> >
> >  	ibdev_dbg(&dev->ibdev,
> > -		  "Mapping address[%#llx], length[%#llx],
> mmap_flag[%d]\n",
> > -		  entry->address, length, entry->mmap_flag);
> > +		  "Mapping address[%#llx], length[%#zx],
> mmap_flag[%d]\n",
> > +		  entry->address, entry->length, entry->mmap_flag);
> >
> >  	pfn = entry->address >> PAGE_SHIFT;
> >  	switch (entry->mmap_flag) {
> > @@ -1630,15 +1623,16 @@ static int __efa_mmap(struct efa_dev *dev,
> struct efa_ucontext *ucontext,
> >  		err = -EINVAL;
> >  	}
> >
> > -	if (err) {
> > -		ibdev_dbg(
> > -			&dev->ibdev,
> > -			"Couldn't mmap address[%#llx] length[%#llx]
> mmap_flag[%d] err[%d]\n",
> > -			entry->address, length, entry->mmap_flag, err);
> > -		return err;
> > -	}
> > +	if (err)
> > +		goto err;
> 
> Thanks Michal,
> Acked-by: Gal Pressman <galpress@xxxxxxxxxx>
thanks
> 
> If you're planning on doing another cycle, this error path now prints nothing, I
> meant move the print from the goto inside this if (before goto err).
Yes, I'll need to send a v11 because of a siw issue. I'll send you the patch before I send it out for review before I send v11.
Thanks,
Michal

> 
> >
> >  	return 0;
> > +
> > +err:
> > +	rdma_user_mmap_entry_put(&ucontext->ibucontext,
> > +				 rdma_entry);
> > +
> > +	return err;
> >  }




[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