Thread (25 messages) 25 messages, 4 authors, 2026-03-04

[RFC net-next 1/4] ethtool: module: Define CMIS loopback YAML spec and UAPI

From: Björn Töpel <bjorn@kernel.org>
Date: 2026-02-19 13:01:09
Also in: linux-rdma, lkml
Subsystem: networking drivers, networking [ethtool], networking [general], the rest, yaml netlink (ynl) · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Donald Hunter

Add the netlink YAML specification for module loopback attributes used
to query and control diagnostic loopback modes on CMIS-compliant
transceiver modules.

Define the module-loopback-types flags enum with four loopback types
from CMIS 5.2 Section 8.4.11 ("Diagnostic Loopback Capabilities"):
  - media-side-output (Rx to Tx)
  - media-side-input  (Tx to Rx)
  - host-side-output  (Rx to Tx)
  - host-side-input   (Tx to Rx)

Add two new attributes to the module attribute-set:
  - loopback-capabilities: bitmask of supported loopback types
  - loopback-enabled:      bitmask of currently enabled loopback types

Include both attributes in the module-get reply (and by YAML anchor
reuse, in the module-set request). Regenerate the UAPI header.

Signed-off-by: Björn Töpel <bjorn@kernel.org>
---
 Documentation/netlink/specs/ethtool.yaml      | 27 +++++++++++++++++++
 .../uapi/linux/ethtool_netlink_generated.h    | 22 +++++++++++++++
 2 files changed, 49 insertions(+)
diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml
index 0a2d2343f79a..88dfd5f05b3c 100644
--- a/Documentation/netlink/specs/ethtool.yaml
+++ b/Documentation/netlink/specs/ethtool.yaml
@@ -11,6 +11,23 @@ c-family-name: ethtool-genl-name
 c-version-name: ethtool-genl-version
 
 definitions:
+  -
+    name: module-loopback-types
+    type: flags
+    doc: Defines the loopback types (host/electrical or media/optical side) and the signal's path direction (input/near-end or output/far-end).
+    entries:
+      -
+        name: media-side-output
+        doc: Media Side Output Loopback (Rx to Tx)
+      -
+        name: media-side-input
+        doc: Media Side Input Loopback (Tx to Rx)
+      -
+        name: host-side-output
+        doc: Host Side Output Loopback (Rx to Tx)
+      -
+        name: host-side-input
+        doc: Host Side Input Loopback (Tx to Rx)
   -
     name: udp-tunnel-type
     enum-name:
@@ -1438,6 +1455,14 @@ attribute-sets:
       -
         name: power-mode
         type: u8
+      -
+        name: loopback-capabilities
+        type: uint
+        enum: module-loopback-types
+      -
+        name: loopback-enabled
+        type: uint
+        enum: module-loopback-types
   -
     name: c33-pse-pw-limit
     attr-cnt-name: __ethtool-a-c33-pse-pw-limit-cnt
@@ -2501,6 +2526,8 @@ operations:
             - header
             - power-mode-policy
             - power-mode
+            - loopback-capabilities
+            - loopback-enabled
       dump: *module-get-op
     -
       name: module-set
diff --git a/include/uapi/linux/ethtool_netlink_generated.h b/include/uapi/linux/ethtool_netlink_generated.h
index 556a0c834df5..d94b75b27718 100644
--- a/include/uapi/linux/ethtool_netlink_generated.h
+++ b/include/uapi/linux/ethtool_netlink_generated.h
@@ -10,6 +10,26 @@
 #define ETHTOOL_GENL_NAME	"ethtool"
 #define ETHTOOL_GENL_VERSION	1
 
+/**
+ * enum ethtool_module_loopback_types - Defines the loopback types
+ *   (host/electrical or media/optical side) and the signal's path direction
+ *   (input/near-end or output/far-end).
+ * @ETHTOOL_MODULE_LOOPBACK_TYPES_MEDIA_SIDE_OUTPUT: Media Side Output Loopback
+ *   (Rx to Tx)
+ * @ETHTOOL_MODULE_LOOPBACK_TYPES_MEDIA_SIDE_INPUT: Media Side Input Loopback
+ *   (Tx to Rx)
+ * @ETHTOOL_MODULE_LOOPBACK_TYPES_HOST_SIDE_OUTPUT: Host Side Output Loopback
+ *   (Rx to Tx)
+ * @ETHTOOL_MODULE_LOOPBACK_TYPES_HOST_SIDE_INPUT: Host Side Input Loopback (Tx
+ *   to Rx)
+ */
+enum ethtool_module_loopback_types {
+	ETHTOOL_MODULE_LOOPBACK_TYPES_MEDIA_SIDE_OUTPUT = 1,
+	ETHTOOL_MODULE_LOOPBACK_TYPES_MEDIA_SIDE_INPUT = 2,
+	ETHTOOL_MODULE_LOOPBACK_TYPES_HOST_SIDE_OUTPUT = 4,
+	ETHTOOL_MODULE_LOOPBACK_TYPES_HOST_SIDE_INPUT = 8,
+};
+
 enum {
 	ETHTOOL_UDP_TUNNEL_TYPE_VXLAN,
 	ETHTOOL_UDP_TUNNEL_TYPE_GENEVE,
@@ -654,6 +674,8 @@ enum {
 	ETHTOOL_A_MODULE_HEADER,
 	ETHTOOL_A_MODULE_POWER_MODE_POLICY,
 	ETHTOOL_A_MODULE_POWER_MODE,
+	ETHTOOL_A_MODULE_LOOPBACK_CAPABILITIES,
+	ETHTOOL_A_MODULE_LOOPBACK_ENABLED,
 
 	__ETHTOOL_A_MODULE_CNT,
 	ETHTOOL_A_MODULE_MAX = (__ETHTOOL_A_MODULE_CNT - 1)
-- 
2.53.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help