netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
	"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: Fri, 17 Jan 2025 16:23:52 +0000	[thread overview]
Message-ID: <Z4qEGIRYvSuVR9AK@shell.armlinux.org.uk> (raw)
In-Reply-To: <38ad9a25-a5b9-48ab-b92d-4c9d9f4c7d62@lunn.ch>

On Mon, Jan 13, 2025 at 02:45:14PM +0100, Andrew Lunn wrote:
> On Mon, Jan 13, 2025 at 01:29:37PM +0000, Russell King (Oracle) wrote:
> > On Mon, Jan 13, 2025 at 01:42:06PM +0100, Oleksij Rempel wrote:
> > > On Thu, Jan 09, 2025 at 08:33:07PM +0100, Andrew Lunn wrote:
> > > > > Andrew had a large patch set, which added the phylib core code, and
> > > > > fixed up many drivers. This was taken by someone else, and only
> > > > > Andrew's core phylib code was merged along with the code for their
> > > > > driver, thus breaking a heck of a lot of other drivers.
> > > > 
> > > > As Russell says, i did convert all existing drivers over the new
> > > > internal API, and removed some ugly parts of the old EEE core code.
> > > > I'm not too happy we only got part way with my patches. Having this in
> > > > between state makes the internal APIs much harder to deal with, and as
> > > > Russell says, we broke a few MAC drivers because the rest did not get
> > > > merged.
> > > > 
> > > > Before we think about extensions to the kAPI, we first need to finish
> > > > the refactor. Get all MAC drivers over to the newer internal API and
> > > > remove phy_init_eee() which really does need to die. My patches have
> > > > probably bit rotted a bit, but i doubt they are unusable. So i would
> > > > like to see them merged. I would however leave phylink drivers to
> > > > Russell. He went a slight different way than i did, and he should get
> > > > to decide how phylink should support this.
> > > 
> > > Hi Andrew,
> > > 
> > > Ok. If I see it correctly, all patches from the
> > > v6.4-rc6-net-next-ethtool-eee-v7 branch, which I was working on, have been
> > > merged by now. The missing parts are patches from the
> > > v6.3-rc3-net-next-ethtool-eee-v5 branch.
> > > 
> > > More precisely, the following non-phylink drivers still need to be addressed:
> > > drivers/net/ethernet/broadcom/asp2
> > > drivers/net/ethernet/broadcom/genet
> > > drivers/net/ethernet/samsung/sxgbe
> > > drivers/net/usb/lan78xx - this one is in progress
> > > 
> > > Unfortunately, I won’t be able to accomplish this before the merge window, as I
> > > am currently on sick leave. However, I promise to take care of it as soon as
> > > possible.
> > 
> > Does any of this include mvneta?
> 
> Hi Russell 
> 
> I asked Oleksij to skip MAC drivers using phylink. I'm not sure it
> makes sense to merge my phylink changes for EEE and then replace them
> with your EEE implementation.

Doing an audit on today's net-next after I've fixed up another driver
for the phylib-eee fallout, we have two obvious breakages remaining
in drivers that directly use phylib:

drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c:

        edata->tx_lpi_timer = priv->tx_lpi_timer;

        return phy_ethtool_get_eee(dev->phydev, edata);

drivers/net/ethernet/broadcom/genet/bcmgenet.c:

        e->tx_lpi_enabled = p->tx_lpi_enabled;
        e->tx_lpi_timer = bcmgenet_umac_readl(priv, UMAC_EEE_LPI_TIMER);

        return phy_ethtool_get_eee(dev->phydev, e);

Two others change ->tx_lpi_timer after calling phy_ethtool_get_eee()
and thus are unaffected:

drivers/net/ethernet/realtek/r8169_main.c:
drivers/net/usb/lan78xx.c

Howeve,r I wonder whether lan78xx_set_eee() is racy:

        ret = phy_ethtool_set_eee(net->phydev, edata);
        if (ret < 0)
                goto out;

        buf = (u32)edata->tx_lpi_timer;
        ret = lan78xx_write_reg(dev, EEE_TX_LPI_REQ_DLY, buf);

since phy_ethtool_set_eee() will have bounced the link if the timer
was changed.

I'm also wondering whether r8169 programs its LPI timer correctly.

I think all phylink using drivers network are now no longer affected.

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.

qca8k_set_mac_eee() sets the LPI enabled based off eee->eee_enabled.
It doesn't seem to change the register on link up/down, so I wonder
how the autoneg resolution is handled. Maybe it isn't, so maybe it's
buggy.

b53_set_mac_eee() looks similar to qca8k_set_mac_eee().

So there's still work to be done.

-- 
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:[~2025-01-17 16:24 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) [this message]
2025-01-18  7:22                           ` Oleksij Rempel
2025-01-18  9:04                             ` Russell King (Oracle)
2025-01-18 10:01                               ` Oleksij Rempel
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=Z4qEGIRYvSuVR9AK@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --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=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --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;
as well as URLs for NNTP newsgroup(s).