Blame SOURCES/0033-cmis-Print-Module-Level-Controls.patch

89ea86
From 0b45f392c6c92e9823d6332622d7a45e7a36365e Mon Sep 17 00:00:00 2001
89ea86
From: Ido Schimmel <idosch@nvidia.com>
89ea86
Date: Tue, 23 Nov 2021 19:41:01 +0200
89ea86
Subject: [PATCH 33/35] cmis: Print Module-Level Controls
89ea86
89ea86
Print the CMIS Module-Level Controls when dumping EEPROM contents via
89ea86
the '-m' option. It can be used to understand low power mode enforcement
89ea86
by the host.
89ea86
89ea86
Example output:
89ea86
89ea86
 # ethtool -m swp11
89ea86
 Identifier                                : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628))
89ea86
 ...
89ea86
 Module State                              : 0x03 (ModuleReady)
89ea86
 LowPwrAllowRequestHW                      : Off
89ea86
 LowPwrRequestSW                           : Off
89ea86
 ...
89ea86
 Transmit avg optical power (Channel 1)    : 1.3222 mW / 1.21 dBm
89ea86
 Transmit avg optical power (Channel 2)    : 1.2666 mW / 1.03 dBm
89ea86
 Transmit avg optical power (Channel 3)    : 1.2860 mW / 1.09 dBm
89ea86
 Transmit avg optical power (Channel 4)    : 1.2988 mW / 1.14 dBm
89ea86
 Transmit avg optical power (Channel 5)    : 1.2828 mW / 1.08 dBm
89ea86
 Transmit avg optical power (Channel 6)    : 1.2913 mW / 1.11 dBm
89ea86
 Transmit avg optical power (Channel 7)    : 1.2636 mW / 1.02 dBm
89ea86
 Transmit avg optical power (Channel 8)    : 1.3408 mW / 1.27 dBm
89ea86
 Transmit avg optical power (Channel 9)    : 1.3222 mW / 1.21 dBm
89ea86
 Transmit avg optical power (Channel 10)   : 1.2666 mW / 1.03 dBm
89ea86
 Transmit avg optical power (Channel 11)   : 1.2860 mW / 1.09 dBm
89ea86
 Transmit avg optical power (Channel 12)   : 1.2988 mW / 1.14 dBm
89ea86
 Transmit avg optical power (Channel 13)   : 1.2828 mW / 1.08 dBm
89ea86
 Transmit avg optical power (Channel 14)   : 1.2913 mW / 1.11 dBm
89ea86
 Transmit avg optical power (Channel 15)   : 1.2636 mW / 1.02 dBm
89ea86
 Transmit avg optical power (Channel 16)   : 1.3408 mW / 1.27 dBm
89ea86
 Rcvr signal avg optical power (Channel 1) : 1.1351 mW / 0.55 dBm
89ea86
 Rcvr signal avg optical power (Channel 2) : 1.1603 mW / 0.65 dBm
89ea86
 Rcvr signal avg optical power (Channel 3) : 1.1529 mW / 0.62 dBm
89ea86
 Rcvr signal avg optical power (Channel 4) : 1.1670 mW / 0.67 dBm
89ea86
 Rcvr signal avg optical power (Channel 5) : 1.1759 mW / 0.70 dBm
89ea86
 Rcvr signal avg optical power (Channel 6) : 1.1744 mW / 0.70 dBm
89ea86
 Rcvr signal avg optical power (Channel 7) : 1.1188 mW / 0.49 dBm
89ea86
 Rcvr signal avg optical power (Channel 8) : 1.1640 mW / 0.66 dBm
89ea86
 Rcvr signal avg optical power (Channel 9) : 1.1351 mW / 0.55 dBm
89ea86
 Rcvr signal avg optical power (Channel 10) : 1.1603 mW / 0.65 dBm
89ea86
 Rcvr signal avg optical power (Channel 11) : 1.1529 mW / 0.62 dBm
89ea86
 Rcvr signal avg optical power (Channel 12) : 1.1670 mW / 0.67 dBm
89ea86
 Rcvr signal avg optical power (Channel 13) : 1.1759 mW / 0.70 dBm
89ea86
 Rcvr signal avg optical power (Channel 14) : 1.1744 mW / 0.70 dBm
89ea86
 Rcvr signal avg optical power (Channel 15) : 1.1188 mW / 0.49 dBm
89ea86
 Rcvr signal avg optical power (Channel 16) : 1.1640 mW / 0.66 dBm
89ea86
89ea86
 # ethtool --set-module swp11 power-mode-policy auto
89ea86
89ea86
 # ethtool -m swp11
89ea86
 Identifier                                : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628))
89ea86
 ...
89ea86
 Module State                              : 0x01 (ModuleLowPwr)
89ea86
 LowPwrAllowRequestHW                      : Off
89ea86
 LowPwrRequestSW                           : On
89ea86
 ...
89ea86
 Transmit avg optical power (Channel 1)    : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 2)    : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 3)    : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 4)    : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 5)    : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 6)    : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 7)    : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 8)    : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 9)    : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 10)   : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 11)   : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 12)   : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 13)   : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 14)   : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 15)   : 0.0001 mW / -40.00 dBm
89ea86
 Transmit avg optical power (Channel 16)   : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 1) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 2) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 3) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 4) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 5) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 6) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 7) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 8) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 9) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 10) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 11) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 12) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 13) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 14) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 15) : 0.0001 mW / -40.00 dBm
89ea86
 Rcvr signal avg optical power (Channel 16) : 0.0001 mW / -40.00 dBm
89ea86
89ea86
 # ethtool --set-module swp11 power-mode-policy high
89ea86
89ea86
 # ethtool -m swp11
89ea86
 Identifier                                : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628))
89ea86
 ...
89ea86
 Module State                              : 0x03 (ModuleReady)
89ea86
 LowPwrAllowRequestHW                      : Off
89ea86
 LowPwrRequestSW                           : Off
89ea86
 ...
89ea86
 Transmit avg optical power (Channel 1)    : 1.3690 mW / 1.36 dBm
89ea86
 Transmit avg optical power (Channel 2)    : 1.3036 mW / 1.15 dBm
89ea86
 Transmit avg optical power (Channel 3)    : 1.3358 mW / 1.26 dBm
89ea86
 Transmit avg optical power (Channel 4)    : 1.3509 mW / 1.31 dBm
89ea86
 Transmit avg optical power (Channel 5)    : 1.3193 mW / 1.20 dBm
89ea86
 Transmit avg optical power (Channel 6)    : 1.3314 mW / 1.24 dBm
89ea86
 Transmit avg optical power (Channel 7)    : 1.3042 mW / 1.15 dBm
89ea86
 Transmit avg optical power (Channel 8)    : 1.3919 mW / 1.44 dBm
89ea86
 Transmit avg optical power (Channel 9)    : 1.3690 mW / 1.36 dBm
89ea86
 Transmit avg optical power (Channel 10)   : 1.3036 mW / 1.15 dBm
89ea86
 Transmit avg optical power (Channel 11)   : 1.3358 mW / 1.26 dBm
89ea86
 Transmit avg optical power (Channel 12)   : 1.3509 mW / 1.31 dBm
89ea86
 Transmit avg optical power (Channel 13)   : 1.3193 mW / 1.20 dBm
89ea86
 Transmit avg optical power (Channel 14)   : 1.3314 mW / 1.24 dBm
89ea86
 Transmit avg optical power (Channel 15)   : 1.3042 mW / 1.15 dBm
89ea86
 Transmit avg optical power (Channel 16)   : 1.3919 mW / 1.44 dBm
89ea86
 Rcvr signal avg optical power (Channel 1) : 1.1299 mW / 0.53 dBm
89ea86
 Rcvr signal avg optical power (Channel 2) : 1.1566 mW / 0.63 dBm
89ea86
 Rcvr signal avg optical power (Channel 3) : 1.1484 mW / 0.60 dBm
89ea86
 Rcvr signal avg optical power (Channel 4) : 1.1655 mW / 0.67 dBm
89ea86
 Rcvr signal avg optical power (Channel 5) : 1.1751 mW / 0.70 dBm
89ea86
 Rcvr signal avg optical power (Channel 6) : 1.1595 mW / 0.64 dBm
89ea86
 Rcvr signal avg optical power (Channel 7) : 1.1158 mW / 0.48 dBm
89ea86
 Rcvr signal avg optical power (Channel 8) : 1.1595 mW / 0.64 dBm
89ea86
 Rcvr signal avg optical power (Channel 9) : 1.1299 mW / 0.53 dBm
89ea86
 Rcvr signal avg optical power (Channel 10) : 1.1566 mW / 0.63 dBm
89ea86
 Rcvr signal avg optical power (Channel 11) : 1.1484 mW / 0.60 dBm
89ea86
 Rcvr signal avg optical power (Channel 12) : 1.1655 mW / 0.67 dBm
89ea86
 Rcvr signal avg optical power (Channel 13) : 1.1751 mW / 0.70 dBm
89ea86
 Rcvr signal avg optical power (Channel 14) : 1.1595 mW / 0.64 dBm
89ea86
 Rcvr signal avg optical power (Channel 15) : 1.1158 mW / 0.48 dBm
89ea86
 Rcvr signal avg optical power (Channel 16) : 1.1595 mW / 0.64 dBm
89ea86
89ea86
In the above example, the LowPwrRequestHW signal is ignored and low
89ea86
power mode is controlled via software only.
89ea86
89ea86
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
89ea86
---
89ea86
 cmis.c | 15 +++++++++++++++
89ea86
 cmis.h |  5 +++++
89ea86
 2 files changed, 20 insertions(+)
89ea86
89ea86
diff --git a/cmis.c b/cmis.c
89ea86
index a32cc9f8b1f6..d0b62728e998 100644
89ea86
--- a/cmis.c
89ea86
+++ b/cmis.c
89ea86
@@ -470,6 +470,20 @@ static void cmis_show_mod_fault_cause(const struct cmis_memory_map *map)
89ea86
 	}
89ea86
 }
89ea86
 
89ea86
+/* Print the current Module-Level Controls. Relevant documents:
89ea86
+ * [1] CMIS Rev. 5, pag. 58, section 6.3.2.2, Table 6-12
89ea86
+ * [2] CMIS Rev. 5, pag. 111, section 8.2.6, Table 8-10
89ea86
+ */
89ea86
+static void cmis_show_mod_lvl_controls(const struct cmis_memory_map *map)
89ea86
+{
89ea86
+	printf("\t%-41s : ", "LowPwrAllowRequestHW");
89ea86
+	printf("%s\n", ONOFF(map->lower_memory[CMIS_MODULE_CONTROL_OFFSET] &
89ea86
+			     CMIS_LOW_PWR_ALLOW_REQUEST_HW_MASK));
89ea86
+	printf("\t%-41s : ", "LowPwrRequestSW");
89ea86
+	printf("%s\n", ONOFF(map->lower_memory[CMIS_MODULE_CONTROL_OFFSET] &
89ea86
+			     CMIS_LOW_PWR_REQUEST_SW_MASK));
89ea86
+}
89ea86
+
89ea86
 static void cmis_parse_dom_power_type(const struct cmis_memory_map *map,
89ea86
 				      struct sff_diags *sd)
89ea86
 {
89ea86
@@ -845,6 +859,7 @@ static void cmis_show_all_common(const struct cmis_memory_map *map)
89ea86
 	cmis_show_rev_compliance(map);
89ea86
 	cmis_show_mod_state(map);
89ea86
 	cmis_show_mod_fault_cause(map);
89ea86
+	cmis_show_mod_lvl_controls(map);
89ea86
 	cmis_show_dom(map);
89ea86
 }
89ea86
 
89ea86
diff --git a/cmis.h b/cmis.h
89ea86
index 2c67ad5640ab..46797081f13c 100644
89ea86
--- a/cmis.h
89ea86
+++ b/cmis.h
89ea86
@@ -36,6 +36,11 @@
89ea86
 #define CMIS_CURR_TEMP_OFFSET			0x0E
89ea86
 #define CMIS_CURR_VCC_OFFSET			0x10
89ea86
 
89ea86
+/* Module Global Controls (Page 0) */
89ea86
+#define CMIS_MODULE_CONTROL_OFFSET		0x1A
89ea86
+#define CMIS_LOW_PWR_ALLOW_REQUEST_HW_MASK	0x40
89ea86
+#define CMIS_LOW_PWR_REQUEST_SW_MASK		0x10
89ea86
+
89ea86
 /* Module Fault Information (Page 0) */
89ea86
 #define CMIS_MODULE_FAULT_OFFSET		0x29
89ea86
 #define CMIS_MODULE_FAULT_NO_FAULT		0x00
89ea86
-- 
89ea86
2.35.1
89ea86