Skip to content

Commit 716cc14

Browse files
committed
wifi: mt76: add multi-radio support to tx scheduling
Look up the phy for each scheduled txq. Only run one scheduling loop per hw. Link: https://patch.msgid.link/[email protected] Signed-off-by: Felix Fietkau <[email protected]>
1 parent 955e823 commit 716cc14

File tree

1 file changed

+19
-14
lines changed
  • drivers/net/wireless/mediatek/mt76

1 file changed

+19
-14
lines changed

drivers/net/wireless/mediatek/mt76/tx.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q,
489489

490490
do {
491491
if (test_bit(MT76_RESET, &phy->state) || phy->offchannel)
492-
return -EBUSY;
492+
break;
493493

494494
if (stop || mt76_txq_stopped(q))
495495
break;
@@ -522,24 +522,16 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q,
522522
static int
523523
mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
524524
{
525-
struct mt76_queue *q = phy->q_tx[qid];
526525
struct mt76_dev *dev = phy->dev;
527526
struct ieee80211_txq *txq;
528527
struct mt76_txq *mtxq;
529528
struct mt76_wcid *wcid;
529+
struct mt76_queue *q;
530530
int ret = 0;
531531

532532
while (1) {
533533
int n_frames = 0;
534534

535-
if (test_bit(MT76_RESET, &phy->state) || phy->offchannel)
536-
return -EBUSY;
537-
538-
if (dev->queue_ops->tx_cleanup &&
539-
q->queued + 2 * MT_TXQ_FREE_THR >= q->ndesc) {
540-
dev->queue_ops->tx_cleanup(dev, q, false);
541-
}
542-
543535
txq = ieee80211_next_txq(phy->hw, qid);
544536
if (!txq)
545537
break;
@@ -549,6 +541,16 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
549541
if (!wcid || test_bit(MT_WCID_FLAG_PS, &wcid->flags))
550542
continue;
551543

544+
phy = mt76_dev_phy(dev, wcid->phy_idx);
545+
if (test_bit(MT76_RESET, &phy->state) || phy->offchannel)
546+
continue;
547+
548+
q = phy->q_tx[qid];
549+
if (dev->queue_ops->tx_cleanup &&
550+
q->queued + 2 * MT_TXQ_FREE_THR >= q->ndesc) {
551+
dev->queue_ops->tx_cleanup(dev, q, false);
552+
}
553+
552554
if (mtxq->send_bar && mtxq->aggr) {
553555
struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
554556
struct ieee80211_sta *sta = txq->sta;
@@ -578,7 +580,7 @@ void mt76_txq_schedule(struct mt76_phy *phy, enum mt76_txq_id qid)
578580
{
579581
int len;
580582

581-
if (qid >= 4 || phy->offchannel)
583+
if (qid >= 4)
582584
return;
583585

584586
local_bh_disable();
@@ -680,9 +682,14 @@ static void mt76_txq_schedule_pending(struct mt76_phy *phy)
680682

681683
void mt76_txq_schedule_all(struct mt76_phy *phy)
682684
{
685+
struct mt76_phy *main_phy = &phy->dev->phy;
683686
int i;
684687

685688
mt76_txq_schedule_pending(phy);
689+
690+
if (phy != main_phy && phy->hw == main_phy->hw)
691+
return;
692+
686693
for (i = 0; i <= MT_TXQ_BK; i++)
687694
mt76_txq_schedule(phy, i);
688695
}
@@ -693,6 +700,7 @@ void mt76_tx_worker_run(struct mt76_dev *dev)
693700
struct mt76_phy *phy;
694701
int i;
695702

703+
mt76_txq_schedule_all(&dev->phy);
696704
for (i = 0; i < ARRAY_SIZE(dev->phys); i++) {
697705
phy = dev->phys[i];
698706
if (!phy)
@@ -748,9 +756,6 @@ void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
748756
struct mt76_phy *phy = hw->priv;
749757
struct mt76_dev *dev = phy->dev;
750758

751-
if (!test_bit(MT76_STATE_RUNNING, &phy->state))
752-
return;
753-
754759
mt76_worker_schedule(&dev->tx_worker);
755760
}
756761
EXPORT_SYMBOL_GPL(mt76_wake_tx_queue);

0 commit comments

Comments
 (0)