Commit 9e63f5e7 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mt7603: use napi polling for tx cleanup

This allows tx scheduling and tx cleanup to run concurrently
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 8402650a
...@@ -35,7 +35,7 @@ irqreturn_t mt7603_irq_handler(int irq, void *dev_instance) ...@@ -35,7 +35,7 @@ irqreturn_t mt7603_irq_handler(int irq, void *dev_instance)
if (intr & MT_INT_TX_DONE_ALL) { if (intr & MT_INT_TX_DONE_ALL) {
mt7603_irq_disable(dev, MT_INT_TX_DONE_ALL); mt7603_irq_disable(dev, MT_INT_TX_DONE_ALL);
tasklet_schedule(&dev->mt76.tx_tasklet); napi_schedule(&dev->mt76.tx_napi);
} }
if (intr & MT_INT_RX_DONE(0)) { if (intr & MT_INT_RX_DONE(0)) {
......
...@@ -139,15 +139,30 @@ static void ...@@ -139,15 +139,30 @@ static void
mt7603_tx_tasklet(unsigned long data) mt7603_tx_tasklet(unsigned long data)
{ {
struct mt7603_dev *dev = (struct mt7603_dev *)data; struct mt7603_dev *dev = (struct mt7603_dev *)data;
mt76_txq_schedule_all(&dev->mt76);
}
static int mt7603_poll_tx(struct napi_struct *napi, int budget)
{
struct mt7603_dev *dev;
int i; int i;
dev = container_of(napi, struct mt7603_dev, mt76.tx_napi);
dev->tx_dma_check = 0; dev->tx_dma_check = 0;
for (i = MT_TXQ_MCU; i >= 0; i--) for (i = MT_TXQ_MCU; i >= 0; i--)
mt76_queue_tx_cleanup(dev, i, false); mt76_queue_tx_cleanup(dev, i, false);
mt76_txq_schedule_all(&dev->mt76); if (napi_complete_done(napi, 0))
mt7603_irq_enable(dev, MT_INT_TX_DONE_ALL);
mt7603_irq_enable(dev, MT_INT_TX_DONE_ALL); for (i = MT_TXQ_MCU; i >= 0; i--)
mt76_queue_tx_cleanup(dev, i, false);
tasklet_schedule(&dev->mt76.tx_tasklet);
return 0;
} }
int mt7603_dma_init(struct mt7603_dev *dev) int mt7603_dma_init(struct mt7603_dev *dev)
...@@ -216,7 +231,15 @@ int mt7603_dma_init(struct mt7603_dev *dev) ...@@ -216,7 +231,15 @@ int mt7603_dma_init(struct mt7603_dev *dev)
return ret; return ret;
mt76_wr(dev, MT_DELAY_INT_CFG, 0); mt76_wr(dev, MT_DELAY_INT_CFG, 0);
return mt76_init_queues(dev); ret = mt76_init_queues(dev);
if (ret)
return ret;
netif_tx_napi_add(&dev->mt76.napi_dev, &dev->mt76.tx_napi,
mt7603_poll_tx, NAPI_POLL_WEIGHT);
napi_enable(&dev->mt76.tx_napi);
return 0;
} }
void mt7603_dma_cleanup(struct mt7603_dev *dev) void mt7603_dma_cleanup(struct mt7603_dev *dev)
...@@ -227,5 +250,6 @@ void mt7603_dma_cleanup(struct mt7603_dev *dev) ...@@ -227,5 +250,6 @@ void mt7603_dma_cleanup(struct mt7603_dev *dev)
MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE); MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE);
tasklet_kill(&dev->mt76.tx_tasklet); tasklet_kill(&dev->mt76.tx_tasklet);
netif_napi_del(&dev->mt76.tx_napi);
mt76_dma_cleanup(&dev->mt76); mt76_dma_cleanup(&dev->mt76);
} }
...@@ -1282,6 +1282,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev) ...@@ -1282,6 +1282,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev)
tasklet_disable(&dev->mt76.pre_tbtt_tasklet); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
napi_disable(&dev->mt76.napi[0]); napi_disable(&dev->mt76.napi[0]);
napi_disable(&dev->mt76.napi[1]); napi_disable(&dev->mt76.napi[1]);
napi_disable(&dev->mt76.tx_napi);
mutex_lock(&dev->mt76.mutex); mutex_lock(&dev->mt76.mutex);
...@@ -1326,7 +1327,8 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev) ...@@ -1326,7 +1327,8 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev)
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);
tasklet_enable(&dev->mt76.tx_tasklet); tasklet_enable(&dev->mt76.tx_tasklet);
tasklet_schedule(&dev->mt76.tx_tasklet); napi_enable(&dev->mt76.tx_napi);
napi_schedule(&dev->mt76.tx_napi);
tasklet_enable(&dev->mt76.pre_tbtt_tasklet); tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
mt7603_beacon_set_timer(dev, -1, beacon_int); mt7603_beacon_set_timer(dev, -1, beacon_int);
......
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