| 1 | --- a/drivers/net/wireless/ath/ath5k/base.c |
| 2 | +++ b/drivers/net/wireless/ath/ath5k/base.c |
| 3 | @@ -325,6 +325,8 @@ ath5k_setup_channels(struct ath5k_hw *ah |
| 4 | if (!ath5k_is_standard_channel(ch, band)) |
| 5 | continue; |
| 6 | |
| 7 | + channels[count].max_power = AR5K_TUNE_MAX_TXPOWER/2; |
| 8 | + |
| 9 | count++; |
| 10 | } |
| 11 | |
| 12 | --- a/net/mac80211/agg-rx.c |
| 13 | +++ b/net/mac80211/agg-rx.c |
| 14 | @@ -203,6 +203,8 @@ static void ieee80211_send_addba_resp(st |
| 15 | memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); |
| 16 | else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
| 17 | memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); |
| 18 | + else if (sdata->vif.type == NL80211_IFTYPE_WDS) |
| 19 | + memcpy(mgmt->bssid, da, ETH_ALEN); |
| 20 | |
| 21 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
| 22 | IEEE80211_STYPE_ACTION); |
| 23 | --- a/net/mac80211/agg-tx.c |
| 24 | +++ b/net/mac80211/agg-tx.c |
| 25 | @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request |
| 26 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
| 27 | if (sdata->vif.type == NL80211_IFTYPE_AP || |
| 28 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN || |
| 29 | - sdata->vif.type == NL80211_IFTYPE_MESH_POINT) |
| 30 | + sdata->vif.type == NL80211_IFTYPE_MESH_POINT || |
| 31 | + sdata->vif.type == NL80211_IFTYPE_WDS) |
| 32 | memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); |
| 33 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) |
| 34 | memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); |
| 35 | @@ -460,6 +461,7 @@ int ieee80211_start_tx_ba_session(struct |
| 36 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT && |
| 37 | sdata->vif.type != NL80211_IFTYPE_AP_VLAN && |
| 38 | sdata->vif.type != NL80211_IFTYPE_AP && |
| 39 | + sdata->vif.type != NL80211_IFTYPE_WDS && |
| 40 | sdata->vif.type != NL80211_IFTYPE_ADHOC) |
| 41 | return -EINVAL; |
| 42 | |
| 43 | @@ -869,7 +871,7 @@ void ieee80211_process_addba_resp(struct |
| 44 | |
| 45 | } else { |
| 46 | ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR, |
| 47 | - true); |
| 48 | + false); |
| 49 | } |
| 50 | |
| 51 | out: |
| 52 | --- a/net/mac80211/debugfs_sta.c |
| 53 | +++ b/net/mac80211/debugfs_sta.c |
| 54 | @@ -63,11 +63,11 @@ static ssize_t sta_flags_read(struct fil |
| 55 | test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : "" |
| 56 | |
| 57 | int res = scnprintf(buf, sizeof(buf), |
| 58 | - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", |
| 59 | + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", |
| 60 | TEST(AUTH), TEST(ASSOC), TEST(PS_STA), |
| 61 | TEST(PS_DRIVER), TEST(AUTHORIZED), |
| 62 | TEST(SHORT_PREAMBLE), |
| 63 | - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT), |
| 64 | + TEST(WME), TEST(CLEAR_PS_FILT), |
| 65 | TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL), |
| 66 | TEST(UAPSD), TEST(SP), TEST(TDLS_PEER), |
| 67 | TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT), |
| 68 | --- a/net/mac80211/iface.c |
| 69 | +++ b/net/mac80211/iface.c |
| 70 | @@ -420,7 +420,6 @@ int ieee80211_do_open(struct wireless_de |
| 71 | struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); |
| 72 | struct net_device *dev = wdev->netdev; |
| 73 | struct ieee80211_local *local = sdata->local; |
| 74 | - struct sta_info *sta; |
| 75 | u32 changed = 0; |
| 76 | int res; |
| 77 | u32 hw_reconf_flags = 0; |
| 78 | @@ -575,30 +574,8 @@ int ieee80211_do_open(struct wireless_de |
| 79 | |
| 80 | set_bit(SDATA_STATE_RUNNING, &sdata->state); |
| 81 | |
| 82 | - if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
| 83 | - /* Create STA entry for the WDS peer */ |
| 84 | - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, |
| 85 | - GFP_KERNEL); |
| 86 | - if (!sta) { |
| 87 | - res = -ENOMEM; |
| 88 | - goto err_del_interface; |
| 89 | - } |
| 90 | - |
| 91 | - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); |
| 92 | - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); |
| 93 | - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); |
| 94 | - |
| 95 | - res = sta_info_insert(sta); |
| 96 | - if (res) { |
| 97 | - /* STA has been freed */ |
| 98 | - goto err_del_interface; |
| 99 | - } |
| 100 | - |
| 101 | - rate_control_rate_init(sta); |
| 102 | - netif_carrier_on(dev); |
| 103 | - } else if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) { |
| 104 | + if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) |
| 105 | rcu_assign_pointer(local->p2p_sdata, sdata); |
| 106 | - } |
| 107 | |
| 108 | /* |
| 109 | * set_multicast_list will be invoked by the networking core |
| 110 | @@ -997,6 +974,72 @@ static void ieee80211_if_setup(struct ne |
| 111 | dev->destructor = free_netdev; |
| 112 | } |
| 113 | |
| 114 | +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, |
| 115 | + struct sk_buff *skb) |
| 116 | +{ |
| 117 | + struct ieee80211_local *local = sdata->local; |
| 118 | + struct ieee80211_rx_status *rx_status; |
| 119 | + struct ieee802_11_elems elems; |
| 120 | + struct ieee80211_mgmt *mgmt; |
| 121 | + struct sta_info *sta; |
| 122 | + size_t baselen; |
| 123 | + u32 rates = 0; |
| 124 | + u16 stype; |
| 125 | + bool new = false; |
| 126 | + enum ieee80211_band band = local->hw.conf.channel->band; |
| 127 | + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band]; |
| 128 | + |
| 129 | + rx_status = IEEE80211_SKB_RXCB(skb); |
| 130 | + mgmt = (struct ieee80211_mgmt *) skb->data; |
| 131 | + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE; |
| 132 | + |
| 133 | + if (stype != IEEE80211_STYPE_BEACON) |
| 134 | + return; |
| 135 | + |
| 136 | + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; |
| 137 | + if (baselen > skb->len) |
| 138 | + return; |
| 139 | + |
| 140 | + ieee802_11_parse_elems(mgmt->u.probe_resp.variable, |
| 141 | + skb->len - baselen, &elems); |
| 142 | + |
| 143 | + rates = ieee80211_sta_get_rates(local, &elems, band, NULL); |
| 144 | + |
| 145 | + rcu_read_lock(); |
| 146 | + |
| 147 | + sta = sta_info_get(sdata, sdata->u.wds.remote_addr); |
| 148 | + |
| 149 | + if (!sta) { |
| 150 | + rcu_read_unlock(); |
| 151 | + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, |
| 152 | + GFP_KERNEL); |
| 153 | + if (!sta) |
| 154 | + return; |
| 155 | + |
| 156 | + new = true; |
| 157 | + } |
| 158 | + |
| 159 | + sta->last_rx = jiffies; |
| 160 | + sta->sta.supp_rates[local->hw.conf.channel->band] = rates; |
| 161 | + |
| 162 | + if (elems.ht_cap_elem) |
| 163 | + ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, |
| 164 | + elems.ht_cap_elem, &sta->sta.ht_cap); |
| 165 | + |
| 166 | + if (elems.wmm_param) |
| 167 | + set_sta_flag(sta, WLAN_STA_WME); |
| 168 | + |
| 169 | + if (new) { |
| 170 | + sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); |
| 171 | + sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); |
| 172 | + sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); |
| 173 | + rate_control_rate_init(sta); |
| 174 | + sta_info_insert_rcu(sta); |
| 175 | + } |
| 176 | + |
| 177 | + rcu_read_unlock(); |
| 178 | +} |
| 179 | + |
| 180 | static void ieee80211_iface_work(struct work_struct *work) |
| 181 | { |
| 182 | struct ieee80211_sub_if_data *sdata = |
| 183 | @@ -1101,6 +1144,9 @@ static void ieee80211_iface_work(struct |
| 184 | break; |
| 185 | ieee80211_mesh_rx_queued_mgmt(sdata, skb); |
| 186 | break; |
| 187 | + case NL80211_IFTYPE_WDS: |
| 188 | + ieee80211_wds_rx_queued_mgmt(sdata, skb); |
| 189 | + break; |
| 190 | default: |
| 191 | WARN(1, "frame for unexpected interface type"); |
| 192 | break; |
| 193 | --- a/net/mac80211/rx.c |
| 194 | +++ b/net/mac80211/rx.c |
| 195 | @@ -2279,6 +2279,7 @@ ieee80211_rx_h_action(struct ieee80211_r |
| 196 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT && |
| 197 | sdata->vif.type != NL80211_IFTYPE_AP_VLAN && |
| 198 | sdata->vif.type != NL80211_IFTYPE_AP && |
| 199 | + sdata->vif.type != NL80211_IFTYPE_WDS && |
| 200 | sdata->vif.type != NL80211_IFTYPE_ADHOC) |
| 201 | break; |
| 202 | |
| 203 | @@ -2496,14 +2497,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_ |
| 204 | |
| 205 | if (!ieee80211_vif_is_mesh(&sdata->vif) && |
| 206 | sdata->vif.type != NL80211_IFTYPE_ADHOC && |
| 207 | - sdata->vif.type != NL80211_IFTYPE_STATION) |
| 208 | + sdata->vif.type != NL80211_IFTYPE_STATION && |
| 209 | + sdata->vif.type != NL80211_IFTYPE_WDS) |
| 210 | return RX_DROP_MONITOR; |
| 211 | |
| 212 | switch (stype) { |
| 213 | case cpu_to_le16(IEEE80211_STYPE_AUTH): |
| 214 | case cpu_to_le16(IEEE80211_STYPE_BEACON): |
| 215 | case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP): |
| 216 | - /* process for all: mesh, mlme, ibss */ |
| 217 | + /* process for all: mesh, mlme, ibss, wds */ |
| 218 | break; |
| 219 | case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): |
| 220 | case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): |
| 221 | @@ -2827,10 +2829,16 @@ static int prepare_for_handlers(struct i |
| 222 | } |
| 223 | break; |
| 224 | case NL80211_IFTYPE_WDS: |
| 225 | - if (bssid || !ieee80211_is_data(hdr->frame_control)) |
| 226 | - return 0; |
| 227 | if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2)) |
| 228 | return 0; |
| 229 | + |
| 230 | + if (ieee80211_is_data(hdr->frame_control) || |
| 231 | + ieee80211_is_action(hdr->frame_control)) { |
| 232 | + if (compare_ether_addr(sdata->vif.addr, hdr->addr1)) |
| 233 | + return 0; |
| 234 | + } else if (!ieee80211_is_beacon(hdr->frame_control)) |
| 235 | + return 0; |
| 236 | + |
| 237 | break; |
| 238 | case NL80211_IFTYPE_P2P_DEVICE: |
| 239 | if (!ieee80211_is_public_action(hdr, skb->len) && |
| 240 | --- a/net/mac80211/sta_info.h |
| 241 | +++ b/net/mac80211/sta_info.h |
| 242 | @@ -32,7 +32,6 @@ |
| 243 | * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble |
| 244 | * frames. |
| 245 | * @WLAN_STA_WME: Station is a QoS-STA. |
| 246 | - * @WLAN_STA_WDS: Station is one of our WDS peers. |
| 247 | * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the |
| 248 | * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next |
| 249 | * frame to this station is transmitted. |
| 250 | @@ -64,7 +63,6 @@ enum ieee80211_sta_info_flags { |
| 251 | WLAN_STA_AUTHORIZED, |
| 252 | WLAN_STA_SHORT_PREAMBLE, |
| 253 | WLAN_STA_WME, |
| 254 | - WLAN_STA_WDS, |
| 255 | WLAN_STA_CLEAR_PS_FILT, |
| 256 | WLAN_STA_MFP, |
| 257 | WLAN_STA_BLOCK_BA, |
| 258 | --- a/net/mac80211/status.c |
| 259 | +++ b/net/mac80211/status.c |
| 260 | @@ -517,29 +517,41 @@ void ieee80211_tx_status(struct ieee8021 |
| 261 | |
| 262 | if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) { |
| 263 | u64 cookie = (unsigned long)skb; |
| 264 | + bool found = false; |
| 265 | + |
| 266 | acked = info->flags & IEEE80211_TX_STAT_ACK; |
| 267 | |
| 268 | - if (ieee80211_is_nullfunc(hdr->frame_control) || |
| 269 | - ieee80211_is_qos_nullfunc(hdr->frame_control)) { |
| 270 | - cfg80211_probe_status(skb->dev, hdr->addr1, |
| 271 | - cookie, acked, GFP_ATOMIC); |
| 272 | - } else if (skb->dev) { |
| 273 | - cfg80211_mgmt_tx_status( |
| 274 | - skb->dev->ieee80211_ptr, cookie, skb->data, |
| 275 | - skb->len, acked, GFP_ATOMIC); |
| 276 | - } else { |
| 277 | - struct ieee80211_sub_if_data *p2p_sdata; |
| 278 | + rcu_read_lock(); |
| 279 | |
| 280 | - rcu_read_lock(); |
| 281 | + list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
| 282 | + if (!sdata->dev) |
| 283 | + continue; |
| 284 | |
| 285 | - p2p_sdata = rcu_dereference(local->p2p_sdata); |
| 286 | - if (p2p_sdata) { |
| 287 | - cfg80211_mgmt_tx_status( |
| 288 | - &p2p_sdata->wdev, cookie, skb->data, |
| 289 | - skb->len, acked, GFP_ATOMIC); |
| 290 | - } |
| 291 | - rcu_read_unlock(); |
| 292 | + if (skb->dev != sdata->dev) |
| 293 | + continue; |
| 294 | + |
| 295 | + found = true; |
| 296 | + break; |
| 297 | } |
| 298 | + |
| 299 | + if (!skb->dev) { |
| 300 | + sdata = rcu_dereference(local->p2p_sdata); |
| 301 | + if (sdata) |
| 302 | + found = true; |
| 303 | + } |
| 304 | + |
| 305 | + if (!found) |
| 306 | + skb->dev = NULL; |
| 307 | + else if (ieee80211_is_nullfunc(hdr->frame_control) || |
| 308 | + ieee80211_is_qos_nullfunc(hdr->frame_control)) { |
| 309 | + cfg80211_probe_status(sdata->dev, hdr->addr1, |
| 310 | + cookie, acked, GFP_ATOMIC); |
| 311 | + } else { |
| 312 | + cfg80211_mgmt_tx_status(&sdata->wdev, cookie, skb->data, |
| 313 | + skb->len, acked, GFP_ATOMIC); |
| 314 | + } |
| 315 | + |
| 316 | + rcu_read_unlock(); |
| 317 | } |
| 318 | |
| 319 | if (unlikely(info->ack_frame_id)) { |
| 320 | --- a/drivers/net/wireless/p54/main.c |
| 321 | +++ b/drivers/net/wireless/p54/main.c |
| 322 | @@ -139,6 +139,7 @@ static int p54_beacon_format_ie_tim(stru |
| 323 | static int p54_beacon_update(struct p54_common *priv, |
| 324 | struct ieee80211_vif *vif) |
| 325 | { |
| 326 | + struct ieee80211_tx_control control = { }; |
| 327 | struct sk_buff *beacon; |
| 328 | int ret; |
| 329 | |
| 330 | @@ -158,7 +159,7 @@ static int p54_beacon_update(struct p54_ |
| 331 | * to cancel the old beacon template by hand, instead the firmware |
| 332 | * will release the previous one through the feedback mechanism. |
| 333 | */ |
| 334 | - p54_tx_80211(priv->hw, NULL, beacon); |
| 335 | + p54_tx_80211(priv->hw, &control, beacon); |
| 336 | priv->tsf_high32 = 0; |
| 337 | priv->tsf_low32 = 0; |
| 338 | |
| 339 | --- a/net/wireless/reg.c |
| 340 | +++ b/net/wireless/reg.c |
| 341 | @@ -352,6 +352,9 @@ static void reg_regdb_search(struct work |
| 342 | struct reg_regdb_search_request *request; |
| 343 | const struct ieee80211_regdomain *curdom, *regdom; |
| 344 | int i, r; |
| 345 | + bool set_reg = false; |
| 346 | + |
| 347 | + mutex_lock(&cfg80211_mutex); |
| 348 | |
| 349 | mutex_lock(®_regdb_search_mutex); |
| 350 | while (!list_empty(®_regdb_search_list)) { |
| 351 | @@ -367,9 +370,7 @@ static void reg_regdb_search(struct work |
| 352 | r = reg_copy_regd(®dom, curdom); |
| 353 | if (r) |
| 354 | break; |
| 355 | - mutex_lock(&cfg80211_mutex); |
| 356 | - set_regdom(regdom); |
| 357 | - mutex_unlock(&cfg80211_mutex); |
| 358 | + set_reg = true; |
| 359 | break; |
| 360 | } |
| 361 | } |
| 362 | @@ -377,6 +378,11 @@ static void reg_regdb_search(struct work |
| 363 | kfree(request); |
| 364 | } |
| 365 | mutex_unlock(®_regdb_search_mutex); |
| 366 | + |
| 367 | + if (set_reg) |
| 368 | + set_regdom(regdom); |
| 369 | + |
| 370 | + mutex_unlock(&cfg80211_mutex); |
| 371 | } |
| 372 | |
| 373 | static DECLARE_WORK(reg_regdb_work, reg_regdb_search); |
| 374 | --- a/drivers/net/wireless/ath/ath9k/recv.c |
| 375 | +++ b/drivers/net/wireless/ath/ath9k/recv.c |
| 376 | @@ -424,8 +424,8 @@ u32 ath_calcrxfilter(struct ath_softc *s |
| 377 | rfilt |= ATH9K_RX_FILTER_COMP_BAR; |
| 378 | |
| 379 | if (sc->nvifs > 1 || (sc->rx.rxfilter & FIF_OTHER_BSS)) { |
| 380 | - /* The following may also be needed for other older chips */ |
| 381 | - if (sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_9160) |
| 382 | + /* This is needed for older chips */ |
| 383 | + if (sc->sc_ah->hw_version.macVersion <= AR_SREV_VERSION_9160) |
| 384 | rfilt |= ATH9K_RX_FILTER_PROM; |
| 385 | rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL; |
| 386 | } |
| 387 | --- a/net/mac80211/mlme.c |
| 388 | +++ b/net/mac80211/mlme.c |
| 389 | @@ -818,23 +818,71 @@ void ieee80211_sta_process_chanswitch(st |
| 390 | } |
| 391 | |
| 392 | static void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, |
| 393 | - u16 capab_info, u8 *pwr_constr_elem, |
| 394 | - u8 pwr_constr_elem_len) |
| 395 | + struct ieee80211_channel *channel, |
| 396 | + const u8 *country_ie, u8 country_ie_len, |
| 397 | + const u8 *pwr_constr_elem) |
| 398 | { |
| 399 | - struct ieee80211_conf *conf = &sdata->local->hw.conf; |
| 400 | + struct ieee80211_country_ie_triplet *triplet; |
| 401 | + int chan = ieee80211_frequency_to_channel(channel->center_freq); |
| 402 | + int i, chan_pwr, chan_increment, new_ap_level; |
| 403 | + bool have_chan_pwr = false; |
| 404 | |
| 405 | - if (!(capab_info & WLAN_CAPABILITY_SPECTRUM_MGMT)) |
| 406 | + /* Invalid IE */ |
| 407 | + if (country_ie_len % 2 || country_ie_len < IEEE80211_COUNTRY_IE_MIN_LEN) |
| 408 | return; |
| 409 | |
| 410 | - /* Power constraint IE length should be 1 octet */ |
| 411 | - if (pwr_constr_elem_len != 1) |
| 412 | - return; |
| 413 | + triplet = (void *)(country_ie + 3); |
| 414 | + country_ie_len -= 3; |
| 415 | |
| 416 | - if ((*pwr_constr_elem <= conf->channel->max_reg_power) && |
| 417 | - (*pwr_constr_elem != sdata->local->power_constr_level)) { |
| 418 | - sdata->local->power_constr_level = *pwr_constr_elem; |
| 419 | - ieee80211_hw_config(sdata->local, 0); |
| 420 | + switch (channel->band) { |
| 421 | + default: |
| 422 | + WARN_ON_ONCE(1); |
| 423 | + /* fall through */ |
| 424 | + case IEEE80211_BAND_2GHZ: |
| 425 | + case IEEE80211_BAND_60GHZ: |
| 426 | + chan_increment = 1; |
| 427 | + break; |
| 428 | + case IEEE80211_BAND_5GHZ: |
| 429 | + chan_increment = 4; |
| 430 | + break; |
| 431 | } |
| 432 | + |
| 433 | + /* find channel */ |
| 434 | + while (country_ie_len >= 3) { |
| 435 | + u8 first_channel = triplet->chans.first_channel; |
| 436 | + |
| 437 | + if (first_channel >= IEEE80211_COUNTRY_EXTENSION_ID) |
| 438 | + goto next; |
| 439 | + |
| 440 | + for (i = 0; i < triplet->chans.num_channels; i++) { |
| 441 | + if (first_channel + i * chan_increment == chan) { |
| 442 | + have_chan_pwr = true; |
| 443 | + chan_pwr = triplet->chans.max_power; |
| 444 | + break; |
| 445 | + } |
| 446 | + } |
| 447 | + if (have_chan_pwr) |
| 448 | + break; |
| 449 | + |
| 450 | + next: |
| 451 | + triplet++; |
| 452 | + country_ie_len -= 3; |
| 453 | + } |
| 454 | + |
| 455 | + if (!have_chan_pwr) |
| 456 | + return; |
| 457 | + |
| 458 | + new_ap_level = max_t(int, 0, chan_pwr - *pwr_constr_elem); |
| 459 | + |
| 460 | + if (sdata->local->ap_power_level == new_ap_level) |
| 461 | + return; |
| 462 | + |
| 463 | + sdata_info(sdata, |
| 464 | + "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n", |
| 465 | + new_ap_level, chan_pwr, *pwr_constr_elem, |
| 466 | + sdata->u.mgd.bssid); |
| 467 | + sdata->local->ap_power_level = new_ap_level; |
| 468 | + ieee80211_hw_config(sdata->local, 0); |
| 469 | } |
| 470 | |
| 471 | void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif) |
| 472 | @@ -1390,7 +1438,7 @@ static void ieee80211_set_disassoc(struc |
| 473 | sta = sta_info_get(sdata, ifmgd->bssid); |
| 474 | if (sta) { |
| 475 | set_sta_flag(sta, WLAN_STA_BLOCK_BA); |
| 476 | - ieee80211_sta_tear_down_BA_sessions(sta, tx); |
| 477 | + ieee80211_sta_tear_down_BA_sessions(sta, false); |
| 478 | } |
| 479 | mutex_unlock(&local->sta_mtx); |
| 480 | |
| 481 | @@ -1438,7 +1486,7 @@ static void ieee80211_set_disassoc(struc |
| 482 | memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); |
| 483 | memset(&ifmgd->ht_capa_mask, 0, sizeof(ifmgd->ht_capa_mask)); |
| 484 | |
| 485 | - local->power_constr_level = 0; |
| 486 | + local->ap_power_level = 0; |
| 487 | |
| 488 | del_timer_sync(&local->dynamic_ps_timer); |
| 489 | cancel_work_sync(&local->dynamic_ps_enable_work); |
| 490 | @@ -2530,15 +2578,13 @@ static void ieee80211_rx_mgmt_beacon(str |
| 491 | bssid, true); |
| 492 | } |
| 493 | |
| 494 | - /* Note: country IE parsing is done for us by cfg80211 */ |
| 495 | - if (elems.country_elem) { |
| 496 | - /* TODO: IBSS also needs this */ |
| 497 | - if (elems.pwr_constr_elem) |
| 498 | - ieee80211_handle_pwr_constr(sdata, |
| 499 | - le16_to_cpu(mgmt->u.probe_resp.capab_info), |
| 500 | - elems.pwr_constr_elem, |
| 501 | - elems.pwr_constr_elem_len); |
| 502 | - } |
| 503 | + if (elems.country_elem && elems.pwr_constr_elem && |
| 504 | + mgmt->u.probe_resp.capab_info & |
| 505 | + cpu_to_le16(WLAN_CAPABILITY_SPECTRUM_MGMT)) |
| 506 | + ieee80211_handle_pwr_constr(sdata, local->oper_channel, |
| 507 | + elems.country_elem, |
| 508 | + elems.country_elem_len, |
| 509 | + elems.pwr_constr_elem); |
| 510 | |
| 511 | ieee80211_bss_info_change_notify(sdata, changed); |
| 512 | } |
| 513 | --- a/net/mac80211/sta_info.c |
| 514 | +++ b/net/mac80211/sta_info.c |
| 515 | @@ -674,7 +674,7 @@ int __must_check __sta_info_destroy(stru |
| 516 | * will be sufficient. |
| 517 | */ |
| 518 | set_sta_flag(sta, WLAN_STA_BLOCK_BA); |
| 519 | - ieee80211_sta_tear_down_BA_sessions(sta, true); |
| 520 | + ieee80211_sta_tear_down_BA_sessions(sta, false); |
| 521 | |
| 522 | ret = sta_info_hash_del(local, sta); |
| 523 | if (ret) |
| 524 | --- a/drivers/net/wireless/ath/ath5k/phy.c |
| 525 | +++ b/drivers/net/wireless/ath/ath5k/phy.c |
| 526 | @@ -1977,11 +1977,13 @@ ath5k_hw_set_spur_mitigation_filter(stru |
| 527 | spur_delta_phase = (spur_offset << 18) / 25; |
| 528 | spur_freq_sigma_delta = (spur_delta_phase >> 10); |
| 529 | symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz / 2; |
| 530 | + break; |
| 531 | case AR5K_BWMODE_5MHZ: |
| 532 | /* Both sample_freq and chip_freq are 10MHz (?) */ |
| 533 | spur_delta_phase = (spur_offset << 19) / 25; |
| 534 | spur_freq_sigma_delta = (spur_delta_phase >> 10); |
| 535 | symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz / 4; |
| 536 | + break; |
| 537 | default: |
| 538 | if (channel->band == IEEE80211_BAND_5GHZ) { |
| 539 | /* Both sample_freq and chip_freq are 40MHz */ |
| 540 | --- a/net/mac80211/ieee80211_i.h |
| 541 | +++ b/net/mac80211/ieee80211_i.h |
| 542 | @@ -1062,7 +1062,7 @@ struct ieee80211_local { |
| 543 | bool disable_dynamic_ps; |
| 544 | |
| 545 | int user_power_level; /* in dBm */ |
| 546 | - int power_constr_level; /* in dBm */ |
| 547 | + int ap_power_level; /* in dBm */ |
| 548 | |
| 549 | enum ieee80211_smps_mode smps_mode; |
| 550 | |
| 551 | @@ -1170,7 +1170,6 @@ struct ieee802_11_elems { |
| 552 | u8 prep_len; |
| 553 | u8 perr_len; |
| 554 | u8 country_elem_len; |
| 555 | - u8 pwr_constr_elem_len; |
| 556 | u8 quiet_elem_len; |
| 557 | u8 num_of_quiet_elem; /* can be more the one */ |
| 558 | u8 timeout_int_len; |
| 559 | --- a/net/mac80211/util.c |
| 560 | +++ b/net/mac80211/util.c |
| 561 | @@ -792,8 +792,11 @@ u32 ieee802_11_parse_elems_crc(u8 *start |
| 562 | elems->country_elem_len = elen; |
| 563 | break; |
| 564 | case WLAN_EID_PWR_CONSTRAINT: |
| 565 | + if (elen != 1) { |
| 566 | + elem_parse_failed = true; |
| 567 | + break; |
| 568 | + } |
| 569 | elems->pwr_constr_elem = pos; |
| 570 | - elems->pwr_constr_elem_len = elen; |
| 571 | break; |
| 572 | case WLAN_EID_TIMEOUT_INTERVAL: |
| 573 | elems->timeout_int = pos; |
| 574 | --- a/net/mac80211/main.c |
| 575 | +++ b/net/mac80211/main.c |
| 576 | @@ -154,13 +154,11 @@ int ieee80211_hw_config(struct ieee80211 |
| 577 | |
| 578 | if (test_bit(SCAN_SW_SCANNING, &local->scanning) || |
| 579 | test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning) || |
| 580 | - test_bit(SCAN_HW_SCANNING, &local->scanning)) |
| 581 | + test_bit(SCAN_HW_SCANNING, &local->scanning) || |
| 582 | + !local->ap_power_level) |
| 583 | power = chan->max_power; |
| 584 | else |
| 585 | - power = local->power_constr_level ? |
| 586 | - min(chan->max_power, |
| 587 | - (chan->max_reg_power - local->power_constr_level)) : |
| 588 | - chan->max_power; |
| 589 | + power = min(chan->max_power, local->ap_power_level); |
| 590 | |
| 591 | if (local->user_power_level >= 0) |
| 592 | power = min(power, local->user_power_level); |
| 593 | |