Re: [PATCH net-next v4 09/10] net: usb: lan78xx: Integrate EEE support with phylink LPI API
From: Russell King (Oracle)
Date: Tue Mar 18 2025 - 06:17:37 EST
On Tue, Mar 18, 2025 at 10:34:09AM +0100, Oleksij Rempel wrote:
> +static int lan78xx_mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
> + bool tx_clk_stop)
> +{
> + struct net_device *net = to_net_dev(config->dev);
> + struct lan78xx_net *dev = netdev_priv(net);
> + int ret;
> +
> + /* Software should only change this field when Energy Efficient
> + * Ethernet Enable (EEEEN) is cleared. We ensure that by clearing
> + * EEEEN during probe, and phylink itself guarantees that
> + * mac_disable_tx_lpi() will have been previously called.
> + */
> + ret = lan78xx_write_reg(dev, EEE_TX_LPI_REQ_DLY, timer);
> + if (ret < 0)
> + goto tx_lpi_fail;
> +
> + ret = lan78xx_mac_eee_enable(dev, true);
> + if (ret < 0)
> + goto tx_lpi_fail;
> +
> + return 0;
> +
> +tx_lpi_fail:
> + netdev_err(dev->net, "Failed to enable TX LPI with error %pe\n",
> + ERR_PTR(ret));
This function is called thusly:
err = pl->mac_ops->mac_enable_tx_lpi(pl->config, pl->mac_tx_lpi_timer,
pl->mac_tx_clk_stop);
if (err) {
phylink_pcs_disable_eee(pl->pcs);
phylink_err(pl, "%ps() failed: %pe\n",
pl->mac_ops->mac_enable_tx_lpi, ERR_PTR(err));
Is it necessary to report the error twice?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!