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

From: Frank Wunderlich
Date: Tue Mar 14 2023 - 04:51:42 EST


Hi,

first i removed maintainers/reviewers and mtk people from this thread to (hopefully) no more disturb the review-process of daniels patch-series.

> Gesendet: Montag, 13. März 2023 um 23:57 Uhr
> Von: "Russell King (Oracle)" <linux@xxxxxxxxxxxxxxx>
>
> On Mon, Mar 13, 2023 at 07:39:00PM +0100, Frank Wunderlich wrote:
> > > Gesendet: Montag, 13. März 2023 um 11:59 Uhr
> > > Von: "Russell King (Oracle)" <linux@xxxxxxxxxxxxxxx>
> >
> > > Since describing what I wanted you to test didn't work, here's a patch
> > > instead, based upon the quirk that you provided (which is what I'd have
> > > written anyway). Add a "#define DEBUG" to the top of
> > > drivers/net/phy/phylink.c in addition to applying this patch, and please
> > > test the resulting kernel, sending me the resulting kernel messages, and
> > > also reporting whether this works or not.
> >
> > Hi
> >
> > thx for the patch...sorry for misunderstanding. i thought the sfp quirk only sets a flag and i need to change
> > something in phylink.c to do the same as done on userspace, so i tried to simulate the userspace call there only for testing.
> >
> > here relevant parts of debug
> >
> > [ 1.990637] sfp sfp-1: module OEM SFP-2.5G-T rev 1.0 sn SK2301110008 dc 230110
> > [ 2.000147] mtk_soc_eth 15100000.ethernet eth1: optical SFP: interfaces=[mac=2-4,21-22, sfp=]
>
> First thing... why are the SFP interfaces here empty? They should be
> listing at least 22 for this SFP. Looking at the full log, you have
> omitted:
>
> [ 2.008678] mtk_soc_eth 15100000.ethernet eth1: unsupported SFP module: no common interface modes

not sure why i have not added this as it should match the second grep for eth1 (sfp had not matched because of missing -i flag)
it was not intended to omit any relevant data, just wanted to pre-filter from full log.

> which seems to suggest that we need more than what I provided - and
> is a big pointer to why it isn't working... and I guess has been there
> all along.
>
> This means that the interface configuration never gets updated, so
> its pointless trying to add quirks etc. Error messages are rather
> a key point.

thats clear, but somehow missed this one, sorry

> So everything after this is just not relevant. Let's fix that. Here's
> an updated patch which sets an interface mode for this SFP and sets a
> link mode for it (although we use 2500baseX rather than baseT here
> just to test this). I'm guessing it also does rate adaption, which we
> will have to work out later.

many thanks for guiding through this ;)

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'
[ 0.000000] Linux version 6.3.0-rc1-bpi-r3-sfp13 (frank@frank-G5) (aarch64-linux-gnu-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #1 SMP Tue Mar 143
[ 1.653862] sfp sfp-1: Host maximum power 1.0W
[ 1.658862] sfp sfp-2: Host maximum power 1.0W
[ 1.812551] mtk_soc_eth 15100000.ethernet eth1: mediatek frame engine at 0xffffffc00b080000, irq 123
[ 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
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

ethtool output after autoneg workaround:

Settings for eth1:
Supported ports: [ FIBRE ]
Supported link modes: 2500baseX/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: No
Supported FEC modes: Not reported
Advertised link modes: 2500baseX/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Speed: 2500Mb/s
Duplex: Full
Auto-negotiation: off
Port: FIBRE
PHYAD: 0
Transceiver: internal
Current message level: 0x000000ff (255)
drv probe link timer ifdown ifup rx_err tx_err
Link detected: yes

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).

regards Frank