* [PATCH net] amd-xgbe: Check per channel DMA interrupt use in main ISR
@ 2015-02-06 1:17 Tom Lendacky
2015-02-08 6:45 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Tom Lendacky @ 2015-02-06 1:17 UTC (permalink / raw)
To: netdev; +Cc: David Miller
When using per channel DMA interrupts the transmit interrupt (TI) and the
receive interrupt (RI) are masked off so as to not generate an interrupt
to the main ISR. However, should another interrupt fire for the DMA channel
that is handled by the main ISR the TI/RI bits can still be set. This
will cause the wrong and uninitialized napi structure to be used causing a
panic. Add a check to be sure per channel DMA interrupts are not enabled
before acting on those bit flags.
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index e5ffb2c..477a7e3 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -337,12 +337,13 @@ static irqreturn_t xgbe_isr(int irq, void *data)
dma_ch_isr = XGMAC_DMA_IOREAD(channel, DMA_CH_SR);
DBGPR(" DMA_CH%u_ISR = %08x\n", i, dma_ch_isr);
- /* If we get a TI or RI interrupt that means per channel DMA
- * interrupts are not enabled, so we use the private data napi
- * structure, not the per channel napi structure
+ /* The TI or RI interrupt bits may still be set even if using
+ * per channel DMA interrupts. Check to be sure those are not
+ * enabled before using the private data napi structure.
*/
- if (XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, TI) ||
- XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, RI)) {
+ if (!pdata->per_channel_irq &&
+ (XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, TI) ||
+ XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, RI))) {
if (napi_schedule_prep(&pdata->napi)) {
/* Disable Tx and Rx interrupts */
xgbe_disable_rx_tx_ints(pdata);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] amd-xgbe: Check per channel DMA interrupt use in main ISR
2015-02-06 1:17 [PATCH net] amd-xgbe: Check per channel DMA interrupt use in main ISR Tom Lendacky
@ 2015-02-08 6:45 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-02-08 6:45 UTC (permalink / raw)
To: thomas.lendacky; +Cc: netdev
From: Tom Lendacky <thomas.lendacky@amd.com>
Date: Thu, 5 Feb 2015 19:17:14 -0600
> When using per channel DMA interrupts the transmit interrupt (TI) and the
> receive interrupt (RI) are masked off so as to not generate an interrupt
> to the main ISR. However, should another interrupt fire for the DMA channel
> that is handled by the main ISR the TI/RI bits can still be set. This
> will cause the wrong and uninitialized napi structure to be used causing a
> panic. Add a check to be sure per channel DMA interrupts are not enabled
> before acting on those bit flags.
>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-08 6:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-06 1:17 [PATCH net] amd-xgbe: Check per channel DMA interrupt use in main ISR Tom Lendacky
2015-02-08 6:45 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).