Re: [EXT] Re: [PATCH v11 rdma-next 2/7] RDMA/core: Create mmap database and cookie helper functions

Jason Gunthorpe
2019-09-24T12:37:28Z

On Tue, Sep 24, 2019 at 08:31:16AM +0000, Michal Kalderon wrote:
> > From: linux-rdma-owner@vger.kernel.org <linux-rdma-
> > owner@vger.kernel.org> On Behalf Of Jason Gunthorpe
> >
> > On Mon, Sep 23, 2019 at 09:36:01AM +0000, Michal Kalderon wrote:
> > > > > + * will use the key to retrieve information such as address to
> > > > > + * be mapped and how.
> > > > > + *
> > > > > + * Return: unique key or RDMA_USER_MMAP_INVALID if entry was
> > not
> > > > added.
> > > > > + */
> > > > > +u64 rdma_user_mmap_entry_insert(struct ib_ucontext *ucontext,
> > > > > + struct rdma_user_mmap_entry *entry,
> > > > > + size_t length)
> > > >
> > > > The similarly we don't need to return a u64 here and the sort of
> > > > ugly RDMA_USER_MMAP_INVALID can go away
> > >
> > > So you mean add a return code here ? and on failure driver will delete
> > > the Allocated xx_user_mmap_entry and not store it in xx_key ?
> >
> > I'm not sure what this means
> >
> Before fixing: driver allocated rdma_user_mmap_entry, receives a key and stores
> The key, if the key received is INVALID the driver frees the allocated entry.
> Wanted to make sure I understand correctly that you're requesting I change the
> Function to return an error code, and on success the driver will store the pointer
> To the mmap_entry structure and on failure free it ?
> And the driver will not hold the value of the key, instead call a
> helper function if it is required ?

Yes

Jason