]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: add multi-radio support to tx scheduling
authorFelix Fietkau <nbd@nbd.name>
Thu, 2 Jan 2025 16:34:54 +0000 (17:34 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 14 Jan 2025 12:42:29 +0000 (13:42 +0100)
Look up the phy for each scheduled txq. Only run one scheduling loop per hw.

Link: https://patch.msgid.link/20250102163508.52945-10-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/tx.c

index ce193e625666bec7e9d4ec86df25c09d8210760a..af0c50c983ec11d7cbf9836a8cf006daf2d9e7d8 100644 (file)
@@ -489,7 +489,7 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q,
 
        do {
                if (test_bit(MT76_RESET, &phy->state) || phy->offchannel)
-                       return -EBUSY;
+                       break;
 
                if (stop || mt76_txq_stopped(q))
                        break;
@@ -522,24 +522,16 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q,
 static int
 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 ieee80211_txq *txq;
        struct mt76_txq *mtxq;
        struct mt76_wcid *wcid;
+       struct mt76_queue *q;
        int ret = 0;
 
        while (1) {
                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);
                if (!txq)
                        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))
                        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) {
                        struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
                        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;
 
-       if (qid >= 4 || phy->offchannel)
+       if (qid >= 4)
                return;
 
        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)
 {
+       struct mt76_phy *main_phy = &phy->dev->phy;
        int i;
 
        mt76_txq_schedule_pending(phy);
+
+       if (phy != main_phy && phy->hw == main_phy->hw)
+               return;
+
        for (i = 0; i <= MT_TXQ_BK; i++)
                mt76_txq_schedule(phy, i);
 }
@@ -693,6 +700,7 @@ void mt76_tx_worker_run(struct mt76_dev *dev)
        struct mt76_phy *phy;
        int i;
 
+       mt76_txq_schedule_all(&dev->phy);
        for (i = 0; i < ARRAY_SIZE(dev->phys); i++) {
                phy = dev->phys[i];
                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_dev *dev = phy->dev;
 
-       if (!test_bit(MT76_STATE_RUNNING, &phy->state))
-               return;
-
        mt76_worker_schedule(&dev->tx_worker);
 }
 EXPORT_SYMBOL_GPL(mt76_wake_tx_queue);