public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Golle <daniel@makrotopia.org>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: "Andrew Lunn" <andrew@lunn.ch>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Marek Behún" <kabel@kernel.org>, "Pali Rohár" <pali@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Eric Woudstra" <ericwouds@gmail.com>,
	"John Crispin" <john@phrozen.org>
Subject: Re: [PATCH net] net: phylink: set phy_state interface when attaching SFP
Date: Fri, 1 Dec 2023 18:19:20 +0000	[thread overview]
Message-ID: <ZWojqBKfZvShtjel@makrotopia.org> (raw)
In-Reply-To: <ZWGwJE0aCC/H3O2A@shell.armlinux.org.uk>

On Sat, Nov 25, 2023 at 08:28:20AM +0000, Russell King (Oracle) wrote:
> On Sat, Nov 25, 2023 at 04:56:20AM +0000, Daniel Golle wrote:
> > Assume 'usxgmii' being set as initial interface mode in DTS. Now plug
> > a 2.5GBase-T SFP module with exposed PHY. Currently this results in
> > a rather bizare situation:
> > 
> > RTL8221B-VB-CG 2.5Gbps PHY (C45) i2c:sfp1-wan:11: rtl822x_c45_get_features: supported=00,00000000,00008000,000080ef
> > mtk_soc_eth 15100000.ethernet eth2: requesting link mode phy/2500base-x with support 00,00000000,00008000,0000e0ef
> > mtk_soc_eth 15100000.ethernet eth2: switched to phy/2500base-x link mode   <<< !!!!!!
> > mtk_soc_eth 15100000.ethernet eth2: major config usxgmii    <<< !!!!!!
> > mtk_soc_eth 15100000.ethernet eth2: phylink_mac_config: mode=phy/usxgmii/none adv=00,00000000,00000000,00000000 pause=00
> > mtk_soc_eth 15100000.ethernet eth2: PHY [i2c:sfp1-wan:11] driver [RTL8221B-VB-CG 2.5Gbps PHY (C45)] (irq=POLL)
> > mtk_soc_eth 15100000.ethernet eth2: phy: 2500base-x setting supported 00,00000000,00008000,0000e0ef advertising 00,00000000,00008000,0000e0ef
> > 
> > Then the link seemingly comes up (but is dead) because no subsequent
> > call to phylink_major_config actually configured MAC and PCS for
> > 2500base-x mode.
> > 
> > This is because phylink_mac_initial_config() considers
> > pl->phy_state.interface if in MLO_AN_PHY mode while
> > phylink_sfp_set_config() only sets pl->link_config.interface.
> > 
> > Also set pl->phy_state.interface in phylink_sfp_set_config().
> 
> Does it _actually_ matter?

It does matter, I'm suggesting this change because the SFP module
won't work without it.

> When the PHY's link comes up, doesn't it get sorted out for the real
> mode that will be used?

That does happen once the interface mode *changes* to anything else,
than 2500M/Full and the PHY driver sets state->interface to SGMII.
However, initially it does *not* happen, probably because phylink
ends up believing MAC and PCS are already operating in 2500base-x
mode (but that's not the case).

Previously (eg. with the BananaPi R3) this has not been a problem
because the default interface mode defined in device tree anyway has
also been 2500base-x. Now that I'm testing the same module with the
R4 which uses usxgmii by default the problem surfaced.

  reply	other threads:[~2023-12-01 18:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-25  4:56 [PATCH net] net: phylink: set phy_state interface when attaching SFP Daniel Golle
2023-11-25  8:28 ` Russell King (Oracle)
2023-12-01 18:19   ` Daniel Golle [this message]
2023-12-02  9:18     ` Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZWojqBKfZvShtjel@makrotopia.org \
    --to=daniel@makrotopia.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ericwouds@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=john@phrozen.org \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pali@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox