[PATCH v3 2/2] drivers: net: sun4i-emac: Fix emac_timeout

qianfanguijin at 163.com qianfanguijin at 163.com
Thu Apr 27 03:52:31 PDT 2023


From: qianfan Zhao <qianfanguijin at 163.com>

The system will hang in softirq after emac_timeout happens, next is the
trace logs:

289.902631: softirq_entry: vec=2 [action=NET_TX]
289.902651: net_dev_xmit: dev=eth0 skbaddr=(ptrval) len=98 rc=16
289.902656: softirq_exit: vec=2 [action=NET_TX]
289.902659: softirq_entry: vec=2 [action=NET_TX]
289.902664: net_dev_xmit: dev=eth0 skbaddr=(ptrval) len=98 rc=16
289.902668: softirq_exit: vec=2 [action=NET_TX]
...

Clear tx_fifo_stat to free all tx channels after emac reset done to fix.

Fixes: 492205050d77b (net: Add EMAC ethernet driver found on Allwinner A10 SoC's)
Signed-off-by: qianfan Zhao <qianfanguijin at 163.com>
---
 drivers/net/ethernet/allwinner/sun4i-emac.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index 8093d6d2101c..964c5e7188f8 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -536,6 +536,9 @@ static void emac_timeout(struct net_device *dev, unsigned int txqueue)
 	netif_trans_update(dev);
 	netif_wake_queue(dev);
 
+	/* Clear tx_fifo_stat to free all tx channels */
+	db->tx_fifo_stat = 0;
+
 	/* Restore previous register address */
 	spin_unlock_irqrestore(&db->lock, flags);
 }
-- 
2.25.1




More information about the linux-arm-kernel mailing list