Netdev List
 help / color / mirror / Atom feed
From: Danielle Ratson <danieller@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: <mkubecek@suse.cz>, <idosch@nvidia.com>, <petrm@nvidia.com>,
	"Danielle Ratson" <danieller@nvidia.com>
Subject: [PATCH ethtool-next v2 0/5] ethtool: Add 'pages on|off' option for module EEPROM hex dump
Date: Tue, 19 May 2026 15:36:57 +0300	[thread overview]
Message-ID: <cover.1779190777.git.danieller@nvidia.com> (raw)

The existing 'ethtool -m' command can dump module EEPROM data either as
a parsed pretty-print or as a raw/hex dump. The pretty-printer reads
multiple pages per module type, but decodes only specific fields from them.

In practice, both outputs are often needed together for offline debugging:
the pretty-print to identify the module type and decoded fields, and the
hex dump for fields the pretty-printer does not decode. However, there is
no single command that provides the raw hex dump of all relevant pages,
organized by page boundary. This is especially problematic for CMIS
transceivers where the existing hex dump does not provide Upper Pages
beyond Page 02h, let alone banked pages.

This series adds 'pages on|off' sub-option to 'hex on|off' for
'ethtool -m':
$ ethtool -m hex on pages on

That produces a hex dump organized by page, matching exactly the pages read
by the pretty-printer for each module type.

Each page is preceded by a header identifying the page number and, for
banked modules, the bank number. For SFP, where the two memory regions
are separate I2C addresses rather than pages, the header shows the I2C
address instead.

In JSON context (--json), each function emits a "pages" array with one
object per page, containing page/bank or I2C address, offset, length and
data. Consumers that need a stable, machine-parseable form of the hex
dump can use this output instead of the text format.

SFF-8636 Output examples (values zeroed to omit vendor-specific
identifiers):

$ ethtool -m swp61 hex on pages on
Page: 0x0

Offset          Values
------          ------
0x0000:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0010:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0020:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0030:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0040:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0050:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0060:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0070:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Page: 0x0

Offset          Values
------          ------
0x0080:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0090:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00a0:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00b0:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00c0:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00d0:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00e0:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00f0:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

$ ethtool -j -m swp61 hex on pages on
[ {
        "pages": [ {
                "bank": 0,
                "page": 0,
                "offset": 0,
                "length": 128,
                "i2c_address": 80,
                "data": ["0","0",...,"0"]
            },{
                "bank": 0,
                "page": 0,
                "offset": 128,
                "length": 128,
                "i2c_address": 80,
                "data": ["0","0",...,"0"]
            } ]
    } ]

v2:
	* Add JSON output support: each per-type function emits a "pages"
	  array with one object per page containing bank, page, offset,
	  length, i2c_address and data.
	* The shared module_dump_eeprom_hex() helper takes a struct
	  module_eeprom_dump with print_bank / print_i2c flags selecting
	  which header fields are printed
	* In JSON context all fields are emitted unconditionally.
	* Document the JSON output format in the man page.


Danielle Ratson (5):
  module-common: Add module_dump_eeprom_hex() helper
  sfpid: Refactor sff8079_show_all_nl() to separate page retrieval from
    display
  module: Add per-type EEPROM page hex dump functions
  netlink: module-eeprom: Add 'hex on pages on' option for
    page-organized hex dump
  ethtool: Add man page and bash completion for 'pages on|off'

 cmis.c                        | 70 +++++++++++++++++++++++++++----
 cmis.h                        |  2 +-
 ethtool.8.in                  | 18 ++++++++
 ethtool.c                     |  1 +
 internal.h                    |  4 +-
 module-common.c               | 38 +++++++++++++++++
 module-common.h               | 12 ++++++
 netlink/module-eeprom.c       | 43 +++++++++++++++----
 qsfp.c                        | 67 +++++++++++++++++++++++++----
 sfpid.c                       | 79 +++++++++++++++++++++++++++--------
 shell-completion/bash/ethtool |  2 +
 11 files changed, 294 insertions(+), 42 deletions(-)

-- 
2.51.0


             reply	other threads:[~2026-05-19 12:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 12:36 Danielle Ratson [this message]
2026-05-19 12:36 ` [PATCH ethtool-next v2 1/5] module-common: Add module_dump_eeprom_hex() helper Danielle Ratson
2026-05-19 12:36 ` [PATCH ethtool-next v2 2/5] sfpid: Refactor sff8079_show_all_nl() to separate page retrieval from display Danielle Ratson
2026-05-19 12:37 ` [PATCH ethtool-next v2 3/5] module: Add per-type EEPROM page hex dump functions Danielle Ratson
2026-05-19 12:37 ` [PATCH ethtool-next v2 4/5] netlink: module-eeprom: Add 'hex on pages on' option for page-organized hex dump Danielle Ratson
2026-05-19 12:37 ` [PATCH ethtool-next v2 5/5] ethtool: Add man page and bash completion for 'pages on|off' Danielle Ratson
2026-05-19 14:10 ` [PATCH ethtool-next v2 0/5] ethtool: Add 'pages on|off' option for module EEPROM hex dump Andrew Lunn

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=cover.1779190777.git.danieller@nvidia.com \
    --to=danieller@nvidia.com \
    --cc=idosch@nvidia.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@nvidia.com \
    /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