diff mbox series

[2/3] IB/verbs: Add rdma_is_user_pd function

Message ID 20181007072308.10936-3-shamir.rabinovitch@oracle.com (mailing list archive)
State Superseded
Headers show
Series figure uverbs/kernel ib_pd w/o using ib_pd uobject | expand

Commit Message

Shamir Rabinovitch Oct. 7, 2018, 7:23 a.m. UTC
This function can replace the need for tests based on 'pd->uobject'
in the IB core code and will be used in next patches.

Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com>
---
 include/rdma/ib_verbs.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jason Gunthorpe Oct. 7, 2018, 7:19 p.m. UTC | #1
On Sun, Oct 07, 2018 at 10:23:07AM +0300, Shamir Rabinovitch wrote:
> This function can replace the need for tests based on 'pd->uobject'
> in the IB core code and will be used in next patches.
> 
> Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com>
>  include/rdma/ib_verbs.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index 9897d2329f2c..136f2ffc4b0b 100644
> +++ b/include/rdma/ib_verbs.h
> @@ -1550,6 +1550,11 @@ struct ib_pd {
>  	struct rdma_restrack_entry res;
>  };
>  
> +static inline bool rdma_is_user_pd(struct ib_pd *pd)
> +{
> +	return !rdma_is_kernel_res(&pd->res);
> +}

Shouldn't this just be pd->res.user?

Why are are we using two different ways to track user or not?

Jason
Shamir Rabinovitch Oct. 8, 2018, 7:43 a.m. UTC | #2
On Sun, Oct 07, 2018 at 01:19:49PM -0600, Jason Gunthorpe wrote:
> On Sun, Oct 07, 2018 at 10:23:07AM +0300, Shamir Rabinovitch wrote:
> > This function can replace the need for tests based on 'pd->uobject'
> > in the IB core code and will be used in next patches.
> > 
> > Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com>
> >  include/rdma/ib_verbs.h | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> > index 9897d2329f2c..136f2ffc4b0b 100644
> > +++ b/include/rdma/ib_verbs.h
> > @@ -1550,6 +1550,11 @@ struct ib_pd {
> >  	struct rdma_restrack_entry res;
> >  };
> >  
> > +static inline bool rdma_is_user_pd(struct ib_pd *pd)
> > +{
> > +	return !rdma_is_kernel_res(&pd->res);
> > +}
> 
> Shouldn't this just be pd->res.user?
> 
> Why are are we using two different ways to track user or not?
> 
> Jason

I'd rather not know the internal structure to resource tracker objects
and use the API as Leon suggested in another email.

Thanks
Jason Gunthorpe Oct. 8, 2018, 7:44 p.m. UTC | #3
On Mon, Oct 08, 2018 at 10:43:26AM +0300, Shamir Rabinovitch wrote:
> On Sun, Oct 07, 2018 at 01:19:49PM -0600, Jason Gunthorpe wrote:
> > On Sun, Oct 07, 2018 at 10:23:07AM +0300, Shamir Rabinovitch wrote:
> > > This function can replace the need for tests based on 'pd->uobject'
> > > in the IB core code and will be used in next patches.
> > > 
> > > Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com>
> > >  include/rdma/ib_verbs.h | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> > > index 9897d2329f2c..136f2ffc4b0b 100644
> > > +++ b/include/rdma/ib_verbs.h
> > > @@ -1550,6 +1550,11 @@ struct ib_pd {
> > >  	struct rdma_restrack_entry res;
> > >  };
> > >  
> > > +static inline bool rdma_is_user_pd(struct ib_pd *pd)
> > > +{
> > > +	return !rdma_is_kernel_res(&pd->res);
> > > +}
> > 
> > Shouldn't this just be pd->res.user?
> > 
> > Why are are we using two different ways to track user or not?
> > 
> > Jason
> 
> I'd rather not know the internal structure to resource tracker objects
> and use the API as Leon suggested in another email.

Either don't add res.user or change rdma_is_kernel_res() to use
it. Don't have two different tests for user-ness

Jason
diff mbox series

Patch

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 9897d2329f2c..136f2ffc4b0b 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1550,6 +1550,11 @@  struct ib_pd {
 	struct rdma_restrack_entry res;
 };
 
+static inline bool rdma_is_user_pd(struct ib_pd *pd)
+{
+	return !rdma_is_kernel_res(&pd->res);
+}
+
 struct ib_xrcd {
 	struct ib_device       *device;
 	atomic_t		usecnt; /* count all exposed resources */