Hi Vivien, Le 12/14/18 à 6:50 PM, Vivien Didelot a écrit : > This patch series adds support to pretty dump the registers of user > ports created by the kernel "dsa" subsystem. > > The first patch adds the base support for "dsa" interfaces. > > The second patch adds the boilerplate for the "mv88e6xxx" DSA driver, > all using 32 registers of 16 bits, the switch ID being available in > the port identification register 3. Support for other DSA drivers such > as "b53" or "ksz" can be added similarly later. Because the different > switches supported by mv88e6xxx have slightly different register layout, > we keep it simple and stupid by providing one dump function per switch.
This looks good to me, the only "concern" is that mv88e6xxx set regs->version = 0, while we could probably put the switch model in there directly which would avoid other drivers to have to put the chip ID in regs[3] since that may, or may not be convenient. For instance the B53 devices are organized by page (0-255), and then by offsets (0-255 again). Within a page, there are registers that are really per-port and some that are global. Also, registers can be 8/16/32/48/64 bits (which is going to be interesting to support). > > The remaining patches add support for the switch models currently > supported by the mv88e6xxx driver. Here's an example of dump of the > 32 registers of a 88E6352 port: > > # ethtool -d lan3 > 88E6352 Switch Port Registers > ------------------------------ > 00: Port Status 0x500f > Pause Enabled 0 > My Pause 1 > 802.3 PHY Detected 1 > Link Status Down > Duplex Half > Speed 10 Mbps > EEE Enabled 0 > Transmitter Paused 0 > Flow Control 0 > Config Mode 0xf > 01: Physical Control 0x0003 > RGMII Receive Timing Control Default > RGMII Transmit Timing Control Default > 200 BASE Mode 100 > Flow Control's Forced value 0 > Force Flow Control 0 > Link's Forced value Down > Force Link 0 > Duplex's Forced value Half > Force Duplex 0 > Force Speed Not forced > 02: Jamming Control 0x0000 > 03: Switch Identifier 0x3521 > 04: Port Control 0x0433 > Source Address Filtering controls Disabled > Egress Mode Unmodified > Ingress & Egress Header Mode 0 > IGMP and MLD Snooping 1 > Frame Mode Normal > VLAN Tunnel 0 > TagIfBoth 0 > Initial Priority assignment Tag & IP Priority > Egress Flooding mode No unknown DA > Port State Forwarding > 05: Port Control 1 0x0000 > Message Port 0 > Trunk Port 0 > Trunk ID 0 > FID[11:4] 0x000 > 06: Port Base VLAN Map (Header) 0x0060 > FID[3:0] 0x000 > VLANTable 5 6 > 07: Default VLAN ID & Priority 0x0000 > Default Priority 0x0 > Force to use Default VID 0 > Default VLAN Identifier 0 > 08: Port Control 2 0x2080 > Force good FCS in the frame 0 > Jumbo Mode 10240 > 802.1QMode Disabled > Discard Tagged Frames 0 > Discard Untagged Frames 0 > Map using DA hits 1 > ARP Mirror enable 0 > Egress Monitor Source Port 0 > Ingress Monitor Source Port 0 > Use Default Queue Priority 0 > Default Queue Priority 0x0 > 09: Egress Rate Control 0x0001 > 10: Egress Rate Control 2 0x0000 > 11: Port Association Vector 0x0001 > 12: Port ATU Control 0x0000 > 13: Override 0x0000 > 14: Policy Control 0x0000 > 15: Port Ether Type 0x9100 > 16: InDiscardsLo Frame Counter 0x0000 > 17: InDiscardsHi Frame Counter 0x0000 > 18: InFiltered/TcamCtr Frame Counter 0x0000 > 19: Rx Frame Counter 0x0000 > 20: Reserved 0x0000 > 21: Reserved 0x0000 > 22: LED Control 0x0022 > 23: Reserved 0x0000 > 24: Tag Remap 0-3 0x3210 > 25: Tag Remap 4-7 0x7654 > 26: Reserved 0x0000 > 27: Queue Counters 0x8000 > 28: Reserved 0x0000 > 29: Reserved 0x0000 > 30: Reserved 0x0000 > 31: Reserved 0x0000 > > > Vivien Didelot (7): > ethtool: dsa: add pretty dump > ethtool: dsa: mv88e6xxx: add pretty dump > ethtool: dsa: mv88e6xxx: add pretty dump for 88E6185 > ethtool: dsa: mv88e6xxx: add pretty dump for 88E6161 > ethtool: dsa: mv88e6xxx: add pretty dump for 88E6352 > ethtool: dsa: mv88e6xxx: add pretty dump for 88E6390 > ethtool: dsa: mv88e6xxx: pretty dump others > > Makefile.am | 2 +- > dsa.c | 685 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > ethtool.c | 1 + > internal.h | 3 + > 4 files changed, 690 insertions(+), 1 deletion(-) > create mode 100644 dsa.c > -- Florian