summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2020-11-11 14:47:24 +0100
committerFelix Fietkau <nbd@nbd.name>2020-12-04 14:31:14 +0100
commita2a93548db88b73f5781f4c3df3c757656d50c67 (patch)
tree84161d4bf4b1626582c4c04e5b37d4719d424731 /drivers
parentb671da33d1c5973f90f098ff66a91953691df582 (diff)
mt76: sdio: introduce mt76s_alloc_tx_queue
This is a preliminary patch to move hw data queues in mt76_phy for mt7915 dbdc support Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/mediatek/mt76/sdio.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c
index b4def262e1a0..4c6a65cec318 100644
--- a/drivers/net/wireless/mediatek/mt76/sdio.c
+++ b/drivers/net/wireless/mediatek/mt76/sdio.c
@@ -36,28 +36,46 @@ mt76s_alloc_rx_queue(struct mt76_dev *dev, enum mt76_rxq_id qid)
return 0;
}
+static struct mt76_queue *mt76s_alloc_tx_queue(struct mt76_dev *dev)
+{
+ struct mt76_queue *q;
+
+ q = devm_kzalloc(dev->dev, sizeof(*q), GFP_KERNEL);
+ if (!q)
+ return ERR_PTR(-ENOMEM);
+
+ spin_lock_init(&q->lock);
+ q->entry = devm_kcalloc(dev->dev,
+ MT_NUM_TX_ENTRIES, sizeof(*q->entry),
+ GFP_KERNEL);
+ if (!q->entry)
+ return ERR_PTR(-ENOMEM);
+
+ q->ndesc = MT_NUM_TX_ENTRIES;
+
+ return q;
+}
+
static int mt76s_alloc_tx(struct mt76_dev *dev)
{
struct mt76_queue *q;
int i;
- for (i = 0; i < MT_TXQ_MCU_WA; i++) {
- q = devm_kzalloc(dev->dev, sizeof(*q), GFP_KERNEL);
- if (!q)
- return -ENOMEM;
+ for (i = 0; i <= MT_TXQ_PSD; i++) {
+ q = mt76s_alloc_tx_queue(dev);
+ if (IS_ERR(q))
+ return PTR_ERR(q);
- spin_lock_init(&q->lock);
- q->hw_idx = i;
+ q->qid = i;
dev->q_tx[i] = q;
+ }
- q->entry = devm_kcalloc(dev->dev,
- MT_NUM_TX_ENTRIES, sizeof(*q->entry),
- GFP_KERNEL);
- if (!q->entry)
- return -ENOMEM;
+ q = mt76s_alloc_tx_queue(dev);
+ if (IS_ERR(q))
+ return PTR_ERR(q);
- q->ndesc = MT_NUM_TX_ENTRIES;
- }
+ q->qid = MT_TXQ_MCU;
+ dev->q_tx[MT_TXQ_MCU] = q;
return 0;
}