From: Roman Khromenok <roma55592@yandex.ru>
To: dev@dpdk.org
Cc: Thomas Monjalon <thomas@monjalon.net>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: [PATCH v2 0/4] ethdev: add API to decode module EEPROM
Date: Mon, 28 Sep 2026 10:47:25 +0200 [thread overview]
Message-ID: <20260928084729.973192-1-roma55592@yandex.ru> (raw)
In-Reply-To: <20260927112041.775972-1-roma55592@yandex.ru>
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
next prev parent reply other threads:[~2026-09-28 8:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 11:20 [PATCH 0/4] ethdev: add API to decode module EEPROM Roman Khromenok
2026-09-27 11:20 ` [PATCH 1/4] ethdev: decouple SFF module EEPROM decoders from telemetry Roman Khromenok
2026-09-27 11:20 ` [PATCH 2/4] ethdev: check module EEPROM length before decoding Roman Khromenok
2026-09-27 11:20 ` [PATCH 3/4] ethdev: add API to decode module EEPROM Roman Khromenok
2026-09-27 11:20 ` [PATCH 4/4] test: add ethdev module EEPROM decoding tests Roman Khromenok
2026-09-28 8:47 ` Roman Khromenok [this message]
2026-09-28 8:47 ` [PATCH v2 1/4] ethdev: decouple SFF module EEPROM decoders from telemetry Roman Khromenok
2026-09-28 8:47 ` [PATCH v2 2/4] ethdev: check module EEPROM length before decoding Roman Khromenok
2026-09-28 8:47 ` [PATCH v2 3/4] ethdev: add API to decode module EEPROM Roman Khromenok
2026-09-28 8:47 ` [PATCH v2 4/4] test: add ethdev module EEPROM decoding tests Roman Khromenok
2026-09-28 18:11 ` [PATCH v2 0/4] ethdev: add API to decode module EEPROM Stephen Hemminger
2026-09-29 7:07 ` [PATCH v3 0/6] " Roman Khromenok
2026-09-29 7:07 ` [PATCH v3 1/6] ethdev: fix out-of-bounds read of SFF-8636 thresholds Roman Khromenok
2026-09-29 7:07 ` [PATCH v3 2/6] ethdev: decouple SFF module EEPROM decoders from telemetry Roman Khromenok
2026-09-29 7:07 ` [PATCH v3 3/6] ethdev: check module EEPROM length before decoding Roman Khromenok
2026-09-29 7:07 ` [PATCH v3 4/6] ethdev: avoid unaligned access in SFF-8472 decoder Roman Khromenok
2026-09-29 7:07 ` [PATCH v3 5/6] ethdev: add API to decode module EEPROM Roman Khromenok
2026-09-29 7:07 ` [PATCH v3 6/6] test: add ethdev module EEPROM decoding tests Roman Khromenok
2026-09-29 16:02 ` [PATCH v3 0/6] ethdev: add API to decode module EEPROM Stephen Hemminger
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=20260928084729.973192-1-roma55592@yandex.ru \
--to=roma55592@yandex.ru \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=thomas@monjalon.net \
/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