summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt7615
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2020-11-11 14:47:23 +0100
committerFelix Fietkau <nbd@nbd.name>2020-12-04 14:31:14 +0100
commitb671da33d1c5973f90f098ff66a91953691df582 (patch)
treea7fdfec1ca73586d5c1ab8f423cfe2b04633e435 /drivers/net/wireless/mediatek/mt76/mt7615
parent3d51a3e993803f1180f1a31ff763b040667ba7c5 (diff)
mt76: move mt76_init_tx_queue in common code
Move mt76_init_tx_queue in mac80211.c since it is shared by all drivers. 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')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/dma.c50
1 files changed, 17 insertions, 33 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/dma.c b/drivers/net/wireless/mediatek/mt76/mt7615/dma.c
index bf8ae14121db..333254734ac5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/dma.c
@@ -12,25 +12,6 @@
#include "mac.h"
static int
-mt7615_init_tx_queue(struct mt7615_dev *dev, int qid, int idx, int n_desc)
-{
- struct mt76_queue *hwq;
- int err;
-
- hwq = devm_kzalloc(dev->mt76.dev, sizeof(*hwq), GFP_KERNEL);
- if (!hwq)
- return -ENOMEM;
-
- err = mt76_queue_alloc(dev, hwq, idx, n_desc, 0, MT_TX_RING_BASE);
- if (err < 0)
- return err;
-
- dev->mt76.q_tx[qid] = hwq;
-
- return 0;
-}
-
-static int
mt7622_init_tx_queues_multi(struct mt7615_dev *dev)
{
static const u8 wmm_queue_map[] = {
@@ -43,20 +24,22 @@ mt7622_init_tx_queues_multi(struct mt7615_dev *dev)
int i;
for (i = 0; i < ARRAY_SIZE(wmm_queue_map); i++) {
- ret = mt7615_init_tx_queue(dev, i, wmm_queue_map[i],
- MT7615_TX_RING_SIZE / 2);
+ ret = mt76_init_tx_queue(&dev->mt76, i, wmm_queue_map[i],
+ MT7615_TX_RING_SIZE / 2,
+ MT_TX_RING_BASE);
if (ret)
return ret;
}
- ret = mt7615_init_tx_queue(dev, MT_TXQ_PSD,
- MT7622_TXQ_MGMT, MT7615_TX_MGMT_RING_SIZE);
+ ret = mt76_init_tx_queue(&dev->mt76, MT_TXQ_PSD, MT7622_TXQ_MGMT,
+ MT7615_TX_MGMT_RING_SIZE,
+ MT_TX_RING_BASE);
if (ret)
return ret;
- ret = mt7615_init_tx_queue(dev, MT_TXQ_MCU,
- MT7622_TXQ_MCU, MT7615_TX_MCU_RING_SIZE);
- return ret;
+ return mt76_init_tx_queue(&dev->mt76, MT_TXQ_MCU, MT7622_TXQ_MCU,
+ MT7615_TX_MCU_RING_SIZE,
+ MT_TX_RING_BASE);
}
static int
@@ -64,25 +47,26 @@ mt7615_init_tx_queues(struct mt7615_dev *dev)
{
int ret, i;
- ret = mt7615_init_tx_queue(dev, MT_TXQ_FWDL,
- MT7615_TXQ_FWDL,
- MT7615_TX_FWDL_RING_SIZE);
+ ret = mt76_init_tx_queue(&dev->mt76, MT_TXQ_FWDL, MT7615_TXQ_FWDL,
+ MT7615_TX_FWDL_RING_SIZE,
+ MT_TX_RING_BASE);
if (ret)
return ret;
if (!is_mt7615(&dev->mt76))
return mt7622_init_tx_queues_multi(dev);
- ret = mt7615_init_tx_queue(dev, 0, 0, MT7615_TX_RING_SIZE);
+ ret = mt76_init_tx_queue(&dev->mt76, 0, 0, MT7615_TX_RING_SIZE,
+ MT_TX_RING_BASE);
if (ret)
return ret;
for (i = 1; i < MT_TXQ_MCU; i++)
dev->mt76.q_tx[i] = dev->mt76.q_tx[0];
- ret = mt7615_init_tx_queue(dev, MT_TXQ_MCU, MT7615_TXQ_MCU,
- MT7615_TX_MCU_RING_SIZE);
- return 0;
+ return mt76_init_tx_queue(&dev->mt76, MT_TXQ_MCU, MT7615_TXQ_MCU,
+ MT7615_TX_MCU_RING_SIZE,
+ MT_TX_RING_BASE);
}
static int mt7615_poll_tx(struct napi_struct *napi, int budget)