aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2014-05-16 14:16:17 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-05-16 14:16:17 -0400
commitd91a48cbae4cc12f6e8a65372a73ecf46f8f1b7f (patch)
tree3b5e1c94e6aca1d132491ade8d033733ab06e328
parent75e58071c0c64f331ccc4c0037990a1e50099f7f (diff)
parentaf7c603eb476216f1c27d82b802f0ce879c54ab3 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig3
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/calib.c1
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/debugfs.c7
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/devices.c2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/lib.c17
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/main.c27
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/power.c4
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rs.c10
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rxon.c18
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/scan.c3
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/sta.c29
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/tt.c2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/tx.c24
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/ucode.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-8000.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-config.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h41
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-drv.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-fw.h8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-io.c18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-io.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-modparams.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-nvm-parse.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-phy-db.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-prph.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h31
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/coex.c68
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/d3.c27
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/debugfs.c9
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw.c17
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c94
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c46
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/nvm.c76
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/ops.c13
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c15
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/power.c48
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/quota.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rs.c8
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/scan.c13
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.c18
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/time-event.c4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tt.c1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/utils.c4
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/drv.c14
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c26
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/tx.c10
51 files changed, 443 insertions, 368 deletions
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index b82d30c0f0c9..7fd50428b934 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -42,7 +42,7 @@ config IWLWIFI
42config IWLWIFI_LEDS 42config IWLWIFI_LEDS
43 bool 43 bool
44 depends on IWLWIFI 44 depends on IWLWIFI
45 depends on LEDS_CLASS 45 depends on LEDS_CLASS=y || LEDS_CLASS=IWLWIFI
46 select LEDS_TRIGGERS 46 select LEDS_TRIGGERS
47 select MAC80211_LEDS 47 select MAC80211_LEDS
48 default y 48 default y
@@ -128,7 +128,6 @@ config IWLWIFI_DEBUG_EXPERIMENTAL_UCODE
128 Enable use of experimental ucode for testing and debugging. 128 Enable use of experimental ucode for testing and debugging.
129 129
130config IWLWIFI_DEVICE_TRACING 130config IWLWIFI_DEVICE_TRACING
131
132 bool "iwlwifi device access tracing" 131 bool "iwlwifi device access tracing"
133 depends on IWLWIFI 132 depends on IWLWIFI
134 depends on EVENT_TRACING 133 depends on EVENT_TRACING
diff --git a/drivers/net/wireless/iwlwifi/dvm/calib.c b/drivers/net/wireless/iwlwifi/dvm/calib.c
index be1086c87157..20e6aa910700 100644
--- a/drivers/net/wireless/iwlwifi/dvm/calib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/calib.c
@@ -94,7 +94,6 @@ int iwl_send_calib_results(struct iwl_priv *priv)
94{ 94{
95 struct iwl_host_cmd hcmd = { 95 struct iwl_host_cmd hcmd = {
96 .id = REPLY_PHY_CALIBRATION_CMD, 96 .id = REPLY_PHY_CALIBRATION_CMD,
97 .flags = CMD_SYNC,
98 }; 97 };
99 struct iwl_calib_result *res; 98 struct iwl_calib_result *res;
100 99
diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
index d2fe2596d54e..0ffb6ff1a255 100644
--- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
@@ -1481,7 +1481,7 @@ static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file,
1481 1481
1482 /* make request to uCode to retrieve statistics information */ 1482 /* make request to uCode to retrieve statistics information */
1483 mutex_lock(&priv->mutex); 1483 mutex_lock(&priv->mutex);
1484 ret = iwl_send_statistics_request(priv, CMD_SYNC, false); 1484 ret = iwl_send_statistics_request(priv, 0, false);
1485 mutex_unlock(&priv->mutex); 1485 mutex_unlock(&priv->mutex);
1486 1486
1487 if (ret) 1487 if (ret)
@@ -1868,7 +1868,7 @@ static ssize_t iwl_dbgfs_clear_ucode_statistics_write(struct file *file,
1868 1868
1869 /* make request to uCode to retrieve statistics information */ 1869 /* make request to uCode to retrieve statistics information */
1870 mutex_lock(&priv->mutex); 1870 mutex_lock(&priv->mutex);
1871 iwl_send_statistics_request(priv, CMD_SYNC, true); 1871 iwl_send_statistics_request(priv, 0, true);
1872 mutex_unlock(&priv->mutex); 1872 mutex_unlock(&priv->mutex);
1873 1873
1874 return count; 1874 return count;
@@ -2188,7 +2188,6 @@ static int iwl_cmd_echo_test(struct iwl_priv *priv)
2188 struct iwl_host_cmd cmd = { 2188 struct iwl_host_cmd cmd = {
2189 .id = REPLY_ECHO, 2189 .id = REPLY_ECHO,
2190 .len = { 0 }, 2190 .len = { 0 },
2191 .flags = CMD_SYNC,
2192 }; 2191 };
2193 2192
2194 ret = iwl_dvm_send_cmd(priv, &cmd); 2193 ret = iwl_dvm_send_cmd(priv, &cmd);
@@ -2320,7 +2319,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct file *file,
2320 mutex_lock(&priv->mutex); 2319 mutex_lock(&priv->mutex);
2321 2320
2322 /* take the return value to make compiler happy - it will fail anyway */ 2321 /* take the return value to make compiler happy - it will fail anyway */
2323 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_ERROR, CMD_SYNC, 0, NULL); 2322 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_ERROR, 0, 0, NULL);
2324 2323
2325 mutex_unlock(&priv->mutex); 2324 mutex_unlock(&priv->mutex);
2326 2325
diff --git a/drivers/net/wireless/iwlwifi/dvm/devices.c b/drivers/net/wireless/iwlwifi/dvm/devices.c
index 758c54eeb206..34b41e5f7cfc 100644
--- a/drivers/net/wireless/iwlwifi/dvm/devices.c
+++ b/drivers/net/wireless/iwlwifi/dvm/devices.c
@@ -417,7 +417,6 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
417 struct iwl_host_cmd hcmd = { 417 struct iwl_host_cmd hcmd = {
418 .id = REPLY_CHANNEL_SWITCH, 418 .id = REPLY_CHANNEL_SWITCH,
419 .len = { sizeof(cmd), }, 419 .len = { sizeof(cmd), },
420 .flags = CMD_SYNC,
421 .data = { &cmd, }, 420 .data = { &cmd, },
422 }; 421 };
423 422
@@ -579,7 +578,6 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
579 struct iwl_host_cmd hcmd = { 578 struct iwl_host_cmd hcmd = {
580 .id = REPLY_CHANNEL_SWITCH, 579 .id = REPLY_CHANNEL_SWITCH,
581 .len = { sizeof(*cmd), }, 580 .len = { sizeof(*cmd), },
582 .flags = CMD_SYNC,
583 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 581 .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
584 }; 582 };
585 int err; 583 int err;
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c
index d169228f59e7..2191621d69c1 100644
--- a/drivers/net/wireless/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/lib.c
@@ -81,7 +81,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
81 else 81 else
82 tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD; 82 tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;
83 83
84 return iwl_dvm_send_cmd_pdu(priv, tx_ant_cfg_cmd, CMD_SYNC, 84 return iwl_dvm_send_cmd_pdu(priv, tx_ant_cfg_cmd, 0,
85 sizeof(tx_power_cmd), &tx_power_cmd); 85 sizeof(tx_power_cmd), &tx_power_cmd);
86} 86}
87 87
@@ -141,7 +141,6 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u32 scd_q_msk)
141 struct iwl_host_cmd cmd = { 141 struct iwl_host_cmd cmd = {
142 .id = REPLY_TXFIFO_FLUSH, 142 .id = REPLY_TXFIFO_FLUSH,
143 .len = { sizeof(struct iwl_txfifo_flush_cmd), }, 143 .len = { sizeof(struct iwl_txfifo_flush_cmd), },
144 .flags = CMD_SYNC,
145 .data = { &flush_cmd, }, 144 .data = { &flush_cmd, },
146 }; 145 };
147 146
@@ -333,12 +332,12 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
333 memcpy(&bt_cmd_v2.basic, &basic, 332 memcpy(&bt_cmd_v2.basic, &basic,
334 sizeof(basic)); 333 sizeof(basic));
335 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, 334 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG,
336 CMD_SYNC, sizeof(bt_cmd_v2), &bt_cmd_v2); 335 0, sizeof(bt_cmd_v2), &bt_cmd_v2);
337 } else { 336 } else {
338 memcpy(&bt_cmd_v1.basic, &basic, 337 memcpy(&bt_cmd_v1.basic, &basic,
339 sizeof(basic)); 338 sizeof(basic));
340 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, 339 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG,
341 CMD_SYNC, sizeof(bt_cmd_v1), &bt_cmd_v1); 340 0, sizeof(bt_cmd_v1), &bt_cmd_v1);
342 } 341 }
343 if (ret) 342 if (ret)
344 IWL_ERR(priv, "failed to send BT Coex Config\n"); 343 IWL_ERR(priv, "failed to send BT Coex Config\n");
@@ -1044,7 +1043,6 @@ int iwlagn_send_patterns(struct iwl_priv *priv,
1044 struct iwl_host_cmd cmd = { 1043 struct iwl_host_cmd cmd = {
1045 .id = REPLY_WOWLAN_PATTERNS, 1044 .id = REPLY_WOWLAN_PATTERNS,
1046 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 1045 .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
1047 .flags = CMD_SYNC,
1048 }; 1046 };
1049 int i, err; 1047 int i, err;
1050 1048
@@ -1201,7 +1199,6 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)
1201 if (key_data.use_rsc_tsc) { 1199 if (key_data.use_rsc_tsc) {
1202 struct iwl_host_cmd rsc_tsc_cmd = { 1200 struct iwl_host_cmd rsc_tsc_cmd = {
1203 .id = REPLY_WOWLAN_TSC_RSC_PARAMS, 1201 .id = REPLY_WOWLAN_TSC_RSC_PARAMS,
1204 .flags = CMD_SYNC,
1205 .data[0] = key_data.rsc_tsc, 1202 .data[0] = key_data.rsc_tsc,
1206 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 1203 .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
1207 .len[0] = sizeof(*key_data.rsc_tsc), 1204 .len[0] = sizeof(*key_data.rsc_tsc),
@@ -1215,7 +1212,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)
1215 if (key_data.use_tkip) { 1212 if (key_data.use_tkip) {
1216 ret = iwl_dvm_send_cmd_pdu(priv, 1213 ret = iwl_dvm_send_cmd_pdu(priv,
1217 REPLY_WOWLAN_TKIP_PARAMS, 1214 REPLY_WOWLAN_TKIP_PARAMS,
1218 CMD_SYNC, sizeof(tkip_cmd), 1215 0, sizeof(tkip_cmd),
1219 &tkip_cmd); 1216 &tkip_cmd);
1220 if (ret) 1217 if (ret)
1221 goto out; 1218 goto out;
@@ -1231,20 +1228,20 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)
1231 1228
1232 ret = iwl_dvm_send_cmd_pdu(priv, 1229 ret = iwl_dvm_send_cmd_pdu(priv,
1233 REPLY_WOWLAN_KEK_KCK_MATERIAL, 1230 REPLY_WOWLAN_KEK_KCK_MATERIAL,
1234 CMD_SYNC, sizeof(kek_kck_cmd), 1231 0, sizeof(kek_kck_cmd),
1235 &kek_kck_cmd); 1232 &kek_kck_cmd);
1236 if (ret) 1233 if (ret)
1237 goto out; 1234 goto out;
1238 } 1235 }
1239 } 1236 }
1240 1237
1241 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_D3_CONFIG, CMD_SYNC, 1238 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_D3_CONFIG, 0,
1242 sizeof(d3_cfg_cmd), &d3_cfg_cmd); 1239 sizeof(d3_cfg_cmd), &d3_cfg_cmd);
1243 if (ret) 1240 if (ret)
1244 goto out; 1241 goto out;
1245 1242
1246 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WOWLAN_WAKEUP_FILTER, 1243 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WOWLAN_WAKEUP_FILTER,
1247 CMD_SYNC, sizeof(wakeup_filter_cmd), 1244 0, sizeof(wakeup_filter_cmd),
1248 &wakeup_filter_cmd); 1245 &wakeup_filter_cmd);
1249 if (ret) 1246 if (ret)
1250 goto out; 1247 goto out;
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c
index 6a00353768f3..0b7f46f0b079 100644
--- a/drivers/net/wireless/iwlwifi/dvm/main.c
+++ b/drivers/net/wireless/iwlwifi/dvm/main.c
@@ -128,7 +128,6 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv)
128 struct iwl_tx_beacon_cmd *tx_beacon_cmd; 128 struct iwl_tx_beacon_cmd *tx_beacon_cmd;
129 struct iwl_host_cmd cmd = { 129 struct iwl_host_cmd cmd = {
130 .id = REPLY_TX_BEACON, 130 .id = REPLY_TX_BEACON,
131 .flags = CMD_SYNC,
132 }; 131 };
133 struct ieee80211_tx_info *info; 132 struct ieee80211_tx_info *info;
134 u32 frame_size; 133 u32 frame_size;
@@ -311,8 +310,7 @@ int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags, bool clear)
311 sizeof(struct iwl_statistics_cmd), 310 sizeof(struct iwl_statistics_cmd),
312 &statistics_cmd); 311 &statistics_cmd);
313 else 312 else
314 return iwl_dvm_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, 313 return iwl_dvm_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, 0,
315 CMD_SYNC,
316 sizeof(struct iwl_statistics_cmd), 314 sizeof(struct iwl_statistics_cmd),
317 &statistics_cmd); 315 &statistics_cmd);
318} 316}
@@ -622,7 +620,7 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
622 620
623 ret = iwl_dvm_send_cmd_pdu(priv, 621 ret = iwl_dvm_send_cmd_pdu(priv,
624 REPLY_CT_KILL_CONFIG_CMD, 622 REPLY_CT_KILL_CONFIG_CMD,
625 CMD_SYNC, sizeof(adv_cmd), &adv_cmd); 623 0, sizeof(adv_cmd), &adv_cmd);
626 if (ret) 624 if (ret)
627 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); 625 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
628 else 626 else
@@ -637,7 +635,7 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
637 635
638 ret = iwl_dvm_send_cmd_pdu(priv, 636 ret = iwl_dvm_send_cmd_pdu(priv,
639 REPLY_CT_KILL_CONFIG_CMD, 637 REPLY_CT_KILL_CONFIG_CMD,
640 CMD_SYNC, sizeof(cmd), &cmd); 638 0, sizeof(cmd), &cmd);
641 if (ret) 639 if (ret)
642 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); 640 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
643 else 641 else
@@ -673,9 +671,7 @@ static int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)
673 671
674 if (IWL_UCODE_API(priv->fw->ucode_ver) > 1) { 672 if (IWL_UCODE_API(priv->fw->ucode_ver) > 1) {
675 IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant); 673 IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant);
676 return iwl_dvm_send_cmd_pdu(priv, 674 return iwl_dvm_send_cmd_pdu(priv, TX_ANT_CONFIGURATION_CMD, 0,
677 TX_ANT_CONFIGURATION_CMD,
678 CMD_SYNC,
679 sizeof(struct iwl_tx_ant_config_cmd), 675 sizeof(struct iwl_tx_ant_config_cmd),
680 &tx_ant_cmd); 676 &tx_ant_cmd);
681 } else { 677 } else {
@@ -703,7 +699,7 @@ static void iwl_send_bt_config(struct iwl_priv *priv)
703 (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); 699 (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active");
704 700
705 if (iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, 701 if (iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG,
706 CMD_SYNC, sizeof(struct iwl_bt_cmd), &bt_cmd)) 702 0, sizeof(struct iwl_bt_cmd), &bt_cmd))
707 IWL_ERR(priv, "failed to send BT Coex Config\n"); 703 IWL_ERR(priv, "failed to send BT Coex Config\n");
708} 704}
709 705
@@ -987,7 +983,7 @@ static void iwl_bg_restart(struct work_struct *data)
987 ieee80211_restart_hw(priv->hw); 983 ieee80211_restart_hw(priv->hw);
988 else 984 else
989 IWL_ERR(priv, 985 IWL_ERR(priv,
990 "Cannot request restart before registrating with mac80211"); 986 "Cannot request restart before registrating with mac80211\n");
991 } else { 987 } else {
992 WARN_ON(1); 988 WARN_ON(1);
993 } 989 }
@@ -1127,7 +1123,6 @@ static void iwl_option_config(struct iwl_priv *priv)
1127static int iwl_eeprom_init_hw_params(struct iwl_priv *priv) 1123static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
1128{ 1124{
1129 struct iwl_nvm_data *data = priv->nvm_data; 1125 struct iwl_nvm_data *data = priv->nvm_data;
1130 char *debug_msg;
1131 1126
1132 if (data->sku_cap_11n_enable && 1127 if (data->sku_cap_11n_enable &&
1133 !priv->cfg->ht_params) { 1128 !priv->cfg->ht_params) {
@@ -1141,8 +1136,8 @@ static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
1141 return -EINVAL; 1136 return -EINVAL;
1142 } 1137 }
1143 1138
1144 debug_msg = "Device SKU: 24GHz %s %s, 52GHz %s %s, 11.n %s %s\n"; 1139 IWL_DEBUG_INFO(priv,
1145 IWL_DEBUG_INFO(priv, debug_msg, 1140 "Device SKU: 24GHz %s %s, 52GHz %s %s, 11.n %s %s\n",
1146 data->sku_cap_band_24GHz_enable ? "" : "NOT", "enabled", 1141 data->sku_cap_band_24GHz_enable ? "" : "NOT", "enabled",
1147 data->sku_cap_band_52GHz_enable ? "" : "NOT", "enabled", 1142 data->sku_cap_band_52GHz_enable ? "" : "NOT", "enabled",
1148 data->sku_cap_11n_enable ? "" : "NOT", "enabled"); 1143 data->sku_cap_11n_enable ? "" : "NOT", "enabled");
@@ -1350,7 +1345,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1350 iwl_set_hw_params(priv); 1345 iwl_set_hw_params(priv);
1351 1346
1352 if (!(priv->nvm_data->sku_cap_ipan_enable)) { 1347 if (!(priv->nvm_data->sku_cap_ipan_enable)) {
1353 IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN"); 1348 IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN\n");
1354 ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN; 1349 ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
1355 /* 1350 /*
1356 * if not PAN, then don't support P2P -- might be a uCode 1351 * if not PAN, then don't support P2P -- might be a uCode
@@ -2019,10 +2014,10 @@ void iwlagn_lift_passive_no_rx(struct iwl_priv *priv)
2019 2014
2020 for (mq = 0; mq < IWLAGN_FIRST_AMPDU_QUEUE; mq++) { 2015 for (mq = 0; mq < IWLAGN_FIRST_AMPDU_QUEUE; mq++) {
2021 if (!test_bit(mq, &priv->transport_queue_stop)) { 2016 if (!test_bit(mq, &priv->transport_queue_stop)) {
2022 IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d", mq); 2017 IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d\n", mq);
2023 ieee80211_wake_queue(priv->hw, mq); 2018 ieee80211_wake_queue(priv->hw, mq);
2024 } else { 2019 } else {
2025 IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d", mq); 2020 IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d\n", mq);
2026 } 2021 }
2027 } 2022 }
2028 2023
diff --git a/drivers/net/wireless/iwlwifi/dvm/power.c b/drivers/net/wireless/iwlwifi/dvm/power.c
index b4e61417013a..f2c1439566b5 100644
--- a/drivers/net/wireless/iwlwifi/dvm/power.c
+++ b/drivers/net/wireless/iwlwifi/dvm/power.c
@@ -278,7 +278,7 @@ static int iwl_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd)
278 le32_to_cpu(cmd->sleep_interval[3]), 278 le32_to_cpu(cmd->sleep_interval[3]),
279 le32_to_cpu(cmd->sleep_interval[4])); 279 le32_to_cpu(cmd->sleep_interval[4]));
280 280
281 return iwl_dvm_send_cmd_pdu(priv, POWER_TABLE_CMD, CMD_SYNC, 281 return iwl_dvm_send_cmd_pdu(priv, POWER_TABLE_CMD, 0,
282 sizeof(struct iwl_powertable_cmd), cmd); 282 sizeof(struct iwl_powertable_cmd), cmd);
283} 283}
284 284
@@ -361,7 +361,7 @@ int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd,
361 361
362 memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)); 362 memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd));
363 } else 363 } else
364 IWL_ERR(priv, "set power fail, ret = %d", ret); 364 IWL_ERR(priv, "set power fail, ret = %d\n", ret);
365 365
366 return ret; 366 return ret;
367} 367}
diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.c b/drivers/net/wireless/iwlwifi/dvm/rs.c
index aa773a2da4ab..32b78a66536d 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rs.c
@@ -1453,7 +1453,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1453 tbl->action = IWL_LEGACY_SWITCH_SISO; 1453 tbl->action = IWL_LEGACY_SWITCH_SISO;
1454 break; 1454 break;
1455 default: 1455 default:
1456 IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); 1456 IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load);
1457 break; 1457 break;
1458 } 1458 }
1459 1459
@@ -1628,7 +1628,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1628 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1628 tbl->action = IWL_SISO_SWITCH_ANTENNA1;
1629 break; 1629 break;
1630 default: 1630 default:
1631 IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); 1631 IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load);
1632 break; 1632 break;
1633 } 1633 }
1634 1634
@@ -1799,7 +1799,7 @@ static int rs_move_mimo2_to_other(struct iwl_priv *priv,
1799 tbl->action = IWL_MIMO2_SWITCH_SISO_A; 1799 tbl->action = IWL_MIMO2_SWITCH_SISO_A;
1800 break; 1800 break;
1801 default: 1801 default:
1802 IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); 1802 IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load);
1803 break; 1803 break;
1804 } 1804 }
1805 1805
@@ -1969,7 +1969,7 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv,
1969 tbl->action = IWL_MIMO3_SWITCH_SISO_A; 1969 tbl->action = IWL_MIMO3_SWITCH_SISO_A;
1970 break; 1970 break;
1971 default: 1971 default:
1972 IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); 1972 IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load);
1973 break; 1973 break;
1974 } 1974 }
1975 1975
@@ -2709,7 +2709,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2709 rs_set_expected_tpt_table(lq_sta, tbl); 2709 rs_set_expected_tpt_table(lq_sta, tbl);
2710 rs_fill_link_cmd(NULL, lq_sta, rate); 2710 rs_fill_link_cmd(NULL, lq_sta, rate);
2711 priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; 2711 priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq;
2712 iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true); 2712 iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, 0, true);
2713} 2713}
2714 2714
2715static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, 2715static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
diff --git a/drivers/net/wireless/iwlwifi/dvm/rx.c b/drivers/net/wireless/iwlwifi/dvm/rx.c
index cd8377346aff..debec963c610 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rx.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rx.c
@@ -786,7 +786,7 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,
786 786
787 memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); 787 memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));
788 788
789 ieee80211_rx_ni(priv->hw, skb); 789 ieee80211_rx(priv->hw, skb);
790} 790}
791 791
792static u32 iwlagn_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in) 792static u32 iwlagn_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in)
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c
index 503a81e58185..ed50de6362ed 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rxon.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c
@@ -104,7 +104,7 @@ static int iwlagn_disable_bss(struct iwl_priv *priv,
104 104
105 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 105 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
106 ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, 106 ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd,
107 CMD_SYNC, sizeof(*send), send); 107 0, sizeof(*send), send);
108 108
109 send->filter_flags = old_filter; 109 send->filter_flags = old_filter;
110 110
@@ -134,7 +134,7 @@ static int iwlagn_disable_pan(struct iwl_priv *priv,
134 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 134 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
135 send->dev_type = RXON_DEV_TYPE_P2P; 135 send->dev_type = RXON_DEV_TYPE_P2P;
136 ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, 136 ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd,
137 CMD_SYNC, sizeof(*send), send); 137 0, sizeof(*send), send);
138 138
139 send->filter_flags = old_filter; 139 send->filter_flags = old_filter;
140 send->dev_type = old_dev_type; 140 send->dev_type = old_dev_type;
@@ -160,7 +160,7 @@ static int iwlagn_disconn_pan(struct iwl_priv *priv,
160 int ret; 160 int ret;
161 161
162 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 162 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
163 ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC, 163 ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, 0,
164 sizeof(*send), send); 164 sizeof(*send), send);
165 165
166 send->filter_flags = old_filter; 166 send->filter_flags = old_filter;
@@ -189,7 +189,7 @@ static void iwlagn_update_qos(struct iwl_priv *priv,
189 ctx->qos_data.qos_active, 189 ctx->qos_data.qos_active,
190 ctx->qos_data.def_qos_parm.qos_flags); 190 ctx->qos_data.def_qos_parm.qos_flags);
191 191
192 ret = iwl_dvm_send_cmd_pdu(priv, ctx->qos_cmd, CMD_SYNC, 192 ret = iwl_dvm_send_cmd_pdu(priv, ctx->qos_cmd, 0,
193 sizeof(struct iwl_qosparam_cmd), 193 sizeof(struct iwl_qosparam_cmd),
194 &ctx->qos_data.def_qos_parm); 194 &ctx->qos_data.def_qos_parm);
195 if (ret) 195 if (ret)
@@ -353,7 +353,7 @@ static int iwl_send_rxon_timing(struct iwl_priv *priv,
353 le16_to_cpu(ctx->timing.atim_window)); 353 le16_to_cpu(ctx->timing.atim_window));
354 354
355 return iwl_dvm_send_cmd_pdu(priv, ctx->rxon_timing_cmd, 355 return iwl_dvm_send_cmd_pdu(priv, ctx->rxon_timing_cmd,
356 CMD_SYNC, sizeof(ctx->timing), &ctx->timing); 356 0, sizeof(ctx->timing), &ctx->timing);
357} 357}
358 358
359static int iwlagn_rxon_disconn(struct iwl_priv *priv, 359static int iwlagn_rxon_disconn(struct iwl_priv *priv,
@@ -495,7 +495,7 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv,
495 * Associated RXON doesn't clear the station table in uCode, 495 * Associated RXON doesn't clear the station table in uCode,
496 * so we don't need to restore stations etc. after this. 496 * so we don't need to restore stations etc. after this.
497 */ 497 */
498 ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC, 498 ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, 0,
499 sizeof(struct iwl_rxon_cmd), &ctx->staging); 499 sizeof(struct iwl_rxon_cmd), &ctx->staging);
500 if (ret) { 500 if (ret) {
501 IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); 501 IWL_ERR(priv, "Error setting new RXON (%d)\n", ret);
@@ -610,7 +610,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
610 cmd.slots[0].width = cpu_to_le16(slot0); 610 cmd.slots[0].width = cpu_to_le16(slot0);
611 cmd.slots[1].width = cpu_to_le16(slot1); 611 cmd.slots[1].width = cpu_to_le16(slot1);
612 612
613 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, CMD_SYNC, 613 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, 0,
614 sizeof(cmd), &cmd); 614 sizeof(cmd), &cmd);
615 if (ret) 615 if (ret)
616 IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret); 616 IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret);
@@ -823,7 +823,7 @@ static int iwl_check_rxon_cmd(struct iwl_priv *priv,
823 823
824 if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) 824 if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
825 == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) { 825 == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) {
826 IWL_WARN(priv, "CCK and auto detect"); 826 IWL_WARN(priv, "CCK and auto detect\n");
827 errors |= BIT(8); 827 errors |= BIT(8);
828 } 828 }
829 829
@@ -1395,7 +1395,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
1395 priv->phy_calib_chain_noise_reset_cmd); 1395 priv->phy_calib_chain_noise_reset_cmd);
1396 ret = iwl_dvm_send_cmd_pdu(priv, 1396 ret = iwl_dvm_send_cmd_pdu(priv,
1397 REPLY_PHY_CALIBRATION_CMD, 1397 REPLY_PHY_CALIBRATION_CMD,
1398 CMD_SYNC, sizeof(cmd), &cmd); 1398 0, sizeof(cmd), &cmd);
1399 if (ret) 1399 if (ret)
1400 IWL_ERR(priv, 1400 IWL_ERR(priv,
1401 "Could not send REPLY_PHY_CALIBRATION_CMD\n"); 1401 "Could not send REPLY_PHY_CALIBRATION_CMD\n");
diff --git a/drivers/net/wireless/iwlwifi/dvm/scan.c b/drivers/net/wireless/iwlwifi/dvm/scan.c
index be98b913ed58..43bef901e8f9 100644
--- a/drivers/net/wireless/iwlwifi/dvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/dvm/scan.c
@@ -59,7 +59,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
59 int ret; 59 int ret;
60 struct iwl_host_cmd cmd = { 60 struct iwl_host_cmd cmd = {
61 .id = REPLY_SCAN_ABORT_CMD, 61 .id = REPLY_SCAN_ABORT_CMD,
62 .flags = CMD_SYNC | CMD_WANT_SKB, 62 .flags = CMD_WANT_SKB,
63 }; 63 };
64 __le32 *status; 64 __le32 *status;
65 65
@@ -639,7 +639,6 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
639 struct iwl_host_cmd cmd = { 639 struct iwl_host_cmd cmd = {
640 .id = REPLY_SCAN_CMD, 640 .id = REPLY_SCAN_CMD,
641 .len = { sizeof(struct iwl_scan_cmd), }, 641 .len = { sizeof(struct iwl_scan_cmd), },
642 .flags = CMD_SYNC,
643 }; 642 };
644 struct iwl_scan_cmd *scan; 643 struct iwl_scan_cmd *scan;
645 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 644 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c
index 9cdd91cdf661..6ec86adbe4a1 100644
--- a/drivers/net/wireless/iwlwifi/dvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/dvm/sta.c
@@ -39,7 +39,7 @@ static int iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
39 lockdep_assert_held(&priv->sta_lock); 39 lockdep_assert_held(&priv->sta_lock);
40 40
41 if (sta_id >= IWLAGN_STATION_COUNT) { 41 if (sta_id >= IWLAGN_STATION_COUNT) {
42 IWL_ERR(priv, "invalid sta_id %u", sta_id); 42 IWL_ERR(priv, "invalid sta_id %u\n", sta_id);
43 return -EINVAL; 43 return -EINVAL;
44 } 44 }
45 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) 45 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE))
@@ -165,7 +165,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
165 iwl_free_resp(&cmd); 165 iwl_free_resp(&cmd);
166 166
167 if (cmd.handler_status) 167 if (cmd.handler_status)
168 IWL_ERR(priv, "%s - error in the CMD response %d", __func__, 168 IWL_ERR(priv, "%s - error in the CMD response %d\n", __func__,
169 cmd.handler_status); 169 cmd.handler_status);
170 170
171 return cmd.handler_status; 171 return cmd.handler_status;
@@ -261,7 +261,7 @@ int iwl_sta_update_ht(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
261 cmd.station_flags = flags; 261 cmd.station_flags = flags;
262 cmd.sta.sta_id = sta_id; 262 cmd.sta.sta_id = sta_id;
263 263
264 return iwl_send_add_sta(priv, &cmd, CMD_SYNC); 264 return iwl_send_add_sta(priv, &cmd, 0);
265} 265}
266 266
267static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, 267static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
@@ -413,7 +413,7 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
413 spin_unlock_bh(&priv->sta_lock); 413 spin_unlock_bh(&priv->sta_lock);
414 414
415 /* Add station to device's station table */ 415 /* Add station to device's station table */
416 ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 416 ret = iwl_send_add_sta(priv, &sta_cmd, 0);
417 if (ret) { 417 if (ret) {
418 spin_lock_bh(&priv->sta_lock); 418 spin_lock_bh(&priv->sta_lock);
419 IWL_ERR(priv, "Adding station %pM failed.\n", 419 IWL_ERR(priv, "Adding station %pM failed.\n",
@@ -456,7 +456,6 @@ static int iwl_send_remove_station(struct iwl_priv *priv,
456 struct iwl_host_cmd cmd = { 456 struct iwl_host_cmd cmd = {
457 .id = REPLY_REMOVE_STA, 457 .id = REPLY_REMOVE_STA,
458 .len = { sizeof(struct iwl_rem_sta_cmd), }, 458 .len = { sizeof(struct iwl_rem_sta_cmd), },
459 .flags = CMD_SYNC,
460 .data = { &rm_sta_cmd, }, 459 .data = { &rm_sta_cmd, },
461 }; 460 };
462 461
@@ -740,7 +739,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
740 send_lq = true; 739 send_lq = true;
741 } 740 }
742 spin_unlock_bh(&priv->sta_lock); 741 spin_unlock_bh(&priv->sta_lock);
743 ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 742 ret = iwl_send_add_sta(priv, &sta_cmd, 0);
744 if (ret) { 743 if (ret) {
745 spin_lock_bh(&priv->sta_lock); 744 spin_lock_bh(&priv->sta_lock);
746 IWL_ERR(priv, "Adding station %pM failed.\n", 745 IWL_ERR(priv, "Adding station %pM failed.\n",
@@ -756,8 +755,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
756 * current LQ command 755 * current LQ command
757 */ 756 */
758 if (send_lq) 757 if (send_lq)
759 iwl_send_lq_cmd(priv, ctx, &lq, 758 iwl_send_lq_cmd(priv, ctx, &lq, 0, true);
760 CMD_SYNC, true);
761 spin_lock_bh(&priv->sta_lock); 759 spin_lock_bh(&priv->sta_lock);
762 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; 760 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS;
763 } 761 }
@@ -968,7 +966,7 @@ int iwlagn_add_bssid_station(struct iwl_priv *priv,
968 return -ENOMEM; 966 return -ENOMEM;
969 } 967 }
970 968
971 ret = iwl_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true); 969 ret = iwl_send_lq_cmd(priv, ctx, link_cmd, 0, true);
972 if (ret) 970 if (ret)
973 IWL_ERR(priv, "Link quality command failed (%d)\n", ret); 971 IWL_ERR(priv, "Link quality command failed (%d)\n", ret);
974 972
@@ -999,7 +997,6 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv,
999 struct iwl_host_cmd cmd = { 997 struct iwl_host_cmd cmd = {
1000 .id = ctx->wep_key_cmd, 998 .id = ctx->wep_key_cmd,
1001 .data = { wep_cmd, }, 999 .data = { wep_cmd, },
1002 .flags = CMD_SYNC,
1003 }; 1000 };
1004 1001
1005 might_sleep(); 1002 might_sleep();
@@ -1248,7 +1245,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
1248 sta_cmd.sta.modify_mask = STA_MODIFY_KEY_MASK; 1245 sta_cmd.sta.modify_mask = STA_MODIFY_KEY_MASK;
1249 sta_cmd.mode = STA_CONTROL_MODIFY_MSK; 1246 sta_cmd.mode = STA_CONTROL_MODIFY_MSK;
1250 1247
1251 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 1248 return iwl_send_add_sta(priv, &sta_cmd, 0);
1252} 1249}
1253 1250
1254int iwl_set_dynamic_key(struct iwl_priv *priv, 1251int iwl_set_dynamic_key(struct iwl_priv *priv,
@@ -1284,13 +1281,13 @@ int iwl_set_dynamic_key(struct iwl_priv *priv,
1284 ieee80211_get_key_rx_seq(keyconf, 0, &seq); 1281 ieee80211_get_key_rx_seq(keyconf, 0, &seq);
1285 ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k); 1282 ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k);
1286 ret = iwlagn_send_sta_key(priv, keyconf, sta_id, 1283 ret = iwlagn_send_sta_key(priv, keyconf, sta_id,
1287 seq.tkip.iv32, p1k, CMD_SYNC); 1284 seq.tkip.iv32, p1k, 0);
1288 break; 1285 break;
1289 case WLAN_CIPHER_SUITE_CCMP: 1286 case WLAN_CIPHER_SUITE_CCMP:
1290 case WLAN_CIPHER_SUITE_WEP40: 1287 case WLAN_CIPHER_SUITE_WEP40:
1291 case WLAN_CIPHER_SUITE_WEP104: 1288 case WLAN_CIPHER_SUITE_WEP104:
1292 ret = iwlagn_send_sta_key(priv, keyconf, sta_id, 1289 ret = iwlagn_send_sta_key(priv, keyconf, sta_id,
1293 0, NULL, CMD_SYNC); 1290 0, NULL, 0);
1294 break; 1291 break;
1295 default: 1292 default:
1296 IWL_ERR(priv, "Unknown cipher %x\n", keyconf->cipher); 1293 IWL_ERR(priv, "Unknown cipher %x\n", keyconf->cipher);
@@ -1409,7 +1406,7 @@ int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid)
1409 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); 1406 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
1410 spin_unlock_bh(&priv->sta_lock); 1407 spin_unlock_bh(&priv->sta_lock);
1411 1408
1412 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 1409 return iwl_send_add_sta(priv, &sta_cmd, 0);
1413} 1410}
1414 1411
1415int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, 1412int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta,
@@ -1433,7 +1430,7 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta,
1433 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); 1430 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
1434 spin_unlock_bh(&priv->sta_lock); 1431 spin_unlock_bh(&priv->sta_lock);
1435 1432
1436 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 1433 return iwl_send_add_sta(priv, &sta_cmd, 0);
1437} 1434}
1438 1435
1439int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, 1436int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta,
@@ -1458,7 +1455,7 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta,
1458 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); 1455 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
1459 spin_unlock_bh(&priv->sta_lock); 1456 spin_unlock_bh(&priv->sta_lock);
1460 1457
1461 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 1458 return iwl_send_add_sta(priv, &sta_cmd, 0);
1462} 1459}
1463 1460
1464 1461
diff --git a/drivers/net/wireless/iwlwifi/dvm/tt.c b/drivers/net/wireless/iwlwifi/dvm/tt.c
index 058c5892c427..acb981a0a0aa 100644
--- a/drivers/net/wireless/iwlwifi/dvm/tt.c
+++ b/drivers/net/wireless/iwlwifi/dvm/tt.c
@@ -236,7 +236,7 @@ static void iwl_prepare_ct_kill_task(struct iwl_priv *priv)
236{ 236{
237 IWL_DEBUG_TEMP(priv, "Prepare to enter IWL_TI_CT_KILL\n"); 237 IWL_DEBUG_TEMP(priv, "Prepare to enter IWL_TI_CT_KILL\n");
238 /* make request to retrieve statistics information */ 238 /* make request to retrieve statistics information */
239 iwl_send_statistics_request(priv, CMD_SYNC, false); 239 iwl_send_statistics_request(priv, 0, false);
240 /* Reschedule the ct_kill wait timer */ 240 /* Reschedule the ct_kill wait timer */
241 mod_timer(&priv->thermal_throttle.ct_kill_waiting_tm, 241 mod_timer(&priv->thermal_throttle.ct_kill_waiting_tm,
242 jiffies + msecs_to_jiffies(CT_KILL_WAITING_DURATION)); 242 jiffies + msecs_to_jiffies(CT_KILL_WAITING_DURATION));
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c
index 398dd096674c..3255a1723d17 100644
--- a/drivers/net/wireless/iwlwifi/dvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/dvm/tx.c
@@ -402,10 +402,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
402 /* aggregation is on for this <sta,tid> */ 402 /* aggregation is on for this <sta,tid> */
403 if (info->flags & IEEE80211_TX_CTL_AMPDU && 403 if (info->flags & IEEE80211_TX_CTL_AMPDU &&
404 tid_data->agg.state != IWL_AGG_ON) { 404 tid_data->agg.state != IWL_AGG_ON) {
405 IWL_ERR(priv, "TX_CTL_AMPDU while not in AGG:" 405 IWL_ERR(priv,
406 " Tx flags = 0x%08x, agg.state = %d", 406 "TX_CTL_AMPDU while not in AGG: Tx flags = 0x%08x, agg.state = %d\n",
407 info->flags, tid_data->agg.state); 407 info->flags, tid_data->agg.state);
408 IWL_ERR(priv, "sta_id = %d, tid = %d seq_num = %d", 408 IWL_ERR(priv, "sta_id = %d, tid = %d seq_num = %d\n",
409 sta_id, tid, 409 sta_id, tid,
410 IEEE80211_SEQ_TO_SN(tid_data->seq_number)); 410 IEEE80211_SEQ_TO_SN(tid_data->seq_number));
411 goto drop_unlock_sta; 411 goto drop_unlock_sta;
@@ -416,7 +416,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
416 */ 416 */
417 if (WARN_ONCE(tid_data->agg.state != IWL_AGG_ON && 417 if (WARN_ONCE(tid_data->agg.state != IWL_AGG_ON &&
418 tid_data->agg.state != IWL_AGG_OFF, 418 tid_data->agg.state != IWL_AGG_OFF,
419 "Tx while agg.state = %d", tid_data->agg.state)) 419 "Tx while agg.state = %d\n", tid_data->agg.state))
420 goto drop_unlock_sta; 420 goto drop_unlock_sta;
421 421
422 seq_number = tid_data->seq_number; 422 seq_number = tid_data->seq_number;
@@ -778,8 +778,8 @@ static void iwlagn_check_ratid_empty(struct iwl_priv *priv, int sta_id, u8 tid)
778 /* There are no packets for this RA / TID in the HW any more */ 778 /* There are no packets for this RA / TID in the HW any more */
779 if (tid_data->agg.ssn == tid_data->next_reclaimed) { 779 if (tid_data->agg.ssn == tid_data->next_reclaimed) {
780 IWL_DEBUG_TX_QUEUES(priv, 780 IWL_DEBUG_TX_QUEUES(priv,
781 "Can continue DELBA flow ssn = next_recl =" 781 "Can continue DELBA flow ssn = next_recl = %d\n",
782 " %d", tid_data->next_reclaimed); 782 tid_data->next_reclaimed);
783 iwl_trans_txq_disable(priv->trans, 783 iwl_trans_txq_disable(priv->trans,
784 tid_data->agg.txq_id); 784 tid_data->agg.txq_id);
785 iwlagn_dealloc_agg_txq(priv, tid_data->agg.txq_id); 785 iwlagn_dealloc_agg_txq(priv, tid_data->agg.txq_id);
@@ -791,8 +791,8 @@ static void iwlagn_check_ratid_empty(struct iwl_priv *priv, int sta_id, u8 tid)
791 /* There are no packets for this RA / TID in the HW any more */ 791 /* There are no packets for this RA / TID in the HW any more */
792 if (tid_data->agg.ssn == tid_data->next_reclaimed) { 792 if (tid_data->agg.ssn == tid_data->next_reclaimed) {
793 IWL_DEBUG_TX_QUEUES(priv, 793 IWL_DEBUG_TX_QUEUES(priv,
794 "Can continue ADDBA flow ssn = next_recl =" 794 "Can continue ADDBA flow ssn = next_recl = %d\n",
795 " %d", tid_data->next_reclaimed); 795 tid_data->next_reclaimed);
796 tid_data->agg.state = IWL_AGG_STARTING; 796 tid_data->agg.state = IWL_AGG_STARTING;
797 ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid); 797 ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid);
798 } 798 }
@@ -1216,8 +1216,8 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1216 ctx->vif->type == NL80211_IFTYPE_STATION) { 1216 ctx->vif->type == NL80211_IFTYPE_STATION) {
1217 /* block and stop all queues */ 1217 /* block and stop all queues */
1218 priv->passive_no_rx = true; 1218 priv->passive_no_rx = true;
1219 IWL_DEBUG_TX_QUEUES(priv, "stop all queues: " 1219 IWL_DEBUG_TX_QUEUES(priv,
1220 "passive channel"); 1220 "stop all queues: passive channel\n");
1221 ieee80211_stop_queues(priv->hw); 1221 ieee80211_stop_queues(priv->hw);
1222 1222
1223 IWL_DEBUG_TX_REPLY(priv, 1223 IWL_DEBUG_TX_REPLY(priv,
@@ -1271,7 +1271,7 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1271 1271
1272 while (!skb_queue_empty(&skbs)) { 1272 while (!skb_queue_empty(&skbs)) {
1273 skb = __skb_dequeue(&skbs); 1273 skb = __skb_dequeue(&skbs);
1274 ieee80211_tx_status_ni(priv->hw, skb); 1274 ieee80211_tx_status(priv->hw, skb);
1275 } 1275 }
1276 1276
1277 return 0; 1277 return 0;
@@ -1411,7 +1411,7 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
1411 1411
1412 while (!skb_queue_empty(&reclaimed_skbs)) { 1412 while (!skb_queue_empty(&reclaimed_skbs)) {
1413 skb = __skb_dequeue(&reclaimed_skbs); 1413 skb = __skb_dequeue(&reclaimed_skbs);
1414 ieee80211_tx_status_ni(priv->hw, skb); 1414 ieee80211_tx_status(priv->hw, skb);
1415 } 1415 }
1416 1416
1417 return 0; 1417 return 0;
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c
index cf03ef5619d9..d5cee1530597 100644
--- a/drivers/net/wireless/iwlwifi/dvm/ucode.c
+++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c
@@ -172,7 +172,7 @@ static int iwl_send_wimax_coex(struct iwl_priv *priv)
172 memset(&coex_cmd, 0, sizeof(coex_cmd)); 172 memset(&coex_cmd, 0, sizeof(coex_cmd));
173 173
174 return iwl_dvm_send_cmd_pdu(priv, 174 return iwl_dvm_send_cmd_pdu(priv,
175 COEX_PRIORITY_TABLE_CMD, CMD_SYNC, 175 COEX_PRIORITY_TABLE_CMD, 0,
176 sizeof(coex_cmd), &coex_cmd); 176 sizeof(coex_cmd), &coex_cmd);
177} 177}
178 178
@@ -205,7 +205,7 @@ void iwl_send_prio_tbl(struct iwl_priv *priv)
205 memcpy(prio_tbl_cmd.prio_tbl, iwl_bt_prio_tbl, 205 memcpy(prio_tbl_cmd.prio_tbl, iwl_bt_prio_tbl,
206 sizeof(iwl_bt_prio_tbl)); 206 sizeof(iwl_bt_prio_tbl));
207 if (iwl_dvm_send_cmd_pdu(priv, 207 if (iwl_dvm_send_cmd_pdu(priv,
208 REPLY_BT_COEX_PRIO_TABLE, CMD_SYNC, 208 REPLY_BT_COEX_PRIO_TABLE, 0,
209 sizeof(prio_tbl_cmd), &prio_tbl_cmd)) 209 sizeof(prio_tbl_cmd), &prio_tbl_cmd))
210 IWL_ERR(priv, "failed to send BT prio tbl command\n"); 210 IWL_ERR(priv, "failed to send BT prio tbl command\n");
211} 211}
@@ -218,7 +218,7 @@ int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type)
218 env_cmd.action = action; 218 env_cmd.action = action;
219 env_cmd.type = type; 219 env_cmd.type = type;
220 ret = iwl_dvm_send_cmd_pdu(priv, 220 ret = iwl_dvm_send_cmd_pdu(priv,
221 REPLY_BT_COEX_PROT_ENV, CMD_SYNC, 221 REPLY_BT_COEX_PROT_ENV, 0,
222 sizeof(env_cmd), &env_cmd); 222 sizeof(env_cmd), &env_cmd);
223 if (ret) 223 if (ret)
224 IWL_ERR(priv, "failed to send BT env command\n"); 224 IWL_ERR(priv, "failed to send BT env command\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-8000.c b/drivers/net/wireless/iwlwifi/iwl-8000.c
index b26b68ce8205..51c41531d81d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-8000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-8000.c
@@ -83,6 +83,7 @@
83#define IWL8000_MODULE_FIRMWARE(api) IWL8000_FW_PRE __stringify(api) ".ucode" 83#define IWL8000_MODULE_FIRMWARE(api) IWL8000_FW_PRE __stringify(api) ".ucode"
84 84
85#define NVM_HW_SECTION_NUM_FAMILY_8000 10 85#define NVM_HW_SECTION_NUM_FAMILY_8000 10
86#define DEFAULT_NVM_FILE_FAMILY_8000 "iwl_nvm_8000.bin"
86 87
87static const struct iwl_base_params iwl8000_base_params = { 88static const struct iwl_base_params iwl8000_base_params = {
88 .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_8000, 89 .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_8000,
@@ -118,6 +119,7 @@ const struct iwl_cfg iwl8260_2ac_cfg = {
118 .ht_params = &iwl8000_ht_params, 119 .ht_params = &iwl8000_ht_params,
119 .nvm_ver = IWL8000_NVM_VERSION, 120 .nvm_ver = IWL8000_NVM_VERSION,
120 .nvm_calib_ver = IWL8000_TX_POWER_VERSION, 121 .nvm_calib_ver = IWL8000_TX_POWER_VERSION,
122 .default_nvm_file = DEFAULT_NVM_FILE_FAMILY_8000,
121}; 123};
122 124
123const struct iwl_cfg iwl8260_n_cfg = { 125const struct iwl_cfg iwl8260_n_cfg = {
@@ -127,6 +129,7 @@ const struct iwl_cfg iwl8260_n_cfg = {
127 .ht_params = &iwl8000_ht_params, 129 .ht_params = &iwl8000_ht_params,
128 .nvm_ver = IWL8000_NVM_VERSION, 130 .nvm_ver = IWL8000_NVM_VERSION,
129 .nvm_calib_ver = IWL8000_TX_POWER_VERSION, 131 .nvm_calib_ver = IWL8000_TX_POWER_VERSION,
132 .default_nvm_file = DEFAULT_NVM_FILE_FAMILY_8000,
130}; 133};
131 134
132MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_OK)); 135MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_OK));
diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h
index 97f23d6e480b..b7047905f41a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/iwlwifi/iwl-config.h
@@ -195,7 +195,7 @@ struct iwl_ht_params {
195 195
196/* lower blocks contain EEPROM image and calibration data */ 196/* lower blocks contain EEPROM image and calibration data */
197#define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ 197#define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */
198#define OTP_LOW_IMAGE_SIZE_FAMILY_7000 (4 * 512 * sizeof(u16)) /* 4 KB */ 198#define OTP_LOW_IMAGE_SIZE_FAMILY_7000 (16 * 512 * sizeof(u16)) /* 16 KB */
199#define OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(u16)) /* 32 KB */ 199#define OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(u16)) /* 32 KB */
200 200
201struct iwl_eeprom_params { 201struct iwl_eeprom_params {
@@ -275,6 +275,7 @@ struct iwl_cfg {
275 bool lp_xtal_workaround; 275 bool lp_xtal_workaround;
276 const struct iwl_pwr_tx_backoff *pwr_tx_backoffs; 276 const struct iwl_pwr_tx_backoff *pwr_tx_backoffs;
277 bool no_power_up_nic_in_init; 277 bool no_power_up_nic_in_init;
278 const char *default_nvm_file;
278}; 279};
279 280
280/* 281/*
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.c b/drivers/net/wireless/iwlwifi/iwl-debug.c
index 8a44f594528d..09feff4fa226 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.c
@@ -61,8 +61,6 @@
61 * 61 *
62 *****************************************************************************/ 62 *****************************************************************************/
63 63
64#define DEBUG
65
66#include <linux/device.h> 64#include <linux/device.h>
67#include <linux/interrupt.h> 65#include <linux/interrupt.h>
68#include <linux/export.h> 66#include <linux/export.h>
@@ -128,8 +126,8 @@ void __iwl_dbg(struct device *dev,
128#ifdef CONFIG_IWLWIFI_DEBUG 126#ifdef CONFIG_IWLWIFI_DEBUG
129 if (iwl_have_debug_level(level) && 127 if (iwl_have_debug_level(level) &&
130 (!limit || net_ratelimit())) 128 (!limit || net_ratelimit()))
131 dev_dbg(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U', 129 dev_printk(KERN_DEBUG, dev, "%c %s %pV",
132 function, &vaf); 130 in_interrupt() ? 'I' : 'U', function, &vaf);
133#endif 131#endif
134 trace_iwlwifi_dbg(level, in_interrupt(), function, &vaf); 132 trace_iwlwifi_dbg(level, in_interrupt(), function, &vaf);
135 va_end(args); 133 va_end(args);
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index c8cbdbe15924..295083510e72 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -47,12 +47,32 @@ void __iwl_warn(struct device *dev, const char *fmt, ...) __printf(2, 3);
47void __iwl_info(struct device *dev, const char *fmt, ...) __printf(2, 3); 47void __iwl_info(struct device *dev, const char *fmt, ...) __printf(2, 3);
48void __iwl_crit(struct device *dev, const char *fmt, ...) __printf(2, 3); 48void __iwl_crit(struct device *dev, const char *fmt, ...) __printf(2, 3);
49 49
50/* not all compilers can evaluate strlen() at compile time, so use sizeof() */
51#define CHECK_FOR_NEWLINE(f) BUILD_BUG_ON(f[sizeof(f) - 2] != '\n')
52
50/* No matter what is m (priv, bus, trans), this will work */ 53/* No matter what is m (priv, bus, trans), this will work */
51#define IWL_ERR(m, f, a...) __iwl_err((m)->dev, false, false, f, ## a) 54#define IWL_ERR_DEV(d, f, a...) \
52#define IWL_ERR_DEV(d, f, a...) __iwl_err((d), false, false, f, ## a) 55 do { \
53#define IWL_WARN(m, f, a...) __iwl_warn((m)->dev, f, ## a) 56 CHECK_FOR_NEWLINE(f); \
54#define IWL_INFO(m, f, a...) __iwl_info((m)->dev, f, ## a) 57 __iwl_err((d), false, false, f, ## a); \
55#define IWL_CRIT(m, f, a...) __iwl_crit((m)->dev, f, ## a) 58 } while (0)
59#define IWL_ERR(m, f, a...) \
60 IWL_ERR_DEV((m)->dev, f, ## a)
61#define IWL_WARN(m, f, a...) \
62 do { \
63 CHECK_FOR_NEWLINE(f); \
64 __iwl_warn((m)->dev, f, ## a); \
65 } while (0)
66#define IWL_INFO(m, f, a...) \
67 do { \
68 CHECK_FOR_NEWLINE(f); \
69 __iwl_info((m)->dev, f, ## a); \
70 } while (0)
71#define IWL_CRIT(m, f, a...) \
72 do { \
73 CHECK_FOR_NEWLINE(f); \
74 __iwl_crit((m)->dev, f, ## a); \
75 } while (0)
56 76
57#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING) 77#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)
58void __iwl_dbg(struct device *dev, 78void __iwl_dbg(struct device *dev,
@@ -72,12 +92,17 @@ do { \
72 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ 92 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
73} while (0) 93} while (0)
74 94
95#define __IWL_DEBUG_DEV(dev, level, limit, fmt, args...) \
96 do { \
97 CHECK_FOR_NEWLINE(fmt); \
98 __iwl_dbg(dev, level, limit, __func__, fmt, ##args); \
99 } while (0)
75#define IWL_DEBUG(m, level, fmt, args...) \ 100#define IWL_DEBUG(m, level, fmt, args...) \
76 __iwl_dbg((m)->dev, level, false, __func__, fmt, ##args) 101 __IWL_DEBUG_DEV((m)->dev, level, false, fmt, ##args)
77#define IWL_DEBUG_DEV(dev, level, fmt, args...) \ 102#define IWL_DEBUG_DEV(dev, level, fmt, args...) \
78 __iwl_dbg((dev), level, false, __func__, fmt, ##args) 103 __IWL_DEBUG_DEV(dev, level, false, fmt, ##args)
79#define IWL_DEBUG_LIMIT(m, level, fmt, args...) \ 104#define IWL_DEBUG_LIMIT(m, level, fmt, args...) \
80 __iwl_dbg((m)->dev, level, true, __func__, fmt, ##args) 105 __IWL_DEBUG_DEV((m)->dev, level, true, fmt, ##args)
81 106
82#ifdef CONFIG_IWLWIFI_DEBUG 107#ifdef CONFIG_IWLWIFI_DEBUG
83#define iwl_print_hex_dump(m, level, p, len) \ 108#define iwl_print_hex_dump(m, level, p, len) \
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index 0a3e841b44a9..f2a5c12269a3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -1243,6 +1243,7 @@ struct iwl_mod_params iwlwifi_mod_params = {
1243 .bt_coex_active = true, 1243 .bt_coex_active = true,
1244 .power_level = IWL_POWER_INDEX_1, 1244 .power_level = IWL_POWER_INDEX_1,
1245 .wd_disable = true, 1245 .wd_disable = true,
1246 .uapsd_disable = false,
1246 /* the rest are 0 by default */ 1247 /* the rest are 0 by default */
1247}; 1248};
1248IWL_EXPORT_SYMBOL(iwlwifi_mod_params); 1249IWL_EXPORT_SYMBOL(iwlwifi_mod_params);
@@ -1356,6 +1357,10 @@ MODULE_PARM_DESC(wd_disable,
1356module_param_named(nvm_file, iwlwifi_mod_params.nvm_file, charp, S_IRUGO); 1357module_param_named(nvm_file, iwlwifi_mod_params.nvm_file, charp, S_IRUGO);
1357MODULE_PARM_DESC(nvm_file, "NVM file name"); 1358MODULE_PARM_DESC(nvm_file, "NVM file name");
1358 1359
1360module_param_named(uapsd_disable, iwlwifi_mod_params.uapsd_disable,
1361 bool, S_IRUGO);
1362MODULE_PARM_DESC(uapsd_disable, "disable U-APSD functionality (default: N)");
1363
1359/* 1364/*
1360 * set bt_coex_active to true, uCode will do kill/defer 1365 * set bt_coex_active to true, uCode will do kill/defer
1361 * every time the priority line is asserted (BT is sending signals on the 1366 * every time the priority line is asserted (BT is sending signals on the
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h
index 6fea27c0dd8e..0aa7c0085c9f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fw.h
@@ -74,7 +74,7 @@
74 * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w). 74 * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w).
75 * @IWL_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P. 75 * @IWL_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P.
76 * @IWL_UCODE_TLV_FLAGS_DW_BC_TABLE: The SCD byte count table is in DWORDS 76 * @IWL_UCODE_TLV_FLAGS_DW_BC_TABLE: The SCD byte count table is in DWORDS
77 * @IWL_UCODE_TLV_FLAGS_UAPSD: This uCode image supports uAPSD 77 * @IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT: This uCode image supports uAPSD
78 * @IWL_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in scan 78 * @IWL_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in scan
79 * offload profile config command. 79 * offload profile config command.
80 * @IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six 80 * @IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six
@@ -107,6 +107,7 @@ enum iwl_ucode_tlv_flag {
107 IWL_UCODE_TLV_FLAGS_P2P_PM = BIT(21), 107 IWL_UCODE_TLV_FLAGS_P2P_PM = BIT(21),
108 IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM = BIT(22), 108 IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM = BIT(22),
109 IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_SCM = BIT(23), 109 IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_SCM = BIT(23),
110 IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT = BIT(24),
110 IWL_UCODE_TLV_FLAGS_EBS_SUPPORT = BIT(25), 111 IWL_UCODE_TLV_FLAGS_EBS_SUPPORT = BIT(25),
111 IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD = BIT(26), 112 IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD = BIT(26),
112 IWL_UCODE_TLV_FLAGS_BCAST_FILTERING = BIT(29), 113 IWL_UCODE_TLV_FLAGS_BCAST_FILTERING = BIT(29),
@@ -196,6 +197,11 @@ struct fw_img {
196 bool is_dual_cpus; 197 bool is_dual_cpus;
197}; 198};
198 199
200struct iwl_sf_region {
201 u32 addr;
202 u32 size;
203};
204
199/* uCode version contains 4 values: Major/Minor/API/Serial */ 205/* uCode version contains 4 values: Major/Minor/API/Serial */
200#define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) 206#define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
201#define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) 207#define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c
index 44cc3cf45762..5eef4ae7333b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -33,6 +33,7 @@
33#include "iwl-io.h" 33#include "iwl-io.h"
34#include "iwl-csr.h" 34#include "iwl-csr.h"
35#include "iwl-debug.h" 35#include "iwl-debug.h"
36#include "iwl-prph.h"
36#include "iwl-fh.h" 37#include "iwl-fh.h"
37 38
38#define IWL_POLL_INTERVAL 10 /* microseconds */ 39#define IWL_POLL_INTERVAL 10 /* microseconds */
@@ -183,6 +184,23 @@ void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask)
183} 184}
184IWL_EXPORT_SYMBOL(iwl_clear_bits_prph); 185IWL_EXPORT_SYMBOL(iwl_clear_bits_prph);
185 186
187void iwl_force_nmi(struct iwl_trans *trans)
188{
189 /*
190 * In HW previous to the 8000 HW family, and in the 8000 HW family
191 * itself when the revision step==0, the DEVICE_SET_NMI_REG is used
192 * to force an NMI. Otherwise, a different register -
193 * DEVICE_SET_NMI_8000B_REG - is used.
194 */
195 if ((trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) ||
196 ((trans->hw_rev & 0xc) == 0x0))
197 iwl_write_prph(trans, DEVICE_SET_NMI_REG, DEVICE_SET_NMI_VAL);
198 else
199 iwl_write_prph(trans, DEVICE_SET_NMI_8000B_REG,
200 DEVICE_SET_NMI_8000B_VAL);
201}
202IWL_EXPORT_SYMBOL(iwl_force_nmi);
203
186static const char *get_fh_string(int cmd) 204static const char *get_fh_string(int cmd)
187{ 205{
188#define IWL_CMD(x) case x: return #x 206#define IWL_CMD(x) case x: return #x
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h
index 665ddd9dbbc4..705d12c079e8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -80,6 +80,7 @@ void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask);
80void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, 80void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs,
81 u32 bits, u32 mask); 81 u32 bits, u32 mask);
82void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); 82void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask);
83void iwl_force_nmi(struct iwl_trans *trans);
83 84
84/* Error handling */ 85/* Error handling */
85int iwl_dump_fh(struct iwl_trans *trans, char **buf); 86int iwl_dump_fh(struct iwl_trans *trans, char **buf);
diff --git a/drivers/net/wireless/iwlwifi/iwl-modparams.h b/drivers/net/wireless/iwlwifi/iwl-modparams.h
index d994317db85b..d051857729ab 100644
--- a/drivers/net/wireless/iwlwifi/iwl-modparams.h
+++ b/drivers/net/wireless/iwlwifi/iwl-modparams.h
@@ -119,6 +119,7 @@ struct iwl_mod_params {
119#endif 119#endif
120 int ant_coupling; 120 int ant_coupling;
121 char *nvm_file; 121 char *nvm_file;
122 bool uapsd_disable;
122}; 123};
123 124
124#endif /* #__iwl_modparams_h__ */ 125#endif /* #__iwl_modparams_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
index 49963e4a887e..85eee79c495c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
@@ -128,7 +128,7 @@ static const u8 iwl_nvm_channels[] = {
128 128
129static const u8 iwl_nvm_channels_family_8000[] = { 129static const u8 iwl_nvm_channels_family_8000[] = {
130 /* 2.4 GHz */ 130 /* 2.4 GHz */
131 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 131 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
132 /* 5 GHz */ 132 /* 5 GHz */
133 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 133 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92,
134 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 134 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144,
@@ -138,7 +138,7 @@ static const u8 iwl_nvm_channels_family_8000[] = {
138#define IWL_NUM_CHANNELS ARRAY_SIZE(iwl_nvm_channels) 138#define IWL_NUM_CHANNELS ARRAY_SIZE(iwl_nvm_channels)
139#define IWL_NUM_CHANNELS_FAMILY_8000 ARRAY_SIZE(iwl_nvm_channels_family_8000) 139#define IWL_NUM_CHANNELS_FAMILY_8000 ARRAY_SIZE(iwl_nvm_channels_family_8000)
140#define NUM_2GHZ_CHANNELS 14 140#define NUM_2GHZ_CHANNELS 14
141#define NUM_2GHZ_CHANNELS_FAMILY_8000 13 141#define NUM_2GHZ_CHANNELS_FAMILY_8000 14
142#define FIRST_2GHZ_HT_MINUS 5 142#define FIRST_2GHZ_HT_MINUS 5
143#define LAST_2GHZ_HT_PLUS 9 143#define LAST_2GHZ_HT_PLUS 9
144#define LAST_5GHZ_HT 161 144#define LAST_5GHZ_HT 161
diff --git a/drivers/net/wireless/iwlwifi/iwl-phy-db.c b/drivers/net/wireless/iwlwifi/iwl-phy-db.c
index b761ac4822a3..d4fb5cad07ea 100644
--- a/drivers/net/wireless/iwlwifi/iwl-phy-db.c
+++ b/drivers/net/wireless/iwlwifi/iwl-phy-db.c
@@ -345,7 +345,6 @@ static int iwl_send_phy_db_cmd(struct iwl_phy_db *phy_db, u16 type,
345 struct iwl_phy_db_cmd phy_db_cmd; 345 struct iwl_phy_db_cmd phy_db_cmd;
346 struct iwl_host_cmd cmd = { 346 struct iwl_host_cmd cmd = {
347 .id = PHY_DB_CMD, 347 .id = PHY_DB_CMD,
348 .flags = CMD_SYNC,
349 }; 348 };
350 349
351 IWL_DEBUG_INFO(phy_db->trans, 350 IWL_DEBUG_INFO(phy_db->trans,
@@ -393,13 +392,13 @@ static int iwl_phy_db_send_all_channel_groups(
393 entry->data); 392 entry->data);
394 if (err) { 393 if (err) {
395 IWL_ERR(phy_db->trans, 394 IWL_ERR(phy_db->trans,
396 "Can't SEND phy_db section %d (%d), err %d", 395 "Can't SEND phy_db section %d (%d), err %d\n",
397 type, i, err); 396 type, i, err);
398 return err; 397 return err;
399 } 398 }
400 399
401 IWL_DEBUG_INFO(phy_db->trans, 400 IWL_DEBUG_INFO(phy_db->trans,
402 "Sent PHY_DB HCMD, type = %d num = %d", 401 "Sent PHY_DB HCMD, type = %d num = %d\n",
403 type, i); 402 type, i);
404 } 403 }
405 404
@@ -451,7 +450,7 @@ int iwl_send_phy_db_data(struct iwl_phy_db *phy_db)
451 IWL_NUM_PAPD_CH_GROUPS); 450 IWL_NUM_PAPD_CH_GROUPS);
452 if (err) { 451 if (err) {
453 IWL_ERR(phy_db->trans, 452 IWL_ERR(phy_db->trans,
454 "Cannot send channel specific PAPD groups"); 453 "Cannot send channel specific PAPD groups\n");
455 return err; 454 return err;
456 } 455 }
457 456
@@ -461,7 +460,7 @@ int iwl_send_phy_db_data(struct iwl_phy_db *phy_db)
461 IWL_NUM_TXP_CH_GROUPS); 460 IWL_NUM_TXP_CH_GROUPS);
462 if (err) { 461 if (err) {
463 IWL_ERR(phy_db->trans, 462 IWL_ERR(phy_db->trans,
464 "Cannot send channel specific TX power groups"); 463 "Cannot send channel specific TX power groups\n");
465 return err; 464 return err;
466 } 465 }
467 466
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h
index 779311080a9e..4997e27672b3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-prph.h
+++ b/drivers/net/wireless/iwlwifi/iwl-prph.h
@@ -105,6 +105,9 @@
105 105
106/* Device NMI register */ 106/* Device NMI register */
107#define DEVICE_SET_NMI_REG 0x00a01c30 107#define DEVICE_SET_NMI_REG 0x00a01c30
108#define DEVICE_SET_NMI_VAL 0x1
109#define DEVICE_SET_NMI_8000B_REG 0x00a01c24
110#define DEVICE_SET_NMI_8000B_VAL 0x1000000
108 111
109/* Shared registers (0x0..0x3ff, via target indirect or periphery */ 112/* Shared registers (0x0..0x3ff, via target indirect or periphery */
110#define SHR_BASE 0x00a10000 113#define SHR_BASE 0x00a10000
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 84ad48de6e29..34d49e171fb4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -189,10 +189,9 @@ static inline u32 iwl_rx_packet_payload_len(const struct iwl_rx_packet *pkt)
189/** 189/**
190 * enum CMD_MODE - how to send the host commands ? 190 * enum CMD_MODE - how to send the host commands ?
191 * 191 *
192 * @CMD_SYNC: The caller will be stalled until the fw responds to the command
193 * @CMD_ASYNC: Return right away and don't wait for the response 192 * @CMD_ASYNC: Return right away and don't wait for the response
194 * @CMD_WANT_SKB: valid only with CMD_SYNC. The caller needs the buffer of the 193 * @CMD_WANT_SKB: Not valid with CMD_ASYNC. The caller needs the buffer of
195 * response. The caller needs to call iwl_free_resp when done. 194 * the response. The caller needs to call iwl_free_resp when done.
196 * @CMD_HIGH_PRIO: The command is high priority - it goes to the front of the 195 * @CMD_HIGH_PRIO: The command is high priority - it goes to the front of the
197 * command queue, but after other high priority commands. valid only 196 * command queue, but after other high priority commands. valid only
198 * with CMD_ASYNC. 197 * with CMD_ASYNC.
@@ -202,7 +201,6 @@ static inline u32 iwl_rx_packet_payload_len(const struct iwl_rx_packet *pkt)
202 * (i.e. mark it as non-idle). 201 * (i.e. mark it as non-idle).
203 */ 202 */
204enum CMD_MODE { 203enum CMD_MODE {
205 CMD_SYNC = 0,
206 CMD_ASYNC = BIT(0), 204 CMD_ASYNC = BIT(0),
207 CMD_WANT_SKB = BIT(1), 205 CMD_WANT_SKB = BIT(1),
208 CMD_SEND_IN_RFKILL = BIT(2), 206 CMD_SEND_IN_RFKILL = BIT(2),
@@ -427,7 +425,7 @@ struct iwl_trans;
427 * @send_cmd:send a host command. Must return -ERFKILL if RFkill is asserted. 425 * @send_cmd:send a host command. Must return -ERFKILL if RFkill is asserted.
428 * If RFkill is asserted in the middle of a SYNC host command, it must 426 * If RFkill is asserted in the middle of a SYNC host command, it must
429 * return -ERFKILL straight away. 427 * return -ERFKILL straight away.
430 * May sleep only if CMD_SYNC is set 428 * May sleep only if CMD_ASYNC is not set
431 * @tx: send an skb 429 * @tx: send an skb
432 * Must be atomic 430 * Must be atomic
433 * @reclaim: free packet until ssn. Returns a list of freed packets. 431 * @reclaim: free packet until ssn. Returns a list of freed packets.
@@ -475,6 +473,8 @@ struct iwl_trans_ops {
475 void (*op_mode_leave)(struct iwl_trans *iwl_trans); 473 void (*op_mode_leave)(struct iwl_trans *iwl_trans);
476 int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw, 474 int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw,
477 bool run_in_rfkill); 475 bool run_in_rfkill);
476 int (*update_sf)(struct iwl_trans *trans,
477 struct iwl_sf_region *st_fwrd_space);
478 void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr); 478 void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr);
479 void (*stop_device)(struct iwl_trans *trans); 479 void (*stop_device)(struct iwl_trans *trans);
480 480
@@ -638,6 +638,17 @@ static inline int iwl_trans_start_fw(struct iwl_trans *trans,
638 return trans->ops->start_fw(trans, fw, run_in_rfkill); 638 return trans->ops->start_fw(trans, fw, run_in_rfkill);
639} 639}
640 640
641static inline int iwl_trans_update_sf(struct iwl_trans *trans,
642 struct iwl_sf_region *st_fwrd_space)
643{
644 might_sleep();
645
646 if (trans->ops->update_sf)
647 return trans->ops->update_sf(trans, st_fwrd_space);
648
649 return 0;
650}
651
641static inline void iwl_trans_stop_device(struct iwl_trans *trans) 652static inline void iwl_trans_stop_device(struct iwl_trans *trans)
642{ 653{
643 might_sleep(); 654 might_sleep();
@@ -696,7 +707,7 @@ static inline int iwl_trans_send_cmd(struct iwl_trans *trans,
696 return -EIO; 707 return -EIO;
697 708
698 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) { 709 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) {
699 IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); 710 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
700 return -EIO; 711 return -EIO;
701 } 712 }
702 713
@@ -738,7 +749,7 @@ static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
738 return -EIO; 749 return -EIO;
739 750
740 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) 751 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
741 IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); 752 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
742 753
743 return trans->ops->tx(trans, skb, dev_cmd, queue); 754 return trans->ops->tx(trans, skb, dev_cmd, queue);
744} 755}
@@ -747,7 +758,7 @@ static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue,
747 int ssn, struct sk_buff_head *skbs) 758 int ssn, struct sk_buff_head *skbs)
748{ 759{
749 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) 760 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
750 IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); 761 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
751 762
752 trans->ops->reclaim(trans, queue, ssn, skbs); 763 trans->ops->reclaim(trans, queue, ssn, skbs);
753} 764}
@@ -764,7 +775,7 @@ static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
764 might_sleep(); 775 might_sleep();
765 776
766 if (unlikely((trans->state != IWL_TRANS_FW_ALIVE))) 777 if (unlikely((trans->state != IWL_TRANS_FW_ALIVE)))
767 IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); 778 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
768 779
769 trans->ops->txq_enable(trans, queue, fifo, sta_id, tid, 780 trans->ops->txq_enable(trans, queue, fifo, sta_id, tid,
770 frame_limit, ssn); 781 frame_limit, ssn);
@@ -781,7 +792,7 @@ static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans,
781 u32 txq_bm) 792 u32 txq_bm)
782{ 793{
783 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) 794 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
784 IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); 795 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
785 796
786 return trans->ops->wait_tx_queue_empty(trans, txq_bm); 797 return trans->ops->wait_tx_queue_empty(trans, txq_bm);
787} 798}
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c
index 4284672d0397..cbad3ef3de0e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/coex.c
+++ b/drivers/net/wireless/iwlwifi/mvm/coex.c
@@ -106,7 +106,7 @@ static const u8 iwl_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = {
106 106
107static int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm) 107static int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm)
108{ 108{
109 return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PRIO_TABLE, CMD_SYNC, 109 return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PRIO_TABLE, 0,
110 sizeof(struct iwl_bt_coex_prio_tbl_cmd), 110 sizeof(struct iwl_bt_coex_prio_tbl_cmd),
111 &iwl_bt_prio_tbl); 111 &iwl_bt_prio_tbl);
112} 112}
@@ -124,10 +124,10 @@ const u32 iwl_bt_cts_kill_msk[BT_KILL_MSK_MAX] = {
124}; 124};
125 125
126static const __le32 iwl_bt_prio_boost[BT_COEX_BOOST_SIZE] = { 126static const __le32 iwl_bt_prio_boost[BT_COEX_BOOST_SIZE] = {
127 cpu_to_le32(0xf0f0f0f0), 127 cpu_to_le32(0xf0f0f0f0), /* 50% */
128 cpu_to_le32(0xc0c0c0c0), 128 cpu_to_le32(0xc0c0c0c0), /* 25% */
129 cpu_to_le32(0xfcfcfcfc), 129 cpu_to_le32(0xfcfcfcfc), /* 75% */
130 cpu_to_le32(0xff00ff00), 130 cpu_to_le32(0xfefefefe), /* 87.5% */
131}; 131};
132 132
133static const __le32 iwl_single_shared_ant[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { 133static const __le32 iwl_single_shared_ant[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = {
@@ -300,8 +300,8 @@ static const __le64 iwl_ci_mask[][3] = {
300}; 300};
301 301
302static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { 302static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = {
303 cpu_to_le32(0x22002200), 303 cpu_to_le32(0x28412201),
304 cpu_to_le32(0x33113311), 304 cpu_to_le32(0x11118451),
305}; 305};
306 306
307struct corunning_block_luts { 307struct corunning_block_luts {
@@ -565,7 +565,6 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
565 .id = BT_CONFIG, 565 .id = BT_CONFIG,
566 .len = { sizeof(*bt_cmd), }, 566 .len = { sizeof(*bt_cmd), },
567 .dataflags = { IWL_HCMD_DFL_NOCOPY, }, 567 .dataflags = { IWL_HCMD_DFL_NOCOPY, },
568 .flags = CMD_SYNC,
569 }; 568 };
570 int ret; 569 int ret;
571 u32 flags; 570 u32 flags;
@@ -663,7 +662,6 @@ static int iwl_mvm_bt_udpate_ctrl_kill_msk(struct iwl_mvm *mvm,
663 .data[0] = &bt_cmd, 662 .data[0] = &bt_cmd,
664 .len = { sizeof(*bt_cmd), }, 663 .len = { sizeof(*bt_cmd), },
665 .dataflags = { IWL_HCMD_DFL_NOCOPY, }, 664 .dataflags = { IWL_HCMD_DFL_NOCOPY, },
666 .flags = CMD_SYNC,
667 }; 665 };
668 int ret = 0; 666 int ret = 0;
669 667
@@ -803,23 +801,10 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
803 801
804 switch (vif->type) { 802 switch (vif->type) {
805 case NL80211_IFTYPE_STATION: 803 case NL80211_IFTYPE_STATION:
804 /* Count BSSes vifs */
805 data->num_bss_ifaces++;
806 /* default smps_mode for BSS / P2P client is AUTOMATIC */ 806 /* default smps_mode for BSS / P2P client is AUTOMATIC */
807 smps_mode = IEEE80211_SMPS_AUTOMATIC; 807 smps_mode = IEEE80211_SMPS_AUTOMATIC;
808 data->num_bss_ifaces++;
809
810 /*
811 * Count unassoc BSSes, relax SMSP constraints
812 * and disable reduced Tx Power
813 */
814 if (!vif->bss_conf.assoc) {
815 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX,
816 smps_mode);
817 if (iwl_mvm_bt_coex_reduced_txp(mvm,
818 mvmvif->ap_sta_id,
819 false))
820 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n");
821 return;
822 }
823 break; 808 break;
824 case NL80211_IFTYPE_AP: 809 case NL80211_IFTYPE_AP:
825 /* default smps_mode for AP / GO is OFF */ 810 /* default smps_mode for AP / GO is OFF */
@@ -845,6 +830,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
845 /* ... relax constraints and disable rssi events */ 830 /* ... relax constraints and disable rssi events */
846 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, 831 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX,
847 smps_mode); 832 smps_mode);
833 data->reduced_tx_power = false;
848 if (vif->type == NL80211_IFTYPE_STATION) 834 if (vif->type == NL80211_IFTYPE_STATION)
849 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); 835 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
850 return; 836 return;
@@ -857,6 +843,11 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
857 smps_mode = vif->type == NL80211_IFTYPE_AP ? 843 smps_mode = vif->type == NL80211_IFTYPE_AP ?
858 IEEE80211_SMPS_OFF : 844 IEEE80211_SMPS_OFF :
859 IEEE80211_SMPS_DYNAMIC; 845 IEEE80211_SMPS_DYNAMIC;
846
847 /* relax SMPS contraints for next association */
848 if (!vif->bss_conf.assoc)
849 smps_mode = IEEE80211_SMPS_AUTOMATIC;
850
860 IWL_DEBUG_COEX(data->mvm, 851 IWL_DEBUG_COEX(data->mvm,
861 "mac %d: bt_status %d bt_activity_grading %d smps_req %d\n", 852 "mac %d: bt_status %d bt_activity_grading %d smps_req %d\n",
862 mvmvif->id, data->notif->bt_status, bt_activity_grading, 853 mvmvif->id, data->notif->bt_status, bt_activity_grading,
@@ -903,26 +894,21 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
903 /* if secondary is not NULL, it might be a GO */ 894 /* if secondary is not NULL, it might be a GO */
904 data->secondary = chanctx_conf; 895 data->secondary = chanctx_conf;
905 896
906 /* don't reduce the Tx power if in loose scheme */ 897 /*
898 * don't reduce the Tx power if one of these is true:
899 * we are in LOOSE
900 * single share antenna product
901 * BT is active
902 * we are associated
903 */
907 if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || 904 if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT ||
908 mvm->cfg->bt_shared_single_ant) { 905 mvm->cfg->bt_shared_single_ant || !vif->bss_conf.assoc ||
906 !data->notif->bt_status) {
909 data->reduced_tx_power = false; 907 data->reduced_tx_power = false;
910 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); 908 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
911 return; 909 return;
912 } 910 }
913 911
914 /* reduced Txpower only if BT is on, so ...*/
915 if (!data->notif->bt_status) {
916 /* ... cancel reduced Tx power ... */
917 if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false))
918 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n");
919 data->reduced_tx_power = false;
920
921 /* ... and there is no need to get reports on RSSI any more. */
922 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
923 return;
924 }
925
926 /* try to get the avg rssi from fw */ 912 /* try to get the avg rssi from fw */
927 ave_rssi = mvmvif->bf_data.ave_beacon_signal; 913 ave_rssi = mvmvif->bf_data.ave_beacon_signal;
928 914
@@ -1022,9 +1008,9 @@ static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm)
1022 1008
1023 /* Don't spam the fw with the same command over and over */ 1009 /* Don't spam the fw with the same command over and over */
1024 if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) { 1010 if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) {
1025 if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, CMD_SYNC, 1011 if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, 0,
1026 sizeof(cmd), &cmd)) 1012 sizeof(cmd), &cmd))
1027 IWL_ERR(mvm, "Failed to send BT_CI cmd"); 1013 IWL_ERR(mvm, "Failed to send BT_CI cmd\n");
1028 memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd)); 1014 memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd));
1029 } 1015 }
1030 1016
@@ -1039,7 +1025,6 @@ static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm)
1039 IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); 1025 IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n");
1040} 1026}
1041 1027
1042/* upon association, the fw will send in BT Coex notification */
1043int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, 1028int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
1044 struct iwl_rx_cmd_buffer *rxb, 1029 struct iwl_rx_cmd_buffer *rxb,
1045 struct iwl_device_cmd *dev_cmd) 1030 struct iwl_device_cmd *dev_cmd)
@@ -1278,7 +1263,6 @@ int iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm,
1278 .id = BT_CONFIG, 1263 .id = BT_CONFIG,
1279 .len = { sizeof(*bt_cmd), }, 1264 .len = { sizeof(*bt_cmd), },
1280 .dataflags = { IWL_HCMD_DFL_NOCOPY, }, 1265 .dataflags = { IWL_HCMD_DFL_NOCOPY, },
1281 .flags = CMD_SYNC,
1282 }; 1266 };
1283 1267
1284 if (!IWL_MVM_BT_COEX_CORUNNING) 1268 if (!IWL_MVM_BT_COEX_CORUNNING)
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c
index 7694472a303e..7dc71f344c94 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -193,8 +193,7 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
193 wkc.wep_key.key_offset = data->wep_key_idx; 193 wkc.wep_key.key_offset = data->wep_key_idx;
194 } 194 }
195 195
196 ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, CMD_SYNC, 196 ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, 0, sizeof(wkc), &wkc);
197 sizeof(wkc), &wkc);
198 data->error = ret != 0; 197 data->error = ret != 0;
199 198
200 mvm->ptk_ivlen = key->iv_len; 199 mvm->ptk_ivlen = key->iv_len;
@@ -341,7 +340,6 @@ static int iwl_mvm_send_patterns(struct iwl_mvm *mvm,
341 struct iwl_host_cmd cmd = { 340 struct iwl_host_cmd cmd = {
342 .id = WOWLAN_PATTERNS, 341 .id = WOWLAN_PATTERNS,
343 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 342 .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
344 .flags = CMD_SYNC,
345 }; 343 };
346 int i, err; 344 int i, err;
347 345
@@ -518,7 +516,6 @@ static int iwl_mvm_send_remote_wake_cfg(struct iwl_mvm *mvm,
518 .id = REMOTE_WAKE_CONFIG_CMD, 516 .id = REMOTE_WAKE_CONFIG_CMD,
519 .len = { sizeof(*cfg), }, 517 .len = { sizeof(*cfg), },
520 .dataflags = { IWL_HCMD_DFL_NOCOPY, }, 518 .dataflags = { IWL_HCMD_DFL_NOCOPY, },
521 .flags = CMD_SYNC,
522 }; 519 };
523 int ret; 520 int ret;
524 521
@@ -719,7 +716,7 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
719 for (i = 1; i < MAX_BINDINGS; i++) 716 for (i = 1; i < MAX_BINDINGS; i++)
720 quota_cmd.quotas[i].id_and_color = cpu_to_le32(FW_CTXT_INVALID); 717 quota_cmd.quotas[i].id_and_color = cpu_to_le32(FW_CTXT_INVALID);
721 718
722 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC, 719 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, 0,
723 sizeof(quota_cmd), &quota_cmd); 720 sizeof(quota_cmd), &quota_cmd);
724 if (ret) 721 if (ret)
725 IWL_ERR(mvm, "Failed to send quota: %d\n", ret); 722 IWL_ERR(mvm, "Failed to send quota: %d\n", ret);
@@ -739,7 +736,7 @@ static int iwl_mvm_get_last_nonqos_seq(struct iwl_mvm *mvm,
739 }; 736 };
740 struct iwl_host_cmd cmd = { 737 struct iwl_host_cmd cmd = {
741 .id = NON_QOS_TX_COUNTER_CMD, 738 .id = NON_QOS_TX_COUNTER_CMD,
742 .flags = CMD_SYNC | CMD_WANT_SKB, 739 .flags = CMD_WANT_SKB,
743 }; 740 };
744 int err; 741 int err;
745 u32 size; 742 u32 size;
@@ -781,7 +778,7 @@ void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
781 778
782 mvmvif->seqno_valid = false; 779 mvmvif->seqno_valid = false;
783 780
784 if (iwl_mvm_send_cmd_pdu(mvm, NON_QOS_TX_COUNTER_CMD, CMD_SYNC, 781 if (iwl_mvm_send_cmd_pdu(mvm, NON_QOS_TX_COUNTER_CMD, 0,
785 sizeof(query_cmd), &query_cmd)) 782 sizeof(query_cmd), &query_cmd))
786 IWL_ERR(mvm, "failed to set non-QoS seqno\n"); 783 IWL_ERR(mvm, "failed to set non-QoS seqno\n");
787} 784}
@@ -796,7 +793,7 @@ iwl_mvm_send_wowlan_config_cmd(struct iwl_mvm *mvm,
796 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID) 793 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID)
797 cmd_len = sizeof(*cmd); 794 cmd_len = sizeof(*cmd);
798 795
799 return iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, CMD_SYNC, 796 return iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, 0,
800 cmd_len, cmd); 797 cmd_len, cmd);
801} 798}
802 799
@@ -825,7 +822,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
825 }; 822 };
826 struct iwl_host_cmd d3_cfg_cmd = { 823 struct iwl_host_cmd d3_cfg_cmd = {
827 .id = D3_CONFIG_CMD, 824 .id = D3_CONFIG_CMD,
828 .flags = CMD_SYNC | CMD_WANT_SKB, 825 .flags = CMD_WANT_SKB,
829 .data[0] = &d3_cfg_cmd_data, 826 .data[0] = &d3_cfg_cmd_data,
830 .len[0] = sizeof(d3_cfg_cmd_data), 827 .len[0] = sizeof(d3_cfg_cmd_data),
831 }; 828 };
@@ -975,7 +972,6 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
975 if (key_data.use_rsc_tsc) { 972 if (key_data.use_rsc_tsc) {
976 struct iwl_host_cmd rsc_tsc_cmd = { 973 struct iwl_host_cmd rsc_tsc_cmd = {
977 .id = WOWLAN_TSC_RSC_PARAM, 974 .id = WOWLAN_TSC_RSC_PARAM,
978 .flags = CMD_SYNC,
979 .data[0] = key_data.rsc_tsc, 975 .data[0] = key_data.rsc_tsc,
980 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 976 .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
981 .len[0] = sizeof(*key_data.rsc_tsc), 977 .len[0] = sizeof(*key_data.rsc_tsc),
@@ -989,7 +985,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
989 if (key_data.use_tkip) { 985 if (key_data.use_tkip) {
990 ret = iwl_mvm_send_cmd_pdu(mvm, 986 ret = iwl_mvm_send_cmd_pdu(mvm,
991 WOWLAN_TKIP_PARAM, 987 WOWLAN_TKIP_PARAM,
992 CMD_SYNC, sizeof(tkip_cmd), 988 0, sizeof(tkip_cmd),
993 &tkip_cmd); 989 &tkip_cmd);
994 if (ret) 990 if (ret)
995 goto out; 991 goto out;
@@ -1006,8 +1002,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
1006 kek_kck_cmd.replay_ctr = mvmvif->rekey_data.replay_ctr; 1002 kek_kck_cmd.replay_ctr = mvmvif->rekey_data.replay_ctr;
1007 1003
1008 ret = iwl_mvm_send_cmd_pdu(mvm, 1004 ret = iwl_mvm_send_cmd_pdu(mvm,
1009 WOWLAN_KEK_KCK_MATERIAL, 1005 WOWLAN_KEK_KCK_MATERIAL, 0,
1010 CMD_SYNC,
1011 sizeof(kek_kck_cmd), 1006 sizeof(kek_kck_cmd),
1012 &kek_kck_cmd); 1007 &kek_kck_cmd);
1013 if (ret) 1008 if (ret)
@@ -1023,7 +1018,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
1023 if (ret) 1018 if (ret)
1024 goto out; 1019 goto out;
1025 1020
1026 ret = iwl_mvm_send_proto_offload(mvm, vif, false, CMD_SYNC); 1021 ret = iwl_mvm_send_proto_offload(mvm, vif, false, 0);
1027 if (ret) 1022 if (ret)
1028 goto out; 1023 goto out;
1029 1024
@@ -1466,7 +1461,7 @@ static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm,
1466 } err_info; 1461 } err_info;
1467 struct iwl_host_cmd cmd = { 1462 struct iwl_host_cmd cmd = {
1468 .id = WOWLAN_GET_STATUSES, 1463 .id = WOWLAN_GET_STATUSES,
1469 .flags = CMD_SYNC | CMD_WANT_SKB, 1464 .flags = CMD_WANT_SKB,
1470 }; 1465 };
1471 struct iwl_wowlan_status_data status; 1466 struct iwl_wowlan_status_data status;
1472 struct iwl_wowlan_status *fw_status; 1467 struct iwl_wowlan_status *fw_status;
@@ -1492,7 +1487,7 @@ static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm,
1492 } 1487 }
1493 1488
1494 /* only for tracing for now */ 1489 /* only for tracing for now */
1495 ret = iwl_mvm_send_cmd_pdu(mvm, OFFLOADS_QUERY_CMD, CMD_SYNC, 0, NULL); 1490 ret = iwl_mvm_send_cmd_pdu(mvm, OFFLOADS_QUERY_CMD, 0, 0, NULL);
1496 if (ret) 1491 if (ret)
1497 IWL_ERR(mvm, "failed to query offload statistics (%d)\n", ret); 1492 IWL_ERR(mvm, "failed to query offload statistics (%d)\n", ret);
1498 1493
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
index 6047cfdafb95..21793c871a73 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
@@ -452,9 +452,9 @@ static ssize_t iwl_dbgfs_bf_params_write(struct ieee80211_vif *vif, char *buf,
452 mutex_lock(&mvm->mutex); 452 mutex_lock(&mvm->mutex);
453 iwl_dbgfs_update_bf(vif, param, value); 453 iwl_dbgfs_update_bf(vif, param, value);
454 if (param == MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER && !value) 454 if (param == MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER && !value)
455 ret = iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC); 455 ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0);
456 else 456 else
457 ret = iwl_mvm_enable_beacon_filter(mvm, vif, CMD_SYNC); 457 ret = iwl_mvm_enable_beacon_filter(mvm, vif, 0);
458 mutex_unlock(&mvm->mutex); 458 mutex_unlock(&mvm->mutex);
459 459
460 return ret ?: count; 460 return ret ?: count;
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
index bef487bb880e..29ca72695eaa 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
@@ -65,7 +65,6 @@
65#include "mvm.h" 65#include "mvm.h"
66#include "sta.h" 66#include "sta.h"
67#include "iwl-io.h" 67#include "iwl-io.h"
68#include "iwl-prph.h"
69#include "debugfs.h" 68#include "debugfs.h"
70#include "iwl-fw-error-dump.h" 69#include "iwl-fw-error-dump.h"
71 70
@@ -681,7 +680,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf,
681 mvm->restart_fw++; 680 mvm->restart_fw++;
682 681
683 /* take the return value to make compiler happy - it will fail anyway */ 682 /* take the return value to make compiler happy - it will fail anyway */
684 ret = iwl_mvm_send_cmd_pdu(mvm, REPLY_ERROR, CMD_SYNC, 0, NULL); 683 ret = iwl_mvm_send_cmd_pdu(mvm, REPLY_ERROR, 0, 0, NULL);
685 684
686 mutex_unlock(&mvm->mutex); 685 mutex_unlock(&mvm->mutex);
687 686
@@ -691,7 +690,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf,
691static ssize_t iwl_dbgfs_fw_nmi_write(struct iwl_mvm *mvm, char *buf, 690static ssize_t iwl_dbgfs_fw_nmi_write(struct iwl_mvm *mvm, char *buf,
692 size_t count, loff_t *ppos) 691 size_t count, loff_t *ppos)
693{ 692{
694 iwl_write_prph(mvm->trans, DEVICE_SET_NMI_REG, 1); 693 iwl_force_nmi(mvm->trans);
695 694
696 return count; 695 return count;
697} 696}
@@ -838,7 +837,7 @@ static ssize_t iwl_dbgfs_bcast_filters_write(struct iwl_mvm *mvm, char *buf,
838 /* send updated bcast filtering configuration */ 837 /* send updated bcast filtering configuration */
839 if (mvm->dbgfs_bcast_filtering.override && 838 if (mvm->dbgfs_bcast_filtering.override &&
840 iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) 839 iwl_mvm_bcast_filter_build_cmd(mvm, &cmd))
841 err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, CMD_SYNC, 840 err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0,
842 sizeof(cmd), &cmd); 841 sizeof(cmd), &cmd);
843 mutex_unlock(&mvm->mutex); 842 mutex_unlock(&mvm->mutex);
844 843
@@ -910,7 +909,7 @@ static ssize_t iwl_dbgfs_bcast_filters_macs_write(struct iwl_mvm *mvm,
910 /* send updated bcast filtering configuration */ 909 /* send updated bcast filtering configuration */
911 if (mvm->dbgfs_bcast_filtering.override && 910 if (mvm->dbgfs_bcast_filtering.override &&
912 iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) 911 iwl_mvm_bcast_filter_build_cmd(mvm, &cmd))
913 err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, CMD_SYNC, 912 err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0,
914 sizeof(cmd), &cmd); 913 sizeof(cmd), &cmd);
915 mutex_unlock(&mvm->mutex); 914 mutex_unlock(&mvm->mutex);
916 915
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c
index 34ae3f32b300..883e702152d5 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/iwlwifi/mvm/fw.c
@@ -99,7 +99,7 @@ static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant)
99 }; 99 };
100 100
101 IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant); 101 IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant);
102 return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, CMD_SYNC, 102 return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, 0,
103 sizeof(tx_ant_cmd), &tx_ant_cmd); 103 sizeof(tx_ant_cmd), &tx_ant_cmd);
104} 104}
105 105
@@ -137,6 +137,8 @@ static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
137 alive_data->scd_base_addr = le32_to_cpu(palive2->scd_base_ptr); 137 alive_data->scd_base_addr = le32_to_cpu(palive2->scd_base_ptr);
138 mvm->umac_error_event_table = 138 mvm->umac_error_event_table =
139 le32_to_cpu(palive2->error_info_addr); 139 le32_to_cpu(palive2->error_info_addr);
140 mvm->sf_space.addr = le32_to_cpu(palive2->st_fwrd_addr);
141 mvm->sf_space.size = le32_to_cpu(palive2->st_fwrd_size);
140 142
141 alive_data->valid = le16_to_cpu(palive2->status) == 143 alive_data->valid = le16_to_cpu(palive2->status) ==
142 IWL_ALIVE_STATUS_OK; 144 IWL_ALIVE_STATUS_OK;
@@ -180,6 +182,7 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
180 int ret, i; 182 int ret, i;
181 enum iwl_ucode_type old_type = mvm->cur_ucode; 183 enum iwl_ucode_type old_type = mvm->cur_ucode;
182 static const u8 alive_cmd[] = { MVM_ALIVE }; 184 static const u8 alive_cmd[] = { MVM_ALIVE };
185 struct iwl_sf_region st_fwrd_space;
183 186
184 fw = iwl_get_ucode_image(mvm, ucode_type); 187 fw = iwl_get_ucode_image(mvm, ucode_type);
185 if (WARN_ON(!fw)) 188 if (WARN_ON(!fw))
@@ -215,6 +218,14 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
215 return -EIO; 218 return -EIO;
216 } 219 }
217 220
221 /*
222 * update the sdio allocation according to the pointer we get in the
223 * alive notification.
224 */
225 st_fwrd_space.addr = mvm->sf_space.addr;
226 st_fwrd_space.size = mvm->sf_space.size;
227 ret = iwl_trans_update_sf(mvm->trans, &st_fwrd_space);
228
218 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); 229 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr);
219 230
220 /* 231 /*
@@ -256,7 +267,7 @@ static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm)
256 IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n", 267 IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n",
257 phy_cfg_cmd.phy_cfg); 268 phy_cfg_cmd.phy_cfg);
258 269
259 return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, CMD_SYNC, 270 return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, 0,
260 sizeof(phy_cfg_cmd), &phy_cfg_cmd); 271 sizeof(phy_cfg_cmd), &phy_cfg_cmd);
261} 272}
262 273
@@ -303,7 +314,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
303 } 314 }
304 315
305 /* In case we read the NVM from external file, load it to the NIC */ 316 /* In case we read the NVM from external file, load it to the NIC */
306 if (iwlwifi_mod_params.nvm_file) 317 if (mvm->nvm_file_name)
307 iwl_mvm_load_nvm_to_nic(mvm); 318 iwl_mvm_load_nvm_to_nic(mvm);
308 319
309 ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans); 320 ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans);
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
index 56cf58e95698..2c51e40179b5 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
@@ -685,7 +685,7 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
685static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm, 685static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm,
686 struct iwl_mac_ctx_cmd *cmd) 686 struct iwl_mac_ctx_cmd *cmd)
687{ 687{
688 int ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, CMD_SYNC, 688 int ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, 0,
689 sizeof(*cmd), cmd); 689 sizeof(*cmd), cmd);
690 if (ret) 690 if (ret)
691 IWL_ERR(mvm, "Failed to send MAC context (action:%d): %d\n", 691 IWL_ERR(mvm, "Failed to send MAC context (action:%d): %d\n",
@@ -693,14 +693,37 @@ static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm,
693 return ret; 693 return ret;
694} 694}
695 695
696/* 696static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
697 * Fill the specific data for mac context of type station or p2p client 697 struct ieee80211_vif *vif,
698 */ 698 u32 action, bool force_assoc_off)
699static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm,
700 struct ieee80211_vif *vif,
701 struct iwl_mac_data_sta *ctxt_sta,
702 bool force_assoc_off)
703{ 699{
700 struct iwl_mac_ctx_cmd cmd = {};
701 struct iwl_mac_data_sta *ctxt_sta;
702
703 WARN_ON(vif->type != NL80211_IFTYPE_STATION);
704
705 /* Fill the common data for all mac context types */
706 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
707
708 if (vif->p2p) {
709 struct ieee80211_p2p_noa_attr *noa =
710 &vif->bss_conf.p2p_noa_attr;
711
712 cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow &
713 IEEE80211_P2P_OPPPS_CTWINDOW_MASK);
714 ctxt_sta = &cmd.p2p_sta.sta;
715 } else {
716 /* Allow beacons to pass through as long as we are not
717 * associated, or we do not have dtim period information.
718 */
719 if (!vif->bss_conf.assoc || !vif->bss_conf.dtim_period)
720 cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON);
721 else
722 cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON);
723
724 ctxt_sta = &cmd.sta;
725 }
726
704 /* We need the dtim_period to set the MAC as associated */ 727 /* We need the dtim_period to set the MAC as associated */
705 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period && 728 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period &&
706 !force_assoc_off) { 729 !force_assoc_off) {
@@ -752,51 +775,6 @@ static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm,
752 775
753 ctxt_sta->listen_interval = cpu_to_le32(mvm->hw->conf.listen_interval); 776 ctxt_sta->listen_interval = cpu_to_le32(mvm->hw->conf.listen_interval);
754 ctxt_sta->assoc_id = cpu_to_le32(vif->bss_conf.aid); 777 ctxt_sta->assoc_id = cpu_to_le32(vif->bss_conf.aid);
755}
756
757static int iwl_mvm_mac_ctxt_cmd_station(struct iwl_mvm *mvm,
758 struct ieee80211_vif *vif,
759 u32 action)
760{
761 struct iwl_mac_ctx_cmd cmd = {};
762
763 WARN_ON(vif->type != NL80211_IFTYPE_STATION || vif->p2p);
764
765 /* Fill the common data for all mac context types */
766 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
767
768 /* Allow beacons to pass through as long as we are not associated,or we
769 * do not have dtim period information */
770 if (!vif->bss_conf.assoc || !vif->bss_conf.dtim_period)
771 cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON);
772 else
773 cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON);
774
775 /* Fill the data specific for station mode */
776 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta,
777 action == FW_CTXT_ACTION_ADD);
778
779 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
780}
781
782static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm,
783 struct ieee80211_vif *vif,
784 u32 action)
785{
786 struct iwl_mac_ctx_cmd cmd = {};
787 struct ieee80211_p2p_noa_attr *noa = &vif->bss_conf.p2p_noa_attr;
788
789 WARN_ON(vif->type != NL80211_IFTYPE_STATION || !vif->p2p);
790
791 /* Fill the common data for all mac context types */
792 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
793
794 /* Fill the data specific for station mode */
795 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta,
796 action == FW_CTXT_ACTION_ADD);
797
798 cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow &
799 IEEE80211_P2P_OPPPS_CTWINDOW_MASK);
800 778
801 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); 779 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
802} 780}
@@ -1138,12 +1116,8 @@ static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1138{ 1116{
1139 switch (vif->type) { 1117 switch (vif->type) {
1140 case NL80211_IFTYPE_STATION: 1118 case NL80211_IFTYPE_STATION:
1141 if (!vif->p2p) 1119 return iwl_mvm_mac_ctxt_cmd_sta(mvm, vif, action,
1142 return iwl_mvm_mac_ctxt_cmd_station(mvm, vif, 1120 action == FW_CTXT_ACTION_ADD);
1143 action);
1144 else
1145 return iwl_mvm_mac_ctxt_cmd_p2p_client(mvm, vif,
1146 action);
1147 break; 1121 break;
1148 case NL80211_IFTYPE_AP: 1122 case NL80211_IFTYPE_AP:
1149 if (!vif->p2p) 1123 if (!vif->p2p)
@@ -1211,7 +1185,7 @@ int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
1211 mvmvif->color)); 1185 mvmvif->color));
1212 cmd.action = cpu_to_le32(FW_CTXT_ACTION_REMOVE); 1186 cmd.action = cpu_to_le32(FW_CTXT_ACTION_REMOVE);
1213 1187
1214 ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, CMD_SYNC, 1188 ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, 0,
1215 sizeof(cmd), &cmd); 1189 sizeof(cmd), &cmd);
1216 if (ret) { 1190 if (ret) {
1217 IWL_ERR(mvm, "Failed to remove MAC context: %d\n", ret); 1191 IWL_ERR(mvm, "Failed to remove MAC context: %d\n", ret);
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index f20cbd06a49f..069ea18e1d7a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -276,7 +276,6 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
276 IEEE80211_HW_AMPDU_AGGREGATION | 276 IEEE80211_HW_AMPDU_AGGREGATION |
277 IEEE80211_HW_TIMING_BEACON_ONLY | 277 IEEE80211_HW_TIMING_BEACON_ONLY |
278 IEEE80211_HW_CONNECTION_MONITOR | 278 IEEE80211_HW_CONNECTION_MONITOR |
279 IEEE80211_HW_SUPPORTS_UAPSD |
280 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | 279 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
281 IEEE80211_HW_SUPPORTS_STATIC_SMPS; 280 IEEE80211_HW_SUPPORTS_STATIC_SMPS;
282 281
@@ -286,8 +285,6 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
286 IEEE80211_RADIOTAP_MCS_HAVE_STBC; 285 IEEE80211_RADIOTAP_MCS_HAVE_STBC;
287 hw->radiotap_vht_details |= IEEE80211_RADIOTAP_VHT_KNOWN_STBC; 286 hw->radiotap_vht_details |= IEEE80211_RADIOTAP_VHT_KNOWN_STBC;
288 hw->rate_control_algorithm = "iwl-mvm-rs"; 287 hw->rate_control_algorithm = "iwl-mvm-rs";
289 hw->uapsd_queues = IWL_UAPSD_AC_INFO;
290 hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP;
291 288
292 /* 289 /*
293 * Enable 11w if advertised by firmware and software crypto 290 * Enable 11w if advertised by firmware and software crypto
@@ -298,9 +295,13 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
298 !iwlwifi_mod_params.sw_crypto) 295 !iwlwifi_mod_params.sw_crypto)
299 hw->flags |= IEEE80211_HW_MFP_CAPABLE; 296 hw->flags |= IEEE80211_HW_MFP_CAPABLE;
300 297
301 /* Disable uAPSD due to firmware issues */ 298 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT &&
302 if (true) 299 IWL_UCODE_API(mvm->fw->ucode_ver) >= 9 &&
303 hw->flags &= ~IEEE80211_HW_SUPPORTS_UAPSD; 300 !iwlwifi_mod_params.uapsd_disable) {
301 hw->flags |= IEEE80211_HW_SUPPORTS_UAPSD;
302 hw->uapsd_queues = IWL_UAPSD_AC_INFO;
303 hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP;
304 }
304 305
305 hw->sta_data_size = sizeof(struct iwl_mvm_sta); 306 hw->sta_data_size = sizeof(struct iwl_mvm_sta);
306 hw->vif_data_size = sizeof(struct iwl_mvm_vif); 307 hw->vif_data_size = sizeof(struct iwl_mvm_vif);
@@ -772,7 +773,7 @@ static int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
772 .pwr_restriction = cpu_to_le16(tx_power), 773 .pwr_restriction = cpu_to_le16(tx_power),
773 }; 774 };
774 775
775 return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, CMD_SYNC, 776 return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0,
776 sizeof(reduce_txpwr_cmd), 777 sizeof(reduce_txpwr_cmd),
777 &reduce_txpwr_cmd); 778 &reduce_txpwr_cmd);
778} 779}
@@ -836,7 +837,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
836 goto out_release; 837 goto out_release;
837 838
838 /* beacon filtering */ 839 /* beacon filtering */
839 ret = iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC); 840 ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0);
840 if (ret) 841 if (ret)
841 goto out_remove_mac; 842 goto out_remove_mac;
842 843
@@ -1243,7 +1244,7 @@ static int iwl_mvm_configure_bcast_filter(struct iwl_mvm *mvm,
1243 if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) 1244 if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd))
1244 return 0; 1245 return 0;
1245 1246
1246 return iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, CMD_SYNC, 1247 return iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0,
1247 sizeof(cmd), &cmd); 1248 sizeof(cmd), &cmd);
1248} 1249}
1249#else 1250#else
@@ -1350,7 +1351,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
1350 iwl_mvm_remove_time_event(mvm, mvmvif, 1351 iwl_mvm_remove_time_event(mvm, mvmvif,
1351 &mvmvif->time_event_data); 1352 &mvmvif->time_event_data);
1352 iwl_mvm_sf_update(mvm, vif, false); 1353 iwl_mvm_sf_update(mvm, vif, false);
1353 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, CMD_SYNC)); 1354 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0));
1354 } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | 1355 } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS |
1355 BSS_CHANGED_QOS)) { 1356 BSS_CHANGED_QOS)) {
1356 ret = iwl_mvm_power_update_mac(mvm, vif); 1357 ret = iwl_mvm_power_update_mac(mvm, vif);
@@ -1364,16 +1365,16 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
1364 } 1365 }
1365 1366
1366 if (changes & BSS_CHANGED_CQM) { 1367 if (changes & BSS_CHANGED_CQM) {
1367 IWL_DEBUG_MAC80211(mvm, "cqm info_changed"); 1368 IWL_DEBUG_MAC80211(mvm, "cqm info_changed\n");
1368 /* reset cqm events tracking */ 1369 /* reset cqm events tracking */
1369 mvmvif->bf_data.last_cqm_event = 0; 1370 mvmvif->bf_data.last_cqm_event = 0;
1370 ret = iwl_mvm_update_beacon_filter(mvm, vif, false, CMD_SYNC); 1371 ret = iwl_mvm_update_beacon_filter(mvm, vif, false, 0);
1371 if (ret) 1372 if (ret)
1372 IWL_ERR(mvm, "failed to update CQM thresholds\n"); 1373 IWL_ERR(mvm, "failed to update CQM thresholds\n");
1373 } 1374 }
1374 1375
1375 if (changes & BSS_CHANGED_ARP_FILTER) { 1376 if (changes & BSS_CHANGED_ARP_FILTER) {
1376 IWL_DEBUG_MAC80211(mvm, "arp filter changed"); 1377 IWL_DEBUG_MAC80211(mvm, "arp filter changed\n");
1377 iwl_mvm_configure_bcast_filter(mvm, vif); 1378 iwl_mvm_configure_bcast_filter(mvm, vif);
1378 } 1379 }
1379} 1380}
@@ -1512,6 +1513,9 @@ static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
1512 1513
1513 mutex_lock(&mvm->mutex); 1514 mutex_lock(&mvm->mutex);
1514 1515
1516 if (changes & BSS_CHANGED_IDLE && !bss_conf->idle)
1517 iwl_mvm_sched_scan_stop(mvm, true);
1518
1515 switch (vif->type) { 1519 switch (vif->type) {
1516 case NL80211_IFTYPE_STATION: 1520 case NL80211_IFTYPE_STATION:
1517 iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes); 1521 iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes);
@@ -1542,7 +1546,7 @@ static int iwl_mvm_mac_hw_scan(struct ieee80211_hw *hw,
1542 1546
1543 switch (mvm->scan_status) { 1547 switch (mvm->scan_status) {
1544 case IWL_MVM_SCAN_SCHED: 1548 case IWL_MVM_SCAN_SCHED:
1545 ret = iwl_mvm_sched_scan_stop(mvm); 1549 ret = iwl_mvm_sched_scan_stop(mvm, true);
1546 if (ret) { 1550 if (ret) {
1547 ret = -EBUSY; 1551 ret = -EBUSY;
1548 goto out; 1552 goto out;
@@ -1731,13 +1735,12 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
1731 new_state == IEEE80211_STA_AUTHORIZED) { 1735 new_state == IEEE80211_STA_AUTHORIZED) {
1732 /* enable beacon filtering */ 1736 /* enable beacon filtering */
1733 if (vif->bss_conf.dtim_period) 1737 if (vif->bss_conf.dtim_period)
1734 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 1738 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0));
1735 CMD_SYNC));
1736 ret = 0; 1739 ret = 0;
1737 } else if (old_state == IEEE80211_STA_AUTHORIZED && 1740 } else if (old_state == IEEE80211_STA_AUTHORIZED &&
1738 new_state == IEEE80211_STA_ASSOC) { 1741 new_state == IEEE80211_STA_ASSOC) {
1739 /* disable beacon filtering */ 1742 /* disable beacon filtering */
1740 WARN_ON(iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC)); 1743 WARN_ON(iwl_mvm_disable_beacon_filter(mvm, vif, 0));
1741 ret = 0; 1744 ret = 0;
1742 } else if (old_state == IEEE80211_STA_ASSOC && 1745 } else if (old_state == IEEE80211_STA_ASSOC &&
1743 new_state == IEEE80211_STA_AUTH) { 1746 new_state == IEEE80211_STA_AUTH) {
@@ -1887,7 +1890,7 @@ static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw,
1887 int ret; 1890 int ret;
1888 1891
1889 mutex_lock(&mvm->mutex); 1892 mutex_lock(&mvm->mutex);
1890 ret = iwl_mvm_sched_scan_stop(mvm); 1893 ret = iwl_mvm_sched_scan_stop(mvm, false);
1891 mutex_unlock(&mvm->mutex); 1894 mutex_unlock(&mvm->mutex);
1892 iwl_mvm_wait_for_async_handlers(mvm); 1895 iwl_mvm_wait_for_async_handlers(mvm);
1893 1896
@@ -2183,10 +2186,10 @@ static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
2183 return; 2186 return;
2184 2187
2185 mutex_lock(&mvm->mutex); 2188 mutex_lock(&mvm->mutex);
2189 iwl_mvm_bt_coex_vif_change(mvm);
2186 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->min_def, 2190 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->min_def,
2187 ctx->rx_chains_static, 2191 ctx->rx_chains_static,
2188 ctx->rx_chains_dynamic); 2192 ctx->rx_chains_dynamic);
2189 iwl_mvm_bt_coex_vif_change(mvm);
2190 mutex_unlock(&mvm->mutex); 2193 mutex_unlock(&mvm->mutex);
2191} 2194}
2192 2195
@@ -2363,9 +2366,8 @@ static int __iwl_mvm_mac_testmode_cmd(struct iwl_mvm *mvm,
2363 return -EINVAL; 2366 return -EINVAL;
2364 2367
2365 if (nla_get_u32(tb[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE])) 2368 if (nla_get_u32(tb[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE]))
2366 return iwl_mvm_enable_beacon_filter(mvm, vif, 2369 return iwl_mvm_enable_beacon_filter(mvm, vif, 0);
2367 CMD_SYNC); 2370 return iwl_mvm_disable_beacon_filter(mvm, vif, 0);
2368 return iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC);
2369 } 2371 }
2370 2372
2371 return -EOPNOTSUPP; 2373 return -EOPNOTSUPP;
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 8747d03311f3..3c253bfa2590 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -490,6 +490,7 @@ struct iwl_mvm {
490 u32 log_event_table; 490 u32 log_event_table;
491 u32 umac_error_event_table; 491 u32 umac_error_event_table;
492 bool support_umac_log; 492 bool support_umac_log;
493 struct iwl_sf_region sf_space;
493 494
494 u32 ampdu_ref; 495 u32 ampdu_ref;
495 496
@@ -501,6 +502,7 @@ struct iwl_mvm {
501 u8 queue_to_mac80211[IWL_MAX_HW_QUEUES]; 502 u8 queue_to_mac80211[IWL_MAX_HW_QUEUES];
502 atomic_t queue_stop_count[IWL_MAX_HW_QUEUES]; 503 atomic_t queue_stop_count[IWL_MAX_HW_QUEUES];
503 504
505 const char *nvm_file_name;
504 struct iwl_nvm_data *nvm_data; 506 struct iwl_nvm_data *nvm_data;
505 /* NVM sections */ 507 /* NVM sections */
506 struct iwl_nvm_section nvm_sections[NVM_MAX_NUM_SECTIONS]; 508 struct iwl_nvm_section nvm_sections[NVM_MAX_NUM_SECTIONS];
@@ -856,7 +858,7 @@ int iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
856 struct cfg80211_sched_scan_request *req); 858 struct cfg80211_sched_scan_request *req);
857int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, 859int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
858 struct cfg80211_sched_scan_request *req); 860 struct cfg80211_sched_scan_request *req);
859int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm); 861int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm, bool notify);
860int iwl_mvm_rx_sched_scan_results(struct iwl_mvm *mvm, 862int iwl_mvm_rx_sched_scan_results(struct iwl_mvm *mvm,
861 struct iwl_rx_cmd_buffer *rxb, 863 struct iwl_rx_cmd_buffer *rxb,
862 struct iwl_device_cmd *cmd); 864 struct iwl_device_cmd *cmd);
diff --git a/drivers/net/wireless/iwlwifi/mvm/nvm.c b/drivers/net/wireless/iwlwifi/mvm/nvm.c
index 6b88c29ebe6b..808f78f6fbf9 100644
--- a/drivers/net/wireless/iwlwifi/mvm/nvm.c
+++ b/drivers/net/wireless/iwlwifi/mvm/nvm.c
@@ -74,6 +74,12 @@
74#define NVM_WRITE_OPCODE 1 74#define NVM_WRITE_OPCODE 1
75#define NVM_READ_OPCODE 0 75#define NVM_READ_OPCODE 0
76 76
77/* load nvm chunk response */
78enum {
79 READ_NVM_CHUNK_SUCCEED = 0,
80 READ_NVM_CHUNK_NOT_VALID_ADDRESS = 1
81};
82
77/* 83/*
78 * prepare the NVM host command w/ the pointers to the nvm buffer 84 * prepare the NVM host command w/ the pointers to the nvm buffer
79 * and send it to fw 85 * and send it to fw
@@ -90,7 +96,7 @@ static int iwl_nvm_write_chunk(struct iwl_mvm *mvm, u16 section,
90 struct iwl_host_cmd cmd = { 96 struct iwl_host_cmd cmd = {
91 .id = NVM_ACCESS_CMD, 97 .id = NVM_ACCESS_CMD,
92 .len = { sizeof(struct iwl_nvm_access_cmd), length }, 98 .len = { sizeof(struct iwl_nvm_access_cmd), length },
93 .flags = CMD_SYNC | CMD_SEND_IN_RFKILL, 99 .flags = CMD_SEND_IN_RFKILL,
94 .data = { &nvm_access_cmd, data }, 100 .data = { &nvm_access_cmd, data },
95 /* data may come from vmalloc, so use _DUP */ 101 /* data may come from vmalloc, so use _DUP */
96 .dataflags = { 0, IWL_HCMD_DFL_DUP }, 102 .dataflags = { 0, IWL_HCMD_DFL_DUP },
@@ -112,7 +118,7 @@ static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section,
112 struct iwl_rx_packet *pkt; 118 struct iwl_rx_packet *pkt;
113 struct iwl_host_cmd cmd = { 119 struct iwl_host_cmd cmd = {
114 .id = NVM_ACCESS_CMD, 120 .id = NVM_ACCESS_CMD,
115 .flags = CMD_SYNC | CMD_WANT_SKB | CMD_SEND_IN_RFKILL, 121 .flags = CMD_WANT_SKB | CMD_SEND_IN_RFKILL,
116 .data = { &nvm_access_cmd, }, 122 .data = { &nvm_access_cmd, },
117 }; 123 };
118 int ret, bytes_read, offset_read; 124 int ret, bytes_read, offset_read;
@@ -139,10 +145,26 @@ static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section,
139 offset_read = le16_to_cpu(nvm_resp->offset); 145 offset_read = le16_to_cpu(nvm_resp->offset);
140 resp_data = nvm_resp->data; 146 resp_data = nvm_resp->data;
141 if (ret) { 147 if (ret) {
142 IWL_ERR(mvm, 148 if ((offset != 0) &&
143 "NVM access command failed with status %d (device: %s)\n", 149 (ret == READ_NVM_CHUNK_NOT_VALID_ADDRESS)) {
144 ret, mvm->cfg->name); 150 /*
145 ret = -EINVAL; 151 * meaning of NOT_VALID_ADDRESS:
152 * driver try to read chunk from address that is
153 * multiple of 2K and got an error since addr is empty.
154 * meaning of (offset != 0): driver already
155 * read valid data from another chunk so this case
156 * is not an error.
157 */
158 IWL_DEBUG_EEPROM(mvm->trans->dev,
159 "NVM access command failed on offset 0x%x since that section size is multiple 2K\n",
160 offset);
161 ret = 0;
162 } else {
163 IWL_DEBUG_EEPROM(mvm->trans->dev,
164 "NVM access command failed with status %d (device: %s)\n",
165 ret, mvm->cfg->name);
166 ret = -EIO;
167 }
146 goto exit; 168 goto exit;
147 } 169 }
148 170
@@ -211,9 +233,9 @@ static int iwl_nvm_read_section(struct iwl_mvm *mvm, u16 section,
211 while (ret == length) { 233 while (ret == length) {
212 ret = iwl_nvm_read_chunk(mvm, section, offset, length, data); 234 ret = iwl_nvm_read_chunk(mvm, section, offset, length, data);
213 if (ret < 0) { 235 if (ret < 0) {
214 IWL_ERR(mvm, 236 IWL_DEBUG_EEPROM(mvm->trans->dev,
215 "Cannot read NVM from section %d offset %d, length %d\n", 237 "Cannot read NVM from section %d offset %d, length %d\n",
216 section, offset, length); 238 section, offset, length);
217 return ret; 239 return ret;
218 } 240 }
219 offset += ret; 241 offset += ret;
@@ -318,16 +340,16 @@ static int iwl_mvm_read_external_nvm(struct iwl_mvm *mvm)
318 * get here after that we assume the NVM request can be satisfied 340 * get here after that we assume the NVM request can be satisfied
319 * synchronously. 341 * synchronously.
320 */ 342 */
321 ret = request_firmware(&fw_entry, iwlwifi_mod_params.nvm_file, 343 ret = request_firmware(&fw_entry, mvm->nvm_file_name,
322 mvm->trans->dev); 344 mvm->trans->dev);
323 if (ret) { 345 if (ret) {
324 IWL_ERR(mvm, "ERROR: %s isn't available %d\n", 346 IWL_ERR(mvm, "ERROR: %s isn't available %d\n",
325 iwlwifi_mod_params.nvm_file, ret); 347 mvm->nvm_file_name, ret);
326 return ret; 348 return ret;
327 } 349 }
328 350
329 IWL_INFO(mvm, "Loaded NVM file %s (%zu bytes)\n", 351 IWL_INFO(mvm, "Loaded NVM file %s (%zu bytes)\n",
330 iwlwifi_mod_params.nvm_file, fw_entry->size); 352 mvm->nvm_file_name, fw_entry->size);
331 353
332 if (fw_entry->size < sizeof(*file_sec)) { 354 if (fw_entry->size < sizeof(*file_sec)) {
333 IWL_ERR(mvm, "NVM file too small\n"); 355 IWL_ERR(mvm, "NVM file too small\n");
@@ -436,32 +458,14 @@ int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm)
436 458
437int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic) 459int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic)
438{ 460{
439 int ret, i, section; 461 int ret, section;
440 u8 *nvm_buffer, *temp; 462 u8 *nvm_buffer, *temp;
441 int nvm_to_read[NVM_MAX_NUM_SECTIONS];
442 int num_of_sections_to_read;
443 463
444 if (WARN_ON_ONCE(mvm->cfg->nvm_hw_section_num >= NVM_MAX_NUM_SECTIONS)) 464 if (WARN_ON_ONCE(mvm->cfg->nvm_hw_section_num >= NVM_MAX_NUM_SECTIONS))
445 return -EINVAL; 465 return -EINVAL;
446 466
447 /* load NVM values from nic */ 467 /* load NVM values from nic */
448 if (read_nvm_from_nic) { 468 if (read_nvm_from_nic) {
449 /* list of NVM sections we are allowed/need to read */
450 if (mvm->trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) {
451 nvm_to_read[0] = mvm->cfg->nvm_hw_section_num;
452 nvm_to_read[1] = NVM_SECTION_TYPE_SW;
453 nvm_to_read[2] = NVM_SECTION_TYPE_CALIBRATION;
454 nvm_to_read[3] = NVM_SECTION_TYPE_PRODUCTION;
455 num_of_sections_to_read = 4;
456 } else {
457 nvm_to_read[0] = NVM_SECTION_TYPE_SW;
458 nvm_to_read[1] = NVM_SECTION_TYPE_CALIBRATION;
459 nvm_to_read[2] = NVM_SECTION_TYPE_PRODUCTION;
460 nvm_to_read[3] = NVM_SECTION_TYPE_REGULATORY;
461 nvm_to_read[4] = NVM_SECTION_TYPE_MAC_OVERRIDE;
462 num_of_sections_to_read = 5;
463 }
464
465 /* Read From FW NVM */ 469 /* Read From FW NVM */
466 IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from NVM\n"); 470 IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from NVM\n");
467 471
@@ -469,12 +473,11 @@ int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic)
469 GFP_KERNEL); 473 GFP_KERNEL);
470 if (!nvm_buffer) 474 if (!nvm_buffer)
471 return -ENOMEM; 475 return -ENOMEM;
472 for (i = 0; i < num_of_sections_to_read; i++) { 476 for (section = 0; section < NVM_MAX_NUM_SECTIONS; section++) {
473 section = nvm_to_read[i];
474 /* we override the constness for initial read */ 477 /* we override the constness for initial read */
475 ret = iwl_nvm_read_section(mvm, section, nvm_buffer); 478 ret = iwl_nvm_read_section(mvm, section, nvm_buffer);
476 if (ret < 0) 479 if (ret < 0)
477 break; 480 continue;
478 temp = kmemdup(nvm_buffer, ret, GFP_KERNEL); 481 temp = kmemdup(nvm_buffer, ret, GFP_KERNEL);
479 if (!temp) { 482 if (!temp) {
480 ret = -ENOMEM; 483 ret = -ENOMEM;
@@ -503,17 +506,14 @@ int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic)
503 mvm->nvm_hw_blob.size = ret; 506 mvm->nvm_hw_blob.size = ret;
504 break; 507 break;
505 } 508 }
506 WARN(1, "section: %d", section);
507 } 509 }
508#endif 510#endif
509 } 511 }
510 kfree(nvm_buffer); 512 kfree(nvm_buffer);
511 if (ret < 0)
512 return ret;
513 } 513 }
514 514
515 /* load external NVM if configured */ 515 /* load external NVM if configured */
516 if (iwlwifi_mod_params.nvm_file) { 516 if (mvm->nvm_file_name) {
517 /* move to External NVM flow */ 517 /* move to External NVM flow */
518 ret = iwl_mvm_read_external_nvm(mvm); 518 ret = iwl_mvm_read_external_nvm(mvm);
519 if (ret) 519 if (ret)
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index f8530b329d17..cc2f7de396de 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -466,8 +466,13 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
466 466
467 min_backoff = calc_min_backoff(trans, cfg); 467 min_backoff = calc_min_backoff(trans, cfg);
468 iwl_mvm_tt_initialize(mvm, min_backoff); 468 iwl_mvm_tt_initialize(mvm, min_backoff);
469 /* set the nvm_file_name according to priority */
470 if (iwlwifi_mod_params.nvm_file)
471 mvm->nvm_file_name = iwlwifi_mod_params.nvm_file;
472 else
473 mvm->nvm_file_name = mvm->cfg->default_nvm_file;
469 474
470 if (WARN(cfg->no_power_up_nic_in_init && !iwlwifi_mod_params.nvm_file, 475 if (WARN(cfg->no_power_up_nic_in_init && !mvm->nvm_file_name,
471 "not allowing power-up and not having nvm_file\n")) 476 "not allowing power-up and not having nvm_file\n"))
472 goto out_free; 477 goto out_free;
473 478
@@ -477,7 +482,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
477 * and not in the file. 482 * and not in the file.
478 * for nics with no_power_up_nic_in_init: rely completley on nvm_file 483 * for nics with no_power_up_nic_in_init: rely completley on nvm_file
479 */ 484 */
480 if (cfg->no_power_up_nic_in_init && iwlwifi_mod_params.nvm_file) { 485 if (cfg->no_power_up_nic_in_init && mvm->nvm_file_name) {
481 err = iwl_nvm_init(mvm, false); 486 err = iwl_nvm_init(mvm, false);
482 if (err) 487 if (err)
483 goto out_free; 488 goto out_free;
@@ -525,7 +530,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
525 out_free: 530 out_free:
526 iwl_phy_db_free(mvm->phy_db); 531 iwl_phy_db_free(mvm->phy_db);
527 kfree(mvm->scan_cmd); 532 kfree(mvm->scan_cmd);
528 if (!cfg->no_power_up_nic_in_init || !iwlwifi_mod_params.nvm_file) 533 if (!cfg->no_power_up_nic_in_init || !mvm->nvm_file_name)
529 iwl_trans_op_mode_leave(trans); 534 iwl_trans_op_mode_leave(trans);
530 ieee80211_free_hw(mvm->hw); 535 ieee80211_free_hw(mvm->hw);
531 return NULL; 536 return NULL;
@@ -1163,7 +1168,7 @@ static void iwl_mvm_d0i3_exit_work(struct work_struct *wk)
1163 struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, d0i3_exit_work); 1168 struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, d0i3_exit_work);
1164 struct iwl_host_cmd get_status_cmd = { 1169 struct iwl_host_cmd get_status_cmd = {
1165 .id = WOWLAN_GET_STATUSES, 1170 .id = WOWLAN_GET_STATUSES,
1166 .flags = CMD_SYNC | CMD_HIGH_PRIO | CMD_WANT_SKB, 1171 .flags = CMD_HIGH_PRIO | CMD_WANT_SKB,
1167 }; 1172 };
1168 struct iwl_wowlan_status *status; 1173 struct iwl_wowlan_status *status;
1169 int ret; 1174 int ret;
diff --git a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c
index eafc517a5f9e..acb79af6fa89 100644
--- a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c
@@ -156,6 +156,19 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm,
156 idle_cnt = chains_static; 156 idle_cnt = chains_static;
157 active_cnt = chains_dynamic; 157 active_cnt = chains_dynamic;
158 158
159 /* In scenarios where we only ever use a single-stream rates,
160 * i.e. legacy 11b/g/a associations, single-stream APs or even
161 * static SMPS, enable both chains to get diversity, improving
162 * the case where we're far enough from the AP that attenuation
163 * between the two antennas is sufficiently different to impact
164 * performance.
165 */
166 if (active_cnt == 1 && num_of_ant(mvm->fw->valid_rx_ant) > 1 &&
167 !mvm->cfg->rx_with_siso_diversity) {
168 idle_cnt = 2;
169 active_cnt = 2;
170 }
171
159 cmd->rxchain_info = cpu_to_le32(mvm->fw->valid_rx_ant << 172 cmd->rxchain_info = cpu_to_le32(mvm->fw->valid_rx_ant <<
160 PHY_RX_CHAIN_VALID_POS); 173 PHY_RX_CHAIN_VALID_POS);
161 cmd->rxchain_info |= cpu_to_le32(idle_cnt << PHY_RX_CHAIN_CNT_POS); 174 cmd->rxchain_info |= cpu_to_le32(idle_cnt << PHY_RX_CHAIN_CNT_POS);
@@ -187,7 +200,7 @@ static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm,
187 iwl_mvm_phy_ctxt_cmd_data(mvm, &cmd, chandef, 200 iwl_mvm_phy_ctxt_cmd_data(mvm, &cmd, chandef,
188 chains_static, chains_dynamic); 201 chains_static, chains_dynamic);
189 202
190 ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD, CMD_SYNC, 203 ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD, 0,
191 sizeof(struct iwl_phy_context_cmd), 204 sizeof(struct iwl_phy_context_cmd),
192 &cmd); 205 &cmd);
193 if (ret) 206 if (ret)
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c
index 78309f7d0b7b..2e99dddc1e00 100644
--- a/drivers/net/wireless/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/iwlwifi/mvm/power.c
@@ -142,7 +142,7 @@ int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm,
142 mvmvif->bf_data.ba_enabled = enable; 142 mvmvif->bf_data.ba_enabled = enable;
143 iwl_mvm_beacon_filter_set_cqm_params(mvm, vif, &cmd); 143 iwl_mvm_beacon_filter_set_cqm_params(mvm, vif, &cmd);
144 iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd); 144 iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd);
145 return iwl_mvm_beacon_filter_send_cmd(mvm, &cmd, CMD_SYNC); 145 return iwl_mvm_beacon_filter_send_cmd(mvm, &cmd, 0);
146} 146}
147 147
148static void iwl_mvm_power_log(struct iwl_mvm *mvm, 148static void iwl_mvm_power_log(struct iwl_mvm *mvm,
@@ -268,10 +268,30 @@ static void iwl_mvm_power_configure_uapsd(struct iwl_mvm *mvm,
268 IWL_MVM_PS_HEAVY_RX_THLD_PERCENT; 268 IWL_MVM_PS_HEAVY_RX_THLD_PERCENT;
269} 269}
270 270
271static void iwl_mvm_binding_iterator(void *_data, u8 *mac,
272 struct ieee80211_vif *vif)
273{
274 unsigned long *data = _data;
275 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
276
277 if (!mvmvif->phy_ctxt)
278 return;
279
280 if (vif->type == NL80211_IFTYPE_STATION ||
281 vif->type == NL80211_IFTYPE_AP)
282 __set_bit(mvmvif->phy_ctxt->id, data);
283}
284
271static bool iwl_mvm_power_allow_uapsd(struct iwl_mvm *mvm, 285static bool iwl_mvm_power_allow_uapsd(struct iwl_mvm *mvm,
272 struct ieee80211_vif *vif) 286 struct ieee80211_vif *vif)
273{ 287{
274 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 288 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
289 unsigned long phy_ctxt_counter = 0;
290
291 ieee80211_iterate_active_interfaces_atomic(mvm->hw,
292 IEEE80211_IFACE_ITER_NORMAL,
293 iwl_mvm_binding_iterator,
294 &phy_ctxt_counter);
275 295
276 if (!memcmp(mvmvif->uapsd_misbehaving_bssid, vif->bss_conf.bssid, 296 if (!memcmp(mvmvif->uapsd_misbehaving_bssid, vif->bss_conf.bssid,
277 ETH_ALEN)) 297 ETH_ALEN))
@@ -289,6 +309,13 @@ static bool iwl_mvm_power_allow_uapsd(struct iwl_mvm *mvm,
289 IEEE80211_P2P_OPPPS_ENABLE_BIT)) 309 IEEE80211_P2P_OPPPS_ENABLE_BIT))
290 return false; 310 return false;
291 311
312 /*
313 * Avoid using uAPSD if client is in DCM -
314 * low latency issue in Miracast
315 */
316 if (hweight8(phy_ctxt_counter) >= 2)
317 return false;
318
292 return true; 319 return true;
293} 320}
294 321
@@ -429,7 +456,7 @@ static int iwl_mvm_power_send_cmd(struct iwl_mvm *mvm,
429 memcpy(&iwl_mvm_vif_from_mac80211(vif)->mac_pwr_cmd, &cmd, sizeof(cmd)); 456 memcpy(&iwl_mvm_vif_from_mac80211(vif)->mac_pwr_cmd, &cmd, sizeof(cmd));
430#endif 457#endif
431 458
432 return iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, CMD_SYNC, 459 return iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, 0,
433 sizeof(cmd), &cmd); 460 sizeof(cmd), &cmd);
434} 461}
435 462
@@ -455,7 +482,7 @@ int iwl_mvm_power_update_device(struct iwl_mvm *mvm)
455 "Sending device power command with flags = 0x%X\n", 482 "Sending device power command with flags = 0x%X\n",
456 cmd.flags); 483 cmd.flags);
457 484
458 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_SYNC, sizeof(cmd), 485 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, 0, sizeof(cmd),
459 &cmd); 486 &cmd);
460} 487}
461 488
@@ -613,11 +640,15 @@ iwl_mvm_power_set_pm(struct iwl_mvm *mvm,
613 ap_same_channel = (bss_mvmvif->phy_ctxt->id == 640 ap_same_channel = (bss_mvmvif->phy_ctxt->id ==
614 ap_mvmvif->phy_ctxt->id); 641 ap_mvmvif->phy_ctxt->id);
615 642
616 /* bss is not stand alone: enable PM if alone on its channel */ 643 /* clients are not stand alone: enable PM if DCM */
617 if (vifs->bss_active && !(client_same_channel || ap_same_channel) && 644 if (!(client_same_channel || ap_same_channel) &&
618 (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM)) { 645 (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM)) {
646 if (vifs->bss_active)
619 bss_mvmvif->pm_enabled = true; 647 bss_mvmvif->pm_enabled = true;
620 return; 648 if (vifs->p2p_active &&
649 (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PM))
650 p2p_mvmvif->pm_enabled = true;
651 return;
621 } 652 }
622 653
623 /* 654 /*
@@ -871,9 +902,10 @@ int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm,
871 if (WARN_ON(!dtimper_msec)) 902 if (WARN_ON(!dtimper_msec))
872 return 0; 903 return 0;
873 904
874 cmd.flags |=
875 cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK);
876 cmd.skip_dtim_periods = 300 / dtimper_msec; 905 cmd.skip_dtim_periods = 300 / dtimper_msec;
906 if (cmd.skip_dtim_periods)
907 cmd.flags |=
908 cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK);
877 } 909 }
878 iwl_mvm_power_log(mvm, &cmd); 910 iwl_mvm_power_log(mvm, &cmd);
879#ifdef CONFIG_IWLWIFI_DEBUGFS 911#ifdef CONFIG_IWLWIFI_DEBUGFS
diff --git a/drivers/net/wireless/iwlwifi/mvm/quota.c b/drivers/net/wireless/iwlwifi/mvm/quota.c
index 35e86e06dffd..ba68d7b84505 100644
--- a/drivers/net/wireless/iwlwifi/mvm/quota.c
+++ b/drivers/net/wireless/iwlwifi/mvm/quota.c
@@ -285,7 +285,7 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
285 285
286 iwl_mvm_adjust_quota_for_noa(mvm, &cmd); 286 iwl_mvm_adjust_quota_for_noa(mvm, &cmd);
287 287
288 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC, 288 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, 0,
289 sizeof(cmd), &cmd); 289 sizeof(cmd), &cmd);
290 if (ret) 290 if (ret)
291 IWL_ERR(mvm, "Failed to send quota: %d\n", ret); 291 IWL_ERR(mvm, "Failed to send quota: %d\n", ret);
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index 10ad1dca5f17..306a6caa4868 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -1866,7 +1866,7 @@ static bool rs_tpc_perform(struct iwl_mvm *mvm,
1866 1866
1867#ifdef CONFIG_MAC80211_DEBUGFS 1867#ifdef CONFIG_MAC80211_DEBUGFS
1868 if (lq_sta->dbg_fixed_txp_reduction <= TPC_MAX_REDUCTION) { 1868 if (lq_sta->dbg_fixed_txp_reduction <= TPC_MAX_REDUCTION) {
1869 IWL_DEBUG_RATE(mvm, "fixed tpc: %d", 1869 IWL_DEBUG_RATE(mvm, "fixed tpc: %d\n",
1870 lq_sta->dbg_fixed_txp_reduction); 1870 lq_sta->dbg_fixed_txp_reduction);
1871 lq_sta->lq.reduced_tpc = lq_sta->dbg_fixed_txp_reduction; 1871 lq_sta->lq.reduced_tpc = lq_sta->dbg_fixed_txp_reduction;
1872 return cur != lq_sta->dbg_fixed_txp_reduction; 1872 return cur != lq_sta->dbg_fixed_txp_reduction;
@@ -1883,7 +1883,7 @@ static bool rs_tpc_perform(struct iwl_mvm *mvm,
1883 1883
1884 if (!rs_tpc_allowed(mvm, vif, rate, band)) { 1884 if (!rs_tpc_allowed(mvm, vif, rate, band)) {
1885 IWL_DEBUG_RATE(mvm, 1885 IWL_DEBUG_RATE(mvm,
1886 "tpc is not allowed. remove txp restrictions"); 1886 "tpc is not allowed. remove txp restrictions\n");
1887 lq_sta->lq.reduced_tpc = TPC_NO_REDUCTION; 1887 lq_sta->lq.reduced_tpc = TPC_NO_REDUCTION;
1888 return cur != TPC_NO_REDUCTION; 1888 return cur != TPC_NO_REDUCTION;
1889 } 1889 }
@@ -1909,12 +1909,12 @@ static bool rs_tpc_perform(struct iwl_mvm *mvm,
1909 1909
1910 /* override actions if we are on the edge */ 1910 /* override actions if we are on the edge */
1911 if (weak == TPC_INVALID && action == TPC_ACTION_DECREASE) { 1911 if (weak == TPC_INVALID && action == TPC_ACTION_DECREASE) {
1912 IWL_DEBUG_RATE(mvm, "already in lowest txp, stay"); 1912 IWL_DEBUG_RATE(mvm, "already in lowest txp, stay\n");
1913 action = TPC_ACTION_STAY; 1913 action = TPC_ACTION_STAY;
1914 } else if (strong == TPC_INVALID && 1914 } else if (strong == TPC_INVALID &&
1915 (action == TPC_ACTION_INCREASE || 1915 (action == TPC_ACTION_INCREASE ||
1916 action == TPC_ACTION_NO_RESTIRCTION)) { 1916 action == TPC_ACTION_NO_RESTIRCTION)) {
1917 IWL_DEBUG_RATE(mvm, "already in highest txp, stay"); 1917 IWL_DEBUG_RATE(mvm, "already in highest txp, stay\n");
1918 action = TPC_ACTION_STAY; 1918 action = TPC_ACTION_STAY;
1919 } 1919 }
1920 1920
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c
index 36ae01a18dee..4b6c7d4bd199 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -306,7 +306,6 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm,
306 .id = SCAN_REQUEST_CMD, 306 .id = SCAN_REQUEST_CMD,
307 .len = { 0, }, 307 .len = { 0, },
308 .data = { mvm->scan_cmd, }, 308 .data = { mvm->scan_cmd, },
309 .flags = CMD_SYNC,
310 .dataflags = { IWL_HCMD_DFL_NOCOPY, }, 309 .dataflags = { IWL_HCMD_DFL_NOCOPY, },
311 }; 310 };
312 struct iwl_scan_cmd *cmd = mvm->scan_cmd; 311 struct iwl_scan_cmd *cmd = mvm->scan_cmd;
@@ -517,7 +516,7 @@ int iwl_mvm_cancel_scan(struct iwl_mvm *mvm)
517 ARRAY_SIZE(scan_abort_notif), 516 ARRAY_SIZE(scan_abort_notif),
518 iwl_mvm_scan_abort_notif, NULL); 517 iwl_mvm_scan_abort_notif, NULL);
519 518
520 ret = iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_CMD, CMD_SYNC, 0, NULL); 519 ret = iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_CMD, 0, 0, NULL);
521 if (ret) { 520 if (ret) {
522 IWL_ERR(mvm, "Couldn't send SCAN_ABORT_CMD: %d\n", ret); 521 IWL_ERR(mvm, "Couldn't send SCAN_ABORT_CMD: %d\n", ret);
523 /* mac80211's state will be cleaned in the nic_restart flow */ 522 /* mac80211's state will be cleaned in the nic_restart flow */
@@ -749,7 +748,6 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm,
749 struct iwl_scan_offload_cfg *scan_cfg; 748 struct iwl_scan_offload_cfg *scan_cfg;
750 struct iwl_host_cmd cmd = { 749 struct iwl_host_cmd cmd = {
751 .id = SCAN_OFFLOAD_CONFIG_CMD, 750 .id = SCAN_OFFLOAD_CONFIG_CMD,
752 .flags = CMD_SYNC,
753 }; 751 };
754 struct iwl_mvm_scan_params params = {}; 752 struct iwl_mvm_scan_params params = {};
755 753
@@ -807,7 +805,6 @@ int iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
807 struct iwl_scan_offload_blacklist *blacklist; 805 struct iwl_scan_offload_blacklist *blacklist;
808 struct iwl_host_cmd cmd = { 806 struct iwl_host_cmd cmd = {
809 .id = SCAN_OFFLOAD_UPDATE_PROFILES_CMD, 807 .id = SCAN_OFFLOAD_UPDATE_PROFILES_CMD,
810 .flags = CMD_SYNC,
811 .len[1] = sizeof(*profile_cfg), 808 .len[1] = sizeof(*profile_cfg),
812 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 809 .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
813 .dataflags[1] = IWL_HCMD_DFL_NOCOPY, 810 .dataflags[1] = IWL_HCMD_DFL_NOCOPY,
@@ -898,7 +895,7 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
898 scan_req.flags |= 895 scan_req.flags |=
899 cpu_to_le16(IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE); 896 cpu_to_le16(IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE);
900 897
901 return iwl_mvm_send_cmd_pdu(mvm, SCAN_OFFLOAD_REQUEST_CMD, CMD_SYNC, 898 return iwl_mvm_send_cmd_pdu(mvm, SCAN_OFFLOAD_REQUEST_CMD, 0,
902 sizeof(scan_req), &scan_req); 899 sizeof(scan_req), &scan_req);
903} 900}
904 901
@@ -907,7 +904,6 @@ static int iwl_mvm_send_sched_scan_abort(struct iwl_mvm *mvm)
907 int ret; 904 int ret;
908 struct iwl_host_cmd cmd = { 905 struct iwl_host_cmd cmd = {
909 .id = SCAN_OFFLOAD_ABORT_CMD, 906 .id = SCAN_OFFLOAD_ABORT_CMD,
910 .flags = CMD_SYNC,
911 }; 907 };
912 u32 status; 908 u32 status;
913 909
@@ -936,7 +932,7 @@ static int iwl_mvm_send_sched_scan_abort(struct iwl_mvm *mvm)
936 return ret; 932 return ret;
937} 933}
938 934
939int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm) 935int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm, bool notify)
940{ 936{
941 int ret; 937 int ret;
942 struct iwl_notification_wait wait_scan_done; 938 struct iwl_notification_wait wait_scan_done;
@@ -974,5 +970,8 @@ int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm)
974 */ 970 */
975 mvm->scan_status = IWL_MVM_SCAN_NONE; 971 mvm->scan_status = IWL_MVM_SCAN_NONE;
976 972
973 if (notify)
974 ieee80211_sched_scan_stopped(mvm->hw);
975
977 return 0; 976 return 0;
978} 977}
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c
index 3e11b9d802e7..1fb01ea2e704 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -327,7 +327,7 @@ static int iwl_mvm_rm_sta_common(struct iwl_mvm *mvm, u8 sta_id)
327 return -EINVAL; 327 return -EINVAL;
328 } 328 }
329 329
330 ret = iwl_mvm_send_cmd_pdu(mvm, REMOVE_STA, CMD_SYNC, 330 ret = iwl_mvm_send_cmd_pdu(mvm, REMOVE_STA, 0,
331 sizeof(rm_sta_cmd), &rm_sta_cmd); 331 sizeof(rm_sta_cmd), &rm_sta_cmd);
332 if (ret) { 332 if (ret) {
333 IWL_ERR(mvm, "Failed to remove station. Id=%d\n", sta_id); 333 IWL_ERR(mvm, "Failed to remove station. Id=%d\n", sta_id);
@@ -1053,12 +1053,12 @@ static int iwl_mvm_send_sta_key(struct iwl_mvm *mvm,
1053 cmd.sta_id = sta_id; 1053 cmd.sta_id = sta_id;
1054 1054
1055 status = ADD_STA_SUCCESS; 1055 status = ADD_STA_SUCCESS;
1056 if (cmd_flags == CMD_SYNC) 1056 if (cmd_flags & CMD_ASYNC)
1057 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, sizeof(cmd),
1058 &cmd, &status);
1059 else
1060 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA_KEY, CMD_ASYNC, 1057 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA_KEY, CMD_ASYNC,
1061 sizeof(cmd), &cmd); 1058 sizeof(cmd), &cmd);
1059 else
1060 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, sizeof(cmd),
1061 &cmd, &status);
1062 1062
1063 switch (status) { 1063 switch (status) {
1064 case ADD_STA_SUCCESS: 1064 case ADD_STA_SUCCESS:
@@ -1111,7 +1111,7 @@ static int iwl_mvm_send_sta_igtk(struct iwl_mvm *mvm,
1111 remove_key ? "removing" : "installing", 1111 remove_key ? "removing" : "installing",
1112 igtk_cmd.sta_id); 1112 igtk_cmd.sta_id);
1113 1113
1114 return iwl_mvm_send_cmd_pdu(mvm, MGMT_MCAST_KEY, CMD_SYNC, 1114 return iwl_mvm_send_cmd_pdu(mvm, MGMT_MCAST_KEY, 0,
1115 sizeof(igtk_cmd), &igtk_cmd); 1115 sizeof(igtk_cmd), &igtk_cmd);
1116} 1116}
1117 1117
@@ -1198,15 +1198,15 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *mvm,
1198 ieee80211_get_key_rx_seq(keyconf, 0, &seq); 1198 ieee80211_get_key_rx_seq(keyconf, 0, &seq);
1199 ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k); 1199 ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k);
1200 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id, 1200 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id,
1201 seq.tkip.iv32, p1k, CMD_SYNC); 1201 seq.tkip.iv32, p1k, 0);
1202 break; 1202 break;
1203 case WLAN_CIPHER_SUITE_CCMP: 1203 case WLAN_CIPHER_SUITE_CCMP:
1204 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id, 1204 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id,
1205 0, NULL, CMD_SYNC); 1205 0, NULL, 0);
1206 break; 1206 break;
1207 default: 1207 default:
1208 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, 1208 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf,
1209 sta_id, 0, NULL, CMD_SYNC); 1209 sta_id, 0, NULL, 0);
1210 } 1210 }
1211 1211
1212 if (ret) 1212 if (ret)
diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c
index a9402937f767..80100f6cc12a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/time-event.c
+++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c
@@ -312,7 +312,7 @@ static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm,
312 ARRAY_SIZE(time_event_response), 312 ARRAY_SIZE(time_event_response),
313 iwl_mvm_time_event_response, te_data); 313 iwl_mvm_time_event_response, te_data);
314 314
315 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, 315 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0,
316 sizeof(*te_cmd), te_cmd); 316 sizeof(*te_cmd), te_cmd);
317 if (ret) { 317 if (ret) {
318 IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret); 318 IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret);
@@ -434,7 +434,7 @@ void iwl_mvm_remove_time_event(struct iwl_mvm *mvm,
434 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); 434 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color));
435 435
436 IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id)); 436 IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id));
437 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, 437 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0,
438 sizeof(time_cmd), &time_cmd); 438 sizeof(time_cmd), &time_cmd);
439 if (WARN_ON(ret)) 439 if (WARN_ON(ret))
440 return; 440 return;
diff --git a/drivers/net/wireless/iwlwifi/mvm/tt.c b/drivers/net/wireless/iwlwifi/mvm/tt.c
index 39a3e03a0acd..868561512783 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tt.c
@@ -409,7 +409,6 @@ void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff)
409 .id = REPLY_THERMAL_MNG_BACKOFF, 409 .id = REPLY_THERMAL_MNG_BACKOFF,
410 .len = { sizeof(u32), }, 410 .len = { sizeof(u32), },
411 .data = { &backoff, }, 411 .data = { &backoff, },
412 .flags = CMD_SYNC,
413 }; 412 };
414 413
415 backoff = max(backoff, mvm->thermal_throttle.min_backoff); 414 backoff = max(backoff, mvm->thermal_throttle.min_backoff);
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index ff1b630e130e..3846a6c41eb1 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -958,7 +958,7 @@ int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, bool sync)
958 .flush_ctl = cpu_to_le16(DUMP_TX_FIFO_FLUSH), 958 .flush_ctl = cpu_to_le16(DUMP_TX_FIFO_FLUSH),
959 }; 959 };
960 960
961 u32 flags = sync ? CMD_SYNC : CMD_ASYNC; 961 u32 flags = sync ? 0 : CMD_ASYNC;
962 962
963 ret = iwl_mvm_send_cmd_pdu(mvm, TXPATH_FLUSH, flags, 963 ret = iwl_mvm_send_cmd_pdu(mvm, TXPATH_FLUSH, flags,
964 sizeof(flush_cmd), &flush_cmd); 964 sizeof(flush_cmd), &flush_cmd);
diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c
index 2f82d0dc7ad8..5834873aefe1 100644
--- a/drivers/net/wireless/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/iwlwifi/mvm/utils.c
@@ -144,7 +144,7 @@ int iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd,
144 "cmd flags %x", cmd->flags)) 144 "cmd flags %x", cmd->flags))
145 return -EINVAL; 145 return -EINVAL;
146 146
147 cmd->flags |= CMD_SYNC | CMD_WANT_SKB; 147 cmd->flags |= CMD_WANT_SKB;
148 148
149 ret = iwl_trans_send_cmd(mvm->trans, cmd); 149 ret = iwl_trans_send_cmd(mvm->trans, cmd);
150 if (ret == -ERFKILL) { 150 if (ret == -ERFKILL) {
@@ -599,7 +599,7 @@ int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool init)
599 struct iwl_host_cmd cmd = { 599 struct iwl_host_cmd cmd = {
600 .id = LQ_CMD, 600 .id = LQ_CMD,
601 .len = { sizeof(struct iwl_lq_cmd), }, 601 .len = { sizeof(struct iwl_lq_cmd), },
602 .flags = init ? CMD_SYNC : CMD_ASYNC, 602 .flags = init ? 0 : CMD_ASYNC,
603 .data = { lq, }, 603 .data = { lq, },
604 }; 604 };
605 605
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
index 3d1d57f9f5bc..7091a18d5a72 100644
--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -417,7 +417,7 @@ static u64 splx_get_pwr_limit(struct iwl_trans *trans, union acpi_object *splx)
417 splx->package.count != 2 || 417 splx->package.count != 2 ||
418 splx->package.elements[0].type != ACPI_TYPE_INTEGER || 418 splx->package.elements[0].type != ACPI_TYPE_INTEGER ||
419 splx->package.elements[0].integer.value != 0) { 419 splx->package.elements[0].integer.value != 0) {
420 IWL_ERR(trans, "Unsupported splx structure"); 420 IWL_ERR(trans, "Unsupported splx structure\n");
421 return 0; 421 return 0;
422 } 422 }
423 423
@@ -426,14 +426,14 @@ static u64 splx_get_pwr_limit(struct iwl_trans *trans, union acpi_object *splx)
426 limits->package.count < 2 || 426 limits->package.count < 2 ||
427 limits->package.elements[0].type != ACPI_TYPE_INTEGER || 427 limits->package.elements[0].type != ACPI_TYPE_INTEGER ||
428 limits->package.elements[1].type != ACPI_TYPE_INTEGER) { 428 limits->package.elements[1].type != ACPI_TYPE_INTEGER) {
429 IWL_ERR(trans, "Invalid limits element"); 429 IWL_ERR(trans, "Invalid limits element\n");
430 return 0; 430 return 0;
431 } 431 }
432 432
433 domain_type = &limits->package.elements[0]; 433 domain_type = &limits->package.elements[0];
434 power_limit = &limits->package.elements[1]; 434 power_limit = &limits->package.elements[1];
435 if (!(domain_type->integer.value & SPL_DOMAINTYPE_WIFI)) { 435 if (!(domain_type->integer.value & SPL_DOMAINTYPE_WIFI)) {
436 IWL_DEBUG_INFO(trans, "WiFi power is not limited"); 436 IWL_DEBUG_INFO(trans, "WiFi power is not limited\n");
437 return 0; 437 return 0;
438 } 438 }
439 439
@@ -450,26 +450,26 @@ static void set_dflt_pwr_limit(struct iwl_trans *trans, struct pci_dev *pdev)
450 pxsx_handle = ACPI_HANDLE(&pdev->dev); 450 pxsx_handle = ACPI_HANDLE(&pdev->dev);
451 if (!pxsx_handle) { 451 if (!pxsx_handle) {
452 IWL_DEBUG_INFO(trans, 452 IWL_DEBUG_INFO(trans,
453 "Could not retrieve root port ACPI handle"); 453 "Could not retrieve root port ACPI handle\n");
454 return; 454 return;
455 } 455 }
456 456
457 /* Get the method's handle */ 457 /* Get the method's handle */
458 status = acpi_get_handle(pxsx_handle, (acpi_string)SPL_METHOD, &handle); 458 status = acpi_get_handle(pxsx_handle, (acpi_string)SPL_METHOD, &handle);
459 if (ACPI_FAILURE(status)) { 459 if (ACPI_FAILURE(status)) {
460 IWL_DEBUG_INFO(trans, "SPL method not found"); 460 IWL_DEBUG_INFO(trans, "SPL method not found\n");
461 return; 461 return;
462 } 462 }
463 463
464 /* Call SPLC with no arguments */ 464 /* Call SPLC with no arguments */
465 status = acpi_evaluate_object(handle, NULL, NULL, &splx); 465 status = acpi_evaluate_object(handle, NULL, NULL, &splx);
466 if (ACPI_FAILURE(status)) { 466 if (ACPI_FAILURE(status)) {
467 IWL_ERR(trans, "SPLC invocation failed (0x%x)", status); 467 IWL_ERR(trans, "SPLC invocation failed (0x%x)\n", status);
468 return; 468 return;
469 } 469 }
470 470
471 trans->dflt_pwr_limit = splx_get_pwr_limit(trans, splx.pointer); 471 trans->dflt_pwr_limit = splx_get_pwr_limit(trans, splx.pointer);
472 IWL_DEBUG_INFO(trans, "Default power limit set to %lld", 472 IWL_DEBUG_INFO(trans, "Default power limit set to %lld\n",
473 trans->dflt_pwr_limit); 473 trans->dflt_pwr_limit);
474 kfree(splx.pointer); 474 kfree(splx.pointer);
475} 475}
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index a1af903f6c9b..788085bc65d7 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -454,6 +454,7 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
454{ 454{
455 int ret; 455 int ret;
456 int t = 0; 456 int t = 0;
457 int iter;
457 458
458 IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n"); 459 IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n");
459 460
@@ -462,18 +463,23 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
462 if (ret >= 0) 463 if (ret >= 0)
463 return 0; 464 return 0;
464 465
465 /* If HW is not ready, prepare the conditions to check again */ 466 for (iter = 0; iter < 10; iter++) {
466 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, 467 /* If HW is not ready, prepare the conditions to check again */
467 CSR_HW_IF_CONFIG_REG_PREPARE); 468 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
469 CSR_HW_IF_CONFIG_REG_PREPARE);
470
471 do {
472 ret = iwl_pcie_set_hw_ready(trans);
473 if (ret >= 0)
474 return 0;
468 475
469 do { 476 usleep_range(200, 1000);
470 ret = iwl_pcie_set_hw_ready(trans); 477 t += 200;
471 if (ret >= 0) 478 } while (t < 150000);
472 return 0; 479 msleep(25);
480 }
473 481
474 usleep_range(200, 1000); 482 IWL_DEBUG_INFO(trans, "got NIC after %d iterations\n", iter);
475 t += 200;
476 } while (t < 150000);
477 483
478 return ret; 484 return ret;
479} 485}
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 77a512a5a755..038940afbdc5 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -201,7 +201,7 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data)
201 IWL_ERR(trans, "scratch %d = 0x%08x\n", i, 201 IWL_ERR(trans, "scratch %d = 0x%08x\n", i,
202 le32_to_cpu(txq->scratchbufs[i].scratch)); 202 le32_to_cpu(txq->scratchbufs[i].scratch));
203 203
204 iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); 204 iwl_force_nmi(trans);
205} 205}
206 206
207/* 207/*
@@ -332,12 +332,12 @@ void iwl_pcie_txq_check_wrptrs(struct iwl_trans *trans)
332 for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) { 332 for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) {
333 struct iwl_txq *txq = &trans_pcie->txq[i]; 333 struct iwl_txq *txq = &trans_pcie->txq[i];
334 334
335 spin_lock(&txq->lock); 335 spin_lock_bh(&txq->lock);
336 if (trans_pcie->txq[i].need_update) { 336 if (trans_pcie->txq[i].need_update) {
337 iwl_pcie_txq_inc_wr_ptr(trans, txq); 337 iwl_pcie_txq_inc_wr_ptr(trans, txq);
338 trans_pcie->txq[i].need_update = false; 338 trans_pcie->txq[i].need_update = false;
339 } 339 }
340 spin_unlock(&txq->lock); 340 spin_unlock_bh(&txq->lock);
341 } 341 }
342} 342}
343 343
@@ -1029,7 +1029,7 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx)
1029 if (nfreed++ > 0) { 1029 if (nfreed++ > 0) {
1030 IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", 1030 IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n",
1031 idx, q->write_ptr, q->read_ptr); 1031 idx, q->write_ptr, q->read_ptr);
1032 iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); 1032 iwl_force_nmi(trans);
1033 } 1033 }
1034 } 1034 }
1035 1035
@@ -1600,7 +1600,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
1600 get_cmd_string(trans_pcie, cmd->id)); 1600 get_cmd_string(trans_pcie, cmd->id));
1601 ret = -ETIMEDOUT; 1601 ret = -ETIMEDOUT;
1602 1602
1603 iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); 1603 iwl_force_nmi(trans);
1604 iwl_trans_fw_error(trans); 1604 iwl_trans_fw_error(trans);
1605 1605
1606 goto cancel; 1606 goto cancel;