aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2016-06-17 23:58:11 +0200
committerFelix Fietkau <nbd@nbd.name>2016-07-02 10:30:58 +0200
commitf9e7ffe73be9a45c1b44f8899d9f18ccda7c5083 (patch)
tree394bce7cc92c4278df0a9e9be52e75e6d402135c /target/linux/ar71xx
parentf28502a4857027490f0a5d7cc879457dd2b1cc6a (diff)
downloadupstream-f9e7ffe73be9a45c1b44f8899d9f18ccda7c5083.tar.gz
upstream-f9e7ffe73be9a45c1b44f8899d9f18ccda7c5083.tar.bz2
upstream-f9e7ffe73be9a45c1b44f8899d9f18ccda7c5083.zip
ar71xx: prevent spurious ethernet resets from dma hang check false positives
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r--target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h2
-rw-r--r--target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c16
2 files changed, 12 insertions, 6 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
index 5d03dcf2bd..898bde1d25 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
@@ -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;
diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index 0ae6acf119..fc91b9f060 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -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);
@@ -950,6 +950,7 @@ static int ag71xx_tx_packets(struct ag71xx *ag, bool flush)
{
struct ag71xx_ring *ring = &ag->tx_ring;
struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag);
+ bool dma_stuck = false;
int ring_mask = BIT(ring->order) - 1;
int ring_size = BIT(ring->order);
int sent = 0;
@@ -965,8 +966,10 @@ 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);
+ ag71xx_check_dma_stuck(ag, ring->buf[i].timestamp)) {
+ schedule_delayed_work(&ag->restart_work, HZ / 2);
+ dma_stuck = true;
+ }
break;
}
@@ -1003,6 +1006,9 @@ static int ag71xx_tx_packets(struct ag71xx *ag, bool flush)
if ((ring->curr - ring->dirty) < (ring_size * 3) / 4)
netif_wake_queue(ag->dev);
+ if (!dma_stuck)
+ cancel_delayed_work(&ag->restart_work);
+
return sent;
}
@@ -1321,7 +1327,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;