]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
amd-xgbe: Check per channel DMA interrupt use in main ISR
authorLendacky, Thomas <Thomas.Lendacky@amd.com>
Fri, 6 Feb 2015 01:17:14 +0000 (19:17 -0600)
committerDavid S. Miller <davem@davemloft.net>
Sun, 8 Feb 2015 06:44:42 +0000 (22:44 -0800)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amd/xgbe/xgbe-drv.c

index e5ffb2ccb67d1d053d47f0f6cc219e86fb6b086b..477a7e35d21aecb368edf8f5c849261bc07c9a05 100644 (file)
@@ -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);