73190796fac7d8c435d8f04132ae7e04c5463363
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 300-pending_work.patch
1 --- a/drivers/net/wireless/ath/ath5k/base.c
2 +++ b/drivers/net/wireless/ath/ath5k/base.c
3 @@ -2417,6 +2417,22 @@ ath5k_tx_complete_poll_work(struct work_
4 * Initialization routines *
5 \*************************/
6
7 +static const struct ieee80211_iface_limit if_limits[] = {
8 + { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) },
9 + { .max = 4, .types =
10 +#ifdef CONFIG_MAC80211_MESH
11 + BIT(NL80211_IFTYPE_MESH_POINT) |
12 +#endif
13 + BIT(NL80211_IFTYPE_AP) },
14 +};
15 +
16 +static const struct ieee80211_iface_combination if_comb = {
17 + .limits = if_limits,
18 + .n_limits = ARRAY_SIZE(if_limits),
19 + .max_interfaces = 2048,
20 + .num_different_channels = 1,
21 +};
22 +
23 int __devinit
24 ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
25 {
26 @@ -2438,6 +2454,9 @@ ath5k_init_ah(struct ath5k_hw *ah, const
27 BIT(NL80211_IFTYPE_ADHOC) |
28 BIT(NL80211_IFTYPE_MESH_POINT);
29
30 + hw->wiphy->iface_combinations = &if_comb;
31 + hw->wiphy->n_iface_combinations = 1;
32 +
33 /* SW support for IBSS_RSN is provided by mac80211 */
34 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
35
36 --- a/net/mac80211/agg-rx.c
37 +++ b/net/mac80211/agg-rx.c
38 @@ -145,15 +145,20 @@ static void sta_rx_agg_session_timer_exp
39 struct tid_ampdu_rx *tid_rx;
40 unsigned long timeout;
41
42 + rcu_read_lock();
43 tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[*ptid]);
44 - if (!tid_rx)
45 + if (!tid_rx) {
46 + rcu_read_unlock();
47 return;
48 + }
49
50 timeout = tid_rx->last_rx + TU_TO_JIFFIES(tid_rx->timeout);
51 if (time_is_after_jiffies(timeout)) {
52 mod_timer(&tid_rx->session_timer, timeout);
53 + rcu_read_unlock();
54 return;
55 }
56 + rcu_read_unlock();
57
58 #ifdef CONFIG_MAC80211_HT_DEBUG
59 printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid);
60 @@ -200,6 +205,8 @@ static void ieee80211_send_addba_resp(st
61 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
62 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
63 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
64 + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
65 + memcpy(mgmt->bssid, da, ETH_ALEN);
66
67 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
68 IEEE80211_STYPE_ACTION);
69 --- a/net/mac80211/agg-tx.c
70 +++ b/net/mac80211/agg-tx.c
71 @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
72 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
73 if (sdata->vif.type == NL80211_IFTYPE_AP ||
74 sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
75 - sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
76 + sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
77 + sdata->vif.type == NL80211_IFTYPE_WDS)
78 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
79 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
80 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
81 @@ -490,6 +491,7 @@ int ieee80211_start_tx_ba_session(struct
82 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
83 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
84 sdata->vif.type != NL80211_IFTYPE_AP &&
85 + sdata->vif.type != NL80211_IFTYPE_WDS &&
86 sdata->vif.type != NL80211_IFTYPE_ADHOC)
87 return -EINVAL;
88
89 --- a/net/mac80211/debugfs_sta.c
90 +++ b/net/mac80211/debugfs_sta.c
91 @@ -63,11 +63,11 @@ static ssize_t sta_flags_read(struct fil
92 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
93
94 int res = scnprintf(buf, sizeof(buf),
95 - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
96 + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
97 TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
98 TEST(PS_DRIVER), TEST(AUTHORIZED),
99 TEST(SHORT_PREAMBLE),
100 - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
101 + TEST(WME), TEST(CLEAR_PS_FILT),
102 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
103 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
104 TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
105 --- a/net/mac80211/iface.c
106 +++ b/net/mac80211/iface.c
107 @@ -284,7 +284,6 @@ static int ieee80211_do_open(struct net_
108 {
109 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
110 struct ieee80211_local *local = sdata->local;
111 - struct sta_info *sta;
112 u32 changed = 0;
113 int res;
114 u32 hw_reconf_flags = 0;
115 @@ -430,28 +429,6 @@ static int ieee80211_do_open(struct net_
116
117 set_bit(SDATA_STATE_RUNNING, &sdata->state);
118
119 - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
120 - /* Create STA entry for the WDS peer */
121 - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
122 - GFP_KERNEL);
123 - if (!sta) {
124 - res = -ENOMEM;
125 - goto err_del_interface;
126 - }
127 -
128 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
129 - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
130 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
131 -
132 - res = sta_info_insert(sta);
133 - if (res) {
134 - /* STA has been freed */
135 - goto err_del_interface;
136 - }
137 -
138 - rate_control_rate_init(sta);
139 - }
140 -
141 /*
142 * set_multicast_list will be invoked by the networking core
143 * which will check whether any increments here were done in
144 @@ -642,6 +619,8 @@ static void ieee80211_do_stop(struct iee
145 ieee80211_configure_filter(local);
146 break;
147 default:
148 + flush_work(&local->hw_roc_start);
149 + flush_work(&local->hw_roc_done);
150 flush_work(&sdata->work);
151 /*
152 * When we get here, the interface is marked down.
153 @@ -848,6 +827,72 @@ static void ieee80211_if_setup(struct ne
154 dev->destructor = free_netdev;
155 }
156
157 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
158 + struct sk_buff *skb)
159 +{
160 + struct ieee80211_local *local = sdata->local;
161 + struct ieee80211_rx_status *rx_status;
162 + struct ieee802_11_elems elems;
163 + struct ieee80211_mgmt *mgmt;
164 + struct sta_info *sta;
165 + size_t baselen;
166 + u32 rates = 0;
167 + u16 stype;
168 + bool new = false;
169 + enum ieee80211_band band = local->hw.conf.channel->band;
170 + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
171 +
172 + rx_status = IEEE80211_SKB_RXCB(skb);
173 + mgmt = (struct ieee80211_mgmt *) skb->data;
174 + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
175 +
176 + if (stype != IEEE80211_STYPE_BEACON)
177 + return;
178 +
179 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
180 + if (baselen > skb->len)
181 + return;
182 +
183 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
184 + skb->len - baselen, &elems);
185 +
186 + rates = ieee80211_sta_get_rates(local, &elems, band, NULL);
187 +
188 + rcu_read_lock();
189 +
190 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
191 +
192 + if (!sta) {
193 + rcu_read_unlock();
194 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
195 + GFP_KERNEL);
196 + if (!sta)
197 + return;
198 +
199 + new = true;
200 + }
201 +
202 + sta->last_rx = jiffies;
203 + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
204 +
205 + if (elems.ht_cap_elem)
206 + ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
207 + elems.ht_cap_elem, &sta->sta.ht_cap);
208 +
209 + if (elems.wmm_param)
210 + set_sta_flag(sta, WLAN_STA_WME);
211 +
212 + if (new) {
213 + sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
214 + sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
215 + sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
216 + rate_control_rate_init(sta);
217 + sta_info_insert_rcu(sta);
218 + }
219 +
220 + rcu_read_unlock();
221 +}
222 +
223 static void ieee80211_iface_work(struct work_struct *work)
224 {
225 struct ieee80211_sub_if_data *sdata =
226 @@ -952,6 +997,9 @@ static void ieee80211_iface_work(struct
227 break;
228 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
229 break;
230 + case NL80211_IFTYPE_WDS:
231 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
232 + break;
233 default:
234 WARN(1, "frame for unexpected interface type");
235 break;
236 --- a/net/mac80211/rx.c
237 +++ b/net/mac80211/rx.c
238 @@ -2284,6 +2284,7 @@ ieee80211_rx_h_action(struct ieee80211_r
239 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
240 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
241 sdata->vif.type != NL80211_IFTYPE_AP &&
242 + sdata->vif.type != NL80211_IFTYPE_WDS &&
243 sdata->vif.type != NL80211_IFTYPE_ADHOC)
244 break;
245
246 @@ -2498,14 +2499,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
247
248 if (!ieee80211_vif_is_mesh(&sdata->vif) &&
249 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
250 - sdata->vif.type != NL80211_IFTYPE_STATION)
251 + sdata->vif.type != NL80211_IFTYPE_STATION &&
252 + sdata->vif.type != NL80211_IFTYPE_WDS)
253 return RX_DROP_MONITOR;
254
255 switch (stype) {
256 case cpu_to_le16(IEEE80211_STYPE_AUTH):
257 case cpu_to_le16(IEEE80211_STYPE_BEACON):
258 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
259 - /* process for all: mesh, mlme, ibss */
260 + /* process for all: mesh, mlme, ibss, wds */
261 break;
262 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
263 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
264 @@ -2839,10 +2841,16 @@ static int prepare_for_handlers(struct i
265 }
266 break;
267 case NL80211_IFTYPE_WDS:
268 - if (bssid || !ieee80211_is_data(hdr->frame_control))
269 - return 0;
270 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
271 return 0;
272 +
273 + if (ieee80211_is_data(hdr->frame_control) ||
274 + ieee80211_is_action(hdr->frame_control)) {
275 + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
276 + return 0;
277 + } else if (!ieee80211_is_beacon(hdr->frame_control))
278 + return 0;
279 +
280 break;
281 default:
282 /* should never get here */
283 --- a/net/mac80211/sta_info.h
284 +++ b/net/mac80211/sta_info.h
285 @@ -32,7 +32,6 @@
286 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
287 * frames.
288 * @WLAN_STA_WME: Station is a QoS-STA.
289 - * @WLAN_STA_WDS: Station is one of our WDS peers.
290 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
291 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
292 * frame to this station is transmitted.
293 @@ -64,7 +63,6 @@ enum ieee80211_sta_info_flags {
294 WLAN_STA_AUTHORIZED,
295 WLAN_STA_SHORT_PREAMBLE,
296 WLAN_STA_WME,
297 - WLAN_STA_WDS,
298 WLAN_STA_CLEAR_PS_FILT,
299 WLAN_STA_MFP,
300 WLAN_STA_BLOCK_BA,
301 --- a/net/mac80211/util.c
302 +++ b/net/mac80211/util.c
303 @@ -804,7 +804,7 @@ void ieee80211_set_wmm_default(struct ie
304 struct ieee80211_local *local = sdata->local;
305 struct ieee80211_tx_queue_params qparam;
306 int ac;
307 - bool use_11b;
308 + bool use_11b, enable_qos;
309 int aCWmin, aCWmax;
310
311 if (!local->ops->conf_tx)
312 @@ -818,6 +818,13 @@ void ieee80211_set_wmm_default(struct ie
313 use_11b = (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ) &&
314 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE);
315
316 + /*
317 + * By default disable QoS in STA mode for old access points, which do
318 + * not support 802.11e. New APs will provide proper queue parameters,
319 + * that we will configure later.
320 + */
321 + enable_qos = (sdata->vif.type != NL80211_IFTYPE_STATION);
322 +
323 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
324 /* Set defaults according to 802.11-2007 Table 7-37 */
325 aCWmax = 1023;
326 @@ -826,38 +833,47 @@ void ieee80211_set_wmm_default(struct ie
327 else
328 aCWmin = 15;
329
330 - switch (ac) {
331 - case IEEE80211_AC_BK:
332 - qparam.cw_max = aCWmax;
333 - qparam.cw_min = aCWmin;
334 - qparam.txop = 0;
335 - qparam.aifs = 7;
336 - break;
337 - default: /* never happens but let's not leave undefined */
338 - case IEEE80211_AC_BE:
339 + if (enable_qos) {
340 + switch (ac) {
341 + case IEEE80211_AC_BK:
342 + qparam.cw_max = aCWmax;
343 + qparam.cw_min = aCWmin;
344 + qparam.txop = 0;
345 + qparam.aifs = 7;
346 + break;
347 + /* never happens but let's not leave undefined */
348 + default:
349 + case IEEE80211_AC_BE:
350 + qparam.cw_max = aCWmax;
351 + qparam.cw_min = aCWmin;
352 + qparam.txop = 0;
353 + qparam.aifs = 3;
354 + break;
355 + case IEEE80211_AC_VI:
356 + qparam.cw_max = aCWmin;
357 + qparam.cw_min = (aCWmin + 1) / 2 - 1;
358 + if (use_11b)
359 + qparam.txop = 6016/32;
360 + else
361 + qparam.txop = 3008/32;
362 + qparam.aifs = 2;
363 + break;
364 + case IEEE80211_AC_VO:
365 + qparam.cw_max = (aCWmin + 1) / 2 - 1;
366 + qparam.cw_min = (aCWmin + 1) / 4 - 1;
367 + if (use_11b)
368 + qparam.txop = 3264/32;
369 + else
370 + qparam.txop = 1504/32;
371 + qparam.aifs = 2;
372 + break;
373 + }
374 + } else {
375 + /* Confiure old 802.11b/g medium access rules. */
376 qparam.cw_max = aCWmax;
377 qparam.cw_min = aCWmin;
378 qparam.txop = 0;
379 - qparam.aifs = 3;
380 - break;
381 - case IEEE80211_AC_VI:
382 - qparam.cw_max = aCWmin;
383 - qparam.cw_min = (aCWmin + 1) / 2 - 1;
384 - if (use_11b)
385 - qparam.txop = 6016/32;
386 - else
387 - qparam.txop = 3008/32;
388 qparam.aifs = 2;
389 - break;
390 - case IEEE80211_AC_VO:
391 - qparam.cw_max = (aCWmin + 1) / 2 - 1;
392 - qparam.cw_min = (aCWmin + 1) / 4 - 1;
393 - if (use_11b)
394 - qparam.txop = 3264/32;
395 - else
396 - qparam.txop = 1504/32;
397 - qparam.aifs = 2;
398 - break;
399 }
400
401 qparam.uapsd = false;
402 @@ -866,12 +882,8 @@ void ieee80211_set_wmm_default(struct ie
403 drv_conf_tx(local, sdata, ac, &qparam);
404 }
405
406 - /* after reinitialize QoS TX queues setting to default,
407 - * disable QoS at all */
408 -
409 if (sdata->vif.type != NL80211_IFTYPE_MONITOR) {
410 - sdata->vif.bss_conf.qos =
411 - sdata->vif.type != NL80211_IFTYPE_STATION;
412 + sdata->vif.bss_conf.qos = enable_qos;
413 if (bss_notify)
414 ieee80211_bss_info_change_notify(sdata,
415 BSS_CHANGED_QOS);
416 --- a/drivers/net/wireless/ath/ath9k/beacon.c
417 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
418 @@ -48,7 +48,10 @@ int ath_beaconq_config(struct ath_softc
419 txq = sc->tx.txq_map[WME_AC_BE];
420 ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be);
421 qi.tqi_aifs = qi_be.tqi_aifs;
422 - qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
423 + if (ah->slottime == ATH9K_SLOT_TIME_20)
424 + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
425 + else
426 + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
427 qi.tqi_cwmax = qi_be.tqi_cwmax;
428 }
429
430 --- a/net/mac80211/mlme.c
431 +++ b/net/mac80211/mlme.c
432 @@ -1220,6 +1220,22 @@ static void ieee80211_sta_wmm_params(str
433 sdata->vif.bss_conf.qos = true;
434 }
435
436 +static void __ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata)
437 +{
438 + lockdep_assert_held(&sdata->local->mtx);
439 +
440 + sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL |
441 + IEEE80211_STA_BEACON_POLL);
442 + ieee80211_run_deferred_scan(sdata->local);
443 +}
444 +
445 +static void ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata)
446 +{
447 + mutex_lock(&sdata->local->mtx);
448 + __ieee80211_stop_poll(sdata);
449 + mutex_unlock(&sdata->local->mtx);
450 +}
451 +
452 static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
453 u16 capab, bool erp_valid, u8 erp)
454 {
455 @@ -1285,8 +1301,7 @@ static void ieee80211_set_associated(str
456 sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE;
457
458 /* just to be sure */
459 - sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL |
460 - IEEE80211_STA_BEACON_POLL);
461 + ieee80211_stop_poll(sdata);
462
463 ieee80211_led_assoc(local, 1);
464
465 @@ -1456,8 +1471,7 @@ static void ieee80211_reset_ap_probe(str
466 return;
467 }
468
469 - ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |
470 - IEEE80211_STA_BEACON_POLL);
471 + __ieee80211_stop_poll(sdata);
472
473 mutex_lock(&local->iflist_mtx);
474 ieee80211_recalc_ps(local, -1);
475 @@ -1477,7 +1491,6 @@ static void ieee80211_reset_ap_probe(str
476 round_jiffies_up(jiffies +
477 IEEE80211_CONNECTION_IDLE_TIME));
478 out:
479 - ieee80211_run_deferred_scan(local);
480 mutex_unlock(&local->mtx);
481 }
482
483 @@ -2413,7 +2426,11 @@ static void ieee80211_rx_mgmt_beacon(str
484 "to a received beacon\n", sdata->name);
485 }
486 #endif
487 + mutex_lock(&local->mtx);
488 ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL;
489 + ieee80211_run_deferred_scan(local);
490 + mutex_unlock(&local->mtx);
491 +
492 mutex_lock(&local->iflist_mtx);
493 ieee80211_recalc_ps(local, -1);
494 mutex_unlock(&local->iflist_mtx);
495 @@ -2600,8 +2617,7 @@ static void ieee80211_sta_connection_los
496 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
497 u8 frame_buf[DEAUTH_DISASSOC_LEN];
498
499 - ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |
500 - IEEE80211_STA_BEACON_POLL);
501 + ieee80211_stop_poll(sdata);
502
503 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason,
504 false, frame_buf);
505 @@ -2879,8 +2895,7 @@ static void ieee80211_restart_sta_timer(
506 u32 flags;
507
508 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
509 - sdata->u.mgd.flags &= ~(IEEE80211_STA_BEACON_POLL |
510 - IEEE80211_STA_CONNECTION_POLL);
511 + __ieee80211_stop_poll(sdata);
512
513 /* let's probe the connection once */
514 flags = sdata->local->hw.flags;
515 @@ -2949,7 +2964,10 @@ void ieee80211_sta_restart(struct ieee80
516 if (test_and_clear_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running))
517 add_timer(&ifmgd->chswitch_timer);
518 ieee80211_sta_reset_beacon_monitor(sdata);
519 +
520 + mutex_lock(&sdata->local->mtx);
521 ieee80211_restart_sta_timer(sdata);
522 + mutex_unlock(&sdata->local->mtx);
523 }
524 #endif
525