Re: [PATCH net] net: phylink: allow stopping a suspended instance

From: James Hilliard

Date: Sun Oct 04 2026 - 15:12:34 EST


On Sun, Oct 4, 2026 at 7:54 AM Andrew Lunn <andrew@xxxxxxx> wrote:
>
> On Thu, Oct 01, 2026 at 01:24:53AM -0600, James Hilliard wrote:
> > After a failed MAC resume, a driver must be able to stop phylink without
> > resuming it and reconfiguring the failed MAC.
>
> This is adding a lot of complexity, for an edge case, which i don't
> particularly like.
>
> In your case, why is resume failing?

This is a prerequisite for the stmmac recovery fixes, rather than a
fix for the underlying cause of a particular resume failure.

stmmac_resume() already returns an error if stmmac_hw_setup() fails,
for example when the DMA reset does not complete. That return is
before phylink_resume(), leaving phylink suspended.

The stmmac recovery work preserves the interface's administrative
state after that failure, but leaves the datapath detached and
quiescent. An ordinary down/up must then be able to release the
retained resources and attempt a fresh open. Closing the interface
therefore needs to terminate the suspended phylink instance.

Calling phylink_resume() merely to make phylink_stop() usable would
reconfigure the MAC and restart link resolution, even though MAC
setup has just failed.

The additional bookkeeping handles the two different suspend paths:
with MAC WoL, stop must finish the deferred link-down and clear the
WoL disable state; without MAC WoL, suspend has already stopped the
instance, so stop must avoid repeating that shutdown. Suspend-owned
PHY speed changes also need unwinding so the next start does not
retain the reduced advertisement.

Those are phylink-owned transitions which stmmac cannot complete
itself. The driver still owns the recovery policy and any fix for
the underlying resume failure; this supplies the cleanup transition
needed when restoration fails.

>
> Andrew