Subject: Re: [PATCH net-next 5/9] net: phy: improve phy_disable_eee_mode

From: "Russell King (Oracle)" <[email-masked]>
Date: Sat, 11 Jan 2025 17:45:47 +0000

On Sat, Jan 11, 2025 at 06:38:07PM +0100, Andrew Lunn wrote:
> On Sat, Jan 11, 2025 at 10:07:43AM +0100, Heiner Kallweit wrote:
> > If a mode is to be disabled, remove it from advertising_eee.
> > Disabling EEE modes shall be done before calling phy_start(),
> > warn if that's not the case.
> > 
> > Signed-off-by: Heiner Kallweit <[email-masked]>
> > ---
> >  include/linux/phy.h | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/include/linux/phy.h b/include/linux/phy.h
> > index ad71d3a3b..fce29aaa9 100644
> > --- a/include/linux/phy.h
> > +++ b/include/linux/phy.h
> > @@ -1333,7 +1333,10 @@ static inline bool phy_is_started(struct phy_device *phydev)
> >   */
> >  static inline void phy_disable_eee_mode(struct phy_device *phydev, u32 link_mode)
> >  {
> > +	WARN_ON(phy_is_started(phydev));
> > +
> >  	linkmode_set_bit(link_mode, phydev->eee_disabled_modes);
> > +	linkmode_clear_bit(link_mode, phydev->advertising_eee);
> >  }
> 
> Thinking out loud...
> 
> Maybe we should make this more like phy_remove_link_mode()? That
> function also removes the link mode from phydev->supported at the same
> time.

That's what I would expect, but phydev->supported_eee is also used to
determine which registers are programmed. So, removing linkmodes from
it risks not programming a register to disable an EEE mode.

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