[OpenWrt-Devel] [PATCH] ar71xx: check for stuck DMA on AR724x & fix sirq storm after recovery

Conn O'Griofa connogriofa at gmail.com
Fri Jan 8 00:26:17 EST 2016


I'm proposing the following patch to resolve ticket #18922 fully.

With the current master revision, when a tx timeout condition occurs, the interface recovers successfully, but a soft irq storm occurs (causing ksoftirqd to peg the CPU, due to this goto being called without end: https://github.com/openwrt-mirror/openwrt/blob/master/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c#L1073 ). Forcing the tx and rx rings to be cleared and re-inited in ag71xx_restart_work_func seems to avoid the sirq storm, but I'd appreciate feedback on whether there's a more effective workaround.

Additionally, ag71xx_check_dma_stuck *does* successfully detect the stuck DMA condition on AR7241 (TR-WL842ND v1), so enabling the check for this chipset series ensures a link adjust occurs *before* an actual tx timeout is detected. This avoids the brief network interruption that normally occurs during the DMA stuck -> tx timeout -> link adjust condition.


P.S. The sirq storm also occurs when ag71xx_check_dma_stuck is utilized on this chipset to avoid the tx timeout condition, so it appears that both changes are necessary (or at least, a better way to solve the sirq storm needs to be discovered).

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 31b38d7..8959701 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
@@ -183,6 +183,8 @@ static void ag71xx_ring_tx_init(struct ag71xx *ag)
  	ring->curr = 0;
  	ring->dirty = 0;
+	ag71xx_wr(ag, AG71XX_REG_TX_DESC, ag->tx_ring.descs_dma);
  static void ag71xx_ring_rx_clean(struct ag71xx *ag)
@@ -272,6 +274,8 @@ static int ag71xx_ring_rx_init(struct ag71xx *ag)
  	ring->curr = 0;
  	ring->dirty = 0;
+	ag71xx_wr(ag, AG71XX_REG_RX_DESC, ag->rx_ring.descs_dma);
  	return ret;
@@ -652,9 +656,6 @@ static int ag71xx_open(struct net_device *dev)
-	ag71xx_wr(ag, AG71XX_REG_TX_DESC, ag->tx_ring.descs_dma);
-	ag71xx_wr(ag, AG71XX_REG_RX_DESC, ag->rx_ring.descs_dma);
  	ag71xx_hw_set_macaddr(ag, dev->dev_addr);
@@ -873,6 +874,8 @@ static void ag71xx_restart_work_func(struct work_struct *work)
  	if (ag71xx_get_pdata(ag)->is_ar724x) {
  		ag->link = 0;
+		ag71xx_rings_cleanup(ag);
+		ag71xx_rings_init(ag);
@@ -919,7 +922,7 @@ static int ag71xx_tx_packets(struct ag71xx *ag, bool flush)
  		struct sk_buff *skb = ring->buf[i].skb;
  		if (!flush && !ag71xx_desc_empty(desc)) {
-			if (pdata->is_ar7240 &&
+			if (pdata->is_ar724x &&
  			    ag71xx_check_dma_stuck(ag, ring->buf[i].timestamp))
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list