Skip to content

Commit 0a2f0d2

Browse files
RealtekNICdavem330
authored andcommitted
8139too: fix system hang when there is a tx timeout event.
If tx timeout event occur, kernel will call rtl8139_tx_timeout_task() to reset hardware. But in this function, driver does not stop tx and rx function before reset hardware, that will cause system hang. In this patch, add stop tx and rx function before reset hardware. Signed-off-by: Chunhao Lin <hau@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1b4985b commit 0a2f0d2

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎drivers/net/ethernet/realtek/8139too.c‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,10 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
16671667
int i;
16681668
u8 tmp8;
16691669

1670+
napi_disable(&tp->napi);
1671+
netif_stop_queue(dev);
1672+
synchronize_sched();
1673+
16701674
netdev_dbg(dev, "Transmit timeout, status %02x %04x %04x media %02x\n",
16711675
RTL_R8(ChipCmd), RTL_R16(IntrStatus),
16721676
RTL_R16(IntrMask), RTL_R8(MediaStatus));
@@ -1696,10 +1700,10 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
16961700
spin_unlock_irq(&tp->lock);
16971701

16981702
/* ...and finally, reset everything */
1699-
if (netif_running(dev)) {
1700-
rtl8139_hw_start (dev);
1701-
netif_wake_queue (dev);
1702-
}
1703+
napi_enable(&tp->napi);
1704+
rtl8139_hw_start(dev);
1705+
netif_wake_queue(dev);
1706+
17031707
spin_unlock_bh(&tp->rx_lock);
17041708
}
17051709

0 commit comments

Comments
 (0)