netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Danielle Ratson <danieller@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: <mkubecek@suse.cz>, <matt@traverse.com.au>,
	<daniel.zahka@gmail.com>, <amcohen@nvidia.com>,
	<nbu-mlxsw@exchange.nvidia.com>,
	Danielle Ratson <danieller@nvidia.com>
Subject: [PATCH ethtool-next v2 10/14] qsfp: Enable JSON output support for SFF8636 modules
Date: Wed, 29 Jan 2025 15:15:43 +0200	[thread overview]
Message-ID: <20250129131547.964711-11-danieller@nvidia.com> (raw)
In-Reply-To: <20250129131547.964711-1-danieller@nvidia.com>

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 --git a/qsfp.c b/qsfp.c
index bee4f5b..8e3c318 100644
--- a/qsfp.c
+++ b/qsfp.c
@@ -1098,10 +1098,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;
 }
-- 
2.47.0


  parent reply	other threads:[~2025-01-29 13:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-29 13:15 [PATCH ethtool-next v2 00/14] Add JSON output to --module-info Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 01/14] module_common: Add a new file to all the common code for all module types Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 02/14] sff_common: Move sff_show_revision_compliance() to qsfp.c Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 03/14] cmis: Change loop order in cmis_show_dom_chan_lvl_flags() Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 04/14] qsfp: Reorder the channel-level flags list for SFF8636 module type Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 05/14] qsfp: Refactor sff8636_show_dom() by moving code into separate functions Danielle Ratson
2025-01-30 12:26   ` Vadim Fedorenko
2025-01-30 13:03     ` Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 06/14] module_common: Add helpers to support JSON printing for common value types Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 07/14] cmis: Add JSON output handling to --module-info in CMIS modules Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 08/14] cmis: Enable JSON output support " Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 09/14] qsfp: Add JSON output handling to --module-info in SFF8636 modules Danielle Ratson
2025-01-29 13:15 ` Danielle Ratson [this message]
2025-01-29 13:15 ` [PATCH ethtool-next v2 11/14] sfpid: Add JSON output handling to --module-info in SFF8079 modules Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 12/14] sfpdiag: Add JSON output handling to --module-info in SFF8472 modules Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 13/14] ethtool: Enable JSON output support for SFF8079 and " Danielle Ratson
2025-01-29 13:15 ` [PATCH ethtool-next v2 14/14] ethtool: Add '-j' support to ethtool Danielle Ratson

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=20250129131547.964711-11-danieller@nvidia.com \
    --to=danieller@nvidia.com \
    --cc=amcohen@nvidia.com \
    --cc=daniel.zahka@gmail.com \
    --cc=matt@traverse.com.au \
    --cc=mkubecek@suse.cz \
    --cc=nbu-mlxsw@exchange.nvidia.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).