Skip to contentSkip to conversation

net: lantiq: disable interrupt before sheduling NAPI

PATCH Applied Aleksander Jan Bajkowski 3 participants 3 messages Jun 8, 2021 – Jun 9, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: lantiq: disable interrupt before sheduling NAPI

This patch fixes TX hangs with threaded NAPI enabled. The scheduled NAPI seems to be executed in parallel with the interrupt on second thread. Sometimes it happens that ltq_dma_disable_irq() is executed after xrx200_tx_housekeeping(). The symptom is that TX interrupts are disabled in the DMA controller. As a result, the TX hangs after a few seconds of the iperf test. Scheduling NAPI after disabling interrupts fixes this issue.

Tested on Lantiq xRX200 (BT Home Hub 5A).

Fixes 9423361da523 ("net: lantiq: Disable IRQs only if NAPI gets scheduled ")
---
 drivers/net/ethernet/lantiq_xrx200.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/lantiq_xrx200.c +1 -1
index 36dc3e5f6218..0e10d8aeffe1 100644
@@ -352,8 +352,8 @@ static irqreturn_t xrx200_dma_irq(int irq, void *ptr)
 	struct xrx200_chan *ch = ptr;
 
 	if (napi_schedule_prep(&ch->napi)) {
-		__napi_schedule(&ch->napi);
 		ltq_dma_disable_irq(&ch->dma);
+		__napi_schedule(&ch->napi);
 	}
 
 	ltq_dma_ack_irq(&ch->dma);
Signature · 1 line
2.30.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Aleksander Jan Bajkowski

This patch fixes TX hangs with threaded NAPI enabled. The scheduled NAPI seems to be executed in parallel with the interrupt on second thread. Sometimes it happens that ltq_dma_disable_irq() is executed after xrx200_tx_housekeeping(). The symptom is that TX interrupts are disabled in the DMA controller. As a result, the TX hangs after a few seconds of the iperf test. Scheduling NAPI after disabling interrupts fixes this issue.

Quoted 4 lines

Tested on Lantiq xRX200 (BT Home Hub 5A).

Fixes 9423361da523 ("net: lantiq: Disable IRQs only if NAPI gets scheduled ")
Quoted 19 lines
---
  drivers/net/ethernet/lantiq_xrx200.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/lantiq_xrx200.c +1 -1
index 36dc3e5f6218..0e10d8aeffe1 100644
@@ -352,8 +352,8 @@ static irqreturn_t xrx200_dma_irq(int irq, void *ptr)
  	struct xrx200_chan *ch = ptr;
 
  	if (napi_schedule_prep(&ch->napi)) {
-		__napi_schedule(&ch->napi);
  		ltq_dma_disable_irq(&ch->dma);
+		__napi_schedule(&ch->napi);
  	}
 
  	ltq_dma_ack_irq(&ch->dma);
#2 lore raw
In reply to Aleksander Jan Bajkowski
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 9 lines · On Tue, 8 Jun 2021 23:21:07 +0200 you wrote:

This patch fixes TX hangs with threaded NAPI enabled. The scheduled NAPI seems to be executed in parallel with the interrupt on second thread. Sometimes it happens that ltq_dma_disable_irq() is executed after xrx200_tx_housekeeping(). The symptom is that TX interrupts are disabled in the DMA controller. As a result, the TX hangs after a few seconds of the iperf test. Scheduling NAPI after disabling interrupts fixes this issue.

[...]

Here is the summary with links:
- [net] net: lantiq: disable interrupt before sheduling NAPI

    https://git.kernel.org/netdev/net/c/f2386cf7c5f4

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html