netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Golle <daniel@makrotopia.org>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"Lorenzo Bianconi" <lorenzo@kernel.org>,
	"Mark Lee" <Mark-MC.Lee@mediatek.com>,
	"John Crispin" <john@phrozen.org>, "Felix Fietkau" <nbd@nbd.name>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"DENG Qingfang" <dqfext@gmail.com>,
	"Landen Chao" <Landen.Chao@mediatek.com>,
	"Sean Wang" <sean.wang@mediatek.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Eric Dumazet" <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Vladimir Oltean" <vladimir.oltean@nxp.com>,
	"Jianhui Zhao" <zhaojh329@gmail.com>,
	"Bjørn Mork" <bjorn@mork.no>,
	"Frank Wunderlich" <frank-w@public-files.de>,
	"Alexander Couzens" <lynxis@fe80.eu>
Subject: Re: [PATCH net-next v12 08/18] net: ethernet: mtk_eth_soc: fix 1000Base-X and 2500Base-X modes
Date: Wed, 8 Mar 2023 12:53:13 +0000	[thread overview]
Message-ID: <ZAiFOTRQI36nGo+w@makrotopia.org> (raw)
In-Reply-To: <ZAiCh8wkdTBT+6Id@shell.armlinux.org.uk>

On Wed, Mar 08, 2023 at 12:41:43PM +0000, Russell King (Oracle) wrote:
> On Wed, Mar 08, 2023 at 12:11:48PM +0000, Daniel Golle wrote:
> > On Wed, Mar 08, 2023 at 11:35:40AM +0000, Russell King (Oracle) wrote:
> > > On Tue, Mar 07, 2023 at 03:53:58PM +0000, Daniel Golle wrote:
> > > > After conversion to phylink_pcs the 1000Base-X and 2500Base-X modes
> > > > would work only after `ethtool -s eth1 autoneg off`.
> > > > As ethtool autoneg and the ETHTOOL_LINK_MODE_Autoneg_BIT is supposed
> > > > to control auto-negotiation on the external interface it doesn't make
> > > > much sense to use it to control on-board SGMII auto-negotiation between
> > > > MAC and PHY.
> > > > Set correct values to really only enable SGMII auto-negotiation when
> > > > actually operating in SGMII mode. For 1000Base-X and 2500Base-X mode,
> > > > enable remote-fault detection only if in-band-status is enabled.
> > > > This fixes using 1000Base-X and 2500Base-X SFPs on the BananaPi R3
> > > > board and also makes it possible to use interface-mode-switching PHYs
> > > > operating in either SGMII mode for 10M/100M/1000M or in 2500Base-X for
> > > > 2500M mode on other boards.
> > > > 
> > > > Fixes: 14a44ab0330d ("net: mtk_eth_soc: partially convert to phylink_pcs")
> > > > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> > > 
> > > NAK.
> > > 
> > > There are PHYs out there which operate in SGMII mode but do not
> > > exchange the SGMII 16-bit configuration word. The code implemented
> > > here by me was explicitly to allow such a configuration to work,
> > > which is defined as:
> > > 
> > > 	SGMII *without* mode == inband
> > > 
> > > An example of this is the Broadcom 84881 PHY which can be found on
> > > SFP modules.
> > 
> > I also have multiple such 1000Base-T SFP modules here (finisar, AJYA),
> > and this change doesn't touch the codepaths relevant for those. They
> > are operating in SGMII mode, they have always been working fine.
> > 
> > What I'm trying to fix here is 1000Base-X and 2500Base-X mode which
> > has been broken by introducing ETHTOOL_LINK_MODE_Autoneg_BIT as the
> > deciding factor for in-band AN here.
> 
> ... which is correct.
> 
> > Can you explain why ETHTOOL_LINK_MODE_Autoneg_BIT was used there in
> > first place? Is my understanding of this bit controlling autoneg on the
> > *external* interface rather than on the *system-side* interface wrong?
> 
> Think about what 1000BASE-X is for. It's not really for internal links,
> it's intended by IEEE 802.3 to be the 1G *media* side protocol for
> 1000BASE-SX, 1000BASE-LX, 1000BASE-CX etc links.
> 
> Therefore, when being used in that case, one may wish to disable
> autoneg over the fibre link. Hence, turning off autoneg via ethtool
> *should* turn off autoneg over the fibre link. So, using
> ETHTOOL_LINK_MODE_Autoneg_BIT to gate 802.3z autonegotiation the
> correct thing to do.
> 
> If we have a PHY using 1000BASE-X, then it is at odds with the
> primary purpose of this protocol, especially with it comes to AN.
> This is why phylink used to refuse to accept PHYs when using 802.3z
> mode, but Marek wanted this to work, so relaxed the checks
> preventing such a setup working.

Sadly 2500Base-X is very commonly used to connect 2500Base-T-capable
PHYs or SFP modules. I also got an ATS branded 1000M/100M/10M copper
SFP module which uses 1000Base-X as system-side interface, independently
of the speed of the link partner on the TP interface.
All of them do not work with inband-AN enabled and a link only comes
up after `ethtool -s eth1 autoneg off` in the current implementation,
while previously they were working just fine.

I understand that there isn't really a good solution for 1000Base-X as
thanks to you I now understand that SerDes autoneg just transparently
ends up being autoneg on a fiber link.

2500Base-X, however, is hardly used for fiber links, but rather mostly
for 2500Base-T PHYs and SFP module as well as xPON SFPs. Maybe we could
at least have in-band AN disabled by default for those to get them
working without requiring the user to carry out ethtool settings?

  reply	other threads:[~2023-03-08 12:53 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 15:52 [PATCH net-next v12 00/18] net: ethernet: mtk_eth_soc: various enhancements Daniel Golle
2023-03-07 15:52 ` [PATCH net-next v12 01/18] net: ethernet: mtk_eth_soc: add support for MT7981 SoC Daniel Golle
2023-03-07 15:52 ` [PATCH net-next v12 02/18] dt-bindings: net: mediatek,net: add mt7981-eth binding Daniel Golle
2023-03-07 15:52 ` [PATCH net-next v12 03/18] dt-bindings: arm: mediatek: sgmiisys: Convert to DT schema Daniel Golle
2023-03-07 15:53 ` [PATCH net-next v12 04/18] dt-bindings: arm: mediatek: sgmiisys: add MT7981 SoC Daniel Golle
2023-03-07 15:53 ` [PATCH net-next v12 05/18] net: ethernet: mtk_eth_soc: set MDIO bus clock frequency Daniel Golle
2023-03-07 15:53 ` [PATCH net-next v12 06/18] net: ethernet: mtk_eth_soc: reset PCS state Daniel Golle
2023-03-07 18:49   ` Aw: " Frank Wunderlich
2023-03-07 15:53 ` [PATCH net-next v12 07/18] net: ethernet: mtk_eth_soc: only write values if needed Daniel Golle
2023-03-07 18:53   ` Aw: " Frank Wunderlich
2023-03-07 15:53 ` [PATCH net-next v12 08/18] net: ethernet: mtk_eth_soc: fix 1000Base-X and 2500Base-X modes Daniel Golle
2023-03-07 18:52   ` Aw: " Frank Wunderlich
2023-03-08 11:35   ` Russell King (Oracle)
2023-03-08 12:11     ` Daniel Golle
2023-03-08 12:41       ` Russell King (Oracle)
2023-03-08 12:53         ` Daniel Golle [this message]
2023-03-08 13:12           ` Russell King (Oracle)
2023-03-08 13:46             ` Vladimir Oltean
2023-03-08 14:12               ` Russell King (Oracle)
2023-03-08 14:32                 ` Daniel Golle
2023-03-08 15:01                   ` Russell King (Oracle)
2023-03-08 15:08                     ` Daniel Golle
2023-03-08 15:24                       ` Russell King (Oracle)
2023-03-11 12:05                         ` Aw: " Frank Wunderlich
2023-03-11 13:26                           ` Frank Wunderlich
2023-03-11 14:51                             ` Daniel Golle
2023-03-11 20:02                               ` Russell King (Oracle)
2023-03-11 20:34                                 ` Daniel Golle
2023-03-11 20:00                           ` Russell King (Oracle)
2023-03-11 20:21                             ` Frank Wunderlich
2023-03-11 20:30                               ` Russell King (Oracle)
2023-03-12 12:40                                 ` Aw: " Frank Wunderlich
2023-03-12 14:26                                   ` Frank Wunderlich
2023-03-12 16:50                                     ` Frank Wunderlich
2023-03-12 20:10                                       ` Russell King (Oracle)
2023-03-12 20:05                                   ` Russell King (Oracle)
2023-03-13 10:59                                     ` Russell King (Oracle)
2023-03-13 18:39                                       ` Aw: " Frank Wunderlich
2023-03-13 22:57                                         ` Russell King (Oracle)
2023-03-14  8:51                                           ` Aw: " Frank Wunderlich
2023-03-14  9:12                                             ` Russell King (Oracle)
2023-03-14 10:01                                               ` Aw: " Frank Wunderlich
2023-03-14 10:10                                                 ` Russell King (Oracle)
2023-03-14 13:59                                                   ` Aw: " Frank Wunderlich
2023-03-14 14:11                                                     ` Russell King (Oracle)
2023-03-07 15:54 ` [PATCH net-next v12 09/18] net: ethernet: mtk_eth_soc: Fix link status for none-SGMII modes Daniel Golle
2023-03-07 18:50   ` Aw: " Frank Wunderlich
2023-03-08 11:38   ` Russell King (Oracle)
2023-03-08 11:44     ` Frank Wunderlich
2023-03-08 12:05       ` Daniel Golle
2023-03-08 16:24         ` Russell King (Oracle)
2023-03-08 12:35       ` Russell King (Oracle)
2023-03-07 15:54 ` [PATCH net-next v12 10/18] net: ethernet: mtk_eth_soc: ppe: add support for flow accounting Daniel Golle
2023-03-07 15:54 ` [PATCH net-next v12 11/18] net: pcs: add driver for MediaTek SGMII PCS Daniel Golle
2023-03-07 18:52   ` Aw: " Frank Wunderlich
2023-03-07 15:54 ` [PATCH net-next v12 12/18] net: ethernet: mtk_eth_soc: switch to external PCS driver Daniel Golle
2023-03-07 15:55 ` [PATCH net-next v12 13/18] net: dsa: mt7530: use " Daniel Golle
2023-03-07 15:55 ` [PATCH net-next v12 14/18] net: ethernet: mtk_eth_soc: add MTK_NETSYS_V1 capability bit Daniel Golle
2023-03-07 15:55 ` [PATCH net-next v12 15/18] net: ethernet: mtk_eth_soc: move MAX_DEVS in mtk_soc_data Daniel Golle
2023-03-07 15:55 ` [PATCH v12 16/18] net: ethernet: mtk_eth_soc: rely on num_devs and remove MTK_MAC_COUNT Daniel Golle
2023-03-07 15:55 ` [PATCH v12 17/18] net: ethernet: mtk_eth_soc: add MTK_NETSYS_V3 capability bit Daniel Golle
2023-03-07 15:56 ` [PATCH v12 18/18] net: ethernet: mtk_eth_soc: convert caps in mtk_soc_data struct to u64 Daniel Golle

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=ZAiFOTRQI36nGo+w@makrotopia.org \
    --to=daniel@makrotopia.org \
    --cc=Landen.Chao@mediatek.com \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=andrew@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bjorn@mork.no \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=frank-w@public-files.de \
    --cc=hkallweit1@gmail.com \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo@kernel.org \
    --cc=lynxis@fe80.eu \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=zhaojh329@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).