Create device FW version call back
Subsystems (7)
cover Create device FW version call back
From: Ira Weiny <[email protected]>
Currently there are 3 ways to get the firmware version for an RDMA device.
1) verbs query device
2) ethtool
3) sysfs entry
Both 1 and 2 are expecting a 64bit field which is vendor specific and encodes a 3 number version. Some hardware, like OPA, only has 2 numbers in it's version, while other hardware like cxgb4 has 4.
Support for the sysfs entry was left to the devices but generally done in a "common" way.
This series moves to unify firmware version reporting by creating the ib_get_device_fw_str method within the ib_device. With this we can then do 3 things.
1) Support device dependent formats of version strings with ethtool (IPoIB)
2) Support a common sysfs entry in the core for backwards compatibility which can either be changed to a common FW version string with the new verbs interface or simply removed in favor of using ethtool.
3) Eventually drop the sysfs entry once we can get user space tools off of it. If we decide not to have an interface through verbs (require the use of ethtool via IPoIB) iWarp and RoCE devices don't even have to have this support at all and the code can be eliminated for those devices.
1 and 2 are done with this patch series. 3 needs to be decided by the community if, and when, sysfs support can be dropped.
NOTE: I have tested these patches with mlx4, qib, and hfi1. Other drivers were compile tested only.
Ira Weiny (13):
IB/core: Add get FW version string to the core
IB/cxgb3: Support device FW version string
IB/cxgb4: Support device FW version string
IB/i40iw: Support device FW version string
IB/mlx4: Support device FW version string
IB/mlx5: Support device FW version string
IB/mthca: Supprot device FW version string
IB/nes: Support device FW version string
IB/ocrdma: Support device FW version string
IB/usnic: Support device FW version string
IB/ipoib: Use new device FW version string
IB/core: Export a common fw_ver sysfs entry
IB/hfi1: Add device FW version string
drivers/infiniband/core/device.c | 9 ++++++++ drivers/infiniband/core/sysfs.c | 16 +++++++++++++- drivers/infiniband/hw/cxgb3/iwch_provider.c | 27 +++++++++++------------ drivers/infiniband/hw/cxgb4/provider.c | 31 +++++++++++++------------- drivers/infiniband/hw/hfi1/hfi.h | 2 ++ drivers/infiniband/hw/hfi1/verbs.c | 15 +++++++++++++ drivers/infiniband/hw/i40iw/i40iw_verbs.c | 24 +++++++++----------- drivers/infiniband/hw/mlx4/main.c | 24 ++++++++++---------- drivers/infiniband/hw/mlx5/main.c | 21 +++++++++--------- drivers/infiniband/hw/mthca/mthca_provider.c | 24 ++++++++++---------- drivers/infiniband/hw/nes/nes_verbs.c | 33 ++++++++++++---------------- drivers/infiniband/hw/ocrdma/ocrdma_main.c | 19 ++++++++-------- drivers/infiniband/hw/usnic/usnic_ib_main.c | 16 ++++++++++++++ drivers/infiniband/hw/usnic/usnic_ib_sysfs.c | 17 -------------- drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 6 ++--- include/rdma/ib_verbs.h | 3 +++ 16 files changed, 157 insertions(+), 130 deletions(-)
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1465509248-11324-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
PATCH 1/13 IB/core: Add get FW version string to the core
From: Ira Weiny <[email protected]>
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.
--- drivers/infiniband/core/device.c | 9 +++++++++ include/rdma/ib_verbs.h | 3 +++ 2 files changed, 12 insertions(+)
drivers/infiniband/core/device.c +9 -0
@@ -311,6 +311,15 @@ static int read_port_immutable(struct ib_device *device)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 +snprintf (str, str_len,"%s" ,"" ); +} +EXPORT_SYMBOL (ib_get_device_fw_str); +/** * ib_register_device - Register an IB device with IB core * @device:Device to register
include/rdma/ib_verbs.h +3 -0
@@ -1956,6 +1956,7 @@ struct ib_device {* in fast paths. */ 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 {
@@ -1991,6 +1992,8 @@ struct ib_client {struct ib_device *ib_alloc_device (size_t size);void ib_dealloc_device (struct ib_device *device); +void ib_get_device_fw_str (struct ib_device *device,char *,size_t ); +int ib_register_device (struct ib_device *device,int (*port_callback)(struct ib_device *,u8 ,struct kobject *));
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1465509248-11324-2-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 01/13] IB/core: Add get FW version string to the core
drivers/infiniband/core/device.c static int read_port_immutable(struct ib_device *device) · line 319
Quoted 6 lines · On Thu, Jun 09, 2016 at 05:53:56PM -0400…
drivers/infiniband/core/device.c +6
-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 +snprintf (str, str_len,"%s" ,"" );
That is the strangest way to write str[0] = 0;
Quoted 3 lines
void
ib_dealloc_device(struct ib_device *device);+void
ib_get_device_fw_str(struct ib_device *device, char *, size_t);
It is not common in the kernel to drop the parameter names from the prototype, please don't add more.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20160609222919.GA13366-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Re: [PATCH 01/13] IB/core: Add get FW version string to the core
Quoted 9 lines · Jason Gunthorpe
drivers/infiniband/core/device.c static int read_port_immutable(struct ib_device *device) · line 319
Quoted 6 lines · On Thu, Jun 09, 2016 at 05:53:56PM -0400…
drivers/infiniband/core/device.c +6
-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 +snprintf (str, str_len,"%s" ,"" );That is the strangest way to write str[0] = 0;
I find it to be very explicit without any performance requirements.
How about?
str[0] = '\0';
Quoted 7 lines
Quoted 4 lines
void
ib_dealloc_device(struct ib_device *device);+void
ib_get_device_fw_str(struct ib_device *device, char *, size_t);It is not common in the kernel to drop the parameter names from the prototype, please don't add more.
Good catch sorry about that.
Fixed.
Ira
Quoted 6 lines
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/13 IB/cxgb3: Support device FW version string
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
Also remove fw_ver sysfs to be replaced by the common core one.
--- drivers/infiniband/hw/cxgb3/iwch_provider.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
drivers/infiniband/hw/cxgb3/iwch_provider.c +13 -14
@@ -1183,18 +1183,6 @@ static ssize_t show_rev(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" , iwch_dev->rdev.t3cdev_p->type); } -static ssize_t show_fw_ver (struct device *dev,struct device_attribute *attr,char *buf) -{ - struct iwch_dev *iwch_dev = container_of(dev, struct iwch_dev, - ibdev.dev); -struct ethtool_drvinfo info; -struct net_device *lldev = iwch_dev->rdev.t3cdev_p->lldev; - -PDBG ("%s dev 0x%p\n" , __func__, dev); - lldev->ethtool_ops->get_drvinfo (lldev, &info); -return sprintf (buf,"%s\n" , info.fw_version); -} -static ssize_t show_hca (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -1334,13 +1322,11 @@ static int iwch_get_mib(struct ib_device *ibdev, struct rdma_hw_stats *stats, } static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); -static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL);static struct device_attribute *iwch_class_attributes[] = { &dev_attr_hw_rev, - &dev_attr_fw_ver, &dev_attr_hca_type, &dev_attr_board_id, };
@@ -1362,6 +1348,18 @@ static int iwch_port_immutable(struct ib_device *ibdev, u8 port_num,return 0 ; } +static void get_dev_fw_ver_str (struct ib_device *ibdev,char *str, +size_t str_len) +{ +struct iwch_dev *iwch_dev =to_iwch_dev (ibdev); +struct ethtool_drvinfo info; +struct net_device *lldev = iwch_dev->rdev.t3cdev_p->lldev; + +PDBG ("%s dev 0x%p\n" , __func__, iwch_dev); + lldev->ethtool_ops->get_drvinfo (lldev, &info); +snprintf (str, str_len,"%s" , info.fw_version); +} +int iwch_register_device (struct iwch_dev *dev) {int ret;
@@ -1437,6 +1435,7 @@ int iwch_register_device(struct iwch_dev *dev) dev->ibdev.get_hw_stats = iwch_get_mib; dev->ibdev.uverbs_abi_ver =IWCH_UVERBS_ABI_VERSION ; dev->ibdev.get_port_immutable = iwch_port_immutable; + dev->ibdev.get_dev_fw_str = get_dev_fw_ver_str; dev->ibdev.iwcm =kmalloc (sizeof (struct iw_cm_verbs ),GFP_KERNEL );if (!dev->ibdev.iwcm)
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1465509248-11324-3-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Steve Wise
Reviewed-byRE: [PATCH 02/13] IB/cxgb3: Support device FW version string
Quoted 5 lines
Also remove
fw_versysfs to be replaced by the common core one.Reviewed-by Dennis Dalessandro <[email protected]>Signed-off-by Ira Weiny <[email protected]>
Looks good.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/13 IB/cxgb4: Support device FW version string
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
And remove sysfs fw_ver in favor of the core.
--- drivers/infiniband/hw/cxgb4/provider.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/infiniband/hw/cxgb4/provider.c +15 -16
@@ -409,20 +409,6 @@ static ssize_t show_rev(struct device *dev, struct device_attribute *attr, CHELSIO_CHIP_RELEASE(c4iw_dev->rdev.lldi.adapter_type)); } -static ssize_t show_fw_ver (struct device *dev,struct device_attribute *attr, -char *buf) -{ - struct c4iw_dev *c4iw_dev = container_of(dev, struct c4iw_dev, - ibdev.dev); -PDBG ("%s dev 0x%p\n" , __func__, dev); - -return sprintf (buf,"%u.%u.%u.%u\n" , -FW_HDR_FW_VER_MAJOR_G (c4iw_dev->rdev.lldi.fw_vers), -FW_HDR_FW_VER_MINOR_G (c4iw_dev->rdev.lldi.fw_vers), -FW_HDR_FW_VER_MICRO_G (c4iw_dev->rdev.lldi.fw_vers), -FW_HDR_FW_VER_BUILD_G (c4iw_dev->rdev.lldi.fw_vers)); -} -static ssize_t show_hca (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -502,13 +488,11 @@ static int c4iw_get_mib(struct ib_device *ibdev, } static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); -static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL);static struct device_attribute *c4iw_class_attributes[] = { &dev_attr_hw_rev, - &dev_attr_fw_ver, &dev_attr_hca_type, &dev_attr_board_id, };
@@ -530,6 +514,20 @@ static int c4iw_port_immutable(struct ib_device *ibdev, u8 port_num,return 0 ; } +static void get_dev_fw_str (struct ib_device *dev,char *str, +size_t str_len) +{ + struct c4iw_dev *c4iw_dev = container_of(dev, struct c4iw_dev, + ibdev); +PDBG ("%s dev 0x%p\n" , __func__, dev); + +snprintf (str, str_len,"%u.%u.%u.%u" , +FW_HDR_FW_VER_MAJOR_G (c4iw_dev->rdev.lldi.fw_vers), +FW_HDR_FW_VER_MINOR_G (c4iw_dev->rdev.lldi.fw_vers), +FW_HDR_FW_VER_MICRO_G (c4iw_dev->rdev.lldi.fw_vers), +FW_HDR_FW_VER_BUILD_G (c4iw_dev->rdev.lldi.fw_vers)); +} +int c4iw_register_device (struct c4iw_dev *dev) {int ret;
@@ -605,6 +603,7 @@ int c4iw_register_device(struct c4iw_dev *dev) dev->ibdev.get_hw_stats = c4iw_get_mib; dev->ibdev.uverbs_abi_ver =C4IW_UVERBS_ABI_VERSION ; dev->ibdev.get_port_immutable = c4iw_port_immutable; + dev->ibdev.get_dev_fw_str = get_dev_fw_str; dev->ibdev.drain_sq = c4iw_drain_sq; dev->ibdev.drain_rq = c4iw_drain_rq;
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1465509248-11324-4-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Steve Wise
Reviewed-byRE: [PATCH 03/13] IB/cxgb4: Support device FW version string
Quoted 5 lines
And remove sysfs
fw_verin favor of the core.Reviewed-by Dennis Dalessandro <[email protected]>Signed-off-by Ira Weiny <[email protected]>
Looks good.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/13 IB/i40iw: Support device FW version string
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
And remove sysfs support in favor of the core version.
--- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_verbs.c +10 -14
@@ -1973,18 +1973,6 @@ static ssize_t i40iw_show_rev(struct device *dev, }/** -* i40iw_show_fw_ver -*/ -static ssize_t i40iw_show_fw_ver (struct device *dev, -struct device_attribute *attr,char *buf) -{ -u32 firmware_version =I40IW_FW_VERSION ; - -return sprintf (buf,"%u.%u\n" , firmware_version, - (firmware_version &0x000000ff )); -} - -/** * i40iw_show_hca */ static ssize_t i40iw_show_hca(struct device *dev,
@@ -2004,13 +1992,11 @@ static ssize_t i40iw_show_board(struct device *dev, } static DEVICE_ATTR(hw_rev, S_IRUGO, i40iw_show_rev, NULL); -static DEVICE_ATTR(fw_ver, S_IRUGO, i40iw_show_fw_ver, NULL); static DEVICE_ATTR(hca_type, S_IRUGO, i40iw_show_hca, NULL); static DEVICE_ATTR(board_id, S_IRUGO, i40iw_show_board, NULL);static struct device_attribute *i40iw_dev_attributes[] = { &dev_attr_hw_rev, - &dev_attr_fw_ver, &dev_attr_hca_type, &dev_attr_board_id };
@@ -2427,6 +2413,15 @@ static const char * const i40iw_hw_stat_names[] = { "iwRdmaInv" }; +static void i40iw_get_dev_fw_str (struct ib_device *dev,char *str, +size_t str_len) +{ +u32 firmware_version =I40IW_FW_VERSION ; + +snprintf (str, str_len,"%u.%u" , firmware_version, + (firmware_version &0x000000ff )); +} +/** * i40iw_alloc_hw_stats - Allocate a hw stats structure * @ibdev: device pointer from stack
@@ -2650,6 +2645,7 @@ static struct i40iw_ib_device *i40iw_init_rdma_device(struct i40iw_device *iwdevmemcpy (iwibdev->ibdev.iwcm->ifname, netdev->name,sizeof (iwibdev->ibdev.iwcm->ifname)); iwibdev->ibdev.get_port_immutable = i40iw_port_immutable; + iwibdev->ibdev.get_dev_fw_str = i40iw_get_dev_fw_str; iwibdev->ibdev.poll_cq = i40iw_poll_cq; iwibdev->ibdev.req_notify_cq = i40iw_req_notify_cq; iwibdev->ibdev.post_send = i40iw_post_send;
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/13 IB/mlx4: Support device FW version string
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
And remove the sysfs in favor of common core version.
--- drivers/infiniband/hw/mlx4/main.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/infiniband/hw/mlx4/main.c +12 -12
@@ -2022,16 +2022,6 @@ static ssize_t show_hca(struct device *device, struct device_attribute *attr,return sprintf (buf,"MT%d\n" , dev->dev->persist->pdev->device); } -static ssize_t show_fw_ver (struct device *device,struct device_attribute *attr, -char *buf) -{ -struct mlx4_ib_dev *dev = - container_of(device, struct mlx4_ib_dev, ib_dev.dev); -return sprintf (buf,"%d.%d.%d\n" , (int ) (dev->dev->caps.fw_ver >>32 ), - (int ) (dev->dev->caps.fw_ver >>16 ) &0xffff , - (int ) dev->dev->caps.fw_ver &0xffff ); -} -static ssize_t show_rev (struct device *device,struct device_attribute *attr,char *buf) {
@@ -2050,13 +2040,11 @@ static ssize_t show_board(struct device *device, struct device_attribute *attr, } static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); -static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL);static struct device_attribute *mlx4_class_attributes[] = { &dev_attr_hw_rev, - &dev_attr_fw_ver, &dev_attr_hca_type, &dev_attr_board_id };
@@ -2277,6 +2265,17 @@ static int mlx4_port_immutable(struct ib_device *ibdev, u8 port_num,return 0 ; } +static void get_fw_ver_str (struct ib_device *device,char *str, +size_t str_len) +{ +struct mlx4_ib_dev *dev = + container_of(device, struct mlx4_ib_dev, ib_dev); +snprintf (str, str_len,"%d.%d.%d" , + (int ) (dev->dev->caps.fw_ver >>32 ), + (int ) (dev->dev->caps.fw_ver >>16 ) &0xffff , + (int ) dev->dev->caps.fw_ver &0xffff ); +} +static void *mlx4_ib_add (struct mlx4_dev *dev) {struct mlx4_ib_dev *ibdev;
@@ -2410,6 +2409,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) ibdev->ib_dev.detach_mcast = mlx4_ib_mcg_detach; ibdev->ib_dev.process_mad = mlx4_ib_process_mad; ibdev->ib_dev.get_port_immutable = mlx4_port_immutable; + ibdev->ib_dev.get_dev_fw_str = get_fw_ver_str; ibdev->ib_dev.disassociate_ucontext = mlx4_ib_disassociate_ucontext;if (!mlx4_is_slave (ibdev->dev)) {
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/13 IB/mlx5: Support device FW version string
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
And remove sysfs entry in favor of the common code.
--- drivers/infiniband/hw/mlx5/main.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/infiniband/hw/mlx5/main.c +10 -11
@@ -1793,15 +1793,6 @@ static ssize_t show_hca(struct device *device, struct device_attribute *attr,return sprintf (buf,"MT%d\n" , dev->mdev->pdev->device); } -static ssize_t show_fw_ver (struct device *device,struct device_attribute *attr, -char *buf) -{ -struct mlx5_ib_dev *dev = - container_of(device, struct mlx5_ib_dev, ib_dev.dev); -return sprintf (buf,"%d.%d.%d\n" ,fw_rev_maj (dev->mdev), -fw_rev_min (dev->mdev),fw_rev_sub (dev->mdev)); -} -static ssize_t show_rev (struct device *device,struct device_attribute *attr,char *buf) {
@@ -1820,7 +1811,6 @@ static ssize_t show_board(struct device *device, struct device_attribute *attr, } static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); -static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); static DEVICE_ATTR(fw_pages, S_IRUGO, show_fw_pages, NULL);
@@ -1828,7 +1818,6 @@ static DEVICE_ATTR(reg_pages, S_IRUGO, show_reg_pages, NULL);static struct device_attribute *mlx5_class_attributes[] = { &dev_attr_hw_rev, - &dev_attr_fw_ver, &dev_attr_hca_type, &dev_attr_board_id, &dev_attr_fw_pages,
@@ -2267,6 +2256,15 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num,return 0 ; } +static void get_dev_fw_str (struct ib_device *ibdev,char *str, +size_t str_len) +{ +struct mlx5_ib_dev *dev = + container_of(ibdev, struct mlx5_ib_dev, ib_dev); +snprintf (str, str_len,"%d.%d.%d" ,fw_rev_maj (dev->mdev), +fw_rev_min (dev->mdev),fw_rev_sub (dev->mdev)); +} +static int mlx5_enable_roce (struct mlx5_ib_dev *dev) {int err;
@@ -2413,6 +2411,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) dev->ib_dev.map_mr_sg = mlx5_ib_map_mr_sg; dev->ib_dev.check_mr_status = mlx5_ib_check_mr_status; dev->ib_dev.get_port_immutable = mlx5_port_immutable; + dev->ib_dev.get_dev_fw_str = get_dev_fw_str;if (mlx5_core_is_pf (mdev)) { dev->ib_dev.get_vf_config = mlx5_ib_get_vf_config; dev->ib_dev.set_vf_link_state = mlx5_ib_set_vf_link_state;
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 7/13 IB/mthca: Supprot device FW version string
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
And remove the sysfs entry in favor of the core support.
--- drivers/infiniband/hw/mthca/mthca_provider.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/infiniband/hw/mthca/mthca_provider.c +12 -12
@@ -1081,16 +1081,6 @@ static ssize_t show_rev(struct device *device, struct device_attribute *attr,return sprintf (buf,"%x\n" , dev->rev_id); } -static ssize_t show_fw_ver (struct device *device,struct device_attribute *attr, -char *buf) -{ -struct mthca_dev *dev = - container_of(device, struct mthca_dev, ib_dev.dev); -return sprintf (buf,"%d.%d.%d\n" , (int ) (dev->fw_ver >>32 ), - (int ) (dev->fw_ver >>16 ) &0xffff , - (int ) dev->fw_ver &0xffff ); -} -static ssize_t show_hca (struct device *device,struct device_attribute *attr,char *buf) {
@@ -1120,13 +1110,11 @@ static ssize_t show_board(struct device *device, struct device_attribute *attr, } static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); -static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL);static struct device_attribute *mthca_dev_attributes[] = { &dev_attr_hw_rev, - &dev_attr_fw_ver, &dev_attr_hca_type, &dev_attr_board_id };
@@ -1187,6 +1175,17 @@ static int mthca_port_immutable(struct ib_device *ibdev, u8 port_num,return 0 ; } +static void get_dev_fw_str (struct ib_device *device,char *str, +size_t str_len) +{ +struct mthca_dev *dev = + container_of(device, struct mthca_dev, ib_dev); +snprintf (str, str_len,"%d.%d.%d" , + (int ) (dev->fw_ver >>32 ), + (int ) (dev->fw_ver >>16 ) &0xffff , + (int ) dev->fw_ver &0xffff ); +} +int mthca_register_device (struct mthca_dev *dev) {int ret;
@@ -1266,6 +1265,7 @@ int mthca_register_device(struct mthca_dev *dev) dev->ib_dev.reg_user_mr = mthca_reg_user_mr; dev->ib_dev.dereg_mr = mthca_dereg_mr; dev->ib_dev.get_port_immutable = mthca_port_immutable; + dev->ib_dev.get_dev_fw_str = get_dev_fw_str;if (dev->mthca_flags &MTHCA_FLAG_FMR ) { dev->ib_dev.alloc_fmr = mthca_alloc_fmr;
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/13 IB/nes: Support device FW version string
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
And remove the sysfs in favor of the core version.
--- drivers/infiniband/hw/nes/nes_verbs.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-)
drivers/infiniband/hw/nes/nes_verbs.c +14 -19
@@ -2606,23 +2606,6 @@ static ssize_t show_rev(struct device *dev, struct device_attribute *attr,/** -* show_fw_ver -*/ -static ssize_t show_fw_ver (struct device *dev,struct device_attribute *attr, -char *buf) -{ -struct nes_ib_device *nesibdev = - container_of(dev, struct nes_ib_device, ibdev.dev); -struct nes_vnic *nesvnic = nesibdev->nesvnic; - -nes_debug (NES_DBG_INIT ,"\n" ); -return sprintf (buf,"%u.%u\n" , - (nesvnic->nesdev->nesadapter->firmware_version >>16 ), - (nesvnic->nesdev->nesadapter->firmware_version &0x000000ff )); -} - - -/** * show_hca */ static ssize_t show_hca(struct device *dev, struct device_attribute *attr,
@@ -2645,13 +2628,11 @@ static ssize_t show_board(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); -static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL);static struct device_attribute *nes_dev_attributes[] = { &dev_attr_hw_rev, - &dev_attr_fw_ver, &dev_attr_hca_type, &dev_attr_board_id };
@@ -3703,6 +3684,19 @@ static int nes_port_immutable(struct ib_device *ibdev, u8 port_num,return 0 ; } +static void get_dev_fw_str (struct ib_device *dev,char *str, +size_t str_len) +{ +struct nes_ib_device *nesibdev = + container_of(dev, struct nes_ib_device, ibdev); +struct nes_vnic *nesvnic = nesibdev->nesvnic; + +nes_debug (NES_DBG_INIT ,"\n" ); +snprintf (str, str_len,"%u.%u" , + (nesvnic->nesdev->nesadapter->firmware_version >>16 ), + (nesvnic->nesdev->nesadapter->firmware_version &0x000000ff )); +} +/** * nes_init_ofa_device */
@@ -3802,6 +3796,7 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev) nesibdev->ibdev.iwcm->create_listen = nes_create_listen; nesibdev->ibdev.iwcm->destroy_listen = nes_destroy_listen; nesibdev->ibdev.get_port_immutable = nes_port_immutable; + nesibdev->ibdev.get_dev_fw_str = get_dev_fw_str;memcpy (nesibdev->ibdev.iwcm->ifname, netdev->name,sizeof (nesibdev->ibdev.iwcm->ifname));
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/13 IB/ocrdma: Support device FW version string
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
And remove sysfs in favor of the core support.
--- drivers/infiniband/hw/ocrdma/ocrdma_main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/infiniband/hw/ocrdma/ocrdma_main.c +9 -10
@@ -107,6 +107,14 @@ static int ocrdma_port_immutable(struct ib_device *ibdev, u8 port_num,return 0 ; } +static void get_dev_fw_str (struct ib_device *device,char *str, +size_t str_len) +{ +struct ocrdma_dev *dev =get_ocrdma_dev (device); + +snprintf (str, str_len,"%s" , &dev->attr.fw_ver[0 ]); +} +static int ocrdma_register_device (struct ocrdma_dev *dev) {strlcpy (dev->ibdev.name,"ocrdma%d" ,IB_DEVICE_NAME_MAX );
@@ -193,6 +201,7 @@ static int ocrdma_register_device(struct ocrdma_dev *dev) dev->ibdev.process_mad = ocrdma_process_mad; dev->ibdev.get_port_immutable = ocrdma_port_immutable; + dev->ibdev.get_dev_fw_str = get_dev_fw_str;if (ocrdma_get_asic_type (dev) ==OCRDMA_ASIC_GEN_SKH_R ) { dev->ibdev.uverbs_cmd_mask |=
@@ -262,14 +271,6 @@ static ssize_t show_rev(struct device *device, struct device_attribute *attr,return scnprintf (buf,PAGE_SIZE ,"0x%x\n" , dev->nic_info.pdev->vendor); } -static ssize_t show_fw_ver (struct device *device,struct device_attribute *attr, -char *buf) -{ -struct ocrdma_dev *dev =dev_get_drvdata (device); - -return scnprintf (buf,PAGE_SIZE ,"%s\n" , &dev->attr.fw_ver[0 ]); -} -static ssize_t show_hca_type (struct device *device,struct device_attribute *attr,char *buf) {
@@ -279,12 +280,10 @@ static ssize_t show_hca_type(struct device *device, } static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); -static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); static DEVICE_ATTR(hca_type, S_IRUGO, show_hca_type, NULL);static struct device_attribute *ocrdma_attributes[] = { &dev_attr_hw_rev, - &dev_attr_fw_ver, &dev_attr_hca_type };
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 10/13 IB/usnic: Support device FW version string
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
And remove sysfs file in favor of the common core.
--- drivers/infiniband/hw/usnic/usnic_ib_main.c | 16 ++++++++++++++++ drivers/infiniband/hw/usnic/usnic_ib_sysfs.c | 17 ----------------- 2 files changed, 16 insertions(+), 17 deletions(-)
drivers/infiniband/hw/usnic/usnic_ib_main.c +16 -0
@@ -331,6 +331,21 @@ static int usnic_port_immutable(struct ib_device *ibdev, u8 port_num,return 0 ; } +static void usnic_get_dev_fw_str (struct ib_device *device, +char *str, +size_t str_len) +{ +struct usnic_ib_dev *us_ibdev = + container_of(device, struct usnic_ib_dev, ib_dev); +struct ethtool_drvinfo info; + +mutex_lock (&us_ibdev->usdev_lock); + us_ibdev->netdev->ethtool_ops->get_drvinfo (us_ibdev->netdev, &info); +mutex_unlock (&us_ibdev->usdev_lock); + +snprintf (str, str_len,"%s" , info.fw_version); +} +/* Start of PF discovery section */ static void *usnic_ib_device_add (struct pci_dev *dev) {
@@ -414,6 +429,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev) us_ibdev->ib_dev.req_notify_cq = usnic_ib_req_notify_cq; us_ibdev->ib_dev.get_dma_mr = usnic_ib_get_dma_mr; us_ibdev->ib_dev.get_port_immutable = usnic_port_immutable; + us_ibdev->ib_dev.get_dev_fw_str = usnic_get_dev_fw_str;if (ib_register_device (&us_ibdev->ib_dev,NULL ))
drivers/infiniband/hw/usnic/usnic_ib_sysfs.c +0 -17
@@ -45,21 +45,6 @@#include "usnic_ib_verbs.h" #include "usnic_log.h" -static ssize_t usnic_ib_show_fw_ver (struct device *device, -struct device_attribute *attr, -char *buf) -{ -struct usnic_ib_dev *us_ibdev = - container_of(device, struct usnic_ib_dev, ib_dev.dev); -struct ethtool_drvinfo info; - -mutex_lock (&us_ibdev->usdev_lock); - us_ibdev->netdev->ethtool_ops->get_drvinfo (us_ibdev->netdev, &info); -mutex_unlock (&us_ibdev->usdev_lock); - -return scnprintf (buf,PAGE_SIZE ,"%s\n" , info.fw_version); -} -static ssize_t usnic_ib_show_board (struct device *device,struct device_attribute *attr,char *buf)
@@ -192,7 +177,6 @@ usnic_ib_show_cq_per_vf(struct device *device, struct device_attribute *attr, us_ibdev->vf_res_cnt[USNIC_VNIC_RES_TYPE_CQ]); } -static DEVICE_ATTR(fw_ver, S_IRUGO, usnic_ib_show_fw_ver, NULL); static DEVICE_ATTR(board_id, S_IRUGO, usnic_ib_show_board, NULL); static DEVICE_ATTR(config, S_IRUGO, usnic_ib_show_config, NULL); static DEVICE_ATTR(iface, S_IRUGO, usnic_ib_show_iface, NULL);
@@ -201,7 +185,6 @@ static DEVICE_ATTR(qp_per_vf, S_IRUGO, usnic_ib_show_qp_per_vf, NULL); static DEVICE_ATTR(cq_per_vf, S_IRUGO, usnic_ib_show_cq_per_vf, NULL);static struct device_attribute *usnic_class_attributes[] = { - &dev_attr_fw_ver, &dev_attr_board_id, &dev_attr_config, &dev_attr_iface,
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 11/13 IB/ipoib: Use new device FW version string
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
Using this allows for devices to specify the format of their firmware version rather than forcing a format.
--- drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_ethtool.c +2 -4
@@ -62,10 +62,8 @@ static void ipoib_get_drvinfo(struct net_device *netdev, {struct ipoib_dev_priv *priv =netdev_priv (netdev); -snprintf (drvinfo->fw_version,sizeof (drvinfo->fw_version), -"%d.%d.%d" , (int )(priv->ca->attrs.fw_ver >>32 ), - (int )(priv->ca->attrs.fw_ver >>16 ) &0xffff , - (int )priv->ca->attrs.fw_ver &0xffff ); +ib_get_device_fw_str (priv->ca, drvinfo->fw_version, +sizeof (drvinfo->fw_version));strlcpy (drvinfo->bus_info,dev_name (priv->ca->dma_device),sizeof (drvinfo->bus_info));
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 12/13 IB/core: Export a common fw_ver sysfs entry
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
Now that all the devices have stopped exporting their own sysfs entry points we can have the core export this on their behalf.
Eventually this may be removed but this provides for backwards compatibility.
--- drivers/infiniband/core/sysfs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/infiniband/core/sysfs.c +15 -1
@@ -38,6 +38,7 @@#include <linux/stat.h> #include <linux/string.h> #include <linux/netdevice.h> +#include <linux/ethtool.h> #include <rdma/ib_mad.h> #include <rdma/ib_pma.h>
@@ -1188,16 +1189,29 @@ static ssize_t set_node_desc(struct device *device,return count; } +static ssize_t show_fw_ver (struct device *device,struct device_attribute *attr, +char *buf) +{ +char tmp[ETHTOOL_FWVERS_LEN ]; + struct ib_device *dev = container_of(device, struct ib_device, dev); + +ib_get_device_fw_str (dev, tmp,sizeof (tmp)); + +return scnprintf (buf,PAGE_SIZE ,"%s\n" , tmp); +} + static DEVICE_ATTR(node_type, S_IRUGO, show_node_type, NULL); static DEVICE_ATTR(sys_image_guid, S_IRUGO, show_sys_image_guid, NULL); static DEVICE_ATTR(node_guid, S_IRUGO, show_node_guid, NULL); static DEVICE_ATTR(node_desc, S_IRUGO | S_IWUSR, show_node_desc, set_node_desc); +static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL);static struct device_attribute *ib_class_attributes[] = { &dev_attr_node_type, &dev_attr_sys_image_guid, &dev_attr_node_guid, - &dev_attr_node_desc + &dev_attr_node_desc, + &dev_attr_fw_ver };static void free_port_list_attributes (struct ib_device *device)
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1465509248-11324-13-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 12/13] IB/core: Export a common fw_ver sysfs entry
drivers/infiniband/core/sysfs.c static ssize_t set_node_desc(struct device *device, · line 1200
Quoted 10 lines · On Thu, Jun 09, 2016 at 05:54:07PM -0400…
drivers/infiniband/core/sysfs.c +9
-0+static ssize_t show_fw_ver (struct device *device,struct device_attribute *attr, +char *buf) +{ +char tmp[ETHTOOL_FWVERS_LEN ]; + struct ib_device *dev = container_of(device, struct ib_device, dev); + +ib_get_device_fw_str (dev, tmp,sizeof (tmp)); + +return scnprintf (buf,PAGE_SIZE ,"%s\n" , tmp);
No need to use the stack:
ib_get_device_fw_str(dev, buf, PAGE_SIZE);strlcat(buf, "", PAGE_SIZE);
return strlen(buf);
drivers/infiniband/core/sysfs.c static ssize_t set_node_desc(struct device *device, · line 1214
Quoted 4 lines
drivers/infiniband/core/sysfs.c +2
-1&dev_attr_node_guid, - &dev_attr_node_desc + &dev_attr_node_desc, + &dev_attr_fw_ver
Should be
+ &dev_attr_fw_ver,
Note trailing comma. Avoids git churn like the above on append.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20160609224038.GB13366-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Re: [PATCH 12/13] IB/core: Export a common fw_ver sysfs entry
Quoted 6 lines · Jason Gunthorpe
drivers/infiniband/core/sysfs.c static ssize_t set_node_desc(struct device *device, · line 1195
Quoted 5 lines · On Thu, Jun 09, 2016 at 05:54:07PM -0400…
drivers/infiniband/core/sysfs.c +4
-0+static ssize_t show_fw_ver (struct device *device,struct device_attribute *attr, +char *buf) +{ +char tmp[ETHTOOL_FWVERS_LEN ];
Very minor request,
Can we avoid variable names like this?fw_str can be a good candidate for the name.
Quoted 27 lines
drivers/infiniband/core/sysfs.c static ssize_t set_node_desc(struct device *device, · line 1200
Quoted 5 lines
drivers/infiniband/core/sysfs.c +5
-0+ struct ib_device *dev = container_of(device, struct ib_device, dev); + +ib_get_device_fw_str (dev, tmp,sizeof (tmp)); + +return scnprintf (buf,PAGE_SIZE ,"%s\n" , tmp);No need to use the stack:
ib_get_device_fw_str(dev, buf, PAGE_SIZE);strlcat(buf, "", PAGE_SIZE);
return strlen(buf);drivers/infiniband/core/sysfs.c static ssize_t set_node_desc(struct device *device, · line 1214
Quoted 4 lines
drivers/infiniband/core/sysfs.c +2
-1&dev_attr_node_guid, - &dev_attr_node_desc + &dev_attr_node_desc, + &dev_attr_fw_verShould be
+&dev_attr_fw_ver,Note trailing comma. Avoids git churn like the above on append.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20160610140059.GB5408-2ukJVAZIZ/[email protected]
Re: [PATCH 12/13] IB/core: Export a common fw_ver sysfs entry
Quoted 12 lines · Leon Romanovsky
Quoted 6 lines · Jason Gunthorpe
drivers/infiniband/core/sysfs.c static ssize_t set_node_desc(struct device *device, · line 1195
Quoted 5 lines · On Thu, Jun 09, 2016 at 05:54:07PM -0400…
drivers/infiniband/core/sysfs.c +4
-0+static ssize_t show_fw_ver (struct device *device,struct device_attribute *attr, +char *buf) +{ +char tmp[ETHTOOL_FWVERS_LEN ];Very minor request,
Can we avoid variable names like this?fw_strcan be a good candidate for the name.
Sure, but Jason's comment removes the need of this variable. I'll remember for next time.
Ira
Quoted 22 lines
Quoted 22 lines
drivers/infiniband/core/sysfs.c static ssize_t set_node_desc(struct device *device, · line 1200
Quoted 7 lines
drivers/infiniband/core/sysfs.c +5
-0+ struct ib_device *dev = container_of(device, struct ib_device, dev); + +ib_get_device_fw_str (dev, tmp,sizeof (tmp)); + +return scnprintf (buf,PAGE_SIZE ,"%s\n" , tmp);No need to use the stack:
ib_get_device_fw_str(dev, buf, PAGE_SIZE);strlcat(buf, "", PAGE_SIZE);
return strlen(buf);drivers/infiniband/core/sysfs.c static ssize_t set_node_desc(struct device *device, · line 1214
Quoted 4 lines
drivers/infiniband/core/sysfs.c +2
-1&dev_attr_node_guid, - &dev_attr_node_desc + &dev_attr_node_desc, + &dev_attr_fw_verShould be
+&dev_attr_fw_ver,
Quoted 7 lines
Quoted 7 lines
Note trailing comma. Avoids git churn like the above on append.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/13] IB/core: Export a common fw_ver sysfs entry
In reply to a message not in the archiveQuoted 14 lines · Jason Gunthorpe
drivers/infiniband/core/sysfs.c static ssize_t set_node_desc(struct device *device, · line 1200
Quoted 10 lines · On Thu, Jun 09, 2016 at 05:54:07PM -0400…
drivers/infiniband/core/sysfs.c +9
-0+static ssize_t show_fw_ver (struct device *device,struct device_attribute *attr, +char *buf) +{ +char tmp[ETHTOOL_FWVERS_LEN ]; + struct ib_device *dev = container_of(device, struct ib_device, dev); + +ib_get_device_fw_str (dev, tmp,sizeof (tmp)); + +return scnprintf (buf,PAGE_SIZE ,"%s\n" , tmp);No need to use the stack:
Quoted 3 lines
ib_get_device_fw_str(dev, buf, PAGE_SIZE);strlcat(buf, "", PAGE_SIZE);
return strlen(buf);
That works. Fixes Leon's comment as well.
Done.
Quoted 10 lines
drivers/infiniband/core/sysfs.c static ssize_t set_node_desc(struct device *device, · line 1214
Quoted 5 lines
drivers/infiniband/core/sysfs.c +2
-1&dev_attr_node_guid, - &dev_attr_node_desc + &dev_attr_node_desc, + &dev_attr_fw_verShould be
+&dev_attr_fw_ver,Note trailing comma. Avoids git churn like the above on append.
Done.
Ira
Quoted 2 lines
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 13/13 IB/hfi1: Add device FW version string
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
Export the firmware version through the core.
--- drivers/infiniband/hw/hfi1/hfi.h | 2 ++ drivers/infiniband/hw/hfi1/verbs.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+)
drivers/infiniband/hw/hfi1/hfi.h +2 -0
@@ -1174,6 +1174,8 @@ struct hfi1_devdata {/* 8051 firmware version helper */ #define dc8051_ver (a, b) ((a) << 8 | (b)) +#define dc8051_ver_maj (a) ((a & 0xff00) >> 8) +#define dc8051_ver_min (a) (a & 0x00ff)/* f_put_tid types */ #define PT_EXPECTED 0
drivers/infiniband/hw/hfi1/verbs.c +15 -0
@@ -1291,9 +1291,12 @@ int hfi1_verbs_send(struct rvt_qp *qp, struct hfi1_pkt_state *ps)static void hfi1_fill_device_attr (struct hfi1_devdata *dd) {struct rvt_dev_info *rdi = &dd->verbs_dev.rdi; +u16 ver = dd->dc8051_ver;memset (&rdi->dparms.props,0 ,sizeof (rdi->dparms.props)); + rdi->dparms.props.fw_ver = ((u64)(dc8051_ver_maj (ver)) <<16 ) | + (u64 )dc8051_ver_min (ver); rdi->dparms.props.device_cap_flags =IB_DEVICE_BAD_PKEY_CNTR |IB_DEVICE_BAD_QKEY_CNTR |IB_DEVICE_SHUTDOWN_PORT | IB_DEVICE_SYS_IMAGE_GUID | IB_DEVICE_RC_RNR_NAK_GEN |
@@ -1567,6 +1570,17 @@ static void init_ibport(struct hfi1_pportdata *ppd)RCU_INIT_POINTER (ibp->rvp.qp[1 ],NULL ); } +static void hfi1_get_dev_fw_str (struct ib_device *ibdev,char *str, +size_t str_len) +{ +struct rvt_dev_info *rdi =ib_to_rvt (ibdev); +struct hfi1_ibdev *dev =dev_from_rdi (rdi); +u16 ver =dd_from_dev (dev)->dc8051_ver; + +snprintf (str, str_len,"%u.%u" ,dc8051_ver_maj (ver), +dc8051_ver_min (ver)); +} +/** * hfi1_register_ib_device - register our device with the infiniband core * @dd: the device data structure
@@ -1613,6 +1627,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)/* keep process mad in the driver */ ibdev->process_mad = hfi1_process_mad; + ibdev->get_dev_fw_str = hfi1_get_dev_fw_str;strncpy (ibdev->node_desc,init_utsname ()->nodename,sizeof (ibdev->node_desc));
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html