aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/hostapd/patches/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch
blob: 240411236ae5e637aa2f8b277b3098c372ddc85d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 23 Jan 2020 13:50:47 +0100
Subject: [PATCH] driver_nl80211: fix WMM queue mapping for regulatory
 limit

nl80211 uses a different queue mapping from hostap, so AC indexes need to
be converted.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---

--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1403,6 +1403,12 @@ static void phy_info_freq(struct hostapd
 			[NL80211_WMMR_AIFSN] = { .type = NLA_U8 },
 			[NL80211_WMMR_TXOP] = { .type = NLA_U16 },
 		};
+		static const u8 wmm_map[4] = {
+			[NL80211_AC_BE] = WMM_AC_BE,
+			[NL80211_AC_BK] = WMM_AC_BK,
+			[NL80211_AC_VI] = WMM_AC_VI,
+			[NL80211_AC_VO] = WMM_AC_VO,
+		};
 		struct nlattr *nl_wmm;
 		struct nlattr *tb_wmm[NL80211_WMMR_MAX + 1];
 		int rem_wmm, ac, count = 0;
@@ -1424,12 +1430,13 @@ static void phy_info_freq(struct hostapd
 				return;
 			}
 			ac = nl_wmm->nla_type;
-			if (ac < 0 || ac >= WMM_AC_NUM) {
+			if (ac >= ARRAY_SIZE(wmm_map)) {
 				wpa_printf(MSG_DEBUG,
 					   "nl80211: Invalid AC value %d", ac);
 				return;
 			}
 
+			ac = wmm_map[ac];
 			chan->wmm_rules[ac].min_cwmin =
 				nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN]);
 			chan->wmm_rules[ac].min_cwmax =