Commit 9c501397 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Jakub Kicinski

r8169: add support for returning tx_lpi_timer in ethtool get_eee

Add support for returning the tx_lpi_timer value to userspace.
This is supported by few chip versions only: RTL8168h/RTL8125/RTL8126
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/4eee9c34-c5d6-4c96-9b05-455896dea59a@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 57d2d2c8
......@@ -2053,14 +2053,34 @@ static void rtl_set_eee_txidle_timer(struct rtl8169_private *tp)
}
}
static unsigned int r8169_get_tx_lpi_timer_us(struct rtl8169_private *tp)
{
unsigned int speed = tp->phydev->speed;
unsigned int timer = tp->tx_lpi_timer;
if (!timer || speed == SPEED_UNKNOWN)
return 0;
/* tx_lpi_timer value is in bytes */
return DIV_ROUND_CLOSEST(timer * BITS_PER_BYTE, speed);
}
static int rtl8169_get_eee(struct net_device *dev, struct ethtool_keee *data)
{
struct rtl8169_private *tp = netdev_priv(dev);
int ret;
if (!rtl_supports_eee(tp))
return -EOPNOTSUPP;
return phy_ethtool_get_eee(tp->phydev, data);
ret = phy_ethtool_get_eee(tp->phydev, data);
if (ret)
return ret;
data->tx_lpi_timer = r8169_get_tx_lpi_timer_us(tp);
data->tx_lpi_enabled = data->tx_lpi_timer ? data->eee_enabled : false;
return 0;
}
static int rtl8169_set_eee(struct net_device *dev, struct ethtool_keee *data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment