Netdev List
 help / color / mirror / Atom feed
* [PATCH ethtool-next v2 0/5] ethtool: Add 'pages on|off' option for module EEPROM hex dump
@ 2026-05-19 12:36 Danielle Ratson
  2026-05-19 12:36 ` [PATCH ethtool-next v2 1/5] module-common: Add module_dump_eeprom_hex() helper Danielle Ratson
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Danielle Ratson @ 2026-05-19 12:36 UTC (permalink / raw)
  To: netdev; +Cc: mkubecek, idosch, petrm, Danielle Ratson

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-05-19 14:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19 12:36 [PATCH ethtool-next v2 0/5] ethtool: Add 'pages on|off' option for module EEPROM hex dump Danielle Ratson
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox