Thread (16 messages) flat view 16 messages, 4 authors, 2021-08-19
STALE1822d

Revision v2 of 6 in this series.

Revisions (6)
  1. v2 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v3 [diff vs current]
  5. v1 [diff vs current]
  6. v2 [diff vs current]

[RFC PATCH net-next v2 5/6] ethtool: Add transceiver module extended states

From: Ido Schimmel <hidden>
Date: 2021-08-18 15:53:17
Subsystem: documentation, networking [ethtool], networking [general], the rest · Maintainers: Jonathan Corbet, Andrew Lunn, Jakub Kicinski, "David S. Miller", Eric Dumazet, Paolo Abeni, Linus Torvalds

From: Ido Schimmel <idosch@nvidia.com>

Add an extended state and two extended sub-states to describe link
issues related to transceiver modules.

The first, 'ETHTOOL_LINK_EXT_SUBSTATE_MODULE_LOW_POWER_MODE', tells user
space that port is unable to gain a carrier because the associated
transceiver module is in low power mode where the data path is
deactivated. This is applicable to both SFF-8636 and CMIS modules.

Example:

 # ethtool --set-module swp13 power-mode-policy low

 # ip link set dev swp13 up

 $ ethtool swp13
 ...
 Link detected: no (Module, Module is in low power mode)

 # ip link set dev swp13 down

 # ethtool --set-module swp13 power-mode-policy high-on-up

 # ip link set dev swp13 up

 $ ethtool swp13
 ...
 Link detected: yes

The second, 'ETHTOOL_LINK_EXT_SUBSTATE_MODULE_CMIS_NOT_READY', tells
user space that port is unable to gain a carrier because the CMIS Module
State Machine did not reach the ModuleReady (Fully Operational) state.
For example, if the module is stuck at ModuleFault state. In which case,
user space can read the fault reason from the module's EEPROM and
potentially reset it.

For CMIS modules, the first extended sub-state is contained in the
second, but has the added advantage of being applicable to more module
types and being more specific about the nature of the problem.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 Documentation/networking/ethtool-netlink.rst | 12 ++++++++++++
 include/linux/ethtool.h                      |  1 +
 include/uapi/linux/ethtool.h                 |  7 +++++++
 3 files changed, 20 insertions(+)
diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst
index 54a704370bfc..2dcf3d4e4dd4 100644
--- a/Documentation/networking/ethtool-netlink.rst
+++ b/Documentation/networking/ethtool-netlink.rst
@@ -523,6 +523,8 @@ Link extended states:
                                                         power required from cable or module
 
   ``ETHTOOL_LINK_EXT_STATE_OVERHEAT``                   The module is overheated
+
+  ``ETHTOOL_LINK_EXT_STATE_MODULE``                     Transceiver module issue
   ================================================      ============================================
 
 Link extended substates:
@@ -608,6 +610,16 @@ Link extended substates:
   ``ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE``   Cable test failure
   ===================================================   ============================================
 
+  Transceiver module issue substates:
+
+  ===================================================   ============================================
+  ``ETHTOOL_LINK_EXT_SUBSTATE_MODULE_LOW_POWER_MODE``   The transceiver module is in low power mode
+
+  ``ETHTOOL_LINK_EXT_SUBSTATE_MODULE_CMIS_NOT_READY``   The CMIS Module State Machine did not reach
+                                                        the ModuleReady state. For example, if the
+                                                        module is stuck at ModuleFault state
+  ===================================================   ============================================
+
 DEBUG_GET
 =========
 
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 07d40dc20ca4..1f71293011ca 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -93,6 +93,7 @@ struct ethtool_link_ext_state_info {
 		enum ethtool_link_ext_substate_link_logical_mismatch link_logical_mismatch;
 		enum ethtool_link_ext_substate_bad_signal_integrity bad_signal_integrity;
 		enum ethtool_link_ext_substate_cable_issue cable_issue;
+		enum ethtool_link_ext_substate_module module;
 		u8 __link_ext_substate;
 	};
 };
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 0a52ee560c3a..ec2518e9d4e3 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -603,6 +603,7 @@ enum ethtool_link_ext_state {
 	ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE,
 	ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED,
 	ETHTOOL_LINK_EXT_STATE_OVERHEAT,
+	ETHTOOL_LINK_EXT_STATE_MODULE,
 };
 
 /* More information in addition to ETHTOOL_LINK_EXT_STATE_AUTONEG. */
@@ -647,6 +648,12 @@ enum ethtool_link_ext_substate_cable_issue {
 	ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE,
 };
 
+/* More information in addition to ETHTOOL_LINK_EXT_STATE_MODULE. */
+enum ethtool_link_ext_substate_module {
+	ETHTOOL_LINK_EXT_SUBSTATE_MODULE_LOW_POWER_MODE = 1,
+	ETHTOOL_LINK_EXT_SUBSTATE_MODULE_CMIS_NOT_READY,
+};
+
 #define ETH_GSTRING_LEN		32
 
 /**
-- 
2.31.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help