# \[PATCH 3/3\] drivers: net: ethernet: stmmac: fix resume function

- From: Bob Liu \<hidden\>
- Date: 2012-05-22 07:38:36 
- List: netdev
- Page: https://ratatoskr.run/netdev/2012/05/10895750
- Thread: https://ratatoskr.run/netdev/2012/05/10895751/t.md

```text
After wake up from mem, ping fails to work.
This patch fix the resume function in stmmac driver.

Signed-off-by: Bob Liu <redacted>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 714faa2..22243a5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1952,6 +1952,15 @@ int stmmac_resume(struct net_device *ndev)
 		priv->hw->mac->pmt(priv->ioaddr, 0);
 
 	netif_device_attach(ndev);
+	priv->dirty_tx = 0;
+	priv->cur_tx = 0;
+	priv->cur_rx = 0;
+	priv->dirty_rx = 0;
+
+	/* DMA initialization and SW reset */
+	priv->hw->dma->init(priv->ioaddr, priv->plat->pbl,
+			priv->dma_tx_phy, priv->dma_rx_phy);
+	priv->hw->mac->core_init(priv->ioaddr);
 
 	/* Enable the MAC and DMA */
 	stmmac_set_mac(priv->ioaddr, true);
-- 
1.7.0.4
```
