Skip to contentSkip to conversation

net: ethernet: freescale: set FEC ethtool regs version

PATCH Applied Vivien Didelot 3 participants 4 messages Feb 14, 2019 – Mar 14, 2019

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

PATCH 1/1 net: ethernet: freescale: set FEC ethtool regs version

From: Vivien Didelot <[email protected]>

Currently the ethtool_regs version is set to 0 for FEC devices.

Use this field to store the register dump version exposed by the kernel. The choosen version 2 corresponds to the kernel compile test:

        #if defined(CONFIG_M523x) || defined(CONFIG_M527x)
        || defined(CONFIG_M528x) || defined(CONFIG_M520x)
        || defined(CONFIG_M532x) || defined(CONFIG_ARM)
        || defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST)

and version 1 corresponds to the opposite. Binaries of ethtool unaware of this version will dump the whole set as usual.

---
 drivers/net/ethernet/freescale/fec_main.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/freescale/fec_main.c +4 -0
index 2370dc204202..697c2427f2b7 100644
@@ -2098,6 +2098,7 @@ static int fec_enet_get_regs_len(struct net_device *ndev)
 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
 	defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) || \
 	defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST)
+static __u32 fec_enet_register_version = 2;
 static u32 fec_enet_register_offset[] = {
 	FEC_IEVENT, FEC_IMASK, FEC_R_DES_ACTIVE_0, FEC_X_DES_ACTIVE_0,
 	FEC_ECNTRL, FEC_MII_DATA, FEC_MII_SPEED, FEC_MIB_CTRLSTAT, FEC_R_CNTRL,
@@ -2128,6 +2129,7 @@ static u32 fec_enet_register_offset[] = {
 	IEEE_R_FDXFC, IEEE_R_OCTETS_OK
 };
 #else
+static __u32 fec_enet_register_version = 1;
 static u32 fec_enet_register_offset[] = {
 	FEC_ECNTRL, FEC_IEVENT, FEC_IMASK, FEC_IVEC, FEC_R_DES_ACTIVE_0,
 	FEC_R_DES_ACTIVE_1, FEC_R_DES_ACTIVE_2, FEC_X_DES_ACTIVE_0,
@@ -2149,6 +2151,8 @@ static void fec_enet_get_regs(struct net_device *ndev,
 	u32 *buf = (u32 *)regbuf;
 	u32 i, off;
 
+	regs->version = fec_enet_register_version;
+
 	memset(buf, 0, regs->len);
 
 	for (i = 0; i < ARRAY_SIZE(fec_enet_register_offset); i++) {
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 ethtool: fec: add pretty dump

Add pretty dump for the port registers of the "fec" kernel driver. Only offsets exposed by the driver are dumped by ethtool.

Both register dump versions are supported, version 2 which corresponds to the kernel compilation test:

    #if defined(CONFIG_M523x) || defined(CONFIG_M527x)
    || defined(CONFIG_M528x) || defined(CONFIG_M520x)
    || defined(CONFIG_M532x) || defined(CONFIG_ARM)
    || defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST)

and version 1 which corresponds to the opposite test. At the same time, detail a few interesting registers of version 2.

Kernels not patched for setting this version will cause ethtool to dump the whole set of registers as it already does today.

---
 Makefile.am |   2 +-
 ethtool.c   |   1 +
 fec.c       | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 internal.h  |   3 +
 4 files changed, 224 insertions(+), 1 deletion(-)
 create mode 100644 fec.c
Makefile.am +1 -1
index 468eed1fd..0a2fd2917 100644
@@ -10,7 +10,7 @@ ethtool_SOURCES = ethtool.c ethtool-copy.h internal.h net_tstamp-copy.h \
 if ETHTOOL_ENABLE_PRETTY_DUMP
 ethtool_SOURCES += \
 		  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	\
+		  fec.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	\
 		  sff-common.c sff-common.h sfpid.c sfpdiag.c	\
ethtool.c +1 -0
index fb4c0886c..96953ceae 100644
@@ -1167,6 +1167,7 @@ static const struct {
 	{ "fjes", fjes_dump_regs },
 	{ "lan78xx", lan78xx_dump_regs },
 	{ "dsa", dsa_dump_regs },
+	{ "fec", fec_dump_regs },
 #endif
 };
 
fec.c new file +219 -0

219 lines not on this page · raw message

internal.h +3 -0
index 84b0f9cef..aecf1ce60 100644
@@ -357,4 +357,7 @@ 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);
 
+/* i.MX Fast Ethernet Controller */
+int fec_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
+
 #endif /* ETHTOOL_INTERNAL_H__ */
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH] ethtool: fec: add pretty dump

Quoted 11 lines · Vivien Didelot

Add pretty dump for the port registers of the "fec" kernel driver. Only offsets exposed by the driver are dumped by ethtool.

Both register dump versions are supported, version 2 which corresponds to the kernel compilation test:

    #if defined(CONFIG_M523x) || defined(CONFIG_M527x)
    || defined(CONFIG_M528x) || defined(CONFIG_M520x)
    || defined(CONFIG_M532x) || defined(CONFIG_ARM)
    || defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST)
Quoted 7 lines

and version 1 which corresponds to the opposite test. At the same time, detail a few interesting registers of version 2.

Kernels not patched for setting this version will cause ethtool to dump the whole set of registers as it already does today.

Queued for next release -- thanks!

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
maintainer Applied
#3 lore raw
In reply to Vivien Didelot

From: Vivien Didelot <[email protected]>
Date: Thu, 14 Feb 2019 11:15:35 -0500

Quoted 12 lines

From: Vivien Didelot <[email protected]>

Currently the ethtool_regs version is set to 0 for FEC devices.

Use this field to store the register dump version exposed by the kernel. The choosen version 2 corresponds to the kernel compile test:

        #if defined(CONFIG_M523x) || defined(CONFIG_M527x)
        || defined(CONFIG_M528x) || defined(CONFIG_M520x)
        || defined(CONFIG_M532x) || defined(CONFIG_ARM)
        || defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST)
Quoted 4 lines

and version 1 corresponds to the opposite. Binaries of ethtool unaware of this version will dump the whole set as usual.

Applied, thanks Vivien.