wifi: mt76: add multi-radio support to tx scheduling

Look up the phy for each scheduled txq. Only run one scheduling loop per hw.

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2024-10-22 10:18:59 +02:00
parent 0b526090de
commit aeedee5c0a
+19 -14
View File
@@ -489,7 +489,7 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q,
do { do {
if (test_bit(MT76_RESET, &phy->state) || phy->offchannel) if (test_bit(MT76_RESET, &phy->state) || phy->offchannel)
return -EBUSY; break;
if (stop || mt76_txq_stopped(q)) if (stop || mt76_txq_stopped(q))
break; break;
@@ -522,24 +522,16 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q,
static int static int
mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid) mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
{ {
struct mt76_queue *q = phy->q_tx[qid];
struct mt76_dev *dev = phy->dev; struct mt76_dev *dev = phy->dev;
struct ieee80211_txq *txq; struct ieee80211_txq *txq;
struct mt76_txq *mtxq; struct mt76_txq *mtxq;
struct mt76_wcid *wcid; struct mt76_wcid *wcid;
struct mt76_queue *q;
int ret = 0; int ret = 0;
while (1) { while (1) {
int n_frames = 0; int n_frames = 0;
if (test_bit(MT76_RESET, &phy->state) || phy->offchannel)
return -EBUSY;
if (dev->queue_ops->tx_cleanup &&
q->queued + 2 * MT_TXQ_FREE_THR >= q->ndesc) {
dev->queue_ops->tx_cleanup(dev, q, false);
}
txq = ieee80211_next_txq(phy->hw, qid); txq = ieee80211_next_txq(phy->hw, qid);
if (!txq) if (!txq)
break; break;
@@ -549,6 +541,16 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
if (!wcid || test_bit(MT_WCID_FLAG_PS, &wcid->flags)) if (!wcid || test_bit(MT_WCID_FLAG_PS, &wcid->flags))
continue; continue;
phy = mt76_dev_phy(dev, wcid->phy_idx);
if (test_bit(MT76_RESET, &phy->state) || phy->offchannel)
continue;
q = phy->q_tx[qid];
if (dev->queue_ops->tx_cleanup &&
q->queued + 2 * MT_TXQ_FREE_THR >= q->ndesc) {
dev->queue_ops->tx_cleanup(dev, q, false);
}
if (mtxq->send_bar && mtxq->aggr) { if (mtxq->send_bar && mtxq->aggr) {
struct ieee80211_txq *txq = mtxq_to_txq(mtxq); struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
struct ieee80211_sta *sta = txq->sta; struct ieee80211_sta *sta = txq->sta;
@@ -578,7 +580,7 @@ void mt76_txq_schedule(struct mt76_phy *phy, enum mt76_txq_id qid)
{ {
int len; int len;
if (qid >= 4 || phy->offchannel) if (qid >= 4)
return; return;
local_bh_disable(); local_bh_disable();
@@ -680,9 +682,14 @@ static void mt76_txq_schedule_pending(struct mt76_phy *phy)
void mt76_txq_schedule_all(struct mt76_phy *phy) void mt76_txq_schedule_all(struct mt76_phy *phy)
{ {
struct mt76_phy *main_phy = &phy->dev->phy;
int i; int i;
mt76_txq_schedule_pending(phy); mt76_txq_schedule_pending(phy);
if (phy != main_phy && phy->hw == main_phy->hw)
return;
for (i = 0; i <= MT_TXQ_BK; i++) for (i = 0; i <= MT_TXQ_BK; i++)
mt76_txq_schedule(phy, i); mt76_txq_schedule(phy, i);
} }
@@ -693,6 +700,7 @@ void mt76_tx_worker_run(struct mt76_dev *dev)
struct mt76_phy *phy; struct mt76_phy *phy;
int i; int i;
mt76_txq_schedule_all(&dev->phy);
for (i = 0; i < ARRAY_SIZE(dev->phys); i++) { for (i = 0; i < ARRAY_SIZE(dev->phys); i++) {
phy = dev->phys[i]; phy = dev->phys[i];
if (!phy) if (!phy)
@@ -748,9 +756,6 @@ void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
struct mt76_phy *phy = hw->priv; struct mt76_phy *phy = hw->priv;
struct mt76_dev *dev = phy->dev; struct mt76_dev *dev = phy->dev;
if (!test_bit(MT76_STATE_RUNNING, &phy->state))
return;
mt76_worker_schedule(&dev->tx_worker); mt76_worker_schedule(&dev->tx_worker);
} }
EXPORT_SYMBOL_GPL(mt76_wake_tx_queue); EXPORT_SYMBOL_GPL(mt76_wake_tx_queue);