netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathew McBride <matt@traverse.com.au>
To: Michal Kubecek <mkubecek@suse.cz>
Cc: netdev@vger.kernel.org, Mathew McBride <matt@traverse.com.au>
Subject: [PATCH ethtool 0/2] Add JSON support for SFP EEPROM dump
Date: Mon,  4 Jul 2022 05:41:12 +0000	[thread overview]
Message-ID: <20220704054114.22582-1-matt@traverse.com.au> (raw)

This patch adds JSON output support to ethtool's -m option,
useful for presenting transceiver module option in a web interface.

An example frontend can be found here, for OpenWrt's LuCI:
https://gitlab.com/traversetech/muvirt-feed/-/tree/master/sfp-diagnostics-luci

You can find samples of the output, plus a screenshot here:
10GBASE-LR SFP:
https://gitlab.com/-/snippets/2364354
1/10GBASE-LR dual mode SFP
https://gist.github.com/mcbridematt/7921c795c4835afa807d8f83cc132401

I have tried to make the JSON format easy to consume by including both
the original field values and full text descriptions, so any consumer
of the JSON output doesn't need to replicate ethtool's rendering logic.

I'm open to any suggestions on how the structure of the JSON output
could be improved.

Mathew McBride (2):
  ethtool: add JSON output to --module-info
  ethtool: remove restriction on ioctl commands having JSON output

 ethtool.c    |   8 +-
 sff-common.c | 213 +++++++++++++++--------
 sff-common.h |  17 +-
 sfpdiag.c    |  64 ++++++-
 sfpid.c      | 478 +++++++++++++++++++++++++++++++--------------------
 5 files changed, 522 insertions(+), 258 deletions(-)

-- 
2.30.1


             reply	other threads:[~2022-07-04  5:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04  5:41 Mathew McBride [this message]
2022-07-04  5:41 ` [PATCH ethtool 1/2] ethtool: add JSON output to --module-info Mathew McBride
2022-10-06 15:29   ` Michal Kubecek
2022-07-04  5:41 ` [PATCH ethtool 2/2] ethtool: remove restriction on ioctl commands having JSON output Mathew McBride
2022-10-06 15:23   ` Michal Kubecek

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=20220704054114.22582-1-matt@traverse.com.au \
    --to=matt@traverse.com.au \
    --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).