fuse: move package to packages feed
[openwrt/staging/luka.git] / package / network / services / hostapd / patches / 071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 23 Jan 2020 14:10:20 +0100
3 Subject: [PATCH] driver_nl80211: fix regulatory limits for wmm cwmin/cwmax
4 values
5
6 The internal WMM AC parameters use just the exponent of the CW value, while
7 nl80211 reports the full CW value.
8 This led to completely bogus CWmin/CWmax values in the WMM IE when a regulatory
9 limit was present. Fix this by converting the value to the exponent before
10 passing it on
11
12 Signed-off-by: Felix Fietkau <nbd@nbd.name>
13 ---
14
15 --- a/src/drivers/driver_nl80211_capa.c
16 +++ b/src/drivers/driver_nl80211_capa.c
17 @@ -1336,6 +1336,18 @@ static void phy_info_vht_capa(struct hos
18 }
19 }
20
21 +static inline int cw2ecw(unsigned int cw)
22 +{
23 + int bit;
24 +
25 + if (cw == 0)
26 + return 0;
27 +
28 + for (bit = 1; cw != 1; bit++)
29 + cw >>= 1;
30 +
31 + return bit;
32 +}
33
34 static void phy_info_freq(struct hostapd_hw_modes *mode,
35 struct hostapd_channel_data *chan,
36 @@ -1438,9 +1450,9 @@ static void phy_info_freq(struct hostapd
37
38 ac = wmm_map[ac];
39 chan->wmm_rules[ac].min_cwmin =
40 - nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN]);
41 + cw2ecw(nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN]));
42 chan->wmm_rules[ac].min_cwmax =
43 - nla_get_u16(tb_wmm[NL80211_WMMR_CW_MAX]);
44 + cw2ecw(nla_get_u16(tb_wmm[NL80211_WMMR_CW_MAX]));
45 chan->wmm_rules[ac].min_aifs =
46 nla_get_u8(tb_wmm[NL80211_WMMR_AIFSN]);
47 chan->wmm_rules[ac].max_txop =