[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1b102aa-1597-0552-641b-56a811a2520e@seco.com>
Date: Mon, 21 Nov 2022 13:38:31 -0500
From: Sean Anderson <sean.anderson@...o.com>
To: Vladimir Oltean <vladimir.oltean@....com>, netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Russell King <linux@...linux.org.uk>,
Florian Fainelli <f.fainelli@...il.com>,
UNGLinuxDriver@...rochip.com,
bcm-kernel-feedback-list@...adcom.com,
Madalin Bucur <madalin.bucur@....nxp.com>,
Camelia Groza <camelia.groza@....com>,
Claudiu Manoil <claudiu.manoil@....com>,
Ioana Ciornei <ioana.ciornei@....com>,
Maxim Kochetkov <fido_max@...ox.ru>,
Antoine Tenart <atenart@...nel.org>,
Michael Walle <michael@...le.cc>,
Raag Jadav <raagjadav@...il.com>,
Siddharth Vadapalli <s-vadapalli@...com>,
Ong Boon Leong <boon.leong.ong@...el.com>,
Colin Foster <colin.foster@...advantage.com>,
Marek Behun <marek.behun@....cz>
Subject: Re: [PATCH v4 net-next 0/8] Let phylink manage in-band AN for the PHY
Hi Vladimir,
On 11/17/22 19:01, Vladimir Oltean wrote:
> Problem statement
> ~~~~~~~~~~~~~~~~~
>
> The on-board SERDES link between an NXP (Lynx) PCS and a PHY may not
> work, depending on whether U-Boot networking was used on that port or not.
>
> There is no mechanism in Linux (with phylib/phylink, at least) to ensure
> that the MAC driver and the PHY driver have synchronized settings for
> in-band autoneg. It all depends on the 'managed = "in-band-status"'
> device tree property, which does not reflect a stable and unchanging
> reality, and furthermore, some (older) device trees may have this
> property missing when they shouldn't.
>
> Proposed solution
> ~~~~~~~~~~~~~~~~~
>
> Extend the phy_device API with 2 new methods:
> - phy_validate_an_inband()
> - phy_config_an_inband()
>
> Extend phylink with an opt-in bool sync_an_inband which makes sure that
> the configured "unsigned int mode" (MLO_AN_PHY/MLO_AN_INBAND) is both
> supported by the PHY, and actually applied to the PHY.
>
> Make NXP drivers which use phylink and the Lynx PCS driver opt into the
> new behavior. Other drivers can trivially do this as well, by setting
> struct phylink_config :: sync_an_inband to true.
>
> Compared to other solutions
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Sean Anderson, in commit 5d93cfcf7360 ("net: dpaa: Convert to phylink"),
> sets phylink_config :: ovr_an_inband to true. This doesn't quite solve
> all problems, because we don't *know* that the PHY is set for in-band
> autoneg. For example with the VSC8514, it all depends on what the
> bootloader has/has not done. This solution eliminates the bootloader
> dependency by actually programming in-band autoneg in the VSC8514 PHY.
>
> Change log
> ~~~~~~~~~~
>
> Changes in v4:
> Make all new behavior opt-in.
> Fix bug when Generic PHY driver is used.
> Dropped support for PHY_AN_INBAND_OFF in at803x.
>
> Changes in v3:
> Added patch for the Atheros PHY family.
> v3 at:
> https://patchwork.kernel.org/project/netdevbpf/cover/20210922181446.2677089-1-vladimir.oltean@nxp.com/
>
> Changes in v2:
> Incorporated feedback from Russell, which was to consider PHYs on SFP
> modules too, and unify phylink's detection of PHYs with broken in-band
> autoneg with the newly introduced PHY driver methods.
> v2 at:
> https://patchwork.kernel.org/project/netdevbpf/cover/20210212172341.3489046-1-olteanv@gmail.com/
>
> Vladimir Oltean (8):
> net: phylink: let phylink_sfp_config_phy() determine the MLO_AN_* mode
> to use
> net: phylink: introduce generic method to query PHY in-band autoneg
> capability
> net: phy: bcm84881: move the in-band capability check where it belongs
> net: phylink: add option to sync in-band autoneg setting between PCS
> and PHY
> net: phylink: explicitly configure in-band autoneg for on-board PHYs
> net: phy: mscc: configure in-band auto-negotiation for VSC8514
> net: phy: at803x: validate in-band autoneg for AT8031/AT8033
> net: opt MAC drivers which use Lynx PCS into phylink sync_an_inband
>
> drivers/net/dsa/ocelot/felix.c | 2 +
> .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 1 +
> .../net/ethernet/freescale/enetc/enetc_pf.c | 1 +
> .../net/ethernet/freescale/fman/fman_memac.c | 16 +--
> drivers/net/phy/at803x.c | 10 ++
> drivers/net/phy/bcm84881.c | 10 ++
> drivers/net/phy/mscc/mscc.h | 2 +
> drivers/net/phy/mscc/mscc_main.c | 21 ++++
> drivers/net/phy/phy.c | 51 ++++++++++
> drivers/net/phy/phylink.c | 97 +++++++++++++++----
> include/linux/phy.h | 27 ++++++
> include/linux/phylink.h | 7 ++
> 12 files changed, 212 insertions(+), 33 deletions(-)
>
I tested this on an LS1046ARDB. Unfortunately, although the links came
up, the SGMII interfaces could not transfer data:
# dmesg | grep net6
[ 3.846249] fsl_dpaa_mac 1aea000.ethernet net6: renamed from eth3
[ 5.047334] fsl_dpaa_mac 1aea000.ethernet net6: PHY driver does not report in-band autoneg capability, assuming false
[ 5.073739] fsl_dpaa_mac 1aea000.ethernet net6: PHY [0x0000000001afc000:04] driver [RTL8211F Gigabit Ethernet] (irq=POLL)
[ 5.073749] fsl_dpaa_mac 1aea000.ethernet net6: phy: sgmii setting supported 0,00000000,00000000,000062ea advertising 0,00000000,00000000,000062ea
[ 5.073798] fsl_dpaa_mac 1aea000.ethernet net6: configuring for phy/sgmii link mode
[ 5.073803] fsl_dpaa_mac 1aea000.ethernet net6: major config sgmii
[ 5.075369] fsl_dpaa_mac 1aea000.ethernet net6: phylink_mac_config: mode=phy/sgmii/Unknown/Unknown/none adv=0,00000000,00000000,00000000 pause=00 link=0 an=0
[ 5.102308] fsl_dpaa_mac 1aea000.ethernet net6: phy link down sgmii/Unknown/Unknown/none/off
[ 9.186216] fsl_dpaa_mac 1aea000.ethernet net6: phy link up sgmii/1Gbps/Full/none/rx/tx
[ 9.186261] fsl_dpaa_mac 1aea000.ethernet net6: Link is Up - 1Gbps/Full - flow control rx/tx
I added a `managed = "in-band-status";` property, and this time data
transfer worked:
# dmesg | grep net6
[ 3.826156] fsl_dpaa_mac 1aea000.ethernet net6: renamed from eth3
[ 5.062654] fsl_dpaa_mac 1aea000.ethernet net6: PHY driver does not report in-band autoneg capability, assuming true
[ 5.089724] fsl_dpaa_mac 1aea000.ethernet net6: PHY [0x0000000001afc000:04] driver [RTL8211F Gigabit Ethernet] (irq=POLL)
[ 5.089734] fsl_dpaa_mac 1aea000.ethernet net6: phy: sgmii setting supported 0,00000000,00000000,000062ea advertising 0,00000000,00000000,000062ea
[ 5.089782] fsl_dpaa_mac 1aea000.ethernet net6: configuring for inband/sgmii link mode
[ 5.089786] fsl_dpaa_mac 1aea000.ethernet net6: major config sgmii
[ 5.090951] fsl_dpaa_mac 1aea000.ethernet net6: phylink_mac_config: mode=inband/sgmii/Unknown/Unknown/none adv=0,00000000,00000000,000062ea pause=00 link=0 an=1
[ 5.118325] fsl_dpaa_mac 1aea000.ethernet net6: phy link down sgmii/Unknown/Unknown/none/off
[ 9.214204] fsl_dpaa_mac 1aea000.ethernet net6: phy link up sgmii/1Gbps/Full/none/rx/tx
[ 9.214247] fsl_dpaa_mac 1aea000.ethernet net6: Link is Up - 1Gbps/Full - flow control rx/tx
I believe this is the same issue I ran into before. This is why I
defaulted to in-band.
--Sean
Powered by blists - more mailing lists