lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250204133957.1140677-15-danieller@nvidia.com>
Date: Tue, 4 Feb 2025 15:39:55 +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 v3 14/16] ethtool: Enable JSON output support for SFF8079 and SFF8472 modules

 A sample output:

$ ethtool --json -m swp1
[ {
        "identifier": 3,
        "identifier_description": "SFP",
        "extended_identifier": 4,
        "extended_identifier_description": "GBIC/SFP defined by 2-wire
interface ID",
        "connector": 33,
        "connector_description": "Copper pigtail",
        "transceiver_codes": [ 1,0,0,4,0,4,128,213,0 ],
        "transceiver_type": "FC: 100 MBytes/sec",
        "encoding": 0,
        "encoding_description": "unspecified",
        "br_nominal": 10300,
        "rate_identifier": 0,
        "rate_identifier_description": "unspecified",
        "length_(smf)": 0,
        "length_(om2)": 0,
        "length_(om1)": 0,
        "length_(copper_or_active_cable)": 2,
        "length_(om3)": 0,
        "passive_cu_cmplnce.": 1,
        "passive_cu_cmplnce._description": "SFF-8431 appendix E
[SFF-8472 rev10.4 only]",
        "vendor_name": "Mellanox",
        "vendor_oui": [ 0,2,201 ],
        "vendor_pn": "MC2309130-002",
        "vendor_rev": "A2",
        "option_values": [ 0,0 ],
        "br_margin_max": 0,
        "br_margin_min": 0,
        "vendor_sn": "MT1146VS00060",
        "date_code": "111110"
} ]

Signed-off-by: Danielle Ratson <danieller@...dia.com>
---

Notes:
    v3:
    	* Enable JSON output support for SFF8079.
    	* Reword commit message.

 ethtool.c | 4 ++++
 sfpid.c   | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/ethtool.c b/ethtool.c
index 0b876e8..8a81001 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -5007,6 +5007,8 @@ static int do_getmodule(struct cmd_context *ctx)
 		    (eeprom->len != modinfo.eeprom_len)) {
 			geeprom_dump_hex = 1;
 		} else if (!geeprom_dump_hex) {
+			new_json_obj(ctx->json);
+			open_json_object(NULL);
 			switch (modinfo.type) {
 #ifdef ETHTOOL_ENABLE_PRETTY_DUMP
 			case ETH_MODULE_SFF_8079:
@@ -5026,6 +5028,8 @@ static int do_getmodule(struct cmd_context *ctx)
 				geeprom_dump_hex = 1;
 				break;
 			}
+			close_json_object();
+			delete_json_obj();
 		}
 		if (geeprom_dump_hex)
 			dump_hex(stdout, eeprom->data,
diff --git a/sfpid.c b/sfpid.c
index 0ccf9ad..62acb4f 100644
--- a/sfpid.c
+++ b/sfpid.c
@@ -517,7 +517,11 @@ int sff8079_show_all_nl(struct cmd_context *ctx)
 	if (ret)
 		goto out;
 
+	new_json_obj(ctx->json);
+	open_json_object(NULL);
 	sff8079_show_all_common(buf);
+	close_json_object();
+	delete_json_obj();
 
 	/* Finish if A2h page is not present */
 	if (!(buf[92] & (1 << 6)))
-- 
2.47.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ