mt76: use AC specific reorder timeout
authorMarkus Theil <markus.theil@tu-ilmenau.de>
Sat, 14 Dec 2019 09:58:59 +0000 (10:58 +0100)
committerFelix Fietkau <nbd@nbd.name>
Fri, 14 Feb 2020 09:06:01 +0000 (10:06 +0100)
Before this patch, mt76 handled rx traffic for all TIDs equally,
when released from reorder buffer early. This patch uses an AC specific
reorder timeout, in order to release partial aggregated frames for video
ACs earlier. Voice ACs are currently not aggregated (thanks to Felix for
this hint). For example, ath10k also uses AC specific reorder timeouts
(reported by firmware in that case).

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/agg-rx.c
drivers/net/wireless/mediatek/mt76/mt76.h

index 59c1878..a4c64ae 100644 (file)
@@ -4,7 +4,13 @@
  */
 #include "mt76.h"
 
-#define REORDER_TIMEOUT (HZ / 10)
+static unsigned long mt76_aggr_tid_to_timeo(u8 tidno)
+{
+       /* Currently voice traffic (AC_VO) always runs without aggregation,
+        * no special handling is needed. AC_BE/AC_BK use tids 0-3. Just check
+        * for non AC_BK/AC_BE and set smaller timeout for it. */
+       return HZ / (tidno >= 4 ? 25 : 10);
+}
 
 static void
 mt76_aggr_release(struct mt76_rx_tid *tid, struct sk_buff_head *frames, int idx)
@@ -71,7 +77,8 @@ mt76_rx_aggr_check_release(struct mt76_rx_tid *tid, struct sk_buff_head *frames)
                nframes--;
                status = (struct mt76_rx_status *)skb->cb;
                if (!time_after(jiffies,
-                               status->reorder_time + REORDER_TIMEOUT))
+                               status->reorder_time +
+                               mt76_aggr_tid_to_timeo(tid->num)))
                        continue;
 
                mt76_rx_aggr_release_frames(tid, frames, status->seqno);
@@ -101,7 +108,7 @@ mt76_rx_aggr_reorder_work(struct work_struct *work)
 
        if (nframes)
                ieee80211_queue_delayed_work(tid->dev->hw, &tid->reorder_work,
-                                            REORDER_TIMEOUT);
+                                            mt76_aggr_tid_to_timeo(tid->num));
        mt76_rx_complete(dev, &frames, NULL);
 
        rcu_read_unlock();
@@ -225,7 +232,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
        mt76_rx_aggr_release_head(tid, frames);
 
        ieee80211_queue_delayed_work(tid->dev->hw, &tid->reorder_work,
-                                    REORDER_TIMEOUT);
+                                    mt76_aggr_tid_to_timeo(tid->num));
 
 out:
        spin_unlock_bh(&tid->lock);
@@ -245,6 +252,7 @@ int mt76_rx_aggr_start(struct mt76_dev *dev, struct mt76_wcid *wcid, u8 tidno,
        tid->dev = dev;
        tid->head = ssn;
        tid->size = size;
+       tid->num = tidno;
        INIT_DELAYED_WORK(&tid->reorder_work, mt76_rx_aggr_reorder_work);
        spin_lock_init(&tid->lock);
 
index 5b648ef..846c9e1 100644 (file)
@@ -242,6 +242,8 @@ struct mt76_rx_tid {
        u8 size;
        u8 nframes;
 
+       u8 num;
+
        u8 started:1, stopped:1, timer_pending:1;
 
        struct sk_buff *reorder_buf[];