diff options
author | Lorenzo Bianconi <lorenzo@kernel.org> | 2019-05-01 16:06:22 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2019-06-25 12:55:25 +0200 |
commit | 8357f0dcd895231ca1444df60e57a1a33605e282 (patch) | |
tree | 0a395bdd389319b85e52d354caf69b7434baef5c /drivers/net/wireless/mediatek/mt76/mt7615/dma.c | |
parent | 9e63f5e76b5638f51f50e7815914daf879af5b30 (diff) |
mt76: mt7615: use napi polling for tx cleanup
This allows tx scheduling and tx cleanup to run concurrently
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7615/dma.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7615/dma.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/dma.c b/drivers/net/wireless/mediatek/mt76/mt7615/dma.c index 3ec6582afd8f..9c565c93988a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/dma.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/dma.c @@ -93,18 +93,33 @@ void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, static void mt7615_tx_tasklet(unsigned long data) { struct mt7615_dev *dev = (struct mt7615_dev *)data; + + mt76_txq_schedule_all(&dev->mt76); +} + +static int mt7615_poll_tx(struct napi_struct *napi, int budget) +{ static const u8 queue_map[] = { MT_TXQ_MCU, MT_TXQ_BE }; + struct mt7615_dev *dev; int i; + dev = container_of(napi, struct mt7615_dev, mt76.tx_napi); + for (i = 0; i < ARRAY_SIZE(queue_map); i++) mt76_queue_tx_cleanup(dev, queue_map[i], false); - mt76_txq_schedule_all(&dev->mt76); + if (napi_complete_done(napi, 0)) + mt7615_irq_enable(dev, MT_INT_TX_DONE_ALL); - mt7615_irq_enable(dev, MT_INT_TX_DONE_ALL); + for (i = 0; i < ARRAY_SIZE(queue_map); i++) + mt76_queue_tx_cleanup(dev, queue_map[i], false); + + tasklet_schedule(&dev->mt76.tx_tasklet); + + return 0; } int mt7615_dma_init(struct mt7615_dev *dev) @@ -178,6 +193,10 @@ int mt7615_dma_init(struct mt7615_dev *dev) if (ret < 0) return ret; + netif_tx_napi_add(&dev->mt76.napi_dev, &dev->mt76.tx_napi, + mt7615_poll_tx, NAPI_POLL_WEIGHT); + napi_enable(&dev->mt76.tx_napi); + mt76_poll(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_TX_DMA_BUSY | MT_WPDMA_GLO_CFG_RX_DMA_BUSY, 0, 1000); @@ -201,5 +220,6 @@ void mt7615_dma_cleanup(struct mt7615_dev *dev) mt76_set(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_SW_RESET); tasklet_kill(&dev->mt76.tx_tasklet); + netif_napi_del(&dev->mt76.tx_napi); mt76_dma_cleanup(&dev->mt76); } |