From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: "Marek Behún" <kabel@kernel.org>, "Andrew Lunn" <andrew@lunn.ch>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Alvin __ipraga" <alsi@bang-olufsen.dk>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Claudiu Manoil" <claudiu.manoil@nxp.com>,
"Daniel Scally" <djrscally@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"DENG Qingfang" <dqfext@gmail.com>,
"Eric Dumazet" <edumazet@google.com>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"George McCollister" <george.mccollister@gmail.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Hauke Mehrtens" <hauke@hauke-m.de>,
"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Kurt Kanzenbach" <kurt@linutronix.de>,
"Landen Chao" <Landen.Chao@mediatek.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
"Matthias Brugger" <matthias.bgg@gmail.com>,
netdev@vger.kernel.org, "Paolo Abeni" <pabeni@redhat.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Sean Wang" <sean.wang@mediatek.com>,
UNGLinuxDriver@microchip.com,
"Vivien Didelot" <vivien.didelot@gmail.com>,
"Woojung Huh" <woojung.huh@microchip.com>
Subject: Re: [PATCH net-next 3/6] net: dsa: add support for retrieving the interface mode
Date: Fri, 22 Jul 2022 14:16:04 +0100 [thread overview]
Message-ID: <YtqjFKUTsH4CK0L+@shell.armlinux.org.uk> (raw)
In-Reply-To: <20220722124629.7y3p7nt6jmm5hecq@skbuf>
On Fri, Jul 22, 2022 at 03:46:29PM +0300, Vladimir Oltean wrote:
> On Fri, Jul 22, 2022 at 12:44:17PM +0100, Russell King (Oracle) wrote:
> > Today, there is no guarantee - because it depends on how people have
> > chosen to implement 2500base-X, and whether the hardware requires the
> > use of in-band AN or prohibits it. This is what happens when stuff
> > isn't standardised - one ends up with differing implementations doing
> > different things, and this has happened not _only_ at hardware level
> > but also software level as well.
> >
> > You have to also throw into this that various implementations also have
> > an "AN bypass" flag, which means if they see what looks like a valid
> > SERDES data stream, but do not see the AN data, after a certain timeout
> > they allow the link to come up - and again, whether that is enabled or
> > not is pot luck today.
>
> Interesting. After the timeout expires, does the lane ever transition
> back into the encoding required for AN mode, in case there appears at a
> later time someone willing to negotiate?
They don't document that it does.
> > > similarly, there is a good chance that the DT description below might
> > > result in a functional link:
> > >
> > > ð0 {
> > > phy-mode = "2500base-x";
> > > managed = "in-band-status";
> > > };
> > >
> > > &switch_cpu_port {
> > > ethernet = <ð0>;
> > > phy-mode = "25000base-x";
> > >
> > > fixed-link {
> > > speed = <2500>;
> > > full-duplex;
> > > };
> > > };
> > >
> > > There is no expectation from either DT description to use in-band
> > > autoneg or not.
> > >
> > > The fact that of_phy_is_fixed_link() was made by Stas Sergeev to say
> > > that a 'managed' link with the value != 'auto' is fixed prompted me to
> > > study exactly what those changes were about.
> >
> > From what I can see, there is no formal definition of "in-band-status"
> > beyond what it says on the tin. The description in the DT binding
> > specification, which is really where this should be formally documented,
> > is totally lacking.
> >
> > > This patch introduces the new string property 'managed' that allows
> > > the user to set the management type explicitly.
> > > The supported values are:
> > > "auto" - default. Uses either MDIO or nothing, depending on the presence
> > > of the fixed-link node
> > > "in-band-status" - use in-band status
> >
> > This, and how this is implemented by mvneta, is the best we have to go
> > on for the meaning of this.
> >
> > > This is why I am asking whether there is any formal definition of what
> > > managed = "in-band-status" means. You've said it means about retrieving
> > > link status from the PCS. What are you basing upon when you are saying that?
> >
> > Given that this managed property was introduced for mvneta, mvneta's
> > implementation of it is the best reference we have to work out what
> > the intentions of it were beyond the commit text.
> >
> > With in-band mode enabled, mvneta makes use of a fixed-link PHY, and
> > updates the fixed-link PHY with the status from its GMAC block (which
> > is the combined PCS+MAC).
> >
> > So, when in-band mode is specified, the results from SGMII or 1000base-X
> > negotiation are read from the MAC side of the link, pushed into the
> > fixed-PHY, which then are reflected back into the driver via the usual
> > phylib adjust_link().
> >
> > Have a read through mvneta's code at this commit:
> >
> > git show 2eecb2e04abb62ef8ea7b43e1a46bdb5b99d1bf8:drivers/net/ethernet/marvell/mvneta.c
> >
> > specifically, mvneta_fixed_link_update() and mvneta_adjust_link().
> > Note that when operating in in-band mode, there is actually no need
> > for the configuration of MVNETA_GMAC_AUTONEG_CONFIG to be touched
> > in any way since the values read from the MVNETA_GMAC_STATUS register
> > indicate what parameters the MAC is actually using. (The speed,
> > duplex, and pause bits in AUTONEG_CONFIG are ignored anyway if AN
> > is enabled.)
>
> I view this as just an implementation detail and not as something that
> influences what managed = "in-band-status" is supposed to mean.
>
> > I know this is rather wooly, but not everything is defined in black and
> > white, and we need to do the best we can with the information that is
> > available.
>
> So mvneta at the stage of the commit you've mentioned calls
> mvneta_set_autoneg() with the value of pp->use_inband_status. There is
> then the exception to be made for the PCS being what's exposed to the
> medium, and in that case, ethtool may also override the pp->use_inband_status
> variable (which in turn affects the autoneg).
>
> So if we take mvneta at this commit as the reference, what we learn is
> that using in-band status essentially depends on using in-band autoneg
> in the first place.
>
> What is hard for me to comprehend is how we ever came to conclude that
> for SERDES protocols where clause 37 is possible (2500base-x should be
> part of this group), managed = "in-band-status" does not imply in-band
> autoneg, considering the mvneta precedent.
That is a recent addition, since the argument was made that when using
a 1000base-X fibre transceiver, using ethtool to disable autoneg is a
reasonable thing to do - and something that was supported with
mvneta_ethtool_set_link_ksettings() as it stands at the point in the
commit above.
> And why would we essentially redefine its meaning by stating that no,
> it is only about the status, not about the autoneg, even though the
> status comes from the autoneg for these protocols.
I'm not sure I understand what you're getting at there.
Going back to the mvneta combined PCS+MAC implementation, we read the
link parameters from the PCS when operating in in-band mode and throw
them at the fixed PHY so that ethtool works, along with all the usual
link up/down state reporting, carrier etc.
If autoneg is disabled, then we effectively operate in fixed-link mode
(use_inband_status becomes false, and we start forcing the link up/down
and also force the speed and duplex parameters by disabling autoneg.)
Note that this version of mvneta does not support 1000base-X mode, only
SGMII is actually supported.
There's a few things that are rather confusing in the driver:
MVNETA_GMAC_INBAND_AN_ENABLE - this controls whether in-band negotiation
is performed or not.
MVNETA_GMAC_AN_SPEED_EN - this controls whether the result of in-band
negotiation for speed is used, or the manually programmed speed in this
register.
MVNETA_GMAC_AN_DUPLEX_EN - same for duplex.
MVNETA_GMAC_AN_FLOW_CTRL_EN - same for pause (only symmetric pause is
supported)
MVNETA_GMAC2_INBAND_AN_ENABLE - misnamed, it selects whether SGMII (set)
or 1000base-X (unset) format for the 16-bit control word is used.
There is another bit in MVNETA_GMAC_CTRL_0 that selects between
1000base-X and SGMII operation mode, and when this bit is set for
1000base-X. This version of the driver doesn't support 1000base-X,
so this bit is never set.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-07-22 13:25 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-15 16:00 [PATCH net-next 0/6] net: dsa: always use phylink Russell King (Oracle)
2022-07-15 16:01 ` [PATCH net-next 1/6] net: phylink: split out and export interface to caps translation Russell King (Oracle)
2022-07-15 16:01 ` [PATCH net-next 2/6] software node: allow named software node to be created Russell King
2022-07-15 19:57 ` Andy Shevchenko
2022-07-15 20:17 ` Vladimir Oltean
2022-07-15 20:33 ` Andy Shevchenko
2022-07-15 20:48 ` Vladimir Oltean
2022-07-18 12:29 ` Andy Shevchenko
2022-07-18 13:27 ` Russell King (Oracle)
2022-07-18 18:43 ` Andy Shevchenko
2022-07-18 18:53 ` Andy Shevchenko
2022-07-18 19:14 ` Russell King (Oracle)
2022-07-18 19:24 ` Andy Shevchenko
2022-07-18 20:39 ` Marek Behún
2022-07-18 20:48 ` Andy Shevchenko
2022-07-19 7:18 ` Marek Behún
2022-07-29 12:08 ` Andy Shevchenko
2022-07-18 19:11 ` Russell King (Oracle)
2022-07-18 20:07 ` Andy Shevchenko
2022-07-18 20:38 ` Russell King (Oracle)
2022-07-19 8:50 ` Sakari Ailus
2022-07-20 22:56 ` Vladimir Oltean
2022-07-22 6:21 ` Sakari Ailus
2022-07-18 20:42 ` Andrew Lunn
2022-07-15 16:01 ` [PATCH net-next 3/6] net: dsa: add support for retrieving the interface mode Russell King (Oracle)
2022-07-15 17:24 ` Vladimir Oltean
2022-07-15 21:31 ` Russell King (Oracle)
2022-07-15 22:23 ` Vladimir Oltean
2022-07-15 22:57 ` Russell King (Oracle)
2022-07-16 10:57 ` Vladimir Oltean
2022-07-16 11:13 ` Russell King (Oracle)
2022-07-16 12:36 ` Vladimir Oltean
2022-07-18 8:48 ` Russell King (Oracle)
2022-07-20 22:44 ` Vladimir Oltean
2022-07-21 13:46 ` Vladimir Oltean
2022-07-21 14:46 ` Andrew Lunn
2022-07-21 14:54 ` Russell King (Oracle)
2022-07-21 15:15 ` Vladimir Oltean
2022-07-21 17:21 ` Marek Behún
2022-07-21 18:15 ` Russell King (Oracle)
2022-07-21 18:22 ` Vladimir Oltean
2022-07-21 21:14 ` Russell King (Oracle)
2022-07-21 21:36 ` Vladimir Oltean
2022-07-22 8:28 ` Russell King (Oracle)
2022-07-22 10:52 ` Vladimir Oltean
2022-07-22 11:44 ` Russell King (Oracle)
2022-07-22 12:14 ` Russell King (Oracle)
2022-07-22 12:46 ` Vladimir Oltean
2022-07-22 13:16 ` Russell King (Oracle) [this message]
2022-07-22 16:56 ` Vladimir Oltean
2022-07-22 21:20 ` Russell King (Oracle)
2022-07-22 21:53 ` Andrew Lunn
2022-07-22 22:35 ` Andrew Lunn
2022-07-22 22:39 ` Vladimir Oltean
2022-07-23 7:12 ` Russell King (Oracle)
2022-07-23 13:44 ` Vladimir Oltean
2022-07-25 10:11 ` Russell King (Oracle)
2022-07-23 17:26 ` Marek Behún
2022-07-24 17:39 ` Vladimir Oltean
2022-07-22 13:20 ` Andrew Lunn
2022-07-22 12:59 ` Marek Behún
2022-07-22 13:23 ` Russell King (Oracle)
2022-07-22 14:19 ` Marek Behún
2022-07-15 16:01 ` [PATCH net-next 4/6] net: dsa: mv88e6xxx: report the default interface mode for the port Russell King (Oracle)
2022-07-15 16:01 ` [PATCH net-next 5/6] net: dsa: use swnode fixed-link if using default params Russell King (Oracle)
2022-07-15 20:11 ` Andy Shevchenko
2022-07-15 21:36 ` Russell King (Oracle)
2022-07-18 18:59 ` Andy Shevchenko
2022-07-18 19:13 ` Russell King (Oracle)
2022-07-18 20:08 ` Andy Shevchenko
2022-07-15 16:01 ` [PATCH net-next 6/6] net: dsa: mv88e6xxx: remove handling for DSA and CPU ports Russell King (Oracle)
2022-07-15 17:17 ` [PATCH net-next 0/6] net: dsa: always use phylink Vladimir Oltean
2022-07-15 20:59 ` Russell King (Oracle)
2022-07-15 23:03 ` Jakub Kicinski
2022-07-16 11:15 ` Vladimir Oltean
2022-07-16 11:43 ` Russell King (Oracle)
2022-07-16 13:13 ` Vladimir Oltean
2022-07-18 8:53 ` Russell King (Oracle)
2022-07-18 12:45 ` Vladimir Oltean
2022-07-18 13:02 ` Russell King (Oracle)
2022-07-18 14:25 ` Vladimir Oltean
2022-07-16 23:44 ` Jakub Kicinski
2022-07-27 9:00 ` Marek Behún
2022-07-27 13:38 ` Vladimir Oltean
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=YtqjFKUTsH4CK0L+@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=Landen.Chao@mediatek.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alsi@bang-olufsen.dk \
--cc=andrew@lunn.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=djrscally@gmail.com \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=george.mccollister@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hauke@hauke-m.de \
--cc=heikki.krogerus@linux.intel.com \
--cc=hkallweit1@gmail.com \
--cc=kabel@kernel.org \
--cc=kuba@kernel.org \
--cc=kurt@linutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=rafael@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=sean.wang@mediatek.com \
--cc=vivien.didelot@gmail.com \
--cc=woojung.huh@microchip.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).