Thread (39 messages) 39 messages, 6 authors, 2025-02-03

RE: [PATCH ethtool-next 09/14] qsfp: Add JSON output handling to --module-info in SFF8636 modules

From: Danielle Ratson <hidden>
Date: 2025-01-29 11:53:17

-----Original Message-----
From: Petr Machata <petrm@nvidia.com>
Sent: Wednesday, 29 January 2025 12:44
To: Danielle Ratson <redacted>
Cc: Jakub Kicinski <kuba@kernel.org>; netdev@vger.kernel.org;
mkubecek@suse.cz; matt@traverse.com.au; daniel.zahka@gmail.com; Amit
Cohen [off-list ref]; NBU-mlxsw <NBU-
mlxsw@exchange.nvidia.com>
Subject: Re: [PATCH ethtool-next 09/14] qsfp: Add JSON output handling to --
module-info in SFF8636 modules


Danielle Ratson [off-list ref] writes:
quoted
From: Jakub Kicinski <kuba@kernel.org>
quoted
On Sun, 26 Jan 2025 13:56:30 +0200 Danielle Ratson wrote:
quoted
+		open_json_object("extended_identifier");
+		print_int(PRINT_JSON, "value", "0x%02x",
+			  map->page_00h[SFF8636_EXT_ID_OFFSET]);
Hm, why hex here?
Priority for JSON output is to make it easy to handle in code, rather
than easy to read. Hex strings need extra manual decoding, no?
I kept the same convention as in the regular output.

And as agreed in Daniel's design those hex fields remain hex fields and are
followed by a description field.
quoted
Do you think otherwise?
Regular output is for human consumption, JSON is for machine consumption.
IMHO it makes sense to reasonably diverge and use the "correct" JSON type
where available, even if the human-readable output is different. So numbers
should IMHO be numbers, true / false, yes / no, off / on etc. should probably
be booleans, arrays should be arrays, etc.
Ok, for both of you, will use ints instead of in JSON output.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help