* [PATCH net-next v2] r8169: Use napi_schedule_irqoff()
@ 2026-04-12 1:40 Matt Vollrath
2026-04-12 11:30 ` Heiner Kallweit
0 siblings, 1 reply; 5+ messages in thread
From: Matt Vollrath @ 2026-04-12 1:40 UTC (permalink / raw)
To: netdev
Cc: Matt Vollrath, edumazet, pabeni, hkallweit1, kuba, andrew+netdev,
nic_swsd
napi_schedule() masks hard interrupts while doing its work, which is
redundant when called from an interrupt handler where hard interrupts
are already masked. Use napi_schedule_irqoff() instead to bypass this
redundant masking. This is an optimization.
Tested on a Lenovo RTL8168h/8111h.
Signed-off-by: Matt Vollrath <tactii@gmail.com>
---
drivers/net/ethernet/realtek/r8169_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 791277e750ba..4c0ad0de3410 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -4873,7 +4873,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
phy_mac_interrupt(tp->phydev);
rtl_irq_disable(tp);
- napi_schedule(&tp->napi);
+ napi_schedule_irqoff(&tp->napi);
out:
rtl_ack_events(tp, status);
--
2.43.0
Changes:
v2:
* CC the maintainers, make the CI board green
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] r8169: Use napi_schedule_irqoff()
2026-04-12 1:40 [PATCH net-next v2] r8169: Use napi_schedule_irqoff() Matt Vollrath
@ 2026-04-12 11:30 ` Heiner Kallweit
2026-04-12 13:11 ` Matt Vollrath
2026-04-12 13:51 ` Matt Vollrath
0 siblings, 2 replies; 5+ messages in thread
From: Heiner Kallweit @ 2026-04-12 11:30 UTC (permalink / raw)
To: Matt Vollrath, netdev; +Cc: edumazet, pabeni, kuba, andrew+netdev, nic_swsd
On 12.04.2026 03:40, Matt Vollrath wrote:
> napi_schedule() masks hard interrupts while doing its work, which is
> redundant when called from an interrupt handler where hard interrupts
> are already masked. Use napi_schedule_irqoff() instead to bypass this
> redundant masking. This is an optimization.
>
> Tested on a Lenovo RTL8168h/8111h.
>
> Signed-off-by: Matt Vollrath <tactii@gmail.com>
> ---
> drivers/net/ethernet/realtek/r8169_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
> index 791277e750ba..4c0ad0de3410 100644
> --- a/drivers/net/ethernet/realtek/r8169_main.c
> +++ b/drivers/net/ethernet/realtek/r8169_main.c
> @@ -4873,7 +4873,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
> phy_mac_interrupt(tp->phydev);
>
> rtl_irq_disable(tp);
> - napi_schedule(&tp->napi);
> + napi_schedule_irqoff(&tp->napi);
> out:
> rtl_ack_events(tp, status);
>
Not using napi_schedule_irqoff() here is intentional,
see 2734a24e6e5d18522fbf599135c59b82ec9b2c9e.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] r8169: Use napi_schedule_irqoff()
2026-04-12 11:30 ` Heiner Kallweit
@ 2026-04-12 13:11 ` Matt Vollrath
2026-04-12 13:51 ` Matt Vollrath
1 sibling, 0 replies; 5+ messages in thread
From: Matt Vollrath @ 2026-04-12 13:11 UTC (permalink / raw)
To: Heiner Kallweit, netdev; +Cc: edumazet, pabeni, kuba, andrew+netdev, nic_swsd
On 4/12/26 07:30, Heiner Kallweit wrote:
> On 12.04.2026 03:40, Matt Vollrath wrote:
>> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
>> index 791277e750ba..4c0ad0de3410 100644
>> --- a/drivers/net/ethernet/realtek/r8169_main.c
>> +++ b/drivers/net/ethernet/realtek/r8169_main.c
>> @@ -4873,7 +4873,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
>> phy_mac_interrupt(tp->phydev);
>>
>> rtl_irq_disable(tp);
>> - napi_schedule(&tp->napi);
>> + napi_schedule_irqoff(&tp->napi);
>> out:
>> rtl_ack_events(tp, status);
>>
>
> Not using napi_schedule_irqoff() here is intentional,
> see 2734a24e6e5d18522fbf599135c59b82ec9b2c9e.
I see, thank you Heiner. Seems like it could work if
legacy interrupts went to a separate handler, but not
worth the complexity for this small optimization.
mv
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] r8169: Use napi_schedule_irqoff()
2026-04-12 11:30 ` Heiner Kallweit
2026-04-12 13:11 ` Matt Vollrath
@ 2026-04-12 13:51 ` Matt Vollrath
2026-04-12 20:12 ` Heiner Kallweit
1 sibling, 1 reply; 5+ messages in thread
From: Matt Vollrath @ 2026-04-12 13:51 UTC (permalink / raw)
To: Heiner Kallweit, netdev; +Cc: edumazet, pabeni, kuba, andrew+netdev, nic_swsd
On 4/12/26 07:30, Heiner Kallweit wrote:
> On 12.04.2026 03:40, Matt Vollrath wrote:
>> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
>> index 791277e750ba..4c0ad0de3410 100644
>> --- a/drivers/net/ethernet/realtek/r8169_main.c
>> +++ b/drivers/net/ethernet/realtek/r8169_main.c
>> @@ -4873,7 +4873,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
>> phy_mac_interrupt(tp->phydev);
>>
>> rtl_irq_disable(tp);
>> - napi_schedule(&tp->napi);
>> + napi_schedule_irqoff(&tp->napi);
>> out:
>> rtl_ack_events(tp, status);
>>
>
> Not using napi_schedule_irqoff() here is intentional,
> see 2734a24e6e5d18522fbf599135c59b82ec9b2c9e.
It looks like forced threading was fixed after your fix
to mitigate the issue of forced threading not masking
interrupts.
see 81e2073c175b887398e5bca6c004efa89983f58d
If I understand correctly, this should make
napi_schedule_irqoff() safe in any interrupt handler.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] r8169: Use napi_schedule_irqoff()
2026-04-12 13:51 ` Matt Vollrath
@ 2026-04-12 20:12 ` Heiner Kallweit
0 siblings, 0 replies; 5+ messages in thread
From: Heiner Kallweit @ 2026-04-12 20:12 UTC (permalink / raw)
To: Matt Vollrath, netdev; +Cc: edumazet, pabeni, kuba, andrew+netdev, nic_swsd
On 12.04.2026 15:51, Matt Vollrath wrote:
> On 4/12/26 07:30, Heiner Kallweit wrote:
>> On 12.04.2026 03:40, Matt Vollrath wrote:
>>> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
>>> index 791277e750ba..4c0ad0de3410 100644
>>> --- a/drivers/net/ethernet/realtek/r8169_main.c
>>> +++ b/drivers/net/ethernet/realtek/r8169_main.c
>>> @@ -4873,7 +4873,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
>>> phy_mac_interrupt(tp->phydev);
>>> rtl_irq_disable(tp);
>>> - napi_schedule(&tp->napi);
>>> + napi_schedule_irqoff(&tp->napi);
>>> out:
>>> rtl_ack_events(tp, status);
>>>
>>
>> Not using napi_schedule_irqoff() here is intentional,
>> see 2734a24e6e5d18522fbf599135c59b82ec9b2c9e.
>
> It looks like forced threading was fixed after your fix
> to mitigate the issue of forced threading not masking
> interrupts.
>
> see 81e2073c175b887398e5bca6c004efa89983f58d
>
> If I understand correctly, this should make
> napi_schedule_irqoff() safe in any interrupt handler.
>
I think 8380c81d5c4fced6f4397795a5ae65758272bbfd needs to be
mentioned too, because only with this change your patch is safe
under PREEMPT_RT. Best extend the commit message based on our
discussion. With that one:
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-04-12 20:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-12 1:40 [PATCH net-next v2] r8169: Use napi_schedule_irqoff() Matt Vollrath
2026-04-12 11:30 ` Heiner Kallweit
2026-04-12 13:11 ` Matt Vollrath
2026-04-12 13:51 ` Matt Vollrath
2026-04-12 20:12 ` Heiner Kallweit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox