Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1468598 > unrolled thread

[PATCH net] dwc_eth_qos: fix interrupt enable race

Started byLars Persson <lars.persson@axis.com>
First post2016-08-23 16:40 +0200
Last post2016-08-24 02:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net] dwc_eth_qos: fix interrupt enable race Lars Persson <lars.persson@axis.com> - 2016-08-23 16:40 +0200
    Re: [PATCH net] dwc_eth_qos: fix interrupt enable race David Miller <davem@davemloft.net> - 2016-08-24 02:20 +0200

#1468598 — [PATCH net] dwc_eth_qos: fix interrupt enable race

FromLars Persson <lars.persson@axis.com>
Date2016-08-23 16:40 +0200
Subject[PATCH net] dwc_eth_qos: fix interrupt enable race
Message-ID<s9l1U-5eM-19@gated-at.bofh.it>
From: Rabin Vincent <rabinv@axis.com>

We currently enable interrupts before we enable NAPI. If an RX interrupt
hits before we enabled NAPI then the NAPI callback is never called and
we leave the hardware with RX interrupts disabled, which of course leads
us to never handling received packets.  Fix this by moving the interrupt
enable to after we've enable NAPI and the reclaim tasklet.

Fixes: cd5e41234729 ("dwc_eth_qos: do phy_start before resetting hardware")
Signed-off-by: Rabin Vincent <rabinv@axis.com>
Signed-off-by: Lars Persson <larper@axis.com>
---
 drivers/net/ethernet/synopsys/dwc_eth_qos.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/synopsys/dwc_eth_qos.c b/drivers/net/ethernet/synopsys/dwc_eth_qos.c
index 9f159a7..5a3941b 100644
--- a/drivers/net/ethernet/synopsys/dwc_eth_qos.c
+++ b/drivers/net/ethernet/synopsys/dwc_eth_qos.c
@@ -1622,13 +1622,7 @@ static void dwceqos_init_hw(struct net_local *lp)
 		DWCEQOS_MMC_CTRL_RSTONRD);
 	dwceqos_enable_mmc_interrupt(lp);
 
-	/* Enable Interrupts */
-	dwceqos_write(lp, REG_DWCEQOS_DMA_CH0_IE,
-		      DWCEQOS_DMA_CH0_IE_NIE |
-		      DWCEQOS_DMA_CH0_IE_RIE | DWCEQOS_DMA_CH0_IE_TIE |
-		      DWCEQOS_DMA_CH0_IE_AIE |
-		      DWCEQOS_DMA_CH0_IE_FBEE);
-
+	dwceqos_write(lp, REG_DWCEQOS_DMA_CH0_IE, 0);
 	dwceqos_write(lp, REG_DWCEQOS_MAC_IE, 0);
 
 	dwceqos_write(lp, REG_DWCEQOS_MAC_CFG, DWCEQOS_MAC_CFG_IPC |
@@ -1905,6 +1899,15 @@ static int dwceqos_open(struct net_device *ndev)
 	netif_start_queue(ndev);
 	tasklet_enable(&lp->tx_bdreclaim_tasklet);
 
+	/* Enable Interrupts -- do this only after we enable NAPI and the
+	 * tasklet.
+	 */
+	dwceqos_write(lp, REG_DWCEQOS_DMA_CH0_IE,
+		      DWCEQOS_DMA_CH0_IE_NIE |
+		      DWCEQOS_DMA_CH0_IE_RIE | DWCEQOS_DMA_CH0_IE_TIE |
+		      DWCEQOS_DMA_CH0_IE_AIE |
+		      DWCEQOS_DMA_CH0_IE_FBEE);
+
 	return 0;
 }
 
-- 
2.1.4

[toc] | [next] | [standalone]


#1468986

FromDavid Miller <davem@davemloft.net>
Date2016-08-24 02:20 +0200
Message-ID<s9u5b-2Ua-3@gated-at.bofh.it>
In reply to#1468598
From: Lars Persson <lars.persson@axis.com>
Date: Tue, 23 Aug 2016 16:31:28 +0200

> From: Rabin Vincent <rabinv@axis.com>
> 
> We currently enable interrupts before we enable NAPI. If an RX interrupt
> hits before we enabled NAPI then the NAPI callback is never called and
> we leave the hardware with RX interrupts disabled, which of course leads
> us to never handling received packets.  Fix this by moving the interrupt
> enable to after we've enable NAPI and the reclaim tasklet.
> 
> Fixes: cd5e41234729 ("dwc_eth_qos: do phy_start before resetting hardware")
> Signed-off-by: Rabin Vincent <rabinv@axis.com>
> Signed-off-by: Lars Persson <larper@axis.com>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web