[PATCH v2 2/2] app/procinfo: add option to decode module EEPROM
Roman Khromenok
roma55592 at yandex.ru
Thu Oct 29 19:20:33 CET 2026
The --show-module-eeprom option only prints a hexdump of the
pluggable module EEPROM, which has to be decoded by hand against
the SFF specifications.
Add an optional "decode" value, --show-module-eeprom=decode,
to print the fields decoded by the transceiver library,
such as the vendor, the transceiver type and the digital
diagnostics, as the testpmd command "show port <port_id>
module_eeprom decode" does. Without the value, the hexdump
is printed as before.
Signed-off-by: Roman Khromenok <roma55592 at yandex.ru>
---
app/proc-info/main.c | 36 +++++++++++++++++++++++++++++++---
app/proc-info/meson.build | 2 +-
doc/guides/tools/proc_info.rst | 9 ++++++---
3 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index d918a0a3c8..da4c3afb3d 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -39,6 +39,7 @@
#include <rte_cryptodev.h>
#include <rte_tm.h>
#include <rte_hexdump.h>
+#include <rte_transceiver.h>
#include <rte_version.h>
#include <rte_eventdev.h>
@@ -117,6 +118,8 @@ static uint32_t enable_shw_fw_version;
static uint32_t enable_shw_rss_reta;
/* Enable show module eeprom information. */
static uint32_t enable_shw_module_eeprom;
+/* Decode module eeprom instead of a hexdump. */
+static uint32_t module_eeprom_decode;
/* Enable dump Rx/Tx descriptor. */
static uint32_t enable_shw_rx_desc_dump;
@@ -184,7 +187,8 @@ proc_info_usage(const char *prgname)
" --version: to display DPDK version\n"
" --firmware-version: to display ethdev firmware version\n"
" --show-rss-reta: to display ports redirection table\n"
- " --show-module-eeprom: to display ports module eeprom information\n"
+ " --show-module-eeprom[=decode]: to display ports module eeprom information, "
+ "as a hexdump or decoded\n"
" --show-rx-descriptor queue_id:offset:num to display ports Rx descriptor information. "
"queue_id: A Rx queue identifier on this port. "
"offset: The offset of the descriptor starting from tail. "
@@ -445,7 +449,7 @@ proc_info_parse_args(int argc, char **argv)
{"version", 0, NULL, 0},
{"firmware-version", 0, NULL, 0},
{"show-rss-reta", 0, NULL, 0},
- {"show-module-eeprom", 0, NULL, 0},
+ {"show-module-eeprom", optional_argument, NULL, 0},
{"show-rx-descriptor", required_argument, NULL, 1},
{"show-tx-descriptor", required_argument, NULL, 1},
{"show-edev-queue-xstats", required_argument, NULL, 0},
@@ -539,8 +543,17 @@ proc_info_parse_args(int argc, char **argv)
"show-rss-reta", MAX_LONG_OPT_SZ))
enable_shw_rss_reta = 1;
else if (!strncmp(long_option[option_index].name,
- "show-module-eeprom", MAX_LONG_OPT_SZ))
+ "show-module-eeprom", MAX_LONG_OPT_SZ)) {
enable_shw_module_eeprom = 1;
+ if (optarg != NULL) {
+ if (strcmp(optarg, "decode") != 0) {
+ fprintf(stderr, "Invalid show-module-eeprom value: %s\n",
+ optarg);
+ return -1;
+ }
+ module_eeprom_decode = 1;
+ }
+ }
else if (!strncmp(long_option[option_index].name,
"edev-dump-xstats", MAX_LONG_OPT_SZ)) {
int ret = parse_eventdev_dump_xstats_params(optarg);
@@ -1850,6 +1863,13 @@ show_port_rss_reta_info(void)
}
}
+static void
+module_eeprom_field_print(const char *name, const char *value,
+ __rte_unused void *arg)
+{
+ printf("\t%-41s : %s\n", name, value);
+}
+
static void
show_module_eeprom_info(void)
{
@@ -1891,6 +1911,16 @@ show_module_eeprom_info(void)
continue;
}
+ if (module_eeprom_decode) {
+ ret = rte_transceiver_decode(module_info.type,
+ eeprom_info.data, eeprom_info.length,
+ module_eeprom_field_print, NULL);
+ if (ret != 0)
+ fprintf(stderr, "Port %u module EEPROM decode error: %s\n",
+ i, strerror(-ret));
+ continue;
+ }
+
rte_hexdump(stdout, "hexdump", eeprom_info.data,
eeprom_info.length);
printf("Finish -- Port: %u MODULE EEPROM length: %d bytes\n",
diff --git a/app/proc-info/meson.build b/app/proc-info/meson.build
index 316253cd5d..ee33615dfc 100644
--- a/app/proc-info/meson.build
+++ b/app/proc-info/meson.build
@@ -8,7 +8,7 @@ if is_windows
endif
sources = files('main.c')
-deps += ['ethdev', 'security', 'eventdev']
+deps += ['ethdev', 'security', 'eventdev', 'transceiver']
if dpdk_conf.has('RTE_LIB_METRICS')
deps += 'metrics'
endif
diff --git a/doc/guides/tools/proc_info.rst b/doc/guides/tools/proc_info.rst
index 0a54f20f8c..36f8000408 100644
--- a/doc/guides/tools/proc_info.rst
+++ b/doc/guides/tools/proc_info.rst
@@ -21,7 +21,7 @@ The application has a number of command line options:
--stats-reset | --xstats-reset] [ --show-port | --show-tm | --show-crypto |
--show-ring[=name] | --show-mempool[=name] | --iter-mempool=name |
--show-port-private | --version | --firmware-version | --show-rss-reta |
- --show-module-eeprom | --show-rx-descriptor queue_id:offset:num |
+ --show-module-eeprom[=decode] | --show-rx-descriptor queue_id:offset:num |
--show-tx-descriptor queue_id:offset:num | --show-edev-queue-xstats=queue_num:evdev_id |
--show-edev-port-xstats=port_num :evdev_id | --edev-dump-xstats=evdev_id |
--edev-reset-xstats=evdev_id | --show-edev-device-xstats=evdev_id]
@@ -87,8 +87,11 @@ The firmware-version parameter displays ethdev firmware version.
**--show-rss-reta**
The show-rss-reta parameter displays ports rss redirection table.
-**--show-module-eeprom**
-The show-module-eeprom parameter displays ports module eeprom information.
+**--show-module-eeprom[=decode]**
+The show-module-eeprom parameter displays ports module eeprom information
+as a hexdump. With the decode value, the module eeprom is decoded
+according to the SFF specifications, for example the vendor,
+the transceiver type and the digital diagnostics.
**--show-rx-descriptor queue_id:offset:num**
The show-rx-descriptor parameter displays ports Rx descriptor information
--
2.47.3
More information about the dev
mailing list