Message ID | 20170621060528.3752-9-leon@kernel.org |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
> From: Leon Romanovsky <leonro@mellanox.com> > > Provide ability to convert from device name to ib_device for the > IB/core users. > > Signed-off-by: Leon Romanovsky <leonro@mellanox.com> > --- > drivers/infiniband/core/core_priv.h | 1 + > drivers/infiniband/core/device.c | 3 +-- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/infiniband/core/core_priv.h > b/drivers/infiniband/core/core_priv.h > index 4a150c4be175..049ccbfca988 100644 > --- a/drivers/infiniband/core/core_priv.h > +++ b/drivers/infiniband/core/core_priv.h > @@ -184,4 +184,5 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb, > int ib_nl_handle_ip_res_resp(struct sk_buff *skb, > struct netlink_callback *cb); > > +struct ib_device *__ib_device_get_by_name(const char *name); > #endif /* _CORE_PRIV_H */ > diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c > index 7a799fc90348..4ec1b24258de 100644 > --- a/drivers/infiniband/core/device.c > +++ b/drivers/infiniband/core/device.c > @@ -124,7 +124,7 @@ static int ib_device_check_mandatory(struct ib_device > *device) > return 0; > } > > -static struct ib_device *__ib_device_get_by_name(const char *name) > +struct ib_device *__ib_device_get_by_name(const char *name) > { > struct ib_device *device; > > Nit: Why is this function prefixed with __? Perhaps now it should just be ib_device_get_by_name()? Reviewed-by: Steve Wise <swise@opengridcomputing.com>
On Wed, Jun 21, 2017 at 09:09:27AM -0500, Steve Wise wrote: > > From: Leon Romanovsky <leonro@mellanox.com> > > > > Provide ability to convert from device name to ib_device for the > > IB/core users. > > > > Signed-off-by: Leon Romanovsky <leonro@mellanox.com> > > --- > > drivers/infiniband/core/core_priv.h | 1 + > > drivers/infiniband/core/device.c | 3 +-- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/infiniband/core/core_priv.h > > b/drivers/infiniband/core/core_priv.h > > index 4a150c4be175..049ccbfca988 100644 > > --- a/drivers/infiniband/core/core_priv.h > > +++ b/drivers/infiniband/core/core_priv.h > > @@ -184,4 +184,5 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb, > > int ib_nl_handle_ip_res_resp(struct sk_buff *skb, > > struct netlink_callback *cb); > > > > +struct ib_device *__ib_device_get_by_name(const char *name); > > #endif /* _CORE_PRIV_H */ > > diff --git a/drivers/infiniband/core/device.c > b/drivers/infiniband/core/device.c > > index 7a799fc90348..4ec1b24258de 100644 > > --- a/drivers/infiniband/core/device.c > > +++ b/drivers/infiniband/core/device.c > > @@ -124,7 +124,7 @@ static int ib_device_check_mandatory(struct ib_device > > *device) > > return 0; > > } > > > > -static struct ib_device *__ib_device_get_by_name(const char *name) > > +struct ib_device *__ib_device_get_by_name(const char *name) > > { > > struct ib_device *device; > > > > > > Nit: Why is this function prefixed with __? Perhaps now it should just be > ib_device_get_by_name()? The access to this function should be protected by device_mutex and the convention is to prefix functions with "_" to mark that it needs to handle lock. > > > Reviewed-by: Steve Wise <swise@opengridcomputing.com> > >
On Wed, Jun 21, 2017 at 09:05:17AM +0300, Leon Romanovsky wrote: > From: Leon Romanovsky <leonro@mellanox.com> > > Provide ability to convert from device name to ib_device for the > IB/core users. FWIW, as a general comment, we really need to start using some kind of device index like netdev does instead of the name. I'd like the see the new netlink interface be index based. As we saw in a past discussion there is a desire to have stable device naming, which means renaming... Jason
On Wed, Jun 21, 2017 at 10:07:48AM -0600, Jason Gunthorpe wrote: > On Wed, Jun 21, 2017 at 09:05:17AM +0300, Leon Romanovsky wrote: > > From: Leon Romanovsky <leonro@mellanox.com> > > > > Provide ability to convert from device name to ib_device for the > > IB/core users. > > FWIW, as a general comment, we really need to start using some kind of > device index like netdev does instead of the name. I'd like the see > the new netlink interface be index based. I can do it, but it won't be full solution as I would like to have. At this stage, IB doesn't support namespaces yet and to implement them is a little bit overkill for rdmatool. > > As we saw in a past discussion there is a desire to have stable device > naming, which means renaming... If I recall correctly, after your proposal the participants disappeared :). > > Jason
diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index 4a150c4be175..049ccbfca988 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h @@ -184,4 +184,5 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb, int ib_nl_handle_ip_res_resp(struct sk_buff *skb, struct netlink_callback *cb); +struct ib_device *__ib_device_get_by_name(const char *name); #endif /* _CORE_PRIV_H */ diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 7a799fc90348..4ec1b24258de 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -124,7 +124,7 @@ static int ib_device_check_mandatory(struct ib_device *device) return 0; } -static struct ib_device *__ib_device_get_by_name(const char *name) +struct ib_device *__ib_device_get_by_name(const char *name) { struct ib_device *device; @@ -135,7 +135,6 @@ static struct ib_device *__ib_device_get_by_name(const char *name) return NULL; } - static int alloc_name(char *name) { unsigned long *inuse;