Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: fec: use phydev->eee_cfg.tx_lpi_timer

Rather than maintaining a private copy of the LPI timer, make use of
the LPI timer maintained by phylib. In any case, phylib overwrites the
value of tx_lpi_timer set by the driver in phy_ethtool_get_eee().

Note that feb->eee.tx_lpi_timer is initialised to zero, which is just
the same with phylib's copy, so there should be no functional change.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tested-by: Wei Fang <wei.fang@nxp.com>
Link: https://patch.msgid.link/E1tKzVS-006c67-IJ@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Russell King (Oracle) and committed by
Jakub Kicinski
3fa2540d 175dd907

+6 -12
-2
drivers/net/ethernet/freescale/fec.h
··· 671 671 unsigned int tx_time_itr; 672 672 unsigned int itr_clk_rate; 673 673 674 - /* tx lpi eee mode */ 675 - struct ethtool_keee eee; 676 674 unsigned int clk_ref_rate; 677 675 678 676 /* ptp clock period in ns*/
+6 -10
drivers/net/ethernet/freescale/fec_main.c
··· 2045 2045 return us * (fep->clk_ref_rate / 1000) / 1000; 2046 2046 } 2047 2047 2048 - static int fec_enet_eee_mode_set(struct net_device *ndev, bool enable) 2048 + static int fec_enet_eee_mode_set(struct net_device *ndev, u32 lpi_timer, 2049 + bool enable) 2049 2050 { 2050 2051 struct fec_enet_private *fep = netdev_priv(ndev); 2051 - struct ethtool_keee *p = &fep->eee; 2052 2052 unsigned int sleep_cycle, wake_cycle; 2053 2053 2054 2054 if (enable) { 2055 - sleep_cycle = fec_enet_us_to_tx_cycle(ndev, p->tx_lpi_timer); 2055 + sleep_cycle = fec_enet_us_to_tx_cycle(ndev, lpi_timer); 2056 2056 wake_cycle = sleep_cycle; 2057 2057 } else { 2058 2058 sleep_cycle = 0; ··· 2105 2105 napi_enable(&fep->napi); 2106 2106 } 2107 2107 if (fep->quirks & FEC_QUIRK_HAS_EEE) 2108 - fec_enet_eee_mode_set(ndev, phy_dev->enable_tx_lpi); 2108 + fec_enet_eee_mode_set(ndev, 2109 + phy_dev->eee_cfg.tx_lpi_timer, 2110 + phy_dev->enable_tx_lpi); 2109 2111 } else { 2110 2112 if (fep->link) { 2111 2113 netif_stop_queue(ndev); ··· 3183 3181 fec_enet_get_eee(struct net_device *ndev, struct ethtool_keee *edata) 3184 3182 { 3185 3183 struct fec_enet_private *fep = netdev_priv(ndev); 3186 - struct ethtool_keee *p = &fep->eee; 3187 3184 3188 3185 if (!(fep->quirks & FEC_QUIRK_HAS_EEE)) 3189 3186 return -EOPNOTSUPP; 3190 3187 3191 3188 if (!netif_running(ndev)) 3192 3189 return -ENETDOWN; 3193 - 3194 - edata->tx_lpi_timer = p->tx_lpi_timer; 3195 3190 3196 3191 return phy_ethtool_get_eee(ndev->phydev, edata); 3197 3192 } ··· 3197 3198 fec_enet_set_eee(struct net_device *ndev, struct ethtool_keee *edata) 3198 3199 { 3199 3200 struct fec_enet_private *fep = netdev_priv(ndev); 3200 - struct ethtool_keee *p = &fep->eee; 3201 3201 3202 3202 if (!(fep->quirks & FEC_QUIRK_HAS_EEE)) 3203 3203 return -EOPNOTSUPP; 3204 3204 3205 3205 if (!netif_running(ndev)) 3206 3206 return -ENETDOWN; 3207 - 3208 - p->tx_lpi_timer = edata->tx_lpi_timer; 3209 3207 3210 3208 return phy_ethtool_set_eee(ndev->phydev, edata); 3211 3209 }