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 \*************************/
7 +static const struct ieee80211_iface_limit if_limits[] = {
8 + { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) },
10 +#ifdef CONFIG_MAC80211_MESH
11 + BIT(NL80211_IFTYPE_MESH_POINT) |
13 + BIT(NL80211_IFTYPE_AP) },
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,
24 ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
26 @@ -2438,6 +2454,9 @@ ath5k_init_ah(struct ath5k_hw *ah, const
27 BIT(NL80211_IFTYPE_ADHOC) |
28 BIT(NL80211_IFTYPE_MESH_POINT);
30 + hw->wiphy->iface_combinations = &if_comb;
31 + hw->wiphy->n_iface_combinations = 1;
33 /* SW support for IBSS_RSN is provided by mac80211 */
34 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
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;
43 tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[*ptid]);
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);
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);
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)
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" : ""
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),
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_
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;
114 u32 hw_reconf_flags = 0;
115 @@ -430,28 +429,6 @@ static int ieee80211_do_open(struct net_
117 set_bit(SDATA_STATE_RUNNING, &sdata->state);
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,
125 - goto err_del_interface;
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);
132 - res = sta_info_insert(sta);
134 - /* STA has been freed */
135 - goto err_del_interface;
138 - rate_control_rate_init(sta);
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);
148 + flush_work(&local->hw_roc_start);
149 + flush_work(&local->hw_roc_done);
150 flush_work(&sdata->work);
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;
157 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
158 + struct sk_buff *skb)
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;
169 + enum ieee80211_band band = local->hw.conf.channel->band;
170 + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
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;
176 + if (stype != IEEE80211_STYPE_BEACON)
179 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
180 + if (baselen > skb->len)
183 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
184 + skb->len - baselen, &elems);
186 + rates = ieee80211_sta_get_rates(local, &elems, band, NULL);
190 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
194 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
202 + sta->last_rx = jiffies;
203 + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
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);
209 + if (elems.wmm_param)
210 + set_sta_flag(sta, WLAN_STA_WME);
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);
223 static void ieee80211_iface_work(struct work_struct *work)
225 struct ieee80211_sub_if_data *sdata =
226 @@ -952,6 +997,9 @@ static void ieee80211_iface_work(struct
228 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
230 + case NL80211_IFTYPE_WDS:
231 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
234 WARN(1, "frame for unexpected interface type");
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)
246 @@ -2498,14 +2499,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
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;
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 */
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
267 case NL80211_IFTYPE_WDS:
268 - if (bssid || !ieee80211_is_data(hdr->frame_control))
270 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
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))
277 + } else if (!ieee80211_is_beacon(hdr->frame_control))
282 /* should never get here */
283 --- a/net/mac80211/sta_info.h
284 +++ b/net/mac80211/sta_info.h
286 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
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 {
295 WLAN_STA_SHORT_PREAMBLE,
298 WLAN_STA_CLEAR_PS_FILT,
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;
308 + bool use_11b, enable_qos;
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);
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.
321 + enable_qos = (sdata->vif.type != NL80211_IFTYPE_STATION);
323 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
324 /* Set defaults according to 802.11-2007 Table 7-37 */
326 @@ -826,38 +833,47 @@ void ieee80211_set_wmm_default(struct ie
331 - case IEEE80211_AC_BK:
332 - qparam.cw_max = aCWmax;
333 - qparam.cw_min = aCWmin;
337 - default: /* never happens but let's not leave undefined */
338 - case IEEE80211_AC_BE:
341 + case IEEE80211_AC_BK:
342 + qparam.cw_max = aCWmax;
343 + qparam.cw_min = aCWmin;
347 + /* never happens but let's not leave undefined */
349 + case IEEE80211_AC_BE:
350 + qparam.cw_max = aCWmax;
351 + qparam.cw_min = aCWmin;
355 + case IEEE80211_AC_VI:
356 + qparam.cw_max = aCWmin;
357 + qparam.cw_min = (aCWmin + 1) / 2 - 1;
359 + qparam.txop = 6016/32;
361 + qparam.txop = 3008/32;
364 + case IEEE80211_AC_VO:
365 + qparam.cw_max = (aCWmin + 1) / 2 - 1;
366 + qparam.cw_min = (aCWmin + 1) / 4 - 1;
368 + qparam.txop = 3264/32;
370 + qparam.txop = 1504/32;
375 + /* Confiure old 802.11b/g medium access rules. */
376 qparam.cw_max = aCWmax;
377 qparam.cw_min = aCWmin;
381 - case IEEE80211_AC_VI:
382 - qparam.cw_max = aCWmin;
383 - qparam.cw_min = (aCWmin + 1) / 2 - 1;
385 - qparam.txop = 6016/32;
387 - qparam.txop = 3008/32;
390 - case IEEE80211_AC_VO:
391 - qparam.cw_max = (aCWmin + 1) / 2 - 1;
392 - qparam.cw_min = (aCWmin + 1) / 4 - 1;
394 - qparam.txop = 3264/32;
396 - qparam.txop = 1504/32;
401 qparam.uapsd = false;
402 @@ -866,12 +882,8 @@ void ieee80211_set_wmm_default(struct ie
403 drv_conf_tx(local, sdata, ac, &qparam);
406 - /* after reinitialize QoS TX queues setting to default,
407 - * disable QoS at all */
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;
414 ieee80211_bss_info_change_notify(sdata,
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;
426 + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
427 qi.tqi_cwmax = qi_be.tqi_cwmax;
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;
436 +static void __ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata)
438 + lockdep_assert_held(&sdata->local->mtx);
440 + sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL |
441 + IEEE80211_STA_BEACON_POLL);
442 + ieee80211_run_deferred_scan(sdata->local);
445 +static void ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata)
447 + mutex_lock(&sdata->local->mtx);
448 + __ieee80211_stop_poll(sdata);
449 + mutex_unlock(&sdata->local->mtx);
452 static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
453 u16 capab, bool erp_valid, u8 erp)
455 @@ -1285,8 +1301,7 @@ static void ieee80211_set_associated(str
456 sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE;
458 /* just to be sure */
459 - sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL |
460 - IEEE80211_STA_BEACON_POLL);
461 + ieee80211_stop_poll(sdata);
463 ieee80211_led_assoc(local, 1);
465 @@ -1456,8 +1471,7 @@ static void ieee80211_reset_ap_probe(str
469 - ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |
470 - IEEE80211_STA_BEACON_POLL);
471 + __ieee80211_stop_poll(sdata);
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));
479 - ieee80211_run_deferred_scan(local);
480 mutex_unlock(&local->mtx);
483 @@ -2413,7 +2426,11 @@ static void ieee80211_rx_mgmt_beacon(str
484 "to a received beacon\n", sdata->name);
487 + mutex_lock(&local->mtx);
488 ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL;
489 + ieee80211_run_deferred_scan(local);
490 + mutex_unlock(&local->mtx);
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];
499 - ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |
500 - IEEE80211_STA_BEACON_POLL);
501 + ieee80211_stop_poll(sdata);
503 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason,
505 @@ -2879,8 +2895,7 @@ static void ieee80211_restart_sta_timer(
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);
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);
520 + mutex_lock(&sdata->local->mtx);
521 ieee80211_restart_sta_timer(sdata);
522 + mutex_unlock(&sdata->local->mtx);
526 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
527 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
528 @@ -214,6 +214,7 @@ struct ath_frame_info {
529 enum ath9k_key_type keytype;
532 + bool short_preamble;
535 struct ath_buf_state {
536 --- a/drivers/net/wireless/ath/ath9k/xmit.c
537 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
538 @@ -938,6 +938,7 @@ static void ath_buf_set_rate(struct ath_
539 struct ieee80211_tx_rate *rates;
540 const struct ieee80211_rate *rate;
541 struct ieee80211_hdr *hdr;
542 + struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
546 @@ -957,8 +958,7 @@ static void ath_buf_set_rate(struct ath_
547 rate = ieee80211_get_rts_cts_rate(sc->hw, tx_info);
548 info->rtscts_rate = rate->hw_value;
550 - if (tx_info->control.vif &&
551 - tx_info->control.vif->bss_conf.use_short_preamble)
552 + if (fi->short_preamble)
553 info->rtscts_rate |= rate->hw_value_short;
555 for (i = 0; i < 4; i++) {
556 @@ -1779,6 +1779,11 @@ static void setup_frame_info(struct ieee
557 struct ath_frame_info *fi = get_frame_info(skb);
558 struct ath_node *an = NULL;
559 enum ath9k_key_type keytype;
560 + bool short_preamble = false;
562 + if (tx_info->control.vif &&
563 + tx_info->control.vif->bss_conf.use_short_preamble)
564 + short_preamble = true;
566 keytype = ath9k_cmn_get_hw_crypto_keytype(skb);
568 @@ -1794,6 +1799,7 @@ static void setup_frame_info(struct ieee
569 fi->keyix = ATH9K_TXKEYIX_INVALID;
570 fi->keytype = keytype;
571 fi->framelen = framelen;
572 + fi->short_preamble = short_preamble;
575 u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate)