Skip to content

Commit 080d5c5

Browse files
ikhorndavem330
authored andcommitted
net: ethernet: ti: davinci_cpdma: fix locking while ctrl_stop
The interrupts shouldn't be disabled while receiving skb, but while ctrl_stop, the channels are stopped and all remaining packets are handled with netif_receive_skb(), it can cause WARN_ONCE when ctrl is stopping while not all packets were handled with NAPIs: lock_irq_save cpdma_ctlr_stop cpdma_chan_top __cpdma_chan_free cpsw_rx_handler netif_receive_skb So, split locking while ctrl stop thus interrupts are still enabled while skbs handling. It can cause WARN_ONCE in rare cases when ctrl is stopping while not all packets were handled with NAPIs. Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3802dce commit 080d5c5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/ti/davinci_cpdma.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,14 @@ int cpdma_ctlr_stop(struct cpdma_ctlr *ctlr)
334334
}
335335

336336
ctlr->state = CPDMA_STATE_TEARDOWN;
337+
spin_unlock_irqrestore(&ctlr->lock, flags);
337338

338339
for (i = 0; i < ARRAY_SIZE(ctlr->channels); i++) {
339340
if (ctlr->channels[i])
340341
cpdma_chan_stop(ctlr->channels[i]);
341342
}
342343

344+
spin_lock_irqsave(&ctlr->lock, flags);
343345
dma_reg_write(ctlr, CPDMA_RXINTMASKCLEAR, 0xffffffff);
344346
dma_reg_write(ctlr, CPDMA_TXINTMASKCLEAR, 0xffffffff);
345347

0 commit comments

Comments
 (0)