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 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?

Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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