Skip to contentSkip to conversation

ethtool: Addition of -m option to dump module eeprom

PATCH Applied Stuart Hodgson 2 participants 2 messages May 18, 2012 – May 23, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 ethtool: Addition of -m option to dump module eeprom

The -m option now allows for retrieval of EEPROM information form a plug in module such as SFP+. This shows specific information about the type and capabilities of the module in use The format can be easily extended to support other modules types such as QSFP in future. Raw data dump is also supported.

---
 Makefile.am    |    2 +-
 ethtool.8.in   |   10 ++
 ethtool.c      |   87 +++++++++++++
 internal.h     |    3 +
 sfpid.c        |  387 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 test-cmdline.c |   10 ++
 6 files changed, 498 insertions(+), 1 deletions(-)
 create mode 100644 sfpid.c
Makefile.am +1 -1
index 4b0eb17..e40fc99 100644
@@ -9,7 +9,7 @@ ethtool_SOURCES = ethtool.c ethtool-copy.h internal.h \
 		  fec_8xx.c ibm_emac.c ixgb.c ixgbe.c natsemi.c	\
 		  pcnet32.c realtek.c tg3.c marvell.c vioc.c	\
 		  smsc911x.c at76c50x-usb.c sfc.c stmmac.c	\
-		  rxclass.c
+		  rxclass.c sfpid.c
 
 TESTS = test-cmdline
 check_PROGRAMS = test-cmdline test-one-cmdline
ethtool.8.in +10 -0
index 63d5d48..cba86ff 100644
@@ -318,6 +318,13 @@ ethtool \- query or control network driver and hardware settings
 .BN other
 .BN combined
 .HP
+.B ethtool \-m|\-\-dump\-module\-eeprom
+.I devname
+.B2 raw on off
+.B2 hex on off
+.BN offset
+.BN length
+.HP
 .B ethtool \-\-show\-priv\-flags
 .I devname
 .HP
@@ -789,6 +796,9 @@ Changes the number of channels used only for other purposes e.g. link interrupts
 .BI combined \ N
 Changes the number of multi-purpose channels.
 .TP
+.B \-m \-\-dump\-module\-eeprom
+Retrieves and if possible decodes the EEPROM from plugin modules, e.g SFP+, QSFP
+.TP
 .B \-\-show\-priv\-flags
 Queries the specified network device for its private flags.  The
 names and meanings of private flags (if any) are defined by each
ethtool.c +87 -0

99 lines not on this page · raw message

internal.h +3 -0
index 867c0ea..576b79b 100644
@@ -174,4 +174,7 @@ int rxclass_rule_ins(struct cmd_context *ctx,
 		     struct ethtool_rx_flow_spec *fsp);
 int rxclass_rule_del(struct cmd_context *ctx, __u32 loc);
 
+/* Module EEPROM parsing code */
+void sff8079_show_all(const __u8 *id);
+
 #endif /* ETHTOOL_INTERNAL_H__ */
sfpid.c new file +387 -0

387 lines not on this page · raw message

test-cmdline.c +10 -0
index 4718842..f830d54 100644
@@ -210,6 +210,16 @@ static struct test_case {
 	{ 0, "--show-priv-flags devname" },
 	{ 1, "--show-priv-flags devname foo" },
 	{ 1, "--show-priv-flags" },
+	{ 1, "-m" },
+	{ 0, "-m devname" },
+	{ 1, "--dump-module-eeprom" },
+	{ 0, "--dump-module-eeprom devname" },
+	{ 0, "-m devname raw on" },
+	{ 0, "-m devname raw off" },
+	{ 0, "-m devname hex on" },
+	{ 0, "-m devname hex off" },
+	{ 1, "-m devname hex on raw on" },
+	{ 0, "-m devname offset 4 length 6" },
 	/* can't test --set-priv-flags yet */
 	{ 0, "-h" },
 	{ 0, "--help" },
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 6 lines · Stuart Hodgson

The -m option now allows for retrieval of EEPROM information form a plug in module such as SFP+. This shows specific information about the type and capabilities of the module in use The format can be easily extended to support other modules types such as QSFP in future. Raw data dump is also supported.

[...]

Applied, thanks.

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.