[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPjxYbbiYAexF9nQ@PC-LX-JohEi>
Date: Wed, 22 Oct 2025 16:59:45 +0200
From: Johannes Eigner <johannes.eigner@...berle.de>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org, Michal Kubecek <mkubecek@...e.cz>,
Danielle Ratson <danieller@...dia.com>,
Stephan Wurm <stephan.wurm@...berle.de>
Subject: Re: [PATCH ethtool 2/2] sff-common: Fix naming of JSON keys for
thresholds
Am Wed, Oct 22, 2025 at 03:32:24PM +0200 schrieb Andrew Lunn:
> On Tue, Oct 21, 2025 at 04:00:13PM +0200, Johannes Eigner wrote:
> > Append "_thresholds" to the threshold JSON objects to avoid using the
> > same key which is not allowed in JSON.
> > The JSON output for SFP transceivers uses the keys "laser_bias_current",
> > "laser_output_power", "module_temperature" and "module_voltage" for
> > both the actual value and the threshold values. This leads to invalid
> > JSON output as keys in a JSON object must be unique.
> > For QSPI and CMIS the keys "module_temperature" and "module_voltage" are
> > also used for both the actual value and the threshold values.
> >
> > Signed-off-by: Johannes Eigner <johannes.eigner@...berle.de>
> > ---
> > sff-common.c | 50 +++++++++++++++++++++++++-------------------------
> > 1 file changed, 25 insertions(+), 25 deletions(-)
> >
> > diff --git a/sff-common.c b/sff-common.c
> > index 0824dfb..6528f5a 100644
> > --- a/sff-common.c
> > +++ b/sff-common.c
> > @@ -104,39 +104,39 @@ void sff8024_show_encoding(const __u8 *id, int encoding_offset, int sff_type)
> >
> > void sff_show_thresholds_json(struct sff_diags sd)
> > {
> > - open_json_object("laser_bias_current");
> > - PRINT_BIAS_JSON("high_alarm_threshold", sd.bias_cur[HALRM]);
> > - PRINT_BIAS_JSON("low_alarm_threshold", sd.bias_cur[LALRM]);
> > - PRINT_BIAS_JSON("high_warning_threshold", sd.bias_cur[HWARN]);
> > - PRINT_BIAS_JSON("low_warning_threshold", sd.bias_cur[LWARN]);
> > + open_json_object("laser_bias_current_thresholds");
> > + PRINT_BIAS_JSON("high_alarm", sd.bias_cur[HALRM]);
> > + PRINT_BIAS_JSON("low_alarm", sd.bias_cur[LALRM]);
> > + PRINT_BIAS_JSON("high_warning", sd.bias_cur[HWARN]);
> > + PRINT_BIAS_JSON("low_warning", sd.bias_cur[LWARN]);
> > close_json_object();
>
> I'm struggling understanding the changes here. Maybe give an example
> before and after.
>
Shortened example for laser_bias_current, full output at end of mail.
Shortened output without patch
$ ethtool -j -m sfp1
"laser_bias_current": 15.604,
"laser_bias_current_high_alarm": false,
"laser_bias_current_low_alarm": false,
"laser_bias_current_high_warning": false,
"laser_bias_current_low_warning": false,
"laser_bias_current": {
"high_alarm_threshold": 80,
"low_alarm_threshold": 2,
"high_warning_threshold": 70,
"low_warning_threshold": 3
},
Shortened output after patch
$ ethtool -j -m sfp1
"laser_bias_current": 16.168,
"laser_bias_current_high_alarm": false,
"laser_bias_current_low_alarm": false,
"laser_bias_current_high_warning": false,
"laser_bias_current_low_warning": false,
"laser_bias_current_threshold": {
"high_alarm": 80,
"low_alarm": 2,
"high_warning": 70,
"low_warning": 3
},
> The commit message talks about adding _threshold, but you are also
> removing _threshold, which is what is confusing me. Is this required?
> It makes the ABI breakage bigger.
Removing _threshold from the child objects is not required. I removed
them because it is somehow redundant to have _threshold at the parent and
child. If a smaller ABI breakage is more desirable I can drop the
removal of _threshold in the children.
Johannes
Full output without patch
$ ethtool -j -m sfp1
[ {
"identifier": 3,
"identifier_description": "SFP",
"extended_identifier": 4,
"extended_identifier_description": "GBIC/SFP defined by 2-wire interface ID",
"connector": 7,
"connector_description": "LC",
"transceiver_codes": [ 0,0,0,2,0,0,0,0,0 ],
"transceiver_type": "Ethernet: 1000BASE-LX",
"encoding": 1,
"encoding_description": "8B/10B",
"br_nominal": 1300,
"rate_identifier": 0,
"rate_identifier_description": "unspecified",
"length_(smf)": 10,
"length_(om2)": 0,
"length_(om1)": 0,
"length_(copper_or_active_cable)": 0,
"length_(om3)": 0,
"laser_wavelength": 1310,
"vendor_name": "FLEXOPTIX",
"vendor_oui": [ 56,134,2 ],
"vendor_pn": "S.1312.2M.DI",
"vendor_rev": "A",
"option_values": [ 0,26 ],
"option": "TX_DISABLE implemented",
"br_margin_max": 0,
"br_margin_min": 0,
"vendor_sn": "F7B0CRQ",
"date_code": "240618",
"optical_diagnostics_support": true,
"laser_bias_current": 15.604,
"laser_output_power": 0.2461,
"rx_power": {
"value": 0.0516,
"type": "Receiver signal average optical power"
},
"module_temperature": 26.5898,
"module_voltage": 3.3812,
"alarm/warning_flags_implemented": true,
"laser_bias_current_high_alarm": false,
"laser_bias_current_low_alarm": false,
"laser_bias_current_high_warning": false,
"laser_bias_current_low_warning": false,
"laser_output_power_high_alarm": false,
"laser_output_power_low_alarm": false,
"laser_output_power_high_warning": false,
"laser_output_power_low_warning": false,
"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_rx_power_high_alarm": false,
"laser_rx_power_low_alarm": false,
"laser_rx_power_high_warning": false,
"laser_rx_power_low_warning": false,
"laser_bias_current": {
"high_alarm_threshold": 80,
"low_alarm_threshold": 2,
"high_warning_threshold": 70,
"low_warning_threshold": 3
},
"laser_output_power": {
"high_alarm_threshold": 0.7943,
"low_alarm_threshold": 0.0794,
"high_warning_threshold": 0.631,
"low_warning_threshold": 0.1
},
"module_temperature": {
"high_alarm_threshold": 110,
"low_alarm_threshold": -45,
"high_warning_threshold": 95,
"low_warning_threshold": -42
},
"module_voltage": {
"high_alarm_threshold": 3.6,
"low_alarm_threshold": 3,
"high_warning_threshold": 3.5,
"low_warning_threshold": 3.05
},
"laser_rx_power": {
"high_alarm_threshold": 0.5012,
"low_alarm_threshold": 0.004,
"high_warning_threshold": 0.3981,
"low_warning_threshold": 0.005
}
} ]
Full output after patch
$ ethtool -j -m sfp1
[ {
"identifier": 3,
"identifier_description": "SFP",
"extended_identifier": 4,
"extended_identifier_description": "GBIC/SFP defined by 2-wire interface ID",
"connector": 7,
"connector_description": "LC",
"transceiver_codes": [ 0,0,0,2,0,0,0,0,0 ],
"transceiver_type": "Ethernet: 1000BASE-LX",
"encoding": 1,
"encoding_description": "8B/10B",
"br_nominal": 1300,
"rate_identifier": 0,
"rate_identifier_description": "unspecified",
"length_(smf)": 10,
"length_(om2)": 0,
"length_(om1)": 0,
"length_(copper_or_active_cable)": 0,
"length_(om3)": 0,
"laser_wavelength": 1310,
"vendor_name": "FLEXOPTIX",
"vendor_oui": [ 56,134,2 ],
"vendor_pn": "S.1312.2M.DI",
"vendor_rev": "A",
"option_values": [ 0,26 ],
"option": "TX_DISABLE implemented",
"br_margin_max": 0,
"br_margin_min": 0,
"vendor_sn": "F7B0CRQ",
"date_code": "240618",
"optical_diagnostics_support": true,
"laser_bias_current": 16.168,
"laser_output_power": 0.2478,
"rx_power": {
"value": 0.052,
"type": "Receiver signal average optical power"
},
"module_temperature": 31.918,
"module_voltage": 3.3678,
"alarm/warning_flags_implemented": true,
"laser_bias_current_high_alarm": false,
"laser_bias_current_low_alarm": false,
"laser_bias_current_high_warning": false,
"laser_bias_current_low_warning": false,
"laser_output_power_high_alarm": false,
"laser_output_power_low_alarm": false,
"laser_output_power_high_warning": false,
"laser_output_power_low_warning": false,
"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_rx_power_high_alarm": false,
"laser_rx_power_low_alarm": false,
"laser_rx_power_high_warning": false,
"laser_rx_power_low_warning": false,
"laser_bias_current_threshold": {
"high_alarm": 80,
"low_alarm": 2,
"high_warning": 70,
"low_warning": 3
},
"laser_output_power_threshold": {
"high_alarm": 0.7943,
"low_alarm": 0.0794,
"high_warning": 0.631,
"low_warning": 0.1
},
"module_temperature_threshold": {
"high_alarm": 110,
"low_alarm": -45,
"high_warning": 95,
"low_warning": -42
},
"module_voltage_threshold": {
"high_alarm": 3.6,
"low_alarm": 3,
"high_warning": 3.5,
"low_warning": 3.05
},
"laser_rx_power_threshold": {
"high_alarm": 0.5012,
"low_alarm": 0.004,
"high_warning": 0.3981,
"low_warning": 0.005
}
} ]
Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (4153 bytes)
Powered by blists - more mailing lists