aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlegacy/iwl-4965.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlegacy/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965.c680
1 files changed, 340 insertions, 340 deletions
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index 0f2bc5f767d..d3c818354ca 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -48,8 +48,8 @@
48#include "iwl-4965.h" 48#include "iwl-4965.h"
49#include "iwl-4965-debugfs.h" 49#include "iwl-4965-debugfs.h"
50 50
51static int il4965_send_tx_power(struct il_priv *priv); 51static int il4965_send_tx_power(struct il_priv *il);
52static int il4965_hw_get_temperature(struct il_priv *priv); 52static int il4965_hw_get_temperature(struct il_priv *il);
53 53
54/* Highest firmware API version supported */ 54/* Highest firmware API version supported */
55#define IWL4965_UCODE_API_MAX 2 55#define IWL4965_UCODE_API_MAX 2
@@ -62,23 +62,23 @@ static int il4965_hw_get_temperature(struct il_priv *priv);
62#define IWL4965_MODULE_FIRMWARE(api) _IWL4965_MODULE_FIRMWARE(api) 62#define IWL4965_MODULE_FIRMWARE(api) _IWL4965_MODULE_FIRMWARE(api)
63 63
64/* check contents of special bootstrap uCode SRAM */ 64/* check contents of special bootstrap uCode SRAM */
65static int il4965_verify_bsm(struct il_priv *priv) 65static int il4965_verify_bsm(struct il_priv *il)
66{ 66{
67 __le32 *image = priv->ucode_boot.v_addr; 67 __le32 *image = il->ucode_boot.v_addr;
68 u32 len = priv->ucode_boot.len; 68 u32 len = il->ucode_boot.len;
69 u32 reg; 69 u32 reg;
70 u32 val; 70 u32 val;
71 71
72 IL_DEBUG_INFO(priv, "Begin verify bsm\n"); 72 IL_DEBUG_INFO(il, "Begin verify bsm\n");
73 73
74 /* verify BSM SRAM contents */ 74 /* verify BSM SRAM contents */
75 val = il_read_prph(priv, BSM_WR_DWCOUNT_REG); 75 val = il_read_prph(il, BSM_WR_DWCOUNT_REG);
76 for (reg = BSM_SRAM_LOWER_BOUND; 76 for (reg = BSM_SRAM_LOWER_BOUND;
77 reg < BSM_SRAM_LOWER_BOUND + len; 77 reg < BSM_SRAM_LOWER_BOUND + len;
78 reg += sizeof(u32), image++) { 78 reg += sizeof(u32), image++) {
79 val = il_read_prph(priv, reg); 79 val = il_read_prph(il, reg);
80 if (val != le32_to_cpu(*image)) { 80 if (val != le32_to_cpu(*image)) {
81 IL_ERR(priv, "BSM uCode verification failed at " 81 IL_ERR(il, "BSM uCode verification failed at "
82 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", 82 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
83 BSM_SRAM_LOWER_BOUND, 83 BSM_SRAM_LOWER_BOUND,
84 reg - BSM_SRAM_LOWER_BOUND, len, 84 reg - BSM_SRAM_LOWER_BOUND, len,
@@ -87,7 +87,7 @@ static int il4965_verify_bsm(struct il_priv *priv)
87 } 87 }
88 } 88 }
89 89
90 IL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n"); 90 IL_DEBUG_INFO(il, "BSM bootstrap uCode image OK\n");
91 91
92 return 0; 92 return 0;
93} 93}
@@ -124,10 +124,10 @@ static int il4965_verify_bsm(struct il_priv *priv)
124 * the runtime uCode instructions and the backup data cache into SRAM, 124 * the runtime uCode instructions and the backup data cache into SRAM,
125 * and re-launches the runtime uCode from where it left off. 125 * and re-launches the runtime uCode from where it left off.
126 */ 126 */
127static int il4965_load_bsm(struct il_priv *priv) 127static int il4965_load_bsm(struct il_priv *il)
128{ 128{
129 __le32 *image = priv->ucode_boot.v_addr; 129 __le32 *image = il->ucode_boot.v_addr;
130 u32 len = priv->ucode_boot.len; 130 u32 len = il->ucode_boot.len;
131 dma_addr_t pinst; 131 dma_addr_t pinst;
132 dma_addr_t pdata; 132 dma_addr_t pdata;
133 u32 inst_len; 133 u32 inst_len;
@@ -137,9 +137,9 @@ static int il4965_load_bsm(struct il_priv *priv)
137 u32 reg_offset; 137 u32 reg_offset;
138 int ret; 138 int ret;
139 139
140 IL_DEBUG_INFO(priv, "Begin load bsm\n"); 140 IL_DEBUG_INFO(il, "Begin load bsm\n");
141 141
142 priv->ucode_type = UCODE_RT; 142 il->ucode_type = UCODE_RT;
143 143
144 /* make sure bootstrap program is no larger than BSM's SRAM size */ 144 /* make sure bootstrap program is no larger than BSM's SRAM size */
145 if (len > IWL49_MAX_BSM_SIZE) 145 if (len > IWL49_MAX_BSM_SIZE)
@@ -151,53 +151,53 @@ static int il4965_load_bsm(struct il_priv *priv)
151 * after the "initialize" uCode has run, to point to 151 * after the "initialize" uCode has run, to point to
152 * runtime/protocol instructions and backup data cache. 152 * runtime/protocol instructions and backup data cache.
153 */ 153 */
154 pinst = priv->ucode_init.p_addr >> 4; 154 pinst = il->ucode_init.p_addr >> 4;
155 pdata = priv->ucode_init_data.p_addr >> 4; 155 pdata = il->ucode_init_data.p_addr >> 4;
156 inst_len = priv->ucode_init.len; 156 inst_len = il->ucode_init.len;
157 data_len = priv->ucode_init_data.len; 157 data_len = il->ucode_init_data.len;
158 158
159 il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 159 il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst);
160 il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 160 il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata);
161 il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); 161 il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
162 il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); 162 il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);
163 163
164 /* Fill BSM memory with bootstrap instructions */ 164 /* Fill BSM memory with bootstrap instructions */
165 for (reg_offset = BSM_SRAM_LOWER_BOUND; 165 for (reg_offset = BSM_SRAM_LOWER_BOUND;
166 reg_offset < BSM_SRAM_LOWER_BOUND + len; 166 reg_offset < BSM_SRAM_LOWER_BOUND + len;
167 reg_offset += sizeof(u32), image++) 167 reg_offset += sizeof(u32), image++)
168 _il_write_prph(priv, reg_offset, le32_to_cpu(*image)); 168 _il_write_prph(il, reg_offset, le32_to_cpu(*image));
169 169
170 ret = il4965_verify_bsm(priv); 170 ret = il4965_verify_bsm(il);
171 if (ret) 171 if (ret)
172 return ret; 172 return ret;
173 173
174 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ 174 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
175 il_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); 175 il_write_prph(il, BSM_WR_MEM_SRC_REG, 0x0);
176 il_write_prph(priv, 176 il_write_prph(il,
177 BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND); 177 BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND);
178 il_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); 178 il_write_prph(il, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
179 179
180 /* Load bootstrap code into instruction SRAM now, 180 /* Load bootstrap code into instruction SRAM now,
181 * to prepare to load "initialize" uCode */ 181 * to prepare to load "initialize" uCode */
182 il_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); 182 il_write_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START);
183 183
184 /* Wait for load of bootstrap uCode to finish */ 184 /* Wait for load of bootstrap uCode to finish */
185 for (i = 0; i < 100; i++) { 185 for (i = 0; i < 100; i++) {
186 done = il_read_prph(priv, BSM_WR_CTRL_REG); 186 done = il_read_prph(il, BSM_WR_CTRL_REG);
187 if (!(done & BSM_WR_CTRL_REG_BIT_START)) 187 if (!(done & BSM_WR_CTRL_REG_BIT_START))
188 break; 188 break;
189 udelay(10); 189 udelay(10);
190 } 190 }
191 if (i < 100) 191 if (i < 100)
192 IL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i); 192 IL_DEBUG_INFO(il, "BSM write complete, poll %d iterations\n", i);
193 else { 193 else {
194 IL_ERR(priv, "BSM write did not complete!\n"); 194 IL_ERR(il, "BSM write did not complete!\n");
195 return -EIO; 195 return -EIO;
196 } 196 }
197 197
198 /* Enable future boot loads whenever power management unit triggers it 198 /* Enable future boot loads whenever power management unit triggers it
199 * (e.g. when powering back up after power-save shutdown) */ 199 * (e.g. when powering back up after power-save shutdown) */
200 il_write_prph(priv, 200 il_write_prph(il,
201 BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); 201 BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN);
202 202
203 203
@@ -213,27 +213,27 @@ static int il4965_load_bsm(struct il_priv *priv)
213 * We need to replace them to load runtime uCode inst and data, 213 * We need to replace them to load runtime uCode inst and data,
214 * and to save runtime data when powering down. 214 * and to save runtime data when powering down.
215 */ 215 */
216static int il4965_set_ucode_ptrs(struct il_priv *priv) 216static int il4965_set_ucode_ptrs(struct il_priv *il)
217{ 217{
218 dma_addr_t pinst; 218 dma_addr_t pinst;
219 dma_addr_t pdata; 219 dma_addr_t pdata;
220 int ret = 0; 220 int ret = 0;
221 221
222 /* bits 35:4 for 4965 */ 222 /* bits 35:4 for 4965 */
223 pinst = priv->ucode_code.p_addr >> 4; 223 pinst = il->ucode_code.p_addr >> 4;
224 pdata = priv->ucode_data_backup.p_addr >> 4; 224 pdata = il->ucode_data_backup.p_addr >> 4;
225 225
226 /* Tell bootstrap uCode where to find image to load */ 226 /* Tell bootstrap uCode where to find image to load */
227 il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 227 il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst);
228 il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 228 il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata);
229 il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, 229 il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG,
230 priv->ucode_data.len); 230 il->ucode_data.len);
231 231
232 /* Inst byte count must be last to set up, bit 31 signals uCode 232 /* Inst byte count must be last to set up, bit 31 signals uCode
233 * that all new ptr/size info is in place */ 233 * that all new ptr/size info is in place */
234 il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, 234 il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG,
235 priv->ucode_code.len | BSM_DRAM_INST_LOAD); 235 il->ucode_code.len | BSM_DRAM_INST_LOAD);
236 IL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); 236 IL_DEBUG_INFO(il, "Runtime uCode pointers are set.\n");
237 237
238 return ret; 238 return ret;
239} 239}
@@ -244,40 +244,40 @@ static int il4965_set_ucode_ptrs(struct il_priv *priv)
244 * Called after REPLY_ALIVE notification received from "initialize" uCode. 244 * Called after REPLY_ALIVE notification received from "initialize" uCode.
245 * 245 *
246 * The 4965 "initialize" ALIVE reply contains calibration data for: 246 * The 4965 "initialize" ALIVE reply contains calibration data for:
247 * Voltage, temperature, and MIMO tx gain correction, now stored in priv 247 * Voltage, temperature, and MIMO tx gain correction, now stored in il
248 * (3945 does not contain this data). 248 * (3945 does not contain this data).
249 * 249 *
250 * Tell "initialize" uCode to go ahead and load the runtime uCode. 250 * Tell "initialize" uCode to go ahead and load the runtime uCode.
251*/ 251*/
252static void il4965_init_alive_start(struct il_priv *priv) 252static void il4965_init_alive_start(struct il_priv *il)
253{ 253{
254 /* Bootstrap uCode has loaded initialize uCode ... verify inst image. 254 /* Bootstrap uCode has loaded initialize uCode ... verify inst image.
255 * This is a paranoid check, because we would not have gotten the 255 * This is a paranoid check, because we would not have gotten the
256 * "initialize" alive if code weren't properly loaded. */ 256 * "initialize" alive if code weren't properly loaded. */
257 if (il4965_verify_ucode(priv)) { 257 if (il4965_verify_ucode(il)) {
258 /* Runtime instruction load was bad; 258 /* Runtime instruction load was bad;
259 * take it all the way back down so we can try again */ 259 * take it all the way back down so we can try again */
260 IL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); 260 IL_DEBUG_INFO(il, "Bad \"initialize\" uCode load.\n");
261 goto restart; 261 goto restart;
262 } 262 }
263 263
264 /* Calculate temperature */ 264 /* Calculate temperature */
265 priv->temperature = il4965_hw_get_temperature(priv); 265 il->temperature = il4965_hw_get_temperature(il);
266 266
267 /* Send pointers to protocol/runtime uCode image ... init code will 267 /* Send pointers to protocol/runtime uCode image ... init code will
268 * load and launch runtime uCode, which will send us another "Alive" 268 * load and launch runtime uCode, which will send us another "Alive"
269 * notification. */ 269 * notification. */
270 IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); 270 IL_DEBUG_INFO(il, "Initialization Alive received.\n");
271 if (il4965_set_ucode_ptrs(priv)) { 271 if (il4965_set_ucode_ptrs(il)) {
272 /* Runtime instruction load won't happen; 272 /* Runtime instruction load won't happen;
273 * take it all the way back down so we can try again */ 273 * take it all the way back down so we can try again */
274 IL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); 274 IL_DEBUG_INFO(il, "Couldn't set up uCode pointers.\n");
275 goto restart; 275 goto restart;
276 } 276 }
277 return; 277 return;
278 278
279restart: 279restart:
280 queue_work(priv->workqueue, &priv->restart); 280 queue_work(il->workqueue, &il->restart);
281} 281}
282 282
283static bool iw4965_is_ht40_channel(__le32 rxon_flags) 283static bool iw4965_is_ht40_channel(__le32 rxon_flags)
@@ -288,43 +288,43 @@ static bool iw4965_is_ht40_channel(__le32 rxon_flags)
288 (chan_mod == CHANNEL_MODE_MIXED)); 288 (chan_mod == CHANNEL_MODE_MIXED));
289} 289}
290 290
291static void il4965_nic_config(struct il_priv *priv) 291static void il4965_nic_config(struct il_priv *il)
292{ 292{
293 unsigned long flags; 293 unsigned long flags;
294 u16 radio_cfg; 294 u16 radio_cfg;
295 295
296 spin_lock_irqsave(&priv->lock, flags); 296 spin_lock_irqsave(&il->lock, flags);
297 297
298 radio_cfg = il_eeprom_query16(priv, EEPROM_RADIO_CONFIG); 298 radio_cfg = il_eeprom_query16(il, EEPROM_RADIO_CONFIG);
299 299
300 /* write radio config values to register */ 300 /* write radio config values to register */
301 if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) == EEPROM_4965_RF_CFG_TYPE_MAX) 301 if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) == EEPROM_4965_RF_CFG_TYPE_MAX)
302 il_set_bit(priv, CSR_HW_IF_CONFIG_REG, 302 il_set_bit(il, CSR_HW_IF_CONFIG_REG,
303 EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | 303 EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
304 EEPROM_RF_CFG_STEP_MSK(radio_cfg) | 304 EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
305 EEPROM_RF_CFG_DASH_MSK(radio_cfg)); 305 EEPROM_RF_CFG_DASH_MSK(radio_cfg));
306 306
307 /* set CSR_HW_CONFIG_REG for uCode use */ 307 /* set CSR_HW_CONFIG_REG for uCode use */
308 il_set_bit(priv, CSR_HW_IF_CONFIG_REG, 308 il_set_bit(il, CSR_HW_IF_CONFIG_REG,
309 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | 309 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
310 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); 310 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
311 311
312 priv->calib_info = (struct il_eeprom_calib_info *) 312 il->calib_info = (struct il_eeprom_calib_info *)
313 il_eeprom_query_addr(priv, 313 il_eeprom_query_addr(il,
314 EEPROM_4965_CALIB_TXPOWER_OFFSET); 314 EEPROM_4965_CALIB_TXPOWER_OFFSET);
315 315
316 spin_unlock_irqrestore(&priv->lock, flags); 316 spin_unlock_irqrestore(&il->lock, flags);
317} 317}
318 318
319/* Reset differential Rx gains in NIC to prepare for chain noise calibration. 319/* Reset differential Rx gains in NIC to prepare for chain noise calibration.
320 * Called after every association, but this runs only once! 320 * Called after every association, but this runs only once!
321 * ... once chain noise is calibrated the first time, it's good forever. */ 321 * ... once chain noise is calibrated the first time, it's good forever. */
322static void il4965_chain_noise_reset(struct il_priv *priv) 322static void il4965_chain_noise_reset(struct il_priv *il)
323{ 323{
324 struct il_chain_noise_data *data = &(priv->chain_noise_data); 324 struct il_chain_noise_data *data = &(il->chain_noise_data);
325 325
326 if ((data->state == IL_CHAIN_NOISE_ALIVE) && 326 if ((data->state == IL_CHAIN_NOISE_ALIVE) &&
327 il_is_any_associated(priv)) { 327 il_is_any_associated(il)) {
328 struct il_calib_diff_gain_cmd cmd; 328 struct il_calib_diff_gain_cmd cmd;
329 329
330 /* clear data for chain noise calibration algorithm */ 330 /* clear data for chain noise calibration algorithm */
@@ -341,12 +341,12 @@ static void il4965_chain_noise_reset(struct il_priv *priv)
341 cmd.diff_gain_a = 0; 341 cmd.diff_gain_a = 0;
342 cmd.diff_gain_b = 0; 342 cmd.diff_gain_b = 0;
343 cmd.diff_gain_c = 0; 343 cmd.diff_gain_c = 0;
344 if (il_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, 344 if (il_send_cmd_pdu(il, REPLY_PHY_CALIBRATION_CMD,
345 sizeof(cmd), &cmd)) 345 sizeof(cmd), &cmd))
346 IL_ERR(priv, 346 IL_ERR(il,
347 "Could not send REPLY_PHY_CALIBRATION_CMD\n"); 347 "Could not send REPLY_PHY_CALIBRATION_CMD\n");
348 data->state = IL_CHAIN_NOISE_ACCUMULATE; 348 data->state = IL_CHAIN_NOISE_ACCUMULATE;
349 IL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n"); 349 IL_DEBUG_CALIB(il, "Run chain_noise_calibrate\n");
350 } 350 }
351} 351}
352 352
@@ -377,10 +377,10 @@ static struct il_sensitivity_ranges il4965_sensitivity = {
377 .nrg_th_cca = 62, 377 .nrg_th_cca = 62,
378}; 378};
379 379
380static void il4965_set_ct_threshold(struct il_priv *priv) 380static void il4965_set_ct_threshold(struct il_priv *il)
381{ 381{
382 /* want Kelvin */ 382 /* want Kelvin */
383 priv->hw_params.ct_kill_threshold = 383 il->hw_params.ct_kill_threshold =
384 CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY); 384 CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY);
385} 385}
386 386
@@ -389,37 +389,37 @@ static void il4965_set_ct_threshold(struct il_priv *priv)
389 * 389 *
390 * Called when initializing driver 390 * Called when initializing driver
391 */ 391 */
392static int il4965_hw_set_hw_params(struct il_priv *priv) 392static int il4965_hw_set_hw_params(struct il_priv *il)
393{ 393{
394 if (priv->cfg->mod_params->num_of_queues >= IL_MIN_NUM_QUEUES && 394 if (il->cfg->mod_params->num_of_queues >= IL_MIN_NUM_QUEUES &&
395 priv->cfg->mod_params->num_of_queues <= IWL49_NUM_QUEUES) 395 il->cfg->mod_params->num_of_queues <= IWL49_NUM_QUEUES)
396 priv->cfg->base_params->num_of_queues = 396 il->cfg->base_params->num_of_queues =
397 priv->cfg->mod_params->num_of_queues; 397 il->cfg->mod_params->num_of_queues;
398 398
399 priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; 399 il->hw_params.max_txq_num = il->cfg->base_params->num_of_queues;
400 priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM; 400 il->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM;
401 priv->hw_params.scd_bc_tbls_size = 401 il->hw_params.scd_bc_tbls_size =
402 priv->cfg->base_params->num_of_queues * 402 il->cfg->base_params->num_of_queues *
403 sizeof(struct il4965_scd_bc_tbl); 403 sizeof(struct il4965_scd_bc_tbl);
404 priv->hw_params.tfd_size = sizeof(struct il_tfd); 404 il->hw_params.tfd_size = sizeof(struct il_tfd);
405 priv->hw_params.max_stations = IWL4965_STATION_COUNT; 405 il->hw_params.max_stations = IWL4965_STATION_COUNT;
406 priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID; 406 il->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID;
407 priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; 407 il->hw_params.max_data_size = IWL49_RTC_DATA_SIZE;
408 priv->hw_params.max_inst_size = IWL49_RTC_INST_SIZE; 408 il->hw_params.max_inst_size = IWL49_RTC_INST_SIZE;
409 priv->hw_params.max_bsm_size = BSM_SRAM_SIZE; 409 il->hw_params.max_bsm_size = BSM_SRAM_SIZE;
410 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_5GHZ); 410 il->hw_params.ht40_channel = BIT(IEEE80211_BAND_5GHZ);
411 411
412 priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR; 412 il->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
413 413
414 priv->hw_params.tx_chains_num = il4965_num_of_ant(priv->cfg->valid_tx_ant); 414 il->hw_params.tx_chains_num = il4965_num_of_ant(il->cfg->valid_tx_ant);
415 priv->hw_params.rx_chains_num = il4965_num_of_ant(priv->cfg->valid_rx_ant); 415 il->hw_params.rx_chains_num = il4965_num_of_ant(il->cfg->valid_rx_ant);
416 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; 416 il->hw_params.valid_tx_ant = il->cfg->valid_tx_ant;
417 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; 417 il->hw_params.valid_rx_ant = il->cfg->valid_rx_ant;
418 418
419 il4965_set_ct_threshold(priv); 419 il4965_set_ct_threshold(il);
420 420
421 priv->hw_params.sens = &il4965_sensitivity; 421 il->hw_params.sens = &il4965_sensitivity;
422 priv->hw_params.beacon_time_tsf_bits = IWL4965_EXT_BEACON_TIME_POS; 422 il->hw_params.beacon_time_tsf_bits = IWL4965_EXT_BEACON_TIME_POS;
423 423
424 return 0; 424 return 0;
425} 425}
@@ -498,16 +498,16 @@ static s32 il4965_get_tx_atten_grp(u16 channel)
498 return -EINVAL; 498 return -EINVAL;
499} 499}
500 500
501static u32 il4965_get_sub_band(const struct il_priv *priv, u32 channel) 501static u32 il4965_get_sub_band(const struct il_priv *il, u32 channel)
502{ 502{
503 s32 b = -1; 503 s32 b = -1;
504 504
505 for (b = 0; b < EEPROM_TX_POWER_BANDS; b++) { 505 for (b = 0; b < EEPROM_TX_POWER_BANDS; b++) {
506 if (priv->calib_info->band_info[b].ch_from == 0) 506 if (il->calib_info->band_info[b].ch_from == 0)
507 continue; 507 continue;
508 508
509 if ((channel >= priv->calib_info->band_info[b].ch_from) 509 if ((channel >= il->calib_info->band_info[b].ch_from)
510 && (channel <= priv->calib_info->band_info[b].ch_to)) 510 && (channel <= il->calib_info->band_info[b].ch_to))
511 break; 511 break;
512 } 512 }
513 513
@@ -534,7 +534,7 @@ static s32 il4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2)
534 * differences in channel frequencies, which is proportional to differences 534 * differences in channel frequencies, which is proportional to differences
535 * in channel number. 535 * in channel number.
536 */ 536 */
537static int il4965_interpolate_chan(struct il_priv *priv, u32 channel, 537static int il4965_interpolate_chan(struct il_priv *il, u32 channel,
538 struct il_eeprom_calib_ch_info *chan_info) 538 struct il_eeprom_calib_ch_info *chan_info)
539{ 539{
540 s32 s = -1; 540 s32 s = -1;
@@ -546,24 +546,24 @@ static int il4965_interpolate_chan(struct il_priv *priv, u32 channel,
546 u32 ch_i1; 546 u32 ch_i1;
547 u32 ch_i2; 547 u32 ch_i2;
548 548
549 s = il4965_get_sub_band(priv, channel); 549 s = il4965_get_sub_band(il, channel);
550 if (s >= EEPROM_TX_POWER_BANDS) { 550 if (s >= EEPROM_TX_POWER_BANDS) {
551 IL_ERR(priv, "Tx Power can not find channel %d\n", channel); 551 IL_ERR(il, "Tx Power can not find channel %d\n", channel);
552 return -1; 552 return -1;
553 } 553 }
554 554
555 ch_i1 = priv->calib_info->band_info[s].ch1.ch_num; 555 ch_i1 = il->calib_info->band_info[s].ch1.ch_num;
556 ch_i2 = priv->calib_info->band_info[s].ch2.ch_num; 556 ch_i2 = il->calib_info->band_info[s].ch2.ch_num;
557 chan_info->ch_num = (u8) channel; 557 chan_info->ch_num = (u8) channel;
558 558
559 IL_DEBUG_TXPOWER(priv, "channel %d subband %d factory cal ch %d & %d\n", 559 IL_DEBUG_TXPOWER(il, "channel %d subband %d factory cal ch %d & %d\n",
560 channel, s, ch_i1, ch_i2); 560 channel, s, ch_i1, ch_i2);
561 561
562 for (c = 0; c < EEPROM_TX_POWER_TX_CHAINS; c++) { 562 for (c = 0; c < EEPROM_TX_POWER_TX_CHAINS; c++) {
563 for (m = 0; m < EEPROM_TX_POWER_MEASUREMENTS; m++) { 563 for (m = 0; m < EEPROM_TX_POWER_MEASUREMENTS; m++) {
564 m1 = &(priv->calib_info->band_info[s].ch1. 564 m1 = &(il->calib_info->band_info[s].ch1.
565 measurements[c][m]); 565 measurements[c][m]);
566 m2 = &(priv->calib_info->band_info[s].ch2. 566 m2 = &(il->calib_info->band_info[s].ch2.
567 measurements[c][m]); 567 measurements[c][m]);
568 omeas = &(chan_info->measurements[c][m]); 568 omeas = &(chan_info->measurements[c][m]);
569 569
@@ -586,16 +586,16 @@ static int il4965_interpolate_chan(struct il_priv *priv, u32 channel,
586 m1->pa_det, ch_i2, 586 m1->pa_det, ch_i2,
587 m2->pa_det); 587 m2->pa_det);
588 588
589 IL_DEBUG_TXPOWER(priv, 589 IL_DEBUG_TXPOWER(il,
590 "chain %d meas %d AP1=%d AP2=%d AP=%d\n", c, m, 590 "chain %d meas %d AP1=%d AP2=%d AP=%d\n", c, m,
591 m1->actual_pow, m2->actual_pow, omeas->actual_pow); 591 m1->actual_pow, m2->actual_pow, omeas->actual_pow);
592 IL_DEBUG_TXPOWER(priv, 592 IL_DEBUG_TXPOWER(il,
593 "chain %d meas %d NI1=%d NI2=%d NI=%d\n", c, m, 593 "chain %d meas %d NI1=%d NI2=%d NI=%d\n", c, m,
594 m1->gain_idx, m2->gain_idx, omeas->gain_idx); 594 m1->gain_idx, m2->gain_idx, omeas->gain_idx);
595 IL_DEBUG_TXPOWER(priv, 595 IL_DEBUG_TXPOWER(il,
596 "chain %d meas %d PA1=%d PA2=%d PA=%d\n", c, m, 596 "chain %d meas %d PA1=%d PA2=%d PA=%d\n", c, m,
597 m1->pa_det, m2->pa_det, omeas->pa_det); 597 m1->pa_det, m2->pa_det, omeas->pa_det);
598 IL_DEBUG_TXPOWER(priv, 598 IL_DEBUG_TXPOWER(il,
599 "chain %d meas %d T1=%d T2=%d T=%d\n", c, m, 599 "chain %d meas %d T1=%d T2=%d T=%d\n", c, m,
600 m1->temperature, m2->temperature, 600 m1->temperature, m2->temperature,
601 omeas->temperature); 601 omeas->temperature);
@@ -867,7 +867,7 @@ static const struct gain_entry gain_table[2][108] = {
867 } 867 }
868}; 868};
869 869
870static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, 870static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
871 u8 is_ht40, u8 ctrl_chan_high, 871 u8 is_ht40, u8 ctrl_chan_high,
872 struct il4965_tx_power_db *tx_power_tbl) 872 struct il4965_tx_power_db *tx_power_tbl)
873{ 873{
@@ -897,13 +897,13 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
897 897
898 /* tx_power_user_lmt is in dBm, convert to half-dBm (half-dB units 898 /* tx_power_user_lmt is in dBm, convert to half-dBm (half-dB units
899 * are used for indexing into txpower table) */ 899 * are used for indexing into txpower table) */
900 user_target_power = 2 * priv->tx_power_user_lmt; 900 user_target_power = 2 * il->tx_power_user_lmt;
901 901
902 /* Get current (RXON) channel, band, width */ 902 /* Get current (RXON) channel, band, width */
903 IL_DEBUG_TXPOWER(priv, "chan %d band %d is_ht40 %d\n", channel, band, 903 IL_DEBUG_TXPOWER(il, "chan %d band %d is_ht40 %d\n", channel, band,
904 is_ht40); 904 is_ht40);
905 905
906 ch_info = il_get_channel_info(priv, priv->band, channel); 906 ch_info = il_get_channel_info(il, il->band, channel);
907 907
908 if (!il_is_channel_valid(ch_info)) 908 if (!il_is_channel_valid(ch_info))
909 return -EINVAL; 909 return -EINVAL;
@@ -912,12 +912,12 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
912 * and 2) mimo txpower balance between Tx chains. */ 912 * and 2) mimo txpower balance between Tx chains. */
913 txatten_grp = il4965_get_tx_atten_grp(channel); 913 txatten_grp = il4965_get_tx_atten_grp(channel);
914 if (txatten_grp < 0) { 914 if (txatten_grp < 0) {
915 IL_ERR(priv, "Can't find txatten group for channel %d.\n", 915 IL_ERR(il, "Can't find txatten group for channel %d.\n",
916 channel); 916 channel);
917 return txatten_grp; 917 return txatten_grp;
918 } 918 }
919 919
920 IL_DEBUG_TXPOWER(priv, "channel %d belongs to txatten group %d\n", 920 IL_DEBUG_TXPOWER(il, "channel %d belongs to txatten group %d\n",
921 channel, txatten_grp); 921 channel, txatten_grp);
922 922
923 if (is_ht40) { 923 if (is_ht40) {
@@ -930,9 +930,9 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
930 /* hardware txpower limits ... 930 /* hardware txpower limits ...
931 * saturation (clipping distortion) txpowers are in half-dBm */ 931 * saturation (clipping distortion) txpowers are in half-dBm */
932 if (band) 932 if (band)
933 saturation_power = priv->calib_info->saturation_power24; 933 saturation_power = il->calib_info->saturation_power24;
934 else 934 else
935 saturation_power = priv->calib_info->saturation_power52; 935 saturation_power = il->calib_info->saturation_power52;
936 936
937 if (saturation_power < IL_TX_POWER_SATURATION_MIN || 937 if (saturation_power < IL_TX_POWER_SATURATION_MIN ||
938 saturation_power > IL_TX_POWER_SATURATION_MAX) { 938 saturation_power > IL_TX_POWER_SATURATION_MAX) {
@@ -959,21 +959,21 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
959 959
960 /* Interpolate txpower calibration values for this channel, 960 /* Interpolate txpower calibration values for this channel,
961 * based on factory calibration tests on spaced channels. */ 961 * based on factory calibration tests on spaced channels. */
962 il4965_interpolate_chan(priv, channel, &ch_eeprom_info); 962 il4965_interpolate_chan(il, channel, &ch_eeprom_info);
963 963
964 /* calculate tx gain adjustment based on power supply voltage */ 964 /* calculate tx gain adjustment based on power supply voltage */
965 voltage = le16_to_cpu(priv->calib_info->voltage); 965 voltage = le16_to_cpu(il->calib_info->voltage);
966 init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); 966 init_voltage = (s32)le32_to_cpu(il->card_alive_init.voltage);
967 voltage_compensation = 967 voltage_compensation =
968 il4965_get_voltage_compensation(voltage, init_voltage); 968 il4965_get_voltage_compensation(voltage, init_voltage);
969 969
970 IL_DEBUG_TXPOWER(priv, "curr volt %d eeprom volt %d volt comp %d\n", 970 IL_DEBUG_TXPOWER(il, "curr volt %d eeprom volt %d volt comp %d\n",
971 init_voltage, 971 init_voltage,
972 voltage, voltage_compensation); 972 voltage, voltage_compensation);
973 973
974 /* get current temperature (Celsius) */ 974 /* get current temperature (Celsius) */
975 current_temp = max(priv->temperature, IL_TX_POWER_TEMPERATURE_MIN); 975 current_temp = max(il->temperature, IL_TX_POWER_TEMPERATURE_MIN);
976 current_temp = min(priv->temperature, IL_TX_POWER_TEMPERATURE_MAX); 976 current_temp = min(il->temperature, IL_TX_POWER_TEMPERATURE_MAX);
977 current_temp = KELVIN_TO_CELSIUS(current_temp); 977 current_temp = KELVIN_TO_CELSIUS(current_temp);
978 978
979 /* select thermal txpower adjustment params, based on channel group 979 /* select thermal txpower adjustment params, based on channel group
@@ -998,13 +998,13 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
998 factory_gain_index[c] = measurement->gain_idx; 998 factory_gain_index[c] = measurement->gain_idx;
999 factory_actual_pwr[c] = measurement->actual_pow; 999 factory_actual_pwr[c] = measurement->actual_pow;
1000 1000
1001 IL_DEBUG_TXPOWER(priv, "chain = %d\n", c); 1001 IL_DEBUG_TXPOWER(il, "chain = %d\n", c);
1002 IL_DEBUG_TXPOWER(priv, "fctry tmp %d, " 1002 IL_DEBUG_TXPOWER(il, "fctry tmp %d, "
1003 "curr tmp %d, comp %d steps\n", 1003 "curr tmp %d, comp %d steps\n",
1004 factory_temp, current_temp, 1004 factory_temp, current_temp,
1005 temperature_comp[c]); 1005 temperature_comp[c]);
1006 1006
1007 IL_DEBUG_TXPOWER(priv, "fctry idx %d, fctry pwr %d\n", 1007 IL_DEBUG_TXPOWER(il, "fctry idx %d, fctry pwr %d\n",
1008 factory_gain_index[c], 1008 factory_gain_index[c],
1009 factory_actual_pwr[c]); 1009 factory_actual_pwr[c]);
1010 } 1010 }
@@ -1037,7 +1037,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
1037 if (target_power > power_limit) 1037 if (target_power > power_limit)
1038 target_power = power_limit; 1038 target_power = power_limit;
1039 1039
1040 IL_DEBUG_TXPOWER(priv, "rate %d sat %d reg %d usr %d tgt %d\n", 1040 IL_DEBUG_TXPOWER(il, "rate %d sat %d reg %d usr %d tgt %d\n",
1041 i, saturation_power - back_off_table[i], 1041 i, saturation_power - back_off_table[i],
1042 current_regulatory, user_target_power, 1042 current_regulatory, user_target_power,
1043 target_power); 1043 target_power);
@@ -1048,7 +1048,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
1048 1048
1049 if (is_mimo_rate) 1049 if (is_mimo_rate)
1050 atten_value = 1050 atten_value =
1051 (s32)le32_to_cpu(priv->card_alive_init. 1051 (s32)le32_to_cpu(il->card_alive_init.
1052 tx_atten[txatten_grp][c]); 1052 tx_atten[txatten_grp][c]);
1053 else 1053 else
1054 atten_value = 0; 1054 atten_value = 0;
@@ -1061,7 +1061,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
1061 voltage_compensation + 1061 voltage_compensation +
1062 atten_value); 1062 atten_value);
1063 1063
1064/* IL_DEBUG_TXPOWER(priv, "calculated txpower index %d\n", 1064/* IL_DEBUG_TXPOWER(il, "calculated txpower index %d\n",
1065 power_index); */ 1065 power_index); */
1066 1066
1067 if (power_index < get_min_power_index(i, band)) 1067 if (power_index < get_min_power_index(i, band))
@@ -1078,12 +1078,12 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
1078 1078
1079 /* stay within the table! */ 1079 /* stay within the table! */
1080 if (power_index > 107) { 1080 if (power_index > 107) {
1081 IL_WARN(priv, "txpower index %d > 107\n", 1081 IL_WARN(il, "txpower index %d > 107\n",
1082 power_index); 1082 power_index);
1083 power_index = 107; 1083 power_index = 107;
1084 } 1084 }
1085 if (power_index < 0) { 1085 if (power_index < 0) {
1086 IL_WARN(priv, "txpower index %d < 0\n", 1086 IL_WARN(il, "txpower index %d < 0\n",
1087 power_index); 1087 power_index);
1088 power_index = 0; 1088 power_index = 0;
1089 } 1089 }
@@ -1094,7 +1094,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
1094 tx_power.s.dsp_predis_atten[c] = 1094 tx_power.s.dsp_predis_atten[c] =
1095 gain_table[band][power_index].dsp; 1095 gain_table[band][power_index].dsp;
1096 1096
1097 IL_DEBUG_TXPOWER(priv, "chain %d mimo %d index %d " 1097 IL_DEBUG_TXPOWER(il, "chain %d mimo %d index %d "
1098 "gain 0x%02x dsp %d\n", 1098 "gain 0x%02x dsp %d\n",
1099 c, atten_value, power_index, 1099 c, atten_value, power_index,
1100 tx_power.s.radio_tx_gain[c], 1100 tx_power.s.radio_tx_gain[c],
@@ -1112,22 +1112,22 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
1112 * il4965_send_tx_power - Configure the TXPOWER level user limit 1112 * il4965_send_tx_power - Configure the TXPOWER level user limit
1113 * 1113 *
1114 * Uses the active RXON for channel, band, and characteristics (ht40, high) 1114 * Uses the active RXON for channel, band, and characteristics (ht40, high)
1115 * The power limit is taken from priv->tx_power_user_lmt. 1115 * The power limit is taken from il->tx_power_user_lmt.
1116 */ 1116 */
1117static int il4965_send_tx_power(struct il_priv *priv) 1117static int il4965_send_tx_power(struct il_priv *il)
1118{ 1118{
1119 struct il4965_txpowertable_cmd cmd = { 0 }; 1119 struct il4965_txpowertable_cmd cmd = { 0 };
1120 int ret; 1120 int ret;
1121 u8 band = 0; 1121 u8 band = 0;
1122 bool is_ht40 = false; 1122 bool is_ht40 = false;
1123 u8 ctrl_chan_high = 0; 1123 u8 ctrl_chan_high = 0;
1124 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; 1124 struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS];
1125 1125
1126 if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status), 1126 if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &il->status),
1127 "TX Power requested while scanning!\n")) 1127 "TX Power requested while scanning!\n"))
1128 return -EAGAIN; 1128 return -EAGAIN;
1129 1129
1130 band = priv->band == IEEE80211_BAND_2GHZ; 1130 band = il->band == IEEE80211_BAND_2GHZ;
1131 1131
1132 is_ht40 = iw4965_is_ht40_channel(ctx->active.flags); 1132 is_ht40 = iw4965_is_ht40_channel(ctx->active.flags);
1133 1133
@@ -1137,20 +1137,20 @@ static int il4965_send_tx_power(struct il_priv *priv)
1137 cmd.band = band; 1137 cmd.band = band;
1138 cmd.channel = ctx->active.channel; 1138 cmd.channel = ctx->active.channel;
1139 1139
1140 ret = il4965_fill_txpower_tbl(priv, band, 1140 ret = il4965_fill_txpower_tbl(il, band,
1141 le16_to_cpu(ctx->active.channel), 1141 le16_to_cpu(ctx->active.channel),
1142 is_ht40, ctrl_chan_high, &cmd.tx_power); 1142 is_ht40, ctrl_chan_high, &cmd.tx_power);
1143 if (ret) 1143 if (ret)
1144 goto out; 1144 goto out;
1145 1145
1146 ret = il_send_cmd_pdu(priv, 1146 ret = il_send_cmd_pdu(il,
1147 REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd); 1147 REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd);
1148 1148
1149out: 1149out:
1150 return ret; 1150 return ret;
1151} 1151}
1152 1152
1153static int il4965_send_rxon_assoc(struct il_priv *priv, 1153static int il4965_send_rxon_assoc(struct il_priv *il,
1154 struct il_rxon_context *ctx) 1154 struct il_rxon_context *ctx)
1155{ 1155{
1156 int ret = 0; 1156 int ret = 0;
@@ -1167,7 +1167,7 @@ static int il4965_send_rxon_assoc(struct il_priv *priv,
1167 rxon2->ofdm_ht_dual_stream_basic_rates) && 1167 rxon2->ofdm_ht_dual_stream_basic_rates) &&
1168 (rxon1->rx_chain == rxon2->rx_chain) && 1168 (rxon1->rx_chain == rxon2->rx_chain) &&
1169 (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { 1169 (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) {
1170 IL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); 1170 IL_DEBUG_INFO(il, "Using current RXON_ASSOC. Not resending.\n");
1171 return 0; 1171 return 0;
1172 } 1172 }
1173 1173
@@ -1182,13 +1182,13 @@ static int il4965_send_rxon_assoc(struct il_priv *priv,
1182 ctx->staging.ofdm_ht_dual_stream_basic_rates; 1182 ctx->staging.ofdm_ht_dual_stream_basic_rates;
1183 rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain; 1183 rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain;
1184 1184
1185 ret = il_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, 1185 ret = il_send_cmd_pdu_async(il, REPLY_RXON_ASSOC,
1186 sizeof(rxon_assoc), &rxon_assoc, NULL); 1186 sizeof(rxon_assoc), &rxon_assoc, NULL);
1187 1187
1188 return ret; 1188 return ret;
1189} 1189}
1190 1190
1191static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) 1191static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1192{ 1192{
1193 /* cast away the const for active_rxon in this function */ 1193 /* cast away the const for active_rxon in this function */
1194 struct il_rxon_cmd *active_rxon = (void *)&ctx->active; 1194 struct il_rxon_cmd *active_rxon = (void *)&ctx->active;
@@ -1196,7 +1196,7 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx)
1196 bool new_assoc = 1196 bool new_assoc =
1197 !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK); 1197 !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK);
1198 1198
1199 if (!il_is_alive(priv)) 1199 if (!il_is_alive(il))
1200 return -EBUSY; 1200 return -EBUSY;
1201 1201
1202 if (!ctx->is_active) 1202 if (!ctx->is_active)
@@ -1205,9 +1205,9 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx)
1205 /* always get timestamp with Rx frame */ 1205 /* always get timestamp with Rx frame */
1206 ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; 1206 ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK;
1207 1207
1208 ret = il_check_rxon_cmd(priv, ctx); 1208 ret = il_check_rxon_cmd(il, ctx);
1209 if (ret) { 1209 if (ret) {
1210 IL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); 1210 IL_ERR(il, "Invalid RXON configuration. Not committing.\n");
1211 return -EINVAL; 1211 return -EINVAL;
1212 } 1212 }
1213 1213
@@ -1215,30 +1215,30 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx)
1215 * receive commit_rxon request 1215 * receive commit_rxon request
1216 * abort any previous channel switch if still in process 1216 * abort any previous channel switch if still in process
1217 */ 1217 */
1218 if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) && 1218 if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status) &&
1219 (priv->switch_channel != ctx->staging.channel)) { 1219 (il->switch_channel != ctx->staging.channel)) {
1220 IL_DEBUG_11H(priv, "abort channel switch on %d\n", 1220 IL_DEBUG_11H(il, "abort channel switch on %d\n",
1221 le16_to_cpu(priv->switch_channel)); 1221 le16_to_cpu(il->switch_channel));
1222 il_chswitch_done(priv, false); 1222 il_chswitch_done(il, false);
1223 } 1223 }
1224 1224
1225 /* If we don't need to send a full RXON, we can use 1225 /* If we don't need to send a full RXON, we can use
1226 * il_rxon_assoc_cmd which is used to reconfigure filter 1226 * il_rxon_assoc_cmd which is used to reconfigure filter
1227 * and other flags for the current radio configuration. */ 1227 * and other flags for the current radio configuration. */
1228 if (!il_full_rxon_required(priv, ctx)) { 1228 if (!il_full_rxon_required(il, ctx)) {
1229 ret = il_send_rxon_assoc(priv, ctx); 1229 ret = il_send_rxon_assoc(il, ctx);
1230 if (ret) { 1230 if (ret) {
1231 IL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret); 1231 IL_ERR(il, "Error setting RXON_ASSOC (%d)\n", ret);
1232 return ret; 1232 return ret;
1233 } 1233 }
1234 1234
1235 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); 1235 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon));
1236 il_print_rx_config_cmd(priv, ctx); 1236 il_print_rx_config_cmd(il, ctx);
1237 /* 1237 /*
1238 * We do not commit tx power settings while channel changing, 1238 * We do not commit tx power settings while channel changing,
1239 * do it now if tx power changed. 1239 * do it now if tx power changed.
1240 */ 1240 */
1241 il_set_tx_power(priv, priv->tx_power_next, false); 1241 il_set_tx_power(il, il->tx_power_next, false);
1242 return 0; 1242 return 0;
1243 } 1243 }
1244 1244
@@ -1247,10 +1247,10 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx)
1247 * we must clear the associated from the active configuration 1247 * we must clear the associated from the active configuration
1248 * before we apply the new config */ 1248 * before we apply the new config */
1249 if (il_is_associated_ctx(ctx) && new_assoc) { 1249 if (il_is_associated_ctx(ctx) && new_assoc) {
1250 IL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); 1250 IL_DEBUG_INFO(il, "Toggling associated bit on current RXON\n");
1251 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1251 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1252 1252
1253 ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, 1253 ret = il_send_cmd_pdu(il, ctx->rxon_cmd,
1254 sizeof(struct il_rxon_cmd), 1254 sizeof(struct il_rxon_cmd),
1255 active_rxon); 1255 active_rxon);
1256 1256
@@ -1258,19 +1258,19 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx)
1258 * active_rxon back to what it was previously */ 1258 * active_rxon back to what it was previously */
1259 if (ret) { 1259 if (ret) {
1260 active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; 1260 active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK;
1261 IL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); 1261 IL_ERR(il, "Error clearing ASSOC_MSK (%d)\n", ret);
1262 return ret; 1262 return ret;
1263 } 1263 }
1264 il_clear_ucode_stations(priv, ctx); 1264 il_clear_ucode_stations(il, ctx);
1265 il_restore_stations(priv, ctx); 1265 il_restore_stations(il, ctx);
1266 ret = il4965_restore_default_wep_keys(priv, ctx); 1266 ret = il4965_restore_default_wep_keys(il, ctx);
1267 if (ret) { 1267 if (ret) {
1268 IL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); 1268 IL_ERR(il, "Failed to restore WEP keys (%d)\n", ret);
1269 return ret; 1269 return ret;
1270 } 1270 }
1271 } 1271 }
1272 1272
1273 IL_DEBUG_INFO(priv, "Sending RXON\n" 1273 IL_DEBUG_INFO(il, "Sending RXON\n"
1274 "* with%s RXON_FILTER_ASSOC_MSK\n" 1274 "* with%s RXON_FILTER_ASSOC_MSK\n"
1275 "* channel = %d\n" 1275 "* channel = %d\n"
1276 "* bssid = %pM\n", 1276 "* bssid = %pM\n",
@@ -1278,62 +1278,62 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx)
1278 le16_to_cpu(ctx->staging.channel), 1278 le16_to_cpu(ctx->staging.channel),
1279 ctx->staging.bssid_addr); 1279 ctx->staging.bssid_addr);
1280 1280
1281 il_set_rxon_hwcrypto(priv, ctx, 1281 il_set_rxon_hwcrypto(il, ctx,
1282 !priv->cfg->mod_params->sw_crypto); 1282 !il->cfg->mod_params->sw_crypto);
1283 1283
1284 /* Apply the new configuration 1284 /* Apply the new configuration
1285 * RXON unassoc clears the station table in uCode so restoration of 1285 * RXON unassoc clears the station table in uCode so restoration of
1286 * stations is needed after it (the RXON command) completes 1286 * stations is needed after it (the RXON command) completes
1287 */ 1287 */
1288 if (!new_assoc) { 1288 if (!new_assoc) {
1289 ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, 1289 ret = il_send_cmd_pdu(il, ctx->rxon_cmd,
1290 sizeof(struct il_rxon_cmd), &ctx->staging); 1290 sizeof(struct il_rxon_cmd), &ctx->staging);
1291 if (ret) { 1291 if (ret) {
1292 IL_ERR(priv, "Error setting new RXON (%d)\n", ret); 1292 IL_ERR(il, "Error setting new RXON (%d)\n", ret);
1293 return ret; 1293 return ret;
1294 } 1294 }
1295 IL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); 1295 IL_DEBUG_INFO(il, "Return from !new_assoc RXON.\n");
1296 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); 1296 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon));
1297 il_clear_ucode_stations(priv, ctx); 1297 il_clear_ucode_stations(il, ctx);
1298 il_restore_stations(priv, ctx); 1298 il_restore_stations(il, ctx);
1299 ret = il4965_restore_default_wep_keys(priv, ctx); 1299 ret = il4965_restore_default_wep_keys(il, ctx);
1300 if (ret) { 1300 if (ret) {
1301 IL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); 1301 IL_ERR(il, "Failed to restore WEP keys (%d)\n", ret);
1302 return ret; 1302 return ret;
1303 } 1303 }
1304 } 1304 }
1305 if (new_assoc) { 1305 if (new_assoc) {
1306 priv->start_calib = 0; 1306 il->start_calib = 0;
1307 /* Apply the new configuration 1307 /* Apply the new configuration
1308 * RXON assoc doesn't clear the station table in uCode, 1308 * RXON assoc doesn't clear the station table in uCode,
1309 */ 1309 */
1310 ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, 1310 ret = il_send_cmd_pdu(il, ctx->rxon_cmd,
1311 sizeof(struct il_rxon_cmd), &ctx->staging); 1311 sizeof(struct il_rxon_cmd), &ctx->staging);
1312 if (ret) { 1312 if (ret) {
1313 IL_ERR(priv, "Error setting new RXON (%d)\n", ret); 1313 IL_ERR(il, "Error setting new RXON (%d)\n", ret);
1314 return ret; 1314 return ret;
1315 } 1315 }
1316 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); 1316 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon));
1317 } 1317 }
1318 il_print_rx_config_cmd(priv, ctx); 1318 il_print_rx_config_cmd(il, ctx);
1319 1319
1320 il4965_init_sensitivity(priv); 1320 il4965_init_sensitivity(il);
1321 1321
1322 /* If we issue a new RXON command which required a tune then we must 1322 /* If we issue a new RXON command which required a tune then we must
1323 * send a new TXPOWER command or we won't be able to Tx any frames */ 1323 * send a new TXPOWER command or we won't be able to Tx any frames */
1324 ret = il_set_tx_power(priv, priv->tx_power_next, true); 1324 ret = il_set_tx_power(il, il->tx_power_next, true);
1325 if (ret) { 1325 if (ret) {
1326 IL_ERR(priv, "Error sending TX power (%d)\n", ret); 1326 IL_ERR(il, "Error sending TX power (%d)\n", ret);
1327 return ret; 1327 return ret;
1328 } 1328 }
1329 1329
1330 return 0; 1330 return 0;
1331} 1331}
1332 1332
1333static int il4965_hw_channel_switch(struct il_priv *priv, 1333static int il4965_hw_channel_switch(struct il_priv *il,
1334 struct ieee80211_channel_switch *ch_switch) 1334 struct ieee80211_channel_switch *ch_switch)
1335{ 1335{
1336 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; 1336 struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS];
1337 int rc; 1337 int rc;
1338 u8 band = 0; 1338 u8 band = 0;
1339 bool is_ht40 = false; 1339 bool is_ht40 = false;
@@ -1346,7 +1346,7 @@ static int il4965_hw_channel_switch(struct il_priv *priv,
1346 u8 switch_count; 1346 u8 switch_count;
1347 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); 1347 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
1348 struct ieee80211_vif *vif = ctx->vif; 1348 struct ieee80211_vif *vif = ctx->vif;
1349 band = priv->band == IEEE80211_BAND_2GHZ; 1349 band = il->band == IEEE80211_BAND_2GHZ;
1350 1350
1351 is_ht40 = iw4965_is_ht40_channel(ctx->staging.flags); 1351 is_ht40 = iw4965_is_ht40_channel(ctx->staging.flags);
1352 1352
@@ -1366,57 +1366,57 @@ static int il4965_hw_channel_switch(struct il_priv *priv,
1366 * calculate the ucode channel switch time 1366 * calculate the ucode channel switch time
1367 * adding TSF as one of the factor for when to switch 1367 * adding TSF as one of the factor for when to switch
1368 */ 1368 */
1369 if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) { 1369 if ((il->ucode_beacon_time > tsf_low) && beacon_interval) {
1370 if (switch_count > ((priv->ucode_beacon_time - tsf_low) / 1370 if (switch_count > ((il->ucode_beacon_time - tsf_low) /
1371 beacon_interval)) { 1371 beacon_interval)) {
1372 switch_count -= (priv->ucode_beacon_time - 1372 switch_count -= (il->ucode_beacon_time -
1373 tsf_low) / beacon_interval; 1373 tsf_low) / beacon_interval;
1374 } else 1374 } else
1375 switch_count = 0; 1375 switch_count = 0;
1376 } 1376 }
1377 if (switch_count <= 1) 1377 if (switch_count <= 1)
1378 cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time); 1378 cmd.switch_time = cpu_to_le32(il->ucode_beacon_time);
1379 else { 1379 else {
1380 switch_time_in_usec = 1380 switch_time_in_usec =
1381 vif->bss_conf.beacon_int * switch_count * TIME_UNIT; 1381 vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
1382 ucode_switch_time = il_usecs_to_beacons(priv, 1382 ucode_switch_time = il_usecs_to_beacons(il,
1383 switch_time_in_usec, 1383 switch_time_in_usec,
1384 beacon_interval); 1384 beacon_interval);
1385 cmd.switch_time = il_add_beacon_time(priv, 1385 cmd.switch_time = il_add_beacon_time(il,
1386 priv->ucode_beacon_time, 1386 il->ucode_beacon_time,
1387 ucode_switch_time, 1387 ucode_switch_time,
1388 beacon_interval); 1388 beacon_interval);
1389 } 1389 }
1390 IL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", 1390 IL_DEBUG_11H(il, "uCode time for the switch is 0x%x\n",
1391 cmd.switch_time); 1391 cmd.switch_time);
1392 ch_info = il_get_channel_info(priv, priv->band, ch); 1392 ch_info = il_get_channel_info(il, il->band, ch);
1393 if (ch_info) 1393 if (ch_info)
1394 cmd.expect_beacon = il_is_channel_radar(ch_info); 1394 cmd.expect_beacon = il_is_channel_radar(ch_info);
1395 else { 1395 else {
1396 IL_ERR(priv, "invalid channel switch from %u to %u\n", 1396 IL_ERR(il, "invalid channel switch from %u to %u\n",
1397 ctx->active.channel, ch); 1397 ctx->active.channel, ch);
1398 return -EFAULT; 1398 return -EFAULT;
1399 } 1399 }
1400 1400
1401 rc = il4965_fill_txpower_tbl(priv, band, ch, is_ht40, 1401 rc = il4965_fill_txpower_tbl(il, band, ch, is_ht40,
1402 ctrl_chan_high, &cmd.tx_power); 1402 ctrl_chan_high, &cmd.tx_power);
1403 if (rc) { 1403 if (rc) {
1404 IL_DEBUG_11H(priv, "error:%d fill txpower_tbl\n", rc); 1404 IL_DEBUG_11H(il, "error:%d fill txpower_tbl\n", rc);
1405 return rc; 1405 return rc;
1406 } 1406 }
1407 1407
1408 return il_send_cmd_pdu(priv, 1408 return il_send_cmd_pdu(il,
1409 REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); 1409 REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd);
1410} 1410}
1411 1411
1412/** 1412/**
1413 * il4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array 1413 * il4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array
1414 */ 1414 */
1415static void il4965_txq_update_byte_cnt_tbl(struct il_priv *priv, 1415static void il4965_txq_update_byte_cnt_tbl(struct il_priv *il,
1416 struct il_tx_queue *txq, 1416 struct il_tx_queue *txq,
1417 u16 byte_cnt) 1417 u16 byte_cnt)
1418{ 1418{
1419 struct il4965_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; 1419 struct il4965_scd_bc_tbl *scd_bc_tbl = il->scd_bc_tbls.addr;
1420 int txq_id = txq->q.id; 1420 int txq_id = txq->q.id;
1421 int write_ptr = txq->q.write_ptr; 1421 int write_ptr = txq->q.write_ptr;
1422 int len = byte_cnt + IL_TX_CRC_SIZE + IL_TX_DELIMITER_SIZE; 1422 int len = byte_cnt + IL_TX_CRC_SIZE + IL_TX_DELIMITER_SIZE;
@@ -1440,27 +1440,27 @@ static void il4965_txq_update_byte_cnt_tbl(struct il_priv *priv,
1440 * 1440 *
1441 * A return of <0 indicates bogus data in the statistics 1441 * A return of <0 indicates bogus data in the statistics
1442 */ 1442 */
1443static int il4965_hw_get_temperature(struct il_priv *priv) 1443static int il4965_hw_get_temperature(struct il_priv *il)
1444{ 1444{
1445 s32 temperature; 1445 s32 temperature;
1446 s32 vt; 1446 s32 vt;
1447 s32 R1, R2, R3; 1447 s32 R1, R2, R3;
1448 u32 R4; 1448 u32 R4;
1449 1449
1450 if (test_bit(STATUS_TEMPERATURE, &priv->status) && 1450 if (test_bit(STATUS_TEMPERATURE, &il->status) &&
1451 (priv->_4965.statistics.flag & 1451 (il->_4965.statistics.flag &
1452 STATISTICS_REPLY_FLG_HT40_MODE_MSK)) { 1452 STATISTICS_REPLY_FLG_HT40_MODE_MSK)) {
1453 IL_DEBUG_TEMP(priv, "Running HT40 temperature calibration\n"); 1453 IL_DEBUG_TEMP(il, "Running HT40 temperature calibration\n");
1454 R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[1]); 1454 R1 = (s32)le32_to_cpu(il->card_alive_init.therm_r1[1]);
1455 R2 = (s32)le32_to_cpu(priv->card_alive_init.therm_r2[1]); 1455 R2 = (s32)le32_to_cpu(il->card_alive_init.therm_r2[1]);
1456 R3 = (s32)le32_to_cpu(priv->card_alive_init.therm_r3[1]); 1456 R3 = (s32)le32_to_cpu(il->card_alive_init.therm_r3[1]);
1457 R4 = le32_to_cpu(priv->card_alive_init.therm_r4[1]); 1457 R4 = le32_to_cpu(il->card_alive_init.therm_r4[1]);
1458 } else { 1458 } else {
1459 IL_DEBUG_TEMP(priv, "Running temperature calibration\n"); 1459 IL_DEBUG_TEMP(il, "Running temperature calibration\n");
1460 R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[0]); 1460 R1 = (s32)le32_to_cpu(il->card_alive_init.therm_r1[0]);
1461 R2 = (s32)le32_to_cpu(priv->card_alive_init.therm_r2[0]); 1461 R2 = (s32)le32_to_cpu(il->card_alive_init.therm_r2[0]);
1462 R3 = (s32)le32_to_cpu(priv->card_alive_init.therm_r3[0]); 1462 R3 = (s32)le32_to_cpu(il->card_alive_init.therm_r3[0]);
1463 R4 = le32_to_cpu(priv->card_alive_init.therm_r4[0]); 1463 R4 = le32_to_cpu(il->card_alive_init.therm_r4[0]);
1464 } 1464 }
1465 1465
1466 /* 1466 /*
@@ -1470,16 +1470,16 @@ static int il4965_hw_get_temperature(struct il_priv *priv)
1470 * with an updated temperature, use R4 provided to us in the 1470 * with an updated temperature, use R4 provided to us in the
1471 * "initialize" ALIVE response. 1471 * "initialize" ALIVE response.
1472 */ 1472 */
1473 if (!test_bit(STATUS_TEMPERATURE, &priv->status)) 1473 if (!test_bit(STATUS_TEMPERATURE, &il->status))
1474 vt = sign_extend32(R4, 23); 1474 vt = sign_extend32(R4, 23);
1475 else 1475 else
1476 vt = sign_extend32(le32_to_cpu(priv->_4965.statistics. 1476 vt = sign_extend32(le32_to_cpu(il->_4965.statistics.
1477 general.common.temperature), 23); 1477 general.common.temperature), 23);
1478 1478
1479 IL_DEBUG_TEMP(priv, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); 1479 IL_DEBUG_TEMP(il, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt);
1480 1480
1481 if (R3 == R1) { 1481 if (R3 == R1) {
1482 IL_ERR(priv, "Calibration conflict R1 == R3\n"); 1482 IL_ERR(il, "Calibration conflict R1 == R3\n");
1483 return -1; 1483 return -1;
1484 } 1484 }
1485 1485
@@ -1489,7 +1489,7 @@ static int il4965_hw_get_temperature(struct il_priv *priv)
1489 temperature /= (R3 - R1); 1489 temperature /= (R3 - R1);
1490 temperature = (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET; 1490 temperature = (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET;
1491 1491
1492 IL_DEBUG_TEMP(priv, "Calibrated temperature: %dK, %dC\n", 1492 IL_DEBUG_TEMP(il, "Calibrated temperature: %dK, %dC\n",
1493 temperature, KELVIN_TO_CELSIUS(temperature)); 1493 temperature, KELVIN_TO_CELSIUS(temperature));
1494 1494
1495 return temperature; 1495 return temperature;
@@ -1504,66 +1504,66 @@ static int il4965_hw_get_temperature(struct il_priv *priv)
1504 * If the temperature changed has changed sufficiently, then a recalibration 1504 * If the temperature changed has changed sufficiently, then a recalibration
1505 * is needed. 1505 * is needed.
1506 * 1506 *
1507 * Assumes caller will replace priv->last_temperature once calibration 1507 * Assumes caller will replace il->last_temperature once calibration
1508 * executed. 1508 * executed.
1509 */ 1509 */
1510static int il4965_is_temp_calib_needed(struct il_priv *priv) 1510static int il4965_is_temp_calib_needed(struct il_priv *il)
1511{ 1511{
1512 int temp_diff; 1512 int temp_diff;
1513 1513
1514 if (!test_bit(STATUS_STATISTICS, &priv->status)) { 1514 if (!test_bit(STATUS_STATISTICS, &il->status)) {
1515 IL_DEBUG_TEMP(priv, "Temperature not updated -- no statistics.\n"); 1515 IL_DEBUG_TEMP(il, "Temperature not updated -- no statistics.\n");
1516 return 0; 1516 return 0;
1517 } 1517 }
1518 1518
1519 temp_diff = priv->temperature - priv->last_temperature; 1519 temp_diff = il->temperature - il->last_temperature;
1520 1520
1521 /* get absolute value */ 1521 /* get absolute value */
1522 if (temp_diff < 0) { 1522 if (temp_diff < 0) {
1523 IL_DEBUG_POWER(priv, "Getting cooler, delta %d\n", temp_diff); 1523 IL_DEBUG_POWER(il, "Getting cooler, delta %d\n", temp_diff);
1524 temp_diff = -temp_diff; 1524 temp_diff = -temp_diff;
1525 } else if (temp_diff == 0) 1525 } else if (temp_diff == 0)
1526 IL_DEBUG_POWER(priv, "Temperature unchanged\n"); 1526 IL_DEBUG_POWER(il, "Temperature unchanged\n");
1527 else 1527 else
1528 IL_DEBUG_POWER(priv, "Getting warmer, delta %d\n", temp_diff); 1528 IL_DEBUG_POWER(il, "Getting warmer, delta %d\n", temp_diff);
1529 1529
1530 if (temp_diff < IL_TEMPERATURE_THRESHOLD) { 1530 if (temp_diff < IL_TEMPERATURE_THRESHOLD) {
1531 IL_DEBUG_POWER(priv, " => thermal txpower calib not needed\n"); 1531 IL_DEBUG_POWER(il, " => thermal txpower calib not needed\n");
1532 return 0; 1532 return 0;
1533 } 1533 }
1534 1534
1535 IL_DEBUG_POWER(priv, " => thermal txpower calib needed\n"); 1535 IL_DEBUG_POWER(il, " => thermal txpower calib needed\n");
1536 1536
1537 return 1; 1537 return 1;
1538} 1538}
1539 1539
1540static void il4965_temperature_calib(struct il_priv *priv) 1540static void il4965_temperature_calib(struct il_priv *il)
1541{ 1541{
1542 s32 temp; 1542 s32 temp;
1543 1543
1544 temp = il4965_hw_get_temperature(priv); 1544 temp = il4965_hw_get_temperature(il);
1545 if (IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(temp)) 1545 if (IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(temp))
1546 return; 1546 return;
1547 1547
1548 if (priv->temperature != temp) { 1548 if (il->temperature != temp) {
1549 if (priv->temperature) 1549 if (il->temperature)
1550 IL_DEBUG_TEMP(priv, "Temperature changed " 1550 IL_DEBUG_TEMP(il, "Temperature changed "
1551 "from %dC to %dC\n", 1551 "from %dC to %dC\n",
1552 KELVIN_TO_CELSIUS(priv->temperature), 1552 KELVIN_TO_CELSIUS(il->temperature),
1553 KELVIN_TO_CELSIUS(temp)); 1553 KELVIN_TO_CELSIUS(temp));
1554 else 1554 else
1555 IL_DEBUG_TEMP(priv, "Temperature " 1555 IL_DEBUG_TEMP(il, "Temperature "
1556 "initialized to %dC\n", 1556 "initialized to %dC\n",
1557 KELVIN_TO_CELSIUS(temp)); 1557 KELVIN_TO_CELSIUS(temp));
1558 } 1558 }
1559 1559
1560 priv->temperature = temp; 1560 il->temperature = temp;
1561 set_bit(STATUS_TEMPERATURE, &priv->status); 1561 set_bit(STATUS_TEMPERATURE, &il->status);
1562 1562
1563 if (!priv->disable_tx_power_cal && 1563 if (!il->disable_tx_power_cal &&
1564 unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && 1564 unlikely(!test_bit(STATUS_SCANNING, &il->status)) &&
1565 il4965_is_temp_calib_needed(priv)) 1565 il4965_is_temp_calib_needed(il))
1566 queue_work(priv->workqueue, &priv->txpower_work); 1566 queue_work(il->workqueue, &il->txpower_work);
1567} 1567}
1568 1568
1569static u16 il4965_get_hcmd_size(u8 cmd_id, u16 len) 1569static u16 il4965_get_hcmd_size(u8 cmd_id, u16 len)
@@ -1604,7 +1604,7 @@ static inline u32 il4965_get_scd_ssn(struct il4965_tx_resp *tx_resp)
1604/** 1604/**
1605 * il4965_tx_status_reply_tx - Handle Tx response for frames in aggregation queue 1605 * il4965_tx_status_reply_tx - Handle Tx response for frames in aggregation queue
1606 */ 1606 */
1607static int il4965_tx_status_reply_tx(struct il_priv *priv, 1607static int il4965_tx_status_reply_tx(struct il_priv *il,
1608 struct il_ht_agg *agg, 1608 struct il_ht_agg *agg,
1609 struct il4965_tx_resp *tx_resp, 1609 struct il4965_tx_resp *tx_resp,
1610 int txq_id, u16 start_idx) 1610 int txq_id, u16 start_idx)
@@ -1617,7 +1617,7 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv,
1617 int i, sh, idx; 1617 int i, sh, idx;
1618 u16 seq; 1618 u16 seq;
1619 if (agg->wait_for_ba) 1619 if (agg->wait_for_ba)
1620 IL_DEBUG_TX_REPLY(priv, "got tx response w/o block-ack\n"); 1620 IL_DEBUG_TX_REPLY(il, "got tx response w/o block-ack\n");
1621 1621
1622 agg->frame_count = tx_resp->frame_count; 1622 agg->frame_count = tx_resp->frame_count;
1623 agg->start_idx = start_idx; 1623 agg->start_idx = start_idx;
@@ -1630,18 +1630,18 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv,
1630 status = le16_to_cpu(frame_status[0].status); 1630 status = le16_to_cpu(frame_status[0].status);
1631 idx = start_idx; 1631 idx = start_idx;
1632 1632
1633 IL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n", 1633 IL_DEBUG_TX_REPLY(il, "FrameCnt = %d, StartIdx=%d idx=%d\n",
1634 agg->frame_count, agg->start_idx, idx); 1634 agg->frame_count, agg->start_idx, idx);
1635 1635
1636 info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb); 1636 info = IEEE80211_SKB_CB(il->txq[txq_id].txb[idx].skb);
1637 info->status.rates[0].count = tx_resp->failure_frame + 1; 1637 info->status.rates[0].count = tx_resp->failure_frame + 1;
1638 info->flags &= ~IEEE80211_TX_CTL_AMPDU; 1638 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
1639 info->flags |= il4965_tx_status_to_mac80211(status); 1639 info->flags |= il4965_tx_status_to_mac80211(status);
1640 il4965_hwrate_to_tx_control(priv, rate_n_flags, info); 1640 il4965_hwrate_to_tx_control(il, rate_n_flags, info);
1641 1641
1642 IL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n", 1642 IL_DEBUG_TX_REPLY(il, "1 Frame 0x%x failure :%d\n",
1643 status & 0xff, tx_resp->failure_frame); 1643 status & 0xff, tx_resp->failure_frame);
1644 IL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags); 1644 IL_DEBUG_TX_REPLY(il, "Rate Info rate_n_flags=%x\n", rate_n_flags);
1645 1645
1646 agg->wait_for_ba = 0; 1646 agg->wait_for_ba = 0;
1647 } else { 1647 } else {
@@ -1661,12 +1661,12 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv,
1661 AGG_TX_STATE_ABORT_MSK)) 1661 AGG_TX_STATE_ABORT_MSK))
1662 continue; 1662 continue;
1663 1663
1664 IL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n", 1664 IL_DEBUG_TX_REPLY(il, "FrameCnt = %d, txq_id=%d idx=%d\n",
1665 agg->frame_count, txq_id, idx); 1665 agg->frame_count, txq_id, idx);
1666 1666
1667 hdr = il_tx_queue_get_hdr(priv, txq_id, idx); 1667 hdr = il_tx_queue_get_hdr(il, txq_id, idx);
1668 if (!hdr) { 1668 if (!hdr) {
1669 IL_ERR(priv, 1669 IL_ERR(il,
1670 "BUG_ON idx doesn't point to valid skb" 1670 "BUG_ON idx doesn't point to valid skb"
1671 " idx=%d, txq_id=%d\n", idx, txq_id); 1671 " idx=%d, txq_id=%d\n", idx, txq_id);
1672 return -1; 1672 return -1;
@@ -1674,14 +1674,14 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv,
1674 1674
1675 sc = le16_to_cpu(hdr->seq_ctrl); 1675 sc = le16_to_cpu(hdr->seq_ctrl);
1676 if (idx != (SEQ_TO_SN(sc) & 0xff)) { 1676 if (idx != (SEQ_TO_SN(sc) & 0xff)) {
1677 IL_ERR(priv, 1677 IL_ERR(il,
1678 "BUG_ON idx doesn't match seq control" 1678 "BUG_ON idx doesn't match seq control"
1679 " idx=%d, seq_idx=%d, seq=%d\n", 1679 " idx=%d, seq_idx=%d, seq=%d\n",
1680 idx, SEQ_TO_SN(sc), hdr->seq_ctrl); 1680 idx, SEQ_TO_SN(sc), hdr->seq_ctrl);
1681 return -1; 1681 return -1;
1682 } 1682 }
1683 1683
1684 IL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n", 1684 IL_DEBUG_TX_REPLY(il, "AGG Frame i=%d idx %d seq=%d\n",
1685 i, idx, SEQ_TO_SN(sc)); 1685 i, idx, SEQ_TO_SN(sc));
1686 1686
1687 sh = idx - start; 1687 sh = idx - start;
@@ -1699,13 +1699,13 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv,
1699 sh = 0; 1699 sh = 0;
1700 } 1700 }
1701 bitmap |= 1ULL << sh; 1701 bitmap |= 1ULL << sh;
1702 IL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n", 1702 IL_DEBUG_TX_REPLY(il, "start=%d bitmap=0x%llx\n",
1703 start, (unsigned long long)bitmap); 1703 start, (unsigned long long)bitmap);
1704 } 1704 }
1705 1705
1706 agg->bitmap = bitmap; 1706 agg->bitmap = bitmap;
1707 agg->start_idx = start; 1707 agg->start_idx = start;
1708 IL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n", 1708 IL_DEBUG_TX_REPLY(il, "Frames %d start_idx=%d bitmap=0x%llx\n",
1709 agg->frame_count, agg->start_idx, 1709 agg->frame_count, agg->start_idx,
1710 (unsigned long long)agg->bitmap); 1710 (unsigned long long)agg->bitmap);
1711 1711
@@ -1715,30 +1715,30 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv,
1715 return 0; 1715 return 0;
1716} 1716}
1717 1717
1718static u8 il4965_find_station(struct il_priv *priv, const u8 *addr) 1718static u8 il4965_find_station(struct il_priv *il, const u8 *addr)
1719{ 1719{
1720 int i; 1720 int i;
1721 int start = 0; 1721 int start = 0;
1722 int ret = IL_INVALID_STATION; 1722 int ret = IL_INVALID_STATION;
1723 unsigned long flags; 1723 unsigned long flags;
1724 1724
1725 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC)) 1725 if ((il->iw_mode == NL80211_IFTYPE_ADHOC))
1726 start = IL_STA_ID; 1726 start = IL_STA_ID;
1727 1727
1728 if (is_broadcast_ether_addr(addr)) 1728 if (is_broadcast_ether_addr(addr))
1729 return priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id; 1729 return il->contexts[IL_RXON_CTX_BSS].bcast_sta_id;
1730 1730
1731 spin_lock_irqsave(&priv->sta_lock, flags); 1731 spin_lock_irqsave(&il->sta_lock, flags);
1732 for (i = start; i < priv->hw_params.max_stations; i++) 1732 for (i = start; i < il->hw_params.max_stations; i++)
1733 if (priv->stations[i].used && 1733 if (il->stations[i].used &&
1734 (!compare_ether_addr(priv->stations[i].sta.sta.addr, 1734 (!compare_ether_addr(il->stations[i].sta.sta.addr,
1735 addr))) { 1735 addr))) {
1736 ret = i; 1736 ret = i;
1737 goto out; 1737 goto out;
1738 } 1738 }
1739 1739
1740 IL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n", 1740 IL_DEBUG_ASSOC_LIMIT(il, "can not find STA %pM total %d\n",
1741 addr, priv->num_stations); 1741 addr, il->num_stations);
1742 1742
1743 out: 1743 out:
1744 /* 1744 /*
@@ -1747,38 +1747,38 @@ static u8 il4965_find_station(struct il_priv *priv, const u8 *addr)
1747 * station 1747 * station
1748 */ 1748 */
1749 if (ret != IL_INVALID_STATION && 1749 if (ret != IL_INVALID_STATION &&
1750 (!(priv->stations[ret].used & IL_STA_UCODE_ACTIVE) || 1750 (!(il->stations[ret].used & IL_STA_UCODE_ACTIVE) ||
1751 ((priv->stations[ret].used & IL_STA_UCODE_ACTIVE) && 1751 ((il->stations[ret].used & IL_STA_UCODE_ACTIVE) &&
1752 (priv->stations[ret].used & IL_STA_UCODE_INPROGRESS)))) { 1752 (il->stations[ret].used & IL_STA_UCODE_INPROGRESS)))) {
1753 IL_ERR(priv, "Requested station info for sta %d before ready.\n", 1753 IL_ERR(il, "Requested station info for sta %d before ready.\n",
1754 ret); 1754 ret);
1755 ret = IL_INVALID_STATION; 1755 ret = IL_INVALID_STATION;
1756 } 1756 }
1757 spin_unlock_irqrestore(&priv->sta_lock, flags); 1757 spin_unlock_irqrestore(&il->sta_lock, flags);
1758 return ret; 1758 return ret;
1759} 1759}
1760 1760
1761static int il4965_get_ra_sta_id(struct il_priv *priv, struct ieee80211_hdr *hdr) 1761static int il4965_get_ra_sta_id(struct il_priv *il, struct ieee80211_hdr *hdr)
1762{ 1762{
1763 if (priv->iw_mode == NL80211_IFTYPE_STATION) { 1763 if (il->iw_mode == NL80211_IFTYPE_STATION) {
1764 return IL_AP_ID; 1764 return IL_AP_ID;
1765 } else { 1765 } else {
1766 u8 *da = ieee80211_get_DA(hdr); 1766 u8 *da = ieee80211_get_DA(hdr);
1767 return il4965_find_station(priv, da); 1767 return il4965_find_station(il, da);
1768 } 1768 }
1769} 1769}
1770 1770
1771/** 1771/**
1772 * il4965_rx_reply_tx - Handle standard (non-aggregation) Tx response 1772 * il4965_rx_reply_tx - Handle standard (non-aggregation) Tx response
1773 */ 1773 */
1774static void il4965_rx_reply_tx(struct il_priv *priv, 1774static void il4965_rx_reply_tx(struct il_priv *il,
1775 struct il_rx_mem_buffer *rxb) 1775 struct il_rx_mem_buffer *rxb)
1776{ 1776{
1777 struct il_rx_packet *pkt = rxb_addr(rxb); 1777 struct il_rx_packet *pkt = rxb_addr(rxb);
1778 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 1778 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
1779 int txq_id = SEQ_TO_QUEUE(sequence); 1779 int txq_id = SEQ_TO_QUEUE(sequence);
1780 int index = SEQ_TO_INDEX(sequence); 1780 int index = SEQ_TO_INDEX(sequence);
1781 struct il_tx_queue *txq = &priv->txq[txq_id]; 1781 struct il_tx_queue *txq = &il->txq[txq_id];
1782 struct ieee80211_hdr *hdr; 1782 struct ieee80211_hdr *hdr;
1783 struct ieee80211_tx_info *info; 1783 struct ieee80211_tx_info *info;
1784 struct il4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 1784 struct il4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
@@ -1790,7 +1790,7 @@ static void il4965_rx_reply_tx(struct il_priv *priv,
1790 unsigned long flags; 1790 unsigned long flags;
1791 1791
1792 if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) { 1792 if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) {
1793 IL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " 1793 IL_ERR(il, "Read index for DMA queue txq_id (%d) index %d "
1794 "is out of range [0-%d] %d %d\n", txq_id, 1794 "is out of range [0-%d] %d %d\n", txq_id,
1795 index, txq->q.n_bd, txq->q.write_ptr, 1795 index, txq->q.n_bd, txq->q.write_ptr,
1796 txq->q.read_ptr); 1796 txq->q.read_ptr);
@@ -1801,27 +1801,27 @@ static void il4965_rx_reply_tx(struct il_priv *priv,
1801 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb); 1801 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb);
1802 memset(&info->status, 0, sizeof(info->status)); 1802 memset(&info->status, 0, sizeof(info->status));
1803 1803
1804 hdr = il_tx_queue_get_hdr(priv, txq_id, index); 1804 hdr = il_tx_queue_get_hdr(il, txq_id, index);
1805 if (ieee80211_is_data_qos(hdr->frame_control)) { 1805 if (ieee80211_is_data_qos(hdr->frame_control)) {
1806 qc = ieee80211_get_qos_ctl(hdr); 1806 qc = ieee80211_get_qos_ctl(hdr);
1807 tid = qc[0] & 0xf; 1807 tid = qc[0] & 0xf;
1808 } 1808 }
1809 1809
1810 sta_id = il4965_get_ra_sta_id(priv, hdr); 1810 sta_id = il4965_get_ra_sta_id(il, hdr);
1811 if (txq->sched_retry && unlikely(sta_id == IL_INVALID_STATION)) { 1811 if (txq->sched_retry && unlikely(sta_id == IL_INVALID_STATION)) {
1812 IL_ERR(priv, "Station not known\n"); 1812 IL_ERR(il, "Station not known\n");
1813 return; 1813 return;
1814 } 1814 }
1815 1815
1816 spin_lock_irqsave(&priv->sta_lock, flags); 1816 spin_lock_irqsave(&il->sta_lock, flags);
1817 if (txq->sched_retry) { 1817 if (txq->sched_retry) {
1818 const u32 scd_ssn = il4965_get_scd_ssn(tx_resp); 1818 const u32 scd_ssn = il4965_get_scd_ssn(tx_resp);
1819 struct il_ht_agg *agg = NULL; 1819 struct il_ht_agg *agg = NULL;
1820 WARN_ON(!qc); 1820 WARN_ON(!qc);
1821 1821
1822 agg = &priv->stations[sta_id].tid[tid].agg; 1822 agg = &il->stations[sta_id].tid[tid].agg;
1823 1823
1824 il4965_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); 1824 il4965_tx_status_reply_tx(il, agg, tx_resp, txq_id, index);
1825 1825
1826 /* check if BAR is needed */ 1826 /* check if BAR is needed */
1827 if ((tx_resp->frame_count == 1) && !il4965_is_tx_success(status)) 1827 if ((tx_resp->frame_count == 1) && !il4965_is_tx_success(status))
@@ -1830,51 +1830,51 @@ static void il4965_rx_reply_tx(struct il_priv *priv,
1830 if (txq->q.read_ptr != (scd_ssn & 0xff)) { 1830 if (txq->q.read_ptr != (scd_ssn & 0xff)) {
1831 index = il_queue_dec_wrap(scd_ssn & 0xff, 1831 index = il_queue_dec_wrap(scd_ssn & 0xff,
1832 txq->q.n_bd); 1832 txq->q.n_bd);
1833 IL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn " 1833 IL_DEBUG_TX_REPLY(il, "Retry scheduler reclaim scd_ssn "
1834 "%d index %d\n", scd_ssn , index); 1834 "%d index %d\n", scd_ssn , index);
1835 freed = il4965_tx_queue_reclaim(priv, txq_id, index); 1835 freed = il4965_tx_queue_reclaim(il, txq_id, index);
1836 if (qc) 1836 if (qc)
1837 il4965_free_tfds_in_queue(priv, sta_id, 1837 il4965_free_tfds_in_queue(il, sta_id,
1838 tid, freed); 1838 tid, freed);
1839 1839
1840 if (priv->mac80211_registered && 1840 if (il->mac80211_registered &&
1841 (il_queue_space(&txq->q) > txq->q.low_mark) 1841 (il_queue_space(&txq->q) > txq->q.low_mark)
1842 && (agg->state != IL_EMPTYING_HW_QUEUE_DELBA)) 1842 && (agg->state != IL_EMPTYING_HW_QUEUE_DELBA))
1843 il_wake_queue(priv, txq); 1843 il_wake_queue(il, txq);
1844 } 1844 }
1845 } else { 1845 } else {
1846 info->status.rates[0].count = tx_resp->failure_frame + 1; 1846 info->status.rates[0].count = tx_resp->failure_frame + 1;
1847 info->flags |= il4965_tx_status_to_mac80211(status); 1847 info->flags |= il4965_tx_status_to_mac80211(status);
1848 il4965_hwrate_to_tx_control(priv, 1848 il4965_hwrate_to_tx_control(il,
1849 le32_to_cpu(tx_resp->rate_n_flags), 1849 le32_to_cpu(tx_resp->rate_n_flags),
1850 info); 1850 info);
1851 1851
1852 IL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) " 1852 IL_DEBUG_TX_REPLY(il, "TXQ %d status %s (0x%08x) "
1853 "rate_n_flags 0x%x retries %d\n", 1853 "rate_n_flags 0x%x retries %d\n",
1854 txq_id, 1854 txq_id,
1855 il4965_get_tx_fail_reason(status), status, 1855 il4965_get_tx_fail_reason(status), status,
1856 le32_to_cpu(tx_resp->rate_n_flags), 1856 le32_to_cpu(tx_resp->rate_n_flags),
1857 tx_resp->failure_frame); 1857 tx_resp->failure_frame);
1858 1858
1859 freed = il4965_tx_queue_reclaim(priv, txq_id, index); 1859 freed = il4965_tx_queue_reclaim(il, txq_id, index);
1860 if (qc && likely(sta_id != IL_INVALID_STATION)) 1860 if (qc && likely(sta_id != IL_INVALID_STATION))
1861 il4965_free_tfds_in_queue(priv, sta_id, tid, freed); 1861 il4965_free_tfds_in_queue(il, sta_id, tid, freed);
1862 else if (sta_id == IL_INVALID_STATION) 1862 else if (sta_id == IL_INVALID_STATION)
1863 IL_DEBUG_TX_REPLY(priv, "Station not known\n"); 1863 IL_DEBUG_TX_REPLY(il, "Station not known\n");
1864 1864
1865 if (priv->mac80211_registered && 1865 if (il->mac80211_registered &&
1866 (il_queue_space(&txq->q) > txq->q.low_mark)) 1866 (il_queue_space(&txq->q) > txq->q.low_mark))
1867 il_wake_queue(priv, txq); 1867 il_wake_queue(il, txq);
1868 } 1868 }
1869 if (qc && likely(sta_id != IL_INVALID_STATION)) 1869 if (qc && likely(sta_id != IL_INVALID_STATION))
1870 il4965_txq_check_empty(priv, sta_id, tid, txq_id); 1870 il4965_txq_check_empty(il, sta_id, tid, txq_id);
1871 1871
1872 il4965_check_abort_status(priv, tx_resp->frame_count, status); 1872 il4965_check_abort_status(il, tx_resp->frame_count, status);
1873 1873
1874 spin_unlock_irqrestore(&priv->sta_lock, flags); 1874 spin_unlock_irqrestore(&il->sta_lock, flags);
1875} 1875}
1876 1876
1877static void il4965_rx_beacon_notif(struct il_priv *priv, 1877static void il4965_rx_beacon_notif(struct il_priv *il,
1878 struct il_rx_mem_buffer *rxb) 1878 struct il_rx_mem_buffer *rxb)
1879{ 1879{
1880 struct il_rx_packet *pkt = rxb_addr(rxb); 1880 struct il_rx_packet *pkt = rxb_addr(rxb);
@@ -1882,7 +1882,7 @@ static void il4965_rx_beacon_notif(struct il_priv *priv,
1882 u8 rate __maybe_unused = 1882 u8 rate __maybe_unused =
1883 il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); 1883 il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags);
1884 1884
1885 IL_DEBUG_RX(priv, "beacon status %#x, retries:%d ibssmgr:%d " 1885 IL_DEBUG_RX(il, "beacon status %#x, retries:%d ibssmgr:%d "
1886 "tsf:0x%.8x%.8x rate:%d\n", 1886 "tsf:0x%.8x%.8x rate:%d\n",
1887 le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, 1887 le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK,
1888 beacon->beacon_notify_hdr.failure_frame, 1888 beacon->beacon_notify_hdr.failure_frame,
@@ -1890,17 +1890,17 @@ static void il4965_rx_beacon_notif(struct il_priv *priv,
1890 le32_to_cpu(beacon->high_tsf), 1890 le32_to_cpu(beacon->high_tsf),
1891 le32_to_cpu(beacon->low_tsf), rate); 1891 le32_to_cpu(beacon->low_tsf), rate);
1892 1892
1893 priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); 1893 il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status);
1894} 1894}
1895 1895
1896/* Set up 4965-specific Rx frame reply handlers */ 1896/* Set up 4965-specific Rx frame reply handlers */
1897static void il4965_rx_handler_setup(struct il_priv *priv) 1897static void il4965_rx_handler_setup(struct il_priv *il)
1898{ 1898{
1899 /* Legacy Rx frames */ 1899 /* Legacy Rx frames */
1900 priv->rx_handlers[REPLY_RX] = il4965_rx_reply_rx; 1900 il->rx_handlers[REPLY_RX] = il4965_rx_reply_rx;
1901 /* Tx response */ 1901 /* Tx response */
1902 priv->rx_handlers[REPLY_TX] = il4965_rx_reply_tx; 1902 il->rx_handlers[REPLY_TX] = il4965_rx_reply_tx;
1903 priv->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif; 1903 il->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif;
1904} 1904}
1905 1905
1906static struct il_hcmd_ops il4965_hcmd = { 1906static struct il_hcmd_ops il4965_hcmd = {
@@ -1909,53 +1909,53 @@ static struct il_hcmd_ops il4965_hcmd = {
1909 .set_rxon_chain = il4965_set_rxon_chain, 1909 .set_rxon_chain = il4965_set_rxon_chain,
1910}; 1910};
1911 1911
1912static void il4965_post_scan(struct il_priv *priv) 1912static void il4965_post_scan(struct il_priv *il)
1913{ 1913{
1914 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; 1914 struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS];
1915 1915
1916 /* 1916 /*
1917 * Since setting the RXON may have been deferred while 1917 * Since setting the RXON may have been deferred while
1918 * performing the scan, fire one off if needed 1918 * performing the scan, fire one off if needed
1919 */ 1919 */
1920 if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) 1920 if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
1921 il_commit_rxon(priv, ctx); 1921 il_commit_rxon(il, ctx);
1922} 1922}
1923 1923
1924static void il4965_post_associate(struct il_priv *priv) 1924static void il4965_post_associate(struct il_priv *il)
1925{ 1925{
1926 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; 1926 struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS];
1927 struct ieee80211_vif *vif = ctx->vif; 1927 struct ieee80211_vif *vif = ctx->vif;
1928 struct ieee80211_conf *conf = NULL; 1928 struct ieee80211_conf *conf = NULL;
1929 int ret = 0; 1929 int ret = 0;
1930 1930
1931 if (!vif || !priv->is_open) 1931 if (!vif || !il->is_open)
1932 return; 1932 return;
1933 1933
1934 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1934 if (test_bit(STATUS_EXIT_PENDING, &il->status))
1935 return; 1935 return;
1936 1936
1937 il_scan_cancel_timeout(priv, 200); 1937 il_scan_cancel_timeout(il, 200);
1938 1938
1939 conf = il_ieee80211_get_hw_conf(priv->hw); 1939 conf = il_ieee80211_get_hw_conf(il->hw);
1940 1940
1941 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1941 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1942 il_commit_rxon(priv, ctx); 1942 il_commit_rxon(il, ctx);
1943 1943
1944 ret = il_send_rxon_timing(priv, ctx); 1944 ret = il_send_rxon_timing(il, ctx);
1945 if (ret) 1945 if (ret)
1946 IL_WARN(priv, "RXON timing - " 1946 IL_WARN(il, "RXON timing - "
1947 "Attempting to continue.\n"); 1947 "Attempting to continue.\n");
1948 1948
1949 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 1949 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
1950 1950
1951 il_set_rxon_ht(priv, &priv->current_ht_config); 1951 il_set_rxon_ht(il, &il->current_ht_config);
1952 1952
1953 if (priv->cfg->ops->hcmd->set_rxon_chain) 1953 if (il->cfg->ops->hcmd->set_rxon_chain)
1954 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); 1954 il->cfg->ops->hcmd->set_rxon_chain(il, ctx);
1955 1955
1956 ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid); 1956 ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid);
1957 1957
1958 IL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", 1958 IL_DEBUG_ASSOC(il, "assoc id %d beacon interval %d\n",
1959 vif->bss_conf.aid, vif->bss_conf.beacon_int); 1959 vif->bss_conf.aid, vif->bss_conf.beacon_int);
1960 1960
1961 if (vif->bss_conf.use_short_preamble) 1961 if (vif->bss_conf.use_short_preamble)
@@ -1970,19 +1970,19 @@ static void il4965_post_associate(struct il_priv *priv)
1970 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 1970 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
1971 } 1971 }
1972 1972
1973 il_commit_rxon(priv, ctx); 1973 il_commit_rxon(il, ctx);
1974 1974
1975 IL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", 1975 IL_DEBUG_ASSOC(il, "Associated as %d to: %pM\n",
1976 vif->bss_conf.aid, ctx->active.bssid_addr); 1976 vif->bss_conf.aid, ctx->active.bssid_addr);
1977 1977
1978 switch (vif->type) { 1978 switch (vif->type) {
1979 case NL80211_IFTYPE_STATION: 1979 case NL80211_IFTYPE_STATION:
1980 break; 1980 break;
1981 case NL80211_IFTYPE_ADHOC: 1981 case NL80211_IFTYPE_ADHOC:
1982 il4965_send_beacon_cmd(priv); 1982 il4965_send_beacon_cmd(il);
1983 break; 1983 break;
1984 default: 1984 default:
1985 IL_ERR(priv, "%s Should not be called in %d mode\n", 1985 IL_ERR(il, "%s Should not be called in %d mode\n",
1986 __func__, vif->type); 1986 __func__, vif->type);
1987 break; 1987 break;
1988 } 1988 }
@@ -1990,23 +1990,23 @@ static void il4965_post_associate(struct il_priv *priv)
1990 /* the chain noise calibration will enabled PM upon completion 1990 /* the chain noise calibration will enabled PM upon completion
1991 * If chain noise has already been run, then we need to enable 1991 * If chain noise has already been run, then we need to enable
1992 * power management here */ 1992 * power management here */
1993 if (priv->chain_noise_data.state == IL_CHAIN_NOISE_DONE) 1993 if (il->chain_noise_data.state == IL_CHAIN_NOISE_DONE)
1994 il_power_update_mode(priv, false); 1994 il_power_update_mode(il, false);
1995 1995
1996 /* Enable Rx differential gain and sensitivity calibrations */ 1996 /* Enable Rx differential gain and sensitivity calibrations */
1997 il4965_chain_noise_reset(priv); 1997 il4965_chain_noise_reset(il);
1998 priv->start_calib = 1; 1998 il->start_calib = 1;
1999} 1999}
2000 2000
2001static void il4965_config_ap(struct il_priv *priv) 2001static void il4965_config_ap(struct il_priv *il)
2002{ 2002{
2003 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; 2003 struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS];
2004 struct ieee80211_vif *vif = ctx->vif; 2004 struct ieee80211_vif *vif = ctx->vif;
2005 int ret = 0; 2005 int ret = 0;
2006 2006
2007 lockdep_assert_held(&priv->mutex); 2007 lockdep_assert_held(&il->mutex);
2008 2008
2009 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2009 if (test_bit(STATUS_EXIT_PENDING, &il->status))
2010 return; 2010 return;
2011 2011
2012 /* The following should be done only at AP bring up */ 2012 /* The following should be done only at AP bring up */
@@ -2014,20 +2014,20 @@ static void il4965_config_ap(struct il_priv *priv)
2014 2014
2015 /* RXON - unassoc (to set timing command) */ 2015 /* RXON - unassoc (to set timing command) */
2016 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2016 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2017 il_commit_rxon(priv, ctx); 2017 il_commit_rxon(il, ctx);
2018 2018
2019 /* RXON Timing */ 2019 /* RXON Timing */
2020 ret = il_send_rxon_timing(priv, ctx); 2020 ret = il_send_rxon_timing(il, ctx);
2021 if (ret) 2021 if (ret)
2022 IL_WARN(priv, "RXON timing failed - " 2022 IL_WARN(il, "RXON timing failed - "
2023 "Attempting to continue.\n"); 2023 "Attempting to continue.\n");
2024 2024
2025 /* AP has all antennas */ 2025 /* AP has all antennas */
2026 priv->chain_noise_data.active_chains = 2026 il->chain_noise_data.active_chains =
2027 priv->hw_params.valid_rx_ant; 2027 il->hw_params.valid_rx_ant;
2028 il_set_rxon_ht(priv, &priv->current_ht_config); 2028 il_set_rxon_ht(il, &il->current_ht_config);
2029 if (priv->cfg->ops->hcmd->set_rxon_chain) 2029 if (il->cfg->ops->hcmd->set_rxon_chain)
2030 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); 2030 il->cfg->ops->hcmd->set_rxon_chain(il, ctx);
2031 2031
2032 ctx->staging.assoc_id = 0; 2032 ctx->staging.assoc_id = 0;
2033 2033
@@ -2047,12 +2047,12 @@ static void il4965_config_ap(struct il_priv *priv)
2047 ~RXON_FLG_SHORT_SLOT_MSK; 2047 ~RXON_FLG_SHORT_SLOT_MSK;
2048 } 2048 }
2049 /* need to send beacon cmd before committing assoc RXON! */ 2049 /* need to send beacon cmd before committing assoc RXON! */
2050 il4965_send_beacon_cmd(priv); 2050 il4965_send_beacon_cmd(il);
2051 /* restore RXON assoc */ 2051 /* restore RXON assoc */
2052 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2052 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2053 il_commit_rxon(priv, ctx); 2053 il_commit_rxon(il, ctx);
2054 } 2054 }
2055 il4965_send_beacon_cmd(priv); 2055 il4965_send_beacon_cmd(il);
2056} 2056}
2057 2057
2058static struct il_hcmd_utils_ops il4965_hcmd_utils = { 2058static struct il_hcmd_utils_ops il4965_hcmd_utils = {