netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: mkubecek@suse.cz
Cc: danieller@nvidia.com, idosch@idosch.org, netdev@vger.kernel.org,
	Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH ethtool 1/2] module_common: always print per-lane status in JSON
Date: Thu, 29 May 2025 07:20:32 -0700	[thread overview]
Message-ID: <20250529142033.2308815-2-kuba@kernel.org> (raw)
In-Reply-To: <20250529142033.2308815-1-kuba@kernel.org>

The JSON output type changes when loss of signal / fault is
detected. When there is no problem we print single bool, eg:

  "rx_loss_of_signal": false,

but when there's a problem we print an array:

  "rx_loss_of_signal": ["No", "Yes", "No", "No"],

This appears to be a mirror of the human-readable output,
but it's a pain to parse / unmarshall for user space.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 module-common.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/module-common.c b/module-common.c
index 9c21c2a55a18..ae500c62af89 100644
--- a/module-common.c
+++ b/module-common.c
@@ -308,11 +308,8 @@ void module_show_lane_status(const char *name, unsigned int lane_cnt,
 
 	convert_json_field_name(name, json_fn);
 
-	if (!value) {
-		if (is_json_context())
-			print_bool(PRINT_JSON, json_fn, NULL, false);
-		else
-			printf("\t%-41s : None\n", name);
+	if (!value && !is_json_context()) {
+		printf("\t%-41s : None\n", name);
 		return;
 	}
 
-- 
2.49.0


  reply	other threads:[~2025-05-29 14:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-29 14:20 [PATCH ethtool 0/2] module_common: adjust the JSON output for per-lane signals Jakub Kicinski
2025-05-29 14:20 ` Jakub Kicinski [this message]
2025-05-29 15:53   ` [PATCH ethtool 1/2] module_common: always print per-lane status in JSON Ido Schimmel
2025-05-29 14:20 ` [PATCH ethtool 2/2] module_common: print loss / fault signals as bool Jakub Kicinski
2025-05-29 15:53   ` Ido Schimmel
2025-05-29 23:02 ` [PATCH ethtool 0/2] module_common: adjust the JSON output for per-lane signals Joe Damato
2025-05-30 11:35 ` Michal Kubecek
2025-05-31  1:20   ` Jakub Kicinski
2025-06-10 23:50 ` patchwork-bot+netdevbpf

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=20250529142033.2308815-2-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=danieller@nvidia.com \
    --cc=idosch@idosch.org \
    --cc=mkubecek@suse.cz \
    --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).