# \[PATCH net\] net: stmmac: use \_\_napi\_schedule() for PREEMPT\_RT

- Subsystems: NETWORKING DRIVERS, STMMAC ETHERNET DRIVER, THE REST
- Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Chevallier, Linus Torvalds
- Status: LANDED (1f02efd1bb35 · 2021-01-13 23:50)
- Landed in mainline as 1f02efd1bb35 on 2021-01-13.
- List: linux-arm-kernel
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-arm-kernel/2021/01/6231807/t

## \[PATCH net\] net: stmmac: use \_\_napi\_schedule() for PREEMPT\_RT

- From: Sebastien Laveze \<hidden\>
- Date: 2021-01-12 14:04:29 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/01/6231807.md

```text
From: Seb Laveze <redacted>

Use of __napi_schedule_irqoff() is not safe with PREEMPT_RT in which
hard interrupts are not disabled while running the threaded interrupt.

Using __napi_schedule() works for both PREEMPT_RT and mainline Linux,
just at the cost of an additional check if interrupts are disabled for
mainline (since they are already disabled).

Similar to the fix done for enetc:
215602a8d212 ("enetc: use napi_schedule to be compatible with PREEMPT_RT")

Signed-off-by: Seb Laveze <redacted>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5b1c12ff98c0..2d90d6856ec5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2184,7 +2184,7 @@ static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan)
 			spin_lock_irqsave(&ch->lock, flags);
 			stmmac_disable_dma_irq(priv, priv->ioaddr, chan, 1, 0);
 			spin_unlock_irqrestore(&ch->lock, flags);
-			__napi_schedule_irqoff(&ch->rx_napi);
+			__napi_schedule(&ch->rx_napi);
 		}
 	}
 
@@ -2193,7 +2193,7 @@ static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan)
 			spin_lock_irqsave(&ch->lock, flags);
 			stmmac_disable_dma_irq(priv, priv->ioaddr, chan, 0, 1);
 			spin_unlock_irqrestore(&ch->lock, flags);
-			__napi_schedule_irqoff(&ch->tx_napi);
+			__napi_schedule(&ch->tx_napi);
 		}
 	}
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```

## Re: \[PATCH net\] net: stmmac: use \_\_napi\_schedule() for PREEMPT\_RT

- From: Jakub Kicinski \<kuba@kernel.org\>
- Date: 2021-01-14 01:51:44 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/01/6234003.md

```text
On Tue, 12 Jan 2021 15:01:22 +0100 Sebastien Laveze wrote:
> From: Seb Laveze <redacted>
> 
> Use of __napi_schedule_irqoff() is not safe with PREEMPT_RT in which
> hard interrupts are not disabled while running the threaded interrupt.
> 
> Using __napi_schedule() works for both PREEMPT_RT and mainline Linux,
> just at the cost of an additional check if interrupts are disabled for
> mainline (since they are already disabled).
> 
> Similar to the fix done for enetc:
> 215602a8d212 ("enetc: use napi_schedule to be compatible with PREEMPT_RT")
> 
> Signed-off-by: Seb Laveze <redacted>

Fixed up the commit message to appease checkpatch and applied, thanks!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```
