Re: [PATCH RFC net-next] net: pcs: pcs-mtk-lynxi fix mtk_pcs_lynxi_get_state() for 2500base-x

Daniel Golle
2024-01-02T23:13:53Z

On Tue, Jan 02, 2024 at 11:13:58PM +0100, Eric Woudstra wrote:
> I believe the general idea is that phylink should be aware wether to use inband or outband negotiation in order to setup the hardware correctly. Speaking of a situation where there is a PHY attached.

Well, SGMII speed/duplex AN is not defined for 2500Base-X by any
standard and not supported by the hardware (unlike e.g. RealTek
which came up with their own proprietary extension called HiSGMII).

So we should simply never set the SGMII_SPEED_DUPLEX_AN bit if using
2500Base-X on MediaTek LynxI PCS -- in-band link status will still work,
and as 2500Base-X anyway only supports 2500M speed at full duplex it is
not a problem that speed and duplex are hard-coded in the driver in this
case imho. And that works fine for SFPs with and without
present/discoverable/accessible PHY.

Surely, having phylink take care whether SGMII_SPEED_DUPLEX_AN should be
set would be even nicer.

I believe that source of confusion here is simply that

in-band-status != SGMII_SPEED_DUPLEX_AN

We *do* have in-band-status even without having SGMII_SPEED_DUPLEX_AN set
with 2500Base-X link mode (as in: link being up or down and link, duplex
and speed is fixed anyway for 2500Base-X).

>
> On January 2, 2024 9:01:23 PM GMT+01:00, Daniel Golle <daniel@makrotopia.org> wrote:
> >On Tue, Jan 02, 2024 at 08:33:32PM +0100, Eric Woudstra wrote:
> >> [...]
> >>
> >> So if phylink_mii_c22_pcs_decode_state() should not set the speed, then it is not correctly set somewhere else.
> >
> >Yes, but the fix should go to pcs-mtk-lynxi.c and you don't need to
> >change phylink for it to work.
> >This should be enough:
> >https://patchwork.kernel.org/project/netdevbpf/patch/091e466912f1333bb76d23e95dc6019c9b71645f.1699565880.git.daniel@makrotopia.org/
> >