aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intel
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/intel')
-rw-r--r--drivers/net/wireless/intel/iwlegacy/4965-rs.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/cfg/8000.c51
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/paging.h24
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/file.h2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/img.h8
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/paging.c103
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-config.h3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-csr.h2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-drv.c6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-trans.h42
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw.c15
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c62
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mvm.h4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/ops.c1
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rs.c10
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c23
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/sta.c50
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/tx.c3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/drv.c10
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/trans.c7
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/tx.c1
21 files changed, 127 insertions, 302 deletions
diff --git a/drivers/net/wireless/intel/iwlegacy/4965-rs.c b/drivers/net/wireless/intel/iwlegacy/4965-rs.c
index c055f6da11c6..365a4187fc37 100644
--- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c
@@ -2154,13 +2154,11 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf,
2154 u8 use_green; 2154 u8 use_green;
2155 u8 active_tbl = 0; 2155 u8 active_tbl = 0;
2156 u8 valid_tx_ant; 2156 u8 valid_tx_ant;
2157 struct il_station_priv *sta_priv;
2158 2157
2159 if (!sta || !lq_sta) 2158 if (!sta || !lq_sta)
2160 return; 2159 return;
2161 2160
2162 use_green = il4965_rs_use_green(il, sta); 2161 use_green = il4965_rs_use_green(il, sta);
2163 sta_priv = (void *)sta->drv_priv;
2164 2162
2165 i = lq_sta->last_txrate_idx; 2163 i = lq_sta->last_txrate_idx;
2166 2164
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/8000.c b/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
index 1dce74afcd75..9bb7c19d48eb 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
@@ -100,14 +100,6 @@
100#define NVM_HW_SECTION_NUM_FAMILY_8000 10 100#define NVM_HW_SECTION_NUM_FAMILY_8000 10
101#define DEFAULT_NVM_FILE_FAMILY_8000C "nvmData-8000C" 101#define DEFAULT_NVM_FILE_FAMILY_8000C "nvmData-8000C"
102 102
103/* Max SDIO RX/TX aggregation sizes of the ADDBA request/response */
104#define MAX_RX_AGG_SIZE_8260_SDIO 21
105#define MAX_TX_AGG_SIZE_8260_SDIO 40
106
107/* Max A-MPDU exponent for HT and VHT */
108#define MAX_HT_AMPDU_EXPONENT_8260_SDIO IEEE80211_HT_MAX_AMPDU_32K
109#define MAX_VHT_AMPDU_EXPONENT_8260_SDIO IEEE80211_VHT_MAX_AMPDU_32K
110
111static const struct iwl_base_params iwl8000_base_params = { 103static const struct iwl_base_params iwl8000_base_params = {
112 .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_8000, 104 .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_8000,
113 .num_of_queues = 31, 105 .num_of_queues = 31,
@@ -234,48 +226,5 @@ const struct iwl_cfg iwl4165_2ac_cfg = {
234 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 226 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
235}; 227};
236 228
237const struct iwl_cfg iwl8260_2ac_sdio_cfg = {
238 .name = "Intel(R) Dual Band Wireless-AC 8260",
239 .fw_name_pre = IWL8000_FW_PRE,
240 IWL_DEVICE_8260,
241 .ht_params = &iwl8000_ht_params,
242 .nvm_ver = IWL8000_NVM_VERSION,
243 .nvm_calib_ver = IWL8000_TX_POWER_VERSION,
244 .max_rx_agg_size = MAX_RX_AGG_SIZE_8260_SDIO,
245 .max_tx_agg_size = MAX_TX_AGG_SIZE_8260_SDIO,
246 .disable_dummy_notification = true,
247 .max_ht_ampdu_exponent = MAX_HT_AMPDU_EXPONENT_8260_SDIO,
248 .max_vht_ampdu_exponent = MAX_VHT_AMPDU_EXPONENT_8260_SDIO,
249};
250
251const struct iwl_cfg iwl8265_2ac_sdio_cfg = {
252 .name = "Intel(R) Dual Band Wireless-AC 8265",
253 .fw_name_pre = IWL8265_FW_PRE,
254 IWL_DEVICE_8265,
255 .ht_params = &iwl8000_ht_params,
256 .nvm_ver = IWL8000_NVM_VERSION,
257 .nvm_calib_ver = IWL8000_TX_POWER_VERSION,
258 .max_rx_agg_size = MAX_RX_AGG_SIZE_8260_SDIO,
259 .max_tx_agg_size = MAX_TX_AGG_SIZE_8260_SDIO,
260 .disable_dummy_notification = true,
261 .max_ht_ampdu_exponent = MAX_HT_AMPDU_EXPONENT_8260_SDIO,
262 .max_vht_ampdu_exponent = MAX_VHT_AMPDU_EXPONENT_8260_SDIO,
263};
264
265const struct iwl_cfg iwl4165_2ac_sdio_cfg = {
266 .name = "Intel(R) Dual Band Wireless-AC 4165",
267 .fw_name_pre = IWL8000_FW_PRE,
268 IWL_DEVICE_8000,
269 .ht_params = &iwl8000_ht_params,
270 .nvm_ver = IWL8000_NVM_VERSION,
271 .nvm_calib_ver = IWL8000_TX_POWER_VERSION,
272 .max_rx_agg_size = MAX_RX_AGG_SIZE_8260_SDIO,
273 .max_tx_agg_size = MAX_TX_AGG_SIZE_8260_SDIO,
274 .bt_shared_single_ant = true,
275 .disable_dummy_notification = true,
276 .max_ht_ampdu_exponent = MAX_HT_AMPDU_EXPONENT_8260_SDIO,
277 .max_vht_ampdu_exponent = MAX_VHT_AMPDU_EXPONENT_8260_SDIO,
278};
279
280MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_MAX)); 229MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_MAX));
281MODULE_FIRMWARE(IWL8265_MODULE_FIRMWARE(IWL8265_UCODE_API_MAX)); 230MODULE_FIRMWARE(IWL8265_MODULE_FIRMWARE(IWL8265_UCODE_API_MAX));
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/paging.h b/drivers/net/wireless/intel/iwlwifi/fw/api/paging.h
index e76f9cd4473d..721b9fed7201 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/paging.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/paging.h
@@ -81,28 +81,4 @@ struct iwl_fw_paging_cmd {
81 __le32 device_phy_addr[NUM_OF_FW_PAGING_BLOCKS]; 81 __le32 device_phy_addr[NUM_OF_FW_PAGING_BLOCKS];
82} __packed; /* FW_PAGING_BLOCK_CMD_API_S_VER_1 */ 82} __packed; /* FW_PAGING_BLOCK_CMD_API_S_VER_1 */
83 83
84/**
85 * enum iwl_fw_item_id - FW item IDs
86 *
87 * @IWL_FW_ITEM_ID_PAGING: Address of the pages that the FW will upload
88 * download
89 */
90enum iwl_fw_item_id {
91 IWL_FW_ITEM_ID_PAGING = 3,
92};
93
94/**
95 * struct iwl_fw_get_item_cmd - get an item from the fw
96 * @item_id: ID of item to obtain, see &enum iwl_fw_item_id
97 */
98struct iwl_fw_get_item_cmd {
99 __le32 item_id;
100} __packed; /* FW_GET_ITEM_CMD_API_S_VER_1 */
101
102struct iwl_fw_get_item_resp {
103 __le32 item_id;
104 __le32 item_byte_cnt;
105 __le32 item_val;
106} __packed; /* FW_GET_ITEM_RSP_S_VER_1 */
107
108#endif /* __iwl_fw_api_paging_h__ */ 84#endif /* __iwl_fw_api_paging_h__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/file.h b/drivers/net/wireless/intel/iwlwifi/fw/file.h
index efd7fb65de8b..740d97093d1c 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/file.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/file.h
@@ -136,7 +136,7 @@ enum iwl_ucode_tlv_type {
136 IWL_UCODE_TLV_N_SCAN_CHANNELS = 31, 136 IWL_UCODE_TLV_N_SCAN_CHANNELS = 31,
137 IWL_UCODE_TLV_PAGING = 32, 137 IWL_UCODE_TLV_PAGING = 32,
138 IWL_UCODE_TLV_SEC_RT_USNIFFER = 34, 138 IWL_UCODE_TLV_SEC_RT_USNIFFER = 34,
139 IWL_UCODE_TLV_SDIO_ADMA_ADDR = 35, 139 /* 35 is unused */
140 IWL_UCODE_TLV_FW_VERSION = 36, 140 IWL_UCODE_TLV_FW_VERSION = 36,
141 IWL_UCODE_TLV_FW_DBG_DEST = 38, 141 IWL_UCODE_TLV_FW_DBG_DEST = 38,
142 IWL_UCODE_TLV_FW_DBG_CONF = 39, 142 IWL_UCODE_TLV_FW_DBG_CONF = 39,
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/img.h b/drivers/net/wireless/intel/iwlwifi/fw/img.h
index e6bc9cb60700..985496cc01d0 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/img.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/img.h
@@ -138,11 +138,6 @@ struct fw_img {
138 u32 paging_mem_size; 138 u32 paging_mem_size;
139}; 139};
140 140
141struct iwl_sf_region {
142 u32 addr;
143 u32 size;
144};
145
146/* 141/*
147 * Block paging calculations 142 * Block paging calculations
148 */ 143 */
@@ -257,7 +252,6 @@ enum iwl_fw_type {
257 * @type: firmware type (&enum iwl_fw_type) 252 * @type: firmware type (&enum iwl_fw_type)
258 * @cipher_scheme: optional external cipher scheme. 253 * @cipher_scheme: optional external cipher scheme.
259 * @human_readable: human readable version 254 * @human_readable: human readable version
260 * @sdio_adma_addr: the default address to set for the ADMA in SDIO mode until
261 * we get the ALIVE from the uCode 255 * we get the ALIVE from the uCode
262 * @dbg_dest_tlv: points to the destination TLV for debug 256 * @dbg_dest_tlv: points to the destination TLV for debug
263 * @dbg_conf_tlv: array of pointers to configuration TLVs for debug 257 * @dbg_conf_tlv: array of pointers to configuration TLVs for debug
@@ -290,8 +284,6 @@ struct iwl_fw {
290 struct iwl_fw_cipher_scheme cs[IWL_UCODE_MAX_CS]; 284 struct iwl_fw_cipher_scheme cs[IWL_UCODE_MAX_CS];
291 u8 human_readable[FW_VER_HUMAN_READABLE_SZ]; 285 u8 human_readable[FW_VER_HUMAN_READABLE_SZ];
292 286
293 u32 sdio_adma_addr;
294
295 struct iwl_fw_dbg_dest_tlv *dbg_dest_tlv; 287 struct iwl_fw_dbg_dest_tlv *dbg_dest_tlv;
296 struct iwl_fw_dbg_conf_tlv *dbg_conf_tlv[FW_DBG_CONF_MAX]; 288 struct iwl_fw_dbg_conf_tlv *dbg_conf_tlv[FW_DBG_CONF_MAX];
297 size_t dbg_conf_tlv_len[FW_DBG_CONF_MAX]; 289 size_t dbg_conf_tlv_len[FW_DBG_CONF_MAX];
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/paging.c b/drivers/net/wireless/intel/iwlwifi/fw/paging.c
index 1610722b8099..1fec8e3a6b35 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/paging.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/paging.c
@@ -87,9 +87,6 @@ void iwl_free_fw_paging(struct iwl_fw_runtime *fwrt)
87 get_order(paging->fw_paging_size)); 87 get_order(paging->fw_paging_size));
88 paging->fw_paging_block = NULL; 88 paging->fw_paging_block = NULL;
89 } 89 }
90 kfree(fwrt->trans->paging_download_buf);
91 fwrt->trans->paging_download_buf = NULL;
92 fwrt->trans->paging_db = NULL;
93 90
94 memset(fwrt->fw_paging_db, 0, sizeof(fwrt->fw_paging_db)); 91 memset(fwrt->fw_paging_db, 0, sizeof(fwrt->fw_paging_db));
95} 92}
@@ -100,13 +97,11 @@ static int iwl_alloc_fw_paging_mem(struct iwl_fw_runtime *fwrt,
100{ 97{
101 struct page *block; 98 struct page *block;
102 dma_addr_t phys = 0; 99 dma_addr_t phys = 0;
103 int blk_idx, order, num_of_pages, size, dma_enabled; 100 int blk_idx, order, num_of_pages, size;
104 101
105 if (fwrt->fw_paging_db[0].fw_paging_block) 102 if (fwrt->fw_paging_db[0].fw_paging_block)
106 return 0; 103 return 0;
107 104
108 dma_enabled = is_device_dma_capable(fwrt->trans->dev);
109
110 /* ensure BLOCK_2_EXP_SIZE is power of 2 of PAGING_BLOCK_SIZE */ 105 /* ensure BLOCK_2_EXP_SIZE is power of 2 of PAGING_BLOCK_SIZE */
111 BUILD_BUG_ON(BIT(BLOCK_2_EXP_SIZE) != PAGING_BLOCK_SIZE); 106 BUILD_BUG_ON(BIT(BLOCK_2_EXP_SIZE) != PAGING_BLOCK_SIZE);
112 107
@@ -139,24 +134,18 @@ static int iwl_alloc_fw_paging_mem(struct iwl_fw_runtime *fwrt,
139 fwrt->fw_paging_db[blk_idx].fw_paging_block = block; 134 fwrt->fw_paging_db[blk_idx].fw_paging_block = block;
140 fwrt->fw_paging_db[blk_idx].fw_paging_size = size; 135 fwrt->fw_paging_db[blk_idx].fw_paging_size = size;
141 136
142 if (dma_enabled) { 137 phys = dma_map_page(fwrt->trans->dev, block, 0,
143 phys = dma_map_page(fwrt->trans->dev, block, 0, 138 PAGE_SIZE << order,
144 PAGE_SIZE << order, 139 DMA_BIDIRECTIONAL);
145 DMA_BIDIRECTIONAL); 140 if (dma_mapping_error(fwrt->trans->dev, phys)) {
146 if (dma_mapping_error(fwrt->trans->dev, phys)) { 141 /*
147 /* 142 * free the previous pages and the current one
148 * free the previous pages and the current one 143 * since we failed to map_page.
149 * since we failed to map_page. 144 */
150 */ 145 iwl_free_fw_paging(fwrt);
151 iwl_free_fw_paging(fwrt); 146 return -ENOMEM;
152 return -ENOMEM;
153 }
154 fwrt->fw_paging_db[blk_idx].fw_paging_phys = phys;
155 } else {
156 fwrt->fw_paging_db[blk_idx].fw_paging_phys =
157 PAGING_ADDR_SIG |
158 blk_idx << BLOCK_2_EXP_SIZE;
159 } 147 }
148 fwrt->fw_paging_db[blk_idx].fw_paging_phys = phys;
160 149
161 if (!blk_idx) 150 if (!blk_idx)
162 IWL_DEBUG_FW(fwrt, 151 IWL_DEBUG_FW(fwrt,
@@ -312,60 +301,6 @@ static int iwl_send_paging_cmd(struct iwl_fw_runtime *fwrt,
312 return iwl_trans_send_cmd(fwrt->trans, &hcmd); 301 return iwl_trans_send_cmd(fwrt->trans, &hcmd);
313} 302}
314 303
315/*
316 * Send paging item cmd to FW in case CPU2 has paging image
317 */
318static int iwl_trans_get_paging_item(struct iwl_fw_runtime *fwrt)
319{
320 int ret;
321 struct iwl_fw_get_item_cmd fw_get_item_cmd = {
322 .item_id = cpu_to_le32(IWL_FW_ITEM_ID_PAGING),
323 };
324 struct iwl_fw_get_item_resp *item_resp;
325 struct iwl_host_cmd cmd = {
326 .id = iwl_cmd_id(FW_GET_ITEM_CMD, IWL_ALWAYS_LONG_GROUP, 0),
327 .flags = CMD_WANT_SKB | CMD_SEND_IN_RFKILL,
328 .data = { &fw_get_item_cmd, },
329 .len = { sizeof(fw_get_item_cmd), },
330 };
331
332 ret = iwl_trans_send_cmd(fwrt->trans, &cmd);
333 if (ret) {
334 IWL_ERR(fwrt,
335 "Paging: Failed to send FW_GET_ITEM_CMD cmd (err = %d)\n",
336 ret);
337 return ret;
338 }
339
340 item_resp = (void *)((struct iwl_rx_packet *)cmd.resp_pkt)->data;
341 if (item_resp->item_id != cpu_to_le32(IWL_FW_ITEM_ID_PAGING)) {
342 IWL_ERR(fwrt,
343 "Paging: got wrong item in FW_GET_ITEM_CMD resp (item_id = %u)\n",
344 le32_to_cpu(item_resp->item_id));
345 ret = -EIO;
346 goto exit;
347 }
348
349 /* Add an extra page for headers */
350 fwrt->trans->paging_download_buf = kzalloc(PAGING_BLOCK_SIZE +
351 FW_PAGING_SIZE,
352 GFP_KERNEL);
353 if (!fwrt->trans->paging_download_buf) {
354 ret = -ENOMEM;
355 goto exit;
356 }
357 fwrt->trans->paging_req_addr = le32_to_cpu(item_resp->item_val);
358 fwrt->trans->paging_db = fwrt->fw_paging_db;
359 IWL_DEBUG_FW(fwrt,
360 "Paging: got paging request address (paging_req_addr 0x%08x)\n",
361 fwrt->trans->paging_req_addr);
362
363exit:
364 iwl_free_resp(&cmd);
365
366 return ret;
367}
368
369int iwl_init_paging(struct iwl_fw_runtime *fwrt, enum iwl_ucode_type type) 304int iwl_init_paging(struct iwl_fw_runtime *fwrt, enum iwl_ucode_type type)
370{ 305{
371 const struct fw_img *fw = &fwrt->fw->img[type]; 306 const struct fw_img *fw = &fwrt->fw->img[type];
@@ -382,20 +317,6 @@ int iwl_init_paging(struct iwl_fw_runtime *fwrt, enum iwl_ucode_type type)
382 if (!fw->paging_mem_size) 317 if (!fw->paging_mem_size)
383 return 0; 318 return 0;
384 319
385 /*
386 * When dma is not enabled, the driver needs to copy / write
387 * the downloaded / uploaded page to / from the smem.
388 * This gets the location of the place were the pages are
389 * stored.
390 */
391 if (!is_device_dma_capable(fwrt->trans->dev)) {
392 ret = iwl_trans_get_paging_item(fwrt);
393 if (ret) {
394 IWL_ERR(fwrt, "failed to get FW paging item\n");
395 return ret;
396 }
397 }
398
399 ret = iwl_save_fw_paging(fwrt, fw); 320 ret = iwl_save_fw_paging(fwrt, fw);
400 if (ret) { 321 if (ret) {
401 IWL_ERR(fwrt, "failed to save the FW paging image\n"); 322 IWL_ERR(fwrt, "failed to save the FW paging image\n");
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index 86a796025750..d1263a554420 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -467,9 +467,6 @@ extern const struct iwl_cfg iwl8260_2ac_cfg;
467extern const struct iwl_cfg iwl8265_2ac_cfg; 467extern const struct iwl_cfg iwl8265_2ac_cfg;
468extern const struct iwl_cfg iwl8275_2ac_cfg; 468extern const struct iwl_cfg iwl8275_2ac_cfg;
469extern const struct iwl_cfg iwl4165_2ac_cfg; 469extern const struct iwl_cfg iwl4165_2ac_cfg;
470extern const struct iwl_cfg iwl8260_2ac_sdio_cfg;
471extern const struct iwl_cfg iwl8265_2ac_sdio_cfg;
472extern const struct iwl_cfg iwl4165_2ac_sdio_cfg;
473extern const struct iwl_cfg iwl9160_2ac_cfg; 470extern const struct iwl_cfg iwl9160_2ac_cfg;
474extern const struct iwl_cfg iwl9260_2ac_cfg; 471extern const struct iwl_cfg iwl9260_2ac_cfg;
475extern const struct iwl_cfg iwl9270_2ac_cfg; 472extern const struct iwl_cfg iwl9270_2ac_cfg;
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
index b03e0f975b5a..4f0d070eda54 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
@@ -218,7 +218,6 @@
218#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */ 218#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */
219#define CSR_INT_BIT_SCD (1 << 26) /* TXQ pointer advanced */ 219#define CSR_INT_BIT_SCD (1 << 26) /* TXQ pointer advanced */
220#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */ 220#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */
221#define CSR_INT_BIT_PAGING (1 << 24) /* SDIO PAGING */
222#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */ 221#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */
223#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */ 222#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */
224#define CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses */ 223#define CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses */
@@ -229,7 +228,6 @@
229 CSR_INT_BIT_HW_ERR | \ 228 CSR_INT_BIT_HW_ERR | \
230 CSR_INT_BIT_FH_TX | \ 229 CSR_INT_BIT_FH_TX | \
231 CSR_INT_BIT_SW_ERR | \ 230 CSR_INT_BIT_SW_ERR | \
232 CSR_INT_BIT_PAGING | \
233 CSR_INT_BIT_RF_KILL | \ 231 CSR_INT_BIT_RF_KILL | \
234 CSR_INT_BIT_SW_RX | \ 232 CSR_INT_BIT_SW_RX | \
235 CSR_INT_BIT_WAKEUP | \ 233 CSR_INT_BIT_WAKEUP | \
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index ccdb247d68c5..4b224d7d967c 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -1039,12 +1039,6 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
1039 drv->fw.img[usniffer_img].paging_mem_size = 1039 drv->fw.img[usniffer_img].paging_mem_size =
1040 paging_mem_size; 1040 paging_mem_size;
1041 break; 1041 break;
1042 case IWL_UCODE_TLV_SDIO_ADMA_ADDR:
1043 if (tlv_len != sizeof(u32))
1044 goto invalid_tlv_len;
1045 drv->fw.sdio_adma_addr =
1046 le32_to_cpup((__le32 *)tlv_data);
1047 break;
1048 case IWL_UCODE_TLV_FW_GSCAN_CAPA: 1042 case IWL_UCODE_TLV_FW_GSCAN_CAPA:
1049 /* 1043 /*
1050 * Don't return an error in case of a shorter tlv_len 1044 * Don't return an error in case of a shorter tlv_len
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index bba4f54cbbbb..ca0b5536a8a6 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -398,8 +398,6 @@ struct iwl_hcmd_arr {
398 * @command_groups: array of command groups, each member is an array of the 398 * @command_groups: array of command groups, each member is an array of the
399 * commands in the group; for debugging only 399 * commands in the group; for debugging only
400 * @command_groups_size: number of command groups, to avoid illegal access 400 * @command_groups_size: number of command groups, to avoid illegal access
401 * @sdio_adma_addr: the default address to set for the ADMA in SDIO mode until
402 * we get the ALIVE from the uCode
403 * @cb_data_offs: offset inside skb->cb to store transport data at, must have 401 * @cb_data_offs: offset inside skb->cb to store transport data at, must have
404 * space for at least two pointers 402 * space for at least two pointers
405 */ 403 */
@@ -419,8 +417,6 @@ struct iwl_trans_config {
419 const struct iwl_hcmd_arr *command_groups; 417 const struct iwl_hcmd_arr *command_groups;
420 int command_groups_size; 418 int command_groups_size;
421 419
422 u32 sdio_adma_addr;
423
424 u8 cb_data_offs; 420 u8 cb_data_offs;
425}; 421};
426 422
@@ -524,6 +520,9 @@ struct iwl_trans_txq_scd_cfg {
524 * @dump_data: return a vmalloc'ed buffer with debug data, maybe containing last 520 * @dump_data: return a vmalloc'ed buffer with debug data, maybe containing last
525 * TX'ed commands and similar. The buffer will be vfree'd by the caller. 521 * TX'ed commands and similar. The buffer will be vfree'd by the caller.
526 * Note that the transport must fill in the proper file headers. 522 * Note that the transport must fill in the proper file headers.
523 * @dump_regs: dump using IWL_ERR configuration space and memory mapped
524 * registers of the device to diagnose failure, e.g., when HW becomes
525 * inaccessible.
527 */ 526 */
528struct iwl_trans_ops { 527struct iwl_trans_ops {
529 528
@@ -531,8 +530,6 @@ struct iwl_trans_ops {
531 void (*op_mode_leave)(struct iwl_trans *iwl_trans); 530 void (*op_mode_leave)(struct iwl_trans *iwl_trans);
532 int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw, 531 int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw,
533 bool run_in_rfkill); 532 bool run_in_rfkill);
534 int (*update_sf)(struct iwl_trans *trans,
535 struct iwl_sf_region *st_fwrd_space);
536 void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr); 533 void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr);
537 void (*stop_device)(struct iwl_trans *trans, bool low_power); 534 void (*stop_device)(struct iwl_trans *trans, bool low_power);
538 535
@@ -593,6 +590,8 @@ struct iwl_trans_ops {
593 struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans, 590 struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans,
594 const struct iwl_fw_dbg_trigger_tlv 591 const struct iwl_fw_dbg_trigger_tlv
595 *trigger); 592 *trigger);
593
594 void (*dump_regs)(struct iwl_trans *trans);
596}; 595};
597 596
598/** 597/**
@@ -700,12 +699,6 @@ enum iwl_plat_pm_mode {
700 * @dbg_conf_tlv: array of pointers to configuration TLVs for debug 699 * @dbg_conf_tlv: array of pointers to configuration TLVs for debug
701 * @dbg_trigger_tlv: array of pointers to triggers TLVs for debug 700 * @dbg_trigger_tlv: array of pointers to triggers TLVs for debug
702 * @dbg_dest_reg_num: num of reg_ops in %dbg_dest_tlv 701 * @dbg_dest_reg_num: num of reg_ops in %dbg_dest_tlv
703 * @paging_req_addr: The location were the FW will upload / download the pages
704 * from. The address is set by the opmode
705 * @paging_db: Pointer to the opmode paging data base, the pointer is set by
706 * the opmode.
707 * @paging_download_buf: Buffer used for copying all of the pages before
708 * downloading them to the FW. The buffer is allocated in the opmode
709 * @system_pm_mode: the system-wide power management mode in use. 702 * @system_pm_mode: the system-wide power management mode in use.
710 * This mode is set dynamically, depending on the WoWLAN values 703 * This mode is set dynamically, depending on the WoWLAN values
711 * configured from the userspace at runtime. 704 * configured from the userspace at runtime.
@@ -754,14 +747,6 @@ struct iwl_trans {
754 struct iwl_fw_dbg_trigger_tlv * const *dbg_trigger_tlv; 747 struct iwl_fw_dbg_trigger_tlv * const *dbg_trigger_tlv;
755 u8 dbg_dest_reg_num; 748 u8 dbg_dest_reg_num;
756 749
757 /*
758 * Paging parameters - All of the parameters should be set by the
759 * opmode when paging is enabled
760 */
761 u32 paging_req_addr;
762 struct iwl_fw_paging *paging_db;
763 void *paging_download_buf;
764
765 enum iwl_plat_pm_mode system_pm_mode; 750 enum iwl_plat_pm_mode system_pm_mode;
766 enum iwl_plat_pm_mode runtime_pm_mode; 751 enum iwl_plat_pm_mode runtime_pm_mode;
767 bool suspending; 752 bool suspending;
@@ -828,17 +813,6 @@ static inline int iwl_trans_start_fw(struct iwl_trans *trans,
828 return trans->ops->start_fw(trans, fw, run_in_rfkill); 813 return trans->ops->start_fw(trans, fw, run_in_rfkill);
829} 814}
830 815
831static inline int iwl_trans_update_sf(struct iwl_trans *trans,
832 struct iwl_sf_region *st_fwrd_space)
833{
834 might_sleep();
835
836 if (trans->ops->update_sf)
837 return trans->ops->update_sf(trans, st_fwrd_space);
838
839 return 0;
840}
841
842static inline void _iwl_trans_stop_device(struct iwl_trans *trans, 816static inline void _iwl_trans_stop_device(struct iwl_trans *trans,
843 bool low_power) 817 bool low_power)
844{ 818{
@@ -896,6 +870,12 @@ iwl_trans_dump_data(struct iwl_trans *trans,
896 return trans->ops->dump_data(trans, trigger); 870 return trans->ops->dump_data(trans, trigger);
897} 871}
898 872
873static inline void iwl_trans_dump_regs(struct iwl_trans *trans)
874{
875 if (trans->ops->dump_regs)
876 trans->ops->dump_regs(trans);
877}
878
899static inline struct iwl_device_cmd * 879static inline struct iwl_device_cmd *
900iwl_trans_alloc_tx_cmd(struct iwl_trans *trans) 880iwl_trans_alloc_tx_cmd(struct iwl_trans *trans)
901{ 881{
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 0296df625cd5..c0de7bb86cf7 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -196,8 +196,6 @@ static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
196 mvm->error_event_table[1] = 196 mvm->error_event_table[1] =
197 le32_to_cpu(lmac2->error_event_table_ptr); 197 le32_to_cpu(lmac2->error_event_table_ptr);
198 mvm->log_event_table = le32_to_cpu(lmac1->log_event_table_ptr); 198 mvm->log_event_table = le32_to_cpu(lmac1->log_event_table_ptr);
199 mvm->sf_space.addr = le32_to_cpu(lmac1->st_fwrd_addr);
200 mvm->sf_space.size = le32_to_cpu(lmac1->st_fwrd_size);
201 199
202 umac_error_event_table = le32_to_cpu(umac->error_info_addr); 200 umac_error_event_table = le32_to_cpu(umac->error_info_addr);
203 201
@@ -266,7 +264,6 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
266 int ret, i; 264 int ret, i;
267 enum iwl_ucode_type old_type = mvm->fwrt.cur_fw_img; 265 enum iwl_ucode_type old_type = mvm->fwrt.cur_fw_img;
268 static const u16 alive_cmd[] = { MVM_ALIVE }; 266 static const u16 alive_cmd[] = { MVM_ALIVE };
269 struct iwl_sf_region st_fwrd_space;
270 267
271 if (ucode_type == IWL_UCODE_REGULAR && 268 if (ucode_type == IWL_UCODE_REGULAR &&
272 iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE) && 269 iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE) &&
@@ -320,18 +317,6 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
320 return -EIO; 317 return -EIO;
321 } 318 }
322 319
323 /*
324 * update the sdio allocation according to the pointer we get in the
325 * alive notification.
326 */
327 st_fwrd_space.addr = mvm->sf_space.addr;
328 st_fwrd_space.size = mvm->sf_space.size;
329 ret = iwl_trans_update_sf(mvm->trans, &st_fwrd_space);
330 if (ret) {
331 IWL_ERR(mvm, "Failed to update SF size. ret %d\n", ret);
332 return ret;
333 }
334
335 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); 320 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr);
336 321
337 /* 322 /*
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 0b3d275fe177..3e92a117c0b8 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -4002,39 +4002,36 @@ out_unlock:
4002 4002
4003static void iwl_mvm_flush_no_vif(struct iwl_mvm *mvm, u32 queues, bool drop) 4003static void iwl_mvm_flush_no_vif(struct iwl_mvm *mvm, u32 queues, bool drop)
4004{ 4004{
4005 if (drop) { 4005 int i;
4006 if (iwl_mvm_has_new_tx_api(mvm))
4007 /* TODO new tx api */
4008 WARN_ONCE(1,
4009 "Need to implement flush TX queue\n");
4010 else
4011 iwl_mvm_flush_tx_path(mvm,
4012 iwl_mvm_flushable_queues(mvm) & queues,
4013 0);
4014 } else {
4015 if (iwl_mvm_has_new_tx_api(mvm)) {
4016 struct ieee80211_sta *sta;
4017 int i;
4018 4006
4007 if (!iwl_mvm_has_new_tx_api(mvm)) {
4008 if (drop) {
4019 mutex_lock(&mvm->mutex); 4009 mutex_lock(&mvm->mutex);
4020 4010 iwl_mvm_flush_tx_path(mvm,
4021 for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) { 4011 iwl_mvm_flushable_queues(mvm) & queues, 0);
4022 sta = rcu_dereference_protected(
4023 mvm->fw_id_to_mac_id[i],
4024 lockdep_is_held(&mvm->mutex));
4025 if (IS_ERR_OR_NULL(sta))
4026 continue;
4027
4028 iwl_mvm_wait_sta_queues_empty(mvm,
4029 iwl_mvm_sta_from_mac80211(sta));
4030 }
4031
4032 mutex_unlock(&mvm->mutex); 4012 mutex_unlock(&mvm->mutex);
4033 } else { 4013 } else {
4034 iwl_trans_wait_tx_queues_empty(mvm->trans, 4014 iwl_trans_wait_tx_queues_empty(mvm->trans, queues);
4035 queues);
4036 } 4015 }
4016 return;
4017 }
4018
4019 mutex_lock(&mvm->mutex);
4020 for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) {
4021 struct ieee80211_sta *sta;
4022
4023 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i],
4024 lockdep_is_held(&mvm->mutex));
4025 if (IS_ERR_OR_NULL(sta))
4026 continue;
4027
4028 if (drop)
4029 iwl_mvm_flush_sta_tids(mvm, i, 0xFF, 0);
4030 else
4031 iwl_mvm_wait_sta_queues_empty(mvm,
4032 iwl_mvm_sta_from_mac80211(sta));
4037 } 4033 }
4034 mutex_unlock(&mvm->mutex);
4038} 4035}
4039 4036
4040static void iwl_mvm_mac_flush(struct ieee80211_hw *hw, 4037static void iwl_mvm_mac_flush(struct ieee80211_hw *hw,
@@ -4294,9 +4291,7 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
4294 4291
4295 lockdep_assert_held(&mvm->mutex); 4292 lockdep_assert_held(&mvm->mutex);
4296 4293
4297 /* TODO - remove a000 disablement when we have RXQ config API */ 4294 if (!iwl_mvm_has_new_rx_api(mvm))
4298 if (!iwl_mvm_has_new_rx_api(mvm) ||
4299 mvm->trans->cfg->device_family == IWL_DEVICE_FAMILY_A000)
4300 return; 4295 return;
4301 4296
4302 notif->cookie = mvm->queue_sync_cookie; 4297 notif->cookie = mvm->queue_sync_cookie;
@@ -4305,6 +4300,13 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
4305 atomic_set(&mvm->queue_sync_counter, 4300 atomic_set(&mvm->queue_sync_counter,
4306 mvm->trans->num_rx_queues); 4301 mvm->trans->num_rx_queues);
4307 4302
4303 /* TODO - remove this when we have RXQ config API */
4304 if (mvm->trans->cfg->device_family == IWL_DEVICE_FAMILY_A000) {
4305 qmask = BIT(0);
4306 if (notif->sync)
4307 atomic_set(&mvm->queue_sync_counter, 1);
4308 }
4309
4308 ret = iwl_mvm_notify_rx_queue(mvm, qmask, (u8 *)notif, size); 4310 ret = iwl_mvm_notify_rx_queue(mvm, qmask, (u8 *)notif, size);
4309 if (ret) { 4311 if (ret) {
4310 IWL_ERR(mvm, "Failed to trigger RX queues sync (%d)\n", ret); 4312 IWL_ERR(mvm, "Failed to trigger RX queues sync (%d)\n", ret);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index e34b3eb8e08b..0e18c5066f04 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -652,6 +652,7 @@ struct iwl_mvm_baid_data {
652 u16 entries_per_queue; 652 u16 entries_per_queue;
653 unsigned long last_rx; 653 unsigned long last_rx;
654 struct timer_list session_timer; 654 struct timer_list session_timer;
655 struct iwl_mvm_baid_data __rcu **rcu_ptr;
655 struct iwl_mvm *mvm; 656 struct iwl_mvm *mvm;
656 struct iwl_mvm_reorder_buffer reorder_buf[IWL_MAX_RX_HW_QUEUES]; 657 struct iwl_mvm_reorder_buffer reorder_buf[IWL_MAX_RX_HW_QUEUES];
657 struct iwl_mvm_reorder_buf_entry entries[]; 658 struct iwl_mvm_reorder_buf_entry entries[];
@@ -754,7 +755,6 @@ struct iwl_mvm {
754 u32 log_event_table; 755 u32 log_event_table;
755 u32 umac_error_event_table; 756 u32 umac_error_event_table;
756 bool support_umac_log; 757 bool support_umac_log;
757 struct iwl_sf_region sf_space;
758 758
759 u32 ampdu_ref; 759 u32 ampdu_ref;
760 bool ampdu_toggle; 760 bool ampdu_toggle;
@@ -1854,7 +1854,7 @@ void iwl_mvm_tdls_ch_switch_work(struct work_struct *work);
1854void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, 1854void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
1855 struct iwl_mvm_internal_rxq_notif *notif, 1855 struct iwl_mvm_internal_rxq_notif *notif,
1856 u32 size); 1856 u32 size);
1857void iwl_mvm_reorder_timer_expired(unsigned long data); 1857void iwl_mvm_reorder_timer_expired(struct timer_list *t);
1858struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm); 1858struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm);
1859bool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm); 1859bool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm);
1860 1860
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index e82b4462722b..ce718e9c63ec 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -703,7 +703,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
703 trans_cfg.cb_data_offs = offsetof(struct ieee80211_tx_info, 703 trans_cfg.cb_data_offs = offsetof(struct ieee80211_tx_info,
704 driver_data[2]); 704 driver_data[2]);
705 705
706 trans_cfg.sdio_adma_addr = fw->sdio_adma_addr;
707 trans_cfg.sw_csum_tx = IWL_MVM_SW_TX_CSUM_OFFLOAD; 706 trans_cfg.sw_csum_tx = IWL_MVM_SW_TX_CSUM_OFFLOAD;
708 707
709 /* Set a short watchdog for the command queue */ 708 /* Set a short watchdog for the command queue */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 0fe723ca844e..c69515ed72df 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -67,12 +67,8 @@ static u8 rs_ht_to_legacy[] = {
67static const u8 ant_toggle_lookup[] = { 67static const u8 ant_toggle_lookup[] = {
68 [ANT_NONE] = ANT_NONE, 68 [ANT_NONE] = ANT_NONE,
69 [ANT_A] = ANT_B, 69 [ANT_A] = ANT_B,
70 [ANT_B] = ANT_C, 70 [ANT_B] = ANT_A,
71 [ANT_AB] = ANT_BC, 71 [ANT_AB] = ANT_AB,
72 [ANT_C] = ANT_A,
73 [ANT_AC] = ANT_AB,
74 [ANT_BC] = ANT_AC,
75 [ANT_ABC] = ANT_ABC,
76}; 72};
77 73
78#define IWL_DECLARE_RATE_INFO(r, s, rp, rn) \ 74#define IWL_DECLARE_RATE_INFO(r, s, rp, rn) \
@@ -975,7 +971,7 @@ static int rs_toggle_antenna(u32 valid_ant, struct rs_rate *rate)
975{ 971{
976 u8 new_ant_type; 972 u8 new_ant_type;
977 973
978 if (!rate->ant || rate->ant > ANT_ABC) 974 if (!rate->ant || WARN_ON_ONCE(rate->ant & ANT_C))
979 return 0; 975 return 0;
980 976
981 if (!rs_is_valid_ant(valid_ant, rate->ant)) 977 if (!rs_is_valid_ant(valid_ant, rate->ant))
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index b84756dc9d6c..76dc58381e1c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -460,9 +460,9 @@ set_timer:
460 } 460 }
461} 461}
462 462
463void iwl_mvm_reorder_timer_expired(unsigned long data) 463void iwl_mvm_reorder_timer_expired(struct timer_list *t)
464{ 464{
465 struct iwl_mvm_reorder_buffer *buf = (void *)data; 465 struct iwl_mvm_reorder_buffer *buf = from_timer(buf, t, reorder_timer);
466 struct iwl_mvm_baid_data *baid_data = 466 struct iwl_mvm_baid_data *baid_data =
467 iwl_mvm_baid_data_from_reorder_buf(buf); 467 iwl_mvm_baid_data_from_reorder_buf(buf);
468 struct iwl_mvm_reorder_buf_entry *entries = 468 struct iwl_mvm_reorder_buf_entry *entries =
@@ -719,6 +719,22 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
719 return false; 719 return false;
720 } 720 }
721 721
722 /*
723 * release immediately if there are no stored frames, and the sn is
724 * equal to the head.
725 * This can happen due to reorder timer, where NSSN is behind head_sn.
726 * When we released everything, and we got the next frame in the
727 * sequence, according to the NSSN we can't release immediately,
728 * while technically there is no hole and we can move forward.
729 */
730 if (!buffer->num_stored && sn == buffer->head_sn) {
731 if (!amsdu || last_subframe)
732 buffer->head_sn = ieee80211_sn_inc(buffer->head_sn);
733 /* No need to update AMSDU last SN - we are moving the head */
734 spin_unlock_bh(&buffer->lock);
735 return false;
736 }
737
722 index = sn % buffer->buf_size; 738 index = sn % buffer->buf_size;
723 739
724 /* 740 /*
@@ -818,6 +834,9 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
818 struct sk_buff *skb; 834 struct sk_buff *skb;
819 u8 crypt_len = 0; 835 u8 crypt_len = 0;
820 836
837 if (unlikely(test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)))
838 return;
839
821 /* Dont use dev_alloc_skb(), we'll have enough headroom once 840 /* Dont use dev_alloc_skb(), we'll have enough headroom once
822 * ieee80211_hdr pulled. 841 * ieee80211_hdr pulled.
823 */ 842 */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 23787cc9c89e..c19f98489d4e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -252,9 +252,11 @@ int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
252 return ret; 252 return ret;
253} 253}
254 254
255static void iwl_mvm_rx_agg_session_expired(unsigned long data) 255static void iwl_mvm_rx_agg_session_expired(struct timer_list *t)
256{ 256{
257 struct iwl_mvm_baid_data __rcu **rcu_ptr = (void *)data; 257 struct iwl_mvm_baid_data *data =
258 from_timer(data, t, session_timer);
259 struct iwl_mvm_baid_data __rcu **rcu_ptr = data->rcu_ptr;
258 struct iwl_mvm_baid_data *ba_data; 260 struct iwl_mvm_baid_data *ba_data;
259 struct ieee80211_sta *sta; 261 struct ieee80211_sta *sta;
260 struct iwl_mvm_sta *mvm_sta; 262 struct iwl_mvm_sta *mvm_sta;
@@ -644,8 +646,7 @@ int iwl_mvm_scd_queue_redirect(struct iwl_mvm *mvm, int queue, int tid,
644 646
645 /* Redirect to lower AC */ 647 /* Redirect to lower AC */
646 iwl_mvm_reconfig_scd(mvm, queue, iwl_mvm_ac_to_tx_fifo[ac], 648 iwl_mvm_reconfig_scd(mvm, queue, iwl_mvm_ac_to_tx_fifo[ac],
647 cmd.sta_id, tid, LINK_QUAL_AGG_FRAME_LIMIT_DEF, 649 cmd.sta_id, tid, IWL_FRAME_LIMIT, ssn);
648 ssn);
649 650
650 /* Update AC marking of the queue */ 651 /* Update AC marking of the queue */
651 spin_lock_bh(&mvm->queue_info_lock); 652 spin_lock_bh(&mvm->queue_info_lock);
@@ -1258,6 +1259,14 @@ static void iwl_mvm_realloc_queues_after_restart(struct iwl_mvm *mvm,
1258 mvm_sta->sta_id, 1259 mvm_sta->sta_id,
1259 i, wdg_timeout); 1260 i, wdg_timeout);
1260 tid_data->txq_id = txq_id; 1261 tid_data->txq_id = txq_id;
1262
1263 /*
1264 * Since we don't set the seq number after reset, and HW
1265 * sets it now, FW reset will cause the seq num to start
1266 * at 0 again, so driver will need to update it
1267 * internally as well, so it keeps in sync with real val
1268 */
1269 tid_data->seq_number = 0;
1261 } else { 1270 } else {
1262 u16 seq = IEEE80211_SEQ_TO_SN(tid_data->seq_number); 1271 u16 seq = IEEE80211_SEQ_TO_SN(tid_data->seq_number);
1263 1272
@@ -2153,10 +2162,8 @@ static void iwl_mvm_init_reorder_buffer(struct iwl_mvm *mvm,
2153 reorder_buf->head_sn = ssn; 2162 reorder_buf->head_sn = ssn;
2154 reorder_buf->buf_size = buf_size; 2163 reorder_buf->buf_size = buf_size;
2155 /* rx reorder timer */ 2164 /* rx reorder timer */
2156 reorder_buf->reorder_timer.function = 2165 timer_setup(&reorder_buf->reorder_timer,
2157 iwl_mvm_reorder_timer_expired; 2166 iwl_mvm_reorder_timer_expired, 0);
2158 reorder_buf->reorder_timer.data = (unsigned long)reorder_buf;
2159 init_timer(&reorder_buf->reorder_timer);
2160 spin_lock_init(&reorder_buf->lock); 2167 spin_lock_init(&reorder_buf->lock);
2161 reorder_buf->mvm = mvm; 2168 reorder_buf->mvm = mvm;
2162 reorder_buf->queue = i; 2169 reorder_buf->queue = i;
@@ -2279,9 +2286,9 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
2279 baid_data->baid = baid; 2286 baid_data->baid = baid;
2280 baid_data->timeout = timeout; 2287 baid_data->timeout = timeout;
2281 baid_data->last_rx = jiffies; 2288 baid_data->last_rx = jiffies;
2282 setup_timer(&baid_data->session_timer, 2289 baid_data->rcu_ptr = &mvm->baid_map[baid];
2283 iwl_mvm_rx_agg_session_expired, 2290 timer_setup(&baid_data->session_timer,
2284 (unsigned long)&mvm->baid_map[baid]); 2291 iwl_mvm_rx_agg_session_expired, 0);
2285 baid_data->mvm = mvm; 2292 baid_data->mvm = mvm;
2286 baid_data->tid = tid; 2293 baid_data->tid = tid;
2287 baid_data->sta_id = mvm_sta->sta_id; 2294 baid_data->sta_id = mvm_sta->sta_id;
@@ -2544,12 +2551,6 @@ int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2544 BUILD_BUG_ON((sizeof(mvmsta->agg_tids) * BITS_PER_BYTE) 2551 BUILD_BUG_ON((sizeof(mvmsta->agg_tids) * BITS_PER_BYTE)
2545 != IWL_MAX_TID_COUNT); 2552 != IWL_MAX_TID_COUNT);
2546 2553
2547 if (!mvm->trans->cfg->gen2)
2548 buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF);
2549 else
2550 buf_size = min_t(int, buf_size,
2551 LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF);
2552
2553 spin_lock_bh(&mvmsta->lock); 2554 spin_lock_bh(&mvmsta->lock);
2554 ssn = tid_data->ssn; 2555 ssn = tid_data->ssn;
2555 queue = tid_data->txq_id; 2556 queue = tid_data->txq_id;
@@ -2561,10 +2562,17 @@ int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2561 2562
2562 if (iwl_mvm_has_new_tx_api(mvm)) { 2563 if (iwl_mvm_has_new_tx_api(mvm)) {
2563 /* 2564 /*
2564 * If no queue iwl_mvm_sta_tx_agg_start() would have failed so 2565 * If there is no queue for this tid, iwl_mvm_sta_tx_agg_start()
2565 * no need to check queue's status 2566 * would have failed, so if we are here there is no need to
2567 * allocate a queue.
2568 * However, if aggregation size is different than the default
2569 * size, the scheduler should be reconfigured.
2570 * We cannot do this with the new TX API, so return unsupported
2571 * for now, until it will be offloaded to firmware..
2572 * Note that if SCD default value changes - this condition
2573 * should be updated as well.
2566 */ 2574 */
2567 if (buf_size < mvmsta->max_agg_bufsize) 2575 if (buf_size < IWL_FRAME_LIMIT)
2568 return -ENOTSUPP; 2576 return -ENOTSUPP;
2569 2577
2570 ret = iwl_mvm_sta_tx_agg(mvm, sta, tid, queue, true); 2578 ret = iwl_mvm_sta_tx_agg(mvm, sta, tid, queue, true);
@@ -2587,7 +2595,7 @@ int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2587 * Only reconfig the SCD for the queue if the window size has 2595 * Only reconfig the SCD for the queue if the window size has
2588 * changed from current (become smaller) 2596 * changed from current (become smaller)
2589 */ 2597 */
2590 if (!alloc_queue && buf_size < mvmsta->max_agg_bufsize) { 2598 if (!alloc_queue && buf_size < IWL_FRAME_LIMIT) {
2591 /* 2599 /*
2592 * If reconfiguring an existing queue, it first must be 2600 * If reconfiguring an existing queue, it first must be
2593 * drained 2601 * drained
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index 00a0efab20e3..d88c3685a6dd 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -1594,8 +1594,7 @@ static void iwl_mvm_rx_tx_cmd_agg(struct iwl_mvm *mvm,
1594 mvmsta->tid_data[tid].tx_time = 1594 mvmsta->tid_data[tid].tx_time =
1595 le16_to_cpu(tx_resp->wireless_media_time); 1595 le16_to_cpu(tx_resp->wireless_media_time);
1596 mvmsta->tid_data[tid].lq_color = 1596 mvmsta->tid_data[tid].lq_color =
1597 (tx_resp->tlc_info & TX_RES_RATE_TABLE_COLOR_MSK) >> 1597 TX_RES_RATE_TABLE_COL_GET(tx_resp->tlc_info);
1598 TX_RES_RATE_TABLE_COLOR_POS;
1599 } 1598 }
1600 1599
1601 rcu_read_unlock(); 1600 rcu_read_unlock();
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index aa3c07192624..4a21c12276d7 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -467,6 +467,8 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
467 {IWL_PCI_DEVICE(0x24F3, 0x9110, iwl8260_2ac_cfg)}, 467 {IWL_PCI_DEVICE(0x24F3, 0x9110, iwl8260_2ac_cfg)},
468 {IWL_PCI_DEVICE(0x24F4, 0x8030, iwl8260_2ac_cfg)}, 468 {IWL_PCI_DEVICE(0x24F4, 0x8030, iwl8260_2ac_cfg)},
469 {IWL_PCI_DEVICE(0x24F4, 0x9030, iwl8260_2ac_cfg)}, 469 {IWL_PCI_DEVICE(0x24F4, 0x9030, iwl8260_2ac_cfg)},
470 {IWL_PCI_DEVICE(0x24F4, 0xC030, iwl8260_2ac_cfg)},
471 {IWL_PCI_DEVICE(0x24F4, 0xD030, iwl8260_2ac_cfg)},
470 {IWL_PCI_DEVICE(0x24F3, 0x8130, iwl8260_2ac_cfg)}, 472 {IWL_PCI_DEVICE(0x24F3, 0x8130, iwl8260_2ac_cfg)},
471 {IWL_PCI_DEVICE(0x24F3, 0x9130, iwl8260_2ac_cfg)}, 473 {IWL_PCI_DEVICE(0x24F3, 0x9130, iwl8260_2ac_cfg)},
472 {IWL_PCI_DEVICE(0x24F3, 0x8132, iwl8260_2ac_cfg)}, 474 {IWL_PCI_DEVICE(0x24F3, 0x8132, iwl8260_2ac_cfg)},
@@ -485,6 +487,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
485 {IWL_PCI_DEVICE(0x24F3, 0x0950, iwl8260_2ac_cfg)}, 487 {IWL_PCI_DEVICE(0x24F3, 0x0950, iwl8260_2ac_cfg)},
486 {IWL_PCI_DEVICE(0x24F3, 0x0930, iwl8260_2ac_cfg)}, 488 {IWL_PCI_DEVICE(0x24F3, 0x0930, iwl8260_2ac_cfg)},
487 {IWL_PCI_DEVICE(0x24F3, 0x0000, iwl8265_2ac_cfg)}, 489 {IWL_PCI_DEVICE(0x24F3, 0x0000, iwl8265_2ac_cfg)},
490 {IWL_PCI_DEVICE(0x24F3, 0x4010, iwl8260_2ac_cfg)},
488 {IWL_PCI_DEVICE(0x24FD, 0x0010, iwl8265_2ac_cfg)}, 491 {IWL_PCI_DEVICE(0x24FD, 0x0010, iwl8265_2ac_cfg)},
489 {IWL_PCI_DEVICE(0x24FD, 0x0110, iwl8265_2ac_cfg)}, 492 {IWL_PCI_DEVICE(0x24FD, 0x0110, iwl8265_2ac_cfg)},
490 {IWL_PCI_DEVICE(0x24FD, 0x1110, iwl8265_2ac_cfg)}, 493 {IWL_PCI_DEVICE(0x24FD, 0x1110, iwl8265_2ac_cfg)},
@@ -510,6 +513,8 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
510 {IWL_PCI_DEVICE(0x24FD, 0x3E01, iwl8275_2ac_cfg)}, 513 {IWL_PCI_DEVICE(0x24FD, 0x3E01, iwl8275_2ac_cfg)},
511 {IWL_PCI_DEVICE(0x24FD, 0x1012, iwl8275_2ac_cfg)}, 514 {IWL_PCI_DEVICE(0x24FD, 0x1012, iwl8275_2ac_cfg)},
512 {IWL_PCI_DEVICE(0x24FD, 0x0012, iwl8275_2ac_cfg)}, 515 {IWL_PCI_DEVICE(0x24FD, 0x0012, iwl8275_2ac_cfg)},
516 {IWL_PCI_DEVICE(0x24FD, 0x0014, iwl8265_2ac_cfg)},
517 {IWL_PCI_DEVICE(0x24FD, 0x9074, iwl8265_2ac_cfg)},
513 518
514/* 9000 Series */ 519/* 9000 Series */
515 {IWL_PCI_DEVICE(0x2526, 0x0000, iwl9260_2ac_cfg)}, 520 {IWL_PCI_DEVICE(0x2526, 0x0000, iwl9260_2ac_cfg)},
@@ -581,6 +586,11 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
581 {IWL_PCI_DEVICE(0x2720, 0x0070, iwla000_2ac_cfg_hr_cdb)}, 586 {IWL_PCI_DEVICE(0x2720, 0x0070, iwla000_2ac_cfg_hr_cdb)},
582 {IWL_PCI_DEVICE(0x2720, 0x0030, iwla000_2ac_cfg_hr_cdb)}, 587 {IWL_PCI_DEVICE(0x2720, 0x0030, iwla000_2ac_cfg_hr_cdb)},
583 {IWL_PCI_DEVICE(0x2720, 0x1080, iwla000_2ax_cfg_hr)}, 588 {IWL_PCI_DEVICE(0x2720, 0x1080, iwla000_2ax_cfg_hr)},
589 {IWL_PCI_DEVICE(0x2720, 0x0090, iwla000_2ac_cfg_hr_cdb)},
590 {IWL_PCI_DEVICE(0x2720, 0x0310, iwla000_2ac_cfg_hr_cdb)},
591 {IWL_PCI_DEVICE(0x40C0, 0x0000, iwla000_2ax_cfg_hr)},
592 {IWL_PCI_DEVICE(0x40C0, 0x0A10, iwla000_2ax_cfg_hr)},
593
584#endif /* CONFIG_IWLMVM */ 594#endif /* CONFIG_IWLMVM */
585 595
586 {0} 596 {0}
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 0008ea323be3..8d992d5ba064 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -88,7 +88,7 @@
88#define IWL_FW_MEM_EXTENDED_START 0x40000 88#define IWL_FW_MEM_EXTENDED_START 0x40000
89#define IWL_FW_MEM_EXTENDED_END 0x57FFF 89#define IWL_FW_MEM_EXTENDED_END 0x57FFF
90 90
91static void iwl_trans_pcie_err_dump(struct iwl_trans *trans) 91static void iwl_trans_pcie_dump_regs(struct iwl_trans *trans)
92{ 92{
93#define PCI_DUMP_SIZE 64 93#define PCI_DUMP_SIZE 64
94#define PREFIX_LEN 32 94#define PREFIX_LEN 32
@@ -736,7 +736,7 @@ static int iwl_pcie_load_firmware_chunk(struct iwl_trans *trans,
736 trans_pcie->ucode_write_complete, 5 * HZ); 736 trans_pcie->ucode_write_complete, 5 * HZ);
737 if (!ret) { 737 if (!ret) {
738 IWL_ERR(trans, "Failed to load firmware chunk!\n"); 738 IWL_ERR(trans, "Failed to load firmware chunk!\n");
739 iwl_trans_pcie_err_dump(trans); 739 iwl_trans_pcie_dump_regs(trans);
740 return -ETIMEDOUT; 740 return -ETIMEDOUT;
741 } 741 }
742 742
@@ -1956,7 +1956,7 @@ static bool iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans,
1956 (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | 1956 (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY |
1957 CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000); 1957 CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000);
1958 if (unlikely(ret < 0)) { 1958 if (unlikely(ret < 0)) {
1959 iwl_trans_pcie_err_dump(trans); 1959 iwl_trans_pcie_dump_regs(trans);
1960 iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_FORCE_NMI); 1960 iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_FORCE_NMI);
1961 WARN_ONCE(1, 1961 WARN_ONCE(1,
1962 "Timeout waiting for hardware access (CSR_GP_CNTRL 0x%08x)\n", 1962 "Timeout waiting for hardware access (CSR_GP_CNTRL 0x%08x)\n",
@@ -3021,6 +3021,7 @@ static void iwl_trans_pcie_resume(struct iwl_trans *trans)
3021 .ref = iwl_trans_pcie_ref, \ 3021 .ref = iwl_trans_pcie_ref, \
3022 .unref = iwl_trans_pcie_unref, \ 3022 .unref = iwl_trans_pcie_unref, \
3023 .dump_data = iwl_trans_pcie_dump_data, \ 3023 .dump_data = iwl_trans_pcie_dump_data, \
3024 .dump_regs = iwl_trans_pcie_dump_regs, \
3024 .d3_suspend = iwl_trans_pcie_d3_suspend, \ 3025 .d3_suspend = iwl_trans_pcie_d3_suspend, \
3025 .d3_resume = iwl_trans_pcie_d3_resume 3026 .d3_resume = iwl_trans_pcie_d3_resume
3026 3027
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
index e93c471ef9bf..b5c459cd70ce 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
@@ -1909,6 +1909,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
1909 } 1909 }
1910 1910
1911 if (test_bit(STATUS_FW_ERROR, &trans->status)) { 1911 if (test_bit(STATUS_FW_ERROR, &trans->status)) {
1912 iwl_trans_dump_regs(trans);
1912 IWL_ERR(trans, "FW error in SYNC CMD %s\n", 1913 IWL_ERR(trans, "FW error in SYNC CMD %s\n",
1913 iwl_get_cmd_string(trans, cmd->id)); 1914 iwl_get_cmd_string(trans, cmd->id));
1914 dump_stack(); 1915 dump_stack();