Skip to content

Commit e3f4055

Browse files
pelwellpopcornmix
authored andcommitted
lan78xx: Return tx_lpi_timer even if disabled
Disabling tx_lpi or eee should not cause the value of tx_lpi_timer to be lost, even though it is not useful until they are re-enabled. Signed-off-by: Phil Elwell <phil@raspberrypi.com>
1 parent bd5af64 commit e3f4055

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

drivers/net/usb/lan78xx.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,15 +1818,34 @@ static int lan78xx_set_wol(struct net_device *netdev,
18181818
static int lan78xx_get_eee(struct net_device *net, struct ethtool_keee *edata)
18191819
{
18201820
struct lan78xx_net *dev = netdev_priv(net);
1821+
u32 buf;
1822+
int ret;
1823+
1824+
ret = phylink_ethtool_get_eee(dev->phylink, edata);
1825+
if (ret < 0)
1826+
return ret;
1827+
1828+
ret = lan78xx_read_reg(dev, EEE_TX_LPI_REQ_DLY, &buf);
1829+
if (ret >= 0)
1830+
edata->tx_lpi_timer = buf;
1831+
else
1832+
edata->tx_lpi_timer = 0;
18211833

1822-
return phylink_ethtool_get_eee(dev->phylink, edata);
1834+
return 0;
18231835
}
18241836

18251837
static int lan78xx_set_eee(struct net_device *net, struct ethtool_keee *edata)
18261838
{
18271839
struct lan78xx_net *dev = netdev_priv(net);
1840+
u32 buf;
1841+
int ret;
1842+
1843+
ret = phylink_ethtool_set_eee(dev->phylink, edata);
1844+
if (ret < 0)
1845+
return ret;
18281846

1829-
return phylink_ethtool_set_eee(dev->phylink, edata);
1847+
buf = (u32)edata->tx_lpi_timer;
1848+
return lan78xx_write_reg(dev, EEE_TX_LPI_REQ_DLY, buf);
18301849
}
18311850

18321851
static void lan78xx_get_drvinfo(struct net_device *net,

0 commit comments

Comments
 (0)