ce39fe0d8b16d03c835c1ff5052edea28e62ae5e
[openwrt/staging/ynezz.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 17 Sep 2020 12:07:19 +0200
3 Subject: [PATCH] mac80211: do not allow bigger VHT MPDUs than the hardware
4 supports
5
6 Limit maximum VHT MPDU size by local capability
7
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 ---
10
11 --- a/net/mac80211/vht.c
12 +++ b/net/mac80211/vht.c
13 @@ -170,10 +170,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(stru
14 /* take some capabilities as-is */
15 cap_info = le32_to_cpu(vht_cap_ie->vht_cap_info);
16 vht_cap->cap = cap_info;
17 - vht_cap->cap &= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 |
18 - IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
19 - IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
20 - IEEE80211_VHT_CAP_RXLDPC |
21 + vht_cap->cap &= IEEE80211_VHT_CAP_RXLDPC |
22 IEEE80211_VHT_CAP_VHT_TXOP_PS |
23 IEEE80211_VHT_CAP_HTC_VHT |
24 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
25 @@ -182,6 +179,9 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(stru
26 IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |
27 IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN;
28
29 + vht_cap->cap |= min_t(u32, cap_info & IEEE80211_VHT_CAP_MAX_MPDU_MASK,
30 + own_cap.cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK);
31 +
32 /* and some based on our own capabilities */
33 switch (own_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) {
34 case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ: