|
|
2a1b01 |
From 4a86034f138e1a96e54047b8036b0a4425e99944 Mon Sep 17 00:00:00 2001
|
|
|
2a1b01 |
From: Ido Schimmel <idosch@nvidia.com>
|
|
|
2a1b01 |
Date: Tue, 23 Nov 2021 19:41:00 +0200
|
|
|
2a1b01 |
Subject: [PATCH 32/35] cmis: Print Module State and Fault Cause
|
|
|
2a1b01 |
|
|
|
2a1b01 |
Print the CMIS Module State when dumping EEPROM contents via the '-m'
|
|
|
2a1b01 |
option. It can be used, for example, to test module power mode settings.
|
|
|
2a1b01 |
|
|
|
2a1b01 |
Example output:
|
|
|
2a1b01 |
|
|
|
2a1b01 |
# ethtool -m swp11
|
|
|
2a1b01 |
Identifier : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628))
|
|
|
2a1b01 |
...
|
|
|
2a1b01 |
Module State : 0x03 (ModuleReady)
|
|
|
2a1b01 |
|
|
|
2a1b01 |
# ethtool --set-module swp11 power-mode-policy auto
|
|
|
2a1b01 |
|
|
|
2a1b01 |
# ethtool -m swp11
|
|
|
2a1b01 |
Identifier : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628))
|
|
|
2a1b01 |
...
|
|
|
2a1b01 |
Module State : 0x01 (ModuleLowPwr)
|
|
|
2a1b01 |
|
|
|
2a1b01 |
In case the module is in fault state, print the CMIS Module Fault Cause.
|
|
|
2a1b01 |
|
|
|
2a1b01 |
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
|
|
|
2a1b01 |
---
|
|
|
2a1b01 |
cmis.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
2a1b01 |
cmis.h | 16 ++++++++++++++
|
|
|
2a1b01 |
2 files changed, 86 insertions(+)
|
|
|
2a1b01 |
|
|
|
2a1b01 |
diff --git a/cmis.c b/cmis.c
|
|
|
2a1b01 |
index d7b7097139b3..a32cc9f8b1f6 100644
|
|
|
2a1b01 |
--- a/cmis.c
|
|
|
2a1b01 |
+++ b/cmis.c
|
|
|
2a1b01 |
@@ -402,6 +402,74 @@ static void cmis_show_vendor_info(const struct cmis_memory_map *map)
|
|
|
2a1b01 |
CMIS_CLEI_END_OFFSET, "CLEI code");
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
+/* Print the current Module State. Relevant documents:
|
|
|
2a1b01 |
+ * [1] CMIS Rev. 5, pag. 57, section 6.3.2.2, Figure 6-3
|
|
|
2a1b01 |
+ * [2] CMIS Rev. 5, pag. 60, section 6.3.2.3, Figure 6-4
|
|
|
2a1b01 |
+ * [3] CMIS Rev. 5, pag. 107, section 8.2.2, Table 8-6
|
|
|
2a1b01 |
+ */
|
|
|
2a1b01 |
+static void cmis_show_mod_state(const struct cmis_memory_map *map)
|
|
|
2a1b01 |
+{
|
|
|
2a1b01 |
+ __u8 mod_state;
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
+ mod_state = (map->lower_memory[CMIS_MODULE_STATE_OFFSET] &
|
|
|
2a1b01 |
+ CMIS_MODULE_STATE_MASK) >> 1;
|
|
|
2a1b01 |
+ printf("\t%-41s : 0x%02x", "Module State", mod_state);
|
|
|
2a1b01 |
+ switch (mod_state) {
|
|
|
2a1b01 |
+ case CMIS_MODULE_STATE_MODULE_LOW_PWR:
|
|
|
2a1b01 |
+ printf(" (ModuleLowPwr)\n");
|
|
|
2a1b01 |
+ break;
|
|
|
2a1b01 |
+ case CMIS_MODULE_STATE_MODULE_PWR_UP:
|
|
|
2a1b01 |
+ printf(" (ModulePwrUp)\n");
|
|
|
2a1b01 |
+ break;
|
|
|
2a1b01 |
+ case CMIS_MODULE_STATE_MODULE_READY:
|
|
|
2a1b01 |
+ printf(" (ModuleReady)\n");
|
|
|
2a1b01 |
+ break;
|
|
|
2a1b01 |
+ case CMIS_MODULE_STATE_MODULE_PWR_DN:
|
|
|
2a1b01 |
+ printf(" (ModulePwrDn)\n");
|
|
|
2a1b01 |
+ break;
|
|
|
2a1b01 |
+ case CMIS_MODULE_STATE_MODULE_FAULT:
|
|
|
2a1b01 |
+ printf(" (ModuleFault)\n");
|
|
|
2a1b01 |
+ break;
|
|
|
2a1b01 |
+ default:
|
|
|
2a1b01 |
+ printf(" (reserved or unknown)\n");
|
|
|
2a1b01 |
+ break;
|
|
|
2a1b01 |
+ }
|
|
|
2a1b01 |
+}
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
+/* Print the Module Fault Information. Relevant documents:
|
|
|
2a1b01 |
+ * [1] CMIS Rev. 5, pag. 64, section 6.3.2.12
|
|
|
2a1b01 |
+ * [2] CMIS Rev. 5, pag. 115, section 8.2.10, Table 8-15
|
|
|
2a1b01 |
+ */
|
|
|
2a1b01 |
+static void cmis_show_mod_fault_cause(const struct cmis_memory_map *map)
|
|
|
2a1b01 |
+{
|
|
|
2a1b01 |
+ __u8 mod_state, fault_cause;
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
+ mod_state = (map->lower_memory[CMIS_MODULE_STATE_OFFSET] &
|
|
|
2a1b01 |
+ CMIS_MODULE_STATE_MASK) >> 1;
|
|
|
2a1b01 |
+ if (mod_state != CMIS_MODULE_STATE_MODULE_FAULT)
|
|
|
2a1b01 |
+ return;
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
+ fault_cause = map->lower_memory[CMIS_MODULE_FAULT_OFFSET];
|
|
|
2a1b01 |
+ printf("\t%-41s : 0x%02x", "Module Fault Cause", fault_cause);
|
|
|
2a1b01 |
+ switch (fault_cause) {
|
|
|
2a1b01 |
+ case CMIS_MODULE_FAULT_NO_FAULT:
|
|
|
2a1b01 |
+ printf(" (No fault detected / not supported)\n");
|
|
|
2a1b01 |
+ break;
|
|
|
2a1b01 |
+ case CMIS_MODULE_FAULT_TEC_RUNAWAY:
|
|
|
2a1b01 |
+ printf(" (TEC runaway)\n");
|
|
|
2a1b01 |
+ break;
|
|
|
2a1b01 |
+ case CMIS_MODULE_FAULT_DATA_MEM_CORRUPTED:
|
|
|
2a1b01 |
+ printf(" (Data memory corrupted)\n");
|
|
|
2a1b01 |
+ break;
|
|
|
2a1b01 |
+ case CMIS_MODULE_FAULT_PROG_MEM_CORRUPTED:
|
|
|
2a1b01 |
+ printf(" (Program memory corrupted)\n");
|
|
|
2a1b01 |
+ break;
|
|
|
2a1b01 |
+ default:
|
|
|
2a1b01 |
+ printf(" (reserved or unknown)\n");
|
|
|
2a1b01 |
+ break;
|
|
|
2a1b01 |
+ }
|
|
|
2a1b01 |
+}
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
static void cmis_parse_dom_power_type(const struct cmis_memory_map *map,
|
|
|
2a1b01 |
struct sff_diags *sd)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
@@ -775,6 +843,8 @@ static void cmis_show_all_common(const struct cmis_memory_map *map)
|
|
|
2a1b01 |
cmis_show_link_len(map);
|
|
|
2a1b01 |
cmis_show_vendor_info(map);
|
|
|
2a1b01 |
cmis_show_rev_compliance(map);
|
|
|
2a1b01 |
+ cmis_show_mod_state(map);
|
|
|
2a1b01 |
+ cmis_show_mod_fault_cause(map);
|
|
|
2a1b01 |
cmis_show_dom(map);
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
diff --git a/cmis.h b/cmis.h
|
|
|
2a1b01 |
index 310697b0ef32..2c67ad5640ab 100644
|
|
|
2a1b01 |
--- a/cmis.h
|
|
|
2a1b01 |
+++ b/cmis.h
|
|
|
2a1b01 |
@@ -7,6 +7,15 @@
|
|
|
2a1b01 |
#define CMIS_MEMORY_MODEL_OFFSET 0x02
|
|
|
2a1b01 |
#define CMIS_MEMORY_MODEL_MASK 0x80
|
|
|
2a1b01 |
|
|
|
2a1b01 |
+/* Global Status Information (Page 0) */
|
|
|
2a1b01 |
+#define CMIS_MODULE_STATE_OFFSET 0x03
|
|
|
2a1b01 |
+#define CMIS_MODULE_STATE_MASK 0x0E
|
|
|
2a1b01 |
+#define CMIS_MODULE_STATE_MODULE_LOW_PWR 0x01
|
|
|
2a1b01 |
+#define CMIS_MODULE_STATE_MODULE_PWR_UP 0x02
|
|
|
2a1b01 |
+#define CMIS_MODULE_STATE_MODULE_READY 0x03
|
|
|
2a1b01 |
+#define CMIS_MODULE_STATE_MODULE_PWR_DN 0x04
|
|
|
2a1b01 |
+#define CMIS_MODULE_STATE_MODULE_FAULT 0x05
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
/* Module Flags (Page 0) */
|
|
|
2a1b01 |
#define CMIS_VCC_AW_OFFSET 0x09
|
|
|
2a1b01 |
#define CMIS_VCC_LWARN_STATUS 0x80
|
|
|
2a1b01 |
@@ -27,6 +36,13 @@
|
|
|
2a1b01 |
#define CMIS_CURR_TEMP_OFFSET 0x0E
|
|
|
2a1b01 |
#define CMIS_CURR_VCC_OFFSET 0x10
|
|
|
2a1b01 |
|
|
|
2a1b01 |
+/* Module Fault Information (Page 0) */
|
|
|
2a1b01 |
+#define CMIS_MODULE_FAULT_OFFSET 0x29
|
|
|
2a1b01 |
+#define CMIS_MODULE_FAULT_NO_FAULT 0x00
|
|
|
2a1b01 |
+#define CMIS_MODULE_FAULT_TEC_RUNAWAY 0x01
|
|
|
2a1b01 |
+#define CMIS_MODULE_FAULT_DATA_MEM_CORRUPTED 0x02
|
|
|
2a1b01 |
+#define CMIS_MODULE_FAULT_PROG_MEM_CORRUPTED 0x03
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
#define CMIS_CTOR_OFFSET 0xCB
|
|
|
2a1b01 |
|
|
|
2a1b01 |
/* Vendor related information (Page 0) */
|
|
|
2a1b01 |
--
|
|
|
2a1b01 |
2.35.1
|
|
|
2a1b01 |
|