> -----Original Message----- > From: Leon Romanovsky <leon@xxxxxxxxxx> > Sent: Friday, March 30, 2018 9:56 AM > To: Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx> > Cc: jgg@xxxxxxxxxxxx; dledford@xxxxxxxxxx; linux-rdma@xxxxxxxxxxxxxxx > Subject: Re: [PATCH v2 rdma-next 4/5] RDMA/NLDEV: helper functions to > add provider attributes > > On Fri, Mar 30, 2018 at 09:51:09AM -0500, Steve Wise wrote: > > > On Thu, Mar 29, 2018 at 09:09:54AM -0700, Steve Wise wrote: > > > > These help rdma providers to fill out the provider entries. > > > > > > > > Signed-off-by: Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx> > > > > --- > > > > drivers/infiniband/core/nldev.c | 79 > > > +++++++++++++++++++++++++++++++++++++++++ > > > > include/rdma/restrack.h | 19 ++++++++++ > > > > 2 files changed, 98 insertions(+) > > > > > > > > diff --git a/drivers/infiniband/core/nldev.c > > > b/drivers/infiniband/core/nldev.c > > > > index 902517f..301646b 100644 > > > > --- a/drivers/infiniband/core/nldev.c > > > > +++ b/drivers/infiniband/core/nldev.c > > > > @@ -131,6 +131,85 @@ static int provider_fill_port_info(struct > sk_buff > > > *msg, > > > > device->res.fill_port_info(msg, cb, device, port) : 0; > > > > } > > > > > > > > +static int put_provider_name_print_type(struct sk_buff *msg, const > char > > > *name, > > > > + enum rdma_nldev_print_type > > > print_type) > > > > +{ > > > > + if (nla_put_string(msg, RDMA_NLDEV_ATTR_PROVIDER_STRING, > > > name)) > > > > + return -EMSGSIZE; > > > > + if (print_type != RDMA_NLDEV_PRINT_TYPE_UNSPEC && > > > > + nla_put_u8(msg, RDMA_NLDEV_ATTR_PROVIDER_PRINT_TYPE, > > > print_type)) > > > > + return -EMSGSIZE; > > > > + > > > > + return 0; > > > > +} > > > > + > > > > +int rdma_nl_put_provider_u32(struct sk_buff *msg, const char > *name, > > > > + enum rdma_nldev_print_type print_type, > > > > + u32 value) > > > > +{ > > > > + if (put_provider_name_print_type(msg, name, print_type)) > > > > + return -EMSGSIZE; > > > > + if (nla_put_u32(msg, RDMA_NLDEV_ATTR_PROVIDER_U32, value)) > > > > + return -EMSGSIZE; > > > > + > > > > + return 0; > > > > +} > > > > +EXPORT_SYMBOL(rdma_nl_put_provider_u32); > > > > > > Let's do two functions > > > 1. rdma_nl_put_provider_u32(struct sk_buff *msg, const char > *name,u32 > > > value) > > > 2. rdma_nl_put_provider_u32_hex(struct sk_buff *msg, const char > *name, > > > u32 value) > > > > > > And save from drivers the need to specify type (and _UNSPEC) > > > > > > Please implement only functions which you are using, other functions > > > will be implemented later. > > > > > > Thanks > > > > The last patch uses u64 as well. I need u32 and u64. > > I meant that if you don't need u32_hex, so don't implement it :) > > Let's nail this down so the next respin will stick: - remove cb from provider fill API functions - null out function pointers explicitly - remove BIN print type - have u32/u64 unspec and hex helpers, and only the ones I need for patch 4 (I'll add more if I need them in a subsequent series). Is this list complete? thanks -- 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