Re: [PATCH net-next v5 2/6] net: usb: lan78xx: Convert to PHYlink for improved PHY and MAC management

Russell King (Oracle)
2025-03-19T15:14:33Z

On Wed, Mar 19, 2025 at 11:48:02AM +0100, Maxime Chevallier wrote:
> Hi Oleksij,
>
> On Wed, 19 Mar 2025 09:49:48 +0100
> Oleksij Rempel <o.rempel@pengutronix.de> wrote:
>
> > Convert the LAN78xx driver to use the PHYlink framework for managing
> > PHY and MAC interactions.
> >
> > Key changes include:
> > - Replace direct PHY operations with phylink equivalents (e.g.,
> > phylink_start, phylink_stop).
> > - Introduce lan78xx_phylink_setup for phylink initialization and
> > configuration.
> > - Add phylink MAC operations (lan78xx_mac_config,
> > lan78xx_mac_link_down, lan78xx_mac_link_up) for managing link
> > settings and flow control.
> > - Remove redundant and now phylink-managed functions like
> > `lan78xx_link_status_change`.
> > - update lan78xx_get/set_pause to use phylink helpers
> >
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
>
>
> [...]
>
> > @@ -5158,7 +5137,7 @@ static int lan78xx_reset_resume(struct usb_interface *intf)
> > if (ret < 0)
> > return ret;
> >
> > - phy_start(dev->net->phydev);
> > + phylink_start(dev->phylink);
>
> You need RTNL to be held when calling this function.
>
> I'm not familiar with USB but from what I get, this function is part of
> the resume path (resume by resetting). I think you also need to
> address the suspend path, it still has calls to
> netif_carrier_off(dev->net), and you may need to use
> phylink_suspend() / phylink_resume() ? (not sure)

phylink_suspend/resume are very much preferred in suspend/resume paths
over stop/start.

Remember that phylink_resume() (and phylink_start()) may result in the
link coming up *immediately* so should be the last step. stmmac gets
this wrong, which can cause problems (as well as solving the lack of
RXC issue.)

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!