All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V1 00/13] Create device FW version call back
@ 2016-06-15  6:21 ira.weiny-ral2JQCrhuEAvxtiuMwx3w
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:21 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

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.

---
Changes from V0:
	Address comments by Jason and Leon
	Rebase to upstream
	Add Reviewed-by for cxgb4


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              | 15 ++++++++++++-
 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, 156 insertions(+), 130 deletions(-)

-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH V1 01/13] IB/core: Add get FW version string to the core
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-06-15  6:21   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
       [not found]     ` <1465971728-24104-2-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2016-06-15  6:21   ` [PATCH V1 02/13] IB/cxgb3: Support device FW version string ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (13 subsequent siblings)
  14 siblings, 1 reply; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:21 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

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: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

---
Changes from V0:
	Add parameter names to function signature
	change default string assignment

 drivers/infiniband/core/device.c | 9 +++++++++
 include/rdma/ib_verbs.h          | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 5c155fa91eec..760ef603a468 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -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
+		str[0] = '\0';
+}
+EXPORT_SYMBOL(ib_get_device_fw_str);
+
 /**
  * ib_register_device - Register an IB device with IB core
  * @device:Device to register
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 7e440d41487a..1dc3d0d90202 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -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 *str, size_t str_len);
+
 int ib_register_device(struct ib_device *device,
 		       int (*port_callback)(struct ib_device *,
 					    u8, struct kobject *));
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 02/13] IB/cxgb3: Support device FW version string
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2016-06-15  6:21   ` [PATCH V1 01/13] IB/core: Add get FW version string to the core ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:21   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
       [not found]     ` <1465971728-24104-3-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2016-06-15  6:21   ` [PATCH V1 03/13] IB/cxgb4: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (12 subsequent siblings)
  14 siblings, 1 reply; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:21 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Also remove fw_ver sysfs to be replaced by the common core one.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/cxgb3/iwch_provider.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index bb1a839d4d6d..3edb80644b53 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -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)
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 03/13] IB/cxgb4: Support device FW version string
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2016-06-15  6:21   ` [PATCH V1 01/13] IB/core: Add get FW version string to the core ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15  6:21   ` [PATCH V1 02/13] IB/cxgb3: Support device FW version string ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:21   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15  6:21   ` [PATCH V1 04/13] IB/i40iw: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (11 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:21 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

And remove sysfs fw_ver in favor of the core.

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

---
Changes from V0:
	Add tag Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>

 drivers/infiniband/hw/cxgb4/provider.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index dd8a86b726d2..df127ce6b6ec 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -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;
 
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 04/13] IB/i40iw: Support device FW version string
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-06-15  6:21   ` [PATCH V1 03/13] IB/cxgb4: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:21   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15  6:22   ` [PATCH V1 05/13] IB/mlx4: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (10 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:21 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

And remove sysfs support in favor of the core version.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/i40iw/i40iw_verbs.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 02a735b64208..39096a246863 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -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 *iwdev
 	memcpy(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;
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 05/13] IB/mlx4: Support device FW version string
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (3 preceding siblings ...)
  2016-06-15  6:21   ` [PATCH V1 04/13] IB/i40iw: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:22   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15  6:22   ` [PATCH V1 06/13] IB/mlx5: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (9 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:22 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

And remove the sysfs in favor of common core version.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/mlx4/main.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 0eb09e104542..1cbd075ce7e4 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -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)) {
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 06/13] IB/mlx5: Support device FW version string
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (4 preceding siblings ...)
  2016-06-15  6:22   ` [PATCH V1 05/13] IB/mlx4: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:22   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15  6:22   ` [PATCH V1 07/13] IB/mthca: Supprot " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (8 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:22 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

And remove sysfs entry in favor of the common code.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

---
Changes from V0:
	Update to new format which was in upstream code

 drivers/infiniband/hw/mlx5/main.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index b48ad85315dc..3fa8557eddbd 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1804,15 +1804,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.%04d\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)
 {
@@ -1831,7 +1822,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);
@@ -1839,7 +1829,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,
@@ -2275,6 +2264,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.%04d", 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;
@@ -2421,6 +2419,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;
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 07/13] IB/mthca: Supprot device FW version string
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (5 preceding siblings ...)
  2016-06-15  6:22   ` [PATCH V1 06/13] IB/mlx5: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:22   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15  6:22   ` [PATCH V1 08/13] IB/nes: Support " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (7 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:22 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

And remove the sysfs entry in favor of the core support.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/mthca/mthca_provider.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 9866c35cc977..da2335f7f7c3 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -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;
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 08/13] IB/nes: Support device FW version string
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (6 preceding siblings ...)
  2016-06-15  6:22   ` [PATCH V1 07/13] IB/mthca: Supprot " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:22   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15  6:22   ` [PATCH V1 09/13] IB/ocrdma: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (6 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:22 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

And remove the sysfs in favor of the core version.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/nes/nes_verbs.c | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 464d6da5fe91..bd69125731c1 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -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));
 
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 09/13] IB/ocrdma: Support device FW version string
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (7 preceding siblings ...)
  2016-06-15  6:22   ` [PATCH V1 08/13] IB/nes: Support " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:22   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15  6:22   ` [PATCH V1 10/13] IB/usnic: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (5 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:22 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

And remove sysfs in favor of the core support.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/ocrdma/ocrdma_main.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 3d75f65ce87e..07d0c6c5b046 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -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
 };
 
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 10/13] IB/usnic: Support device FW version string
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (8 preceding siblings ...)
  2016-06-15  6:22   ` [PATCH V1 09/13] IB/ocrdma: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:22   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15  6:22   ` [PATCH V1 11/13] IB/ipoib: Use new " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (4 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:22 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

And remove sysfs file in favor of the common core.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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(-)

diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
index 565c881a44ba..c229b9f4a52d 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
@@ -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))
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
index 3412ea06116e..80ef3f8998c8 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
@@ -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,
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 11/13] IB/ipoib: Use new device FW version string
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (9 preceding siblings ...)
  2016-06-15  6:22   ` [PATCH V1 10/13] IB/usnic: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:22   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15  6:22   ` [PATCH V1 12/13] IB/core: Export a common fw_ver sysfs entry ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (3 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:22 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Using this allows for devices to specify the format of their
firmware version rather than forcing a format.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
index 1502199c8e56..7b6d40ff1acf 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
@@ -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));
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 12/13] IB/core: Export a common fw_ver sysfs entry
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (10 preceding siblings ...)
  2016-06-15  6:22   ` [PATCH V1 11/13] IB/ipoib: Use new " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:22   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15  6:22   ` [PATCH V1 13/13] IB/hfi1: Add device FW version string ira.weiny-ral2JQCrhuEAvxtiuMwx3w
                     ` (2 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:22 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

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.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

---
Changes from V0:
	Remove the use of the temp stack variable.
	Add trailing comma in attribute list

 drivers/infiniband/core/sysfs.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index a5793c8f1590..0d1ab73f8186 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -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>
@@ -1196,16 +1197,28 @@ 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)
+{
+	struct ib_device *dev = container_of(device, struct ib_device, dev);
+
+	ib_get_device_fw_str(dev, buf, PAGE_SIZE);
+	strlcat(buf, "\n", PAGE_SIZE);
+	return strlen(buf);
+}
+
 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)
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH V1 13/13] IB/hfi1: Add device FW version string
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (11 preceding siblings ...)
  2016-06-15  6:22   ` [PATCH V1 12/13] IB/core: Export a common fw_ver sysfs entry ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15  6:22   ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  2016-06-15 10:55   ` [PATCH V1 00/13] Create device FW version call back Leon Romanovsky
  2016-06-23 16:11   ` Doug Ledford
  14 siblings, 0 replies; 23+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-06-15  6:22 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ, Ira Weiny

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Export the firmware version through the core.

Acked-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hfi1/hfi.h   |  2 ++
 drivers/infiniband/hw/hfi1/verbs.c | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h
index 1dd48efb5b61..ac73206a8e18 100644
--- a/drivers/infiniband/hw/hfi1/hfi.h
+++ b/drivers/infiniband/hw/hfi1/hfi.h
@@ -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
diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c
index 849c4b9399d4..dd4be3c2b225 100644
--- a/drivers/infiniband/hw/hfi1/verbs.c
+++ b/drivers/infiniband/hw/hfi1/verbs.c
@@ -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));
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH V1 01/13] IB/core: Add get FW version string to the core
       [not found]     ` <1465971728-24104-2-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-06-15  6:40       ` Leon Romanovsky
       [not found]         ` <20160615064008.GS5408-2ukJVAZIZ/Y@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Leon Romanovsky @ 2016-06-15  6:40 UTC (permalink / raw)
  To: ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, swise-ut6Up61K2wZBDgjK7y7TUQ

[-- Attachment #1: Type: text/plain, Size: 1870 bytes --]

On Wed, Jun 15, 2016 at 02:21:56AM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> 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: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> ---
> Changes from V0:
> 	Add parameter names to function signature
> 	change default string assignment
> 
>  drivers/infiniband/core/device.c | 9 +++++++++
>  include/rdma/ib_verbs.h          | 3 +++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> index 5c155fa91eec..760ef603a468 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -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
> +		str[0] = '\0';

Interesting point, what is better for the caller to get as a version?
You chose empty string, but it can be all Fs or all 0s.

> +}
> +EXPORT_SYMBOL(ib_get_device_fw_str);

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH V1 00/13] Create device FW version call back
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (12 preceding siblings ...)
  2016-06-15  6:22   ` [PATCH V1 13/13] IB/hfi1: Add device FW version string ira.weiny-ral2JQCrhuEAvxtiuMwx3w
@ 2016-06-15 10:55   ` Leon Romanovsky
  2016-06-23 16:11   ` Doug Ledford
  14 siblings, 0 replies; 23+ messages in thread
From: Leon Romanovsky @ 2016-06-15 10:55 UTC (permalink / raw)
  To: ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, swise-ut6Up61K2wZBDgjK7y7TUQ

[-- Attachment #1: Type: text/plain, Size: 4116 bytes --]

On Wed, Jun 15, 2016 at 02:21:55AM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> 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.
> 
> ---
> Changes from V0:
> 	Address comments by Jason and Leon
> 	Rebase to upstream
> 	Add Reviewed-by for cxgb4
> 
> 
> 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              | 15 ++++++++++++-
>  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, 156 insertions(+), 130 deletions(-)

Such statistic (more insertions than deletions) doesn't look good for
common code.

Anyway, I'm fine with it, for mlx5/mlx4 and core:

Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

> 
> -- 
> 1.8.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [PATCH V1 02/13] IB/cxgb3: Support device FW version string
       [not found]     ` <1465971728-24104-3-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-06-15 14:21       ` Steve Wise
  2016-06-15 14:25         ` Weiny, Ira
  0 siblings, 1 reply; 23+ messages in thread
From: Steve Wise @ 2016-06-15 14:21 UTC (permalink / raw)
  To: ira.weiny-ral2JQCrhuEAvxtiuMwx3w, dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ

I reviewed this previously...

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [PATCH V1 02/13] IB/cxgb3: Support device FW version string
  2016-06-15 14:21       ` Steve Wise
@ 2016-06-15 14:25         ` Weiny, Ira
  0 siblings, 0 replies; 23+ messages in thread
From: Weiny, Ira @ 2016-06-15 14:25 UTC (permalink / raw)
  To: Steve Wise, dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg, Latif, Faisal,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ

I saw your response to cxgb4.  I was not sure if you meant for both or not.

Sorry I will add this too.

Ira

> -----Original Message-----
> From: Steve Wise [mailto:swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org]
> Sent: Wednesday, June 15, 2016 7:21 AM
> To: Weiny, Ira <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>; dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
> Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; dgoodell-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org;
> devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg@public.gmane.org; Latif, Faisal <faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>;
> matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org; leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org; swise-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org
> Subject: RE: [PATCH V1 02/13] IB/cxgb3: Support device FW version string
> 
> I reviewed this previously...
> 
> Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH V1 01/13] IB/core: Add get FW version string to the core
       [not found]         ` <20160615064008.GS5408-2ukJVAZIZ/Y@public.gmane.org>
@ 2016-06-15 15:20           ` ira.weiny
       [not found]             ` <20160615152048.GB8690-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: ira.weiny @ 2016-06-15 15:20 UTC (permalink / raw)
  To: leon-DgEjT+Ai2ygdnm+yROfE0A
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, swise-ut6Up61K2wZBDgjK7y7TUQ

On Wed, Jun 15, 2016 at 09:40:08AM +0300, Leon Romanovsky wrote:
> On Wed, Jun 15, 2016 at 02:21:56AM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> > From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

[snip]

> > 
> > diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> > index 5c155fa91eec..760ef603a468 100644
> > --- a/drivers/infiniband/core/device.c
> > +++ b/drivers/infiniband/core/device.c
> > @@ -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
> > +		str[0] = '\0';
> 
> Interesting point, what is better for the caller to get as a version?
> You chose empty string, but it can be all Fs or all 0s.

The default here is that a device does not provide a firmware string.  In that
case the assumption is that there is no firmware.  Hence the empty string.  I
don't think that reporting 0's or F's are appropriate if a device does not have
firmware.

In the cases you speak of I would expect the device to supply the firmware
function and report all 0s or all Fs for whatever version that may represent.
(I'm assuming that would be some sort of debug or unreleased firmware...)

I could just as well done something like.

snprintf(str, str_len, "<none>");

Which may be more informative?  I just don't want to get too wrapped up in the
policy here.  I think this is best left to the driver/hw vendor.

Ira

> 
> > +}
> > +EXPORT_SYMBOL(ib_get_device_fw_str);


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH V1 01/13] IB/core: Add get FW version string to the core
       [not found]             ` <20160615152048.GB8690-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
@ 2016-06-15 16:51               ` Jason Gunthorpe
       [not found]                 ` <20160615165106.GA10256-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Jason Gunthorpe @ 2016-06-15 16:51 UTC (permalink / raw)
  To: ira.weiny
  Cc: leon-DgEjT+Ai2ygdnm+yROfE0A, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, swise-ut6Up61K2wZBDgjK7y7TUQ

On Wed, Jun 15, 2016 at 11:20:49AM -0400, ira.weiny wrote:
> The default here is that a device does not provide a firmware string.  In that
> case the assumption is that there is no firmware.  Hence the empty string.  I
> don't think that reporting 0's or F's are appropriate if a device does not have
> firmware.
> 
> In the cases you speak of I would expect the device to supply the firmware
> function and report all 0s or all Fs for whatever version that may represent.
> (I'm assuming that would be some sort of debug or unreleased firmware...)
> 
> I could just as well done something like.
> 
> snprintf(str, str_len, "<none>");

Just don't provide a 'fw' sysfs file at all if the driver cannot
support it.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH V1 01/13] IB/core: Add get FW version string to the core
       [not found]                 ` <20160615165106.GA10256-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2016-06-15 23:26                   ` ira.weiny
       [not found]                     ` <20160615232602.GA4034-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: ira.weiny @ 2016-06-15 23:26 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: leon-DgEjT+Ai2ygdnm+yROfE0A, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, swise-ut6Up61K2wZBDgjK7y7TUQ

On Wed, Jun 15, 2016 at 10:51:06AM -0600, Jason Gunthorpe wrote:
> On Wed, Jun 15, 2016 at 11:20:49AM -0400, ira.weiny wrote:
> > The default here is that a device does not provide a firmware string.  In that
> > case the assumption is that there is no firmware.  Hence the empty string.  I
> > don't think that reporting 0's or F's are appropriate if a device does not have
> > firmware.
> > 
> > In the cases you speak of I would expect the device to supply the firmware
> > function and report all 0s or all Fs for whatever version that may represent.
> > (I'm assuming that would be some sort of debug or unreleased firmware...)
> > 
> > I could just as well done something like.
> > 
> > snprintf(str, str_len, "<none>");
> 
> Just don't provide a 'fw' sysfs file at all if the driver cannot
> support it.

This function is supporting both sysfs and ethtool.

ethtool_drvinfo->fw_version is normally up to the device.  I've just provided a
default.

For example I see "N/A", "n/a", and "none" all used in the network stack.

./ethernet/freescale/gianfar_ethtool.c: strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));

./rionet.c:     strlcpy(info->fw_version, "n/a", sizeof(info->fw_version));

./fjes/fjes_ethtool.c:  strlcpy(drvinfo->fw_version, "none", sizeof(drvinfo->fw_version));

I really think we are in the weeds here and are fine to leave it blank.

But if you wish, I can force all drivers to provide the string and then they can
put something in like the above.

Ira

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH V1 01/13] IB/core: Add get FW version string to the core
       [not found]                     ` <20160615232602.GA4034-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
@ 2016-06-16  9:46                       ` Leon Romanovsky
  0 siblings, 0 replies; 23+ messages in thread
From: Leon Romanovsky @ 2016-06-16  9:46 UTC (permalink / raw)
  To: ira.weiny
  Cc: Jason Gunthorpe, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, swise-ut6Up61K2wZBDgjK7y7TUQ

[-- Attachment #1: Type: text/plain, Size: 1698 bytes --]

On Wed, Jun 15, 2016 at 07:26:03PM -0400, ira.weiny wrote:
> On Wed, Jun 15, 2016 at 10:51:06AM -0600, Jason Gunthorpe wrote:
> > On Wed, Jun 15, 2016 at 11:20:49AM -0400, ira.weiny wrote:
> > > The default here is that a device does not provide a firmware string.  In that
> > > case the assumption is that there is no firmware.  Hence the empty string.  I
> > > don't think that reporting 0's or F's are appropriate if a device does not have
> > > firmware.
> > > 
> > > In the cases you speak of I would expect the device to supply the firmware
> > > function and report all 0s or all Fs for whatever version that may represent.
> > > (I'm assuming that would be some sort of debug or unreleased firmware...)
> > > 
> > > I could just as well done something like.
> > > 
> > > snprintf(str, str_len, "<none>");
> > 
> > Just don't provide a 'fw' sysfs file at all if the driver cannot
> > support it.
> 
> This function is supporting both sysfs and ethtool.
> 
> ethtool_drvinfo->fw_version is normally up to the device.  I've just provided a
> default.
> 
> For example I see "N/A", "n/a", and "none" all used in the network stack.
> 
> ./ethernet/freescale/gianfar_ethtool.c: strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
> 
> ./rionet.c:     strlcpy(info->fw_version, "n/a", sizeof(info->fw_version));
> 
> ./fjes/fjes_ethtool.c:  strlcpy(drvinfo->fw_version, "none", sizeof(drvinfo->fw_version));
> 
> I really think we are in the weeds here and are fine to leave it blank.

I'm fine with that.

> 
> But if you wish, I can force all drivers to provide the string and then they can
> put something in like the above.
> 
> Ira
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH V1 00/13] Create device FW version call back
       [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (13 preceding siblings ...)
  2016-06-15 10:55   ` [PATCH V1 00/13] Create device FW version call back Leon Romanovsky
@ 2016-06-23 16:11   ` Doug Ledford
  14 siblings, 0 replies; 23+ messages in thread
From: Doug Ledford @ 2016-06-23 16:11 UTC (permalink / raw)
  To: ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dgoodell-FYB4Gu1CFyUAvxtiuMwx3w,
	devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg,
	faisal.latif-ral2JQCrhuEAvxtiuMwx3w,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	swise-ut6Up61K2wZBDgjK7y7TUQ

[-- Attachment #1: Type: text/plain, Size: 3776 bytes --]

On 06/15/2016 02:21 AM, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> 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.
> 
> ---
> Changes from V0:
> 	Address comments by Jason and Leon
> 	Rebase to upstream
> 	Add Reviewed-by for cxgb4
> 
> 
> 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              | 15 ++++++++++++-
>  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, 156 insertions(+), 130 deletions(-)
> 

Thanks Ira, series taken in for 4.8.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2016-06-23 16:11 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15  6:21 [PATCH V1 00/13] Create device FW version call back ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found] ` <1465971728-24104-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-06-15  6:21   ` [PATCH V1 01/13] IB/core: Add get FW version string to the core ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1465971728-24104-2-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-06-15  6:40       ` Leon Romanovsky
     [not found]         ` <20160615064008.GS5408-2ukJVAZIZ/Y@public.gmane.org>
2016-06-15 15:20           ` ira.weiny
     [not found]             ` <20160615152048.GB8690-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-06-15 16:51               ` Jason Gunthorpe
     [not found]                 ` <20160615165106.GA10256-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-06-15 23:26                   ` ira.weiny
     [not found]                     ` <20160615232602.GA4034-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-06-16  9:46                       ` Leon Romanovsky
2016-06-15  6:21   ` [PATCH V1 02/13] IB/cxgb3: Support device FW version string ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1465971728-24104-3-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-06-15 14:21       ` Steve Wise
2016-06-15 14:25         ` Weiny, Ira
2016-06-15  6:21   ` [PATCH V1 03/13] IB/cxgb4: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-06-15  6:21   ` [PATCH V1 04/13] IB/i40iw: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-06-15  6:22   ` [PATCH V1 05/13] IB/mlx4: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-06-15  6:22   ` [PATCH V1 06/13] IB/mlx5: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-06-15  6:22   ` [PATCH V1 07/13] IB/mthca: Supprot " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-06-15  6:22   ` [PATCH V1 08/13] IB/nes: Support " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-06-15  6:22   ` [PATCH V1 09/13] IB/ocrdma: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-06-15  6:22   ` [PATCH V1 10/13] IB/usnic: " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-06-15  6:22   ` [PATCH V1 11/13] IB/ipoib: Use new " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-06-15  6:22   ` [PATCH V1 12/13] IB/core: Export a common fw_ver sysfs entry ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-06-15  6:22   ` [PATCH V1 13/13] IB/hfi1: Add device FW version string ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-06-15 10:55   ` [PATCH V1 00/13] Create device FW version call back Leon Romanovsky
2016-06-23 16:11   ` Doug Ledford

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.