mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Woojung Huh <woojung.huh@microchip.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, UNGLinuxDriver@microchip.com,
	Phil Elwell <phil@raspberrypi.org>
Subject: Re: [PATCH net-next v1 7/7] net: usb: lan78xx: Enable EEE support with phylink integration
Date: Sat, 18 Jan 2025 11:01:22 +0100	[thread overview]
Message-ID: <Z4t78tI0gXWbDhXT@pengutronix.de> (raw)
In-Reply-To: <Z4tuhzHwiKFIGZ5e@shell.armlinux.org.uk>

On Sat, Jan 18, 2025 at 09:04:07AM +0000, Russell King (Oracle) wrote:
> On Sat, Jan 18, 2025 at 08:22:15AM +0100, Oleksij Rempel wrote:
> > On Fri, Jan 17, 2025 at 04:23:52PM +0000, Russell King (Oracle) wrote:
> > > I'm unsure about many DSA drivers. mt753x:
> > > 
> > >         u32 set, mask = LPI_THRESH_MASK | LPI_MODE_EN;
> > > 
> > >         if (e->tx_lpi_timer > 0xFFF)
> > >                 return -EINVAL;
> > > 
> > >         set = LPI_THRESH_SET(e->tx_lpi_timer);
> > >         if (!e->tx_lpi_enabled)
> > >                 /* Force LPI Mode without a delay */
> > >                 set |= LPI_MODE_EN;
> > >         mt7530_rmw(priv, MT753X_PMEEECR_P(port), mask, set);
> > > 
> > > Why force LPI *without* a delay if tx_lpi_enabled is false? This
> > > seems to go against the documented API:
> > > 
> > >  * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given
> > >  *      that eee was negotiated.
> > 
> > According to MT7531 manual, I would say, the code is not correct:
> > https://repo.librerouter.org/misc/lr2/MT7531_switch_Reference_Manual_for_Development_Board.pdf
> > 
> > The LPI_MODE_EN_Px bit has following meaning:
> > 
> > When there is no packet to be transmitted, and the idle time is greater
> > than P2_LPI_THRESHOLD, the TXMAC will automatically enter LPI (Low
> > Power Idle) mode and send EEE LPI frame to the link partner.
> > 0: LPI mode depends on the P2_LPI_THRESHOLD.
> > 1: Let the system enter the LPI mode immediately and send EEE LPI frame
> >    to the link partner.
> 
> Okay, so LPI_MODE_EN_Px causes it to disregard the LPI timer, and enter
> LPI mode immediately. Thus, the code should never set LPI_MODE_EN_Px.
> 
> > This chip seems to not have support for tx_lpi_enabled != eee_enabled
> > configuration.
> 
> Sorry, I don't see your reasoning there - and I think your
> interpretation is different from the documentation (which is
> the whole point of having a generic implementation in phylib
> to avoid these kinds of different interpretation.)
> 
>  * @eee_enabled: EEE configured mode (enabled/disabled).
>  * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given
>  *      that eee was negotiated.
> 
>            eee on|off
>                   Enables/disables the device support of EEE.
> 
>            tx-lpi on|off
>                   Determines whether the device should assert its Tx LPI.
> 
> The way phylib interprets eee_enabled is whether EEE is advertised
> to the remote device or not. If EEE is not advertised, then EEE is
> not negotiated, and thus EEE will not become active. If EEE is not
> active, then LPI must not be asserted. tx_lpi_enabled defines whether,
> given that EEE has been negotiated, whether LPI should be signalled
> after the LPI timer has expired.
> 
> phylib deals with all this logic, and its all encoded into the
> phydev->enable_tx_lpi flag to give consistency of implementation.
> 
> Thus, phydev->enable_tx_lpi is only true when eee_enabled && eee
> negotiated at the specified speed && tx_lpi_enabled. In that state,
> LPI is expected to be signalled after the LPI timer has expired.

I mean, the configuration where EEE can be enabled and in active state,
but TX LPI is disabled: eee_enabled = true; eee_active = true;
enable_tx_lpi = false. UAPI allows this configuration and it seems to
work for 100Mbit/s. Atheros documentation call it asymmetric EEE
operation - where each link partner enters LPI mode independently. In
comparison, the same documentation calls 1000Mbit EEE mode, symmetric
operation - where both link partner must enter the LPI mode
simulatneously.

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2025-01-18 10:01 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08 12:13 [PATCH net-next v1 0/7] Convert LAN78xx to PHYLINK Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 1/7] net: usb: lan78xx: Convert to PHYlink for improved PHY and MAC management Oleksij Rempel
2025-01-08 12:43   ` Russell King (Oracle)
2025-01-17 10:50   ` Rengarajan.S
2025-01-22  8:16     ` Oleksij Rempel
2025-01-22  4:02   ` Thangaraj.S
2025-01-22  6:06     ` Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 2/7] net: usb: lan78xx: Move fixed PHY cleanup to lan78xx_unbind() Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 3/7] net: usb: lan78xx: Improve error handling for PHY init path Oleksij Rempel
2025-01-08 12:52   ` Russell King (Oracle)
2025-01-08 12:13 ` [PATCH net-next v1 4/7] net: usb: lan78xx: Use ethtool_op_get_link to reflect current link status Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 5/7] net: usb: lan78xx: port link settings to phylink API Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 6/7] net: usb: lan78xx: Transition get/set_pause to phylink Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 7/7] net: usb: lan78xx: Enable EEE support with phylink integration Oleksij Rempel
2025-01-08 12:47   ` Russell King (Oracle)
2025-01-08 14:23     ` Oleksij Rempel
2025-01-08 15:15       ` Russell King (Oracle)
2025-01-09 17:13         ` Oleksij Rempel
2025-01-09 17:27           ` Russell King (Oracle)
2025-01-09 17:39             ` Oleksij Rempel
2025-01-09 18:10               ` Russell King (Oracle)
2025-01-09 19:33                 ` Andrew Lunn
2025-01-13 12:42                   ` Oleksij Rempel
2025-01-13 13:29                     ` Russell King (Oracle)
2025-01-13 13:45                       ` Andrew Lunn
2025-01-17 16:23                         ` Russell King (Oracle)
2025-01-18  7:22                           ` Oleksij Rempel
2025-01-18  9:04                             ` Russell King (Oracle)
2025-01-18 10:01                               ` Oleksij Rempel [this message]
2025-01-18 10:40                                 ` Russell King (Oracle)
2025-01-18 11:23                                   ` Oleksij Rempel
2025-01-18 10:03                             ` Oleksij Rempel
2025-01-09 19:36                 ` 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=Z4t78tI0gXWbDhXT@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel@pengutronix.de \
    --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=phil@raspberrypi.org \
    --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

all inboxes | Powered by JetHome®