Re: [PATCH v3 rdma-next 2/5] RDMA/nldev: add provider-specific resource tracking

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

 



On Mon, Apr 23, 2018 at 10:44:10AM -0500, Steve Wise wrote:
>
> On 4/20/2018 1:09 PM, Jason Gunthorpe wrote:
> > On Fri, Mar 30, 2018 at 11:03:36AM -0700, Steve Wise wrote:
> >> diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
> >> index 884843e..1a680a3 100644
> >> +++ b/drivers/infiniband/core/nldev.c
> >> @@ -95,8 +95,25 @@
> >>  	[RDMA_NLDEV_ATTR_RES_PD_ENTRY]		= { .type = NLA_NESTED },
> >>  	[RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY]	= { .type = NLA_U32 },
> >>  	[RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY] = { .type = NLA_U32 },
> >> +	[RDMA_NLDEV_ATTR_PROVIDER]		= { .type = NLA_NESTED },
> >> +	[RDMA_NLDEV_ATTR_PROVIDER_ENTRY]	= { .type = NLA_NESTED },
> >> +	[RDMA_NLDEV_ATTR_PROVIDER_STRING]	= { .type = NLA_NUL_STRING,
> >> +				    .len = RDMA_NLDEV_ATTR_ENTRY_STRLEN },
> >> +	[RDMA_NLDEV_ATTR_PROVIDER_PRINT_TYPE]	= { .type = NLA_U8 },
> >> +	[RDMA_NLDEV_ATTR_PROVIDER_S32]		= { .type = NLA_S32 },
> >> +	[RDMA_NLDEV_ATTR_PROVIDER_U32]		= { .type = NLA_U32 },
> >> +	[RDMA_NLDEV_ATTR_PROVIDER_S64]		= { .type = NLA_S64 },
> >> +	[RDMA_NLDEV_ATTR_PROVIDER_U64]		= { .type = NLA_U64 },
> > Why do we need 64 and 32 bit version of this? Pass everything as s64
> > or u64?
> >
> >> +static int provider_fill_res_entry(struct rdma_restrack_root *resroot,
> >> +				   struct sk_buff *msg,
> >> +				   struct rdma_restrack_entry *res)
> >> +{
> >> +	return resroot->fill_res_entry ?
> >> +		resroot->fill_res_entry(msg, res) : 0;
> >> +}
> > Just init resroot->fill_res_entry to a function that returns 0 and
> > drop provider_fill_res_entry..
>
> Why is calling a function that returns 0 better than testing for the
> null function pointer?

I guess the reason to it that it will allow to us to call this
function unconditionally and get rid of provider_fill_res_entry()
entirely.

Thanks

>
> Steve.

Attachment: signature.asc
Description: PGP signature


[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