Skip to content

Commit 9912a46

Browse files
committed
mt76: reduce tx queue lock hold time
- call txq dequeue without holding txq lock (locking handled by mac80211) - disable bh around tx queue schedule Signed-off-by: Felix Fietkau <[email protected]>
1 parent 7b8e1ae commit 9912a46

File tree

1 file changed

+8
-6
lines changed
  • drivers/net/wireless/mediatek/mt76

1 file changed

+8
-6
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,9 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q,
463463
ieee80211_get_tx_rates(txq->vif, txq->sta, skb,
464464
info->control.rates, 1);
465465

466+
spin_lock(&q->lock);
466467
idx = __mt76_tx_queue_skb(phy, qid, skb, wcid, txq->sta, &stop);
468+
spin_unlock(&q->lock);
467469
if (idx < 0)
468470
return idx;
469471

@@ -483,14 +485,18 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q,
483485
ieee80211_get_tx_rates(txq->vif, txq->sta, skb,
484486
info->control.rates, 1);
485487

488+
spin_lock(&q->lock);
486489
idx = __mt76_tx_queue_skb(phy, qid, skb, wcid, txq->sta, &stop);
490+
spin_unlock(&q->lock);
487491
if (idx < 0)
488492
break;
489493

490494
n_frames++;
491495
} while (1);
492496

497+
spin_lock(&q->lock);
493498
dev->queue_ops->kick(dev, q);
499+
spin_unlock(&q->lock);
494500

495501
return n_frames;
496502
}
@@ -525,8 +531,6 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
525531
if (wcid && test_bit(MT_WCID_FLAG_PS, &wcid->flags))
526532
continue;
527533

528-
spin_lock_bh(&q->lock);
529-
530534
if (mtxq->send_bar && mtxq->aggr) {
531535
struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
532536
struct ieee80211_sta *sta = txq->sta;
@@ -535,16 +539,12 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
535539
u8 tid = txq->tid;
536540

537541
mtxq->send_bar = false;
538-
spin_unlock_bh(&q->lock);
539542
ieee80211_send_bar(vif, sta->addr, tid, agg_ssn);
540-
spin_lock_bh(&q->lock);
541543
}
542544

543545
if (!mt76_txq_stopped(q))
544546
n_frames = mt76_txq_send_burst(phy, q, mtxq);
545547

546-
spin_unlock_bh(&q->lock);
547-
548548
ieee80211_return_txq(phy->hw, txq, false);
549549

550550
if (unlikely(n_frames < 0))
@@ -563,6 +563,7 @@ void mt76_txq_schedule(struct mt76_phy *phy, enum mt76_txq_id qid)
563563
if (qid >= 4)
564564
return;
565565

566+
local_bh_disable();
566567
rcu_read_lock();
567568

568569
do {
@@ -572,6 +573,7 @@ void mt76_txq_schedule(struct mt76_phy *phy, enum mt76_txq_id qid)
572573
} while (len > 0);
573574

574575
rcu_read_unlock();
576+
local_bh_enable();
575577
}
576578
EXPORT_SYMBOL_GPL(mt76_txq_schedule);
577579

0 commit comments

Comments
 (0)