ar71xx: prevent spurious ethernet resets from dma hang check false positives

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2016-06-17 23:58:11 +02:00
parent 26b8db2537
commit 3d58d7f053
2 changed files with 6 additions and 5 deletions

View File

@ -174,7 +174,7 @@ struct ag71xx {
unsigned int desc_pktlen_mask;
unsigned int rx_buf_size;
struct work_struct restart_work;
struct delayed_work restart_work;
struct delayed_work link_work;
struct timer_list oom_timer;

View File

@ -908,12 +908,12 @@ static void ag71xx_tx_timeout(struct net_device *dev)
if (netif_msg_tx_err(ag))
pr_info("%s: tx timeout\n", ag->dev->name);
schedule_work(&ag->restart_work);
schedule_delayed_work(&ag->restart_work, 1);
}
static void ag71xx_restart_work_func(struct work_struct *work)
{
struct ag71xx *ag = container_of(work, struct ag71xx, restart_work);
struct ag71xx *ag = container_of(work, struct ag71xx, restart_work.work);
rtnl_lock();
ag71xx_hw_disable(ag);
@ -966,7 +966,7 @@ static int ag71xx_tx_packets(struct ag71xx *ag, bool flush)
if (!flush && !ag71xx_desc_empty(desc)) {
if (pdata->is_ar724x &&
ag71xx_check_dma_stuck(ag, ring->buf[i].timestamp))
schedule_work(&ag->restart_work);
schedule_delayed_work(&ag->restart_work, HZ / 2);
break;
}
@ -1002,6 +1002,7 @@ static int ag71xx_tx_packets(struct ag71xx *ag, bool flush)
netdev_completed_queue(ag->dev, sent, bytes_compl);
if ((ring->curr - ring->dirty) < (ring_size * 3) / 4)
netif_wake_queue(ag->dev);
cancel_delayed_work(&ag->restart_work);
return sent;
}
@ -1321,7 +1322,7 @@ static int ag71xx_probe(struct platform_device *pdev)
dev->netdev_ops = &ag71xx_netdev_ops;
dev->ethtool_ops = &ag71xx_ethtool_ops;
INIT_WORK(&ag->restart_work, ag71xx_restart_work_func);
INIT_DELAYED_WORK(&ag->restart_work, ag71xx_restart_work_func);
init_timer(&ag->oom_timer);
ag->oom_timer.data = (unsigned long) dev;