Re: [PATCH net-next 1/2] net: usb: lan78xx: Fixup EEE

From: Oleksij Rempel
Date: Sun Apr 07 2024 - 13:51:30 EST


Hi Andrew,

On Sat, Apr 06, 2024 at 03:15:59PM -0500, Andrew Lunn wrote:
....
> ---
> - if (edata->eee_enabled) {
> - ret = lan78xx_read_reg(dev, MAC_CR, &buf);
> - buf |= MAC_CR_EEE_EN_;
> - ret = lan78xx_write_reg(dev, MAC_CR, buf);
> -
> - phy_ethtool_set_eee(net->phydev, edata);
> -
> - buf = (u32)edata->tx_lpi_timer;
> - ret = lan78xx_write_reg(dev, EEE_TX_LPI_REQ_DLY, buf);
> - } else {
> - ret = lan78xx_read_reg(dev, MAC_CR, &buf);
> - buf &= ~MAC_CR_EEE_EN_;
> - ret = lan78xx_write_reg(dev, MAC_CR, buf);
> - }
> + ret = phy_ethtool_set_eee(net->phydev, edata);
> + if (ret < 0)
> + goto out;
>
> + buf = (u32)edata->tx_lpi_timer;
> + ret = lan78xx_write_reg(dev, EEE_TX_LPI_REQ_DLY, buf);

According to the documentation:
"Host software should only change this field when Energy Efficient
Ethernet Enable (EEEEN) is cleared."

Even more: "A value of zero may adversely affect the ability of the TX
data path to support Gigabit operation. A reasonable value when the part
is operating at Gigabit speeds is 50 us."

Previous code seems to not care about it too. So, it would be not a
regression if something is broken.

Reviewed-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>

I'll get some time to work on this driver in some months, in this case
I'll take a closer look on EEE too.

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 |