Some drivers know how many frames a station has inside the hardware better than AQL does. mt7603 completes a frame to mac80211 as soon as DMA has copied it, so AQL releases its airtime right away while the hardware may keep hundreds of frames for the station. Add MT_WCID_FLAG_TX_HOLD. While it is set, the tx scheduler leaves the station's queues alone, like it does for a station at the non-AQL limit, and stops a burst that filled the hardware. The driver clears the flag and schedules the queues again when the hardware has drained. No functional change for drivers that do not set the flag. Assisted-by: LLM Signed-off-by: Cristian Papa --- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + drivers/net/wireless/mediatek/mt76/tx.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 62b41c8bb..d03e66c2a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -362,6 +362,7 @@ enum mt76_wcid_flags { MT_WCID_FLAG_4ADDR, MT_WCID_FLAG_HDR_TRANS, MT_WCID_FLAG_TDLS_PEER, + MT_WCID_FLAG_TX_HOLD, }; #define MT76_N_WCIDS 1088 diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c index 3707ee19e..e16a380c6 100644 --- a/drivers/net/wireless/mediatek/mt76/tx.c +++ b/drivers/net/wireless/mediatek/mt76/tx.c @@ -534,6 +534,10 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q, if (stop || mt76_txq_stopped(q)) break; + /* The previous frame may have filled the hardware. */ + if (test_bit(MT_WCID_FLAG_TX_HOLD, &wcid->flags)) + break; + skb = mt76_txq_dequeue(phy, mtxq); if (!skb) break; @@ -605,6 +609,9 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid) if (atomic_read(&wcid->non_aql_packets) >= MT_MAX_NON_AQL_PKT) continue; + /* The driver schedules the queues again when it lifts the hold. */ + if (test_bit(MT_WCID_FLAG_TX_HOLD, &wcid->flags)) + continue; if (dev->queue_ops->tx_cleanup && q->queued + 2 * MT_TXQ_FREE_THR >= q->ndesc) { dev->queue_ops->tx_cleanup(dev, q, false); -- 2.47.3