[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250129131547.964711-9-danieller@nvidia.com>
Date: Wed, 29 Jan 2025 15:15:41 +0200
From: Danielle Ratson <danieller@...dia.com>
To: <netdev@...r.kernel.org>
CC: <mkubecek@...e.cz>, <matt@...verse.com.au>, <daniel.zahka@...il.com>,
<amcohen@...dia.com>, <nbu-mlxsw@...hange.nvidia.com>, Danielle Ratson
<danieller@...dia.com>
Subject: [PATCH ethtool-next v2 08/14] cmis: Enable JSON output support in CMIS modules
A sample output:
$ ethtool --json -m swp23
[ {
"identifier": 24,
"identifier_description": "QSFP-DD Double Density 8X Pluggable
Transceiver (INF-8628)",
"power_class": 5,
"max_power": 10.0000,
"max_power_units": "W",
"connector": 40,
"connector_description": "MPO 1x16",
"cable_assembly_length": 0.0000,
"cable_assembly_length_units": "m",
"tx_cdr_bypass_control": false,
"rx_cdr_bypass_control": false,
"tx_cdr": true,
"rx_cdr": true,
"transmitter_technology": 0,
"transmitter_technology_description": "850 nm VCSEL",
"laser_wavelength": 850.0000,
"laser_wavelength_units": "nm",
"laser_wavelength_tolerance": 94.8000,
"laser_wavelength_tolerance_units": "nm",
"length_(smf)": 0.0000,
"length_(smf)_units": "km",
"length_(om5)": 0,
"length_(om5)_units": "m",
"length_(om4)": 100,
"length_(om4)_units": "m",
"length_(om3_50/125um)": 70,
"length_(om3_50/125um)_units": "m",
"length_(om2_50/125um)": 0,
"length_(om2_50/125um)_units": "m",
"vendor_name": "FINISAR CORP.",
"vendor_oui": [ 0,144,101 ],
"vendor_pn": "FTCD8613E1PCM",
"vendor_rev": "A0",
"vendor_sn": "X6LBE6H",
"date_code": "211229__",
"revision_compliance": {
"major": 4,
"minor": 0
},
"rx_loss_of_signal": [
"Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes" ],
"tx_loss_of_signal": "None",
"rx_loss_of_lock": "None",
"tx_loss_of_lock": "None",
"tx_fault": "None",
"module_state": 3,
"module_state_description": "ModuleReady",
"low_pwr_allow_request_hw": false,
"low_pwr_request_sw": false,
"module_temperature": 36.8203,
"module_temperature_units": "degrees C",
"module_voltage": 3.3385,
"module_voltage_units": "V",
"laser_tx_bias_current": [
0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000 ],
"laser_tx_bias_current_units": "mA",
"transmit_avg_optical_power": [
0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001 ],
"transmit_avg_optical_power_units": "mW",
"rcvr_signal_avg_optical_power": [
0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001 ],
"rcvr_signal_avg_optical_power_units": "mW",
"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": [
false,false,false,false,false,false,false,false ],
"laser_bias_current_low_alarm": [
false,false,false,false,false,false,false,false ],
"laser_bias_current_high_warning": [
false,false,false,false,false,false,false,false ],
"laser_bias_current_low_warning": [
false,false,false,false,false,false,false,false ],
"laser_tx_power_high_alarm": [
false,false,false,false,false,false,false,false ],
"laser_tx_power_low_alarm": [
false,false,false,false,false,false,false,false ],
"laser_tx_power_high_warning": [
false,false,false,false,false,false,false,false ],
"laser_tx_power_low_warning": [
false,false,false,false,false,false,false,false ],
"laser_rx_power_high_alarm": [
false,false,false,false,false,false,false,false ],
"laser_rx_power_low_alarm": [
false,false,false,false,false,false,false,false ],
"laser_rx_power_high_warning": [
false,false,false,false,false,false,false,false ],
"laser_rx_power_low_warning": [
false,false,false,false,false,false,false,false ],
"laser_bias_current": {
"high_alarm_threshold": 13.0000,
"low_alarm_threshold": 3.0000,
"high_warning_threshold": 11.0000,
"low_warning_threshold": 5.0000,
"units": "mA"
},
"laser_output_power": {
"high_alarm_threshold": 3.1623,
"low_alarm_threshold": 0.1000,
"high_warning_threshold": 1.9953,
"low_warning_threshold": 0.1585,
"units": "mW"
},
"module_temperature": {
"high_alarm_threshold": 75.0000,
"low_alarm_threshold": -5.0000,
"high_warning_threshold": 70.0000,
"low_warning_threshold": 0.0000,
"units": "degrees C"
},
"module_voltage": {
"high_alarm_threshold": 3.4650,
"low_alarm_threshold": 3.1350,
"high_warning_threshold": 3.4500,
"low_warning_threshold": 3.1500,
"units": "V"
},
"laser_rx_power": {
"high_alarm_threshold": 3.1623,
"low_alarm_threshold": 0.0398,
"high_warning_threshold": 2.5119,
"low_warning_threshold": 0.0794,
"units": "mW"
},
"active_firmware_version": {
"major": 2,
"minor": 7
},
"inactive_firmware_version": {
"major": 2,
"minor": 7
},
"cdb_instances": 1,
"cdb_background_mode": "Supported",
"cdb_epl_pages": 0,
"cdb_maximum_epl_rw_length": 128,
"cdb_maximum_lpl_rw_length": 128,
"cdb_trigger_method": "Single write"
} ]
Signed-off-by: Danielle Ratson <danieller@...dia.com>
Reviewed-by: Amit Cohen <amcohen@...dia.com>
---
cmis.c | 6 ++++++
ethtool.c | 1 +
2 files changed, 7 insertions(+)
diff --git a/cmis.c b/cmis.c
index 4c759e8..d044743 100644
--- a/cmis.c
+++ b/cmis.c
@@ -1130,10 +1130,16 @@ int cmis_show_all_nl(struct cmd_context *ctx)
struct cmis_memory_map map = {};
int ret;
+ new_json_obj(ctx->json);
+ open_json_object(NULL);
+
ret = cmis_memory_map_init_pages(ctx, &map);
if (ret < 0)
return ret;
cmis_show_all_common(&map);
+ close_json_object();
+ delete_json_obj();
+
return 0;
}
diff --git a/ethtool.c b/ethtool.c
index a1393bc..0b876e8 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -6050,6 +6050,7 @@ static const struct option args[] = {
},
{
.opts = "-m|--dump-module-eeprom|--module-info",
+ .json = true,
.func = do_getmodule,
.nlfunc = nl_getmodule,
.help = "Query/Decode Module EEPROM information and optical diagnostics if available",
--
2.47.0
Powered by blists - more mailing lists