Subject: Re: [PATCH net-next 1/1] net: dsa: microchip: Add Microchip KSZ8895 DSA driver

From: Pavel Machek <[email-masked]>
Date: Thu, 7 Dec 2017 22:04:48 +0100

Hi!

> > I went back to my version of dsa patches, and test above works as
> > expected.
> 
> Sorry to be this late for the reply.  I finally got hold of a KSZ8895 board that
> works with my SoC board to confirm the network communication.
> 
> As expected the KSZ8895 board works correctly as the chip uses the same
> tail tagging feature in KSZ8795, and I did verify that board is
 > working.

Ok, let me retry:

> One thing to debug this problem is to dump the MIB counters.  Use the ethtool
> utility to show MIB counters of both ports:
> 
> ethtool -S lan3
> ethtool -S eth0
> 
> Assuming eth0 is the MAC controller that drives the switch, the receive counters of
> the host port of the switch should match the transmit counters of
> lan3, and vice versa.

Hmm. I'm getting some "interesting" results from mii-tool:

root@miro:~# mii-tool lan3
lan3: negotiated 1000baseT-HD flow-control, link ok

But IIRC the switch is 100mbit? And dmesg does get it right. Its just
mii-tool that is confused.

Link detection seems to work

root@miro:/sys/bus/spi/devices/spi2.0# mii-tool lan1
lan1: negotiated 1000baseT-HD flow-control, link ok
root@miro:/sys/bus/spi/devices/spi2.0# mii-tool lan1
lan1: no link

(But that really should be 100baseT, not 1000baseT).

Is there register dump available somewhere? I was using
/sys/bus/spi/devices/spi32766.0/registers but this does not seem to be
available.

I tried that ethtool -S, and counters do not seem to match:

Help welcome.

Best regards,
							Pavel

root@miro:~# ifconfig eth0 up
root@miro:~# ifconfig lan3 192.168.20.103 netmask 255.255.0.0 up
[  180.903675] IPv6: ADDRCONF(NETDEV_UP): lan3: link is not ready
root@miro:~# [  181.913284] ksz8895-switch spi2.0 lan3: Link is Up - 100Mbps/Full - flow control rx/tx
[  181.921358] IPv6: ADDRCONF(NETDEV_CHANGE): lan3: link becomes ready

root@miro:~# route add default gw 192.168.1.1
root@miro:~# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
^C
--- 192.168.1.1 ping statistics ---
17 packets transmitted, 0 packets received, 100% packet loss
root@miro:~# ethtool -S eth0
NIC statistics:
     tx_dropped: 0
     tx_packets: 55
     tx_broadcast: 35
     tx_multicast: 20
     tx_crc_errors: 0
     tx_undersize: 0
     tx_oversize: 0
     tx_fragment: 0
     tx_jabber: 0
     tx_collision: 0
     tx_64byte: 0
     tx_65to127byte: 35
     tx_128to255byte: 0
     tx_256to511byte: 20
     tx_512to1023byte: 0
     tx_1024to2047byte: 0
     tx_GTE2048byte: 0
     tx_octets: 9576
     IEEE_tx_drop: 0
     IEEE_tx_frame_ok: 55
     IEEE_tx_1col: 0
     IEEE_tx_mcol: 0
     IEEE_tx_def: 0
     IEEE_tx_lcol: 0
     IEEE_tx_excol: 0
     IEEE_tx_macerr: 0
     IEEE_tx_cserr: 0
     IEEE_tx_sqe: 0
     IEEE_tx_fdxfc: 0
     IEEE_tx_octets_ok: 9576
     rx_packets: 0
     rx_broadcast: 0
     rx_multicast: 0
     rx_crc_errors: 0
     rx_undersize: 0
     rx_oversize: 0
     rx_fragment: 0
     rx_jabber: 0
     rx_64byte: 0
     rx_65to127byte: 0
     rx_128to255byte: 0
     rx_256to511byte: 0
     rx_512to1023byte: 0
     rx_1024to2047byte: 0
     rx_GTE2048byte: 0
     rx_octets: 0
     IEEE_rx_drop: 0
     IEEE_rx_frame_ok: 0
     IEEE_rx_crc: 0
     IEEE_rx_align: 0
     IEEE_rx_macerr: 0
     IEEE_rx_fdxfc: 0
     IEEE_rx_octets_ok: 0
     p04_rx: 660
     p04_rx_hi: 0
     p04_rx_undersize: 0
     p04_rx_fragments: 20
     p04_rx_oversize: 0
     p04_rx_jabbers: 0
     p04_rx_symbol_err: 0
     p04_rx_crc_err: 0
     p04_rx_align_err: 0
     p04_rx_mac_ctrl: 0
     p04_rx_pause: 0
     p04_rx_bcast: 0
     p04_rx_mcast: 0
     p04_rx_ucast: 0
     p04_rx_64_or_less: 0
     p04_rx_65_127: 0
     p04_rx_128_255: 0
     p04_rx_256_511: 0
     p04_rx_512_1023: 0
     p04_rx_1024_1522: 0
     p04_tx: 388
     p04_tx_hi: 0
     p04_tx_late_col: 0
     p04_tx_pause: 0
     p04_tx_bcast: 0
     p04_tx_mcast: 3
     p04_tx_ucast: 0
     p04_tx_deferred: 0
     p04_tx_total_col: 0
     p04_tx_exc_col: 0
     p04_tx_single_col: 0
     p04_tx_mult_col: 0
     p04_rx_discards: 0
     p04_tx_discards: 0
root@miro:~# ethtool -S lan3
NIC statistics:
     tx_packets: 24
     tx_bytes: 1356
     rx_packets: 0
     rx_bytes: 0
     rx: 566
     rx_hi: 0
     rx_undersize: 0
     rx_fragments: 0
     rx_oversize: 0
     rx_jabbers: 0
     rx_symbol_err: 0
     rx_crc_err: 0
     rx_align_err: 0
     rx_mac_ctrl: 0
     rx_pause: 0
     rx_bcast: 0
     rx_mcast: 4
     rx_ucast: 0
     rx_64_or_less: 0
     rx_65_127: 1
     rx_128_255: 3
     rx_256_511: 0
     rx_512_1023: 0
     rx_1024_1522: 0
     tx: 0
     tx_hi: 0
     tx_late_col: 0
     tx_pause: 0
     tx_bcast: 0
     tx_mcast: 0
     tx_ucast: 0
     tx_deferred: 0
     tx_total_col: 0
     tx_exc_col: 0
     tx_single_col: 0
     tx_mult_col: 0
     rx_discards: 0
     tx_discards: 0
root@miro:~# 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html