diff mbox series

[ethtool-next,10/14] qsfp: Enable JSON output support for SFF8636 modules

Message ID 20250126115635.801935-11-danieller@nvidia.com (mailing list archive)
State New
Delegated to: Michal Kubecek
Headers show
Series Add JSON output to --module-info | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Danielle Ratson Jan. 26, 2025, 11:56 a.m. UTC
A sample output:

$ ethtool --json -m swp13
[ {
        "identifier": 17,
        "identifier_description": "QSFP28",
        "extended_identifier": {
            "value": 207,
            "description": "3.5W max. Power consumption",
            "description": "CDR present in TX, CDR present in RX",
            "description": "5.0W max. Power consumption, High Power
Class (> 3.5 W) enabled"
        },
        "power_set": false,
        "power_override": true,
        "connector": 35,
        "connector_description": "No separable connector",
        "transceiver_codes": [ 128,0,0,0,0,0,0,0 ],
        "transceiver_type": "Active Optical Cable with 50GAUI, 100GAUI-2
or 200GAUI-4 C2M. Providing a worst BER of 10-6 or below",
        "encoding": 8,
        "encoding_description": "PAM4",
        "br_nominal": 25500,
        "br_nominal_units": "Mbps",
        "rate_identifier": 2,
        "length_(smf,km)": 0,
        "length_(smf,km)_units": "km",
        "length_(om3_50um)": 0,
        "length_(om3_50um)_units": "m",
        "length_(om2_50um)": 0,
        "length_(om2_50um)_units": "m",
        "length_(om1_62.5um)": 0,
        "length_(om1_62.5um)_units": "m",
        "length_(copper_or_active_cable)": 3,
        "length_(copper_or_active_cable)_units": "m",
        "transmitter_technology": 0,
        "transmitter_technology_description": "850 nm VCSEL",
        "laser_wavelength": 850,
        "laser_wavelength_units": "nm",
        "laser_wavelength_tolerance": 150,
        "laser_wavelength_tolerance_units": "nm",
        "vendor_name": "Mellanox",
        "vendor_oui": [ 0,2,201 ],
        "vendor_pn": "MFS1S00-V003E",
        "vendor_rev": "A6",
        "vendor_sn": "MT1915FT03913",
        "date_code": "190412",
        "revision_compliance": "Unallocated",
        "rx_loss_of_signal": [ "Yes","Yes","Yes","Yes" ],
        "tx_loss_of_signal": "None",
        "rx_loss_of_lock": [ "Yes","Yes","Yes","Yes" ],
        "tx_loss_of_lock": "None",
        "tx_adaptive_eq_fault": "None",
        "module_temperature": 56.75,
        "module_temperature_units": "degrees C",
        "module_voltage": 3.261,
        "module_voltage_units": "V",
        "alarm/warning_flags_implemented": true,
        "laser_tx_bias_current": [ 0,0,0,0 ],
        "laser_tx_bias_current_units": "mA",
        "transmit_avg_optical_power": [ 0,0,0,0 ],
        "transmit_avg_optical_power_units": "mW",
        "rcvr_signal_avg_optical_power": [ 0.0388,0.041,0.0417,0.0392 ],
        "rcvr_signal_avg_optical_power_units": "mW",
        "laser_bias_current_high_alarm": [ false,false,false,false ],
        "laser_bias_current_low_alarm": [ false,false,false,false ],
        "laser_bias_current_high_warning": [ false,false,false,false ],
        "laser_bias_current_low_warning": [ false,false,false,false ],
        "laser_tx_power_high_alarm": [ false,false,false,false ],
        "laser_tx_power_low_alarm": [ false,false,false,false ],
        "laser_tx_power_high_warning": [ false,false,false,false ],
        "laser_tx_power_low_warning": [ false,false,false,false ],
        "laser_rx_power_high_alarm": [ false,false,false,false ],
        "laser_rx_power_low_alarm": [ true,true,true,true ],
        "laser_rx_power_high_warning": [ false,false,false,false ],
        "laser_rx_power_low_warning": [ true,true,true,true ],
        "Module temperature high alarm": false,
        "Module temperature low alarm": false,
        "Module temperature high warning": false,
        "Module temperature low warning": false,
        "Module voltage high alarm": false,
        "Module voltage low alarm": false,
        "Module voltage high warning": false,
        "Module voltage low warning": false,
        "laser_bias_current": {
            "high_alarm_threshold": 8.5,
            "low_alarm_threshold": 5.492,
            "high_warning_threshold": 8,
            "low_warning_threshold": 6,
            "units": "mA"
        },
        "laser_output_power": {
            "high_alarm_threshold": 3.4673,
            "low_alarm_threshold": 0.0724,
            "high_warning_threshold": 1.7378,
            "low_warning_threshold": 0.1445,
            "units": "mW"
        },
        "module_temperature": {
            "high_alarm_threshold": 80,
            "low_alarm_threshold": -10,
            "high_warning_threshold": 70,
            "low_warning_threshold": 0,
            "units": "degrees C"
        },
        "module_voltage": {
            "high_alarm_threshold": 3.5,
            "low_alarm_threshold": 3.1,
            "high_warning_threshold": 3.465,
            "low_warning_threshold": 3.135,
            "units": "V"
        },
        "laser_rx_power": {
            "high_alarm_threshold": 3.4673,
            "low_alarm_threshold": 0.0467,
            "high_warning_threshold": 1.7378,
            "low_warning_threshold": 0.0933,
            "units": "mW"
        }
    } ]

Signed-off-by: Danielle Ratson <danieller@nvidia.com>
---
 qsfp.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/qsfp.c b/qsfp.c
index d835067..6f95377 100644
--- a/qsfp.c
+++ b/qsfp.c
@@ -1096,10 +1096,16 @@  int sff8636_show_all_nl(struct cmd_context *ctx)
 	struct sff8636_memory_map map = {};
 	int ret;
 
+	new_json_obj(ctx->json);
+	open_json_object(NULL);
+
 	ret = sff8636_memory_map_init_pages(ctx, &map);
 	if (ret < 0)
 		return ret;
 	sff8636_show_all_common(&map);
 
+	close_json_object();
+	delete_json_obj();
+
 	return 0;
 }