Skip to content

Commit ba0da2d

Browse files
Sean AndersonPaolo Abeni
authored andcommitted
net: xilinx: axienet: Schedule NAPI in two steps
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: 9e2bc26 ("net: axienet: Use NAPI for TX completion path") Fixes: cc37610 ("net: axienet: implement NAPI and GRO receive") Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 194ef9d commit ba0da2d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/net/ethernet/xilinx/xilinx_axienet_main.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,9 +1282,10 @@ static irqreturn_t axienet_tx_irq(int irq, void *_ndev)
12821282
u32 cr = lp->tx_dma_cr;
12831283

12841284
cr &= ~(XAXIDMA_IRQ_IOC_MASK | XAXIDMA_IRQ_DELAY_MASK);
1285-
axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, cr);
1286-
1287-
napi_schedule(&lp->napi_tx);
1285+
if (napi_schedule_prep(&lp->napi_tx)) {
1286+
axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, cr);
1287+
__napi_schedule(&lp->napi_tx);
1288+
}
12881289
}
12891290

12901291
return IRQ_HANDLED;
@@ -1326,9 +1327,10 @@ static irqreturn_t axienet_rx_irq(int irq, void *_ndev)
13261327
u32 cr = lp->rx_dma_cr;
13271328

13281329
cr &= ~(XAXIDMA_IRQ_IOC_MASK | XAXIDMA_IRQ_DELAY_MASK);
1329-
axienet_dma_out32(lp, XAXIDMA_RX_CR_OFFSET, cr);
1330-
1331-
napi_schedule(&lp->napi_rx);
1330+
if (napi_schedule_prep(&lp->napi_rx)) {
1331+
axienet_dma_out32(lp, XAXIDMA_RX_CR_OFFSET, cr);
1332+
__napi_schedule(&lp->napi_rx);
1333+
}
13321334
}
13331335

13341336
return IRQ_HANDLED;

0 commit comments

Comments
 (0)