Skip to contentSkip to conversation

e1000e: Use __napi_schedule_irqoff()

PATCH In review Matt Vollrath 3 participants 3 messages Apr 8 – May 17

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

PATCH 1/1 e1000e: Use __napi_schedule_irqoff()

The __napi_schedule_irqoff() macro is intended to bypass saving and restoring IRQ state when scheduling is requested from an IRQ handler, where hard interrupts are already disabled. Use this macro in all three interrupt handlers.

This was tested on a system with an I218-V and MSI interrupts. Because this is an optimization, I was interested in measuring the impact, so I added ktime_get() time measurement to e1000_intr_msi and a print of the last sample in the watchdog task. For each test case I ran a bi-directional iperf3 to saturate the line. With some help from awk, here are the statistics.

49 samples each, all units ns

previous: min 678 max 1265 mean 879.429 median 806 stddev 137.188
noirq:    min 707 max 1165 mean 811.857 median 790 stddev  89.486

According to this informal comparison, the mean time to handle an interrupt from start to finish is improved by about 8% under load.

---
 drivers/net/ethernet/intel/e1000e/netdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +3 -3
index 9befdacd6730..3ba108bc3036 100644
@@ -1803,7 +1803,7 @@ static irqreturn_t e1000_intr_msi(int __always_unused irq, void *data)
 		adapter->total_tx_packets = 0;
 		adapter->total_rx_bytes = 0;
 		adapter->total_rx_packets = 0;
-		__napi_schedule(&adapter->napi);
+		__napi_schedule_irqoff(&adapter->napi);
 	}
 
 	return IRQ_HANDLED;
@@ -1882,7 +1882,7 @@ static irqreturn_t e1000_intr(int __always_unused irq, void *data)
 		adapter->total_tx_packets = 0;
 		adapter->total_rx_bytes = 0;
 		adapter->total_rx_packets = 0;
-		__napi_schedule(&adapter->napi);
+		__napi_schedule_irqoff(&adapter->napi);
 	}
 
 	return IRQ_HANDLED;
@@ -1951,7 +1951,7 @@ static irqreturn_t e1000_intr_msix_rx(int __always_unused irq, void *data)
 	if (napi_schedule_prep(&adapter->napi)) {
 		adapter->total_rx_bytes = 0;
 		adapter->total_rx_packets = 0;
-		__napi_schedule(&adapter->napi);
+		__napi_schedule_irqoff(&adapter->napi);
 	}
 	return IRQ_HANDLED;
 }
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 69 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Matt Vollrath
Sent: Thursday, April 9, 2026 12:17 AM
To: [email protected]
Cc: Matt Vollrath <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next] e1000e: Use __napi_schedule_irqoff()

The __napi_schedule_irqoff() macro is intended to bypass saving and restoring IRQ state when scheduling is requested from an IRQ handler, where hard interrupts are already disabled. Use this macro in all three interrupt handlers.

This was tested on a system with an I218-V and MSI interrupts. Because this is an optimization, I was interested in measuring the impact, so I added ktime_get() time measurement to e1000_intr_msi and a print of the last sample in the watchdog task. For each test case I ran a bi- directional iperf3 to saturate the line. With some help from awk, here are the statistics.

49 samples each, all units ns

previous: min 678 max 1265 mean 879.429 median 806 stddev 137.188
noirq:    min 707 max 1165 mean 811.857 median 790 stddev  89.486

According to this informal comparison, the mean time to handle an interrupt from start to finish is improved by about 8% under load.

---
 drivers/net/ethernet/intel/e1000e/netdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +1 -1
index 9befdacd6730..3ba108bc3036 100644
@@ -1803,7 +1803,7 @@ static irqreturn_t e1000_intr_msi(int
 __always_unused irq, void *data)
 		adapter->total_tx_packets = 0;
 		adapter->total_rx_bytes = 0;
 		adapter->total_rx_packets = 0;
-		__napi_schedule(&adapter->napi);
+		__napi_schedule_irqoff(&adapter->napi);
 	}
 
drivers/net/ethernet/intel/e1000e/netdev.c +1 -1
 	return IRQ_HANDLED;
@@ -1882,7 +1882,7 @@ static irqreturn_t e1000_intr(int
 __always_unused irq, void *data)
 		adapter->total_tx_packets = 0;
 		adapter->total_rx_bytes = 0;
 		adapter->total_rx_packets = 0;
-		__napi_schedule(&adapter->napi);
+		__napi_schedule_irqoff(&adapter->napi);
 	}
 
drivers/net/ethernet/intel/e1000e/netdev.c +1 -1
 	return IRQ_HANDLED;
@@ -1951,7 +1951,7 @@ static irqreturn_t e1000_intr_msix_rx(int
 __always_unused irq, void *data)
 	if (napi_schedule_prep(&adapter->napi)) {
 		adapter->total_rx_bytes = 0;
 		adapter->total_rx_packets = 0;
-		__napi_schedule(&adapter->napi);
+		__napi_schedule_irqoff(&adapter->napi);
 	}
 	return IRQ_HANDLED;
Quoted 3 lines

}
--
2.43.0

Tested-by
#2 lore raw
Quoted 59 lines · Aleksandr
Quoted 59 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Matt Vollrath
Sent: Thursday, April 9, 2026 12:17 AM
To: [email protected]
Cc: Matt Vollrath <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next] e1000e: Use __napi_schedule_irqoff()

The __napi_schedule_irqoff() macro is intended to bypass saving and restoring IRQ state when scheduling is requested from an IRQ handler, where hard interrupts are already disabled. Use this macro in all three interrupt handlers.

This was tested on a system with an I218-V and MSI interrupts. Because this is an optimization, I was interested in measuring the impact, so I added ktime_get() time measurement to e1000_intr_msi and a print of the last sample in the watchdog task. For each test case I ran a bi- directional iperf3 to saturate the line. With some help from awk, here are the statistics.

49 samples each, all units ns

previous: min 678 max 1265 mean 879.429 median 806 stddev 137.188
noirq:    min 707 max 1165 mean 811.857 median 790 stddev  89.486

According to this informal comparison, the mean time to handle an interrupt from start to finish is improved by about 8% under load.

---
  drivers/net/ethernet/intel/e1000e/netdev.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +1 -1
index 9befdacd6730..3ba108bc3036 100644
@@ -1803,7 +1803,7 @@ static irqreturn_t e1000_intr_msi(int
 __always_unused irq, void *data)
               adapter->total_tx_packets = 0;
               adapter->total_rx_bytes = 0;
               adapter->total_rx_packets = 0;
-             __napi_schedule(&adapter->napi);
+             __napi_schedule_irqoff(&adapter->napi);
       }
 
       return IRQ_HANDLED;
drivers/net/ethernet/intel/e1000e/netdev.c +1 -1
@@ -1882,7 +1882,7 @@ static irqreturn_t e1000_intr(int
 __always_unused irq, void *data)
               adapter->total_tx_packets = 0;
               adapter->total_rx_bytes = 0;
               adapter->total_rx_packets = 0;
-             __napi_schedule(&adapter->napi);
+             __napi_schedule_irqoff(&adapter->napi);
       }
 
Quoted 16 lines
Quoted 10 lines
       return IRQ_HANDLED;
drivers/net/ethernet/intel/e1000e/netdev.c +1 -1
@@ -1951,7 +1951,7 @@ static irqreturn_t e1000_intr_msix_rx(int
 __always_unused irq, void *data)
       if (napi_schedule_prep(&adapter->napi)) {
               adapter->total_rx_bytes = 0;
               adapter->total_rx_packets = 0;
-             __napi_schedule(&adapter->napi);
+             __napi_schedule_irqoff(&adapter->napi);
       }
       return IRQ_HANDLED;
Quoted 3 lines

}
--
2.43.0