r8169: respect EEE user setting when restarting network
[ Upstream commit 7ec3f872bc85ada93db34448d73bb399d6b82c2c ] Currently, if network is re-started, we advertise all supported EEE modes, thus potentially overriding a manual adjustment the user made e.g. via ethtool. Be friendly to the user and preserve a manual setting on network re-start. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
4eab6c4e07
commit
0ed50cdcb5
@ -680,6 +680,7 @@ struct rtl8169_private {
|
|||||||
struct rtl8169_counters *counters;
|
struct rtl8169_counters *counters;
|
||||||
struct rtl8169_tc_offsets tc_offset;
|
struct rtl8169_tc_offsets tc_offset;
|
||||||
u32 saved_wolopts;
|
u32 saved_wolopts;
|
||||||
|
int eee_adv;
|
||||||
|
|
||||||
const char *fw_name;
|
const char *fw_name;
|
||||||
struct rtl_fw *rtl_fw;
|
struct rtl_fw *rtl_fw;
|
||||||
@ -2075,6 +2076,10 @@ static int rtl8169_set_eee(struct net_device *dev, struct ethtool_eee *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = phy_ethtool_set_eee(tp->phydev, data);
|
ret = phy_ethtool_set_eee(tp->phydev, data);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
tp->eee_adv = phy_read_mmd(dev->phydev, MDIO_MMD_AN,
|
||||||
|
MDIO_AN_EEE_ADV);
|
||||||
out:
|
out:
|
||||||
pm_runtime_put_noidle(d);
|
pm_runtime_put_noidle(d);
|
||||||
return ret;
|
return ret;
|
||||||
@ -2105,10 +2110,16 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
|
|||||||
static void rtl_enable_eee(struct rtl8169_private *tp)
|
static void rtl_enable_eee(struct rtl8169_private *tp)
|
||||||
{
|
{
|
||||||
struct phy_device *phydev = tp->phydev;
|
struct phy_device *phydev = tp->phydev;
|
||||||
int supported = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE);
|
int adv;
|
||||||
|
|
||||||
if (supported > 0)
|
/* respect EEE advertisement the user may have set */
|
||||||
phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, supported);
|
if (tp->eee_adv >= 0)
|
||||||
|
adv = tp->eee_adv;
|
||||||
|
else
|
||||||
|
adv = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE);
|
||||||
|
|
||||||
|
if (adv >= 0)
|
||||||
|
phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, adv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rtl8169_get_mac_version(struct rtl8169_private *tp)
|
static void rtl8169_get_mac_version(struct rtl8169_private *tp)
|
||||||
@ -7064,6 +7075,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||||||
tp->pci_dev = pdev;
|
tp->pci_dev = pdev;
|
||||||
tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT);
|
tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT);
|
||||||
tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1;
|
tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1;
|
||||||
|
tp->eee_adv = -1;
|
||||||
|
|
||||||
/* Get the *optional* external "ether_clk" used on some boards */
|
/* Get the *optional* external "ether_clk" used on some boards */
|
||||||
rc = rtl_get_ether_clk(tp);
|
rc = rtl_get_ether_clk(tp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user