mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: f.fainelli@gmail.com
Cc: netdev@vger.kernel.org, horms@kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, hkallweit1@gmail.com, linux@armlinux.org.uk,
	shaojijie@huawei.com, runyu.xiao@seu.edu.cn, mmyangfl@gmail.com,
	hvr@gnu.org, danny.kukawka@bisect.de, mugunthanvnm@ti.com,
	sebastian.hesselbarth@gmail.com, linux-kernel@vger.kernel.org,
	manuel.lauss@gmail.com
Subject: Re: [PATCH net v5 09/10] net: au1000: keep the MAC stopped until the PHY link is ready
Date: Thu, 03 Dec 2026 23:41:19 +0000	[thread overview]
Message-ID: <179634127950.3146.17178958985267882353@kernel.org> (raw)
In-Reply-To: <20261202224957.3043478-10-f.fainelli@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] au1000_resume() (drivers/net/ethernet/amd/au1000_eth.c) calls
  phy_init_hw() and phy_resume() on the attached PHY before it checks…
- [Low] net: au1000: missing discovery and runtime test context in
  changelog

--

net: au1000: keep the MAC stopped until the PHY link is ready

This patch keeps au1000 MAC RX/TX disabled until phylib reports link up
and stops the MAC on link-down. au1000_open() now resumes the PHY
synchronously before MAC initialization. The patch also adds system
sleep PM ops that manage PHY power from the MAC driver, and marks every
PHY on the MDIO bus as mac_managed_pm.

> diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
> index ec28ed33bf698..5bfafe52020f6 100644
> --- a/drivers/net/ethernet/amd/au1000_eth.c
> +++ b/drivers/net/ethernet/amd/au1000_eth.c

[ ... ]

> +static int au1000_resume(struct device *device)
> +{
> +	struct net_device *dev = dev_get_drvdata(device);
> +	struct au1000_private *aup = netdev_priv(dev);
> +	unsigned long flags;
> +	int ret = 0;
> +
> +	rtnl_lock();
> +	spin_lock_irqsave(&aup->lock, flags);
> +	aup->old_link = 0;
> +	aup->old_speed = 0;
> +	aup->old_duplex = -1;
> +	spin_unlock_irqrestore(&aup->lock, flags);
> +
> +	if (dev->phydev) {
> +		ret = phy_init_hw(dev->phydev);
> +		if (ret)
> +			goto err_reset;
> +		ret = phy_resume(dev->phydev);
> +		if (ret)
> +			goto err_reset;
> +	}
> +
> +	if (!netif_running(dev)) {
> +		/* PHY reinitialization may have enabled the MAC for MDIO. */
> +		au1000_reset_mac(dev);
> +		netif_device_attach(dev);
> +		goto out;
> +	}

[Severity: Low]
The changelog explains the mechanism in detail, but it still doesn't
say how these problems were found or which of them were seen on real
hardware.

On v4 you replied that the open/close/open hang on MTX-1 was hit
during hardware testing, and that the other issues were found by code
inspection. Jakub asked for that to be recorded in the changelog when
the series was reposted:

https://lore.kernel.org/r/20261121103844.2c27eba4@kernel.org

This patch now bundles several separate changes:

  - the link-down MAC stop in au1000_adjust_link()
  - the phy_init_hw()/phy_resume() ordering before au1000_init() in
    au1000_open()
  - the new au1000_suspend()/au1000_resume() PM ops
  - setting mac_managed_pm on every PHY on the bus for the address 31
    alias
  - the failed-resume recovery through au1000_close()

>From your v4 reply, only the reopen hang appears to have been
reproduced. A reader of the v5 log can't tell that.

Could you add a short paragraph that says which changes fix the
reproduced MTX-1 reopen hang and which ones come from inspection or
review? Please also say whether the system sleep paths and the alias
handling were exercised on MTX-1 at all. That would make it much
easier to judge the Fixes: tag and the risk of backporting this to
stable.

[Severity: Medium]
Does this power up the PHY of a down interface again after every
system resume?

Here is the sequence. First ifup, then ifdown. au1000_close() calls
phy_stop(), and phylib suspends the PHY: genphy_suspend() sets
BMCR_PDOWN and phydev->suspended becomes 1. On system suspend,
au1000_suspend() takes the non-running branch. phy_suspend() returns
early there because the PHY is already suspended.

On resume, phy_init_hw() and phy_resume() run before netif_running()
is checked. On MTX-1 this reaches lan83c183_resume():

drivers/net/phy/smsc.c:lan83c183_resume() {
	ret = phy_modify_changed(phydev, MII_BMCR, BMCR_PDOWN, 0);
	...
	if (ret)
		msleep(500);
}

The !netif_running() branch then only resets the MAC and returns. The
PHY stays powered, autonegotiates and shows link to the partner while
the host interface is administratively down. phydev->state stays
PHY_HALTED with suspended cleared until the next ifup/ifdown or system
suspend. On MTX-1, each down interface also adds 500 ms to system
resume.

Before this patch, phylib's MDIO bus PM handled the PHY.
mdio_bus_phy_may_suspend() returns !phydev->suspended, which is false
for a PHY that phy_stop() has already powered down. So
mdio_bus_phy_resume() took the no_resume path and the close-time
power-down survived sleep. That looks like the behaviour introduced by
be9dad1f9f26, the commit this patch names in its Fixes: tag.

The commit message says:

    Reinitialize and resume the attached PHY even when the interface is
    down across sleep, then reset the MAC again to gate the clock enabled
    by MDIO.

It doesn't give a reason. au1000_open() now calls phy_init_hw() and
phy_resume() itself, so is the resume needed here at all? It also
seems to conflict with au1000_suspend(), which treats a non-running
interface as one whose PHY should be suspended.

Could the !netif_running() branch call phy_suspend() after the PHY is
reinitialized and before au1000_reset_mac()?

Two error paths appear to leave a similar gap. In au1000_open(), a
phy_init_hw() or phy_resume() failure only resets the MAC, even if
phy_init_hw() has already powered the PHY up:

err_reset:
	au1000_reset_mac(dev);
	free_irq(dev->irq, dev);
	return retval;

In au1000_close(), after a failed system resume the state is already
PHY_HALTED, so phy_stop() is skipped:

	if (dev->phydev && dev->phydev->state != PHY_HALTED)
		phy_stop(dev->phydev);

phy_init_hw() may have reset and powered up the PHY on that failed
resume path. In both cases nothing puts the PHY back into power-down.
Should these paths also call phy_suspend()?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202224957.3043478-1-f.fainelli%40gmail.com

  reply	other threads:[~2026-12-03 23:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 22:49 [PATCH net v5 00/10] net: au1000: Bug fixes Florian Fainelli
2026-12-02 22:49 ` [PATCH net v5 01/10] net: au1000: recycle RX descriptors on allocation failure Florian Fainelli
2026-12-02 22:49 ` [PATCH net v5 02/10] net: au1000: clear all-multicast mode when restoring hash filtering Florian Fainelli
2026-12-02 22:49 ` [PATCH net v5 03/10] net: au1000: disconnect the PHY before freeing the MDIO bus Florian Fainelli
2026-12-02 22:49 ` [PATCH net v5 04/10] net: au1000: report MDIO transaction timeouts Florian Fainelli
2026-12-02 22:49 ` [PATCH net v5 05/10] net: au1000: serialize TX completion with packet submission Florian Fainelli
2026-12-03  7:26   ` Jijie Shao
2026-12-03 23:41   ` netdev-bot+sashiko
2026-12-02 22:49 ` [PATCH net v5 06/10] net: au1000: restore receive filtering before enabling RX Florian Fainelli
2026-12-02 22:49 ` [PATCH net v5 07/10] net: au1000: restore RX buffer addresses when restarting the MAC Florian Fainelli
2026-12-02 22:49 ` [PATCH net v5 08/10] net: phy: smsc: wait for LAN83C183 power-down recovery Florian Fainelli
2026-12-03 23:41   ` netdev-bot+sashiko
2026-12-02 22:49 ` [PATCH net v5 09/10] net: au1000: keep the MAC stopped until the PHY link is ready Florian Fainelli
2026-12-03 23:41   ` netdev-bot+sashiko [this message]
2026-12-02 22:49 ` [PATCH net v5 10/10] net: au1000: reject frames larger than the TX bounce buffer Florian Fainelli
2026-12-02 22:55 ` [PATCH net v5 00/10] net: au1000: Bug fixes netdev-bot+sinfo

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=179634127950.3146.17178958985267882353@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=danny.kukawka@bisect.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=hvr@gnu.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=manuel.lauss@gmail.com \
    --cc=mmyangfl@gmail.com \
    --cc=mugunthanvnm@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=runyu.xiao@seu.edu.cn \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=shaojijie@huawei.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®