Commit e7d425dc authored by John Crispin's avatar John Crispin Committed by David S. Miller

net: mediatek: fix mtk_pending_work

The driver supports 2 MACs. Both run on the same DMA ring. If we hit a TX
timeout we need to stop both netdevs before restarting them again. If we
don't do this, mtk_stop() wont shutdown DMA and the consecutive call to
mtk_open() wont restart DMA and enable IRQs.
Signed-off-by: default avatarJohn Crispin <blogic@openwrt.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 34c2e4c9
...@@ -1432,17 +1432,29 @@ static void mtk_pending_work(struct work_struct *work) ...@@ -1432,17 +1432,29 @@ static void mtk_pending_work(struct work_struct *work)
{ {
struct mtk_mac *mac = container_of(work, struct mtk_mac, pending_work); struct mtk_mac *mac = container_of(work, struct mtk_mac, pending_work);
struct mtk_eth *eth = mac->hw; struct mtk_eth *eth = mac->hw;
struct net_device *dev = eth->netdev[mac->id]; int err, i;
int err; unsigned long restart = 0;
rtnl_lock(); rtnl_lock();
mtk_stop(dev);
err = mtk_open(dev); /* stop all devices to make sure that dma is properly shut down */
if (err) { for (i = 0; i < MTK_MAC_COUNT; i++) {
netif_alert(eth, ifup, dev, if (!netif_oper_up(eth->netdev[i]))
"Driver up/down cycle failed, closing device.\n"); continue;
dev_close(dev); mtk_stop(eth->netdev[i]);
__set_bit(i, &restart);
}
/* restart DMA and enable IRQs */
for (i = 0; i < MTK_MAC_COUNT; i++) {
if (!test_bit(i, &restart))
continue;
err = mtk_open(eth->netdev[i]);
if (err) {
netif_alert(eth, ifup, eth->netdev[i],
"Driver up/down cycle failed, closing device.\n");
dev_close(eth->netdev[i]);
}
} }
rtnl_unlock(); rtnl_unlock();
} }
......
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