* [PATCH net v2] net: xilinx: axienet: Schedule NAPI in two steps
@ 2024-09-13 14:57 Sean Anderson
2024-09-13 15:37 ` Eric Dumazet
2024-09-19 11:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Sean Anderson @ 2024-09-13 14:57 UTC (permalink / raw)
To: Radhey Shyam Pandey, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev
Cc: linux-arm-kernel, Michal Simek, linux-kernel, Robert Hancock,
Sean Anderson, Shannon Nelson
As advised by Documentation/networking/napi.rst, masking IRQs after
calling napi_schedule can be racy. Avoid this by only masking/scheduling
if napi_schedule_prep returns true.
Fixes: 9e2bc267e780 ("net: axienet: Use NAPI for TX completion path")
Fixes: cc37610caaf8 ("net: axienet: implement NAPI and GRO receive")
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
Changes in v2:
- Don't use the irqoff variant of __napi_schedule
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 9eb300fc3590..3de6559ceea6 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1222,9 +1222,10 @@ static irqreturn_t axienet_tx_irq(int irq, void *_ndev)
u32 cr = lp->tx_dma_cr;
cr &= ~(XAXIDMA_IRQ_IOC_MASK | XAXIDMA_IRQ_DELAY_MASK);
- axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, cr);
-
- napi_schedule(&lp->napi_tx);
+ if (napi_schedule_prep(&lp->napi_tx)) {
+ axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, cr);
+ __napi_schedule(&lp->napi_tx);
+ }
}
return IRQ_HANDLED;
@@ -1266,9 +1267,10 @@ static irqreturn_t axienet_rx_irq(int irq, void *_ndev)
u32 cr = lp->rx_dma_cr;
cr &= ~(XAXIDMA_IRQ_IOC_MASK | XAXIDMA_IRQ_DELAY_MASK);
- axienet_dma_out32(lp, XAXIDMA_RX_CR_OFFSET, cr);
-
- napi_schedule(&lp->napi_rx);
+ if (napi_schedule_prep(&lp->napi_rx)) {
+ axienet_dma_out32(lp, XAXIDMA_RX_CR_OFFSET, cr);
+ __napi_schedule(&lp->napi_rx);
+ }
}
return IRQ_HANDLED;
--
2.35.1.1320.gc452695387.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: xilinx: axienet: Schedule NAPI in two steps
2024-09-13 14:57 [PATCH net v2] net: xilinx: axienet: Schedule NAPI in two steps Sean Anderson
@ 2024-09-13 15:37 ` Eric Dumazet
2024-09-19 11:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2024-09-13 15:37 UTC (permalink / raw)
To: Sean Anderson
Cc: Radhey Shyam Pandey, David S . Miller, Jakub Kicinski,
Paolo Abeni, netdev, linux-arm-kernel, Michal Simek, linux-kernel,
Robert Hancock, Shannon Nelson
On Fri, Sep 13, 2024 at 4:57 PM Sean Anderson <sean.anderson@linux.dev> wrote:
>
> As advised by Documentation/networking/napi.rst, masking IRQs after
> calling napi_schedule can be racy. Avoid this by only masking/scheduling
> if napi_schedule_prep returns true.
>
> Fixes: 9e2bc267e780 ("net: axienet: Use NAPI for TX completion path")
> Fixes: cc37610caaf8 ("net: axienet: implement NAPI and GRO receive")
> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
> ---
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: xilinx: axienet: Schedule NAPI in two steps
2024-09-13 14:57 [PATCH net v2] net: xilinx: axienet: Schedule NAPI in two steps Sean Anderson
2024-09-13 15:37 ` Eric Dumazet
@ 2024-09-19 11:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-19 11:10 UTC (permalink / raw)
To: Sean Anderson
Cc: radhey.shyam.pandey, davem, edumazet, kuba, pabeni, netdev,
linux-arm-kernel, michal.simek, linux-kernel, robert.hancock,
shannon.nelson
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Fri, 13 Sep 2024 10:57:11 -0400 you wrote:
> As advised by Documentation/networking/napi.rst, masking IRQs after
> calling napi_schedule can be racy. Avoid this by only masking/scheduling
> if napi_schedule_prep returns true.
>
> Fixes: 9e2bc267e780 ("net: axienet: Use NAPI for TX completion path")
> Fixes: cc37610caaf8 ("net: axienet: implement NAPI and GRO receive")
> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
>
> [...]
Here is the summary with links:
- [net,v2] net: xilinx: axienet: Schedule NAPI in two steps
https://git.kernel.org/netdev/net/c/ba0da2dc934e
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] 3+ messages in thread
end of thread, other threads:[~2024-09-19 11:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-13 14:57 [PATCH net v2] net: xilinx: axienet: Schedule NAPI in two steps Sean Anderson
2024-09-13 15:37 ` Eric Dumazet
2024-09-19 11:10 ` 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