* [net PATCH] net: ethernet: mediatek: disable irq before schedule napi
@ 2023-10-02 14:08 Christian Marangi
2023-10-05 13:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Christian Marangi @ 2023-10-02 14:08 UTC (permalink / raw)
To: Felix Fietkau, John Crispin, Sean Wang, Mark Lee,
Lorenzo Bianconi, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Matthias Brugger, AngeloGioacchino Del Regno,
Michael Lee, netdev, linux-kernel, linux-arm-kernel,
linux-mediatek
Cc: Christian Marangi, stable
While searching for possible refactor of napi_schedule_prep and
__napi_schedule it was notice that the mtk eth driver disable the
interrupt for rx and tx AFTER napi is scheduled.
While this is a very hard to repro case it might happen to have
situation where the interrupt is disabled and never enabled again as the
napi completes and the interrupt is enabled before.
This is caused by the fact that a napi driven by interrupt expect a
logic with:
1. interrupt received. napi prepared -> interrupt disabled -> napi
scheduled
2. napi triggered. ring cleared -> interrupt enabled -> wait for new
interrupt
To prevent this case, disable the interrupt BEFORE the napi is
scheduled.
Fixes: 656e705243fd ("net-next: mediatek: add support for MT7623 ethernet")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 82b51072aad8..7669b446915a 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -3172,8 +3172,8 @@ static irqreturn_t mtk_handle_irq_rx(int irq, void *_eth)
eth->rx_events++;
if (likely(napi_schedule_prep(ð->rx_napi))) {
- __napi_schedule(ð->rx_napi);
mtk_rx_irq_disable(eth, eth->soc->txrx.rx_irq_done_mask);
+ __napi_schedule(ð->rx_napi);
}
return IRQ_HANDLED;
@@ -3185,8 +3185,8 @@ static irqreturn_t mtk_handle_irq_tx(int irq, void *_eth)
eth->tx_events++;
if (likely(napi_schedule_prep(ð->tx_napi))) {
- __napi_schedule(ð->tx_napi);
mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
+ __napi_schedule(ð->tx_napi);
}
return IRQ_HANDLED;
--
2.40.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [net PATCH] net: ethernet: mediatek: disable irq before schedule napi
2023-10-02 14:08 [net PATCH] net: ethernet: mediatek: disable irq before schedule napi Christian Marangi
@ 2023-10-05 13:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-05 13:30 UTC (permalink / raw)
To: Christian Marangi
Cc: nbd, john, sean.wang, Mark-MC.Lee, lorenzo, davem, edumazet, kuba,
pabeni, matthias.bgg, angelogioacchino.delregno, igvtee, netdev,
linux-kernel, linux-arm-kernel, linux-mediatek, stable
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 2 Oct 2023 16:08:05 +0200 you wrote:
> While searching for possible refactor of napi_schedule_prep and
> __napi_schedule it was notice that the mtk eth driver disable the
> interrupt for rx and tx AFTER napi is scheduled.
>
> While this is a very hard to repro case it might happen to have
> situation where the interrupt is disabled and never enabled again as the
> napi completes and the interrupt is enabled before.
>
> [...]
Here is the summary with links:
- [net] net: ethernet: mediatek: disable irq before schedule napi
https://git.kernel.org/netdev/net/c/fcdfc462881d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-05 13:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-02 14:08 [net PATCH] net: ethernet: mediatek: disable irq before schedule napi Christian Marangi
2023-10-05 13:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).