Commit 5fa76c20 authored by Ira Weiny's avatar Ira Weiny Committed by Doug Ledford

IB/core: Add get FW version string to the core

Allow for a common core function to get firmware version strings
from the individual devices.

In later patches this format can then then be used to pass a
properly formated version string through the IPoIB layer.

The problem with the current code in the IPoIB layer is that it is
specific to certain hardware types.

Furthermore, this gives us a common function through which the core
can provide a common sysfs entry.  Eventually we may want to
remove the sysfs export but this provides for user space backwards
compatibility.
Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 5edb5649
...@@ -311,6 +311,15 @@ static int read_port_immutable(struct ib_device *device) ...@@ -311,6 +311,15 @@ static int read_port_immutable(struct ib_device *device)
return 0; return 0;
} }
void ib_get_device_fw_str(struct ib_device *dev, char *str, size_t str_len)
{
if (dev->get_dev_fw_str)
dev->get_dev_fw_str(dev, str, str_len);
else
str[0] = '\0';
}
EXPORT_SYMBOL(ib_get_device_fw_str);
/** /**
* ib_register_device - Register an IB device with IB core * ib_register_device - Register an IB device with IB core
* @device:Device to register * @device:Device to register
......
...@@ -1956,6 +1956,7 @@ struct ib_device { ...@@ -1956,6 +1956,7 @@ struct ib_device {
* in fast paths. * in fast paths.
*/ */
int (*get_port_immutable)(struct ib_device *, u8, struct ib_port_immutable *); int (*get_port_immutable)(struct ib_device *, u8, struct ib_port_immutable *);
void (*get_dev_fw_str)(struct ib_device *, char *str, size_t str_len);
}; };
struct ib_client { struct ib_client {
...@@ -1991,6 +1992,8 @@ struct ib_client { ...@@ -1991,6 +1992,8 @@ struct ib_client {
struct ib_device *ib_alloc_device(size_t size); struct ib_device *ib_alloc_device(size_t size);
void ib_dealloc_device(struct ib_device *device); void ib_dealloc_device(struct ib_device *device);
void ib_get_device_fw_str(struct ib_device *device, char *str, size_t str_len);
int ib_register_device(struct ib_device *device, int ib_register_device(struct ib_device *device,
int (*port_callback)(struct ib_device *, int (*port_callback)(struct ib_device *,
u8, struct kobject *)); u8, struct kobject *));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment