240411236ae5e637aa2f8b277b3098c372ddc85d
[oweals/openwrt.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 23 Jan 2020 13:50:47 +0100
3 Subject: [PATCH] driver_nl80211: fix WMM queue mapping for regulatory
4  limit
5
6 nl80211 uses a different queue mapping from hostap, so AC indexes need to
7 be converted.
8
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 ---
11
12 --- a/src/drivers/driver_nl80211_capa.c
13 +++ b/src/drivers/driver_nl80211_capa.c
14 @@ -1403,6 +1403,12 @@ static void phy_info_freq(struct hostapd
15                         [NL80211_WMMR_AIFSN] = { .type = NLA_U8 },
16                         [NL80211_WMMR_TXOP] = { .type = NLA_U16 },
17                 };
18 +               static const u8 wmm_map[4] = {
19 +                       [NL80211_AC_BE] = WMM_AC_BE,
20 +                       [NL80211_AC_BK] = WMM_AC_BK,
21 +                       [NL80211_AC_VI] = WMM_AC_VI,
22 +                       [NL80211_AC_VO] = WMM_AC_VO,
23 +               };
24                 struct nlattr *nl_wmm;
25                 struct nlattr *tb_wmm[NL80211_WMMR_MAX + 1];
26                 int rem_wmm, ac, count = 0;
27 @@ -1424,12 +1430,13 @@ static void phy_info_freq(struct hostapd
28                                 return;
29                         }
30                         ac = nl_wmm->nla_type;
31 -                       if (ac < 0 || ac >= WMM_AC_NUM) {
32 +                       if (ac >= ARRAY_SIZE(wmm_map)) {
33                                 wpa_printf(MSG_DEBUG,
34                                            "nl80211: Invalid AC value %d", ac);
35                                 return;
36                         }
37  
38 +                       ac = wmm_map[ac];
39                         chan->wmm_rules[ac].min_cwmin =
40                                 nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN]);
41                         chan->wmm_rules[ac].min_cwmax =