Re: [PATCH net-next v5 5/6] net: usb: lan78xx: Integrate EEE support with phylink LPI API
From: Russell King (Oracle)
Date: Tue Mar 25 2025 - 14:35:15 EST
On Tue, Mar 25, 2025 at 05:51:05PM +0000, Rengarajan.S@xxxxxxxxxxxxx wrote:
> Hi Oleksij,
>
> On Wed, 2025-03-19 at 09:49 +0100, Oleksij Rempel wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you
> > know the content is safe
> >
> > Refactor Energy-Efficient Ethernet (EEE) support in the LAN78xx
> > driver to
> > fully integrate with the phylink Low Power Idle (LPI) API. This
> > includes:
> >
> > - Replacing direct calls to `phy_ethtool_get_eee` and
> > `phy_ethtool_set_eee`
> > with `phylink_ethtool_get_eee` and `phylink_ethtool_set_eee`.
> > - Implementing `.mac_enable_tx_lpi` and `.mac_disable_tx_lpi` to
> > control
> > LPI transitions via phylink.
> > - Configuring `lpi_timer_default` to align with recommended values
> > from
> > LAN7800 documentation.
> > - ensure EEE is disabled on controller reset
> >
> > Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> > ---
> > changes v5:
> > - remove redundant error prints
> > changes v2:
> > - use latest PHYlink TX_LPI API
> > ---
> > drivers/net/usb/lan78xx.c | 111 +++++++++++++++++++++++-------------
> > --
> > 1 file changed, 67 insertions(+), 44 deletions(-)
> >
> > diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> > index 9ff8e7850e1e..074ac4d1cbcb 100644
> > --- a/drivers/net/usb/lan78xx.c
> > +++ b/drivers/net/usb/lan78xx.c
> >
> > +static int lan78xx_mac_eee_enable(struct lan78xx_net *dev, bool
> > enable)
> > +{
> > + u32 mac_cr = 0;
> > +
> > + if (enable)
> > + mac_cr |= MAC_CR_EEE_EN_;
> > +
> > + /* make sure TXEN and RXEN are disabled before reconfiguring
> > MAC */
> > + return lan78xx_update_reg(dev, MAC_CR, MAC_CR_EEE_EN_,
> > mac_cr);
>
> Is it possible to add a check to make sure TXEN and RXEN are disabled
> before updating the MAC. Is it taken care by phylink itself?
I suspect this is not true.
On link up, the order of calls that phylink makes is:
pcs_link_up()
mac_link_up()
pcs_enable_eee()
mac_enable_tx_lpi()
>From what I can see, TXEN and RXEN are set by lan78xx_start_tx_path()
and lan78xx_start_rx_path(). These are called from lan78xx_open(),
which *might* happen way before the link comes up. Given the placement
of phy_start() (now phylink_start()) then the above sequence can happen
at *any* moment from that call to phy*_start() onwards, maybe midway
through these two functions.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!