[v2,1/7] ethtool: dsa: add pretty dump

Message ID 20181218190641.31883-2-vivien.didelot@gmail.com
State Accepted
Delegated to: John Linville
Headers show
Series
  • ethtool: pretty dump mv88e6xxx registers
Related show

Commit Message

Vivien Didelot Dec. 18, 2018, 7:06 p.m.
This patch adds the preliminary bits for pretty dumping the registers
of the "dsa" kernel drivers.

This patch does not pretty dump anything yet.

Following patches will add support for the "mv88e6xxx" DSA driver.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
---
 Makefile.am |  2 +-
 dsa.c       | 12 ++++++++++++
 ethtool.c   |  1 +
 internal.h  |  3 +++
 4 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 dsa.c

Patch

diff --git a/Makefile.am b/Makefile.am
index 14f79b6..468eed1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,7 @@  ethtool_SOURCES = ethtool.c ethtool-copy.h internal.h net_tstamp-copy.h \
 		  rxclass.c
 if ETHTOOL_ENABLE_PRETTY_DUMP
 ethtool_SOURCES += \
-		  amd8111e.c de2104x.c e100.c e1000.c et131x.c igb.c	\
+		  amd8111e.c de2104x.c dsa.c e100.c e1000.c et131x.c igb.c	\
 		  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	\
diff --git a/dsa.c b/dsa.c
new file mode 100644
index 0000000..83396b5
--- /dev/null
+++ b/dsa.c
@@ -0,0 +1,12 @@ 
+#include <stdio.h>
+#include <string.h>
+
+#include "internal.h"
+
+int dsa_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
+{
+	/* DSA per-driver register dump */
+
+	/* Fallback to hexdump */
+	return 1;
+}
diff --git a/ethtool.c b/ethtool.c
index 2f7e96b..f1f1ec2 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1166,6 +1166,7 @@  static const struct {
 	{ "vmxnet3", vmxnet3_dump_regs },
 	{ "fjes", fjes_dump_regs },
 	{ "lan78xx", lan78xx_dump_regs },
+	{ "dsa", dsa_dump_regs },
 #endif
 };
 
diff --git a/internal.h b/internal.h
index b239dc7..84b0f9c 100644
--- a/internal.h
+++ b/internal.h
@@ -354,4 +354,7 @@  int fjes_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
 /* MICROCHIP LAN78XX USB ETHERNET Controller */
 int lan78xx_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
 
+/* Distributed Switch Architecture */
+int dsa_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
+
 #endif /* ETHTOOL_INTERNAL_H__ */