[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230613050507.1899596-2-kuba@kernel.org>
Date: Mon, 12 Jun 2023 22:05:07 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: mkubecek@...e.cz,
idosch@...dia.com
Cc: danieller@...dia.com,
netdev@...r.kernel.org,
vladyslavt@...dia.com,
linux@...linux.org.uk,
andrew@...n.ch,
Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH ethtool-next v2 2/2] cmis: report LOL / LOS / Tx Fault
Report whether Loss of Lock, of Signal and Tx Faults were detected.
Print "None" in case no lane has the problem, and per-lane "Yes" /
"No" if at least one of the lanes reports true.
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
Turns out I don't have access to any host with CMIS optics at this
point so untested. I can only confirm it correctly shows nothing
with a DAC...
---
cmis.c | 39 +++++++++++++++++++++++++++++++++++++++
cmis.h | 17 +++++++++++++++++
2 files changed, 56 insertions(+)
diff --git a/cmis.c b/cmis.c
index d0b62728e998..531932ee7eeb 100644
--- a/cmis.c
+++ b/cmis.c
@@ -139,6 +139,44 @@ static void cmis_show_rev_compliance(const struct cmis_memory_map *map)
printf("\t%-41s : Rev. %d.%d\n", "Revision compliance", major, minor);
}
+static void
+cmis_show_signals_one(const struct cmis_memory_map *map, const char *name,
+ int off, int ioff, unsigned int imask)
+{
+ unsigned int v;
+ int i;
+
+ if (!map->page_01h)
+ return;
+
+ v = 0;
+ for (i = 0; i < CMIS_MAX_BANKS && map->upper_memory[i][0x11]; i++)
+ v |= map->upper_memory[i][0x11][off] << (i * 8);
+
+ if (map->page_01h[ioff] & imask)
+ sff_show_lane_status(name, i * 8, "Yes", "No", v);
+}
+
+static void cmis_show_signals(const struct cmis_memory_map *map)
+{
+ cmis_show_signals_one(map, "Rx loss of signal", CMIS_RX_LOS_OFFSET,
+ CMIS_DIAG_FLAGS_RX_OFFSET, CMIS_DIAG_FL_RX_LOS);
+ cmis_show_signals_one(map, "Tx loss of signal", CMIS_TX_LOS_OFFSET,
+ CMIS_DIAG_FLAGS_TX_OFFSET, CMIS_DIAG_FL_TX_LOS);
+
+ cmis_show_signals_one(map, "Rx loss of lock", CMIS_RX_LOL_OFFSET,
+ CMIS_DIAG_FLAGS_RX_OFFSET, CMIS_DIAG_FL_RX_LOL);
+ cmis_show_signals_one(map, "Tx loss of lock", CMIS_TX_LOL_OFFSET,
+ CMIS_DIAG_FLAGS_TX_OFFSET, CMIS_DIAG_FL_TX_LOL);
+
+ cmis_show_signals_one(map, "Tx fault", CMIS_TX_FAIL_OFFSET,
+ CMIS_DIAG_FLAGS_TX_OFFSET, CMIS_DIAG_FL_TX_FAIL);
+
+ cmis_show_signals_one(map, "Tx adaptive eq fault",
+ CMIS_TX_EQ_FAIL_OFFSET, CMIS_DIAG_FLAGS_TX_OFFSET,
+ CMIS_DIAG_FL_TX_ADAPTIVE_EQ_FAIL);
+}
+
/**
* Print information about the device's power consumption.
* Relevant documents:
@@ -857,6 +895,7 @@ static void cmis_show_all_common(const struct cmis_memory_map *map)
cmis_show_link_len(map);
cmis_show_vendor_info(map);
cmis_show_rev_compliance(map);
+ cmis_show_signals(map);
cmis_show_mod_state(map);
cmis_show_mod_fault_cause(map);
cmis_show_mod_lvl_controls(map);
diff --git a/cmis.h b/cmis.h
index 46797081f13c..8d66f92dd971 100644
--- a/cmis.h
+++ b/cmis.h
@@ -158,6 +158,17 @@
#define CMIS_DIAG_TYPE_OFFSET 0x97
#define CMIS_RX_PWR_TYPE_MASK 0x10
+/* Supported Flags Advertisement (Page 1) */
+#define CMIS_DIAG_FLAGS_TX_OFFSET 0x9d
+#define CMIS_DIAG_FL_TX_ADAPTIVE_EQ_FAIL (1 << 3)
+#define CMIS_DIAG_FL_TX_LOL (1 << 2)
+#define CMIS_DIAG_FL_TX_LOS (1 << 1)
+#define CMIS_DIAG_FL_TX_FAIL (1 << 0)
+
+#define CMIS_DIAG_FLAGS_RX_OFFSET 0x9e
+#define CMIS_DIAG_FL_RX_LOL (1 << 2)
+#define CMIS_DIAG_FL_RX_LOS (1 << 1)
+
/* Supported Monitors Advertisement (Page 1) */
#define CMIS_DIAG_CHAN_ADVER_OFFSET 0xA0
#define CMIS_TX_BIAS_MON_MASK 0x01
@@ -207,6 +218,10 @@
*/
/* Media Lane-Specific Flags (Page 0x11) */
+#define CMIS_TX_FAIL_OFFSET 0x87
+#define CMIS_TX_LOS_OFFSET 0x88
+#define CMIS_TX_LOL_OFFSET 0x89
+#define CMIS_TX_EQ_FAIL_OFFSET 0x8a
#define CMIS_TX_PWR_AW_HALARM_OFFSET 0x8B
#define CMIS_TX_PWR_AW_LALARM_OFFSET 0x8C
#define CMIS_TX_PWR_AW_HWARN_OFFSET 0x8D
@@ -215,6 +230,8 @@
#define CMIS_TX_BIAS_AW_LALARM_OFFSET 0x90
#define CMIS_TX_BIAS_AW_HWARN_OFFSET 0x91
#define CMIS_TX_BIAS_AW_LWARN_OFFSET 0x92
+#define CMIS_RX_LOS_OFFSET 0x93
+#define CMIS_RX_LOL_OFFSET 0x94
#define CMIS_RX_PWR_AW_HALARM_OFFSET 0x95
#define CMIS_RX_PWR_AW_LALARM_OFFSET 0x96
#define CMIS_RX_PWR_AW_HWARN_OFFSET 0x97
--
2.40.1
Powered by blists - more mailing lists