mac80211: fix an issue with the TXQ scheduling API and powersave clients
[openwrt/.git] / package / kernel / mac80211 / patches / subsys / 359-mac80211-un-schedule-TXQs-on-powersave-start.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Tue, 19 Mar 2019 11:36:12 +0100
3 Subject: [PATCH] mac80211: un-schedule TXQs on powersave start
4
5 Once a station enters powersave, its queues should not be returned by
6 ieee80211_next_txq() anymore. They will be re-scheduled again after the
7 station has woken up again
8
9 Fixes: 1866760096bf4 ("mac80211: Add TXQ scheduling API")
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 ---
12
13 --- a/net/mac80211/rx.c
14 +++ b/net/mac80211/rx.c
15 @@ -1508,7 +1508,15 @@ static void sta_ps_start(struct sta_info
16                 return;
17  
18         for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
19 -               if (txq_has_queue(sta->sta.txq[tid]))
20 +               struct ieee80211_txq *txq = sta->sta.txq[tid];
21 +               struct txq_info *txqi = to_txq_info(txq);
22 +
23 +               spin_lock(&local->active_txq_lock[txq->ac]);
24 +               if (!list_empty(&txqi->schedule_order))
25 +                       list_del_init(&txqi->schedule_order);
26 +               spin_unlock(&local->active_txq_lock[txq->ac]);
27 +
28 +               if (txq_has_queue(txq))
29                         set_bit(tid, &sta->txq_buffered_tids);
30                 else
31                         clear_bit(tid, &sta->txq_buffered_tids);