linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Bryan Whitehead <bryan.whitehead@microchip.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Jose Abreu <joabreu@synopsys.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com,
	Marcin Wojtas <marcin.s.wojtas@gmail.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
	UNGLinuxDriver@microchip.com
Subject: Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support
Date: Tue, 26 Nov 2024 16:14:10 +0000	[thread overview]
Message-ID: <Z0Xz0pQGXMIcG4jB@shell.armlinux.org.uk> (raw)
In-Reply-To: <Z0XZZszZFVbVl_kN@pengutronix.de>

On Tue, Nov 26, 2024 at 03:21:26PM +0100, Oleksij Rempel wrote:
> Hi Russell,
> 
> On Tue, Nov 26, 2024 at 01:01:11PM +0000, Russell King (Oracle) wrote:
> > On Tue, Nov 26, 2024 at 12:51:36PM +0000, Russell King (Oracle) wrote:
> > > Patch 11 adds phylink managed EEE support. Two new MAC APIs are added,
> > > to enable and disable LPI. The enable method is passed the LPI timer
> > > setting which it is expected to program into the hardware, and also a
> > > flag ehther the transmit clock should be stopped.
> > > 
> > >  *** There are open questions here. Eagle eyed reviewers will notice
> > >    pl->config->lpi_interfaces. There are MACs out there which only
> > >    support LPI signalling on a subset of their interface types. Phylib
> > >    doesn't understand this. I'm handling this at the moment by simply
> > >    not activating LPI at the MAC, but that leads to ethtool --show-eee
> > >    suggesting that EEE is active when it isn't.
> > >  *** Should we pass the phy_interface_t to these functions?
> > >  *** Should mac_enable_tx_lpi() be allowed to fail if the MAC doesn't
> > >    support the interface mode?
> > 
> > There is another point to raise here - should we have a "validate_eee"
> > method in struct phylink_mac_ops so that MAC drivers can validate
> > settings such as the tx_lpi_timer value can be programmed into the
> > hardware?
> > 
> > We do have the situation on Marvell platforms where the programmed
> > value depends on the MAC speed, and is only 8 bit, which makes
> > validating its value rather difficult - at 1G speeds, it's a
> > resolution of 1us so we can support up to 255us. At 100M speeds,
> > it's 10us, supporting up to 2.55ms. This makes it awkward to be able
> > to validate the set_eee() settings are sane for the hardware. Should
> > Marvell platforms instead implement a hrtimer above this? That sounds
> > a bit problematical to manage sanely.
> 
> I agree that tx_lpi_timer can be a problem, and this is not just a
> Marvell issue.  For example, I think the FEC MAC on i.MX8MP might also
> be affected.  But I can't confirm this because I don't have an i.MX8MP
> board with a PHY that supports MAC-controlled EEE mode. The Realtek PHY
> I have uses PHY-controlled EEE (SmartEEE).
> 
> Except for this, I think there should be sane default values for
> tx_lpi_timer.  The IEEE 802.3-2022 standard (Section 78.2) describes EEE
> timing, but it doesn’t give a clear recommendation for tx_lpi_timer.

There are of course some parameters of EEE that should be fixed, and
IEEE specifies them in that section. These are Ts, Tq and Tr, and IEEE
gives a range of values for these which need to be conformed with in a
compliant implementation.

Please don't get confused by the mvneta/mvpp2 implementation, there are
parameters for Ts and Tw, but the Ts value is not the same as Ts in
IEEE. IEEE defines it as the period of time between the PHY transmitting
sleep and turning all transmitters off. Marvell define it as the minimum
time from the Tx FIFO being empty to asserting LPI - quite different!

Other parameters depend on the implementation, such as the propagation
delay of data through the PHY. These, we don't currently take account
of. I don't recall off-hand whether there's any standards defined
registers describing these parameters in the PHY (I need to delve into
802.3...) That's all needed for computing Tw.

> IMO, the best value for tx_lpi_timer should be the sum of the time
> needed to put the full chain (MAC -> PHY -> remote PHY) into sleep mode
> and the time needed to wake the chain. These times are link-speed
> specific, so defaults should consider PHY timings for each link speed.

One can only make a set of defaults that depend on the speed if we also
give the user the ability to set the tx_lpi_timer values on a per-speed
basis, otherwise how do we update the values when set_eee() gets called?

Also how do we know what the requirements of the remote PHY are? I think
the only way that could be known is by exchanging the EEE TLV with the
link partner as described in section 78.

> Except for tx_lpi_timer, some MACs also allow configuration of the Twake
> timer.  For example, the FEC driver uses the lpi_timer value to
> configure the Twake timer, and the LAN78xx driver also provides a
> configurable Twake timer register.
> 
> If the Twake timer is not configured properly, or if the system has
> quirks causing the actual Twake time to be longer than expected, it can
> result in frame corruption. 

I have been aware of it, and to me it sounds like another can of worms
that right now I'd rather not open until we have solved the basics of
EEE and got MAC drivers into better shape for the basics. I had been
wondering whether we would eventually need phylink to pass Tw along
with the LPI timer, and I think eventually we would need to - and we
also need some infrastructure for the EEE TLV, both sending it at the
appropriate time, and processing it when received. I don't think we
have any of that at the moment, so it would be another chunk of
development.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


  reply	other threads:[~2024-11-26 16:15 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 01/23] net: phy: ensure that genphy_c45_an_config_eee_aneg() sees new value of phydev->eee_cfg.eee_enabled Russell King
2024-11-26 12:52 ` [PATCH RFC net-next 02/23] net: phy: fix phy_ethtool_set_eee() incorrectly enabling LPI Russell King (Oracle)
2024-11-27 11:12   ` Russell King (Oracle)
2024-11-27 12:20     ` Oleksij Rempel
2024-11-28 14:11     ` Andrew Lunn
2024-11-26 12:52 ` [PATCH RFC net-next 03/23] net: phy: marvell: use phydev->eee_cfg.eee_enabled Russell King (Oracle)
2024-11-26 20:19   ` Heiner Kallweit
2024-11-26 12:52 ` [PATCH RFC net-next 04/23] net: phy: avoid genphy_c45_ethtool_get_eee() setting eee_enabled Russell King (Oracle)
2024-11-26 20:20   ` Heiner Kallweit
2024-11-26 12:52 ` [PATCH RFC net-next 05/23] net: phy: remove genphy_c45_eee_is_active()'s is_enabled arg Russell King (Oracle)
2024-11-26 20:24   ` Heiner Kallweit
2024-11-26 12:52 ` [PATCH RFC net-next 06/23] net: phy: update phy_ethtool_get_eee() documentation Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 07/23] net: mdio: add definition for clock stop capable bit Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 08/23] net: phy: add support for querying PHY clock stop capability Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 09/23] net: phy: add configuration of rx clock stop mode Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 10/23] net: phylink: add phylink_link_is_up() helper Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 11/23] net: phylink: add EEE management Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 12/23] net: mvneta: convert to phylink EEE implementation Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 13/23] net: mvneta: only allow EEE to be used in "SGMII" modes Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 14/23] net: mvpp2: add EEE implementation Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 15/23] net: lan743x: use netdev in lan743x_phylink_mac_link_down() Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 16/23] net: lan743x: convert to phylink managed EEE Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 17/23] net: stmmac: move tx_lpi_timer tracking to phylib Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 18/23] net: stmmac: make EEE depend on phy->enable_tx_lpi Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 19/23] net: stmmac: remove redundant code from ethtool EEE ops Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 20/23] net: stmmac: remove priv->tx_lpi_enabled Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 21/23] net: stmmac: report EEE errors if EEE is supported Russell King (Oracle)
2024-11-26 12:54 ` [PATCH RFC net-next 22/23] net: stmmac: convert to use phy_eee_rx_clock_stop() Russell King (Oracle)
2024-11-26 12:54 ` [PATCH RFC net-next 23/23] net: stmmac: convert to phylink managed EEE support Russell King (Oracle)
2024-11-26 13:01 ` [PATCH RFC net-next 00/23] net: " Russell King (Oracle)
2024-11-26 14:21   ` Oleksij Rempel
2024-11-26 16:14     ` Russell King (Oracle) [this message]
2024-11-26 16:55 ` Russell King (Oracle)
2024-11-27 10:49 ` net: rtl8169: EEE seems to be ok (was: Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support) Russell King (Oracle)
2024-11-27 22:15   ` net: rtl8169: EEE seems to be ok Heiner Kallweit
2024-11-27 11:20 ` net: ti: weirdness (was Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support) Russell King (Oracle)
2024-11-28 14:21   ` Andrew Lunn
2024-11-27 12:15 ` net: sxgbe: using lpi_timer for Twake timer Oleksij Rempel

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=Z0Xz0pQGXMIcG4jB@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=bryan.whitehead@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=marcin.s.wojtas@gmail.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.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).