Commit a2a93548 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

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: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent b671da33
Loading
Loading
Loading
Loading
+31 −13
Original line number Diff line number Diff line
@@ -36,29 +36,47 @@ mt76s_alloc_rx_queue(struct mt76_dev *dev, enum mt76_rxq_id qid)
	return 0;
}

static int mt76s_alloc_tx(struct mt76_dev *dev)
static struct mt76_queue *mt76s_alloc_tx_queue(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;
		return ERR_PTR(-ENOMEM);

	spin_lock_init(&q->lock);
		q->hw_idx = 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;
		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_PSD; i++) {
		q = mt76s_alloc_tx_queue(dev);
		if (IS_ERR(q))
			return PTR_ERR(q);

		q->qid = i;
		dev->q_tx[i] = q;
	}

	q = mt76s_alloc_tx_queue(dev);
	if (IS_ERR(q))
		return PTR_ERR(q);

	q->qid = MT_TXQ_MCU;
	dev->q_tx[MT_TXQ_MCU] = q;

	return 0;
}