All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/hfi1: Fetch monitor values on-demand for CableInfo query
@ 2016-08-09 15:17 ira.weiny-ral2JQCrhuEAvxtiuMwx3w
       [not found] ` <1470755838-14117-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-08-09 15:17 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Easwar Hariharan

From: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

The monitor values from bytes 22 through 81 of the QSFP memory space
(SFF 8636) are dynamic and serving them out of the QSFP memory cache
maintained by the driver provides stale data to the CableInfo SMA query.
This patch refreshes the dynamic values from the QSFP memory on request
and overwrites the stale data from the cache for the overlap between the
requested range and the monitor range.


Reviewed-by: Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hfi1/qsfp.c | 32 ++++++++++++++++++++++++++++++--
 drivers/infiniband/hw/hfi1/qsfp.h |  3 +++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/qsfp.c b/drivers/infiniband/hw/hfi1/qsfp.c
index a207717ade2a..4e95ad810847 100644
--- a/drivers/infiniband/hw/hfi1/qsfp.c
+++ b/drivers/infiniband/hw/hfi1/qsfp.c
@@ -706,8 +706,8 @@ int get_cable_info(struct hfi1_devdata *dd, u32 port_num, u32 addr, u32 len,
 		   u8 *data)
 {
 	struct hfi1_pportdata *ppd;
-	u32 excess_len = 0;
-	int ret = 0;
+	u32 excess_len = len;
+	int ret = 0, offset = 0;
 
 	if (port_num > dd->num_pports || port_num < 1) {
 		dd_dev_info(dd, "%s: Invalid port number %d\n",
@@ -740,6 +740,34 @@ int get_cable_info(struct hfi1_devdata *dd, u32 port_num, u32 addr, u32 len,
 	}
 
 	memcpy(data, &ppd->qsfp_info.cache[addr], len);
+
+	if (addr <= QSFP_MONITOR_VAL_END &&
+	    (addr + len) >= QSFP_MONITOR_VAL_START) {
+		/* Overlap with the dynamic channel monitor range */
+		if (addr < QSFP_MONITOR_VAL_START) {
+			if (addr + len <= QSFP_MONITOR_VAL_END)
+				len = addr + len - QSFP_MONITOR_VAL_START;
+			else
+				len = QSFP_MONITOR_RANGE;
+			offset = QSFP_MONITOR_VAL_START - addr;
+			addr = QSFP_MONITOR_VAL_START;
+		} else if (addr == QSFP_MONITOR_VAL_START) {
+			offset = 0;
+			if (addr + len > QSFP_MONITOR_VAL_END)
+				len = QSFP_MONITOR_RANGE;
+		} else {
+			offset = 0;
+			if (addr + len > QSFP_MONITOR_VAL_END)
+				len = QSFP_MONITOR_VAL_END - addr + 1;
+		}
+		/* Refresh the values of the dynamic monitors from the cable */
+		ret = one_qsfp_read(ppd, dd->hfi1_id, addr, data + offset, len);
+		if (ret != len) {
+			ret = -EAGAIN;
+			goto set_zeroes;
+		}
+	}
+
 	return 0;
 
 set_zeroes:
diff --git a/drivers/infiniband/hw/hfi1/qsfp.h b/drivers/infiniband/hw/hfi1/qsfp.h
index 69275ebd9597..36cf52359848 100644
--- a/drivers/infiniband/hw/hfi1/qsfp.h
+++ b/drivers/infiniband/hw/hfi1/qsfp.h
@@ -74,6 +74,9 @@
 /* Defined fields that Intel requires of qualified cables */
 /* Byte 0 is Identifier, not checked */
 /* Byte 1 is reserved "status MSB" */
+#define QSFP_MONITOR_VAL_START 22
+#define QSFP_MONITOR_VAL_END 81
+#define QSFP_MONITOR_RANGE (QSFP_MONITOR_VAL_END - QSFP_MONITOR_VAL_START + 1)
 #define QSFP_TX_CTRL_BYTE_OFFS 86
 #define QSFP_PWR_CTRL_BYTE_OFFS 93
 #define QSFP_CDR_CTRL_BYTE_OFFS 98
-- 
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] 8+ messages in thread

* Re: [PATCH] IB/hfi1: Fetch monitor values on-demand for CableInfo query
       [not found] ` <1470755838-14117-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-08-09 17:58   ` Leon Romanovsky
       [not found]     ` <20160809175801.GD23921-2ukJVAZIZ/Y@public.gmane.org>
  2016-08-22 18:22   ` Doug Ledford
  1 sibling, 1 reply; 8+ messages in thread
From: Leon Romanovsky @ 2016-08-09 17:58 UTC (permalink / raw)
  To: ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Easwar Hariharan

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

On Tue, Aug 09, 2016 at 11:17:18AM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> From: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> The monitor values from bytes 22 through 81 of the QSFP memory space
> (SFF 8636) are dynamic and serving them out of the QSFP memory cache
> maintained by the driver provides stale data to the CableInfo SMA query.
> This patch refreshes the dynamic values from the QSFP memory on request
> and overwrites the stale data from the cache for the overlap between the
> requested range and the monitor range.
> 
> 

Ira,
On all your patches, you have double line between commit message and
tags.

> Reviewed-by: Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

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

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

* Re: [PATCH] IB/hfi1: Fetch monitor values on-demand for CableInfo query
       [not found]     ` <20160809175801.GD23921-2ukJVAZIZ/Y@public.gmane.org>
@ 2016-08-10  5:35       ` ira.weiny
       [not found]         ` <20160810053549.GA32695-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: ira.weiny @ 2016-08-10  5:35 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Easwar Hariharan

On Tue, Aug 09, 2016 at 08:58:01PM +0300, Leon Romanovsky wrote:
> On Tue, Aug 09, 2016 at 11:17:18AM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> > From: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > 
> > The monitor values from bytes 22 through 81 of the QSFP memory space
> > (SFF 8636) are dynamic and serving them out of the QSFP memory cache
> > maintained by the driver provides stale data to the CableInfo SMA query.
> > This patch refreshes the dynamic values from the QSFP memory on request
> > and overwrites the stale data from the cache for the overlap between the
> > requested range and the monitor range.
> > 
> > 
> 
> Ira,
> On all your patches, you have double line between commit message and
> tags.

Does this cause a problem?

Ira

> 
> > Reviewed-by: Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Signed-off-by: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@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] 8+ messages in thread

* Re: [PATCH] IB/hfi1: Fetch monitor values on-demand for CableInfo query
       [not found]         ` <20160810053549.GA32695-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
@ 2016-08-10  5:51           ` Leon Romanovsky
       [not found]             ` <20160810055138.GH23921-2ukJVAZIZ/Y@public.gmane.org>
  2016-08-10 10:19           ` Leon Romanovsky
  1 sibling, 1 reply; 8+ messages in thread
From: Leon Romanovsky @ 2016-08-10  5:51 UTC (permalink / raw)
  To: ira.weiny
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Easwar Hariharan

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

On Wed, Aug 10, 2016 at 01:35:50AM -0400, ira.weiny wrote:
> On Tue, Aug 09, 2016 at 08:58:01PM +0300, Leon Romanovsky wrote:
> > On Tue, Aug 09, 2016 at 11:17:18AM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> > > From: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > > 
> > > The monitor values from bytes 22 through 81 of the QSFP memory space
> > > (SFF 8636) are dynamic and serving them out of the QSFP memory cache
> > > maintained by the driver provides stale data to the CableInfo SMA query.
> > > This patch refreshes the dynamic values from the QSFP memory on request
> > > and overwrites the stale data from the cache for the overlap between the
> > > requested range and the monitor range.
> > > 
> > > 
> > 
> > Ira,
> > On all your patches, you have double line between commit message and
> > tags.
> 
> Does this cause a problem?

Problem - no, inconvenience - yes.
It doesn't look pretty in git history.

> 
> Ira
> 
> > 
> > > Reviewed-by: Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > > Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > > Signed-off-by: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> 

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

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

* Re: [PATCH] IB/hfi1: Fetch monitor values on-demand for CableInfo query
       [not found]         ` <20160810053549.GA32695-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
  2016-08-10  5:51           ` Leon Romanovsky
@ 2016-08-10 10:19           ` Leon Romanovsky
  1 sibling, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2016-08-10 10:19 UTC (permalink / raw)
  To: ira.weiny
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Easwar Hariharan

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

On Wed, Aug 10, 2016 at 01:35:50AM -0400, ira.weiny wrote:
> On Tue, Aug 09, 2016 at 08:58:01PM +0300, Leon Romanovsky wrote:
> > On Tue, Aug 09, 2016 at 11:17:18AM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> > > From: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > > 
> > > The monitor values from bytes 22 through 81 of the QSFP memory space
> > > (SFF 8636) are dynamic and serving them out of the QSFP memory cache
> > > maintained by the driver provides stale data to the CableInfo SMA query.
> > > This patch refreshes the dynamic values from the QSFP memory on request
> > > and overwrites the stale data from the cache for the overlap between the
> > > requested range and the monitor range.
> > > 
> > > 
> > 
> > Ira,
> > On all your patches, you have double line between commit message and
> > tags.
> 
> Does this cause a problem?

Problem - no, inconvenience - yes.
It doesn't look good in git history.

> 
> Ira
> 
> > 
> > > Reviewed-by: Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > > Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > > Signed-off-by: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> 

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

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

* Re: [PATCH] IB/hfi1: Fetch monitor values on-demand for CableInfo query
       [not found]             ` <20160810055138.GH23921-2ukJVAZIZ/Y@public.gmane.org>
@ 2016-08-10 19:07               ` Dalessandro, Dennis
       [not found]                 ` <1470856029.9289.11.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Dalessandro, Dennis @ 2016-08-10 19:07 UTC (permalink / raw)
  To: leon-DgEjT+Ai2ygdnm+yROfE0A, Weiny, Ira
  Cc: Dalessandro, Dennis, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dledford-H+wXaHxf7aLQT0dZR+AlfA, Hariharan, Easwar

On Wed, 2016-08-10 at 08:51 +0300, Leon Romanovsky wrote:
> On Wed, Aug 10, 2016 at 01:35:50AM -0400, ira.weiny wrote:
> > On Tue, Aug 09, 2016 at 08:58:01PM +0300, Leon Romanovsky wrote:
> > > On Tue, Aug 09, 2016 at 11:17:18AM -0400, ira.weiny@intel.com
> > > wrote:
> > > > From: Easwar Hariharan <easwar.hariharan@intel.com>
> > > > 
> > > > The monitor values from bytes 22 through 81 of the QSFP memory
> > > > space
> > > > (SFF 8636) are dynamic and serving them out of the QSFP memory
> > > > cache
> > > > maintained by the driver provides stale data to the CableInfo
> > > > SMA query.
> > > > This patch refreshes the dynamic values from the QSFP memory on
> > > > request
> > > > and overwrites the stale data from the cache for the overlap
> > > > between the
> > > > requested range and the monitor range.
> > > > 
> > > > 
> > > 
> > > Ira,
> > > On all your patches, you have double line between commit message
> > > and
> > > tags.
> > 
> > Does this cause a problem?
> 
> Problem - no, inconvenience - yes.
> It doesn't look pretty in git history.

We'll catch it next time? Not worth resubmitting I don't think.

-Denny

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

* Re: [PATCH] IB/hfi1: Fetch monitor values on-demand for CableInfo query
       [not found]                 ` <1470856029.9289.11.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-08-11  5:07                   ` Leon Romanovsky
  0 siblings, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2016-08-11  5:07 UTC (permalink / raw)
  To: Dalessandro, Dennis
  Cc: Weiny, Ira, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	dledford-H+wXaHxf7aLQT0dZR+AlfA, Hariharan, Easwar

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

On Wed, Aug 10, 2016 at 07:07:12PM +0000, Dalessandro, Dennis wrote:
> On Wed, 2016-08-10 at 08:51 +0300, Leon Romanovsky wrote:
> > On Wed, Aug 10, 2016 at 01:35:50AM -0400, ira.weiny wrote:
> > > On Tue, Aug 09, 2016 at 08:58:01PM +0300, Leon Romanovsky wrote:
> > > > On Tue, Aug 09, 2016 at 11:17:18AM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
> > > > wrote:
> > > > > From: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > > > > 
> > > > > The monitor values from bytes 22 through 81 of the QSFP memory
> > > > > space
> > > > > (SFF 8636) are dynamic and serving them out of the QSFP memory
> > > > > cache
> > > > > maintained by the driver provides stale data to the CableInfo
> > > > > SMA query.
> > > > > This patch refreshes the dynamic values from the QSFP memory on
> > > > > request
> > > > > and overwrites the stale data from the cache for the overlap
> > > > > between the
> > > > > requested range and the monitor range.
> > > > > 
> > > > > 
> > > > 
> > > > Ira,
> > > > On all your patches, you have double line between commit message
> > > > and
> > > > tags.
> > > 
> > > Does this cause a problem?
> > 
> > Problem - no, inconvenience - yes.
> > It doesn't look pretty in git history.
> 
> We'll catch it next time? Not worth resubmitting I don't think.

Sure, no problems.

> 
> -Denny

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

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

* Re: [PATCH] IB/hfi1: Fetch monitor values on-demand for CableInfo query
       [not found] ` <1470755838-14117-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2016-08-09 17:58   ` Leon Romanovsky
@ 2016-08-22 18:22   ` Doug Ledford
  1 sibling, 0 replies; 8+ messages in thread
From: Doug Ledford @ 2016-08-22 18:22 UTC (permalink / raw)
  To: ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Easwar Hariharan


[-- Attachment #1.1: Type: text/plain, Size: 964 bytes --]

On 8/9/2016 11:17 AM, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> From: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> The monitor values from bytes 22 through 81 of the QSFP memory space
> (SFF 8636) are dynamic and serving them out of the QSFP memory cache
> maintained by the driver provides stale data to the CableInfo SMA query.
> This patch refreshes the dynamic values from the QSFP memory on request
> and overwrites the stale data from the cache for the overlap between the
> requested range and the monitor range.
> 
> 
> Reviewed-by: Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Easwar Hariharan <easwar.hariharan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Thanks, applied.


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


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

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

end of thread, other threads:[~2016-08-22 18:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-09 15:17 [PATCH] IB/hfi1: Fetch monitor values on-demand for CableInfo query ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found] ` <1470755838-14117-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-09 17:58   ` Leon Romanovsky
     [not found]     ` <20160809175801.GD23921-2ukJVAZIZ/Y@public.gmane.org>
2016-08-10  5:35       ` ira.weiny
     [not found]         ` <20160810053549.GA32695-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-08-10  5:51           ` Leon Romanovsky
     [not found]             ` <20160810055138.GH23921-2ukJVAZIZ/Y@public.gmane.org>
2016-08-10 19:07               ` Dalessandro, Dennis
     [not found]                 ` <1470856029.9289.11.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-11  5:07                   ` Leon Romanovsky
2016-08-10 10:19           ` Leon Romanovsky
2016-08-22 18:22   ` 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.