Skip to content

Commit ea852c1

Browse files
Gerhard Englederdavem330
authored andcommitted
tsnep: Fix NAPI scheduling
According to the NAPI documentation networking/napi.rst, drivers which have to mask interrupts explicitly should use the napi_schedule_prep() and __napi_schedule() calls. No problem seen so far with current implementation. Nevertheless, let's align the implementation with documentation. Signed-off-by: Gerhard Engleder <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent af21b94 commit ea852c1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

drivers/net/ethernet/engleder/tsnep_main.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,11 @@ static irqreturn_t tsnep_irq(int irq, void *arg)
8787

8888
/* handle TX/RX queue 0 interrupt */
8989
if ((active & adapter->queue[0].irq_mask) != 0) {
90-
tsnep_disable_irq(adapter, adapter->queue[0].irq_mask);
91-
napi_schedule(&adapter->queue[0].napi);
90+
if (napi_schedule_prep(&adapter->queue[0].napi)) {
91+
tsnep_disable_irq(adapter, adapter->queue[0].irq_mask);
92+
/* schedule after masking to avoid races */
93+
__napi_schedule(&adapter->queue[0].napi);
94+
}
9295
}
9396

9497
return IRQ_HANDLED;
@@ -99,8 +102,11 @@ static irqreturn_t tsnep_irq_txrx(int irq, void *arg)
99102
struct tsnep_queue *queue = arg;
100103

101104
/* handle TX/RX queue interrupt */
102-
tsnep_disable_irq(queue->adapter, queue->irq_mask);
103-
napi_schedule(&queue->napi);
105+
if (napi_schedule_prep(&queue->napi)) {
106+
tsnep_disable_irq(queue->adapter, queue->irq_mask);
107+
/* schedule after masking to avoid races */
108+
__napi_schedule(&queue->napi);
109+
}
104110

105111
return IRQ_HANDLED;
106112
}

0 commit comments

Comments
 (0)