ath9k: fix transmitting to stations in dynamic SMPS mode
[openwrt/staging/rmilecki.git] / package / kernel / mac80211 / patches / ath / 560-ath9k-fix-transmitting-to-stations-in-dynamic-SMPS-m.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sun, 14 Feb 2021 19:45:50 +0100
3 Subject: [PATCH] ath9k: fix transmitting to stations in dynamic SMPS mode
4
5 When transmitting to a receiver in dynamic SMPS mode, all transmissions that
6 use multiple spatial streams need to be sent using CTS-to-self or RTS/CTS to
7 give the receiver's extra chains some time to wake up.
8 This fixes the tx rate getting stuck at <= MCS7 for some clients, especially
9 Intel ones, which make aggressive use of SMPS.
10
11 Cc: stable@vger.kernel.org
12 Reported-by: Martin Kennedy <hurricos@gmail.com>
13 Signed-off-by: Felix Fietkau <nbd@nbd.name>
14 ---
15
16 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
17 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
18 @@ -179,7 +179,8 @@ struct ath_frame_info {
19 s8 txq;
20 u8 keyix;
21 u8 rtscts_rate;
22 - u8 retries : 7;
23 + u8 retries : 6;
24 + u8 dyn_smps : 1;
25 u8 baw_tracked : 1;
26 u8 tx_power;
27 enum ath9k_key_type keytype:2;
28 --- a/drivers/net/wireless/ath/ath9k/xmit.c
29 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
30 @@ -1271,6 +1271,11 @@ static void ath_buf_set_rate(struct ath_
31 is_40, is_sgi, is_sp);
32 if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC))
33 info->rates[i].RateFlags |= ATH9K_RATESERIES_STBC;
34 + if (rix >= 8 && fi->dyn_smps) {
35 + info->rates[i].RateFlags |=
36 + ATH9K_RATESERIES_RTS_CTS;
37 + info->flags |= ATH9K_TXDESC_CTSENA;
38 + }
39
40 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix,
41 is_40, false);
42 @@ -2114,6 +2119,7 @@ static void setup_frame_info(struct ieee
43 fi->keyix = an->ps_key;
44 else
45 fi->keyix = ATH9K_TXKEYIX_INVALID;
46 + fi->dyn_smps = sta && sta->smps_mode == IEEE80211_SMPS_DYNAMIC;
47 fi->keytype = keytype;
48 fi->framelen = framelen;
49 fi->tx_power = txpower;