aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2014-02-13 14:43:02 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-02-13 14:43:02 -0500
commit0e028ab0fb2da47fd235dafd4159859892e73d08 (patch)
treee9e1348372b413e6b1b503209582b03c9005f614
parente57f1734d87aa0e9a00905ed08888f0c62f56227 (diff)
parent348f7d4adee97f222e3ad9ff97956ca3793d11c6 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
-rw-r--r--drivers/net/wireless/ath/ar5523/ar5523.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c63
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-nvm-parse.c5
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/scan.c5
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tx.c73
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/utils.c2
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/drv.c7
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c5
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c5
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c5
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/dev.c23
-rw-r--r--net/mac80211/cfg.c44
-rw-r--r--net/mac80211/ht.c4
-rw-r--r--net/mac80211/ibss.c5
-rw-r--r--net/mac80211/iface.c27
-rw-r--r--net/mac80211/tx.c2
-rw-r--r--net/wireless/core.c17
-rw-r--r--net/wireless/core.h4
-rw-r--r--net/wireless/nl80211.c32
-rw-r--r--net/wireless/nl80211.h8
-rw-r--r--net/wireless/scan.c40
-rw-r--r--net/wireless/sme.c2
30 files changed, 256 insertions, 159 deletions
diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c
index 8aa20df55e50..507d9a9ee69a 100644
--- a/drivers/net/wireless/ath/ar5523/ar5523.c
+++ b/drivers/net/wireless/ath/ar5523/ar5523.c
@@ -1764,7 +1764,7 @@ static struct usb_device_id ar5523_id_table[] = {
1764 AR5523_DEVICE_UG(0x07d1, 0x3a07), /* D-Link / WUA-2340 rev A1 */ 1764 AR5523_DEVICE_UG(0x07d1, 0x3a07), /* D-Link / WUA-2340 rev A1 */
1765 AR5523_DEVICE_UG(0x1690, 0x0712), /* Gigaset / AR5523 */ 1765 AR5523_DEVICE_UG(0x1690, 0x0712), /* Gigaset / AR5523 */
1766 AR5523_DEVICE_UG(0x1690, 0x0710), /* Gigaset / SMCWUSBTG */ 1766 AR5523_DEVICE_UG(0x1690, 0x0710), /* Gigaset / SMCWUSBTG */
1767 AR5523_DEVICE_UG(0x129b, 0x160c), /* Gigaset / USB stick 108 1767 AR5523_DEVICE_UG(0x129b, 0x160b), /* Gigaset / USB stick 108
1768 (CyberTAN Technology) */ 1768 (CyberTAN Technology) */
1769 AR5523_DEVICE_UG(0x16ab, 0x7801), /* Globalsun / AR5523_1 */ 1769 AR5523_DEVICE_UG(0x16ab, 0x7801), /* Globalsun / AR5523_1 */
1770 AR5523_DEVICE_UX(0x16ab, 0x7811), /* Globalsun / AR5523_2 */ 1770 AR5523_DEVICE_UX(0x16ab, 0x7811), /* Globalsun / AR5523_2 */
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 25243cbc07f0..b8daff78b9d1 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -5065,6 +5065,10 @@ static u16 ar9003_hw_get_max_edge_power(struct ar9300_eeprom *eep,
5065 break; 5065 break;
5066 } 5066 }
5067 } 5067 }
5068
5069 if (is2GHz && !twiceMaxEdgePower)
5070 twiceMaxEdgePower = 60;
5071
5068 return twiceMaxEdgePower; 5072 return twiceMaxEdgePower;
5069} 5073}
5070 5074
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index c75493f4236a..ba83f582bf4a 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -262,6 +262,8 @@ enum tid_aggr_state {
262struct ath9k_htc_sta { 262struct ath9k_htc_sta {
263 u8 index; 263 u8 index;
264 enum tid_aggr_state tid_state[ATH9K_HTC_MAX_TID]; 264 enum tid_aggr_state tid_state[ATH9K_HTC_MAX_TID];
265 struct work_struct rc_update_work;
266 struct ath9k_htc_priv *htc_priv;
265}; 267};
266 268
267#define ATH9K_HTC_RXBUF 256 269#define ATH9K_HTC_RXBUF 256
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 9db8aefb8600..8d0b9bcb47b4 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -34,6 +34,10 @@ static int ath9k_htc_btcoex_enable;
34module_param_named(btcoex_enable, ath9k_htc_btcoex_enable, int, 0444); 34module_param_named(btcoex_enable, ath9k_htc_btcoex_enable, int, 0444);
35MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence"); 35MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence");
36 36
37static int ath9k_ps_enable;
38module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
39MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
40
37#define CHAN2G(_freq, _idx) { \ 41#define CHAN2G(_freq, _idx) { \
38 .center_freq = (_freq), \ 42 .center_freq = (_freq), \
39 .hw_value = (_idx), \ 43 .hw_value = (_idx), \
@@ -726,12 +730,14 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
726 IEEE80211_HW_SPECTRUM_MGMT | 730 IEEE80211_HW_SPECTRUM_MGMT |
727 IEEE80211_HW_HAS_RATE_CONTROL | 731 IEEE80211_HW_HAS_RATE_CONTROL |
728 IEEE80211_HW_RX_INCLUDES_FCS | 732 IEEE80211_HW_RX_INCLUDES_FCS |
729 IEEE80211_HW_SUPPORTS_PS |
730 IEEE80211_HW_PS_NULLFUNC_STACK | 733 IEEE80211_HW_PS_NULLFUNC_STACK |
731 IEEE80211_HW_REPORTS_TX_ACK_STATUS | 734 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
732 IEEE80211_HW_MFP_CAPABLE | 735 IEEE80211_HW_MFP_CAPABLE |
733 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING; 736 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING;
734 737
738 if (ath9k_ps_enable)
739 hw->flags |= IEEE80211_HW_SUPPORTS_PS;
740
735 hw->wiphy->interface_modes = 741 hw->wiphy->interface_modes =
736 BIT(NL80211_IFTYPE_STATION) | 742 BIT(NL80211_IFTYPE_STATION) |
737 BIT(NL80211_IFTYPE_ADHOC) | 743 BIT(NL80211_IFTYPE_ADHOC) |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 228549a65ab9..90dad4172b0a 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1270,18 +1270,50 @@ static void ath9k_htc_configure_filter(struct ieee80211_hw *hw,
1270 mutex_unlock(&priv->mutex); 1270 mutex_unlock(&priv->mutex);
1271} 1271}
1272 1272
1273static void ath9k_htc_sta_rc_update_work(struct work_struct *work)
1274{
1275 struct ath9k_htc_sta *ista =
1276 container_of(work, struct ath9k_htc_sta, rc_update_work);
1277 struct ieee80211_sta *sta =
1278 container_of((void *)ista, struct ieee80211_sta, drv_priv);
1279 struct ath9k_htc_priv *priv = ista->htc_priv;
1280 struct ath_common *common = ath9k_hw_common(priv->ah);
1281 struct ath9k_htc_target_rate trate;
1282
1283 mutex_lock(&priv->mutex);
1284 ath9k_htc_ps_wakeup(priv);
1285
1286 memset(&trate, 0, sizeof(struct ath9k_htc_target_rate));
1287 ath9k_htc_setup_rate(priv, sta, &trate);
1288 if (!ath9k_htc_send_rate_cmd(priv, &trate))
1289 ath_dbg(common, CONFIG,
1290 "Supported rates for sta: %pM updated, rate caps: 0x%X\n",
1291 sta->addr, be32_to_cpu(trate.capflags));
1292 else
1293 ath_dbg(common, CONFIG,
1294 "Unable to update supported rates for sta: %pM\n",
1295 sta->addr);
1296
1297 ath9k_htc_ps_restore(priv);
1298 mutex_unlock(&priv->mutex);
1299}
1300
1273static int ath9k_htc_sta_add(struct ieee80211_hw *hw, 1301static int ath9k_htc_sta_add(struct ieee80211_hw *hw,
1274 struct ieee80211_vif *vif, 1302 struct ieee80211_vif *vif,
1275 struct ieee80211_sta *sta) 1303 struct ieee80211_sta *sta)
1276{ 1304{
1277 struct ath9k_htc_priv *priv = hw->priv; 1305 struct ath9k_htc_priv *priv = hw->priv;
1306 struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv;
1278 int ret; 1307 int ret;
1279 1308
1280 mutex_lock(&priv->mutex); 1309 mutex_lock(&priv->mutex);
1281 ath9k_htc_ps_wakeup(priv); 1310 ath9k_htc_ps_wakeup(priv);
1282 ret = ath9k_htc_add_station(priv, vif, sta); 1311 ret = ath9k_htc_add_station(priv, vif, sta);
1283 if (!ret) 1312 if (!ret) {
1313 INIT_WORK(&ista->rc_update_work, ath9k_htc_sta_rc_update_work);
1314 ista->htc_priv = priv;
1284 ath9k_htc_init_rate(priv, sta); 1315 ath9k_htc_init_rate(priv, sta);
1316 }
1285 ath9k_htc_ps_restore(priv); 1317 ath9k_htc_ps_restore(priv);
1286 mutex_unlock(&priv->mutex); 1318 mutex_unlock(&priv->mutex);
1287 1319
@@ -1293,12 +1325,13 @@ static int ath9k_htc_sta_remove(struct ieee80211_hw *hw,
1293 struct ieee80211_sta *sta) 1325 struct ieee80211_sta *sta)
1294{ 1326{
1295 struct ath9k_htc_priv *priv = hw->priv; 1327 struct ath9k_htc_priv *priv = hw->priv;
1296 struct ath9k_htc_sta *ista; 1328 struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv;
1297 int ret; 1329 int ret;
1298 1330
1331 cancel_work_sync(&ista->rc_update_work);
1332
1299 mutex_lock(&priv->mutex); 1333 mutex_lock(&priv->mutex);
1300 ath9k_htc_ps_wakeup(priv); 1334 ath9k_htc_ps_wakeup(priv);
1301 ista = (struct ath9k_htc_sta *) sta->drv_priv;
1302 htc_sta_drain(priv->htc, ista->index); 1335 htc_sta_drain(priv->htc, ista->index);
1303 ret = ath9k_htc_remove_station(priv, vif, sta); 1336 ret = ath9k_htc_remove_station(priv, vif, sta);
1304 ath9k_htc_ps_restore(priv); 1337 ath9k_htc_ps_restore(priv);
@@ -1311,28 +1344,12 @@ static void ath9k_htc_sta_rc_update(struct ieee80211_hw *hw,
1311 struct ieee80211_vif *vif, 1344 struct ieee80211_vif *vif,
1312 struct ieee80211_sta *sta, u32 changed) 1345 struct ieee80211_sta *sta, u32 changed)
1313{ 1346{
1314 struct ath9k_htc_priv *priv = hw->priv; 1347 struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv;
1315 struct ath_common *common = ath9k_hw_common(priv->ah);
1316 struct ath9k_htc_target_rate trate;
1317
1318 mutex_lock(&priv->mutex);
1319 ath9k_htc_ps_wakeup(priv);
1320 1348
1321 if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) { 1349 if (!(changed & IEEE80211_RC_SUPP_RATES_CHANGED))
1322 memset(&trate, 0, sizeof(struct ath9k_htc_target_rate)); 1350 return;
1323 ath9k_htc_setup_rate(priv, sta, &trate);
1324 if (!ath9k_htc_send_rate_cmd(priv, &trate))
1325 ath_dbg(common, CONFIG,
1326 "Supported rates for sta: %pM updated, rate caps: 0x%X\n",
1327 sta->addr, be32_to_cpu(trate.capflags));
1328 else
1329 ath_dbg(common, CONFIG,
1330 "Unable to update supported rates for sta: %pM\n",
1331 sta->addr);
1332 }
1333 1351
1334 ath9k_htc_ps_restore(priv); 1352 schedule_work(&ista->rc_update_work);
1335 mutex_unlock(&priv->mutex);
1336} 1353}
1337 1354
1338static int ath9k_htc_conf_tx(struct ieee80211_hw *hw, 1355static int ath9k_htc_conf_tx(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 15b8e783d1a7..5db01b4212c8 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1315,7 +1315,7 @@ static bool ath9k_hw_set_reset(struct ath_hw *ah, int type)
1315 if (AR_SREV_9300_20_OR_LATER(ah)) 1315 if (AR_SREV_9300_20_OR_LATER(ah))
1316 udelay(50); 1316 udelay(50);
1317 else if (AR_SREV_9100(ah)) 1317 else if (AR_SREV_9100(ah))
1318 udelay(10000); 1318 mdelay(10);
1319 else 1319 else
1320 udelay(100); 1320 udelay(100);
1321 1321
@@ -2050,9 +2050,8 @@ static bool ath9k_hw_set_power_awake(struct ath_hw *ah)
2050 2050
2051 REG_SET_BIT(ah, AR_RTC_FORCE_WAKE, 2051 REG_SET_BIT(ah, AR_RTC_FORCE_WAKE,
2052 AR_RTC_FORCE_WAKE_EN); 2052 AR_RTC_FORCE_WAKE_EN);
2053
2054 if (AR_SREV_9100(ah)) 2053 if (AR_SREV_9100(ah))
2055 udelay(10000); 2054 mdelay(10);
2056 else 2055 else
2057 udelay(50); 2056 udelay(50);
2058 2057
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 67411d21c9a5..07a0315dd2f6 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -57,6 +57,10 @@ static int ath9k_bt_ant_diversity;
57module_param_named(bt_ant_diversity, ath9k_bt_ant_diversity, int, 0444); 57module_param_named(bt_ant_diversity, ath9k_bt_ant_diversity, int, 0444);
58MODULE_PARM_DESC(bt_ant_diversity, "Enable WLAN/BT RX antenna diversity"); 58MODULE_PARM_DESC(bt_ant_diversity, "Enable WLAN/BT RX antenna diversity");
59 59
60static int ath9k_ps_enable;
61module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
62MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
63
60bool is_ath9k_unloaded; 64bool is_ath9k_unloaded;
61/* We use the hw_value as an index into our private channel structure */ 65/* We use the hw_value as an index into our private channel structure */
62 66
@@ -903,13 +907,15 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
903 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | 907 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
904 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 908 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
905 IEEE80211_HW_SIGNAL_DBM | 909 IEEE80211_HW_SIGNAL_DBM |
906 IEEE80211_HW_SUPPORTS_PS |
907 IEEE80211_HW_PS_NULLFUNC_STACK | 910 IEEE80211_HW_PS_NULLFUNC_STACK |
908 IEEE80211_HW_SPECTRUM_MGMT | 911 IEEE80211_HW_SPECTRUM_MGMT |
909 IEEE80211_HW_REPORTS_TX_ACK_STATUS | 912 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
910 IEEE80211_HW_SUPPORTS_RC_TABLE | 913 IEEE80211_HW_SUPPORTS_RC_TABLE |
911 IEEE80211_HW_SUPPORTS_HT_CCK_RATES; 914 IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
912 915
916 if (ath9k_ps_enable)
917 hw->flags |= IEEE80211_HW_SUPPORTS_PS;
918
913 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { 919 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
914 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION; 920 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
915 921
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
index 42780971aa04..53b9cad50477 100644
--- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
@@ -182,6 +182,11 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
182 182
183 for (ch_idx = 0; ch_idx < IWL_NUM_CHANNELS; ch_idx++) { 183 for (ch_idx = 0; ch_idx < IWL_NUM_CHANNELS; ch_idx++) {
184 ch_flags = __le16_to_cpup(nvm_ch_flags + ch_idx); 184 ch_flags = __le16_to_cpup(nvm_ch_flags + ch_idx);
185
186 if (ch_idx >= NUM_2GHZ_CHANNELS &&
187 !data->sku_cap_band_52GHz_enable)
188 ch_flags &= ~NVM_CHANNEL_VALID;
189
185 if (!(ch_flags & NVM_CHANNEL_VALID)) { 190 if (!(ch_flags & NVM_CHANNEL_VALID)) {
186 IWL_DEBUG_EEPROM(dev, 191 IWL_DEBUG_EEPROM(dev,
187 "Ch. %d Flags %x [%sGHz] - No traffic\n", 192 "Ch. %d Flags %x [%sGHz] - No traffic\n",
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h
index 73cbba7424f2..9426905de6b2 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h
+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h
@@ -504,6 +504,7 @@ struct iwl_scan_offload_profile {
504 * @match_notify: clients waiting for match found notification 504 * @match_notify: clients waiting for match found notification
505 * @pass_match: clients waiting for the results 505 * @pass_match: clients waiting for the results
506 * @active_clients: active clients bitmap - enum scan_framework_client 506 * @active_clients: active clients bitmap - enum scan_framework_client
507 * @any_beacon_notify: clients waiting for match notification without match
507 */ 508 */
508struct iwl_scan_offload_profile_cfg { 509struct iwl_scan_offload_profile_cfg {
509 struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES]; 510 struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
@@ -512,7 +513,8 @@ struct iwl_scan_offload_profile_cfg {
512 u8 match_notify; 513 u8 match_notify;
513 u8 pass_match; 514 u8 pass_match;
514 u8 active_clients; 515 u8 active_clients;
515 u8 reserved[3]; 516 u8 any_beacon_notify;
517 u8 reserved[2];
516} __packed; 518} __packed;
517 519
518/** 520/**
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index ba4dcabf7c4a..beaf8140abbf 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -361,7 +361,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
361 else 361 else
362 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; 362 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
363 363
364 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_SCHED_SCAN) { 364 if (0 && mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_SCHED_SCAN) {
365 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; 365 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
366 hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; 366 hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX;
367 hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES; 367 hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES;
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c
index bf4e773c6f46..eba55cc3352d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -344,7 +344,8 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm,
344 344
345 iwl_mvm_scan_fill_ssids(cmd, req, basic_ssid ? 1 : 0); 345 iwl_mvm_scan_fill_ssids(cmd, req, basic_ssid ? 1 : 0);
346 346
347 cmd->tx_cmd.tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL); 347 cmd->tx_cmd.tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL |
348 TX_CMD_FLG_BT_DIS);
348 cmd->tx_cmd.sta_id = mvm->aux_sta.sta_id; 349 cmd->tx_cmd.sta_id = mvm->aux_sta.sta_id;
349 cmd->tx_cmd.life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE); 350 cmd->tx_cmd.life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE);
350 cmd->tx_cmd.rate_n_flags = 351 cmd->tx_cmd.rate_n_flags =
@@ -818,6 +819,8 @@ int iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
818 profile_cfg->active_clients = SCAN_CLIENT_SCHED_SCAN; 819 profile_cfg->active_clients = SCAN_CLIENT_SCHED_SCAN;
819 profile_cfg->pass_match = SCAN_CLIENT_SCHED_SCAN; 820 profile_cfg->pass_match = SCAN_CLIENT_SCHED_SCAN;
820 profile_cfg->match_notify = SCAN_CLIENT_SCHED_SCAN; 821 profile_cfg->match_notify = SCAN_CLIENT_SCHED_SCAN;
822 if (!req->n_match_sets || !req->match_sets[0].ssid.ssid_len)
823 profile_cfg->any_beacon_notify = SCAN_CLIENT_SCHED_SCAN;
821 824
822 for (i = 0; i < req->n_match_sets; i++) { 825 for (i = 0; i < req->n_match_sets; i++) {
823 profile = &profile_cfg->profiles[i]; 826 profile = &profile_cfg->profiles[i];
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c
index d1da93b79cc6..2677d1c0e1a1 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -669,7 +669,7 @@ int iwl_mvm_send_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
669{ 669{
670 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 670 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
671 static const u8 _baddr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; 671 static const u8 _baddr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
672 static const u8 *baddr = _baddr; 672 const u8 *baddr = _baddr;
673 673
674 lockdep_assert_held(&mvm->mutex); 674 lockdep_assert_held(&mvm->mutex);
675 675
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 8d18bf23e4bf..74d60bf27750 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -677,8 +677,14 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
677 rcu_read_lock(); 677 rcu_read_lock();
678 678
679 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); 679 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
680 /*
681 * sta can't be NULL otherwise it'd mean that the sta has been freed in
682 * the firmware while we still have packets for it in the Tx queues.
683 */
684 if (WARN_ON_ONCE(!sta))
685 goto out;
680 686
681 if (!IS_ERR_OR_NULL(sta)) { 687 if (!IS_ERR(sta)) {
682 mvmsta = iwl_mvm_sta_from_mac80211(sta); 688 mvmsta = iwl_mvm_sta_from_mac80211(sta);
683 689
684 if (tid != IWL_TID_NON_QOS) { 690 if (tid != IWL_TID_NON_QOS) {
@@ -698,7 +704,6 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
698 ieee80211_sta_eosp(sta); 704 ieee80211_sta_eosp(sta);
699 } 705 }
700 } else { 706 } else {
701 sta = NULL;
702 mvmsta = NULL; 707 mvmsta = NULL;
703 } 708 }
704 709
@@ -706,42 +711,38 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
706 * If the txq is not an AMPDU queue, there is no chance we freed 711 * If the txq is not an AMPDU queue, there is no chance we freed
707 * several skbs. Check that out... 712 * several skbs. Check that out...
708 */ 713 */
709 if (txq_id < mvm->first_agg_queue && !WARN_ON(skb_freed > 1) && 714 if (txq_id >= mvm->first_agg_queue)
710 atomic_sub_and_test(skb_freed, &mvm->pending_frames[sta_id])) { 715 goto out;
711 if (mvmsta) { 716
712 /* 717 /* We can't free more than one frame at once on a shared queue */
713 * If there are no pending frames for this STA, notify 718 WARN_ON(skb_freed > 1);
714 * mac80211 that this station can go to sleep in its 719
715 * STA table. 720 /* If we have still frames from this STA nothing to do here */
716 */ 721 if (!atomic_sub_and_test(skb_freed, &mvm->pending_frames[sta_id]))
717 if (mvmsta->vif->type == NL80211_IFTYPE_AP) 722 goto out;
718 ieee80211_sta_block_awake(mvm->hw, sta, false); 723
719 /* 724 if (mvmsta && mvmsta->vif->type == NL80211_IFTYPE_AP) {
720 * We might very well have taken mvmsta pointer while 725 /*
721 * the station was being removed. The remove flow might 726 * If there are no pending frames for this STA, notify
722 * have seen a pending_frame (because we didn't take 727 * mac80211 that this station can go to sleep in its
723 * the lock) even if now the queues are drained. So make 728 * STA table.
724 * really sure now that this the station is not being 729 * If mvmsta is not NULL, sta is valid.
725 * removed. If it is, run the drain worker to remove it. 730 */
726 */ 731 ieee80211_sta_block_awake(mvm->hw, sta, false);
727 spin_lock_bh(&mvmsta->lock); 732 }
728 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); 733
729 if (!sta || PTR_ERR(sta) == -EBUSY) { 734 if (PTR_ERR(sta) == -EBUSY || PTR_ERR(sta) == -ENOENT) {
730 /* 735 /*
731 * Station disappeared in the meantime: 736 * We are draining and this was the last packet - pre_rcu_remove
732 * so we are draining. 737 * has been called already. We might be after the
733 */ 738 * synchronize_net already.
734 set_bit(sta_id, mvm->sta_drained); 739 * Don't rely on iwl_mvm_rm_sta to see the empty Tx queues.
735 schedule_work(&mvm->sta_drained_wk); 740 */
736 } 741 set_bit(sta_id, mvm->sta_drained);
737 spin_unlock_bh(&mvmsta->lock); 742 schedule_work(&mvm->sta_drained_wk);
738 } else if (!mvmsta && PTR_ERR(sta) == -EBUSY) {
739 /* Tx response without STA, so we are draining */
740 set_bit(sta_id, mvm->sta_drained);
741 schedule_work(&mvm->sta_drained_wk);
742 }
743 } 743 }
744 744
745out:
745 rcu_read_unlock(); 746 rcu_read_unlock();
746} 747}
747 748
diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c
index f4598cb2dd2e..1493f79e67e0 100644
--- a/drivers/net/wireless/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/iwlwifi/mvm/utils.c
@@ -469,6 +469,8 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm)
469 mvm->status, table.valid); 469 mvm->status, table.valid);
470 } 470 }
471 471
472 IWL_ERR(mvm, "Loaded firmware version: %s\n", mvm->fw->fw_version);
473
472 trace_iwlwifi_dev_ucode_error(trans->dev, table.error_id, table.tsf_low, 474 trace_iwlwifi_dev_ucode_error(trans->dev, table.error_id, table.tsf_low,
473 table.data1, table.data2, table.data3, 475 table.data1, table.data2, table.data3,
474 table.blink1, table.blink2, table.ilink1, 476 table.blink1, table.blink2, table.ilink1,
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
index 85779390c444..0f52e961a5a5 100644
--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -360,20 +360,25 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
360/* 7265 Series */ 360/* 7265 Series */
361 {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, 361 {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)},
362 {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, 362 {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)},
363 {IWL_PCI_DEVICE(0x095A, 0x5112, iwl7265_2ac_cfg)},
364 {IWL_PCI_DEVICE(0x095A, 0x5100, iwl7265_2ac_cfg)},
365 {IWL_PCI_DEVICE(0x095A, 0x510A, iwl7265_2ac_cfg)},
363 {IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)}, 366 {IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)},
364 {IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_2ac_cfg)}, 367 {IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_2ac_cfg)},
365 {IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)}, 368 {IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)},
366 {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)}, 369 {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)},
367 {IWL_PCI_DEVICE(0x095A, 0x500A, iwl7265_2ac_cfg)},
368 {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)}, 370 {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)},
369 {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)}, 371 {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)},
370 {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)}, 372 {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)},
371 {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)}, 373 {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)},
374 {IWL_PCI_DEVICE(0x095A, 0x500A, iwl7265_2n_cfg)},
372 {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)}, 375 {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)},
373 {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)}, 376 {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)},
374 {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, 377 {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)},
375 {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, 378 {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)},
379 {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)},
376 {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, 380 {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)},
381 {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)},
377 {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, 382 {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)},
378 {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)}, 383 {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)},
379 {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)}, 384 {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)},
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index abc5f56f29fe..2f1cd929c6f6 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1877,6 +1877,11 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1877 EEPROM_MAC_ADDR_0)); 1877 EEPROM_MAC_ADDR_0));
1878 1878
1879 /* 1879 /*
1880 * Disable powersaving as default.
1881 */
1882 rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
1883
1884 /*
1880 * Initialize hw_mode information. 1885 * Initialize hw_mode information.
1881 */ 1886 */
1882 spec->supported_bands = SUPPORT_BAND_2GHZ; 1887 spec->supported_bands = SUPPORT_BAND_2GHZ;
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 9f16824cd1bc..d849d590de25 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1706,6 +1706,11 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1706 IEEE80211_HW_SUPPORTS_PS | 1706 IEEE80211_HW_SUPPORTS_PS |
1707 IEEE80211_HW_PS_NULLFUNC_STACK; 1707 IEEE80211_HW_PS_NULLFUNC_STACK;
1708 1708
1709 /*
1710 * Disable powersaving as default.
1711 */
1712 rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
1713
1709 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); 1714 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
1710 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, 1715 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
1711 rt2x00_eeprom_addr(rt2x00dev, 1716 rt2x00_eeprom_addr(rt2x00dev,
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index b8f5b06006c4..7f8b5d156c8c 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -7458,10 +7458,9 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
7458 u32 reg; 7458 u32 reg;
7459 7459
7460 /* 7460 /*
7461 * Disable powersaving as default on PCI devices. 7461 * Disable powersaving as default.
7462 */ 7462 */
7463 if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) 7463 rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
7464 rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
7465 7464
7466 /* 7465 /*
7467 * Initialize all hw fields. 7466 * Initialize all hw fields.
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c
index 9bc843e9f4b4..7980ab1f9eca 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
@@ -107,6 +107,7 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev)
107 struct rtl8180_priv *priv = dev->priv; 107 struct rtl8180_priv *priv = dev->priv;
108 unsigned int count = 32; 108 unsigned int count = 32;
109 u8 signal, agc, sq; 109 u8 signal, agc, sq;
110 dma_addr_t mapping;
110 111
111 while (count--) { 112 while (count--) {
112 struct rtl8180_rx_desc *entry = &priv->rx_ring[priv->rx_idx]; 113 struct rtl8180_rx_desc *entry = &priv->rx_ring[priv->rx_idx];
@@ -128,6 +129,17 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev)
128 if (unlikely(!new_skb)) 129 if (unlikely(!new_skb))
129 goto done; 130 goto done;
130 131
132 mapping = pci_map_single(priv->pdev,
133 skb_tail_pointer(new_skb),
134 MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
135
136 if (pci_dma_mapping_error(priv->pdev, mapping)) {
137 kfree_skb(new_skb);
138 dev_err(&priv->pdev->dev, "RX DMA map error\n");
139
140 goto done;
141 }
142
131 pci_unmap_single(priv->pdev, 143 pci_unmap_single(priv->pdev,
132 *((dma_addr_t *)skb->cb), 144 *((dma_addr_t *)skb->cb),
133 MAX_RX_SIZE, PCI_DMA_FROMDEVICE); 145 MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
@@ -158,9 +170,7 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev)
158 170
159 skb = new_skb; 171 skb = new_skb;
160 priv->rx_buf[priv->rx_idx] = skb; 172 priv->rx_buf[priv->rx_idx] = skb;
161 *((dma_addr_t *) skb->cb) = 173 *((dma_addr_t *) skb->cb) = mapping;
162 pci_map_single(priv->pdev, skb_tail_pointer(skb),
163 MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
164 } 174 }
165 175
166 done: 176 done:
@@ -266,6 +276,13 @@ static void rtl8180_tx(struct ieee80211_hw *dev,
266 mapping = pci_map_single(priv->pdev, skb->data, 276 mapping = pci_map_single(priv->pdev, skb->data,
267 skb->len, PCI_DMA_TODEVICE); 277 skb->len, PCI_DMA_TODEVICE);
268 278
279 if (pci_dma_mapping_error(priv->pdev, mapping)) {
280 kfree_skb(skb);
281 dev_err(&priv->pdev->dev, "TX DMA mapping error\n");
282 return;
283
284 }
285
269 tx_flags = RTL818X_TX_DESC_FLAG_OWN | RTL818X_TX_DESC_FLAG_FS | 286 tx_flags = RTL818X_TX_DESC_FLAG_OWN | RTL818X_TX_DESC_FLAG_FS |
270 RTL818X_TX_DESC_FLAG_LS | 287 RTL818X_TX_DESC_FLAG_LS |
271 (ieee80211_get_tx_rate(dev, info)->hw_value << 24) | 288 (ieee80211_get_tx_rate(dev, info)->hw_value << 24) |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6973ccdd230b..363d19b5d5c8 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1021,8 +1021,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
1021 IEEE80211_P2P_OPPPS_ENABLE_BIT; 1021 IEEE80211_P2P_OPPPS_ENABLE_BIT;
1022 1022
1023 err = ieee80211_assign_beacon(sdata, &params->beacon); 1023 err = ieee80211_assign_beacon(sdata, &params->beacon);
1024 if (err < 0) 1024 if (err < 0) {
1025 ieee80211_vif_release_channel(sdata);
1025 return err; 1026 return err;
1027 }
1026 changed |= err; 1028 changed |= err;
1027 1029
1028 err = drv_start_ap(sdata->local, sdata); 1030 err = drv_start_ap(sdata->local, sdata);
@@ -1032,6 +1034,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
1032 if (old) 1034 if (old)
1033 kfree_rcu(old, rcu_head); 1035 kfree_rcu(old, rcu_head);
1034 RCU_INIT_POINTER(sdata->u.ap.beacon, NULL); 1036 RCU_INIT_POINTER(sdata->u.ap.beacon, NULL);
1037 ieee80211_vif_release_channel(sdata);
1035 return err; 1038 return err;
1036 } 1039 }
1037 1040
@@ -1093,8 +1096,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
1093 kfree(sdata->u.ap.next_beacon); 1096 kfree(sdata->u.ap.next_beacon);
1094 sdata->u.ap.next_beacon = NULL; 1097 sdata->u.ap.next_beacon = NULL;
1095 1098
1096 cancel_work_sync(&sdata->u.ap.request_smps_work);
1097
1098 /* turn off carrier for this interface and dependent VLANs */ 1099 /* turn off carrier for this interface and dependent VLANs */
1099 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) 1100 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
1100 netif_carrier_off(vlan->dev); 1101 netif_carrier_off(vlan->dev);
@@ -1106,6 +1107,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
1106 kfree_rcu(old_beacon, rcu_head); 1107 kfree_rcu(old_beacon, rcu_head);
1107 if (old_probe_resp) 1108 if (old_probe_resp)
1108 kfree_rcu(old_probe_resp, rcu_head); 1109 kfree_rcu(old_probe_resp, rcu_head);
1110 sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
1109 1111
1110 __sta_info_flush(sdata, true); 1112 __sta_info_flush(sdata, true);
1111 ieee80211_free_keys(sdata, true); 1113 ieee80211_free_keys(sdata, true);
@@ -2665,6 +2667,24 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2665 INIT_DELAYED_WORK(&roc->work, ieee80211_sw_roc_work); 2667 INIT_DELAYED_WORK(&roc->work, ieee80211_sw_roc_work);
2666 INIT_LIST_HEAD(&roc->dependents); 2668 INIT_LIST_HEAD(&roc->dependents);
2667 2669
2670 /*
2671 * cookie is either the roc cookie (for normal roc)
2672 * or the SKB (for mgmt TX)
2673 */
2674 if (!txskb) {
2675 /* local->mtx protects this */
2676 local->roc_cookie_counter++;
2677 roc->cookie = local->roc_cookie_counter;
2678 /* wow, you wrapped 64 bits ... more likely a bug */
2679 if (WARN_ON(roc->cookie == 0)) {
2680 roc->cookie = 1;
2681 local->roc_cookie_counter++;
2682 }
2683 *cookie = roc->cookie;
2684 } else {
2685 *cookie = (unsigned long)txskb;
2686 }
2687
2668 /* if there's one pending or we're scanning, queue this one */ 2688 /* if there's one pending or we're scanning, queue this one */
2669 if (!list_empty(&local->roc_list) || 2689 if (!list_empty(&local->roc_list) ||
2670 local->scanning || local->radar_detect_enabled) 2690 local->scanning || local->radar_detect_enabled)
@@ -2787,24 +2807,6 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2787 if (!queued) 2807 if (!queued)
2788 list_add_tail(&roc->list, &local->roc_list); 2808 list_add_tail(&roc->list, &local->roc_list);
2789 2809
2790 /*
2791 * cookie is either the roc cookie (for normal roc)
2792 * or the SKB (for mgmt TX)
2793 */
2794 if (!txskb) {
2795 /* local->mtx protects this */
2796 local->roc_cookie_counter++;
2797 roc->cookie = local->roc_cookie_counter;
2798 /* wow, you wrapped 64 bits ... more likely a bug */
2799 if (WARN_ON(roc->cookie == 0)) {
2800 roc->cookie = 1;
2801 local->roc_cookie_counter++;
2802 }
2803 *cookie = roc->cookie;
2804 } else {
2805 *cookie = (unsigned long)txskb;
2806 }
2807
2808 return 0; 2810 return 0;
2809} 2811}
2810 2812
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index dc3c28002e3e..afbe2b203c3e 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -466,7 +466,9 @@ void ieee80211_request_smps_ap_work(struct work_struct *work)
466 u.ap.request_smps_work); 466 u.ap.request_smps_work);
467 467
468 sdata_lock(sdata); 468 sdata_lock(sdata);
469 __ieee80211_request_smps_ap(sdata, sdata->u.ap.driver_smps_mode); 469 if (sdata_dereference(sdata->u.ap.beacon, sdata))
470 __ieee80211_request_smps_ap(sdata,
471 sdata->u.ap.driver_smps_mode);
470 sdata_unlock(sdata); 472 sdata_unlock(sdata);
471} 473}
472 474
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 9c84b75f3de8..4453e2725e40 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -684,12 +684,9 @@ static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata)
684 struct cfg80211_bss *cbss; 684 struct cfg80211_bss *cbss;
685 struct beacon_data *presp; 685 struct beacon_data *presp;
686 struct sta_info *sta; 686 struct sta_info *sta;
687 int active_ibss;
688 u16 capability; 687 u16 capability;
689 688
690 active_ibss = ieee80211_sta_active_ibss(sdata); 689 if (!is_zero_ether_addr(ifibss->bssid)) {
691
692 if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) {
693 capability = WLAN_CAPABILITY_IBSS; 690 capability = WLAN_CAPABILITY_IBSS;
694 691
695 if (ifibss->privacy) 692 if (ifibss->privacy)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 8880bc8fce0d..96518ad200c4 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -418,20 +418,24 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
418 return ret; 418 return ret;
419 } 419 }
420 420
421 mutex_lock(&local->iflist_mtx);
422 rcu_assign_pointer(local->monitor_sdata, sdata);
423 mutex_unlock(&local->iflist_mtx);
424
421 mutex_lock(&local->mtx); 425 mutex_lock(&local->mtx);
422 ret = ieee80211_vif_use_channel(sdata, &local->monitor_chandef, 426 ret = ieee80211_vif_use_channel(sdata, &local->monitor_chandef,
423 IEEE80211_CHANCTX_EXCLUSIVE); 427 IEEE80211_CHANCTX_EXCLUSIVE);
424 mutex_unlock(&local->mtx); 428 mutex_unlock(&local->mtx);
425 if (ret) { 429 if (ret) {
430 mutex_lock(&local->iflist_mtx);
431 rcu_assign_pointer(local->monitor_sdata, NULL);
432 mutex_unlock(&local->iflist_mtx);
433 synchronize_net();
426 drv_remove_interface(local, sdata); 434 drv_remove_interface(local, sdata);
427 kfree(sdata); 435 kfree(sdata);
428 return ret; 436 return ret;
429 } 437 }
430 438
431 mutex_lock(&local->iflist_mtx);
432 rcu_assign_pointer(local->monitor_sdata, sdata);
433 mutex_unlock(&local->iflist_mtx);
434
435 return 0; 439 return 0;
436} 440}
437 441
@@ -770,12 +774,19 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
770 774
771 ieee80211_roc_purge(local, sdata); 775 ieee80211_roc_purge(local, sdata);
772 776
773 if (sdata->vif.type == NL80211_IFTYPE_STATION) 777 switch (sdata->vif.type) {
778 case NL80211_IFTYPE_STATION:
774 ieee80211_mgd_stop(sdata); 779 ieee80211_mgd_stop(sdata);
775 780 break;
776 if (sdata->vif.type == NL80211_IFTYPE_ADHOC) 781 case NL80211_IFTYPE_ADHOC:
777 ieee80211_ibss_stop(sdata); 782 ieee80211_ibss_stop(sdata);
778 783 break;
784 case NL80211_IFTYPE_AP:
785 cancel_work_sync(&sdata->u.ap.request_smps_work);
786 break;
787 default:
788 break;
789 }
779 790
780 /* 791 /*
781 * Remove all stations associated with this interface. 792 * Remove all stations associated with this interface.
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 5476a69b45c9..722151fa5dce 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -874,7 +874,7 @@ static int ieee80211_fragment(struct ieee80211_tx_data *tx,
874 } 874 }
875 875
876 /* adjust first fragment's length */ 876 /* adjust first fragment's length */
877 skb->len = hdrlen + per_fragm; 877 skb_trim(skb, hdrlen + per_fragm);
878 return 0; 878 return 0;
879} 879}
880 880
diff --git a/net/wireless/core.c b/net/wireless/core.c
index b5ff39a6f6ed..76ae6a605abb 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -203,8 +203,11 @@ void cfg80211_stop_p2p_device(struct cfg80211_registered_device *rdev,
203 203
204 rdev->opencount--; 204 rdev->opencount--;
205 205
206 WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev && 206 if (rdev->scan_req && rdev->scan_req->wdev == wdev) {
207 !rdev->scan_req->notified); 207 if (WARN_ON(!rdev->scan_req->notified))
208 rdev->scan_req->aborted = true;
209 ___cfg80211_scan_done(rdev, false);
210 }
208} 211}
209 212
210static int cfg80211_rfkill_set_block(void *data, bool blocked) 213static int cfg80211_rfkill_set_block(void *data, bool blocked)
@@ -440,9 +443,6 @@ int wiphy_register(struct wiphy *wiphy)
440 int i; 443 int i;
441 u16 ifmodes = wiphy->interface_modes; 444 u16 ifmodes = wiphy->interface_modes;
442 445
443 /* support for 5/10 MHz is broken due to nl80211 API mess - disable */
444 wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_5_10_MHZ;
445
446 /* 446 /*
447 * There are major locking problems in nl80211/mac80211 for CSA, 447 * There are major locking problems in nl80211/mac80211 for CSA,
448 * disable for all drivers until this has been reworked. 448 * disable for all drivers until this has been reworked.
@@ -859,8 +859,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
859 break; 859 break;
860 case NETDEV_DOWN: 860 case NETDEV_DOWN:
861 cfg80211_update_iface_num(rdev, wdev->iftype, -1); 861 cfg80211_update_iface_num(rdev, wdev->iftype, -1);
862 WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev && 862 if (rdev->scan_req && rdev->scan_req->wdev == wdev) {
863 !rdev->scan_req->notified); 863 if (WARN_ON(!rdev->scan_req->notified))
864 rdev->scan_req->aborted = true;
865 ___cfg80211_scan_done(rdev, false);
866 }
864 867
865 if (WARN_ON(rdev->sched_scan_req && 868 if (WARN_ON(rdev->sched_scan_req &&
866 rdev->sched_scan_req->dev == wdev->netdev)) { 869 rdev->sched_scan_req->dev == wdev->netdev)) {
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 9895ab16c051..40683004d523 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -62,6 +62,7 @@ struct cfg80211_registered_device {
62 struct rb_root bss_tree; 62 struct rb_root bss_tree;
63 u32 bss_generation; 63 u32 bss_generation;
64 struct cfg80211_scan_request *scan_req; /* protected by RTNL */ 64 struct cfg80211_scan_request *scan_req; /* protected by RTNL */
65 struct sk_buff *scan_msg;
65 struct cfg80211_sched_scan_request *sched_scan_req; 66 struct cfg80211_sched_scan_request *sched_scan_req;
66 unsigned long suspend_at; 67 unsigned long suspend_at;
67 struct work_struct scan_done_wk; 68 struct work_struct scan_done_wk;
@@ -363,7 +364,8 @@ int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev,
363 struct key_params *params, int key_idx, 364 struct key_params *params, int key_idx,
364 bool pairwise, const u8 *mac_addr); 365 bool pairwise, const u8 *mac_addr);
365void __cfg80211_scan_done(struct work_struct *wk); 366void __cfg80211_scan_done(struct work_struct *wk);
366void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev); 367void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev,
368 bool send_message);
367void __cfg80211_sched_scan_results(struct work_struct *wk); 369void __cfg80211_sched_scan_results(struct work_struct *wk);
368int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev, 370int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
369 bool driver_initiated); 371 bool driver_initiated);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ebea1a197afb..8e6b6a2d35cb 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1740,9 +1740,10 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
1740 * We can then retry with the larger buffer. 1740 * We can then retry with the larger buffer.
1741 */ 1741 */
1742 if ((ret == -ENOBUFS || ret == -EMSGSIZE) && 1742 if ((ret == -ENOBUFS || ret == -EMSGSIZE) &&
1743 !skb->len && 1743 !skb->len && !state->split &&
1744 cb->min_dump_alloc < 4096) { 1744 cb->min_dump_alloc < 4096) {
1745 cb->min_dump_alloc = 4096; 1745 cb->min_dump_alloc = 4096;
1746 state->split_start = 0;
1746 rtnl_unlock(); 1747 rtnl_unlock();
1747 return 1; 1748 return 1;
1748 } 1749 }
@@ -5274,7 +5275,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
5274 if (!rdev->ops->scan) 5275 if (!rdev->ops->scan)
5275 return -EOPNOTSUPP; 5276 return -EOPNOTSUPP;
5276 5277
5277 if (rdev->scan_req) { 5278 if (rdev->scan_req || rdev->scan_msg) {
5278 err = -EBUSY; 5279 err = -EBUSY;
5279 goto unlock; 5280 goto unlock;
5280 } 5281 }
@@ -10116,40 +10117,31 @@ void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
10116 NL80211_MCGRP_SCAN, GFP_KERNEL); 10117 NL80211_MCGRP_SCAN, GFP_KERNEL);
10117} 10118}
10118 10119
10119void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, 10120struct sk_buff *nl80211_build_scan_msg(struct cfg80211_registered_device *rdev,
10120 struct wireless_dev *wdev) 10121 struct wireless_dev *wdev, bool aborted)
10121{ 10122{
10122 struct sk_buff *msg; 10123 struct sk_buff *msg;
10123 10124
10124 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 10125 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
10125 if (!msg) 10126 if (!msg)
10126 return; 10127 return NULL;
10127 10128
10128 if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0, 10129 if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0,
10129 NL80211_CMD_NEW_SCAN_RESULTS) < 0) { 10130 aborted ? NL80211_CMD_SCAN_ABORTED :
10131 NL80211_CMD_NEW_SCAN_RESULTS) < 0) {
10130 nlmsg_free(msg); 10132 nlmsg_free(msg);
10131 return; 10133 return NULL;
10132 } 10134 }
10133 10135
10134 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, 10136 return msg;
10135 NL80211_MCGRP_SCAN, GFP_KERNEL);
10136} 10137}
10137 10138
10138void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, 10139void nl80211_send_scan_result(struct cfg80211_registered_device *rdev,
10139 struct wireless_dev *wdev) 10140 struct sk_buff *msg)
10140{ 10141{
10141 struct sk_buff *msg;
10142
10143 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
10144 if (!msg) 10142 if (!msg)
10145 return; 10143 return;
10146 10144
10147 if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0,
10148 NL80211_CMD_SCAN_ABORTED) < 0) {
10149 nlmsg_free(msg);
10150 return;
10151 }
10152
10153 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, 10145 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
10154 NL80211_MCGRP_SCAN, GFP_KERNEL); 10146 NL80211_MCGRP_SCAN, GFP_KERNEL);
10155} 10147}
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index cb0216e1a004..1e6df9630f42 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -8,10 +8,10 @@ void nl80211_exit(void);
8void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev); 8void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev);
9void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, 9void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
10 struct wireless_dev *wdev); 10 struct wireless_dev *wdev);
11void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, 11struct sk_buff *nl80211_build_scan_msg(struct cfg80211_registered_device *rdev,
12 struct wireless_dev *wdev); 12 struct wireless_dev *wdev, bool aborted);
13void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, 13void nl80211_send_scan_result(struct cfg80211_registered_device *rdev,
14 struct wireless_dev *wdev); 14 struct sk_buff *msg);
15void nl80211_send_sched_scan(struct cfg80211_registered_device *rdev, 15void nl80211_send_sched_scan(struct cfg80211_registered_device *rdev,
16 struct net_device *netdev, u32 cmd); 16 struct net_device *netdev, u32 cmd);
17void nl80211_send_sched_scan_results(struct cfg80211_registered_device *rdev, 17void nl80211_send_sched_scan_results(struct cfg80211_registered_device *rdev,
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index b528e31da2cf..d1ed4aebbbb7 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -161,18 +161,25 @@ static void __cfg80211_bss_expire(struct cfg80211_registered_device *dev,
161 dev->bss_generation++; 161 dev->bss_generation++;
162} 162}
163 163
164void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev) 164void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev,
165 bool send_message)
165{ 166{
166 struct cfg80211_scan_request *request; 167 struct cfg80211_scan_request *request;
167 struct wireless_dev *wdev; 168 struct wireless_dev *wdev;
169 struct sk_buff *msg;
168#ifdef CONFIG_CFG80211_WEXT 170#ifdef CONFIG_CFG80211_WEXT
169 union iwreq_data wrqu; 171 union iwreq_data wrqu;
170#endif 172#endif
171 173
172 ASSERT_RTNL(); 174 ASSERT_RTNL();
173 175
174 request = rdev->scan_req; 176 if (rdev->scan_msg) {
177 nl80211_send_scan_result(rdev, rdev->scan_msg);
178 rdev->scan_msg = NULL;
179 return;
180 }
175 181
182 request = rdev->scan_req;
176 if (!request) 183 if (!request)
177 return; 184 return;
178 185
@@ -186,18 +193,16 @@ void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev)
186 if (wdev->netdev) 193 if (wdev->netdev)
187 cfg80211_sme_scan_done(wdev->netdev); 194 cfg80211_sme_scan_done(wdev->netdev);
188 195
189 if (request->aborted) { 196 if (!request->aborted &&
190 nl80211_send_scan_aborted(rdev, wdev); 197 request->flags & NL80211_SCAN_FLAG_FLUSH) {
191 } else { 198 /* flush entries from previous scans */
192 if (request->flags & NL80211_SCAN_FLAG_FLUSH) { 199 spin_lock_bh(&rdev->bss_lock);
193 /* flush entries from previous scans */ 200 __cfg80211_bss_expire(rdev, request->scan_start);
194 spin_lock_bh(&rdev->bss_lock); 201 spin_unlock_bh(&rdev->bss_lock);
195 __cfg80211_bss_expire(rdev, request->scan_start);
196 spin_unlock_bh(&rdev->bss_lock);
197 }
198 nl80211_send_scan_done(rdev, wdev);
199 } 202 }
200 203
204 msg = nl80211_build_scan_msg(rdev, wdev, request->aborted);
205
201#ifdef CONFIG_CFG80211_WEXT 206#ifdef CONFIG_CFG80211_WEXT
202 if (wdev->netdev && !request->aborted) { 207 if (wdev->netdev && !request->aborted) {
203 memset(&wrqu, 0, sizeof(wrqu)); 208 memset(&wrqu, 0, sizeof(wrqu));
@@ -211,6 +216,11 @@ void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev)
211 216
212 rdev->scan_req = NULL; 217 rdev->scan_req = NULL;
213 kfree(request); 218 kfree(request);
219
220 if (!send_message)
221 rdev->scan_msg = msg;
222 else
223 nl80211_send_scan_result(rdev, msg);
214} 224}
215 225
216void __cfg80211_scan_done(struct work_struct *wk) 226void __cfg80211_scan_done(struct work_struct *wk)
@@ -221,7 +231,7 @@ void __cfg80211_scan_done(struct work_struct *wk)
221 scan_done_wk); 231 scan_done_wk);
222 232
223 rtnl_lock(); 233 rtnl_lock();
224 ___cfg80211_scan_done(rdev); 234 ___cfg80211_scan_done(rdev, true);
225 rtnl_unlock(); 235 rtnl_unlock();
226} 236}
227 237
@@ -1079,7 +1089,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
1079 if (IS_ERR(rdev)) 1089 if (IS_ERR(rdev))
1080 return PTR_ERR(rdev); 1090 return PTR_ERR(rdev);
1081 1091
1082 if (rdev->scan_req) { 1092 if (rdev->scan_req || rdev->scan_msg) {
1083 err = -EBUSY; 1093 err = -EBUSY;
1084 goto out; 1094 goto out;
1085 } 1095 }
@@ -1481,7 +1491,7 @@ int cfg80211_wext_giwscan(struct net_device *dev,
1481 if (IS_ERR(rdev)) 1491 if (IS_ERR(rdev))
1482 return PTR_ERR(rdev); 1492 return PTR_ERR(rdev);
1483 1493
1484 if (rdev->scan_req) 1494 if (rdev->scan_req || rdev->scan_msg)
1485 return -EAGAIN; 1495 return -EAGAIN;
1486 1496
1487 res = ieee80211_scan_results(rdev, info, extra, data->length); 1497 res = ieee80211_scan_results(rdev, info, extra, data->length);
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index a63509118508..f04d4c32e96e 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -67,7 +67,7 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
67 ASSERT_RDEV_LOCK(rdev); 67 ASSERT_RDEV_LOCK(rdev);
68 ASSERT_WDEV_LOCK(wdev); 68 ASSERT_WDEV_LOCK(wdev);
69 69
70 if (rdev->scan_req) 70 if (rdev->scan_req || rdev->scan_msg)
71 return -EBUSY; 71 return -EBUSY;
72 72
73 if (wdev->conn->params.channel) 73 if (wdev->conn->params.channel)