aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac80211/debugfs.c81
-rw-r--r--net/mac80211/debugfs_netdev.c58
-rw-r--r--net/mac80211/ieee80211_i.h28
-rw-r--r--net/mac80211/main.c2
-rw-r--r--net/mac80211/mlme.c8
-rw-r--r--net/mac80211/tx.c4
6 files changed, 79 insertions, 102 deletions
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 483e96ed95c1..cc5b7a6e7e0b 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -97,85 +97,6 @@ static const struct file_operations reset_ops = {
97 .llseek = noop_llseek, 97 .llseek = noop_llseek,
98}; 98};
99 99
100static ssize_t uapsd_queues_read(struct file *file, char __user *user_buf,
101 size_t count, loff_t *ppos)
102{
103 struct ieee80211_local *local = file->private_data;
104 return mac80211_format_buffer(user_buf, count, ppos, "0x%x\n",
105 local->uapsd_queues);
106}
107
108static ssize_t uapsd_queues_write(struct file *file,
109 const char __user *user_buf,
110 size_t count, loff_t *ppos)
111{
112 struct ieee80211_local *local = file->private_data;
113 u8 val;
114 int ret;
115
116 ret = kstrtou8_from_user(user_buf, count, 0, &val);
117 if (ret)
118 return ret;
119
120 if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK)
121 return -ERANGE;
122
123 local->uapsd_queues = val;
124
125 return count;
126}
127
128static const struct file_operations uapsd_queues_ops = {
129 .read = uapsd_queues_read,
130 .write = uapsd_queues_write,
131 .open = mac80211_open_file_generic,
132 .llseek = default_llseek,
133};
134
135static ssize_t uapsd_max_sp_len_read(struct file *file, char __user *user_buf,
136 size_t count, loff_t *ppos)
137{
138 struct ieee80211_local *local = file->private_data;
139
140 return mac80211_format_buffer(user_buf, count, ppos, "0x%x\n",
141 local->uapsd_max_sp_len);
142}
143
144static ssize_t uapsd_max_sp_len_write(struct file *file,
145 const char __user *user_buf,
146 size_t count, loff_t *ppos)
147{
148 struct ieee80211_local *local = file->private_data;
149 unsigned long val;
150 char buf[10];
151 size_t len;
152 int ret;
153
154 len = min(count, sizeof(buf) - 1);
155 if (copy_from_user(buf, user_buf, len))
156 return -EFAULT;
157 buf[len] = '\0';
158
159 ret = kstrtoul(buf, 0, &val);
160
161 if (ret)
162 return -EINVAL;
163
164 if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK)
165 return -ERANGE;
166
167 local->uapsd_max_sp_len = val;
168
169 return count;
170}
171
172static const struct file_operations uapsd_max_sp_len_ops = {
173 .read = uapsd_max_sp_len_read,
174 .write = uapsd_max_sp_len_write,
175 .open = mac80211_open_file_generic,
176 .llseek = default_llseek,
177};
178
179static ssize_t channel_type_read(struct file *file, char __user *user_buf, 100static ssize_t channel_type_read(struct file *file, char __user *user_buf,
180 size_t count, loff_t *ppos) 101 size_t count, loff_t *ppos)
181{ 102{
@@ -362,8 +283,6 @@ void debugfs_hw_add(struct ieee80211_local *local)
362 DEBUGFS_ADD(wep_iv); 283 DEBUGFS_ADD(wep_iv);
363 DEBUGFS_ADD(queues); 284 DEBUGFS_ADD(queues);
364 DEBUGFS_ADD_MODE(reset, 0200); 285 DEBUGFS_ADD_MODE(reset, 0200);
365 DEBUGFS_ADD(uapsd_queues);
366 DEBUGFS_ADD(uapsd_max_sp_len);
367 DEBUGFS_ADD(channel_type); 286 DEBUGFS_ADD(channel_type);
368 DEBUGFS_ADD(hwflags); 287 DEBUGFS_ADD(hwflags);
369 DEBUGFS_ADD(user_power); 288 DEBUGFS_ADD(user_power);
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index ef5cf2685657..a32eeda04aa3 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -337,6 +337,62 @@ static ssize_t ieee80211_if_parse_tkip_mic_test(
337 337
338__IEEE80211_IF_FILE_W(tkip_mic_test); 338__IEEE80211_IF_FILE_W(tkip_mic_test);
339 339
340static ssize_t ieee80211_if_fmt_uapsd_queues(
341 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
342{
343 const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
344
345 return snprintf(buf, buflen, "0x%x\n", ifmgd->uapsd_queues);
346}
347
348static ssize_t ieee80211_if_parse_uapsd_queues(
349 struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
350{
351 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
352 u8 val;
353 int ret;
354
355 ret = kstrtou8(buf, 0, &val);
356 if (ret)
357 return ret;
358
359 if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK)
360 return -ERANGE;
361
362 ifmgd->uapsd_queues = val;
363
364 return buflen;
365}
366__IEEE80211_IF_FILE_W(uapsd_queues);
367
368static ssize_t ieee80211_if_fmt_uapsd_max_sp_len(
369 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
370{
371 const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
372
373 return snprintf(buf, buflen, "0x%x\n", ifmgd->uapsd_max_sp_len);
374}
375
376static ssize_t ieee80211_if_parse_uapsd_max_sp_len(
377 struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
378{
379 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
380 unsigned long val;
381 int ret;
382
383 ret = kstrtoul(buf, 0, &val);
384 if (ret)
385 return -EINVAL;
386
387 if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK)
388 return -ERANGE;
389
390 ifmgd->uapsd_max_sp_len = val;
391
392 return buflen;
393}
394__IEEE80211_IF_FILE_W(uapsd_max_sp_len);
395
340/* AP attributes */ 396/* AP attributes */
341IEEE80211_IF_FILE(num_sta_authorized, u.ap.num_sta_authorized, ATOMIC); 397IEEE80211_IF_FILE(num_sta_authorized, u.ap.num_sta_authorized, ATOMIC);
342IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC); 398IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC);
@@ -469,6 +525,8 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata)
469 DEBUGFS_ADD(ave_beacon); 525 DEBUGFS_ADD(ave_beacon);
470 DEBUGFS_ADD_MODE(smps, 0600); 526 DEBUGFS_ADD_MODE(smps, 0600);
471 DEBUGFS_ADD_MODE(tkip_mic_test, 0200); 527 DEBUGFS_ADD_MODE(tkip_mic_test, 0200);
528 DEBUGFS_ADD_MODE(uapsd_queues, 0600);
529 DEBUGFS_ADD_MODE(uapsd_max_sp_len, 0600);
472} 530}
473 531
474static void add_ap_files(struct ieee80211_sub_if_data *sdata) 532static void add_ap_files(struct ieee80211_sub_if_data *sdata)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 63fb0eb79d8e..d9798a307f20 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -459,6 +459,20 @@ struct ieee80211_if_managed {
459 IEEE80211_MFP_REQUIRED 459 IEEE80211_MFP_REQUIRED
460 } mfp; /* management frame protection */ 460 } mfp; /* management frame protection */
461 461
462 /*
463 * Bitmask of enabled u-apsd queues,
464 * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
465 * to take effect.
466 */
467 unsigned int uapsd_queues;
468
469 /*
470 * Maximum number of buffered frames AP can deliver during a
471 * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
472 * Needs a new association to take effect.
473 */
474 unsigned int uapsd_max_sp_len;
475
462 int wmm_last_param_set; 476 int wmm_last_param_set;
463 477
464 u8 use_4addr; 478 u8 use_4addr;
@@ -1017,20 +1031,6 @@ struct ieee80211_local {
1017 */ 1031 */
1018 unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */ 1032 unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
1019 1033
1020 /*
1021 * Bitmask of enabled u-apsd queues,
1022 * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
1023 * to take effect.
1024 */
1025 unsigned int uapsd_queues;
1026
1027 /*
1028 * Maximum number of buffered frames AP can deliver during a
1029 * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
1030 * Needs a new association to take effect.
1031 */
1032 unsigned int uapsd_max_sp_len;
1033
1034 bool pspolling; 1034 bool pspolling;
1035 bool offchannel_ps_enabled; 1035 bool offchannel_ps_enabled;
1036 /* 1036 /*
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 36fa8051296c..b581a24fa15c 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -595,8 +595,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
595 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long; 595 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
596 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short; 596 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
597 local->user_power_level = -1; 597 local->user_power_level = -1;
598 local->uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
599 local->uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
600 wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask; 598 wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask;
601 599
602 INIT_LIST_HEAD(&local->interfaces); 600 INIT_LIST_HEAD(&local->interfaces);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 0df22372af8d..576fb25456dd 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -572,8 +572,8 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
572 572
573 if (assoc_data->wmm) { 573 if (assoc_data->wmm) {
574 if (assoc_data->uapsd) { 574 if (assoc_data->uapsd) {
575 qos_info = local->uapsd_queues; 575 qos_info = ifmgd->uapsd_queues;
576 qos_info |= (local->uapsd_max_sp_len << 576 qos_info |= (ifmgd->uapsd_max_sp_len <<
577 IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT); 577 IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT);
578 } else { 578 } else {
579 qos_info = 0; 579 qos_info = 0;
@@ -1192,7 +1192,7 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
1192 return; 1192 return;
1193 1193
1194 if (ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) 1194 if (ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED)
1195 uapsd_queues = local->uapsd_queues; 1195 uapsd_queues = ifmgd->uapsd_queues;
1196 1196
1197 count = wmm_param[6] & 0x0f; 1197 count = wmm_param[6] & 0x0f;
1198 if (count == ifmgd->wmm_last_param_set) 1198 if (count == ifmgd->wmm_last_param_set)
@@ -3013,6 +3013,8 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
3013 3013
3014 ifmgd->flags = 0; 3014 ifmgd->flags = 0;
3015 ifmgd->powersave = sdata->wdev.ps; 3015 ifmgd->powersave = sdata->wdev.ps;
3016 ifmgd->uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
3017 ifmgd->uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
3016 3018
3017 mutex_init(&ifmgd->mtx); 3019 mutex_init(&ifmgd->mtx);
3018 3020
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index d9e791d2b543..782a60198df4 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -226,12 +226,12 @@ ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
226 * have correct qos tag for some reason, due the network or the 226 * have correct qos tag for some reason, due the network or the
227 * peer application. 227 * peer application.
228 * 228 *
229 * Note: local->uapsd_queues access is racy here. If the value is 229 * Note: ifmgd->uapsd_queues access is racy here. If the value is
230 * changed via debugfs, user needs to reassociate manually to have 230 * changed via debugfs, user needs to reassociate manually to have
231 * everything in sync. 231 * everything in sync.
232 */ 232 */
233 if ((ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) 233 if ((ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED)
234 && (local->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) 234 && (ifmgd->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
235 && skb_get_queue_mapping(tx->skb) == 0) 235 && skb_get_queue_mapping(tx->skb) == 0)
236 return TX_CONTINUE; 236 return TX_CONTINUE;
237 237