[PATCH v2 0/4] ethdev: add API to decode module EEPROM

Roman Khromenok roma55592 at yandex.ru
Mon Sep 28 10:47:25 CEST 2026


Since 22.07, ethdev contains SFF-8079, SFF-8472 and SFF-8636 decoders
for plugin module EEPROM (SFP, QSFP), ported from ethtool.
They are reachable only through the telemetry command
/ethdev/module_eeprom, which reads the EEPROM of a DPDK port
and returns the result as a telemetry dictionary.

An application which needs to show transceiver information
(vendor, part number, serial number, optical power) in its own
interface cannot reuse this code and has to duplicate it.
It is also common to have some ports managed by DPDK and others
by the Linux kernel; the kernel returns the EEPROM through the ethtool
interface with the same module types and layout, but there is no way
to decode it with DPDK.

This series exposes the decoders through a small experimental function:

  int rte_eth_module_eeprom_parse(uint32_t type,
          const uint8_t *data, uint32_t length,
          rte_eth_module_eeprom_field_cb cb, void *arg);

Each decoded field is reported to the callback as a pair of strings,
the same names and values as in the telemetry output.
The function does not access any device and does not require
EAL initialization.

Patch 1 makes the decoders write to a callback instead of
the telemetry dictionary; the telemetry output is unchanged.
Patch 2 adds the buffer length checks needed by a public API:
currently SFF-8079 and SFF-8472 decoders do not receive the length.
Patch 3 adds the API with documentation and release notes.
Patch 4 adds unit tests.

v2:
- patch 2: do not read the SFF-8636 alarm and warning thresholds
  from page 03h when only 256 bytes are available (out of bounds read
  found by ASan in the new unit test).

Roman Khromenok (4):
  ethdev: decouple SFF module EEPROM decoders from telemetry
  ethdev: check module EEPROM length before decoding
  ethdev: add API to decode module EEPROM
  test: add ethdev module EEPROM decoding tests

 .mailmap                                |   1 +
 app/test/meson.build                    |   1 +
 app/test/test_ethdev_module_eeprom.c    | 285 ++++++++++++++++++++++++
 doc/guides/prog_guide/ethdev/ethdev.rst |  44 ++++
 doc/guides/rel_notes/release_26_11.rst  |   7 +
 lib/ethdev/rte_ethdev.c                 |  20 ++
 lib/ethdev/rte_ethdev.h                 |  50 +++++
 lib/ethdev/sff_8079.c                   |  20 +-
 lib/ethdev/sff_8472.c                   |   2 +-
 lib/ethdev/sff_8636.c                   |  74 +++---
 lib/ethdev/sff_common.c                 |  14 +-
 lib/ethdev/sff_common.h                 |  14 +-
 lib/ethdev/sff_telemetry.c              |  94 +++++---
 lib/ethdev/sff_telemetry.h              |  25 ++-
 14 files changed, 552 insertions(+), 99 deletions(-)
 create mode 100644 app/test/test_ethdev_module_eeprom.c

-- 
2.47.3



More information about the dev mailing list