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 2/2] module_common: print loss / fault signals as bool
Date: Thu, 29 May 2025 07:20:33 -0700	[thread overview]
Message-ID: <20250529142033.2308815-3-kuba@kernel.org> (raw)
In-Reply-To: <20250529142033.2308815-1-kuba@kernel.org>

JSON output is supposed to be easy to parse. We currently
output "Yes" / "No" for the per-lane signal loss / fault.
This forces user space to do string matching. Print bool.

Before:
  "rx_loss_of_signal": ["No", "No", "No", "No"],

After:
  "rx_loss_of_signal": [false, false, false, false],

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

diff --git a/module-common.c b/module-common.c
index ae500c62af89..11b71bdb6281 100644
--- a/module-common.c
+++ b/module-common.c
@@ -317,8 +317,7 @@ void module_show_lane_status(const char *name, unsigned int lane_cnt,
 		open_json_array(json_fn, "");
 
 		while (lane_cnt--) {
-			print_string(PRINT_JSON, NULL, "%s",
-				     value & 1 ? yes : no);
+			print_bool(PRINT_JSON, NULL, NULL, value & 1);
 			value >>= 1;
 		}
 		close_json_array("");
-- 
2.49.0


  parent 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 ` [PATCH ethtool 1/2] module_common: always print per-lane status in JSON Jakub Kicinski
2025-05-29 15:53   ` Ido Schimmel
2025-05-29 14:20 ` Jakub Kicinski [this message]
2025-05-29 15:53   ` [PATCH ethtool 2/2] module_common: print loss / fault signals as bool 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-3-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).