Re: Re: Re: Re: Re: [PATCH net-next v12 08/18] net: ethernet: mtk_eth_soc: fix 1000Base-X and 2500Base-X modes

From: Russell King (Oracle)
Date: Tue Mar 14 2023 - 05:13:03 EST


On Tue, Mar 14, 2023 at 09:51:12AM +0100, Frank Wunderlich wrote:
> Hi,
>
> at least the error-message is gone, and interface gets up when i call ethtoo to switch off autoneg.
>
> root@bpi-r3:~# dmesg | grep -i 'sfp\|eth1'
> [ 1.991838] sfp sfp-1: module OEM SFP-2.5G-T rev 1.0 sn SK2301110008 dc 230110
> [ 2.001352] mtk_soc_eth 15100000.ethernet eth1: optical SFP: interfaces=[mac=2-4,21-22, sfp=22]
> [ 2.010059] mtk_soc_eth 15100000.ethernet eth1: optical SFP: chosen 2500base-x interface
> [ 2.018145] mtk_soc_eth 15100000.ethernet eth1: requesting link mode inband/2500base-x with support 00,00000000,00000000,0000e400
> [ 34.385814] mtk_soc_eth 15100000.ethernet eth1: configuring for inband/2500base-x link mode
> [ 34.394259] mtk_soc_eth 15100000.ethernet eth1: major config 2500base-x
> [ 34.400860] mtk_soc_eth 15100000.ethernet eth1: phylink_mac_config: mode=inband/2500base-x/Unknown/Unknown/none adv=00,00000000,00000000,0000e400 pause=04 link=0 an=1

Looking good - apart from that pesky an=1 (which isn't used by the PCS
driver, and I've been thinking of killing it off anyway.) Until such
time that happens, we really ought to set that correctly, which means
an extra bit is needed in phylink_sfp_set_config(). However, this
should not affect anything.

> root@bpi-r3:~#
> root@bpi-r3:~# ethtool -s eth1 autoneg off
> root@bpi-r3:~# [ 131.031902] mtk_soc_eth 15100000.ethernet eth1: Link is Up - 2.5Gbps/Full - flow control off
> [ 131.040366] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
>
> full log here:
> https://pastebin.com/yDC7PuM2
>
> i see that an is still 1..maybe because of the fixed value here?
>
> https://elixir.bootlin.com/linux/v6.3-rc1/source/drivers/net/phy/phylink.c#L3038

Not sure what that line has to do with it - this is what the above
points to:

phylink_sfp_set_config(pl, MLO_AN_INBAND, pl->sfp_support, &config);

Anyway, the important thing is the Autoneg bit in the advertising mask
is now zero, which is what we want. That should set the PCS to disable
negotiation when in 2500baseX mode, the same as ethtool -s eth1 autoneg
off.

So I think the question becomes - what was the state that ethtool was
reporting before asking ethtool to set autoneg off, and why does that
make a difference.

> and yes, module seems to do rate adaption (it is labeled with 100M/1G/2.5G), i tried it on a 1G-Port and link came up (with workaround patch from daniel),
> traffic "works" but in tx-direction with massive retransmitts (i guess because pause-frames are ignored - pause was 00).

We'll see about addressing that later once we've got the module working
at 2.5G. However, thanks for the information.

The patch below should result in ethtool reporting 2500baseT rather than
2500baseX, and that an=1 should now be an=0. Please try it, and dump the
ethtool eth1 before asking for autoneg to be manually disabled, and also
report the kernel messages.

Thanks.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!