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
Attachment:
signature.asc
Description: PGP signature