aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2012-06-29 12:42:14 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-06-29 12:42:14 -0400
commit8732baafc3f19e69df683c3f0f36c13cec746fb9 (patch)
tree9059d0fe8f2a49425edab88ea8e7d5337e13e66c /drivers/net/wireless/iwlwifi
parent7a9bc9b81a5bc6e44ebc80ef781332e4385083f2 (diff)
parent42fb0b0278e6b9a44bee8adec051de5f43e10b2b (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts: drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/agn.h2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/dev.h2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/devices.c13
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/lib.c2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/mac80211.c55
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/main.c29
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/scan.c47
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-notif-wait.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-op-mode.h16
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/rx.c30
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c19
12 files changed, 117 insertions, 106 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/agn.h b/drivers/net/wireless/iwlwifi/dvm/agn.h
index 6d102413dd94..9bb16bdf6d26 100644
--- a/drivers/net/wireless/iwlwifi/dvm/agn.h
+++ b/drivers/net/wireless/iwlwifi/dvm/agn.h
@@ -269,7 +269,7 @@ void iwl_scan_offchannel_skb_status(struct iwl_priv *priv);
269#define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */ 269#define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */
270#define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */ 270#define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */
271 271
272#define IWL_SCAN_CHECK_WATCHDOG (HZ * 7) 272#define IWL_SCAN_CHECK_WATCHDOG (HZ * 15)
273 273
274 274
275/* bt coex */ 275/* bt coex */
diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h
index 4620b657948a..54cf085ddc89 100644
--- a/drivers/net/wireless/iwlwifi/dvm/dev.h
+++ b/drivers/net/wireless/iwlwifi/dvm/dev.h
@@ -568,7 +568,6 @@ enum iwl_scan_type {
568 * 568 *
569 * @tx_chains_num: Number of TX chains 569 * @tx_chains_num: Number of TX chains
570 * @rx_chains_num: Number of RX chains 570 * @rx_chains_num: Number of RX chains
571 * @sku: sku read from EEPROM
572 * @ct_kill_threshold: temperature threshold - in hw dependent unit 571 * @ct_kill_threshold: temperature threshold - in hw dependent unit
573 * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit 572 * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit
574 * relevant for 1000, 6000 and up 573 * relevant for 1000, 6000 and up
@@ -579,7 +578,6 @@ struct iwl_hw_params {
579 u8 tx_chains_num; 578 u8 tx_chains_num;
580 u8 rx_chains_num; 579 u8 rx_chains_num;
581 bool use_rts_for_aggregation; 580 bool use_rts_for_aggregation;
582 u16 sku;
583 u32 ct_kill_threshold; 581 u32 ct_kill_threshold;
584 u32 ct_kill_exit_threshold; 582 u32 ct_kill_exit_threshold;
585 583
diff --git a/drivers/net/wireless/iwlwifi/dvm/devices.c b/drivers/net/wireless/iwlwifi/dvm/devices.c
index 0521a6be09d2..349c205d5f62 100644
--- a/drivers/net/wireless/iwlwifi/dvm/devices.c
+++ b/drivers/net/wireless/iwlwifi/dvm/devices.c
@@ -250,17 +250,6 @@ struct iwl_lib_ops iwl2030_lib = {
250 */ 250 */
251 251
252/* NIC configuration for 5000 series */ 252/* NIC configuration for 5000 series */
253static void iwl5000_nic_config(struct iwl_priv *priv)
254{
255 /* W/A : NIC is stuck in a reset state after Early PCIe power off
256 * (PCIe power is lost before PERST# is asserted),
257 * causing ME FW to lose ownership and not being able to obtain it back.
258 */
259 iwl_set_bits_mask_prph(priv->trans, APMG_PS_CTRL_REG,
260 APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
261 ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
262}
263
264static const struct iwl_sensitivity_ranges iwl5000_sensitivity = { 253static const struct iwl_sensitivity_ranges iwl5000_sensitivity = {
265 .min_nrg_cck = 100, 254 .min_nrg_cck = 100,
266 .auto_corr_min_ofdm = 90, 255 .auto_corr_min_ofdm = 90,
@@ -433,14 +422,12 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
433struct iwl_lib_ops iwl5000_lib = { 422struct iwl_lib_ops iwl5000_lib = {
434 .set_hw_params = iwl5000_hw_set_hw_params, 423 .set_hw_params = iwl5000_hw_set_hw_params,
435 .set_channel_switch = iwl5000_hw_channel_switch, 424 .set_channel_switch = iwl5000_hw_channel_switch,
436 .nic_config = iwl5000_nic_config,
437 .temperature = iwlagn_temperature, 425 .temperature = iwlagn_temperature,
438}; 426};
439 427
440struct iwl_lib_ops iwl5150_lib = { 428struct iwl_lib_ops iwl5150_lib = {
441 .set_hw_params = iwl5150_hw_set_hw_params, 429 .set_hw_params = iwl5150_hw_set_hw_params,
442 .set_channel_switch = iwl5000_hw_channel_switch, 430 .set_channel_switch = iwl5000_hw_channel_switch,
443 .nic_config = iwl5000_nic_config,
444 .temperature = iwl5150_temperature, 431 .temperature = iwl5150_temperature,
445}; 432};
446 433
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c
index 76f259283c3a..207ae91a83aa 100644
--- a/drivers/net/wireless/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/lib.c
@@ -160,7 +160,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
160 IWL_PAN_SCD_BK_MSK | IWL_PAN_SCD_MGMT_MSK | 160 IWL_PAN_SCD_BK_MSK | IWL_PAN_SCD_MGMT_MSK |
161 IWL_PAN_SCD_MULTICAST_MSK; 161 IWL_PAN_SCD_MULTICAST_MSK;
162 162
163 if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE) 163 if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE)
164 flush_cmd.fifo_control |= IWL_AGG_TX_QUEUE_MSK; 164 flush_cmd.fifo_control |= IWL_AGG_TX_QUEUE_MSK;
165 165
166 IWL_DEBUG_INFO(priv, "fifo queue control: 0X%x\n", 166 IWL_DEBUG_INFO(priv, "fifo queue control: 0X%x\n",
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
index 2f10346c6ba1..a5f7bce96325 100644
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
@@ -164,7 +164,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
164 hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF; 164 hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
165 */ 165 */
166 166
167 if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE) 167 if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE)
168 hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | 168 hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
169 IEEE80211_HW_SUPPORTS_STATIC_SMPS; 169 IEEE80211_HW_SUPPORTS_STATIC_SMPS;
170 170
@@ -649,7 +649,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
649 IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", 649 IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n",
650 sta->addr, tid); 650 sta->addr, tid);
651 651
652 if (!(priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE)) 652 if (!(priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE))
653 return -EACCES; 653 return -EACCES;
654 654
655 IWL_DEBUG_MAC80211(priv, "enter\n"); 655 IWL_DEBUG_MAC80211(priv, "enter\n");
@@ -1048,8 +1048,18 @@ static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw,
1048 mutex_lock(&priv->mutex); 1048 mutex_lock(&priv->mutex);
1049 1049
1050 if (test_bit(STATUS_SCAN_HW, &priv->status)) { 1050 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
1051 err = -EBUSY; 1051 /* mac80211 should not scan while ROC or ROC while scanning */
1052 goto out; 1052 if (WARN_ON_ONCE(priv->scan_type != IWL_SCAN_RADIO_RESET)) {
1053 err = -EBUSY;
1054 goto out;
1055 }
1056
1057 iwl_scan_cancel_timeout(priv, 100);
1058
1059 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
1060 err = -EBUSY;
1061 goto out;
1062 }
1053 } 1063 }
1054 1064
1055 priv->hw_roc_channel = channel; 1065 priv->hw_roc_channel = channel;
@@ -1413,13 +1423,11 @@ static void iwlagn_mac_remove_interface(struct ieee80211_hw *hw,
1413} 1423}
1414 1424
1415static int iwlagn_mac_change_interface(struct ieee80211_hw *hw, 1425static int iwlagn_mac_change_interface(struct ieee80211_hw *hw,
1416 struct ieee80211_vif *vif, 1426 struct ieee80211_vif *vif,
1417 enum nl80211_iftype newtype, bool newp2p) 1427 enum nl80211_iftype newtype, bool newp2p)
1418{ 1428{
1419 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); 1429 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1420 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 1430 struct iwl_rxon_context *ctx, *tmp;
1421 struct iwl_rxon_context *bss_ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1422 struct iwl_rxon_context *tmp;
1423 enum nl80211_iftype newviftype = newtype; 1431 enum nl80211_iftype newviftype = newtype;
1424 u32 interface_modes; 1432 u32 interface_modes;
1425 int err; 1433 int err;
@@ -1430,6 +1438,18 @@ static int iwlagn_mac_change_interface(struct ieee80211_hw *hw,
1430 1438
1431 mutex_lock(&priv->mutex); 1439 mutex_lock(&priv->mutex);
1432 1440
1441 ctx = iwl_rxon_ctx_from_vif(vif);
1442
1443 /*
1444 * To simplify this code, only support changes on the
1445 * BSS context. The PAN context is usually reassigned
1446 * by creating/removing P2P interfaces anyway.
1447 */
1448 if (ctx->ctxid != IWL_RXON_CTX_BSS) {
1449 err = -EBUSY;
1450 goto out;
1451 }
1452
1433 if (!ctx->vif || !iwl_is_ready_rf(priv)) { 1453 if (!ctx->vif || !iwl_is_ready_rf(priv)) {
1434 /* 1454 /*
1435 * Huh? But wait ... this can maybe happen when 1455 * Huh? But wait ... this can maybe happen when
@@ -1439,32 +1459,19 @@ static int iwlagn_mac_change_interface(struct ieee80211_hw *hw,
1439 goto out; 1459 goto out;
1440 } 1460 }
1441 1461
1462 /* Check if the switch is supported in the same context */
1442 interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; 1463 interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes;
1443
1444 if (!(interface_modes & BIT(newtype))) { 1464 if (!(interface_modes & BIT(newtype))) {
1445 err = -EBUSY; 1465 err = -EBUSY;
1446 goto out; 1466 goto out;
1447 } 1467 }
1448 1468
1449 /*
1450 * Refuse a change that should be done by moving from the PAN
1451 * context to the BSS context instead, if the BSS context is
1452 * available and can support the new interface type.
1453 */
1454 if (ctx->ctxid == IWL_RXON_CTX_PAN && !bss_ctx->vif &&
1455 (bss_ctx->interface_modes & BIT(newtype) ||
1456 bss_ctx->exclusive_interface_modes & BIT(newtype))) {
1457 BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
1458 err = -EBUSY;
1459 goto out;
1460 }
1461
1462 if (ctx->exclusive_interface_modes & BIT(newtype)) { 1469 if (ctx->exclusive_interface_modes & BIT(newtype)) {
1463 for_each_context(priv, tmp) { 1470 for_each_context(priv, tmp) {
1464 if (ctx == tmp) 1471 if (ctx == tmp)
1465 continue; 1472 continue;
1466 1473
1467 if (!tmp->vif) 1474 if (!tmp->is_active)
1468 continue; 1475 continue;
1469 1476
1470 /* 1477 /*
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c
index e620af3d592d..abfd7916bde6 100644
--- a/drivers/net/wireless/iwlwifi/dvm/main.c
+++ b/drivers/net/wireless/iwlwifi/dvm/main.c
@@ -51,11 +51,13 @@
51#include "iwl-op-mode.h" 51#include "iwl-op-mode.h"
52#include "iwl-drv.h" 52#include "iwl-drv.h"
53#include "iwl-modparams.h" 53#include "iwl-modparams.h"
54#include "iwl-prph.h"
54 55
55#include "dev.h" 56#include "dev.h"
56#include "calib.h" 57#include "calib.h"
57#include "agn.h" 58#include "agn.h"
58 59
60
59/****************************************************************************** 61/******************************************************************************
60 * 62 *
61 * module boiler plate 63 * module boiler plate
@@ -1185,9 +1187,6 @@ static void iwl_set_hw_params(struct iwl_priv *priv)
1185 priv->hw_params.use_rts_for_aggregation = 1187 priv->hw_params.use_rts_for_aggregation =
1186 priv->cfg->ht_params->use_rts_for_aggregation; 1188 priv->cfg->ht_params->use_rts_for_aggregation;
1187 1189
1188 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL)
1189 priv->hw_params.sku &= ~EEPROM_SKU_CAP_11N_ENABLE;
1190
1191 /* Device-specific setup */ 1190 /* Device-specific setup */
1192 priv->lib->set_hw_params(priv); 1191 priv->lib->set_hw_params(priv);
1193} 1192}
@@ -1232,20 +1231,20 @@ static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
1232{ 1231{
1233 u16 radio_cfg; 1232 u16 radio_cfg;
1234 1233
1235 priv->hw_params.sku = priv->eeprom_data->sku; 1234 priv->eeprom_data->sku = priv->eeprom_data->sku;
1236 1235
1237 if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE && 1236 if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE &&
1238 !priv->cfg->ht_params) { 1237 !priv->cfg->ht_params) {
1239 IWL_ERR(priv, "Invalid 11n configuration\n"); 1238 IWL_ERR(priv, "Invalid 11n configuration\n");
1240 return -EINVAL; 1239 return -EINVAL;
1241 } 1240 }
1242 1241
1243 if (!priv->hw_params.sku) { 1242 if (!priv->eeprom_data->sku) {
1244 IWL_ERR(priv, "Invalid device sku\n"); 1243 IWL_ERR(priv, "Invalid device sku\n");
1245 return -EINVAL; 1244 return -EINVAL;
1246 } 1245 }
1247 1246
1248 IWL_INFO(priv, "Device SKU: 0x%X\n", priv->hw_params.sku); 1247 IWL_INFO(priv, "Device SKU: 0x%X\n", priv->eeprom_data->sku);
1249 1248
1250 radio_cfg = priv->eeprom_data->radio_cfg; 1249 radio_cfg = priv->eeprom_data->radio_cfg;
1251 1250
@@ -1352,6 +1351,9 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1352 trans_cfg.queue_watchdog_timeout = IWL_WATCHDOG_DISABLED; 1351 trans_cfg.queue_watchdog_timeout = IWL_WATCHDOG_DISABLED;
1353 trans_cfg.command_names = iwl_dvm_cmd_strings; 1352 trans_cfg.command_names = iwl_dvm_cmd_strings;
1354 1353
1354 WARN_ON(sizeof(priv->transport_queue_stop) * BITS_PER_BYTE <
1355 priv->cfg->base_params->num_of_queues);
1356
1355 ucode_flags = fw->ucode_capa.flags; 1357 ucode_flags = fw->ucode_capa.flags;
1356 1358
1357#ifndef CONFIG_IWLWIFI_P2P 1359#ifndef CONFIG_IWLWIFI_P2P
@@ -1448,7 +1450,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1448 ************************/ 1450 ************************/
1449 iwl_set_hw_params(priv); 1451 iwl_set_hw_params(priv);
1450 1452
1451 if (!(priv->hw_params.sku & EEPROM_SKU_CAP_IPAN_ENABLE)) { 1453 if (!(priv->eeprom_data->sku & EEPROM_SKU_CAP_IPAN_ENABLE)) {
1452 IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN"); 1454 IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN");
1453 ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN; 1455 ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
1454 /* 1456 /*
@@ -2073,7 +2075,16 @@ static void iwl_nic_config(struct iwl_op_mode *op_mode)
2073 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | 2075 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
2074 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); 2076 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
2075 2077
2076 priv->lib->nic_config(priv); 2078 /* W/A : NIC is stuck in a reset state after Early PCIe power off
2079 * (PCIe power is lost before PERST# is asserted),
2080 * causing ME FW to lose ownership and not being able to obtain it back.
2081 */
2082 iwl_set_bits_mask_prph(priv->trans, APMG_PS_CTRL_REG,
2083 APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
2084 ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
2085
2086 if (priv->lib->nic_config)
2087 priv->lib->nic_config(priv);
2077} 2088}
2078 2089
2079static void iwl_wimax_active(struct iwl_op_mode *op_mode) 2090static void iwl_wimax_active(struct iwl_op_mode *op_mode)
diff --git a/drivers/net/wireless/iwlwifi/dvm/scan.c b/drivers/net/wireless/iwlwifi/dvm/scan.c
index 2f271c96ed39..6633074258c7 100644
--- a/drivers/net/wireless/iwlwifi/dvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/dvm/scan.c
@@ -51,6 +51,9 @@
51#define IWL_CHANNEL_TUNE_TIME 5 51#define IWL_CHANNEL_TUNE_TIME 5
52#define MAX_SCAN_CHANNEL 50 52#define MAX_SCAN_CHANNEL 50
53 53
54/* For reset radio, need minimal dwell time only */
55#define IWL_RADIO_RESET_DWELL_TIME 5
56
54static int iwl_send_scan_abort(struct iwl_priv *priv) 57static int iwl_send_scan_abort(struct iwl_priv *priv)
55{ 58{
56 int ret; 59 int ret;
@@ -469,45 +472,39 @@ static u8 iwl_get_single_channel_number(struct iwl_priv *priv,
469 return 0; 472 return 0;
470} 473}
471 474
472static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, 475static int iwl_get_channel_for_reset_scan(struct iwl_priv *priv,
473 struct ieee80211_vif *vif, 476 struct ieee80211_vif *vif,
474 enum ieee80211_band band, 477 enum ieee80211_band band,
475 struct iwl_scan_channel *scan_ch) 478 struct iwl_scan_channel *scan_ch)
476{ 479{
477 const struct ieee80211_supported_band *sband; 480 const struct ieee80211_supported_band *sband;
478 u16 passive_dwell = 0; 481 u16 channel;
479 u16 active_dwell = 0;
480 int added = 0;
481 u16 channel = 0;
482 482
483 sband = iwl_get_hw_mode(priv, band); 483 sband = iwl_get_hw_mode(priv, band);
484 if (!sband) { 484 if (!sband) {
485 IWL_ERR(priv, "invalid band\n"); 485 IWL_ERR(priv, "invalid band\n");
486 return added; 486 return 0;
487 } 487 }
488 488
489 active_dwell = iwl_get_active_dwell_time(priv, band, 0);
490 passive_dwell = iwl_get_passive_dwell_time(priv, band);
491
492 if (passive_dwell <= active_dwell)
493 passive_dwell = active_dwell + 1;
494
495 channel = iwl_get_single_channel_number(priv, band); 489 channel = iwl_get_single_channel_number(priv, band);
496 if (channel) { 490 if (channel) {
497 scan_ch->channel = cpu_to_le16(channel); 491 scan_ch->channel = cpu_to_le16(channel);
498 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; 492 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
499 scan_ch->active_dwell = cpu_to_le16(active_dwell); 493 scan_ch->active_dwell =
500 scan_ch->passive_dwell = cpu_to_le16(passive_dwell); 494 cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME);
495 scan_ch->passive_dwell =
496 cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME);
501 /* Set txpower levels to defaults */ 497 /* Set txpower levels to defaults */
502 scan_ch->dsp_atten = 110; 498 scan_ch->dsp_atten = 110;
503 if (band == IEEE80211_BAND_5GHZ) 499 if (band == IEEE80211_BAND_5GHZ)
504 scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3; 500 scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
505 else 501 else
506 scan_ch->tx_gain = ((1 << 5) | (5 << 3)); 502 scan_ch->tx_gain = ((1 << 5) | (5 << 3));
507 added++; 503 return 1;
508 } else 504 }
509 IWL_ERR(priv, "no valid channel found\n"); 505
510 return added; 506 IWL_ERR(priv, "no valid channel found\n");
507 return 0;
511} 508}
512 509
513static int iwl_get_channels_for_scan(struct iwl_priv *priv, 510static int iwl_get_channels_for_scan(struct iwl_priv *priv,
@@ -723,6 +720,12 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
723 switch (priv->scan_type) { 720 switch (priv->scan_type) {
724 case IWL_SCAN_RADIO_RESET: 721 case IWL_SCAN_RADIO_RESET:
725 IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); 722 IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n");
723 /*
724 * Override quiet time as firmware checks that active
725 * dwell is >= quiet; since we use passive scan it'll
726 * not actually be used.
727 */
728 scan->quiet_time = cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME);
726 break; 729 break;
727 case IWL_SCAN_NORMAL: 730 case IWL_SCAN_NORMAL:
728 if (priv->scan_request->n_ssids) { 731 if (priv->scan_request->n_ssids) {
@@ -896,7 +899,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
896 switch (priv->scan_type) { 899 switch (priv->scan_type) {
897 case IWL_SCAN_RADIO_RESET: 900 case IWL_SCAN_RADIO_RESET:
898 scan->channel_count = 901 scan->channel_count =
899 iwl_get_single_channel_for_scan(priv, vif, band, 902 iwl_get_channel_for_reset_scan(priv, vif, band,
900 (void *)&scan->data[cmd_len]); 903 (void *)&scan->data[cmd_len]);
901 break; 904 break;
902 case IWL_SCAN_NORMAL: 905 case IWL_SCAN_NORMAL:
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
index c87a05cbec12..f10170fe8799 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
@@ -853,6 +853,9 @@ iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg,
853 EEPROM_RADIO_CONFIG); 853 EEPROM_RADIO_CONFIG);
854 data->sku = iwl_eeprom_query16(eeprom, eeprom_size, 854 data->sku = iwl_eeprom_query16(eeprom, eeprom_size,
855 EEPROM_SKU_CAP); 855 EEPROM_SKU_CAP);
856 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL)
857 data->sku &= ~EEPROM_SKU_CAP_11N_ENABLE;
858
856 data->eeprom_version = iwl_eeprom_query16(eeprom, eeprom_size, 859 data->eeprom_version = iwl_eeprom_query16(eeprom, eeprom_size,
857 EEPROM_VERSION); 860 EEPROM_VERSION);
858 861
diff --git a/drivers/net/wireless/iwlwifi/iwl-notif-wait.c b/drivers/net/wireless/iwlwifi/iwl-notif-wait.c
index 5cfed29b1b18..c61f2070f15a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-notif-wait.c
+++ b/drivers/net/wireless/iwlwifi/iwl-notif-wait.c
@@ -121,13 +121,12 @@ EXPORT_SYMBOL_GPL(iwl_notification_wait_notify);
121 121
122void iwl_abort_notification_waits(struct iwl_notif_wait_data *notif_wait) 122void iwl_abort_notification_waits(struct iwl_notif_wait_data *notif_wait)
123{ 123{
124 unsigned long flags;
125 struct iwl_notification_wait *wait_entry; 124 struct iwl_notification_wait *wait_entry;
126 125
127 spin_lock_irqsave(&notif_wait->notif_wait_lock, flags); 126 spin_lock(&notif_wait->notif_wait_lock);
128 list_for_each_entry(wait_entry, &notif_wait->notif_waits, list) 127 list_for_each_entry(wait_entry, &notif_wait->notif_waits, list)
129 wait_entry->aborted = true; 128 wait_entry->aborted = true;
130 spin_unlock_irqrestore(&notif_wait->notif_wait_lock, flags); 129 spin_unlock(&notif_wait->notif_wait_lock);
131 130
132 wake_up_all(&notif_wait->notif_waitq); 131 wake_up_all(&notif_wait->notif_waitq);
133} 132}
diff --git a/drivers/net/wireless/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/iwlwifi/iwl-op-mode.h
index cd9ef114d3a3..64886f95664f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-op-mode.h
+++ b/drivers/net/wireless/iwlwifi/iwl-op-mode.h
@@ -111,22 +111,25 @@ struct iwl_cfg;
111 * May sleep 111 * May sleep
112 * @rx: Rx notification to the op_mode. rxb is the Rx buffer itself. Cmd is the 112 * @rx: Rx notification to the op_mode. rxb is the Rx buffer itself. Cmd is the
113 * HCMD the this Rx responds to. 113 * HCMD the this Rx responds to.
114 * Must be atomic. 114 * Must be atomic and called with BH disabled.
115 * @queue_full: notifies that a HW queue is full. 115 * @queue_full: notifies that a HW queue is full.
116 * Must be atomic 116 * Must be atomic and called with BH disabled.
117 * @queue_not_full: notifies that a HW queue is not full any more. 117 * @queue_not_full: notifies that a HW queue is not full any more.
118 * Must be atomic 118 * Must be atomic and called with BH disabled.
119 * @hw_rf_kill:notifies of a change in the HW rf kill switch. True means that 119 * @hw_rf_kill:notifies of a change in the HW rf kill switch. True means that
120 * the radio is killed. Must be atomic. 120 * the radio is killed. Must be atomic.
121 * @free_skb: allows the transport layer to free skbs that haven't been 121 * @free_skb: allows the transport layer to free skbs that haven't been
122 * reclaimed by the op_mode. This can happen when the driver is freed and 122 * reclaimed by the op_mode. This can happen when the driver is freed and
123 * there are Tx packets pending in the transport layer. 123 * there are Tx packets pending in the transport layer.
124 * Must be atomic 124 * Must be atomic
125 * @nic_error: error notification. Must be atomic 125 * @nic_error: error notification. Must be atomic and must be called with BH
126 * @cmd_queue_full: Called when the command queue gets full. Must be atomic. 126 * disabled.
127 * @cmd_queue_full: Called when the command queue gets full. Must be atomic and
128 * called with BH disabled.
127 * @nic_config: configure NIC, called before firmware is started. 129 * @nic_config: configure NIC, called before firmware is started.
128 * May sleep 130 * May sleep
129 * @wimax_active: invoked when WiMax becomes active. Must be atomic. 131 * @wimax_active: invoked when WiMax becomes active. Must be atomic and called
132 * with BH disabled.
130 */ 133 */
131struct iwl_op_mode_ops { 134struct iwl_op_mode_ops {
132 struct iwl_op_mode *(*start)(struct iwl_trans *trans, 135 struct iwl_op_mode *(*start)(struct iwl_trans *trans,
@@ -165,7 +168,6 @@ struct iwl_op_mode {
165static inline void iwl_op_mode_stop(struct iwl_op_mode *op_mode) 168static inline void iwl_op_mode_stop(struct iwl_op_mode *op_mode)
166{ 169{
167 might_sleep(); 170 might_sleep();
168
169 op_mode->ops->stop(op_mode); 171 op_mode->ops->stop(op_mode);
170} 172}
171 173
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
index d6860c070c16..be143eb4aa4f 100644
--- a/drivers/net/wireless/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
@@ -867,24 +867,23 @@ void iwl_disable_ict(struct iwl_trans *trans)
867 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); 867 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
868} 868}
869 869
870/* legacy (non-ICT) ISR. Assumes that trans_pcie->irq_lock is held */
870static irqreturn_t iwl_isr(int irq, void *data) 871static irqreturn_t iwl_isr(int irq, void *data)
871{ 872{
872 struct iwl_trans *trans = data; 873 struct iwl_trans *trans = data;
873 struct iwl_trans_pcie *trans_pcie; 874 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
874 u32 inta, inta_mask; 875 u32 inta, inta_mask;
875 unsigned long flags;
876#ifdef CONFIG_IWLWIFI_DEBUG 876#ifdef CONFIG_IWLWIFI_DEBUG
877 u32 inta_fh; 877 u32 inta_fh;
878#endif 878#endif
879
880 lockdep_assert_held(&trans_pcie->irq_lock);
881
879 if (!trans) 882 if (!trans)
880 return IRQ_NONE; 883 return IRQ_NONE;
881 884
882 trace_iwlwifi_dev_irq(trans->dev); 885 trace_iwlwifi_dev_irq(trans->dev);
883 886
884 trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
885
886 spin_lock_irqsave(&trans_pcie->irq_lock, flags);
887
888 /* Disable (but don't clear!) interrupts here to avoid 887 /* Disable (but don't clear!) interrupts here to avoid
889 * back-to-back ISRs and sporadic interrupts from our NIC. 888 * back-to-back ISRs and sporadic interrupts from our NIC.
890 * If we have something to service, the tasklet will re-enable ints. 889 * If we have something to service, the tasklet will re-enable ints.
@@ -907,7 +906,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
907 /* Hardware disappeared. It might have already raised 906 /* Hardware disappeared. It might have already raised
908 * an interrupt */ 907 * an interrupt */
909 IWL_WARN(trans, "HARDWARE GONE?? INTA == 0x%08x\n", inta); 908 IWL_WARN(trans, "HARDWARE GONE?? INTA == 0x%08x\n", inta);
910 goto unplugged; 909 return IRQ_HANDLED;
911 } 910 }
912 911
913#ifdef CONFIG_IWLWIFI_DEBUG 912#ifdef CONFIG_IWLWIFI_DEBUG
@@ -926,18 +925,13 @@ static irqreturn_t iwl_isr(int irq, void *data)
926 !trans_pcie->inta) 925 !trans_pcie->inta)
927 iwl_enable_interrupts(trans); 926 iwl_enable_interrupts(trans);
928 927
929 unplugged: 928none:
930 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
931 return IRQ_HANDLED;
932
933 none:
934 /* re-enable interrupts here since we don't have anything to service. */ 929 /* re-enable interrupts here since we don't have anything to service. */
935 /* only Re-enable if disabled by irq and no schedules tasklet. */ 930 /* only Re-enable if disabled by irq and no schedules tasklet. */
936 if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) && 931 if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
937 !trans_pcie->inta) 932 !trans_pcie->inta)
938 iwl_enable_interrupts(trans); 933 iwl_enable_interrupts(trans);
939 934
940 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
941 return IRQ_NONE; 935 return IRQ_NONE;
942} 936}
943 937
@@ -963,15 +957,19 @@ irqreturn_t iwl_isr_ict(int irq, void *data)
963 957
964 trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 958 trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
965 959
960 spin_lock_irqsave(&trans_pcie->irq_lock, flags);
961
966 /* dram interrupt table not set yet, 962 /* dram interrupt table not set yet,
967 * use legacy interrupt. 963 * use legacy interrupt.
968 */ 964 */
969 if (!trans_pcie->use_ict) 965 if (unlikely(!trans_pcie->use_ict)) {
970 return iwl_isr(irq, data); 966 irqreturn_t ret = iwl_isr(irq, data);
967 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
968 return ret;
969 }
971 970
972 trace_iwlwifi_dev_irq(trans->dev); 971 trace_iwlwifi_dev_irq(trans->dev);
973 972
974 spin_lock_irqsave(&trans_pcie->irq_lock, flags);
975 973
976 /* Disable (but don't clear!) interrupts here to avoid 974 /* Disable (but don't clear!) interrupts here to avoid
977 * back-to-back ISRs and sporadic interrupts from our NIC. 975 * back-to-back ISRs and sporadic interrupts from our NIC.
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 32ab8ea56135..d1950838f17f 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -296,6 +296,7 @@ static void iwlagn_free_dma_ptr(struct iwl_trans *trans,
296static void iwl_trans_pcie_queue_stuck_timer(unsigned long data) 296static void iwl_trans_pcie_queue_stuck_timer(unsigned long data)
297{ 297{
298 struct iwl_tx_queue *txq = (void *)data; 298 struct iwl_tx_queue *txq = (void *)data;
299 struct iwl_queue *q = &txq->q;
299 struct iwl_trans_pcie *trans_pcie = txq->trans_pcie; 300 struct iwl_trans_pcie *trans_pcie = txq->trans_pcie;
300 struct iwl_trans *trans = iwl_trans_pcie_get_trans(trans_pcie); 301 struct iwl_trans *trans = iwl_trans_pcie_get_trans(trans_pcie);
301 u32 scd_sram_addr = trans_pcie->scd_base_addr + 302 u32 scd_sram_addr = trans_pcie->scd_base_addr +
@@ -346,6 +347,14 @@ static void iwl_trans_pcie_queue_stuck_timer(unsigned long data)
346 iwl_read_prph(trans, SCD_QUEUE_WRPTR(i))); 347 iwl_read_prph(trans, SCD_QUEUE_WRPTR(i)));
347 } 348 }
348 349
350 for (i = q->read_ptr; i != q->write_ptr;
351 i = iwl_queue_inc_wrap(i, q->n_bd)) {
352 struct iwl_tx_cmd *tx_cmd =
353 (struct iwl_tx_cmd *)txq->entries[i].cmd->payload;
354 IWL_ERR(trans, "scratch %d = 0x%08x\n", i,
355 get_unaligned_le32(&tx_cmd->scratch));
356 }
357
349 iwl_op_mode_nic_error(trans->op_mode); 358 iwl_op_mode_nic_error(trans->op_mode);
350} 359}
351 360
@@ -1037,15 +1046,12 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans,
1037 1046
1038/* 1047/*
1039 * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask 1048 * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask
1040 * must be called under the irq lock and with MAC access
1041 */ 1049 */
1042static void iwl_trans_txq_set_sched(struct iwl_trans *trans, u32 mask) 1050static void iwl_trans_txq_set_sched(struct iwl_trans *trans, u32 mask)
1043{ 1051{
1044 struct iwl_trans_pcie __maybe_unused *trans_pcie = 1052 struct iwl_trans_pcie __maybe_unused *trans_pcie =
1045 IWL_TRANS_GET_PCIE_TRANS(trans); 1053 IWL_TRANS_GET_PCIE_TRANS(trans);
1046 1054
1047 lockdep_assert_held(&trans_pcie->irq_lock);
1048
1049 iwl_write_prph(trans, SCD_TXFACT, mask); 1055 iwl_write_prph(trans, SCD_TXFACT, mask);
1050} 1056}
1051 1057
@@ -1053,12 +1059,9 @@ static void iwl_tx_start(struct iwl_trans *trans)
1053{ 1059{
1054 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1060 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
1055 u32 a; 1061 u32 a;
1056 unsigned long flags;
1057 int i, chan; 1062 int i, chan;
1058 u32 reg_val; 1063 u32 reg_val;
1059 1064
1060 spin_lock_irqsave(&trans_pcie->irq_lock, flags);
1061
1062 /* make sure all queue are not stopped/used */ 1065 /* make sure all queue are not stopped/used */
1063 memset(trans_pcie->queue_stopped, 0, sizeof(trans_pcie->queue_stopped)); 1066 memset(trans_pcie->queue_stopped, 0, sizeof(trans_pcie->queue_stopped));
1064 memset(trans_pcie->queue_used, 0, sizeof(trans_pcie->queue_used)); 1067 memset(trans_pcie->queue_used, 0, sizeof(trans_pcie->queue_used));
@@ -1109,8 +1112,6 @@ static void iwl_tx_start(struct iwl_trans *trans)
1109 iwl_write_direct32(trans, FH_TX_CHICKEN_BITS_REG, 1112 iwl_write_direct32(trans, FH_TX_CHICKEN_BITS_REG,
1110 reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); 1113 reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
1111 1114
1112 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
1113
1114 /* Enable L1-Active */ 1115 /* Enable L1-Active */
1115 iwl_clear_bits_prph(trans, APMG_PCIDEV_STT_REG, 1116 iwl_clear_bits_prph(trans, APMG_PCIDEV_STT_REG,
1116 APMG_PCIDEV_STT_VAL_L1_ACT_DIS); 1117 APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
@@ -2017,7 +2018,9 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct file *file,
2017 if (!trans->op_mode) 2018 if (!trans->op_mode)
2018 return -EAGAIN; 2019 return -EAGAIN;
2019 2020
2021 local_bh_disable();
2020 iwl_op_mode_nic_error(trans->op_mode); 2022 iwl_op_mode_nic_error(trans->op_mode);
2023 local_bh_enable();
2021 2024
2022 return count; 2025 return count;
2023} 2026}