All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Cc: Thangaraj Samynathan <Thangaraj.S@microchip.com>,
	UNGLinuxDriver@microchip.com, netdev@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Russell King <linux@armlinux.org.uk>,
	stable@vger.kernel.org, Bin Yu <byu@xidian.edu.cn>,
	Cheng Wen <wencheng@xidian.edu.cn>
Subject: Re: [PATCH net] net: usb: lan78xx: only stop phylink if the interface is running
Date: Mon, 2 Nov 2026 16:40:10 +0100	[thread overview]
Message-ID: <auiu2voApMN42KV4@pengutronix.de> (raw)
In-Reply-To: <20261029160204.2567-1-25031212351@stu.xidian.edu.cn>

On Fri, Oct 30, 2026 at 12:02:04AM +0800, YuanZhe Liu wrote:
> lan78xx_disconnect() unconditionally calls phylink_stop(), but
> phylink_start() is only called from lan78xx_open(). When the device is
> unplugged before the interface has been brought up, the attached PHY is
> still in PHY_READY and phy_stop() reports:
> 
>   called from state READY
>   WARNING: drivers/net/phy/phy.c:1670 at phy_stop+0xad/0x380
> 
> The same warning is emitted after an ifup/ifdown cycle, where the PHY is
> already in PHY_HALTED. Call phylink_stop() only when the network device is
> running, which is when phylink_start() has been called.
> 
> Fixes: e110bc825897 ("net: usb: lan78xx: Convert to PHYLINK for improved PHY and MAC management")
> Cc: stable@vger.kernel.org
> Co-developed-by: Bin Yu <byu@xidian.edu.cn>
> Signed-off-by: Bin Yu <byu@xidian.edu.cn>
> Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
> Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
> Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>

Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>

I reproduced the phy_stop() warning on a LAN7850 behind an i.MX8MP, by
unbinding the driver or by writing 0 to the USB device's "authorized"
attribute:

- interface never opened: "called from state READY"
- after ifup and ifdown: "called from state HALTED"
- ifup/ifdown loop during the removal: "called from state HALTED"

On kernels before the phylink conversion, none of these three cases hit
the phy_stop() warning.

With this patch, none of them warns, on net-next and on ba28ef3ccfa9
("Merge branch 'convert-lan78xx-driver-to-the-phylink'") with
312c816c6bc3 ("net: usb: lan78xx: fix WARN in __netif_napi_del_locked on
disconnect") applied. Removals with the interface open, sending, with
link up, link down or link flapping did not warn either. I ran each
case twice per patched kernel, with lockdep, KASAN and kmemleak enabled.
After re-adding the device the interface came up again.

The suspend/resume problems in the Sashiko review are not caused or
fixed by this patch.

Best Regards,
Oleksij
-- 
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 |

  parent reply	other threads:[~2026-11-02 15:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 16:02 [PATCH net] net: usb: lan78xx: only stop phylink if the interface is running YuanZhe Liu
2026-10-30 16:02 ` sashiko-bot
2026-10-31 16:52   ` YuanZhe Liu
2026-11-02 10:05     ` Oleksij Rempel
2026-11-02 11:29       ` YuanZhe Liu
2026-10-30 17:38 ` YuanZhe Liu
2026-10-30 19:23   ` Andrew Lunn
2026-10-30 20:02 ` Andrew Lunn
2026-11-02 15:40 ` Oleksij Rempel [this message]
2026-11-02 16:42   ` [PATCH net] net: usb: lan78xx: only stop phylink if the network device " Yuanzhe Liu
2026-11-02 16:20 ` [PATCH net] net: usb: lan78xx: only stop phylink if the interface " netdev-bot+sashiko

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=auiu2voApMN42KV4@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=25031212351@stu.xidian.edu.cn \
    --cc=Thangaraj.S@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=byu@xidian.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wencheng@xidian.edu.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.