a88b24d4023c99e69a37c43fac0bbaf9c6f8744c
[openwrt/staging/ynezz.git] /
1 From ebbd7dc7ca856a182769c17c4c8a739cedc064c4 Mon Sep 17 00:00:00 2001
2 From: Johannes Berg <johannes.berg@intel.com>
3 Date: Sun, 6 Dec 2020 14:54:44 +0200
4 Subject: [PATCH] mac80211: don't set set TDLS STA bandwidth wider than
5 possible
6
7 [ Upstream commit f65607cdbc6b0da356ef5a22552ddd9313cf87a0 ]
8
9 When we set up a TDLS station, we set sta->sta.bandwidth solely based
10 on the capabilities, because the "what's the current bandwidth" check
11 is bypassed and only applied for other types of stations.
12
13 This leads to the unfortunate scenario that the sta->sta.bandwidth is
14 160 MHz if both stations support it, but we never actually configure
15 this bandwidth unless the AP is already using 160 MHz; even for wider
16 bandwidth support we only go up to 80 MHz (at least right now.)
17
18 For iwlwifi, this can also lead to firmware asserts, telling us that
19 we've configured the TX rates for a higher bandwidth than is actually
20 available due to the PHY configuration.
21
22 For non-TDLS, we check against the interface's requested bandwidth,
23 but we explicitly skip this check for TDLS to cope with the wider BW
24 case. Change this to
25 (a) still limit to the TDLS peer's own chandef, which gets factored
26 into the overall PHY configuration we request from the driver,
27 and
28 (b) limit it to when the TDLS peer is authorized, because it's only
29 factored into the channel context in this case.
30
31 Fixes: 504871e602d9 ("mac80211: fix bandwidth computation for TDLS peers")
32 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
33 Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
34 Link: https://lore.kernel.org/r/iwlwifi.20201206145305.fcc7d29c4590.I11f77e9e25ddf871a3c8d5604650c763e2c5887a@changeid
35 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
36 Signed-off-by: Sasha Levin <sashal@kernel.org>
37 ---
38 net/mac80211/vht.c | 14 ++++++++++----
39 1 file changed, 10 insertions(+), 4 deletions(-)
40
41 --- a/net/mac80211/vht.c
42 +++ b/net/mac80211/vht.c
43 @@ -421,12 +421,18 @@ enum ieee80211_sta_rx_bandwidth ieee8021
44 * IEEE80211-2016 specification makes higher bandwidth operation
45 * possible on the TDLS link if the peers have wider bandwidth
46 * capability.
47 + *
48 + * However, in this case, and only if the TDLS peer is authorized,
49 + * limit to the tdls_chandef so that the configuration here isn't
50 + * wider than what's actually requested on the channel context.
51 */
52 if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) &&
53 - test_sta_flag(sta, WLAN_STA_TDLS_WIDER_BW))
54 - return bw;
55 -
56 - bw = min(bw, ieee80211_chan_width_to_rx_bw(bss_width));
57 + test_sta_flag(sta, WLAN_STA_TDLS_WIDER_BW) &&
58 + test_sta_flag(sta, WLAN_STA_AUTHORIZED) &&
59 + sta->tdls_chandef.chan)
60 + bw = min(bw, ieee80211_chan_width_to_rx_bw(sta->tdls_chandef.width));
61 + else
62 + bw = min(bw, ieee80211_chan_width_to_rx_bw(bss_width));
63
64 return bw;
65 }