From: Johannes Eigner <johannes.eigner@a-eberle.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org, Michal Kubecek <mkubecek@suse.cz>,
Danielle Ratson <danieller@nvidia.com>,
Stephan Wurm <stephan.wurm@a-eberle.de>
Subject: Re: [PATCH ethtool 2/2] sff-common: Fix naming of JSON keys for thresholds
Date: Wed, 22 Oct 2025 16:59:45 +0200 [thread overview]
Message-ID: <aPjxYbbiYAexF9nQ@PC-LX-JohEi> (raw)
In-Reply-To: <0b99a68f-0dd3-4f95-a367-750464ff1fee@lunn.ch>
[-- Attachment #1: Type: text/plain, Size: 10120 bytes --]
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@a-eberle.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
}
} ]
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 4153 bytes --]
next prev parent reply other threads:[~2025-10-22 15:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 14:00 [PATCH ethtool 0/2] fix module info JSON output Johannes Eigner
2025-10-21 14:00 ` [PATCH ethtool 1/2] sfpid: Fix JSON output of SFP diagnostics Johannes Eigner
2025-10-22 12:55 ` Danielle Ratson
2025-10-22 14:52 ` Johannes Eigner
2025-10-21 14:00 ` [PATCH ethtool 2/2] sff-common: Fix naming of JSON keys for thresholds Johannes Eigner
2025-10-22 13:32 ` Andrew Lunn
2025-10-22 14:59 ` Johannes Eigner [this message]
2025-10-22 15:34 ` Andrew Lunn
2025-10-23 10:02 ` Johannes Eigner
2025-10-23 13:14 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aPjxYbbiYAexF9nQ@PC-LX-JohEi \
--to=johannes.eigner@a-eberle.de \
--cc=andrew@lunn.ch \
--cc=danieller@nvidia.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=stephan.wurm@a-eberle.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox