Commit 5f585913 authored by Fugang Duan's avatar Fugang Duan Committed by David S. Miller

net: stmmac: delete the eee_ctrl_timer after napi disabled

There have chance to re-enable the eee_ctrl_timer and fire the timer
in napi callback after delete the timer in .stmmac_release(), which
introduces to access eee registers in the timer function after clocks
are disabled then causes system hang. Found this issue when do
suspend/resume and reboot stress test.

It is safe to delete the timer after napi disabled and disable lpi mode.

Fixes: d765955d ("stmmac: add the Energy Efficient Ethernet support")
Signed-off-by: default avatarFugang Duan <fugang.duan@nxp.com>
Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4ec236c7
...@@ -2908,9 +2908,6 @@ static int stmmac_release(struct net_device *dev) ...@@ -2908,9 +2908,6 @@ static int stmmac_release(struct net_device *dev)
struct stmmac_priv *priv = netdev_priv(dev); struct stmmac_priv *priv = netdev_priv(dev);
u32 chan; u32 chan;
if (priv->eee_enabled)
del_timer_sync(&priv->eee_ctrl_timer);
if (device_may_wakeup(priv->device)) if (device_may_wakeup(priv->device))
phylink_speed_down(priv->phylink, false); phylink_speed_down(priv->phylink, false);
/* Stop and disconnect the PHY */ /* Stop and disconnect the PHY */
...@@ -2929,6 +2926,11 @@ static int stmmac_release(struct net_device *dev) ...@@ -2929,6 +2926,11 @@ static int stmmac_release(struct net_device *dev)
if (priv->lpi_irq > 0) if (priv->lpi_irq > 0)
free_irq(priv->lpi_irq, dev); free_irq(priv->lpi_irq, dev);
if (priv->eee_enabled) {
priv->tx_path_in_lpi_mode = false;
del_timer_sync(&priv->eee_ctrl_timer);
}
/* Stop TX/RX DMA and clear the descriptors */ /* Stop TX/RX DMA and clear the descriptors */
stmmac_stop_all_dma(priv); stmmac_stop_all_dma(priv);
...@@ -5155,6 +5157,11 @@ int stmmac_suspend(struct device *dev) ...@@ -5155,6 +5157,11 @@ int stmmac_suspend(struct device *dev)
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
del_timer_sync(&priv->tx_queue[chan].txtimer); del_timer_sync(&priv->tx_queue[chan].txtimer);
if (priv->eee_enabled) {
priv->tx_path_in_lpi_mode = false;
del_timer_sync(&priv->eee_ctrl_timer);
}
/* Stop TX/RX DMA */ /* Stop TX/RX DMA */
stmmac_stop_all_dma(priv); stmmac_stop_all_dma(priv);
......
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