Commit 2c270b0e authored by Felix Fietkau's avatar Felix Fietkau

mt76: mt76x02: clean up and fix interrupt masking in the irq handler

Only clear unmasked interrupts. If an interrupt is temporarily masked,
its pending events need to be processed later, even if another interrupt
happened in the mean time.
Disable interrupts in one call before scheduling
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 40fde8c4
...@@ -263,9 +263,10 @@ EXPORT_SYMBOL_GPL(mt76x02_rx_poll_complete); ...@@ -263,9 +263,10 @@ EXPORT_SYMBOL_GPL(mt76x02_rx_poll_complete);
irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance) irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance)
{ {
struct mt76x02_dev *dev = dev_instance; struct mt76x02_dev *dev = dev_instance;
u32 intr; u32 intr, mask;
intr = mt76_rr(dev, MT_INT_SOURCE_CSR); intr = mt76_rr(dev, MT_INT_SOURCE_CSR);
intr &= dev->mt76.mmio.irqmask;
mt76_wr(dev, MT_INT_SOURCE_CSR, intr); mt76_wr(dev, MT_INT_SOURCE_CSR, intr);
if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state)) if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
...@@ -273,17 +274,17 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance) ...@@ -273,17 +274,17 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance)
trace_dev_irq(&dev->mt76, intr, dev->mt76.mmio.irqmask); trace_dev_irq(&dev->mt76, intr, dev->mt76.mmio.irqmask);
intr &= dev->mt76.mmio.irqmask; mask = intr & (MT_INT_RX_DONE_ALL | MT_INT_GPTIMER);
if (intr & (MT_INT_TX_DONE_ALL | MT_INT_TX_STAT))
mask |= MT_INT_TX_DONE_ALL;
mt76x02_irq_disable(dev, mask);
if (intr & MT_INT_RX_DONE(0)) { if (intr & MT_INT_RX_DONE(0))
mt76x02_irq_disable(dev, MT_INT_RX_DONE(0));
napi_schedule(&dev->mt76.napi[0]); napi_schedule(&dev->mt76.napi[0]);
}
if (intr & MT_INT_RX_DONE(1)) { if (intr & MT_INT_RX_DONE(1))
mt76x02_irq_disable(dev, MT_INT_RX_DONE(1));
napi_schedule(&dev->mt76.napi[1]); napi_schedule(&dev->mt76.napi[1]);
}
if (intr & MT_INT_PRE_TBTT) if (intr & MT_INT_PRE_TBTT)
tasklet_schedule(&dev->mt76.pre_tbtt_tasklet); tasklet_schedule(&dev->mt76.pre_tbtt_tasklet);
...@@ -299,15 +300,11 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance) ...@@ -299,15 +300,11 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance)
if (intr & MT_INT_TX_STAT) if (intr & MT_INT_TX_STAT)
mt76x02_mac_poll_tx_status(dev, true); mt76x02_mac_poll_tx_status(dev, true);
if (intr & (MT_INT_TX_STAT | MT_INT_TX_DONE_ALL)) { if (intr & (MT_INT_TX_STAT | MT_INT_TX_DONE_ALL))
mt76x02_irq_disable(dev, MT_INT_TX_DONE_ALL);
napi_schedule(&dev->mt76.tx_napi); napi_schedule(&dev->mt76.tx_napi);
}
if (intr & MT_INT_GPTIMER) { if (intr & MT_INT_GPTIMER)
mt76x02_irq_disable(dev, MT_INT_GPTIMER);
tasklet_schedule(&dev->dfs_pd.dfs_tasklet); tasklet_schedule(&dev->dfs_pd.dfs_tasklet);
}
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment