aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-10-24 09:41:30 -0400
committerStanislaw Gruszka <sgruszka@redhat.com>2011-11-15 05:16:58 -0500
commite2ebc8337d116acdc25469ec8547ae665f50a4c1 (patch)
treecf4401fdbf6dabbd2731d90e3105c1ebbf60f87d /drivers
parentfee005e5dd82a43546c1b1beb187e82415360940 (diff)
iwlegacy: rename iwl to il
iwl_legacy prefix result in long function names, what cause that we have frequent line split and not readable code. Also iwl_foo symbols are duplicated in iwlwifi driver, what is annoying when editing kernel tree with cscope. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c32
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h12
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-fh.h12
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-hw.h46
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-led.c14
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-led.h8
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-rs.c468
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945.c1200
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945.h186
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-calib.c210
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-calib.h16
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c32
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-debugfs.h12
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c26
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-hw.h82
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-led.c20
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-led.h10
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-lib.c380
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-rs.c1112
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-rx.c52
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-sta.c258
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-tx.c442
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-ucode.c50
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965.c846
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965.h202
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-commands.h506
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c994
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.h434
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-csr.h16
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-debug.h194
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-debugfs.c284
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-dev.h440
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-eeprom.c156
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-eeprom.h60
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-fh.h38
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-hcmd.c186
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-helpers.h66
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-io.h326
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-led.c60
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-led.h34
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-legacy-rs.h404
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-power.c64
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-power.h32
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-prph.h18
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-rx.c72
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-scan.c258
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-spectrum.h4
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-sta.c376
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-sta.h78
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-tx.c200
-rw-r--r--drivers/net/wireless/iwlegacy/iwl3945-base.c1664
-rw-r--r--drivers/net/wireless/iwlegacy/iwl4965-base.c1382
52 files changed, 7037 insertions, 7037 deletions
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c
index cfabb38793ab..954aed4e7b34 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c
@@ -29,7 +29,7 @@
29#include "iwl-3945-debugfs.h" 29#include "iwl-3945-debugfs.h"
30 30
31 31
32static int iwl3945_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz) 32static int il3945_statistics_flag(struct il_priv *priv, char *buf, int bufsz)
33{ 33{
34 int p = 0; 34 int p = 0;
35 35
@@ -50,11 +50,11 @@ static int iwl3945_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
50 return p; 50 return p;
51} 51}
52 52
53ssize_t iwl3945_ucode_rx_stats_read(struct file *file, 53ssize_t il3945_ucode_rx_stats_read(struct file *file,
54 char __user *user_buf, 54 char __user *user_buf,
55 size_t count, loff_t *ppos) 55 size_t count, loff_t *ppos)
56{ 56{
57 struct iwl_priv *priv = file->private_data; 57 struct il_priv *priv = file->private_data;
58 int pos = 0; 58 int pos = 0;
59 char *buf; 59 char *buf;
60 int bufsz = sizeof(struct iwl39_statistics_rx_phy) * 40 + 60 int bufsz = sizeof(struct iwl39_statistics_rx_phy) * 40 +
@@ -66,12 +66,12 @@ ssize_t iwl3945_ucode_rx_stats_read(struct file *file,
66 struct iwl39_statistics_rx_non_phy *general, *accum_general; 66 struct iwl39_statistics_rx_non_phy *general, *accum_general;
67 struct iwl39_statistics_rx_non_phy *delta_general, *max_general; 67 struct iwl39_statistics_rx_non_phy *delta_general, *max_general;
68 68
69 if (!iwl_legacy_is_alive(priv)) 69 if (!il_is_alive(priv))
70 return -EAGAIN; 70 return -EAGAIN;
71 71
72 buf = kzalloc(bufsz, GFP_KERNEL); 72 buf = kzalloc(bufsz, GFP_KERNEL);
73 if (!buf) { 73 if (!buf) {
74 IWL_ERR(priv, "Can not allocate Buffer\n"); 74 IL_ERR(priv, "Can not allocate Buffer\n");
75 return -ENOMEM; 75 return -ENOMEM;
76 } 76 }
77 77
@@ -93,7 +93,7 @@ ssize_t iwl3945_ucode_rx_stats_read(struct file *file,
93 max_cck = &priv->_3945.max_delta.rx.cck; 93 max_cck = &priv->_3945.max_delta.rx.cck;
94 max_general = &priv->_3945.max_delta.rx.general; 94 max_general = &priv->_3945.max_delta.rx.general;
95 95
96 pos += iwl3945_statistics_flag(priv, buf, bufsz); 96 pos += il3945_statistics_flag(priv, buf, bufsz);
97 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" 97 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
98 "acumulative delta max\n", 98 "acumulative delta max\n",
99 "Statistics_Rx - OFDM:"); 99 "Statistics_Rx - OFDM:");
@@ -325,23 +325,23 @@ ssize_t iwl3945_ucode_rx_stats_read(struct file *file,
325 return ret; 325 return ret;
326} 326}
327 327
328ssize_t iwl3945_ucode_tx_stats_read(struct file *file, 328ssize_t il3945_ucode_tx_stats_read(struct file *file,
329 char __user *user_buf, 329 char __user *user_buf,
330 size_t count, loff_t *ppos) 330 size_t count, loff_t *ppos)
331{ 331{
332 struct iwl_priv *priv = file->private_data; 332 struct il_priv *priv = file->private_data;
333 int pos = 0; 333 int pos = 0;
334 char *buf; 334 char *buf;
335 int bufsz = (sizeof(struct iwl39_statistics_tx) * 48) + 250; 335 int bufsz = (sizeof(struct iwl39_statistics_tx) * 48) + 250;
336 ssize_t ret; 336 ssize_t ret;
337 struct iwl39_statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; 337 struct iwl39_statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
338 338
339 if (!iwl_legacy_is_alive(priv)) 339 if (!il_is_alive(priv))
340 return -EAGAIN; 340 return -EAGAIN;
341 341
342 buf = kzalloc(bufsz, GFP_KERNEL); 342 buf = kzalloc(bufsz, GFP_KERNEL);
343 if (!buf) { 343 if (!buf) {
344 IWL_ERR(priv, "Can not allocate Buffer\n"); 344 IL_ERR(priv, "Can not allocate Buffer\n");
345 return -ENOMEM; 345 return -ENOMEM;
346 } 346 }
347 347
@@ -354,7 +354,7 @@ ssize_t iwl3945_ucode_tx_stats_read(struct file *file,
354 accum_tx = &priv->_3945.accum_statistics.tx; 354 accum_tx = &priv->_3945.accum_statistics.tx;
355 delta_tx = &priv->_3945.delta_statistics.tx; 355 delta_tx = &priv->_3945.delta_statistics.tx;
356 max_tx = &priv->_3945.max_delta.tx; 356 max_tx = &priv->_3945.max_delta.tx;
357 pos += iwl3945_statistics_flag(priv, buf, bufsz); 357 pos += il3945_statistics_flag(priv, buf, bufsz);
358 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" 358 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
359 "acumulative delta max\n", 359 "acumulative delta max\n",
360 "Statistics_Tx:"); 360 "Statistics_Tx:");
@@ -421,11 +421,11 @@ ssize_t iwl3945_ucode_tx_stats_read(struct file *file,
421 return ret; 421 return ret;
422} 422}
423 423
424ssize_t iwl3945_ucode_general_stats_read(struct file *file, 424ssize_t il3945_ucode_general_stats_read(struct file *file,
425 char __user *user_buf, 425 char __user *user_buf,
426 size_t count, loff_t *ppos) 426 size_t count, loff_t *ppos)
427{ 427{
428 struct iwl_priv *priv = file->private_data; 428 struct il_priv *priv = file->private_data;
429 int pos = 0; 429 int pos = 0;
430 char *buf; 430 char *buf;
431 int bufsz = sizeof(struct iwl39_statistics_general) * 10 + 300; 431 int bufsz = sizeof(struct iwl39_statistics_general) * 10 + 300;
@@ -435,12 +435,12 @@ ssize_t iwl3945_ucode_general_stats_read(struct file *file,
435 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; 435 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
436 struct iwl39_statistics_div *div, *accum_div, *delta_div, *max_div; 436 struct iwl39_statistics_div *div, *accum_div, *delta_div, *max_div;
437 437
438 if (!iwl_legacy_is_alive(priv)) 438 if (!il_is_alive(priv))
439 return -EAGAIN; 439 return -EAGAIN;
440 440
441 buf = kzalloc(bufsz, GFP_KERNEL); 441 buf = kzalloc(bufsz, GFP_KERNEL);
442 if (!buf) { 442 if (!buf) {
443 IWL_ERR(priv, "Can not allocate Buffer\n"); 443 IL_ERR(priv, "Can not allocate Buffer\n");
444 return -ENOMEM; 444 return -ENOMEM;
445 } 445 }
446 446
@@ -461,7 +461,7 @@ ssize_t iwl3945_ucode_general_stats_read(struct file *file,
461 accum_div = &priv->_3945.accum_statistics.general.div; 461 accum_div = &priv->_3945.accum_statistics.general.div;
462 delta_div = &priv->_3945.delta_statistics.general.div; 462 delta_div = &priv->_3945.delta_statistics.general.div;
463 max_div = &priv->_3945.max_delta.general.div; 463 max_div = &priv->_3945.max_delta.general.div;
464 pos += iwl3945_statistics_flag(priv, buf, bufsz); 464 pos += il3945_statistics_flag(priv, buf, bufsz);
465 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" 465 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
466 "acumulative delta max\n", 466 "acumulative delta max\n",
467 "Statistics_General:"); 467 "Statistics_General:");
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h
index 8fef4b32b447..54334ac02788 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h
@@ -31,27 +31,27 @@
31#include "iwl-debug.h" 31#include "iwl-debug.h"
32 32
33#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 33#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
34ssize_t iwl3945_ucode_rx_stats_read(struct file *file, char __user *user_buf, 34ssize_t il3945_ucode_rx_stats_read(struct file *file, char __user *user_buf,
35 size_t count, loff_t *ppos); 35 size_t count, loff_t *ppos);
36ssize_t iwl3945_ucode_tx_stats_read(struct file *file, char __user *user_buf, 36ssize_t il3945_ucode_tx_stats_read(struct file *file, char __user *user_buf,
37 size_t count, loff_t *ppos); 37 size_t count, loff_t *ppos);
38ssize_t iwl3945_ucode_general_stats_read(struct file *file, 38ssize_t il3945_ucode_general_stats_read(struct file *file,
39 char __user *user_buf, size_t count, 39 char __user *user_buf, size_t count,
40 loff_t *ppos); 40 loff_t *ppos);
41#else 41#else
42static ssize_t iwl3945_ucode_rx_stats_read(struct file *file, 42static ssize_t il3945_ucode_rx_stats_read(struct file *file,
43 char __user *user_buf, size_t count, 43 char __user *user_buf, size_t count,
44 loff_t *ppos) 44 loff_t *ppos)
45{ 45{
46 return 0; 46 return 0;
47} 47}
48static ssize_t iwl3945_ucode_tx_stats_read(struct file *file, 48static ssize_t il3945_ucode_tx_stats_read(struct file *file,
49 char __user *user_buf, size_t count, 49 char __user *user_buf, size_t count,
50 loff_t *ppos) 50 loff_t *ppos)
51{ 51{
52 return 0; 52 return 0;
53} 53}
54static ssize_t iwl3945_ucode_general_stats_read(struct file *file, 54static ssize_t il3945_ucode_general_stats_read(struct file *file,
55 char __user *user_buf, 55 char __user *user_buf,
56 size_t count, loff_t *ppos) 56 size_t count, loff_t *ppos)
57{ 57{
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-fh.h b/drivers/net/wireless/iwlegacy/iwl-3945-fh.h
index 836c9919f82e..b98cabb2ee10 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-fh.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-fh.h
@@ -60,8 +60,8 @@
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 * 61 *
62 *****************************************************************************/ 62 *****************************************************************************/
63#ifndef __iwl_3945_fh_h__ 63#ifndef __il_3945_fh_h__
64#define __iwl_3945_fh_h__ 64#define __il_3945_fh_h__
65 65
66/************************************/ 66/************************************/
67/* iwl3945 Flow Handler Definitions */ 67/* iwl3945 Flow Handler Definitions */
@@ -172,16 +172,16 @@
172 172
173#define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) 173#define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000)
174 174
175struct iwl3945_tfd_tb { 175struct il3945_tfd_tb {
176 __le32 addr; 176 __le32 addr;
177 __le32 len; 177 __le32 len;
178} __packed; 178} __packed;
179 179
180struct iwl3945_tfd { 180struct il3945_tfd {
181 __le32 control_flags; 181 __le32 control_flags;
182 struct iwl3945_tfd_tb tbs[4]; 182 struct il3945_tfd_tb tbs[4];
183 u8 __pad[28]; 183 u8 __pad[28];
184} __packed; 184} __packed;
185 185
186 186
187#endif /* __iwl_3945_fh_h__ */ 187#endif /* __il_3945_fh_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
index 5c3a68d3af12..ad0509378714 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
@@ -66,8 +66,8 @@
66 * Please use iwl-3945.h for driver implementation definitions. 66 * Please use iwl-3945.h for driver implementation definitions.
67 */ 67 */
68 68
69#ifndef __iwl_3945_hw__ 69#ifndef __il_3945_hw__
70#define __iwl_3945_hw__ 70#define __il_3945_hw__
71 71
72#include "iwl-eeprom.h" 72#include "iwl-eeprom.h"
73 73
@@ -90,7 +90,7 @@
90 * Data copied from EEPROM. 90 * Data copied from EEPROM.
91 * DO NOT ALTER THIS STRUCTURE!!! 91 * DO NOT ALTER THIS STRUCTURE!!!
92 */ 92 */
93struct iwl3945_eeprom_txpower_sample { 93struct il3945_eeprom_txpower_sample {
94 u8 gain_index; /* index into power (gain) setup table ... */ 94 u8 gain_index; /* index into power (gain) setup table ... */
95 s8 power; /* ... for this pwr level for this chnl group */ 95 s8 power; /* ... for this pwr level for this chnl group */
96 u16 v_det; /* PA output voltage */ 96 u16 v_det; /* PA output voltage */
@@ -104,8 +104,8 @@ struct iwl3945_eeprom_txpower_sample {
104 * Data copied from EEPROM. 104 * Data copied from EEPROM.
105 * DO NOT ALTER THIS STRUCTURE!!! 105 * DO NOT ALTER THIS STRUCTURE!!!
106 */ 106 */
107struct iwl3945_eeprom_txpower_group { 107struct il3945_eeprom_txpower_group {
108 struct iwl3945_eeprom_txpower_sample samples[5]; /* 5 power levels */ 108 struct il3945_eeprom_txpower_sample samples[5]; /* 5 power levels */
109 s32 a, b, c, d, e; /* coefficients for voltage->power 109 s32 a, b, c, d, e; /* coefficients for voltage->power
110 * formula (signed) */ 110 * formula (signed) */
111 s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on 111 s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on
@@ -123,7 +123,7 @@ struct iwl3945_eeprom_txpower_group {
123 * difference between current temperature and factory calib temperature. 123 * difference between current temperature and factory calib temperature.
124 * Data copied from EEPROM. 124 * Data copied from EEPROM.
125 */ 125 */
126struct iwl3945_eeprom_temperature_corr { 126struct il3945_eeprom_temperature_corr {
127 u32 Ta; 127 u32 Ta;
128 u32 Tb; 128 u32 Tb;
129 u32 Tc; 129 u32 Tc;
@@ -134,7 +134,7 @@ struct iwl3945_eeprom_temperature_corr {
134/* 134/*
135 * EEPROM map 135 * EEPROM map
136 */ 136 */
137struct iwl3945_eeprom { 137struct il3945_eeprom {
138 u8 reserved0[16]; 138 u8 reserved0[16];
139 u16 device_id; /* abs.ofs: 16 */ 139 u16 device_id; /* abs.ofs: 16 */
140 u8 reserved1[2]; 140 u8 reserved1[2];
@@ -171,7 +171,7 @@ struct iwl3945_eeprom {
171 * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 171 * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
172 */ 172 */
173 u16 band_1_count; /* abs.ofs: 196 */ 173 u16 band_1_count; /* abs.ofs: 196 */
174 struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 198 */ 174 struct il_eeprom_channel band_1_channels[14]; /* abs.ofs: 198 */
175 175
176/* 176/*
177 * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196, 177 * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196,
@@ -179,38 +179,38 @@ struct iwl3945_eeprom {
179 * (4915-5080MHz) (none of these is ever supported) 179 * (4915-5080MHz) (none of these is ever supported)
180 */ 180 */
181 u16 band_2_count; /* abs.ofs: 226 */ 181 u16 band_2_count; /* abs.ofs: 226 */
182 struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ 182 struct il_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
183 183
184/* 184/*
185 * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 185 * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
186 * (5170-5320MHz) 186 * (5170-5320MHz)
187 */ 187 */
188 u16 band_3_count; /* abs.ofs: 254 */ 188 u16 band_3_count; /* abs.ofs: 254 */
189 struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ 189 struct il_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
190 190
191/* 191/*
192 * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 192 * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
193 * (5500-5700MHz) 193 * (5500-5700MHz)
194 */ 194 */
195 u16 band_4_count; /* abs.ofs: 280 */ 195 u16 band_4_count; /* abs.ofs: 280 */
196 struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ 196 struct il_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
197 197
198/* 198/*
199 * 5.7 GHz channels 145, 149, 153, 157, 161, 165 199 * 5.7 GHz channels 145, 149, 153, 157, 161, 165
200 * (5725-5825MHz) 200 * (5725-5825MHz)
201 */ 201 */
202 u16 band_5_count; /* abs.ofs: 304 */ 202 u16 band_5_count; /* abs.ofs: 304 */
203 struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ 203 struct il_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
204 204
205 u8 reserved9[194]; 205 u8 reserved9[194];
206 206
207/* 207/*
208 * 3945 Txpower calibration data. 208 * 3945 Txpower calibration data.
209 */ 209 */
210#define IWL_NUM_TX_CALIB_GROUPS 5 210#define IL_NUM_TX_CALIB_GROUPS 5
211 struct iwl3945_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS]; 211 struct il3945_eeprom_txpower_group groups[IL_NUM_TX_CALIB_GROUPS];
212/* abs.ofs: 512 */ 212/* abs.ofs: 512 */
213 struct iwl3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ 213 struct il3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */
214 u8 reserved16[172]; /* fill out to full 1024 byte block */ 214 u8 reserved16[172]; /* fill out to full 1024 byte block */
215} __packed; 215} __packed;
216 216
@@ -225,7 +225,7 @@ struct iwl3945_eeprom {
225#define IWL39_NUM_QUEUES 5 225#define IWL39_NUM_QUEUES 5
226#define IWL39_CMD_QUEUE_NUM 4 226#define IWL39_CMD_QUEUE_NUM 4
227 227
228#define IWL_DEFAULT_TX_RETRY 15 228#define IL_DEFAULT_TX_RETRY 15
229 229
230/*********************************************/ 230/*********************************************/
231 231
@@ -262,29 +262,29 @@ struct iwl3945_eeprom {
262/* Size of uCode instruction memory in bootstrap state machine */ 262/* Size of uCode instruction memory in bootstrap state machine */
263#define IWL39_MAX_BSM_SIZE IWL39_RTC_INST_SIZE 263#define IWL39_MAX_BSM_SIZE IWL39_RTC_INST_SIZE
264 264
265static inline int iwl3945_hw_valid_rtc_data_addr(u32 addr) 265static inline int il3945_hw_valid_rtc_data_addr(u32 addr)
266{ 266{
267 return (addr >= IWL39_RTC_DATA_LOWER_BOUND) && 267 return (addr >= IWL39_RTC_DATA_LOWER_BOUND) &&
268 (addr < IWL39_RTC_DATA_UPPER_BOUND); 268 (addr < IWL39_RTC_DATA_UPPER_BOUND);
269} 269}
270 270
271/* Base physical address of iwl3945_shared is provided to FH_TSSR_CBB_BASE 271/* Base physical address of il3945_shared is provided to FH_TSSR_CBB_BASE
272 * and &iwl3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */ 272 * and &il3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */
273struct iwl3945_shared { 273struct il3945_shared {
274 __le32 tx_base_ptr[8]; 274 __le32 tx_base_ptr[8];
275} __packed; 275} __packed;
276 276
277static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags) 277static inline u8 il3945_hw_get_rate(__le16 rate_n_flags)
278{ 278{
279 return le16_to_cpu(rate_n_flags) & 0xFF; 279 return le16_to_cpu(rate_n_flags) & 0xFF;
280} 280}
281 281
282static inline u16 iwl3945_hw_get_rate_n_flags(__le16 rate_n_flags) 282static inline u16 il3945_hw_get_rate_n_flags(__le16 rate_n_flags)
283{ 283{
284 return le16_to_cpu(rate_n_flags); 284 return le16_to_cpu(rate_n_flags);
285} 285}
286 286
287static inline __le16 iwl3945_hw_set_rate_n_flags(u8 rate, u16 flags) 287static inline __le16 il3945_hw_set_rate_n_flags(u8 rate, u16 flags)
288{ 288{
289 return cpu_to_le16((u16)rate|flags); 289 return cpu_to_le16((u16)rate|flags);
290} 290}
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-led.c b/drivers/net/wireless/iwlegacy/iwl-3945-led.c
index 7a7f0f38c8ab..69703b07bd69 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-led.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-led.c
@@ -44,20 +44,20 @@
44 44
45 45
46/* Send led command */ 46/* Send led command */
47static int iwl3945_send_led_cmd(struct iwl_priv *priv, 47static int il3945_send_led_cmd(struct il_priv *priv,
48 struct iwl_led_cmd *led_cmd) 48 struct il_led_cmd *led_cmd)
49{ 49{
50 struct iwl_host_cmd cmd = { 50 struct il_host_cmd cmd = {
51 .id = REPLY_LEDS_CMD, 51 .id = REPLY_LEDS_CMD,
52 .len = sizeof(struct iwl_led_cmd), 52 .len = sizeof(struct il_led_cmd),
53 .data = led_cmd, 53 .data = led_cmd,
54 .flags = CMD_ASYNC, 54 .flags = CMD_ASYNC,
55 .callback = NULL, 55 .callback = NULL,
56 }; 56 };
57 57
58 return iwl_legacy_send_cmd(priv, &cmd); 58 return il_send_cmd(priv, &cmd);
59} 59}
60 60
61const struct iwl_led_ops iwl3945_led_ops = { 61const struct il_led_ops il3945_led_ops = {
62 .cmd = iwl3945_send_led_cmd, 62 .cmd = il3945_send_led_cmd,
63}; 63};
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-led.h b/drivers/net/wireless/iwlegacy/iwl-3945-led.h
index 96716276eb0d..369c72d5cd68 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-led.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-led.h
@@ -24,9 +24,9 @@
24 * 24 *
25 *****************************************************************************/ 25 *****************************************************************************/
26 26
27#ifndef __iwl_3945_led_h__ 27#ifndef __il_3945_led_h__
28#define __iwl_3945_led_h__ 28#define __il_3945_led_h__
29 29
30extern const struct iwl_led_ops iwl3945_led_ops; 30extern const struct il_led_ops il3945_led_ops;
31 31
32#endif /* __iwl_3945_led_h__ */ 32#endif /* __il_3945_led_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
index 8faeaf2dddec..d97f24bfc451 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
@@ -42,80 +42,80 @@
42 42
43#define RS_NAME "iwl-3945-rs" 43#define RS_NAME "iwl-3945-rs"
44 44
45static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT_3945] = { 45static s32 il3945_expected_tpt_g[IL_RATE_COUNT_3945] = {
46 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 46 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202
47}; 47};
48 48
49static s32 iwl3945_expected_tpt_g_prot[IWL_RATE_COUNT_3945] = { 49static s32 il3945_expected_tpt_g_prot[IL_RATE_COUNT_3945] = {
50 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125 50 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125
51}; 51};
52 52
53static s32 iwl3945_expected_tpt_a[IWL_RATE_COUNT_3945] = { 53static s32 il3945_expected_tpt_a[IL_RATE_COUNT_3945] = {
54 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186 54 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186
55}; 55};
56 56
57static s32 iwl3945_expected_tpt_b[IWL_RATE_COUNT_3945] = { 57static s32 il3945_expected_tpt_b[IL_RATE_COUNT_3945] = {
58 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0 58 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0
59}; 59};
60 60
61struct iwl3945_tpt_entry { 61struct il3945_tpt_entry {
62 s8 min_rssi; 62 s8 min_rssi;
63 u8 index; 63 u8 index;
64}; 64};
65 65
66static struct iwl3945_tpt_entry iwl3945_tpt_table_a[] = { 66static struct il3945_tpt_entry il3945_tpt_table_a[] = {
67 {-60, IWL_RATE_54M_INDEX}, 67 {-60, IL_RATE_54M_INDEX},
68 {-64, IWL_RATE_48M_INDEX}, 68 {-64, IL_RATE_48M_INDEX},
69 {-72, IWL_RATE_36M_INDEX}, 69 {-72, IL_RATE_36M_INDEX},
70 {-80, IWL_RATE_24M_INDEX}, 70 {-80, IL_RATE_24M_INDEX},
71 {-84, IWL_RATE_18M_INDEX}, 71 {-84, IL_RATE_18M_INDEX},
72 {-85, IWL_RATE_12M_INDEX}, 72 {-85, IL_RATE_12M_INDEX},
73 {-87, IWL_RATE_9M_INDEX}, 73 {-87, IL_RATE_9M_INDEX},
74 {-89, IWL_RATE_6M_INDEX} 74 {-89, IL_RATE_6M_INDEX}
75}; 75};
76 76
77static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = { 77static struct il3945_tpt_entry il3945_tpt_table_g[] = {
78 {-60, IWL_RATE_54M_INDEX}, 78 {-60, IL_RATE_54M_INDEX},
79 {-64, IWL_RATE_48M_INDEX}, 79 {-64, IL_RATE_48M_INDEX},
80 {-68, IWL_RATE_36M_INDEX}, 80 {-68, IL_RATE_36M_INDEX},
81 {-80, IWL_RATE_24M_INDEX}, 81 {-80, IL_RATE_24M_INDEX},
82 {-84, IWL_RATE_18M_INDEX}, 82 {-84, IL_RATE_18M_INDEX},
83 {-85, IWL_RATE_12M_INDEX}, 83 {-85, IL_RATE_12M_INDEX},
84 {-86, IWL_RATE_11M_INDEX}, 84 {-86, IL_RATE_11M_INDEX},
85 {-88, IWL_RATE_5M_INDEX}, 85 {-88, IL_RATE_5M_INDEX},
86 {-90, IWL_RATE_2M_INDEX}, 86 {-90, IL_RATE_2M_INDEX},
87 {-92, IWL_RATE_1M_INDEX} 87 {-92, IL_RATE_1M_INDEX}
88}; 88};
89 89
90#define IWL_RATE_MAX_WINDOW 62 90#define IL_RATE_MAX_WINDOW 62
91#define IWL_RATE_FLUSH (3*HZ) 91#define IL_RATE_FLUSH (3*HZ)
92#define IWL_RATE_WIN_FLUSH (HZ/2) 92#define IL_RATE_WIN_FLUSH (HZ/2)
93#define IWL39_RATE_HIGH_TH 11520 93#define IWL39_RATE_HIGH_TH 11520
94#define IWL_SUCCESS_UP_TH 8960 94#define IL_SUCCESS_UP_TH 8960
95#define IWL_SUCCESS_DOWN_TH 10880 95#define IL_SUCCESS_DOWN_TH 10880
96#define IWL_RATE_MIN_FAILURE_TH 6 96#define IL_RATE_MIN_FAILURE_TH 6
97#define IWL_RATE_MIN_SUCCESS_TH 8 97#define IL_RATE_MIN_SUCCESS_TH 8
98#define IWL_RATE_DECREASE_TH 1920 98#define IL_RATE_DECREASE_TH 1920
99#define IWL_RATE_RETRY_TH 15 99#define IL_RATE_RETRY_TH 15
100 100
101static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) 101static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band)
102{ 102{
103 u32 index = 0; 103 u32 index = 0;
104 u32 table_size = 0; 104 u32 table_size = 0;
105 struct iwl3945_tpt_entry *tpt_table = NULL; 105 struct il3945_tpt_entry *tpt_table = NULL;
106 106
107 if ((rssi < IWL_MIN_RSSI_VAL) || (rssi > IWL_MAX_RSSI_VAL)) 107 if ((rssi < IL_MIN_RSSI_VAL) || (rssi > IL_MAX_RSSI_VAL))
108 rssi = IWL_MIN_RSSI_VAL; 108 rssi = IL_MIN_RSSI_VAL;
109 109
110 switch (band) { 110 switch (band) {
111 case IEEE80211_BAND_2GHZ: 111 case IEEE80211_BAND_2GHZ:
112 tpt_table = iwl3945_tpt_table_g; 112 tpt_table = il3945_tpt_table_g;
113 table_size = ARRAY_SIZE(iwl3945_tpt_table_g); 113 table_size = ARRAY_SIZE(il3945_tpt_table_g);
114 break; 114 break;
115 115
116 case IEEE80211_BAND_5GHZ: 116 case IEEE80211_BAND_5GHZ:
117 tpt_table = iwl3945_tpt_table_a; 117 tpt_table = il3945_tpt_table_a;
118 table_size = ARRAY_SIZE(iwl3945_tpt_table_a); 118 table_size = ARRAY_SIZE(il3945_tpt_table_a);
119 break; 119 break;
120 120
121 default: 121 default:
@@ -131,46 +131,46 @@ static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band)
131 return tpt_table[index].index; 131 return tpt_table[index].index;
132} 132}
133 133
134static void iwl3945_clear_window(struct iwl3945_rate_scale_data *window) 134static void il3945_clear_window(struct il3945_rate_scale_data *window)
135{ 135{
136 window->data = 0; 136 window->data = 0;
137 window->success_counter = 0; 137 window->success_counter = 0;
138 window->success_ratio = -1; 138 window->success_ratio = -1;
139 window->counter = 0; 139 window->counter = 0;
140 window->average_tpt = IWL_INVALID_VALUE; 140 window->average_tpt = IL_INVALID_VALUE;
141 window->stamp = 0; 141 window->stamp = 0;
142} 142}
143 143
144/** 144/**
145 * iwl3945_rate_scale_flush_windows - flush out the rate scale windows 145 * il3945_rate_scale_flush_windows - flush out the rate scale windows
146 * 146 *
147 * Returns the number of windows that have gathered data but were 147 * Returns the number of windows that have gathered data but were
148 * not flushed. If there were any that were not flushed, then 148 * not flushed. If there were any that were not flushed, then
149 * reschedule the rate flushing routine. 149 * reschedule the rate flushing routine.
150 */ 150 */
151static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta) 151static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta)
152{ 152{
153 int unflushed = 0; 153 int unflushed = 0;
154 int i; 154 int i;
155 unsigned long flags; 155 unsigned long flags;
156 struct iwl_priv *priv __maybe_unused = rs_sta->priv; 156 struct il_priv *priv __maybe_unused = rs_sta->priv;
157 157
158 /* 158 /*
159 * For each rate, if we have collected data on that rate 159 * For each rate, if we have collected data on that rate
160 * and it has been more than IWL_RATE_WIN_FLUSH 160 * and it has been more than IL_RATE_WIN_FLUSH
161 * since we flushed, clear out the gathered statistics 161 * since we flushed, clear out the gathered statistics
162 */ 162 */
163 for (i = 0; i < IWL_RATE_COUNT_3945; i++) { 163 for (i = 0; i < IL_RATE_COUNT_3945; i++) {
164 if (!rs_sta->win[i].counter) 164 if (!rs_sta->win[i].counter)
165 continue; 165 continue;
166 166
167 spin_lock_irqsave(&rs_sta->lock, flags); 167 spin_lock_irqsave(&rs_sta->lock, flags);
168 if (time_after(jiffies, rs_sta->win[i].stamp + 168 if (time_after(jiffies, rs_sta->win[i].stamp +
169 IWL_RATE_WIN_FLUSH)) { 169 IL_RATE_WIN_FLUSH)) {
170 IWL_DEBUG_RATE(priv, "flushing %d samples of rate " 170 IL_DEBUG_RATE(priv, "flushing %d samples of rate "
171 "index %d\n", 171 "index %d\n",
172 rs_sta->win[i].counter, i); 172 rs_sta->win[i].counter, i);
173 iwl3945_clear_window(&rs_sta->win[i]); 173 il3945_clear_window(&rs_sta->win[i]);
174 } else 174 } else
175 unflushed++; 175 unflushed++;
176 spin_unlock_irqrestore(&rs_sta->lock, flags); 176 spin_unlock_irqrestore(&rs_sta->lock, flags);
@@ -179,21 +179,21 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta)
179 return unflushed; 179 return unflushed;
180} 180}
181 181
182#define IWL_RATE_FLUSH_MAX 5000 /* msec */ 182#define IL_RATE_FLUSH_MAX 5000 /* msec */
183#define IWL_RATE_FLUSH_MIN 50 /* msec */ 183#define IL_RATE_FLUSH_MIN 50 /* msec */
184#define IWL_AVERAGE_PACKETS 1500 184#define IL_AVERAGE_PACKETS 1500
185 185
186static void iwl3945_bg_rate_scale_flush(unsigned long data) 186static void il3945_bg_rate_scale_flush(unsigned long data)
187{ 187{
188 struct iwl3945_rs_sta *rs_sta = (void *)data; 188 struct il3945_rs_sta *rs_sta = (void *)data;
189 struct iwl_priv *priv __maybe_unused = rs_sta->priv; 189 struct il_priv *priv __maybe_unused = rs_sta->priv;
190 int unflushed = 0; 190 int unflushed = 0;
191 unsigned long flags; 191 unsigned long flags;
192 u32 packet_count, duration, pps; 192 u32 packet_count, duration, pps;
193 193
194 IWL_DEBUG_RATE(priv, "enter\n"); 194 IL_DEBUG_RATE(priv, "enter\n");
195 195
196 unflushed = iwl3945_rate_scale_flush_windows(rs_sta); 196 unflushed = il3945_rate_scale_flush_windows(rs_sta);
197 197
198 spin_lock_irqsave(&rs_sta->lock, flags); 198 spin_lock_irqsave(&rs_sta->lock, flags);
199 199
@@ -206,7 +206,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
206 duration = 206 duration =
207 jiffies_to_msecs(jiffies - rs_sta->last_partial_flush); 207 jiffies_to_msecs(jiffies - rs_sta->last_partial_flush);
208 208
209 IWL_DEBUG_RATE(priv, "Tx'd %d packets in %dms\n", 209 IL_DEBUG_RATE(priv, "Tx'd %d packets in %dms\n",
210 packet_count, duration); 210 packet_count, duration);
211 211
212 /* Determine packets per second */ 212 /* Determine packets per second */
@@ -216,17 +216,17 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
216 pps = 0; 216 pps = 0;
217 217
218 if (pps) { 218 if (pps) {
219 duration = (IWL_AVERAGE_PACKETS * 1000) / pps; 219 duration = (IL_AVERAGE_PACKETS * 1000) / pps;
220 if (duration < IWL_RATE_FLUSH_MIN) 220 if (duration < IL_RATE_FLUSH_MIN)
221 duration = IWL_RATE_FLUSH_MIN; 221 duration = IL_RATE_FLUSH_MIN;
222 else if (duration > IWL_RATE_FLUSH_MAX) 222 else if (duration > IL_RATE_FLUSH_MAX)
223 duration = IWL_RATE_FLUSH_MAX; 223 duration = IL_RATE_FLUSH_MAX;
224 } else 224 } else
225 duration = IWL_RATE_FLUSH_MAX; 225 duration = IL_RATE_FLUSH_MAX;
226 226
227 rs_sta->flush_time = msecs_to_jiffies(duration); 227 rs_sta->flush_time = msecs_to_jiffies(duration);
228 228
229 IWL_DEBUG_RATE(priv, "new flush period: %d msec ave %d\n", 229 IL_DEBUG_RATE(priv, "new flush period: %d msec ave %d\n",
230 duration, packet_count); 230 duration, packet_count);
231 231
232 mod_timer(&rs_sta->rate_scale_flush, jiffies + 232 mod_timer(&rs_sta->rate_scale_flush, jiffies +
@@ -234,7 +234,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
234 234
235 rs_sta->last_partial_flush = jiffies; 235 rs_sta->last_partial_flush = jiffies;
236 } else { 236 } else {
237 rs_sta->flush_time = IWL_RATE_FLUSH; 237 rs_sta->flush_time = IL_RATE_FLUSH;
238 rs_sta->flush_pending = 0; 238 rs_sta->flush_pending = 0;
239 } 239 }
240 /* If there weren't any unflushed entries, we don't schedule the timer 240 /* If there weren't any unflushed entries, we don't schedule the timer
@@ -244,26 +244,26 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
244 244
245 spin_unlock_irqrestore(&rs_sta->lock, flags); 245 spin_unlock_irqrestore(&rs_sta->lock, flags);
246 246
247 IWL_DEBUG_RATE(priv, "leave\n"); 247 IL_DEBUG_RATE(priv, "leave\n");
248} 248}
249 249
250/** 250/**
251 * iwl3945_collect_tx_data - Update the success/failure sliding window 251 * il3945_collect_tx_data - Update the success/failure sliding window
252 * 252 *
253 * We keep a sliding window of the last 64 packets transmitted 253 * We keep a sliding window of the last 64 packets transmitted
254 * at this rate. window->data contains the bitmask of successful 254 * at this rate. window->data contains the bitmask of successful
255 * packets. 255 * packets.
256 */ 256 */
257static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, 257static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
258 struct iwl3945_rate_scale_data *window, 258 struct il3945_rate_scale_data *window,
259 int success, int retries, int index) 259 int success, int retries, int index)
260{ 260{
261 unsigned long flags; 261 unsigned long flags;
262 s32 fail_count; 262 s32 fail_count;
263 struct iwl_priv *priv __maybe_unused = rs_sta->priv; 263 struct il_priv *priv __maybe_unused = rs_sta->priv;
264 264
265 if (!retries) { 265 if (!retries) {
266 IWL_DEBUG_RATE(priv, "leave: retries == 0 -- should be at least 1\n"); 266 IL_DEBUG_RATE(priv, "leave: retries == 0 -- should be at least 1\n");
267 return; 267 return;
268 } 268 }
269 269
@@ -278,13 +278,13 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
278 * we keep these bitmaps!). 278 * we keep these bitmaps!).
279 * */ 279 * */
280 while (retries > 0) { 280 while (retries > 0) {
281 if (window->counter >= IWL_RATE_MAX_WINDOW) { 281 if (window->counter >= IL_RATE_MAX_WINDOW) {
282 282
283 /* remove earliest */ 283 /* remove earliest */
284 window->counter = IWL_RATE_MAX_WINDOW - 1; 284 window->counter = IL_RATE_MAX_WINDOW - 1;
285 285
286 if (window->data & (1ULL << (IWL_RATE_MAX_WINDOW - 1))) { 286 if (window->data & (1ULL << (IL_RATE_MAX_WINDOW - 1))) {
287 window->data &= ~(1ULL << (IWL_RATE_MAX_WINDOW - 1)); 287 window->data &= ~(1ULL << (IL_RATE_MAX_WINDOW - 1));
288 window->success_counter--; 288 window->success_counter--;
289 } 289 }
290 } 290 }
@@ -310,17 +310,17 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
310 window->success_ratio = 128 * (100 * window->success_counter) 310 window->success_ratio = 128 * (100 * window->success_counter)
311 / window->counter; 311 / window->counter;
312 else 312 else
313 window->success_ratio = IWL_INVALID_VALUE; 313 window->success_ratio = IL_INVALID_VALUE;
314 314
315 fail_count = window->counter - window->success_counter; 315 fail_count = window->counter - window->success_counter;
316 316
317 /* Calculate average throughput, if we have enough history. */ 317 /* Calculate average throughput, if we have enough history. */
318 if ((fail_count >= IWL_RATE_MIN_FAILURE_TH) || 318 if ((fail_count >= IL_RATE_MIN_FAILURE_TH) ||
319 (window->success_counter >= IWL_RATE_MIN_SUCCESS_TH)) 319 (window->success_counter >= IL_RATE_MIN_SUCCESS_TH))
320 window->average_tpt = ((window->success_ratio * 320 window->average_tpt = ((window->success_ratio *
321 rs_sta->expected_tpt[index] + 64) / 128); 321 rs_sta->expected_tpt[index] + 64) / 128);
322 else 322 else
323 window->average_tpt = IWL_INVALID_VALUE; 323 window->average_tpt = IL_INVALID_VALUE;
324 324
325 /* Tag this window as having been updated */ 325 /* Tag this window as having been updated */
326 window->stamp = jiffies; 326 window->stamp = jiffies;
@@ -332,40 +332,40 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
332/* 332/*
333 * Called after adding a new station to initialize rate scaling 333 * Called after adding a new station to initialize rate scaling
334 */ 334 */
335void iwl3945_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_id) 335void il3945_rs_rate_init(struct il_priv *priv, struct ieee80211_sta *sta, u8 sta_id)
336{ 336{
337 struct ieee80211_hw *hw = priv->hw; 337 struct ieee80211_hw *hw = priv->hw;
338 struct ieee80211_conf *conf = &priv->hw->conf; 338 struct ieee80211_conf *conf = &priv->hw->conf;
339 struct iwl3945_sta_priv *psta; 339 struct il3945_sta_priv *psta;
340 struct iwl3945_rs_sta *rs_sta; 340 struct il3945_rs_sta *rs_sta;
341 struct ieee80211_supported_band *sband; 341 struct ieee80211_supported_band *sband;
342 int i; 342 int i;
343 343
344 IWL_DEBUG_INFO(priv, "enter\n"); 344 IL_DEBUG_INFO(priv, "enter\n");
345 if (sta_id == priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id) 345 if (sta_id == priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id)
346 goto out; 346 goto out;
347 347
348 psta = (struct iwl3945_sta_priv *) sta->drv_priv; 348 psta = (struct il3945_sta_priv *) sta->drv_priv;
349 rs_sta = &psta->rs_sta; 349 rs_sta = &psta->rs_sta;
350 sband = hw->wiphy->bands[conf->channel->band]; 350 sband = hw->wiphy->bands[conf->channel->band];
351 351
352 rs_sta->priv = priv; 352 rs_sta->priv = priv;
353 353
354 rs_sta->start_rate = IWL_RATE_INVALID; 354 rs_sta->start_rate = IL_RATE_INVALID;
355 355
356 /* default to just 802.11b */ 356 /* default to just 802.11b */
357 rs_sta->expected_tpt = iwl3945_expected_tpt_b; 357 rs_sta->expected_tpt = il3945_expected_tpt_b;
358 358
359 rs_sta->last_partial_flush = jiffies; 359 rs_sta->last_partial_flush = jiffies;
360 rs_sta->last_flush = jiffies; 360 rs_sta->last_flush = jiffies;
361 rs_sta->flush_time = IWL_RATE_FLUSH; 361 rs_sta->flush_time = IL_RATE_FLUSH;
362 rs_sta->last_tx_packets = 0; 362 rs_sta->last_tx_packets = 0;
363 363
364 rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; 364 rs_sta->rate_scale_flush.data = (unsigned long)rs_sta;
365 rs_sta->rate_scale_flush.function = iwl3945_bg_rate_scale_flush; 365 rs_sta->rate_scale_flush.function = il3945_bg_rate_scale_flush;
366 366
367 for (i = 0; i < IWL_RATE_COUNT_3945; i++) 367 for (i = 0; i < IL_RATE_COUNT_3945; i++)
368 iwl3945_clear_window(&rs_sta->win[i]); 368 il3945_clear_window(&rs_sta->win[i]);
369 369
370 /* TODO: what is a good starting rate for STA? About middle? Maybe not 370 /* TODO: what is a good starting rate for STA? About middle? Maybe not
371 * the lowest or the highest rate.. Could consider using RSSI from 371 * the lowest or the highest rate.. Could consider using RSSI from
@@ -380,56 +380,56 @@ void iwl3945_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 s
380 } 380 }
381 381
382 priv->_3945.sta_supp_rates = sta->supp_rates[sband->band]; 382 priv->_3945.sta_supp_rates = sta->supp_rates[sband->band];
383 /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ 383 /* For 5 GHz band it start at IL_FIRST_OFDM_RATE */
384 if (sband->band == IEEE80211_BAND_5GHZ) { 384 if (sband->band == IEEE80211_BAND_5GHZ) {
385 rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; 385 rs_sta->last_txrate_idx += IL_FIRST_OFDM_RATE;
386 priv->_3945.sta_supp_rates = priv->_3945.sta_supp_rates << 386 priv->_3945.sta_supp_rates = priv->_3945.sta_supp_rates <<
387 IWL_FIRST_OFDM_RATE; 387 IL_FIRST_OFDM_RATE;
388 } 388 }
389 389
390out: 390out:
391 priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; 391 priv->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS;
392 392
393 IWL_DEBUG_INFO(priv, "leave\n"); 393 IL_DEBUG_INFO(priv, "leave\n");
394} 394}
395 395
396static void *iwl3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) 396static void *il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
397{ 397{
398 return hw->priv; 398 return hw->priv;
399} 399}
400 400
401/* rate scale requires free function to be implemented */ 401/* rate scale requires free function to be implemented */
402static void iwl3945_rs_free(void *priv) 402static void il3945_rs_free(void *priv)
403{ 403{
404 return; 404 return;
405} 405}
406 406
407static void *iwl3945_rs_alloc_sta(void *iwl_priv, struct ieee80211_sta *sta, gfp_t gfp) 407static void *il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t gfp)
408{ 408{
409 struct iwl3945_rs_sta *rs_sta; 409 struct il3945_rs_sta *rs_sta;
410 struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; 410 struct il3945_sta_priv *psta = (void *) sta->drv_priv;
411 struct iwl_priv *priv __maybe_unused = iwl_priv; 411 struct il_priv *priv __maybe_unused = il_priv;
412 412
413 IWL_DEBUG_RATE(priv, "enter\n"); 413 IL_DEBUG_RATE(priv, "enter\n");
414 414
415 rs_sta = &psta->rs_sta; 415 rs_sta = &psta->rs_sta;
416 416
417 spin_lock_init(&rs_sta->lock); 417 spin_lock_init(&rs_sta->lock);
418 init_timer(&rs_sta->rate_scale_flush); 418 init_timer(&rs_sta->rate_scale_flush);
419 419
420 IWL_DEBUG_RATE(priv, "leave\n"); 420 IL_DEBUG_RATE(priv, "leave\n");
421 421
422 return rs_sta; 422 return rs_sta;
423} 423}
424 424
425static void iwl3945_rs_free_sta(void *iwl_priv, struct ieee80211_sta *sta, 425static void il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta,
426 void *priv_sta) 426 void *priv_sta)
427{ 427{
428 struct iwl3945_rs_sta *rs_sta = priv_sta; 428 struct il3945_rs_sta *rs_sta = priv_sta;
429 429
430 /* 430 /*
431 * Be careful not to use any members of iwl3945_rs_sta (like trying 431 * Be careful not to use any members of il3945_rs_sta (like trying
432 * to use iwl_priv to print out debugging) since it may not be fully 432 * to use il_priv to print out debugging) since it may not be fully
433 * initialized at this point. 433 * initialized at this point.
434 */ 434 */
435 del_timer_sync(&rs_sta->rate_scale_flush); 435 del_timer_sync(&rs_sta->rate_scale_flush);
@@ -437,43 +437,43 @@ static void iwl3945_rs_free_sta(void *iwl_priv, struct ieee80211_sta *sta,
437 437
438 438
439/** 439/**
440 * iwl3945_rs_tx_status - Update rate control values based on Tx results 440 * il3945_rs_tx_status - Update rate control values based on Tx results
441 * 441 *
442 * NOTE: Uses iwl_priv->retry_rate for the # of retries attempted by 442 * NOTE: Uses il_priv->retry_rate for the # of retries attempted by
443 * the hardware for each rate. 443 * the hardware for each rate.
444 */ 444 */
445static void iwl3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband, 445static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband,
446 struct ieee80211_sta *sta, void *priv_sta, 446 struct ieee80211_sta *sta, void *priv_sta,
447 struct sk_buff *skb) 447 struct sk_buff *skb)
448{ 448{
449 s8 retries = 0, current_count; 449 s8 retries = 0, current_count;
450 int scale_rate_index, first_index, last_index; 450 int scale_rate_index, first_index, last_index;
451 unsigned long flags; 451 unsigned long flags;
452 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 452 struct il_priv *priv = (struct il_priv *)priv_rate;
453 struct iwl3945_rs_sta *rs_sta = priv_sta; 453 struct il3945_rs_sta *rs_sta = priv_sta;
454 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 454 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
455 455
456 IWL_DEBUG_RATE(priv, "enter\n"); 456 IL_DEBUG_RATE(priv, "enter\n");
457 457
458 retries = info->status.rates[0].count; 458 retries = info->status.rates[0].count;
459 /* Sanity Check for retries */ 459 /* Sanity Check for retries */
460 if (retries > IWL_RATE_RETRY_TH) 460 if (retries > IL_RATE_RETRY_TH)
461 retries = IWL_RATE_RETRY_TH; 461 retries = IL_RATE_RETRY_TH;
462 462
463 first_index = sband->bitrates[info->status.rates[0].idx].hw_value; 463 first_index = sband->bitrates[info->status.rates[0].idx].hw_value;
464 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT_3945)) { 464 if ((first_index < 0) || (first_index >= IL_RATE_COUNT_3945)) {
465 IWL_DEBUG_RATE(priv, "leave: Rate out of bounds: %d\n", first_index); 465 IL_DEBUG_RATE(priv, "leave: Rate out of bounds: %d\n", first_index);
466 return; 466 return;
467 } 467 }
468 468
469 if (!priv_sta) { 469 if (!priv_sta) {
470 IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n"); 470 IL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
471 return; 471 return;
472 } 472 }
473 473
474 /* Treat uninitialized rate scaling data same as non-existing. */ 474 /* Treat uninitialized rate scaling data same as non-existing. */
475 if (!rs_sta->priv) { 475 if (!rs_sta->priv) {
476 IWL_DEBUG_RATE(priv, "leave: STA priv data uninitialized!\n"); 476 IL_DEBUG_RATE(priv, "leave: STA priv data uninitialized!\n");
477 return; 477 return;
478 } 478 }
479 479
@@ -499,16 +499,16 @@ static void iwl3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_ban
499 last_index = scale_rate_index; 499 last_index = scale_rate_index;
500 } else { 500 } else {
501 current_count = priv->retry_rate; 501 current_count = priv->retry_rate;
502 last_index = iwl3945_rs_next_rate(priv, 502 last_index = il3945_rs_next_rate(priv,
503 scale_rate_index); 503 scale_rate_index);
504 } 504 }
505 505
506 /* Update this rate accounting for as many retries 506 /* Update this rate accounting for as many retries
507 * as was used for it (per current_count) */ 507 * as was used for it (per current_count) */
508 iwl3945_collect_tx_data(rs_sta, 508 il3945_collect_tx_data(rs_sta,
509 &rs_sta->win[scale_rate_index], 509 &rs_sta->win[scale_rate_index],
510 0, current_count, scale_rate_index); 510 0, current_count, scale_rate_index);
511 IWL_DEBUG_RATE(priv, "Update rate %d for %d retries.\n", 511 IL_DEBUG_RATE(priv, "Update rate %d for %d retries.\n",
512 scale_rate_index, current_count); 512 scale_rate_index, current_count);
513 513
514 retries -= current_count; 514 retries -= current_count;
@@ -518,11 +518,11 @@ static void iwl3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_ban
518 518
519 519
520 /* Update the last index window with success/failure based on ACK */ 520 /* Update the last index window with success/failure based on ACK */
521 IWL_DEBUG_RATE(priv, "Update rate %d with %s.\n", 521 IL_DEBUG_RATE(priv, "Update rate %d with %s.\n",
522 last_index, 522 last_index,
523 (info->flags & IEEE80211_TX_STAT_ACK) ? 523 (info->flags & IEEE80211_TX_STAT_ACK) ?
524 "success" : "failure"); 524 "success" : "failure");
525 iwl3945_collect_tx_data(rs_sta, 525 il3945_collect_tx_data(rs_sta,
526 &rs_sta->win[last_index], 526 &rs_sta->win[last_index],
527 info->flags & IEEE80211_TX_STAT_ACK, 1, last_index); 527 info->flags & IEEE80211_TX_STAT_ACK, 1, last_index);
528 528
@@ -543,15 +543,15 @@ static void iwl3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_ban
543 543
544 spin_unlock_irqrestore(&rs_sta->lock, flags); 544 spin_unlock_irqrestore(&rs_sta->lock, flags);
545 545
546 IWL_DEBUG_RATE(priv, "leave\n"); 546 IL_DEBUG_RATE(priv, "leave\n");
547} 547}
548 548
549static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, 549static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
550 u8 index, u16 rate_mask, enum ieee80211_band band) 550 u8 index, u16 rate_mask, enum ieee80211_band band)
551{ 551{
552 u8 high = IWL_RATE_INVALID; 552 u8 high = IL_RATE_INVALID;
553 u8 low = IWL_RATE_INVALID; 553 u8 low = IL_RATE_INVALID;
554 struct iwl_priv *priv __maybe_unused = rs_sta->priv; 554 struct il_priv *priv __maybe_unused = rs_sta->priv;
555 555
556 /* 802.11A walks to the next literal adjacent rate in 556 /* 802.11A walks to the next literal adjacent rate in
557 * the rate table */ 557 * the rate table */
@@ -570,7 +570,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
570 570
571 /* Find the next rate that is in the rate mask */ 571 /* Find the next rate that is in the rate mask */
572 i = index + 1; 572 i = index + 1;
573 for (mask = (1 << i); i < IWL_RATE_COUNT_3945; 573 for (mask = (1 << i); i < IL_RATE_COUNT_3945;
574 i++, mask <<= 1) { 574 i++, mask <<= 1) {
575 if (rate_mask & mask) { 575 if (rate_mask & mask) {
576 high = i; 576 high = i;
@@ -582,36 +582,36 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
582 } 582 }
583 583
584 low = index; 584 low = index;
585 while (low != IWL_RATE_INVALID) { 585 while (low != IL_RATE_INVALID) {
586 if (rs_sta->tgg) 586 if (rs_sta->tgg)
587 low = iwl3945_rates[low].prev_rs_tgg; 587 low = il3945_rates[low].prev_rs_tgg;
588 else 588 else
589 low = iwl3945_rates[low].prev_rs; 589 low = il3945_rates[low].prev_rs;
590 if (low == IWL_RATE_INVALID) 590 if (low == IL_RATE_INVALID)
591 break; 591 break;
592 if (rate_mask & (1 << low)) 592 if (rate_mask & (1 << low))
593 break; 593 break;
594 IWL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low); 594 IL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low);
595 } 595 }
596 596
597 high = index; 597 high = index;
598 while (high != IWL_RATE_INVALID) { 598 while (high != IL_RATE_INVALID) {
599 if (rs_sta->tgg) 599 if (rs_sta->tgg)
600 high = iwl3945_rates[high].next_rs_tgg; 600 high = il3945_rates[high].next_rs_tgg;
601 else 601 else
602 high = iwl3945_rates[high].next_rs; 602 high = il3945_rates[high].next_rs;
603 if (high == IWL_RATE_INVALID) 603 if (high == IL_RATE_INVALID)
604 break; 604 break;
605 if (rate_mask & (1 << high)) 605 if (rate_mask & (1 << high))
606 break; 606 break;
607 IWL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high); 607 IL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high);
608 } 608 }
609 609
610 return (high << 8) | low; 610 return (high << 8) | low;
611} 611}
612 612
613/** 613/**
614 * iwl3945_rs_get_rate - find the rate for the requested packet 614 * il3945_rs_get_rate - find the rate for the requested packet
615 * 615 *
616 * Returns the ieee80211_rate structure allocated by the driver. 616 * Returns the ieee80211_rate structure allocated by the driver.
617 * 617 *
@@ -626,33 +626,33 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
626 * rate table and must reference the driver allocated rate table 626 * rate table and must reference the driver allocated rate table
627 * 627 *
628 */ 628 */
629static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, 629static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
630 void *priv_sta, struct ieee80211_tx_rate_control *txrc) 630 void *priv_sta, struct ieee80211_tx_rate_control *txrc)
631{ 631{
632 struct ieee80211_supported_band *sband = txrc->sband; 632 struct ieee80211_supported_band *sband = txrc->sband;
633 struct sk_buff *skb = txrc->skb; 633 struct sk_buff *skb = txrc->skb;
634 u8 low = IWL_RATE_INVALID; 634 u8 low = IL_RATE_INVALID;
635 u8 high = IWL_RATE_INVALID; 635 u8 high = IL_RATE_INVALID;
636 u16 high_low; 636 u16 high_low;
637 int index; 637 int index;
638 struct iwl3945_rs_sta *rs_sta = priv_sta; 638 struct il3945_rs_sta *rs_sta = priv_sta;
639 struct iwl3945_rate_scale_data *window = NULL; 639 struct il3945_rate_scale_data *window = NULL;
640 int current_tpt = IWL_INVALID_VALUE; 640 int current_tpt = IL_INVALID_VALUE;
641 int low_tpt = IWL_INVALID_VALUE; 641 int low_tpt = IL_INVALID_VALUE;
642 int high_tpt = IWL_INVALID_VALUE; 642 int high_tpt = IL_INVALID_VALUE;
643 u32 fail_count; 643 u32 fail_count;
644 s8 scale_action = 0; 644 s8 scale_action = 0;
645 unsigned long flags; 645 unsigned long flags;
646 u16 rate_mask; 646 u16 rate_mask;
647 s8 max_rate_idx = -1; 647 s8 max_rate_idx = -1;
648 struct iwl_priv *priv __maybe_unused = (struct iwl_priv *)priv_r; 648 struct il_priv *priv __maybe_unused = (struct il_priv *)priv_r;
649 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 649 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
650 650
651 IWL_DEBUG_RATE(priv, "enter\n"); 651 IL_DEBUG_RATE(priv, "enter\n");
652 652
653 /* Treat uninitialized rate scaling data same as non-existing. */ 653 /* Treat uninitialized rate scaling data same as non-existing. */
654 if (rs_sta && !rs_sta->priv) { 654 if (rs_sta && !rs_sta->priv) {
655 IWL_DEBUG_RATE(priv, "Rate scaling information not initialized yet.\n"); 655 IL_DEBUG_RATE(priv, "Rate scaling information not initialized yet.\n");
656 priv_sta = NULL; 656 priv_sta = NULL;
657 } 657 }
658 658
@@ -664,25 +664,25 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
664 /* get user max rate if set */ 664 /* get user max rate if set */
665 max_rate_idx = txrc->max_rate_idx; 665 max_rate_idx = txrc->max_rate_idx;
666 if ((sband->band == IEEE80211_BAND_5GHZ) && (max_rate_idx != -1)) 666 if ((sband->band == IEEE80211_BAND_5GHZ) && (max_rate_idx != -1))
667 max_rate_idx += IWL_FIRST_OFDM_RATE; 667 max_rate_idx += IL_FIRST_OFDM_RATE;
668 if ((max_rate_idx < 0) || (max_rate_idx >= IWL_RATE_COUNT)) 668 if ((max_rate_idx < 0) || (max_rate_idx >= IL_RATE_COUNT))
669 max_rate_idx = -1; 669 max_rate_idx = -1;
670 670
671 index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT_3945 - 1); 671 index = min(rs_sta->last_txrate_idx & 0xffff, IL_RATE_COUNT_3945 - 1);
672 672
673 if (sband->band == IEEE80211_BAND_5GHZ) 673 if (sband->band == IEEE80211_BAND_5GHZ)
674 rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; 674 rate_mask = rate_mask << IL_FIRST_OFDM_RATE;
675 675
676 spin_lock_irqsave(&rs_sta->lock, flags); 676 spin_lock_irqsave(&rs_sta->lock, flags);
677 677
678 /* for recent assoc, choose best rate regarding 678 /* for recent assoc, choose best rate regarding
679 * to rssi value 679 * to rssi value
680 */ 680 */
681 if (rs_sta->start_rate != IWL_RATE_INVALID) { 681 if (rs_sta->start_rate != IL_RATE_INVALID) {
682 if (rs_sta->start_rate < index && 682 if (rs_sta->start_rate < index &&
683 (rate_mask & (1 << rs_sta->start_rate))) 683 (rate_mask & (1 << rs_sta->start_rate)))
684 index = rs_sta->start_rate; 684 index = rs_sta->start_rate;
685 rs_sta->start_rate = IWL_RATE_INVALID; 685 rs_sta->start_rate = IL_RATE_INVALID;
686 } 686 }
687 687
688 /* force user max rate if set by user */ 688 /* force user max rate if set by user */
@@ -695,11 +695,11 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
695 695
696 fail_count = window->counter - window->success_counter; 696 fail_count = window->counter - window->success_counter;
697 697
698 if (((fail_count < IWL_RATE_MIN_FAILURE_TH) && 698 if (((fail_count < IL_RATE_MIN_FAILURE_TH) &&
699 (window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) { 699 (window->success_counter < IL_RATE_MIN_SUCCESS_TH))) {
700 spin_unlock_irqrestore(&rs_sta->lock, flags); 700 spin_unlock_irqrestore(&rs_sta->lock, flags);
701 701
702 IWL_DEBUG_RATE(priv, "Invalid average_tpt on rate %d: " 702 IL_DEBUG_RATE(priv, "Invalid average_tpt on rate %d: "
703 "counter: %d, success_counter: %d, " 703 "counter: %d, success_counter: %d, "
704 "expected_tpt is %sNULL\n", 704 "expected_tpt is %sNULL\n",
705 index, 705 index,
@@ -708,27 +708,27 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
708 rs_sta->expected_tpt ? "not " : ""); 708 rs_sta->expected_tpt ? "not " : "");
709 709
710 /* Can't calculate this yet; not enough history */ 710 /* Can't calculate this yet; not enough history */
711 window->average_tpt = IWL_INVALID_VALUE; 711 window->average_tpt = IL_INVALID_VALUE;
712 goto out; 712 goto out;
713 713
714 } 714 }
715 715
716 current_tpt = window->average_tpt; 716 current_tpt = window->average_tpt;
717 717
718 high_low = iwl3945_get_adjacent_rate(rs_sta, index, rate_mask, 718 high_low = il3945_get_adjacent_rate(rs_sta, index, rate_mask,
719 sband->band); 719 sband->band);
720 low = high_low & 0xff; 720 low = high_low & 0xff;
721 high = (high_low >> 8) & 0xff; 721 high = (high_low >> 8) & 0xff;
722 722
723 /* If user set max rate, dont allow higher than user constrain */ 723 /* If user set max rate, dont allow higher than user constrain */
724 if ((max_rate_idx != -1) && (max_rate_idx < high)) 724 if ((max_rate_idx != -1) && (max_rate_idx < high))
725 high = IWL_RATE_INVALID; 725 high = IL_RATE_INVALID;
726 726
727 /* Collect Measured throughputs of adjacent rates */ 727 /* Collect Measured throughputs of adjacent rates */
728 if (low != IWL_RATE_INVALID) 728 if (low != IL_RATE_INVALID)
729 low_tpt = rs_sta->win[low].average_tpt; 729 low_tpt = rs_sta->win[low].average_tpt;
730 730
731 if (high != IWL_RATE_INVALID) 731 if (high != IL_RATE_INVALID)
732 high_tpt = rs_sta->win[high].average_tpt; 732 high_tpt = rs_sta->win[high].average_tpt;
733 733
734 spin_unlock_irqrestore(&rs_sta->lock, flags); 734 spin_unlock_irqrestore(&rs_sta->lock, flags);
@@ -736,51 +736,51 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
736 scale_action = 0; 736 scale_action = 0;
737 737
738 /* Low success ratio , need to drop the rate */ 738 /* Low success ratio , need to drop the rate */
739 if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) { 739 if ((window->success_ratio < IL_RATE_DECREASE_TH) || !current_tpt) {
740 IWL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n"); 740 IL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n");
741 scale_action = -1; 741 scale_action = -1;
742 /* No throughput measured yet for adjacent rates, 742 /* No throughput measured yet for adjacent rates,
743 * try increase */ 743 * try increase */
744 } else if ((low_tpt == IWL_INVALID_VALUE) && 744 } else if ((low_tpt == IL_INVALID_VALUE) &&
745 (high_tpt == IWL_INVALID_VALUE)) { 745 (high_tpt == IL_INVALID_VALUE)) {
746 746
747 if (high != IWL_RATE_INVALID && window->success_ratio >= IWL_RATE_INCREASE_TH) 747 if (high != IL_RATE_INVALID && window->success_ratio >= IL_RATE_INCREASE_TH)
748 scale_action = 1; 748 scale_action = 1;
749 else if (low != IWL_RATE_INVALID) 749 else if (low != IL_RATE_INVALID)
750 scale_action = 0; 750 scale_action = 0;
751 751
752 /* Both adjacent throughputs are measured, but neither one has 752 /* Both adjacent throughputs are measured, but neither one has
753 * better throughput; we're using the best rate, don't change 753 * better throughput; we're using the best rate, don't change
754 * it! */ 754 * it! */
755 } else if ((low_tpt != IWL_INVALID_VALUE) && 755 } else if ((low_tpt != IL_INVALID_VALUE) &&
756 (high_tpt != IWL_INVALID_VALUE) && 756 (high_tpt != IL_INVALID_VALUE) &&
757 (low_tpt < current_tpt) && (high_tpt < current_tpt)) { 757 (low_tpt < current_tpt) && (high_tpt < current_tpt)) {
758 758
759 IWL_DEBUG_RATE(priv, "No action -- low [%d] & high [%d] < " 759 IL_DEBUG_RATE(priv, "No action -- low [%d] & high [%d] < "
760 "current_tpt [%d]\n", 760 "current_tpt [%d]\n",
761 low_tpt, high_tpt, current_tpt); 761 low_tpt, high_tpt, current_tpt);
762 scale_action = 0; 762 scale_action = 0;
763 763
764 /* At least one of the rates has better throughput */ 764 /* At least one of the rates has better throughput */
765 } else { 765 } else {
766 if (high_tpt != IWL_INVALID_VALUE) { 766 if (high_tpt != IL_INVALID_VALUE) {
767 767
768 /* High rate has better throughput, Increase 768 /* High rate has better throughput, Increase
769 * rate */ 769 * rate */
770 if (high_tpt > current_tpt && 770 if (high_tpt > current_tpt &&
771 window->success_ratio >= IWL_RATE_INCREASE_TH) 771 window->success_ratio >= IL_RATE_INCREASE_TH)
772 scale_action = 1; 772 scale_action = 1;
773 else { 773 else {
774 IWL_DEBUG_RATE(priv, 774 IL_DEBUG_RATE(priv,
775 "decrease rate because of high tpt\n"); 775 "decrease rate because of high tpt\n");
776 scale_action = 0; 776 scale_action = 0;
777 } 777 }
778 } else if (low_tpt != IWL_INVALID_VALUE) { 778 } else if (low_tpt != IL_INVALID_VALUE) {
779 if (low_tpt > current_tpt) { 779 if (low_tpt > current_tpt) {
780 IWL_DEBUG_RATE(priv, 780 IL_DEBUG_RATE(priv,
781 "decrease rate because of low tpt\n"); 781 "decrease rate because of low tpt\n");
782 scale_action = -1; 782 scale_action = -1;
783 } else if (window->success_ratio >= IWL_RATE_INCREASE_TH) { 783 } else if (window->success_ratio >= IL_RATE_INCREASE_TH) {
784 /* Lower rate has better 784 /* Lower rate has better
785 * throughput,decrease rate */ 785 * throughput,decrease rate */
786 scale_action = 1; 786 scale_action = 1;
@@ -790,8 +790,8 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
790 790
791 /* Sanity check; asked for decrease, but success rate or throughput 791 /* Sanity check; asked for decrease, but success rate or throughput
792 * has been good at old rate. Don't change it. */ 792 * has been good at old rate. Don't change it. */
793 if ((scale_action == -1) && (low != IWL_RATE_INVALID) && 793 if ((scale_action == -1) && (low != IL_RATE_INVALID) &&
794 ((window->success_ratio > IWL_RATE_HIGH_TH) || 794 ((window->success_ratio > IL_RATE_HIGH_TH) ||
795 (current_tpt > (100 * rs_sta->expected_tpt[low])))) 795 (current_tpt > (100 * rs_sta->expected_tpt[low]))))
796 scale_action = 0; 796 scale_action = 0;
797 797
@@ -799,13 +799,13 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
799 case -1: 799 case -1:
800 800
801 /* Decrese rate */ 801 /* Decrese rate */
802 if (low != IWL_RATE_INVALID) 802 if (low != IL_RATE_INVALID)
803 index = low; 803 index = low;
804 break; 804 break;
805 805
806 case 1: 806 case 1:
807 /* Increase rate */ 807 /* Increase rate */
808 if (high != IWL_RATE_INVALID) 808 if (high != IL_RATE_INVALID)
809 index = high; 809 index = high;
810 810
811 break; 811 break;
@@ -816,32 +816,32 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
816 break; 816 break;
817 } 817 }
818 818
819 IWL_DEBUG_RATE(priv, "Selected %d (action %d) - low %d high %d\n", 819 IL_DEBUG_RATE(priv, "Selected %d (action %d) - low %d high %d\n",
820 index, scale_action, low, high); 820 index, scale_action, low, high);
821 821
822 out: 822 out:
823 823
824 if (sband->band == IEEE80211_BAND_5GHZ) { 824 if (sband->band == IEEE80211_BAND_5GHZ) {
825 if (WARN_ON_ONCE(index < IWL_FIRST_OFDM_RATE)) 825 if (WARN_ON_ONCE(index < IL_FIRST_OFDM_RATE))
826 index = IWL_FIRST_OFDM_RATE; 826 index = IL_FIRST_OFDM_RATE;
827 rs_sta->last_txrate_idx = index; 827 rs_sta->last_txrate_idx = index;
828 info->control.rates[0].idx = index - IWL_FIRST_OFDM_RATE; 828 info->control.rates[0].idx = index - IL_FIRST_OFDM_RATE;
829 } else { 829 } else {
830 rs_sta->last_txrate_idx = index; 830 rs_sta->last_txrate_idx = index;
831 info->control.rates[0].idx = rs_sta->last_txrate_idx; 831 info->control.rates[0].idx = rs_sta->last_txrate_idx;
832 } 832 }
833 833
834 IWL_DEBUG_RATE(priv, "leave: %d\n", index); 834 IL_DEBUG_RATE(priv, "leave: %d\n", index);
835} 835}
836 836
837#ifdef CONFIG_MAC80211_DEBUGFS 837#ifdef CONFIG_MAC80211_DEBUGFS
838static int iwl3945_open_file_generic(struct inode *inode, struct file *file) 838static int il3945_open_file_generic(struct inode *inode, struct file *file)
839{ 839{
840 file->private_data = inode->i_private; 840 file->private_data = inode->i_private;
841 return 0; 841 return 0;
842} 842}
843 843
844static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file, 844static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file,
845 char __user *user_buf, 845 char __user *user_buf,
846 size_t count, loff_t *ppos) 846 size_t count, loff_t *ppos)
847{ 847{
@@ -849,7 +849,7 @@ static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file,
849 int desc = 0; 849 int desc = 0;
850 int j; 850 int j;
851 ssize_t ret; 851 ssize_t ret;
852 struct iwl3945_rs_sta *lq_sta = file->private_data; 852 struct il3945_rs_sta *lq_sta = file->private_data;
853 853
854 buff = kmalloc(1024, GFP_KERNEL); 854 buff = kmalloc(1024, GFP_KERNEL);
855 if (!buff) 855 if (!buff)
@@ -860,7 +860,7 @@ static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file,
860 lq_sta->tx_packets, 860 lq_sta->tx_packets,
861 lq_sta->last_txrate_idx, 861 lq_sta->last_txrate_idx,
862 lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time)); 862 lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time));
863 for (j = 0; j < IWL_RATE_COUNT_3945; j++) { 863 for (j = 0; j < IL_RATE_COUNT_3945; j++) {
864 desc += sprintf(buff+desc, 864 desc += sprintf(buff+desc,
865 "counter=%d success=%d %%=%d\n", 865 "counter=%d success=%d %%=%d\n",
866 lq_sta->win[j].counter, 866 lq_sta->win[j].counter,
@@ -873,15 +873,15 @@ static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file,
873} 873}
874 874
875static const struct file_operations rs_sta_dbgfs_stats_table_ops = { 875static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
876 .read = iwl3945_sta_dbgfs_stats_table_read, 876 .read = il3945_sta_dbgfs_stats_table_read,
877 .open = iwl3945_open_file_generic, 877 .open = il3945_open_file_generic,
878 .llseek = default_llseek, 878 .llseek = default_llseek,
879}; 879};
880 880
881static void iwl3945_add_debugfs(void *priv, void *priv_sta, 881static void il3945_add_debugfs(void *priv, void *priv_sta,
882 struct dentry *dir) 882 struct dentry *dir)
883{ 883{
884 struct iwl3945_rs_sta *lq_sta = priv_sta; 884 struct il3945_rs_sta *lq_sta = priv_sta;
885 885
886 lq_sta->rs_sta_dbgfs_stats_table_file = 886 lq_sta->rs_sta_dbgfs_stats_table_file =
887 debugfs_create_file("rate_stats_table", 0600, dir, 887 debugfs_create_file("rate_stats_table", 0600, dir,
@@ -889,9 +889,9 @@ static void iwl3945_add_debugfs(void *priv, void *priv_sta,
889 889
890} 890}
891 891
892static void iwl3945_remove_debugfs(void *priv, void *priv_sta) 892static void il3945_remove_debugfs(void *priv, void *priv_sta)
893{ 893{
894 struct iwl3945_rs_sta *lq_sta = priv_sta; 894 struct il3945_rs_sta *lq_sta = priv_sta;
895 debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); 895 debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file);
896} 896}
897#endif 897#endif
@@ -901,7 +901,7 @@ static void iwl3945_remove_debugfs(void *priv, void *priv_sta)
901 * the station is added. Since mac80211 calls this function before a 901 * the station is added. Since mac80211 calls this function before a
902 * station is added we ignore it. 902 * station is added we ignore it.
903 */ 903 */
904static void iwl3945_rs_rate_init_stub(void *priv_r, 904static void il3945_rs_rate_init_stub(void *priv_r,
905 struct ieee80211_supported_band *sband, 905 struct ieee80211_supported_band *sband,
906 struct ieee80211_sta *sta, void *priv_sta) 906 struct ieee80211_sta *sta, void *priv_sta)
907{ 907{
@@ -910,36 +910,36 @@ static void iwl3945_rs_rate_init_stub(void *priv_r,
910static struct rate_control_ops rs_ops = { 910static struct rate_control_ops rs_ops = {
911 .module = NULL, 911 .module = NULL,
912 .name = RS_NAME, 912 .name = RS_NAME,
913 .tx_status = iwl3945_rs_tx_status, 913 .tx_status = il3945_rs_tx_status,
914 .get_rate = iwl3945_rs_get_rate, 914 .get_rate = il3945_rs_get_rate,
915 .rate_init = iwl3945_rs_rate_init_stub, 915 .rate_init = il3945_rs_rate_init_stub,
916 .alloc = iwl3945_rs_alloc, 916 .alloc = il3945_rs_alloc,
917 .free = iwl3945_rs_free, 917 .free = il3945_rs_free,
918 .alloc_sta = iwl3945_rs_alloc_sta, 918 .alloc_sta = il3945_rs_alloc_sta,
919 .free_sta = iwl3945_rs_free_sta, 919 .free_sta = il3945_rs_free_sta,
920#ifdef CONFIG_MAC80211_DEBUGFS 920#ifdef CONFIG_MAC80211_DEBUGFS
921 .add_sta_debugfs = iwl3945_add_debugfs, 921 .add_sta_debugfs = il3945_add_debugfs,
922 .remove_sta_debugfs = iwl3945_remove_debugfs, 922 .remove_sta_debugfs = il3945_remove_debugfs,
923#endif 923#endif
924 924
925}; 925};
926void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) 926void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
927{ 927{
928 struct iwl_priv *priv = hw->priv; 928 struct il_priv *priv = hw->priv;
929 s32 rssi = 0; 929 s32 rssi = 0;
930 unsigned long flags; 930 unsigned long flags;
931 struct iwl3945_rs_sta *rs_sta; 931 struct il3945_rs_sta *rs_sta;
932 struct ieee80211_sta *sta; 932 struct ieee80211_sta *sta;
933 struct iwl3945_sta_priv *psta; 933 struct il3945_sta_priv *psta;
934 934
935 IWL_DEBUG_RATE(priv, "enter\n"); 935 IL_DEBUG_RATE(priv, "enter\n");
936 936
937 rcu_read_lock(); 937 rcu_read_lock();
938 938
939 sta = ieee80211_find_sta(priv->contexts[IWL_RXON_CTX_BSS].vif, 939 sta = ieee80211_find_sta(priv->contexts[IL_RXON_CTX_BSS].vif,
940 priv->stations[sta_id].sta.sta.addr); 940 priv->stations[sta_id].sta.sta.addr);
941 if (!sta) { 941 if (!sta) {
942 IWL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n"); 942 IL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n");
943 rcu_read_unlock(); 943 rcu_read_unlock();
944 return; 944 return;
945 } 945 }
@@ -953,16 +953,16 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
953 switch (priv->band) { 953 switch (priv->band) {
954 case IEEE80211_BAND_2GHZ: 954 case IEEE80211_BAND_2GHZ:
955 /* TODO: this always does G, not a regression */ 955 /* TODO: this always does G, not a regression */
956 if (priv->contexts[IWL_RXON_CTX_BSS].active.flags & 956 if (priv->contexts[IL_RXON_CTX_BSS].active.flags &
957 RXON_FLG_TGG_PROTECT_MSK) { 957 RXON_FLG_TGG_PROTECT_MSK) {
958 rs_sta->tgg = 1; 958 rs_sta->tgg = 1;
959 rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot; 959 rs_sta->expected_tpt = il3945_expected_tpt_g_prot;
960 } else 960 } else
961 rs_sta->expected_tpt = iwl3945_expected_tpt_g; 961 rs_sta->expected_tpt = il3945_expected_tpt_g;
962 break; 962 break;
963 963
964 case IEEE80211_BAND_5GHZ: 964 case IEEE80211_BAND_5GHZ:
965 rs_sta->expected_tpt = iwl3945_expected_tpt_a; 965 rs_sta->expected_tpt = il3945_expected_tpt_a;
966 break; 966 break;
967 case IEEE80211_NUM_BANDS: 967 case IEEE80211_NUM_BANDS:
968 BUG(); 968 BUG();
@@ -973,24 +973,24 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
973 973
974 rssi = priv->_3945.last_rx_rssi; 974 rssi = priv->_3945.last_rx_rssi;
975 if (rssi == 0) 975 if (rssi == 0)
976 rssi = IWL_MIN_RSSI_VAL; 976 rssi = IL_MIN_RSSI_VAL;
977 977
978 IWL_DEBUG_RATE(priv, "Network RSSI: %d\n", rssi); 978 IL_DEBUG_RATE(priv, "Network RSSI: %d\n", rssi);
979 979
980 rs_sta->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->band); 980 rs_sta->start_rate = il3945_get_rate_index_by_rssi(rssi, priv->band);
981 981
982 IWL_DEBUG_RATE(priv, "leave: rssi %d assign rate index: " 982 IL_DEBUG_RATE(priv, "leave: rssi %d assign rate index: "
983 "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, 983 "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate,
984 iwl3945_rates[rs_sta->start_rate].plcp); 984 il3945_rates[rs_sta->start_rate].plcp);
985 rcu_read_unlock(); 985 rcu_read_unlock();
986} 986}
987 987
988int iwl3945_rate_control_register(void) 988int il3945_rate_control_register(void)
989{ 989{
990 return ieee80211_rate_control_register(&rs_ops); 990 return ieee80211_rate_control_register(&rs_ops);
991} 991}
992 992
993void iwl3945_rate_control_unregister(void) 993void il3945_rate_control_unregister(void)
994{ 994{
995 ieee80211_rate_control_unregister(&rs_ops); 995 ieee80211_rate_control_unregister(&rs_ops);
996} 996}
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c
index f7c0a7438476..6d1740b051df 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.c
@@ -51,70 +51,70 @@
51#include "iwl-3945-led.h" 51#include "iwl-3945-led.h"
52#include "iwl-3945-debugfs.h" 52#include "iwl-3945-debugfs.h"
53 53
54#define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \ 54#define IL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \
55 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ 55 [IL_RATE_##r##M_INDEX] = { IL_RATE_##r##M_PLCP, \
56 IWL_RATE_##r##M_IEEE, \ 56 IL_RATE_##r##M_IEEE, \
57 IWL_RATE_##ip##M_INDEX, \ 57 IL_RATE_##ip##M_INDEX, \
58 IWL_RATE_##in##M_INDEX, \ 58 IL_RATE_##in##M_INDEX, \
59 IWL_RATE_##rp##M_INDEX, \ 59 IL_RATE_##rp##M_INDEX, \
60 IWL_RATE_##rn##M_INDEX, \ 60 IL_RATE_##rn##M_INDEX, \
61 IWL_RATE_##pp##M_INDEX, \ 61 IL_RATE_##pp##M_INDEX, \
62 IWL_RATE_##np##M_INDEX, \ 62 IL_RATE_##np##M_INDEX, \
63 IWL_RATE_##r##M_INDEX_TABLE, \ 63 IL_RATE_##r##M_INDEX_TABLE, \
64 IWL_RATE_##ip##M_INDEX_TABLE } 64 IL_RATE_##ip##M_INDEX_TABLE }
65 65
66/* 66/*
67 * Parameter order: 67 * Parameter order:
68 * rate, prev rate, next rate, prev tgg rate, next tgg rate 68 * rate, prev rate, next rate, prev tgg rate, next tgg rate
69 * 69 *
70 * If there isn't a valid next or previous rate then INV is used which 70 * If there isn't a valid next or previous rate then INV is used which
71 * maps to IWL_RATE_INVALID 71 * maps to IL_RATE_INVALID
72 * 72 *
73 */ 73 */
74const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT_3945] = { 74const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945] = {
75 IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */ 75 IL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */
76 IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */ 76 IL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */
77 IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */ 77 IL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */
78 IWL_DECLARE_RATE_INFO(11, 9, 12, 5, 12, 5, 18), /* 11mbps */ 78 IL_DECLARE_RATE_INFO(11, 9, 12, 5, 12, 5, 18), /* 11mbps */
79 IWL_DECLARE_RATE_INFO(6, 5, 9, 5, 11, 5, 11), /* 6mbps */ 79 IL_DECLARE_RATE_INFO(6, 5, 9, 5, 11, 5, 11), /* 6mbps */
80 IWL_DECLARE_RATE_INFO(9, 6, 11, 5, 11, 5, 11), /* 9mbps */ 80 IL_DECLARE_RATE_INFO(9, 6, 11, 5, 11, 5, 11), /* 9mbps */
81 IWL_DECLARE_RATE_INFO(12, 11, 18, 11, 18, 11, 18), /* 12mbps */ 81 IL_DECLARE_RATE_INFO(12, 11, 18, 11, 18, 11, 18), /* 12mbps */
82 IWL_DECLARE_RATE_INFO(18, 12, 24, 12, 24, 11, 24), /* 18mbps */ 82 IL_DECLARE_RATE_INFO(18, 12, 24, 12, 24, 11, 24), /* 18mbps */
83 IWL_DECLARE_RATE_INFO(24, 18, 36, 18, 36, 18, 36), /* 24mbps */ 83 IL_DECLARE_RATE_INFO(24, 18, 36, 18, 36, 18, 36), /* 24mbps */
84 IWL_DECLARE_RATE_INFO(36, 24, 48, 24, 48, 24, 48), /* 36mbps */ 84 IL_DECLARE_RATE_INFO(36, 24, 48, 24, 48, 24, 48), /* 36mbps */
85 IWL_DECLARE_RATE_INFO(48, 36, 54, 36, 54, 36, 54), /* 48mbps */ 85 IL_DECLARE_RATE_INFO(48, 36, 54, 36, 54, 36, 54), /* 48mbps */
86 IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */ 86 IL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */
87}; 87};
88 88
89static inline u8 iwl3945_get_prev_ieee_rate(u8 rate_index) 89static inline u8 il3945_get_prev_ieee_rate(u8 rate_index)
90{ 90{
91 u8 rate = iwl3945_rates[rate_index].prev_ieee; 91 u8 rate = il3945_rates[rate_index].prev_ieee;
92 92
93 if (rate == IWL_RATE_INVALID) 93 if (rate == IL_RATE_INVALID)
94 rate = rate_index; 94 rate = rate_index;
95 return rate; 95 return rate;
96} 96}
97 97
98/* 1 = enable the iwl3945_disable_events() function */ 98/* 1 = enable the il3945_disable_events() function */
99#define IWL_EVT_DISABLE (0) 99#define IL_EVT_DISABLE (0)
100#define IWL_EVT_DISABLE_SIZE (1532/32) 100#define IL_EVT_DISABLE_SIZE (1532/32)
101 101
102/** 102/**
103 * iwl3945_disable_events - Disable selected events in uCode event log 103 * il3945_disable_events - Disable selected events in uCode event log
104 * 104 *
105 * Disable an event by writing "1"s into "disable" 105 * Disable an event by writing "1"s into "disable"
106 * bitmap in SRAM. Bit position corresponds to Event # (id/type). 106 * bitmap in SRAM. Bit position corresponds to Event # (id/type).
107 * Default values of 0 enable uCode events to be logged. 107 * Default values of 0 enable uCode events to be logged.
108 * Use for only special debugging. This function is just a placeholder as-is, 108 * Use for only special debugging. This function is just a placeholder as-is,
109 * you'll need to provide the special bits! ... 109 * you'll need to provide the special bits! ...
110 * ... and set IWL_EVT_DISABLE to 1. */ 110 * ... and set IL_EVT_DISABLE to 1. */
111void iwl3945_disable_events(struct iwl_priv *priv) 111void il3945_disable_events(struct il_priv *priv)
112{ 112{
113 int i; 113 int i;
114 u32 base; /* SRAM address of event log header */ 114 u32 base; /* SRAM address of event log header */
115 u32 disable_ptr; /* SRAM address of event-disable bitmap array */ 115 u32 disable_ptr; /* SRAM address of event-disable bitmap array */
116 u32 array_size; /* # of u32 entries in array */ 116 u32 array_size; /* # of u32 entries in array */
117 static const u32 evt_disable[IWL_EVT_DISABLE_SIZE] = { 117 static const u32 evt_disable[IL_EVT_DISABLE_SIZE] = {
118 0x00000000, /* 31 - 0 Event id numbers */ 118 0x00000000, /* 31 - 0 Event id numbers */
119 0x00000000, /* 63 - 32 */ 119 0x00000000, /* 63 - 32 */
120 0x00000000, /* 95 - 64 */ 120 0x00000000, /* 95 - 64 */
@@ -165,37 +165,37 @@ void iwl3945_disable_events(struct iwl_priv *priv)
165 }; 165 };
166 166
167 base = le32_to_cpu(priv->card_alive.log_event_table_ptr); 167 base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
168 if (!iwl3945_hw_valid_rtc_data_addr(base)) { 168 if (!il3945_hw_valid_rtc_data_addr(base)) {
169 IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base); 169 IL_ERR(priv, "Invalid event log pointer 0x%08X\n", base);
170 return; 170 return;
171 } 171 }
172 172
173 disable_ptr = iwl_legacy_read_targ_mem(priv, base + (4 * sizeof(u32))); 173 disable_ptr = il_read_targ_mem(priv, base + (4 * sizeof(u32)));
174 array_size = iwl_legacy_read_targ_mem(priv, base + (5 * sizeof(u32))); 174 array_size = il_read_targ_mem(priv, base + (5 * sizeof(u32)));
175 175
176 if (IWL_EVT_DISABLE && (array_size == IWL_EVT_DISABLE_SIZE)) { 176 if (IL_EVT_DISABLE && (array_size == IL_EVT_DISABLE_SIZE)) {
177 IWL_DEBUG_INFO(priv, "Disabling selected uCode log events at 0x%x\n", 177 IL_DEBUG_INFO(priv, "Disabling selected uCode log events at 0x%x\n",
178 disable_ptr); 178 disable_ptr);
179 for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++) 179 for (i = 0; i < IL_EVT_DISABLE_SIZE; i++)
180 iwl_legacy_write_targ_mem(priv, 180 il_write_targ_mem(priv,
181 disable_ptr + (i * sizeof(u32)), 181 disable_ptr + (i * sizeof(u32)),
182 evt_disable[i]); 182 evt_disable[i]);
183 183
184 } else { 184 } else {
185 IWL_DEBUG_INFO(priv, "Selected uCode log events may be disabled\n"); 185 IL_DEBUG_INFO(priv, "Selected uCode log events may be disabled\n");
186 IWL_DEBUG_INFO(priv, " by writing \"1\"s into disable bitmap\n"); 186 IL_DEBUG_INFO(priv, " by writing \"1\"s into disable bitmap\n");
187 IWL_DEBUG_INFO(priv, " in SRAM at 0x%x, size %d u32s\n", 187 IL_DEBUG_INFO(priv, " in SRAM at 0x%x, size %d u32s\n",
188 disable_ptr, array_size); 188 disable_ptr, array_size);
189 } 189 }
190 190
191} 191}
192 192
193static int iwl3945_hwrate_to_plcp_idx(u8 plcp) 193static int il3945_hwrate_to_plcp_idx(u8 plcp)
194{ 194{
195 int idx; 195 int idx;
196 196
197 for (idx = 0; idx < IWL_RATE_COUNT_3945; idx++) 197 for (idx = 0; idx < IL_RATE_COUNT_3945; idx++)
198 if (iwl3945_rates[idx].plcp == plcp) 198 if (il3945_rates[idx].plcp == plcp)
199 return idx; 199 return idx;
200 return -1; 200 return -1;
201} 201}
@@ -203,7 +203,7 @@ static int iwl3945_hwrate_to_plcp_idx(u8 plcp)
203#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 203#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
204#define TX_STATUS_ENTRY(x) case TX_3945_STATUS_FAIL_ ## x: return #x 204#define TX_STATUS_ENTRY(x) case TX_3945_STATUS_FAIL_ ## x: return #x
205 205
206static const char *iwl3945_get_tx_fail_reason(u32 status) 206static const char *il3945_get_tx_fail_reason(u32 status)
207{ 207{
208 switch (status & TX_STATUS_MSK) { 208 switch (status & TX_STATUS_MSK) {
209 case TX_3945_STATUS_SUCCESS: 209 case TX_3945_STATUS_SUCCESS:
@@ -229,7 +229,7 @@ static const char *iwl3945_get_tx_fail_reason(u32 status)
229 return "UNKNOWN"; 229 return "UNKNOWN";
230} 230}
231#else 231#else
232static inline const char *iwl3945_get_tx_fail_reason(u32 status) 232static inline const char *il3945_get_tx_fail_reason(u32 status)
233{ 233{
234 return ""; 234 return "";
235} 235}
@@ -240,22 +240,22 @@ static inline const char *iwl3945_get_tx_fail_reason(u32 status)
240 * for A and B mode we need to overright prev 240 * for A and B mode we need to overright prev
241 * value 241 * value
242 */ 242 */
243int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate) 243int il3945_rs_next_rate(struct il_priv *priv, int rate)
244{ 244{
245 int next_rate = iwl3945_get_prev_ieee_rate(rate); 245 int next_rate = il3945_get_prev_ieee_rate(rate);
246 246
247 switch (priv->band) { 247 switch (priv->band) {
248 case IEEE80211_BAND_5GHZ: 248 case IEEE80211_BAND_5GHZ:
249 if (rate == IWL_RATE_12M_INDEX) 249 if (rate == IL_RATE_12M_INDEX)
250 next_rate = IWL_RATE_9M_INDEX; 250 next_rate = IL_RATE_9M_INDEX;
251 else if (rate == IWL_RATE_6M_INDEX) 251 else if (rate == IL_RATE_6M_INDEX)
252 next_rate = IWL_RATE_6M_INDEX; 252 next_rate = IL_RATE_6M_INDEX;
253 break; 253 break;
254 case IEEE80211_BAND_2GHZ: 254 case IEEE80211_BAND_2GHZ:
255 if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && 255 if (!(priv->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) &&
256 iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { 256 il_is_associated(priv, IL_RXON_CTX_BSS)) {
257 if (rate == IWL_RATE_11M_INDEX) 257 if (rate == IL_RATE_11M_INDEX)
258 next_rate = IWL_RATE_5M_INDEX; 258 next_rate = IL_RATE_5M_INDEX;
259 } 259 }
260 break; 260 break;
261 261
@@ -268,24 +268,24 @@ int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate)
268 268
269 269
270/** 270/**
271 * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd 271 * il3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd
272 * 272 *
273 * When FW advances 'R' index, all entries between old and new 'R' index 273 * When FW advances 'R' index, all entries between old and new 'R' index
274 * need to be reclaimed. As result, some free space forms. If there is 274 * need to be reclaimed. As result, some free space forms. If there is
275 * enough free space (> low mark), wake the stack that feeds us. 275 * enough free space (> low mark), wake the stack that feeds us.
276 */ 276 */
277static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv, 277static void il3945_tx_queue_reclaim(struct il_priv *priv,
278 int txq_id, int index) 278 int txq_id, int index)
279{ 279{
280 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 280 struct il_tx_queue *txq = &priv->txq[txq_id];
281 struct iwl_queue *q = &txq->q; 281 struct il_queue *q = &txq->q;
282 struct iwl_tx_info *tx_info; 282 struct il_tx_info *tx_info;
283 283
284 BUG_ON(txq_id == IWL39_CMD_QUEUE_NUM); 284 BUG_ON(txq_id == IWL39_CMD_QUEUE_NUM);
285 285
286 for (index = iwl_legacy_queue_inc_wrap(index, q->n_bd); 286 for (index = il_queue_inc_wrap(index, q->n_bd);
287 q->read_ptr != index; 287 q->read_ptr != index;
288 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) { 288 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) {
289 289
290 tx_info = &txq->txb[txq->q.read_ptr]; 290 tx_info = &txq->txb[txq->q.read_ptr];
291 ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb); 291 ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb);
@@ -293,31 +293,31 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
293 priv->cfg->ops->lib->txq_free_tfd(priv, txq); 293 priv->cfg->ops->lib->txq_free_tfd(priv, txq);
294 } 294 }
295 295
296 if (iwl_legacy_queue_space(q) > q->low_mark && (txq_id >= 0) && 296 if (il_queue_space(q) > q->low_mark && (txq_id >= 0) &&
297 (txq_id != IWL39_CMD_QUEUE_NUM) && 297 (txq_id != IWL39_CMD_QUEUE_NUM) &&
298 priv->mac80211_registered) 298 priv->mac80211_registered)
299 iwl_legacy_wake_queue(priv, txq); 299 il_wake_queue(priv, txq);
300} 300}
301 301
302/** 302/**
303 * iwl3945_rx_reply_tx - Handle Tx response 303 * il3945_rx_reply_tx - Handle Tx response
304 */ 304 */
305static void iwl3945_rx_reply_tx(struct iwl_priv *priv, 305static void il3945_rx_reply_tx(struct il_priv *priv,
306 struct iwl_rx_mem_buffer *rxb) 306 struct il_rx_mem_buffer *rxb)
307{ 307{
308 struct iwl_rx_packet *pkt = rxb_addr(rxb); 308 struct il_rx_packet *pkt = rxb_addr(rxb);
309 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 309 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
310 int txq_id = SEQ_TO_QUEUE(sequence); 310 int txq_id = SEQ_TO_QUEUE(sequence);
311 int index = SEQ_TO_INDEX(sequence); 311 int index = SEQ_TO_INDEX(sequence);
312 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 312 struct il_tx_queue *txq = &priv->txq[txq_id];
313 struct ieee80211_tx_info *info; 313 struct ieee80211_tx_info *info;
314 struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 314 struct il3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
315 u32 status = le32_to_cpu(tx_resp->status); 315 u32 status = le32_to_cpu(tx_resp->status);
316 int rate_idx; 316 int rate_idx;
317 int fail; 317 int fail;
318 318
319 if ((index >= txq->q.n_bd) || (iwl_legacy_queue_used(&txq->q, index) == 0)) { 319 if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) {
320 IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " 320 IL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d "
321 "is out of range [0-%d] %d %d\n", txq_id, 321 "is out of range [0-%d] %d %d\n", txq_id,
322 index, txq->q.n_bd, txq->q.write_ptr, 322 index, txq->q.n_bd, txq->q.write_ptr,
323 txq->q.read_ptr); 323 txq->q.read_ptr);
@@ -329,9 +329,9 @@ static void iwl3945_rx_reply_tx(struct iwl_priv *priv,
329 ieee80211_tx_info_clear_status(info); 329 ieee80211_tx_info_clear_status(info);
330 330
331 /* Fill the MRR chain with some info about on-chip retransmissions */ 331 /* Fill the MRR chain with some info about on-chip retransmissions */
332 rate_idx = iwl3945_hwrate_to_plcp_idx(tx_resp->rate); 332 rate_idx = il3945_hwrate_to_plcp_idx(tx_resp->rate);
333 if (info->band == IEEE80211_BAND_5GHZ) 333 if (info->band == IEEE80211_BAND_5GHZ)
334 rate_idx -= IWL_FIRST_OFDM_RATE; 334 rate_idx -= IL_FIRST_OFDM_RATE;
335 335
336 fail = tx_resp->failure_frame; 336 fail = tx_resp->failure_frame;
337 337
@@ -342,15 +342,15 @@ static void iwl3945_rx_reply_tx(struct iwl_priv *priv,
342 info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ? 342 info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ?
343 IEEE80211_TX_STAT_ACK : 0; 343 IEEE80211_TX_STAT_ACK : 0;
344 344
345 IWL_DEBUG_TX(priv, "Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", 345 IL_DEBUG_TX(priv, "Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n",
346 txq_id, iwl3945_get_tx_fail_reason(status), status, 346 txq_id, il3945_get_tx_fail_reason(status), status,
347 tx_resp->rate, tx_resp->failure_frame); 347 tx_resp->rate, tx_resp->failure_frame);
348 348
349 IWL_DEBUG_TX_REPLY(priv, "Tx queue reclaim %d\n", index); 349 IL_DEBUG_TX_REPLY(priv, "Tx queue reclaim %d\n", index);
350 iwl3945_tx_queue_reclaim(priv, txq_id, index); 350 il3945_tx_queue_reclaim(priv, txq_id, index);
351 351
352 if (status & TX_ABORT_REQUIRED_MSK) 352 if (status & TX_ABORT_REQUIRED_MSK)
353 IWL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n"); 353 IL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n");
354} 354}
355 355
356 356
@@ -363,7 +363,7 @@ static void iwl3945_rx_reply_tx(struct iwl_priv *priv,
363 * 363 *
364 *****************************************************************************/ 364 *****************************************************************************/
365#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 365#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
366static void iwl3945_accumulative_statistics(struct iwl_priv *priv, 366static void il3945_accumulative_statistics(struct il_priv *priv,
367 __le32 *stats) 367 __le32 *stats)
368{ 368{
369 int i; 369 int i;
@@ -376,7 +376,7 @@ static void iwl3945_accumulative_statistics(struct iwl_priv *priv,
376 delta = (u32 *)&priv->_3945.delta_statistics; 376 delta = (u32 *)&priv->_3945.delta_statistics;
377 max_delta = (u32 *)&priv->_3945.max_delta; 377 max_delta = (u32 *)&priv->_3945.max_delta;
378 378
379 for (i = sizeof(__le32); i < sizeof(struct iwl3945_notif_statistics); 379 for (i = sizeof(__le32); i < sizeof(struct il3945_notif_statistics);
380 i += sizeof(__le32), stats++, prev_stats++, delta++, 380 i += sizeof(__le32), stats++, prev_stats++, delta++,
381 max_delta++, accum_stats++) { 381 max_delta++, accum_stats++) {
382 if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) { 382 if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) {
@@ -396,39 +396,39 @@ static void iwl3945_accumulative_statistics(struct iwl_priv *priv,
396} 396}
397#endif 397#endif
398 398
399void iwl3945_hw_rx_statistics(struct iwl_priv *priv, 399void il3945_hw_rx_statistics(struct il_priv *priv,
400 struct iwl_rx_mem_buffer *rxb) 400 struct il_rx_mem_buffer *rxb)
401{ 401{
402 struct iwl_rx_packet *pkt = rxb_addr(rxb); 402 struct il_rx_packet *pkt = rxb_addr(rxb);
403 403
404 IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", 404 IL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
405 (int)sizeof(struct iwl3945_notif_statistics), 405 (int)sizeof(struct il3945_notif_statistics),
406 le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); 406 le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
407#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 407#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
408 iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw); 408 il3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw);
409#endif 409#endif
410 410
411 memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); 411 memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics));
412} 412}
413 413
414void iwl3945_reply_statistics(struct iwl_priv *priv, 414void il3945_reply_statistics(struct il_priv *priv,
415 struct iwl_rx_mem_buffer *rxb) 415 struct il_rx_mem_buffer *rxb)
416{ 416{
417 struct iwl_rx_packet *pkt = rxb_addr(rxb); 417 struct il_rx_packet *pkt = rxb_addr(rxb);
418 __le32 *flag = (__le32 *)&pkt->u.raw; 418 __le32 *flag = (__le32 *)&pkt->u.raw;
419 419
420 if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) { 420 if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) {
421#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 421#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
422 memset(&priv->_3945.accum_statistics, 0, 422 memset(&priv->_3945.accum_statistics, 0,
423 sizeof(struct iwl3945_notif_statistics)); 423 sizeof(struct il3945_notif_statistics));
424 memset(&priv->_3945.delta_statistics, 0, 424 memset(&priv->_3945.delta_statistics, 0,
425 sizeof(struct iwl3945_notif_statistics)); 425 sizeof(struct il3945_notif_statistics));
426 memset(&priv->_3945.max_delta, 0, 426 memset(&priv->_3945.max_delta, 0,
427 sizeof(struct iwl3945_notif_statistics)); 427 sizeof(struct il3945_notif_statistics));
428#endif 428#endif
429 IWL_DEBUG_RX(priv, "Statistics have been cleared\n"); 429 IL_DEBUG_RX(priv, "Statistics have been cleared\n");
430 } 430 }
431 iwl3945_hw_rx_statistics(priv, rxb); 431 il3945_hw_rx_statistics(priv, rxb);
432} 432}
433 433
434 434
@@ -439,7 +439,7 @@ void iwl3945_reply_statistics(struct iwl_priv *priv,
439 ******************************************************************************/ 439 ******************************************************************************/
440 440
441/* This is necessary only for a number of statistics, see the caller. */ 441/* This is necessary only for a number of statistics, see the caller. */
442static int iwl3945_is_network_packet(struct iwl_priv *priv, 442static int il3945_is_network_packet(struct il_priv *priv,
443 struct ieee80211_hdr *header) 443 struct ieee80211_hdr *header)
444{ 444{
445 /* Filter incoming packets to determine if they are targeted toward 445 /* Filter incoming packets to determine if they are targeted toward
@@ -456,14 +456,14 @@ static int iwl3945_is_network_packet(struct iwl_priv *priv,
456 } 456 }
457} 457}
458 458
459static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv, 459static void il3945_pass_packet_to_mac80211(struct il_priv *priv,
460 struct iwl_rx_mem_buffer *rxb, 460 struct il_rx_mem_buffer *rxb,
461 struct ieee80211_rx_status *stats) 461 struct ieee80211_rx_status *stats)
462{ 462{
463 struct iwl_rx_packet *pkt = rxb_addr(rxb); 463 struct il_rx_packet *pkt = rxb_addr(rxb);
464 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); 464 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IL_RX_DATA(pkt);
465 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); 465 struct il3945_rx_frame_hdr *rx_hdr = IL_RX_HDR(pkt);
466 struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); 466 struct il3945_rx_frame_end *rx_end = IL_RX_END(pkt);
467 u16 len = le16_to_cpu(rx_hdr->len); 467 u16 len = le16_to_cpu(rx_hdr->len);
468 struct sk_buff *skb; 468 struct sk_buff *skb;
469 __le16 fc = hdr->frame_control; 469 __le16 fc = hdr->frame_control;
@@ -471,32 +471,32 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv,
471 /* We received data from the HW, so stop the watchdog */ 471 /* We received data from the HW, so stop the watchdog */
472 if (unlikely(len + IWL39_RX_FRAME_SIZE > 472 if (unlikely(len + IWL39_RX_FRAME_SIZE >
473 PAGE_SIZE << priv->hw_params.rx_page_order)) { 473 PAGE_SIZE << priv->hw_params.rx_page_order)) {
474 IWL_DEBUG_DROP(priv, "Corruption detected!\n"); 474 IL_DEBUG_DROP(priv, "Corruption detected!\n");
475 return; 475 return;
476 } 476 }
477 477
478 /* We only process data packets if the interface is open */ 478 /* We only process data packets if the interface is open */
479 if (unlikely(!priv->is_open)) { 479 if (unlikely(!priv->is_open)) {
480 IWL_DEBUG_DROP_LIMIT(priv, 480 IL_DEBUG_DROP_LIMIT(priv,
481 "Dropping packet while interface is not open.\n"); 481 "Dropping packet while interface is not open.\n");
482 return; 482 return;
483 } 483 }
484 484
485 skb = dev_alloc_skb(128); 485 skb = dev_alloc_skb(128);
486 if (!skb) { 486 if (!skb) {
487 IWL_ERR(priv, "dev_alloc_skb failed\n"); 487 IL_ERR(priv, "dev_alloc_skb failed\n");
488 return; 488 return;
489 } 489 }
490 490
491 if (!iwl3945_mod_params.sw_crypto) 491 if (!il3945_mod_params.sw_crypto)
492 iwl_legacy_set_decrypted_flag(priv, 492 il_set_decrypted_flag(priv,
493 (struct ieee80211_hdr *)rxb_addr(rxb), 493 (struct ieee80211_hdr *)rxb_addr(rxb),
494 le32_to_cpu(rx_end->status), stats); 494 le32_to_cpu(rx_end->status), stats);
495 495
496 skb_add_rx_frag(skb, 0, rxb->page, 496 skb_add_rx_frag(skb, 0, rxb->page,
497 (void *)rx_hdr->payload - (void *)pkt, len); 497 (void *)rx_hdr->payload - (void *)pkt, len);
498 498
499 iwl_legacy_update_stats(priv, false, fc, len); 499 il_update_stats(priv, false, fc, len);
500 memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); 500 memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));
501 501
502 ieee80211_rx(priv->hw, skb); 502 ieee80211_rx(priv->hw, skb);
@@ -504,17 +504,17 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv,
504 rxb->page = NULL; 504 rxb->page = NULL;
505} 505}
506 506
507#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) 507#define IL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
508 508
509static void iwl3945_rx_reply_rx(struct iwl_priv *priv, 509static void il3945_rx_reply_rx(struct il_priv *priv,
510 struct iwl_rx_mem_buffer *rxb) 510 struct il_rx_mem_buffer *rxb)
511{ 511{
512 struct ieee80211_hdr *header; 512 struct ieee80211_hdr *header;
513 struct ieee80211_rx_status rx_status; 513 struct ieee80211_rx_status rx_status;
514 struct iwl_rx_packet *pkt = rxb_addr(rxb); 514 struct il_rx_packet *pkt = rxb_addr(rxb);
515 struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); 515 struct il3945_rx_frame_stats *rx_stats = IL_RX_STATS(pkt);
516 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); 516 struct il3945_rx_frame_hdr *rx_hdr = IL_RX_HDR(pkt);
517 struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); 517 struct il3945_rx_frame_end *rx_end = IL_RX_END(pkt);
518 u16 rx_stats_sig_avg __maybe_unused = le16_to_cpu(rx_stats->sig_avg); 518 u16 rx_stats_sig_avg __maybe_unused = le16_to_cpu(rx_stats->sig_avg);
519 u16 rx_stats_noise_diff __maybe_unused = le16_to_cpu(rx_stats->noise_diff); 519 u16 rx_stats_noise_diff __maybe_unused = le16_to_cpu(rx_stats->noise_diff);
520 u8 network_packet; 520 u8 network_packet;
@@ -527,9 +527,9 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
527 ieee80211_channel_to_frequency(le16_to_cpu(rx_hdr->channel), 527 ieee80211_channel_to_frequency(le16_to_cpu(rx_hdr->channel),
528 rx_status.band); 528 rx_status.band);
529 529
530 rx_status.rate_idx = iwl3945_hwrate_to_plcp_idx(rx_hdr->rate); 530 rx_status.rate_idx = il3945_hwrate_to_plcp_idx(rx_hdr->rate);
531 if (rx_status.band == IEEE80211_BAND_5GHZ) 531 if (rx_status.band == IEEE80211_BAND_5GHZ)
532 rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; 532 rx_status.rate_idx -= IL_FIRST_OFDM_RATE;
533 533
534 rx_status.antenna = (le16_to_cpu(rx_hdr->phy_flags) & 534 rx_status.antenna = (le16_to_cpu(rx_hdr->phy_flags) &
535 RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; 535 RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4;
@@ -539,14 +539,14 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
539 rx_status.flag |= RX_FLAG_SHORTPRE; 539 rx_status.flag |= RX_FLAG_SHORTPRE;
540 540
541 if ((unlikely(rx_stats->phy_count > 20))) { 541 if ((unlikely(rx_stats->phy_count > 20))) {
542 IWL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n", 542 IL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n",
543 rx_stats->phy_count); 543 rx_stats->phy_count);
544 return; 544 return;
545 } 545 }
546 546
547 if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR) 547 if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR)
548 || !(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { 548 || !(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) {
549 IWL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", rx_end->status); 549 IL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", rx_end->status);
550 return; 550 return;
551 } 551 }
552 552
@@ -555,21 +555,21 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
555 /* Convert 3945's rssi indicator to dBm */ 555 /* Convert 3945's rssi indicator to dBm */
556 rx_status.signal = rx_stats->rssi - IWL39_RSSI_OFFSET; 556 rx_status.signal = rx_stats->rssi - IWL39_RSSI_OFFSET;
557 557
558 IWL_DEBUG_STATS(priv, "Rssi %d sig_avg %d noise_diff %d\n", 558 IL_DEBUG_STATS(priv, "Rssi %d sig_avg %d noise_diff %d\n",
559 rx_status.signal, rx_stats_sig_avg, 559 rx_status.signal, rx_stats_sig_avg,
560 rx_stats_noise_diff); 560 rx_stats_noise_diff);
561 561
562 header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); 562 header = (struct ieee80211_hdr *)IL_RX_DATA(pkt);
563 563
564 network_packet = iwl3945_is_network_packet(priv, header); 564 network_packet = il3945_is_network_packet(priv, header);
565 565
566 IWL_DEBUG_STATS_LIMIT(priv, "[%c] %d RSSI:%d Signal:%u, Rate:%u\n", 566 IL_DEBUG_STATS_LIMIT(priv, "[%c] %d RSSI:%d Signal:%u, Rate:%u\n",
567 network_packet ? '*' : ' ', 567 network_packet ? '*' : ' ',
568 le16_to_cpu(rx_hdr->channel), 568 le16_to_cpu(rx_hdr->channel),
569 rx_status.signal, rx_status.signal, 569 rx_status.signal, rx_status.signal,
570 rx_status.rate_idx); 570 rx_status.rate_idx);
571 571
572 iwl_legacy_dbg_log_rx_data_frame(priv, le16_to_cpu(rx_hdr->len), 572 il_dbg_log_rx_data_frame(priv, le16_to_cpu(rx_hdr->len),
573 header); 573 header);
574 574
575 if (network_packet) { 575 if (network_packet) {
@@ -579,19 +579,19 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
579 priv->_3945.last_rx_rssi = rx_status.signal; 579 priv->_3945.last_rx_rssi = rx_status.signal;
580 } 580 }
581 581
582 iwl3945_pass_packet_to_mac80211(priv, rxb, &rx_status); 582 il3945_pass_packet_to_mac80211(priv, rxb, &rx_status);
583} 583}
584 584
585int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, 585int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv,
586 struct iwl_tx_queue *txq, 586 struct il_tx_queue *txq,
587 dma_addr_t addr, u16 len, u8 reset, u8 pad) 587 dma_addr_t addr, u16 len, u8 reset, u8 pad)
588{ 588{
589 int count; 589 int count;
590 struct iwl_queue *q; 590 struct il_queue *q;
591 struct iwl3945_tfd *tfd, *tfd_tmp; 591 struct il3945_tfd *tfd, *tfd_tmp;
592 592
593 q = &txq->q; 593 q = &txq->q;
594 tfd_tmp = (struct iwl3945_tfd *)txq->tfds; 594 tfd_tmp = (struct il3945_tfd *)txq->tfds;
595 tfd = &tfd_tmp[q->write_ptr]; 595 tfd = &tfd_tmp[q->write_ptr];
596 596
597 if (reset) 597 if (reset)
@@ -600,7 +600,7 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
600 count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); 600 count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
601 601
602 if ((count >= NUM_TFD_CHUNKS) || (count < 0)) { 602 if ((count >= NUM_TFD_CHUNKS) || (count < 0)) {
603 IWL_ERR(priv, "Error can not send more than %d chunks\n", 603 IL_ERR(priv, "Error can not send more than %d chunks\n",
604 NUM_TFD_CHUNKS); 604 NUM_TFD_CHUNKS);
605 return -EINVAL; 605 return -EINVAL;
606 } 606 }
@@ -617,15 +617,15 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
617} 617}
618 618
619/** 619/**
620 * iwl3945_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] 620 * il3945_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr]
621 * 621 *
622 * Does NOT advance any indexes 622 * Does NOT advance any indexes
623 */ 623 */
624void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) 624void il3945_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq)
625{ 625{
626 struct iwl3945_tfd *tfd_tmp = (struct iwl3945_tfd *)txq->tfds; 626 struct il3945_tfd *tfd_tmp = (struct il3945_tfd *)txq->tfds;
627 int index = txq->q.read_ptr; 627 int index = txq->q.read_ptr;
628 struct iwl3945_tfd *tfd = &tfd_tmp[index]; 628 struct il3945_tfd *tfd = &tfd_tmp[index];
629 struct pci_dev *dev = priv->pci_dev; 629 struct pci_dev *dev = priv->pci_dev;
630 int i; 630 int i;
631 int counter; 631 int counter;
@@ -633,7 +633,7 @@ void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
633 /* sanity check */ 633 /* sanity check */
634 counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); 634 counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
635 if (counter > NUM_TFD_CHUNKS) { 635 if (counter > NUM_TFD_CHUNKS) {
636 IWL_ERR(priv, "Too many chunks: %i\n", counter); 636 IL_ERR(priv, "Too many chunks: %i\n", counter);
637 /* @todo issue fatal error, it is quite serious situation */ 637 /* @todo issue fatal error, it is quite serious situation */
638 return; 638 return;
639 } 639 }
@@ -666,37 +666,37 @@ void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
666} 666}
667 667
668/** 668/**
669 * iwl3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: 669 * il3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD:
670 * 670 *
671*/ 671*/
672void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, 672void il3945_hw_build_tx_cmd_rate(struct il_priv *priv,
673 struct iwl_device_cmd *cmd, 673 struct il_device_cmd *cmd,
674 struct ieee80211_tx_info *info, 674 struct ieee80211_tx_info *info,
675 struct ieee80211_hdr *hdr, 675 struct ieee80211_hdr *hdr,
676 int sta_id, int tx_id) 676 int sta_id, int tx_id)
677{ 677{
678 u16 hw_value = ieee80211_get_tx_rate(priv->hw, info)->hw_value; 678 u16 hw_value = ieee80211_get_tx_rate(priv->hw, info)->hw_value;
679 u16 rate_index = min(hw_value & 0xffff, IWL_RATE_COUNT_3945); 679 u16 rate_index = min(hw_value & 0xffff, IL_RATE_COUNT_3945);
680 u16 rate_mask; 680 u16 rate_mask;
681 int rate; 681 int rate;
682 u8 rts_retry_limit; 682 u8 rts_retry_limit;
683 u8 data_retry_limit; 683 u8 data_retry_limit;
684 __le32 tx_flags; 684 __le32 tx_flags;
685 __le16 fc = hdr->frame_control; 685 __le16 fc = hdr->frame_control;
686 struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; 686 struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload;
687 687
688 rate = iwl3945_rates[rate_index].plcp; 688 rate = il3945_rates[rate_index].plcp;
689 tx_flags = tx_cmd->tx_flags; 689 tx_flags = tx_cmd->tx_flags;
690 690
691 /* We need to figure out how to get the sta->supp_rates while 691 /* We need to figure out how to get the sta->supp_rates while
692 * in this running context */ 692 * in this running context */
693 rate_mask = IWL_RATES_MASK_3945; 693 rate_mask = IL_RATES_MASK_3945;
694 694
695 /* Set retry limit on DATA packets and Probe Responses*/ 695 /* Set retry limit on DATA packets and Probe Responses*/
696 if (ieee80211_is_probe_resp(fc)) 696 if (ieee80211_is_probe_resp(fc))
697 data_retry_limit = 3; 697 data_retry_limit = 3;
698 else 698 else
699 data_retry_limit = IWL_DEFAULT_TX_RETRY; 699 data_retry_limit = IL_DEFAULT_TX_RETRY;
700 tx_cmd->data_retry_limit = data_retry_limit; 700 tx_cmd->data_retry_limit = data_retry_limit;
701 701
702 if (tx_id >= IWL39_CMD_QUEUE_NUM) 702 if (tx_id >= IWL39_CMD_QUEUE_NUM)
@@ -713,24 +713,24 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv,
713 713
714 /* OFDM */ 714 /* OFDM */
715 tx_cmd->supp_rates[0] = 715 tx_cmd->supp_rates[0] =
716 ((rate_mask & IWL_OFDM_RATES_MASK) >> IWL_FIRST_OFDM_RATE) & 0xFF; 716 ((rate_mask & IL_OFDM_RATES_MASK) >> IL_FIRST_OFDM_RATE) & 0xFF;
717 717
718 /* CCK */ 718 /* CCK */
719 tx_cmd->supp_rates[1] = (rate_mask & 0xF); 719 tx_cmd->supp_rates[1] = (rate_mask & 0xF);
720 720
721 IWL_DEBUG_RATE(priv, "Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " 721 IL_DEBUG_RATE(priv, "Tx sta id: %d, rate: %d (plcp), flags: 0x%4X "
722 "cck/ofdm mask: 0x%x/0x%x\n", sta_id, 722 "cck/ofdm mask: 0x%x/0x%x\n", sta_id,
723 tx_cmd->rate, le32_to_cpu(tx_cmd->tx_flags), 723 tx_cmd->rate, le32_to_cpu(tx_cmd->tx_flags),
724 tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]); 724 tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]);
725} 725}
726 726
727static u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate) 727static u8 il3945_sync_sta(struct il_priv *priv, int sta_id, u16 tx_rate)
728{ 728{
729 unsigned long flags_spin; 729 unsigned long flags_spin;
730 struct iwl_station_entry *station; 730 struct il_station_entry *station;
731 731
732 if (sta_id == IWL_INVALID_STATION) 732 if (sta_id == IL_INVALID_STATION)
733 return IWL_INVALID_STATION; 733 return IL_INVALID_STATION;
734 734
735 spin_lock_irqsave(&priv->sta_lock, flags_spin); 735 spin_lock_irqsave(&priv->sta_lock, flags_spin);
736 station = &priv->stations[sta_id]; 736 station = &priv->stations[sta_id];
@@ -738,46 +738,46 @@ static u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate)
738 station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK; 738 station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK;
739 station->sta.rate_n_flags = cpu_to_le16(tx_rate); 739 station->sta.rate_n_flags = cpu_to_le16(tx_rate);
740 station->sta.mode = STA_CONTROL_MODIFY_MSK; 740 station->sta.mode = STA_CONTROL_MODIFY_MSK;
741 iwl_legacy_send_add_sta(priv, &station->sta, CMD_ASYNC); 741 il_send_add_sta(priv, &station->sta, CMD_ASYNC);
742 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 742 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
743 743
744 IWL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n", 744 IL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n",
745 sta_id, tx_rate); 745 sta_id, tx_rate);
746 return sta_id; 746 return sta_id;
747} 747}
748 748
749static void iwl3945_set_pwr_vmain(struct iwl_priv *priv) 749static void il3945_set_pwr_vmain(struct il_priv *priv)
750{ 750{
751/* 751/*
752 * (for documentation purposes) 752 * (for documentation purposes)
753 * to set power to V_AUX, do 753 * to set power to V_AUX, do
754 754
755 if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) { 755 if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) {
756 iwl_legacy_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 756 il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
757 APMG_PS_CTRL_VAL_PWR_SRC_VAUX, 757 APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
758 ~APMG_PS_CTRL_MSK_PWR_SRC); 758 ~APMG_PS_CTRL_MSK_PWR_SRC);
759 759
760 iwl_poll_bit(priv, CSR_GPIO_IN, 760 il_poll_bit(priv, CSR_GPIO_IN,
761 CSR_GPIO_IN_VAL_VAUX_PWR_SRC, 761 CSR_GPIO_IN_VAL_VAUX_PWR_SRC,
762 CSR_GPIO_IN_BIT_AUX_POWER, 5000); 762 CSR_GPIO_IN_BIT_AUX_POWER, 5000);
763 } 763 }
764 */ 764 */
765 765
766 iwl_legacy_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 766 il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
767 APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, 767 APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
768 ~APMG_PS_CTRL_MSK_PWR_SRC); 768 ~APMG_PS_CTRL_MSK_PWR_SRC);
769 769
770 iwl_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, 770 il_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC,
771 CSR_GPIO_IN_BIT_AUX_POWER, 5000); /* uS */ 771 CSR_GPIO_IN_BIT_AUX_POWER, 5000); /* uS */
772} 772}
773 773
774static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 774static int il3945_rx_init(struct il_priv *priv, struct il_rx_queue *rxq)
775{ 775{
776 iwl_legacy_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->bd_dma); 776 il_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->bd_dma);
777 iwl_legacy_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0), 777 il_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0),
778 rxq->rb_stts_dma); 778 rxq->rb_stts_dma);
779 iwl_legacy_write_direct32(priv, FH39_RCSR_WPTR(0), 0); 779 il_write_direct32(priv, FH39_RCSR_WPTR(0), 0);
780 iwl_legacy_write_direct32(priv, FH39_RCSR_CONFIG(0), 780 il_write_direct32(priv, FH39_RCSR_CONFIG(0),
781 FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE | 781 FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE |
782 FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE | 782 FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE |
783 FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN | 783 FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN |
@@ -788,32 +788,32 @@ static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
788 FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH); 788 FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH);
789 789
790 /* fake read to flush all prev I/O */ 790 /* fake read to flush all prev I/O */
791 iwl_legacy_read_direct32(priv, FH39_RSSR_CTRL); 791 il_read_direct32(priv, FH39_RSSR_CTRL);
792 792
793 return 0; 793 return 0;
794} 794}
795 795
796static int iwl3945_tx_reset(struct iwl_priv *priv) 796static int il3945_tx_reset(struct il_priv *priv)
797{ 797{
798 798
799 /* bypass mode */ 799 /* bypass mode */
800 iwl_legacy_write_prph(priv, ALM_SCD_MODE_REG, 0x2); 800 il_write_prph(priv, ALM_SCD_MODE_REG, 0x2);
801 801
802 /* RA 0 is active */ 802 /* RA 0 is active */
803 iwl_legacy_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01); 803 il_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01);
804 804
805 /* all 6 fifo are active */ 805 /* all 6 fifo are active */
806 iwl_legacy_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f); 806 il_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f);
807 807
808 iwl_legacy_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000); 808 il_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000);
809 iwl_legacy_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002); 809 il_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002);
810 iwl_legacy_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004); 810 il_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004);
811 iwl_legacy_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); 811 il_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005);
812 812
813 iwl_legacy_write_direct32(priv, FH39_TSSR_CBB_BASE, 813 il_write_direct32(priv, FH39_TSSR_CBB_BASE,
814 priv->_3945.shared_phys); 814 priv->_3945.shared_phys);
815 815
816 iwl_legacy_write_direct32(priv, FH39_TSSR_MSG_CONFIG, 816 il_write_direct32(priv, FH39_TSSR_MSG_CONFIG,
817 FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | 817 FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON |
818 FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON | 818 FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON |
819 FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B | 819 FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B |
@@ -827,24 +827,24 @@ static int iwl3945_tx_reset(struct iwl_priv *priv)
827} 827}
828 828
829/** 829/**
830 * iwl3945_txq_ctx_reset - Reset TX queue context 830 * il3945_txq_ctx_reset - Reset TX queue context
831 * 831 *
832 * Destroys all DMA structures and initialize them again 832 * Destroys all DMA structures and initialize them again
833 */ 833 */
834static int iwl3945_txq_ctx_reset(struct iwl_priv *priv) 834static int il3945_txq_ctx_reset(struct il_priv *priv)
835{ 835{
836 int rc; 836 int rc;
837 int txq_id, slots_num; 837 int txq_id, slots_num;
838 838
839 iwl3945_hw_txq_ctx_free(priv); 839 il3945_hw_txq_ctx_free(priv);
840 840
841 /* allocate tx queue structure */ 841 /* allocate tx queue structure */
842 rc = iwl_legacy_alloc_txq_mem(priv); 842 rc = il_alloc_txq_mem(priv);
843 if (rc) 843 if (rc)
844 return rc; 844 return rc;
845 845
846 /* Tx CMD queue */ 846 /* Tx CMD queue */
847 rc = iwl3945_tx_reset(priv); 847 rc = il3945_tx_reset(priv);
848 if (rc) 848 if (rc)
849 goto error; 849 goto error;
850 850
@@ -852,10 +852,10 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
852 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { 852 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) {
853 slots_num = (txq_id == IWL39_CMD_QUEUE_NUM) ? 853 slots_num = (txq_id == IWL39_CMD_QUEUE_NUM) ?
854 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 854 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
855 rc = iwl_legacy_tx_queue_init(priv, &priv->txq[txq_id], 855 rc = il_tx_queue_init(priv, &priv->txq[txq_id],
856 slots_num, txq_id); 856 slots_num, txq_id);
857 if (rc) { 857 if (rc) {
858 IWL_ERR(priv, "Tx %d queue init failed\n", txq_id); 858 IL_ERR(priv, "Tx %d queue init failed\n", txq_id);
859 goto error; 859 goto error;
860 } 860 }
861 } 861 }
@@ -863,133 +863,133 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
863 return rc; 863 return rc;
864 864
865 error: 865 error:
866 iwl3945_hw_txq_ctx_free(priv); 866 il3945_hw_txq_ctx_free(priv);
867 return rc; 867 return rc;
868} 868}
869 869
870 870
871/* 871/*
872 * Start up 3945's basic functionality after it has been reset 872 * Start up 3945's basic functionality after it has been reset
873 * (e.g. after platform boot, or shutdown via iwl_legacy_apm_stop()) 873 * (e.g. after platform boot, or shutdown via il_apm_stop())
874 * NOTE: This does not load uCode nor start the embedded processor 874 * NOTE: This does not load uCode nor start the embedded processor
875 */ 875 */
876static int iwl3945_apm_init(struct iwl_priv *priv) 876static int il3945_apm_init(struct il_priv *priv)
877{ 877{
878 int ret = iwl_legacy_apm_init(priv); 878 int ret = il_apm_init(priv);
879 879
880 /* Clear APMG (NIC's internal power management) interrupts */ 880 /* Clear APMG (NIC's internal power management) interrupts */
881 iwl_legacy_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0); 881 il_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0);
882 iwl_legacy_write_prph(priv, APMG_RTC_INT_STT_REG, 0xFFFFFFFF); 882 il_write_prph(priv, APMG_RTC_INT_STT_REG, 0xFFFFFFFF);
883 883
884 /* Reset radio chip */ 884 /* Reset radio chip */
885 iwl_legacy_set_bits_prph(priv, APMG_PS_CTRL_REG, 885 il_set_bits_prph(priv, APMG_PS_CTRL_REG,
886 APMG_PS_CTRL_VAL_RESET_REQ); 886 APMG_PS_CTRL_VAL_RESET_REQ);
887 udelay(5); 887 udelay(5);
888 iwl_legacy_clear_bits_prph(priv, APMG_PS_CTRL_REG, 888 il_clear_bits_prph(priv, APMG_PS_CTRL_REG,
889 APMG_PS_CTRL_VAL_RESET_REQ); 889 APMG_PS_CTRL_VAL_RESET_REQ);
890 890
891 return ret; 891 return ret;
892} 892}
893 893
894static void iwl3945_nic_config(struct iwl_priv *priv) 894static void il3945_nic_config(struct il_priv *priv)
895{ 895{
896 struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; 896 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom;
897 unsigned long flags; 897 unsigned long flags;
898 u8 rev_id = priv->pci_dev->revision; 898 u8 rev_id = priv->pci_dev->revision;
899 899
900 spin_lock_irqsave(&priv->lock, flags); 900 spin_lock_irqsave(&priv->lock, flags);
901 901
902 /* Determine HW type */ 902 /* Determine HW type */
903 IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id); 903 IL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id);
904 904
905 if (rev_id & PCI_CFG_REV_ID_BIT_RTP) 905 if (rev_id & PCI_CFG_REV_ID_BIT_RTP)
906 IWL_DEBUG_INFO(priv, "RTP type\n"); 906 IL_DEBUG_INFO(priv, "RTP type\n");
907 else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) { 907 else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) {
908 IWL_DEBUG_INFO(priv, "3945 RADIO-MB type\n"); 908 IL_DEBUG_INFO(priv, "3945 RADIO-MB type\n");
909 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 909 il_set_bit(priv, CSR_HW_IF_CONFIG_REG,
910 CSR39_HW_IF_CONFIG_REG_BIT_3945_MB); 910 CSR39_HW_IF_CONFIG_REG_BIT_3945_MB);
911 } else { 911 } else {
912 IWL_DEBUG_INFO(priv, "3945 RADIO-MM type\n"); 912 IL_DEBUG_INFO(priv, "3945 RADIO-MM type\n");
913 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 913 il_set_bit(priv, CSR_HW_IF_CONFIG_REG,
914 CSR39_HW_IF_CONFIG_REG_BIT_3945_MM); 914 CSR39_HW_IF_CONFIG_REG_BIT_3945_MM);
915 } 915 }
916 916
917 if (EEPROM_SKU_CAP_OP_MODE_MRC == eeprom->sku_cap) { 917 if (EEPROM_SKU_CAP_OP_MODE_MRC == eeprom->sku_cap) {
918 IWL_DEBUG_INFO(priv, "SKU OP mode is mrc\n"); 918 IL_DEBUG_INFO(priv, "SKU OP mode is mrc\n");
919 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 919 il_set_bit(priv, CSR_HW_IF_CONFIG_REG,
920 CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC); 920 CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC);
921 } else 921 } else
922 IWL_DEBUG_INFO(priv, "SKU OP mode is basic\n"); 922 IL_DEBUG_INFO(priv, "SKU OP mode is basic\n");
923 923
924 if ((eeprom->board_revision & 0xF0) == 0xD0) { 924 if ((eeprom->board_revision & 0xF0) == 0xD0) {
925 IWL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n", 925 IL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n",
926 eeprom->board_revision); 926 eeprom->board_revision);
927 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 927 il_set_bit(priv, CSR_HW_IF_CONFIG_REG,
928 CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); 928 CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE);
929 } else { 929 } else {
930 IWL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n", 930 IL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n",
931 eeprom->board_revision); 931 eeprom->board_revision);
932 iwl_legacy_clear_bit(priv, CSR_HW_IF_CONFIG_REG, 932 il_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
933 CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); 933 CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE);
934 } 934 }
935 935
936 if (eeprom->almgor_m_version <= 1) { 936 if (eeprom->almgor_m_version <= 1) {
937 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 937 il_set_bit(priv, CSR_HW_IF_CONFIG_REG,
938 CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A); 938 CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A);
939 IWL_DEBUG_INFO(priv, "Card M type A version is 0x%X\n", 939 IL_DEBUG_INFO(priv, "Card M type A version is 0x%X\n",
940 eeprom->almgor_m_version); 940 eeprom->almgor_m_version);
941 } else { 941 } else {
942 IWL_DEBUG_INFO(priv, "Card M type B version is 0x%X\n", 942 IL_DEBUG_INFO(priv, "Card M type B version is 0x%X\n",
943 eeprom->almgor_m_version); 943 eeprom->almgor_m_version);
944 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 944 il_set_bit(priv, CSR_HW_IF_CONFIG_REG,
945 CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B); 945 CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B);
946 } 946 }
947 spin_unlock_irqrestore(&priv->lock, flags); 947 spin_unlock_irqrestore(&priv->lock, flags);
948 948
949 if (eeprom->sku_cap & EEPROM_SKU_CAP_SW_RF_KILL_ENABLE) 949 if (eeprom->sku_cap & EEPROM_SKU_CAP_SW_RF_KILL_ENABLE)
950 IWL_DEBUG_RF_KILL(priv, "SW RF KILL supported in EEPROM.\n"); 950 IL_DEBUG_RF_KILL(priv, "SW RF KILL supported in EEPROM.\n");
951 951
952 if (eeprom->sku_cap & EEPROM_SKU_CAP_HW_RF_KILL_ENABLE) 952 if (eeprom->sku_cap & EEPROM_SKU_CAP_HW_RF_KILL_ENABLE)
953 IWL_DEBUG_RF_KILL(priv, "HW RF KILL supported in EEPROM.\n"); 953 IL_DEBUG_RF_KILL(priv, "HW RF KILL supported in EEPROM.\n");
954} 954}
955 955
956int iwl3945_hw_nic_init(struct iwl_priv *priv) 956int il3945_hw_nic_init(struct il_priv *priv)
957{ 957{
958 int rc; 958 int rc;
959 unsigned long flags; 959 unsigned long flags;
960 struct iwl_rx_queue *rxq = &priv->rxq; 960 struct il_rx_queue *rxq = &priv->rxq;
961 961
962 spin_lock_irqsave(&priv->lock, flags); 962 spin_lock_irqsave(&priv->lock, flags);
963 priv->cfg->ops->lib->apm_ops.init(priv); 963 priv->cfg->ops->lib->apm_ops.init(priv);
964 spin_unlock_irqrestore(&priv->lock, flags); 964 spin_unlock_irqrestore(&priv->lock, flags);
965 965
966 iwl3945_set_pwr_vmain(priv); 966 il3945_set_pwr_vmain(priv);
967 967
968 priv->cfg->ops->lib->apm_ops.config(priv); 968 priv->cfg->ops->lib->apm_ops.config(priv);
969 969
970 /* Allocate the RX queue, or reset if it is already allocated */ 970 /* Allocate the RX queue, or reset if it is already allocated */
971 if (!rxq->bd) { 971 if (!rxq->bd) {
972 rc = iwl_legacy_rx_queue_alloc(priv); 972 rc = il_rx_queue_alloc(priv);
973 if (rc) { 973 if (rc) {
974 IWL_ERR(priv, "Unable to initialize Rx queue\n"); 974 IL_ERR(priv, "Unable to initialize Rx queue\n");
975 return -ENOMEM; 975 return -ENOMEM;
976 } 976 }
977 } else 977 } else
978 iwl3945_rx_queue_reset(priv, rxq); 978 il3945_rx_queue_reset(priv, rxq);
979 979
980 iwl3945_rx_replenish(priv); 980 il3945_rx_replenish(priv);
981 981
982 iwl3945_rx_init(priv, rxq); 982 il3945_rx_init(priv, rxq);
983 983
984 984
985 /* Look at using this instead: 985 /* Look at using this instead:
986 rxq->need_update = 1; 986 rxq->need_update = 1;
987 iwl_legacy_rx_queue_update_write_ptr(priv, rxq); 987 il_rx_queue_update_write_ptr(priv, rxq);
988 */ 988 */
989 989
990 iwl_legacy_write_direct32(priv, FH39_RCSR_WPTR(0), rxq->write & ~7); 990 il_write_direct32(priv, FH39_RCSR_WPTR(0), rxq->write & ~7);
991 991
992 rc = iwl3945_txq_ctx_reset(priv); 992 rc = il3945_txq_ctx_reset(priv);
993 if (rc) 993 if (rc)
994 return rc; 994 return rc;
995 995
@@ -999,11 +999,11 @@ int iwl3945_hw_nic_init(struct iwl_priv *priv)
999} 999}
1000 1000
1001/** 1001/**
1002 * iwl3945_hw_txq_ctx_free - Free TXQ Context 1002 * il3945_hw_txq_ctx_free - Free TXQ Context
1003 * 1003 *
1004 * Destroy all TX DMA queues and structures 1004 * Destroy all TX DMA queues and structures
1005 */ 1005 */
1006void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv) 1006void il3945_hw_txq_ctx_free(struct il_priv *priv)
1007{ 1007{
1008 int txq_id; 1008 int txq_id;
1009 1009
@@ -1012,73 +1012,73 @@ void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv)
1012 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; 1012 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num;
1013 txq_id++) 1013 txq_id++)
1014 if (txq_id == IWL39_CMD_QUEUE_NUM) 1014 if (txq_id == IWL39_CMD_QUEUE_NUM)
1015 iwl_legacy_cmd_queue_free(priv); 1015 il_cmd_queue_free(priv);
1016 else 1016 else
1017 iwl_legacy_tx_queue_free(priv, txq_id); 1017 il_tx_queue_free(priv, txq_id);
1018 1018
1019 /* free tx queue structure */ 1019 /* free tx queue structure */
1020 iwl_legacy_txq_mem(priv); 1020 il_txq_mem(priv);
1021} 1021}
1022 1022
1023void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv) 1023void il3945_hw_txq_ctx_stop(struct il_priv *priv)
1024{ 1024{
1025 int txq_id; 1025 int txq_id;
1026 1026
1027 /* stop SCD */ 1027 /* stop SCD */
1028 iwl_legacy_write_prph(priv, ALM_SCD_MODE_REG, 0); 1028 il_write_prph(priv, ALM_SCD_MODE_REG, 0);
1029 iwl_legacy_write_prph(priv, ALM_SCD_TXFACT_REG, 0); 1029 il_write_prph(priv, ALM_SCD_TXFACT_REG, 0);
1030 1030
1031 /* reset TFD queues */ 1031 /* reset TFD queues */
1032 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { 1032 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) {
1033 iwl_legacy_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), 0x0); 1033 il_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), 0x0);
1034 iwl_poll_direct_bit(priv, FH39_TSSR_TX_STATUS, 1034 il_poll_direct_bit(priv, FH39_TSSR_TX_STATUS,
1035 FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(txq_id), 1035 FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(txq_id),
1036 1000); 1036 1000);
1037 } 1037 }
1038 1038
1039 iwl3945_hw_txq_ctx_free(priv); 1039 il3945_hw_txq_ctx_free(priv);
1040} 1040}
1041 1041
1042/** 1042/**
1043 * iwl3945_hw_reg_adjust_power_by_temp 1043 * il3945_hw_reg_adjust_power_by_temp
1044 * return index delta into power gain settings table 1044 * return index delta into power gain settings table
1045*/ 1045*/
1046static int iwl3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading) 1046static int il3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading)
1047{ 1047{
1048 return (new_reading - old_reading) * (-11) / 100; 1048 return (new_reading - old_reading) * (-11) / 100;
1049} 1049}
1050 1050
1051/** 1051/**
1052 * iwl3945_hw_reg_temp_out_of_range - Keep temperature in sane range 1052 * il3945_hw_reg_temp_out_of_range - Keep temperature in sane range
1053 */ 1053 */
1054static inline int iwl3945_hw_reg_temp_out_of_range(int temperature) 1054static inline int il3945_hw_reg_temp_out_of_range(int temperature)
1055{ 1055{
1056 return ((temperature < -260) || (temperature > 25)) ? 1 : 0; 1056 return ((temperature < -260) || (temperature > 25)) ? 1 : 0;
1057} 1057}
1058 1058
1059int iwl3945_hw_get_temperature(struct iwl_priv *priv) 1059int il3945_hw_get_temperature(struct il_priv *priv)
1060{ 1060{
1061 return iwl_read32(priv, CSR_UCODE_DRV_GP2); 1061 return il_read32(priv, CSR_UCODE_DRV_GP2);
1062} 1062}
1063 1063
1064/** 1064/**
1065 * iwl3945_hw_reg_txpower_get_temperature 1065 * il3945_hw_reg_txpower_get_temperature
1066 * get the current temperature by reading from NIC 1066 * get the current temperature by reading from NIC
1067*/ 1067*/
1068static int iwl3945_hw_reg_txpower_get_temperature(struct iwl_priv *priv) 1068static int il3945_hw_reg_txpower_get_temperature(struct il_priv *priv)
1069{ 1069{
1070 struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; 1070 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom;
1071 int temperature; 1071 int temperature;
1072 1072
1073 temperature = iwl3945_hw_get_temperature(priv); 1073 temperature = il3945_hw_get_temperature(priv);
1074 1074
1075 /* driver's okay range is -260 to +25. 1075 /* driver's okay range is -260 to +25.
1076 * human readable okay range is 0 to +285 */ 1076 * human readable okay range is 0 to +285 */
1077 IWL_DEBUG_INFO(priv, "Temperature: %d\n", temperature + IWL_TEMP_CONVERT); 1077 IL_DEBUG_INFO(priv, "Temperature: %d\n", temperature + IL_TEMP_CONVERT);
1078 1078
1079 /* handle insane temp reading */ 1079 /* handle insane temp reading */
1080 if (iwl3945_hw_reg_temp_out_of_range(temperature)) { 1080 if (il3945_hw_reg_temp_out_of_range(temperature)) {
1081 IWL_ERR(priv, "Error bad temperature value %d\n", temperature); 1081 IL_ERR(priv, "Error bad temperature value %d\n", temperature);
1082 1082
1083 /* if really really hot(?), 1083 /* if really really hot(?),
1084 * substitute the 3rd band/group's temp measured at factory */ 1084 * substitute the 3rd band/group's temp measured at factory */
@@ -1094,37 +1094,37 @@ static int iwl3945_hw_reg_txpower_get_temperature(struct iwl_priv *priv)
1094/* Adjust Txpower only if temperature variance is greater than threshold. 1094/* Adjust Txpower only if temperature variance is greater than threshold.
1095 * 1095 *
1096 * Both are lower than older versions' 9 degrees */ 1096 * Both are lower than older versions' 9 degrees */
1097#define IWL_TEMPERATURE_LIMIT_TIMER 6 1097#define IL_TEMPERATURE_LIMIT_TIMER 6
1098 1098
1099/** 1099/**
1100 * iwl3945_is_temp_calib_needed - determines if new calibration is needed 1100 * il3945_is_temp_calib_needed - determines if new calibration is needed
1101 * 1101 *
1102 * records new temperature in tx_mgr->temperature. 1102 * records new temperature in tx_mgr->temperature.
1103 * replaces tx_mgr->last_temperature *only* if calib needed 1103 * replaces tx_mgr->last_temperature *only* if calib needed
1104 * (assumes caller will actually do the calibration!). */ 1104 * (assumes caller will actually do the calibration!). */
1105static int iwl3945_is_temp_calib_needed(struct iwl_priv *priv) 1105static int il3945_is_temp_calib_needed(struct il_priv *priv)
1106{ 1106{
1107 int temp_diff; 1107 int temp_diff;
1108 1108
1109 priv->temperature = iwl3945_hw_reg_txpower_get_temperature(priv); 1109 priv->temperature = il3945_hw_reg_txpower_get_temperature(priv);
1110 temp_diff = priv->temperature - priv->last_temperature; 1110 temp_diff = priv->temperature - priv->last_temperature;
1111 1111
1112 /* get absolute value */ 1112 /* get absolute value */
1113 if (temp_diff < 0) { 1113 if (temp_diff < 0) {
1114 IWL_DEBUG_POWER(priv, "Getting cooler, delta %d,\n", temp_diff); 1114 IL_DEBUG_POWER(priv, "Getting cooler, delta %d,\n", temp_diff);
1115 temp_diff = -temp_diff; 1115 temp_diff = -temp_diff;
1116 } else if (temp_diff == 0) 1116 } else if (temp_diff == 0)
1117 IWL_DEBUG_POWER(priv, "Same temp,\n"); 1117 IL_DEBUG_POWER(priv, "Same temp,\n");
1118 else 1118 else
1119 IWL_DEBUG_POWER(priv, "Getting warmer, delta %d,\n", temp_diff); 1119 IL_DEBUG_POWER(priv, "Getting warmer, delta %d,\n", temp_diff);
1120 1120
1121 /* if we don't need calibration, *don't* update last_temperature */ 1121 /* if we don't need calibration, *don't* update last_temperature */
1122 if (temp_diff < IWL_TEMPERATURE_LIMIT_TIMER) { 1122 if (temp_diff < IL_TEMPERATURE_LIMIT_TIMER) {
1123 IWL_DEBUG_POWER(priv, "Timed thermal calib not needed\n"); 1123 IL_DEBUG_POWER(priv, "Timed thermal calib not needed\n");
1124 return 0; 1124 return 0;
1125 } 1125 }
1126 1126
1127 IWL_DEBUG_POWER(priv, "Timed thermal calib needed\n"); 1127 IL_DEBUG_POWER(priv, "Timed thermal calib needed\n");
1128 1128
1129 /* assume that caller will actually do calib ... 1129 /* assume that caller will actually do calib ...
1130 * update the "last temperature" value */ 1130 * update the "last temperature" value */
@@ -1132,13 +1132,13 @@ static int iwl3945_is_temp_calib_needed(struct iwl_priv *priv)
1132 return 1; 1132 return 1;
1133} 1133}
1134 1134
1135#define IWL_MAX_GAIN_ENTRIES 78 1135#define IL_MAX_GAIN_ENTRIES 78
1136#define IWL_CCK_FROM_OFDM_POWER_DIFF -5 1136#define IL_CCK_FROM_OFDM_POWER_DIFF -5
1137#define IWL_CCK_FROM_OFDM_INDEX_DIFF (10) 1137#define IL_CCK_FROM_OFDM_INDEX_DIFF (10)
1138 1138
1139/* radio and DSP power table, each step is 1/2 dB. 1139/* radio and DSP power table, each step is 1/2 dB.
1140 * 1st number is for RF analog gain, 2nd number is for DSP pre-DAC gain. */ 1140 * 1st number is for RF analog gain, 2nd number is for DSP pre-DAC gain. */
1141static struct iwl3945_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = { 1141static struct il3945_tx_power power_gain_table[2][IL_MAX_GAIN_ENTRIES] = {
1142 { 1142 {
1143 {251, 127}, /* 2.4 GHz, highest power */ 1143 {251, 127}, /* 2.4 GHz, highest power */
1144 {251, 127}, 1144 {251, 127},
@@ -1299,12 +1299,12 @@ static struct iwl3945_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = {
1299 {3, 120} } /* 5.x GHz, lowest power */ 1299 {3, 120} } /* 5.x GHz, lowest power */
1300}; 1300};
1301 1301
1302static inline u8 iwl3945_hw_reg_fix_power_index(int index) 1302static inline u8 il3945_hw_reg_fix_power_index(int index)
1303{ 1303{
1304 if (index < 0) 1304 if (index < 0)
1305 return 0; 1305 return 0;
1306 if (index >= IWL_MAX_GAIN_ENTRIES) 1306 if (index >= IL_MAX_GAIN_ENTRIES)
1307 return IWL_MAX_GAIN_ENTRIES - 1; 1307 return IL_MAX_GAIN_ENTRIES - 1;
1308 return (u8) index; 1308 return (u8) index;
1309} 1309}
1310 1310
@@ -1312,17 +1312,17 @@ static inline u8 iwl3945_hw_reg_fix_power_index(int index)
1312#define REG_RECALIB_PERIOD (60) 1312#define REG_RECALIB_PERIOD (60)
1313 1313
1314/** 1314/**
1315 * iwl3945_hw_reg_set_scan_power - Set Tx power for scan probe requests 1315 * il3945_hw_reg_set_scan_power - Set Tx power for scan probe requests
1316 * 1316 *
1317 * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK) 1317 * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK)
1318 * or 6 Mbit (OFDM) rates. 1318 * or 6 Mbit (OFDM) rates.
1319 */ 1319 */
1320static void iwl3945_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index, 1320static void il3945_hw_reg_set_scan_power(struct il_priv *priv, u32 scan_tbl_index,
1321 s32 rate_index, const s8 *clip_pwrs, 1321 s32 rate_index, const s8 *clip_pwrs,
1322 struct iwl_channel_info *ch_info, 1322 struct il_channel_info *ch_info,
1323 int band_index) 1323 int band_index)
1324{ 1324{
1325 struct iwl3945_scan_power_info *scan_power_info; 1325 struct il3945_scan_power_info *scan_power_info;
1326 s8 power; 1326 s8 power;
1327 u8 power_index; 1327 u8 power_index;
1328 1328
@@ -1331,7 +1331,7 @@ static void iwl3945_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_in
1331 /* use this channel group's 6Mbit clipping/saturation pwr, 1331 /* use this channel group's 6Mbit clipping/saturation pwr,
1332 * but cap at regulatory scan power restriction (set during init 1332 * but cap at regulatory scan power restriction (set during init
1333 * based on eeprom channel data) for this channel. */ 1333 * based on eeprom channel data) for this channel. */
1334 power = min(ch_info->scan_power, clip_pwrs[IWL_RATE_6M_INDEX_TABLE]); 1334 power = min(ch_info->scan_power, clip_pwrs[IL_RATE_6M_INDEX_TABLE]);
1335 1335
1336 power = min(power, priv->tx_power_user_lmt); 1336 power = min(power, priv->tx_power_user_lmt);
1337 scan_power_info->requested_power = power; 1337 scan_power_info->requested_power = power;
@@ -1343,7 +1343,7 @@ static void iwl3945_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_in
1343 * *index*. */ 1343 * *index*. */
1344 power_index = ch_info->power_info[rate_index].power_table_index 1344 power_index = ch_info->power_info[rate_index].power_table_index
1345 - (power - ch_info->power_info 1345 - (power - ch_info->power_info
1346 [IWL_RATE_6M_INDEX_TABLE].requested_power) * 2; 1346 [IL_RATE_6M_INDEX_TABLE].requested_power) * 2;
1347 1347
1348 /* store reference index that we use when adjusting *all* scan 1348 /* store reference index that we use when adjusting *all* scan
1349 * powers. So we can accommodate user (all channel) or spectrum 1349 * powers. So we can accommodate user (all channel) or spectrum
@@ -1355,7 +1355,7 @@ static void iwl3945_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_in
1355 * of the table. */ 1355 * of the table. */
1356 1356
1357 /* don't exceed table bounds for "real" setting */ 1357 /* don't exceed table bounds for "real" setting */
1358 power_index = iwl3945_hw_reg_fix_power_index(power_index); 1358 power_index = il3945_hw_reg_fix_power_index(power_index);
1359 1359
1360 scan_power_info->power_table_index = power_index; 1360 scan_power_info->power_table_index = power_index;
1361 scan_power_info->tpc.tx_gain = 1361 scan_power_info->tpc.tx_gain =
@@ -1365,17 +1365,17 @@ static void iwl3945_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_in
1365} 1365}
1366 1366
1367/** 1367/**
1368 * iwl3945_send_tx_power - fill in Tx Power command with gain settings 1368 * il3945_send_tx_power - fill in Tx Power command with gain settings
1369 * 1369 *
1370 * Configures power settings for all rates for the current channel, 1370 * Configures power settings for all rates for the current channel,
1371 * using values from channel info struct, and send to NIC 1371 * using values from channel info struct, and send to NIC
1372 */ 1372 */
1373static int iwl3945_send_tx_power(struct iwl_priv *priv) 1373static int il3945_send_tx_power(struct il_priv *priv)
1374{ 1374{
1375 int rate_idx, i; 1375 int rate_idx, i;
1376 const struct iwl_channel_info *ch_info = NULL; 1376 const struct il_channel_info *ch_info = NULL;
1377 struct iwl3945_txpowertable_cmd txpower = { 1377 struct il3945_txpowertable_cmd txpower = {
1378 .channel = priv->contexts[IWL_RXON_CTX_BSS].active.channel, 1378 .channel = priv->contexts[IL_RXON_CTX_BSS].active.channel,
1379 }; 1379 };
1380 u16 chan; 1380 u16 chan;
1381 1381
@@ -1383,32 +1383,32 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv)
1383 "TX Power requested while scanning!\n")) 1383 "TX Power requested while scanning!\n"))
1384 return -EAGAIN; 1384 return -EAGAIN;
1385 1385
1386 chan = le16_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.channel); 1386 chan = le16_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.channel);
1387 1387
1388 txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1; 1388 txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
1389 ch_info = iwl_legacy_get_channel_info(priv, priv->band, chan); 1389 ch_info = il_get_channel_info(priv, priv->band, chan);
1390 if (!ch_info) { 1390 if (!ch_info) {
1391 IWL_ERR(priv, 1391 IL_ERR(priv,
1392 "Failed to get channel info for channel %d [%d]\n", 1392 "Failed to get channel info for channel %d [%d]\n",
1393 chan, priv->band); 1393 chan, priv->band);
1394 return -EINVAL; 1394 return -EINVAL;
1395 } 1395 }
1396 1396
1397 if (!iwl_legacy_is_channel_valid(ch_info)) { 1397 if (!il_is_channel_valid(ch_info)) {
1398 IWL_DEBUG_POWER(priv, "Not calling TX_PWR_TABLE_CMD on " 1398 IL_DEBUG_POWER(priv, "Not calling TX_PWR_TABLE_CMD on "
1399 "non-Tx channel.\n"); 1399 "non-Tx channel.\n");
1400 return 0; 1400 return 0;
1401 } 1401 }
1402 1402
1403 /* fill cmd with power settings for all rates for current channel */ 1403 /* fill cmd with power settings for all rates for current channel */
1404 /* Fill OFDM rate */ 1404 /* Fill OFDM rate */
1405 for (rate_idx = IWL_FIRST_OFDM_RATE, i = 0; 1405 for (rate_idx = IL_FIRST_OFDM_RATE, i = 0;
1406 rate_idx <= IWL39_LAST_OFDM_RATE; rate_idx++, i++) { 1406 rate_idx <= IWL39_LAST_OFDM_RATE; rate_idx++, i++) {
1407 1407
1408 txpower.power[i].tpc = ch_info->power_info[i].tpc; 1408 txpower.power[i].tpc = ch_info->power_info[i].tpc;
1409 txpower.power[i].rate = iwl3945_rates[rate_idx].plcp; 1409 txpower.power[i].rate = il3945_rates[rate_idx].plcp;
1410 1410
1411 IWL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", 1411 IL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
1412 le16_to_cpu(txpower.channel), 1412 le16_to_cpu(txpower.channel),
1413 txpower.band, 1413 txpower.band,
1414 txpower.power[i].tpc.tx_gain, 1414 txpower.power[i].tpc.tx_gain,
@@ -1416,12 +1416,12 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv)
1416 txpower.power[i].rate); 1416 txpower.power[i].rate);
1417 } 1417 }
1418 /* Fill CCK rates */ 1418 /* Fill CCK rates */
1419 for (rate_idx = IWL_FIRST_CCK_RATE; 1419 for (rate_idx = IL_FIRST_CCK_RATE;
1420 rate_idx <= IWL_LAST_CCK_RATE; rate_idx++, i++) { 1420 rate_idx <= IL_LAST_CCK_RATE; rate_idx++, i++) {
1421 txpower.power[i].tpc = ch_info->power_info[i].tpc; 1421 txpower.power[i].tpc = ch_info->power_info[i].tpc;
1422 txpower.power[i].rate = iwl3945_rates[rate_idx].plcp; 1422 txpower.power[i].rate = il3945_rates[rate_idx].plcp;
1423 1423
1424 IWL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", 1424 IL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
1425 le16_to_cpu(txpower.channel), 1425 le16_to_cpu(txpower.channel),
1426 txpower.band, 1426 txpower.band,
1427 txpower.power[i].tpc.tx_gain, 1427 txpower.power[i].tpc.tx_gain,
@@ -1429,14 +1429,14 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv)
1429 txpower.power[i].rate); 1429 txpower.power[i].rate);
1430 } 1430 }
1431 1431
1432 return iwl_legacy_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, 1432 return il_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD,
1433 sizeof(struct iwl3945_txpowertable_cmd), 1433 sizeof(struct il3945_txpowertable_cmd),
1434 &txpower); 1434 &txpower);
1435 1435
1436} 1436}
1437 1437
1438/** 1438/**
1439 * iwl3945_hw_reg_set_new_power - Configures power tables at new levels 1439 * il3945_hw_reg_set_new_power - Configures power tables at new levels
1440 * @ch_info: Channel to update. Uses power_info.requested_power. 1440 * @ch_info: Channel to update. Uses power_info.requested_power.
1441 * 1441 *
1442 * Replace requested_power and base_power_index ch_info fields for 1442 * Replace requested_power and base_power_index ch_info fields for
@@ -1451,10 +1451,10 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv)
1451 * properly fill out the scan powers, and actual h/w gain settings, 1451 * properly fill out the scan powers, and actual h/w gain settings,
1452 * and send changes to NIC 1452 * and send changes to NIC
1453 */ 1453 */
1454static int iwl3945_hw_reg_set_new_power(struct iwl_priv *priv, 1454static int il3945_hw_reg_set_new_power(struct il_priv *priv,
1455 struct iwl_channel_info *ch_info) 1455 struct il_channel_info *ch_info)
1456{ 1456{
1457 struct iwl3945_channel_power_info *power_info; 1457 struct il3945_channel_power_info *power_info;
1458 int power_changed = 0; 1458 int power_changed = 0;
1459 int i; 1459 int i;
1460 const s8 *clip_pwrs; 1460 const s8 *clip_pwrs;
@@ -1467,7 +1467,7 @@ static int iwl3945_hw_reg_set_new_power(struct iwl_priv *priv,
1467 power_info = ch_info->power_info; 1467 power_info = ch_info->power_info;
1468 1468
1469 /* update OFDM Txpower settings */ 1469 /* update OFDM Txpower settings */
1470 for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; 1470 for (i = IL_RATE_6M_INDEX_TABLE; i <= IL_RATE_54M_INDEX_TABLE;
1471 i++, ++power_info) { 1471 i++, ++power_info) {
1472 int delta_idx; 1472 int delta_idx;
1473 1473
@@ -1491,15 +1491,15 @@ static int iwl3945_hw_reg_set_new_power(struct iwl_priv *priv,
1491 * ... all CCK power settings for a given channel are the *same*. */ 1491 * ... all CCK power settings for a given channel are the *same*. */
1492 if (power_changed) { 1492 if (power_changed) {
1493 power = 1493 power =
1494 ch_info->power_info[IWL_RATE_12M_INDEX_TABLE]. 1494 ch_info->power_info[IL_RATE_12M_INDEX_TABLE].
1495 requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF; 1495 requested_power + IL_CCK_FROM_OFDM_POWER_DIFF;
1496 1496
1497 /* do all CCK rates' iwl3945_channel_power_info structures */ 1497 /* do all CCK rates' il3945_channel_power_info structures */
1498 for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) { 1498 for (i = IL_RATE_1M_INDEX_TABLE; i <= IL_RATE_11M_INDEX_TABLE; i++) {
1499 power_info->requested_power = power; 1499 power_info->requested_power = power;
1500 power_info->base_power_index = 1500 power_info->base_power_index =
1501 ch_info->power_info[IWL_RATE_12M_INDEX_TABLE]. 1501 ch_info->power_info[IL_RATE_12M_INDEX_TABLE].
1502 base_power_index + IWL_CCK_FROM_OFDM_INDEX_DIFF; 1502 base_power_index + IL_CCK_FROM_OFDM_INDEX_DIFF;
1503 ++power_info; 1503 ++power_info;
1504 } 1504 }
1505 } 1505 }
@@ -1508,13 +1508,13 @@ static int iwl3945_hw_reg_set_new_power(struct iwl_priv *priv,
1508} 1508}
1509 1509
1510/** 1510/**
1511 * iwl3945_hw_reg_get_ch_txpower_limit - returns new power limit for channel 1511 * il3945_hw_reg_get_ch_txpower_limit - returns new power limit for channel
1512 * 1512 *
1513 * NOTE: Returned power limit may be less (but not more) than requested, 1513 * NOTE: Returned power limit may be less (but not more) than requested,
1514 * based strictly on regulatory (eeprom and spectrum mgt) limitations 1514 * based strictly on regulatory (eeprom and spectrum mgt) limitations
1515 * (no consideration for h/w clipping limitations). 1515 * (no consideration for h/w clipping limitations).
1516 */ 1516 */
1517static int iwl3945_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info) 1517static int il3945_hw_reg_get_ch_txpower_limit(struct il_channel_info *ch_info)
1518{ 1518{
1519 s8 max_power; 1519 s8 max_power;
1520 1520
@@ -1533,7 +1533,7 @@ static int iwl3945_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info)
1533} 1533}
1534 1534
1535/** 1535/**
1536 * iwl3945_hw_reg_comp_txpower_temp - Compensate for temperature 1536 * il3945_hw_reg_comp_txpower_temp - Compensate for temperature
1537 * 1537 *
1538 * Compensate txpower settings of *all* channels for temperature. 1538 * Compensate txpower settings of *all* channels for temperature.
1539 * This only accounts for the difference between current temperature 1539 * This only accounts for the difference between current temperature
@@ -1542,10 +1542,10 @@ static int iwl3945_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info)
1542 * 1542 *
1543 * If RxOn is "associated", this sends the new Txpower to NIC! 1543 * If RxOn is "associated", this sends the new Txpower to NIC!
1544 */ 1544 */
1545static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv) 1545static int il3945_hw_reg_comp_txpower_temp(struct il_priv *priv)
1546{ 1546{
1547 struct iwl_channel_info *ch_info = NULL; 1547 struct il_channel_info *ch_info = NULL;
1548 struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; 1548 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom;
1549 int delta_index; 1549 int delta_index;
1550 const s8 *clip_pwrs; /* array of h/w max power levels for each rate */ 1550 const s8 *clip_pwrs; /* array of h/w max power levels for each rate */
1551 u8 a_band; 1551 u8 a_band;
@@ -1563,7 +1563,7 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
1563 /* set up new Tx power info for each and every channel, 2.4 and 5.x */ 1563 /* set up new Tx power info for each and every channel, 2.4 and 5.x */
1564 for (i = 0; i < priv->channel_count; i++) { 1564 for (i = 0; i < priv->channel_count; i++) {
1565 ch_info = &priv->channel_info[i]; 1565 ch_info = &priv->channel_info[i];
1566 a_band = iwl_legacy_is_channel_a_band(ch_info); 1566 a_band = il_is_channel_a_band(ch_info);
1567 1567
1568 /* Get this chnlgrp's factory calibration temperature */ 1568 /* Get this chnlgrp's factory calibration temperature */
1569 ref_temp = (s16)eeprom->groups[ch_info->group_index]. 1569 ref_temp = (s16)eeprom->groups[ch_info->group_index].
@@ -1571,11 +1571,11 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
1571 1571
1572 /* get power index adjustment based on current and factory 1572 /* get power index adjustment based on current and factory
1573 * temps */ 1573 * temps */
1574 delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature, 1574 delta_index = il3945_hw_reg_adjust_power_by_temp(temperature,
1575 ref_temp); 1575 ref_temp);
1576 1576
1577 /* set tx power value for all rates, OFDM and CCK */ 1577 /* set tx power value for all rates, OFDM and CCK */
1578 for (rate_index = 0; rate_index < IWL_RATE_COUNT_3945; 1578 for (rate_index = 0; rate_index < IL_RATE_COUNT_3945;
1579 rate_index++) { 1579 rate_index++) {
1580 int power_idx = 1580 int power_idx =
1581 ch_info->power_info[rate_index].base_power_index; 1581 ch_info->power_info[rate_index].base_power_index;
@@ -1584,7 +1584,7 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
1584 power_idx += delta_index; 1584 power_idx += delta_index;
1585 1585
1586 /* stay within table range */ 1586 /* stay within table range */
1587 power_idx = iwl3945_hw_reg_fix_power_index(power_idx); 1587 power_idx = il3945_hw_reg_fix_power_index(power_idx);
1588 ch_info->power_info[rate_index]. 1588 ch_info->power_info[rate_index].
1589 power_table_index = (u8) power_idx; 1589 power_table_index = (u8) power_idx;
1590 ch_info->power_info[rate_index].tpc = 1590 ch_info->power_info[rate_index].tpc =
@@ -1596,10 +1596,10 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
1596 1596
1597 /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */ 1597 /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */
1598 for (scan_tbl_index = 0; 1598 for (scan_tbl_index = 0;
1599 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { 1599 scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) {
1600 s32 actual_index = (scan_tbl_index == 0) ? 1600 s32 actual_index = (scan_tbl_index == 0) ?
1601 IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE; 1601 IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE;
1602 iwl3945_hw_reg_set_scan_power(priv, scan_tbl_index, 1602 il3945_hw_reg_set_scan_power(priv, scan_tbl_index,
1603 actual_index, clip_pwrs, 1603 actual_index, clip_pwrs,
1604 ch_info, a_band); 1604 ch_info, a_band);
1605 } 1605 }
@@ -1609,68 +1609,68 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
1609 return priv->cfg->ops->lib->send_tx_power(priv); 1609 return priv->cfg->ops->lib->send_tx_power(priv);
1610} 1610}
1611 1611
1612int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) 1612int il3945_hw_reg_set_txpower(struct il_priv *priv, s8 power)
1613{ 1613{
1614 struct iwl_channel_info *ch_info; 1614 struct il_channel_info *ch_info;
1615 s8 max_power; 1615 s8 max_power;
1616 u8 a_band; 1616 u8 a_band;
1617 u8 i; 1617 u8 i;
1618 1618
1619 if (priv->tx_power_user_lmt == power) { 1619 if (priv->tx_power_user_lmt == power) {
1620 IWL_DEBUG_POWER(priv, "Requested Tx power same as current " 1620 IL_DEBUG_POWER(priv, "Requested Tx power same as current "
1621 "limit: %ddBm.\n", power); 1621 "limit: %ddBm.\n", power);
1622 return 0; 1622 return 0;
1623 } 1623 }
1624 1624
1625 IWL_DEBUG_POWER(priv, "Setting upper limit clamp to %ddBm.\n", power); 1625 IL_DEBUG_POWER(priv, "Setting upper limit clamp to %ddBm.\n", power);
1626 priv->tx_power_user_lmt = power; 1626 priv->tx_power_user_lmt = power;
1627 1627
1628 /* set up new Tx powers for each and every channel, 2.4 and 5.x */ 1628 /* set up new Tx powers for each and every channel, 2.4 and 5.x */
1629 1629
1630 for (i = 0; i < priv->channel_count; i++) { 1630 for (i = 0; i < priv->channel_count; i++) {
1631 ch_info = &priv->channel_info[i]; 1631 ch_info = &priv->channel_info[i];
1632 a_band = iwl_legacy_is_channel_a_band(ch_info); 1632 a_band = il_is_channel_a_band(ch_info);
1633 1633
1634 /* find minimum power of all user and regulatory constraints 1634 /* find minimum power of all user and regulatory constraints
1635 * (does not consider h/w clipping limitations) */ 1635 * (does not consider h/w clipping limitations) */
1636 max_power = iwl3945_hw_reg_get_ch_txpower_limit(ch_info); 1636 max_power = il3945_hw_reg_get_ch_txpower_limit(ch_info);
1637 max_power = min(power, max_power); 1637 max_power = min(power, max_power);
1638 if (max_power != ch_info->curr_txpow) { 1638 if (max_power != ch_info->curr_txpow) {
1639 ch_info->curr_txpow = max_power; 1639 ch_info->curr_txpow = max_power;
1640 1640
1641 /* this considers the h/w clipping limitations */ 1641 /* this considers the h/w clipping limitations */
1642 iwl3945_hw_reg_set_new_power(priv, ch_info); 1642 il3945_hw_reg_set_new_power(priv, ch_info);
1643 } 1643 }
1644 } 1644 }
1645 1645
1646 /* update txpower settings for all channels, 1646 /* update txpower settings for all channels,
1647 * send to NIC if associated. */ 1647 * send to NIC if associated. */
1648 iwl3945_is_temp_calib_needed(priv); 1648 il3945_is_temp_calib_needed(priv);
1649 iwl3945_hw_reg_comp_txpower_temp(priv); 1649 il3945_hw_reg_comp_txpower_temp(priv);
1650 1650
1651 return 0; 1651 return 0;
1652} 1652}
1653 1653
1654static int iwl3945_send_rxon_assoc(struct iwl_priv *priv, 1654static int il3945_send_rxon_assoc(struct il_priv *priv,
1655 struct iwl_rxon_context *ctx) 1655 struct il_rxon_context *ctx)
1656{ 1656{
1657 int rc = 0; 1657 int rc = 0;
1658 struct iwl_rx_packet *pkt; 1658 struct il_rx_packet *pkt;
1659 struct iwl3945_rxon_assoc_cmd rxon_assoc; 1659 struct il3945_rxon_assoc_cmd rxon_assoc;
1660 struct iwl_host_cmd cmd = { 1660 struct il_host_cmd cmd = {
1661 .id = REPLY_RXON_ASSOC, 1661 .id = REPLY_RXON_ASSOC,
1662 .len = sizeof(rxon_assoc), 1662 .len = sizeof(rxon_assoc),
1663 .flags = CMD_WANT_SKB, 1663 .flags = CMD_WANT_SKB,
1664 .data = &rxon_assoc, 1664 .data = &rxon_assoc,
1665 }; 1665 };
1666 const struct iwl_legacy_rxon_cmd *rxon1 = &ctx->staging; 1666 const struct il_rxon_cmd *rxon1 = &ctx->staging;
1667 const struct iwl_legacy_rxon_cmd *rxon2 = &ctx->active; 1667 const struct il_rxon_cmd *rxon2 = &ctx->active;
1668 1668
1669 if ((rxon1->flags == rxon2->flags) && 1669 if ((rxon1->flags == rxon2->flags) &&
1670 (rxon1->filter_flags == rxon2->filter_flags) && 1670 (rxon1->filter_flags == rxon2->filter_flags) &&
1671 (rxon1->cck_basic_rates == rxon2->cck_basic_rates) && 1671 (rxon1->cck_basic_rates == rxon2->cck_basic_rates) &&
1672 (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { 1672 (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) {
1673 IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); 1673 IL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n");
1674 return 0; 1674 return 0;
1675 } 1675 }
1676 1676
@@ -1680,41 +1680,41 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv,
1680 rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; 1680 rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates;
1681 rxon_assoc.reserved = 0; 1681 rxon_assoc.reserved = 0;
1682 1682
1683 rc = iwl_legacy_send_cmd_sync(priv, &cmd); 1683 rc = il_send_cmd_sync(priv, &cmd);
1684 if (rc) 1684 if (rc)
1685 return rc; 1685 return rc;
1686 1686
1687 pkt = (struct iwl_rx_packet *)cmd.reply_page; 1687 pkt = (struct il_rx_packet *)cmd.reply_page;
1688 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { 1688 if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
1689 IWL_ERR(priv, "Bad return from REPLY_RXON_ASSOC command\n"); 1689 IL_ERR(priv, "Bad return from REPLY_RXON_ASSOC command\n");
1690 rc = -EIO; 1690 rc = -EIO;
1691 } 1691 }
1692 1692
1693 iwl_legacy_free_pages(priv, cmd.reply_page); 1693 il_free_pages(priv, cmd.reply_page);
1694 1694
1695 return rc; 1695 return rc;
1696} 1696}
1697 1697
1698/** 1698/**
1699 * iwl3945_commit_rxon - commit staging_rxon to hardware 1699 * il3945_commit_rxon - commit staging_rxon to hardware
1700 * 1700 *
1701 * The RXON command in staging_rxon is committed to the hardware and 1701 * The RXON command in staging_rxon is committed to the hardware and
1702 * the active_rxon structure is updated with the new data. This 1702 * the active_rxon structure is updated with the new data. This
1703 * function correctly transitions out of the RXON_ASSOC_MSK state if 1703 * function correctly transitions out of the RXON_ASSOC_MSK state if
1704 * a HW tune is required based on the RXON structure changes. 1704 * a HW tune is required based on the RXON structure changes.
1705 */ 1705 */
1706int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) 1706int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx)
1707{ 1707{
1708 /* cast away the const for active_rxon in this function */ 1708 /* cast away the const for active_rxon in this function */
1709 struct iwl3945_rxon_cmd *active_rxon = (void *)&ctx->active; 1709 struct il3945_rxon_cmd *active_rxon = (void *)&ctx->active;
1710 struct iwl3945_rxon_cmd *staging_rxon = (void *)&ctx->staging; 1710 struct il3945_rxon_cmd *staging_rxon = (void *)&ctx->staging;
1711 int rc = 0; 1711 int rc = 0;
1712 bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK); 1712 bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK);
1713 1713
1714 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1714 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
1715 return -EINVAL; 1715 return -EINVAL;
1716 1716
1717 if (!iwl_legacy_is_alive(priv)) 1717 if (!il_is_alive(priv))
1718 return -1; 1718 return -1;
1719 1719
1720 /* always get timestamp with Rx frame */ 1720 /* always get timestamp with Rx frame */
@@ -1723,23 +1723,23 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1723 /* select antenna */ 1723 /* select antenna */
1724 staging_rxon->flags &= 1724 staging_rxon->flags &=
1725 ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); 1725 ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK);
1726 staging_rxon->flags |= iwl3945_get_antenna_flags(priv); 1726 staging_rxon->flags |= il3945_get_antenna_flags(priv);
1727 1727
1728 rc = iwl_legacy_check_rxon_cmd(priv, ctx); 1728 rc = il_check_rxon_cmd(priv, ctx);
1729 if (rc) { 1729 if (rc) {
1730 IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); 1730 IL_ERR(priv, "Invalid RXON configuration. Not committing.\n");
1731 return -EINVAL; 1731 return -EINVAL;
1732 } 1732 }
1733 1733
1734 /* If we don't need to send a full RXON, we can use 1734 /* If we don't need to send a full RXON, we can use
1735 * iwl3945_rxon_assoc_cmd which is used to reconfigure filter 1735 * il3945_rxon_assoc_cmd which is used to reconfigure filter
1736 * and other flags for the current radio configuration. */ 1736 * and other flags for the current radio configuration. */
1737 if (!iwl_legacy_full_rxon_required(priv, 1737 if (!il_full_rxon_required(priv,
1738 &priv->contexts[IWL_RXON_CTX_BSS])) { 1738 &priv->contexts[IL_RXON_CTX_BSS])) {
1739 rc = iwl_legacy_send_rxon_assoc(priv, 1739 rc = il_send_rxon_assoc(priv,
1740 &priv->contexts[IWL_RXON_CTX_BSS]); 1740 &priv->contexts[IL_RXON_CTX_BSS]);
1741 if (rc) { 1741 if (rc) {
1742 IWL_ERR(priv, "Error setting RXON_ASSOC " 1742 IL_ERR(priv, "Error setting RXON_ASSOC "
1743 "configuration (%d).\n", rc); 1743 "configuration (%d).\n", rc);
1744 return rc; 1744 return rc;
1745 } 1745 }
@@ -1749,7 +1749,7 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1749 * We do not commit tx power settings while channel changing, 1749 * We do not commit tx power settings while channel changing,
1750 * do it now if tx power changed. 1750 * do it now if tx power changed.
1751 */ 1751 */
1752 iwl_legacy_set_tx_power(priv, priv->tx_power_next, false); 1752 il_set_tx_power(priv, priv->tx_power_next, false);
1753 return 0; 1753 return 0;
1754 } 1754 }
1755 1755
@@ -1757,8 +1757,8 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1757 * an RXON_ASSOC and the new config wants the associated mask enabled, 1757 * an RXON_ASSOC and the new config wants the associated mask enabled,
1758 * we must clear the associated from the active configuration 1758 * we must clear the associated from the active configuration
1759 * before we apply the new config */ 1759 * before we apply the new config */
1760 if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS) && new_assoc) { 1760 if (il_is_associated(priv, IL_RXON_CTX_BSS) && new_assoc) {
1761 IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); 1761 IL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n");
1762 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1762 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1763 1763
1764 /* 1764 /*
@@ -1767,25 +1767,25 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1767 */ 1767 */
1768 active_rxon->reserved4 = 0; 1768 active_rxon->reserved4 = 0;
1769 active_rxon->reserved5 = 0; 1769 active_rxon->reserved5 = 0;
1770 rc = iwl_legacy_send_cmd_pdu(priv, REPLY_RXON, 1770 rc = il_send_cmd_pdu(priv, REPLY_RXON,
1771 sizeof(struct iwl3945_rxon_cmd), 1771 sizeof(struct il3945_rxon_cmd),
1772 &priv->contexts[IWL_RXON_CTX_BSS].active); 1772 &priv->contexts[IL_RXON_CTX_BSS].active);
1773 1773
1774 /* If the mask clearing failed then we set 1774 /* If the mask clearing failed then we set
1775 * active_rxon back to what it was previously */ 1775 * active_rxon back to what it was previously */
1776 if (rc) { 1776 if (rc) {
1777 active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; 1777 active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK;
1778 IWL_ERR(priv, "Error clearing ASSOC_MSK on current " 1778 IL_ERR(priv, "Error clearing ASSOC_MSK on current "
1779 "configuration (%d).\n", rc); 1779 "configuration (%d).\n", rc);
1780 return rc; 1780 return rc;
1781 } 1781 }
1782 iwl_legacy_clear_ucode_stations(priv, 1782 il_clear_ucode_stations(priv,
1783 &priv->contexts[IWL_RXON_CTX_BSS]); 1783 &priv->contexts[IL_RXON_CTX_BSS]);
1784 iwl_legacy_restore_stations(priv, 1784 il_restore_stations(priv,
1785 &priv->contexts[IWL_RXON_CTX_BSS]); 1785 &priv->contexts[IL_RXON_CTX_BSS]);
1786 } 1786 }
1787 1787
1788 IWL_DEBUG_INFO(priv, "Sending RXON\n" 1788 IL_DEBUG_INFO(priv, "Sending RXON\n"
1789 "* with%s RXON_FILTER_ASSOC_MSK\n" 1789 "* with%s RXON_FILTER_ASSOC_MSK\n"
1790 "* channel = %d\n" 1790 "* channel = %d\n"
1791 "* bssid = %pM\n", 1791 "* bssid = %pM\n",
@@ -1800,38 +1800,38 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1800 staging_rxon->reserved4 = 0; 1800 staging_rxon->reserved4 = 0;
1801 staging_rxon->reserved5 = 0; 1801 staging_rxon->reserved5 = 0;
1802 1802
1803 iwl_legacy_set_rxon_hwcrypto(priv, ctx, !iwl3945_mod_params.sw_crypto); 1803 il_set_rxon_hwcrypto(priv, ctx, !il3945_mod_params.sw_crypto);
1804 1804
1805 /* Apply the new configuration */ 1805 /* Apply the new configuration */
1806 rc = iwl_legacy_send_cmd_pdu(priv, REPLY_RXON, 1806 rc = il_send_cmd_pdu(priv, REPLY_RXON,
1807 sizeof(struct iwl3945_rxon_cmd), 1807 sizeof(struct il3945_rxon_cmd),
1808 staging_rxon); 1808 staging_rxon);
1809 if (rc) { 1809 if (rc) {
1810 IWL_ERR(priv, "Error setting new configuration (%d).\n", rc); 1810 IL_ERR(priv, "Error setting new configuration (%d).\n", rc);
1811 return rc; 1811 return rc;
1812 } 1812 }
1813 1813
1814 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); 1814 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
1815 1815
1816 if (!new_assoc) { 1816 if (!new_assoc) {
1817 iwl_legacy_clear_ucode_stations(priv, 1817 il_clear_ucode_stations(priv,
1818 &priv->contexts[IWL_RXON_CTX_BSS]); 1818 &priv->contexts[IL_RXON_CTX_BSS]);
1819 iwl_legacy_restore_stations(priv, 1819 il_restore_stations(priv,
1820 &priv->contexts[IWL_RXON_CTX_BSS]); 1820 &priv->contexts[IL_RXON_CTX_BSS]);
1821 } 1821 }
1822 1822
1823 /* If we issue a new RXON command which required a tune then we must 1823 /* If we issue a new RXON command which required a tune then we must
1824 * send a new TXPOWER command or we won't be able to Tx any frames */ 1824 * send a new TXPOWER command or we won't be able to Tx any frames */
1825 rc = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true); 1825 rc = il_set_tx_power(priv, priv->tx_power_next, true);
1826 if (rc) { 1826 if (rc) {
1827 IWL_ERR(priv, "Error setting Tx power (%d).\n", rc); 1827 IL_ERR(priv, "Error setting Tx power (%d).\n", rc);
1828 return rc; 1828 return rc;
1829 } 1829 }
1830 1830
1831 /* Init the hardware's rate fallback order based on the band */ 1831 /* Init the hardware's rate fallback order based on the band */
1832 rc = iwl3945_init_hw_rate_table(priv); 1832 rc = il3945_init_hw_rate_table(priv);
1833 if (rc) { 1833 if (rc) {
1834 IWL_ERR(priv, "Error setting HW rate table: %02X\n", rc); 1834 IL_ERR(priv, "Error setting HW rate table: %02X\n", rc);
1835 return -EIO; 1835 return -EIO;
1836 } 1836 }
1837 1837
@@ -1839,7 +1839,7 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1839} 1839}
1840 1840
1841/** 1841/**
1842 * iwl3945_reg_txpower_periodic - called when time to check our temperature. 1842 * il3945_reg_txpower_periodic - called when time to check our temperature.
1843 * 1843 *
1844 * -- reset periodic timer 1844 * -- reset periodic timer
1845 * -- see if temp has changed enough to warrant re-calibration ... if so: 1845 * -- see if temp has changed enough to warrant re-calibration ... if so:
@@ -1848,38 +1848,38 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1848 * -- send new set of gain settings to NIC 1848 * -- send new set of gain settings to NIC
1849 * NOTE: This should continue working, even when we're not associated, 1849 * NOTE: This should continue working, even when we're not associated,
1850 * so we can keep our internal table of scan powers current. */ 1850 * so we can keep our internal table of scan powers current. */
1851void iwl3945_reg_txpower_periodic(struct iwl_priv *priv) 1851void il3945_reg_txpower_periodic(struct il_priv *priv)
1852{ 1852{
1853 /* This will kick in the "brute force" 1853 /* This will kick in the "brute force"
1854 * iwl3945_hw_reg_comp_txpower_temp() below */ 1854 * il3945_hw_reg_comp_txpower_temp() below */
1855 if (!iwl3945_is_temp_calib_needed(priv)) 1855 if (!il3945_is_temp_calib_needed(priv))
1856 goto reschedule; 1856 goto reschedule;
1857 1857
1858 /* Set up a new set of temp-adjusted TxPowers, send to NIC. 1858 /* Set up a new set of temp-adjusted TxPowers, send to NIC.
1859 * This is based *only* on current temperature, 1859 * This is based *only* on current temperature,
1860 * ignoring any previous power measurements */ 1860 * ignoring any previous power measurements */
1861 iwl3945_hw_reg_comp_txpower_temp(priv); 1861 il3945_hw_reg_comp_txpower_temp(priv);
1862 1862
1863 reschedule: 1863 reschedule:
1864 queue_delayed_work(priv->workqueue, 1864 queue_delayed_work(priv->workqueue,
1865 &priv->_3945.thermal_periodic, REG_RECALIB_PERIOD * HZ); 1865 &priv->_3945.thermal_periodic, REG_RECALIB_PERIOD * HZ);
1866} 1866}
1867 1867
1868static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) 1868static void il3945_bg_reg_txpower_periodic(struct work_struct *work)
1869{ 1869{
1870 struct iwl_priv *priv = container_of(work, struct iwl_priv, 1870 struct il_priv *priv = container_of(work, struct il_priv,
1871 _3945.thermal_periodic.work); 1871 _3945.thermal_periodic.work);
1872 1872
1873 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1873 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
1874 return; 1874 return;
1875 1875
1876 mutex_lock(&priv->mutex); 1876 mutex_lock(&priv->mutex);
1877 iwl3945_reg_txpower_periodic(priv); 1877 il3945_reg_txpower_periodic(priv);
1878 mutex_unlock(&priv->mutex); 1878 mutex_unlock(&priv->mutex);
1879} 1879}
1880 1880
1881/** 1881/**
1882 * iwl3945_hw_reg_get_ch_grp_index - find the channel-group index (0-4) 1882 * il3945_hw_reg_get_ch_grp_index - find the channel-group index (0-4)
1883 * for the channel. 1883 * for the channel.
1884 * 1884 *
1885 * This function is used when initializing channel-info structs. 1885 * This function is used when initializing channel-info structs.
@@ -1889,17 +1889,17 @@ static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work)
1889 * on A-band, EEPROM's "group frequency" entries represent the top 1889 * on A-band, EEPROM's "group frequency" entries represent the top
1890 * channel in each group 1-4. Group 5 All B/G channels are in group 0. 1890 * channel in each group 1-4. Group 5 All B/G channels are in group 0.
1891 */ 1891 */
1892static u16 iwl3945_hw_reg_get_ch_grp_index(struct iwl_priv *priv, 1892static u16 il3945_hw_reg_get_ch_grp_index(struct il_priv *priv,
1893 const struct iwl_channel_info *ch_info) 1893 const struct il_channel_info *ch_info)
1894{ 1894{
1895 struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; 1895 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom;
1896 struct iwl3945_eeprom_txpower_group *ch_grp = &eeprom->groups[0]; 1896 struct il3945_eeprom_txpower_group *ch_grp = &eeprom->groups[0];
1897 u8 group; 1897 u8 group;
1898 u16 group_index = 0; /* based on factory calib frequencies */ 1898 u16 group_index = 0; /* based on factory calib frequencies */
1899 u8 grp_channel; 1899 u8 grp_channel;
1900 1900
1901 /* Find the group index for the channel ... don't use index 1(?) */ 1901 /* Find the group index for the channel ... don't use index 1(?) */
1902 if (iwl_legacy_is_channel_a_band(ch_info)) { 1902 if (il_is_channel_a_band(ch_info)) {
1903 for (group = 1; group < 5; group++) { 1903 for (group = 1; group < 5; group++) {
1904 grp_channel = ch_grp[group].group_channel; 1904 grp_channel = ch_grp[group].group_channel;
1905 if (ch_info->channel <= grp_channel) { 1905 if (ch_info->channel <= grp_channel) {
@@ -1913,27 +1913,27 @@ static u16 iwl3945_hw_reg_get_ch_grp_index(struct iwl_priv *priv,
1913 } else 1913 } else
1914 group_index = 0; /* 2.4 GHz, group 0 */ 1914 group_index = 0; /* 2.4 GHz, group 0 */
1915 1915
1916 IWL_DEBUG_POWER(priv, "Chnl %d mapped to grp %d\n", ch_info->channel, 1916 IL_DEBUG_POWER(priv, "Chnl %d mapped to grp %d\n", ch_info->channel,
1917 group_index); 1917 group_index);
1918 return group_index; 1918 return group_index;
1919} 1919}
1920 1920
1921/** 1921/**
1922 * iwl3945_hw_reg_get_matched_power_index - Interpolate to get nominal index 1922 * il3945_hw_reg_get_matched_power_index - Interpolate to get nominal index
1923 * 1923 *
1924 * Interpolate to get nominal (i.e. at factory calibration temperature) index 1924 * Interpolate to get nominal (i.e. at factory calibration temperature) index
1925 * into radio/DSP gain settings table for requested power. 1925 * into radio/DSP gain settings table for requested power.
1926 */ 1926 */
1927static int iwl3945_hw_reg_get_matched_power_index(struct iwl_priv *priv, 1927static int il3945_hw_reg_get_matched_power_index(struct il_priv *priv,
1928 s8 requested_power, 1928 s8 requested_power,
1929 s32 setting_index, s32 *new_index) 1929 s32 setting_index, s32 *new_index)
1930{ 1930{
1931 const struct iwl3945_eeprom_txpower_group *chnl_grp = NULL; 1931 const struct il3945_eeprom_txpower_group *chnl_grp = NULL;
1932 struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; 1932 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom;
1933 s32 index0, index1; 1933 s32 index0, index1;
1934 s32 power = 2 * requested_power; 1934 s32 power = 2 * requested_power;
1935 s32 i; 1935 s32 i;
1936 const struct iwl3945_eeprom_txpower_sample *samples; 1936 const struct il3945_eeprom_txpower_sample *samples;
1937 s32 gains0, gains1; 1937 s32 gains0, gains1;
1938 s32 res; 1938 s32 res;
1939 s32 denominator; 1939 s32 denominator;
@@ -1973,23 +1973,23 @@ static int iwl3945_hw_reg_get_matched_power_index(struct iwl_priv *priv,
1973 return 0; 1973 return 0;
1974} 1974}
1975 1975
1976static void iwl3945_hw_reg_init_channel_groups(struct iwl_priv *priv) 1976static void il3945_hw_reg_init_channel_groups(struct il_priv *priv)
1977{ 1977{
1978 u32 i; 1978 u32 i;
1979 s32 rate_index; 1979 s32 rate_index;
1980 struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; 1980 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom;
1981 const struct iwl3945_eeprom_txpower_group *group; 1981 const struct il3945_eeprom_txpower_group *group;
1982 1982
1983 IWL_DEBUG_POWER(priv, "Initializing factory calib info from EEPROM\n"); 1983 IL_DEBUG_POWER(priv, "Initializing factory calib info from EEPROM\n");
1984 1984
1985 for (i = 0; i < IWL_NUM_TX_CALIB_GROUPS; i++) { 1985 for (i = 0; i < IL_NUM_TX_CALIB_GROUPS; i++) {
1986 s8 *clip_pwrs; /* table of power levels for each rate */ 1986 s8 *clip_pwrs; /* table of power levels for each rate */
1987 s8 satur_pwr; /* saturation power for each chnl group */ 1987 s8 satur_pwr; /* saturation power for each chnl group */
1988 group = &eeprom->groups[i]; 1988 group = &eeprom->groups[i];
1989 1989
1990 /* sanity check on factory saturation power value */ 1990 /* sanity check on factory saturation power value */
1991 if (group->saturation_power < 40) { 1991 if (group->saturation_power < 40) {
1992 IWL_WARN(priv, "Error: saturation power is %d, " 1992 IL_WARN(priv, "Error: saturation power is %d, "
1993 "less than minimum expected 40\n", 1993 "less than minimum expected 40\n",
1994 group->saturation_power); 1994 group->saturation_power);
1995 return; 1995 return;
@@ -2011,21 +2011,21 @@ static void iwl3945_hw_reg_init_channel_groups(struct iwl_priv *priv)
2011 2011
2012 /* fill in channel group's nominal powers for each rate */ 2012 /* fill in channel group's nominal powers for each rate */
2013 for (rate_index = 0; 2013 for (rate_index = 0;
2014 rate_index < IWL_RATE_COUNT_3945; rate_index++, clip_pwrs++) { 2014 rate_index < IL_RATE_COUNT_3945; rate_index++, clip_pwrs++) {
2015 switch (rate_index) { 2015 switch (rate_index) {
2016 case IWL_RATE_36M_INDEX_TABLE: 2016 case IL_RATE_36M_INDEX_TABLE:
2017 if (i == 0) /* B/G */ 2017 if (i == 0) /* B/G */
2018 *clip_pwrs = satur_pwr; 2018 *clip_pwrs = satur_pwr;
2019 else /* A */ 2019 else /* A */
2020 *clip_pwrs = satur_pwr - 5; 2020 *clip_pwrs = satur_pwr - 5;
2021 break; 2021 break;
2022 case IWL_RATE_48M_INDEX_TABLE: 2022 case IL_RATE_48M_INDEX_TABLE:
2023 if (i == 0) 2023 if (i == 0)
2024 *clip_pwrs = satur_pwr - 7; 2024 *clip_pwrs = satur_pwr - 7;
2025 else 2025 else
2026 *clip_pwrs = satur_pwr - 10; 2026 *clip_pwrs = satur_pwr - 10;
2027 break; 2027 break;
2028 case IWL_RATE_54M_INDEX_TABLE: 2028 case IL_RATE_54M_INDEX_TABLE:
2029 if (i == 0) 2029 if (i == 0)
2030 *clip_pwrs = satur_pwr - 9; 2030 *clip_pwrs = satur_pwr - 9;
2031 else 2031 else
@@ -2040,7 +2040,7 @@ static void iwl3945_hw_reg_init_channel_groups(struct iwl_priv *priv)
2040} 2040}
2041 2041
2042/** 2042/**
2043 * iwl3945_txpower_set_from_eeprom - Set channel power info based on EEPROM 2043 * il3945_txpower_set_from_eeprom - Set channel power info based on EEPROM
2044 * 2044 *
2045 * Second pass (during init) to set up priv->channel_info 2045 * Second pass (during init) to set up priv->channel_info
2046 * 2046 *
@@ -2054,11 +2054,11 @@ static void iwl3945_hw_reg_init_channel_groups(struct iwl_priv *priv)
2054 * 2054 *
2055 * This does *not* write values to NIC, just sets up our internal table. 2055 * This does *not* write values to NIC, just sets up our internal table.
2056 */ 2056 */
2057int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) 2057int il3945_txpower_set_from_eeprom(struct il_priv *priv)
2058{ 2058{
2059 struct iwl_channel_info *ch_info = NULL; 2059 struct il_channel_info *ch_info = NULL;
2060 struct iwl3945_channel_power_info *pwr_info; 2060 struct il3945_channel_power_info *pwr_info;
2061 struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; 2061 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom;
2062 int delta_index; 2062 int delta_index;
2063 u8 rate_index; 2063 u8 rate_index;
2064 u8 scan_tbl_index; 2064 u8 scan_tbl_index;
@@ -2071,37 +2071,37 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2071 2071
2072 /* save temperature reference, 2072 /* save temperature reference,
2073 * so we can determine next time to calibrate */ 2073 * so we can determine next time to calibrate */
2074 temperature = iwl3945_hw_reg_txpower_get_temperature(priv); 2074 temperature = il3945_hw_reg_txpower_get_temperature(priv);
2075 priv->last_temperature = temperature; 2075 priv->last_temperature = temperature;
2076 2076
2077 iwl3945_hw_reg_init_channel_groups(priv); 2077 il3945_hw_reg_init_channel_groups(priv);
2078 2078
2079 /* initialize Tx power info for each and every channel, 2.4 and 5.x */ 2079 /* initialize Tx power info for each and every channel, 2.4 and 5.x */
2080 for (i = 0, ch_info = priv->channel_info; i < priv->channel_count; 2080 for (i = 0, ch_info = priv->channel_info; i < priv->channel_count;
2081 i++, ch_info++) { 2081 i++, ch_info++) {
2082 a_band = iwl_legacy_is_channel_a_band(ch_info); 2082 a_band = il_is_channel_a_band(ch_info);
2083 if (!iwl_legacy_is_channel_valid(ch_info)) 2083 if (!il_is_channel_valid(ch_info))
2084 continue; 2084 continue;
2085 2085
2086 /* find this channel's channel group (*not* "band") index */ 2086 /* find this channel's channel group (*not* "band") index */
2087 ch_info->group_index = 2087 ch_info->group_index =
2088 iwl3945_hw_reg_get_ch_grp_index(priv, ch_info); 2088 il3945_hw_reg_get_ch_grp_index(priv, ch_info);
2089 2089
2090 /* Get this chnlgrp's rate->max/clip-powers table */ 2090 /* Get this chnlgrp's rate->max/clip-powers table */
2091 clip_pwrs = priv->_3945.clip_groups[ch_info->group_index].clip_powers; 2091 clip_pwrs = priv->_3945.clip_groups[ch_info->group_index].clip_powers;
2092 2092
2093 /* calculate power index *adjustment* value according to 2093 /* calculate power index *adjustment* value according to
2094 * diff between current temperature and factory temperature */ 2094 * diff between current temperature and factory temperature */
2095 delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature, 2095 delta_index = il3945_hw_reg_adjust_power_by_temp(temperature,
2096 eeprom->groups[ch_info->group_index]. 2096 eeprom->groups[ch_info->group_index].
2097 temperature); 2097 temperature);
2098 2098
2099 IWL_DEBUG_POWER(priv, "Delta index for channel %d: %d [%d]\n", 2099 IL_DEBUG_POWER(priv, "Delta index for channel %d: %d [%d]\n",
2100 ch_info->channel, delta_index, temperature + 2100 ch_info->channel, delta_index, temperature +
2101 IWL_TEMP_CONVERT); 2101 IL_TEMP_CONVERT);
2102 2102
2103 /* set tx power value for all OFDM rates */ 2103 /* set tx power value for all OFDM rates */
2104 for (rate_index = 0; rate_index < IWL_OFDM_RATES; 2104 for (rate_index = 0; rate_index < IL_OFDM_RATES;
2105 rate_index++) { 2105 rate_index++) {
2106 s32 uninitialized_var(power_idx); 2106 s32 uninitialized_var(power_idx);
2107 int rc; 2107 int rc;
@@ -2115,11 +2115,11 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2115 2115
2116 /* get base (i.e. at factory-measured temperature) 2116 /* get base (i.e. at factory-measured temperature)
2117 * power table index for this rate's power */ 2117 * power table index for this rate's power */
2118 rc = iwl3945_hw_reg_get_matched_power_index(priv, pwr, 2118 rc = il3945_hw_reg_get_matched_power_index(priv, pwr,
2119 ch_info->group_index, 2119 ch_info->group_index,
2120 &power_idx); 2120 &power_idx);
2121 if (rc) { 2121 if (rc) {
2122 IWL_ERR(priv, "Invalid power index\n"); 2122 IL_ERR(priv, "Invalid power index\n");
2123 return rc; 2123 return rc;
2124 } 2124 }
2125 pwr_info->base_power_index = (u8) power_idx; 2125 pwr_info->base_power_index = (u8) power_idx;
@@ -2128,9 +2128,9 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2128 power_idx += delta_index; 2128 power_idx += delta_index;
2129 2129
2130 /* stay within range of gain table */ 2130 /* stay within range of gain table */
2131 power_idx = iwl3945_hw_reg_fix_power_index(power_idx); 2131 power_idx = il3945_hw_reg_fix_power_index(power_idx);
2132 2132
2133 /* fill 1 OFDM rate's iwl3945_channel_power_info struct */ 2133 /* fill 1 OFDM rate's il3945_channel_power_info struct */
2134 pwr_info->requested_power = pwr; 2134 pwr_info->requested_power = pwr;
2135 pwr_info->power_table_index = (u8) power_idx; 2135 pwr_info->power_table_index = (u8) power_idx;
2136 pwr_info->tpc.tx_gain = 2136 pwr_info->tpc.tx_gain =
@@ -2140,25 +2140,25 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2140 } 2140 }
2141 2141
2142 /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/ 2142 /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/
2143 pwr_info = &ch_info->power_info[IWL_RATE_12M_INDEX_TABLE]; 2143 pwr_info = &ch_info->power_info[IL_RATE_12M_INDEX_TABLE];
2144 power = pwr_info->requested_power + 2144 power = pwr_info->requested_power +
2145 IWL_CCK_FROM_OFDM_POWER_DIFF; 2145 IL_CCK_FROM_OFDM_POWER_DIFF;
2146 pwr_index = pwr_info->power_table_index + 2146 pwr_index = pwr_info->power_table_index +
2147 IWL_CCK_FROM_OFDM_INDEX_DIFF; 2147 IL_CCK_FROM_OFDM_INDEX_DIFF;
2148 base_pwr_index = pwr_info->base_power_index + 2148 base_pwr_index = pwr_info->base_power_index +
2149 IWL_CCK_FROM_OFDM_INDEX_DIFF; 2149 IL_CCK_FROM_OFDM_INDEX_DIFF;
2150 2150
2151 /* stay within table range */ 2151 /* stay within table range */
2152 pwr_index = iwl3945_hw_reg_fix_power_index(pwr_index); 2152 pwr_index = il3945_hw_reg_fix_power_index(pwr_index);
2153 gain = power_gain_table[a_band][pwr_index].tx_gain; 2153 gain = power_gain_table[a_band][pwr_index].tx_gain;
2154 dsp_atten = power_gain_table[a_band][pwr_index].dsp_atten; 2154 dsp_atten = power_gain_table[a_band][pwr_index].dsp_atten;
2155 2155
2156 /* fill each CCK rate's iwl3945_channel_power_info structure 2156 /* fill each CCK rate's il3945_channel_power_info structure
2157 * NOTE: All CCK-rate Txpwrs are the same for a given chnl! 2157 * NOTE: All CCK-rate Txpwrs are the same for a given chnl!
2158 * NOTE: CCK rates start at end of OFDM rates! */ 2158 * NOTE: CCK rates start at end of OFDM rates! */
2159 for (rate_index = 0; 2159 for (rate_index = 0;
2160 rate_index < IWL_CCK_RATES; rate_index++) { 2160 rate_index < IL_CCK_RATES; rate_index++) {
2161 pwr_info = &ch_info->power_info[rate_index+IWL_OFDM_RATES]; 2161 pwr_info = &ch_info->power_info[rate_index+IL_OFDM_RATES];
2162 pwr_info->requested_power = power; 2162 pwr_info->requested_power = power;
2163 pwr_info->power_table_index = pwr_index; 2163 pwr_info->power_table_index = pwr_index;
2164 pwr_info->base_power_index = base_pwr_index; 2164 pwr_info->base_power_index = base_pwr_index;
@@ -2168,10 +2168,10 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2168 2168
2169 /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */ 2169 /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */
2170 for (scan_tbl_index = 0; 2170 for (scan_tbl_index = 0;
2171 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { 2171 scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) {
2172 s32 actual_index = (scan_tbl_index == 0) ? 2172 s32 actual_index = (scan_tbl_index == 0) ?
2173 IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE; 2173 IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE;
2174 iwl3945_hw_reg_set_scan_power(priv, scan_tbl_index, 2174 il3945_hw_reg_set_scan_power(priv, scan_tbl_index,
2175 actual_index, clip_pwrs, ch_info, a_band); 2175 actual_index, clip_pwrs, ch_info, a_band);
2176 } 2176 }
2177 } 2177 }
@@ -2179,31 +2179,31 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2179 return 0; 2179 return 0;
2180} 2180}
2181 2181
2182int iwl3945_hw_rxq_stop(struct iwl_priv *priv) 2182int il3945_hw_rxq_stop(struct il_priv *priv)
2183{ 2183{
2184 int rc; 2184 int rc;
2185 2185
2186 iwl_legacy_write_direct32(priv, FH39_RCSR_CONFIG(0), 0); 2186 il_write_direct32(priv, FH39_RCSR_CONFIG(0), 0);
2187 rc = iwl_poll_direct_bit(priv, FH39_RSSR_STATUS, 2187 rc = il_poll_direct_bit(priv, FH39_RSSR_STATUS,
2188 FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); 2188 FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
2189 if (rc < 0) 2189 if (rc < 0)
2190 IWL_ERR(priv, "Can't stop Rx DMA.\n"); 2190 IL_ERR(priv, "Can't stop Rx DMA.\n");
2191 2191
2192 return 0; 2192 return 0;
2193} 2193}
2194 2194
2195int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) 2195int il3945_hw_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq)
2196{ 2196{
2197 int txq_id = txq->q.id; 2197 int txq_id = txq->q.id;
2198 2198
2199 struct iwl3945_shared *shared_data = priv->_3945.shared_virt; 2199 struct il3945_shared *shared_data = priv->_3945.shared_virt;
2200 2200
2201 shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); 2201 shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr);
2202 2202
2203 iwl_legacy_write_direct32(priv, FH39_CBCC_CTRL(txq_id), 0); 2203 il_write_direct32(priv, FH39_CBCC_CTRL(txq_id), 0);
2204 iwl_legacy_write_direct32(priv, FH39_CBCC_BASE(txq_id), 0); 2204 il_write_direct32(priv, FH39_CBCC_BASE(txq_id), 0);
2205 2205
2206 iwl_legacy_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), 2206 il_write_direct32(priv, FH39_TCSR_CONFIG(txq_id),
2207 FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT | 2207 FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT |
2208 FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF | 2208 FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF |
2209 FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD | 2209 FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD |
@@ -2211,7 +2211,7 @@ int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq)
2211 FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE); 2211 FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE);
2212 2212
2213 /* fake read to flush all prev. writes */ 2213 /* fake read to flush all prev. writes */
2214 iwl_read32(priv, FH39_TSSR_CBB_BASE); 2214 il_read32(priv, FH39_TSSR_CBB_BASE);
2215 2215
2216 return 0; 2216 return 0;
2217} 2217}
@@ -2219,26 +2219,26 @@ int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq)
2219/* 2219/*
2220 * HCMD utils 2220 * HCMD utils
2221 */ 2221 */
2222static u16 iwl3945_get_hcmd_size(u8 cmd_id, u16 len) 2222static u16 il3945_get_hcmd_size(u8 cmd_id, u16 len)
2223{ 2223{
2224 switch (cmd_id) { 2224 switch (cmd_id) {
2225 case REPLY_RXON: 2225 case REPLY_RXON:
2226 return sizeof(struct iwl3945_rxon_cmd); 2226 return sizeof(struct il3945_rxon_cmd);
2227 case POWER_TABLE_CMD: 2227 case POWER_TABLE_CMD:
2228 return sizeof(struct iwl3945_powertable_cmd); 2228 return sizeof(struct il3945_powertable_cmd);
2229 default: 2229 default:
2230 return len; 2230 return len;
2231 } 2231 }
2232} 2232}
2233 2233
2234 2234
2235static u16 iwl3945_build_addsta_hcmd(const struct iwl_legacy_addsta_cmd *cmd, 2235static u16 il3945_build_addsta_hcmd(const struct il_addsta_cmd *cmd,
2236 u8 *data) 2236 u8 *data)
2237{ 2237{
2238 struct iwl3945_addsta_cmd *addsta = (struct iwl3945_addsta_cmd *)data; 2238 struct il3945_addsta_cmd *addsta = (struct il3945_addsta_cmd *)data;
2239 addsta->mode = cmd->mode; 2239 addsta->mode = cmd->mode;
2240 memcpy(&addsta->sta, &cmd->sta, sizeof(struct sta_id_modify)); 2240 memcpy(&addsta->sta, &cmd->sta, sizeof(struct sta_id_modify));
2241 memcpy(&addsta->key, &cmd->key, sizeof(struct iwl4965_keyinfo)); 2241 memcpy(&addsta->key, &cmd->key, sizeof(struct il4965_keyinfo));
2242 addsta->station_flags = cmd->station_flags; 2242 addsta->station_flags = cmd->station_flags;
2243 addsta->station_flags_msk = cmd->station_flags_msk; 2243 addsta->station_flags_msk = cmd->station_flags_msk;
2244 addsta->tid_disable_tx = cpu_to_le16(0); 2244 addsta->tid_disable_tx = cpu_to_le16(0);
@@ -2247,23 +2247,23 @@ static u16 iwl3945_build_addsta_hcmd(const struct iwl_legacy_addsta_cmd *cmd,
2247 addsta->remove_immediate_ba_tid = cmd->remove_immediate_ba_tid; 2247 addsta->remove_immediate_ba_tid = cmd->remove_immediate_ba_tid;
2248 addsta->add_immediate_ba_ssn = cmd->add_immediate_ba_ssn; 2248 addsta->add_immediate_ba_ssn = cmd->add_immediate_ba_ssn;
2249 2249
2250 return (u16)sizeof(struct iwl3945_addsta_cmd); 2250 return (u16)sizeof(struct il3945_addsta_cmd);
2251} 2251}
2252 2252
2253static int iwl3945_add_bssid_station(struct iwl_priv *priv, 2253static int il3945_add_bssid_station(struct il_priv *priv,
2254 const u8 *addr, u8 *sta_id_r) 2254 const u8 *addr, u8 *sta_id_r)
2255{ 2255{
2256 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2256 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2257 int ret; 2257 int ret;
2258 u8 sta_id; 2258 u8 sta_id;
2259 unsigned long flags; 2259 unsigned long flags;
2260 2260
2261 if (sta_id_r) 2261 if (sta_id_r)
2262 *sta_id_r = IWL_INVALID_STATION; 2262 *sta_id_r = IL_INVALID_STATION;
2263 2263
2264 ret = iwl_legacy_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); 2264 ret = il_add_station_common(priv, ctx, addr, 0, NULL, &sta_id);
2265 if (ret) { 2265 if (ret) {
2266 IWL_ERR(priv, "Unable to add station %pM\n", addr); 2266 IL_ERR(priv, "Unable to add station %pM\n", addr);
2267 return ret; 2267 return ret;
2268 } 2268 }
2269 2269
@@ -2271,93 +2271,93 @@ static int iwl3945_add_bssid_station(struct iwl_priv *priv,
2271 *sta_id_r = sta_id; 2271 *sta_id_r = sta_id;
2272 2272
2273 spin_lock_irqsave(&priv->sta_lock, flags); 2273 spin_lock_irqsave(&priv->sta_lock, flags);
2274 priv->stations[sta_id].used |= IWL_STA_LOCAL; 2274 priv->stations[sta_id].used |= IL_STA_LOCAL;
2275 spin_unlock_irqrestore(&priv->sta_lock, flags); 2275 spin_unlock_irqrestore(&priv->sta_lock, flags);
2276 2276
2277 return 0; 2277 return 0;
2278} 2278}
2279static int iwl3945_manage_ibss_station(struct iwl_priv *priv, 2279static int il3945_manage_ibss_station(struct il_priv *priv,
2280 struct ieee80211_vif *vif, bool add) 2280 struct ieee80211_vif *vif, bool add)
2281{ 2281{
2282 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 2282 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
2283 int ret; 2283 int ret;
2284 2284
2285 if (add) { 2285 if (add) {
2286 ret = iwl3945_add_bssid_station(priv, vif->bss_conf.bssid, 2286 ret = il3945_add_bssid_station(priv, vif->bss_conf.bssid,
2287 &vif_priv->ibss_bssid_sta_id); 2287 &vif_priv->ibss_bssid_sta_id);
2288 if (ret) 2288 if (ret)
2289 return ret; 2289 return ret;
2290 2290
2291 iwl3945_sync_sta(priv, vif_priv->ibss_bssid_sta_id, 2291 il3945_sync_sta(priv, vif_priv->ibss_bssid_sta_id,
2292 (priv->band == IEEE80211_BAND_5GHZ) ? 2292 (priv->band == IEEE80211_BAND_5GHZ) ?
2293 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP); 2293 IL_RATE_6M_PLCP : IL_RATE_1M_PLCP);
2294 iwl3945_rate_scale_init(priv->hw, vif_priv->ibss_bssid_sta_id); 2294 il3945_rate_scale_init(priv->hw, vif_priv->ibss_bssid_sta_id);
2295 2295
2296 return 0; 2296 return 0;
2297 } 2297 }
2298 2298
2299 return iwl_legacy_remove_station(priv, vif_priv->ibss_bssid_sta_id, 2299 return il_remove_station(priv, vif_priv->ibss_bssid_sta_id,
2300 vif->bss_conf.bssid); 2300 vif->bss_conf.bssid);
2301} 2301}
2302 2302
2303/** 2303/**
2304 * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table 2304 * il3945_init_hw_rate_table - Initialize the hardware rate fallback table
2305 */ 2305 */
2306int iwl3945_init_hw_rate_table(struct iwl_priv *priv) 2306int il3945_init_hw_rate_table(struct il_priv *priv)
2307{ 2307{
2308 int rc, i, index, prev_index; 2308 int rc, i, index, prev_index;
2309 struct iwl3945_rate_scaling_cmd rate_cmd = { 2309 struct il3945_rate_scaling_cmd rate_cmd = {
2310 .reserved = {0, 0, 0}, 2310 .reserved = {0, 0, 0},
2311 }; 2311 };
2312 struct iwl3945_rate_scaling_info *table = rate_cmd.table; 2312 struct il3945_rate_scaling_info *table = rate_cmd.table;
2313 2313
2314 for (i = 0; i < ARRAY_SIZE(iwl3945_rates); i++) { 2314 for (i = 0; i < ARRAY_SIZE(il3945_rates); i++) {
2315 index = iwl3945_rates[i].table_rs_index; 2315 index = il3945_rates[i].table_rs_index;
2316 2316
2317 table[index].rate_n_flags = 2317 table[index].rate_n_flags =
2318 iwl3945_hw_set_rate_n_flags(iwl3945_rates[i].plcp, 0); 2318 il3945_hw_set_rate_n_flags(il3945_rates[i].plcp, 0);
2319 table[index].try_cnt = priv->retry_rate; 2319 table[index].try_cnt = priv->retry_rate;
2320 prev_index = iwl3945_get_prev_ieee_rate(i); 2320 prev_index = il3945_get_prev_ieee_rate(i);
2321 table[index].next_rate_index = 2321 table[index].next_rate_index =
2322 iwl3945_rates[prev_index].table_rs_index; 2322 il3945_rates[prev_index].table_rs_index;
2323 } 2323 }
2324 2324
2325 switch (priv->band) { 2325 switch (priv->band) {
2326 case IEEE80211_BAND_5GHZ: 2326 case IEEE80211_BAND_5GHZ:
2327 IWL_DEBUG_RATE(priv, "Select A mode rate scale\n"); 2327 IL_DEBUG_RATE(priv, "Select A mode rate scale\n");
2328 /* If one of the following CCK rates is used, 2328 /* If one of the following CCK rates is used,
2329 * have it fall back to the 6M OFDM rate */ 2329 * have it fall back to the 6M OFDM rate */
2330 for (i = IWL_RATE_1M_INDEX_TABLE; 2330 for (i = IL_RATE_1M_INDEX_TABLE;
2331 i <= IWL_RATE_11M_INDEX_TABLE; i++) 2331 i <= IL_RATE_11M_INDEX_TABLE; i++)
2332 table[i].next_rate_index = 2332 table[i].next_rate_index =
2333 iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index; 2333 il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index;
2334 2334
2335 /* Don't fall back to CCK rates */ 2335 /* Don't fall back to CCK rates */
2336 table[IWL_RATE_12M_INDEX_TABLE].next_rate_index = 2336 table[IL_RATE_12M_INDEX_TABLE].next_rate_index =
2337 IWL_RATE_9M_INDEX_TABLE; 2337 IL_RATE_9M_INDEX_TABLE;
2338 2338
2339 /* Don't drop out of OFDM rates */ 2339 /* Don't drop out of OFDM rates */
2340 table[IWL_RATE_6M_INDEX_TABLE].next_rate_index = 2340 table[IL_RATE_6M_INDEX_TABLE].next_rate_index =
2341 iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index; 2341 il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index;
2342 break; 2342 break;
2343 2343
2344 case IEEE80211_BAND_2GHZ: 2344 case IEEE80211_BAND_2GHZ:
2345 IWL_DEBUG_RATE(priv, "Select B/G mode rate scale\n"); 2345 IL_DEBUG_RATE(priv, "Select B/G mode rate scale\n");
2346 /* If an OFDM rate is used, have it fall back to the 2346 /* If an OFDM rate is used, have it fall back to the
2347 * 1M CCK rates */ 2347 * 1M CCK rates */
2348 2348
2349 if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && 2349 if (!(priv->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) &&
2350 iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { 2350 il_is_associated(priv, IL_RXON_CTX_BSS)) {
2351 2351
2352 index = IWL_FIRST_CCK_RATE; 2352 index = IL_FIRST_CCK_RATE;
2353 for (i = IWL_RATE_6M_INDEX_TABLE; 2353 for (i = IL_RATE_6M_INDEX_TABLE;
2354 i <= IWL_RATE_54M_INDEX_TABLE; i++) 2354 i <= IL_RATE_54M_INDEX_TABLE; i++)
2355 table[i].next_rate_index = 2355 table[i].next_rate_index =
2356 iwl3945_rates[index].table_rs_index; 2356 il3945_rates[index].table_rs_index;
2357 2357
2358 index = IWL_RATE_11M_INDEX_TABLE; 2358 index = IL_RATE_11M_INDEX_TABLE;
2359 /* CCK shouldn't fall back to OFDM... */ 2359 /* CCK shouldn't fall back to OFDM... */
2360 table[index].next_rate_index = IWL_RATE_5M_INDEX_TABLE; 2360 table[index].next_rate_index = IL_RATE_5M_INDEX_TABLE;
2361 } 2361 }
2362 break; 2362 break;
2363 2363
@@ -2368,41 +2368,41 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
2368 2368
2369 /* Update the rate scaling for control frame Tx */ 2369 /* Update the rate scaling for control frame Tx */
2370 rate_cmd.table_id = 0; 2370 rate_cmd.table_id = 0;
2371 rc = iwl_legacy_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), 2371 rc = il_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
2372 &rate_cmd); 2372 &rate_cmd);
2373 if (rc) 2373 if (rc)
2374 return rc; 2374 return rc;
2375 2375
2376 /* Update the rate scaling for data frame Tx */ 2376 /* Update the rate scaling for data frame Tx */
2377 rate_cmd.table_id = 1; 2377 rate_cmd.table_id = 1;
2378 return iwl_legacy_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), 2378 return il_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
2379 &rate_cmd); 2379 &rate_cmd);
2380} 2380}
2381 2381
2382/* Called when initializing driver */ 2382/* Called when initializing driver */
2383int iwl3945_hw_set_hw_params(struct iwl_priv *priv) 2383int il3945_hw_set_hw_params(struct il_priv *priv)
2384{ 2384{
2385 memset((void *)&priv->hw_params, 0, 2385 memset((void *)&priv->hw_params, 0,
2386 sizeof(struct iwl_hw_params)); 2386 sizeof(struct il_hw_params));
2387 2387
2388 priv->_3945.shared_virt = 2388 priv->_3945.shared_virt =
2389 dma_alloc_coherent(&priv->pci_dev->dev, 2389 dma_alloc_coherent(&priv->pci_dev->dev,
2390 sizeof(struct iwl3945_shared), 2390 sizeof(struct il3945_shared),
2391 &priv->_3945.shared_phys, GFP_KERNEL); 2391 &priv->_3945.shared_phys, GFP_KERNEL);
2392 if (!priv->_3945.shared_virt) { 2392 if (!priv->_3945.shared_virt) {
2393 IWL_ERR(priv, "failed to allocate pci memory\n"); 2393 IL_ERR(priv, "failed to allocate pci memory\n");
2394 return -ENOMEM; 2394 return -ENOMEM;
2395 } 2395 }
2396 2396
2397 /* Assign number of Usable TX queues */ 2397 /* Assign number of Usable TX queues */
2398 priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; 2398 priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues;
2399 2399
2400 priv->hw_params.tfd_size = sizeof(struct iwl3945_tfd); 2400 priv->hw_params.tfd_size = sizeof(struct il3945_tfd);
2401 priv->hw_params.rx_page_order = get_order(IWL_RX_BUF_SIZE_3K); 2401 priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_3K);
2402 priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; 2402 priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
2403 priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; 2403 priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
2404 priv->hw_params.max_stations = IWL3945_STATION_COUNT; 2404 priv->hw_params.max_stations = IWL3945_STATION_COUNT;
2405 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWL3945_BROADCAST_ID; 2405 priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL3945_BROADCAST_ID;
2406 2406
2407 priv->sta_key_max_num = STA_KEY_MAX_NUM; 2407 priv->sta_key_max_num = STA_KEY_MAX_NUM;
2408 2408
@@ -2413,20 +2413,20 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv)
2413 return 0; 2413 return 0;
2414} 2414}
2415 2415
2416unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv, 2416unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv,
2417 struct iwl3945_frame *frame, u8 rate) 2417 struct il3945_frame *frame, u8 rate)
2418{ 2418{
2419 struct iwl3945_tx_beacon_cmd *tx_beacon_cmd; 2419 struct il3945_tx_beacon_cmd *tx_beacon_cmd;
2420 unsigned int frame_size; 2420 unsigned int frame_size;
2421 2421
2422 tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u; 2422 tx_beacon_cmd = (struct il3945_tx_beacon_cmd *)&frame->u;
2423 memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); 2423 memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
2424 2424
2425 tx_beacon_cmd->tx.sta_id = 2425 tx_beacon_cmd->tx.sta_id =
2426 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id; 2426 priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id;
2427 tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 2427 tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
2428 2428
2429 frame_size = iwl3945_fill_beacon_frame(priv, 2429 frame_size = il3945_fill_beacon_frame(priv,
2430 tx_beacon_cmd->frame, 2430 tx_beacon_cmd->frame,
2431 sizeof(frame->u) - sizeof(*tx_beacon_cmd)); 2431 sizeof(frame->u) - sizeof(*tx_beacon_cmd));
2432 2432
@@ -2437,51 +2437,51 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv,
2437 tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | 2437 tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK |
2438 TX_CMD_FLG_TSF_MSK); 2438 TX_CMD_FLG_TSF_MSK);
2439 2439
2440 /* supp_rates[0] == OFDM start at IWL_FIRST_OFDM_RATE*/ 2440 /* supp_rates[0] == OFDM start at IL_FIRST_OFDM_RATE*/
2441 tx_beacon_cmd->tx.supp_rates[0] = 2441 tx_beacon_cmd->tx.supp_rates[0] =
2442 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 2442 (IL_OFDM_BASIC_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF;
2443 2443
2444 tx_beacon_cmd->tx.supp_rates[1] = 2444 tx_beacon_cmd->tx.supp_rates[1] =
2445 (IWL_CCK_BASIC_RATES_MASK & 0xF); 2445 (IL_CCK_BASIC_RATES_MASK & 0xF);
2446 2446
2447 return sizeof(struct iwl3945_tx_beacon_cmd) + frame_size; 2447 return sizeof(struct il3945_tx_beacon_cmd) + frame_size;
2448} 2448}
2449 2449
2450void iwl3945_hw_rx_handler_setup(struct iwl_priv *priv) 2450void il3945_hw_rx_handler_setup(struct il_priv *priv)
2451{ 2451{
2452 priv->rx_handlers[REPLY_TX] = iwl3945_rx_reply_tx; 2452 priv->rx_handlers[REPLY_TX] = il3945_rx_reply_tx;
2453 priv->rx_handlers[REPLY_3945_RX] = iwl3945_rx_reply_rx; 2453 priv->rx_handlers[REPLY_3945_RX] = il3945_rx_reply_rx;
2454} 2454}
2455 2455
2456void iwl3945_hw_setup_deferred_work(struct iwl_priv *priv) 2456void il3945_hw_setup_deferred_work(struct il_priv *priv)
2457{ 2457{
2458 INIT_DELAYED_WORK(&priv->_3945.thermal_periodic, 2458 INIT_DELAYED_WORK(&priv->_3945.thermal_periodic,
2459 iwl3945_bg_reg_txpower_periodic); 2459 il3945_bg_reg_txpower_periodic);
2460} 2460}
2461 2461
2462void iwl3945_hw_cancel_deferred_work(struct iwl_priv *priv) 2462void il3945_hw_cancel_deferred_work(struct il_priv *priv)
2463{ 2463{
2464 cancel_delayed_work(&priv->_3945.thermal_periodic); 2464 cancel_delayed_work(&priv->_3945.thermal_periodic);
2465} 2465}
2466 2466
2467/* check contents of special bootstrap uCode SRAM */ 2467/* check contents of special bootstrap uCode SRAM */
2468static int iwl3945_verify_bsm(struct iwl_priv *priv) 2468static int il3945_verify_bsm(struct il_priv *priv)
2469 { 2469 {
2470 __le32 *image = priv->ucode_boot.v_addr; 2470 __le32 *image = priv->ucode_boot.v_addr;
2471 u32 len = priv->ucode_boot.len; 2471 u32 len = priv->ucode_boot.len;
2472 u32 reg; 2472 u32 reg;
2473 u32 val; 2473 u32 val;
2474 2474
2475 IWL_DEBUG_INFO(priv, "Begin verify bsm\n"); 2475 IL_DEBUG_INFO(priv, "Begin verify bsm\n");
2476 2476
2477 /* verify BSM SRAM contents */ 2477 /* verify BSM SRAM contents */
2478 val = iwl_legacy_read_prph(priv, BSM_WR_DWCOUNT_REG); 2478 val = il_read_prph(priv, BSM_WR_DWCOUNT_REG);
2479 for (reg = BSM_SRAM_LOWER_BOUND; 2479 for (reg = BSM_SRAM_LOWER_BOUND;
2480 reg < BSM_SRAM_LOWER_BOUND + len; 2480 reg < BSM_SRAM_LOWER_BOUND + len;
2481 reg += sizeof(u32), image++) { 2481 reg += sizeof(u32), image++) {
2482 val = iwl_legacy_read_prph(priv, reg); 2482 val = il_read_prph(priv, reg);
2483 if (val != le32_to_cpu(*image)) { 2483 if (val != le32_to_cpu(*image)) {
2484 IWL_ERR(priv, "BSM uCode verification failed at " 2484 IL_ERR(priv, "BSM uCode verification failed at "
2485 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", 2485 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
2486 BSM_SRAM_LOWER_BOUND, 2486 BSM_SRAM_LOWER_BOUND,
2487 reg - BSM_SRAM_LOWER_BOUND, len, 2487 reg - BSM_SRAM_LOWER_BOUND, len,
@@ -2490,7 +2490,7 @@ static int iwl3945_verify_bsm(struct iwl_priv *priv)
2490 } 2490 }
2491 } 2491 }
2492 2492
2493 IWL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n"); 2493 IL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n");
2494 2494
2495 return 0; 2495 return 0;
2496} 2496}
@@ -2510,20 +2510,20 @@ static int iwl3945_verify_bsm(struct iwl_priv *priv)
2510 * simply claims ownership, which should be safe when this function is called 2510 * simply claims ownership, which should be safe when this function is called
2511 * (i.e. before loading uCode!). 2511 * (i.e. before loading uCode!).
2512 */ 2512 */
2513static int iwl3945_eeprom_acquire_semaphore(struct iwl_priv *priv) 2513static int il3945_eeprom_acquire_semaphore(struct il_priv *priv)
2514{ 2514{
2515 _iwl_legacy_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); 2515 _il_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK);
2516 return 0; 2516 return 0;
2517} 2517}
2518 2518
2519 2519
2520static void iwl3945_eeprom_release_semaphore(struct iwl_priv *priv) 2520static void il3945_eeprom_release_semaphore(struct il_priv *priv)
2521{ 2521{
2522 return; 2522 return;
2523} 2523}
2524 2524
2525 /** 2525 /**
2526 * iwl3945_load_bsm - Load bootstrap instructions 2526 * il3945_load_bsm - Load bootstrap instructions
2527 * 2527 *
2528 * BSM operation: 2528 * BSM operation:
2529 * 2529 *
@@ -2554,7 +2554,7 @@ static void iwl3945_eeprom_release_semaphore(struct iwl_priv *priv)
2554 * the runtime uCode instructions and the backup data cache into SRAM, 2554 * the runtime uCode instructions and the backup data cache into SRAM,
2555 * and re-launches the runtime uCode from where it left off. 2555 * and re-launches the runtime uCode from where it left off.
2556 */ 2556 */
2557static int iwl3945_load_bsm(struct iwl_priv *priv) 2557static int il3945_load_bsm(struct il_priv *priv)
2558{ 2558{
2559 __le32 *image = priv->ucode_boot.v_addr; 2559 __le32 *image = priv->ucode_boot.v_addr;
2560 u32 len = priv->ucode_boot.len; 2560 u32 len = priv->ucode_boot.len;
@@ -2567,7 +2567,7 @@ static int iwl3945_load_bsm(struct iwl_priv *priv)
2567 u32 done; 2567 u32 done;
2568 u32 reg_offset; 2568 u32 reg_offset;
2569 2569
2570 IWL_DEBUG_INFO(priv, "Begin load bsm\n"); 2570 IL_DEBUG_INFO(priv, "Begin load bsm\n");
2571 2571
2572 /* make sure bootstrap program is no larger than BSM's SRAM size */ 2572 /* make sure bootstrap program is no larger than BSM's SRAM size */
2573 if (len > IWL39_MAX_BSM_SIZE) 2573 if (len > IWL39_MAX_BSM_SIZE)
@@ -2575,7 +2575,7 @@ static int iwl3945_load_bsm(struct iwl_priv *priv)
2575 2575
2576 /* Tell bootstrap uCode where to find the "Initialize" uCode 2576 /* Tell bootstrap uCode where to find the "Initialize" uCode
2577 * in host DRAM ... host DRAM physical address bits 31:0 for 3945. 2577 * in host DRAM ... host DRAM physical address bits 31:0 for 3945.
2578 * NOTE: iwl3945_initialize_alive_start() will replace these values, 2578 * NOTE: il3945_initialize_alive_start() will replace these values,
2579 * after the "initialize" uCode has run, to point to 2579 * after the "initialize" uCode has run, to point to
2580 * runtime/protocol instructions and backup data cache. */ 2580 * runtime/protocol instructions and backup data cache. */
2581 pinst = priv->ucode_init.p_addr; 2581 pinst = priv->ucode_init.p_addr;
@@ -2583,69 +2583,69 @@ static int iwl3945_load_bsm(struct iwl_priv *priv)
2583 inst_len = priv->ucode_init.len; 2583 inst_len = priv->ucode_init.len;
2584 data_len = priv->ucode_init_data.len; 2584 data_len = priv->ucode_init_data.len;
2585 2585
2586 iwl_legacy_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 2586 il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
2587 iwl_legacy_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 2587 il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
2588 iwl_legacy_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); 2588 il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
2589 iwl_legacy_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); 2589 il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);
2590 2590
2591 /* Fill BSM memory with bootstrap instructions */ 2591 /* Fill BSM memory with bootstrap instructions */
2592 for (reg_offset = BSM_SRAM_LOWER_BOUND; 2592 for (reg_offset = BSM_SRAM_LOWER_BOUND;
2593 reg_offset < BSM_SRAM_LOWER_BOUND + len; 2593 reg_offset < BSM_SRAM_LOWER_BOUND + len;
2594 reg_offset += sizeof(u32), image++) 2594 reg_offset += sizeof(u32), image++)
2595 _iwl_legacy_write_prph(priv, reg_offset, 2595 _il_write_prph(priv, reg_offset,
2596 le32_to_cpu(*image)); 2596 le32_to_cpu(*image));
2597 2597
2598 rc = iwl3945_verify_bsm(priv); 2598 rc = il3945_verify_bsm(priv);
2599 if (rc) 2599 if (rc)
2600 return rc; 2600 return rc;
2601 2601
2602 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ 2602 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
2603 iwl_legacy_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); 2603 il_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
2604 iwl_legacy_write_prph(priv, BSM_WR_MEM_DST_REG, 2604 il_write_prph(priv, BSM_WR_MEM_DST_REG,
2605 IWL39_RTC_INST_LOWER_BOUND); 2605 IWL39_RTC_INST_LOWER_BOUND);
2606 iwl_legacy_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); 2606 il_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
2607 2607
2608 /* Load bootstrap code into instruction SRAM now, 2608 /* Load bootstrap code into instruction SRAM now,
2609 * to prepare to load "initialize" uCode */ 2609 * to prepare to load "initialize" uCode */
2610 iwl_legacy_write_prph(priv, BSM_WR_CTRL_REG, 2610 il_write_prph(priv, BSM_WR_CTRL_REG,
2611 BSM_WR_CTRL_REG_BIT_START); 2611 BSM_WR_CTRL_REG_BIT_START);
2612 2612
2613 /* Wait for load of bootstrap uCode to finish */ 2613 /* Wait for load of bootstrap uCode to finish */
2614 for (i = 0; i < 100; i++) { 2614 for (i = 0; i < 100; i++) {
2615 done = iwl_legacy_read_prph(priv, BSM_WR_CTRL_REG); 2615 done = il_read_prph(priv, BSM_WR_CTRL_REG);
2616 if (!(done & BSM_WR_CTRL_REG_BIT_START)) 2616 if (!(done & BSM_WR_CTRL_REG_BIT_START))
2617 break; 2617 break;
2618 udelay(10); 2618 udelay(10);
2619 } 2619 }
2620 if (i < 100) 2620 if (i < 100)
2621 IWL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i); 2621 IL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i);
2622 else { 2622 else {
2623 IWL_ERR(priv, "BSM write did not complete!\n"); 2623 IL_ERR(priv, "BSM write did not complete!\n");
2624 return -EIO; 2624 return -EIO;
2625 } 2625 }
2626 2626
2627 /* Enable future boot loads whenever power management unit triggers it 2627 /* Enable future boot loads whenever power management unit triggers it
2628 * (e.g. when powering back up after power-save shutdown) */ 2628 * (e.g. when powering back up after power-save shutdown) */
2629 iwl_legacy_write_prph(priv, BSM_WR_CTRL_REG, 2629 il_write_prph(priv, BSM_WR_CTRL_REG,
2630 BSM_WR_CTRL_REG_BIT_START_EN); 2630 BSM_WR_CTRL_REG_BIT_START_EN);
2631 2631
2632 return 0; 2632 return 0;
2633} 2633}
2634 2634
2635static struct iwl_hcmd_ops iwl3945_hcmd = { 2635static struct il_hcmd_ops il3945_hcmd = {
2636 .rxon_assoc = iwl3945_send_rxon_assoc, 2636 .rxon_assoc = il3945_send_rxon_assoc,
2637 .commit_rxon = iwl3945_commit_rxon, 2637 .commit_rxon = il3945_commit_rxon,
2638}; 2638};
2639 2639
2640static struct iwl_lib_ops iwl3945_lib = { 2640static struct il_lib_ops il3945_lib = {
2641 .txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd, 2641 .txq_attach_buf_to_tfd = il3945_hw_txq_attach_buf_to_tfd,
2642 .txq_free_tfd = iwl3945_hw_txq_free_tfd, 2642 .txq_free_tfd = il3945_hw_txq_free_tfd,
2643 .txq_init = iwl3945_hw_tx_queue_init, 2643 .txq_init = il3945_hw_tx_queue_init,
2644 .load_ucode = iwl3945_load_bsm, 2644 .load_ucode = il3945_load_bsm,
2645 .dump_nic_error_log = iwl3945_dump_nic_error_log, 2645 .dump_nic_error_log = il3945_dump_nic_error_log,
2646 .apm_ops = { 2646 .apm_ops = {
2647 .init = iwl3945_apm_init, 2647 .init = il3945_apm_init,
2648 .config = iwl3945_nic_config, 2648 .config = il3945_nic_config,
2649 }, 2649 },
2650 .eeprom_ops = { 2650 .eeprom_ops = {
2651 .regulatory_bands = { 2651 .regulatory_bands = {
@@ -2657,85 +2657,85 @@ static struct iwl_lib_ops iwl3945_lib = {
2657 EEPROM_REGULATORY_BAND_NO_HT40, 2657 EEPROM_REGULATORY_BAND_NO_HT40,
2658 EEPROM_REGULATORY_BAND_NO_HT40, 2658 EEPROM_REGULATORY_BAND_NO_HT40,
2659 }, 2659 },
2660 .acquire_semaphore = iwl3945_eeprom_acquire_semaphore, 2660 .acquire_semaphore = il3945_eeprom_acquire_semaphore,
2661 .release_semaphore = iwl3945_eeprom_release_semaphore, 2661 .release_semaphore = il3945_eeprom_release_semaphore,
2662 }, 2662 },
2663 .send_tx_power = iwl3945_send_tx_power, 2663 .send_tx_power = il3945_send_tx_power,
2664 .is_valid_rtc_data_addr = iwl3945_hw_valid_rtc_data_addr, 2664 .is_valid_rtc_data_addr = il3945_hw_valid_rtc_data_addr,
2665 2665
2666 .debugfs_ops = { 2666 .debugfs_ops = {
2667 .rx_stats_read = iwl3945_ucode_rx_stats_read, 2667 .rx_stats_read = il3945_ucode_rx_stats_read,
2668 .tx_stats_read = iwl3945_ucode_tx_stats_read, 2668 .tx_stats_read = il3945_ucode_tx_stats_read,
2669 .general_stats_read = iwl3945_ucode_general_stats_read, 2669 .general_stats_read = il3945_ucode_general_stats_read,
2670 }, 2670 },
2671}; 2671};
2672 2672
2673static const struct iwl_legacy_ops iwl3945_legacy_ops = { 2673static const struct il_legacy_ops il3945_legacy_ops = {
2674 .post_associate = iwl3945_post_associate, 2674 .post_associate = il3945_post_associate,
2675 .config_ap = iwl3945_config_ap, 2675 .config_ap = il3945_config_ap,
2676 .manage_ibss_station = iwl3945_manage_ibss_station, 2676 .manage_ibss_station = il3945_manage_ibss_station,
2677}; 2677};
2678 2678
2679static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { 2679static struct il_hcmd_utils_ops il3945_hcmd_utils = {
2680 .get_hcmd_size = iwl3945_get_hcmd_size, 2680 .get_hcmd_size = il3945_get_hcmd_size,
2681 .build_addsta_hcmd = iwl3945_build_addsta_hcmd, 2681 .build_addsta_hcmd = il3945_build_addsta_hcmd,
2682 .request_scan = iwl3945_request_scan, 2682 .request_scan = il3945_request_scan,
2683 .post_scan = iwl3945_post_scan, 2683 .post_scan = il3945_post_scan,
2684}; 2684};
2685 2685
2686static const struct iwl_ops iwl3945_ops = { 2686static const struct il_ops il3945_ops = {
2687 .lib = &iwl3945_lib, 2687 .lib = &il3945_lib,
2688 .hcmd = &iwl3945_hcmd, 2688 .hcmd = &il3945_hcmd,
2689 .utils = &iwl3945_hcmd_utils, 2689 .utils = &il3945_hcmd_utils,
2690 .led = &iwl3945_led_ops, 2690 .led = &il3945_led_ops,
2691 .legacy = &iwl3945_legacy_ops, 2691 .legacy = &il3945_legacy_ops,
2692 .ieee80211_ops = &iwl3945_hw_ops, 2692 .ieee80211_ops = &il3945_hw_ops,
2693}; 2693};
2694 2694
2695static struct iwl_base_params iwl3945_base_params = { 2695static struct il_base_params il3945_base_params = {
2696 .eeprom_size = IWL3945_EEPROM_IMG_SIZE, 2696 .eeprom_size = IWL3945_EEPROM_IMG_SIZE,
2697 .num_of_queues = IWL39_NUM_QUEUES, 2697 .num_of_queues = IWL39_NUM_QUEUES,
2698 .pll_cfg_val = CSR39_ANA_PLL_CFG_VAL, 2698 .pll_cfg_val = CSR39_ANA_PLL_CFG_VAL,
2699 .set_l0s = false, 2699 .set_l0s = false,
2700 .use_bsm = true, 2700 .use_bsm = true,
2701 .led_compensation = 64, 2701 .led_compensation = 64,
2702 .wd_timeout = IWL_DEF_WD_TIMEOUT, 2702 .wd_timeout = IL_DEF_WD_TIMEOUT,
2703}; 2703};
2704 2704
2705static struct iwl_cfg iwl3945_bg_cfg = { 2705static struct il_cfg il3945_bg_cfg = {
2706 .name = "3945BG", 2706 .name = "3945BG",
2707 .fw_name_pre = IWL3945_FW_PRE, 2707 .fw_name_pre = IWL3945_FW_PRE,
2708 .ucode_api_max = IWL3945_UCODE_API_MAX, 2708 .ucode_api_max = IWL3945_UCODE_API_MAX,
2709 .ucode_api_min = IWL3945_UCODE_API_MIN, 2709 .ucode_api_min = IWL3945_UCODE_API_MIN,
2710 .sku = IWL_SKU_G, 2710 .sku = IL_SKU_G,
2711 .eeprom_ver = EEPROM_3945_EEPROM_VERSION, 2711 .eeprom_ver = EEPROM_3945_EEPROM_VERSION,
2712 .ops = &iwl3945_ops, 2712 .ops = &il3945_ops,
2713 .mod_params = &iwl3945_mod_params, 2713 .mod_params = &il3945_mod_params,
2714 .base_params = &iwl3945_base_params, 2714 .base_params = &il3945_base_params,
2715 .led_mode = IWL_LED_BLINK, 2715 .led_mode = IL_LED_BLINK,
2716}; 2716};
2717 2717
2718static struct iwl_cfg iwl3945_abg_cfg = { 2718static struct il_cfg il3945_abg_cfg = {
2719 .name = "3945ABG", 2719 .name = "3945ABG",
2720 .fw_name_pre = IWL3945_FW_PRE, 2720 .fw_name_pre = IWL3945_FW_PRE,
2721 .ucode_api_max = IWL3945_UCODE_API_MAX, 2721 .ucode_api_max = IWL3945_UCODE_API_MAX,
2722 .ucode_api_min = IWL3945_UCODE_API_MIN, 2722 .ucode_api_min = IWL3945_UCODE_API_MIN,
2723 .sku = IWL_SKU_A|IWL_SKU_G, 2723 .sku = IL_SKU_A|IL_SKU_G,
2724 .eeprom_ver = EEPROM_3945_EEPROM_VERSION, 2724 .eeprom_ver = EEPROM_3945_EEPROM_VERSION,
2725 .ops = &iwl3945_ops, 2725 .ops = &il3945_ops,
2726 .mod_params = &iwl3945_mod_params, 2726 .mod_params = &il3945_mod_params,
2727 .base_params = &iwl3945_base_params, 2727 .base_params = &il3945_base_params,
2728 .led_mode = IWL_LED_BLINK, 2728 .led_mode = IL_LED_BLINK,
2729}; 2729};
2730 2730
2731DEFINE_PCI_DEVICE_TABLE(iwl3945_hw_card_ids) = { 2731DEFINE_PCI_DEVICE_TABLE(il3945_hw_card_ids) = {
2732 {IWL_PCI_DEVICE(0x4222, 0x1005, iwl3945_bg_cfg)}, 2732 {IL_PCI_DEVICE(0x4222, 0x1005, il3945_bg_cfg)},
2733 {IWL_PCI_DEVICE(0x4222, 0x1034, iwl3945_bg_cfg)}, 2733 {IL_PCI_DEVICE(0x4222, 0x1034, il3945_bg_cfg)},
2734 {IWL_PCI_DEVICE(0x4222, 0x1044, iwl3945_bg_cfg)}, 2734 {IL_PCI_DEVICE(0x4222, 0x1044, il3945_bg_cfg)},
2735 {IWL_PCI_DEVICE(0x4227, 0x1014, iwl3945_bg_cfg)}, 2735 {IL_PCI_DEVICE(0x4227, 0x1014, il3945_bg_cfg)},
2736 {IWL_PCI_DEVICE(0x4222, PCI_ANY_ID, iwl3945_abg_cfg)}, 2736 {IL_PCI_DEVICE(0x4222, PCI_ANY_ID, il3945_abg_cfg)},
2737 {IWL_PCI_DEVICE(0x4227, PCI_ANY_ID, iwl3945_abg_cfg)}, 2737 {IL_PCI_DEVICE(0x4227, PCI_ANY_ID, il3945_abg_cfg)},
2738 {0} 2738 {0}
2739}; 2739};
2740 2740
2741MODULE_DEVICE_TABLE(pci, iwl3945_hw_card_ids); 2741MODULE_DEVICE_TABLE(pci, il3945_hw_card_ids);
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.h b/drivers/net/wireless/iwlegacy/iwl-3945.h
index b118b59b71de..167eedcfeb63 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.h
@@ -29,15 +29,15 @@
29 * Please use iwl-3945-hw.h for hardware-related definitions. 29 * Please use iwl-3945-hw.h for hardware-related definitions.
30 */ 30 */
31 31
32#ifndef __iwl_3945_h__ 32#ifndef __il_3945_h__
33#define __iwl_3945_h__ 33#define __il_3945_h__
34 34
35#include <linux/pci.h> /* for struct pci_device_id */ 35#include <linux/pci.h> /* for struct pci_device_id */
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <net/ieee80211_radiotap.h> 37#include <net/ieee80211_radiotap.h>
38 38
39/* Hardware specific file defines the PCI IDs table for that hardware module */ 39/* Hardware specific file defines the PCI IDs table for that hardware module */
40extern const struct pci_device_id iwl3945_hw_card_ids[]; 40extern const struct pci_device_id il3945_hw_card_ids[];
41 41
42#include "iwl-csr.h" 42#include "iwl-csr.h"
43#include "iwl-prph.h" 43#include "iwl-prph.h"
@@ -69,12 +69,12 @@ extern const struct pci_device_id iwl3945_hw_card_ids[];
69 * noise info (e.g. averaging might be done in app); measured dBm values are 69 * noise info (e.g. averaging might be done in app); measured dBm values are
70 * always negative ... using a negative value as the default keeps all 70 * always negative ... using a negative value as the default keeps all
71 * averages within an s8's (used in some apps) range of negative values. */ 71 * averages within an s8's (used in some apps) range of negative values. */
72#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) 72#define IL_NOISE_MEAS_NOT_AVAILABLE (-127)
73 73
74/* Module parameters accessible from iwl-*.c */ 74/* Module parameters accessible from iwl-*.c */
75extern struct iwl_mod_params iwl3945_mod_params; 75extern struct il_mod_params il3945_mod_params;
76 76
77struct iwl3945_rate_scale_data { 77struct il3945_rate_scale_data {
78 u64 data; 78 u64 data;
79 s32 success_counter; 79 s32 success_counter;
80 s32 success_ratio; 80 s32 success_ratio;
@@ -83,9 +83,9 @@ struct iwl3945_rate_scale_data {
83 unsigned long stamp; 83 unsigned long stamp;
84}; 84};
85 85
86struct iwl3945_rs_sta { 86struct il3945_rs_sta {
87 spinlock_t lock; 87 spinlock_t lock;
88 struct iwl_priv *priv; 88 struct il_priv *priv;
89 s32 *expected_tpt; 89 s32 *expected_tpt;
90 unsigned long last_partial_flush; 90 unsigned long last_partial_flush;
91 unsigned long last_flush; 91 unsigned long last_flush;
@@ -96,7 +96,7 @@ struct iwl3945_rs_sta {
96 u8 flush_pending; 96 u8 flush_pending;
97 u8 start_rate; 97 u8 start_rate;
98 struct timer_list rate_scale_flush; 98 struct timer_list rate_scale_flush;
99 struct iwl3945_rate_scale_data win[IWL_RATE_COUNT_3945]; 99 struct il3945_rate_scale_data win[IL_RATE_COUNT_3945];
100#ifdef CONFIG_MAC80211_DEBUGFS 100#ifdef CONFIG_MAC80211_DEBUGFS
101 struct dentry *rs_sta_dbgfs_stats_table_file; 101 struct dentry *rs_sta_dbgfs_stats_table_file;
102#endif 102#endif
@@ -110,15 +110,15 @@ struct iwl3945_rs_sta {
110 * The common struct MUST be first because it is shared between 110 * The common struct MUST be first because it is shared between
111 * 3945 and 4965! 111 * 3945 and 4965!
112 */ 112 */
113struct iwl3945_sta_priv { 113struct il3945_sta_priv {
114 struct iwl_station_priv_common common; 114 struct il_station_priv_common common;
115 struct iwl3945_rs_sta rs_sta; 115 struct il3945_rs_sta rs_sta;
116}; 116};
117 117
118enum iwl3945_antenna { 118enum il3945_antenna {
119 IWL_ANTENNA_DIVERSITY, 119 IL_ANTENNA_DIVERSITY,
120 IWL_ANTENNA_MAIN, 120 IL_ANTENNA_MAIN,
121 IWL_ANTENNA_AUX 121 IL_ANTENNA_AUX
122}; 122};
123 123
124/* 124/*
@@ -138,23 +138,23 @@ enum iwl3945_antenna {
138#define DEFAULT_SHORT_RETRY_LIMIT 7U 138#define DEFAULT_SHORT_RETRY_LIMIT 7U
139#define DEFAULT_LONG_RETRY_LIMIT 4U 139#define DEFAULT_LONG_RETRY_LIMIT 4U
140 140
141#define IWL_TX_FIFO_AC0 0 141#define IL_TX_FIFO_AC0 0
142#define IWL_TX_FIFO_AC1 1 142#define IL_TX_FIFO_AC1 1
143#define IWL_TX_FIFO_AC2 2 143#define IL_TX_FIFO_AC2 2
144#define IWL_TX_FIFO_AC3 3 144#define IL_TX_FIFO_AC3 3
145#define IWL_TX_FIFO_HCCA_1 5 145#define IL_TX_FIFO_HCCA_1 5
146#define IWL_TX_FIFO_HCCA_2 6 146#define IL_TX_FIFO_HCCA_2 6
147#define IWL_TX_FIFO_NONE 7 147#define IL_TX_FIFO_NONE 7
148 148
149#define IEEE80211_DATA_LEN 2304 149#define IEEE80211_DATA_LEN 2304
150#define IEEE80211_4ADDR_LEN 30 150#define IEEE80211_4ADDR_LEN 30
151#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) 151#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
152#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) 152#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
153 153
154struct iwl3945_frame { 154struct il3945_frame {
155 union { 155 union {
156 struct ieee80211_hdr frame; 156 struct ieee80211_hdr frame;
157 struct iwl3945_tx_beacon_cmd beacon; 157 struct il3945_tx_beacon_cmd beacon;
158 u8 raw[IEEE80211_FRAME_LEN]; 158 u8 raw[IEEE80211_FRAME_LEN];
159 u8 cmd[360]; 159 u8 cmd[360];
160 } u; 160 } u;
@@ -169,19 +169,19 @@ struct iwl3945_frame {
169#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 169#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
170#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 170#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
171 171
172#define IWL_SUPPORTED_RATES_IE_LEN 8 172#define IL_SUPPORTED_RATES_IE_LEN 8
173 173
174#define SCAN_INTERVAL 100 174#define SCAN_INTERVAL 100
175 175
176#define MAX_TID_COUNT 9 176#define MAX_TID_COUNT 9
177 177
178#define IWL_INVALID_RATE 0xFF 178#define IL_INVALID_RATE 0xFF
179#define IWL_INVALID_VALUE -1 179#define IL_INVALID_VALUE -1
180 180
181#define STA_PS_STATUS_WAKE 0 181#define STA_PS_STATUS_WAKE 0
182#define STA_PS_STATUS_SLEEP 1 182#define STA_PS_STATUS_SLEEP 1
183 183
184struct iwl3945_ibss_seq { 184struct il3945_ibss_seq {
185 u8 mac[ETH_ALEN]; 185 u8 mac[ETH_ALEN];
186 u16 seq_num; 186 u16 seq_num;
187 u16 frag_num; 187 u16 frag_num;
@@ -189,14 +189,14 @@ struct iwl3945_ibss_seq {
189 struct list_head list; 189 struct list_head list;
190}; 190};
191 191
192#define IWL_RX_HDR(x) ((struct iwl3945_rx_frame_hdr *)(\ 192#define IL_RX_HDR(x) ((struct il3945_rx_frame_hdr *)(\
193 x->u.rx_frame.stats.payload + \ 193 x->u.rx_frame.stats.payload + \
194 x->u.rx_frame.stats.phy_count)) 194 x->u.rx_frame.stats.phy_count))
195#define IWL_RX_END(x) ((struct iwl3945_rx_frame_end *)(\ 195#define IL_RX_END(x) ((struct il3945_rx_frame_end *)(\
196 IWL_RX_HDR(x)->payload + \ 196 IL_RX_HDR(x)->payload + \
197 le16_to_cpu(IWL_RX_HDR(x)->len))) 197 le16_to_cpu(IL_RX_HDR(x)->len)))
198#define IWL_RX_STATS(x) (&x->u.rx_frame.stats) 198#define IL_RX_STATS(x) (&x->u.rx_frame.stats)
199#define IWL_RX_DATA(x) (IWL_RX_HDR(x)->payload) 199#define IL_RX_DATA(x) (IL_RX_HDR(x)->payload)
200 200
201 201
202/****************************************************************************** 202/******************************************************************************
@@ -205,14 +205,14 @@ struct iwl3945_ibss_seq {
205 * for use by iwl-*.c 205 * for use by iwl-*.c
206 * 206 *
207 *****************************************************************************/ 207 *****************************************************************************/
208extern int iwl3945_calc_db_from_ratio(int sig_ratio); 208extern int il3945_calc_db_from_ratio(int sig_ratio);
209extern void iwl3945_rx_replenish(void *data); 209extern void il3945_rx_replenish(void *data);
210extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); 210extern void il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq);
211extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, 211extern unsigned int il3945_fill_beacon_frame(struct il_priv *priv,
212 struct ieee80211_hdr *hdr, int left); 212 struct ieee80211_hdr *hdr, int left);
213extern int iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log, 213extern int il3945_dump_nic_event_log(struct il_priv *priv, bool full_log,
214 char **buf, bool display); 214 char **buf, bool display);
215extern void iwl3945_dump_nic_error_log(struct iwl_priv *priv); 215extern void il3945_dump_nic_error_log(struct il_priv *priv);
216 216
217/****************************************************************************** 217/******************************************************************************
218 * 218 *
@@ -223,86 +223,86 @@ extern void iwl3945_dump_nic_error_log(struct iwl_priv *priv);
223 * which is why they are in the hardware specific files (vs. iwl-base.c) 223 * which is why they are in the hardware specific files (vs. iwl-base.c)
224 * 224 *
225 * Naming convention -- 225 * Naming convention --
226 * iwl3945_ <-- Its part of iwlwifi (should be changed to iwl3945_) 226 * il3945_ <-- Its part of iwlwifi (should be changed to il3945_)
227 * iwl3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) 227 * il3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW)
228 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) 228 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
229 * iwl3945_bg_ <-- Called from work queue context 229 * il3945_bg_ <-- Called from work queue context
230 * iwl3945_mac_ <-- mac80211 callback 230 * il3945_mac_ <-- mac80211 callback
231 * 231 *
232 ****************************************************************************/ 232 ****************************************************************************/
233extern void iwl3945_hw_rx_handler_setup(struct iwl_priv *priv); 233extern void il3945_hw_rx_handler_setup(struct il_priv *priv);
234extern void iwl3945_hw_setup_deferred_work(struct iwl_priv *priv); 234extern void il3945_hw_setup_deferred_work(struct il_priv *priv);
235extern void iwl3945_hw_cancel_deferred_work(struct iwl_priv *priv); 235extern void il3945_hw_cancel_deferred_work(struct il_priv *priv);
236extern int iwl3945_hw_rxq_stop(struct iwl_priv *priv); 236extern int il3945_hw_rxq_stop(struct il_priv *priv);
237extern int iwl3945_hw_set_hw_params(struct iwl_priv *priv); 237extern int il3945_hw_set_hw_params(struct il_priv *priv);
238extern int iwl3945_hw_nic_init(struct iwl_priv *priv); 238extern int il3945_hw_nic_init(struct il_priv *priv);
239extern int iwl3945_hw_nic_stop_master(struct iwl_priv *priv); 239extern int il3945_hw_nic_stop_master(struct il_priv *priv);
240extern void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv); 240extern void il3945_hw_txq_ctx_free(struct il_priv *priv);
241extern void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv); 241extern void il3945_hw_txq_ctx_stop(struct il_priv *priv);
242extern int iwl3945_hw_nic_reset(struct iwl_priv *priv); 242extern int il3945_hw_nic_reset(struct il_priv *priv);
243extern int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, 243extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv,
244 struct iwl_tx_queue *txq, 244 struct il_tx_queue *txq,
245 dma_addr_t addr, u16 len, 245 dma_addr_t addr, u16 len,
246 u8 reset, u8 pad); 246 u8 reset, u8 pad);
247extern void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, 247extern void il3945_hw_txq_free_tfd(struct il_priv *priv,
248 struct iwl_tx_queue *txq); 248 struct il_tx_queue *txq);
249extern int iwl3945_hw_get_temperature(struct iwl_priv *priv); 249extern int il3945_hw_get_temperature(struct il_priv *priv);
250extern int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, 250extern int il3945_hw_tx_queue_init(struct il_priv *priv,
251 struct iwl_tx_queue *txq); 251 struct il_tx_queue *txq);
252extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv, 252extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv,
253 struct iwl3945_frame *frame, u8 rate); 253 struct il3945_frame *frame, u8 rate);
254void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, 254void il3945_hw_build_tx_cmd_rate(struct il_priv *priv,
255 struct iwl_device_cmd *cmd, 255 struct il_device_cmd *cmd,
256 struct ieee80211_tx_info *info, 256 struct ieee80211_tx_info *info,
257 struct ieee80211_hdr *hdr, 257 struct ieee80211_hdr *hdr,
258 int sta_id, int tx_id); 258 int sta_id, int tx_id);
259extern int iwl3945_hw_reg_send_txpower(struct iwl_priv *priv); 259extern int il3945_hw_reg_send_txpower(struct il_priv *priv);
260extern int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power); 260extern int il3945_hw_reg_set_txpower(struct il_priv *priv, s8 power);
261extern void iwl3945_hw_rx_statistics(struct iwl_priv *priv, 261extern void il3945_hw_rx_statistics(struct il_priv *priv,
262 struct iwl_rx_mem_buffer *rxb); 262 struct il_rx_mem_buffer *rxb);
263void iwl3945_reply_statistics(struct iwl_priv *priv, 263void il3945_reply_statistics(struct il_priv *priv,
264 struct iwl_rx_mem_buffer *rxb); 264 struct il_rx_mem_buffer *rxb);
265extern void iwl3945_disable_events(struct iwl_priv *priv); 265extern void il3945_disable_events(struct il_priv *priv);
266extern int iwl4965_get_temperature(const struct iwl_priv *priv); 266extern int il4965_get_temperature(const struct il_priv *priv);
267extern void iwl3945_post_associate(struct iwl_priv *priv); 267extern void il3945_post_associate(struct il_priv *priv);
268extern void iwl3945_config_ap(struct iwl_priv *priv); 268extern void il3945_config_ap(struct il_priv *priv);
269 269
270extern int iwl3945_commit_rxon(struct iwl_priv *priv, 270extern int il3945_commit_rxon(struct il_priv *priv,
271 struct iwl_rxon_context *ctx); 271 struct il_rxon_context *ctx);
272 272
273/** 273/**
274 * iwl3945_hw_find_station - Find station id for a given BSSID 274 * il3945_hw_find_station - Find station id for a given BSSID
275 * @bssid: MAC address of station ID to find 275 * @bssid: MAC address of station ID to find
276 * 276 *
277 * NOTE: This should not be hardware specific but the code has 277 * NOTE: This should not be hardware specific but the code has
278 * not yet been merged into a single common layer for managing the 278 * not yet been merged into a single common layer for managing the
279 * station tables. 279 * station tables.
280 */ 280 */
281extern u8 iwl3945_hw_find_station(struct iwl_priv *priv, const u8 *bssid); 281extern u8 il3945_hw_find_station(struct il_priv *priv, const u8 *bssid);
282 282
283extern struct ieee80211_ops iwl3945_hw_ops; 283extern struct ieee80211_ops il3945_hw_ops;
284 284
285/* 285/*
286 * Forward declare iwl-3945.c functions for iwl3945-base.c 286 * Forward declare iwl-3945.c functions for iwl3945-base.c
287 */ 287 */
288extern __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv); 288extern __le32 il3945_get_antenna_flags(const struct il_priv *priv);
289extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv); 289extern int il3945_init_hw_rate_table(struct il_priv *priv);
290extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv); 290extern void il3945_reg_txpower_periodic(struct il_priv *priv);
291extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv); 291extern int il3945_txpower_set_from_eeprom(struct il_priv *priv);
292 292
293extern const struct iwl_channel_info *iwl3945_get_channel_info( 293extern const struct il_channel_info *il3945_get_channel_info(
294 const struct iwl_priv *priv, enum ieee80211_band band, u16 channel); 294 const struct il_priv *priv, enum ieee80211_band band, u16 channel);
295 295
296extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate); 296extern int il3945_rs_next_rate(struct il_priv *priv, int rate);
297 297
298/* scanning */ 298/* scanning */
299int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif); 299int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif);
300void iwl3945_post_scan(struct iwl_priv *priv); 300void il3945_post_scan(struct il_priv *priv);
301 301
302/* rates */ 302/* rates */
303extern const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT_3945]; 303extern const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945];
304 304
305/* Requires full declaration of iwl_priv before including */ 305/* Requires full declaration of il_priv before including */
306#include "iwl-io.h" 306#include "iwl-io.h"
307 307
308#endif 308#endif
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
index 162d877e6869..115eeb3d7c39 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c
@@ -80,11 +80,11 @@ struct statistics_general_data {
80 u32 beacon_energy_c; 80 u32 beacon_energy_c;
81}; 81};
82 82
83void iwl4965_calib_free_results(struct iwl_priv *priv) 83void il4965_calib_free_results(struct il_priv *priv)
84{ 84{
85 int i; 85 int i;
86 86
87 for (i = 0; i < IWL_CALIB_MAX; i++) { 87 for (i = 0; i < IL_CALIB_MAX; i++) {
88 kfree(priv->calib_results[i].buf); 88 kfree(priv->calib_results[i].buf);
89 priv->calib_results[i].buf = NULL; 89 priv->calib_results[i].buf = NULL;
90 priv->calib_results[i].buf_len = 0; 90 priv->calib_results[i].buf_len = 0;
@@ -103,7 +103,7 @@ void iwl4965_calib_free_results(struct iwl_priv *priv)
103 * enough to receive all of our own network traffic, but not so 103 * enough to receive all of our own network traffic, but not so
104 * high that our DSP gets too busy trying to lock onto non-network 104 * high that our DSP gets too busy trying to lock onto non-network
105 * activity/noise. */ 105 * activity/noise. */
106static int iwl4965_sens_energy_cck(struct iwl_priv *priv, 106static int il4965_sens_energy_cck(struct il_priv *priv,
107 u32 norm_fa, 107 u32 norm_fa,
108 u32 rx_enable_time, 108 u32 rx_enable_time,
109 struct statistics_general_data *rx_info) 109 struct statistics_general_data *rx_info)
@@ -129,8 +129,8 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
129 u32 false_alarms = norm_fa * 200 * 1024; 129 u32 false_alarms = norm_fa * 200 * 1024;
130 u32 max_false_alarms = MAX_FA_CCK * rx_enable_time; 130 u32 max_false_alarms = MAX_FA_CCK * rx_enable_time;
131 u32 min_false_alarms = MIN_FA_CCK * rx_enable_time; 131 u32 min_false_alarms = MIN_FA_CCK * rx_enable_time;
132 struct iwl_sensitivity_data *data = NULL; 132 struct il_sensitivity_data *data = NULL;
133 const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; 133 const struct il_sensitivity_ranges *ranges = priv->hw_params.sens;
134 134
135 data = &(priv->sensitivity_data); 135 data = &(priv->sensitivity_data);
136 136
@@ -160,7 +160,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
160 val = data->nrg_silence_rssi[i]; 160 val = data->nrg_silence_rssi[i];
161 silence_ref = max(silence_ref, val); 161 silence_ref = max(silence_ref, val);
162 } 162 }
163 IWL_DEBUG_CALIB(priv, "silence a %u, b %u, c %u, 20-bcn max %u\n", 163 IL_DEBUG_CALIB(priv, "silence a %u, b %u, c %u, 20-bcn max %u\n",
164 silence_rssi_a, silence_rssi_b, silence_rssi_c, 164 silence_rssi_a, silence_rssi_b, silence_rssi_c,
165 silence_ref); 165 silence_ref);
166 166
@@ -184,7 +184,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
184 max_nrg_cck = (u32) max(max_nrg_cck, (data->nrg_value[i])); 184 max_nrg_cck = (u32) max(max_nrg_cck, (data->nrg_value[i]));
185 max_nrg_cck += 6; 185 max_nrg_cck += 6;
186 186
187 IWL_DEBUG_CALIB(priv, "rx energy a %u, b %u, c %u, 10-bcn max/min %u\n", 187 IL_DEBUG_CALIB(priv, "rx energy a %u, b %u, c %u, 10-bcn max/min %u\n",
188 rx_info->beacon_energy_a, rx_info->beacon_energy_b, 188 rx_info->beacon_energy_a, rx_info->beacon_energy_b,
189 rx_info->beacon_energy_c, max_nrg_cck - 6); 189 rx_info->beacon_energy_c, max_nrg_cck - 6);
190 190
@@ -194,16 +194,16 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
194 data->num_in_cck_no_fa++; 194 data->num_in_cck_no_fa++;
195 else 195 else
196 data->num_in_cck_no_fa = 0; 196 data->num_in_cck_no_fa = 0;
197 IWL_DEBUG_CALIB(priv, "consecutive bcns with few false alarms = %u\n", 197 IL_DEBUG_CALIB(priv, "consecutive bcns with few false alarms = %u\n",
198 data->num_in_cck_no_fa); 198 data->num_in_cck_no_fa);
199 199
200 /* If we got too many false alarms this time, reduce sensitivity */ 200 /* If we got too many false alarms this time, reduce sensitivity */
201 if ((false_alarms > max_false_alarms) && 201 if ((false_alarms > max_false_alarms) &&
202 (data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK)) { 202 (data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK)) {
203 IWL_DEBUG_CALIB(priv, "norm FA %u > max FA %u\n", 203 IL_DEBUG_CALIB(priv, "norm FA %u > max FA %u\n",
204 false_alarms, max_false_alarms); 204 false_alarms, max_false_alarms);
205 IWL_DEBUG_CALIB(priv, "... reducing sensitivity\n"); 205 IL_DEBUG_CALIB(priv, "... reducing sensitivity\n");
206 data->nrg_curr_state = IWL_FA_TOO_MANY; 206 data->nrg_curr_state = IL_FA_TOO_MANY;
207 /* Store for "fewer than desired" on later beacon */ 207 /* Store for "fewer than desired" on later beacon */
208 data->nrg_silence_ref = silence_ref; 208 data->nrg_silence_ref = silence_ref;
209 209
@@ -212,14 +212,14 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
212 data->nrg_th_cck = data->nrg_th_cck - NRG_STEP_CCK; 212 data->nrg_th_cck = data->nrg_th_cck - NRG_STEP_CCK;
213 /* Else if we got fewer than desired, increase sensitivity */ 213 /* Else if we got fewer than desired, increase sensitivity */
214 } else if (false_alarms < min_false_alarms) { 214 } else if (false_alarms < min_false_alarms) {
215 data->nrg_curr_state = IWL_FA_TOO_FEW; 215 data->nrg_curr_state = IL_FA_TOO_FEW;
216 216
217 /* Compare silence level with silence level for most recent 217 /* Compare silence level with silence level for most recent
218 * healthy number or too many false alarms */ 218 * healthy number or too many false alarms */
219 data->nrg_auto_corr_silence_diff = (s32)data->nrg_silence_ref - 219 data->nrg_auto_corr_silence_diff = (s32)data->nrg_silence_ref -
220 (s32)silence_ref; 220 (s32)silence_ref;
221 221
222 IWL_DEBUG_CALIB(priv, 222 IL_DEBUG_CALIB(priv,
223 "norm FA %u < min FA %u, silence diff %d\n", 223 "norm FA %u < min FA %u, silence diff %d\n",
224 false_alarms, min_false_alarms, 224 false_alarms, min_false_alarms,
225 data->nrg_auto_corr_silence_diff); 225 data->nrg_auto_corr_silence_diff);
@@ -230,23 +230,23 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
230 * from a previous beacon with too many, or healthy # FAs 230 * from a previous beacon with too many, or healthy # FAs
231 * OR 2) We've seen a lot of beacons (100) with too few 231 * OR 2) We've seen a lot of beacons (100) with too few
232 * false alarms */ 232 * false alarms */
233 if ((data->nrg_prev_state != IWL_FA_TOO_MANY) && 233 if ((data->nrg_prev_state != IL_FA_TOO_MANY) &&
234 ((data->nrg_auto_corr_silence_diff > NRG_DIFF) || 234 ((data->nrg_auto_corr_silence_diff > NRG_DIFF) ||
235 (data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) { 235 (data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) {
236 236
237 IWL_DEBUG_CALIB(priv, "... increasing sensitivity\n"); 237 IL_DEBUG_CALIB(priv, "... increasing sensitivity\n");
238 /* Increase nrg value to increase sensitivity */ 238 /* Increase nrg value to increase sensitivity */
239 val = data->nrg_th_cck + NRG_STEP_CCK; 239 val = data->nrg_th_cck + NRG_STEP_CCK;
240 data->nrg_th_cck = min((u32)ranges->min_nrg_cck, val); 240 data->nrg_th_cck = min((u32)ranges->min_nrg_cck, val);
241 } else { 241 } else {
242 IWL_DEBUG_CALIB(priv, 242 IL_DEBUG_CALIB(priv,
243 "... but not changing sensitivity\n"); 243 "... but not changing sensitivity\n");
244 } 244 }
245 245
246 /* Else we got a healthy number of false alarms, keep status quo */ 246 /* Else we got a healthy number of false alarms, keep status quo */
247 } else { 247 } else {
248 IWL_DEBUG_CALIB(priv, " FA in safe zone\n"); 248 IL_DEBUG_CALIB(priv, " FA in safe zone\n");
249 data->nrg_curr_state = IWL_FA_GOOD_RANGE; 249 data->nrg_curr_state = IL_FA_GOOD_RANGE;
250 250
251 /* Store for use in "fewer than desired" with later beacon */ 251 /* Store for use in "fewer than desired" with later beacon */
252 data->nrg_silence_ref = silence_ref; 252 data->nrg_silence_ref = silence_ref;
@@ -254,8 +254,8 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
254 /* If previous beacon had too many false alarms, 254 /* If previous beacon had too many false alarms,
255 * give it some extra margin by reducing sensitivity again 255 * give it some extra margin by reducing sensitivity again
256 * (but don't go below measured energy of desired Rx) */ 256 * (but don't go below measured energy of desired Rx) */
257 if (IWL_FA_TOO_MANY == data->nrg_prev_state) { 257 if (IL_FA_TOO_MANY == data->nrg_prev_state) {
258 IWL_DEBUG_CALIB(priv, "... increasing margin\n"); 258 IL_DEBUG_CALIB(priv, "... increasing margin\n");
259 if (data->nrg_th_cck > (max_nrg_cck + NRG_MARGIN)) 259 if (data->nrg_th_cck > (max_nrg_cck + NRG_MARGIN))
260 data->nrg_th_cck -= NRG_MARGIN; 260 data->nrg_th_cck -= NRG_MARGIN;
261 else 261 else
@@ -269,7 +269,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
269 * Lower value is higher energy, so we use max()! 269 * Lower value is higher energy, so we use max()!
270 */ 270 */
271 data->nrg_th_cck = max(max_nrg_cck, data->nrg_th_cck); 271 data->nrg_th_cck = max(max_nrg_cck, data->nrg_th_cck);
272 IWL_DEBUG_CALIB(priv, "new nrg_th_cck %u\n", data->nrg_th_cck); 272 IL_DEBUG_CALIB(priv, "new nrg_th_cck %u\n", data->nrg_th_cck);
273 273
274 data->nrg_prev_state = data->nrg_curr_state; 274 data->nrg_prev_state = data->nrg_curr_state;
275 275
@@ -306,7 +306,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
306} 306}
307 307
308 308
309static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv, 309static int il4965_sens_auto_corr_ofdm(struct il_priv *priv,
310 u32 norm_fa, 310 u32 norm_fa,
311 u32 rx_enable_time) 311 u32 rx_enable_time)
312{ 312{
@@ -314,15 +314,15 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv,
314 u32 false_alarms = norm_fa * 200 * 1024; 314 u32 false_alarms = norm_fa * 200 * 1024;
315 u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time; 315 u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time;
316 u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time; 316 u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time;
317 struct iwl_sensitivity_data *data = NULL; 317 struct il_sensitivity_data *data = NULL;
318 const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; 318 const struct il_sensitivity_ranges *ranges = priv->hw_params.sens;
319 319
320 data = &(priv->sensitivity_data); 320 data = &(priv->sensitivity_data);
321 321
322 /* If we got too many false alarms this time, reduce sensitivity */ 322 /* If we got too many false alarms this time, reduce sensitivity */
323 if (false_alarms > max_false_alarms) { 323 if (false_alarms > max_false_alarms) {
324 324
325 IWL_DEBUG_CALIB(priv, "norm FA %u > max FA %u)\n", 325 IL_DEBUG_CALIB(priv, "norm FA %u > max FA %u)\n",
326 false_alarms, max_false_alarms); 326 false_alarms, max_false_alarms);
327 327
328 val = data->auto_corr_ofdm + AUTO_CORR_STEP_OFDM; 328 val = data->auto_corr_ofdm + AUTO_CORR_STEP_OFDM;
@@ -345,7 +345,7 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv,
345 /* Else if we got fewer than desired, increase sensitivity */ 345 /* Else if we got fewer than desired, increase sensitivity */
346 else if (false_alarms < min_false_alarms) { 346 else if (false_alarms < min_false_alarms) {
347 347
348 IWL_DEBUG_CALIB(priv, "norm FA %u < min FA %u\n", 348 IL_DEBUG_CALIB(priv, "norm FA %u < min FA %u\n",
349 false_alarms, min_false_alarms); 349 false_alarms, min_false_alarms);
350 350
351 val = data->auto_corr_ofdm - AUTO_CORR_STEP_OFDM; 351 val = data->auto_corr_ofdm - AUTO_CORR_STEP_OFDM;
@@ -364,14 +364,14 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv,
364 data->auto_corr_ofdm_mrc_x1 = 364 data->auto_corr_ofdm_mrc_x1 =
365 max((u32)ranges->auto_corr_min_ofdm_mrc_x1, val); 365 max((u32)ranges->auto_corr_min_ofdm_mrc_x1, val);
366 } else { 366 } else {
367 IWL_DEBUG_CALIB(priv, "min FA %u < norm FA %u < max FA %u OK\n", 367 IL_DEBUG_CALIB(priv, "min FA %u < norm FA %u < max FA %u OK\n",
368 min_false_alarms, false_alarms, max_false_alarms); 368 min_false_alarms, false_alarms, max_false_alarms);
369 } 369 }
370 return 0; 370 return 0;
371} 371}
372 372
373static void iwl4965_prepare_legacy_sensitivity_tbl(struct iwl_priv *priv, 373static void il4965_prepare_legacy_sensitivity_tbl(struct il_priv *priv,
374 struct iwl_sensitivity_data *data, 374 struct il_sensitivity_data *data,
375 __le16 *tbl) 375 __le16 *tbl)
376{ 376{
377 tbl[HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX] = 377 tbl[HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX] =
@@ -400,24 +400,24 @@ static void iwl4965_prepare_legacy_sensitivity_tbl(struct iwl_priv *priv,
400 tbl[HD_OFDM_ENERGY_TH_IN_INDEX] = 400 tbl[HD_OFDM_ENERGY_TH_IN_INDEX] =
401 cpu_to_le16(data->nrg_th_cca); 401 cpu_to_le16(data->nrg_th_cca);
402 402
403 IWL_DEBUG_CALIB(priv, "ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n", 403 IL_DEBUG_CALIB(priv, "ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n",
404 data->auto_corr_ofdm, data->auto_corr_ofdm_mrc, 404 data->auto_corr_ofdm, data->auto_corr_ofdm_mrc,
405 data->auto_corr_ofdm_x1, data->auto_corr_ofdm_mrc_x1, 405 data->auto_corr_ofdm_x1, data->auto_corr_ofdm_mrc_x1,
406 data->nrg_th_ofdm); 406 data->nrg_th_ofdm);
407 407
408 IWL_DEBUG_CALIB(priv, "cck: ac %u mrc %u thresh %u\n", 408 IL_DEBUG_CALIB(priv, "cck: ac %u mrc %u thresh %u\n",
409 data->auto_corr_cck, data->auto_corr_cck_mrc, 409 data->auto_corr_cck, data->auto_corr_cck_mrc,
410 data->nrg_th_cck); 410 data->nrg_th_cck);
411} 411}
412 412
413/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ 413/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */
414static int iwl4965_sensitivity_write(struct iwl_priv *priv) 414static int il4965_sensitivity_write(struct il_priv *priv)
415{ 415{
416 struct iwl_sensitivity_cmd cmd; 416 struct il_sensitivity_cmd cmd;
417 struct iwl_sensitivity_data *data = NULL; 417 struct il_sensitivity_data *data = NULL;
418 struct iwl_host_cmd cmd_out = { 418 struct il_host_cmd cmd_out = {
419 .id = SENSITIVITY_CMD, 419 .id = SENSITIVITY_CMD,
420 .len = sizeof(struct iwl_sensitivity_cmd), 420 .len = sizeof(struct il_sensitivity_cmd),
421 .flags = CMD_ASYNC, 421 .flags = CMD_ASYNC,
422 .data = &cmd, 422 .data = &cmd,
423 }; 423 };
@@ -426,7 +426,7 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv)
426 426
427 memset(&cmd, 0, sizeof(cmd)); 427 memset(&cmd, 0, sizeof(cmd));
428 428
429 iwl4965_prepare_legacy_sensitivity_tbl(priv, data, &cmd.table[0]); 429 il4965_prepare_legacy_sensitivity_tbl(priv, data, &cmd.table[0]);
430 430
431 /* Update uCode's "work" table, and copy it to DSP */ 431 /* Update uCode's "work" table, and copy it to DSP */
432 cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE; 432 cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE;
@@ -434,7 +434,7 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv)
434 /* Don't send command to uCode if nothing has changed */ 434 /* Don't send command to uCode if nothing has changed */
435 if (!memcmp(&cmd.table[0], &(priv->sensitivity_tbl[0]), 435 if (!memcmp(&cmd.table[0], &(priv->sensitivity_tbl[0]),
436 sizeof(u16)*HD_TABLE_SIZE)) { 436 sizeof(u16)*HD_TABLE_SIZE)) {
437 IWL_DEBUG_CALIB(priv, "No change in SENSITIVITY_CMD\n"); 437 IL_DEBUG_CALIB(priv, "No change in SENSITIVITY_CMD\n");
438 return 0; 438 return 0;
439 } 439 }
440 440
@@ -442,20 +442,20 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv)
442 memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]), 442 memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]),
443 sizeof(u16)*HD_TABLE_SIZE); 443 sizeof(u16)*HD_TABLE_SIZE);
444 444
445 return iwl_legacy_send_cmd(priv, &cmd_out); 445 return il_send_cmd(priv, &cmd_out);
446} 446}
447 447
448void iwl4965_init_sensitivity(struct iwl_priv *priv) 448void il4965_init_sensitivity(struct il_priv *priv)
449{ 449{
450 int ret = 0; 450 int ret = 0;
451 int i; 451 int i;
452 struct iwl_sensitivity_data *data = NULL; 452 struct il_sensitivity_data *data = NULL;
453 const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; 453 const struct il_sensitivity_ranges *ranges = priv->hw_params.sens;
454 454
455 if (priv->disable_sens_cal) 455 if (priv->disable_sens_cal)
456 return; 456 return;
457 457
458 IWL_DEBUG_CALIB(priv, "Start iwl4965_init_sensitivity\n"); 458 IL_DEBUG_CALIB(priv, "Start il4965_init_sensitivity\n");
459 459
460 /* Clear driver's sensitivity algo data */ 460 /* Clear driver's sensitivity algo data */
461 data = &(priv->sensitivity_data); 461 data = &(priv->sensitivity_data);
@@ -463,11 +463,11 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv)
463 if (ranges == NULL) 463 if (ranges == NULL)
464 return; 464 return;
465 465
466 memset(data, 0, sizeof(struct iwl_sensitivity_data)); 466 memset(data, 0, sizeof(struct il_sensitivity_data));
467 467
468 data->num_in_cck_no_fa = 0; 468 data->num_in_cck_no_fa = 0;
469 data->nrg_curr_state = IWL_FA_TOO_MANY; 469 data->nrg_curr_state = IL_FA_TOO_MANY;
470 data->nrg_prev_state = IWL_FA_TOO_MANY; 470 data->nrg_prev_state = IL_FA_TOO_MANY;
471 data->nrg_silence_ref = 0; 471 data->nrg_silence_ref = 0;
472 data->nrg_silence_idx = 0; 472 data->nrg_silence_idx = 0;
473 data->nrg_energy_idx = 0; 473 data->nrg_energy_idx = 0;
@@ -495,11 +495,11 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv)
495 data->last_bad_plcp_cnt_cck = 0; 495 data->last_bad_plcp_cnt_cck = 0;
496 data->last_fa_cnt_cck = 0; 496 data->last_fa_cnt_cck = 0;
497 497
498 ret |= iwl4965_sensitivity_write(priv); 498 ret |= il4965_sensitivity_write(priv);
499 IWL_DEBUG_CALIB(priv, "<<return 0x%X\n", ret); 499 IL_DEBUG_CALIB(priv, "<<return 0x%X\n", ret);
500} 500}
501 501
502void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp) 502void il4965_sensitivity_calibration(struct il_priv *priv, void *resp)
503{ 503{
504 u32 rx_enable_time; 504 u32 rx_enable_time;
505 u32 fa_cck; 505 u32 fa_cck;
@@ -508,7 +508,7 @@ void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp)
508 u32 bad_plcp_ofdm; 508 u32 bad_plcp_ofdm;
509 u32 norm_fa_ofdm; 509 u32 norm_fa_ofdm;
510 u32 norm_fa_cck; 510 u32 norm_fa_cck;
511 struct iwl_sensitivity_data *data = NULL; 511 struct il_sensitivity_data *data = NULL;
512 struct statistics_rx_non_phy *rx_info; 512 struct statistics_rx_non_phy *rx_info;
513 struct statistics_rx_phy *ofdm, *cck; 513 struct statistics_rx_phy *ofdm, *cck;
514 unsigned long flags; 514 unsigned long flags;
@@ -519,19 +519,19 @@ void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp)
519 519
520 data = &(priv->sensitivity_data); 520 data = &(priv->sensitivity_data);
521 521
522 if (!iwl_legacy_is_any_associated(priv)) { 522 if (!il_is_any_associated(priv)) {
523 IWL_DEBUG_CALIB(priv, "<< - not associated\n"); 523 IL_DEBUG_CALIB(priv, "<< - not associated\n");
524 return; 524 return;
525 } 525 }
526 526
527 spin_lock_irqsave(&priv->lock, flags); 527 spin_lock_irqsave(&priv->lock, flags);
528 528
529 rx_info = &(((struct iwl_notif_statistics *)resp)->rx.general); 529 rx_info = &(((struct il_notif_statistics *)resp)->rx.general);
530 ofdm = &(((struct iwl_notif_statistics *)resp)->rx.ofdm); 530 ofdm = &(((struct il_notif_statistics *)resp)->rx.ofdm);
531 cck = &(((struct iwl_notif_statistics *)resp)->rx.cck); 531 cck = &(((struct il_notif_statistics *)resp)->rx.cck);
532 532
533 if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { 533 if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
534 IWL_DEBUG_CALIB(priv, "<< invalid data.\n"); 534 IL_DEBUG_CALIB(priv, "<< invalid data.\n");
535 spin_unlock_irqrestore(&priv->lock, flags); 535 spin_unlock_irqrestore(&priv->lock, flags);
536 return; 536 return;
537 } 537 }
@@ -558,10 +558,10 @@ void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp)
558 558
559 spin_unlock_irqrestore(&priv->lock, flags); 559 spin_unlock_irqrestore(&priv->lock, flags);
560 560
561 IWL_DEBUG_CALIB(priv, "rx_enable_time = %u usecs\n", rx_enable_time); 561 IL_DEBUG_CALIB(priv, "rx_enable_time = %u usecs\n", rx_enable_time);
562 562
563 if (!rx_enable_time) { 563 if (!rx_enable_time) {
564 IWL_DEBUG_CALIB(priv, "<< RX Enable Time == 0!\n"); 564 IL_DEBUG_CALIB(priv, "<< RX Enable Time == 0!\n");
565 return; 565 return;
566 } 566 }
567 567
@@ -600,17 +600,17 @@ void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp)
600 norm_fa_ofdm = fa_ofdm + bad_plcp_ofdm; 600 norm_fa_ofdm = fa_ofdm + bad_plcp_ofdm;
601 norm_fa_cck = fa_cck + bad_plcp_cck; 601 norm_fa_cck = fa_cck + bad_plcp_cck;
602 602
603 IWL_DEBUG_CALIB(priv, 603 IL_DEBUG_CALIB(priv,
604 "cck: fa %u badp %u ofdm: fa %u badp %u\n", fa_cck, 604 "cck: fa %u badp %u ofdm: fa %u badp %u\n", fa_cck,
605 bad_plcp_cck, fa_ofdm, bad_plcp_ofdm); 605 bad_plcp_cck, fa_ofdm, bad_plcp_ofdm);
606 606
607 iwl4965_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time); 607 il4965_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time);
608 iwl4965_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis); 608 il4965_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis);
609 609
610 iwl4965_sensitivity_write(priv); 610 il4965_sensitivity_write(priv);
611} 611}
612 612
613static inline u8 iwl4965_find_first_chain(u8 mask) 613static inline u8 il4965_find_first_chain(u8 mask)
614{ 614{
615 if (mask & ANT_A) 615 if (mask & ANT_A)
616 return CHAIN_A; 616 return CHAIN_A;
@@ -624,8 +624,8 @@ static inline u8 iwl4965_find_first_chain(u8 mask)
624 * disconnected. 624 * disconnected.
625 */ 625 */
626static void 626static void
627iwl4965_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, 627il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig,
628 struct iwl_chain_noise_data *data) 628 struct il_chain_noise_data *data)
629{ 629{
630 u32 active_chains = 0; 630 u32 active_chains = 0;
631 u32 max_average_sig; 631 u32 max_average_sig;
@@ -657,9 +657,9 @@ iwl4965_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
657 active_chains = (1 << max_average_sig_antenna_i); 657 active_chains = (1 << max_average_sig_antenna_i);
658 } 658 }
659 659
660 IWL_DEBUG_CALIB(priv, "average_sig: a %d b %d c %d\n", 660 IL_DEBUG_CALIB(priv, "average_sig: a %d b %d c %d\n",
661 average_sig[0], average_sig[1], average_sig[2]); 661 average_sig[0], average_sig[1], average_sig[2]);
662 IWL_DEBUG_CALIB(priv, "max_average_sig = %d, antenna %d\n", 662 IL_DEBUG_CALIB(priv, "max_average_sig = %d, antenna %d\n",
663 max_average_sig, max_average_sig_antenna_i); 663 max_average_sig, max_average_sig_antenna_i);
664 664
665 /* Compare signal strengths for all 3 receivers. */ 665 /* Compare signal strengths for all 3 receivers. */
@@ -673,7 +673,7 @@ iwl4965_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
673 data->disconn_array[i] = 1; 673 data->disconn_array[i] = 1;
674 else 674 else
675 active_chains |= (1 << i); 675 active_chains |= (1 << i);
676 IWL_DEBUG_CALIB(priv, "i = %d rssiDelta = %d " 676 IL_DEBUG_CALIB(priv, "i = %d rssiDelta = %d "
677 "disconn_array[i] = %d\n", 677 "disconn_array[i] = %d\n",
678 i, rssi_delta, data->disconn_array[i]); 678 i, rssi_delta, data->disconn_array[i]);
679 } 679 }
@@ -710,10 +710,10 @@ iwl4965_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
710 * connect the first valid tx chain 710 * connect the first valid tx chain
711 */ 711 */
712 first_chain = 712 first_chain =
713 iwl4965_find_first_chain(priv->cfg->valid_tx_ant); 713 il4965_find_first_chain(priv->cfg->valid_tx_ant);
714 data->disconn_array[first_chain] = 0; 714 data->disconn_array[first_chain] = 0;
715 active_chains |= BIT(first_chain); 715 active_chains |= BIT(first_chain);
716 IWL_DEBUG_CALIB(priv, 716 IL_DEBUG_CALIB(priv,
717 "All Tx chains are disconnected W/A - declare %d as connected\n", 717 "All Tx chains are disconnected W/A - declare %d as connected\n",
718 first_chain); 718 first_chain);
719 break; 719 break;
@@ -722,25 +722,25 @@ iwl4965_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
722 722
723 if (active_chains != priv->hw_params.valid_rx_ant && 723 if (active_chains != priv->hw_params.valid_rx_ant &&
724 active_chains != priv->chain_noise_data.active_chains) 724 active_chains != priv->chain_noise_data.active_chains)
725 IWL_DEBUG_CALIB(priv, 725 IL_DEBUG_CALIB(priv,
726 "Detected that not all antennas are connected! " 726 "Detected that not all antennas are connected! "
727 "Connected: %#x, valid: %#x.\n", 727 "Connected: %#x, valid: %#x.\n",
728 active_chains, priv->hw_params.valid_rx_ant); 728 active_chains, priv->hw_params.valid_rx_ant);
729 729
730 /* Save for use within RXON, TX, SCAN commands, etc. */ 730 /* Save for use within RXON, TX, SCAN commands, etc. */
731 data->active_chains = active_chains; 731 data->active_chains = active_chains;
732 IWL_DEBUG_CALIB(priv, "active_chains (bitwise) = 0x%x\n", 732 IL_DEBUG_CALIB(priv, "active_chains (bitwise) = 0x%x\n",
733 active_chains); 733 active_chains);
734} 734}
735 735
736static void iwl4965_gain_computation(struct iwl_priv *priv, 736static void il4965_gain_computation(struct il_priv *priv,
737 u32 *average_noise, 737 u32 *average_noise,
738 u16 min_average_noise_antenna_i, 738 u16 min_average_noise_antenna_i,
739 u32 min_average_noise, 739 u32 min_average_noise,
740 u8 default_chain) 740 u8 default_chain)
741{ 741{
742 int i, ret; 742 int i, ret;
743 struct iwl_chain_noise_data *data = &priv->chain_noise_data; 743 struct il_chain_noise_data *data = &priv->chain_noise_data;
744 744
745 data->delta_gain_code[min_average_noise_antenna_i] = 0; 745 data->delta_gain_code[min_average_noise_antenna_i] = 0;
746 746
@@ -762,32 +762,32 @@ static void iwl4965_gain_computation(struct iwl_priv *priv,
762 data->delta_gain_code[i] = 0; 762 data->delta_gain_code[i] = 0;
763 } 763 }
764 } 764 }
765 IWL_DEBUG_CALIB(priv, "delta_gain_codes: a %d b %d c %d\n", 765 IL_DEBUG_CALIB(priv, "delta_gain_codes: a %d b %d c %d\n",
766 data->delta_gain_code[0], 766 data->delta_gain_code[0],
767 data->delta_gain_code[1], 767 data->delta_gain_code[1],
768 data->delta_gain_code[2]); 768 data->delta_gain_code[2]);
769 769
770 /* Differential gain gets sent to uCode only once */ 770 /* Differential gain gets sent to uCode only once */
771 if (!data->radio_write) { 771 if (!data->radio_write) {
772 struct iwl_calib_diff_gain_cmd cmd; 772 struct il_calib_diff_gain_cmd cmd;
773 data->radio_write = 1; 773 data->radio_write = 1;
774 774
775 memset(&cmd, 0, sizeof(cmd)); 775 memset(&cmd, 0, sizeof(cmd));
776 cmd.hdr.op_code = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD; 776 cmd.hdr.op_code = IL_PHY_CALIBRATE_DIFF_GAIN_CMD;
777 cmd.diff_gain_a = data->delta_gain_code[0]; 777 cmd.diff_gain_a = data->delta_gain_code[0];
778 cmd.diff_gain_b = data->delta_gain_code[1]; 778 cmd.diff_gain_b = data->delta_gain_code[1];
779 cmd.diff_gain_c = data->delta_gain_code[2]; 779 cmd.diff_gain_c = data->delta_gain_code[2];
780 ret = iwl_legacy_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, 780 ret = il_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
781 sizeof(cmd), &cmd); 781 sizeof(cmd), &cmd);
782 if (ret) 782 if (ret)
783 IWL_DEBUG_CALIB(priv, "fail sending cmd " 783 IL_DEBUG_CALIB(priv, "fail sending cmd "
784 "REPLY_PHY_CALIBRATION_CMD\n"); 784 "REPLY_PHY_CALIBRATION_CMD\n");
785 785
786 /* TODO we might want recalculate 786 /* TODO we might want recalculate
787 * rx_chain in rxon cmd */ 787 * rx_chain in rxon cmd */
788 788
789 /* Mark so we run this algo only once! */ 789 /* Mark so we run this algo only once! */
790 data->state = IWL_CHAIN_NOISE_CALIBRATED; 790 data->state = IL_CHAIN_NOISE_CALIBRATED;
791 } 791 }
792} 792}
793 793
@@ -799,9 +799,9 @@ static void iwl4965_gain_computation(struct iwl_priv *priv,
799 * 1) Which antennas are connected. 799 * 1) Which antennas are connected.
800 * 2) Differential rx gain settings to balance the 3 receivers. 800 * 2) Differential rx gain settings to balance the 3 receivers.
801 */ 801 */
802void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) 802void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp)
803{ 803{
804 struct iwl_chain_noise_data *data = NULL; 804 struct il_chain_noise_data *data = NULL;
805 805
806 u32 chain_noise_a; 806 u32 chain_noise_a;
807 u32 chain_noise_b; 807 u32 chain_noise_b;
@@ -821,7 +821,7 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
821 unsigned long flags; 821 unsigned long flags;
822 struct statistics_rx_non_phy *rx_info; 822 struct statistics_rx_non_phy *rx_info;
823 823
824 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 824 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
825 825
826 if (priv->disable_chain_noise_cal) 826 if (priv->disable_chain_noise_cal)
827 return; 827 return;
@@ -832,19 +832,19 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
832 * Accumulate just the first "chain_noise_num_beacons" after 832 * Accumulate just the first "chain_noise_num_beacons" after
833 * the first association, then we're done forever. 833 * the first association, then we're done forever.
834 */ 834 */
835 if (data->state != IWL_CHAIN_NOISE_ACCUMULATE) { 835 if (data->state != IL_CHAIN_NOISE_ACCUMULATE) {
836 if (data->state == IWL_CHAIN_NOISE_ALIVE) 836 if (data->state == IL_CHAIN_NOISE_ALIVE)
837 IWL_DEBUG_CALIB(priv, "Wait for noise calib reset\n"); 837 IL_DEBUG_CALIB(priv, "Wait for noise calib reset\n");
838 return; 838 return;
839 } 839 }
840 840
841 spin_lock_irqsave(&priv->lock, flags); 841 spin_lock_irqsave(&priv->lock, flags);
842 842
843 rx_info = &(((struct iwl_notif_statistics *)stat_resp)-> 843 rx_info = &(((struct il_notif_statistics *)stat_resp)->
844 rx.general); 844 rx.general);
845 845
846 if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { 846 if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
847 IWL_DEBUG_CALIB(priv, " << Interference data unavailable\n"); 847 IL_DEBUG_CALIB(priv, " << Interference data unavailable\n");
848 spin_unlock_irqrestore(&priv->lock, flags); 848 spin_unlock_irqrestore(&priv->lock, flags);
849 return; 849 return;
850 } 850 }
@@ -852,16 +852,16 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
852 rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK); 852 rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK);
853 rxon_chnum = le16_to_cpu(ctx->staging.channel); 853 rxon_chnum = le16_to_cpu(ctx->staging.channel);
854 854
855 stat_band24 = !!(((struct iwl_notif_statistics *) 855 stat_band24 = !!(((struct il_notif_statistics *)
856 stat_resp)->flag & 856 stat_resp)->flag &
857 STATISTICS_REPLY_FLG_BAND_24G_MSK); 857 STATISTICS_REPLY_FLG_BAND_24G_MSK);
858 stat_chnum = le32_to_cpu(((struct iwl_notif_statistics *) 858 stat_chnum = le32_to_cpu(((struct il_notif_statistics *)
859 stat_resp)->flag) >> 16; 859 stat_resp)->flag) >> 16;
860 860
861 /* Make sure we accumulate data for just the associated channel 861 /* Make sure we accumulate data for just the associated channel
862 * (even if scanning). */ 862 * (even if scanning). */
863 if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) { 863 if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) {
864 IWL_DEBUG_CALIB(priv, "Stats not from chan=%d, band24=%d\n", 864 IL_DEBUG_CALIB(priv, "Stats not from chan=%d, band24=%d\n",
865 rxon_chnum, rxon_band24); 865 rxon_chnum, rxon_band24);
866 spin_unlock_irqrestore(&priv->lock, flags); 866 spin_unlock_irqrestore(&priv->lock, flags);
867 return; 867 return;
@@ -894,11 +894,11 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
894 data->chain_signal_b = (chain_sig_b + data->chain_signal_b); 894 data->chain_signal_b = (chain_sig_b + data->chain_signal_b);
895 data->chain_signal_c = (chain_sig_c + data->chain_signal_c); 895 data->chain_signal_c = (chain_sig_c + data->chain_signal_c);
896 896
897 IWL_DEBUG_CALIB(priv, "chan=%d, band24=%d, beacon=%d\n", 897 IL_DEBUG_CALIB(priv, "chan=%d, band24=%d, beacon=%d\n",
898 rxon_chnum, rxon_band24, data->beacon_count); 898 rxon_chnum, rxon_band24, data->beacon_count);
899 IWL_DEBUG_CALIB(priv, "chain_sig: a %d b %d c %d\n", 899 IL_DEBUG_CALIB(priv, "chain_sig: a %d b %d c %d\n",
900 chain_sig_a, chain_sig_b, chain_sig_c); 900 chain_sig_a, chain_sig_b, chain_sig_c);
901 IWL_DEBUG_CALIB(priv, "chain_noise: a %d b %d c %d\n", 901 IL_DEBUG_CALIB(priv, "chain_noise: a %d b %d c %d\n",
902 chain_noise_a, chain_noise_b, chain_noise_c); 902 chain_noise_a, chain_noise_b, chain_noise_c);
903 903
904 /* If this is the "chain_noise_num_beacons", determine: 904 /* If this is the "chain_noise_num_beacons", determine:
@@ -909,7 +909,7 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
909 return; 909 return;
910 910
911 /* Analyze signal for disconnected antenna */ 911 /* Analyze signal for disconnected antenna */
912 iwl4965_find_disconn_antenna(priv, average_sig, data); 912 il4965_find_disconn_antenna(priv, average_sig, data);
913 913
914 /* Analyze noise for rx balance */ 914 /* Analyze noise for rx balance */
915 average_noise[0] = data->chain_noise_a / 915 average_noise[0] = data->chain_noise_a /
@@ -929,16 +929,16 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
929 } 929 }
930 } 930 }
931 931
932 IWL_DEBUG_CALIB(priv, "average_noise: a %d b %d c %d\n", 932 IL_DEBUG_CALIB(priv, "average_noise: a %d b %d c %d\n",
933 average_noise[0], average_noise[1], 933 average_noise[0], average_noise[1],
934 average_noise[2]); 934 average_noise[2]);
935 935
936 IWL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n", 936 IL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n",
937 min_average_noise, min_average_noise_antenna_i); 937 min_average_noise, min_average_noise_antenna_i);
938 938
939 iwl4965_gain_computation(priv, average_noise, 939 il4965_gain_computation(priv, average_noise,
940 min_average_noise_antenna_i, min_average_noise, 940 min_average_noise_antenna_i, min_average_noise,
941 iwl4965_find_first_chain(priv->cfg->valid_rx_ant)); 941 il4965_find_first_chain(priv->cfg->valid_rx_ant));
942 942
943 /* Some power changes may have been made during the calibration. 943 /* Some power changes may have been made during the calibration.
944 * Update and commit the RXON 944 * Update and commit the RXON
@@ -946,22 +946,22 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
946 if (priv->cfg->ops->lib->update_chain_flags) 946 if (priv->cfg->ops->lib->update_chain_flags)
947 priv->cfg->ops->lib->update_chain_flags(priv); 947 priv->cfg->ops->lib->update_chain_flags(priv);
948 948
949 data->state = IWL_CHAIN_NOISE_DONE; 949 data->state = IL_CHAIN_NOISE_DONE;
950 iwl_legacy_power_update_mode(priv, false); 950 il_power_update_mode(priv, false);
951} 951}
952 952
953void iwl4965_reset_run_time_calib(struct iwl_priv *priv) 953void il4965_reset_run_time_calib(struct il_priv *priv)
954{ 954{
955 int i; 955 int i;
956 memset(&(priv->sensitivity_data), 0, 956 memset(&(priv->sensitivity_data), 0,
957 sizeof(struct iwl_sensitivity_data)); 957 sizeof(struct il_sensitivity_data));
958 memset(&(priv->chain_noise_data), 0, 958 memset(&(priv->chain_noise_data), 0,
959 sizeof(struct iwl_chain_noise_data)); 959 sizeof(struct il_chain_noise_data));
960 for (i = 0; i < NUM_RX_CHAINS; i++) 960 for (i = 0; i < NUM_RX_CHAINS; i++)
961 priv->chain_noise_data.delta_gain_code[i] = 961 priv->chain_noise_data.delta_gain_code[i] =
962 CHAIN_NOISE_DELTA_GAIN_INIT_VAL; 962 CHAIN_NOISE_DELTA_GAIN_INIT_VAL;
963 963
964 /* Ask for statistics now, the uCode will send notification 964 /* Ask for statistics now, the uCode will send notification
965 * periodically after association */ 965 * periodically after association */
966 iwl_legacy_send_statistics_request(priv, CMD_ASYNC, true); 966 il_send_statistics_request(priv, CMD_ASYNC, true);
967} 967}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-calib.h b/drivers/net/wireless/iwlegacy/iwl-4965-calib.h
index f46c80e6e005..a23081f1d03e 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-calib.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-calib.h
@@ -59,17 +59,17 @@
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *****************************************************************************/ 61 *****************************************************************************/
62#ifndef __iwl_4965_calib_h__ 62#ifndef __il_4965_calib_h__
63#define __iwl_4965_calib_h__ 63#define __il_4965_calib_h__
64 64
65#include "iwl-dev.h" 65#include "iwl-dev.h"
66#include "iwl-core.h" 66#include "iwl-core.h"
67#include "iwl-commands.h" 67#include "iwl-commands.h"
68 68
69void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp); 69void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp);
70void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp); 70void il4965_sensitivity_calibration(struct il_priv *priv, void *resp);
71void iwl4965_init_sensitivity(struct iwl_priv *priv); 71void il4965_init_sensitivity(struct il_priv *priv);
72void iwl4965_reset_run_time_calib(struct iwl_priv *priv); 72void il4965_reset_run_time_calib(struct il_priv *priv);
73void iwl4965_calib_free_results(struct iwl_priv *priv); 73void il4965_calib_free_results(struct il_priv *priv);
74 74
75#endif /* __iwl_4965_calib_h__ */ 75#endif /* __il_4965_calib_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c
index 1c93665766e4..3c2876ffadc5 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c
@@ -33,7 +33,7 @@ static const char *fmt_table = " %-30s %10u %10u %10u %10u\n";
33static const char *fmt_header = 33static const char *fmt_header =
34 "%-32s current cumulative delta max\n"; 34 "%-32s current cumulative delta max\n";
35 35
36static int iwl4965_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz) 36static int il4965_statistics_flag(struct il_priv *priv, char *buf, int bufsz)
37{ 37{
38 int p = 0; 38 int p = 0;
39 u32 flag; 39 u32 flag;
@@ -54,10 +54,10 @@ static int iwl4965_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
54 return p; 54 return p;
55} 55}
56 56
57ssize_t iwl4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, 57ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,
58 size_t count, loff_t *ppos) 58 size_t count, loff_t *ppos)
59{ 59{
60 struct iwl_priv *priv = file->private_data; 60 struct il_priv *priv = file->private_data;
61 int pos = 0; 61 int pos = 0;
62 char *buf; 62 char *buf;
63 int bufsz = sizeof(struct statistics_rx_phy) * 40 + 63 int bufsz = sizeof(struct statistics_rx_phy) * 40 +
@@ -70,12 +70,12 @@ ssize_t iwl4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,
70 struct statistics_rx_non_phy *delta_general, *max_general; 70 struct statistics_rx_non_phy *delta_general, *max_general;
71 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; 71 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
72 72
73 if (!iwl_legacy_is_alive(priv)) 73 if (!il_is_alive(priv))
74 return -EAGAIN; 74 return -EAGAIN;
75 75
76 buf = kzalloc(bufsz, GFP_KERNEL); 76 buf = kzalloc(bufsz, GFP_KERNEL);
77 if (!buf) { 77 if (!buf) {
78 IWL_ERR(priv, "Can not allocate Buffer\n"); 78 IL_ERR(priv, "Can not allocate Buffer\n");
79 return -ENOMEM; 79 return -ENOMEM;
80 } 80 }
81 81
@@ -101,7 +101,7 @@ ssize_t iwl4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,
101 max_general = &priv->_4965.max_delta.rx.general; 101 max_general = &priv->_4965.max_delta.rx.general;
102 max_ht = &priv->_4965.max_delta.rx.ofdm_ht; 102 max_ht = &priv->_4965.max_delta.rx.ofdm_ht;
103 103
104 pos += iwl4965_statistics_flag(priv, buf, bufsz); 104 pos += il4965_statistics_flag(priv, buf, bufsz);
105 pos += scnprintf(buf + pos, bufsz - pos, 105 pos += scnprintf(buf + pos, bufsz - pos,
106 fmt_header, "Statistics_Rx - OFDM:"); 106 fmt_header, "Statistics_Rx - OFDM:");
107 pos += scnprintf(buf + pos, bufsz - pos, 107 pos += scnprintf(buf + pos, bufsz - pos,
@@ -485,23 +485,23 @@ ssize_t iwl4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,
485 return ret; 485 return ret;
486} 486}
487 487
488ssize_t iwl4965_ucode_tx_stats_read(struct file *file, 488ssize_t il4965_ucode_tx_stats_read(struct file *file,
489 char __user *user_buf, 489 char __user *user_buf,
490 size_t count, loff_t *ppos) 490 size_t count, loff_t *ppos)
491{ 491{
492 struct iwl_priv *priv = file->private_data; 492 struct il_priv *priv = file->private_data;
493 int pos = 0; 493 int pos = 0;
494 char *buf; 494 char *buf;
495 int bufsz = (sizeof(struct statistics_tx) * 48) + 250; 495 int bufsz = (sizeof(struct statistics_tx) * 48) + 250;
496 ssize_t ret; 496 ssize_t ret;
497 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; 497 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
498 498
499 if (!iwl_legacy_is_alive(priv)) 499 if (!il_is_alive(priv))
500 return -EAGAIN; 500 return -EAGAIN;
501 501
502 buf = kzalloc(bufsz, GFP_KERNEL); 502 buf = kzalloc(bufsz, GFP_KERNEL);
503 if (!buf) { 503 if (!buf) {
504 IWL_ERR(priv, "Can not allocate Buffer\n"); 504 IL_ERR(priv, "Can not allocate Buffer\n");
505 return -ENOMEM; 505 return -ENOMEM;
506 } 506 }
507 507
@@ -514,7 +514,7 @@ ssize_t iwl4965_ucode_tx_stats_read(struct file *file,
514 delta_tx = &priv->_4965.delta_statistics.tx; 514 delta_tx = &priv->_4965.delta_statistics.tx;
515 max_tx = &priv->_4965.max_delta.tx; 515 max_tx = &priv->_4965.max_delta.tx;
516 516
517 pos += iwl4965_statistics_flag(priv, buf, bufsz); 517 pos += il4965_statistics_flag(priv, buf, bufsz);
518 pos += scnprintf(buf + pos, bufsz - pos, 518 pos += scnprintf(buf + pos, bufsz - pos,
519 fmt_header, "Statistics_Tx:"); 519 fmt_header, "Statistics_Tx:");
520 pos += scnprintf(buf + pos, bufsz - pos, 520 pos += scnprintf(buf + pos, bufsz - pos,
@@ -661,10 +661,10 @@ ssize_t iwl4965_ucode_tx_stats_read(struct file *file,
661} 661}
662 662
663ssize_t 663ssize_t
664iwl4965_ucode_general_stats_read(struct file *file, char __user *user_buf, 664il4965_ucode_general_stats_read(struct file *file, char __user *user_buf,
665 size_t count, loff_t *ppos) 665 size_t count, loff_t *ppos)
666{ 666{
667 struct iwl_priv *priv = file->private_data; 667 struct il_priv *priv = file->private_data;
668 int pos = 0; 668 int pos = 0;
669 char *buf; 669 char *buf;
670 int bufsz = sizeof(struct statistics_general) * 10 + 300; 670 int bufsz = sizeof(struct statistics_general) * 10 + 300;
@@ -674,12 +674,12 @@ iwl4965_ucode_general_stats_read(struct file *file, char __user *user_buf,
674 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; 674 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
675 struct statistics_div *div, *accum_div, *delta_div, *max_div; 675 struct statistics_div *div, *accum_div, *delta_div, *max_div;
676 676
677 if (!iwl_legacy_is_alive(priv)) 677 if (!il_is_alive(priv))
678 return -EAGAIN; 678 return -EAGAIN;
679 679
680 buf = kzalloc(bufsz, GFP_KERNEL); 680 buf = kzalloc(bufsz, GFP_KERNEL);
681 if (!buf) { 681 if (!buf) {
682 IWL_ERR(priv, "Can not allocate Buffer\n"); 682 IL_ERR(priv, "Can not allocate Buffer\n");
683 return -ENOMEM; 683 return -ENOMEM;
684 } 684 }
685 685
@@ -700,7 +700,7 @@ iwl4965_ucode_general_stats_read(struct file *file, char __user *user_buf,
700 delta_div = &priv->_4965.delta_statistics.general.common.div; 700 delta_div = &priv->_4965.delta_statistics.general.common.div;
701 max_div = &priv->_4965.max_delta.general.common.div; 701 max_div = &priv->_4965.max_delta.general.common.div;
702 702
703 pos += iwl4965_statistics_flag(priv, buf, bufsz); 703 pos += il4965_statistics_flag(priv, buf, bufsz);
704 pos += scnprintf(buf + pos, bufsz - pos, 704 pos += scnprintf(buf + pos, bufsz - pos,
705 fmt_header, "Statistics_General:"); 705 fmt_header, "Statistics_General:");
706 pos += scnprintf(buf + pos, bufsz - pos, 706 pos += scnprintf(buf + pos, bufsz - pos,
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.h b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.h
index 6c8e35361a9e..ca1cf586f07b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.h
@@ -31,27 +31,27 @@
31#include "iwl-debug.h" 31#include "iwl-debug.h"
32 32
33#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 33#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
34ssize_t iwl4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, 34ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,
35 size_t count, loff_t *ppos); 35 size_t count, loff_t *ppos);
36ssize_t iwl4965_ucode_tx_stats_read(struct file *file, char __user *user_buf, 36ssize_t il4965_ucode_tx_stats_read(struct file *file, char __user *user_buf,
37 size_t count, loff_t *ppos); 37 size_t count, loff_t *ppos);
38ssize_t iwl4965_ucode_general_stats_read(struct file *file, 38ssize_t il4965_ucode_general_stats_read(struct file *file,
39 char __user *user_buf, size_t count, loff_t *ppos); 39 char __user *user_buf, size_t count, loff_t *ppos);
40#else 40#else
41static ssize_t 41static ssize_t
42iwl4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, 42il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,
43 size_t count, loff_t *ppos) 43 size_t count, loff_t *ppos)
44{ 44{
45 return 0; 45 return 0;
46} 46}
47static ssize_t 47static ssize_t
48iwl4965_ucode_tx_stats_read(struct file *file, char __user *user_buf, 48il4965_ucode_tx_stats_read(struct file *file, char __user *user_buf,
49 size_t count, loff_t *ppos) 49 size_t count, loff_t *ppos)
50{ 50{
51 return 0; 51 return 0;
52} 52}
53static ssize_t 53static ssize_t
54iwl4965_ucode_general_stats_read(struct file *file, char __user *user_buf, 54il4965_ucode_general_stats_read(struct file *file, char __user *user_buf,
55 size_t count, loff_t *ppos) 55 size_t count, loff_t *ppos)
56{ 56{
57 return 0; 57 return 0;
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c
index cb9baab1ff7d..e657b444cf48 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c
@@ -87,23 +87,23 @@
87 * EEPROM chip, not a single event, so even reads could conflict if they 87 * EEPROM chip, not a single event, so even reads could conflict if they
88 * weren't arbitrated by the semaphore. 88 * weren't arbitrated by the semaphore.
89 */ 89 */
90int iwl4965_eeprom_acquire_semaphore(struct iwl_priv *priv) 90int il4965_eeprom_acquire_semaphore(struct il_priv *priv)
91{ 91{
92 u16 count; 92 u16 count;
93 int ret; 93 int ret;
94 94
95 for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) { 95 for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) {
96 /* Request semaphore */ 96 /* Request semaphore */
97 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 97 il_set_bit(priv, CSR_HW_IF_CONFIG_REG,
98 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); 98 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
99 99
100 /* See if we got it */ 100 /* See if we got it */
101 ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG, 101 ret = il_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
102 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, 102 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
103 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, 103 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
104 EEPROM_SEM_TIMEOUT); 104 EEPROM_SEM_TIMEOUT);
105 if (ret >= 0) { 105 if (ret >= 0) {
106 IWL_DEBUG_IO(priv, 106 IL_DEBUG_IO(priv,
107 "Acquired semaphore after %d tries.\n", 107 "Acquired semaphore after %d tries.\n",
108 count+1); 108 count+1);
109 return ret; 109 return ret;
@@ -113,32 +113,32 @@ int iwl4965_eeprom_acquire_semaphore(struct iwl_priv *priv)
113 return ret; 113 return ret;
114} 114}
115 115
116void iwl4965_eeprom_release_semaphore(struct iwl_priv *priv) 116void il4965_eeprom_release_semaphore(struct il_priv *priv)
117{ 117{
118 iwl_legacy_clear_bit(priv, CSR_HW_IF_CONFIG_REG, 118 il_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
119 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); 119 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
120 120
121} 121}
122 122
123int iwl4965_eeprom_check_version(struct iwl_priv *priv) 123int il4965_eeprom_check_version(struct il_priv *priv)
124{ 124{
125 u16 eeprom_ver; 125 u16 eeprom_ver;
126 u16 calib_ver; 126 u16 calib_ver;
127 127
128 eeprom_ver = iwl_legacy_eeprom_query16(priv, EEPROM_VERSION); 128 eeprom_ver = il_eeprom_query16(priv, EEPROM_VERSION);
129 calib_ver = iwl_legacy_eeprom_query16(priv, 129 calib_ver = il_eeprom_query16(priv,
130 EEPROM_4965_CALIB_VERSION_OFFSET); 130 EEPROM_4965_CALIB_VERSION_OFFSET);
131 131
132 if (eeprom_ver < priv->cfg->eeprom_ver || 132 if (eeprom_ver < priv->cfg->eeprom_ver ||
133 calib_ver < priv->cfg->eeprom_calib_ver) 133 calib_ver < priv->cfg->eeprom_calib_ver)
134 goto err; 134 goto err;
135 135
136 IWL_INFO(priv, "device EEPROM VER=0x%x, CALIB=0x%x\n", 136 IL_INFO(priv, "device EEPROM VER=0x%x, CALIB=0x%x\n",
137 eeprom_ver, calib_ver); 137 eeprom_ver, calib_ver);
138 138
139 return 0; 139 return 0;
140err: 140err:
141 IWL_ERR(priv, "Unsupported (too old) EEPROM VER=0x%x < 0x%x " 141 IL_ERR(priv, "Unsupported (too old) EEPROM VER=0x%x < 0x%x "
142 "CALIB=0x%x < 0x%x\n", 142 "CALIB=0x%x < 0x%x\n",
143 eeprom_ver, priv->cfg->eeprom_ver, 143 eeprom_ver, priv->cfg->eeprom_ver,
144 calib_ver, priv->cfg->eeprom_calib_ver); 144 calib_ver, priv->cfg->eeprom_calib_ver);
@@ -146,9 +146,9 @@ err:
146 146
147} 147}
148 148
149void iwl4965_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac) 149void il4965_eeprom_get_mac(const struct il_priv *priv, u8 *mac)
150{ 150{
151 const u8 *addr = iwl_legacy_eeprom_query_addr(priv, 151 const u8 *addr = il_eeprom_query_addr(priv,
152 EEPROM_MAC_ADDRESS); 152 EEPROM_MAC_ADDRESS);
153 memcpy(mac, addr, ETH_ALEN); 153 memcpy(mac, addr, ETH_ALEN);
154} 154}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
index fc6fa2886d9c..b6b7fe2f5ca4 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
@@ -66,8 +66,8 @@
66 * Use iwl-dev.h for driver implementation definitions. 66 * Use iwl-dev.h for driver implementation definitions.
67 */ 67 */
68 68
69#ifndef __iwl_4965_hw_h__ 69#ifndef __il_4965_hw_h__
70#define __iwl_4965_hw_h__ 70#define __il_4965_hw_h__
71 71
72#include "iwl-fh.h" 72#include "iwl-fh.h"
73 73
@@ -100,7 +100,7 @@
100/* Size of uCode instruction memory in bootstrap state machine */ 100/* Size of uCode instruction memory in bootstrap state machine */
101#define IWL49_MAX_BSM_SIZE BSM_SRAM_SIZE 101#define IWL49_MAX_BSM_SIZE BSM_SRAM_SIZE
102 102
103static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) 103static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
104{ 104{
105 return (addr >= IWL49_RTC_DATA_LOWER_BOUND) && 105 return (addr >= IWL49_RTC_DATA_LOWER_BOUND) &&
106 (addr < IWL49_RTC_DATA_UPPER_BOUND); 106 (addr < IWL49_RTC_DATA_UPPER_BOUND);
@@ -118,7 +118,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
118 * real-time temperature indicator. 118 * real-time temperature indicator.
119 * 119 *
120 * uCode provides all 4 values to the driver via the "initialize alive" 120 * uCode provides all 4 values to the driver via the "initialize alive"
121 * notification (see struct iwl4965_init_alive_resp). After the runtime uCode 121 * notification (see struct il4965_init_alive_resp). After the runtime uCode
122 * image loads, uCode updates the R4 value via statistics notifications 122 * image loads, uCode updates the R4 value via statistics notifications
123 * (see STATISTICS_NOTIFICATION), which occur after each received beacon 123 * (see STATISTICS_NOTIFICATION), which occur after each received beacon
124 * when associated, or can be requested via REPLY_STATISTICS_CMD. 124 * when associated, or can be requested via REPLY_STATISTICS_CMD.
@@ -143,12 +143,12 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
143#define TEMPERATURE_CALIB_A_VAL 259 143#define TEMPERATURE_CALIB_A_VAL 259
144 144
145/* Limit range of calculated temperature to be between these Kelvin values */ 145/* Limit range of calculated temperature to be between these Kelvin values */
146#define IWL_TX_POWER_TEMPERATURE_MIN (263) 146#define IL_TX_POWER_TEMPERATURE_MIN (263)
147#define IWL_TX_POWER_TEMPERATURE_MAX (410) 147#define IL_TX_POWER_TEMPERATURE_MAX (410)
148 148
149#define IWL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \ 149#define IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \
150 (((t) < IWL_TX_POWER_TEMPERATURE_MIN) || \ 150 (((t) < IL_TX_POWER_TEMPERATURE_MIN) || \
151 ((t) > IWL_TX_POWER_TEMPERATURE_MAX)) 151 ((t) > IL_TX_POWER_TEMPERATURE_MAX))
152 152
153/********************* END TEMPERATURE ***************************************/ 153/********************* END TEMPERATURE ***************************************/
154 154
@@ -168,7 +168,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
168 * 40 MHz wide (.11n HT40) channels are listed separately from 20 MHz 168 * 40 MHz wide (.11n HT40) channels are listed separately from 20 MHz
169 * (legacy) channels. 169 * (legacy) channels.
170 * 170 *
171 * See struct iwl4965_eeprom_channel for format, and struct iwl4965_eeprom 171 * See struct il4965_eeprom_channel for format, and struct il4965_eeprom
172 * for locations in EEPROM. 172 * for locations in EEPROM.
173 * 173 *
174 * 2) Factory txpower calibration information is provided separately for 174 * 2) Factory txpower calibration information is provided separately for
@@ -177,11 +177,11 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
177 * 177 *
178 * In addition, per-band (2.4 and 5 Ghz) saturation txpowers are provided. 178 * In addition, per-band (2.4 and 5 Ghz) saturation txpowers are provided.
179 * 179 *
180 * See struct iwl4965_eeprom_calib_info (and the tree of structures 180 * See struct il4965_eeprom_calib_info (and the tree of structures
181 * contained within it) for format, and struct iwl4965_eeprom for 181 * contained within it) for format, and struct il4965_eeprom for
182 * locations in EEPROM. 182 * locations in EEPROM.
183 * 183 *
184 * "Initialization alive" notification (see struct iwl4965_init_alive_resp) 184 * "Initialization alive" notification (see struct il4965_init_alive_resp)
185 * consists of: 185 * consists of:
186 * 186 *
187 * 1) Temperature calculation parameters. 187 * 1) Temperature calculation parameters.
@@ -238,7 +238,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
238 * 238 *
239 * 3) Determine (EEPROM) calibration sub band for the target channel, by 239 * 3) Determine (EEPROM) calibration sub band for the target channel, by
240 * comparing against first and last channels in each sub band 240 * comparing against first and last channels in each sub band
241 * (see struct iwl4965_eeprom_calib_subband_info). 241 * (see struct il4965_eeprom_calib_subband_info).
242 * 242 *
243 * 243 *
244 * 4) Linearly interpolate (EEPROM) factory calibration measurement sets, 244 * 4) Linearly interpolate (EEPROM) factory calibration measurement sets,
@@ -254,7 +254,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
254 * span of the sampled channels. 254 * span of the sampled channels.
255 * 255 *
256 * Driver may choose the pair (for 2 Tx chains) of measurements (see 256 * Driver may choose the pair (for 2 Tx chains) of measurements (see
257 * struct iwl4965_eeprom_calib_ch_info) for which the actual measured 257 * struct il4965_eeprom_calib_ch_info) for which the actual measured
258 * txpower comes closest to the desired txpower. Usually, though, 258 * txpower comes closest to the desired txpower. Usually, though,
259 * the middle set of measurements is closest to the regulatory limits, 259 * the middle set of measurements is closest to the regulatory limits,
260 * and is therefore a good choice for all txpower calculations (this 260 * and is therefore a good choice for all txpower calculations (this
@@ -370,7 +370,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
370 * 370 *
371 * 371 *
372 * 11) Read gain table entries for DSP and radio gain, place into appropriate 372 * 11) Read gain table entries for DSP and radio gain, place into appropriate
373 * location(s) in command (struct iwl4965_txpowertable_cmd). 373 * location(s) in command (struct il4965_txpowertable_cmd).
374 */ 374 */
375 375
376/** 376/**
@@ -382,7 +382,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
382 * The value "6" represents number of steps in gain table to reduce power 3 dB. 382 * The value "6" represents number of steps in gain table to reduce power 3 dB.
383 * Each step is 1/2 dB. 383 * Each step is 1/2 dB.
384 */ 384 */
385#define IWL_TX_POWER_MIMO_REGULATORY_COMPENSATION (6) 385#define IL_TX_POWER_MIMO_REGULATORY_COMPENSATION (6)
386 386
387/** 387/**
388 * CCK gain compensation. 388 * CCK gain compensation.
@@ -394,13 +394,13 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
394 * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG, 394 * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG,
395 * bits [3:2], 1 = B, 2 = C. 395 * bits [3:2], 1 = B, 2 = C.
396 */ 396 */
397#define IWL_TX_POWER_CCK_COMPENSATION_B_STEP (9) 397#define IL_TX_POWER_CCK_COMPENSATION_B_STEP (9)
398#define IWL_TX_POWER_CCK_COMPENSATION_C_STEP (5) 398#define IL_TX_POWER_CCK_COMPENSATION_C_STEP (5)
399 399
400/* 400/*
401 * 4965 power supply voltage compensation for txpower 401 * 4965 power supply voltage compensation for txpower
402 */ 402 */
403#define TX_POWER_IWL_VOLTAGE_CODES_PER_03V (7) 403#define TX_POWER_IL_VOLTAGE_CODES_PER_03V (7)
404 404
405/** 405/**
406 * Gain tables. 406 * Gain tables.
@@ -668,10 +668,10 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
668 * 668 *
669 * Units are in half-dBm (i.e. "34" means 17 dBm). 669 * Units are in half-dBm (i.e. "34" means 17 dBm).
670 */ 670 */
671#define IWL_TX_POWER_DEFAULT_REGULATORY_24 (34) 671#define IL_TX_POWER_DEFAULT_REGULATORY_24 (34)
672#define IWL_TX_POWER_DEFAULT_REGULATORY_52 (34) 672#define IL_TX_POWER_DEFAULT_REGULATORY_52 (34)
673#define IWL_TX_POWER_REGULATORY_MIN (0) 673#define IL_TX_POWER_REGULATORY_MIN (0)
674#define IWL_TX_POWER_REGULATORY_MAX (34) 674#define IL_TX_POWER_REGULATORY_MAX (34)
675 675
676/** 676/**
677 * Sanity checks and default values for EEPROM saturation levels. 677 * Sanity checks and default values for EEPROM saturation levels.
@@ -689,10 +689,10 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
689 * 689 *
690 * Units are in half-dBm (i.e. "38" means 19 dBm). 690 * Units are in half-dBm (i.e. "38" means 19 dBm).
691 */ 691 */
692#define IWL_TX_POWER_DEFAULT_SATURATION_24 (38) 692#define IL_TX_POWER_DEFAULT_SATURATION_24 (38)
693#define IWL_TX_POWER_DEFAULT_SATURATION_52 (38) 693#define IL_TX_POWER_DEFAULT_SATURATION_52 (38)
694#define IWL_TX_POWER_SATURATION_MIN (20) 694#define IL_TX_POWER_SATURATION_MIN (20)
695#define IWL_TX_POWER_SATURATION_MAX (50) 695#define IL_TX_POWER_SATURATION_MAX (50)
696 696
697/** 697/**
698 * Channel groups used for Tx Attenuation calibration (MIMO tx channel balance) 698 * Channel groups used for Tx Attenuation calibration (MIMO tx channel balance)
@@ -709,24 +709,24 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
709 * Different frequency ranges require different compensation, as shown below. 709 * Different frequency ranges require different compensation, as shown below.
710 */ 710 */
711/* Group 0, 5.2 GHz ch 34-43: 4.5 degrees per 1/2 dB. */ 711/* Group 0, 5.2 GHz ch 34-43: 4.5 degrees per 1/2 dB. */
712#define CALIB_IWL_TX_ATTEN_GR1_FCH 34 712#define CALIB_IL_TX_ATTEN_GR1_FCH 34
713#define CALIB_IWL_TX_ATTEN_GR1_LCH 43 713#define CALIB_IL_TX_ATTEN_GR1_LCH 43
714 714
715/* Group 1, 5.3 GHz ch 44-70: 4.0 degrees per 1/2 dB. */ 715/* Group 1, 5.3 GHz ch 44-70: 4.0 degrees per 1/2 dB. */
716#define CALIB_IWL_TX_ATTEN_GR2_FCH 44 716#define CALIB_IL_TX_ATTEN_GR2_FCH 44
717#define CALIB_IWL_TX_ATTEN_GR2_LCH 70 717#define CALIB_IL_TX_ATTEN_GR2_LCH 70
718 718
719/* Group 2, 5.5 GHz ch 71-124: 4.0 degrees per 1/2 dB. */ 719/* Group 2, 5.5 GHz ch 71-124: 4.0 degrees per 1/2 dB. */
720#define CALIB_IWL_TX_ATTEN_GR3_FCH 71 720#define CALIB_IL_TX_ATTEN_GR3_FCH 71
721#define CALIB_IWL_TX_ATTEN_GR3_LCH 124 721#define CALIB_IL_TX_ATTEN_GR3_LCH 124
722 722
723/* Group 3, 5.7 GHz ch 125-200: 4.0 degrees per 1/2 dB. */ 723/* Group 3, 5.7 GHz ch 125-200: 4.0 degrees per 1/2 dB. */
724#define CALIB_IWL_TX_ATTEN_GR4_FCH 125 724#define CALIB_IL_TX_ATTEN_GR4_FCH 125
725#define CALIB_IWL_TX_ATTEN_GR4_LCH 200 725#define CALIB_IL_TX_ATTEN_GR4_LCH 200
726 726
727/* Group 4, 2.4 GHz all channels: 3.5 degrees per 1/2 dB. */ 727/* Group 4, 2.4 GHz all channels: 3.5 degrees per 1/2 dB. */
728#define CALIB_IWL_TX_ATTEN_GR5_FCH 1 728#define CALIB_IL_TX_ATTEN_GR5_FCH 1
729#define CALIB_IWL_TX_ATTEN_GR5_LCH 20 729#define CALIB_IL_TX_ATTEN_GR5_LCH 20
730 730
731enum { 731enum {
732 CALIB_CH_GROUP_1 = 0, 732 CALIB_CH_GROUP_1 = 0,
@@ -767,7 +767,7 @@ enum {
767 767
768 768
769/** 769/**
770 * struct iwl4965_schedq_bc_tbl 770 * struct il4965_schedq_bc_tbl
771 * 771 *
772 * Byte Count table 772 * Byte Count table
773 * 773 *
@@ -784,7 +784,7 @@ enum {
784 * padding puts each byte count table on a 1024-byte boundary; 784 * padding puts each byte count table on a 1024-byte boundary;
785 * 4965 assumes tables are separated by 1024 bytes. 785 * 4965 assumes tables are separated by 1024 bytes.
786 */ 786 */
787struct iwl4965_scd_bc_tbl { 787struct il4965_scd_bc_tbl {
788 __le16 tfd_offset[TFD_QUEUE_BC_SIZE]; 788 __le16 tfd_offset[TFD_QUEUE_BC_SIZE];
789 u8 pad[1024 - (TFD_QUEUE_BC_SIZE) * sizeof(__le16)]; 789 u8 pad[1024 - (TFD_QUEUE_BC_SIZE) * sizeof(__le16)];
790} __packed; 790} __packed;
@@ -808,4 +808,4 @@ struct iwl4965_scd_bc_tbl {
808#define IWL4965_FIRST_AMPDU_QUEUE 10 808#define IWL4965_FIRST_AMPDU_QUEUE 10
809 809
810 810
811#endif /* !__iwl_4965_hw_h__ */ 811#endif /* !__il_4965_hw_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-led.c b/drivers/net/wireless/iwlegacy/iwl-4965-led.c
index 6862fdcaee62..d2c8eacd6835 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-led.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-led.c
@@ -44,30 +44,30 @@
44 44
45/* Send led command */ 45/* Send led command */
46static int 46static int
47iwl4965_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd) 47il4965_send_led_cmd(struct il_priv *priv, struct il_led_cmd *led_cmd)
48{ 48{
49 struct iwl_host_cmd cmd = { 49 struct il_host_cmd cmd = {
50 .id = REPLY_LEDS_CMD, 50 .id = REPLY_LEDS_CMD,
51 .len = sizeof(struct iwl_led_cmd), 51 .len = sizeof(struct il_led_cmd),
52 .data = led_cmd, 52 .data = led_cmd,
53 .flags = CMD_ASYNC, 53 .flags = CMD_ASYNC,
54 .callback = NULL, 54 .callback = NULL,
55 }; 55 };
56 u32 reg; 56 u32 reg;
57 57
58 reg = iwl_read32(priv, CSR_LED_REG); 58 reg = il_read32(priv, CSR_LED_REG);
59 if (reg != (reg & CSR_LED_BSM_CTRL_MSK)) 59 if (reg != (reg & CSR_LED_BSM_CTRL_MSK))
60 iwl_write32(priv, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK); 60 il_write32(priv, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK);
61 61
62 return iwl_legacy_send_cmd(priv, &cmd); 62 return il_send_cmd(priv, &cmd);
63} 63}
64 64
65/* Set led register off */ 65/* Set led register off */
66void iwl4965_led_enable(struct iwl_priv *priv) 66void il4965_led_enable(struct il_priv *priv)
67{ 67{
68 iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_ON); 68 il_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_ON);
69} 69}
70 70
71const struct iwl_led_ops iwl4965_led_ops = { 71const struct il_led_ops il4965_led_ops = {
72 .cmd = iwl4965_send_led_cmd, 72 .cmd = il4965_send_led_cmd,
73}; 73};
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-led.h b/drivers/net/wireless/iwlegacy/iwl-4965-led.h
index 5ed3615fc338..ab03dff812fd 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-led.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-led.h
@@ -24,10 +24,10 @@
24 * 24 *
25 *****************************************************************************/ 25 *****************************************************************************/
26 26
27#ifndef __iwl_4965_led_h__ 27#ifndef __il_4965_led_h__
28#define __iwl_4965_led_h__ 28#define __il_4965_led_h__
29 29
30extern const struct iwl_led_ops iwl4965_led_ops; 30extern const struct il_led_ops il4965_led_ops;
31void iwl4965_led_enable(struct iwl_priv *priv); 31void il4965_led_enable(struct il_priv *priv);
32 32
33#endif /* __iwl_4965_led_h__ */ 33#endif /* __il_4965_led_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
index 2be6d9e3b019..25f1d4768e7b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
@@ -40,11 +40,11 @@
40#include "iwl-4965.h" 40#include "iwl-4965.h"
41#include "iwl-sta.h" 41#include "iwl-sta.h"
42 42
43void iwl4965_check_abort_status(struct iwl_priv *priv, 43void il4965_check_abort_status(struct il_priv *priv,
44 u8 frame_count, u32 status) 44 u8 frame_count, u32 status)
45{ 45{
46 if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) { 46 if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
47 IWL_ERR(priv, "Tx flush command to flush out all frames\n"); 47 IL_ERR(priv, "Tx flush command to flush out all frames\n");
48 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) 48 if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
49 queue_work(priv->workqueue, &priv->tx_flush); 49 queue_work(priv->workqueue, &priv->tx_flush);
50 } 50 }
@@ -53,13 +53,13 @@ void iwl4965_check_abort_status(struct iwl_priv *priv,
53/* 53/*
54 * EEPROM 54 * EEPROM
55 */ 55 */
56struct iwl_mod_params iwl4965_mod_params = { 56struct il_mod_params il4965_mod_params = {
57 .amsdu_size_8K = 1, 57 .amsdu_size_8K = 1,
58 .restart_fw = 1, 58 .restart_fw = 1,
59 /* the rest are 0 by default */ 59 /* the rest are 0 by default */
60}; 60};
61 61
62void iwl4965_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 62void il4965_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq)
63{ 63{
64 unsigned long flags; 64 unsigned long flags;
65 int i; 65 int i;
@@ -74,7 +74,7 @@ void iwl4965_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
74 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, 74 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
75 PAGE_SIZE << priv->hw_params.rx_page_order, 75 PAGE_SIZE << priv->hw_params.rx_page_order,
76 PCI_DMA_FROMDEVICE); 76 PCI_DMA_FROMDEVICE);
77 __iwl_legacy_free_pages(priv, rxq->pool[i].page); 77 __il_free_pages(priv, rxq->pool[i].page);
78 rxq->pool[i].page = NULL; 78 rxq->pool[i].page = NULL;
79 } 79 }
80 list_add_tail(&rxq->pool[i].list, &rxq->rx_used); 80 list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
@@ -91,7 +91,7 @@ void iwl4965_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
91 spin_unlock_irqrestore(&rxq->lock, flags); 91 spin_unlock_irqrestore(&rxq->lock, flags);
92} 92}
93 93
94int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 94int il4965_rx_init(struct il_priv *priv, struct il_rx_queue *rxq)
95{ 95{
96 u32 rb_size; 96 u32 rb_size;
97 const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */ 97 const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */
@@ -103,17 +103,17 @@ int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
103 rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K; 103 rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K;
104 104
105 /* Stop Rx DMA */ 105 /* Stop Rx DMA */
106 iwl_legacy_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); 106 il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
107 107
108 /* Reset driver's Rx queue write index */ 108 /* Reset driver's Rx queue write index */
109 iwl_legacy_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); 109 il_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0);
110 110
111 /* Tell device where to find RBD circular buffer in DRAM */ 111 /* Tell device where to find RBD circular buffer in DRAM */
112 iwl_legacy_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, 112 il_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG,
113 (u32)(rxq->bd_dma >> 8)); 113 (u32)(rxq->bd_dma >> 8));
114 114
115 /* Tell device where in DRAM to update its Rx status */ 115 /* Tell device where in DRAM to update its Rx status */
116 iwl_legacy_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, 116 il_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG,
117 rxq->rb_stts_dma >> 4); 117 rxq->rb_stts_dma >> 4);
118 118
119 /* Enable Rx DMA 119 /* Enable Rx DMA
@@ -122,7 +122,7 @@ int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
122 * RB timeout 0x10 122 * RB timeout 0x10
123 * 256 RBDs 123 * 256 RBDs
124 */ 124 */
125 iwl_legacy_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 125 il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG,
126 FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | 126 FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL |
127 FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | 127 FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL |
128 FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK | 128 FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK |
@@ -131,32 +131,32 @@ int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
131 (rfdnlog << FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS)); 131 (rfdnlog << FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS));
132 132
133 /* Set interrupt coalescing timer to default (2048 usecs) */ 133 /* Set interrupt coalescing timer to default (2048 usecs) */
134 iwl_write8(priv, CSR_INT_COALESCING, IWL_HOST_INT_TIMEOUT_DEF); 134 il_write8(priv, CSR_INT_COALESCING, IL_HOST_INT_TIMEOUT_DEF);
135 135
136 return 0; 136 return 0;
137} 137}
138 138
139static void iwl4965_set_pwr_vmain(struct iwl_priv *priv) 139static void il4965_set_pwr_vmain(struct il_priv *priv)
140{ 140{
141/* 141/*
142 * (for documentation purposes) 142 * (for documentation purposes)
143 * to set power to V_AUX, do: 143 * to set power to V_AUX, do:
144 144
145 if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) 145 if (pci_pme_capable(priv->pci_dev, PCI_D3cold))
146 iwl_legacy_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 146 il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
147 APMG_PS_CTRL_VAL_PWR_SRC_VAUX, 147 APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
148 ~APMG_PS_CTRL_MSK_PWR_SRC); 148 ~APMG_PS_CTRL_MSK_PWR_SRC);
149 */ 149 */
150 150
151 iwl_legacy_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 151 il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
152 APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, 152 APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
153 ~APMG_PS_CTRL_MSK_PWR_SRC); 153 ~APMG_PS_CTRL_MSK_PWR_SRC);
154} 154}
155 155
156int iwl4965_hw_nic_init(struct iwl_priv *priv) 156int il4965_hw_nic_init(struct il_priv *priv)
157{ 157{
158 unsigned long flags; 158 unsigned long flags;
159 struct iwl_rx_queue *rxq = &priv->rxq; 159 struct il_rx_queue *rxq = &priv->rxq;
160 int ret; 160 int ret;
161 161
162 /* nic_init */ 162 /* nic_init */
@@ -164,42 +164,42 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv)
164 priv->cfg->ops->lib->apm_ops.init(priv); 164 priv->cfg->ops->lib->apm_ops.init(priv);
165 165
166 /* Set interrupt coalescing calibration timer to default (512 usecs) */ 166 /* Set interrupt coalescing calibration timer to default (512 usecs) */
167 iwl_write8(priv, CSR_INT_COALESCING, IWL_HOST_INT_CALIB_TIMEOUT_DEF); 167 il_write8(priv, CSR_INT_COALESCING, IL_HOST_INT_CALIB_TIMEOUT_DEF);
168 168
169 spin_unlock_irqrestore(&priv->lock, flags); 169 spin_unlock_irqrestore(&priv->lock, flags);
170 170
171 iwl4965_set_pwr_vmain(priv); 171 il4965_set_pwr_vmain(priv);
172 172
173 priv->cfg->ops->lib->apm_ops.config(priv); 173 priv->cfg->ops->lib->apm_ops.config(priv);
174 174
175 /* Allocate the RX queue, or reset if it is already allocated */ 175 /* Allocate the RX queue, or reset if it is already allocated */
176 if (!rxq->bd) { 176 if (!rxq->bd) {
177 ret = iwl_legacy_rx_queue_alloc(priv); 177 ret = il_rx_queue_alloc(priv);
178 if (ret) { 178 if (ret) {
179 IWL_ERR(priv, "Unable to initialize Rx queue\n"); 179 IL_ERR(priv, "Unable to initialize Rx queue\n");
180 return -ENOMEM; 180 return -ENOMEM;
181 } 181 }
182 } else 182 } else
183 iwl4965_rx_queue_reset(priv, rxq); 183 il4965_rx_queue_reset(priv, rxq);
184 184
185 iwl4965_rx_replenish(priv); 185 il4965_rx_replenish(priv);
186 186
187 iwl4965_rx_init(priv, rxq); 187 il4965_rx_init(priv, rxq);
188 188
189 spin_lock_irqsave(&priv->lock, flags); 189 spin_lock_irqsave(&priv->lock, flags);
190 190
191 rxq->need_update = 1; 191 rxq->need_update = 1;
192 iwl_legacy_rx_queue_update_write_ptr(priv, rxq); 192 il_rx_queue_update_write_ptr(priv, rxq);
193 193
194 spin_unlock_irqrestore(&priv->lock, flags); 194 spin_unlock_irqrestore(&priv->lock, flags);
195 195
196 /* Allocate or reset and init all Tx and Command queues */ 196 /* Allocate or reset and init all Tx and Command queues */
197 if (!priv->txq) { 197 if (!priv->txq) {
198 ret = iwl4965_txq_ctx_alloc(priv); 198 ret = il4965_txq_ctx_alloc(priv);
199 if (ret) 199 if (ret)
200 return ret; 200 return ret;
201 } else 201 } else
202 iwl4965_txq_ctx_reset(priv); 202 il4965_txq_ctx_reset(priv);
203 203
204 set_bit(STATUS_INIT, &priv->status); 204 set_bit(STATUS_INIT, &priv->status);
205 205
@@ -207,16 +207,16 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv)
207} 207}
208 208
209/** 209/**
210 * iwl4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr 210 * il4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr
211 */ 211 */
212static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl_priv *priv, 212static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *priv,
213 dma_addr_t dma_addr) 213 dma_addr_t dma_addr)
214{ 214{
215 return cpu_to_le32((u32)(dma_addr >> 8)); 215 return cpu_to_le32((u32)(dma_addr >> 8));
216} 216}
217 217
218/** 218/**
219 * iwl4965_rx_queue_restock - refill RX queue from pre-allocated pool 219 * il4965_rx_queue_restock - refill RX queue from pre-allocated pool
220 * 220 *
221 * If there are slots in the RX queue that need to be restocked, 221 * If there are slots in the RX queue that need to be restocked,
222 * and we have free pre-allocated buffers, fill the ranks as much 222 * and we have free pre-allocated buffers, fill the ranks as much
@@ -226,26 +226,26 @@ static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl_priv *priv,
226 * also updates the memory address in the firmware to reference the new 226 * also updates the memory address in the firmware to reference the new
227 * target buffer. 227 * target buffer.
228 */ 228 */
229void iwl4965_rx_queue_restock(struct iwl_priv *priv) 229void il4965_rx_queue_restock(struct il_priv *priv)
230{ 230{
231 struct iwl_rx_queue *rxq = &priv->rxq; 231 struct il_rx_queue *rxq = &priv->rxq;
232 struct list_head *element; 232 struct list_head *element;
233 struct iwl_rx_mem_buffer *rxb; 233 struct il_rx_mem_buffer *rxb;
234 unsigned long flags; 234 unsigned long flags;
235 235
236 spin_lock_irqsave(&rxq->lock, flags); 236 spin_lock_irqsave(&rxq->lock, flags);
237 while ((iwl_legacy_rx_queue_space(rxq) > 0) && (rxq->free_count)) { 237 while ((il_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
238 /* The overwritten rxb must be a used one */ 238 /* The overwritten rxb must be a used one */
239 rxb = rxq->queue[rxq->write]; 239 rxb = rxq->queue[rxq->write];
240 BUG_ON(rxb && rxb->page); 240 BUG_ON(rxb && rxb->page);
241 241
242 /* Get next free Rx buffer, remove from free list */ 242 /* Get next free Rx buffer, remove from free list */
243 element = rxq->rx_free.next; 243 element = rxq->rx_free.next;
244 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 244 rxb = list_entry(element, struct il_rx_mem_buffer, list);
245 list_del(element); 245 list_del(element);
246 246
247 /* Point to Rx buffer via next RBD in circular buffer */ 247 /* Point to Rx buffer via next RBD in circular buffer */
248 rxq->bd[rxq->write] = iwl4965_dma_addr2rbd_ptr(priv, 248 rxq->bd[rxq->write] = il4965_dma_addr2rbd_ptr(priv,
249 rxb->page_dma); 249 rxb->page_dma);
250 rxq->queue[rxq->write] = rxb; 250 rxq->queue[rxq->write] = rxb;
251 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; 251 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK;
@@ -264,23 +264,23 @@ void iwl4965_rx_queue_restock(struct iwl_priv *priv)
264 spin_lock_irqsave(&rxq->lock, flags); 264 spin_lock_irqsave(&rxq->lock, flags);
265 rxq->need_update = 1; 265 rxq->need_update = 1;
266 spin_unlock_irqrestore(&rxq->lock, flags); 266 spin_unlock_irqrestore(&rxq->lock, flags);
267 iwl_legacy_rx_queue_update_write_ptr(priv, rxq); 267 il_rx_queue_update_write_ptr(priv, rxq);
268 } 268 }
269} 269}
270 270
271/** 271/**
272 * iwl4965_rx_replenish - Move all used packet from rx_used to rx_free 272 * il4965_rx_replenish - Move all used packet from rx_used to rx_free
273 * 273 *
274 * When moving to rx_free an SKB is allocated for the slot. 274 * When moving to rx_free an SKB is allocated for the slot.
275 * 275 *
276 * Also restock the Rx queue via iwl_rx_queue_restock. 276 * Also restock the Rx queue via il_rx_queue_restock.
277 * This is called as a scheduled work item (except for during initialization) 277 * This is called as a scheduled work item (except for during initialization)
278 */ 278 */
279static void iwl4965_rx_allocate(struct iwl_priv *priv, gfp_t priority) 279static void il4965_rx_allocate(struct il_priv *priv, gfp_t priority)
280{ 280{
281 struct iwl_rx_queue *rxq = &priv->rxq; 281 struct il_rx_queue *rxq = &priv->rxq;
282 struct list_head *element; 282 struct list_head *element;
283 struct iwl_rx_mem_buffer *rxb; 283 struct il_rx_mem_buffer *rxb;
284 struct page *page; 284 struct page *page;
285 unsigned long flags; 285 unsigned long flags;
286 gfp_t gfp_mask = priority; 286 gfp_t gfp_mask = priority;
@@ -303,13 +303,13 @@ static void iwl4965_rx_allocate(struct iwl_priv *priv, gfp_t priority)
303 page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order); 303 page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order);
304 if (!page) { 304 if (!page) {
305 if (net_ratelimit()) 305 if (net_ratelimit())
306 IWL_DEBUG_INFO(priv, "alloc_pages failed, " 306 IL_DEBUG_INFO(priv, "alloc_pages failed, "
307 "order: %d\n", 307 "order: %d\n",
308 priv->hw_params.rx_page_order); 308 priv->hw_params.rx_page_order);
309 309
310 if ((rxq->free_count <= RX_LOW_WATERMARK) && 310 if ((rxq->free_count <= RX_LOW_WATERMARK) &&
311 net_ratelimit()) 311 net_ratelimit())
312 IWL_CRIT(priv, 312 IL_CRIT(priv,
313 "Failed to alloc_pages with %s. " 313 "Failed to alloc_pages with %s. "
314 "Only %u free buffers remaining.\n", 314 "Only %u free buffers remaining.\n",
315 priority == GFP_ATOMIC ? 315 priority == GFP_ATOMIC ?
@@ -329,7 +329,7 @@ static void iwl4965_rx_allocate(struct iwl_priv *priv, gfp_t priority)
329 return; 329 return;
330 } 330 }
331 element = rxq->rx_used.next; 331 element = rxq->rx_used.next;
332 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 332 rxb = list_entry(element, struct il_rx_mem_buffer, list);
333 list_del(element); 333 list_del(element);
334 334
335 spin_unlock_irqrestore(&rxq->lock, flags); 335 spin_unlock_irqrestore(&rxq->lock, flags);
@@ -355,22 +355,22 @@ static void iwl4965_rx_allocate(struct iwl_priv *priv, gfp_t priority)
355 } 355 }
356} 356}
357 357
358void iwl4965_rx_replenish(struct iwl_priv *priv) 358void il4965_rx_replenish(struct il_priv *priv)
359{ 359{
360 unsigned long flags; 360 unsigned long flags;
361 361
362 iwl4965_rx_allocate(priv, GFP_KERNEL); 362 il4965_rx_allocate(priv, GFP_KERNEL);
363 363
364 spin_lock_irqsave(&priv->lock, flags); 364 spin_lock_irqsave(&priv->lock, flags);
365 iwl4965_rx_queue_restock(priv); 365 il4965_rx_queue_restock(priv);
366 spin_unlock_irqrestore(&priv->lock, flags); 366 spin_unlock_irqrestore(&priv->lock, flags);
367} 367}
368 368
369void iwl4965_rx_replenish_now(struct iwl_priv *priv) 369void il4965_rx_replenish_now(struct il_priv *priv)
370{ 370{
371 iwl4965_rx_allocate(priv, GFP_ATOMIC); 371 il4965_rx_allocate(priv, GFP_ATOMIC);
372 372
373 iwl4965_rx_queue_restock(priv); 373 il4965_rx_queue_restock(priv);
374} 374}
375 375
376/* Assumes that the skb field of the buffers in 'pool' is kept accurate. 376/* Assumes that the skb field of the buffers in 'pool' is kept accurate.
@@ -378,7 +378,7 @@ void iwl4965_rx_replenish_now(struct iwl_priv *priv)
378 * This free routine walks the list of POOL entries and if SKB is set to 378 * This free routine walks the list of POOL entries and if SKB is set to
379 * non NULL it is unmapped and freed 379 * non NULL it is unmapped and freed
380 */ 380 */
381void iwl4965_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 381void il4965_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq)
382{ 382{
383 int i; 383 int i;
384 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { 384 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
@@ -386,31 +386,31 @@ void iwl4965_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
386 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, 386 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
387 PAGE_SIZE << priv->hw_params.rx_page_order, 387 PAGE_SIZE << priv->hw_params.rx_page_order,
388 PCI_DMA_FROMDEVICE); 388 PCI_DMA_FROMDEVICE);
389 __iwl_legacy_free_pages(priv, rxq->pool[i].page); 389 __il_free_pages(priv, rxq->pool[i].page);
390 rxq->pool[i].page = NULL; 390 rxq->pool[i].page = NULL;
391 } 391 }
392 } 392 }
393 393
394 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, 394 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
395 rxq->bd_dma); 395 rxq->bd_dma);
396 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), 396 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct il_rb_status),
397 rxq->rb_stts, rxq->rb_stts_dma); 397 rxq->rb_stts, rxq->rb_stts_dma);
398 rxq->bd = NULL; 398 rxq->bd = NULL;
399 rxq->rb_stts = NULL; 399 rxq->rb_stts = NULL;
400} 400}
401 401
402int iwl4965_rxq_stop(struct iwl_priv *priv) 402int il4965_rxq_stop(struct il_priv *priv)
403{ 403{
404 404
405 /* stop Rx DMA */ 405 /* stop Rx DMA */
406 iwl_legacy_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); 406 il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
407 iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, 407 il_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG,
408 FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); 408 FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
409 409
410 return 0; 410 return 0;
411} 411}
412 412
413int iwl4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) 413int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
414{ 414{
415 int idx = 0; 415 int idx = 0;
416 int band_offset = 0; 416 int band_offset = 0;
@@ -422,8 +422,8 @@ int iwl4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
422 /* Legacy rate format, search for match in table */ 422 /* Legacy rate format, search for match in table */
423 } else { 423 } else {
424 if (band == IEEE80211_BAND_5GHZ) 424 if (band == IEEE80211_BAND_5GHZ)
425 band_offset = IWL_FIRST_OFDM_RATE; 425 band_offset = IL_FIRST_OFDM_RATE;
426 for (idx = band_offset; idx < IWL_RATE_COUNT_LEGACY; idx++) 426 for (idx = band_offset; idx < IL_RATE_COUNT_LEGACY; idx++)
427 if (iwlegacy_rates[idx].plcp == (rate_n_flags & 0xFF)) 427 if (iwlegacy_rates[idx].plcp == (rate_n_flags & 0xFF))
428 return idx - band_offset; 428 return idx - band_offset;
429 } 429 }
@@ -431,13 +431,13 @@ int iwl4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
431 return -1; 431 return -1;
432} 432}
433 433
434static int iwl4965_calc_rssi(struct iwl_priv *priv, 434static int il4965_calc_rssi(struct il_priv *priv,
435 struct iwl_rx_phy_res *rx_resp) 435 struct il_rx_phy_res *rx_resp)
436{ 436{
437 /* data from PHY/DSP regarding signal strength, etc., 437 /* data from PHY/DSP regarding signal strength, etc.,
438 * contents are always there, not configurable by host. */ 438 * contents are always there, not configurable by host. */
439 struct iwl4965_rx_non_cfg_phy *ncphy = 439 struct il4965_rx_non_cfg_phy *ncphy =
440 (struct iwl4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy_buf; 440 (struct il4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy_buf;
441 u32 agc = (le16_to_cpu(ncphy->agc_info) & IWL49_AGC_DB_MASK) 441 u32 agc = (le16_to_cpu(ncphy->agc_info) & IWL49_AGC_DB_MASK)
442 >> IWL49_AGC_DB_POS; 442 >> IWL49_AGC_DB_POS;
443 443
@@ -456,7 +456,7 @@ static int iwl4965_calc_rssi(struct iwl_priv *priv,
456 if (valid_antennae & (1 << i)) 456 if (valid_antennae & (1 << i))
457 max_rssi = max(ncphy->rssi_info[i << 1], max_rssi); 457 max_rssi = max(ncphy->rssi_info[i << 1], max_rssi);
458 458
459 IWL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n", 459 IL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n",
460 ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4], 460 ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4],
461 max_rssi, agc); 461 max_rssi, agc);
462 462
@@ -466,7 +466,7 @@ static int iwl4965_calc_rssi(struct iwl_priv *priv,
466} 466}
467 467
468 468
469static u32 iwl4965_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in) 469static u32 il4965_translate_rx_status(struct il_priv *priv, u32 decrypt_in)
470{ 470{
471 u32 decrypt_out = 0; 471 u32 decrypt_out = 0;
472 472
@@ -519,17 +519,17 @@ static u32 iwl4965_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in)
519 break; 519 break;
520 } 520 }
521 521
522 IWL_DEBUG_RX(priv, "decrypt_in:0x%x decrypt_out = 0x%x\n", 522 IL_DEBUG_RX(priv, "decrypt_in:0x%x decrypt_out = 0x%x\n",
523 decrypt_in, decrypt_out); 523 decrypt_in, decrypt_out);
524 524
525 return decrypt_out; 525 return decrypt_out;
526} 526}
527 527
528static void iwl4965_pass_packet_to_mac80211(struct iwl_priv *priv, 528static void il4965_pass_packet_to_mac80211(struct il_priv *priv,
529 struct ieee80211_hdr *hdr, 529 struct ieee80211_hdr *hdr,
530 u16 len, 530 u16 len,
531 u32 ampdu_status, 531 u32 ampdu_status,
532 struct iwl_rx_mem_buffer *rxb, 532 struct il_rx_mem_buffer *rxb,
533 struct ieee80211_rx_status *stats) 533 struct ieee80211_rx_status *stats)
534{ 534{
535 struct sk_buff *skb; 535 struct sk_buff *skb;
@@ -537,25 +537,25 @@ static void iwl4965_pass_packet_to_mac80211(struct iwl_priv *priv,
537 537
538 /* We only process data packets if the interface is open */ 538 /* We only process data packets if the interface is open */
539 if (unlikely(!priv->is_open)) { 539 if (unlikely(!priv->is_open)) {
540 IWL_DEBUG_DROP_LIMIT(priv, 540 IL_DEBUG_DROP_LIMIT(priv,
541 "Dropping packet while interface is not open.\n"); 541 "Dropping packet while interface is not open.\n");
542 return; 542 return;
543 } 543 }
544 544
545 /* In case of HW accelerated crypto and bad decryption, drop */ 545 /* In case of HW accelerated crypto and bad decryption, drop */
546 if (!priv->cfg->mod_params->sw_crypto && 546 if (!priv->cfg->mod_params->sw_crypto &&
547 iwl_legacy_set_decrypted_flag(priv, hdr, ampdu_status, stats)) 547 il_set_decrypted_flag(priv, hdr, ampdu_status, stats))
548 return; 548 return;
549 549
550 skb = dev_alloc_skb(128); 550 skb = dev_alloc_skb(128);
551 if (!skb) { 551 if (!skb) {
552 IWL_ERR(priv, "dev_alloc_skb failed\n"); 552 IL_ERR(priv, "dev_alloc_skb failed\n");
553 return; 553 return;
554 } 554 }
555 555
556 skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len); 556 skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len);
557 557
558 iwl_legacy_update_stats(priv, false, fc, len); 558 il_update_stats(priv, false, fc, len);
559 memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); 559 memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));
560 560
561 ieee80211_rx(priv->hw, skb); 561 ieee80211_rx(priv->hw, skb);
@@ -565,15 +565,15 @@ static void iwl4965_pass_packet_to_mac80211(struct iwl_priv *priv,
565 565
566/* Called for REPLY_RX (legacy ABG frames), or 566/* Called for REPLY_RX (legacy ABG frames), or
567 * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ 567 * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */
568void iwl4965_rx_reply_rx(struct iwl_priv *priv, 568void il4965_rx_reply_rx(struct il_priv *priv,
569 struct iwl_rx_mem_buffer *rxb) 569 struct il_rx_mem_buffer *rxb)
570{ 570{
571 struct ieee80211_hdr *header; 571 struct ieee80211_hdr *header;
572 struct ieee80211_rx_status rx_status; 572 struct ieee80211_rx_status rx_status;
573 struct iwl_rx_packet *pkt = rxb_addr(rxb); 573 struct il_rx_packet *pkt = rxb_addr(rxb);
574 struct iwl_rx_phy_res *phy_res; 574 struct il_rx_phy_res *phy_res;
575 __le32 rx_pkt_status; 575 __le32 rx_pkt_status;
576 struct iwl_rx_mpdu_res_start *amsdu; 576 struct il_rx_mpdu_res_start *amsdu;
577 u32 len; 577 u32 len;
578 u32 ampdu_status; 578 u32 ampdu_status;
579 u32 rate_n_flags; 579 u32 rate_n_flags;
@@ -588,7 +588,7 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv,
588 * received. 588 * received.
589 */ 589 */
590 if (pkt->hdr.cmd == REPLY_RX) { 590 if (pkt->hdr.cmd == REPLY_RX) {
591 phy_res = (struct iwl_rx_phy_res *)pkt->u.raw; 591 phy_res = (struct il_rx_phy_res *)pkt->u.raw;
592 header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*phy_res) 592 header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*phy_res)
593 + phy_res->cfg_phy_cnt); 593 + phy_res->cfg_phy_cnt);
594 594
@@ -598,27 +598,27 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv,
598 ampdu_status = le32_to_cpu(rx_pkt_status); 598 ampdu_status = le32_to_cpu(rx_pkt_status);
599 } else { 599 } else {
600 if (!priv->_4965.last_phy_res_valid) { 600 if (!priv->_4965.last_phy_res_valid) {
601 IWL_ERR(priv, "MPDU frame without cached PHY data\n"); 601 IL_ERR(priv, "MPDU frame without cached PHY data\n");
602 return; 602 return;
603 } 603 }
604 phy_res = &priv->_4965.last_phy_res; 604 phy_res = &priv->_4965.last_phy_res;
605 amsdu = (struct iwl_rx_mpdu_res_start *)pkt->u.raw; 605 amsdu = (struct il_rx_mpdu_res_start *)pkt->u.raw;
606 header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*amsdu)); 606 header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*amsdu));
607 len = le16_to_cpu(amsdu->byte_count); 607 len = le16_to_cpu(amsdu->byte_count);
608 rx_pkt_status = *(__le32 *)(pkt->u.raw + sizeof(*amsdu) + len); 608 rx_pkt_status = *(__le32 *)(pkt->u.raw + sizeof(*amsdu) + len);
609 ampdu_status = iwl4965_translate_rx_status(priv, 609 ampdu_status = il4965_translate_rx_status(priv,
610 le32_to_cpu(rx_pkt_status)); 610 le32_to_cpu(rx_pkt_status));
611 } 611 }
612 612
613 if ((unlikely(phy_res->cfg_phy_cnt > 20))) { 613 if ((unlikely(phy_res->cfg_phy_cnt > 20))) {
614 IWL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n", 614 IL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n",
615 phy_res->cfg_phy_cnt); 615 phy_res->cfg_phy_cnt);
616 return; 616 return;
617 } 617 }
618 618
619 if (!(rx_pkt_status & RX_RES_STATUS_NO_CRC32_ERROR) || 619 if (!(rx_pkt_status & RX_RES_STATUS_NO_CRC32_ERROR) ||
620 !(rx_pkt_status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { 620 !(rx_pkt_status & RX_RES_STATUS_NO_RXE_OVERFLOW)) {
621 IWL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", 621 IL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n",
622 le32_to_cpu(rx_pkt_status)); 622 le32_to_cpu(rx_pkt_status));
623 return; 623 return;
624 } 624 }
@@ -634,7 +634,7 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv,
634 ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel), 634 ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel),
635 rx_status.band); 635 rx_status.band);
636 rx_status.rate_idx = 636 rx_status.rate_idx =
637 iwl4965_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band); 637 il4965_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band);
638 rx_status.flag = 0; 638 rx_status.flag = 0;
639 639
640 /* TSF isn't reliable. In order to allow smooth user experience, 640 /* TSF isn't reliable. In order to allow smooth user experience,
@@ -644,10 +644,10 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv,
644 priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp); 644 priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp);
645 645
646 /* Find max signal strength (dBm) among 3 antenna/receiver chains */ 646 /* Find max signal strength (dBm) among 3 antenna/receiver chains */
647 rx_status.signal = iwl4965_calc_rssi(priv, phy_res); 647 rx_status.signal = il4965_calc_rssi(priv, phy_res);
648 648
649 iwl_legacy_dbg_log_rx_data_frame(priv, len, header); 649 il_dbg_log_rx_data_frame(priv, len, header);
650 IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n", 650 IL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n",
651 rx_status.signal, (unsigned long long)rx_status.mactime); 651 rx_status.signal, (unsigned long long)rx_status.mactime);
652 652
653 /* 653 /*
@@ -679,41 +679,41 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv,
679 if (rate_n_flags & RATE_MCS_SGI_MSK) 679 if (rate_n_flags & RATE_MCS_SGI_MSK)
680 rx_status.flag |= RX_FLAG_SHORT_GI; 680 rx_status.flag |= RX_FLAG_SHORT_GI;
681 681
682 iwl4965_pass_packet_to_mac80211(priv, header, len, ampdu_status, 682 il4965_pass_packet_to_mac80211(priv, header, len, ampdu_status,
683 rxb, &rx_status); 683 rxb, &rx_status);
684} 684}
685 685
686/* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD). 686/* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD).
687 * This will be used later in iwl_rx_reply_rx() for REPLY_RX_MPDU_CMD. */ 687 * This will be used later in il_rx_reply_rx() for REPLY_RX_MPDU_CMD. */
688void iwl4965_rx_reply_rx_phy(struct iwl_priv *priv, 688void il4965_rx_reply_rx_phy(struct il_priv *priv,
689 struct iwl_rx_mem_buffer *rxb) 689 struct il_rx_mem_buffer *rxb)
690{ 690{
691 struct iwl_rx_packet *pkt = rxb_addr(rxb); 691 struct il_rx_packet *pkt = rxb_addr(rxb);
692 priv->_4965.last_phy_res_valid = true; 692 priv->_4965.last_phy_res_valid = true;
693 memcpy(&priv->_4965.last_phy_res, pkt->u.raw, 693 memcpy(&priv->_4965.last_phy_res, pkt->u.raw,
694 sizeof(struct iwl_rx_phy_res)); 694 sizeof(struct il_rx_phy_res));
695} 695}
696 696
697static int iwl4965_get_channels_for_scan(struct iwl_priv *priv, 697static int il4965_get_channels_for_scan(struct il_priv *priv,
698 struct ieee80211_vif *vif, 698 struct ieee80211_vif *vif,
699 enum ieee80211_band band, 699 enum ieee80211_band band,
700 u8 is_active, u8 n_probes, 700 u8 is_active, u8 n_probes,
701 struct iwl_scan_channel *scan_ch) 701 struct il_scan_channel *scan_ch)
702{ 702{
703 struct ieee80211_channel *chan; 703 struct ieee80211_channel *chan;
704 const struct ieee80211_supported_band *sband; 704 const struct ieee80211_supported_band *sband;
705 const struct iwl_channel_info *ch_info; 705 const struct il_channel_info *ch_info;
706 u16 passive_dwell = 0; 706 u16 passive_dwell = 0;
707 u16 active_dwell = 0; 707 u16 active_dwell = 0;
708 int added, i; 708 int added, i;
709 u16 channel; 709 u16 channel;
710 710
711 sband = iwl_get_hw_mode(priv, band); 711 sband = il_get_hw_mode(priv, band);
712 if (!sband) 712 if (!sband)
713 return 0; 713 return 0;
714 714
715 active_dwell = iwl_legacy_get_active_dwell_time(priv, band, n_probes); 715 active_dwell = il_get_active_dwell_time(priv, band, n_probes);
716 passive_dwell = iwl_legacy_get_passive_dwell_time(priv, band, vif); 716 passive_dwell = il_get_passive_dwell_time(priv, band, vif);
717 717
718 if (passive_dwell <= active_dwell) 718 if (passive_dwell <= active_dwell)
719 passive_dwell = active_dwell + 1; 719 passive_dwell = active_dwell + 1;
@@ -727,22 +727,22 @@ static int iwl4965_get_channels_for_scan(struct iwl_priv *priv,
727 channel = chan->hw_value; 727 channel = chan->hw_value;
728 scan_ch->channel = cpu_to_le16(channel); 728 scan_ch->channel = cpu_to_le16(channel);
729 729
730 ch_info = iwl_legacy_get_channel_info(priv, band, channel); 730 ch_info = il_get_channel_info(priv, band, channel);
731 if (!iwl_legacy_is_channel_valid(ch_info)) { 731 if (!il_is_channel_valid(ch_info)) {
732 IWL_DEBUG_SCAN(priv, 732 IL_DEBUG_SCAN(priv,
733 "Channel %d is INVALID for this band.\n", 733 "Channel %d is INVALID for this band.\n",
734 channel); 734 channel);
735 continue; 735 continue;
736 } 736 }
737 737
738 if (!is_active || iwl_legacy_is_channel_passive(ch_info) || 738 if (!is_active || il_is_channel_passive(ch_info) ||
739 (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) 739 (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN))
740 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; 740 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
741 else 741 else
742 scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; 742 scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE;
743 743
744 if (n_probes) 744 if (n_probes)
745 scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); 745 scan_ch->type |= IL_SCAN_PROBE_MASK(n_probes);
746 746
747 scan_ch->active_dwell = cpu_to_le16(active_dwell); 747 scan_ch->active_dwell = cpu_to_le16(active_dwell);
748 scan_ch->passive_dwell = cpu_to_le16(passive_dwell); 748 scan_ch->passive_dwell = cpu_to_le16(passive_dwell);
@@ -759,7 +759,7 @@ static int iwl4965_get_channels_for_scan(struct iwl_priv *priv,
759 else 759 else
760 scan_ch->tx_gain = ((1 << 5) | (5 << 3)); 760 scan_ch->tx_gain = ((1 << 5) | (5 << 3));
761 761
762 IWL_DEBUG_SCAN(priv, "Scanning ch=%d prob=0x%X [%s %d]\n", 762 IL_DEBUG_SCAN(priv, "Scanning ch=%d prob=0x%X [%s %d]\n",
763 channel, le32_to_cpu(scan_ch->type), 763 channel, le32_to_cpu(scan_ch->type),
764 (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ? 764 (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ?
765 "ACTIVE" : "PASSIVE", 765 "ACTIVE" : "PASSIVE",
@@ -770,19 +770,19 @@ static int iwl4965_get_channels_for_scan(struct iwl_priv *priv,
770 added++; 770 added++;
771 } 771 }
772 772
773 IWL_DEBUG_SCAN(priv, "total channels to scan %d\n", added); 773 IL_DEBUG_SCAN(priv, "total channels to scan %d\n", added);
774 return added; 774 return added;
775} 775}
776 776
777int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) 777int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif)
778{ 778{
779 struct iwl_host_cmd cmd = { 779 struct il_host_cmd cmd = {
780 .id = REPLY_SCAN_CMD, 780 .id = REPLY_SCAN_CMD,
781 .len = sizeof(struct iwl_scan_cmd), 781 .len = sizeof(struct il_scan_cmd),
782 .flags = CMD_SIZE_HUGE, 782 .flags = CMD_SIZE_HUGE,
783 }; 783 };
784 struct iwl_scan_cmd *scan; 784 struct il_scan_cmd *scan;
785 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 785 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
786 u32 rate_flags = 0; 786 u32 rate_flags = 0;
787 u16 cmd_len; 787 u16 cmd_len;
788 u16 rx_chain = 0; 788 u16 rx_chain = 0;
@@ -799,30 +799,30 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
799 lockdep_assert_held(&priv->mutex); 799 lockdep_assert_held(&priv->mutex);
800 800
801 if (vif) 801 if (vif)
802 ctx = iwl_legacy_rxon_ctx_from_vif(vif); 802 ctx = il_rxon_ctx_from_vif(vif);
803 803
804 if (!priv->scan_cmd) { 804 if (!priv->scan_cmd) {
805 priv->scan_cmd = kmalloc(sizeof(struct iwl_scan_cmd) + 805 priv->scan_cmd = kmalloc(sizeof(struct il_scan_cmd) +
806 IWL_MAX_SCAN_SIZE, GFP_KERNEL); 806 IL_MAX_SCAN_SIZE, GFP_KERNEL);
807 if (!priv->scan_cmd) { 807 if (!priv->scan_cmd) {
808 IWL_DEBUG_SCAN(priv, 808 IL_DEBUG_SCAN(priv,
809 "fail to allocate memory for scan\n"); 809 "fail to allocate memory for scan\n");
810 return -ENOMEM; 810 return -ENOMEM;
811 } 811 }
812 } 812 }
813 scan = priv->scan_cmd; 813 scan = priv->scan_cmd;
814 memset(scan, 0, sizeof(struct iwl_scan_cmd) + IWL_MAX_SCAN_SIZE); 814 memset(scan, 0, sizeof(struct il_scan_cmd) + IL_MAX_SCAN_SIZE);
815 815
816 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 816 scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH;
817 scan->quiet_time = IWL_ACTIVE_QUIET_TIME; 817 scan->quiet_time = IL_ACTIVE_QUIET_TIME;
818 818
819 if (iwl_legacy_is_any_associated(priv)) { 819 if (il_is_any_associated(priv)) {
820 u16 interval; 820 u16 interval;
821 u32 extra; 821 u32 extra;
822 u32 suspend_time = 100; 822 u32 suspend_time = 100;
823 u32 scan_suspend_time = 100; 823 u32 scan_suspend_time = 100;
824 824
825 IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); 825 IL_DEBUG_INFO(priv, "Scanning while associated...\n");
826 interval = vif->bss_conf.beacon_int; 826 interval = vif->bss_conf.beacon_int;
827 827
828 scan->suspend_time = 0; 828 scan->suspend_time = 0;
@@ -834,13 +834,13 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
834 scan_suspend_time = (extra | 834 scan_suspend_time = (extra |
835 ((suspend_time % interval) * 1024)); 835 ((suspend_time % interval) * 1024));
836 scan->suspend_time = cpu_to_le32(scan_suspend_time); 836 scan->suspend_time = cpu_to_le32(scan_suspend_time);
837 IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n", 837 IL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n",
838 scan_suspend_time, interval); 838 scan_suspend_time, interval);
839 } 839 }
840 840
841 if (priv->scan_request->n_ssids) { 841 if (priv->scan_request->n_ssids) {
842 int i, p = 0; 842 int i, p = 0;
843 IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); 843 IL_DEBUG_SCAN(priv, "Kicking off active scan\n");
844 for (i = 0; i < priv->scan_request->n_ssids; i++) { 844 for (i = 0; i < priv->scan_request->n_ssids; i++) {
845 /* always does wildcard anyway */ 845 /* always does wildcard anyway */
846 if (!priv->scan_request->ssids[i].ssid_len) 846 if (!priv->scan_request->ssids[i].ssid_len)
@@ -856,7 +856,7 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
856 } 856 }
857 is_active = true; 857 is_active = true;
858 } else 858 } else
859 IWL_DEBUG_SCAN(priv, "Start passive scan.\n"); 859 IL_DEBUG_SCAN(priv, "Start passive scan.\n");
860 860
861 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 861 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
862 scan->tx_cmd.sta_id = ctx->bcast_sta_id; 862 scan->tx_cmd.sta_id = ctx->bcast_sta_id;
@@ -866,21 +866,21 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
866 case IEEE80211_BAND_2GHZ: 866 case IEEE80211_BAND_2GHZ:
867 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 867 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
868 chan_mod = le32_to_cpu( 868 chan_mod = le32_to_cpu(
869 priv->contexts[IWL_RXON_CTX_BSS].active.flags & 869 priv->contexts[IL_RXON_CTX_BSS].active.flags &
870 RXON_FLG_CHANNEL_MODE_MSK) 870 RXON_FLG_CHANNEL_MODE_MSK)
871 >> RXON_FLG_CHANNEL_MODE_POS; 871 >> RXON_FLG_CHANNEL_MODE_POS;
872 if (chan_mod == CHANNEL_MODE_PURE_40) { 872 if (chan_mod == CHANNEL_MODE_PURE_40) {
873 rate = IWL_RATE_6M_PLCP; 873 rate = IL_RATE_6M_PLCP;
874 } else { 874 } else {
875 rate = IWL_RATE_1M_PLCP; 875 rate = IL_RATE_1M_PLCP;
876 rate_flags = RATE_MCS_CCK_MSK; 876 rate_flags = RATE_MCS_CCK_MSK;
877 } 877 }
878 break; 878 break;
879 case IEEE80211_BAND_5GHZ: 879 case IEEE80211_BAND_5GHZ:
880 rate = IWL_RATE_6M_PLCP; 880 rate = IL_RATE_6M_PLCP;
881 break; 881 break;
882 default: 882 default:
883 IWL_WARN(priv, "Invalid scan band\n"); 883 IL_WARN(priv, "Invalid scan band\n");
884 return -EIO; 884 return -EIO;
885 } 885 }
886 886
@@ -898,22 +898,22 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
898 * need to receive during our dwell time on a channel before 898 * need to receive during our dwell time on a channel before
899 * sending out probes -- setting this to a huge value will 899 * sending out probes -- setting this to a huge value will
900 * mean we never reach it, but at the same time work around 900 * mean we never reach it, but at the same time work around
901 * the aforementioned issue. Thus use IWL_GOOD_CRC_TH_NEVER 901 * the aforementioned issue. Thus use IL_GOOD_CRC_TH_NEVER
902 * here instead of IWL_GOOD_CRC_TH_DISABLED. 902 * here instead of IL_GOOD_CRC_TH_DISABLED.
903 */ 903 */
904 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT : 904 scan->good_CRC_th = is_active ? IL_GOOD_CRC_TH_DEFAULT :
905 IWL_GOOD_CRC_TH_NEVER; 905 IL_GOOD_CRC_TH_NEVER;
906 906
907 band = priv->scan_band; 907 band = priv->scan_band;
908 908
909 if (priv->cfg->scan_rx_antennas[band]) 909 if (priv->cfg->scan_rx_antennas[band])
910 rx_ant = priv->cfg->scan_rx_antennas[band]; 910 rx_ant = priv->cfg->scan_rx_antennas[band];
911 911
912 priv->scan_tx_ant[band] = iwl4965_toggle_tx_ant(priv, 912 priv->scan_tx_ant[band] = il4965_toggle_tx_ant(priv,
913 priv->scan_tx_ant[band], 913 priv->scan_tx_ant[band],
914 scan_tx_antennas); 914 scan_tx_antennas);
915 rate_flags |= iwl4965_ant_idx_to_flags(priv->scan_tx_ant[band]); 915 rate_flags |= il4965_ant_idx_to_flags(priv->scan_tx_ant[band]);
916 scan->tx_cmd.rate_n_flags = iwl4965_hw_set_rate_n_flags(rate, rate_flags); 916 scan->tx_cmd.rate_n_flags = il4965_hw_set_rate_n_flags(rate, rate_flags);
917 917
918 /* In power save mode use one chain, otherwise use all chains */ 918 /* In power save mode use one chain, otherwise use all chains */
919 if (test_bit(STATUS_POWER_PMI, &priv->status)) { 919 if (test_bit(STATUS_POWER_PMI, &priv->status)) {
@@ -923,10 +923,10 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
923 if (!active_chains) 923 if (!active_chains)
924 active_chains = rx_ant; 924 active_chains = rx_ant;
925 925
926 IWL_DEBUG_SCAN(priv, "chain_noise_data.active_chains: %u\n", 926 IL_DEBUG_SCAN(priv, "chain_noise_data.active_chains: %u\n",
927 priv->chain_noise_data.active_chains); 927 priv->chain_noise_data.active_chains);
928 928
929 rx_ant = iwl4965_first_antenna(active_chains); 929 rx_ant = il4965_first_antenna(active_chains);
930 } 930 }
931 931
932 /* MIMO is not used here, but value is required */ 932 /* MIMO is not used here, but value is required */
@@ -936,53 +936,53 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
936 rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; 936 rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS;
937 scan->rx_chain = cpu_to_le16(rx_chain); 937 scan->rx_chain = cpu_to_le16(rx_chain);
938 938
939 cmd_len = iwl_legacy_fill_probe_req(priv, 939 cmd_len = il_fill_probe_req(priv,
940 (struct ieee80211_mgmt *)scan->data, 940 (struct ieee80211_mgmt *)scan->data,
941 vif->addr, 941 vif->addr,
942 priv->scan_request->ie, 942 priv->scan_request->ie,
943 priv->scan_request->ie_len, 943 priv->scan_request->ie_len,
944 IWL_MAX_SCAN_SIZE - sizeof(*scan)); 944 IL_MAX_SCAN_SIZE - sizeof(*scan));
945 scan->tx_cmd.len = cpu_to_le16(cmd_len); 945 scan->tx_cmd.len = cpu_to_le16(cmd_len);
946 946
947 scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | 947 scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK |
948 RXON_FILTER_BCON_AWARE_MSK); 948 RXON_FILTER_BCON_AWARE_MSK);
949 949
950 scan->channel_count = iwl4965_get_channels_for_scan(priv, vif, band, 950 scan->channel_count = il4965_get_channels_for_scan(priv, vif, band,
951 is_active, n_probes, 951 is_active, n_probes,
952 (void *)&scan->data[cmd_len]); 952 (void *)&scan->data[cmd_len]);
953 if (scan->channel_count == 0) { 953 if (scan->channel_count == 0) {
954 IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); 954 IL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count);
955 return -EIO; 955 return -EIO;
956 } 956 }
957 957
958 cmd.len += le16_to_cpu(scan->tx_cmd.len) + 958 cmd.len += le16_to_cpu(scan->tx_cmd.len) +
959 scan->channel_count * sizeof(struct iwl_scan_channel); 959 scan->channel_count * sizeof(struct il_scan_channel);
960 cmd.data = scan; 960 cmd.data = scan;
961 scan->len = cpu_to_le16(cmd.len); 961 scan->len = cpu_to_le16(cmd.len);
962 962
963 set_bit(STATUS_SCAN_HW, &priv->status); 963 set_bit(STATUS_SCAN_HW, &priv->status);
964 964
965 ret = iwl_legacy_send_cmd_sync(priv, &cmd); 965 ret = il_send_cmd_sync(priv, &cmd);
966 if (ret) 966 if (ret)
967 clear_bit(STATUS_SCAN_HW, &priv->status); 967 clear_bit(STATUS_SCAN_HW, &priv->status);
968 968
969 return ret; 969 return ret;
970} 970}
971 971
972int iwl4965_manage_ibss_station(struct iwl_priv *priv, 972int il4965_manage_ibss_station(struct il_priv *priv,
973 struct ieee80211_vif *vif, bool add) 973 struct ieee80211_vif *vif, bool add)
974{ 974{
975 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 975 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
976 976
977 if (add) 977 if (add)
978 return iwl4965_add_bssid_station(priv, vif_priv->ctx, 978 return il4965_add_bssid_station(priv, vif_priv->ctx,
979 vif->bss_conf.bssid, 979 vif->bss_conf.bssid,
980 &vif_priv->ibss_bssid_sta_id); 980 &vif_priv->ibss_bssid_sta_id);
981 return iwl_legacy_remove_station(priv, vif_priv->ibss_bssid_sta_id, 981 return il_remove_station(priv, vif_priv->ibss_bssid_sta_id,
982 vif->bss_conf.bssid); 982 vif->bss_conf.bssid);
983} 983}
984 984
985void iwl4965_free_tfds_in_queue(struct iwl_priv *priv, 985void il4965_free_tfds_in_queue(struct il_priv *priv,
986 int sta_id, int tid, int freed) 986 int sta_id, int tid, int freed)
987{ 987{
988 lockdep_assert_held(&priv->sta_lock); 988 lockdep_assert_held(&priv->sta_lock);
@@ -990,25 +990,25 @@ void iwl4965_free_tfds_in_queue(struct iwl_priv *priv,
990 if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed) 990 if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed)
991 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; 991 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
992 else { 992 else {
993 IWL_DEBUG_TX(priv, "free more than tfds_in_queue (%u:%d)\n", 993 IL_DEBUG_TX(priv, "free more than tfds_in_queue (%u:%d)\n",
994 priv->stations[sta_id].tid[tid].tfds_in_queue, 994 priv->stations[sta_id].tid[tid].tfds_in_queue,
995 freed); 995 freed);
996 priv->stations[sta_id].tid[tid].tfds_in_queue = 0; 996 priv->stations[sta_id].tid[tid].tfds_in_queue = 0;
997 } 997 }
998} 998}
999 999
1000#define IWL_TX_QUEUE_MSK 0xfffff 1000#define IL_TX_QUEUE_MSK 0xfffff
1001 1001
1002static bool iwl4965_is_single_rx_stream(struct iwl_priv *priv) 1002static bool il4965_is_single_rx_stream(struct il_priv *priv)
1003{ 1003{
1004 return priv->current_ht_config.smps == IEEE80211_SMPS_STATIC || 1004 return priv->current_ht_config.smps == IEEE80211_SMPS_STATIC ||
1005 priv->current_ht_config.single_chain_sufficient; 1005 priv->current_ht_config.single_chain_sufficient;
1006} 1006}
1007 1007
1008#define IWL_NUM_RX_CHAINS_MULTIPLE 3 1008#define IL_NUM_RX_CHAINS_MULTIPLE 3
1009#define IWL_NUM_RX_CHAINS_SINGLE 2 1009#define IL_NUM_RX_CHAINS_SINGLE 2
1010#define IWL_NUM_IDLE_CHAINS_DUAL 2 1010#define IL_NUM_IDLE_CHAINS_DUAL 2
1011#define IWL_NUM_IDLE_CHAINS_SINGLE 1 1011#define IL_NUM_IDLE_CHAINS_SINGLE 1
1012 1012
1013/* 1013/*
1014 * Determine how many receiver/antenna chains to use. 1014 * Determine how many receiver/antenna chains to use.
@@ -1020,13 +1020,13 @@ static bool iwl4965_is_single_rx_stream(struct iwl_priv *priv)
1020 * MIMO (dual stream) requires at least 2, but works better with 3. 1020 * MIMO (dual stream) requires at least 2, but works better with 3.
1021 * This does not determine *which* chains to use, just how many. 1021 * This does not determine *which* chains to use, just how many.
1022 */ 1022 */
1023static int iwl4965_get_active_rx_chain_count(struct iwl_priv *priv) 1023static int il4965_get_active_rx_chain_count(struct il_priv *priv)
1024{ 1024{
1025 /* # of Rx chains to use when expecting MIMO. */ 1025 /* # of Rx chains to use when expecting MIMO. */
1026 if (iwl4965_is_single_rx_stream(priv)) 1026 if (il4965_is_single_rx_stream(priv))
1027 return IWL_NUM_RX_CHAINS_SINGLE; 1027 return IL_NUM_RX_CHAINS_SINGLE;
1028 else 1028 else
1029 return IWL_NUM_RX_CHAINS_MULTIPLE; 1029 return IL_NUM_RX_CHAINS_MULTIPLE;
1030} 1030}
1031 1031
1032/* 1032/*
@@ -1034,13 +1034,13 @@ static int iwl4965_get_active_rx_chain_count(struct iwl_priv *priv)
1034 * multiplexing power save, use the active count for rx chain count. 1034 * multiplexing power save, use the active count for rx chain count.
1035 */ 1035 */
1036static int 1036static int
1037iwl4965_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) 1037il4965_get_idle_rx_chain_count(struct il_priv *priv, int active_cnt)
1038{ 1038{
1039 /* # Rx chains when idling, depending on SMPS mode */ 1039 /* # Rx chains when idling, depending on SMPS mode */
1040 switch (priv->current_ht_config.smps) { 1040 switch (priv->current_ht_config.smps) {
1041 case IEEE80211_SMPS_STATIC: 1041 case IEEE80211_SMPS_STATIC:
1042 case IEEE80211_SMPS_DYNAMIC: 1042 case IEEE80211_SMPS_DYNAMIC:
1043 return IWL_NUM_IDLE_CHAINS_SINGLE; 1043 return IL_NUM_IDLE_CHAINS_SINGLE;
1044 case IEEE80211_SMPS_OFF: 1044 case IEEE80211_SMPS_OFF:
1045 return active_cnt; 1045 return active_cnt;
1046 default: 1046 default:
@@ -1051,7 +1051,7 @@ iwl4965_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt)
1051} 1051}
1052 1052
1053/* up to 4 chains */ 1053/* up to 4 chains */
1054static u8 iwl4965_count_chain_bitmap(u32 chain_bitmap) 1054static u8 il4965_count_chain_bitmap(u32 chain_bitmap)
1055{ 1055{
1056 u8 res; 1056 u8 res;
1057 res = (chain_bitmap & BIT(0)) >> 0; 1057 res = (chain_bitmap & BIT(0)) >> 0;
@@ -1062,14 +1062,14 @@ static u8 iwl4965_count_chain_bitmap(u32 chain_bitmap)
1062} 1062}
1063 1063
1064/** 1064/**
1065 * iwl4965_set_rxon_chain - Set up Rx chain usage in "staging" RXON image 1065 * il4965_set_rxon_chain - Set up Rx chain usage in "staging" RXON image
1066 * 1066 *
1067 * Selects how many and which Rx receivers/antennas/chains to use. 1067 * Selects how many and which Rx receivers/antennas/chains to use.
1068 * This should not be used for scan command ... it puts data in wrong place. 1068 * This should not be used for scan command ... it puts data in wrong place.
1069 */ 1069 */
1070void iwl4965_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx) 1070void il4965_set_rxon_chain(struct il_priv *priv, struct il_rxon_context *ctx)
1071{ 1071{
1072 bool is_single = iwl4965_is_single_rx_stream(priv); 1072 bool is_single = il4965_is_single_rx_stream(priv);
1073 bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); 1073 bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status);
1074 u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt; 1074 u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt;
1075 u32 active_chains; 1075 u32 active_chains;
@@ -1077,7 +1077,7 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1077 1077
1078 /* Tell uCode which antennas are actually connected. 1078 /* Tell uCode which antennas are actually connected.
1079 * Before first association, we assume all antennas are connected. 1079 * Before first association, we assume all antennas are connected.
1080 * Just after first association, iwl4965_chain_noise_calibration() 1080 * Just after first association, il4965_chain_noise_calibration()
1081 * checks which antennas actually *are* connected. */ 1081 * checks which antennas actually *are* connected. */
1082 if (priv->chain_noise_data.active_chains) 1082 if (priv->chain_noise_data.active_chains)
1083 active_chains = priv->chain_noise_data.active_chains; 1083 active_chains = priv->chain_noise_data.active_chains;
@@ -1087,14 +1087,14 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1087 rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS; 1087 rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS;
1088 1088
1089 /* How many receivers should we use? */ 1089 /* How many receivers should we use? */
1090 active_rx_cnt = iwl4965_get_active_rx_chain_count(priv); 1090 active_rx_cnt = il4965_get_active_rx_chain_count(priv);
1091 idle_rx_cnt = iwl4965_get_idle_rx_chain_count(priv, active_rx_cnt); 1091 idle_rx_cnt = il4965_get_idle_rx_chain_count(priv, active_rx_cnt);
1092 1092
1093 1093
1094 /* correct rx chain count according hw settings 1094 /* correct rx chain count according hw settings
1095 * and chain noise calibration 1095 * and chain noise calibration
1096 */ 1096 */
1097 valid_rx_cnt = iwl4965_count_chain_bitmap(active_chains); 1097 valid_rx_cnt = il4965_count_chain_bitmap(active_chains);
1098 if (valid_rx_cnt < active_rx_cnt) 1098 if (valid_rx_cnt < active_rx_cnt)
1099 active_rx_cnt = valid_rx_cnt; 1099 active_rx_cnt = valid_rx_cnt;
1100 1100
@@ -1106,12 +1106,12 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1106 1106
1107 ctx->staging.rx_chain = cpu_to_le16(rx_chain); 1107 ctx->staging.rx_chain = cpu_to_le16(rx_chain);
1108 1108
1109 if (!is_single && (active_rx_cnt >= IWL_NUM_RX_CHAINS_SINGLE) && is_cam) 1109 if (!is_single && (active_rx_cnt >= IL_NUM_RX_CHAINS_SINGLE) && is_cam)
1110 ctx->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; 1110 ctx->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK;
1111 else 1111 else
1112 ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; 1112 ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK;
1113 1113
1114 IWL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n", 1114 IL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n",
1115 ctx->staging.rx_chain, 1115 ctx->staging.rx_chain,
1116 active_rx_cnt, idle_rx_cnt); 1116 active_rx_cnt, idle_rx_cnt);
1117 1117
@@ -1119,7 +1119,7 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1119 active_rx_cnt < idle_rx_cnt); 1119 active_rx_cnt < idle_rx_cnt);
1120} 1120}
1121 1121
1122u8 iwl4965_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid) 1122u8 il4965_toggle_tx_ant(struct il_priv *priv, u8 ant, u8 valid)
1123{ 1123{
1124 int i; 1124 int i;
1125 u8 ind = ant; 1125 u8 ind = ant;
@@ -1132,24 +1132,24 @@ u8 iwl4965_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid)
1132 return ant; 1132 return ant;
1133} 1133}
1134 1134
1135static const char *iwl4965_get_fh_string(int cmd) 1135static const char *il4965_get_fh_string(int cmd)
1136{ 1136{
1137 switch (cmd) { 1137 switch (cmd) {
1138 IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG); 1138 IL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG);
1139 IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG); 1139 IL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG);
1140 IWL_CMD(FH_RSCSR_CHNL0_WPTR); 1140 IL_CMD(FH_RSCSR_CHNL0_WPTR);
1141 IWL_CMD(FH_MEM_RCSR_CHNL0_CONFIG_REG); 1141 IL_CMD(FH_MEM_RCSR_CHNL0_CONFIG_REG);
1142 IWL_CMD(FH_MEM_RSSR_SHARED_CTRL_REG); 1142 IL_CMD(FH_MEM_RSSR_SHARED_CTRL_REG);
1143 IWL_CMD(FH_MEM_RSSR_RX_STATUS_REG); 1143 IL_CMD(FH_MEM_RSSR_RX_STATUS_REG);
1144 IWL_CMD(FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV); 1144 IL_CMD(FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV);
1145 IWL_CMD(FH_TSSR_TX_STATUS_REG); 1145 IL_CMD(FH_TSSR_TX_STATUS_REG);
1146 IWL_CMD(FH_TSSR_TX_ERROR_REG); 1146 IL_CMD(FH_TSSR_TX_ERROR_REG);
1147 default: 1147 default:
1148 return "UNKNOWN"; 1148 return "UNKNOWN";
1149 } 1149 }
1150} 1150}
1151 1151
1152int iwl4965_dump_fh(struct iwl_priv *priv, char **buf, bool display) 1152int il4965_dump_fh(struct il_priv *priv, char **buf, bool display)
1153{ 1153{
1154 int i; 1154 int i;
1155#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 1155#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
@@ -1178,17 +1178,17 @@ int iwl4965_dump_fh(struct iwl_priv *priv, char **buf, bool display)
1178 for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) { 1178 for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
1179 pos += scnprintf(*buf + pos, bufsz - pos, 1179 pos += scnprintf(*buf + pos, bufsz - pos,
1180 " %34s: 0X%08x\n", 1180 " %34s: 0X%08x\n",
1181 iwl4965_get_fh_string(fh_tbl[i]), 1181 il4965_get_fh_string(fh_tbl[i]),
1182 iwl_legacy_read_direct32(priv, fh_tbl[i])); 1182 il_read_direct32(priv, fh_tbl[i]));
1183 } 1183 }
1184 return pos; 1184 return pos;
1185 } 1185 }
1186#endif 1186#endif
1187 IWL_ERR(priv, "FH register values:\n"); 1187 IL_ERR(priv, "FH register values:\n");
1188 for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) { 1188 for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
1189 IWL_ERR(priv, " %34s: 0X%08x\n", 1189 IL_ERR(priv, " %34s: 0X%08x\n",
1190 iwl4965_get_fh_string(fh_tbl[i]), 1190 il4965_get_fh_string(fh_tbl[i]),
1191 iwl_legacy_read_direct32(priv, fh_tbl[i])); 1191 il_read_direct32(priv, fh_tbl[i]));
1192 } 1192 }
1193 return 0; 1193 return 0;
1194} 1194}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index 57ebe214e68c..a7298f5997a2 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -43,26 +43,26 @@
43#define IWL4965_RS_NAME "iwl-4965-rs" 43#define IWL4965_RS_NAME "iwl-4965-rs"
44 44
45#define NUM_TRY_BEFORE_ANT_TOGGLE 1 45#define NUM_TRY_BEFORE_ANT_TOGGLE 1
46#define IWL_NUMBER_TRY 1 46#define IL_NUMBER_TRY 1
47#define IWL_HT_NUMBER_TRY 3 47#define IL_HT_NUMBER_TRY 3
48 48
49#define IWL_RATE_MAX_WINDOW 62 /* # tx in history window */ 49#define IL_RATE_MAX_WINDOW 62 /* # tx in history window */
50#define IWL_RATE_MIN_FAILURE_TH 6 /* min failures to calc tpt */ 50#define IL_RATE_MIN_FAILURE_TH 6 /* min failures to calc tpt */
51#define IWL_RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */ 51#define IL_RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */
52 52
53/* max allowed rate miss before sync LQ cmd */ 53/* max allowed rate miss before sync LQ cmd */
54#define IWL_MISSED_RATE_MAX 15 54#define IL_MISSED_RATE_MAX 15
55/* max time to accum history 2 seconds */ 55/* max time to accum history 2 seconds */
56#define IWL_RATE_SCALE_FLUSH_INTVL (3*HZ) 56#define IL_RATE_SCALE_FLUSH_INTVL (3*HZ)
57 57
58static u8 rs_ht_to_legacy[] = { 58static u8 rs_ht_to_legacy[] = {
59 IWL_RATE_6M_INDEX, IWL_RATE_6M_INDEX, 59 IL_RATE_6M_INDEX, IL_RATE_6M_INDEX,
60 IWL_RATE_6M_INDEX, IWL_RATE_6M_INDEX, 60 IL_RATE_6M_INDEX, IL_RATE_6M_INDEX,
61 IWL_RATE_6M_INDEX, 61 IL_RATE_6M_INDEX,
62 IWL_RATE_6M_INDEX, IWL_RATE_9M_INDEX, 62 IL_RATE_6M_INDEX, IL_RATE_9M_INDEX,
63 IWL_RATE_12M_INDEX, IWL_RATE_18M_INDEX, 63 IL_RATE_12M_INDEX, IL_RATE_18M_INDEX,
64 IWL_RATE_24M_INDEX, IWL_RATE_36M_INDEX, 64 IL_RATE_24M_INDEX, IL_RATE_36M_INDEX,
65 IWL_RATE_48M_INDEX, IWL_RATE_54M_INDEX 65 IL_RATE_48M_INDEX, IL_RATE_54M_INDEX
66}; 66};
67 67
68static const u8 ant_toggle_lookup[] = { 68static const u8 ant_toggle_lookup[] = {
@@ -76,43 +76,43 @@ static const u8 ant_toggle_lookup[] = {
76 /*ANT_ABC -> */ ANT_ABC, 76 /*ANT_ABC -> */ ANT_ABC,
77}; 77};
78 78
79#define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ 79#define IL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \
80 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ 80 [IL_RATE_##r##M_INDEX] = { IL_RATE_##r##M_PLCP, \
81 IWL_RATE_SISO_##s##M_PLCP, \ 81 IL_RATE_SISO_##s##M_PLCP, \
82 IWL_RATE_MIMO2_##s##M_PLCP,\ 82 IL_RATE_MIMO2_##s##M_PLCP,\
83 IWL_RATE_##r##M_IEEE, \ 83 IL_RATE_##r##M_IEEE, \
84 IWL_RATE_##ip##M_INDEX, \ 84 IL_RATE_##ip##M_INDEX, \
85 IWL_RATE_##in##M_INDEX, \ 85 IL_RATE_##in##M_INDEX, \
86 IWL_RATE_##rp##M_INDEX, \ 86 IL_RATE_##rp##M_INDEX, \
87 IWL_RATE_##rn##M_INDEX, \ 87 IL_RATE_##rn##M_INDEX, \
88 IWL_RATE_##pp##M_INDEX, \ 88 IL_RATE_##pp##M_INDEX, \
89 IWL_RATE_##np##M_INDEX } 89 IL_RATE_##np##M_INDEX }
90 90
91/* 91/*
92 * Parameter order: 92 * Parameter order:
93 * rate, ht rate, prev rate, next rate, prev tgg rate, next tgg rate 93 * rate, ht rate, prev rate, next rate, prev tgg rate, next tgg rate
94 * 94 *
95 * If there isn't a valid next or previous rate then INV is used which 95 * If there isn't a valid next or previous rate then INV is used which
96 * maps to IWL_RATE_INVALID 96 * maps to IL_RATE_INVALID
97 * 97 *
98 */ 98 */
99const struct iwl_rate_info iwlegacy_rates[IWL_RATE_COUNT] = { 99const struct il_rate_info iwlegacy_rates[IL_RATE_COUNT] = {
100 IWL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */ 100 IL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */
101 IWL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */ 101 IL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */
102 IWL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */ 102 IL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */
103 IWL_DECLARE_RATE_INFO(11, INV, 9, 12, 9, 12, 5, 18), /* 11mbps */ 103 IL_DECLARE_RATE_INFO(11, INV, 9, 12, 9, 12, 5, 18), /* 11mbps */
104 IWL_DECLARE_RATE_INFO(6, 6, 5, 9, 5, 11, 5, 11), /* 6mbps */ 104 IL_DECLARE_RATE_INFO(6, 6, 5, 9, 5, 11, 5, 11), /* 6mbps */
105 IWL_DECLARE_RATE_INFO(9, 6, 6, 11, 6, 11, 5, 11), /* 9mbps */ 105 IL_DECLARE_RATE_INFO(9, 6, 6, 11, 6, 11, 5, 11), /* 9mbps */
106 IWL_DECLARE_RATE_INFO(12, 12, 11, 18, 11, 18, 11, 18), /* 12mbps */ 106 IL_DECLARE_RATE_INFO(12, 12, 11, 18, 11, 18, 11, 18), /* 12mbps */
107 IWL_DECLARE_RATE_INFO(18, 18, 12, 24, 12, 24, 11, 24), /* 18mbps */ 107 IL_DECLARE_RATE_INFO(18, 18, 12, 24, 12, 24, 11, 24), /* 18mbps */
108 IWL_DECLARE_RATE_INFO(24, 24, 18, 36, 18, 36, 18, 36), /* 24mbps */ 108 IL_DECLARE_RATE_INFO(24, 24, 18, 36, 18, 36, 18, 36), /* 24mbps */
109 IWL_DECLARE_RATE_INFO(36, 36, 24, 48, 24, 48, 24, 48), /* 36mbps */ 109 IL_DECLARE_RATE_INFO(36, 36, 24, 48, 24, 48, 24, 48), /* 36mbps */
110 IWL_DECLARE_RATE_INFO(48, 48, 36, 54, 36, 54, 36, 54), /* 48mbps */ 110 IL_DECLARE_RATE_INFO(48, 48, 36, 54, 36, 54, 36, 54), /* 48mbps */
111 IWL_DECLARE_RATE_INFO(54, 54, 48, INV, 48, INV, 48, INV),/* 54mbps */ 111 IL_DECLARE_RATE_INFO(54, 54, 48, INV, 48, INV, 48, INV),/* 54mbps */
112 IWL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */ 112 IL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */
113}; 113};
114 114
115static int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags) 115static int il4965_hwrate_to_plcp_idx(u32 rate_n_flags)
116{ 116{
117 int idx = 0; 117 int idx = 0;
118 118
@@ -120,14 +120,14 @@ static int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags)
120 if (rate_n_flags & RATE_MCS_HT_MSK) { 120 if (rate_n_flags & RATE_MCS_HT_MSK) {
121 idx = (rate_n_flags & 0xff); 121 idx = (rate_n_flags & 0xff);
122 122
123 if (idx >= IWL_RATE_MIMO2_6M_PLCP) 123 if (idx >= IL_RATE_MIMO2_6M_PLCP)
124 idx = idx - IWL_RATE_MIMO2_6M_PLCP; 124 idx = idx - IL_RATE_MIMO2_6M_PLCP;
125 125
126 idx += IWL_FIRST_OFDM_RATE; 126 idx += IL_FIRST_OFDM_RATE;
127 /* skip 9M not supported in ht*/ 127 /* skip 9M not supported in ht*/
128 if (idx >= IWL_RATE_9M_INDEX) 128 if (idx >= IL_RATE_9M_INDEX)
129 idx += 1; 129 idx += 1;
130 if ((idx >= IWL_FIRST_OFDM_RATE) && (idx <= IWL_LAST_OFDM_RATE)) 130 if ((idx >= IL_FIRST_OFDM_RATE) && (idx <= IL_LAST_OFDM_RATE))
131 return idx; 131 return idx;
132 132
133 /* legacy rate format, search for match in table */ 133 /* legacy rate format, search for match in table */
@@ -140,20 +140,20 @@ static int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags)
140 return -1; 140 return -1;
141} 141}
142 142
143static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, 143static void il4965_rs_rate_scale_perform(struct il_priv *priv,
144 struct sk_buff *skb, 144 struct sk_buff *skb,
145 struct ieee80211_sta *sta, 145 struct ieee80211_sta *sta,
146 struct iwl_lq_sta *lq_sta); 146 struct il_lq_sta *lq_sta);
147static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv, 147static void il4965_rs_fill_link_cmd(struct il_priv *priv,
148 struct iwl_lq_sta *lq_sta, u32 rate_n_flags); 148 struct il_lq_sta *lq_sta, u32 rate_n_flags);
149static void iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, 149static void il4965_rs_stay_in_table(struct il_lq_sta *lq_sta,
150 bool force_search); 150 bool force_search);
151 151
152#ifdef CONFIG_MAC80211_DEBUGFS 152#ifdef CONFIG_MAC80211_DEBUGFS
153static void iwl4965_rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 153static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta,
154 u32 *rate_n_flags, int index); 154 u32 *rate_n_flags, int index);
155#else 155#else
156static void iwl4965_rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 156static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta,
157 u32 *rate_n_flags, int index) 157 u32 *rate_n_flags, int index)
158{} 158{}
159#endif 159#endif
@@ -169,32 +169,32 @@ static void iwl4965_rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
169 * (2.4 GHz) band. 169 * (2.4 GHz) band.
170 */ 170 */
171 171
172static s32 expected_tpt_legacy[IWL_RATE_COUNT] = { 172static s32 expected_tpt_legacy[IL_RATE_COUNT] = {
173 7, 13, 35, 58, 40, 57, 72, 98, 121, 154, 177, 186, 0 173 7, 13, 35, 58, 40, 57, 72, 98, 121, 154, 177, 186, 0
174}; 174};
175 175
176static s32 expected_tpt_siso20MHz[4][IWL_RATE_COUNT] = { 176static s32 expected_tpt_siso20MHz[4][IL_RATE_COUNT] = {
177 {0, 0, 0, 0, 42, 0, 76, 102, 124, 158, 183, 193, 202}, /* Norm */ 177 {0, 0, 0, 0, 42, 0, 76, 102, 124, 158, 183, 193, 202}, /* Norm */
178 {0, 0, 0, 0, 46, 0, 82, 110, 132, 167, 192, 202, 210}, /* SGI */ 178 {0, 0, 0, 0, 46, 0, 82, 110, 132, 167, 192, 202, 210}, /* SGI */
179 {0, 0, 0, 0, 48, 0, 93, 135, 176, 251, 319, 351, 381}, /* AGG */ 179 {0, 0, 0, 0, 48, 0, 93, 135, 176, 251, 319, 351, 381}, /* AGG */
180 {0, 0, 0, 0, 53, 0, 102, 149, 193, 275, 348, 381, 413}, /* AGG+SGI */ 180 {0, 0, 0, 0, 53, 0, 102, 149, 193, 275, 348, 381, 413}, /* AGG+SGI */
181}; 181};
182 182
183static s32 expected_tpt_siso40MHz[4][IWL_RATE_COUNT] = { 183static s32 expected_tpt_siso40MHz[4][IL_RATE_COUNT] = {
184 {0, 0, 0, 0, 77, 0, 127, 160, 184, 220, 242, 250, 257}, /* Norm */ 184 {0, 0, 0, 0, 77, 0, 127, 160, 184, 220, 242, 250, 257}, /* Norm */
185 {0, 0, 0, 0, 83, 0, 135, 169, 193, 229, 250, 257, 264}, /* SGI */ 185 {0, 0, 0, 0, 83, 0, 135, 169, 193, 229, 250, 257, 264}, /* SGI */
186 {0, 0, 0, 0, 96, 0, 182, 259, 328, 451, 553, 598, 640}, /* AGG */ 186 {0, 0, 0, 0, 96, 0, 182, 259, 328, 451, 553, 598, 640}, /* AGG */
187 {0, 0, 0, 0, 106, 0, 199, 282, 357, 487, 593, 640, 683}, /* AGG+SGI */ 187 {0, 0, 0, 0, 106, 0, 199, 282, 357, 487, 593, 640, 683}, /* AGG+SGI */
188}; 188};
189 189
190static s32 expected_tpt_mimo2_20MHz[4][IWL_RATE_COUNT] = { 190static s32 expected_tpt_mimo2_20MHz[4][IL_RATE_COUNT] = {
191 {0, 0, 0, 0, 74, 0, 123, 155, 179, 213, 235, 243, 250}, /* Norm */ 191 {0, 0, 0, 0, 74, 0, 123, 155, 179, 213, 235, 243, 250}, /* Norm */
192 {0, 0, 0, 0, 81, 0, 131, 164, 187, 221, 242, 250, 256}, /* SGI */ 192 {0, 0, 0, 0, 81, 0, 131, 164, 187, 221, 242, 250, 256}, /* SGI */
193 {0, 0, 0, 0, 92, 0, 175, 250, 317, 436, 534, 578, 619}, /* AGG */ 193 {0, 0, 0, 0, 92, 0, 175, 250, 317, 436, 534, 578, 619}, /* AGG */
194 {0, 0, 0, 0, 102, 0, 192, 273, 344, 470, 573, 619, 660}, /* AGG+SGI*/ 194 {0, 0, 0, 0, 102, 0, 192, 273, 344, 470, 573, 619, 660}, /* AGG+SGI*/
195}; 195};
196 196
197static s32 expected_tpt_mimo2_40MHz[4][IWL_RATE_COUNT] = { 197static s32 expected_tpt_mimo2_40MHz[4][IL_RATE_COUNT] = {
198 {0, 0, 0, 0, 123, 0, 182, 214, 235, 264, 279, 285, 289}, /* Norm */ 198 {0, 0, 0, 0, 123, 0, 182, 214, 235, 264, 279, 285, 289}, /* Norm */
199 {0, 0, 0, 0, 131, 0, 191, 222, 242, 270, 284, 289, 293}, /* SGI */ 199 {0, 0, 0, 0, 131, 0, 191, 222, 242, 270, 284, 289, 293}, /* SGI */
200 {0, 0, 0, 0, 180, 0, 327, 446, 545, 708, 828, 878, 922}, /* AGG */ 200 {0, 0, 0, 0, 180, 0, 327, 446, 545, 708, 828, 878, 922}, /* AGG */
@@ -202,7 +202,7 @@ static s32 expected_tpt_mimo2_40MHz[4][IWL_RATE_COUNT] = {
202}; 202};
203 203
204/* mbps, mcs */ 204/* mbps, mcs */
205static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { 205static const struct il_rate_mcs_info il_rate_mcs[IL_RATE_COUNT] = {
206 { "1", "BPSK DSSS"}, 206 { "1", "BPSK DSSS"},
207 { "2", "QPSK DSSS"}, 207 { "2", "QPSK DSSS"},
208 {"5.5", "BPSK CCK"}, 208 {"5.5", "BPSK CCK"},
@@ -220,23 +220,23 @@ static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = {
220 220
221#define MCS_INDEX_PER_STREAM (8) 221#define MCS_INDEX_PER_STREAM (8)
222 222
223static inline u8 iwl4965_rs_extract_rate(u32 rate_n_flags) 223static inline u8 il4965_rs_extract_rate(u32 rate_n_flags)
224{ 224{
225 return (u8)(rate_n_flags & 0xFF); 225 return (u8)(rate_n_flags & 0xFF);
226} 226}
227 227
228static void 228static void
229iwl4965_rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) 229il4965_rs_rate_scale_clear_window(struct il_rate_scale_data *window)
230{ 230{
231 window->data = 0; 231 window->data = 0;
232 window->success_counter = 0; 232 window->success_counter = 0;
233 window->success_ratio = IWL_INVALID_VALUE; 233 window->success_ratio = IL_INVALID_VALUE;
234 window->counter = 0; 234 window->counter = 0;
235 window->average_tpt = IWL_INVALID_VALUE; 235 window->average_tpt = IL_INVALID_VALUE;
236 window->stamp = 0; 236 window->stamp = 0;
237} 237}
238 238
239static inline u8 iwl4965_rs_is_valid_ant(u8 valid_antenna, u8 ant_type) 239static inline u8 il4965_rs_is_valid_ant(u8 valid_antenna, u8 ant_type)
240{ 240{
241 return (ant_type & valid_antenna) == ant_type; 241 return (ant_type & valid_antenna) == ant_type;
242} 242}
@@ -246,7 +246,7 @@ static inline u8 iwl4965_rs_is_valid_ant(u8 valid_antenna, u8 ant_type)
246 * TID_MAX_TIME_DIFF, will be deleted. 246 * TID_MAX_TIME_DIFF, will be deleted.
247 */ 247 */
248static void 248static void
249iwl4965_rs_tl_rm_old_stats(struct iwl_traffic_load *tl, u32 curr_time) 249il4965_rs_tl_rm_old_stats(struct il_traffic_load *tl, u32 curr_time)
250{ 250{
251 /* The oldest age we want to keep */ 251 /* The oldest age we want to keep */
252 u32 oldest_time = curr_time - TID_MAX_TIME_DIFF; 252 u32 oldest_time = curr_time - TID_MAX_TIME_DIFF;
@@ -267,13 +267,13 @@ iwl4965_rs_tl_rm_old_stats(struct iwl_traffic_load *tl, u32 curr_time)
267 * increment traffic load value for tid and also remove 267 * increment traffic load value for tid and also remove
268 * any old values if passed the certain time period 268 * any old values if passed the certain time period
269 */ 269 */
270static u8 iwl4965_rs_tl_add_packet(struct iwl_lq_sta *lq_data, 270static u8 il4965_rs_tl_add_packet(struct il_lq_sta *lq_data,
271 struct ieee80211_hdr *hdr) 271 struct ieee80211_hdr *hdr)
272{ 272{
273 u32 curr_time = jiffies_to_msecs(jiffies); 273 u32 curr_time = jiffies_to_msecs(jiffies);
274 u32 time_diff; 274 u32 time_diff;
275 s32 index; 275 s32 index;
276 struct iwl_traffic_load *tl = NULL; 276 struct il_traffic_load *tl = NULL;
277 u8 tid; 277 u8 tid;
278 278
279 if (ieee80211_is_data_qos(hdr->frame_control)) { 279 if (ieee80211_is_data_qos(hdr->frame_control)) {
@@ -305,7 +305,7 @@ static u8 iwl4965_rs_tl_add_packet(struct iwl_lq_sta *lq_data,
305 /* The history is too long: remove data that is older than */ 305 /* The history is too long: remove data that is older than */
306 /* TID_MAX_TIME_DIFF */ 306 /* TID_MAX_TIME_DIFF */
307 if (index >= TID_QUEUE_MAX_SIZE) 307 if (index >= TID_QUEUE_MAX_SIZE)
308 iwl4965_rs_tl_rm_old_stats(tl, curr_time); 308 il4965_rs_tl_rm_old_stats(tl, curr_time);
309 309
310 index = (tl->head + index) % TID_QUEUE_MAX_SIZE; 310 index = (tl->head + index) % TID_QUEUE_MAX_SIZE;
311 tl->packet_count[index] = tl->packet_count[index] + 1; 311 tl->packet_count[index] = tl->packet_count[index] + 1;
@@ -320,12 +320,12 @@ static u8 iwl4965_rs_tl_add_packet(struct iwl_lq_sta *lq_data,
320/* 320/*
321 get the traffic load value for tid 321 get the traffic load value for tid
322*/ 322*/
323static u32 iwl4965_rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid) 323static u32 il4965_rs_tl_get_load(struct il_lq_sta *lq_data, u8 tid)
324{ 324{
325 u32 curr_time = jiffies_to_msecs(jiffies); 325 u32 curr_time = jiffies_to_msecs(jiffies);
326 u32 time_diff; 326 u32 time_diff;
327 s32 index; 327 s32 index;
328 struct iwl_traffic_load *tl = NULL; 328 struct il_traffic_load *tl = NULL;
329 329
330 if (tid >= TID_MAX_LOAD_COUNT) 330 if (tid >= TID_MAX_LOAD_COUNT)
331 return 0; 331 return 0;
@@ -343,22 +343,22 @@ static u32 iwl4965_rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid)
343 /* The history is too long: remove data that is older than */ 343 /* The history is too long: remove data that is older than */
344 /* TID_MAX_TIME_DIFF */ 344 /* TID_MAX_TIME_DIFF */
345 if (index >= TID_QUEUE_MAX_SIZE) 345 if (index >= TID_QUEUE_MAX_SIZE)
346 iwl4965_rs_tl_rm_old_stats(tl, curr_time); 346 il4965_rs_tl_rm_old_stats(tl, curr_time);
347 347
348 return tl->total; 348 return tl->total;
349} 349}
350 350
351static int iwl4965_rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, 351static int il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *priv,
352 struct iwl_lq_sta *lq_data, u8 tid, 352 struct il_lq_sta *lq_data, u8 tid,
353 struct ieee80211_sta *sta) 353 struct ieee80211_sta *sta)
354{ 354{
355 int ret = -EAGAIN; 355 int ret = -EAGAIN;
356 u32 load; 356 u32 load;
357 357
358 load = iwl4965_rs_tl_get_load(lq_data, tid); 358 load = il4965_rs_tl_get_load(lq_data, tid);
359 359
360 if (load > IWL_AGG_LOAD_THRESHOLD) { 360 if (load > IL_AGG_LOAD_THRESHOLD) {
361 IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", 361 IL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n",
362 sta->addr, tid); 362 sta->addr, tid);
363 ret = ieee80211_start_tx_ba_session(sta, tid, 5000); 363 ret = ieee80211_start_tx_ba_session(sta, tid, 5000);
364 if (ret == -EAGAIN) { 364 if (ret == -EAGAIN) {
@@ -367,29 +367,29 @@ static int iwl4965_rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
367 * this might be cause by reloading firmware 367 * this might be cause by reloading firmware
368 * stop the tx ba session here 368 * stop the tx ba session here
369 */ 369 */
370 IWL_ERR(priv, "Fail start Tx agg on tid: %d\n", 370 IL_ERR(priv, "Fail start Tx agg on tid: %d\n",
371 tid); 371 tid);
372 ieee80211_stop_tx_ba_session(sta, tid); 372 ieee80211_stop_tx_ba_session(sta, tid);
373 } 373 }
374 } else { 374 } else {
375 IWL_ERR(priv, "Aggregation not enabled for tid %d " 375 IL_ERR(priv, "Aggregation not enabled for tid %d "
376 "because load = %u\n", tid, load); 376 "because load = %u\n", tid, load);
377 } 377 }
378 return ret; 378 return ret;
379} 379}
380 380
381static void iwl4965_rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, 381static void il4965_rs_tl_turn_on_agg(struct il_priv *priv, u8 tid,
382 struct iwl_lq_sta *lq_data, 382 struct il_lq_sta *lq_data,
383 struct ieee80211_sta *sta) 383 struct ieee80211_sta *sta)
384{ 384{
385 if (tid < TID_MAX_LOAD_COUNT) 385 if (tid < TID_MAX_LOAD_COUNT)
386 iwl4965_rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); 386 il4965_rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta);
387 else 387 else
388 IWL_ERR(priv, "tid exceeds max load count: %d/%d\n", 388 IL_ERR(priv, "tid exceeds max load count: %d/%d\n",
389 tid, TID_MAX_LOAD_COUNT); 389 tid, TID_MAX_LOAD_COUNT);
390} 390}
391 391
392static inline int iwl4965_get_iwl4965_num_of_ant_from_rate(u32 rate_n_flags) 392static inline int il4965_get_il4965_num_of_ant_from_rate(u32 rate_n_flags)
393{ 393{
394 return !!(rate_n_flags & RATE_MCS_ANT_A_MSK) + 394 return !!(rate_n_flags & RATE_MCS_ANT_A_MSK) +
395 !!(rate_n_flags & RATE_MCS_ANT_B_MSK) + 395 !!(rate_n_flags & RATE_MCS_ANT_B_MSK) +
@@ -397,11 +397,11 @@ static inline int iwl4965_get_iwl4965_num_of_ant_from_rate(u32 rate_n_flags)
397} 397}
398 398
399/* 399/*
400 * Static function to get the expected throughput from an iwl_scale_tbl_info 400 * Static function to get the expected throughput from an il_scale_tbl_info
401 * that wraps a NULL pointer check 401 * that wraps a NULL pointer check
402 */ 402 */
403static s32 403static s32
404iwl4965_get_expected_tpt(struct iwl_scale_tbl_info *tbl, int rs_index) 404il4965_get_expected_tpt(struct il_scale_tbl_info *tbl, int rs_index)
405{ 405{
406 if (tbl->expected_tpt) 406 if (tbl->expected_tpt)
407 return tbl->expected_tpt[rs_index]; 407 return tbl->expected_tpt[rs_index];
@@ -409,27 +409,27 @@ iwl4965_get_expected_tpt(struct iwl_scale_tbl_info *tbl, int rs_index)
409} 409}
410 410
411/** 411/**
412 * iwl4965_rs_collect_tx_data - Update the success/failure sliding window 412 * il4965_rs_collect_tx_data - Update the success/failure sliding window
413 * 413 *
414 * We keep a sliding window of the last 62 packets transmitted 414 * We keep a sliding window of the last 62 packets transmitted
415 * at this rate. window->data contains the bitmask of successful 415 * at this rate. window->data contains the bitmask of successful
416 * packets. 416 * packets.
417 */ 417 */
418static int iwl4965_rs_collect_tx_data(struct iwl_scale_tbl_info *tbl, 418static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl,
419 int scale_index, int attempts, int successes) 419 int scale_index, int attempts, int successes)
420{ 420{
421 struct iwl_rate_scale_data *window = NULL; 421 struct il_rate_scale_data *window = NULL;
422 static const u64 mask = (((u64)1) << (IWL_RATE_MAX_WINDOW - 1)); 422 static const u64 mask = (((u64)1) << (IL_RATE_MAX_WINDOW - 1));
423 s32 fail_count, tpt; 423 s32 fail_count, tpt;
424 424
425 if (scale_index < 0 || scale_index >= IWL_RATE_COUNT) 425 if (scale_index < 0 || scale_index >= IL_RATE_COUNT)
426 return -EINVAL; 426 return -EINVAL;
427 427
428 /* Select window for current tx bit rate */ 428 /* Select window for current tx bit rate */
429 window = &(tbl->win[scale_index]); 429 window = &(tbl->win[scale_index]);
430 430
431 /* Get expected throughput */ 431 /* Get expected throughput */
432 tpt = iwl4965_get_expected_tpt(tbl, scale_index); 432 tpt = il4965_get_expected_tpt(tbl, scale_index);
433 433
434 /* 434 /*
435 * Keep track of only the latest 62 tx frame attempts in this rate's 435 * Keep track of only the latest 62 tx frame attempts in this rate's
@@ -440,10 +440,10 @@ static int iwl4965_rs_collect_tx_data(struct iwl_scale_tbl_info *tbl,
440 * we keep these bitmaps!). 440 * we keep these bitmaps!).
441 */ 441 */
442 while (attempts > 0) { 442 while (attempts > 0) {
443 if (window->counter >= IWL_RATE_MAX_WINDOW) { 443 if (window->counter >= IL_RATE_MAX_WINDOW) {
444 444
445 /* remove earliest */ 445 /* remove earliest */
446 window->counter = IWL_RATE_MAX_WINDOW - 1; 446 window->counter = IL_RATE_MAX_WINDOW - 1;
447 447
448 if (window->data & mask) { 448 if (window->data & mask) {
449 window->data &= ~mask; 449 window->data &= ~mask;
@@ -472,16 +472,16 @@ static int iwl4965_rs_collect_tx_data(struct iwl_scale_tbl_info *tbl,
472 window->success_ratio = 128 * (100 * window->success_counter) 472 window->success_ratio = 128 * (100 * window->success_counter)
473 / window->counter; 473 / window->counter;
474 else 474 else
475 window->success_ratio = IWL_INVALID_VALUE; 475 window->success_ratio = IL_INVALID_VALUE;
476 476
477 fail_count = window->counter - window->success_counter; 477 fail_count = window->counter - window->success_counter;
478 478
479 /* Calculate average throughput, if we have enough history. */ 479 /* Calculate average throughput, if we have enough history. */
480 if ((fail_count >= IWL_RATE_MIN_FAILURE_TH) || 480 if ((fail_count >= IL_RATE_MIN_FAILURE_TH) ||
481 (window->success_counter >= IWL_RATE_MIN_SUCCESS_TH)) 481 (window->success_counter >= IL_RATE_MIN_SUCCESS_TH))
482 window->average_tpt = (window->success_ratio * tpt + 64) / 128; 482 window->average_tpt = (window->success_ratio * tpt + 64) / 128;
483 else 483 else
484 window->average_tpt = IWL_INVALID_VALUE; 484 window->average_tpt = IL_INVALID_VALUE;
485 485
486 /* Tag this window as having been updated */ 486 /* Tag this window as having been updated */
487 window->stamp = jiffies; 487 window->stamp = jiffies;
@@ -492,21 +492,21 @@ static int iwl4965_rs_collect_tx_data(struct iwl_scale_tbl_info *tbl,
492/* 492/*
493 * Fill uCode API rate_n_flags field, based on "search" or "active" table. 493 * Fill uCode API rate_n_flags field, based on "search" or "active" table.
494 */ 494 */
495static u32 iwl4965_rate_n_flags_from_tbl(struct iwl_priv *priv, 495static u32 il4965_rate_n_flags_from_tbl(struct il_priv *priv,
496 struct iwl_scale_tbl_info *tbl, 496 struct il_scale_tbl_info *tbl,
497 int index, u8 use_green) 497 int index, u8 use_green)
498{ 498{
499 u32 rate_n_flags = 0; 499 u32 rate_n_flags = 0;
500 500
501 if (is_legacy(tbl->lq_type)) { 501 if (is_legacy(tbl->lq_type)) {
502 rate_n_flags = iwlegacy_rates[index].plcp; 502 rate_n_flags = iwlegacy_rates[index].plcp;
503 if (index >= IWL_FIRST_CCK_RATE && index <= IWL_LAST_CCK_RATE) 503 if (index >= IL_FIRST_CCK_RATE && index <= IL_LAST_CCK_RATE)
504 rate_n_flags |= RATE_MCS_CCK_MSK; 504 rate_n_flags |= RATE_MCS_CCK_MSK;
505 505
506 } else if (is_Ht(tbl->lq_type)) { 506 } else if (is_Ht(tbl->lq_type)) {
507 if (index > IWL_LAST_OFDM_RATE) { 507 if (index > IL_LAST_OFDM_RATE) {
508 IWL_ERR(priv, "Invalid HT rate index %d\n", index); 508 IL_ERR(priv, "Invalid HT rate index %d\n", index);
509 index = IWL_LAST_OFDM_RATE; 509 index = IL_LAST_OFDM_RATE;
510 } 510 }
511 rate_n_flags = RATE_MCS_HT_MSK; 511 rate_n_flags = RATE_MCS_HT_MSK;
512 512
@@ -515,7 +515,7 @@ static u32 iwl4965_rate_n_flags_from_tbl(struct iwl_priv *priv,
515 else 515 else
516 rate_n_flags |= iwlegacy_rates[index].plcp_mimo2; 516 rate_n_flags |= iwlegacy_rates[index].plcp_mimo2;
517 } else { 517 } else {
518 IWL_ERR(priv, "Invalid tbl->lq_type %d\n", tbl->lq_type); 518 IL_ERR(priv, "Invalid tbl->lq_type %d\n", tbl->lq_type);
519 } 519 }
520 520
521 rate_n_flags |= ((tbl->ant_type << RATE_MCS_ANT_POS) & 521 rate_n_flags |= ((tbl->ant_type << RATE_MCS_ANT_POS) &
@@ -535,7 +535,7 @@ static u32 iwl4965_rate_n_flags_from_tbl(struct iwl_priv *priv,
535 rate_n_flags |= RATE_MCS_GF_MSK; 535 rate_n_flags |= RATE_MCS_GF_MSK;
536 if (is_siso(tbl->lq_type) && tbl->is_SGI) { 536 if (is_siso(tbl->lq_type) && tbl->is_SGI) {
537 rate_n_flags &= ~RATE_MCS_SGI_MSK; 537 rate_n_flags &= ~RATE_MCS_SGI_MSK;
538 IWL_ERR(priv, "GF was set with SGI:SISO\n"); 538 IL_ERR(priv, "GF was set with SGI:SISO\n");
539 } 539 }
540 } 540 }
541 } 541 }
@@ -546,19 +546,19 @@ static u32 iwl4965_rate_n_flags_from_tbl(struct iwl_priv *priv,
546 * Interpret uCode API's rate_n_flags format, 546 * Interpret uCode API's rate_n_flags format,
547 * fill "search" or "active" tx mode table. 547 * fill "search" or "active" tx mode table.
548 */ 548 */
549static int iwl4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags, 549static int il4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
550 enum ieee80211_band band, 550 enum ieee80211_band band,
551 struct iwl_scale_tbl_info *tbl, 551 struct il_scale_tbl_info *tbl,
552 int *rate_idx) 552 int *rate_idx)
553{ 553{
554 u32 ant_msk = (rate_n_flags & RATE_MCS_ANT_ABC_MSK); 554 u32 ant_msk = (rate_n_flags & RATE_MCS_ANT_ABC_MSK);
555 u8 iwl4965_num_of_ant = iwl4965_get_iwl4965_num_of_ant_from_rate(rate_n_flags); 555 u8 il4965_num_of_ant = il4965_get_il4965_num_of_ant_from_rate(rate_n_flags);
556 u8 mcs; 556 u8 mcs;
557 557
558 memset(tbl, 0, sizeof(struct iwl_scale_tbl_info)); 558 memset(tbl, 0, sizeof(struct il_scale_tbl_info));
559 *rate_idx = iwl4965_hwrate_to_plcp_idx(rate_n_flags); 559 *rate_idx = il4965_hwrate_to_plcp_idx(rate_n_flags);
560 560
561 if (*rate_idx == IWL_RATE_INVALID) { 561 if (*rate_idx == IL_RATE_INVALID) {
562 *rate_idx = -1; 562 *rate_idx = -1;
563 return -EINVAL; 563 return -EINVAL;
564 } 564 }
@@ -567,11 +567,11 @@ static int iwl4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
567 tbl->is_dup = 0; 567 tbl->is_dup = 0;
568 tbl->ant_type = (ant_msk >> RATE_MCS_ANT_POS); 568 tbl->ant_type = (ant_msk >> RATE_MCS_ANT_POS);
569 tbl->lq_type = LQ_NONE; 569 tbl->lq_type = LQ_NONE;
570 tbl->max_search = IWL_MAX_SEARCH; 570 tbl->max_search = IL_MAX_SEARCH;
571 571
572 /* legacy rate format */ 572 /* legacy rate format */
573 if (!(rate_n_flags & RATE_MCS_HT_MSK)) { 573 if (!(rate_n_flags & RATE_MCS_HT_MSK)) {
574 if (iwl4965_num_of_ant == 1) { 574 if (il4965_num_of_ant == 1) {
575 if (band == IEEE80211_BAND_5GHZ) 575 if (band == IEEE80211_BAND_5GHZ)
576 tbl->lq_type = LQ_A; 576 tbl->lq_type = LQ_A;
577 else 577 else
@@ -589,15 +589,15 @@ static int iwl4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
589 if (rate_n_flags & RATE_MCS_DUP_MSK) 589 if (rate_n_flags & RATE_MCS_DUP_MSK)
590 tbl->is_dup = 1; 590 tbl->is_dup = 1;
591 591
592 mcs = iwl4965_rs_extract_rate(rate_n_flags); 592 mcs = il4965_rs_extract_rate(rate_n_flags);
593 593
594 /* SISO */ 594 /* SISO */
595 if (mcs <= IWL_RATE_SISO_60M_PLCP) { 595 if (mcs <= IL_RATE_SISO_60M_PLCP) {
596 if (iwl4965_num_of_ant == 1) 596 if (il4965_num_of_ant == 1)
597 tbl->lq_type = LQ_SISO; /*else NONE*/ 597 tbl->lq_type = LQ_SISO; /*else NONE*/
598 /* MIMO2 */ 598 /* MIMO2 */
599 } else { 599 } else {
600 if (iwl4965_num_of_ant == 2) 600 if (il4965_num_of_ant == 2)
601 tbl->lq_type = LQ_MIMO2; 601 tbl->lq_type = LQ_MIMO2;
602 } 602 }
603 } 603 }
@@ -606,21 +606,21 @@ static int iwl4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
606 606
607/* switch to another antenna/antennas and return 1 */ 607/* switch to another antenna/antennas and return 1 */
608/* if no other valid antenna found, return 0 */ 608/* if no other valid antenna found, return 0 */
609static int iwl4965_rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags, 609static int il4965_rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags,
610 struct iwl_scale_tbl_info *tbl) 610 struct il_scale_tbl_info *tbl)
611{ 611{
612 u8 new_ant_type; 612 u8 new_ant_type;
613 613
614 if (!tbl->ant_type || tbl->ant_type > ANT_ABC) 614 if (!tbl->ant_type || tbl->ant_type > ANT_ABC)
615 return 0; 615 return 0;
616 616
617 if (!iwl4965_rs_is_valid_ant(valid_ant, tbl->ant_type)) 617 if (!il4965_rs_is_valid_ant(valid_ant, tbl->ant_type))
618 return 0; 618 return 0;
619 619
620 new_ant_type = ant_toggle_lookup[tbl->ant_type]; 620 new_ant_type = ant_toggle_lookup[tbl->ant_type];
621 621
622 while ((new_ant_type != tbl->ant_type) && 622 while ((new_ant_type != tbl->ant_type) &&
623 !iwl4965_rs_is_valid_ant(valid_ant, new_ant_type)) 623 !il4965_rs_is_valid_ant(valid_ant, new_ant_type))
624 new_ant_type = ant_toggle_lookup[new_ant_type]; 624 new_ant_type = ant_toggle_lookup[new_ant_type];
625 625
626 if (new_ant_type == tbl->ant_type) 626 if (new_ant_type == tbl->ant_type)
@@ -636,25 +636,25 @@ static int iwl4965_rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags,
636 * Green-field mode is valid if the station supports it and 636 * Green-field mode is valid if the station supports it and
637 * there are no non-GF stations present in the BSS. 637 * there are no non-GF stations present in the BSS.
638 */ 638 */
639static bool iwl4965_rs_use_green(struct ieee80211_sta *sta) 639static bool il4965_rs_use_green(struct ieee80211_sta *sta)
640{ 640{
641 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 641 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
642 struct iwl_rxon_context *ctx = sta_priv->common.ctx; 642 struct il_rxon_context *ctx = sta_priv->common.ctx;
643 643
644 return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && 644 return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) &&
645 !(ctx->ht.non_gf_sta_present); 645 !(ctx->ht.non_gf_sta_present);
646} 646}
647 647
648/** 648/**
649 * iwl4965_rs_get_supported_rates - get the available rates 649 * il4965_rs_get_supported_rates - get the available rates
650 * 650 *
651 * if management frame or broadcast frame only return 651 * if management frame or broadcast frame only return
652 * basic available rates. 652 * basic available rates.
653 * 653 *
654 */ 654 */
655static u16 iwl4965_rs_get_supported_rates(struct iwl_lq_sta *lq_sta, 655static u16 il4965_rs_get_supported_rates(struct il_lq_sta *lq_sta,
656 struct ieee80211_hdr *hdr, 656 struct ieee80211_hdr *hdr,
657 enum iwl_table_type rate_type) 657 enum il_table_type rate_type)
658{ 658{
659 if (is_legacy(rate_type)) { 659 if (is_legacy(rate_type)) {
660 return lq_sta->active_legacy_rate; 660 return lq_sta->active_legacy_rate;
@@ -667,11 +667,11 @@ static u16 iwl4965_rs_get_supported_rates(struct iwl_lq_sta *lq_sta,
667} 667}
668 668
669static u16 669static u16
670iwl4965_rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask, 670il4965_rs_get_adjacent_rate(struct il_priv *priv, u8 index, u16 rate_mask,
671 int rate_type) 671 int rate_type)
672{ 672{
673 u8 high = IWL_RATE_INVALID; 673 u8 high = IL_RATE_INVALID;
674 u8 low = IWL_RATE_INVALID; 674 u8 low = IL_RATE_INVALID;
675 675
676 /* 802.11A or ht walks to the next literal adjacent rate in 676 /* 802.11A or ht walks to the next literal adjacent rate in
677 * the rate table */ 677 * the rate table */
@@ -690,7 +690,7 @@ iwl4965_rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask,
690 690
691 /* Find the next rate that is in the rate mask */ 691 /* Find the next rate that is in the rate mask */
692 i = index + 1; 692 i = index + 1;
693 for (mask = (1 << i); i < IWL_RATE_COUNT; i++, mask <<= 1) { 693 for (mask = (1 << i); i < IL_RATE_COUNT; i++, mask <<= 1) {
694 if (rate_mask & mask) { 694 if (rate_mask & mask) {
695 high = i; 695 high = i;
696 break; 696 break;
@@ -701,30 +701,30 @@ iwl4965_rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask,
701 } 701 }
702 702
703 low = index; 703 low = index;
704 while (low != IWL_RATE_INVALID) { 704 while (low != IL_RATE_INVALID) {
705 low = iwlegacy_rates[low].prev_rs; 705 low = iwlegacy_rates[low].prev_rs;
706 if (low == IWL_RATE_INVALID) 706 if (low == IL_RATE_INVALID)
707 break; 707 break;
708 if (rate_mask & (1 << low)) 708 if (rate_mask & (1 << low))
709 break; 709 break;
710 IWL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low); 710 IL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low);
711 } 711 }
712 712
713 high = index; 713 high = index;
714 while (high != IWL_RATE_INVALID) { 714 while (high != IL_RATE_INVALID) {
715 high = iwlegacy_rates[high].next_rs; 715 high = iwlegacy_rates[high].next_rs;
716 if (high == IWL_RATE_INVALID) 716 if (high == IL_RATE_INVALID)
717 break; 717 break;
718 if (rate_mask & (1 << high)) 718 if (rate_mask & (1 << high))
719 break; 719 break;
720 IWL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high); 720 IL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high);
721 } 721 }
722 722
723 return (high << 8) | low; 723 return (high << 8) | low;
724} 724}
725 725
726static u32 iwl4965_rs_get_lower_rate(struct iwl_lq_sta *lq_sta, 726static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta,
727 struct iwl_scale_tbl_info *tbl, 727 struct il_scale_tbl_info *tbl,
728 u8 scale_index, u8 ht_possible) 728 u8 scale_index, u8 ht_possible)
729{ 729{
730 s32 low; 730 s32 low;
@@ -732,7 +732,7 @@ static u32 iwl4965_rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
732 u16 high_low; 732 u16 high_low;
733 u8 switch_to_legacy = 0; 733 u8 switch_to_legacy = 0;
734 u8 is_green = lq_sta->is_green; 734 u8 is_green = lq_sta->is_green;
735 struct iwl_priv *priv = lq_sta->drv; 735 struct il_priv *priv = lq_sta->drv;
736 736
737 /* check if we need to switch from HT to legacy rates. 737 /* check if we need to switch from HT to legacy rates.
738 * assumption is that mandatory rates (1Mbps or 6Mbps) 738 * assumption is that mandatory rates (1Mbps or 6Mbps)
@@ -745,23 +745,23 @@ static u32 iwl4965_rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
745 else 745 else
746 tbl->lq_type = LQ_G; 746 tbl->lq_type = LQ_G;
747 747
748 if (iwl4965_num_of_ant(tbl->ant_type) > 1) 748 if (il4965_num_of_ant(tbl->ant_type) > 1)
749 tbl->ant_type = 749 tbl->ant_type =
750 iwl4965_first_antenna(priv->hw_params.valid_tx_ant); 750 il4965_first_antenna(priv->hw_params.valid_tx_ant);
751 751
752 tbl->is_ht40 = 0; 752 tbl->is_ht40 = 0;
753 tbl->is_SGI = 0; 753 tbl->is_SGI = 0;
754 tbl->max_search = IWL_MAX_SEARCH; 754 tbl->max_search = IL_MAX_SEARCH;
755 } 755 }
756 756
757 rate_mask = iwl4965_rs_get_supported_rates(lq_sta, NULL, tbl->lq_type); 757 rate_mask = il4965_rs_get_supported_rates(lq_sta, NULL, tbl->lq_type);
758 758
759 /* Mask with station rate restriction */ 759 /* Mask with station rate restriction */
760 if (is_legacy(tbl->lq_type)) { 760 if (is_legacy(tbl->lq_type)) {
761 /* supp_rates has no CCK bits in A mode */ 761 /* supp_rates has no CCK bits in A mode */
762 if (lq_sta->band == IEEE80211_BAND_5GHZ) 762 if (lq_sta->band == IEEE80211_BAND_5GHZ)
763 rate_mask = (u16)(rate_mask & 763 rate_mask = (u16)(rate_mask &
764 (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); 764 (lq_sta->supp_rates << IL_FIRST_OFDM_RATE));
765 else 765 else
766 rate_mask = (u16)(rate_mask & lq_sta->supp_rates); 766 rate_mask = (u16)(rate_mask & lq_sta->supp_rates);
767 } 767 }
@@ -772,23 +772,23 @@ static u32 iwl4965_rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
772 goto out; 772 goto out;
773 } 773 }
774 774
775 high_low = iwl4965_rs_get_adjacent_rate(lq_sta->drv, 775 high_low = il4965_rs_get_adjacent_rate(lq_sta->drv,
776 scale_index, rate_mask, 776 scale_index, rate_mask,
777 tbl->lq_type); 777 tbl->lq_type);
778 low = high_low & 0xff; 778 low = high_low & 0xff;
779 779
780 if (low == IWL_RATE_INVALID) 780 if (low == IL_RATE_INVALID)
781 low = scale_index; 781 low = scale_index;
782 782
783out: 783out:
784 return iwl4965_rate_n_flags_from_tbl(lq_sta->drv, tbl, low, is_green); 784 return il4965_rate_n_flags_from_tbl(lq_sta->drv, tbl, low, is_green);
785} 785}
786 786
787/* 787/*
788 * Simple function to compare two rate scale table types 788 * Simple function to compare two rate scale table types
789 */ 789 */
790static bool iwl4965_table_type_matches(struct iwl_scale_tbl_info *a, 790static bool il4965_table_type_matches(struct il_scale_tbl_info *a,
791 struct iwl_scale_tbl_info *b) 791 struct il_scale_tbl_info *b)
792{ 792{
793 return (a->lq_type == b->lq_type) && (a->ant_type == b->ant_type) && 793 return (a->lq_type == b->lq_type) && (a->ant_type == b->ant_type) &&
794 (a->is_SGI == b->is_SGI); 794 (a->is_SGI == b->is_SGI);
@@ -798,34 +798,34 @@ static bool iwl4965_table_type_matches(struct iwl_scale_tbl_info *a,
798 * mac80211 sends us Tx status 798 * mac80211 sends us Tx status
799 */ 799 */
800static void 800static void
801iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, 801il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
802 struct ieee80211_sta *sta, void *priv_sta, 802 struct ieee80211_sta *sta, void *priv_sta,
803 struct sk_buff *skb) 803 struct sk_buff *skb)
804{ 804{
805 int legacy_success; 805 int legacy_success;
806 int retries; 806 int retries;
807 int rs_index, mac_index, i; 807 int rs_index, mac_index, i;
808 struct iwl_lq_sta *lq_sta = priv_sta; 808 struct il_lq_sta *lq_sta = priv_sta;
809 struct iwl_link_quality_cmd *table; 809 struct il_link_quality_cmd *table;
810 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 810 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
811 struct iwl_priv *priv = (struct iwl_priv *)priv_r; 811 struct il_priv *priv = (struct il_priv *)priv_r;
812 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 812 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
813 enum mac80211_rate_control_flags mac_flags; 813 enum mac80211_rate_control_flags mac_flags;
814 u32 tx_rate; 814 u32 tx_rate;
815 struct iwl_scale_tbl_info tbl_type; 815 struct il_scale_tbl_info tbl_type;
816 struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; 816 struct il_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl;
817 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 817 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
818 struct iwl_rxon_context *ctx = sta_priv->common.ctx; 818 struct il_rxon_context *ctx = sta_priv->common.ctx;
819 819
820 IWL_DEBUG_RATE_LIMIT(priv, 820 IL_DEBUG_RATE_LIMIT(priv,
821 "get frame ack response, update rate scale window\n"); 821 "get frame ack response, update rate scale window\n");
822 822
823 /* Treat uninitialized rate scaling data same as non-existing. */ 823 /* Treat uninitialized rate scaling data same as non-existing. */
824 if (!lq_sta) { 824 if (!lq_sta) {
825 IWL_DEBUG_RATE(priv, "Station rate scaling not created yet.\n"); 825 IL_DEBUG_RATE(priv, "Station rate scaling not created yet.\n");
826 return; 826 return;
827 } else if (!lq_sta->drv) { 827 } else if (!lq_sta->drv) {
828 IWL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); 828 IL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n");
829 return; 829 return;
830 } 830 }
831 831
@@ -848,23 +848,23 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
848 */ 848 */
849 table = &lq_sta->lq; 849 table = &lq_sta->lq;
850 tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); 850 tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags);
851 iwl4965_rs_get_tbl_info_from_mcs(tx_rate, 851 il4965_rs_get_tbl_info_from_mcs(tx_rate,
852 priv->band, &tbl_type, &rs_index); 852 priv->band, &tbl_type, &rs_index);
853 if (priv->band == IEEE80211_BAND_5GHZ) 853 if (priv->band == IEEE80211_BAND_5GHZ)
854 rs_index -= IWL_FIRST_OFDM_RATE; 854 rs_index -= IL_FIRST_OFDM_RATE;
855 mac_flags = info->status.rates[0].flags; 855 mac_flags = info->status.rates[0].flags;
856 mac_index = info->status.rates[0].idx; 856 mac_index = info->status.rates[0].idx;
857 /* For HT packets, map MCS to PLCP */ 857 /* For HT packets, map MCS to PLCP */
858 if (mac_flags & IEEE80211_TX_RC_MCS) { 858 if (mac_flags & IEEE80211_TX_RC_MCS) {
859 mac_index &= RATE_MCS_CODE_MSK; /* Remove # of streams */ 859 mac_index &= RATE_MCS_CODE_MSK; /* Remove # of streams */
860 if (mac_index >= (IWL_RATE_9M_INDEX - IWL_FIRST_OFDM_RATE)) 860 if (mac_index >= (IL_RATE_9M_INDEX - IL_FIRST_OFDM_RATE))
861 mac_index++; 861 mac_index++;
862 /* 862 /*
863 * mac80211 HT index is always zero-indexed; we need to move 863 * mac80211 HT index is always zero-indexed; we need to move
864 * HT OFDM rates after CCK rates in 2.4 GHz band 864 * HT OFDM rates after CCK rates in 2.4 GHz band
865 */ 865 */
866 if (priv->band == IEEE80211_BAND_2GHZ) 866 if (priv->band == IEEE80211_BAND_2GHZ)
867 mac_index += IWL_FIRST_OFDM_RATE; 867 mac_index += IL_FIRST_OFDM_RATE;
868 } 868 }
869 /* Here we actually compare this rate to the latest LQ command */ 869 /* Here we actually compare this rate to the latest LQ command */
870 if ((mac_index < 0) || 870 if ((mac_index < 0) ||
@@ -880,18 +880,18 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
880 (!!(tx_rate & RATE_MCS_GF_MSK) != 880 (!!(tx_rate & RATE_MCS_GF_MSK) !=
881 !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD)) || 881 !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD)) ||
882 (rs_index != mac_index)) { 882 (rs_index != mac_index)) {
883 IWL_DEBUG_RATE(priv, 883 IL_DEBUG_RATE(priv,
884 "initial rate %d does not match %d (0x%x)\n", 884 "initial rate %d does not match %d (0x%x)\n",
885 mac_index, rs_index, tx_rate); 885 mac_index, rs_index, tx_rate);
886 /* 886 /*
887 * Since rates mis-match, the last LQ command may have failed. 887 * Since rates mis-match, the last LQ command may have failed.
888 * After IWL_MISSED_RATE_MAX mis-matches, resync the uCode with 888 * After IL_MISSED_RATE_MAX mis-matches, resync the uCode with
889 * ... driver. 889 * ... driver.
890 */ 890 */
891 lq_sta->missed_rate_counter++; 891 lq_sta->missed_rate_counter++;
892 if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) { 892 if (lq_sta->missed_rate_counter > IL_MISSED_RATE_MAX) {
893 lq_sta->missed_rate_counter = 0; 893 lq_sta->missed_rate_counter = 0;
894 iwl_legacy_send_lq_cmd(priv, ctx, &lq_sta->lq, 894 il_send_lq_cmd(priv, ctx, &lq_sta->lq,
895 CMD_ASYNC, false); 895 CMD_ASYNC, false);
896 } 896 }
897 /* Regardless, ignore this status info for outdated rate */ 897 /* Regardless, ignore this status info for outdated rate */
@@ -901,30 +901,30 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
901 lq_sta->missed_rate_counter = 0; 901 lq_sta->missed_rate_counter = 0;
902 902
903 /* Figure out if rate scale algorithm is in active or search table */ 903 /* Figure out if rate scale algorithm is in active or search table */
904 if (iwl4965_table_type_matches(&tbl_type, 904 if (il4965_table_type_matches(&tbl_type,
905 &(lq_sta->lq_info[lq_sta->active_tbl]))) { 905 &(lq_sta->lq_info[lq_sta->active_tbl]))) {
906 curr_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 906 curr_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
907 other_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); 907 other_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]);
908 } else if (iwl4965_table_type_matches(&tbl_type, 908 } else if (il4965_table_type_matches(&tbl_type,
909 &lq_sta->lq_info[1 - lq_sta->active_tbl])) { 909 &lq_sta->lq_info[1 - lq_sta->active_tbl])) {
910 curr_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); 910 curr_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]);
911 other_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 911 other_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
912 } else { 912 } else {
913 IWL_DEBUG_RATE(priv, 913 IL_DEBUG_RATE(priv,
914 "Neither active nor search matches tx rate\n"); 914 "Neither active nor search matches tx rate\n");
915 tmp_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 915 tmp_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
916 IWL_DEBUG_RATE(priv, "active- lq:%x, ant:%x, SGI:%d\n", 916 IL_DEBUG_RATE(priv, "active- lq:%x, ant:%x, SGI:%d\n",
917 tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); 917 tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI);
918 tmp_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); 918 tmp_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]);
919 IWL_DEBUG_RATE(priv, "search- lq:%x, ant:%x, SGI:%d\n", 919 IL_DEBUG_RATE(priv, "search- lq:%x, ant:%x, SGI:%d\n",
920 tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); 920 tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI);
921 IWL_DEBUG_RATE(priv, "actual- lq:%x, ant:%x, SGI:%d\n", 921 IL_DEBUG_RATE(priv, "actual- lq:%x, ant:%x, SGI:%d\n",
922 tbl_type.lq_type, tbl_type.ant_type, tbl_type.is_SGI); 922 tbl_type.lq_type, tbl_type.ant_type, tbl_type.is_SGI);
923 /* 923 /*
924 * no matching table found, let's by-pass the data collection 924 * no matching table found, let's by-pass the data collection
925 * and continue to perform rate scale to find the rate table 925 * and continue to perform rate scale to find the rate table
926 */ 926 */
927 iwl4965_rs_stay_in_table(lq_sta, true); 927 il4965_rs_stay_in_table(lq_sta, true);
928 goto done; 928 goto done;
929 } 929 }
930 930
@@ -937,9 +937,9 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
937 */ 937 */
938 if (info->flags & IEEE80211_TX_STAT_AMPDU) { 938 if (info->flags & IEEE80211_TX_STAT_AMPDU) {
939 tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); 939 tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags);
940 iwl4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, 940 il4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type,
941 &rs_index); 941 &rs_index);
942 iwl4965_rs_collect_tx_data(curr_tbl, rs_index, 942 il4965_rs_collect_tx_data(curr_tbl, rs_index,
943 info->status.ampdu_len, 943 info->status.ampdu_len,
944 info->status.ampdu_ack_len); 944 info->status.ampdu_ack_len);
945 945
@@ -962,20 +962,20 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
962 /* Collect data for each rate used during failed TX attempts */ 962 /* Collect data for each rate used during failed TX attempts */
963 for (i = 0; i <= retries; ++i) { 963 for (i = 0; i <= retries; ++i) {
964 tx_rate = le32_to_cpu(table->rs_table[i].rate_n_flags); 964 tx_rate = le32_to_cpu(table->rs_table[i].rate_n_flags);
965 iwl4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, 965 il4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band,
966 &tbl_type, &rs_index); 966 &tbl_type, &rs_index);
967 /* 967 /*
968 * Only collect stats if retried rate is in the same RS 968 * Only collect stats if retried rate is in the same RS
969 * table as active/search. 969 * table as active/search.
970 */ 970 */
971 if (iwl4965_table_type_matches(&tbl_type, curr_tbl)) 971 if (il4965_table_type_matches(&tbl_type, curr_tbl))
972 tmp_tbl = curr_tbl; 972 tmp_tbl = curr_tbl;
973 else if (iwl4965_table_type_matches(&tbl_type, 973 else if (il4965_table_type_matches(&tbl_type,
974 other_tbl)) 974 other_tbl))
975 tmp_tbl = other_tbl; 975 tmp_tbl = other_tbl;
976 else 976 else
977 continue; 977 continue;
978 iwl4965_rs_collect_tx_data(tmp_tbl, rs_index, 1, 978 il4965_rs_collect_tx_data(tmp_tbl, rs_index, 1,
979 i < retries ? 0 : legacy_success); 979 i < retries ? 0 : legacy_success);
980 } 980 }
981 981
@@ -990,7 +990,7 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
990done: 990done:
991 /* See if there's a better rate or modulation mode to try. */ 991 /* See if there's a better rate or modulation mode to try. */
992 if (sta && sta->supp_rates[sband->band]) 992 if (sta && sta->supp_rates[sband->band])
993 iwl4965_rs_rate_scale_perform(priv, skb, sta, lq_sta); 993 il4965_rs_rate_scale_perform(priv, skb, sta, lq_sta);
994} 994}
995 995
996/* 996/*
@@ -1001,19 +1001,19 @@ done:
1001 * These control how long we stay using same modulation mode before 1001 * These control how long we stay using same modulation mode before
1002 * searching for a new mode. 1002 * searching for a new mode.
1003 */ 1003 */
1004static void iwl4965_rs_set_stay_in_table(struct iwl_priv *priv, u8 is_legacy, 1004static void il4965_rs_set_stay_in_table(struct il_priv *priv, u8 is_legacy,
1005 struct iwl_lq_sta *lq_sta) 1005 struct il_lq_sta *lq_sta)
1006{ 1006{
1007 IWL_DEBUG_RATE(priv, "we are staying in the same table\n"); 1007 IL_DEBUG_RATE(priv, "we are staying in the same table\n");
1008 lq_sta->stay_in_tbl = 1; /* only place this gets set */ 1008 lq_sta->stay_in_tbl = 1; /* only place this gets set */
1009 if (is_legacy) { 1009 if (is_legacy) {
1010 lq_sta->table_count_limit = IWL_LEGACY_TABLE_COUNT; 1010 lq_sta->table_count_limit = IL_LEGACY_TABLE_COUNT;
1011 lq_sta->max_failure_limit = IWL_LEGACY_FAILURE_LIMIT; 1011 lq_sta->max_failure_limit = IL_LEGACY_FAILURE_LIMIT;
1012 lq_sta->max_success_limit = IWL_LEGACY_SUCCESS_LIMIT; 1012 lq_sta->max_success_limit = IL_LEGACY_SUCCESS_LIMIT;
1013 } else { 1013 } else {
1014 lq_sta->table_count_limit = IWL_NONE_LEGACY_TABLE_COUNT; 1014 lq_sta->table_count_limit = IL_NONE_LEGACY_TABLE_COUNT;
1015 lq_sta->max_failure_limit = IWL_NONE_LEGACY_FAILURE_LIMIT; 1015 lq_sta->max_failure_limit = IL_NONE_LEGACY_FAILURE_LIMIT;
1016 lq_sta->max_success_limit = IWL_NONE_LEGACY_SUCCESS_LIMIT; 1016 lq_sta->max_success_limit = IL_NONE_LEGACY_SUCCESS_LIMIT;
1017 } 1017 }
1018 lq_sta->table_count = 0; 1018 lq_sta->table_count = 0;
1019 lq_sta->total_failed = 0; 1019 lq_sta->total_failed = 0;
@@ -1025,11 +1025,11 @@ static void iwl4965_rs_set_stay_in_table(struct iwl_priv *priv, u8 is_legacy,
1025/* 1025/*
1026 * Find correct throughput table for given mode of modulation 1026 * Find correct throughput table for given mode of modulation
1027 */ 1027 */
1028static void iwl4965_rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, 1028static void il4965_rs_set_expected_tpt_table(struct il_lq_sta *lq_sta,
1029 struct iwl_scale_tbl_info *tbl) 1029 struct il_scale_tbl_info *tbl)
1030{ 1030{
1031 /* Used to choose among HT tables */ 1031 /* Used to choose among HT tables */
1032 s32 (*ht_tbl_pointer)[IWL_RATE_COUNT]; 1032 s32 (*ht_tbl_pointer)[IL_RATE_COUNT];
1033 1033
1034 /* Check for invalid LQ type */ 1034 /* Check for invalid LQ type */
1035 if (WARN_ON_ONCE(!is_legacy(tbl->lq_type) && !is_Ht(tbl->lq_type))) { 1035 if (WARN_ON_ONCE(!is_legacy(tbl->lq_type) && !is_Ht(tbl->lq_type))) {
@@ -1077,13 +1077,13 @@ static void iwl4965_rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta,
1077 * to decrease to match "active" throughput. When moving from MIMO to SISO, 1077 * to decrease to match "active" throughput. When moving from MIMO to SISO,
1078 * bit rate will typically need to increase, but not if performance was bad. 1078 * bit rate will typically need to increase, but not if performance was bad.
1079 */ 1079 */
1080static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv, 1080static s32 il4965_rs_get_best_rate(struct il_priv *priv,
1081 struct iwl_lq_sta *lq_sta, 1081 struct il_lq_sta *lq_sta,
1082 struct iwl_scale_tbl_info *tbl, /* "search" */ 1082 struct il_scale_tbl_info *tbl, /* "search" */
1083 u16 rate_mask, s8 index) 1083 u16 rate_mask, s8 index)
1084{ 1084{
1085 /* "active" values */ 1085 /* "active" values */
1086 struct iwl_scale_tbl_info *active_tbl = 1086 struct il_scale_tbl_info *active_tbl =
1087 &(lq_sta->lq_info[lq_sta->active_tbl]); 1087 &(lq_sta->lq_info[lq_sta->active_tbl]);
1088 s32 active_sr = active_tbl->win[index].success_ratio; 1088 s32 active_sr = active_tbl->win[index].success_ratio;
1089 s32 active_tpt = active_tbl->expected_tpt[index]; 1089 s32 active_tpt = active_tbl->expected_tpt[index];
@@ -1095,10 +1095,10 @@ static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv,
1095 u16 high_low; 1095 u16 high_low;
1096 s8 rate = index; 1096 s8 rate = index;
1097 1097
1098 new_rate = high = low = start_hi = IWL_RATE_INVALID; 1098 new_rate = high = low = start_hi = IL_RATE_INVALID;
1099 1099
1100 for (; ;) { 1100 for (; ;) {
1101 high_low = iwl4965_rs_get_adjacent_rate(priv, rate, rate_mask, 1101 high_low = il4965_rs_get_adjacent_rate(priv, rate, rate_mask,
1102 tbl->lq_type); 1102 tbl->lq_type);
1103 1103
1104 low = high_low & 0xff; 1104 low = high_low & 0xff;
@@ -1120,16 +1120,16 @@ static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv,
1120 * "active" throughput (under perfect conditions). 1120 * "active" throughput (under perfect conditions).
1121 */ 1121 */
1122 if ((((100 * tpt_tbl[rate]) > lq_sta->last_tpt) && 1122 if ((((100 * tpt_tbl[rate]) > lq_sta->last_tpt) &&
1123 ((active_sr > IWL_RATE_DECREASE_TH) && 1123 ((active_sr > IL_RATE_DECREASE_TH) &&
1124 (active_sr <= IWL_RATE_HIGH_TH) && 1124 (active_sr <= IL_RATE_HIGH_TH) &&
1125 (tpt_tbl[rate] <= active_tpt))) || 1125 (tpt_tbl[rate] <= active_tpt))) ||
1126 ((active_sr >= IWL_RATE_SCALE_SWITCH) && 1126 ((active_sr >= IL_RATE_SCALE_SWITCH) &&
1127 (tpt_tbl[rate] > active_tpt))) { 1127 (tpt_tbl[rate] > active_tpt))) {
1128 1128
1129 /* (2nd or later pass) 1129 /* (2nd or later pass)
1130 * If we've already tried to raise the rate, and are 1130 * If we've already tried to raise the rate, and are
1131 * now trying to lower it, use the higher rate. */ 1131 * now trying to lower it, use the higher rate. */
1132 if (start_hi != IWL_RATE_INVALID) { 1132 if (start_hi != IL_RATE_INVALID) {
1133 new_rate = start_hi; 1133 new_rate = start_hi;
1134 break; 1134 break;
1135 } 1135 }
@@ -1137,7 +1137,7 @@ static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv,
1137 new_rate = rate; 1137 new_rate = rate;
1138 1138
1139 /* Loop again with lower rate */ 1139 /* Loop again with lower rate */
1140 if (low != IWL_RATE_INVALID) 1140 if (low != IL_RATE_INVALID)
1141 rate = low; 1141 rate = low;
1142 1142
1143 /* Lower rate not available, use the original */ 1143 /* Lower rate not available, use the original */
@@ -1149,11 +1149,11 @@ static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv,
1149 /* (2nd or later pass) 1149 /* (2nd or later pass)
1150 * If we've already tried to lower the rate, and are 1150 * If we've already tried to lower the rate, and are
1151 * now trying to raise it, use the lower rate. */ 1151 * now trying to raise it, use the lower rate. */
1152 if (new_rate != IWL_RATE_INVALID) 1152 if (new_rate != IL_RATE_INVALID)
1153 break; 1153 break;
1154 1154
1155 /* Loop again with higher rate */ 1155 /* Loop again with higher rate */
1156 else if (high != IWL_RATE_INVALID) { 1156 else if (high != IL_RATE_INVALID) {
1157 start_hi = high; 1157 start_hi = high;
1158 rate = high; 1158 rate = high;
1159 1159
@@ -1171,17 +1171,17 @@ static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv,
1171/* 1171/*
1172 * Set up search table for MIMO2 1172 * Set up search table for MIMO2
1173 */ 1173 */
1174static int iwl4965_rs_switch_to_mimo2(struct iwl_priv *priv, 1174static int il4965_rs_switch_to_mimo2(struct il_priv *priv,
1175 struct iwl_lq_sta *lq_sta, 1175 struct il_lq_sta *lq_sta,
1176 struct ieee80211_conf *conf, 1176 struct ieee80211_conf *conf,
1177 struct ieee80211_sta *sta, 1177 struct ieee80211_sta *sta,
1178 struct iwl_scale_tbl_info *tbl, int index) 1178 struct il_scale_tbl_info *tbl, int index)
1179{ 1179{
1180 u16 rate_mask; 1180 u16 rate_mask;
1181 s32 rate; 1181 s32 rate;
1182 s8 is_green = lq_sta->is_green; 1182 s8 is_green = lq_sta->is_green;
1183 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 1183 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
1184 struct iwl_rxon_context *ctx = sta_priv->common.ctx; 1184 struct il_rxon_context *ctx = sta_priv->common.ctx;
1185 1185
1186 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) 1186 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported)
1187 return -1; 1187 return -1;
@@ -1194,35 +1194,35 @@ static int iwl4965_rs_switch_to_mimo2(struct iwl_priv *priv,
1194 if (priv->hw_params.tx_chains_num < 2) 1194 if (priv->hw_params.tx_chains_num < 2)
1195 return -1; 1195 return -1;
1196 1196
1197 IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n"); 1197 IL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n");
1198 1198
1199 tbl->lq_type = LQ_MIMO2; 1199 tbl->lq_type = LQ_MIMO2;
1200 tbl->is_dup = lq_sta->is_dup; 1200 tbl->is_dup = lq_sta->is_dup;
1201 tbl->action = 0; 1201 tbl->action = 0;
1202 tbl->max_search = IWL_MAX_SEARCH; 1202 tbl->max_search = IL_MAX_SEARCH;
1203 rate_mask = lq_sta->active_mimo2_rate; 1203 rate_mask = lq_sta->active_mimo2_rate;
1204 1204
1205 if (iwl_legacy_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) 1205 if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
1206 tbl->is_ht40 = 1; 1206 tbl->is_ht40 = 1;
1207 else 1207 else
1208 tbl->is_ht40 = 0; 1208 tbl->is_ht40 = 0;
1209 1209
1210 iwl4965_rs_set_expected_tpt_table(lq_sta, tbl); 1210 il4965_rs_set_expected_tpt_table(lq_sta, tbl);
1211 1211
1212 rate = iwl4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); 1212 rate = il4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index);
1213 1213
1214 IWL_DEBUG_RATE(priv, "LQ: MIMO2 best rate %d mask %X\n", 1214 IL_DEBUG_RATE(priv, "LQ: MIMO2 best rate %d mask %X\n",
1215 rate, rate_mask); 1215 rate, rate_mask);
1216 if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { 1216 if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) {
1217 IWL_DEBUG_RATE(priv, 1217 IL_DEBUG_RATE(priv,
1218 "Can't switch with index %d rate mask %x\n", 1218 "Can't switch with index %d rate mask %x\n",
1219 rate, rate_mask); 1219 rate, rate_mask);
1220 return -1; 1220 return -1;
1221 } 1221 }
1222 tbl->current_rate = iwl4965_rate_n_flags_from_tbl(priv, 1222 tbl->current_rate = il4965_rate_n_flags_from_tbl(priv,
1223 tbl, rate, is_green); 1223 tbl, rate, is_green);
1224 1224
1225 IWL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", 1225 IL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n",
1226 tbl->current_rate, is_green); 1226 tbl->current_rate, is_green);
1227 return 0; 1227 return 0;
1228} 1228}
@@ -1230,30 +1230,30 @@ static int iwl4965_rs_switch_to_mimo2(struct iwl_priv *priv,
1230/* 1230/*
1231 * Set up search table for SISO 1231 * Set up search table for SISO
1232 */ 1232 */
1233static int iwl4965_rs_switch_to_siso(struct iwl_priv *priv, 1233static int il4965_rs_switch_to_siso(struct il_priv *priv,
1234 struct iwl_lq_sta *lq_sta, 1234 struct il_lq_sta *lq_sta,
1235 struct ieee80211_conf *conf, 1235 struct ieee80211_conf *conf,
1236 struct ieee80211_sta *sta, 1236 struct ieee80211_sta *sta,
1237 struct iwl_scale_tbl_info *tbl, int index) 1237 struct il_scale_tbl_info *tbl, int index)
1238{ 1238{
1239 u16 rate_mask; 1239 u16 rate_mask;
1240 u8 is_green = lq_sta->is_green; 1240 u8 is_green = lq_sta->is_green;
1241 s32 rate; 1241 s32 rate;
1242 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 1242 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
1243 struct iwl_rxon_context *ctx = sta_priv->common.ctx; 1243 struct il_rxon_context *ctx = sta_priv->common.ctx;
1244 1244
1245 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) 1245 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported)
1246 return -1; 1246 return -1;
1247 1247
1248 IWL_DEBUG_RATE(priv, "LQ: try to switch to SISO\n"); 1248 IL_DEBUG_RATE(priv, "LQ: try to switch to SISO\n");
1249 1249
1250 tbl->is_dup = lq_sta->is_dup; 1250 tbl->is_dup = lq_sta->is_dup;
1251 tbl->lq_type = LQ_SISO; 1251 tbl->lq_type = LQ_SISO;
1252 tbl->action = 0; 1252 tbl->action = 0;
1253 tbl->max_search = IWL_MAX_SEARCH; 1253 tbl->max_search = IL_MAX_SEARCH;
1254 rate_mask = lq_sta->active_siso_rate; 1254 rate_mask = lq_sta->active_siso_rate;
1255 1255
1256 if (iwl_legacy_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) 1256 if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
1257 tbl->is_ht40 = 1; 1257 tbl->is_ht40 = 1;
1258 else 1258 else
1259 tbl->is_ht40 = 0; 1259 tbl->is_ht40 = 0;
@@ -1261,19 +1261,19 @@ static int iwl4965_rs_switch_to_siso(struct iwl_priv *priv,
1261 if (is_green) 1261 if (is_green)
1262 tbl->is_SGI = 0; /*11n spec: no SGI in SISO+Greenfield*/ 1262 tbl->is_SGI = 0; /*11n spec: no SGI in SISO+Greenfield*/
1263 1263
1264 iwl4965_rs_set_expected_tpt_table(lq_sta, tbl); 1264 il4965_rs_set_expected_tpt_table(lq_sta, tbl);
1265 rate = iwl4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); 1265 rate = il4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index);
1266 1266
1267 IWL_DEBUG_RATE(priv, "LQ: get best rate %d mask %X\n", rate, rate_mask); 1267 IL_DEBUG_RATE(priv, "LQ: get best rate %d mask %X\n", rate, rate_mask);
1268 if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { 1268 if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) {
1269 IWL_DEBUG_RATE(priv, 1269 IL_DEBUG_RATE(priv,
1270 "can not switch with index %d rate mask %x\n", 1270 "can not switch with index %d rate mask %x\n",
1271 rate, rate_mask); 1271 rate, rate_mask);
1272 return -1; 1272 return -1;
1273 } 1273 }
1274 tbl->current_rate = iwl4965_rate_n_flags_from_tbl(priv, 1274 tbl->current_rate = il4965_rate_n_flags_from_tbl(priv,
1275 tbl, rate, is_green); 1275 tbl, rate, is_green);
1276 IWL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", 1276 IL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n",
1277 tbl->current_rate, is_green); 1277 tbl->current_rate, is_green);
1278 return 0; 1278 return 0;
1279} 1279}
@@ -1281,62 +1281,62 @@ static int iwl4965_rs_switch_to_siso(struct iwl_priv *priv,
1281/* 1281/*
1282 * Try to switch to new modulation mode from legacy 1282 * Try to switch to new modulation mode from legacy
1283 */ 1283 */
1284static int iwl4965_rs_move_legacy_other(struct iwl_priv *priv, 1284static int il4965_rs_move_legacy_other(struct il_priv *priv,
1285 struct iwl_lq_sta *lq_sta, 1285 struct il_lq_sta *lq_sta,
1286 struct ieee80211_conf *conf, 1286 struct ieee80211_conf *conf,
1287 struct ieee80211_sta *sta, 1287 struct ieee80211_sta *sta,
1288 int index) 1288 int index)
1289{ 1289{
1290 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1290 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1291 struct iwl_scale_tbl_info *search_tbl = 1291 struct il_scale_tbl_info *search_tbl =
1292 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1292 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
1293 struct iwl_rate_scale_data *window = &(tbl->win[index]); 1293 struct il_rate_scale_data *window = &(tbl->win[index]);
1294 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1294 u32 sz = (sizeof(struct il_scale_tbl_info) -
1295 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1295 (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT));
1296 u8 start_action; 1296 u8 start_action;
1297 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1297 u8 valid_tx_ant = priv->hw_params.valid_tx_ant;
1298 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1298 u8 tx_chains_num = priv->hw_params.tx_chains_num;
1299 int ret = 0; 1299 int ret = 0;
1300 u8 update_search_tbl_counter = 0; 1300 u8 update_search_tbl_counter = 0;
1301 1301
1302 tbl->action = IWL_LEGACY_SWITCH_SISO; 1302 tbl->action = IL_LEGACY_SWITCH_SISO;
1303 1303
1304 start_action = tbl->action; 1304 start_action = tbl->action;
1305 for (; ;) { 1305 for (; ;) {
1306 lq_sta->action_counter++; 1306 lq_sta->action_counter++;
1307 switch (tbl->action) { 1307 switch (tbl->action) {
1308 case IWL_LEGACY_SWITCH_ANTENNA1: 1308 case IL_LEGACY_SWITCH_ANTENNA1:
1309 case IWL_LEGACY_SWITCH_ANTENNA2: 1309 case IL_LEGACY_SWITCH_ANTENNA2:
1310 IWL_DEBUG_RATE(priv, "LQ: Legacy toggle Antenna\n"); 1310 IL_DEBUG_RATE(priv, "LQ: Legacy toggle Antenna\n");
1311 1311
1312 if ((tbl->action == IWL_LEGACY_SWITCH_ANTENNA1 && 1312 if ((tbl->action == IL_LEGACY_SWITCH_ANTENNA1 &&
1313 tx_chains_num <= 1) || 1313 tx_chains_num <= 1) ||
1314 (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2 && 1314 (tbl->action == IL_LEGACY_SWITCH_ANTENNA2 &&
1315 tx_chains_num <= 2)) 1315 tx_chains_num <= 2))
1316 break; 1316 break;
1317 1317
1318 /* Don't change antenna if success has been great */ 1318 /* Don't change antenna if success has been great */
1319 if (window->success_ratio >= IWL_RS_GOOD_RATIO) 1319 if (window->success_ratio >= IL_RS_GOOD_RATIO)
1320 break; 1320 break;
1321 1321
1322 /* Set up search table to try other antenna */ 1322 /* Set up search table to try other antenna */
1323 memcpy(search_tbl, tbl, sz); 1323 memcpy(search_tbl, tbl, sz);
1324 1324
1325 if (iwl4965_rs_toggle_antenna(valid_tx_ant, 1325 if (il4965_rs_toggle_antenna(valid_tx_ant,
1326 &search_tbl->current_rate, search_tbl)) { 1326 &search_tbl->current_rate, search_tbl)) {
1327 update_search_tbl_counter = 1; 1327 update_search_tbl_counter = 1;
1328 iwl4965_rs_set_expected_tpt_table(lq_sta, 1328 il4965_rs_set_expected_tpt_table(lq_sta,
1329 search_tbl); 1329 search_tbl);
1330 goto out; 1330 goto out;
1331 } 1331 }
1332 break; 1332 break;
1333 case IWL_LEGACY_SWITCH_SISO: 1333 case IL_LEGACY_SWITCH_SISO:
1334 IWL_DEBUG_RATE(priv, "LQ: Legacy switch to SISO\n"); 1334 IL_DEBUG_RATE(priv, "LQ: Legacy switch to SISO\n");
1335 1335
1336 /* Set up search table to try SISO */ 1336 /* Set up search table to try SISO */
1337 memcpy(search_tbl, tbl, sz); 1337 memcpy(search_tbl, tbl, sz);
1338 search_tbl->is_SGI = 0; 1338 search_tbl->is_SGI = 0;
1339 ret = iwl4965_rs_switch_to_siso(priv, lq_sta, conf, sta, 1339 ret = il4965_rs_switch_to_siso(priv, lq_sta, conf, sta,
1340 search_tbl, index); 1340 search_tbl, index);
1341 if (!ret) { 1341 if (!ret) {
1342 lq_sta->action_counter = 0; 1342 lq_sta->action_counter = 0;
@@ -1344,27 +1344,27 @@ static int iwl4965_rs_move_legacy_other(struct iwl_priv *priv,
1344 } 1344 }
1345 1345
1346 break; 1346 break;
1347 case IWL_LEGACY_SWITCH_MIMO2_AB: 1347 case IL_LEGACY_SWITCH_MIMO2_AB:
1348 case IWL_LEGACY_SWITCH_MIMO2_AC: 1348 case IL_LEGACY_SWITCH_MIMO2_AC:
1349 case IWL_LEGACY_SWITCH_MIMO2_BC: 1349 case IL_LEGACY_SWITCH_MIMO2_BC:
1350 IWL_DEBUG_RATE(priv, "LQ: Legacy switch to MIMO2\n"); 1350 IL_DEBUG_RATE(priv, "LQ: Legacy switch to MIMO2\n");
1351 1351
1352 /* Set up search table to try MIMO */ 1352 /* Set up search table to try MIMO */
1353 memcpy(search_tbl, tbl, sz); 1353 memcpy(search_tbl, tbl, sz);
1354 search_tbl->is_SGI = 0; 1354 search_tbl->is_SGI = 0;
1355 1355
1356 if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AB) 1356 if (tbl->action == IL_LEGACY_SWITCH_MIMO2_AB)
1357 search_tbl->ant_type = ANT_AB; 1357 search_tbl->ant_type = ANT_AB;
1358 else if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AC) 1358 else if (tbl->action == IL_LEGACY_SWITCH_MIMO2_AC)
1359 search_tbl->ant_type = ANT_AC; 1359 search_tbl->ant_type = ANT_AC;
1360 else 1360 else
1361 search_tbl->ant_type = ANT_BC; 1361 search_tbl->ant_type = ANT_BC;
1362 1362
1363 if (!iwl4965_rs_is_valid_ant(valid_tx_ant, 1363 if (!il4965_rs_is_valid_ant(valid_tx_ant,
1364 search_tbl->ant_type)) 1364 search_tbl->ant_type))
1365 break; 1365 break;
1366 1366
1367 ret = iwl4965_rs_switch_to_mimo2(priv, lq_sta, 1367 ret = il4965_rs_switch_to_mimo2(priv, lq_sta,
1368 conf, sta, 1368 conf, sta,
1369 search_tbl, index); 1369 search_tbl, index);
1370 if (!ret) { 1370 if (!ret) {
@@ -1374,8 +1374,8 @@ static int iwl4965_rs_move_legacy_other(struct iwl_priv *priv,
1374 break; 1374 break;
1375 } 1375 }
1376 tbl->action++; 1376 tbl->action++;
1377 if (tbl->action > IWL_LEGACY_SWITCH_MIMO2_BC) 1377 if (tbl->action > IL_LEGACY_SWITCH_MIMO2_BC)
1378 tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; 1378 tbl->action = IL_LEGACY_SWITCH_ANTENNA1;
1379 1379
1380 if (tbl->action == start_action) 1380 if (tbl->action == start_action)
1381 break; 1381 break;
@@ -1387,8 +1387,8 @@ static int iwl4965_rs_move_legacy_other(struct iwl_priv *priv,
1387out: 1387out:
1388 lq_sta->search_better_tbl = 1; 1388 lq_sta->search_better_tbl = 1;
1389 tbl->action++; 1389 tbl->action++;
1390 if (tbl->action > IWL_LEGACY_SWITCH_MIMO2_BC) 1390 if (tbl->action > IL_LEGACY_SWITCH_MIMO2_BC)
1391 tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; 1391 tbl->action = IL_LEGACY_SWITCH_ANTENNA1;
1392 if (update_search_tbl_counter) 1392 if (update_search_tbl_counter)
1393 search_tbl->action = tbl->action; 1393 search_tbl->action = tbl->action;
1394 return 0; 1394 return 0;
@@ -1398,19 +1398,19 @@ out:
1398/* 1398/*
1399 * Try to switch to new modulation mode from SISO 1399 * Try to switch to new modulation mode from SISO
1400 */ 1400 */
1401static int iwl4965_rs_move_siso_to_other(struct iwl_priv *priv, 1401static int il4965_rs_move_siso_to_other(struct il_priv *priv,
1402 struct iwl_lq_sta *lq_sta, 1402 struct il_lq_sta *lq_sta,
1403 struct ieee80211_conf *conf, 1403 struct ieee80211_conf *conf,
1404 struct ieee80211_sta *sta, int index) 1404 struct ieee80211_sta *sta, int index)
1405{ 1405{
1406 u8 is_green = lq_sta->is_green; 1406 u8 is_green = lq_sta->is_green;
1407 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1407 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1408 struct iwl_scale_tbl_info *search_tbl = 1408 struct il_scale_tbl_info *search_tbl =
1409 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1409 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
1410 struct iwl_rate_scale_data *window = &(tbl->win[index]); 1410 struct il_rate_scale_data *window = &(tbl->win[index]);
1411 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; 1411 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
1412 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1412 u32 sz = (sizeof(struct il_scale_tbl_info) -
1413 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1413 (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT));
1414 u8 start_action; 1414 u8 start_action;
1415 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1415 u8 valid_tx_ant = priv->hw_params.valid_tx_ant;
1416 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1416 u8 tx_chains_num = priv->hw_params.tx_chains_num;
@@ -1422,50 +1422,50 @@ static int iwl4965_rs_move_siso_to_other(struct iwl_priv *priv,
1422 for (;;) { 1422 for (;;) {
1423 lq_sta->action_counter++; 1423 lq_sta->action_counter++;
1424 switch (tbl->action) { 1424 switch (tbl->action) {
1425 case IWL_SISO_SWITCH_ANTENNA1: 1425 case IL_SISO_SWITCH_ANTENNA1:
1426 case IWL_SISO_SWITCH_ANTENNA2: 1426 case IL_SISO_SWITCH_ANTENNA2:
1427 IWL_DEBUG_RATE(priv, "LQ: SISO toggle Antenna\n"); 1427 IL_DEBUG_RATE(priv, "LQ: SISO toggle Antenna\n");
1428 if ((tbl->action == IWL_SISO_SWITCH_ANTENNA1 && 1428 if ((tbl->action == IL_SISO_SWITCH_ANTENNA1 &&
1429 tx_chains_num <= 1) || 1429 tx_chains_num <= 1) ||
1430 (tbl->action == IWL_SISO_SWITCH_ANTENNA2 && 1430 (tbl->action == IL_SISO_SWITCH_ANTENNA2 &&
1431 tx_chains_num <= 2)) 1431 tx_chains_num <= 2))
1432 break; 1432 break;
1433 1433
1434 if (window->success_ratio >= IWL_RS_GOOD_RATIO) 1434 if (window->success_ratio >= IL_RS_GOOD_RATIO)
1435 break; 1435 break;
1436 1436
1437 memcpy(search_tbl, tbl, sz); 1437 memcpy(search_tbl, tbl, sz);
1438 if (iwl4965_rs_toggle_antenna(valid_tx_ant, 1438 if (il4965_rs_toggle_antenna(valid_tx_ant,
1439 &search_tbl->current_rate, search_tbl)) { 1439 &search_tbl->current_rate, search_tbl)) {
1440 update_search_tbl_counter = 1; 1440 update_search_tbl_counter = 1;
1441 goto out; 1441 goto out;
1442 } 1442 }
1443 break; 1443 break;
1444 case IWL_SISO_SWITCH_MIMO2_AB: 1444 case IL_SISO_SWITCH_MIMO2_AB:
1445 case IWL_SISO_SWITCH_MIMO2_AC: 1445 case IL_SISO_SWITCH_MIMO2_AC:
1446 case IWL_SISO_SWITCH_MIMO2_BC: 1446 case IL_SISO_SWITCH_MIMO2_BC:
1447 IWL_DEBUG_RATE(priv, "LQ: SISO switch to MIMO2\n"); 1447 IL_DEBUG_RATE(priv, "LQ: SISO switch to MIMO2\n");
1448 memcpy(search_tbl, tbl, sz); 1448 memcpy(search_tbl, tbl, sz);
1449 search_tbl->is_SGI = 0; 1449 search_tbl->is_SGI = 0;
1450 1450
1451 if (tbl->action == IWL_SISO_SWITCH_MIMO2_AB) 1451 if (tbl->action == IL_SISO_SWITCH_MIMO2_AB)
1452 search_tbl->ant_type = ANT_AB; 1452 search_tbl->ant_type = ANT_AB;
1453 else if (tbl->action == IWL_SISO_SWITCH_MIMO2_AC) 1453 else if (tbl->action == IL_SISO_SWITCH_MIMO2_AC)
1454 search_tbl->ant_type = ANT_AC; 1454 search_tbl->ant_type = ANT_AC;
1455 else 1455 else
1456 search_tbl->ant_type = ANT_BC; 1456 search_tbl->ant_type = ANT_BC;
1457 1457
1458 if (!iwl4965_rs_is_valid_ant(valid_tx_ant, 1458 if (!il4965_rs_is_valid_ant(valid_tx_ant,
1459 search_tbl->ant_type)) 1459 search_tbl->ant_type))
1460 break; 1460 break;
1461 1461
1462 ret = iwl4965_rs_switch_to_mimo2(priv, lq_sta, 1462 ret = il4965_rs_switch_to_mimo2(priv, lq_sta,
1463 conf, sta, 1463 conf, sta,
1464 search_tbl, index); 1464 search_tbl, index);
1465 if (!ret) 1465 if (!ret)
1466 goto out; 1466 goto out;
1467 break; 1467 break;
1468 case IWL_SISO_SWITCH_GI: 1468 case IL_SISO_SWITCH_GI:
1469 if (!tbl->is_ht40 && !(ht_cap->cap & 1469 if (!tbl->is_ht40 && !(ht_cap->cap &
1470 IEEE80211_HT_CAP_SGI_20)) 1470 IEEE80211_HT_CAP_SGI_20))
1471 break; 1471 break;
@@ -1473,32 +1473,32 @@ static int iwl4965_rs_move_siso_to_other(struct iwl_priv *priv,
1473 IEEE80211_HT_CAP_SGI_40)) 1473 IEEE80211_HT_CAP_SGI_40))
1474 break; 1474 break;
1475 1475
1476 IWL_DEBUG_RATE(priv, "LQ: SISO toggle SGI/NGI\n"); 1476 IL_DEBUG_RATE(priv, "LQ: SISO toggle SGI/NGI\n");
1477 1477
1478 memcpy(search_tbl, tbl, sz); 1478 memcpy(search_tbl, tbl, sz);
1479 if (is_green) { 1479 if (is_green) {
1480 if (!tbl->is_SGI) 1480 if (!tbl->is_SGI)
1481 break; 1481 break;
1482 else 1482 else
1483 IWL_ERR(priv, 1483 IL_ERR(priv,
1484 "SGI was set in GF+SISO\n"); 1484 "SGI was set in GF+SISO\n");
1485 } 1485 }
1486 search_tbl->is_SGI = !tbl->is_SGI; 1486 search_tbl->is_SGI = !tbl->is_SGI;
1487 iwl4965_rs_set_expected_tpt_table(lq_sta, search_tbl); 1487 il4965_rs_set_expected_tpt_table(lq_sta, search_tbl);
1488 if (tbl->is_SGI) { 1488 if (tbl->is_SGI) {
1489 s32 tpt = lq_sta->last_tpt / 100; 1489 s32 tpt = lq_sta->last_tpt / 100;
1490 if (tpt >= search_tbl->expected_tpt[index]) 1490 if (tpt >= search_tbl->expected_tpt[index])
1491 break; 1491 break;
1492 } 1492 }
1493 search_tbl->current_rate = 1493 search_tbl->current_rate =
1494 iwl4965_rate_n_flags_from_tbl(priv, search_tbl, 1494 il4965_rate_n_flags_from_tbl(priv, search_tbl,
1495 index, is_green); 1495 index, is_green);
1496 update_search_tbl_counter = 1; 1496 update_search_tbl_counter = 1;
1497 goto out; 1497 goto out;
1498 } 1498 }
1499 tbl->action++; 1499 tbl->action++;
1500 if (tbl->action > IWL_SISO_SWITCH_GI) 1500 if (tbl->action > IL_SISO_SWITCH_GI)
1501 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1501 tbl->action = IL_SISO_SWITCH_ANTENNA1;
1502 1502
1503 if (tbl->action == start_action) 1503 if (tbl->action == start_action)
1504 break; 1504 break;
@@ -1509,8 +1509,8 @@ static int iwl4965_rs_move_siso_to_other(struct iwl_priv *priv,
1509 out: 1509 out:
1510 lq_sta->search_better_tbl = 1; 1510 lq_sta->search_better_tbl = 1;
1511 tbl->action++; 1511 tbl->action++;
1512 if (tbl->action > IWL_SISO_SWITCH_GI) 1512 if (tbl->action > IL_SISO_SWITCH_GI)
1513 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1513 tbl->action = IL_SISO_SWITCH_ANTENNA1;
1514 if (update_search_tbl_counter) 1514 if (update_search_tbl_counter)
1515 search_tbl->action = tbl->action; 1515 search_tbl->action = tbl->action;
1516 1516
@@ -1520,19 +1520,19 @@ static int iwl4965_rs_move_siso_to_other(struct iwl_priv *priv,
1520/* 1520/*
1521 * Try to switch to new modulation mode from MIMO2 1521 * Try to switch to new modulation mode from MIMO2
1522 */ 1522 */
1523static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv, 1523static int il4965_rs_move_mimo2_to_other(struct il_priv *priv,
1524 struct iwl_lq_sta *lq_sta, 1524 struct il_lq_sta *lq_sta,
1525 struct ieee80211_conf *conf, 1525 struct ieee80211_conf *conf,
1526 struct ieee80211_sta *sta, int index) 1526 struct ieee80211_sta *sta, int index)
1527{ 1527{
1528 s8 is_green = lq_sta->is_green; 1528 s8 is_green = lq_sta->is_green;
1529 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1529 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1530 struct iwl_scale_tbl_info *search_tbl = 1530 struct il_scale_tbl_info *search_tbl =
1531 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1531 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
1532 struct iwl_rate_scale_data *window = &(tbl->win[index]); 1532 struct il_rate_scale_data *window = &(tbl->win[index]);
1533 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; 1533 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
1534 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1534 u32 sz = (sizeof(struct il_scale_tbl_info) -
1535 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1535 (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT));
1536 u8 start_action; 1536 u8 start_action;
1537 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1537 u8 valid_tx_ant = priv->hw_params.valid_tx_ant;
1538 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1538 u8 tx_chains_num = priv->hw_params.tx_chains_num;
@@ -1543,43 +1543,43 @@ static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv,
1543 for (;;) { 1543 for (;;) {
1544 lq_sta->action_counter++; 1544 lq_sta->action_counter++;
1545 switch (tbl->action) { 1545 switch (tbl->action) {
1546 case IWL_MIMO2_SWITCH_ANTENNA1: 1546 case IL_MIMO2_SWITCH_ANTENNA1:
1547 case IWL_MIMO2_SWITCH_ANTENNA2: 1547 case IL_MIMO2_SWITCH_ANTENNA2:
1548 IWL_DEBUG_RATE(priv, "LQ: MIMO2 toggle Antennas\n"); 1548 IL_DEBUG_RATE(priv, "LQ: MIMO2 toggle Antennas\n");
1549 1549
1550 if (tx_chains_num <= 2) 1550 if (tx_chains_num <= 2)
1551 break; 1551 break;
1552 1552
1553 if (window->success_ratio >= IWL_RS_GOOD_RATIO) 1553 if (window->success_ratio >= IL_RS_GOOD_RATIO)
1554 break; 1554 break;
1555 1555
1556 memcpy(search_tbl, tbl, sz); 1556 memcpy(search_tbl, tbl, sz);
1557 if (iwl4965_rs_toggle_antenna(valid_tx_ant, 1557 if (il4965_rs_toggle_antenna(valid_tx_ant,
1558 &search_tbl->current_rate, search_tbl)) { 1558 &search_tbl->current_rate, search_tbl)) {
1559 update_search_tbl_counter = 1; 1559 update_search_tbl_counter = 1;
1560 goto out; 1560 goto out;
1561 } 1561 }
1562 break; 1562 break;
1563 case IWL_MIMO2_SWITCH_SISO_A: 1563 case IL_MIMO2_SWITCH_SISO_A:
1564 case IWL_MIMO2_SWITCH_SISO_B: 1564 case IL_MIMO2_SWITCH_SISO_B:
1565 case IWL_MIMO2_SWITCH_SISO_C: 1565 case IL_MIMO2_SWITCH_SISO_C:
1566 IWL_DEBUG_RATE(priv, "LQ: MIMO2 switch to SISO\n"); 1566 IL_DEBUG_RATE(priv, "LQ: MIMO2 switch to SISO\n");
1567 1567
1568 /* Set up new search table for SISO */ 1568 /* Set up new search table for SISO */
1569 memcpy(search_tbl, tbl, sz); 1569 memcpy(search_tbl, tbl, sz);
1570 1570
1571 if (tbl->action == IWL_MIMO2_SWITCH_SISO_A) 1571 if (tbl->action == IL_MIMO2_SWITCH_SISO_A)
1572 search_tbl->ant_type = ANT_A; 1572 search_tbl->ant_type = ANT_A;
1573 else if (tbl->action == IWL_MIMO2_SWITCH_SISO_B) 1573 else if (tbl->action == IL_MIMO2_SWITCH_SISO_B)
1574 search_tbl->ant_type = ANT_B; 1574 search_tbl->ant_type = ANT_B;
1575 else 1575 else
1576 search_tbl->ant_type = ANT_C; 1576 search_tbl->ant_type = ANT_C;
1577 1577
1578 if (!iwl4965_rs_is_valid_ant(valid_tx_ant, 1578 if (!il4965_rs_is_valid_ant(valid_tx_ant,
1579 search_tbl->ant_type)) 1579 search_tbl->ant_type))
1580 break; 1580 break;
1581 1581
1582 ret = iwl4965_rs_switch_to_siso(priv, lq_sta, 1582 ret = il4965_rs_switch_to_siso(priv, lq_sta,
1583 conf, sta, 1583 conf, sta,
1584 search_tbl, index); 1584 search_tbl, index);
1585 if (!ret) 1585 if (!ret)
@@ -1587,7 +1587,7 @@ static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv,
1587 1587
1588 break; 1588 break;
1589 1589
1590 case IWL_MIMO2_SWITCH_GI: 1590 case IL_MIMO2_SWITCH_GI:
1591 if (!tbl->is_ht40 && !(ht_cap->cap & 1591 if (!tbl->is_ht40 && !(ht_cap->cap &
1592 IEEE80211_HT_CAP_SGI_20)) 1592 IEEE80211_HT_CAP_SGI_20))
1593 break; 1593 break;
@@ -1595,12 +1595,12 @@ static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv,
1595 IEEE80211_HT_CAP_SGI_40)) 1595 IEEE80211_HT_CAP_SGI_40))
1596 break; 1596 break;
1597 1597
1598 IWL_DEBUG_RATE(priv, "LQ: MIMO2 toggle SGI/NGI\n"); 1598 IL_DEBUG_RATE(priv, "LQ: MIMO2 toggle SGI/NGI\n");
1599 1599
1600 /* Set up new search table for MIMO2 */ 1600 /* Set up new search table for MIMO2 */
1601 memcpy(search_tbl, tbl, sz); 1601 memcpy(search_tbl, tbl, sz);
1602 search_tbl->is_SGI = !tbl->is_SGI; 1602 search_tbl->is_SGI = !tbl->is_SGI;
1603 iwl4965_rs_set_expected_tpt_table(lq_sta, search_tbl); 1603 il4965_rs_set_expected_tpt_table(lq_sta, search_tbl);
1604 /* 1604 /*
1605 * If active table already uses the fastest possible 1605 * If active table already uses the fastest possible
1606 * modulation (dual stream with short guard interval), 1606 * modulation (dual stream with short guard interval),
@@ -1613,15 +1613,15 @@ static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv,
1613 break; 1613 break;
1614 } 1614 }
1615 search_tbl->current_rate = 1615 search_tbl->current_rate =
1616 iwl4965_rate_n_flags_from_tbl(priv, search_tbl, 1616 il4965_rate_n_flags_from_tbl(priv, search_tbl,
1617 index, is_green); 1617 index, is_green);
1618 update_search_tbl_counter = 1; 1618 update_search_tbl_counter = 1;
1619 goto out; 1619 goto out;
1620 1620
1621 } 1621 }
1622 tbl->action++; 1622 tbl->action++;
1623 if (tbl->action > IWL_MIMO2_SWITCH_GI) 1623 if (tbl->action > IL_MIMO2_SWITCH_GI)
1624 tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; 1624 tbl->action = IL_MIMO2_SWITCH_ANTENNA1;
1625 1625
1626 if (tbl->action == start_action) 1626 if (tbl->action == start_action)
1627 break; 1627 break;
@@ -1631,8 +1631,8 @@ static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv,
1631 out: 1631 out:
1632 lq_sta->search_better_tbl = 1; 1632 lq_sta->search_better_tbl = 1;
1633 tbl->action++; 1633 tbl->action++;
1634 if (tbl->action > IWL_MIMO2_SWITCH_GI) 1634 if (tbl->action > IL_MIMO2_SWITCH_GI)
1635 tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; 1635 tbl->action = IL_MIMO2_SWITCH_ANTENNA1;
1636 if (update_search_tbl_counter) 1636 if (update_search_tbl_counter)
1637 search_tbl->action = tbl->action; 1637 search_tbl->action = tbl->action;
1638 1638
@@ -1648,13 +1648,13 @@ static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv,
1648 * 3) elapsed time in this mode (not used, for now) 1648 * 3) elapsed time in this mode (not used, for now)
1649 */ 1649 */
1650static void 1650static void
1651iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) 1651il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search)
1652{ 1652{
1653 struct iwl_scale_tbl_info *tbl; 1653 struct il_scale_tbl_info *tbl;
1654 int i; 1654 int i;
1655 int active_tbl; 1655 int active_tbl;
1656 int flush_interval_passed = 0; 1656 int flush_interval_passed = 0;
1657 struct iwl_priv *priv; 1657 struct il_priv *priv;
1658 1658
1659 priv = lq_sta->drv; 1659 priv = lq_sta->drv;
1660 active_tbl = lq_sta->active_tbl; 1660 active_tbl = lq_sta->active_tbl;
@@ -1669,7 +1669,7 @@ iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
1669 flush_interval_passed = 1669 flush_interval_passed =
1670 time_after(jiffies, 1670 time_after(jiffies,
1671 (unsigned long)(lq_sta->flush_timer + 1671 (unsigned long)(lq_sta->flush_timer +
1672 IWL_RATE_SCALE_FLUSH_INTVL)); 1672 IL_RATE_SCALE_FLUSH_INTVL));
1673 1673
1674 /* 1674 /*
1675 * Check if we should allow search for new modulation mode. 1675 * Check if we should allow search for new modulation mode.
@@ -1684,7 +1684,7 @@ iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
1684 (lq_sta->total_success > lq_sta->max_success_limit) || 1684 (lq_sta->total_success > lq_sta->max_success_limit) ||
1685 ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer) 1685 ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer)
1686 && (flush_interval_passed))) { 1686 && (flush_interval_passed))) {
1687 IWL_DEBUG_RATE(priv, "LQ: stay is expired %d %d %d\n:", 1687 IL_DEBUG_RATE(priv, "LQ: stay is expired %d %d %d\n:",
1688 lq_sta->total_failed, 1688 lq_sta->total_failed,
1689 lq_sta->total_success, 1689 lq_sta->total_success,
1690 flush_interval_passed); 1690 flush_interval_passed);
@@ -1707,10 +1707,10 @@ iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
1707 lq_sta->table_count_limit) { 1707 lq_sta->table_count_limit) {
1708 lq_sta->table_count = 0; 1708 lq_sta->table_count = 0;
1709 1709
1710 IWL_DEBUG_RATE(priv, 1710 IL_DEBUG_RATE(priv,
1711 "LQ: stay in table clear win\n"); 1711 "LQ: stay in table clear win\n");
1712 for (i = 0; i < IWL_RATE_COUNT; i++) 1712 for (i = 0; i < IL_RATE_COUNT; i++)
1713 iwl4965_rs_rate_scale_clear_window( 1713 il4965_rs_rate_scale_clear_window(
1714 &(tbl->win[i])); 1714 &(tbl->win[i]));
1715 } 1715 }
1716 } 1716 }
@@ -1719,8 +1719,8 @@ iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
1719 * bitmaps and stats in active table (this will become the new 1719 * bitmaps and stats in active table (this will become the new
1720 * "search" table). */ 1720 * "search" table). */
1721 if (!lq_sta->stay_in_tbl) { 1721 if (!lq_sta->stay_in_tbl) {
1722 for (i = 0; i < IWL_RATE_COUNT; i++) 1722 for (i = 0; i < IL_RATE_COUNT; i++)
1723 iwl4965_rs_rate_scale_clear_window( 1723 il4965_rs_rate_scale_clear_window(
1724 &(tbl->win[i])); 1724 &(tbl->win[i]));
1725 } 1725 }
1726 } 1726 }
@@ -1730,18 +1730,18 @@ iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
1730 * setup rate table in uCode 1730 * setup rate table in uCode
1731 * return rate_n_flags as used in the table 1731 * return rate_n_flags as used in the table
1732 */ 1732 */
1733static u32 iwl4965_rs_update_rate_tbl(struct iwl_priv *priv, 1733static u32 il4965_rs_update_rate_tbl(struct il_priv *priv,
1734 struct iwl_rxon_context *ctx, 1734 struct il_rxon_context *ctx,
1735 struct iwl_lq_sta *lq_sta, 1735 struct il_lq_sta *lq_sta,
1736 struct iwl_scale_tbl_info *tbl, 1736 struct il_scale_tbl_info *tbl,
1737 int index, u8 is_green) 1737 int index, u8 is_green)
1738{ 1738{
1739 u32 rate; 1739 u32 rate;
1740 1740
1741 /* Update uCode's rate table. */ 1741 /* Update uCode's rate table. */
1742 rate = iwl4965_rate_n_flags_from_tbl(priv, tbl, index, is_green); 1742 rate = il4965_rate_n_flags_from_tbl(priv, tbl, index, is_green);
1743 iwl4965_rs_fill_link_cmd(priv, lq_sta, rate); 1743 il4965_rs_fill_link_cmd(priv, lq_sta, rate);
1744 iwl_legacy_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); 1744 il_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false);
1745 1745
1746 return rate; 1746 return rate;
1747} 1747}
@@ -1749,28 +1749,28 @@ static u32 iwl4965_rs_update_rate_tbl(struct iwl_priv *priv,
1749/* 1749/*
1750 * Do rate scaling and search for new modulation mode. 1750 * Do rate scaling and search for new modulation mode.
1751 */ 1751 */
1752static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, 1752static void il4965_rs_rate_scale_perform(struct il_priv *priv,
1753 struct sk_buff *skb, 1753 struct sk_buff *skb,
1754 struct ieee80211_sta *sta, 1754 struct ieee80211_sta *sta,
1755 struct iwl_lq_sta *lq_sta) 1755 struct il_lq_sta *lq_sta)
1756{ 1756{
1757 struct ieee80211_hw *hw = priv->hw; 1757 struct ieee80211_hw *hw = priv->hw;
1758 struct ieee80211_conf *conf = &hw->conf; 1758 struct ieee80211_conf *conf = &hw->conf;
1759 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1759 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1760 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1760 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1761 int low = IWL_RATE_INVALID; 1761 int low = IL_RATE_INVALID;
1762 int high = IWL_RATE_INVALID; 1762 int high = IL_RATE_INVALID;
1763 int index; 1763 int index;
1764 int i; 1764 int i;
1765 struct iwl_rate_scale_data *window = NULL; 1765 struct il_rate_scale_data *window = NULL;
1766 int current_tpt = IWL_INVALID_VALUE; 1766 int current_tpt = IL_INVALID_VALUE;
1767 int low_tpt = IWL_INVALID_VALUE; 1767 int low_tpt = IL_INVALID_VALUE;
1768 int high_tpt = IWL_INVALID_VALUE; 1768 int high_tpt = IL_INVALID_VALUE;
1769 u32 fail_count; 1769 u32 fail_count;
1770 s8 scale_action = 0; 1770 s8 scale_action = 0;
1771 u16 rate_mask; 1771 u16 rate_mask;
1772 u8 update_lq = 0; 1772 u8 update_lq = 0;
1773 struct iwl_scale_tbl_info *tbl, *tbl1; 1773 struct il_scale_tbl_info *tbl, *tbl1;
1774 u16 rate_scale_index_msk = 0; 1774 u16 rate_scale_index_msk = 0;
1775 u32 rate; 1775 u32 rate;
1776 u8 is_green = 0; 1776 u8 is_green = 0;
@@ -1779,11 +1779,11 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1779 u16 high_low; 1779 u16 high_low;
1780 s32 sr; 1780 s32 sr;
1781 u8 tid = MAX_TID_COUNT; 1781 u8 tid = MAX_TID_COUNT;
1782 struct iwl_tid_data *tid_data; 1782 struct il_tid_data *tid_data;
1783 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 1783 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
1784 struct iwl_rxon_context *ctx = sta_priv->common.ctx; 1784 struct il_rxon_context *ctx = sta_priv->common.ctx;
1785 1785
1786 IWL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n"); 1786 IL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n");
1787 1787
1788 /* Send management frames and NO_ACK data using lowest rate. */ 1788 /* Send management frames and NO_ACK data using lowest rate. */
1789 /* TODO: this could probably be improved.. */ 1789 /* TODO: this could probably be improved.. */
@@ -1796,10 +1796,10 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1796 1796
1797 lq_sta->supp_rates = sta->supp_rates[lq_sta->band]; 1797 lq_sta->supp_rates = sta->supp_rates[lq_sta->band];
1798 1798
1799 tid = iwl4965_rs_tl_add_packet(lq_sta, hdr); 1799 tid = il4965_rs_tl_add_packet(lq_sta, hdr);
1800 if ((tid != MAX_TID_COUNT) && (lq_sta->tx_agg_tid_en & (1 << tid))) { 1800 if ((tid != MAX_TID_COUNT) && (lq_sta->tx_agg_tid_en & (1 << tid))) {
1801 tid_data = &priv->stations[lq_sta->lq.sta_id].tid[tid]; 1801 tid_data = &priv->stations[lq_sta->lq.sta_id].tid[tid];
1802 if (tid_data->agg.state == IWL_AGG_OFF) 1802 if (tid_data->agg.state == IL_AGG_OFF)
1803 lq_sta->is_agg = 0; 1803 lq_sta->is_agg = 0;
1804 else 1804 else
1805 lq_sta->is_agg = 1; 1805 lq_sta->is_agg = 1;
@@ -1820,26 +1820,26 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1820 if (is_legacy(tbl->lq_type)) 1820 if (is_legacy(tbl->lq_type))
1821 lq_sta->is_green = 0; 1821 lq_sta->is_green = 0;
1822 else 1822 else
1823 lq_sta->is_green = iwl4965_rs_use_green(sta); 1823 lq_sta->is_green = il4965_rs_use_green(sta);
1824 is_green = lq_sta->is_green; 1824 is_green = lq_sta->is_green;
1825 1825
1826 /* current tx rate */ 1826 /* current tx rate */
1827 index = lq_sta->last_txrate_idx; 1827 index = lq_sta->last_txrate_idx;
1828 1828
1829 IWL_DEBUG_RATE(priv, "Rate scale index %d for type %d\n", index, 1829 IL_DEBUG_RATE(priv, "Rate scale index %d for type %d\n", index,
1830 tbl->lq_type); 1830 tbl->lq_type);
1831 1831
1832 /* rates available for this association, and for modulation mode */ 1832 /* rates available for this association, and for modulation mode */
1833 rate_mask = iwl4965_rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); 1833 rate_mask = il4965_rs_get_supported_rates(lq_sta, hdr, tbl->lq_type);
1834 1834
1835 IWL_DEBUG_RATE(priv, "mask 0x%04X\n", rate_mask); 1835 IL_DEBUG_RATE(priv, "mask 0x%04X\n", rate_mask);
1836 1836
1837 /* mask with station rate restriction */ 1837 /* mask with station rate restriction */
1838 if (is_legacy(tbl->lq_type)) { 1838 if (is_legacy(tbl->lq_type)) {
1839 if (lq_sta->band == IEEE80211_BAND_5GHZ) 1839 if (lq_sta->band == IEEE80211_BAND_5GHZ)
1840 /* supp_rates has no CCK bits in A mode */ 1840 /* supp_rates has no CCK bits in A mode */
1841 rate_scale_index_msk = (u16) (rate_mask & 1841 rate_scale_index_msk = (u16) (rate_mask &
1842 (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); 1842 (lq_sta->supp_rates << IL_FIRST_OFDM_RATE));
1843 else 1843 else
1844 rate_scale_index_msk = (u16) (rate_mask & 1844 rate_scale_index_msk = (u16) (rate_mask &
1845 lq_sta->supp_rates); 1845 lq_sta->supp_rates);
@@ -1851,15 +1851,15 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1851 rate_scale_index_msk = rate_mask; 1851 rate_scale_index_msk = rate_mask;
1852 1852
1853 if (!((1 << index) & rate_scale_index_msk)) { 1853 if (!((1 << index) & rate_scale_index_msk)) {
1854 IWL_ERR(priv, "Current Rate is not valid\n"); 1854 IL_ERR(priv, "Current Rate is not valid\n");
1855 if (lq_sta->search_better_tbl) { 1855 if (lq_sta->search_better_tbl) {
1856 /* revert to active table if search table is not valid*/ 1856 /* revert to active table if search table is not valid*/
1857 tbl->lq_type = LQ_NONE; 1857 tbl->lq_type = LQ_NONE;
1858 lq_sta->search_better_tbl = 0; 1858 lq_sta->search_better_tbl = 0;
1859 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1859 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1860 /* get "active" rate info */ 1860 /* get "active" rate info */
1861 index = iwl4965_hwrate_to_plcp_idx(tbl->current_rate); 1861 index = il4965_hwrate_to_plcp_idx(tbl->current_rate);
1862 rate = iwl4965_rs_update_rate_tbl(priv, ctx, lq_sta, 1862 rate = il4965_rs_update_rate_tbl(priv, ctx, lq_sta,
1863 tbl, index, is_green); 1863 tbl, index, is_green);
1864 } 1864 }
1865 return; 1865 return;
@@ -1867,7 +1867,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1867 1867
1868 /* Get expected throughput table and history window for current rate */ 1868 /* Get expected throughput table and history window for current rate */
1869 if (!tbl->expected_tpt) { 1869 if (!tbl->expected_tpt) {
1870 IWL_ERR(priv, "tbl->expected_tpt is NULL\n"); 1870 IL_ERR(priv, "tbl->expected_tpt is NULL\n");
1871 return; 1871 return;
1872 } 1872 }
1873 1873
@@ -1890,18 +1890,18 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1890 * in current association (use new rate found above). 1890 * in current association (use new rate found above).
1891 */ 1891 */
1892 fail_count = window->counter - window->success_counter; 1892 fail_count = window->counter - window->success_counter;
1893 if ((fail_count < IWL_RATE_MIN_FAILURE_TH) && 1893 if ((fail_count < IL_RATE_MIN_FAILURE_TH) &&
1894 (window->success_counter < IWL_RATE_MIN_SUCCESS_TH)) { 1894 (window->success_counter < IL_RATE_MIN_SUCCESS_TH)) {
1895 IWL_DEBUG_RATE(priv, "LQ: still below TH. succ=%d total=%d " 1895 IL_DEBUG_RATE(priv, "LQ: still below TH. succ=%d total=%d "
1896 "for index %d\n", 1896 "for index %d\n",
1897 window->success_counter, window->counter, index); 1897 window->success_counter, window->counter, index);
1898 1898
1899 /* Can't calculate this yet; not enough history */ 1899 /* Can't calculate this yet; not enough history */
1900 window->average_tpt = IWL_INVALID_VALUE; 1900 window->average_tpt = IL_INVALID_VALUE;
1901 1901
1902 /* Should we stay with this modulation mode, 1902 /* Should we stay with this modulation mode,
1903 * or search for a new one? */ 1903 * or search for a new one? */
1904 iwl4965_rs_stay_in_table(lq_sta, false); 1904 il4965_rs_stay_in_table(lq_sta, false);
1905 1905
1906 goto out; 1906 goto out;
1907 } 1907 }
@@ -1909,7 +1909,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1909 * actual average throughput */ 1909 * actual average throughput */
1910 if (window->average_tpt != ((window->success_ratio * 1910 if (window->average_tpt != ((window->success_ratio *
1911 tbl->expected_tpt[index] + 64) / 128)) { 1911 tbl->expected_tpt[index] + 64) / 128)) {
1912 IWL_ERR(priv, 1912 IL_ERR(priv,
1913 "expected_tpt should have been calculated by now\n"); 1913 "expected_tpt should have been calculated by now\n");
1914 window->average_tpt = ((window->success_ratio * 1914 window->average_tpt = ((window->success_ratio *
1915 tbl->expected_tpt[index] + 64) / 128); 1915 tbl->expected_tpt[index] + 64) / 128);
@@ -1922,7 +1922,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1922 * continuing to use the setup that we've been trying. */ 1922 * continuing to use the setup that we've been trying. */
1923 if (window->average_tpt > lq_sta->last_tpt) { 1923 if (window->average_tpt > lq_sta->last_tpt) {
1924 1924
1925 IWL_DEBUG_RATE(priv, "LQ: SWITCHING TO NEW TABLE " 1925 IL_DEBUG_RATE(priv, "LQ: SWITCHING TO NEW TABLE "
1926 "suc=%d cur-tpt=%d old-tpt=%d\n", 1926 "suc=%d cur-tpt=%d old-tpt=%d\n",
1927 window->success_ratio, 1927 window->success_ratio,
1928 window->average_tpt, 1928 window->average_tpt,
@@ -1938,7 +1938,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1938 /* Else poor success; go back to mode in "active" table */ 1938 /* Else poor success; go back to mode in "active" table */
1939 } else { 1939 } else {
1940 1940
1941 IWL_DEBUG_RATE(priv, "LQ: GOING BACK TO THE OLD TABLE " 1941 IL_DEBUG_RATE(priv, "LQ: GOING BACK TO THE OLD TABLE "
1942 "suc=%d cur-tpt=%d old-tpt=%d\n", 1942 "suc=%d cur-tpt=%d old-tpt=%d\n",
1943 window->success_ratio, 1943 window->success_ratio,
1944 window->average_tpt, 1944 window->average_tpt,
@@ -1952,7 +1952,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1952 tbl = &(lq_sta->lq_info[active_tbl]); 1952 tbl = &(lq_sta->lq_info[active_tbl]);
1953 1953
1954 /* Revert to "active" rate and throughput info */ 1954 /* Revert to "active" rate and throughput info */
1955 index = iwl4965_hwrate_to_plcp_idx(tbl->current_rate); 1955 index = il4965_hwrate_to_plcp_idx(tbl->current_rate);
1956 current_tpt = lq_sta->last_tpt; 1956 current_tpt = lq_sta->last_tpt;
1957 1957
1958 /* Need to set up a new rate table in uCode */ 1958 /* Need to set up a new rate table in uCode */
@@ -1968,7 +1968,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1968 1968
1969 /* (Else) not in search of better modulation mode, try for better 1969 /* (Else) not in search of better modulation mode, try for better
1970 * starting rate, while staying in this mode. */ 1970 * starting rate, while staying in this mode. */
1971 high_low = iwl4965_rs_get_adjacent_rate(priv, index, 1971 high_low = il4965_rs_get_adjacent_rate(priv, index,
1972 rate_scale_index_msk, 1972 rate_scale_index_msk,
1973 tbl->lq_type); 1973 tbl->lq_type);
1974 low = high_low & 0xff; 1974 low = high_low & 0xff;
@@ -1977,39 +1977,39 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
1977 /* If user set max rate, dont allow higher than user constrain */ 1977 /* If user set max rate, dont allow higher than user constrain */
1978 if ((lq_sta->max_rate_idx != -1) && 1978 if ((lq_sta->max_rate_idx != -1) &&
1979 (lq_sta->max_rate_idx < high)) 1979 (lq_sta->max_rate_idx < high))
1980 high = IWL_RATE_INVALID; 1980 high = IL_RATE_INVALID;
1981 1981
1982 sr = window->success_ratio; 1982 sr = window->success_ratio;
1983 1983
1984 /* Collect measured throughputs for current and adjacent rates */ 1984 /* Collect measured throughputs for current and adjacent rates */
1985 current_tpt = window->average_tpt; 1985 current_tpt = window->average_tpt;
1986 if (low != IWL_RATE_INVALID) 1986 if (low != IL_RATE_INVALID)
1987 low_tpt = tbl->win[low].average_tpt; 1987 low_tpt = tbl->win[low].average_tpt;
1988 if (high != IWL_RATE_INVALID) 1988 if (high != IL_RATE_INVALID)
1989 high_tpt = tbl->win[high].average_tpt; 1989 high_tpt = tbl->win[high].average_tpt;
1990 1990
1991 scale_action = 0; 1991 scale_action = 0;
1992 1992
1993 /* Too many failures, decrease rate */ 1993 /* Too many failures, decrease rate */
1994 if ((sr <= IWL_RATE_DECREASE_TH) || (current_tpt == 0)) { 1994 if ((sr <= IL_RATE_DECREASE_TH) || (current_tpt == 0)) {
1995 IWL_DEBUG_RATE(priv, 1995 IL_DEBUG_RATE(priv,
1996 "decrease rate because of low success_ratio\n"); 1996 "decrease rate because of low success_ratio\n");
1997 scale_action = -1; 1997 scale_action = -1;
1998 1998
1999 /* No throughput measured yet for adjacent rates; try increase. */ 1999 /* No throughput measured yet for adjacent rates; try increase. */
2000 } else if ((low_tpt == IWL_INVALID_VALUE) && 2000 } else if ((low_tpt == IL_INVALID_VALUE) &&
2001 (high_tpt == IWL_INVALID_VALUE)) { 2001 (high_tpt == IL_INVALID_VALUE)) {
2002 2002
2003 if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) 2003 if (high != IL_RATE_INVALID && sr >= IL_RATE_INCREASE_TH)
2004 scale_action = 1; 2004 scale_action = 1;
2005 else if (low != IWL_RATE_INVALID) 2005 else if (low != IL_RATE_INVALID)
2006 scale_action = 0; 2006 scale_action = 0;
2007 } 2007 }
2008 2008
2009 /* Both adjacent throughputs are measured, but neither one has better 2009 /* Both adjacent throughputs are measured, but neither one has better
2010 * throughput; we're using the best rate, don't change it! */ 2010 * throughput; we're using the best rate, don't change it! */
2011 else if ((low_tpt != IWL_INVALID_VALUE) && 2011 else if ((low_tpt != IL_INVALID_VALUE) &&
2012 (high_tpt != IWL_INVALID_VALUE) && 2012 (high_tpt != IL_INVALID_VALUE) &&
2013 (low_tpt < current_tpt) && 2013 (low_tpt < current_tpt) &&
2014 (high_tpt < current_tpt)) 2014 (high_tpt < current_tpt))
2015 scale_action = 0; 2015 scale_action = 0;
@@ -2018,23 +2018,23 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
2018 * and may have better performance. */ 2018 * and may have better performance. */
2019 else { 2019 else {
2020 /* Higher adjacent rate's throughput is measured */ 2020 /* Higher adjacent rate's throughput is measured */
2021 if (high_tpt != IWL_INVALID_VALUE) { 2021 if (high_tpt != IL_INVALID_VALUE) {
2022 /* Higher rate has better throughput */ 2022 /* Higher rate has better throughput */
2023 if (high_tpt > current_tpt && 2023 if (high_tpt > current_tpt &&
2024 sr >= IWL_RATE_INCREASE_TH) { 2024 sr >= IL_RATE_INCREASE_TH) {
2025 scale_action = 1; 2025 scale_action = 1;
2026 } else { 2026 } else {
2027 scale_action = 0; 2027 scale_action = 0;
2028 } 2028 }
2029 2029
2030 /* Lower adjacent rate's throughput is measured */ 2030 /* Lower adjacent rate's throughput is measured */
2031 } else if (low_tpt != IWL_INVALID_VALUE) { 2031 } else if (low_tpt != IL_INVALID_VALUE) {
2032 /* Lower rate has better throughput */ 2032 /* Lower rate has better throughput */
2033 if (low_tpt > current_tpt) { 2033 if (low_tpt > current_tpt) {
2034 IWL_DEBUG_RATE(priv, 2034 IL_DEBUG_RATE(priv,
2035 "decrease rate because of low tpt\n"); 2035 "decrease rate because of low tpt\n");
2036 scale_action = -1; 2036 scale_action = -1;
2037 } else if (sr >= IWL_RATE_INCREASE_TH) { 2037 } else if (sr >= IL_RATE_INCREASE_TH) {
2038 scale_action = 1; 2038 scale_action = 1;
2039 } 2039 }
2040 } 2040 }
@@ -2042,15 +2042,15 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
2042 2042
2043 /* Sanity check; asked for decrease, but success rate or throughput 2043 /* Sanity check; asked for decrease, but success rate or throughput
2044 * has been good at old rate. Don't change it. */ 2044 * has been good at old rate. Don't change it. */
2045 if ((scale_action == -1) && (low != IWL_RATE_INVALID) && 2045 if ((scale_action == -1) && (low != IL_RATE_INVALID) &&
2046 ((sr > IWL_RATE_HIGH_TH) || 2046 ((sr > IL_RATE_HIGH_TH) ||
2047 (current_tpt > (100 * tbl->expected_tpt[low])))) 2047 (current_tpt > (100 * tbl->expected_tpt[low]))))
2048 scale_action = 0; 2048 scale_action = 0;
2049 2049
2050 switch (scale_action) { 2050 switch (scale_action) {
2051 case -1: 2051 case -1:
2052 /* Decrease starting rate, update uCode's rate table */ 2052 /* Decrease starting rate, update uCode's rate table */
2053 if (low != IWL_RATE_INVALID) { 2053 if (low != IL_RATE_INVALID) {
2054 update_lq = 1; 2054 update_lq = 1;
2055 index = low; 2055 index = low;
2056 } 2056 }
@@ -2058,7 +2058,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
2058 break; 2058 break;
2059 case 1: 2059 case 1:
2060 /* Increase starting rate, update uCode's rate table */ 2060 /* Increase starting rate, update uCode's rate table */
2061 if (high != IWL_RATE_INVALID) { 2061 if (high != IL_RATE_INVALID) {
2062 update_lq = 1; 2062 update_lq = 1;
2063 index = high; 2063 index = high;
2064 } 2064 }
@@ -2070,19 +2070,19 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv,
2070 break; 2070 break;
2071 } 2071 }
2072 2072
2073 IWL_DEBUG_RATE(priv, "choose rate scale index %d action %d low %d " 2073 IL_DEBUG_RATE(priv, "choose rate scale index %d action %d low %d "
2074 "high %d type %d\n", 2074 "high %d type %d\n",
2075 index, scale_action, low, high, tbl->lq_type); 2075 index, scale_action, low, high, tbl->lq_type);
2076 2076
2077lq_update: 2077lq_update:
2078 /* Replace uCode's rate table for the destination station. */ 2078 /* Replace uCode's rate table for the destination station. */
2079 if (update_lq) 2079 if (update_lq)
2080 rate = iwl4965_rs_update_rate_tbl(priv, ctx, lq_sta, 2080 rate = il4965_rs_update_rate_tbl(priv, ctx, lq_sta,
2081 tbl, index, is_green); 2081 tbl, index, is_green);
2082 2082
2083 /* Should we stay with this modulation mode, 2083 /* Should we stay with this modulation mode,
2084 * or search for a new one? */ 2084 * or search for a new one? */
2085 iwl4965_rs_stay_in_table(lq_sta, false); 2085 il4965_rs_stay_in_table(lq_sta, false);
2086 2086
2087 /* 2087 /*
2088 * Search for new modulation mode if we're: 2088 * Search for new modulation mode if we're:
@@ -2098,32 +2098,32 @@ lq_update:
2098 /* Select a new "search" modulation mode to try. 2098 /* Select a new "search" modulation mode to try.
2099 * If one is found, set up the new "search" table. */ 2099 * If one is found, set up the new "search" table. */
2100 if (is_legacy(tbl->lq_type)) 2100 if (is_legacy(tbl->lq_type))
2101 iwl4965_rs_move_legacy_other(priv, lq_sta, 2101 il4965_rs_move_legacy_other(priv, lq_sta,
2102 conf, sta, index); 2102 conf, sta, index);
2103 else if (is_siso(tbl->lq_type)) 2103 else if (is_siso(tbl->lq_type))
2104 iwl4965_rs_move_siso_to_other(priv, lq_sta, 2104 il4965_rs_move_siso_to_other(priv, lq_sta,
2105 conf, sta, index); 2105 conf, sta, index);
2106 else /* (is_mimo2(tbl->lq_type)) */ 2106 else /* (is_mimo2(tbl->lq_type)) */
2107 iwl4965_rs_move_mimo2_to_other(priv, lq_sta, 2107 il4965_rs_move_mimo2_to_other(priv, lq_sta,
2108 conf, sta, index); 2108 conf, sta, index);
2109 2109
2110 /* If new "search" mode was selected, set up in uCode table */ 2110 /* If new "search" mode was selected, set up in uCode table */
2111 if (lq_sta->search_better_tbl) { 2111 if (lq_sta->search_better_tbl) {
2112 /* Access the "search" table, clear its history. */ 2112 /* Access the "search" table, clear its history. */
2113 tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 2113 tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
2114 for (i = 0; i < IWL_RATE_COUNT; i++) 2114 for (i = 0; i < IL_RATE_COUNT; i++)
2115 iwl4965_rs_rate_scale_clear_window( 2115 il4965_rs_rate_scale_clear_window(
2116 &(tbl->win[i])); 2116 &(tbl->win[i]));
2117 2117
2118 /* Use new "search" start rate */ 2118 /* Use new "search" start rate */
2119 index = iwl4965_hwrate_to_plcp_idx(tbl->current_rate); 2119 index = il4965_hwrate_to_plcp_idx(tbl->current_rate);
2120 2120
2121 IWL_DEBUG_RATE(priv, 2121 IL_DEBUG_RATE(priv,
2122 "Switch current mcs: %X index: %d\n", 2122 "Switch current mcs: %X index: %d\n",
2123 tbl->current_rate, index); 2123 tbl->current_rate, index);
2124 iwl4965_rs_fill_link_cmd(priv, lq_sta, 2124 il4965_rs_fill_link_cmd(priv, lq_sta,
2125 tbl->current_rate); 2125 tbl->current_rate);
2126 iwl_legacy_send_lq_cmd(priv, ctx, 2126 il_send_lq_cmd(priv, ctx,
2127 &lq_sta->lq, CMD_ASYNC, false); 2127 &lq_sta->lq, CMD_ASYNC, false);
2128 } else 2128 } else
2129 done_search = 1; 2129 done_search = 1;
@@ -2138,8 +2138,8 @@ lq_update:
2138 tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); 2138 tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]);
2139 if (is_legacy(tbl1->lq_type) && !conf_is_ht(conf) && 2139 if (is_legacy(tbl1->lq_type) && !conf_is_ht(conf) &&
2140 lq_sta->action_counter > tbl1->max_search) { 2140 lq_sta->action_counter > tbl1->max_search) {
2141 IWL_DEBUG_RATE(priv, "LQ: STAY in legacy table\n"); 2141 IL_DEBUG_RATE(priv, "LQ: STAY in legacy table\n");
2142 iwl4965_rs_set_stay_in_table(priv, 1, lq_sta); 2142 il4965_rs_set_stay_in_table(priv, 1, lq_sta);
2143 } 2143 }
2144 2144
2145 /* If we're in an HT mode, and all 3 mode switch actions 2145 /* If we're in an HT mode, and all 3 mode switch actions
@@ -2147,32 +2147,32 @@ lq_update:
2147 * mode for a while before next round of mode comparisons. */ 2147 * mode for a while before next round of mode comparisons. */
2148 if (lq_sta->enable_counter && 2148 if (lq_sta->enable_counter &&
2149 (lq_sta->action_counter >= tbl1->max_search)) { 2149 (lq_sta->action_counter >= tbl1->max_search)) {
2150 if ((lq_sta->last_tpt > IWL_AGG_TPT_THREHOLD) && 2150 if ((lq_sta->last_tpt > IL_AGG_TPT_THREHOLD) &&
2151 (lq_sta->tx_agg_tid_en & (1 << tid)) && 2151 (lq_sta->tx_agg_tid_en & (1 << tid)) &&
2152 (tid != MAX_TID_COUNT)) { 2152 (tid != MAX_TID_COUNT)) {
2153 tid_data = 2153 tid_data =
2154 &priv->stations[lq_sta->lq.sta_id].tid[tid]; 2154 &priv->stations[lq_sta->lq.sta_id].tid[tid];
2155 if (tid_data->agg.state == IWL_AGG_OFF) { 2155 if (tid_data->agg.state == IL_AGG_OFF) {
2156 IWL_DEBUG_RATE(priv, 2156 IL_DEBUG_RATE(priv,
2157 "try to aggregate tid %d\n", 2157 "try to aggregate tid %d\n",
2158 tid); 2158 tid);
2159 iwl4965_rs_tl_turn_on_agg(priv, tid, 2159 il4965_rs_tl_turn_on_agg(priv, tid,
2160 lq_sta, sta); 2160 lq_sta, sta);
2161 } 2161 }
2162 } 2162 }
2163 iwl4965_rs_set_stay_in_table(priv, 0, lq_sta); 2163 il4965_rs_set_stay_in_table(priv, 0, lq_sta);
2164 } 2164 }
2165 } 2165 }
2166 2166
2167out: 2167out:
2168 tbl->current_rate = iwl4965_rate_n_flags_from_tbl(priv, tbl, 2168 tbl->current_rate = il4965_rate_n_flags_from_tbl(priv, tbl,
2169 index, is_green); 2169 index, is_green);
2170 i = index; 2170 i = index;
2171 lq_sta->last_txrate_idx = i; 2171 lq_sta->last_txrate_idx = i;
2172} 2172}
2173 2173
2174/** 2174/**
2175 * iwl4965_rs_initialize_lq - Initialize a station's hardware rate table 2175 * il4965_rs_initialize_lq - Initialize a station's hardware rate table
2176 * 2176 *
2177 * The uCode's station table contains a table of fallback rates 2177 * The uCode's station table contains a table of fallback rates
2178 * for automatic fallback during transmission. 2178 * for automatic fallback during transmission.
@@ -2185,20 +2185,20 @@ out:
2185 * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD, 2185 * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD,
2186 * which requires station table entry to exist). 2186 * which requires station table entry to exist).
2187 */ 2187 */
2188static void iwl4965_rs_initialize_lq(struct iwl_priv *priv, 2188static void il4965_rs_initialize_lq(struct il_priv *priv,
2189 struct ieee80211_conf *conf, 2189 struct ieee80211_conf *conf,
2190 struct ieee80211_sta *sta, 2190 struct ieee80211_sta *sta,
2191 struct iwl_lq_sta *lq_sta) 2191 struct il_lq_sta *lq_sta)
2192{ 2192{
2193 struct iwl_scale_tbl_info *tbl; 2193 struct il_scale_tbl_info *tbl;
2194 int rate_idx; 2194 int rate_idx;
2195 int i; 2195 int i;
2196 u32 rate; 2196 u32 rate;
2197 u8 use_green = iwl4965_rs_use_green(sta); 2197 u8 use_green = il4965_rs_use_green(sta);
2198 u8 active_tbl = 0; 2198 u8 active_tbl = 0;
2199 u8 valid_tx_ant; 2199 u8 valid_tx_ant;
2200 struct iwl_station_priv *sta_priv; 2200 struct il_station_priv *sta_priv;
2201 struct iwl_rxon_context *ctx; 2201 struct il_rxon_context *ctx;
2202 2202
2203 if (!sta || !lq_sta) 2203 if (!sta || !lq_sta)
2204 return; 2204 return;
@@ -2217,56 +2217,56 @@ static void iwl4965_rs_initialize_lq(struct iwl_priv *priv,
2217 2217
2218 tbl = &(lq_sta->lq_info[active_tbl]); 2218 tbl = &(lq_sta->lq_info[active_tbl]);
2219 2219
2220 if ((i < 0) || (i >= IWL_RATE_COUNT)) 2220 if ((i < 0) || (i >= IL_RATE_COUNT))
2221 i = 0; 2221 i = 0;
2222 2222
2223 rate = iwlegacy_rates[i].plcp; 2223 rate = iwlegacy_rates[i].plcp;
2224 tbl->ant_type = iwl4965_first_antenna(valid_tx_ant); 2224 tbl->ant_type = il4965_first_antenna(valid_tx_ant);
2225 rate |= tbl->ant_type << RATE_MCS_ANT_POS; 2225 rate |= tbl->ant_type << RATE_MCS_ANT_POS;
2226 2226
2227 if (i >= IWL_FIRST_CCK_RATE && i <= IWL_LAST_CCK_RATE) 2227 if (i >= IL_FIRST_CCK_RATE && i <= IL_LAST_CCK_RATE)
2228 rate |= RATE_MCS_CCK_MSK; 2228 rate |= RATE_MCS_CCK_MSK;
2229 2229
2230 iwl4965_rs_get_tbl_info_from_mcs(rate, priv->band, tbl, &rate_idx); 2230 il4965_rs_get_tbl_info_from_mcs(rate, priv->band, tbl, &rate_idx);
2231 if (!iwl4965_rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) 2231 if (!il4965_rs_is_valid_ant(valid_tx_ant, tbl->ant_type))
2232 iwl4965_rs_toggle_antenna(valid_tx_ant, &rate, tbl); 2232 il4965_rs_toggle_antenna(valid_tx_ant, &rate, tbl);
2233 2233
2234 rate = iwl4965_rate_n_flags_from_tbl(priv, tbl, rate_idx, use_green); 2234 rate = il4965_rate_n_flags_from_tbl(priv, tbl, rate_idx, use_green);
2235 tbl->current_rate = rate; 2235 tbl->current_rate = rate;
2236 iwl4965_rs_set_expected_tpt_table(lq_sta, tbl); 2236 il4965_rs_set_expected_tpt_table(lq_sta, tbl);
2237 iwl4965_rs_fill_link_cmd(NULL, lq_sta, rate); 2237 il4965_rs_fill_link_cmd(NULL, lq_sta, rate);
2238 priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; 2238 priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq;
2239 iwl_legacy_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true); 2239 il_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true);
2240} 2240}
2241 2241
2242static void 2242static void
2243iwl4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, 2243il4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
2244 struct ieee80211_tx_rate_control *txrc) 2244 struct ieee80211_tx_rate_control *txrc)
2245{ 2245{
2246 2246
2247 struct sk_buff *skb = txrc->skb; 2247 struct sk_buff *skb = txrc->skb;
2248 struct ieee80211_supported_band *sband = txrc->sband; 2248 struct ieee80211_supported_band *sband = txrc->sband;
2249 struct iwl_priv *priv __maybe_unused = (struct iwl_priv *)priv_r; 2249 struct il_priv *priv __maybe_unused = (struct il_priv *)priv_r;
2250 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 2250 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2251 struct iwl_lq_sta *lq_sta = priv_sta; 2251 struct il_lq_sta *lq_sta = priv_sta;
2252 int rate_idx; 2252 int rate_idx;
2253 2253
2254 IWL_DEBUG_RATE_LIMIT(priv, "rate scale calculate new rate for skb\n"); 2254 IL_DEBUG_RATE_LIMIT(priv, "rate scale calculate new rate for skb\n");
2255 2255
2256 /* Get max rate if user set max rate */ 2256 /* Get max rate if user set max rate */
2257 if (lq_sta) { 2257 if (lq_sta) {
2258 lq_sta->max_rate_idx = txrc->max_rate_idx; 2258 lq_sta->max_rate_idx = txrc->max_rate_idx;
2259 if ((sband->band == IEEE80211_BAND_5GHZ) && 2259 if ((sband->band == IEEE80211_BAND_5GHZ) &&
2260 (lq_sta->max_rate_idx != -1)) 2260 (lq_sta->max_rate_idx != -1))
2261 lq_sta->max_rate_idx += IWL_FIRST_OFDM_RATE; 2261 lq_sta->max_rate_idx += IL_FIRST_OFDM_RATE;
2262 if ((lq_sta->max_rate_idx < 0) || 2262 if ((lq_sta->max_rate_idx < 0) ||
2263 (lq_sta->max_rate_idx >= IWL_RATE_COUNT)) 2263 (lq_sta->max_rate_idx >= IL_RATE_COUNT))
2264 lq_sta->max_rate_idx = -1; 2264 lq_sta->max_rate_idx = -1;
2265 } 2265 }
2266 2266
2267 /* Treat uninitialized rate scaling data same as non-existing. */ 2267 /* Treat uninitialized rate scaling data same as non-existing. */
2268 if (lq_sta && !lq_sta->drv) { 2268 if (lq_sta && !lq_sta->drv) {
2269 IWL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); 2269 IL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n");
2270 priv_sta = NULL; 2270 priv_sta = NULL;
2271 } 2271 }
2272 2272
@@ -2280,11 +2280,11 @@ iwl4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
2280 rate_idx = lq_sta->last_txrate_idx; 2280 rate_idx = lq_sta->last_txrate_idx;
2281 2281
2282 if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) { 2282 if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) {
2283 rate_idx -= IWL_FIRST_OFDM_RATE; 2283 rate_idx -= IL_FIRST_OFDM_RATE;
2284 /* 6M and 9M shared same MCS index */ 2284 /* 6M and 9M shared same MCS index */
2285 rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0; 2285 rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0;
2286 if (iwl4965_rs_extract_rate(lq_sta->last_rate_n_flags) >= 2286 if (il4965_rs_extract_rate(lq_sta->last_rate_n_flags) >=
2287 IWL_RATE_MIMO2_6M_PLCP) 2287 IL_RATE_MIMO2_6M_PLCP)
2288 rate_idx = rate_idx + MCS_INDEX_PER_STREAM; 2288 rate_idx = rate_idx + MCS_INDEX_PER_STREAM;
2289 info->control.rates[0].flags = IEEE80211_TX_RC_MCS; 2289 info->control.rates[0].flags = IEEE80211_TX_RC_MCS;
2290 if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK) 2290 if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK)
@@ -2301,29 +2301,29 @@ iwl4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
2301 IEEE80211_TX_RC_GREEN_FIELD; 2301 IEEE80211_TX_RC_GREEN_FIELD;
2302 } else { 2302 } else {
2303 /* Check for invalid rates */ 2303 /* Check for invalid rates */
2304 if ((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT_LEGACY) || 2304 if ((rate_idx < 0) || (rate_idx >= IL_RATE_COUNT_LEGACY) ||
2305 ((sband->band == IEEE80211_BAND_5GHZ) && 2305 ((sband->band == IEEE80211_BAND_5GHZ) &&
2306 (rate_idx < IWL_FIRST_OFDM_RATE))) 2306 (rate_idx < IL_FIRST_OFDM_RATE)))
2307 rate_idx = rate_lowest_index(sband, sta); 2307 rate_idx = rate_lowest_index(sband, sta);
2308 /* On valid 5 GHz rate, adjust index */ 2308 /* On valid 5 GHz rate, adjust index */
2309 else if (sband->band == IEEE80211_BAND_5GHZ) 2309 else if (sband->band == IEEE80211_BAND_5GHZ)
2310 rate_idx -= IWL_FIRST_OFDM_RATE; 2310 rate_idx -= IL_FIRST_OFDM_RATE;
2311 info->control.rates[0].flags = 0; 2311 info->control.rates[0].flags = 0;
2312 } 2312 }
2313 info->control.rates[0].idx = rate_idx; 2313 info->control.rates[0].idx = rate_idx;
2314 2314
2315} 2315}
2316 2316
2317static void *iwl4965_rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, 2317static void *il4965_rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta,
2318 gfp_t gfp) 2318 gfp_t gfp)
2319{ 2319{
2320 struct iwl_lq_sta *lq_sta; 2320 struct il_lq_sta *lq_sta;
2321 struct iwl_station_priv *sta_priv = 2321 struct il_station_priv *sta_priv =
2322 (struct iwl_station_priv *) sta->drv_priv; 2322 (struct il_station_priv *) sta->drv_priv;
2323 struct iwl_priv *priv; 2323 struct il_priv *priv;
2324 2324
2325 priv = (struct iwl_priv *)priv_rate; 2325 priv = (struct il_priv *)priv_rate;
2326 IWL_DEBUG_RATE(priv, "create station rate scale window\n"); 2326 IL_DEBUG_RATE(priv, "create station rate scale window\n");
2327 2327
2328 lq_sta = &sta_priv->lq_sta; 2328 lq_sta = &sta_priv->lq_sta;
2329 2329
@@ -2334,7 +2334,7 @@ static void *iwl4965_rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta,
2334 * Called after adding a new station to initialize rate scaling 2334 * Called after adding a new station to initialize rate scaling
2335 */ 2335 */
2336void 2336void
2337iwl4965_rs_rate_init(struct iwl_priv *priv, 2337il4965_rs_rate_init(struct il_priv *priv,
2338 struct ieee80211_sta *sta, 2338 struct ieee80211_sta *sta,
2339 u8 sta_id) 2339 u8 sta_id)
2340{ 2340{
@@ -2342,11 +2342,11 @@ iwl4965_rs_rate_init(struct iwl_priv *priv,
2342 struct ieee80211_hw *hw = priv->hw; 2342 struct ieee80211_hw *hw = priv->hw;
2343 struct ieee80211_conf *conf = &priv->hw->conf; 2343 struct ieee80211_conf *conf = &priv->hw->conf;
2344 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; 2344 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
2345 struct iwl_station_priv *sta_priv; 2345 struct il_station_priv *sta_priv;
2346 struct iwl_lq_sta *lq_sta; 2346 struct il_lq_sta *lq_sta;
2347 struct ieee80211_supported_band *sband; 2347 struct ieee80211_supported_band *sband;
2348 2348
2349 sta_priv = (struct iwl_station_priv *) sta->drv_priv; 2349 sta_priv = (struct il_station_priv *) sta->drv_priv;
2350 lq_sta = &sta_priv->lq_sta; 2350 lq_sta = &sta_priv->lq_sta;
2351 sband = hw->wiphy->bands[conf->channel->band]; 2351 sband = hw->wiphy->bands[conf->channel->band];
2352 2352
@@ -2354,18 +2354,18 @@ iwl4965_rs_rate_init(struct iwl_priv *priv,
2354 lq_sta->lq.sta_id = sta_id; 2354 lq_sta->lq.sta_id = sta_id;
2355 2355
2356 for (j = 0; j < LQ_SIZE; j++) 2356 for (j = 0; j < LQ_SIZE; j++)
2357 for (i = 0; i < IWL_RATE_COUNT; i++) 2357 for (i = 0; i < IL_RATE_COUNT; i++)
2358 iwl4965_rs_rate_scale_clear_window( 2358 il4965_rs_rate_scale_clear_window(
2359 &lq_sta->lq_info[j].win[i]); 2359 &lq_sta->lq_info[j].win[i]);
2360 2360
2361 lq_sta->flush_timer = 0; 2361 lq_sta->flush_timer = 0;
2362 lq_sta->supp_rates = sta->supp_rates[sband->band]; 2362 lq_sta->supp_rates = sta->supp_rates[sband->band];
2363 for (j = 0; j < LQ_SIZE; j++) 2363 for (j = 0; j < LQ_SIZE; j++)
2364 for (i = 0; i < IWL_RATE_COUNT; i++) 2364 for (i = 0; i < IL_RATE_COUNT; i++)
2365 iwl4965_rs_rate_scale_clear_window( 2365 il4965_rs_rate_scale_clear_window(
2366 &lq_sta->lq_info[j].win[i]); 2366 &lq_sta->lq_info[j].win[i]);
2367 2367
2368 IWL_DEBUG_RATE(priv, "LQ:" 2368 IL_DEBUG_RATE(priv, "LQ:"
2369 "*** rate scale station global init for station %d ***\n", 2369 "*** rate scale station global init for station %d ***\n",
2370 sta_id); 2370 sta_id);
2371 /* TODO: what is a good starting rate for STA? About middle? Maybe not 2371 /* TODO: what is a good starting rate for STA? About middle? Maybe not
@@ -2375,8 +2375,8 @@ iwl4965_rs_rate_init(struct iwl_priv *priv,
2375 2375
2376 lq_sta->is_dup = 0; 2376 lq_sta->is_dup = 0;
2377 lq_sta->max_rate_idx = -1; 2377 lq_sta->max_rate_idx = -1;
2378 lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX; 2378 lq_sta->missed_rate_counter = IL_MISSED_RATE_MAX;
2379 lq_sta->is_green = iwl4965_rs_use_green(sta); 2379 lq_sta->is_green = il4965_rs_use_green(sta);
2380 lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); 2380 lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000);
2381 lq_sta->band = priv->band; 2381 lq_sta->band = priv->band;
2382 /* 2382 /*
@@ -2386,69 +2386,69 @@ iwl4965_rs_rate_init(struct iwl_priv *priv,
2386 lq_sta->active_siso_rate = ht_cap->mcs.rx_mask[0] << 1; 2386 lq_sta->active_siso_rate = ht_cap->mcs.rx_mask[0] << 1;
2387 lq_sta->active_siso_rate |= ht_cap->mcs.rx_mask[0] & 0x1; 2387 lq_sta->active_siso_rate |= ht_cap->mcs.rx_mask[0] & 0x1;
2388 lq_sta->active_siso_rate &= ~((u16)0x2); 2388 lq_sta->active_siso_rate &= ~((u16)0x2);
2389 lq_sta->active_siso_rate <<= IWL_FIRST_OFDM_RATE; 2389 lq_sta->active_siso_rate <<= IL_FIRST_OFDM_RATE;
2390 2390
2391 /* Same here */ 2391 /* Same here */
2392 lq_sta->active_mimo2_rate = ht_cap->mcs.rx_mask[1] << 1; 2392 lq_sta->active_mimo2_rate = ht_cap->mcs.rx_mask[1] << 1;
2393 lq_sta->active_mimo2_rate |= ht_cap->mcs.rx_mask[1] & 0x1; 2393 lq_sta->active_mimo2_rate |= ht_cap->mcs.rx_mask[1] & 0x1;
2394 lq_sta->active_mimo2_rate &= ~((u16)0x2); 2394 lq_sta->active_mimo2_rate &= ~((u16)0x2);
2395 lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE; 2395 lq_sta->active_mimo2_rate <<= IL_FIRST_OFDM_RATE;
2396 2396
2397 /* These values will be overridden later */ 2397 /* These values will be overridden later */
2398 lq_sta->lq.general_params.single_stream_ant_msk = 2398 lq_sta->lq.general_params.single_stream_ant_msk =
2399 iwl4965_first_antenna(priv->hw_params.valid_tx_ant); 2399 il4965_first_antenna(priv->hw_params.valid_tx_ant);
2400 lq_sta->lq.general_params.dual_stream_ant_msk = 2400 lq_sta->lq.general_params.dual_stream_ant_msk =
2401 priv->hw_params.valid_tx_ant & 2401 priv->hw_params.valid_tx_ant &
2402 ~iwl4965_first_antenna(priv->hw_params.valid_tx_ant); 2402 ~il4965_first_antenna(priv->hw_params.valid_tx_ant);
2403 if (!lq_sta->lq.general_params.dual_stream_ant_msk) { 2403 if (!lq_sta->lq.general_params.dual_stream_ant_msk) {
2404 lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; 2404 lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB;
2405 } else if (iwl4965_num_of_ant(priv->hw_params.valid_tx_ant) == 2) { 2405 } else if (il4965_num_of_ant(priv->hw_params.valid_tx_ant) == 2) {
2406 lq_sta->lq.general_params.dual_stream_ant_msk = 2406 lq_sta->lq.general_params.dual_stream_ant_msk =
2407 priv->hw_params.valid_tx_ant; 2407 priv->hw_params.valid_tx_ant;
2408 } 2408 }
2409 2409
2410 /* as default allow aggregation for all tids */ 2410 /* as default allow aggregation for all tids */
2411 lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; 2411 lq_sta->tx_agg_tid_en = IL_AGG_ALL_TID;
2412 lq_sta->drv = priv; 2412 lq_sta->drv = priv;
2413 2413
2414 /* Set last_txrate_idx to lowest rate */ 2414 /* Set last_txrate_idx to lowest rate */
2415 lq_sta->last_txrate_idx = rate_lowest_index(sband, sta); 2415 lq_sta->last_txrate_idx = rate_lowest_index(sband, sta);
2416 if (sband->band == IEEE80211_BAND_5GHZ) 2416 if (sband->band == IEEE80211_BAND_5GHZ)
2417 lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; 2417 lq_sta->last_txrate_idx += IL_FIRST_OFDM_RATE;
2418 lq_sta->is_agg = 0; 2418 lq_sta->is_agg = 0;
2419 2419
2420#ifdef CONFIG_MAC80211_DEBUGFS 2420#ifdef CONFIG_MAC80211_DEBUGFS
2421 lq_sta->dbg_fixed_rate = 0; 2421 lq_sta->dbg_fixed_rate = 0;
2422#endif 2422#endif
2423 2423
2424 iwl4965_rs_initialize_lq(priv, conf, sta, lq_sta); 2424 il4965_rs_initialize_lq(priv, conf, sta, lq_sta);
2425} 2425}
2426 2426
2427static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv, 2427static void il4965_rs_fill_link_cmd(struct il_priv *priv,
2428 struct iwl_lq_sta *lq_sta, u32 new_rate) 2428 struct il_lq_sta *lq_sta, u32 new_rate)
2429{ 2429{
2430 struct iwl_scale_tbl_info tbl_type; 2430 struct il_scale_tbl_info tbl_type;
2431 int index = 0; 2431 int index = 0;
2432 int rate_idx; 2432 int rate_idx;
2433 int repeat_rate = 0; 2433 int repeat_rate = 0;
2434 u8 ant_toggle_cnt = 0; 2434 u8 ant_toggle_cnt = 0;
2435 u8 use_ht_possible = 1; 2435 u8 use_ht_possible = 1;
2436 u8 valid_tx_ant = 0; 2436 u8 valid_tx_ant = 0;
2437 struct iwl_link_quality_cmd *lq_cmd = &lq_sta->lq; 2437 struct il_link_quality_cmd *lq_cmd = &lq_sta->lq;
2438 2438
2439 /* Override starting rate (index 0) if needed for debug purposes */ 2439 /* Override starting rate (index 0) if needed for debug purposes */
2440 iwl4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); 2440 il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index);
2441 2441
2442 /* Interpret new_rate (rate_n_flags) */ 2442 /* Interpret new_rate (rate_n_flags) */
2443 iwl4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, 2443 il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band,
2444 &tbl_type, &rate_idx); 2444 &tbl_type, &rate_idx);
2445 2445
2446 /* How many times should we repeat the initial rate? */ 2446 /* How many times should we repeat the initial rate? */
2447 if (is_legacy(tbl_type.lq_type)) { 2447 if (is_legacy(tbl_type.lq_type)) {
2448 ant_toggle_cnt = 1; 2448 ant_toggle_cnt = 1;
2449 repeat_rate = IWL_NUMBER_TRY; 2449 repeat_rate = IL_NUMBER_TRY;
2450 } else { 2450 } else {
2451 repeat_rate = IWL_HT_NUMBER_TRY; 2451 repeat_rate = IL_HT_NUMBER_TRY;
2452 } 2452 }
2453 2453
2454 lq_cmd->general_params.mimo_delimiter = 2454 lq_cmd->general_params.mimo_delimiter =
@@ -2457,10 +2457,10 @@ static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv,
2457 /* Fill 1st table entry (index 0) */ 2457 /* Fill 1st table entry (index 0) */
2458 lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(new_rate); 2458 lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(new_rate);
2459 2459
2460 if (iwl4965_num_of_ant(tbl_type.ant_type) == 1) { 2460 if (il4965_num_of_ant(tbl_type.ant_type) == 1) {
2461 lq_cmd->general_params.single_stream_ant_msk = 2461 lq_cmd->general_params.single_stream_ant_msk =
2462 tbl_type.ant_type; 2462 tbl_type.ant_type;
2463 } else if (iwl4965_num_of_ant(tbl_type.ant_type) == 2) { 2463 } else if (il4965_num_of_ant(tbl_type.ant_type) == 2) {
2464 lq_cmd->general_params.dual_stream_ant_msk = 2464 lq_cmd->general_params.dual_stream_ant_msk =
2465 tbl_type.ant_type; 2465 tbl_type.ant_type;
2466 } /* otherwise we don't modify the existing value */ 2466 } /* otherwise we don't modify the existing value */
@@ -2473,20 +2473,20 @@ static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv,
2473 /* Fill rest of rate table */ 2473 /* Fill rest of rate table */
2474 while (index < LINK_QUAL_MAX_RETRY_NUM) { 2474 while (index < LINK_QUAL_MAX_RETRY_NUM) {
2475 /* Repeat initial/next rate. 2475 /* Repeat initial/next rate.
2476 * For legacy IWL_NUMBER_TRY == 1, this loop will not execute. 2476 * For legacy IL_NUMBER_TRY == 1, this loop will not execute.
2477 * For HT IWL_HT_NUMBER_TRY == 3, this executes twice. */ 2477 * For HT IL_HT_NUMBER_TRY == 3, this executes twice. */
2478 while (repeat_rate > 0 && (index < LINK_QUAL_MAX_RETRY_NUM)) { 2478 while (repeat_rate > 0 && (index < LINK_QUAL_MAX_RETRY_NUM)) {
2479 if (is_legacy(tbl_type.lq_type)) { 2479 if (is_legacy(tbl_type.lq_type)) {
2480 if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) 2480 if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE)
2481 ant_toggle_cnt++; 2481 ant_toggle_cnt++;
2482 else if (priv && 2482 else if (priv &&
2483 iwl4965_rs_toggle_antenna(valid_tx_ant, 2483 il4965_rs_toggle_antenna(valid_tx_ant,
2484 &new_rate, &tbl_type)) 2484 &new_rate, &tbl_type))
2485 ant_toggle_cnt = 1; 2485 ant_toggle_cnt = 1;
2486 } 2486 }
2487 2487
2488 /* Override next rate if needed for debug purposes */ 2488 /* Override next rate if needed for debug purposes */
2489 iwl4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); 2489 il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index);
2490 2490
2491 /* Fill next table entry */ 2491 /* Fill next table entry */
2492 lq_cmd->rs_table[index].rate_n_flags = 2492 lq_cmd->rs_table[index].rate_n_flags =
@@ -2495,18 +2495,18 @@ static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv,
2495 index++; 2495 index++;
2496 } 2496 }
2497 2497
2498 iwl4965_rs_get_tbl_info_from_mcs(new_rate, 2498 il4965_rs_get_tbl_info_from_mcs(new_rate,
2499 lq_sta->band, &tbl_type, 2499 lq_sta->band, &tbl_type,
2500 &rate_idx); 2500 &rate_idx);
2501 2501
2502 /* Indicate to uCode which entries might be MIMO. 2502 /* Indicate to uCode which entries might be MIMO.
2503 * If initial rate was MIMO, this will finally end up 2503 * If initial rate was MIMO, this will finally end up
2504 * as (IWL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */ 2504 * as (IL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */
2505 if (is_mimo(tbl_type.lq_type)) 2505 if (is_mimo(tbl_type.lq_type))
2506 lq_cmd->general_params.mimo_delimiter = index; 2506 lq_cmd->general_params.mimo_delimiter = index;
2507 2507
2508 /* Get next rate */ 2508 /* Get next rate */
2509 new_rate = iwl4965_rs_get_lower_rate(lq_sta, 2509 new_rate = il4965_rs_get_lower_rate(lq_sta,
2510 &tbl_type, rate_idx, 2510 &tbl_type, rate_idx,
2511 use_ht_possible); 2511 use_ht_possible);
2512 2512
@@ -2515,21 +2515,21 @@ static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv,
2515 if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) 2515 if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE)
2516 ant_toggle_cnt++; 2516 ant_toggle_cnt++;
2517 else if (priv && 2517 else if (priv &&
2518 iwl4965_rs_toggle_antenna(valid_tx_ant, 2518 il4965_rs_toggle_antenna(valid_tx_ant,
2519 &new_rate, &tbl_type)) 2519 &new_rate, &tbl_type))
2520 ant_toggle_cnt = 1; 2520 ant_toggle_cnt = 1;
2521 2521
2522 repeat_rate = IWL_NUMBER_TRY; 2522 repeat_rate = IL_NUMBER_TRY;
2523 } else { 2523 } else {
2524 repeat_rate = IWL_HT_NUMBER_TRY; 2524 repeat_rate = IL_HT_NUMBER_TRY;
2525 } 2525 }
2526 2526
2527 /* Don't allow HT rates after next pass. 2527 /* Don't allow HT rates after next pass.
2528 * iwl4965_rs_get_lower_rate() will change type to LQ_A or LQ_G. */ 2528 * il4965_rs_get_lower_rate() will change type to LQ_A or LQ_G. */
2529 use_ht_possible = 0; 2529 use_ht_possible = 0;
2530 2530
2531 /* Override next rate if needed for debug purposes */ 2531 /* Override next rate if needed for debug purposes */
2532 iwl4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); 2532 il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index);
2533 2533
2534 /* Fill next table entry */ 2534 /* Fill next table entry */
2535 lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(new_rate); 2535 lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(new_rate);
@@ -2546,36 +2546,36 @@ static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv,
2546} 2546}
2547 2547
2548static void 2548static void
2549*iwl4965_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) 2549*il4965_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
2550{ 2550{
2551 return hw->priv; 2551 return hw->priv;
2552} 2552}
2553/* rate scale requires free function to be implemented */ 2553/* rate scale requires free function to be implemented */
2554static void iwl4965_rs_free(void *priv_rate) 2554static void il4965_rs_free(void *priv_rate)
2555{ 2555{
2556 return; 2556 return;
2557} 2557}
2558 2558
2559static void iwl4965_rs_free_sta(void *priv_r, struct ieee80211_sta *sta, 2559static void il4965_rs_free_sta(void *priv_r, struct ieee80211_sta *sta,
2560 void *priv_sta) 2560 void *priv_sta)
2561{ 2561{
2562 struct iwl_priv *priv __maybe_unused = priv_r; 2562 struct il_priv *priv __maybe_unused = priv_r;
2563 2563
2564 IWL_DEBUG_RATE(priv, "enter\n"); 2564 IL_DEBUG_RATE(priv, "enter\n");
2565 IWL_DEBUG_RATE(priv, "leave\n"); 2565 IL_DEBUG_RATE(priv, "leave\n");
2566} 2566}
2567 2567
2568 2568
2569#ifdef CONFIG_MAC80211_DEBUGFS 2569#ifdef CONFIG_MAC80211_DEBUGFS
2570static int iwl4965_open_file_generic(struct inode *inode, struct file *file) 2570static int il4965_open_file_generic(struct inode *inode, struct file *file)
2571{ 2571{
2572 file->private_data = inode->i_private; 2572 file->private_data = inode->i_private;
2573 return 0; 2573 return 0;
2574} 2574}
2575static void iwl4965_rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 2575static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta,
2576 u32 *rate_n_flags, int index) 2576 u32 *rate_n_flags, int index)
2577{ 2577{
2578 struct iwl_priv *priv; 2578 struct il_priv *priv;
2579 u8 valid_tx_ant; 2579 u8 valid_tx_ant;
2580 u8 ant_sel_tx; 2580 u8 ant_sel_tx;
2581 2581
@@ -2587,30 +2587,30 @@ static void iwl4965_rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
2587 >> RATE_MCS_ANT_POS); 2587 >> RATE_MCS_ANT_POS);
2588 if ((valid_tx_ant & ant_sel_tx) == ant_sel_tx) { 2588 if ((valid_tx_ant & ant_sel_tx) == ant_sel_tx) {
2589 *rate_n_flags = lq_sta->dbg_fixed_rate; 2589 *rate_n_flags = lq_sta->dbg_fixed_rate;
2590 IWL_DEBUG_RATE(priv, "Fixed rate ON\n"); 2590 IL_DEBUG_RATE(priv, "Fixed rate ON\n");
2591 } else { 2591 } else {
2592 lq_sta->dbg_fixed_rate = 0; 2592 lq_sta->dbg_fixed_rate = 0;
2593 IWL_ERR(priv, 2593 IL_ERR(priv,
2594 "Invalid antenna selection 0x%X, Valid is 0x%X\n", 2594 "Invalid antenna selection 0x%X, Valid is 0x%X\n",
2595 ant_sel_tx, valid_tx_ant); 2595 ant_sel_tx, valid_tx_ant);
2596 IWL_DEBUG_RATE(priv, "Fixed rate OFF\n"); 2596 IL_DEBUG_RATE(priv, "Fixed rate OFF\n");
2597 } 2597 }
2598 } else { 2598 } else {
2599 IWL_DEBUG_RATE(priv, "Fixed rate OFF\n"); 2599 IL_DEBUG_RATE(priv, "Fixed rate OFF\n");
2600 } 2600 }
2601} 2601}
2602 2602
2603static ssize_t iwl4965_rs_sta_dbgfs_scale_table_write(struct file *file, 2603static ssize_t il4965_rs_sta_dbgfs_scale_table_write(struct file *file,
2604 const char __user *user_buf, size_t count, loff_t *ppos) 2604 const char __user *user_buf, size_t count, loff_t *ppos)
2605{ 2605{
2606 struct iwl_lq_sta *lq_sta = file->private_data; 2606 struct il_lq_sta *lq_sta = file->private_data;
2607 struct iwl_priv *priv; 2607 struct il_priv *priv;
2608 char buf[64]; 2608 char buf[64];
2609 size_t buf_size; 2609 size_t buf_size;
2610 u32 parsed_rate; 2610 u32 parsed_rate;
2611 struct iwl_station_priv *sta_priv = 2611 struct il_station_priv *sta_priv =
2612 container_of(lq_sta, struct iwl_station_priv, lq_sta); 2612 container_of(lq_sta, struct il_station_priv, lq_sta);
2613 struct iwl_rxon_context *ctx = sta_priv->common.ctx; 2613 struct il_rxon_context *ctx = sta_priv->common.ctx;
2614 2614
2615 priv = lq_sta->drv; 2615 priv = lq_sta->drv;
2616 memset(buf, 0, sizeof(buf)); 2616 memset(buf, 0, sizeof(buf));
@@ -2627,19 +2627,19 @@ static ssize_t iwl4965_rs_sta_dbgfs_scale_table_write(struct file *file,
2627 lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ 2627 lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
2628 lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ 2628 lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
2629 2629
2630 IWL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n", 2630 IL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n",
2631 lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate); 2631 lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate);
2632 2632
2633 if (lq_sta->dbg_fixed_rate) { 2633 if (lq_sta->dbg_fixed_rate) {
2634 iwl4965_rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); 2634 il4965_rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate);
2635 iwl_legacy_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC, 2635 il_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC,
2636 false); 2636 false);
2637 } 2637 }
2638 2638
2639 return count; 2639 return count;
2640} 2640}
2641 2641
2642static ssize_t iwl4965_rs_sta_dbgfs_scale_table_read(struct file *file, 2642static ssize_t il4965_rs_sta_dbgfs_scale_table_read(struct file *file,
2643 char __user *user_buf, size_t count, loff_t *ppos) 2643 char __user *user_buf, size_t count, loff_t *ppos)
2644{ 2644{
2645 char *buff; 2645 char *buff;
@@ -2648,9 +2648,9 @@ static ssize_t iwl4965_rs_sta_dbgfs_scale_table_read(struct file *file,
2648 int index = 0; 2648 int index = 0;
2649 ssize_t ret; 2649 ssize_t ret;
2650 2650
2651 struct iwl_lq_sta *lq_sta = file->private_data; 2651 struct il_lq_sta *lq_sta = file->private_data;
2652 struct iwl_priv *priv; 2652 struct il_priv *priv;
2653 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 2653 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
2654 2654
2655 priv = lq_sta->drv; 2655 priv = lq_sta->drv;
2656 buff = kmalloc(1024, GFP_KERNEL); 2656 buff = kmalloc(1024, GFP_KERNEL);
@@ -2702,19 +2702,19 @@ static ssize_t iwl4965_rs_sta_dbgfs_scale_table_read(struct file *file,
2702 lq_sta->lq.general_params.start_rate_index[3]); 2702 lq_sta->lq.general_params.start_rate_index[3]);
2703 2703
2704 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { 2704 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) {
2705 index = iwl4965_hwrate_to_plcp_idx( 2705 index = il4965_hwrate_to_plcp_idx(
2706 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags)); 2706 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags));
2707 if (is_legacy(tbl->lq_type)) { 2707 if (is_legacy(tbl->lq_type)) {
2708 desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n", 2708 desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n",
2709 i, 2709 i,
2710 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), 2710 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags),
2711 iwl_rate_mcs[index].mbps); 2711 il_rate_mcs[index].mbps);
2712 } else { 2712 } else {
2713 desc += sprintf(buff+desc, 2713 desc += sprintf(buff+desc,
2714 " rate[%d] 0x%X %smbps (%s)\n", 2714 " rate[%d] 0x%X %smbps (%s)\n",
2715 i, 2715 i,
2716 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), 2716 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags),
2717 iwl_rate_mcs[index].mbps, iwl_rate_mcs[index].mcs); 2717 il_rate_mcs[index].mbps, il_rate_mcs[index].mcs);
2718 } 2718 }
2719 } 2719 }
2720 2720
@@ -2724,12 +2724,12 @@ static ssize_t iwl4965_rs_sta_dbgfs_scale_table_read(struct file *file,
2724} 2724}
2725 2725
2726static const struct file_operations rs_sta_dbgfs_scale_table_ops = { 2726static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
2727 .write = iwl4965_rs_sta_dbgfs_scale_table_write, 2727 .write = il4965_rs_sta_dbgfs_scale_table_write,
2728 .read = iwl4965_rs_sta_dbgfs_scale_table_read, 2728 .read = il4965_rs_sta_dbgfs_scale_table_read,
2729 .open = iwl4965_open_file_generic, 2729 .open = il4965_open_file_generic,
2730 .llseek = default_llseek, 2730 .llseek = default_llseek,
2731}; 2731};
2732static ssize_t iwl4965_rs_sta_dbgfs_stats_table_read(struct file *file, 2732static ssize_t il4965_rs_sta_dbgfs_stats_table_read(struct file *file,
2733 char __user *user_buf, size_t count, loff_t *ppos) 2733 char __user *user_buf, size_t count, loff_t *ppos)
2734{ 2734{
2735 char *buff; 2735 char *buff;
@@ -2737,7 +2737,7 @@ static ssize_t iwl4965_rs_sta_dbgfs_stats_table_read(struct file *file,
2737 int i, j; 2737 int i, j;
2738 ssize_t ret; 2738 ssize_t ret;
2739 2739
2740 struct iwl_lq_sta *lq_sta = file->private_data; 2740 struct il_lq_sta *lq_sta = file->private_data;
2741 2741
2742 buff = kmalloc(1024, GFP_KERNEL); 2742 buff = kmalloc(1024, GFP_KERNEL);
2743 if (!buff) 2743 if (!buff)
@@ -2754,7 +2754,7 @@ static ssize_t iwl4965_rs_sta_dbgfs_stats_table_read(struct file *file,
2754 lq_sta->lq_info[i].is_dup, 2754 lq_sta->lq_info[i].is_dup,
2755 lq_sta->is_green, 2755 lq_sta->is_green,
2756 lq_sta->lq_info[i].current_rate); 2756 lq_sta->lq_info[i].current_rate);
2757 for (j = 0; j < IWL_RATE_COUNT; j++) { 2757 for (j = 0; j < IL_RATE_COUNT; j++) {
2758 desc += sprintf(buff+desc, 2758 desc += sprintf(buff+desc,
2759 "counter=%d success=%d %%=%d\n", 2759 "counter=%d success=%d %%=%d\n",
2760 lq_sta->lq_info[i].win[j].counter, 2760 lq_sta->lq_info[i].win[j].counter,
@@ -2768,21 +2768,21 @@ static ssize_t iwl4965_rs_sta_dbgfs_stats_table_read(struct file *file,
2768} 2768}
2769 2769
2770static const struct file_operations rs_sta_dbgfs_stats_table_ops = { 2770static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
2771 .read = iwl4965_rs_sta_dbgfs_stats_table_read, 2771 .read = il4965_rs_sta_dbgfs_stats_table_read,
2772 .open = iwl4965_open_file_generic, 2772 .open = il4965_open_file_generic,
2773 .llseek = default_llseek, 2773 .llseek = default_llseek,
2774}; 2774};
2775 2775
2776static ssize_t iwl4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file, 2776static ssize_t il4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file,
2777 char __user *user_buf, size_t count, loff_t *ppos) 2777 char __user *user_buf, size_t count, loff_t *ppos)
2778{ 2778{
2779 char buff[120]; 2779 char buff[120];
2780 int desc = 0; 2780 int desc = 0;
2781 ssize_t ret; 2781 ssize_t ret;
2782 2782
2783 struct iwl_lq_sta *lq_sta = file->private_data; 2783 struct il_lq_sta *lq_sta = file->private_data;
2784 struct iwl_priv *priv; 2784 struct il_priv *priv;
2785 struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; 2785 struct il_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl];
2786 2786
2787 priv = lq_sta->drv; 2787 priv = lq_sta->drv;
2788 2788
@@ -2800,15 +2800,15 @@ static ssize_t iwl4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file,
2800} 2800}
2801 2801
2802static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { 2802static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = {
2803 .read = iwl4965_rs_sta_dbgfs_rate_scale_data_read, 2803 .read = il4965_rs_sta_dbgfs_rate_scale_data_read,
2804 .open = iwl4965_open_file_generic, 2804 .open = il4965_open_file_generic,
2805 .llseek = default_llseek, 2805 .llseek = default_llseek,
2806}; 2806};
2807 2807
2808static void iwl4965_rs_add_debugfs(void *priv, void *priv_sta, 2808static void il4965_rs_add_debugfs(void *priv, void *priv_sta,
2809 struct dentry *dir) 2809 struct dentry *dir)
2810{ 2810{
2811 struct iwl_lq_sta *lq_sta = priv_sta; 2811 struct il_lq_sta *lq_sta = priv_sta;
2812 lq_sta->rs_sta_dbgfs_scale_table_file = 2812 lq_sta->rs_sta_dbgfs_scale_table_file =
2813 debugfs_create_file("rate_scale_table", S_IRUSR | S_IWUSR, dir, 2813 debugfs_create_file("rate_scale_table", S_IRUSR | S_IWUSR, dir,
2814 lq_sta, &rs_sta_dbgfs_scale_table_ops); 2814 lq_sta, &rs_sta_dbgfs_scale_table_ops);
@@ -2824,9 +2824,9 @@ static void iwl4965_rs_add_debugfs(void *priv, void *priv_sta,
2824 2824
2825} 2825}
2826 2826
2827static void iwl4965_rs_remove_debugfs(void *priv, void *priv_sta) 2827static void il4965_rs_remove_debugfs(void *priv, void *priv_sta)
2828{ 2828{
2829 struct iwl_lq_sta *lq_sta = priv_sta; 2829 struct il_lq_sta *lq_sta = priv_sta;
2830 debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); 2830 debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file);
2831 debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); 2831 debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file);
2832 debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file); 2832 debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file);
@@ -2840,32 +2840,32 @@ static void iwl4965_rs_remove_debugfs(void *priv, void *priv_sta)
2840 * station is added we ignore it. 2840 * station is added we ignore it.
2841 */ 2841 */
2842static void 2842static void
2843iwl4965_rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband, 2843il4965_rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband,
2844 struct ieee80211_sta *sta, void *priv_sta) 2844 struct ieee80211_sta *sta, void *priv_sta)
2845{ 2845{
2846} 2846}
2847static struct rate_control_ops rs_4965_ops = { 2847static struct rate_control_ops rs_4965_ops = {
2848 .module = NULL, 2848 .module = NULL,
2849 .name = IWL4965_RS_NAME, 2849 .name = IWL4965_RS_NAME,
2850 .tx_status = iwl4965_rs_tx_status, 2850 .tx_status = il4965_rs_tx_status,
2851 .get_rate = iwl4965_rs_get_rate, 2851 .get_rate = il4965_rs_get_rate,
2852 .rate_init = iwl4965_rs_rate_init_stub, 2852 .rate_init = il4965_rs_rate_init_stub,
2853 .alloc = iwl4965_rs_alloc, 2853 .alloc = il4965_rs_alloc,
2854 .free = iwl4965_rs_free, 2854 .free = il4965_rs_free,
2855 .alloc_sta = iwl4965_rs_alloc_sta, 2855 .alloc_sta = il4965_rs_alloc_sta,
2856 .free_sta = iwl4965_rs_free_sta, 2856 .free_sta = il4965_rs_free_sta,
2857#ifdef CONFIG_MAC80211_DEBUGFS 2857#ifdef CONFIG_MAC80211_DEBUGFS
2858 .add_sta_debugfs = iwl4965_rs_add_debugfs, 2858 .add_sta_debugfs = il4965_rs_add_debugfs,
2859 .remove_sta_debugfs = iwl4965_rs_remove_debugfs, 2859 .remove_sta_debugfs = il4965_rs_remove_debugfs,
2860#endif 2860#endif
2861}; 2861};
2862 2862
2863int iwl4965_rate_control_register(void) 2863int il4965_rate_control_register(void)
2864{ 2864{
2865 return ieee80211_rate_control_register(&rs_4965_ops); 2865 return ieee80211_rate_control_register(&rs_4965_ops);
2866} 2866}
2867 2867
2868void iwl4965_rate_control_unregister(void) 2868void il4965_rate_control_unregister(void)
2869{ 2869{
2870 ieee80211_rate_control_unregister(&rs_4965_ops); 2870 ieee80211_rate_control_unregister(&rs_4965_ops);
2871} 2871}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rx.c b/drivers/net/wireless/iwlegacy/iwl-4965-rx.c
index 2b144bbfc3c5..47cbe565a530 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rx.c
@@ -41,31 +41,31 @@
41#include "iwl-4965-hw.h" 41#include "iwl-4965-hw.h"
42#include "iwl-4965.h" 42#include "iwl-4965.h"
43 43
44void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv, 44void il4965_rx_missed_beacon_notif(struct il_priv *priv,
45 struct iwl_rx_mem_buffer *rxb) 45 struct il_rx_mem_buffer *rxb)
46 46
47{ 47{
48 struct iwl_rx_packet *pkt = rxb_addr(rxb); 48 struct il_rx_packet *pkt = rxb_addr(rxb);
49 struct iwl_missed_beacon_notif *missed_beacon; 49 struct il_missed_beacon_notif *missed_beacon;
50 50
51 missed_beacon = &pkt->u.missed_beacon; 51 missed_beacon = &pkt->u.missed_beacon;
52 if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) > 52 if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) >
53 priv->missed_beacon_threshold) { 53 priv->missed_beacon_threshold) {
54 IWL_DEBUG_CALIB(priv, 54 IL_DEBUG_CALIB(priv,
55 "missed bcn cnsq %d totl %d rcd %d expctd %d\n", 55 "missed bcn cnsq %d totl %d rcd %d expctd %d\n",
56 le32_to_cpu(missed_beacon->consecutive_missed_beacons), 56 le32_to_cpu(missed_beacon->consecutive_missed_beacons),
57 le32_to_cpu(missed_beacon->total_missed_becons), 57 le32_to_cpu(missed_beacon->total_missed_becons),
58 le32_to_cpu(missed_beacon->num_recvd_beacons), 58 le32_to_cpu(missed_beacon->num_recvd_beacons),
59 le32_to_cpu(missed_beacon->num_expected_beacons)); 59 le32_to_cpu(missed_beacon->num_expected_beacons));
60 if (!test_bit(STATUS_SCANNING, &priv->status)) 60 if (!test_bit(STATUS_SCANNING, &priv->status))
61 iwl4965_init_sensitivity(priv); 61 il4965_init_sensitivity(priv);
62 } 62 }
63} 63}
64 64
65/* Calculate noise level, based on measurements during network silence just 65/* Calculate noise level, based on measurements during network silence just
66 * before arriving beacon. This measurement can be done only if we know 66 * before arriving beacon. This measurement can be done only if we know
67 * exactly when to expect beacons, therefore only when we're associated. */ 67 * exactly when to expect beacons, therefore only when we're associated. */
68static void iwl4965_rx_calc_noise(struct iwl_priv *priv) 68static void il4965_rx_calc_noise(struct il_priv *priv)
69{ 69{
70 struct statistics_rx_non_phy *rx_info; 70 struct statistics_rx_non_phy *rx_info;
71 int num_active_rx = 0; 71 int num_active_rx = 0;
@@ -98,9 +98,9 @@ static void iwl4965_rx_calc_noise(struct iwl_priv *priv)
98 if (num_active_rx) 98 if (num_active_rx)
99 last_rx_noise = (total_silence / num_active_rx) - 107; 99 last_rx_noise = (total_silence / num_active_rx) - 107;
100 else 100 else
101 last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; 101 last_rx_noise = IL_NOISE_MEAS_NOT_AVAILABLE;
102 102
103 IWL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n", 103 IL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n",
104 bcn_silence_a, bcn_silence_b, bcn_silence_c, 104 bcn_silence_a, bcn_silence_b, bcn_silence_c,
105 last_rx_noise); 105 last_rx_noise);
106} 106}
@@ -111,7 +111,7 @@ static void iwl4965_rx_calc_noise(struct iwl_priv *priv)
111 * FIXME: This function is for debugging, do not deal with 111 * FIXME: This function is for debugging, do not deal with
112 * the case of counters roll-over. 112 * the case of counters roll-over.
113 */ 113 */
114static void iwl4965_accumulative_statistics(struct iwl_priv *priv, 114static void il4965_accumulative_statistics(struct il_priv *priv,
115 __le32 *stats) 115 __le32 *stats)
116{ 116{
117 int i, size; 117 int i, size;
@@ -123,7 +123,7 @@ static void iwl4965_accumulative_statistics(struct iwl_priv *priv,
123 123
124 prev_stats = (__le32 *)&priv->_4965.statistics; 124 prev_stats = (__le32 *)&priv->_4965.statistics;
125 accum_stats = (u32 *)&priv->_4965.accum_statistics; 125 accum_stats = (u32 *)&priv->_4965.accum_statistics;
126 size = sizeof(struct iwl_notif_statistics); 126 size = sizeof(struct il_notif_statistics);
127 general = &priv->_4965.statistics.general.common; 127 general = &priv->_4965.statistics.general.common;
128 accum_general = &priv->_4965.accum_statistics.general.common; 128 accum_general = &priv->_4965.accum_statistics.general.common;
129 tx = &priv->_4965.statistics.tx; 129 tx = &priv->_4965.statistics.tx;
@@ -151,15 +151,15 @@ static void iwl4965_accumulative_statistics(struct iwl_priv *priv,
151 151
152#define REG_RECALIB_PERIOD (60) 152#define REG_RECALIB_PERIOD (60)
153 153
154void iwl4965_rx_statistics(struct iwl_priv *priv, 154void il4965_rx_statistics(struct il_priv *priv,
155 struct iwl_rx_mem_buffer *rxb) 155 struct il_rx_mem_buffer *rxb)
156{ 156{
157 int change; 157 int change;
158 struct iwl_rx_packet *pkt = rxb_addr(rxb); 158 struct il_rx_packet *pkt = rxb_addr(rxb);
159 159
160 IWL_DEBUG_RX(priv, 160 IL_DEBUG_RX(priv,
161 "Statistics notification received (%d vs %d).\n", 161 "Statistics notification received (%d vs %d).\n",
162 (int)sizeof(struct iwl_notif_statistics), 162 (int)sizeof(struct il_notif_statistics),
163 le32_to_cpu(pkt->len_n_flags) & 163 le32_to_cpu(pkt->len_n_flags) &
164 FH_RSCSR_FRAME_SIZE_MSK); 164 FH_RSCSR_FRAME_SIZE_MSK);
165 165
@@ -170,7 +170,7 @@ void iwl4965_rx_statistics(struct iwl_priv *priv,
170 (pkt->u.stats.flag & 170 (pkt->u.stats.flag &
171 STATISTICS_REPLY_FLG_HT40_MODE_MSK))); 171 STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
172#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 172#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
173 iwl4965_accumulative_statistics(priv, (__le32 *)&pkt->u.stats); 173 il4965_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
174#endif 174#endif
175 175
176 /* TODO: reading some of statistics is unneeded */ 176 /* TODO: reading some of statistics is unneeded */
@@ -188,28 +188,28 @@ void iwl4965_rx_statistics(struct iwl_priv *priv,
188 188
189 if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && 189 if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) &&
190 (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) { 190 (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
191 iwl4965_rx_calc_noise(priv); 191 il4965_rx_calc_noise(priv);
192 queue_work(priv->workqueue, &priv->run_time_calib_work); 192 queue_work(priv->workqueue, &priv->run_time_calib_work);
193 } 193 }
194 if (priv->cfg->ops->lib->temp_ops.temperature && change) 194 if (priv->cfg->ops->lib->temp_ops.temperature && change)
195 priv->cfg->ops->lib->temp_ops.temperature(priv); 195 priv->cfg->ops->lib->temp_ops.temperature(priv);
196} 196}
197 197
198void iwl4965_reply_statistics(struct iwl_priv *priv, 198void il4965_reply_statistics(struct il_priv *priv,
199 struct iwl_rx_mem_buffer *rxb) 199 struct il_rx_mem_buffer *rxb)
200{ 200{
201 struct iwl_rx_packet *pkt = rxb_addr(rxb); 201 struct il_rx_packet *pkt = rxb_addr(rxb);
202 202
203 if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) { 203 if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) {
204#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 204#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
205 memset(&priv->_4965.accum_statistics, 0, 205 memset(&priv->_4965.accum_statistics, 0,
206 sizeof(struct iwl_notif_statistics)); 206 sizeof(struct il_notif_statistics));
207 memset(&priv->_4965.delta_statistics, 0, 207 memset(&priv->_4965.delta_statistics, 0,
208 sizeof(struct iwl_notif_statistics)); 208 sizeof(struct il_notif_statistics));
209 memset(&priv->_4965.max_delta, 0, 209 memset(&priv->_4965.max_delta, 0,
210 sizeof(struct iwl_notif_statistics)); 210 sizeof(struct il_notif_statistics));
211#endif 211#endif
212 IWL_DEBUG_RX(priv, "Statistics have been cleared\n"); 212 IL_DEBUG_RX(priv, "Statistics have been cleared\n");
213 } 213 }
214 iwl4965_rx_statistics(priv, rxb); 214 il4965_rx_statistics(priv, rxb);
215} 215}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
index a262c23553d2..3ac9aef439a6 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
@@ -34,45 +34,45 @@
34#include "iwl-sta.h" 34#include "iwl-sta.h"
35#include "iwl-4965.h" 35#include "iwl-4965.h"
36 36
37static struct iwl_link_quality_cmd * 37static struct il_link_quality_cmd *
38iwl4965_sta_alloc_lq(struct iwl_priv *priv, u8 sta_id) 38il4965_sta_alloc_lq(struct il_priv *priv, u8 sta_id)
39{ 39{
40 int i, r; 40 int i, r;
41 struct iwl_link_quality_cmd *link_cmd; 41 struct il_link_quality_cmd *link_cmd;
42 u32 rate_flags = 0; 42 u32 rate_flags = 0;
43 __le32 rate_n_flags; 43 __le32 rate_n_flags;
44 44
45 link_cmd = kzalloc(sizeof(struct iwl_link_quality_cmd), GFP_KERNEL); 45 link_cmd = kzalloc(sizeof(struct il_link_quality_cmd), GFP_KERNEL);
46 if (!link_cmd) { 46 if (!link_cmd) {
47 IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n"); 47 IL_ERR(priv, "Unable to allocate memory for LQ cmd.\n");
48 return NULL; 48 return NULL;
49 } 49 }
50 /* Set up the rate scaling to start at selected rate, fall back 50 /* Set up the rate scaling to start at selected rate, fall back
51 * all the way down to 1M in IEEE order, and then spin on 1M */ 51 * all the way down to 1M in IEEE order, and then spin on 1M */
52 if (priv->band == IEEE80211_BAND_5GHZ) 52 if (priv->band == IEEE80211_BAND_5GHZ)
53 r = IWL_RATE_6M_INDEX; 53 r = IL_RATE_6M_INDEX;
54 else 54 else
55 r = IWL_RATE_1M_INDEX; 55 r = IL_RATE_1M_INDEX;
56 56
57 if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) 57 if (r >= IL_FIRST_CCK_RATE && r <= IL_LAST_CCK_RATE)
58 rate_flags |= RATE_MCS_CCK_MSK; 58 rate_flags |= RATE_MCS_CCK_MSK;
59 59
60 rate_flags |= iwl4965_first_antenna(priv->hw_params.valid_tx_ant) << 60 rate_flags |= il4965_first_antenna(priv->hw_params.valid_tx_ant) <<
61 RATE_MCS_ANT_POS; 61 RATE_MCS_ANT_POS;
62 rate_n_flags = iwl4965_hw_set_rate_n_flags(iwlegacy_rates[r].plcp, 62 rate_n_flags = il4965_hw_set_rate_n_flags(iwlegacy_rates[r].plcp,
63 rate_flags); 63 rate_flags);
64 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) 64 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
65 link_cmd->rs_table[i].rate_n_flags = rate_n_flags; 65 link_cmd->rs_table[i].rate_n_flags = rate_n_flags;
66 66
67 link_cmd->general_params.single_stream_ant_msk = 67 link_cmd->general_params.single_stream_ant_msk =
68 iwl4965_first_antenna(priv->hw_params.valid_tx_ant); 68 il4965_first_antenna(priv->hw_params.valid_tx_ant);
69 69
70 link_cmd->general_params.dual_stream_ant_msk = 70 link_cmd->general_params.dual_stream_ant_msk =
71 priv->hw_params.valid_tx_ant & 71 priv->hw_params.valid_tx_ant &
72 ~iwl4965_first_antenna(priv->hw_params.valid_tx_ant); 72 ~il4965_first_antenna(priv->hw_params.valid_tx_ant);
73 if (!link_cmd->general_params.dual_stream_ant_msk) { 73 if (!link_cmd->general_params.dual_stream_ant_msk) {
74 link_cmd->general_params.dual_stream_ant_msk = ANT_AB; 74 link_cmd->general_params.dual_stream_ant_msk = ANT_AB;
75 } else if (iwl4965_num_of_ant(priv->hw_params.valid_tx_ant) == 2) { 75 } else if (il4965_num_of_ant(priv->hw_params.valid_tx_ant) == 2) {
76 link_cmd->general_params.dual_stream_ant_msk = 76 link_cmd->general_params.dual_stream_ant_msk =
77 priv->hw_params.valid_tx_ant; 77 priv->hw_params.valid_tx_ant;
78 } 78 }
@@ -87,25 +87,25 @@ iwl4965_sta_alloc_lq(struct iwl_priv *priv, u8 sta_id)
87} 87}
88 88
89/* 89/*
90 * iwl4965_add_bssid_station - Add the special IBSS BSSID station 90 * il4965_add_bssid_station - Add the special IBSS BSSID station
91 * 91 *
92 * Function sleeps. 92 * Function sleeps.
93 */ 93 */
94int 94int
95iwl4965_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 95il4965_add_bssid_station(struct il_priv *priv, struct il_rxon_context *ctx,
96 const u8 *addr, u8 *sta_id_r) 96 const u8 *addr, u8 *sta_id_r)
97{ 97{
98 int ret; 98 int ret;
99 u8 sta_id; 99 u8 sta_id;
100 struct iwl_link_quality_cmd *link_cmd; 100 struct il_link_quality_cmd *link_cmd;
101 unsigned long flags; 101 unsigned long flags;
102 102
103 if (sta_id_r) 103 if (sta_id_r)
104 *sta_id_r = IWL_INVALID_STATION; 104 *sta_id_r = IL_INVALID_STATION;
105 105
106 ret = iwl_legacy_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); 106 ret = il_add_station_common(priv, ctx, addr, 0, NULL, &sta_id);
107 if (ret) { 107 if (ret) {
108 IWL_ERR(priv, "Unable to add station %pM\n", addr); 108 IL_ERR(priv, "Unable to add station %pM\n", addr);
109 return ret; 109 return ret;
110 } 110 }
111 111
@@ -113,21 +113,21 @@ iwl4965_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
113 *sta_id_r = sta_id; 113 *sta_id_r = sta_id;
114 114
115 spin_lock_irqsave(&priv->sta_lock, flags); 115 spin_lock_irqsave(&priv->sta_lock, flags);
116 priv->stations[sta_id].used |= IWL_STA_LOCAL; 116 priv->stations[sta_id].used |= IL_STA_LOCAL;
117 spin_unlock_irqrestore(&priv->sta_lock, flags); 117 spin_unlock_irqrestore(&priv->sta_lock, flags);
118 118
119 /* Set up default rate scaling table in device's station table */ 119 /* Set up default rate scaling table in device's station table */
120 link_cmd = iwl4965_sta_alloc_lq(priv, sta_id); 120 link_cmd = il4965_sta_alloc_lq(priv, sta_id);
121 if (!link_cmd) { 121 if (!link_cmd) {
122 IWL_ERR(priv, 122 IL_ERR(priv,
123 "Unable to initialize rate scaling for station %pM.\n", 123 "Unable to initialize rate scaling for station %pM.\n",
124 addr); 124 addr);
125 return -ENOMEM; 125 return -ENOMEM;
126 } 126 }
127 127
128 ret = iwl_legacy_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true); 128 ret = il_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true);
129 if (ret) 129 if (ret)
130 IWL_ERR(priv, "Link quality command failed (%d)\n", ret); 130 IL_ERR(priv, "Link quality command failed (%d)\n", ret);
131 131
132 spin_lock_irqsave(&priv->sta_lock, flags); 132 spin_lock_irqsave(&priv->sta_lock, flags);
133 priv->stations[sta_id].lq = link_cmd; 133 priv->stations[sta_id].lq = link_cmd;
@@ -136,16 +136,16 @@ iwl4965_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
136 return 0; 136 return 0;
137} 137}
138 138
139static int iwl4965_static_wepkey_cmd(struct iwl_priv *priv, 139static int il4965_static_wepkey_cmd(struct il_priv *priv,
140 struct iwl_rxon_context *ctx, 140 struct il_rxon_context *ctx,
141 bool send_if_empty) 141 bool send_if_empty)
142{ 142{
143 int i, not_empty = 0; 143 int i, not_empty = 0;
144 u8 buff[sizeof(struct iwl_wep_cmd) + 144 u8 buff[sizeof(struct il_wep_cmd) +
145 sizeof(struct iwl_wep_key) * WEP_KEYS_MAX]; 145 sizeof(struct il_wep_key) * WEP_KEYS_MAX];
146 struct iwl_wep_cmd *wep_cmd = (struct iwl_wep_cmd *)buff; 146 struct il_wep_cmd *wep_cmd = (struct il_wep_cmd *)buff;
147 size_t cmd_size = sizeof(struct iwl_wep_cmd); 147 size_t cmd_size = sizeof(struct il_wep_cmd);
148 struct iwl_host_cmd cmd = { 148 struct il_host_cmd cmd = {
149 .id = ctx->wep_key_cmd, 149 .id = ctx->wep_key_cmd,
150 .data = wep_cmd, 150 .data = wep_cmd,
151 .flags = CMD_SYNC, 151 .flags = CMD_SYNC,
@@ -154,7 +154,7 @@ static int iwl4965_static_wepkey_cmd(struct iwl_priv *priv,
154 might_sleep(); 154 might_sleep();
155 155
156 memset(wep_cmd, 0, cmd_size + 156 memset(wep_cmd, 0, cmd_size +
157 (sizeof(struct iwl_wep_key) * WEP_KEYS_MAX)); 157 (sizeof(struct il_wep_key) * WEP_KEYS_MAX));
158 158
159 for (i = 0; i < WEP_KEYS_MAX ; i++) { 159 for (i = 0; i < WEP_KEYS_MAX ; i++) {
160 wep_cmd->key[i].key_index = i; 160 wep_cmd->key[i].key_index = i;
@@ -173,51 +173,51 @@ static int iwl4965_static_wepkey_cmd(struct iwl_priv *priv,
173 wep_cmd->global_key_type = WEP_KEY_WEP_TYPE; 173 wep_cmd->global_key_type = WEP_KEY_WEP_TYPE;
174 wep_cmd->num_keys = WEP_KEYS_MAX; 174 wep_cmd->num_keys = WEP_KEYS_MAX;
175 175
176 cmd_size += sizeof(struct iwl_wep_key) * WEP_KEYS_MAX; 176 cmd_size += sizeof(struct il_wep_key) * WEP_KEYS_MAX;
177 177
178 cmd.len = cmd_size; 178 cmd.len = cmd_size;
179 179
180 if (not_empty || send_if_empty) 180 if (not_empty || send_if_empty)
181 return iwl_legacy_send_cmd(priv, &cmd); 181 return il_send_cmd(priv, &cmd);
182 else 182 else
183 return 0; 183 return 0;
184} 184}
185 185
186int iwl4965_restore_default_wep_keys(struct iwl_priv *priv, 186int il4965_restore_default_wep_keys(struct il_priv *priv,
187 struct iwl_rxon_context *ctx) 187 struct il_rxon_context *ctx)
188{ 188{
189 lockdep_assert_held(&priv->mutex); 189 lockdep_assert_held(&priv->mutex);
190 190
191 return iwl4965_static_wepkey_cmd(priv, ctx, false); 191 return il4965_static_wepkey_cmd(priv, ctx, false);
192} 192}
193 193
194int iwl4965_remove_default_wep_key(struct iwl_priv *priv, 194int il4965_remove_default_wep_key(struct il_priv *priv,
195 struct iwl_rxon_context *ctx, 195 struct il_rxon_context *ctx,
196 struct ieee80211_key_conf *keyconf) 196 struct ieee80211_key_conf *keyconf)
197{ 197{
198 int ret; 198 int ret;
199 199
200 lockdep_assert_held(&priv->mutex); 200 lockdep_assert_held(&priv->mutex);
201 201
202 IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", 202 IL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n",
203 keyconf->keyidx); 203 keyconf->keyidx);
204 204
205 memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0])); 205 memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0]));
206 if (iwl_legacy_is_rfkill(priv)) { 206 if (il_is_rfkill(priv)) {
207 IWL_DEBUG_WEP(priv, 207 IL_DEBUG_WEP(priv,
208 "Not sending REPLY_WEPKEY command due to RFKILL.\n"); 208 "Not sending REPLY_WEPKEY command due to RFKILL.\n");
209 /* but keys in device are clear anyway so return success */ 209 /* but keys in device are clear anyway so return success */
210 return 0; 210 return 0;
211 } 211 }
212 ret = iwl4965_static_wepkey_cmd(priv, ctx, 1); 212 ret = il4965_static_wepkey_cmd(priv, ctx, 1);
213 IWL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n", 213 IL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n",
214 keyconf->keyidx, ret); 214 keyconf->keyidx, ret);
215 215
216 return ret; 216 return ret;
217} 217}
218 218
219int iwl4965_set_default_wep_key(struct iwl_priv *priv, 219int il4965_set_default_wep_key(struct il_priv *priv,
220 struct iwl_rxon_context *ctx, 220 struct il_rxon_context *ctx,
221 struct ieee80211_key_conf *keyconf) 221 struct ieee80211_key_conf *keyconf)
222{ 222{
223 int ret; 223 int ret;
@@ -226,7 +226,7 @@ int iwl4965_set_default_wep_key(struct iwl_priv *priv,
226 226
227 if (keyconf->keylen != WEP_KEY_LEN_128 && 227 if (keyconf->keylen != WEP_KEY_LEN_128 &&
228 keyconf->keylen != WEP_KEY_LEN_64) { 228 keyconf->keylen != WEP_KEY_LEN_64) {
229 IWL_DEBUG_WEP(priv, "Bad WEP key length %d\n", keyconf->keylen); 229 IL_DEBUG_WEP(priv, "Bad WEP key length %d\n", keyconf->keylen);
230 return -EINVAL; 230 return -EINVAL;
231 } 231 }
232 232
@@ -238,21 +238,21 @@ int iwl4965_set_default_wep_key(struct iwl_priv *priv,
238 memcpy(&ctx->wep_keys[keyconf->keyidx].key, &keyconf->key, 238 memcpy(&ctx->wep_keys[keyconf->keyidx].key, &keyconf->key,
239 keyconf->keylen); 239 keyconf->keylen);
240 240
241 ret = iwl4965_static_wepkey_cmd(priv, ctx, false); 241 ret = il4965_static_wepkey_cmd(priv, ctx, false);
242 IWL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n", 242 IL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n",
243 keyconf->keylen, keyconf->keyidx, ret); 243 keyconf->keylen, keyconf->keyidx, ret);
244 244
245 return ret; 245 return ret;
246} 246}
247 247
248static int iwl4965_set_wep_dynamic_key_info(struct iwl_priv *priv, 248static int il4965_set_wep_dynamic_key_info(struct il_priv *priv,
249 struct iwl_rxon_context *ctx, 249 struct il_rxon_context *ctx,
250 struct ieee80211_key_conf *keyconf, 250 struct ieee80211_key_conf *keyconf,
251 u8 sta_id) 251 u8 sta_id)
252{ 252{
253 unsigned long flags; 253 unsigned long flags;
254 __le16 key_flags = 0; 254 __le16 key_flags = 0;
255 struct iwl_legacy_addsta_cmd sta_cmd; 255 struct il_addsta_cmd sta_cmd;
256 256
257 lockdep_assert_held(&priv->mutex); 257 lockdep_assert_held(&priv->mutex);
258 258
@@ -283,7 +283,7 @@ static int iwl4965_set_wep_dynamic_key_info(struct iwl_priv *priv,
283 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) 283 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
284 == STA_KEY_FLG_NO_ENC) 284 == STA_KEY_FLG_NO_ENC)
285 priv->stations[sta_id].sta.key.key_offset = 285 priv->stations[sta_id].sta.key.key_offset =
286 iwl_legacy_get_free_ucode_key_index(priv); 286 il_get_free_ucode_key_index(priv);
287 /* else, we are overriding an existing key => no need to allocated room 287 /* else, we are overriding an existing key => no need to allocated room
288 * in uCode. */ 288 * in uCode. */
289 289
@@ -295,20 +295,20 @@ static int iwl4965_set_wep_dynamic_key_info(struct iwl_priv *priv,
295 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 295 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
296 296
297 memcpy(&sta_cmd, &priv->stations[sta_id].sta, 297 memcpy(&sta_cmd, &priv->stations[sta_id].sta,
298 sizeof(struct iwl_legacy_addsta_cmd)); 298 sizeof(struct il_addsta_cmd));
299 spin_unlock_irqrestore(&priv->sta_lock, flags); 299 spin_unlock_irqrestore(&priv->sta_lock, flags);
300 300
301 return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); 301 return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
302} 302}
303 303
304static int iwl4965_set_ccmp_dynamic_key_info(struct iwl_priv *priv, 304static int il4965_set_ccmp_dynamic_key_info(struct il_priv *priv,
305 struct iwl_rxon_context *ctx, 305 struct il_rxon_context *ctx,
306 struct ieee80211_key_conf *keyconf, 306 struct ieee80211_key_conf *keyconf,
307 u8 sta_id) 307 u8 sta_id)
308{ 308{
309 unsigned long flags; 309 unsigned long flags;
310 __le16 key_flags = 0; 310 __le16 key_flags = 0;
311 struct iwl_legacy_addsta_cmd sta_cmd; 311 struct il_addsta_cmd sta_cmd;
312 312
313 lockdep_assert_held(&priv->mutex); 313 lockdep_assert_held(&priv->mutex);
314 314
@@ -334,7 +334,7 @@ static int iwl4965_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
334 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) 334 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
335 == STA_KEY_FLG_NO_ENC) 335 == STA_KEY_FLG_NO_ENC)
336 priv->stations[sta_id].sta.key.key_offset = 336 priv->stations[sta_id].sta.key.key_offset =
337 iwl_legacy_get_free_ucode_key_index(priv); 337 il_get_free_ucode_key_index(priv);
338 /* else, we are overriding an existing key => no need to allocated room 338 /* else, we are overriding an existing key => no need to allocated room
339 * in uCode. */ 339 * in uCode. */
340 340
@@ -346,14 +346,14 @@ static int iwl4965_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
346 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 346 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
347 347
348 memcpy(&sta_cmd, &priv->stations[sta_id].sta, 348 memcpy(&sta_cmd, &priv->stations[sta_id].sta,
349 sizeof(struct iwl_legacy_addsta_cmd)); 349 sizeof(struct il_addsta_cmd));
350 spin_unlock_irqrestore(&priv->sta_lock, flags); 350 spin_unlock_irqrestore(&priv->sta_lock, flags);
351 351
352 return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); 352 return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
353} 353}
354 354
355static int iwl4965_set_tkip_dynamic_key_info(struct iwl_priv *priv, 355static int il4965_set_tkip_dynamic_key_info(struct il_priv *priv,
356 struct iwl_rxon_context *ctx, 356 struct il_rxon_context *ctx,
357 struct ieee80211_key_conf *keyconf, 357 struct ieee80211_key_conf *keyconf,
358 u8 sta_id) 358 u8 sta_id)
359{ 359{
@@ -379,7 +379,7 @@ static int iwl4965_set_tkip_dynamic_key_info(struct iwl_priv *priv,
379 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) 379 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
380 == STA_KEY_FLG_NO_ENC) 380 == STA_KEY_FLG_NO_ENC)
381 priv->stations[sta_id].sta.key.key_offset = 381 priv->stations[sta_id].sta.key.key_offset =
382 iwl_legacy_get_free_ucode_key_index(priv); 382 il_get_free_ucode_key_index(priv);
383 /* else, we are overriding an existing key => no need to allocated room 383 /* else, we are overriding an existing key => no need to allocated room
384 * in uCode. */ 384 * in uCode. */
385 385
@@ -399,8 +399,8 @@ static int iwl4965_set_tkip_dynamic_key_info(struct iwl_priv *priv,
399 return ret; 399 return ret;
400} 400}
401 401
402void iwl4965_update_tkip_key(struct iwl_priv *priv, 402void il4965_update_tkip_key(struct il_priv *priv,
403 struct iwl_rxon_context *ctx, 403 struct il_rxon_context *ctx,
404 struct ieee80211_key_conf *keyconf, 404 struct ieee80211_key_conf *keyconf,
405 struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) 405 struct ieee80211_sta *sta, u32 iv32, u16 *phase1key)
406{ 406{
@@ -408,14 +408,14 @@ void iwl4965_update_tkip_key(struct iwl_priv *priv,
408 unsigned long flags; 408 unsigned long flags;
409 int i; 409 int i;
410 410
411 if (iwl_legacy_scan_cancel(priv)) { 411 if (il_scan_cancel(priv)) {
412 /* cancel scan failed, just live w/ bad key and rely 412 /* cancel scan failed, just live w/ bad key and rely
413 briefly on SW decryption */ 413 briefly on SW decryption */
414 return; 414 return;
415 } 415 }
416 416
417 sta_id = iwl_legacy_sta_id_or_broadcast(priv, ctx, sta); 417 sta_id = il_sta_id_or_broadcast(priv, ctx, sta);
418 if (sta_id == IWL_INVALID_STATION) 418 if (sta_id == IL_INVALID_STATION)
419 return; 419 return;
420 420
421 spin_lock_irqsave(&priv->sta_lock, flags); 421 spin_lock_irqsave(&priv->sta_lock, flags);
@@ -429,21 +429,21 @@ void iwl4965_update_tkip_key(struct iwl_priv *priv,
429 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 429 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
430 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 430 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
431 431
432 iwl_legacy_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 432 il_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
433 433
434 spin_unlock_irqrestore(&priv->sta_lock, flags); 434 spin_unlock_irqrestore(&priv->sta_lock, flags);
435 435
436} 436}
437 437
438int iwl4965_remove_dynamic_key(struct iwl_priv *priv, 438int il4965_remove_dynamic_key(struct il_priv *priv,
439 struct iwl_rxon_context *ctx, 439 struct il_rxon_context *ctx,
440 struct ieee80211_key_conf *keyconf, 440 struct ieee80211_key_conf *keyconf,
441 u8 sta_id) 441 u8 sta_id)
442{ 442{
443 unsigned long flags; 443 unsigned long flags;
444 u16 key_flags; 444 u16 key_flags;
445 u8 keyidx; 445 u8 keyidx;
446 struct iwl_legacy_addsta_cmd sta_cmd; 446 struct il_addsta_cmd sta_cmd;
447 447
448 lockdep_assert_held(&priv->mutex); 448 lockdep_assert_held(&priv->mutex);
449 449
@@ -453,7 +453,7 @@ int iwl4965_remove_dynamic_key(struct iwl_priv *priv,
453 key_flags = le16_to_cpu(priv->stations[sta_id].sta.key.key_flags); 453 key_flags = le16_to_cpu(priv->stations[sta_id].sta.key.key_flags);
454 keyidx = (key_flags >> STA_KEY_FLG_KEYID_POS) & 0x3; 454 keyidx = (key_flags >> STA_KEY_FLG_KEYID_POS) & 0x3;
455 455
456 IWL_DEBUG_WEP(priv, "Remove dynamic key: idx=%d sta=%d\n", 456 IL_DEBUG_WEP(priv, "Remove dynamic key: idx=%d sta=%d\n",
457 keyconf->keyidx, sta_id); 457 keyconf->keyidx, sta_id);
458 458
459 if (keyconf->keyidx != keyidx) { 459 if (keyconf->keyidx != keyidx) {
@@ -467,7 +467,7 @@ int iwl4965_remove_dynamic_key(struct iwl_priv *priv,
467 } 467 }
468 468
469 if (priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) { 469 if (priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) {
470 IWL_WARN(priv, "Removing wrong key %d 0x%x\n", 470 IL_WARN(priv, "Removing wrong key %d 0x%x\n",
471 keyconf->keyidx, key_flags); 471 keyconf->keyidx, key_flags);
472 spin_unlock_irqrestore(&priv->sta_lock, flags); 472 spin_unlock_irqrestore(&priv->sta_lock, flags);
473 return 0; 473 return 0;
@@ -475,32 +475,32 @@ int iwl4965_remove_dynamic_key(struct iwl_priv *priv,
475 475
476 if (!test_and_clear_bit(priv->stations[sta_id].sta.key.key_offset, 476 if (!test_and_clear_bit(priv->stations[sta_id].sta.key.key_offset,
477 &priv->ucode_key_table)) 477 &priv->ucode_key_table))
478 IWL_ERR(priv, "index %d not used in uCode key table.\n", 478 IL_ERR(priv, "index %d not used in uCode key table.\n",
479 priv->stations[sta_id].sta.key.key_offset); 479 priv->stations[sta_id].sta.key.key_offset);
480 memset(&priv->stations[sta_id].keyinfo, 0, 480 memset(&priv->stations[sta_id].keyinfo, 0,
481 sizeof(struct iwl_hw_key)); 481 sizeof(struct il_hw_key));
482 memset(&priv->stations[sta_id].sta.key, 0, 482 memset(&priv->stations[sta_id].sta.key, 0,
483 sizeof(struct iwl4965_keyinfo)); 483 sizeof(struct il4965_keyinfo));
484 priv->stations[sta_id].sta.key.key_flags = 484 priv->stations[sta_id].sta.key.key_flags =
485 STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID; 485 STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID;
486 priv->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET; 486 priv->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET;
487 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 487 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
488 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 488 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
489 489
490 if (iwl_legacy_is_rfkill(priv)) { 490 if (il_is_rfkill(priv)) {
491 IWL_DEBUG_WEP(priv, 491 IL_DEBUG_WEP(priv,
492 "Not sending REPLY_ADD_STA command because RFKILL enabled.\n"); 492 "Not sending REPLY_ADD_STA command because RFKILL enabled.\n");
493 spin_unlock_irqrestore(&priv->sta_lock, flags); 493 spin_unlock_irqrestore(&priv->sta_lock, flags);
494 return 0; 494 return 0;
495 } 495 }
496 memcpy(&sta_cmd, &priv->stations[sta_id].sta, 496 memcpy(&sta_cmd, &priv->stations[sta_id].sta,
497 sizeof(struct iwl_legacy_addsta_cmd)); 497 sizeof(struct il_addsta_cmd));
498 spin_unlock_irqrestore(&priv->sta_lock, flags); 498 spin_unlock_irqrestore(&priv->sta_lock, flags);
499 499
500 return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); 500 return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
501} 501}
502 502
503int iwl4965_set_dynamic_key(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 503int il4965_set_dynamic_key(struct il_priv *priv, struct il_rxon_context *ctx,
504 struct ieee80211_key_conf *keyconf, u8 sta_id) 504 struct ieee80211_key_conf *keyconf, u8 sta_id)
505{ 505{
506 int ret; 506 int ret;
@@ -512,26 +512,26 @@ int iwl4965_set_dynamic_key(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
512 512
513 switch (keyconf->cipher) { 513 switch (keyconf->cipher) {
514 case WLAN_CIPHER_SUITE_CCMP: 514 case WLAN_CIPHER_SUITE_CCMP:
515 ret = iwl4965_set_ccmp_dynamic_key_info(priv, ctx, 515 ret = il4965_set_ccmp_dynamic_key_info(priv, ctx,
516 keyconf, sta_id); 516 keyconf, sta_id);
517 break; 517 break;
518 case WLAN_CIPHER_SUITE_TKIP: 518 case WLAN_CIPHER_SUITE_TKIP:
519 ret = iwl4965_set_tkip_dynamic_key_info(priv, ctx, 519 ret = il4965_set_tkip_dynamic_key_info(priv, ctx,
520 keyconf, sta_id); 520 keyconf, sta_id);
521 break; 521 break;
522 case WLAN_CIPHER_SUITE_WEP40: 522 case WLAN_CIPHER_SUITE_WEP40:
523 case WLAN_CIPHER_SUITE_WEP104: 523 case WLAN_CIPHER_SUITE_WEP104:
524 ret = iwl4965_set_wep_dynamic_key_info(priv, ctx, 524 ret = il4965_set_wep_dynamic_key_info(priv, ctx,
525 keyconf, sta_id); 525 keyconf, sta_id);
526 break; 526 break;
527 default: 527 default:
528 IWL_ERR(priv, 528 IL_ERR(priv,
529 "Unknown alg: %s cipher = %x\n", __func__, 529 "Unknown alg: %s cipher = %x\n", __func__,
530 keyconf->cipher); 530 keyconf->cipher);
531 ret = -EINVAL; 531 ret = -EINVAL;
532 } 532 }
533 533
534 IWL_DEBUG_WEP(priv, 534 IL_DEBUG_WEP(priv,
535 "Set dynamic key: cipher=%x len=%d idx=%d sta=%d ret=%d\n", 535 "Set dynamic key: cipher=%x len=%d idx=%d sta=%d ret=%d\n",
536 keyconf->cipher, keyconf->keylen, keyconf->keyidx, 536 keyconf->cipher, keyconf->keylen, keyconf->keyidx,
537 sta_id, ret); 537 sta_id, ret);
@@ -540,36 +540,36 @@ int iwl4965_set_dynamic_key(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
540} 540}
541 541
542/** 542/**
543 * iwl4965_alloc_bcast_station - add broadcast station into driver's station table. 543 * il4965_alloc_bcast_station - add broadcast station into driver's station table.
544 * 544 *
545 * This adds the broadcast station into the driver's station table 545 * This adds the broadcast station into the driver's station table
546 * and marks it driver active, so that it will be restored to the 546 * and marks it driver active, so that it will be restored to the
547 * device at the next best time. 547 * device at the next best time.
548 */ 548 */
549int iwl4965_alloc_bcast_station(struct iwl_priv *priv, 549int il4965_alloc_bcast_station(struct il_priv *priv,
550 struct iwl_rxon_context *ctx) 550 struct il_rxon_context *ctx)
551{ 551{
552 struct iwl_link_quality_cmd *link_cmd; 552 struct il_link_quality_cmd *link_cmd;
553 unsigned long flags; 553 unsigned long flags;
554 u8 sta_id; 554 u8 sta_id;
555 555
556 spin_lock_irqsave(&priv->sta_lock, flags); 556 spin_lock_irqsave(&priv->sta_lock, flags);
557 sta_id = iwl_legacy_prep_station(priv, ctx, iwlegacy_bcast_addr, 557 sta_id = il_prep_station(priv, ctx, iwlegacy_bcast_addr,
558 false, NULL); 558 false, NULL);
559 if (sta_id == IWL_INVALID_STATION) { 559 if (sta_id == IL_INVALID_STATION) {
560 IWL_ERR(priv, "Unable to prepare broadcast station\n"); 560 IL_ERR(priv, "Unable to prepare broadcast station\n");
561 spin_unlock_irqrestore(&priv->sta_lock, flags); 561 spin_unlock_irqrestore(&priv->sta_lock, flags);
562 562
563 return -EINVAL; 563 return -EINVAL;
564 } 564 }
565 565
566 priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; 566 priv->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE;
567 priv->stations[sta_id].used |= IWL_STA_BCAST; 567 priv->stations[sta_id].used |= IL_STA_BCAST;
568 spin_unlock_irqrestore(&priv->sta_lock, flags); 568 spin_unlock_irqrestore(&priv->sta_lock, flags);
569 569
570 link_cmd = iwl4965_sta_alloc_lq(priv, sta_id); 570 link_cmd = il4965_sta_alloc_lq(priv, sta_id);
571 if (!link_cmd) { 571 if (!link_cmd) {
572 IWL_ERR(priv, 572 IL_ERR(priv,
573 "Unable to initialize rate scaling for bcast station.\n"); 573 "Unable to initialize rate scaling for bcast station.\n");
574 return -ENOMEM; 574 return -ENOMEM;
575 } 575 }
@@ -582,21 +582,21 @@ int iwl4965_alloc_bcast_station(struct iwl_priv *priv,
582} 582}
583 583
584/** 584/**
585 * iwl4965_update_bcast_station - update broadcast station's LQ command 585 * il4965_update_bcast_station - update broadcast station's LQ command
586 * 586 *
587 * Only used by iwl4965. Placed here to have all bcast station management 587 * Only used by iwl4965. Placed here to have all bcast station management
588 * code together. 588 * code together.
589 */ 589 */
590static int iwl4965_update_bcast_station(struct iwl_priv *priv, 590static int il4965_update_bcast_station(struct il_priv *priv,
591 struct iwl_rxon_context *ctx) 591 struct il_rxon_context *ctx)
592{ 592{
593 unsigned long flags; 593 unsigned long flags;
594 struct iwl_link_quality_cmd *link_cmd; 594 struct il_link_quality_cmd *link_cmd;
595 u8 sta_id = ctx->bcast_sta_id; 595 u8 sta_id = ctx->bcast_sta_id;
596 596
597 link_cmd = iwl4965_sta_alloc_lq(priv, sta_id); 597 link_cmd = il4965_sta_alloc_lq(priv, sta_id);
598 if (!link_cmd) { 598 if (!link_cmd) {
599 IWL_ERR(priv, 599 IL_ERR(priv,
600 "Unable to initialize rate scaling for bcast station.\n"); 600 "Unable to initialize rate scaling for bcast station.\n");
601 return -ENOMEM; 601 return -ENOMEM;
602 } 602 }
@@ -605,7 +605,7 @@ static int iwl4965_update_bcast_station(struct iwl_priv *priv,
605 if (priv->stations[sta_id].lq) 605 if (priv->stations[sta_id].lq)
606 kfree(priv->stations[sta_id].lq); 606 kfree(priv->stations[sta_id].lq);
607 else 607 else
608 IWL_DEBUG_INFO(priv, 608 IL_DEBUG_INFO(priv,
609 "Bcast station rate scaling has not been initialized yet.\n"); 609 "Bcast station rate scaling has not been initialized yet.\n");
610 priv->stations[sta_id].lq = link_cmd; 610 priv->stations[sta_id].lq = link_cmd;
611 spin_unlock_irqrestore(&priv->sta_lock, flags); 611 spin_unlock_irqrestore(&priv->sta_lock, flags);
@@ -613,13 +613,13 @@ static int iwl4965_update_bcast_station(struct iwl_priv *priv,
613 return 0; 613 return 0;
614} 614}
615 615
616int iwl4965_update_bcast_stations(struct iwl_priv *priv) 616int il4965_update_bcast_stations(struct il_priv *priv)
617{ 617{
618 struct iwl_rxon_context *ctx; 618 struct il_rxon_context *ctx;
619 int ret = 0; 619 int ret = 0;
620 620
621 for_each_context(priv, ctx) { 621 for_each_context(priv, ctx) {
622 ret = iwl4965_update_bcast_station(priv, ctx); 622 ret = il4965_update_bcast_station(priv, ctx);
623 if (ret) 623 if (ret)
624 break; 624 break;
625 } 625 }
@@ -628,12 +628,12 @@ int iwl4965_update_bcast_stations(struct iwl_priv *priv)
628} 628}
629 629
630/** 630/**
631 * iwl4965_sta_tx_modify_enable_tid - Enable Tx for this TID in station table 631 * il4965_sta_tx_modify_enable_tid - Enable Tx for this TID in station table
632 */ 632 */
633int iwl4965_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) 633int il4965_sta_tx_modify_enable_tid(struct il_priv *priv, int sta_id, int tid)
634{ 634{
635 unsigned long flags; 635 unsigned long flags;
636 struct iwl_legacy_addsta_cmd sta_cmd; 636 struct il_addsta_cmd sta_cmd;
637 637
638 lockdep_assert_held(&priv->mutex); 638 lockdep_assert_held(&priv->mutex);
639 639
@@ -643,23 +643,23 @@ int iwl4965_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid)
643 priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid)); 643 priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid));
644 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 644 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
645 memcpy(&sta_cmd, &priv->stations[sta_id].sta, 645 memcpy(&sta_cmd, &priv->stations[sta_id].sta,
646 sizeof(struct iwl_legacy_addsta_cmd)); 646 sizeof(struct il_addsta_cmd));
647 spin_unlock_irqrestore(&priv->sta_lock, flags); 647 spin_unlock_irqrestore(&priv->sta_lock, flags);
648 648
649 return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); 649 return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
650} 650}
651 651
652int iwl4965_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, 652int il4965_sta_rx_agg_start(struct il_priv *priv, struct ieee80211_sta *sta,
653 int tid, u16 ssn) 653 int tid, u16 ssn)
654{ 654{
655 unsigned long flags; 655 unsigned long flags;
656 int sta_id; 656 int sta_id;
657 struct iwl_legacy_addsta_cmd sta_cmd; 657 struct il_addsta_cmd sta_cmd;
658 658
659 lockdep_assert_held(&priv->mutex); 659 lockdep_assert_held(&priv->mutex);
660 660
661 sta_id = iwl_legacy_sta_id(sta); 661 sta_id = il_sta_id(sta);
662 if (sta_id == IWL_INVALID_STATION) 662 if (sta_id == IL_INVALID_STATION)
663 return -ENXIO; 663 return -ENXIO;
664 664
665 spin_lock_irqsave(&priv->sta_lock, flags); 665 spin_lock_irqsave(&priv->sta_lock, flags);
@@ -669,24 +669,24 @@ int iwl4965_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta,
669 priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); 669 priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn);
670 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 670 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
671 memcpy(&sta_cmd, &priv->stations[sta_id].sta, 671 memcpy(&sta_cmd, &priv->stations[sta_id].sta,
672 sizeof(struct iwl_legacy_addsta_cmd)); 672 sizeof(struct il_addsta_cmd));
673 spin_unlock_irqrestore(&priv->sta_lock, flags); 673 spin_unlock_irqrestore(&priv->sta_lock, flags);
674 674
675 return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); 675 return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
676} 676}
677 677
678int iwl4965_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, 678int il4965_sta_rx_agg_stop(struct il_priv *priv, struct ieee80211_sta *sta,
679 int tid) 679 int tid)
680{ 680{
681 unsigned long flags; 681 unsigned long flags;
682 int sta_id; 682 int sta_id;
683 struct iwl_legacy_addsta_cmd sta_cmd; 683 struct il_addsta_cmd sta_cmd;
684 684
685 lockdep_assert_held(&priv->mutex); 685 lockdep_assert_held(&priv->mutex);
686 686
687 sta_id = iwl_legacy_sta_id(sta); 687 sta_id = il_sta_id(sta);
688 if (sta_id == IWL_INVALID_STATION) { 688 if (sta_id == IL_INVALID_STATION) {
689 IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); 689 IL_ERR(priv, "Invalid station for AGG tid %d\n", tid);
690 return -ENXIO; 690 return -ENXIO;
691 } 691 }
692 692
@@ -696,14 +696,14 @@ int iwl4965_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta,
696 priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid; 696 priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid;
697 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 697 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
698 memcpy(&sta_cmd, &priv->stations[sta_id].sta, 698 memcpy(&sta_cmd, &priv->stations[sta_id].sta,
699 sizeof(struct iwl_legacy_addsta_cmd)); 699 sizeof(struct il_addsta_cmd));
700 spin_unlock_irqrestore(&priv->sta_lock, flags); 700 spin_unlock_irqrestore(&priv->sta_lock, flags);
701 701
702 return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); 702 return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
703} 703}
704 704
705void 705void
706iwl4965_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) 706il4965_sta_modify_sleep_tx_count(struct il_priv *priv, int sta_id, int cnt)
707{ 707{
708 unsigned long flags; 708 unsigned long flags;
709 709
@@ -714,7 +714,7 @@ iwl4965_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt)
714 STA_MODIFY_SLEEP_TX_COUNT_MSK; 714 STA_MODIFY_SLEEP_TX_COUNT_MSK;
715 priv->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt); 715 priv->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt);
716 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 716 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
717 iwl_legacy_send_add_sta(priv, 717 il_send_add_sta(priv,
718 &priv->stations[sta_id].sta, CMD_ASYNC); 718 &priv->stations[sta_id].sta, CMD_ASYNC);
719 spin_unlock_irqrestore(&priv->sta_lock, flags); 719 spin_unlock_irqrestore(&priv->sta_lock, flags);
720 720
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index e421fdfed8c3..3fdb9d9201dd 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -77,7 +77,7 @@ static const u8 tid_to_ac[] = {
77 IEEE80211_AC_VO 77 IEEE80211_AC_VO
78}; 78};
79 79
80static inline int iwl4965_get_ac_from_tid(u16 tid) 80static inline int il4965_get_ac_from_tid(u16 tid)
81{ 81{
82 if (likely(tid < ARRAY_SIZE(tid_to_ac))) 82 if (likely(tid < ARRAY_SIZE(tid_to_ac)))
83 return tid_to_ac[tid]; 83 return tid_to_ac[tid];
@@ -87,7 +87,7 @@ static inline int iwl4965_get_ac_from_tid(u16 tid)
87} 87}
88 88
89static inline int 89static inline int
90iwl4965_get_fifo_from_tid(struct iwl_rxon_context *ctx, u16 tid) 90il4965_get_fifo_from_tid(struct il_rxon_context *ctx, u16 tid)
91{ 91{
92 if (likely(tid < ARRAY_SIZE(tid_to_ac))) 92 if (likely(tid < ARRAY_SIZE(tid_to_ac)))
93 return ctx->ac_to_fifo[tid_to_ac[tid]]; 93 return ctx->ac_to_fifo[tid_to_ac[tid]];
@@ -99,9 +99,9 @@ iwl4965_get_fifo_from_tid(struct iwl_rxon_context *ctx, u16 tid)
99/* 99/*
100 * handle build REPLY_TX command notification. 100 * handle build REPLY_TX command notification.
101 */ 101 */
102static void iwl4965_tx_cmd_build_basic(struct iwl_priv *priv, 102static void il4965_tx_cmd_build_basic(struct il_priv *priv,
103 struct sk_buff *skb, 103 struct sk_buff *skb,
104 struct iwl_tx_cmd *tx_cmd, 104 struct il_tx_cmd *tx_cmd,
105 struct ieee80211_tx_info *info, 105 struct ieee80211_tx_info *info,
106 struct ieee80211_hdr *hdr, 106 struct ieee80211_hdr *hdr,
107 u8 std_id) 107 u8 std_id)
@@ -137,7 +137,7 @@ static void iwl4965_tx_cmd_build_basic(struct iwl_priv *priv,
137 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 137 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
138 } 138 }
139 139
140 iwl_legacy_tx_cmd_protection(priv, info, fc, &tx_flags); 140 il_tx_cmd_protection(priv, info, fc, &tx_flags);
141 141
142 tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); 142 tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
143 if (ieee80211_is_mgmt(fc)) { 143 if (ieee80211_is_mgmt(fc)) {
@@ -156,8 +156,8 @@ static void iwl4965_tx_cmd_build_basic(struct iwl_priv *priv,
156 156
157#define RTS_DFAULT_RETRY_LIMIT 60 157#define RTS_DFAULT_RETRY_LIMIT 60
158 158
159static void iwl4965_tx_cmd_build_rate(struct iwl_priv *priv, 159static void il4965_tx_cmd_build_rate(struct il_priv *priv,
160 struct iwl_tx_cmd *tx_cmd, 160 struct il_tx_cmd *tx_cmd,
161 struct ieee80211_tx_info *info, 161 struct ieee80211_tx_info *info,
162 __le16 fc) 162 __le16 fc)
163{ 163{
@@ -196,34 +196,34 @@ static void iwl4965_tx_cmd_build_rate(struct iwl_priv *priv,
196 */ 196 */
197 rate_idx = info->control.rates[0].idx; 197 rate_idx = info->control.rates[0].idx;
198 if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS || 198 if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS ||
199 (rate_idx < 0) || (rate_idx > IWL_RATE_COUNT_LEGACY)) 199 (rate_idx < 0) || (rate_idx > IL_RATE_COUNT_LEGACY))
200 rate_idx = rate_lowest_index(&priv->bands[info->band], 200 rate_idx = rate_lowest_index(&priv->bands[info->band],
201 info->control.sta); 201 info->control.sta);
202 /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ 202 /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
203 if (info->band == IEEE80211_BAND_5GHZ) 203 if (info->band == IEEE80211_BAND_5GHZ)
204 rate_idx += IWL_FIRST_OFDM_RATE; 204 rate_idx += IL_FIRST_OFDM_RATE;
205 /* Get PLCP rate for tx_cmd->rate_n_flags */ 205 /* Get PLCP rate for tx_cmd->rate_n_flags */
206 rate_plcp = iwlegacy_rates[rate_idx].plcp; 206 rate_plcp = iwlegacy_rates[rate_idx].plcp;
207 /* Zero out flags for this packet */ 207 /* Zero out flags for this packet */
208 rate_flags = 0; 208 rate_flags = 0;
209 209
210 /* Set CCK flag as needed */ 210 /* Set CCK flag as needed */
211 if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE)) 211 if ((rate_idx >= IL_FIRST_CCK_RATE) && (rate_idx <= IL_LAST_CCK_RATE))
212 rate_flags |= RATE_MCS_CCK_MSK; 212 rate_flags |= RATE_MCS_CCK_MSK;
213 213
214 /* Set up antennas */ 214 /* Set up antennas */
215 priv->mgmt_tx_ant = iwl4965_toggle_tx_ant(priv, priv->mgmt_tx_ant, 215 priv->mgmt_tx_ant = il4965_toggle_tx_ant(priv, priv->mgmt_tx_ant,
216 priv->hw_params.valid_tx_ant); 216 priv->hw_params.valid_tx_ant);
217 217
218 rate_flags |= iwl4965_ant_idx_to_flags(priv->mgmt_tx_ant); 218 rate_flags |= il4965_ant_idx_to_flags(priv->mgmt_tx_ant);
219 219
220 /* Set the rate in the TX cmd */ 220 /* Set the rate in the TX cmd */
221 tx_cmd->rate_n_flags = iwl4965_hw_set_rate_n_flags(rate_plcp, rate_flags); 221 tx_cmd->rate_n_flags = il4965_hw_set_rate_n_flags(rate_plcp, rate_flags);
222} 222}
223 223
224static void iwl4965_tx_cmd_build_hwcrypto(struct iwl_priv *priv, 224static void il4965_tx_cmd_build_hwcrypto(struct il_priv *priv,
225 struct ieee80211_tx_info *info, 225 struct ieee80211_tx_info *info,
226 struct iwl_tx_cmd *tx_cmd, 226 struct il_tx_cmd *tx_cmd,
227 struct sk_buff *skb_frag, 227 struct sk_buff *skb_frag,
228 int sta_id) 228 int sta_id)
229{ 229{
@@ -235,13 +235,13 @@ static void iwl4965_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
235 memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); 235 memcpy(tx_cmd->key, keyconf->key, keyconf->keylen);
236 if (info->flags & IEEE80211_TX_CTL_AMPDU) 236 if (info->flags & IEEE80211_TX_CTL_AMPDU)
237 tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK; 237 tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK;
238 IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); 238 IL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n");
239 break; 239 break;
240 240
241 case WLAN_CIPHER_SUITE_TKIP: 241 case WLAN_CIPHER_SUITE_TKIP:
242 tx_cmd->sec_ctl = TX_CMD_SEC_TKIP; 242 tx_cmd->sec_ctl = TX_CMD_SEC_TKIP;
243 ieee80211_get_tkip_p2k(keyconf, skb_frag, tx_cmd->key); 243 ieee80211_get_tkip_p2k(keyconf, skb_frag, tx_cmd->key);
244 IWL_DEBUG_TX(priv, "tx_cmd with tkip hwcrypto\n"); 244 IL_DEBUG_TX(priv, "tx_cmd with tkip hwcrypto\n");
245 break; 245 break;
246 246
247 case WLAN_CIPHER_SUITE_WEP104: 247 case WLAN_CIPHER_SUITE_WEP104:
@@ -253,12 +253,12 @@ static void iwl4965_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
253 253
254 memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen); 254 memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen);
255 255
256 IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption " 256 IL_DEBUG_TX(priv, "Configuring packet for WEP encryption "
257 "with key %d\n", keyconf->keyidx); 257 "with key %d\n", keyconf->keyidx);
258 break; 258 break;
259 259
260 default: 260 default:
261 IWL_ERR(priv, "Unknown encode cipher %x\n", keyconf->cipher); 261 IL_ERR(priv, "Unknown encode cipher %x\n", keyconf->cipher);
262 break; 262 break;
263 } 263 }
264} 264}
@@ -266,18 +266,18 @@ static void iwl4965_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
266/* 266/*
267 * start REPLY_TX command process 267 * start REPLY_TX command process
268 */ 268 */
269int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) 269int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb)
270{ 270{
271 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 271 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
272 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 272 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
273 struct ieee80211_sta *sta = info->control.sta; 273 struct ieee80211_sta *sta = info->control.sta;
274 struct iwl_station_priv *sta_priv = NULL; 274 struct il_station_priv *sta_priv = NULL;
275 struct iwl_tx_queue *txq; 275 struct il_tx_queue *txq;
276 struct iwl_queue *q; 276 struct il_queue *q;
277 struct iwl_device_cmd *out_cmd; 277 struct il_device_cmd *out_cmd;
278 struct iwl_cmd_meta *out_meta; 278 struct il_cmd_meta *out_meta;
279 struct iwl_tx_cmd *tx_cmd; 279 struct il_tx_cmd *tx_cmd;
280 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 280 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
281 int txq_id; 281 int txq_id;
282 dma_addr_t phys_addr; 282 dma_addr_t phys_addr;
283 dma_addr_t txcmd_phys; 283 dma_addr_t txcmd_phys;
@@ -294,11 +294,11 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
294 bool is_agg = false; 294 bool is_agg = false;
295 295
296 if (info->control.vif) 296 if (info->control.vif)
297 ctx = iwl_legacy_rxon_ctx_from_vif(info->control.vif); 297 ctx = il_rxon_ctx_from_vif(info->control.vif);
298 298
299 spin_lock_irqsave(&priv->lock, flags); 299 spin_lock_irqsave(&priv->lock, flags);
300 if (iwl_legacy_is_rfkill(priv)) { 300 if (il_is_rfkill(priv)) {
301 IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); 301 IL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
302 goto drop_unlock; 302 goto drop_unlock;
303 } 303 }
304 304
@@ -306,11 +306,11 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
306 306
307#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 307#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
308 if (ieee80211_is_auth(fc)) 308 if (ieee80211_is_auth(fc))
309 IWL_DEBUG_TX(priv, "Sending AUTH frame\n"); 309 IL_DEBUG_TX(priv, "Sending AUTH frame\n");
310 else if (ieee80211_is_assoc_req(fc)) 310 else if (ieee80211_is_assoc_req(fc))
311 IWL_DEBUG_TX(priv, "Sending ASSOC frame\n"); 311 IL_DEBUG_TX(priv, "Sending ASSOC frame\n");
312 else if (ieee80211_is_reassoc_req(fc)) 312 else if (ieee80211_is_reassoc_req(fc))
313 IWL_DEBUG_TX(priv, "Sending REASSOC frame\n"); 313 IL_DEBUG_TX(priv, "Sending REASSOC frame\n");
314#endif 314#endif
315 315
316 hdr_len = ieee80211_hdrlen(fc); 316 hdr_len = ieee80211_hdrlen(fc);
@@ -320,16 +320,16 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
320 sta_id = ctx->bcast_sta_id; 320 sta_id = ctx->bcast_sta_id;
321 else { 321 else {
322 /* Find index into station table for destination station */ 322 /* Find index into station table for destination station */
323 sta_id = iwl_legacy_sta_id_or_broadcast(priv, ctx, info->control.sta); 323 sta_id = il_sta_id_or_broadcast(priv, ctx, info->control.sta);
324 324
325 if (sta_id == IWL_INVALID_STATION) { 325 if (sta_id == IL_INVALID_STATION) {
326 IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", 326 IL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
327 hdr->addr1); 327 hdr->addr1);
328 goto drop_unlock; 328 goto drop_unlock;
329 } 329 }
330 } 330 }
331 331
332 IWL_DEBUG_TX(priv, "station Id %d\n", sta_id); 332 IL_DEBUG_TX(priv, "station Id %d\n", sta_id);
333 333
334 if (sta) 334 if (sta)
335 sta_priv = (void *)sta->drv_priv; 335 sta_priv = (void *)sta->drv_priv;
@@ -345,7 +345,7 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
345 * For now set the counter to just 1 since we do not 345 * For now set the counter to just 1 since we do not
346 * support uAPSD yet. 346 * support uAPSD yet.
347 */ 347 */
348 iwl4965_sta_modify_sleep_tx_count(priv, sta_id, 1); 348 il4965_sta_modify_sleep_tx_count(priv, sta_id, 1);
349 } 349 }
350 350
351 /* 351 /*
@@ -381,7 +381,7 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
381 seq_number += 0x10; 381 seq_number += 0x10;
382 /* aggregation is on for this <sta,tid> */ 382 /* aggregation is on for this <sta,tid> */
383 if (info->flags & IEEE80211_TX_CTL_AMPDU && 383 if (info->flags & IEEE80211_TX_CTL_AMPDU &&
384 priv->stations[sta_id].tid[tid].agg.state == IWL_AGG_ON) { 384 priv->stations[sta_id].tid[tid].agg.state == IL_AGG_ON) {
385 txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; 385 txq_id = priv->stations[sta_id].tid[tid].agg.txq_id;
386 is_agg = true; 386 is_agg = true;
387 } 387 }
@@ -390,7 +390,7 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
390 txq = &priv->txq[txq_id]; 390 txq = &priv->txq[txq_id];
391 q = &txq->q; 391 q = &txq->q;
392 392
393 if (unlikely(iwl_legacy_queue_space(q) < q->high_mark)) { 393 if (unlikely(il_queue_space(q) < q->high_mark)) {
394 spin_unlock(&priv->sta_lock); 394 spin_unlock(&priv->sta_lock);
395 goto drop_unlock; 395 goto drop_unlock;
396 } 396 }
@@ -404,7 +404,7 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
404 spin_unlock(&priv->sta_lock); 404 spin_unlock(&priv->sta_lock);
405 405
406 /* Set up driver data for this TFD */ 406 /* Set up driver data for this TFD */
407 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); 407 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info));
408 txq->txb[q->write_ptr].skb = skb; 408 txq->txb[q->write_ptr].skb = skb;
409 txq->txb[q->write_ptr].ctx = ctx; 409 txq->txb[q->write_ptr].ctx = ctx;
410 410
@@ -413,7 +413,7 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
413 out_meta = &txq->meta[q->write_ptr]; 413 out_meta = &txq->meta[q->write_ptr];
414 tx_cmd = &out_cmd->cmd.tx; 414 tx_cmd = &out_cmd->cmd.tx;
415 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); 415 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr));
416 memset(tx_cmd, 0, sizeof(struct iwl_tx_cmd)); 416 memset(tx_cmd, 0, sizeof(struct il_tx_cmd));
417 417
418 /* 418 /*
419 * Set up the Tx-command (not MAC!) header. 419 * Set up the Tx-command (not MAC!) header.
@@ -434,15 +434,15 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
434 tx_cmd->len = cpu_to_le16(len); 434 tx_cmd->len = cpu_to_le16(len);
435 435
436 if (info->control.hw_key) 436 if (info->control.hw_key)
437 iwl4965_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); 437 il4965_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id);
438 438
439 /* TODO need this for burst mode later on */ 439 /* TODO need this for burst mode later on */
440 iwl4965_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); 440 il4965_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id);
441 iwl_legacy_dbg_log_tx_data_frame(priv, len, hdr); 441 il_dbg_log_tx_data_frame(priv, len, hdr);
442 442
443 iwl4965_tx_cmd_build_rate(priv, tx_cmd, info, fc); 443 il4965_tx_cmd_build_rate(priv, tx_cmd, info, fc);
444 444
445 iwl_legacy_update_stats(priv, true, fc, len); 445 il_update_stats(priv, true, fc, len);
446 /* 446 /*
447 * Use the first empty entry in this queue's command buffer array 447 * Use the first empty entry in this queue's command buffer array
448 * to contain the Tx command and MAC header concatenated together 448 * to contain the Tx command and MAC header concatenated together
@@ -452,8 +452,8 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
452 * of the MAC header (device reads on dword boundaries). 452 * of the MAC header (device reads on dword boundaries).
453 * We'll tell device about this padding later. 453 * We'll tell device about this padding later.
454 */ 454 */
455 len = sizeof(struct iwl_tx_cmd) + 455 len = sizeof(struct il_tx_cmd) +
456 sizeof(struct iwl_cmd_header) + hdr_len; 456 sizeof(struct il_cmd_header) + hdr_len;
457 firstlen = (len + 3) & ~3; 457 firstlen = (len + 3) & ~3;
458 458
459 /* Tell NIC about any 2-byte padding after MAC header */ 459 /* Tell NIC about any 2-byte padding after MAC header */
@@ -490,20 +490,20 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
490 0, 0); 490 0, 0);
491 } 491 }
492 492
493 scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + 493 scratch_phys = txcmd_phys + sizeof(struct il_cmd_header) +
494 offsetof(struct iwl_tx_cmd, scratch); 494 offsetof(struct il_tx_cmd, scratch);
495 495
496 /* take back ownership of DMA buffer to enable update */ 496 /* take back ownership of DMA buffer to enable update */
497 pci_dma_sync_single_for_cpu(priv->pci_dev, txcmd_phys, 497 pci_dma_sync_single_for_cpu(priv->pci_dev, txcmd_phys,
498 firstlen, PCI_DMA_BIDIRECTIONAL); 498 firstlen, PCI_DMA_BIDIRECTIONAL);
499 tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); 499 tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys);
500 tx_cmd->dram_msb_ptr = iwl_legacy_get_dma_hi_addr(scratch_phys); 500 tx_cmd->dram_msb_ptr = il_get_dma_hi_addr(scratch_phys);
501 501
502 IWL_DEBUG_TX(priv, "sequence nr = 0X%x\n", 502 IL_DEBUG_TX(priv, "sequence nr = 0X%x\n",
503 le16_to_cpu(out_cmd->hdr.sequence)); 503 le16_to_cpu(out_cmd->hdr.sequence));
504 IWL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); 504 IL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags));
505 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); 505 il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd));
506 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); 506 il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len);
507 507
508 /* Set up entry for this TFD in Tx byte-count array */ 508 /* Set up entry for this TFD in Tx byte-count array */
509 if (info->flags & IEEE80211_TX_CTL_AMPDU) 509 if (info->flags & IEEE80211_TX_CTL_AMPDU)
@@ -514,8 +514,8 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
514 firstlen, PCI_DMA_BIDIRECTIONAL); 514 firstlen, PCI_DMA_BIDIRECTIONAL);
515 515
516 /* Tell device the write index *just past* this latest filled TFD */ 516 /* Tell device the write index *just past* this latest filled TFD */
517 q->write_ptr = iwl_legacy_queue_inc_wrap(q->write_ptr, q->n_bd); 517 q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd);
518 iwl_legacy_txq_update_write_ptr(priv, txq); 518 il_txq_update_write_ptr(priv, txq);
519 spin_unlock_irqrestore(&priv->lock, flags); 519 spin_unlock_irqrestore(&priv->lock, flags);
520 520
521 /* 521 /*
@@ -535,15 +535,15 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
535 if (sta_priv && sta_priv->client && !is_agg) 535 if (sta_priv && sta_priv->client && !is_agg)
536 atomic_inc(&sta_priv->pending_frames); 536 atomic_inc(&sta_priv->pending_frames);
537 537
538 if ((iwl_legacy_queue_space(q) < q->high_mark) && 538 if ((il_queue_space(q) < q->high_mark) &&
539 priv->mac80211_registered) { 539 priv->mac80211_registered) {
540 if (wait_write_ptr) { 540 if (wait_write_ptr) {
541 spin_lock_irqsave(&priv->lock, flags); 541 spin_lock_irqsave(&priv->lock, flags);
542 txq->need_update = 1; 542 txq->need_update = 1;
543 iwl_legacy_txq_update_write_ptr(priv, txq); 543 il_txq_update_write_ptr(priv, txq);
544 spin_unlock_irqrestore(&priv->lock, flags); 544 spin_unlock_irqrestore(&priv->lock, flags);
545 } else { 545 } else {
546 iwl_legacy_stop_queue(priv, txq); 546 il_stop_queue(priv, txq);
547 } 547 }
548 } 548 }
549 549
@@ -554,8 +554,8 @@ drop_unlock:
554 return -1; 554 return -1;
555} 555}
556 556
557static inline int iwl4965_alloc_dma_ptr(struct iwl_priv *priv, 557static inline int il4965_alloc_dma_ptr(struct il_priv *priv,
558 struct iwl_dma_ptr *ptr, size_t size) 558 struct il_dma_ptr *ptr, size_t size)
559{ 559{
560 ptr->addr = dma_alloc_coherent(&priv->pci_dev->dev, size, &ptr->dma, 560 ptr->addr = dma_alloc_coherent(&priv->pci_dev->dev, size, &ptr->dma,
561 GFP_KERNEL); 561 GFP_KERNEL);
@@ -565,8 +565,8 @@ static inline int iwl4965_alloc_dma_ptr(struct iwl_priv *priv,
565 return 0; 565 return 0;
566} 566}
567 567
568static inline void iwl4965_free_dma_ptr(struct iwl_priv *priv, 568static inline void il4965_free_dma_ptr(struct il_priv *priv,
569 struct iwl_dma_ptr *ptr) 569 struct il_dma_ptr *ptr)
570{ 570{
571 if (unlikely(!ptr->addr)) 571 if (unlikely(!ptr->addr))
572 return; 572 return;
@@ -576,11 +576,11 @@ static inline void iwl4965_free_dma_ptr(struct iwl_priv *priv,
576} 576}
577 577
578/** 578/**
579 * iwl4965_hw_txq_ctx_free - Free TXQ Context 579 * il4965_hw_txq_ctx_free - Free TXQ Context
580 * 580 *
581 * Destroy all TX DMA queues and structures 581 * Destroy all TX DMA queues and structures
582 */ 582 */
583void iwl4965_hw_txq_ctx_free(struct iwl_priv *priv) 583void il4965_hw_txq_ctx_free(struct il_priv *priv)
584{ 584{
585 int txq_id; 585 int txq_id;
586 586
@@ -588,59 +588,59 @@ void iwl4965_hw_txq_ctx_free(struct iwl_priv *priv)
588 if (priv->txq) { 588 if (priv->txq) {
589 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) 589 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++)
590 if (txq_id == priv->cmd_queue) 590 if (txq_id == priv->cmd_queue)
591 iwl_legacy_cmd_queue_free(priv); 591 il_cmd_queue_free(priv);
592 else 592 else
593 iwl_legacy_tx_queue_free(priv, txq_id); 593 il_tx_queue_free(priv, txq_id);
594 } 594 }
595 iwl4965_free_dma_ptr(priv, &priv->kw); 595 il4965_free_dma_ptr(priv, &priv->kw);
596 596
597 iwl4965_free_dma_ptr(priv, &priv->scd_bc_tbls); 597 il4965_free_dma_ptr(priv, &priv->scd_bc_tbls);
598 598
599 /* free tx queue structure */ 599 /* free tx queue structure */
600 iwl_legacy_txq_mem(priv); 600 il_txq_mem(priv);
601} 601}
602 602
603/** 603/**
604 * iwl4965_txq_ctx_alloc - allocate TX queue context 604 * il4965_txq_ctx_alloc - allocate TX queue context
605 * Allocate all Tx DMA structures and initialize them 605 * Allocate all Tx DMA structures and initialize them
606 * 606 *
607 * @param priv 607 * @param priv
608 * @return error code 608 * @return error code
609 */ 609 */
610int iwl4965_txq_ctx_alloc(struct iwl_priv *priv) 610int il4965_txq_ctx_alloc(struct il_priv *priv)
611{ 611{
612 int ret; 612 int ret;
613 int txq_id, slots_num; 613 int txq_id, slots_num;
614 unsigned long flags; 614 unsigned long flags;
615 615
616 /* Free all tx/cmd queues and keep-warm buffer */ 616 /* Free all tx/cmd queues and keep-warm buffer */
617 iwl4965_hw_txq_ctx_free(priv); 617 il4965_hw_txq_ctx_free(priv);
618 618
619 ret = iwl4965_alloc_dma_ptr(priv, &priv->scd_bc_tbls, 619 ret = il4965_alloc_dma_ptr(priv, &priv->scd_bc_tbls,
620 priv->hw_params.scd_bc_tbls_size); 620 priv->hw_params.scd_bc_tbls_size);
621 if (ret) { 621 if (ret) {
622 IWL_ERR(priv, "Scheduler BC Table allocation failed\n"); 622 IL_ERR(priv, "Scheduler BC Table allocation failed\n");
623 goto error_bc_tbls; 623 goto error_bc_tbls;
624 } 624 }
625 /* Alloc keep-warm buffer */ 625 /* Alloc keep-warm buffer */
626 ret = iwl4965_alloc_dma_ptr(priv, &priv->kw, IWL_KW_SIZE); 626 ret = il4965_alloc_dma_ptr(priv, &priv->kw, IL_KW_SIZE);
627 if (ret) { 627 if (ret) {
628 IWL_ERR(priv, "Keep Warm allocation failed\n"); 628 IL_ERR(priv, "Keep Warm allocation failed\n");
629 goto error_kw; 629 goto error_kw;
630 } 630 }
631 631
632 /* allocate tx queue structure */ 632 /* allocate tx queue structure */
633 ret = iwl_legacy_alloc_txq_mem(priv); 633 ret = il_alloc_txq_mem(priv);
634 if (ret) 634 if (ret)
635 goto error; 635 goto error;
636 636
637 spin_lock_irqsave(&priv->lock, flags); 637 spin_lock_irqsave(&priv->lock, flags);
638 638
639 /* Turn off all Tx DMA fifos */ 639 /* Turn off all Tx DMA fifos */
640 iwl4965_txq_set_sched(priv, 0); 640 il4965_txq_set_sched(priv, 0);
641 641
642 /* Tell NIC where to find the "keep warm" buffer */ 642 /* Tell NIC where to find the "keep warm" buffer */
643 iwl_legacy_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); 643 il_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4);
644 644
645 spin_unlock_irqrestore(&priv->lock, flags); 645 spin_unlock_irqrestore(&priv->lock, flags);
646 646
@@ -648,11 +648,11 @@ int iwl4965_txq_ctx_alloc(struct iwl_priv *priv)
648 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { 648 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) {
649 slots_num = (txq_id == priv->cmd_queue) ? 649 slots_num = (txq_id == priv->cmd_queue) ?
650 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 650 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
651 ret = iwl_legacy_tx_queue_init(priv, 651 ret = il_tx_queue_init(priv,
652 &priv->txq[txq_id], slots_num, 652 &priv->txq[txq_id], slots_num,
653 txq_id); 653 txq_id);
654 if (ret) { 654 if (ret) {
655 IWL_ERR(priv, "Tx %d queue init failed\n", txq_id); 655 IL_ERR(priv, "Tx %d queue init failed\n", txq_id);
656 goto error; 656 goto error;
657 } 657 }
658 } 658 }
@@ -660,15 +660,15 @@ int iwl4965_txq_ctx_alloc(struct iwl_priv *priv)
660 return ret; 660 return ret;
661 661
662 error: 662 error:
663 iwl4965_hw_txq_ctx_free(priv); 663 il4965_hw_txq_ctx_free(priv);
664 iwl4965_free_dma_ptr(priv, &priv->kw); 664 il4965_free_dma_ptr(priv, &priv->kw);
665 error_kw: 665 error_kw:
666 iwl4965_free_dma_ptr(priv, &priv->scd_bc_tbls); 666 il4965_free_dma_ptr(priv, &priv->scd_bc_tbls);
667 error_bc_tbls: 667 error_bc_tbls:
668 return ret; 668 return ret;
669} 669}
670 670
671void iwl4965_txq_ctx_reset(struct iwl_priv *priv) 671void il4965_txq_ctx_reset(struct il_priv *priv)
672{ 672{
673 int txq_id, slots_num; 673 int txq_id, slots_num;
674 unsigned long flags; 674 unsigned long flags;
@@ -676,10 +676,10 @@ void iwl4965_txq_ctx_reset(struct iwl_priv *priv)
676 spin_lock_irqsave(&priv->lock, flags); 676 spin_lock_irqsave(&priv->lock, flags);
677 677
678 /* Turn off all Tx DMA fifos */ 678 /* Turn off all Tx DMA fifos */
679 iwl4965_txq_set_sched(priv, 0); 679 il4965_txq_set_sched(priv, 0);
680 680
681 /* Tell NIC where to find the "keep warm" buffer */ 681 /* Tell NIC where to find the "keep warm" buffer */
682 iwl_legacy_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); 682 il_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4);
683 683
684 spin_unlock_irqrestore(&priv->lock, flags); 684 spin_unlock_irqrestore(&priv->lock, flags);
685 685
@@ -687,15 +687,15 @@ void iwl4965_txq_ctx_reset(struct iwl_priv *priv)
687 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { 687 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) {
688 slots_num = txq_id == priv->cmd_queue ? 688 slots_num = txq_id == priv->cmd_queue ?
689 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 689 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
690 iwl_legacy_tx_queue_reset(priv, &priv->txq[txq_id], 690 il_tx_queue_reset(priv, &priv->txq[txq_id],
691 slots_num, txq_id); 691 slots_num, txq_id);
692 } 692 }
693} 693}
694 694
695/** 695/**
696 * iwl4965_txq_ctx_stop - Stop all Tx DMA channels 696 * il4965_txq_ctx_stop - Stop all Tx DMA channels
697 */ 697 */
698void iwl4965_txq_ctx_stop(struct iwl_priv *priv) 698void il4965_txq_ctx_stop(struct il_priv *priv)
699{ 699{
700 int ch, txq_id; 700 int ch, txq_id;
701 unsigned long flags; 701 unsigned long flags;
@@ -703,18 +703,18 @@ void iwl4965_txq_ctx_stop(struct iwl_priv *priv)
703 /* Turn off all Tx DMA fifos */ 703 /* Turn off all Tx DMA fifos */
704 spin_lock_irqsave(&priv->lock, flags); 704 spin_lock_irqsave(&priv->lock, flags);
705 705
706 iwl4965_txq_set_sched(priv, 0); 706 il4965_txq_set_sched(priv, 0);
707 707
708 /* Stop each Tx DMA channel, and wait for it to be idle */ 708 /* Stop each Tx DMA channel, and wait for it to be idle */
709 for (ch = 0; ch < priv->hw_params.dma_chnl_num; ch++) { 709 for (ch = 0; ch < priv->hw_params.dma_chnl_num; ch++) {
710 iwl_legacy_write_direct32(priv, 710 il_write_direct32(priv,
711 FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0); 711 FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0);
712 if (iwl_poll_direct_bit(priv, FH_TSSR_TX_STATUS_REG, 712 if (il_poll_direct_bit(priv, FH_TSSR_TX_STATUS_REG,
713 FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), 713 FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch),
714 1000)) 714 1000))
715 IWL_ERR(priv, "Failing on timeout while stopping" 715 IL_ERR(priv, "Failing on timeout while stopping"
716 " DMA channel %d [0x%08x]", ch, 716 " DMA channel %d [0x%08x]", ch,
717 iwl_legacy_read_direct32(priv, 717 il_read_direct32(priv,
718 FH_TSSR_TX_STATUS_REG)); 718 FH_TSSR_TX_STATUS_REG));
719 } 719 }
720 spin_unlock_irqrestore(&priv->lock, flags); 720 spin_unlock_irqrestore(&priv->lock, flags);
@@ -725,9 +725,9 @@ void iwl4965_txq_ctx_stop(struct iwl_priv *priv)
725 /* Unmap DMA from host system and free skb's */ 725 /* Unmap DMA from host system and free skb's */
726 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) 726 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++)
727 if (txq_id == priv->cmd_queue) 727 if (txq_id == priv->cmd_queue)
728 iwl_legacy_cmd_queue_unmap(priv); 728 il_cmd_queue_unmap(priv);
729 else 729 else
730 iwl_legacy_tx_queue_unmap(priv, txq_id); 730 il_tx_queue_unmap(priv, txq_id);
731} 731}
732 732
733/* 733/*
@@ -736,7 +736,7 @@ void iwl4965_txq_ctx_stop(struct iwl_priv *priv)
736 * Should never return anything < 7, because they should already 736 * Should never return anything < 7, because they should already
737 * be in use as EDCA AC (0-3), Command (4), reserved (5, 6) 737 * be in use as EDCA AC (0-3), Command (4), reserved (5, 6)
738 */ 738 */
739static int iwl4965_txq_ctx_activate_free(struct iwl_priv *priv) 739static int il4965_txq_ctx_activate_free(struct il_priv *priv)
740{ 740{
741 int txq_id; 741 int txq_id;
742 742
@@ -747,53 +747,53 @@ static int iwl4965_txq_ctx_activate_free(struct iwl_priv *priv)
747} 747}
748 748
749/** 749/**
750 * iwl4965_tx_queue_stop_scheduler - Stop queue, but keep configuration 750 * il4965_tx_queue_stop_scheduler - Stop queue, but keep configuration
751 */ 751 */
752static void iwl4965_tx_queue_stop_scheduler(struct iwl_priv *priv, 752static void il4965_tx_queue_stop_scheduler(struct il_priv *priv,
753 u16 txq_id) 753 u16 txq_id)
754{ 754{
755 /* Simply stop the queue, but don't change any configuration; 755 /* Simply stop the queue, but don't change any configuration;
756 * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */ 756 * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */
757 iwl_legacy_write_prph(priv, 757 il_write_prph(priv,
758 IWL49_SCD_QUEUE_STATUS_BITS(txq_id), 758 IWL49_SCD_QUEUE_STATUS_BITS(txq_id),
759 (0 << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE)| 759 (0 << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE)|
760 (1 << IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); 760 (1 << IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
761} 761}
762 762
763/** 763/**
764 * iwl4965_tx_queue_set_q2ratid - Map unique receiver/tid combination to a queue 764 * il4965_tx_queue_set_q2ratid - Map unique receiver/tid combination to a queue
765 */ 765 */
766static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, 766static int il4965_tx_queue_set_q2ratid(struct il_priv *priv, u16 ra_tid,
767 u16 txq_id) 767 u16 txq_id)
768{ 768{
769 u32 tbl_dw_addr; 769 u32 tbl_dw_addr;
770 u32 tbl_dw; 770 u32 tbl_dw;
771 u16 scd_q2ratid; 771 u16 scd_q2ratid;
772 772
773 scd_q2ratid = ra_tid & IWL_SCD_QUEUE_RA_TID_MAP_RATID_MSK; 773 scd_q2ratid = ra_tid & IL_SCD_QUEUE_RA_TID_MAP_RATID_MSK;
774 774
775 tbl_dw_addr = priv->scd_base_addr + 775 tbl_dw_addr = priv->scd_base_addr +
776 IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); 776 IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id);
777 777
778 tbl_dw = iwl_legacy_read_targ_mem(priv, tbl_dw_addr); 778 tbl_dw = il_read_targ_mem(priv, tbl_dw_addr);
779 779
780 if (txq_id & 0x1) 780 if (txq_id & 0x1)
781 tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF); 781 tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF);
782 else 782 else
783 tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000); 783 tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000);
784 784
785 iwl_legacy_write_targ_mem(priv, tbl_dw_addr, tbl_dw); 785 il_write_targ_mem(priv, tbl_dw_addr, tbl_dw);
786 786
787 return 0; 787 return 0;
788} 788}
789 789
790/** 790/**
791 * iwl4965_tx_queue_agg_enable - Set up & enable aggregation for selected queue 791 * il4965_tx_queue_agg_enable - Set up & enable aggregation for selected queue
792 * 792 *
793 * NOTE: txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE, 793 * NOTE: txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE,
794 * i.e. it must be one of the higher queues used for aggregation 794 * i.e. it must be one of the higher queues used for aggregation
795 */ 795 */
796static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id, 796static int il4965_txq_agg_enable(struct il_priv *priv, int txq_id,
797 int tx_fifo, int sta_id, int tid, u16 ssn_idx) 797 int tx_fifo, int sta_id, int tid, u16 ssn_idx)
798{ 798{
799 unsigned long flags; 799 unsigned long flags;
@@ -803,7 +803,7 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id,
803 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || 803 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
804 (IWL49_FIRST_AMPDU_QUEUE + 804 (IWL49_FIRST_AMPDU_QUEUE +
805 priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) { 805 priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) {
806 IWL_WARN(priv, 806 IL_WARN(priv,
807 "queue number out of range: %d, must be %d to %d\n", 807 "queue number out of range: %d, must be %d to %d\n",
808 txq_id, IWL49_FIRST_AMPDU_QUEUE, 808 txq_id, IWL49_FIRST_AMPDU_QUEUE,
809 IWL49_FIRST_AMPDU_QUEUE + 809 IWL49_FIRST_AMPDU_QUEUE +
@@ -814,42 +814,42 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id,
814 ra_tid = BUILD_RAxTID(sta_id, tid); 814 ra_tid = BUILD_RAxTID(sta_id, tid);
815 815
816 /* Modify device's station table to Tx this TID */ 816 /* Modify device's station table to Tx this TID */
817 ret = iwl4965_sta_tx_modify_enable_tid(priv, sta_id, tid); 817 ret = il4965_sta_tx_modify_enable_tid(priv, sta_id, tid);
818 if (ret) 818 if (ret)
819 return ret; 819 return ret;
820 820
821 spin_lock_irqsave(&priv->lock, flags); 821 spin_lock_irqsave(&priv->lock, flags);
822 822
823 /* Stop this Tx queue before configuring it */ 823 /* Stop this Tx queue before configuring it */
824 iwl4965_tx_queue_stop_scheduler(priv, txq_id); 824 il4965_tx_queue_stop_scheduler(priv, txq_id);
825 825
826 /* Map receiver-address / traffic-ID to this queue */ 826 /* Map receiver-address / traffic-ID to this queue */
827 iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id); 827 il4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id);
828 828
829 /* Set this queue as a chain-building queue */ 829 /* Set this queue as a chain-building queue */
830 iwl_legacy_set_bits_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); 830 il_set_bits_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id));
831 831
832 /* Place first TFD at index corresponding to start sequence number. 832 /* Place first TFD at index corresponding to start sequence number.
833 * Assumes that ssn_idx is valid (!= 0xFFF) */ 833 * Assumes that ssn_idx is valid (!= 0xFFF) */
834 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); 834 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
835 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); 835 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
836 iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); 836 il4965_set_wr_ptrs(priv, txq_id, ssn_idx);
837 837
838 /* Set up Tx window size and frame limit for this queue */ 838 /* Set up Tx window size and frame limit for this queue */
839 iwl_legacy_write_targ_mem(priv, 839 il_write_targ_mem(priv,
840 priv->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id), 840 priv->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id),
841 (SCD_WIN_SIZE << IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & 841 (SCD_WIN_SIZE << IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) &
842 IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); 842 IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK);
843 843
844 iwl_legacy_write_targ_mem(priv, priv->scd_base_addr + 844 il_write_targ_mem(priv, priv->scd_base_addr +
845 IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), 845 IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32),
846 (SCD_FRAME_LIMIT << IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) 846 (SCD_FRAME_LIMIT << IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS)
847 & IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); 847 & IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK);
848 848
849 iwl_legacy_set_bits_prph(priv, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); 849 il_set_bits_prph(priv, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id));
850 850
851 /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */ 851 /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */
852 iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); 852 il4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1);
853 853
854 spin_unlock_irqrestore(&priv->lock, flags); 854 spin_unlock_irqrestore(&priv->lock, flags);
855 855
@@ -857,7 +857,7 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id,
857} 857}
858 858
859 859
860int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, 860int il4965_tx_agg_start(struct il_priv *priv, struct ieee80211_vif *vif,
861 struct ieee80211_sta *sta, u16 tid, u16 *ssn) 861 struct ieee80211_sta *sta, u16 tid, u16 *ssn)
862{ 862{
863 int sta_id; 863 int sta_id;
@@ -865,31 +865,31 @@ int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
865 int txq_id; 865 int txq_id;
866 int ret; 866 int ret;
867 unsigned long flags; 867 unsigned long flags;
868 struct iwl_tid_data *tid_data; 868 struct il_tid_data *tid_data;
869 869
870 tx_fifo = iwl4965_get_fifo_from_tid(iwl_legacy_rxon_ctx_from_vif(vif), tid); 870 tx_fifo = il4965_get_fifo_from_tid(il_rxon_ctx_from_vif(vif), tid);
871 if (unlikely(tx_fifo < 0)) 871 if (unlikely(tx_fifo < 0))
872 return tx_fifo; 872 return tx_fifo;
873 873
874 IWL_WARN(priv, "%s on ra = %pM tid = %d\n", 874 IL_WARN(priv, "%s on ra = %pM tid = %d\n",
875 __func__, sta->addr, tid); 875 __func__, sta->addr, tid);
876 876
877 sta_id = iwl_legacy_sta_id(sta); 877 sta_id = il_sta_id(sta);
878 if (sta_id == IWL_INVALID_STATION) { 878 if (sta_id == IL_INVALID_STATION) {
879 IWL_ERR(priv, "Start AGG on invalid station\n"); 879 IL_ERR(priv, "Start AGG on invalid station\n");
880 return -ENXIO; 880 return -ENXIO;
881 } 881 }
882 if (unlikely(tid >= MAX_TID_COUNT)) 882 if (unlikely(tid >= MAX_TID_COUNT))
883 return -EINVAL; 883 return -EINVAL;
884 884
885 if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) { 885 if (priv->stations[sta_id].tid[tid].agg.state != IL_AGG_OFF) {
886 IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n"); 886 IL_ERR(priv, "Start AGG when state is not IL_AGG_OFF !\n");
887 return -ENXIO; 887 return -ENXIO;
888 } 888 }
889 889
890 txq_id = iwl4965_txq_ctx_activate_free(priv); 890 txq_id = il4965_txq_ctx_activate_free(priv);
891 if (txq_id == -1) { 891 if (txq_id == -1) {
892 IWL_ERR(priv, "No free aggregation queue available\n"); 892 IL_ERR(priv, "No free aggregation queue available\n");
893 return -ENXIO; 893 return -ENXIO;
894 } 894 }
895 895
@@ -897,11 +897,11 @@ int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
897 tid_data = &priv->stations[sta_id].tid[tid]; 897 tid_data = &priv->stations[sta_id].tid[tid];
898 *ssn = SEQ_TO_SN(tid_data->seq_number); 898 *ssn = SEQ_TO_SN(tid_data->seq_number);
899 tid_data->agg.txq_id = txq_id; 899 tid_data->agg.txq_id = txq_id;
900 iwl_legacy_set_swq_id(&priv->txq[txq_id], 900 il_set_swq_id(&priv->txq[txq_id],
901 iwl4965_get_ac_from_tid(tid), txq_id); 901 il4965_get_ac_from_tid(tid), txq_id);
902 spin_unlock_irqrestore(&priv->sta_lock, flags); 902 spin_unlock_irqrestore(&priv->sta_lock, flags);
903 903
904 ret = iwl4965_txq_agg_enable(priv, txq_id, tx_fifo, 904 ret = il4965_txq_agg_enable(priv, txq_id, tx_fifo,
905 sta_id, tid, *ssn); 905 sta_id, tid, *ssn);
906 if (ret) 906 if (ret)
907 return ret; 907 return ret;
@@ -909,14 +909,14 @@ int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
909 spin_lock_irqsave(&priv->sta_lock, flags); 909 spin_lock_irqsave(&priv->sta_lock, flags);
910 tid_data = &priv->stations[sta_id].tid[tid]; 910 tid_data = &priv->stations[sta_id].tid[tid];
911 if (tid_data->tfds_in_queue == 0) { 911 if (tid_data->tfds_in_queue == 0) {
912 IWL_DEBUG_HT(priv, "HW queue is empty\n"); 912 IL_DEBUG_HT(priv, "HW queue is empty\n");
913 tid_data->agg.state = IWL_AGG_ON; 913 tid_data->agg.state = IL_AGG_ON;
914 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); 914 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
915 } else { 915 } else {
916 IWL_DEBUG_HT(priv, 916 IL_DEBUG_HT(priv,
917 "HW queue is NOT empty: %d packets in HW queue\n", 917 "HW queue is NOT empty: %d packets in HW queue\n",
918 tid_data->tfds_in_queue); 918 tid_data->tfds_in_queue);
919 tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA; 919 tid_data->agg.state = IL_EMPTYING_HW_QUEUE_ADDBA;
920 } 920 }
921 spin_unlock_irqrestore(&priv->sta_lock, flags); 921 spin_unlock_irqrestore(&priv->sta_lock, flags);
922 return ret; 922 return ret;
@@ -926,13 +926,13 @@ int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
926 * txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE 926 * txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE
927 * priv->lock must be held by the caller 927 * priv->lock must be held by the caller
928 */ 928 */
929static int iwl4965_txq_agg_disable(struct iwl_priv *priv, u16 txq_id, 929static int il4965_txq_agg_disable(struct il_priv *priv, u16 txq_id,
930 u16 ssn_idx, u8 tx_fifo) 930 u16 ssn_idx, u8 tx_fifo)
931{ 931{
932 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || 932 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
933 (IWL49_FIRST_AMPDU_QUEUE + 933 (IWL49_FIRST_AMPDU_QUEUE +
934 priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) { 934 priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) {
935 IWL_WARN(priv, 935 IL_WARN(priv,
936 "queue number out of range: %d, must be %d to %d\n", 936 "queue number out of range: %d, must be %d to %d\n",
937 txq_id, IWL49_FIRST_AMPDU_QUEUE, 937 txq_id, IWL49_FIRST_AMPDU_QUEUE,
938 IWL49_FIRST_AMPDU_QUEUE + 938 IWL49_FIRST_AMPDU_QUEUE +
@@ -940,40 +940,40 @@ static int iwl4965_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
940 return -EINVAL; 940 return -EINVAL;
941 } 941 }
942 942
943 iwl4965_tx_queue_stop_scheduler(priv, txq_id); 943 il4965_tx_queue_stop_scheduler(priv, txq_id);
944 944
945 iwl_legacy_clear_bits_prph(priv, 945 il_clear_bits_prph(priv,
946 IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); 946 IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id));
947 947
948 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); 948 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
949 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); 949 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
950 /* supposes that ssn_idx is valid (!= 0xFFF) */ 950 /* supposes that ssn_idx is valid (!= 0xFFF) */
951 iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); 951 il4965_set_wr_ptrs(priv, txq_id, ssn_idx);
952 952
953 iwl_legacy_clear_bits_prph(priv, 953 il_clear_bits_prph(priv,
954 IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); 954 IWL49_SCD_INTERRUPT_MASK, (1 << txq_id));
955 iwl_txq_ctx_deactivate(priv, txq_id); 955 il_txq_ctx_deactivate(priv, txq_id);
956 iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0); 956 il4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0);
957 957
958 return 0; 958 return 0;
959} 959}
960 960
961int iwl4965_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, 961int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif,
962 struct ieee80211_sta *sta, u16 tid) 962 struct ieee80211_sta *sta, u16 tid)
963{ 963{
964 int tx_fifo_id, txq_id, sta_id, ssn; 964 int tx_fifo_id, txq_id, sta_id, ssn;
965 struct iwl_tid_data *tid_data; 965 struct il_tid_data *tid_data;
966 int write_ptr, read_ptr; 966 int write_ptr, read_ptr;
967 unsigned long flags; 967 unsigned long flags;
968 968
969 tx_fifo_id = iwl4965_get_fifo_from_tid(iwl_legacy_rxon_ctx_from_vif(vif), tid); 969 tx_fifo_id = il4965_get_fifo_from_tid(il_rxon_ctx_from_vif(vif), tid);
970 if (unlikely(tx_fifo_id < 0)) 970 if (unlikely(tx_fifo_id < 0))
971 return tx_fifo_id; 971 return tx_fifo_id;
972 972
973 sta_id = iwl_legacy_sta_id(sta); 973 sta_id = il_sta_id(sta);
974 974
975 if (sta_id == IWL_INVALID_STATION) { 975 if (sta_id == IL_INVALID_STATION) {
976 IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); 976 IL_ERR(priv, "Invalid station for AGG tid %d\n", tid);
977 return -ENXIO; 977 return -ENXIO;
978 } 978 }
979 979
@@ -984,19 +984,19 @@ int iwl4965_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
984 txq_id = tid_data->agg.txq_id; 984 txq_id = tid_data->agg.txq_id;
985 985
986 switch (priv->stations[sta_id].tid[tid].agg.state) { 986 switch (priv->stations[sta_id].tid[tid].agg.state) {
987 case IWL_EMPTYING_HW_QUEUE_ADDBA: 987 case IL_EMPTYING_HW_QUEUE_ADDBA:
988 /* 988 /*
989 * This can happen if the peer stops aggregation 989 * This can happen if the peer stops aggregation
990 * again before we've had a chance to drain the 990 * again before we've had a chance to drain the
991 * queue we selected previously, i.e. before the 991 * queue we selected previously, i.e. before the
992 * session was really started completely. 992 * session was really started completely.
993 */ 993 */
994 IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); 994 IL_DEBUG_HT(priv, "AGG stop before setup done\n");
995 goto turn_off; 995 goto turn_off;
996 case IWL_AGG_ON: 996 case IL_AGG_ON:
997 break; 997 break;
998 default: 998 default:
999 IWL_WARN(priv, "Stopping AGG while state not ON or starting\n"); 999 IL_WARN(priv, "Stopping AGG while state not ON or starting\n");
1000 } 1000 }
1001 1001
1002 write_ptr = priv->txq[txq_id].q.write_ptr; 1002 write_ptr = priv->txq[txq_id].q.write_ptr;
@@ -1004,16 +1004,16 @@ int iwl4965_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
1004 1004
1005 /* The queue is not empty */ 1005 /* The queue is not empty */
1006 if (write_ptr != read_ptr) { 1006 if (write_ptr != read_ptr) {
1007 IWL_DEBUG_HT(priv, "Stopping a non empty AGG HW QUEUE\n"); 1007 IL_DEBUG_HT(priv, "Stopping a non empty AGG HW QUEUE\n");
1008 priv->stations[sta_id].tid[tid].agg.state = 1008 priv->stations[sta_id].tid[tid].agg.state =
1009 IWL_EMPTYING_HW_QUEUE_DELBA; 1009 IL_EMPTYING_HW_QUEUE_DELBA;
1010 spin_unlock_irqrestore(&priv->sta_lock, flags); 1010 spin_unlock_irqrestore(&priv->sta_lock, flags);
1011 return 0; 1011 return 0;
1012 } 1012 }
1013 1013
1014 IWL_DEBUG_HT(priv, "HW queue is empty\n"); 1014 IL_DEBUG_HT(priv, "HW queue is empty\n");
1015 turn_off: 1015 turn_off:
1016 priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; 1016 priv->stations[sta_id].tid[tid].agg.state = IL_AGG_OFF;
1017 1017
1018 /* do not restore/save irqs */ 1018 /* do not restore/save irqs */
1019 spin_unlock(&priv->sta_lock); 1019 spin_unlock(&priv->sta_lock);
@@ -1026,7 +1026,7 @@ int iwl4965_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
1026 * to deactivate the uCode queue, just return "success" to allow 1026 * to deactivate the uCode queue, just return "success" to allow
1027 * mac80211 to clean up it own data. 1027 * mac80211 to clean up it own data.
1028 */ 1028 */
1029 iwl4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo_id); 1029 il4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo_id);
1030 spin_unlock_irqrestore(&priv->lock, flags); 1030 spin_unlock_irqrestore(&priv->lock, flags);
1031 1031
1032 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); 1032 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
@@ -1034,39 +1034,39 @@ int iwl4965_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
1034 return 0; 1034 return 0;
1035} 1035}
1036 1036
1037int iwl4965_txq_check_empty(struct iwl_priv *priv, 1037int il4965_txq_check_empty(struct il_priv *priv,
1038 int sta_id, u8 tid, int txq_id) 1038 int sta_id, u8 tid, int txq_id)
1039{ 1039{
1040 struct iwl_queue *q = &priv->txq[txq_id].q; 1040 struct il_queue *q = &priv->txq[txq_id].q;
1041 u8 *addr = priv->stations[sta_id].sta.sta.addr; 1041 u8 *addr = priv->stations[sta_id].sta.sta.addr;
1042 struct iwl_tid_data *tid_data = &priv->stations[sta_id].tid[tid]; 1042 struct il_tid_data *tid_data = &priv->stations[sta_id].tid[tid];
1043 struct iwl_rxon_context *ctx; 1043 struct il_rxon_context *ctx;
1044 1044
1045 ctx = &priv->contexts[priv->stations[sta_id].ctxid]; 1045 ctx = &priv->contexts[priv->stations[sta_id].ctxid];
1046 1046
1047 lockdep_assert_held(&priv->sta_lock); 1047 lockdep_assert_held(&priv->sta_lock);
1048 1048
1049 switch (priv->stations[sta_id].tid[tid].agg.state) { 1049 switch (priv->stations[sta_id].tid[tid].agg.state) {
1050 case IWL_EMPTYING_HW_QUEUE_DELBA: 1050 case IL_EMPTYING_HW_QUEUE_DELBA:
1051 /* We are reclaiming the last packet of the */ 1051 /* We are reclaiming the last packet of the */
1052 /* aggregated HW queue */ 1052 /* aggregated HW queue */
1053 if ((txq_id == tid_data->agg.txq_id) && 1053 if ((txq_id == tid_data->agg.txq_id) &&
1054 (q->read_ptr == q->write_ptr)) { 1054 (q->read_ptr == q->write_ptr)) {
1055 u16 ssn = SEQ_TO_SN(tid_data->seq_number); 1055 u16 ssn = SEQ_TO_SN(tid_data->seq_number);
1056 int tx_fifo = iwl4965_get_fifo_from_tid(ctx, tid); 1056 int tx_fifo = il4965_get_fifo_from_tid(ctx, tid);
1057 IWL_DEBUG_HT(priv, 1057 IL_DEBUG_HT(priv,
1058 "HW queue empty: continue DELBA flow\n"); 1058 "HW queue empty: continue DELBA flow\n");
1059 iwl4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo); 1059 il4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo);
1060 tid_data->agg.state = IWL_AGG_OFF; 1060 tid_data->agg.state = IL_AGG_OFF;
1061 ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid); 1061 ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid);
1062 } 1062 }
1063 break; 1063 break;
1064 case IWL_EMPTYING_HW_QUEUE_ADDBA: 1064 case IL_EMPTYING_HW_QUEUE_ADDBA:
1065 /* We are reclaiming the last packet of the queue */ 1065 /* We are reclaiming the last packet of the queue */
1066 if (tid_data->tfds_in_queue == 0) { 1066 if (tid_data->tfds_in_queue == 0) {
1067 IWL_DEBUG_HT(priv, 1067 IL_DEBUG_HT(priv,
1068 "HW queue empty: continue ADDBA flow\n"); 1068 "HW queue empty: continue ADDBA flow\n");
1069 tid_data->agg.state = IWL_AGG_ON; 1069 tid_data->agg.state = IL_AGG_ON;
1070 ieee80211_start_tx_ba_cb_irqsafe(ctx->vif, addr, tid); 1070 ieee80211_start_tx_ba_cb_irqsafe(ctx->vif, addr, tid);
1071 } 1071 }
1072 break; 1072 break;
@@ -1075,12 +1075,12 @@ int iwl4965_txq_check_empty(struct iwl_priv *priv,
1075 return 0; 1075 return 0;
1076} 1076}
1077 1077
1078static void iwl4965_non_agg_tx_status(struct iwl_priv *priv, 1078static void il4965_non_agg_tx_status(struct il_priv *priv,
1079 struct iwl_rxon_context *ctx, 1079 struct il_rxon_context *ctx,
1080 const u8 *addr1) 1080 const u8 *addr1)
1081{ 1081{
1082 struct ieee80211_sta *sta; 1082 struct ieee80211_sta *sta;
1083 struct iwl_station_priv *sta_priv; 1083 struct il_station_priv *sta_priv;
1084 1084
1085 rcu_read_lock(); 1085 rcu_read_lock();
1086 sta = ieee80211_find_sta(ctx->vif, addr1); 1086 sta = ieee80211_find_sta(ctx->vif, addr1);
@@ -1095,35 +1095,35 @@ static void iwl4965_non_agg_tx_status(struct iwl_priv *priv,
1095} 1095}
1096 1096
1097static void 1097static void
1098iwl4965_tx_status(struct iwl_priv *priv, struct iwl_tx_info *tx_info, 1098il4965_tx_status(struct il_priv *priv, struct il_tx_info *tx_info,
1099 bool is_agg) 1099 bool is_agg)
1100{ 1100{
1101 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data; 1101 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data;
1102 1102
1103 if (!is_agg) 1103 if (!is_agg)
1104 iwl4965_non_agg_tx_status(priv, tx_info->ctx, hdr->addr1); 1104 il4965_non_agg_tx_status(priv, tx_info->ctx, hdr->addr1);
1105 1105
1106 ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb); 1106 ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb);
1107} 1107}
1108 1108
1109int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) 1109int il4965_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index)
1110{ 1110{
1111 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 1111 struct il_tx_queue *txq = &priv->txq[txq_id];
1112 struct iwl_queue *q = &txq->q; 1112 struct il_queue *q = &txq->q;
1113 struct iwl_tx_info *tx_info; 1113 struct il_tx_info *tx_info;
1114 int nfreed = 0; 1114 int nfreed = 0;
1115 struct ieee80211_hdr *hdr; 1115 struct ieee80211_hdr *hdr;
1116 1116
1117 if ((index >= q->n_bd) || (iwl_legacy_queue_used(q, index) == 0)) { 1117 if ((index >= q->n_bd) || (il_queue_used(q, index) == 0)) {
1118 IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " 1118 IL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, "
1119 "is out of range [0-%d] %d %d.\n", txq_id, 1119 "is out of range [0-%d] %d %d.\n", txq_id,
1120 index, q->n_bd, q->write_ptr, q->read_ptr); 1120 index, q->n_bd, q->write_ptr, q->read_ptr);
1121 return 0; 1121 return 0;
1122 } 1122 }
1123 1123
1124 for (index = iwl_legacy_queue_inc_wrap(index, q->n_bd); 1124 for (index = il_queue_inc_wrap(index, q->n_bd);
1125 q->read_ptr != index; 1125 q->read_ptr != index;
1126 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1126 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) {
1127 1127
1128 tx_info = &txq->txb[txq->q.read_ptr]; 1128 tx_info = &txq->txb[txq->q.read_ptr];
1129 1129
@@ -1134,7 +1134,7 @@ int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1134 if (ieee80211_is_data_qos(hdr->frame_control)) 1134 if (ieee80211_is_data_qos(hdr->frame_control))
1135 nfreed++; 1135 nfreed++;
1136 1136
1137 iwl4965_tx_status(priv, tx_info, 1137 il4965_tx_status(priv, tx_info,
1138 txq_id >= IWL4965_FIRST_AMPDU_QUEUE); 1138 txq_id >= IWL4965_FIRST_AMPDU_QUEUE);
1139 tx_info->skb = NULL; 1139 tx_info->skb = NULL;
1140 1140
@@ -1144,14 +1144,14 @@ int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1144} 1144}
1145 1145
1146/** 1146/**
1147 * iwl4965_tx_status_reply_compressed_ba - Update tx status from block-ack 1147 * il4965_tx_status_reply_compressed_ba - Update tx status from block-ack
1148 * 1148 *
1149 * Go through block-ack's bitmap of ACK'd frames, update driver's record of 1149 * Go through block-ack's bitmap of ACK'd frames, update driver's record of
1150 * ACK vs. not. This gets sent to mac80211, then to rate scaling algo. 1150 * ACK vs. not. This gets sent to mac80211, then to rate scaling algo.
1151 */ 1151 */
1152static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv, 1152static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv,
1153 struct iwl_ht_agg *agg, 1153 struct il_ht_agg *agg,
1154 struct iwl_compressed_ba_resp *ba_resp) 1154 struct il_compressed_ba_resp *ba_resp)
1155 1155
1156{ 1156{
1157 int i, sh, ack; 1157 int i, sh, ack;
@@ -1163,13 +1163,13 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
1163 1163
1164 if (unlikely(!agg->wait_for_ba)) { 1164 if (unlikely(!agg->wait_for_ba)) {
1165 if (unlikely(ba_resp->bitmap)) 1165 if (unlikely(ba_resp->bitmap))
1166 IWL_ERR(priv, "Received BA when not expected\n"); 1166 IL_ERR(priv, "Received BA when not expected\n");
1167 return -EINVAL; 1167 return -EINVAL;
1168 } 1168 }
1169 1169
1170 /* Mark that the expected block-ack response arrived */ 1170 /* Mark that the expected block-ack response arrived */
1171 agg->wait_for_ba = 0; 1171 agg->wait_for_ba = 0;
1172 IWL_DEBUG_TX_REPLY(priv, "BA %d %d\n", agg->start_idx, 1172 IL_DEBUG_TX_REPLY(priv, "BA %d %d\n", agg->start_idx,
1173 ba_resp->seq_ctl); 1173 ba_resp->seq_ctl);
1174 1174
1175 /* Calculate shift to align block-ack bits with our Tx window bits */ 1175 /* Calculate shift to align block-ack bits with our Tx window bits */
@@ -1178,7 +1178,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
1178 sh += 0x100; 1178 sh += 0x100;
1179 1179
1180 if (agg->frame_count > (64 - sh)) { 1180 if (agg->frame_count > (64 - sh)) {
1181 IWL_DEBUG_TX_REPLY(priv, "more frames than bitmap size"); 1181 IL_DEBUG_TX_REPLY(priv, "more frames than bitmap size");
1182 return -1; 1182 return -1;
1183 } 1183 }
1184 1184
@@ -1195,7 +1195,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
1195 while (sent_bitmap) { 1195 while (sent_bitmap) {
1196 ack = sent_bitmap & 1ULL; 1196 ack = sent_bitmap & 1ULL;
1197 successes += ack; 1197 successes += ack;
1198 IWL_DEBUG_TX_REPLY(priv, "%s ON i=%d idx=%d raw=%d\n", 1198 IL_DEBUG_TX_REPLY(priv, "%s ON i=%d idx=%d raw=%d\n",
1199 ack ? "ACK" : "NACK", i, 1199 ack ? "ACK" : "NACK", i,
1200 (agg->start_idx + i) & 0xff, 1200 (agg->start_idx + i) & 0xff,
1201 agg->start_idx + i); 1201 agg->start_idx + i);
@@ -1203,7 +1203,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
1203 ++i; 1203 ++i;
1204 } 1204 }
1205 1205
1206 IWL_DEBUG_TX_REPLY(priv, "Bitmap %llx\n", 1206 IL_DEBUG_TX_REPLY(priv, "Bitmap %llx\n",
1207 (unsigned long long)bitmap); 1207 (unsigned long long)bitmap);
1208 1208
1209 info = IEEE80211_SKB_CB(priv->txq[scd_flow].txb[agg->start_idx].skb); 1209 info = IEEE80211_SKB_CB(priv->txq[scd_flow].txb[agg->start_idx].skb);
@@ -1212,7 +1212,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
1212 info->flags |= IEEE80211_TX_STAT_AMPDU; 1212 info->flags |= IEEE80211_TX_STAT_AMPDU;
1213 info->status.ampdu_ack_len = successes; 1213 info->status.ampdu_ack_len = successes;
1214 info->status.ampdu_len = agg->frame_count; 1214 info->status.ampdu_len = agg->frame_count;
1215 iwl4965_hwrate_to_tx_control(priv, agg->rate_n_flags, info); 1215 il4965_hwrate_to_tx_control(priv, agg->rate_n_flags, info);
1216 1216
1217 return 0; 1217 return 0;
1218} 1218}
@@ -1220,7 +1220,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
1220/** 1220/**
1221 * translate ucode response to mac80211 tx status control values 1221 * translate ucode response to mac80211 tx status control values
1222 */ 1222 */
1223void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, 1223void il4965_hwrate_to_tx_control(struct il_priv *priv, u32 rate_n_flags,
1224 struct ieee80211_tx_info *info) 1224 struct ieee80211_tx_info *info)
1225{ 1225{
1226 struct ieee80211_tx_rate *r = &info->control.rates[0]; 1226 struct ieee80211_tx_rate *r = &info->control.rates[0];
@@ -1237,22 +1237,22 @@ void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
1237 r->flags |= IEEE80211_TX_RC_DUP_DATA; 1237 r->flags |= IEEE80211_TX_RC_DUP_DATA;
1238 if (rate_n_flags & RATE_MCS_SGI_MSK) 1238 if (rate_n_flags & RATE_MCS_SGI_MSK)
1239 r->flags |= IEEE80211_TX_RC_SHORT_GI; 1239 r->flags |= IEEE80211_TX_RC_SHORT_GI;
1240 r->idx = iwl4965_hwrate_to_mac80211_idx(rate_n_flags, info->band); 1240 r->idx = il4965_hwrate_to_mac80211_idx(rate_n_flags, info->band);
1241} 1241}
1242 1242
1243/** 1243/**
1244 * iwl4965_rx_reply_compressed_ba - Handler for REPLY_COMPRESSED_BA 1244 * il4965_rx_reply_compressed_ba - Handler for REPLY_COMPRESSED_BA
1245 * 1245 *
1246 * Handles block-acknowledge notification from device, which reports success 1246 * Handles block-acknowledge notification from device, which reports success
1247 * of frames sent via aggregation. 1247 * of frames sent via aggregation.
1248 */ 1248 */
1249void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, 1249void il4965_rx_reply_compressed_ba(struct il_priv *priv,
1250 struct iwl_rx_mem_buffer *rxb) 1250 struct il_rx_mem_buffer *rxb)
1251{ 1251{
1252 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1252 struct il_rx_packet *pkt = rxb_addr(rxb);
1253 struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba; 1253 struct il_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba;
1254 struct iwl_tx_queue *txq = NULL; 1254 struct il_tx_queue *txq = NULL;
1255 struct iwl_ht_agg *agg; 1255 struct il_ht_agg *agg;
1256 int index; 1256 int index;
1257 int sta_id; 1257 int sta_id;
1258 int tid; 1258 int tid;
@@ -1266,7 +1266,7 @@ void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv,
1266 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); 1266 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn);
1267 1267
1268 if (scd_flow >= priv->hw_params.max_txq_num) { 1268 if (scd_flow >= priv->hw_params.max_txq_num) {
1269 IWL_ERR(priv, 1269 IL_ERR(priv,
1270 "BUG_ON scd_flow is bigger than number of queues\n"); 1270 "BUG_ON scd_flow is bigger than number of queues\n");
1271 return; 1271 return;
1272 } 1272 }
@@ -1282,23 +1282,23 @@ void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv,
1282 * since it is possible happen very often and in order 1282 * since it is possible happen very often and in order
1283 * not to fill the syslog, don't enable the logging by default 1283 * not to fill the syslog, don't enable the logging by default
1284 */ 1284 */
1285 IWL_DEBUG_TX_REPLY(priv, 1285 IL_DEBUG_TX_REPLY(priv,
1286 "BA scd_flow %d does not match txq_id %d\n", 1286 "BA scd_flow %d does not match txq_id %d\n",
1287 scd_flow, agg->txq_id); 1287 scd_flow, agg->txq_id);
1288 return; 1288 return;
1289 } 1289 }
1290 1290
1291 /* Find index just before block-ack window */ 1291 /* Find index just before block-ack window */
1292 index = iwl_legacy_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); 1292 index = il_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd);
1293 1293
1294 spin_lock_irqsave(&priv->sta_lock, flags); 1294 spin_lock_irqsave(&priv->sta_lock, flags);
1295 1295
1296 IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, " 1296 IL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, "
1297 "sta_id = %d\n", 1297 "sta_id = %d\n",
1298 agg->wait_for_ba, 1298 agg->wait_for_ba,
1299 (u8 *) &ba_resp->sta_addr_lo32, 1299 (u8 *) &ba_resp->sta_addr_lo32,
1300 ba_resp->sta_id); 1300 ba_resp->sta_id);
1301 IWL_DEBUG_TX_REPLY(priv, "TID = %d, SeqCtl = %d, bitmap = 0x%llx," 1301 IL_DEBUG_TX_REPLY(priv, "TID = %d, SeqCtl = %d, bitmap = 0x%llx,"
1302 "scd_flow = " 1302 "scd_flow = "
1303 "%d, scd_ssn = %d\n", 1303 "%d, scd_ssn = %d\n",
1304 ba_resp->tid, 1304 ba_resp->tid,
@@ -1306,34 +1306,34 @@ void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv,
1306 (unsigned long long)le64_to_cpu(ba_resp->bitmap), 1306 (unsigned long long)le64_to_cpu(ba_resp->bitmap),
1307 ba_resp->scd_flow, 1307 ba_resp->scd_flow,
1308 ba_resp->scd_ssn); 1308 ba_resp->scd_ssn);
1309 IWL_DEBUG_TX_REPLY(priv, "DAT start_idx = %d, bitmap = 0x%llx\n", 1309 IL_DEBUG_TX_REPLY(priv, "DAT start_idx = %d, bitmap = 0x%llx\n",
1310 agg->start_idx, 1310 agg->start_idx,
1311 (unsigned long long)agg->bitmap); 1311 (unsigned long long)agg->bitmap);
1312 1312
1313 /* Update driver's record of ACK vs. not for each frame in window */ 1313 /* Update driver's record of ACK vs. not for each frame in window */
1314 iwl4965_tx_status_reply_compressed_ba(priv, agg, ba_resp); 1314 il4965_tx_status_reply_compressed_ba(priv, agg, ba_resp);
1315 1315
1316 /* Release all TFDs before the SSN, i.e. all TFDs in front of 1316 /* Release all TFDs before the SSN, i.e. all TFDs in front of
1317 * block-ack window (we assume that they've been successfully 1317 * block-ack window (we assume that they've been successfully
1318 * transmitted ... if not, it's too late anyway). */ 1318 * transmitted ... if not, it's too late anyway). */
1319 if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { 1319 if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) {
1320 /* calculate mac80211 ampdu sw queue to wake */ 1320 /* calculate mac80211 ampdu sw queue to wake */
1321 int freed = iwl4965_tx_queue_reclaim(priv, scd_flow, index); 1321 int freed = il4965_tx_queue_reclaim(priv, scd_flow, index);
1322 iwl4965_free_tfds_in_queue(priv, sta_id, tid, freed); 1322 il4965_free_tfds_in_queue(priv, sta_id, tid, freed);
1323 1323
1324 if ((iwl_legacy_queue_space(&txq->q) > txq->q.low_mark) && 1324 if ((il_queue_space(&txq->q) > txq->q.low_mark) &&
1325 priv->mac80211_registered && 1325 priv->mac80211_registered &&
1326 (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)) 1326 (agg->state != IL_EMPTYING_HW_QUEUE_DELBA))
1327 iwl_legacy_wake_queue(priv, txq); 1327 il_wake_queue(priv, txq);
1328 1328
1329 iwl4965_txq_check_empty(priv, sta_id, tid, scd_flow); 1329 il4965_txq_check_empty(priv, sta_id, tid, scd_flow);
1330 } 1330 }
1331 1331
1332 spin_unlock_irqrestore(&priv->sta_lock, flags); 1332 spin_unlock_irqrestore(&priv->sta_lock, flags);
1333} 1333}
1334 1334
1335#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 1335#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
1336const char *iwl4965_get_tx_fail_reason(u32 status) 1336const char *il4965_get_tx_fail_reason(u32 status)
1337{ 1337{
1338#define TX_STATUS_FAIL(x) case TX_STATUS_FAIL_ ## x: return #x 1338#define TX_STATUS_FAIL(x) case TX_STATUS_FAIL_ ## x: return #x
1339#define TX_STATUS_POSTPONE(x) case TX_STATUS_POSTPONE_ ## x: return #x 1339#define TX_STATUS_POSTPONE(x) case TX_STATUS_POSTPONE_ ## x: return #x
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c b/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c
index 001d148feb94..3c9df1bb5afe 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c
@@ -40,30 +40,30 @@
40#include "iwl-4965.h" 40#include "iwl-4965.h"
41#include "iwl-4965-calib.h" 41#include "iwl-4965-calib.h"
42 42
43#define IWL_AC_UNSET -1 43#define IL_AC_UNSET -1
44 44
45/** 45/**
46 * iwl_verify_inst_sparse - verify runtime uCode image in card vs. host, 46 * il_verify_inst_sparse - verify runtime uCode image in card vs. host,
47 * using sample data 100 bytes apart. If these sample points are good, 47 * using sample data 100 bytes apart. If these sample points are good,
48 * it's a pretty good bet that everything between them is good, too. 48 * it's a pretty good bet that everything between them is good, too.
49 */ 49 */
50static int 50static int
51iwl4965_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) 51il4965_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 len)
52{ 52{
53 u32 val; 53 u32 val;
54 int ret = 0; 54 int ret = 0;
55 u32 errcnt = 0; 55 u32 errcnt = 0;
56 u32 i; 56 u32 i;
57 57
58 IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); 58 IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
59 59
60 for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { 60 for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) {
61 /* read data comes through single port, auto-incr addr */ 61 /* read data comes through single port, auto-incr addr */
62 /* NOTE: Use the debugless read so we don't flood kernel log 62 /* NOTE: Use the debugless read so we don't flood kernel log
63 * if IWL_DL_IO is set */ 63 * if IL_DL_IO is set */
64 iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, 64 il_write_direct32(priv, HBUS_TARG_MEM_RADDR,
65 i + IWL4965_RTC_INST_LOWER_BOUND); 65 i + IWL4965_RTC_INST_LOWER_BOUND);
66 val = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); 66 val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT);
67 if (val != le32_to_cpu(*image)) { 67 if (val != le32_to_cpu(*image)) {
68 ret = -EIO; 68 ret = -EIO;
69 errcnt++; 69 errcnt++;
@@ -76,10 +76,10 @@ iwl4965_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len)
76} 76}
77 77
78/** 78/**
79 * iwl4965_verify_inst_full - verify runtime uCode image in card vs. host, 79 * il4965_verify_inst_full - verify runtime uCode image in card vs. host,
80 * looking at all data. 80 * looking at all data.
81 */ 81 */
82static int iwl4965_verify_inst_full(struct iwl_priv *priv, __le32 *image, 82static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image,
83 u32 len) 83 u32 len)
84{ 84{
85 u32 val; 85 u32 val;
@@ -87,19 +87,19 @@ static int iwl4965_verify_inst_full(struct iwl_priv *priv, __le32 *image,
87 int ret = 0; 87 int ret = 0;
88 u32 errcnt; 88 u32 errcnt;
89 89
90 IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); 90 IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
91 91
92 iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, 92 il_write_direct32(priv, HBUS_TARG_MEM_RADDR,
93 IWL4965_RTC_INST_LOWER_BOUND); 93 IWL4965_RTC_INST_LOWER_BOUND);
94 94
95 errcnt = 0; 95 errcnt = 0;
96 for (; len > 0; len -= sizeof(u32), image++) { 96 for (; len > 0; len -= sizeof(u32), image++) {
97 /* read data comes through single port, auto-incr addr */ 97 /* read data comes through single port, auto-incr addr */
98 /* NOTE: Use the debugless read so we don't flood kernel log 98 /* NOTE: Use the debugless read so we don't flood kernel log
99 * if IWL_DL_IO is set */ 99 * if IL_DL_IO is set */
100 val = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); 100 val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT);
101 if (val != le32_to_cpu(*image)) { 101 if (val != le32_to_cpu(*image)) {
102 IWL_ERR(priv, "uCode INST section is invalid at " 102 IL_ERR(priv, "uCode INST section is invalid at "
103 "offset 0x%x, is 0x%x, s/b 0x%x\n", 103 "offset 0x%x, is 0x%x, s/b 0x%x\n",
104 save_len - len, val, le32_to_cpu(*image)); 104 save_len - len, val, le32_to_cpu(*image));
105 ret = -EIO; 105 ret = -EIO;
@@ -110,17 +110,17 @@ static int iwl4965_verify_inst_full(struct iwl_priv *priv, __le32 *image,
110 } 110 }
111 111
112 if (!errcnt) 112 if (!errcnt)
113 IWL_DEBUG_INFO(priv, 113 IL_DEBUG_INFO(priv,
114 "ucode image in INSTRUCTION memory is good\n"); 114 "ucode image in INSTRUCTION memory is good\n");
115 115
116 return ret; 116 return ret;
117} 117}
118 118
119/** 119/**
120 * iwl4965_verify_ucode - determine which instruction image is in SRAM, 120 * il4965_verify_ucode - determine which instruction image is in SRAM,
121 * and verify its contents 121 * and verify its contents
122 */ 122 */
123int iwl4965_verify_ucode(struct iwl_priv *priv) 123int il4965_verify_ucode(struct il_priv *priv)
124{ 124{
125 __le32 *image; 125 __le32 *image;
126 u32 len; 126 u32 len;
@@ -129,38 +129,38 @@ int iwl4965_verify_ucode(struct iwl_priv *priv)
129 /* Try bootstrap */ 129 /* Try bootstrap */
130 image = (__le32 *)priv->ucode_boot.v_addr; 130 image = (__le32 *)priv->ucode_boot.v_addr;
131 len = priv->ucode_boot.len; 131 len = priv->ucode_boot.len;
132 ret = iwl4965_verify_inst_sparse(priv, image, len); 132 ret = il4965_verify_inst_sparse(priv, image, len);
133 if (!ret) { 133 if (!ret) {
134 IWL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n"); 134 IL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n");
135 return 0; 135 return 0;
136 } 136 }
137 137
138 /* Try initialize */ 138 /* Try initialize */
139 image = (__le32 *)priv->ucode_init.v_addr; 139 image = (__le32 *)priv->ucode_init.v_addr;
140 len = priv->ucode_init.len; 140 len = priv->ucode_init.len;
141 ret = iwl4965_verify_inst_sparse(priv, image, len); 141 ret = il4965_verify_inst_sparse(priv, image, len);
142 if (!ret) { 142 if (!ret) {
143 IWL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n"); 143 IL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n");
144 return 0; 144 return 0;
145 } 145 }
146 146
147 /* Try runtime/protocol */ 147 /* Try runtime/protocol */
148 image = (__le32 *)priv->ucode_code.v_addr; 148 image = (__le32 *)priv->ucode_code.v_addr;
149 len = priv->ucode_code.len; 149 len = priv->ucode_code.len;
150 ret = iwl4965_verify_inst_sparse(priv, image, len); 150 ret = il4965_verify_inst_sparse(priv, image, len);
151 if (!ret) { 151 if (!ret) {
152 IWL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n"); 152 IL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n");
153 return 0; 153 return 0;
154 } 154 }
155 155
156 IWL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); 156 IL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
157 157
158 /* Since nothing seems to match, show first several data entries in 158 /* Since nothing seems to match, show first several data entries in
159 * instruction SRAM, so maybe visual inspection will give a clue. 159 * instruction SRAM, so maybe visual inspection will give a clue.
160 * Selection of bootstrap image (vs. other images) is arbitrary. */ 160 * Selection of bootstrap image (vs. other images) is arbitrary. */
161 image = (__le32 *)priv->ucode_boot.v_addr; 161 image = (__le32 *)priv->ucode_boot.v_addr;
162 len = priv->ucode_boot.len; 162 len = priv->ucode_boot.len;
163 ret = iwl4965_verify_inst_full(priv, image, len); 163 ret = il4965_verify_inst_full(priv, image, len);
164 164
165 return ret; 165 return ret;
166} 166}
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index 86f4fce193e4..0f2bc5f767da 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 iwl4965_send_tx_power(struct iwl_priv *priv); 51static int il4965_send_tx_power(struct il_priv *priv);
52static int iwl4965_hw_get_temperature(struct iwl_priv *priv); 52static int il4965_hw_get_temperature(struct il_priv *priv);
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 iwl4965_hw_get_temperature(struct iwl_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 iwl4965_verify_bsm(struct iwl_priv *priv) 65static int il4965_verify_bsm(struct il_priv *priv)
66{ 66{
67 __le32 *image = priv->ucode_boot.v_addr; 67 __le32 *image = priv->ucode_boot.v_addr;
68 u32 len = priv->ucode_boot.len; 68 u32 len = priv->ucode_boot.len;
69 u32 reg; 69 u32 reg;
70 u32 val; 70 u32 val;
71 71
72 IWL_DEBUG_INFO(priv, "Begin verify bsm\n"); 72 IL_DEBUG_INFO(priv, "Begin verify bsm\n");
73 73
74 /* verify BSM SRAM contents */ 74 /* verify BSM SRAM contents */
75 val = iwl_legacy_read_prph(priv, BSM_WR_DWCOUNT_REG); 75 val = il_read_prph(priv, 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 = iwl_legacy_read_prph(priv, reg); 79 val = il_read_prph(priv, reg);
80 if (val != le32_to_cpu(*image)) { 80 if (val != le32_to_cpu(*image)) {
81 IWL_ERR(priv, "BSM uCode verification failed at " 81 IL_ERR(priv, "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,13 +87,13 @@ static int iwl4965_verify_bsm(struct iwl_priv *priv)
87 } 87 }
88 } 88 }
89 89
90 IWL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n"); 90 IL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n");
91 91
92 return 0; 92 return 0;
93} 93}
94 94
95/** 95/**
96 * iwl4965_load_bsm - Load bootstrap instructions 96 * il4965_load_bsm - Load bootstrap instructions
97 * 97 *
98 * BSM operation: 98 * BSM operation:
99 * 99 *
@@ -124,7 +124,7 @@ static int iwl4965_verify_bsm(struct iwl_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 iwl4965_load_bsm(struct iwl_priv *priv) 127static int il4965_load_bsm(struct il_priv *priv)
128{ 128{
129 __le32 *image = priv->ucode_boot.v_addr; 129 __le32 *image = priv->ucode_boot.v_addr;
130 u32 len = priv->ucode_boot.len; 130 u32 len = priv->ucode_boot.len;
@@ -137,7 +137,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
137 u32 reg_offset; 137 u32 reg_offset;
138 int ret; 138 int ret;
139 139
140 IWL_DEBUG_INFO(priv, "Begin load bsm\n"); 140 IL_DEBUG_INFO(priv, "Begin load bsm\n");
141 141
142 priv->ucode_type = UCODE_RT; 142 priv->ucode_type = UCODE_RT;
143 143
@@ -147,7 +147,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
147 147
148 /* Tell bootstrap uCode where to find the "Initialize" uCode 148 /* Tell bootstrap uCode where to find the "Initialize" uCode
149 * in host DRAM ... host DRAM physical address bits 35:4 for 4965. 149 * in host DRAM ... host DRAM physical address bits 35:4 for 4965.
150 * NOTE: iwl_init_alive_start() will replace these values, 150 * NOTE: il_init_alive_start() will replace these values,
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 */
@@ -156,48 +156,48 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
156 inst_len = priv->ucode_init.len; 156 inst_len = priv->ucode_init.len;
157 data_len = priv->ucode_init_data.len; 157 data_len = priv->ucode_init_data.len;
158 158
159 iwl_legacy_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 159 il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
160 iwl_legacy_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 160 il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
161 iwl_legacy_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); 161 il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
162 iwl_legacy_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); 162 il_write_prph(priv, 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 _iwl_legacy_write_prph(priv, reg_offset, le32_to_cpu(*image)); 168 _il_write_prph(priv, reg_offset, le32_to_cpu(*image));
169 169
170 ret = iwl4965_verify_bsm(priv); 170 ret = il4965_verify_bsm(priv);
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 iwl_legacy_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); 175 il_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
176 iwl_legacy_write_prph(priv, 176 il_write_prph(priv,
177 BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND); 177 BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND);
178 iwl_legacy_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); 178 il_write_prph(priv, 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 iwl_legacy_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); 182 il_write_prph(priv, 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 = iwl_legacy_read_prph(priv, BSM_WR_CTRL_REG); 186 done = il_read_prph(priv, 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 IWL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i); 192 IL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i);
193 else { 193 else {
194 IWL_ERR(priv, "BSM write did not complete!\n"); 194 IL_ERR(priv, "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 iwl_legacy_write_prph(priv, 200 il_write_prph(priv,
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
@@ -205,7 +205,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
205} 205}
206 206
207/** 207/**
208 * iwl4965_set_ucode_ptrs - Set uCode address location 208 * il4965_set_ucode_ptrs - Set uCode address location
209 * 209 *
210 * Tell initialization uCode where to find runtime uCode. 210 * Tell initialization uCode where to find runtime uCode.
211 * 211 *
@@ -213,7 +213,7 @@ static int iwl4965_load_bsm(struct iwl_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 iwl4965_set_ucode_ptrs(struct iwl_priv *priv) 216static int il4965_set_ucode_ptrs(struct il_priv *priv)
217{ 217{
218 dma_addr_t pinst; 218 dma_addr_t pinst;
219 dma_addr_t pdata; 219 dma_addr_t pdata;
@@ -224,22 +224,22 @@ static int iwl4965_set_ucode_ptrs(struct iwl_priv *priv)
224 pdata = priv->ucode_data_backup.p_addr >> 4; 224 pdata = priv->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 iwl_legacy_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 227 il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
228 iwl_legacy_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 228 il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
229 iwl_legacy_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, 229 il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG,
230 priv->ucode_data.len); 230 priv->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 iwl_legacy_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, 234 il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG,
235 priv->ucode_code.len | BSM_DRAM_INST_LOAD); 235 priv->ucode_code.len | BSM_DRAM_INST_LOAD);
236 IWL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); 236 IL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n");
237 237
238 return ret; 238 return ret;
239} 239}
240 240
241/** 241/**
242 * iwl4965_init_alive_start - Called after REPLY_ALIVE notification received 242 * il4965_init_alive_start - Called after REPLY_ALIVE notification received
243 * 243 *
244 * Called after REPLY_ALIVE notification received from "initialize" uCode. 244 * Called after REPLY_ALIVE notification received from "initialize" uCode.
245 * 245 *
@@ -249,29 +249,29 @@ static int iwl4965_set_ucode_ptrs(struct iwl_priv *priv)
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 iwl4965_init_alive_start(struct iwl_priv *priv) 252static void il4965_init_alive_start(struct il_priv *priv)
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 (iwl4965_verify_ucode(priv)) { 257 if (il4965_verify_ucode(priv)) {
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 IWL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); 260 IL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n");
261 goto restart; 261 goto restart;
262 } 262 }
263 263
264 /* Calculate temperature */ 264 /* Calculate temperature */
265 priv->temperature = iwl4965_hw_get_temperature(priv); 265 priv->temperature = il4965_hw_get_temperature(priv);
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 IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); 270 IL_DEBUG_INFO(priv, "Initialization Alive received.\n");
271 if (iwl4965_set_ucode_ptrs(priv)) { 271 if (il4965_set_ucode_ptrs(priv)) {
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 IWL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); 274 IL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n");
275 goto restart; 275 goto restart;
276 } 276 }
277 return; 277 return;
@@ -288,29 +288,29 @@ 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 iwl4965_nic_config(struct iwl_priv *priv) 291static void il4965_nic_config(struct il_priv *priv)
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(&priv->lock, flags);
297 297
298 radio_cfg = iwl_legacy_eeprom_query16(priv, EEPROM_RADIO_CONFIG); 298 radio_cfg = il_eeprom_query16(priv, 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 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 302 il_set_bit(priv, 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 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 308 il_set_bit(priv, 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 iwl_eeprom_calib_info *) 312 priv->calib_info = (struct il_eeprom_calib_info *)
313 iwl_legacy_eeprom_query_addr(priv, 313 il_eeprom_query_addr(priv,
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(&priv->lock, flags);
@@ -319,13 +319,13 @@ static void iwl4965_nic_config(struct iwl_priv *priv)
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 iwl4965_chain_noise_reset(struct iwl_priv *priv) 322static void il4965_chain_noise_reset(struct il_priv *priv)
323{ 323{
324 struct iwl_chain_noise_data *data = &(priv->chain_noise_data); 324 struct il_chain_noise_data *data = &(priv->chain_noise_data);
325 325
326 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && 326 if ((data->state == IL_CHAIN_NOISE_ALIVE) &&
327 iwl_legacy_is_any_associated(priv)) { 327 il_is_any_associated(priv)) {
328 struct iwl_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 */
331 data->chain_noise_a = 0; 331 data->chain_noise_a = 0;
@@ -337,20 +337,20 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv)
337 data->beacon_count = 0; 337 data->beacon_count = 0;
338 338
339 memset(&cmd, 0, sizeof(cmd)); 339 memset(&cmd, 0, sizeof(cmd));
340 cmd.hdr.op_code = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD; 340 cmd.hdr.op_code = IL_PHY_CALIBRATE_DIFF_GAIN_CMD;
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 (iwl_legacy_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, 344 if (il_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
345 sizeof(cmd), &cmd)) 345 sizeof(cmd), &cmd))
346 IWL_ERR(priv, 346 IL_ERR(priv,
347 "Could not send REPLY_PHY_CALIBRATION_CMD\n"); 347 "Could not send REPLY_PHY_CALIBRATION_CMD\n");
348 data->state = IWL_CHAIN_NOISE_ACCUMULATE; 348 data->state = IL_CHAIN_NOISE_ACCUMULATE;
349 IWL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n"); 349 IL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n");
350 } 350 }
351} 351}
352 352
353static struct iwl_sensitivity_ranges iwl4965_sensitivity = { 353static struct il_sensitivity_ranges il4965_sensitivity = {
354 .min_nrg_cck = 97, 354 .min_nrg_cck = 97,
355 .max_nrg_cck = 0, /* not used, set to 0 */ 355 .max_nrg_cck = 0, /* not used, set to 0 */
356 356
@@ -377,7 +377,7 @@ static struct iwl_sensitivity_ranges iwl4965_sensitivity = {
377 .nrg_th_cca = 62, 377 .nrg_th_cca = 62,
378}; 378};
379 379
380static void iwl4965_set_ct_threshold(struct iwl_priv *priv) 380static void il4965_set_ct_threshold(struct il_priv *priv)
381{ 381{
382 /* want Kelvin */ 382 /* want Kelvin */
383 priv->hw_params.ct_kill_threshold = 383 priv->hw_params.ct_kill_threshold =
@@ -385,13 +385,13 @@ static void iwl4965_set_ct_threshold(struct iwl_priv *priv)
385} 385}
386 386
387/** 387/**
388 * iwl4965_hw_set_hw_params 388 * il4965_hw_set_hw_params
389 * 389 *
390 * Called when initializing driver 390 * Called when initializing driver
391 */ 391 */
392static int iwl4965_hw_set_hw_params(struct iwl_priv *priv) 392static int il4965_hw_set_hw_params(struct il_priv *priv)
393{ 393{
394 if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES && 394 if (priv->cfg->mod_params->num_of_queues >= IL_MIN_NUM_QUEUES &&
395 priv->cfg->mod_params->num_of_queues <= IWL49_NUM_QUEUES) 395 priv->cfg->mod_params->num_of_queues <= IWL49_NUM_QUEUES)
396 priv->cfg->base_params->num_of_queues = 396 priv->cfg->base_params->num_of_queues =
397 priv->cfg->mod_params->num_of_queues; 397 priv->cfg->mod_params->num_of_queues;
@@ -400,10 +400,10 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
400 priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM; 400 priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM;
401 priv->hw_params.scd_bc_tbls_size = 401 priv->hw_params.scd_bc_tbls_size =
402 priv->cfg->base_params->num_of_queues * 402 priv->cfg->base_params->num_of_queues *
403 sizeof(struct iwl4965_scd_bc_tbl); 403 sizeof(struct il4965_scd_bc_tbl);
404 priv->hw_params.tfd_size = sizeof(struct iwl_tfd); 404 priv->hw_params.tfd_size = sizeof(struct il_tfd);
405 priv->hw_params.max_stations = IWL4965_STATION_COUNT; 405 priv->hw_params.max_stations = IWL4965_STATION_COUNT;
406 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID; 406 priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID;
407 priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; 407 priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE;
408 priv->hw_params.max_inst_size = IWL49_RTC_INST_SIZE; 408 priv->hw_params.max_inst_size = IWL49_RTC_INST_SIZE;
409 priv->hw_params.max_bsm_size = BSM_SRAM_SIZE; 409 priv->hw_params.max_bsm_size = BSM_SRAM_SIZE;
@@ -411,20 +411,20 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
411 411
412 priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR; 412 priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
413 413
414 priv->hw_params.tx_chains_num = iwl4965_num_of_ant(priv->cfg->valid_tx_ant); 414 priv->hw_params.tx_chains_num = il4965_num_of_ant(priv->cfg->valid_tx_ant);
415 priv->hw_params.rx_chains_num = iwl4965_num_of_ant(priv->cfg->valid_rx_ant); 415 priv->hw_params.rx_chains_num = il4965_num_of_ant(priv->cfg->valid_rx_ant);
416 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; 416 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
417 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; 417 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
418 418
419 iwl4965_set_ct_threshold(priv); 419 il4965_set_ct_threshold(priv);
420 420
421 priv->hw_params.sens = &iwl4965_sensitivity; 421 priv->hw_params.sens = &il4965_sensitivity;
422 priv->hw_params.beacon_time_tsf_bits = IWL4965_EXT_BEACON_TIME_POS; 422 priv->hw_params.beacon_time_tsf_bits = IWL4965_EXT_BEACON_TIME_POS;
423 423
424 return 0; 424 return 0;
425} 425}
426 426
427static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) 427static s32 il4965_math_div_round(s32 num, s32 denom, s32 *res)
428{ 428{
429 s32 sign = 1; 429 s32 sign = 1;
430 430
@@ -443,7 +443,7 @@ static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res)
443} 443}
444 444
445/** 445/**
446 * iwl4965_get_voltage_compensation - Power supply voltage comp for txpower 446 * il4965_get_voltage_compensation - Power supply voltage comp for txpower
447 * 447 *
448 * Determines power supply voltage compensation for txpower calculations. 448 * Determines power supply voltage compensation for txpower calculations.
449 * Returns number of 1/2-dB steps to subtract from gain table index, 449 * Returns number of 1/2-dB steps to subtract from gain table index,
@@ -453,17 +453,17 @@ static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res)
453 * Voltage indication is higher for lower voltage. 453 * Voltage indication is higher for lower voltage.
454 * Lower voltage requires more gain (lower gain table index). 454 * Lower voltage requires more gain (lower gain table index).
455 */ 455 */
456static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage, 456static s32 il4965_get_voltage_compensation(s32 eeprom_voltage,
457 s32 current_voltage) 457 s32 current_voltage)
458{ 458{
459 s32 comp = 0; 459 s32 comp = 0;
460 460
461 if ((TX_POWER_IWL_ILLEGAL_VOLTAGE == eeprom_voltage) || 461 if ((TX_POWER_IL_ILLEGAL_VOLTAGE == eeprom_voltage) ||
462 (TX_POWER_IWL_ILLEGAL_VOLTAGE == current_voltage)) 462 (TX_POWER_IL_ILLEGAL_VOLTAGE == current_voltage))
463 return 0; 463 return 0;
464 464
465 iwl4965_math_div_round(current_voltage - eeprom_voltage, 465 il4965_math_div_round(current_voltage - eeprom_voltage,
466 TX_POWER_IWL_VOLTAGE_CODES_PER_03V, &comp); 466 TX_POWER_IL_VOLTAGE_CODES_PER_03V, &comp);
467 467
468 if (current_voltage > eeprom_voltage) 468 if (current_voltage > eeprom_voltage)
469 comp *= 2; 469 comp *= 2;
@@ -473,32 +473,32 @@ static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage,
473 return comp; 473 return comp;
474} 474}
475 475
476static s32 iwl4965_get_tx_atten_grp(u16 channel) 476static s32 il4965_get_tx_atten_grp(u16 channel)
477{ 477{
478 if (channel >= CALIB_IWL_TX_ATTEN_GR5_FCH && 478 if (channel >= CALIB_IL_TX_ATTEN_GR5_FCH &&
479 channel <= CALIB_IWL_TX_ATTEN_GR5_LCH) 479 channel <= CALIB_IL_TX_ATTEN_GR5_LCH)
480 return CALIB_CH_GROUP_5; 480 return CALIB_CH_GROUP_5;
481 481
482 if (channel >= CALIB_IWL_TX_ATTEN_GR1_FCH && 482 if (channel >= CALIB_IL_TX_ATTEN_GR1_FCH &&
483 channel <= CALIB_IWL_TX_ATTEN_GR1_LCH) 483 channel <= CALIB_IL_TX_ATTEN_GR1_LCH)
484 return CALIB_CH_GROUP_1; 484 return CALIB_CH_GROUP_1;
485 485
486 if (channel >= CALIB_IWL_TX_ATTEN_GR2_FCH && 486 if (channel >= CALIB_IL_TX_ATTEN_GR2_FCH &&
487 channel <= CALIB_IWL_TX_ATTEN_GR2_LCH) 487 channel <= CALIB_IL_TX_ATTEN_GR2_LCH)
488 return CALIB_CH_GROUP_2; 488 return CALIB_CH_GROUP_2;
489 489
490 if (channel >= CALIB_IWL_TX_ATTEN_GR3_FCH && 490 if (channel >= CALIB_IL_TX_ATTEN_GR3_FCH &&
491 channel <= CALIB_IWL_TX_ATTEN_GR3_LCH) 491 channel <= CALIB_IL_TX_ATTEN_GR3_LCH)
492 return CALIB_CH_GROUP_3; 492 return CALIB_CH_GROUP_3;
493 493
494 if (channel >= CALIB_IWL_TX_ATTEN_GR4_FCH && 494 if (channel >= CALIB_IL_TX_ATTEN_GR4_FCH &&
495 channel <= CALIB_IWL_TX_ATTEN_GR4_LCH) 495 channel <= CALIB_IL_TX_ATTEN_GR4_LCH)
496 return CALIB_CH_GROUP_4; 496 return CALIB_CH_GROUP_4;
497 497
498 return -EINVAL; 498 return -EINVAL;
499} 499}
500 500
501static u32 iwl4965_get_sub_band(const struct iwl_priv *priv, u32 channel) 501static u32 il4965_get_sub_band(const struct il_priv *priv, u32 channel)
502{ 502{
503 s32 b = -1; 503 s32 b = -1;
504 504
@@ -514,41 +514,41 @@ static u32 iwl4965_get_sub_band(const struct iwl_priv *priv, u32 channel)
514 return b; 514 return b;
515} 515}
516 516
517static s32 iwl4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2) 517static s32 il4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2)
518{ 518{
519 s32 val; 519 s32 val;
520 520
521 if (x2 == x1) 521 if (x2 == x1)
522 return y1; 522 return y1;
523 else { 523 else {
524 iwl4965_math_div_round((x2 - x) * (y1 - y2), (x2 - x1), &val); 524 il4965_math_div_round((x2 - x) * (y1 - y2), (x2 - x1), &val);
525 return val + y2; 525 return val + y2;
526 } 526 }
527} 527}
528 528
529/** 529/**
530 * iwl4965_interpolate_chan - Interpolate factory measurements for one channel 530 * il4965_interpolate_chan - Interpolate factory measurements for one channel
531 * 531 *
532 * Interpolates factory measurements from the two sample channels within a 532 * Interpolates factory measurements from the two sample channels within a
533 * sub-band, to apply to channel of interest. Interpolation is proportional to 533 * sub-band, to apply to channel of interest. Interpolation is proportional to
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 iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel, 537static int il4965_interpolate_chan(struct il_priv *priv, u32 channel,
538 struct iwl_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;
541 u32 c; 541 u32 c;
542 u32 m; 542 u32 m;
543 const struct iwl_eeprom_calib_measure *m1; 543 const struct il_eeprom_calib_measure *m1;
544 const struct iwl_eeprom_calib_measure *m2; 544 const struct il_eeprom_calib_measure *m2;
545 struct iwl_eeprom_calib_measure *omeas; 545 struct il_eeprom_calib_measure *omeas;
546 u32 ch_i1; 546 u32 ch_i1;
547 u32 ch_i2; 547 u32 ch_i2;
548 548
549 s = iwl4965_get_sub_band(priv, channel); 549 s = il4965_get_sub_band(priv, channel);
550 if (s >= EEPROM_TX_POWER_BANDS) { 550 if (s >= EEPROM_TX_POWER_BANDS) {
551 IWL_ERR(priv, "Tx Power can not find channel %d\n", channel); 551 IL_ERR(priv, "Tx Power can not find channel %d\n", channel);
552 return -1; 552 return -1;
553 } 553 }
554 554
@@ -556,7 +556,7 @@ static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel,
556 ch_i2 = priv->calib_info->band_info[s].ch2.ch_num; 556 ch_i2 = priv->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 IWL_DEBUG_TXPOWER(priv, "channel %d subband %d factory cal ch %d & %d\n", 559 IL_DEBUG_TXPOWER(priv, "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++) {
@@ -568,34 +568,34 @@ static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel,
568 omeas = &(chan_info->measurements[c][m]); 568 omeas = &(chan_info->measurements[c][m]);
569 569
570 omeas->actual_pow = 570 omeas->actual_pow =
571 (u8) iwl4965_interpolate_value(channel, ch_i1, 571 (u8) il4965_interpolate_value(channel, ch_i1,
572 m1->actual_pow, 572 m1->actual_pow,
573 ch_i2, 573 ch_i2,
574 m2->actual_pow); 574 m2->actual_pow);
575 omeas->gain_idx = 575 omeas->gain_idx =
576 (u8) iwl4965_interpolate_value(channel, ch_i1, 576 (u8) il4965_interpolate_value(channel, ch_i1,
577 m1->gain_idx, ch_i2, 577 m1->gain_idx, ch_i2,
578 m2->gain_idx); 578 m2->gain_idx);
579 omeas->temperature = 579 omeas->temperature =
580 (u8) iwl4965_interpolate_value(channel, ch_i1, 580 (u8) il4965_interpolate_value(channel, ch_i1,
581 m1->temperature, 581 m1->temperature,
582 ch_i2, 582 ch_i2,
583 m2->temperature); 583 m2->temperature);
584 omeas->pa_det = 584 omeas->pa_det =
585 (s8) iwl4965_interpolate_value(channel, ch_i1, 585 (s8) il4965_interpolate_value(channel, ch_i1,
586 m1->pa_det, ch_i2, 586 m1->pa_det, ch_i2,
587 m2->pa_det); 587 m2->pa_det);
588 588
589 IWL_DEBUG_TXPOWER(priv, 589 IL_DEBUG_TXPOWER(priv,
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 IWL_DEBUG_TXPOWER(priv, 592 IL_DEBUG_TXPOWER(priv,
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 IWL_DEBUG_TXPOWER(priv, 595 IL_DEBUG_TXPOWER(priv,
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 IWL_DEBUG_TXPOWER(priv, 598 IL_DEBUG_TXPOWER(priv,
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);
@@ -617,7 +617,7 @@ static s32 back_off_table[] = {
617 617
618/* Thermal compensation values for txpower for various frequency ranges ... 618/* Thermal compensation values for txpower for various frequency ranges ...
619 * ratios from 3:1 to 4.5:1 of degrees (Celsius) per half-dB gain adjust */ 619 * ratios from 3:1 to 4.5:1 of degrees (Celsius) per half-dB gain adjust */
620static struct iwl4965_txpower_comp_entry { 620static struct il4965_txpower_comp_entry {
621 s32 degrees_per_05db_a; 621 s32 degrees_per_05db_a;
622 s32 degrees_per_05db_a_denom; 622 s32 degrees_per_05db_a_denom;
623} tx_power_cmp_tble[CALIB_CH_GROUP_MAX] = { 623} tx_power_cmp_tble[CALIB_CH_GROUP_MAX] = {
@@ -867,9 +867,9 @@ static const struct gain_entry gain_table[2][108] = {
867 } 867 }
868}; 868};
869 869
870static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, 870static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel,
871 u8 is_ht40, u8 ctrl_chan_high, 871 u8 is_ht40, u8 ctrl_chan_high,
872 struct iwl4965_tx_power_db *tx_power_tbl) 872 struct il4965_tx_power_db *tx_power_tbl)
873{ 873{
874 u8 saturation_power; 874 u8 saturation_power;
875 s32 target_power; 875 s32 target_power;
@@ -881,9 +881,9 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
881 s32 txatten_grp = CALIB_CH_GROUP_MAX; 881 s32 txatten_grp = CALIB_CH_GROUP_MAX;
882 int i; 882 int i;
883 int c; 883 int c;
884 const struct iwl_channel_info *ch_info = NULL; 884 const struct il_channel_info *ch_info = NULL;
885 struct iwl_eeprom_calib_ch_info ch_eeprom_info; 885 struct il_eeprom_calib_ch_info ch_eeprom_info;
886 const struct iwl_eeprom_calib_measure *measurement; 886 const struct il_eeprom_calib_measure *measurement;
887 s16 voltage; 887 s16 voltage;
888 s32 init_voltage; 888 s32 init_voltage;
889 s32 voltage_compensation; 889 s32 voltage_compensation;
@@ -900,24 +900,24 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
900 user_target_power = 2 * priv->tx_power_user_lmt; 900 user_target_power = 2 * priv->tx_power_user_lmt;
901 901
902 /* Get current (RXON) channel, band, width */ 902 /* Get current (RXON) channel, band, width */
903 IWL_DEBUG_TXPOWER(priv, "chan %d band %d is_ht40 %d\n", channel, band, 903 IL_DEBUG_TXPOWER(priv, "chan %d band %d is_ht40 %d\n", channel, band,
904 is_ht40); 904 is_ht40);
905 905
906 ch_info = iwl_legacy_get_channel_info(priv, priv->band, channel); 906 ch_info = il_get_channel_info(priv, priv->band, channel);
907 907
908 if (!iwl_legacy_is_channel_valid(ch_info)) 908 if (!il_is_channel_valid(ch_info))
909 return -EINVAL; 909 return -EINVAL;
910 910
911 /* get txatten group, used to select 1) thermal txpower adjustment 911 /* get txatten group, used to select 1) thermal txpower adjustment
912 * and 2) mimo txpower balance between Tx chains. */ 912 * and 2) mimo txpower balance between Tx chains. */
913 txatten_grp = iwl4965_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 IWL_ERR(priv, "Can't find txatten group for channel %d.\n", 915 IL_ERR(priv, "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 IWL_DEBUG_TXPOWER(priv, "channel %d belongs to txatten group %d\n", 920 IL_DEBUG_TXPOWER(priv, "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) {
@@ -934,12 +934,12 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
934 else 934 else
935 saturation_power = priv->calib_info->saturation_power52; 935 saturation_power = priv->calib_info->saturation_power52;
936 936
937 if (saturation_power < IWL_TX_POWER_SATURATION_MIN || 937 if (saturation_power < IL_TX_POWER_SATURATION_MIN ||
938 saturation_power > IWL_TX_POWER_SATURATION_MAX) { 938 saturation_power > IL_TX_POWER_SATURATION_MAX) {
939 if (band) 939 if (band)
940 saturation_power = IWL_TX_POWER_DEFAULT_SATURATION_24; 940 saturation_power = IL_TX_POWER_DEFAULT_SATURATION_24;
941 else 941 else
942 saturation_power = IWL_TX_POWER_DEFAULT_SATURATION_52; 942 saturation_power = IL_TX_POWER_DEFAULT_SATURATION_52;
943 } 943 }
944 944
945 /* regulatory txpower limits ... reg_limit values are in half-dBm, 945 /* regulatory txpower limits ... reg_limit values are in half-dBm,
@@ -949,31 +949,31 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
949 else 949 else
950 reg_limit = ch_info->max_power_avg * 2; 950 reg_limit = ch_info->max_power_avg * 2;
951 951
952 if ((reg_limit < IWL_TX_POWER_REGULATORY_MIN) || 952 if ((reg_limit < IL_TX_POWER_REGULATORY_MIN) ||
953 (reg_limit > IWL_TX_POWER_REGULATORY_MAX)) { 953 (reg_limit > IL_TX_POWER_REGULATORY_MAX)) {
954 if (band) 954 if (band)
955 reg_limit = IWL_TX_POWER_DEFAULT_REGULATORY_24; 955 reg_limit = IL_TX_POWER_DEFAULT_REGULATORY_24;
956 else 956 else
957 reg_limit = IWL_TX_POWER_DEFAULT_REGULATORY_52; 957 reg_limit = IL_TX_POWER_DEFAULT_REGULATORY_52;
958 } 958 }
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 iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info); 962 il4965_interpolate_chan(priv, 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(priv->calib_info->voltage);
966 init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); 966 init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage);
967 voltage_compensation = 967 voltage_compensation =
968 iwl4965_get_voltage_compensation(voltage, init_voltage); 968 il4965_get_voltage_compensation(voltage, init_voltage);
969 969
970 IWL_DEBUG_TXPOWER(priv, "curr volt %d eeprom volt %d volt comp %d\n", 970 IL_DEBUG_TXPOWER(priv, "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, IWL_TX_POWER_TEMPERATURE_MIN); 975 current_temp = max(priv->temperature, IL_TX_POWER_TEMPERATURE_MIN);
976 current_temp = min(priv->temperature, IWL_TX_POWER_TEMPERATURE_MAX); 976 current_temp = min(priv->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
@@ -990,7 +990,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
990 /* txgain adjustment (in half-dB steps) based on difference 990 /* txgain adjustment (in half-dB steps) based on difference
991 * between factory and current temperature */ 991 * between factory and current temperature */
992 factory_temp = measurement->temperature; 992 factory_temp = measurement->temperature;
993 iwl4965_math_div_round((current_temp - factory_temp) * 993 il4965_math_div_round((current_temp - factory_temp) *
994 degrees_per_05db_denom, 994 degrees_per_05db_denom,
995 degrees_per_05db_num, 995 degrees_per_05db_num,
996 &temperature_comp[c]); 996 &temperature_comp[c]);
@@ -998,13 +998,13 @@ static int iwl4965_fill_txpower_tbl(struct iwl_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 IWL_DEBUG_TXPOWER(priv, "chain = %d\n", c); 1001 IL_DEBUG_TXPOWER(priv, "chain = %d\n", c);
1002 IWL_DEBUG_TXPOWER(priv, "fctry tmp %d, " 1002 IL_DEBUG_TXPOWER(priv, "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 IWL_DEBUG_TXPOWER(priv, "fctry idx %d, fctry pwr %d\n", 1007 IL_DEBUG_TXPOWER(priv, "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 }
@@ -1012,14 +1012,14 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
1012 /* for each of 33 bit-rates (including 1 for CCK) */ 1012 /* for each of 33 bit-rates (including 1 for CCK) */
1013 for (i = 0; i < POWER_TABLE_NUM_ENTRIES; i++) { 1013 for (i = 0; i < POWER_TABLE_NUM_ENTRIES; i++) {
1014 u8 is_mimo_rate; 1014 u8 is_mimo_rate;
1015 union iwl4965_tx_power_dual_stream tx_power; 1015 union il4965_tx_power_dual_stream tx_power;
1016 1016
1017 /* for mimo, reduce each chain's txpower by half 1017 /* for mimo, reduce each chain's txpower by half
1018 * (3dB, 6 steps), so total output power is regulatory 1018 * (3dB, 6 steps), so total output power is regulatory
1019 * compliant. */ 1019 * compliant. */
1020 if (i & 0x8) { 1020 if (i & 0x8) {
1021 current_regulatory = reg_limit - 1021 current_regulatory = reg_limit -
1022 IWL_TX_POWER_MIMO_REGULATORY_COMPENSATION; 1022 IL_TX_POWER_MIMO_REGULATORY_COMPENSATION;
1023 is_mimo_rate = 1; 1023 is_mimo_rate = 1;
1024 } else { 1024 } else {
1025 current_regulatory = reg_limit; 1025 current_regulatory = reg_limit;
@@ -1037,7 +1037,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_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 IWL_DEBUG_TXPOWER(priv, "rate %d sat %d reg %d usr %d tgt %d\n", 1040 IL_DEBUG_TXPOWER(priv, "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);
@@ -1061,7 +1061,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
1061 voltage_compensation + 1061 voltage_compensation +
1062 atten_value); 1062 atten_value);
1063 1063
1064/* IWL_DEBUG_TXPOWER(priv, "calculated txpower index %d\n", 1064/* IL_DEBUG_TXPOWER(priv, "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))
@@ -1074,16 +1074,16 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
1074 /* CCK, rate 32, reduce txpower for CCK */ 1074 /* CCK, rate 32, reduce txpower for CCK */
1075 if (i == POWER_TABLE_CCK_ENTRY) 1075 if (i == POWER_TABLE_CCK_ENTRY)
1076 power_index += 1076 power_index +=
1077 IWL_TX_POWER_CCK_COMPENSATION_C_STEP; 1077 IL_TX_POWER_CCK_COMPENSATION_C_STEP;
1078 1078
1079 /* stay within the table! */ 1079 /* stay within the table! */
1080 if (power_index > 107) { 1080 if (power_index > 107) {
1081 IWL_WARN(priv, "txpower index %d > 107\n", 1081 IL_WARN(priv, "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 IWL_WARN(priv, "txpower index %d < 0\n", 1086 IL_WARN(priv, "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 iwl4965_fill_txpower_tbl(struct iwl_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 IWL_DEBUG_TXPOWER(priv, "chain %d mimo %d index %d " 1097 IL_DEBUG_TXPOWER(priv, "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],
@@ -1109,19 +1109,19 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
1109} 1109}
1110 1110
1111/** 1111/**
1112 * iwl4965_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 priv->tx_power_user_lmt.
1116 */ 1116 */
1117static int iwl4965_send_tx_power(struct iwl_priv *priv) 1117static int il4965_send_tx_power(struct il_priv *priv)
1118{ 1118{
1119 struct iwl4965_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 iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1124 struct il_rxon_context *ctx = &priv->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, &priv->status),
1127 "TX Power requested while scanning!\n")) 1127 "TX Power requested while scanning!\n"))
@@ -1137,26 +1137,26 @@ static int iwl4965_send_tx_power(struct iwl_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 = iwl4965_fill_txpower_tbl(priv, band, 1140 ret = il4965_fill_txpower_tbl(priv, 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 = iwl_legacy_send_cmd_pdu(priv, 1146 ret = il_send_cmd_pdu(priv,
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 iwl4965_send_rxon_assoc(struct iwl_priv *priv, 1153static int il4965_send_rxon_assoc(struct il_priv *priv,
1154 struct iwl_rxon_context *ctx) 1154 struct il_rxon_context *ctx)
1155{ 1155{
1156 int ret = 0; 1156 int ret = 0;
1157 struct iwl4965_rxon_assoc_cmd rxon_assoc; 1157 struct il4965_rxon_assoc_cmd rxon_assoc;
1158 const struct iwl_legacy_rxon_cmd *rxon1 = &ctx->staging; 1158 const struct il_rxon_cmd *rxon1 = &ctx->staging;
1159 const struct iwl_legacy_rxon_cmd *rxon2 = &ctx->active; 1159 const struct il_rxon_cmd *rxon2 = &ctx->active;
1160 1160
1161 if ((rxon1->flags == rxon2->flags) && 1161 if ((rxon1->flags == rxon2->flags) &&
1162 (rxon1->filter_flags == rxon2->filter_flags) && 1162 (rxon1->filter_flags == rxon2->filter_flags) &&
@@ -1167,7 +1167,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_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 IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); 1170 IL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n");
1171 return 0; 1171 return 0;
1172 } 1172 }
1173 1173
@@ -1182,21 +1182,21 @@ static int iwl4965_send_rxon_assoc(struct iwl_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 = iwl_legacy_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, 1185 ret = il_send_cmd_pdu_async(priv, 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 iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) 1191static int il4965_commit_rxon(struct il_priv *priv, 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 iwl_legacy_rxon_cmd *active_rxon = (void *)&ctx->active; 1194 struct il_rxon_cmd *active_rxon = (void *)&ctx->active;
1195 int ret; 1195 int ret;
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 (!iwl_legacy_is_alive(priv)) 1199 if (!il_is_alive(priv))
1200 return -EBUSY; 1200 return -EBUSY;
1201 1201
1202 if (!ctx->is_active) 1202 if (!ctx->is_active)
@@ -1205,9 +1205,9 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
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 = iwl_legacy_check_rxon_cmd(priv, ctx); 1208 ret = il_check_rxon_cmd(priv, ctx);
1209 if (ret) { 1209 if (ret) {
1210 IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); 1210 IL_ERR(priv, "Invalid RXON configuration. Not committing.\n");
1211 return -EINVAL; 1211 return -EINVAL;
1212 } 1212 }
1213 1213
@@ -1217,28 +1217,28 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
1217 */ 1217 */
1218 if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) && 1218 if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) &&
1219 (priv->switch_channel != ctx->staging.channel)) { 1219 (priv->switch_channel != ctx->staging.channel)) {
1220 IWL_DEBUG_11H(priv, "abort channel switch on %d\n", 1220 IL_DEBUG_11H(priv, "abort channel switch on %d\n",
1221 le16_to_cpu(priv->switch_channel)); 1221 le16_to_cpu(priv->switch_channel));
1222 iwl_legacy_chswitch_done(priv, false); 1222 il_chswitch_done(priv, 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 * iwl_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 (!iwl_legacy_full_rxon_required(priv, ctx)) { 1228 if (!il_full_rxon_required(priv, ctx)) {
1229 ret = iwl_legacy_send_rxon_assoc(priv, ctx); 1229 ret = il_send_rxon_assoc(priv, ctx);
1230 if (ret) { 1230 if (ret) {
1231 IWL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret); 1231 IL_ERR(priv, "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 iwl_legacy_print_rx_config_cmd(priv, ctx); 1236 il_print_rx_config_cmd(priv, 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 iwl_legacy_set_tx_power(priv, priv->tx_power_next, false); 1241 il_set_tx_power(priv, priv->tx_power_next, false);
1242 return 0; 1242 return 0;
1243 } 1243 }
1244 1244
@@ -1246,31 +1246,31 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
1246 * an RXON_ASSOC and the new config wants the associated mask enabled, 1246 * an RXON_ASSOC and the new config wants the associated mask enabled,
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 (iwl_legacy_is_associated_ctx(ctx) && new_assoc) { 1249 if (il_is_associated_ctx(ctx) && new_assoc) {
1250 IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); 1250 IL_DEBUG_INFO(priv, "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 = iwl_legacy_send_cmd_pdu(priv, ctx->rxon_cmd, 1253 ret = il_send_cmd_pdu(priv, ctx->rxon_cmd,
1254 sizeof(struct iwl_legacy_rxon_cmd), 1254 sizeof(struct il_rxon_cmd),
1255 active_rxon); 1255 active_rxon);
1256 1256
1257 /* If the mask clearing failed then we set 1257 /* If the mask clearing failed then we set
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 IWL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); 1261 IL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret);
1262 return ret; 1262 return ret;
1263 } 1263 }
1264 iwl_legacy_clear_ucode_stations(priv, ctx); 1264 il_clear_ucode_stations(priv, ctx);
1265 iwl_legacy_restore_stations(priv, ctx); 1265 il_restore_stations(priv, ctx);
1266 ret = iwl4965_restore_default_wep_keys(priv, ctx); 1266 ret = il4965_restore_default_wep_keys(priv, ctx);
1267 if (ret) { 1267 if (ret) {
1268 IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); 1268 IL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret);
1269 return ret; 1269 return ret;
1270 } 1270 }
1271 } 1271 }
1272 1272
1273 IWL_DEBUG_INFO(priv, "Sending RXON\n" 1273 IL_DEBUG_INFO(priv, "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,7 +1278,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
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 iwl_legacy_set_rxon_hwcrypto(priv, ctx, 1281 il_set_rxon_hwcrypto(priv, ctx,
1282 !priv->cfg->mod_params->sw_crypto); 1282 !priv->cfg->mod_params->sw_crypto);
1283 1283
1284 /* Apply the new configuration 1284 /* Apply the new configuration
@@ -1286,19 +1286,19 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
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 = iwl_legacy_send_cmd_pdu(priv, ctx->rxon_cmd, 1289 ret = il_send_cmd_pdu(priv, ctx->rxon_cmd,
1290 sizeof(struct iwl_legacy_rxon_cmd), &ctx->staging); 1290 sizeof(struct il_rxon_cmd), &ctx->staging);
1291 if (ret) { 1291 if (ret) {
1292 IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); 1292 IL_ERR(priv, "Error setting new RXON (%d)\n", ret);
1293 return ret; 1293 return ret;
1294 } 1294 }
1295 IWL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); 1295 IL_DEBUG_INFO(priv, "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 iwl_legacy_clear_ucode_stations(priv, ctx); 1297 il_clear_ucode_stations(priv, ctx);
1298 iwl_legacy_restore_stations(priv, ctx); 1298 il_restore_stations(priv, ctx);
1299 ret = iwl4965_restore_default_wep_keys(priv, ctx); 1299 ret = il4965_restore_default_wep_keys(priv, ctx);
1300 if (ret) { 1300 if (ret) {
1301 IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); 1301 IL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret);
1302 return ret; 1302 return ret;
1303 } 1303 }
1304 } 1304 }
@@ -1307,39 +1307,39 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
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 = iwl_legacy_send_cmd_pdu(priv, ctx->rxon_cmd, 1310 ret = il_send_cmd_pdu(priv, ctx->rxon_cmd,
1311 sizeof(struct iwl_legacy_rxon_cmd), &ctx->staging); 1311 sizeof(struct il_rxon_cmd), &ctx->staging);
1312 if (ret) { 1312 if (ret) {
1313 IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); 1313 IL_ERR(priv, "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 iwl_legacy_print_rx_config_cmd(priv, ctx); 1318 il_print_rx_config_cmd(priv, ctx);
1319 1319
1320 iwl4965_init_sensitivity(priv); 1320 il4965_init_sensitivity(priv);
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 = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true); 1324 ret = il_set_tx_power(priv, priv->tx_power_next, true);
1325 if (ret) { 1325 if (ret) {
1326 IWL_ERR(priv, "Error sending TX power (%d)\n", ret); 1326 IL_ERR(priv, "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 iwl4965_hw_channel_switch(struct iwl_priv *priv, 1333static int il4965_hw_channel_switch(struct il_priv *priv,
1334 struct ieee80211_channel_switch *ch_switch) 1334 struct ieee80211_channel_switch *ch_switch)
1335{ 1335{
1336 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1336 struct il_rxon_context *ctx = &priv->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;
1340 u8 ctrl_chan_high = 0; 1340 u8 ctrl_chan_high = 0;
1341 struct iwl4965_channel_switch_cmd cmd; 1341 struct il4965_channel_switch_cmd cmd;
1342 const struct iwl_channel_info *ch_info; 1342 const struct il_channel_info *ch_info;
1343 u32 switch_time_in_usec, ucode_switch_time; 1343 u32 switch_time_in_usec, ucode_switch_time;
1344 u16 ch; 1344 u16 ch;
1345 u32 tsf_low; 1345 u32 tsf_low;
@@ -1379,47 +1379,47 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
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 = iwl_legacy_usecs_to_beacons(priv, 1382 ucode_switch_time = il_usecs_to_beacons(priv,
1383 switch_time_in_usec, 1383 switch_time_in_usec,
1384 beacon_interval); 1384 beacon_interval);
1385 cmd.switch_time = iwl_legacy_add_beacon_time(priv, 1385 cmd.switch_time = il_add_beacon_time(priv,
1386 priv->ucode_beacon_time, 1386 priv->ucode_beacon_time,
1387 ucode_switch_time, 1387 ucode_switch_time,
1388 beacon_interval); 1388 beacon_interval);
1389 } 1389 }
1390 IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", 1390 IL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
1391 cmd.switch_time); 1391 cmd.switch_time);
1392 ch_info = iwl_legacy_get_channel_info(priv, priv->band, ch); 1392 ch_info = il_get_channel_info(priv, priv->band, ch);
1393 if (ch_info) 1393 if (ch_info)
1394 cmd.expect_beacon = iwl_legacy_is_channel_radar(ch_info); 1394 cmd.expect_beacon = il_is_channel_radar(ch_info);
1395 else { 1395 else {
1396 IWL_ERR(priv, "invalid channel switch from %u to %u\n", 1396 IL_ERR(priv, "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 = iwl4965_fill_txpower_tbl(priv, band, ch, is_ht40, 1401 rc = il4965_fill_txpower_tbl(priv, 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 IWL_DEBUG_11H(priv, "error:%d fill txpower_tbl\n", rc); 1404 IL_DEBUG_11H(priv, "error:%d fill txpower_tbl\n", rc);
1405 return rc; 1405 return rc;
1406 } 1406 }
1407 1407
1408 return iwl_legacy_send_cmd_pdu(priv, 1408 return il_send_cmd_pdu(priv,
1409 REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); 1409 REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd);
1410} 1410}
1411 1411
1412/** 1412/**
1413 * iwl4965_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 iwl4965_txq_update_byte_cnt_tbl(struct iwl_priv *priv, 1415static void il4965_txq_update_byte_cnt_tbl(struct il_priv *priv,
1416 struct iwl_tx_queue *txq, 1416 struct il_tx_queue *txq,
1417 u16 byte_cnt) 1417 u16 byte_cnt)
1418{ 1418{
1419 struct iwl4965_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; 1419 struct il4965_scd_bc_tbl *scd_bc_tbl = priv->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 + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; 1422 int len = byte_cnt + IL_TX_CRC_SIZE + IL_TX_DELIMITER_SIZE;
1423 __le16 bc_ent; 1423 __le16 bc_ent;
1424 1424
1425 WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX); 1425 WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX);
@@ -1435,12 +1435,12 @@ static void iwl4965_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
1435} 1435}
1436 1436
1437/** 1437/**
1438 * iwl4965_hw_get_temperature - return the calibrated temperature (in Kelvin) 1438 * il4965_hw_get_temperature - return the calibrated temperature (in Kelvin)
1439 * @statistics: Provides the temperature reading from the uCode 1439 * @statistics: Provides the temperature reading from the uCode
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 iwl4965_hw_get_temperature(struct iwl_priv *priv) 1443static int il4965_hw_get_temperature(struct il_priv *priv)
1444{ 1444{
1445 s32 temperature; 1445 s32 temperature;
1446 s32 vt; 1446 s32 vt;
@@ -1450,13 +1450,13 @@ static int iwl4965_hw_get_temperature(struct iwl_priv *priv)
1450 if (test_bit(STATUS_TEMPERATURE, &priv->status) && 1450 if (test_bit(STATUS_TEMPERATURE, &priv->status) &&
1451 (priv->_4965.statistics.flag & 1451 (priv->_4965.statistics.flag &
1452 STATISTICS_REPLY_FLG_HT40_MODE_MSK)) { 1452 STATISTICS_REPLY_FLG_HT40_MODE_MSK)) {
1453 IWL_DEBUG_TEMP(priv, "Running HT40 temperature calibration\n"); 1453 IL_DEBUG_TEMP(priv, "Running HT40 temperature calibration\n");
1454 R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[1]); 1454 R1 = (s32)le32_to_cpu(priv->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(priv->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(priv->card_alive_init.therm_r3[1]);
1457 R4 = le32_to_cpu(priv->card_alive_init.therm_r4[1]); 1457 R4 = le32_to_cpu(priv->card_alive_init.therm_r4[1]);
1458 } else { 1458 } else {
1459 IWL_DEBUG_TEMP(priv, "Running temperature calibration\n"); 1459 IL_DEBUG_TEMP(priv, "Running temperature calibration\n");
1460 R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[0]); 1460 R1 = (s32)le32_to_cpu(priv->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(priv->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(priv->card_alive_init.therm_r3[0]);
@@ -1476,10 +1476,10 @@ static int iwl4965_hw_get_temperature(struct iwl_priv *priv)
1476 vt = sign_extend32(le32_to_cpu(priv->_4965.statistics. 1476 vt = sign_extend32(le32_to_cpu(priv->_4965.statistics.
1477 general.common.temperature), 23); 1477 general.common.temperature), 23);
1478 1478
1479 IWL_DEBUG_TEMP(priv, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); 1479 IL_DEBUG_TEMP(priv, "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 IWL_ERR(priv, "Calibration conflict R1 == R3\n"); 1482 IL_ERR(priv, "Calibration conflict R1 == R3\n");
1483 return -1; 1483 return -1;
1484 } 1484 }
1485 1485
@@ -1489,17 +1489,17 @@ static int iwl4965_hw_get_temperature(struct iwl_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 IWL_DEBUG_TEMP(priv, "Calibrated temperature: %dK, %dC\n", 1492 IL_DEBUG_TEMP(priv, "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;
1496} 1496}
1497 1497
1498/* Adjust Txpower only if temperature variance is greater than threshold. */ 1498/* Adjust Txpower only if temperature variance is greater than threshold. */
1499#define IWL_TEMPERATURE_THRESHOLD 3 1499#define IL_TEMPERATURE_THRESHOLD 3
1500 1500
1501/** 1501/**
1502 * iwl4965_is_temp_calib_needed - determines if new calibration is needed 1502 * il4965_is_temp_calib_needed - determines if new calibration is needed
1503 * 1503 *
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.
@@ -1507,12 +1507,12 @@ static int iwl4965_hw_get_temperature(struct iwl_priv *priv)
1507 * Assumes caller will replace priv->last_temperature once calibration 1507 * Assumes caller will replace priv->last_temperature once calibration
1508 * executed. 1508 * executed.
1509 */ 1509 */
1510static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv) 1510static int il4965_is_temp_calib_needed(struct il_priv *priv)
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, &priv->status)) {
1515 IWL_DEBUG_TEMP(priv, "Temperature not updated -- no statistics.\n"); 1515 IL_DEBUG_TEMP(priv, "Temperature not updated -- no statistics.\n");
1516 return 0; 1516 return 0;
1517 } 1517 }
1518 1518
@@ -1520,39 +1520,39 @@ static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv)
1520 1520
1521 /* get absolute value */ 1521 /* get absolute value */
1522 if (temp_diff < 0) { 1522 if (temp_diff < 0) {
1523 IWL_DEBUG_POWER(priv, "Getting cooler, delta %d\n", temp_diff); 1523 IL_DEBUG_POWER(priv, "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 IWL_DEBUG_POWER(priv, "Temperature unchanged\n"); 1526 IL_DEBUG_POWER(priv, "Temperature unchanged\n");
1527 else 1527 else
1528 IWL_DEBUG_POWER(priv, "Getting warmer, delta %d\n", temp_diff); 1528 IL_DEBUG_POWER(priv, "Getting warmer, delta %d\n", temp_diff);
1529 1529
1530 if (temp_diff < IWL_TEMPERATURE_THRESHOLD) { 1530 if (temp_diff < IL_TEMPERATURE_THRESHOLD) {
1531 IWL_DEBUG_POWER(priv, " => thermal txpower calib not needed\n"); 1531 IL_DEBUG_POWER(priv, " => thermal txpower calib not needed\n");
1532 return 0; 1532 return 0;
1533 } 1533 }
1534 1534
1535 IWL_DEBUG_POWER(priv, " => thermal txpower calib needed\n"); 1535 IL_DEBUG_POWER(priv, " => thermal txpower calib needed\n");
1536 1536
1537 return 1; 1537 return 1;
1538} 1538}
1539 1539
1540static void iwl4965_temperature_calib(struct iwl_priv *priv) 1540static void il4965_temperature_calib(struct il_priv *priv)
1541{ 1541{
1542 s32 temp; 1542 s32 temp;
1543 1543
1544 temp = iwl4965_hw_get_temperature(priv); 1544 temp = il4965_hw_get_temperature(priv);
1545 if (IWL_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 (priv->temperature != temp) {
1549 if (priv->temperature) 1549 if (priv->temperature)
1550 IWL_DEBUG_TEMP(priv, "Temperature changed " 1550 IL_DEBUG_TEMP(priv, "Temperature changed "
1551 "from %dC to %dC\n", 1551 "from %dC to %dC\n",
1552 KELVIN_TO_CELSIUS(priv->temperature), 1552 KELVIN_TO_CELSIUS(priv->temperature),
1553 KELVIN_TO_CELSIUS(temp)); 1553 KELVIN_TO_CELSIUS(temp));
1554 else 1554 else
1555 IWL_DEBUG_TEMP(priv, "Temperature " 1555 IL_DEBUG_TEMP(priv, "Temperature "
1556 "initialized to %dC\n", 1556 "initialized to %dC\n",
1557 KELVIN_TO_CELSIUS(temp)); 1557 KELVIN_TO_CELSIUS(temp));
1558 } 1558 }
@@ -1562,27 +1562,27 @@ static void iwl4965_temperature_calib(struct iwl_priv *priv)
1562 1562
1563 if (!priv->disable_tx_power_cal && 1563 if (!priv->disable_tx_power_cal &&
1564 unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && 1564 unlikely(!test_bit(STATUS_SCANNING, &priv->status)) &&
1565 iwl4965_is_temp_calib_needed(priv)) 1565 il4965_is_temp_calib_needed(priv))
1566 queue_work(priv->workqueue, &priv->txpower_work); 1566 queue_work(priv->workqueue, &priv->txpower_work);
1567} 1567}
1568 1568
1569static u16 iwl4965_get_hcmd_size(u8 cmd_id, u16 len) 1569static u16 il4965_get_hcmd_size(u8 cmd_id, u16 len)
1570{ 1570{
1571 switch (cmd_id) { 1571 switch (cmd_id) {
1572 case REPLY_RXON: 1572 case REPLY_RXON:
1573 return (u16) sizeof(struct iwl4965_rxon_cmd); 1573 return (u16) sizeof(struct il4965_rxon_cmd);
1574 default: 1574 default:
1575 return len; 1575 return len;
1576 } 1576 }
1577} 1577}
1578 1578
1579static u16 iwl4965_build_addsta_hcmd(const struct iwl_legacy_addsta_cmd *cmd, 1579static u16 il4965_build_addsta_hcmd(const struct il_addsta_cmd *cmd,
1580 u8 *data) 1580 u8 *data)
1581{ 1581{
1582 struct iwl4965_addsta_cmd *addsta = (struct iwl4965_addsta_cmd *)data; 1582 struct il4965_addsta_cmd *addsta = (struct il4965_addsta_cmd *)data;
1583 addsta->mode = cmd->mode; 1583 addsta->mode = cmd->mode;
1584 memcpy(&addsta->sta, &cmd->sta, sizeof(struct sta_id_modify)); 1584 memcpy(&addsta->sta, &cmd->sta, sizeof(struct sta_id_modify));
1585 memcpy(&addsta->key, &cmd->key, sizeof(struct iwl4965_keyinfo)); 1585 memcpy(&addsta->key, &cmd->key, sizeof(struct il4965_keyinfo));
1586 addsta->station_flags = cmd->station_flags; 1586 addsta->station_flags = cmd->station_flags;
1587 addsta->station_flags_msk = cmd->station_flags_msk; 1587 addsta->station_flags_msk = cmd->station_flags_msk;
1588 addsta->tid_disable_tx = cmd->tid_disable_tx; 1588 addsta->tid_disable_tx = cmd->tid_disable_tx;
@@ -1593,20 +1593,20 @@ static u16 iwl4965_build_addsta_hcmd(const struct iwl_legacy_addsta_cmd *cmd,
1593 addsta->reserved1 = cpu_to_le16(0); 1593 addsta->reserved1 = cpu_to_le16(0);
1594 addsta->reserved2 = cpu_to_le16(0); 1594 addsta->reserved2 = cpu_to_le16(0);
1595 1595
1596 return (u16)sizeof(struct iwl4965_addsta_cmd); 1596 return (u16)sizeof(struct il4965_addsta_cmd);
1597} 1597}
1598 1598
1599static inline u32 iwl4965_get_scd_ssn(struct iwl4965_tx_resp *tx_resp) 1599static inline u32 il4965_get_scd_ssn(struct il4965_tx_resp *tx_resp)
1600{ 1600{
1601 return le32_to_cpup(&tx_resp->u.status + tx_resp->frame_count) & MAX_SN; 1601 return le32_to_cpup(&tx_resp->u.status + tx_resp->frame_count) & MAX_SN;
1602} 1602}
1603 1603
1604/** 1604/**
1605 * iwl4965_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 iwl4965_tx_status_reply_tx(struct iwl_priv *priv, 1607static int il4965_tx_status_reply_tx(struct il_priv *priv,
1608 struct iwl_ht_agg *agg, 1608 struct il_ht_agg *agg,
1609 struct iwl4965_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)
1611{ 1611{
1612 u16 status; 1612 u16 status;
@@ -1617,7 +1617,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_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 IWL_DEBUG_TX_REPLY(priv, "got tx response w/o block-ack\n"); 1620 IL_DEBUG_TX_REPLY(priv, "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 iwl4965_tx_status_reply_tx(struct iwl_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 IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n", 1633 IL_DEBUG_TX_REPLY(priv, "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(priv->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 |= iwl4965_tx_status_to_mac80211(status); 1639 info->flags |= il4965_tx_status_to_mac80211(status);
1640 iwl4965_hwrate_to_tx_control(priv, rate_n_flags, info); 1640 il4965_hwrate_to_tx_control(priv, rate_n_flags, info);
1641 1641
1642 IWL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n", 1642 IL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n",
1643 status & 0xff, tx_resp->failure_frame); 1643 status & 0xff, tx_resp->failure_frame);
1644 IWL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags); 1644 IL_DEBUG_TX_REPLY(priv, "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 iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
1661 AGG_TX_STATE_ABORT_MSK)) 1661 AGG_TX_STATE_ABORT_MSK))
1662 continue; 1662 continue;
1663 1663
1664 IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n", 1664 IL_DEBUG_TX_REPLY(priv, "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 = iwl_legacy_tx_queue_get_hdr(priv, txq_id, idx); 1667 hdr = il_tx_queue_get_hdr(priv, txq_id, idx);
1668 if (!hdr) { 1668 if (!hdr) {
1669 IWL_ERR(priv, 1669 IL_ERR(priv,
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 iwl4965_tx_status_reply_tx(struct iwl_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 IWL_ERR(priv, 1677 IL_ERR(priv,
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 IWL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n", 1684 IL_DEBUG_TX_REPLY(priv, "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 iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
1699 sh = 0; 1699 sh = 0;
1700 } 1700 }
1701 bitmap |= 1ULL << sh; 1701 bitmap |= 1ULL << sh;
1702 IWL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n", 1702 IL_DEBUG_TX_REPLY(priv, "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 IWL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n", 1708 IL_DEBUG_TX_REPLY(priv, "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,18 +1715,18 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
1715 return 0; 1715 return 0;
1716} 1716}
1717 1717
1718static u8 iwl4965_find_station(struct iwl_priv *priv, const u8 *addr) 1718static u8 il4965_find_station(struct il_priv *priv, const u8 *addr)
1719{ 1719{
1720 int i; 1720 int i;
1721 int start = 0; 1721 int start = 0;
1722 int ret = IWL_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 ((priv->iw_mode == NL80211_IFTYPE_ADHOC))
1726 start = IWL_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[IWL_RXON_CTX_BSS].bcast_sta_id; 1729 return priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id;
1730 1730
1731 spin_lock_irqsave(&priv->sta_lock, flags); 1731 spin_lock_irqsave(&priv->sta_lock, flags);
1732 for (i = start; i < priv->hw_params.max_stations; i++) 1732 for (i = start; i < priv->hw_params.max_stations; i++)
@@ -1737,7 +1737,7 @@ static u8 iwl4965_find_station(struct iwl_priv *priv, const u8 *addr)
1737 goto out; 1737 goto out;
1738 } 1738 }
1739 1739
1740 IWL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n", 1740 IL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n",
1741 addr, priv->num_stations); 1741 addr, priv->num_stations);
1742 1742
1743 out: 1743 out:
@@ -1746,42 +1746,42 @@ static u8 iwl4965_find_station(struct iwl_priv *priv, const u8 *addr)
1746 * arrive before we completed processing the adding of 1746 * arrive before we completed processing the adding of
1747 * station 1747 * station
1748 */ 1748 */
1749 if (ret != IWL_INVALID_STATION && 1749 if (ret != IL_INVALID_STATION &&
1750 (!(priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) || 1750 (!(priv->stations[ret].used & IL_STA_UCODE_ACTIVE) ||
1751 ((priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) && 1751 ((priv->stations[ret].used & IL_STA_UCODE_ACTIVE) &&
1752 (priv->stations[ret].used & IWL_STA_UCODE_INPROGRESS)))) { 1752 (priv->stations[ret].used & IL_STA_UCODE_INPROGRESS)))) {
1753 IWL_ERR(priv, "Requested station info for sta %d before ready.\n", 1753 IL_ERR(priv, "Requested station info for sta %d before ready.\n",
1754 ret); 1754 ret);
1755 ret = IWL_INVALID_STATION; 1755 ret = IL_INVALID_STATION;
1756 } 1756 }
1757 spin_unlock_irqrestore(&priv->sta_lock, flags); 1757 spin_unlock_irqrestore(&priv->sta_lock, flags);
1758 return ret; 1758 return ret;
1759} 1759}
1760 1760
1761static int iwl4965_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) 1761static int il4965_get_ra_sta_id(struct il_priv *priv, struct ieee80211_hdr *hdr)
1762{ 1762{
1763 if (priv->iw_mode == NL80211_IFTYPE_STATION) { 1763 if (priv->iw_mode == NL80211_IFTYPE_STATION) {
1764 return IWL_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 iwl4965_find_station(priv, da); 1767 return il4965_find_station(priv, da);
1768 } 1768 }
1769} 1769}
1770 1770
1771/** 1771/**
1772 * iwl4965_rx_reply_tx - Handle standard (non-aggregation) Tx response 1772 * il4965_rx_reply_tx - Handle standard (non-aggregation) Tx response
1773 */ 1773 */
1774static void iwl4965_rx_reply_tx(struct iwl_priv *priv, 1774static void il4965_rx_reply_tx(struct il_priv *priv,
1775 struct iwl_rx_mem_buffer *rxb) 1775 struct il_rx_mem_buffer *rxb)
1776{ 1776{
1777 struct iwl_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 iwl_tx_queue *txq = &priv->txq[txq_id]; 1781 struct il_tx_queue *txq = &priv->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 iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 1784 struct il4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
1785 u32 status = le32_to_cpu(tx_resp->u.status); 1785 u32 status = le32_to_cpu(tx_resp->u.status);
1786 int uninitialized_var(tid); 1786 int uninitialized_var(tid);
1787 int sta_id; 1787 int sta_id;
@@ -1789,8 +1789,8 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
1789 u8 *qc = NULL; 1789 u8 *qc = NULL;
1790 unsigned long flags; 1790 unsigned long flags;
1791 1791
1792 if ((index >= txq->q.n_bd) || (iwl_legacy_queue_used(&txq->q, index) == 0)) { 1792 if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) {
1793 IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " 1793 IL_ERR(priv, "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,88 +1801,88 @@ static void iwl4965_rx_reply_tx(struct iwl_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 = iwl_legacy_tx_queue_get_hdr(priv, txq_id, index); 1804 hdr = il_tx_queue_get_hdr(priv, 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 = iwl4965_get_ra_sta_id(priv, hdr); 1810 sta_id = il4965_get_ra_sta_id(priv, hdr);
1811 if (txq->sched_retry && unlikely(sta_id == IWL_INVALID_STATION)) { 1811 if (txq->sched_retry && unlikely(sta_id == IL_INVALID_STATION)) {
1812 IWL_ERR(priv, "Station not known\n"); 1812 IL_ERR(priv, "Station not known\n");
1813 return; 1813 return;
1814 } 1814 }
1815 1815
1816 spin_lock_irqsave(&priv->sta_lock, flags); 1816 spin_lock_irqsave(&priv->sta_lock, flags);
1817 if (txq->sched_retry) { 1817 if (txq->sched_retry) {
1818 const u32 scd_ssn = iwl4965_get_scd_ssn(tx_resp); 1818 const u32 scd_ssn = il4965_get_scd_ssn(tx_resp);
1819 struct iwl_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 = &priv->stations[sta_id].tid[tid].agg;
1823 1823
1824 iwl4965_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); 1824 il4965_tx_status_reply_tx(priv, 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) && !iwl4965_is_tx_success(status)) 1827 if ((tx_resp->frame_count == 1) && !il4965_is_tx_success(status))
1828 info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; 1828 info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
1829 1829
1830 if (txq->q.read_ptr != (scd_ssn & 0xff)) { 1830 if (txq->q.read_ptr != (scd_ssn & 0xff)) {
1831 index = iwl_legacy_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 IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn " 1833 IL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn "
1834 "%d index %d\n", scd_ssn , index); 1834 "%d index %d\n", scd_ssn , index);
1835 freed = iwl4965_tx_queue_reclaim(priv, txq_id, index); 1835 freed = il4965_tx_queue_reclaim(priv, txq_id, index);
1836 if (qc) 1836 if (qc)
1837 iwl4965_free_tfds_in_queue(priv, sta_id, 1837 il4965_free_tfds_in_queue(priv, sta_id,
1838 tid, freed); 1838 tid, freed);
1839 1839
1840 if (priv->mac80211_registered && 1840 if (priv->mac80211_registered &&
1841 (iwl_legacy_queue_space(&txq->q) > txq->q.low_mark) 1841 (il_queue_space(&txq->q) > txq->q.low_mark)
1842 && (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)) 1842 && (agg->state != IL_EMPTYING_HW_QUEUE_DELBA))
1843 iwl_legacy_wake_queue(priv, txq); 1843 il_wake_queue(priv, 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 |= iwl4965_tx_status_to_mac80211(status); 1847 info->flags |= il4965_tx_status_to_mac80211(status);
1848 iwl4965_hwrate_to_tx_control(priv, 1848 il4965_hwrate_to_tx_control(priv,
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 IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) " 1852 IL_DEBUG_TX_REPLY(priv, "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 iwl4965_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 = iwl4965_tx_queue_reclaim(priv, txq_id, index); 1859 freed = il4965_tx_queue_reclaim(priv, txq_id, index);
1860 if (qc && likely(sta_id != IWL_INVALID_STATION)) 1860 if (qc && likely(sta_id != IL_INVALID_STATION))
1861 iwl4965_free_tfds_in_queue(priv, sta_id, tid, freed); 1861 il4965_free_tfds_in_queue(priv, sta_id, tid, freed);
1862 else if (sta_id == IWL_INVALID_STATION) 1862 else if (sta_id == IL_INVALID_STATION)
1863 IWL_DEBUG_TX_REPLY(priv, "Station not known\n"); 1863 IL_DEBUG_TX_REPLY(priv, "Station not known\n");
1864 1864
1865 if (priv->mac80211_registered && 1865 if (priv->mac80211_registered &&
1866 (iwl_legacy_queue_space(&txq->q) > txq->q.low_mark)) 1866 (il_queue_space(&txq->q) > txq->q.low_mark))
1867 iwl_legacy_wake_queue(priv, txq); 1867 il_wake_queue(priv, txq);
1868 } 1868 }
1869 if (qc && likely(sta_id != IWL_INVALID_STATION)) 1869 if (qc && likely(sta_id != IL_INVALID_STATION))
1870 iwl4965_txq_check_empty(priv, sta_id, tid, txq_id); 1870 il4965_txq_check_empty(priv, sta_id, tid, txq_id);
1871 1871
1872 iwl4965_check_abort_status(priv, tx_resp->frame_count, status); 1872 il4965_check_abort_status(priv, tx_resp->frame_count, status);
1873 1873
1874 spin_unlock_irqrestore(&priv->sta_lock, flags); 1874 spin_unlock_irqrestore(&priv->sta_lock, flags);
1875} 1875}
1876 1876
1877static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, 1877static void il4965_rx_beacon_notif(struct il_priv *priv,
1878 struct iwl_rx_mem_buffer *rxb) 1878 struct il_rx_mem_buffer *rxb)
1879{ 1879{
1880 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1880 struct il_rx_packet *pkt = rxb_addr(rxb);
1881 struct iwl4965_beacon_notif *beacon = (void *)pkt->u.raw; 1881 struct il4965_beacon_notif *beacon = (void *)pkt->u.raw;
1882 u8 rate __maybe_unused = 1882 u8 rate __maybe_unused =
1883 iwl4965_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 IWL_DEBUG_RX(priv, "beacon status %#x, retries:%d ibssmgr:%d " 1885 IL_DEBUG_RX(priv, "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,
@@ -1894,36 +1894,36 @@ static void iwl4965_rx_beacon_notif(struct iwl_priv *priv,
1894} 1894}
1895 1895
1896/* Set up 4965-specific Rx frame reply handlers */ 1896/* Set up 4965-specific Rx frame reply handlers */
1897static void iwl4965_rx_handler_setup(struct iwl_priv *priv) 1897static void il4965_rx_handler_setup(struct il_priv *priv)
1898{ 1898{
1899 /* Legacy Rx frames */ 1899 /* Legacy Rx frames */
1900 priv->rx_handlers[REPLY_RX] = iwl4965_rx_reply_rx; 1900 priv->rx_handlers[REPLY_RX] = il4965_rx_reply_rx;
1901 /* Tx response */ 1901 /* Tx response */
1902 priv->rx_handlers[REPLY_TX] = iwl4965_rx_reply_tx; 1902 priv->rx_handlers[REPLY_TX] = il4965_rx_reply_tx;
1903 priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif; 1903 priv->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif;
1904} 1904}
1905 1905
1906static struct iwl_hcmd_ops iwl4965_hcmd = { 1906static struct il_hcmd_ops il4965_hcmd = {
1907 .rxon_assoc = iwl4965_send_rxon_assoc, 1907 .rxon_assoc = il4965_send_rxon_assoc,
1908 .commit_rxon = iwl4965_commit_rxon, 1908 .commit_rxon = il4965_commit_rxon,
1909 .set_rxon_chain = iwl4965_set_rxon_chain, 1909 .set_rxon_chain = il4965_set_rxon_chain,
1910}; 1910};
1911 1911
1912static void iwl4965_post_scan(struct iwl_priv *priv) 1912static void il4965_post_scan(struct il_priv *priv)
1913{ 1913{
1914 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1914 struct il_rxon_context *ctx = &priv->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 iwl_legacy_commit_rxon(priv, ctx); 1921 il_commit_rxon(priv, ctx);
1922} 1922}
1923 1923
1924static void iwl4965_post_associate(struct iwl_priv *priv) 1924static void il4965_post_associate(struct il_priv *priv)
1925{ 1925{
1926 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1926 struct il_rxon_context *ctx = &priv->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;
@@ -1934,28 +1934,28 @@ static void iwl4965_post_associate(struct iwl_priv *priv)
1934 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1934 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
1935 return; 1935 return;
1936 1936
1937 iwl_legacy_scan_cancel_timeout(priv, 200); 1937 il_scan_cancel_timeout(priv, 200);
1938 1938
1939 conf = iwl_legacy_ieee80211_get_hw_conf(priv->hw); 1939 conf = il_ieee80211_get_hw_conf(priv->hw);
1940 1940
1941 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1941 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1942 iwl_legacy_commit_rxon(priv, ctx); 1942 il_commit_rxon(priv, ctx);
1943 1943
1944 ret = iwl_legacy_send_rxon_timing(priv, ctx); 1944 ret = il_send_rxon_timing(priv, ctx);
1945 if (ret) 1945 if (ret)
1946 IWL_WARN(priv, "RXON timing - " 1946 IL_WARN(priv, "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 iwl_legacy_set_rxon_ht(priv, &priv->current_ht_config); 1951 il_set_rxon_ht(priv, &priv->current_ht_config);
1952 1952
1953 if (priv->cfg->ops->hcmd->set_rxon_chain) 1953 if (priv->cfg->ops->hcmd->set_rxon_chain)
1954 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); 1954 priv->cfg->ops->hcmd->set_rxon_chain(priv, 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 IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", 1958 IL_DEBUG_ASSOC(priv, "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 iwl4965_post_associate(struct iwl_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 iwl_legacy_commit_rxon(priv, ctx); 1973 il_commit_rxon(priv, ctx);
1974 1974
1975 IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", 1975 IL_DEBUG_ASSOC(priv, "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 iwl4965_send_beacon_cmd(priv); 1982 il4965_send_beacon_cmd(priv);
1983 break; 1983 break;
1984 default: 1984 default:
1985 IWL_ERR(priv, "%s Should not be called in %d mode\n", 1985 IL_ERR(priv, "%s Should not be called in %d mode\n",
1986 __func__, vif->type); 1986 __func__, vif->type);
1987 break; 1987 break;
1988 } 1988 }
@@ -1990,17 +1990,17 @@ static void iwl4965_post_associate(struct iwl_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 == IWL_CHAIN_NOISE_DONE) 1993 if (priv->chain_noise_data.state == IL_CHAIN_NOISE_DONE)
1994 iwl_legacy_power_update_mode(priv, false); 1994 il_power_update_mode(priv, false);
1995 1995
1996 /* Enable Rx differential gain and sensitivity calibrations */ 1996 /* Enable Rx differential gain and sensitivity calibrations */
1997 iwl4965_chain_noise_reset(priv); 1997 il4965_chain_noise_reset(priv);
1998 priv->start_calib = 1; 1998 priv->start_calib = 1;
1999} 1999}
2000 2000
2001static void iwl4965_config_ap(struct iwl_priv *priv) 2001static void il4965_config_ap(struct il_priv *priv)
2002{ 2002{
2003 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2003 struct il_rxon_context *ctx = &priv->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
@@ -2010,22 +2010,22 @@ static void iwl4965_config_ap(struct iwl_priv *priv)
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 */
2013 if (!iwl_legacy_is_associated_ctx(ctx)) { 2013 if (!il_is_associated_ctx(ctx)) {
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 iwl_legacy_commit_rxon(priv, ctx); 2017 il_commit_rxon(priv, ctx);
2018 2018
2019 /* RXON Timing */ 2019 /* RXON Timing */
2020 ret = iwl_legacy_send_rxon_timing(priv, ctx); 2020 ret = il_send_rxon_timing(priv, ctx);
2021 if (ret) 2021 if (ret)
2022 IWL_WARN(priv, "RXON timing failed - " 2022 IL_WARN(priv, "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 priv->chain_noise_data.active_chains =
2027 priv->hw_params.valid_rx_ant; 2027 priv->hw_params.valid_rx_ant;
2028 iwl_legacy_set_rxon_ht(priv, &priv->current_ht_config); 2028 il_set_rxon_ht(priv, &priv->current_ht_config);
2029 if (priv->cfg->ops->hcmd->set_rxon_chain) 2029 if (priv->cfg->ops->hcmd->set_rxon_chain)
2030 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); 2030 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
2031 2031
@@ -2047,37 +2047,37 @@ static void iwl4965_config_ap(struct iwl_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 iwl4965_send_beacon_cmd(priv); 2050 il4965_send_beacon_cmd(priv);
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 iwl_legacy_commit_rxon(priv, ctx); 2053 il_commit_rxon(priv, ctx);
2054 } 2054 }
2055 iwl4965_send_beacon_cmd(priv); 2055 il4965_send_beacon_cmd(priv);
2056} 2056}
2057 2057
2058static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { 2058static struct il_hcmd_utils_ops il4965_hcmd_utils = {
2059 .get_hcmd_size = iwl4965_get_hcmd_size, 2059 .get_hcmd_size = il4965_get_hcmd_size,
2060 .build_addsta_hcmd = iwl4965_build_addsta_hcmd, 2060 .build_addsta_hcmd = il4965_build_addsta_hcmd,
2061 .request_scan = iwl4965_request_scan, 2061 .request_scan = il4965_request_scan,
2062 .post_scan = iwl4965_post_scan, 2062 .post_scan = il4965_post_scan,
2063}; 2063};
2064 2064
2065static struct iwl_lib_ops iwl4965_lib = { 2065static struct il_lib_ops il4965_lib = {
2066 .set_hw_params = iwl4965_hw_set_hw_params, 2066 .set_hw_params = il4965_hw_set_hw_params,
2067 .txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl, 2067 .txq_update_byte_cnt_tbl = il4965_txq_update_byte_cnt_tbl,
2068 .txq_attach_buf_to_tfd = iwl4965_hw_txq_attach_buf_to_tfd, 2068 .txq_attach_buf_to_tfd = il4965_hw_txq_attach_buf_to_tfd,
2069 .txq_free_tfd = iwl4965_hw_txq_free_tfd, 2069 .txq_free_tfd = il4965_hw_txq_free_tfd,
2070 .txq_init = iwl4965_hw_tx_queue_init, 2070 .txq_init = il4965_hw_tx_queue_init,
2071 .rx_handler_setup = iwl4965_rx_handler_setup, 2071 .rx_handler_setup = il4965_rx_handler_setup,
2072 .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr, 2072 .is_valid_rtc_data_addr = il4965_hw_valid_rtc_data_addr,
2073 .init_alive_start = iwl4965_init_alive_start, 2073 .init_alive_start = il4965_init_alive_start,
2074 .load_ucode = iwl4965_load_bsm, 2074 .load_ucode = il4965_load_bsm,
2075 .dump_nic_error_log = iwl4965_dump_nic_error_log, 2075 .dump_nic_error_log = il4965_dump_nic_error_log,
2076 .dump_fh = iwl4965_dump_fh, 2076 .dump_fh = il4965_dump_fh,
2077 .set_channel_switch = iwl4965_hw_channel_switch, 2077 .set_channel_switch = il4965_hw_channel_switch,
2078 .apm_ops = { 2078 .apm_ops = {
2079 .init = iwl_legacy_apm_init, 2079 .init = il_apm_init,
2080 .config = iwl4965_nic_config, 2080 .config = il4965_nic_config,
2081 }, 2081 },
2082 .eeprom_ops = { 2082 .eeprom_ops = {
2083 .regulatory_bands = { 2083 .regulatory_bands = {
@@ -2089,60 +2089,60 @@ static struct iwl_lib_ops iwl4965_lib = {
2089 EEPROM_4965_REGULATORY_BAND_24_HT40_CHANNELS, 2089 EEPROM_4965_REGULATORY_BAND_24_HT40_CHANNELS,
2090 EEPROM_4965_REGULATORY_BAND_52_HT40_CHANNELS 2090 EEPROM_4965_REGULATORY_BAND_52_HT40_CHANNELS
2091 }, 2091 },
2092 .acquire_semaphore = iwl4965_eeprom_acquire_semaphore, 2092 .acquire_semaphore = il4965_eeprom_acquire_semaphore,
2093 .release_semaphore = iwl4965_eeprom_release_semaphore, 2093 .release_semaphore = il4965_eeprom_release_semaphore,
2094 }, 2094 },
2095 .send_tx_power = iwl4965_send_tx_power, 2095 .send_tx_power = il4965_send_tx_power,
2096 .update_chain_flags = iwl4965_update_chain_flags, 2096 .update_chain_flags = il4965_update_chain_flags,
2097 .temp_ops = { 2097 .temp_ops = {
2098 .temperature = iwl4965_temperature_calib, 2098 .temperature = il4965_temperature_calib,
2099 }, 2099 },
2100 .debugfs_ops = { 2100 .debugfs_ops = {
2101 .rx_stats_read = iwl4965_ucode_rx_stats_read, 2101 .rx_stats_read = il4965_ucode_rx_stats_read,
2102 .tx_stats_read = iwl4965_ucode_tx_stats_read, 2102 .tx_stats_read = il4965_ucode_tx_stats_read,
2103 .general_stats_read = iwl4965_ucode_general_stats_read, 2103 .general_stats_read = il4965_ucode_general_stats_read,
2104 }, 2104 },
2105}; 2105};
2106 2106
2107static const struct iwl_legacy_ops iwl4965_legacy_ops = { 2107static const struct il_legacy_ops il4965_legacy_ops = {
2108 .post_associate = iwl4965_post_associate, 2108 .post_associate = il4965_post_associate,
2109 .config_ap = iwl4965_config_ap, 2109 .config_ap = il4965_config_ap,
2110 .manage_ibss_station = iwl4965_manage_ibss_station, 2110 .manage_ibss_station = il4965_manage_ibss_station,
2111 .update_bcast_stations = iwl4965_update_bcast_stations, 2111 .update_bcast_stations = il4965_update_bcast_stations,
2112}; 2112};
2113 2113
2114struct ieee80211_ops iwl4965_hw_ops = { 2114struct ieee80211_ops il4965_hw_ops = {
2115 .tx = iwl4965_mac_tx, 2115 .tx = il4965_mac_tx,
2116 .start = iwl4965_mac_start, 2116 .start = il4965_mac_start,
2117 .stop = iwl4965_mac_stop, 2117 .stop = il4965_mac_stop,
2118 .add_interface = iwl_legacy_mac_add_interface, 2118 .add_interface = il_mac_add_interface,
2119 .remove_interface = iwl_legacy_mac_remove_interface, 2119 .remove_interface = il_mac_remove_interface,
2120 .change_interface = iwl_legacy_mac_change_interface, 2120 .change_interface = il_mac_change_interface,
2121 .config = iwl_legacy_mac_config, 2121 .config = il_mac_config,
2122 .configure_filter = iwl4965_configure_filter, 2122 .configure_filter = il4965_configure_filter,
2123 .set_key = iwl4965_mac_set_key, 2123 .set_key = il4965_mac_set_key,
2124 .update_tkip_key = iwl4965_mac_update_tkip_key, 2124 .update_tkip_key = il4965_mac_update_tkip_key,
2125 .conf_tx = iwl_legacy_mac_conf_tx, 2125 .conf_tx = il_mac_conf_tx,
2126 .reset_tsf = iwl_legacy_mac_reset_tsf, 2126 .reset_tsf = il_mac_reset_tsf,
2127 .bss_info_changed = iwl_legacy_mac_bss_info_changed, 2127 .bss_info_changed = il_mac_bss_info_changed,
2128 .ampdu_action = iwl4965_mac_ampdu_action, 2128 .ampdu_action = il4965_mac_ampdu_action,
2129 .hw_scan = iwl_legacy_mac_hw_scan, 2129 .hw_scan = il_mac_hw_scan,
2130 .sta_add = iwl4965_mac_sta_add, 2130 .sta_add = il4965_mac_sta_add,
2131 .sta_remove = iwl_legacy_mac_sta_remove, 2131 .sta_remove = il_mac_sta_remove,
2132 .channel_switch = iwl4965_mac_channel_switch, 2132 .channel_switch = il4965_mac_channel_switch,
2133 .tx_last_beacon = iwl_legacy_mac_tx_last_beacon, 2133 .tx_last_beacon = il_mac_tx_last_beacon,
2134}; 2134};
2135 2135
2136static const struct iwl_ops iwl4965_ops = { 2136static const struct il_ops il4965_ops = {
2137 .lib = &iwl4965_lib, 2137 .lib = &il4965_lib,
2138 .hcmd = &iwl4965_hcmd, 2138 .hcmd = &il4965_hcmd,
2139 .utils = &iwl4965_hcmd_utils, 2139 .utils = &il4965_hcmd_utils,
2140 .led = &iwl4965_led_ops, 2140 .led = &il4965_led_ops,
2141 .legacy = &iwl4965_legacy_ops, 2141 .legacy = &il4965_legacy_ops,
2142 .ieee80211_ops = &iwl4965_hw_ops, 2142 .ieee80211_ops = &il4965_hw_ops,
2143}; 2143};
2144 2144
2145static struct iwl_base_params iwl4965_base_params = { 2145static struct il_base_params il4965_base_params = {
2146 .eeprom_size = IWL4965_EEPROM_IMG_SIZE, 2146 .eeprom_size = IWL4965_EEPROM_IMG_SIZE,
2147 .num_of_queues = IWL49_NUM_QUEUES, 2147 .num_of_queues = IWL49_NUM_QUEUES,
2148 .num_of_ampdu_queues = IWL49_NUM_AMPDU_QUEUES, 2148 .num_of_ampdu_queues = IWL49_NUM_AMPDU_QUEUES,
@@ -2151,27 +2151,27 @@ static struct iwl_base_params iwl4965_base_params = {
2151 .use_bsm = true, 2151 .use_bsm = true,
2152 .led_compensation = 61, 2152 .led_compensation = 61,
2153 .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, 2153 .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS,
2154 .wd_timeout = IWL_DEF_WD_TIMEOUT, 2154 .wd_timeout = IL_DEF_WD_TIMEOUT,
2155 .temperature_kelvin = true, 2155 .temperature_kelvin = true,
2156 .ucode_tracing = true, 2156 .ucode_tracing = true,
2157 .sensitivity_calib_by_driver = true, 2157 .sensitivity_calib_by_driver = true,
2158 .chain_noise_calib_by_driver = true, 2158 .chain_noise_calib_by_driver = true,
2159}; 2159};
2160 2160
2161struct iwl_cfg iwl4965_cfg = { 2161struct il_cfg il4965_cfg = {
2162 .name = "Intel(R) Wireless WiFi Link 4965AGN", 2162 .name = "Intel(R) Wireless WiFi Link 4965AGN",
2163 .fw_name_pre = IWL4965_FW_PRE, 2163 .fw_name_pre = IWL4965_FW_PRE,
2164 .ucode_api_max = IWL4965_UCODE_API_MAX, 2164 .ucode_api_max = IWL4965_UCODE_API_MAX,
2165 .ucode_api_min = IWL4965_UCODE_API_MIN, 2165 .ucode_api_min = IWL4965_UCODE_API_MIN,
2166 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, 2166 .sku = IL_SKU_A|IL_SKU_G|IL_SKU_N,
2167 .valid_tx_ant = ANT_AB, 2167 .valid_tx_ant = ANT_AB,
2168 .valid_rx_ant = ANT_ABC, 2168 .valid_rx_ant = ANT_ABC,
2169 .eeprom_ver = EEPROM_4965_EEPROM_VERSION, 2169 .eeprom_ver = EEPROM_4965_EEPROM_VERSION,
2170 .eeprom_calib_ver = EEPROM_4965_TX_POWER_VERSION, 2170 .eeprom_calib_ver = EEPROM_4965_TX_POWER_VERSION,
2171 .ops = &iwl4965_ops, 2171 .ops = &il4965_ops,
2172 .mod_params = &iwl4965_mod_params, 2172 .mod_params = &il4965_mod_params,
2173 .base_params = &iwl4965_base_params, 2173 .base_params = &il4965_base_params,
2174 .led_mode = IWL_LED_BLINK, 2174 .led_mode = IL_LED_BLINK,
2175 /* 2175 /*
2176 * Force use of chains B and C for scan RX on 5 GHz band 2176 * Force use of chains B and C for scan RX on 5 GHz band
2177 * because the device has off-channel reception on chain A. 2177 * because the device has off-channel reception on chain A.
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.h b/drivers/net/wireless/iwlegacy/iwl-4965.h
index 01f8163daf16..7b322168bfc5 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.h
@@ -60,92 +60,92 @@
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *****************************************************************************/ 61 *****************************************************************************/
62 62
63#ifndef __iwl_4965_h__ 63#ifndef __il_4965_h__
64#define __iwl_4965_h__ 64#define __il_4965_h__
65 65
66#include "iwl-dev.h" 66#include "iwl-dev.h"
67 67
68/* configuration for the _4965 devices */ 68/* configuration for the _4965 devices */
69extern struct iwl_cfg iwl4965_cfg; 69extern struct il_cfg il4965_cfg;
70 70
71extern struct iwl_mod_params iwl4965_mod_params; 71extern struct il_mod_params il4965_mod_params;
72 72
73extern struct ieee80211_ops iwl4965_hw_ops; 73extern struct ieee80211_ops il4965_hw_ops;
74 74
75/* tx queue */ 75/* tx queue */
76void iwl4965_free_tfds_in_queue(struct iwl_priv *priv, 76void il4965_free_tfds_in_queue(struct il_priv *priv,
77 int sta_id, int tid, int freed); 77 int sta_id, int tid, int freed);
78 78
79/* RXON */ 79/* RXON */
80void iwl4965_set_rxon_chain(struct iwl_priv *priv, 80void il4965_set_rxon_chain(struct il_priv *priv,
81 struct iwl_rxon_context *ctx); 81 struct il_rxon_context *ctx);
82 82
83/* uCode */ 83/* uCode */
84int iwl4965_verify_ucode(struct iwl_priv *priv); 84int il4965_verify_ucode(struct il_priv *priv);
85 85
86/* lib */ 86/* lib */
87void iwl4965_check_abort_status(struct iwl_priv *priv, 87void il4965_check_abort_status(struct il_priv *priv,
88 u8 frame_count, u32 status); 88 u8 frame_count, u32 status);
89 89
90void iwl4965_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); 90void il4965_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq);
91int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq); 91int il4965_rx_init(struct il_priv *priv, struct il_rx_queue *rxq);
92int iwl4965_hw_nic_init(struct iwl_priv *priv); 92int il4965_hw_nic_init(struct il_priv *priv);
93int iwl4965_dump_fh(struct iwl_priv *priv, char **buf, bool display); 93int il4965_dump_fh(struct il_priv *priv, char **buf, bool display);
94 94
95/* rx */ 95/* rx */
96void iwl4965_rx_queue_restock(struct iwl_priv *priv); 96void il4965_rx_queue_restock(struct il_priv *priv);
97void iwl4965_rx_replenish(struct iwl_priv *priv); 97void il4965_rx_replenish(struct il_priv *priv);
98void iwl4965_rx_replenish_now(struct iwl_priv *priv); 98void il4965_rx_replenish_now(struct il_priv *priv);
99void iwl4965_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq); 99void il4965_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq);
100int iwl4965_rxq_stop(struct iwl_priv *priv); 100int il4965_rxq_stop(struct il_priv *priv);
101int iwl4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band); 101int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band);
102void iwl4965_rx_reply_rx(struct iwl_priv *priv, 102void il4965_rx_reply_rx(struct il_priv *priv,
103 struct iwl_rx_mem_buffer *rxb); 103 struct il_rx_mem_buffer *rxb);
104void iwl4965_rx_reply_rx_phy(struct iwl_priv *priv, 104void il4965_rx_reply_rx_phy(struct il_priv *priv,
105 struct iwl_rx_mem_buffer *rxb); 105 struct il_rx_mem_buffer *rxb);
106void iwl4965_rx_handle(struct iwl_priv *priv); 106void il4965_rx_handle(struct il_priv *priv);
107 107
108/* tx */ 108/* tx */
109void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); 109void il4965_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq);
110int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, 110int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *priv,
111 struct iwl_tx_queue *txq, 111 struct il_tx_queue *txq,
112 dma_addr_t addr, u16 len, u8 reset, u8 pad); 112 dma_addr_t addr, u16 len, u8 reset, u8 pad);
113int iwl4965_hw_tx_queue_init(struct iwl_priv *priv, 113int il4965_hw_tx_queue_init(struct il_priv *priv,
114 struct iwl_tx_queue *txq); 114 struct il_tx_queue *txq);
115void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, 115void il4965_hwrate_to_tx_control(struct il_priv *priv, u32 rate_n_flags,
116 struct ieee80211_tx_info *info); 116 struct ieee80211_tx_info *info);
117int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); 117int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb);
118int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, 118int il4965_tx_agg_start(struct il_priv *priv, struct ieee80211_vif *vif,
119 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 119 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
120int iwl4965_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, 120int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif,
121 struct ieee80211_sta *sta, u16 tid); 121 struct ieee80211_sta *sta, u16 tid);
122int iwl4965_txq_check_empty(struct iwl_priv *priv, 122int il4965_txq_check_empty(struct il_priv *priv,
123 int sta_id, u8 tid, int txq_id); 123 int sta_id, u8 tid, int txq_id);
124void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, 124void il4965_rx_reply_compressed_ba(struct il_priv *priv,
125 struct iwl_rx_mem_buffer *rxb); 125 struct il_rx_mem_buffer *rxb);
126int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index); 126int il4965_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index);
127void iwl4965_hw_txq_ctx_free(struct iwl_priv *priv); 127void il4965_hw_txq_ctx_free(struct il_priv *priv);
128int iwl4965_txq_ctx_alloc(struct iwl_priv *priv); 128int il4965_txq_ctx_alloc(struct il_priv *priv);
129void iwl4965_txq_ctx_reset(struct iwl_priv *priv); 129void il4965_txq_ctx_reset(struct il_priv *priv);
130void iwl4965_txq_ctx_stop(struct iwl_priv *priv); 130void il4965_txq_ctx_stop(struct il_priv *priv);
131void iwl4965_txq_set_sched(struct iwl_priv *priv, u32 mask); 131void il4965_txq_set_sched(struct il_priv *priv, u32 mask);
132 132
133/* 133/*
134 * Acquire priv->lock before calling this function ! 134 * Acquire priv->lock before calling this function !
135 */ 135 */
136void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index); 136void il4965_set_wr_ptrs(struct il_priv *priv, int txq_id, u32 index);
137/** 137/**
138 * iwl4965_tx_queue_set_status - (optionally) start Tx/Cmd queue 138 * il4965_tx_queue_set_status - (optionally) start Tx/Cmd queue
139 * @tx_fifo_id: Tx DMA/FIFO channel (range 0-7) that the queue will feed 139 * @tx_fifo_id: Tx DMA/FIFO channel (range 0-7) that the queue will feed
140 * @scd_retry: (1) Indicates queue will be used in aggregation mode 140 * @scd_retry: (1) Indicates queue will be used in aggregation mode
141 * 141 *
142 * NOTE: Acquire priv->lock before calling this function ! 142 * NOTE: Acquire priv->lock before calling this function !
143 */ 143 */
144void iwl4965_tx_queue_set_status(struct iwl_priv *priv, 144void il4965_tx_queue_set_status(struct il_priv *priv,
145 struct iwl_tx_queue *txq, 145 struct il_tx_queue *txq,
146 int tx_fifo_id, int scd_retry); 146 int tx_fifo_id, int scd_retry);
147 147
148static inline u32 iwl4965_tx_status_to_mac80211(u32 status) 148static inline u32 il4965_tx_status_to_mac80211(u32 status)
149{ 149{
150 status &= TX_STATUS_MSK; 150 status &= TX_STATUS_MSK;
151 151
@@ -160,123 +160,123 @@ static inline u32 iwl4965_tx_status_to_mac80211(u32 status)
160 } 160 }
161} 161}
162 162
163static inline bool iwl4965_is_tx_success(u32 status) 163static inline bool il4965_is_tx_success(u32 status)
164{ 164{
165 status &= TX_STATUS_MSK; 165 status &= TX_STATUS_MSK;
166 return (status == TX_STATUS_SUCCESS) || 166 return (status == TX_STATUS_SUCCESS) ||
167 (status == TX_STATUS_DIRECT_DONE); 167 (status == TX_STATUS_DIRECT_DONE);
168} 168}
169 169
170u8 iwl4965_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx, u8 valid); 170u8 il4965_toggle_tx_ant(struct il_priv *priv, u8 ant_idx, u8 valid);
171 171
172/* rx */ 172/* rx */
173void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv, 173void il4965_rx_missed_beacon_notif(struct il_priv *priv,
174 struct iwl_rx_mem_buffer *rxb); 174 struct il_rx_mem_buffer *rxb);
175bool iwl4965_good_plcp_health(struct iwl_priv *priv, 175bool il4965_good_plcp_health(struct il_priv *priv,
176 struct iwl_rx_packet *pkt); 176 struct il_rx_packet *pkt);
177void iwl4965_rx_statistics(struct iwl_priv *priv, 177void il4965_rx_statistics(struct il_priv *priv,
178 struct iwl_rx_mem_buffer *rxb); 178 struct il_rx_mem_buffer *rxb);
179void iwl4965_reply_statistics(struct iwl_priv *priv, 179void il4965_reply_statistics(struct il_priv *priv,
180 struct iwl_rx_mem_buffer *rxb); 180 struct il_rx_mem_buffer *rxb);
181 181
182/* scan */ 182/* scan */
183int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif); 183int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif);
184 184
185/* station mgmt */ 185/* station mgmt */
186int iwl4965_manage_ibss_station(struct iwl_priv *priv, 186int il4965_manage_ibss_station(struct il_priv *priv,
187 struct ieee80211_vif *vif, bool add); 187 struct ieee80211_vif *vif, bool add);
188 188
189/* hcmd */ 189/* hcmd */
190int iwl4965_send_beacon_cmd(struct iwl_priv *priv); 190int il4965_send_beacon_cmd(struct il_priv *priv);
191 191
192#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 192#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
193const char *iwl4965_get_tx_fail_reason(u32 status); 193const char *il4965_get_tx_fail_reason(u32 status);
194#else 194#else
195static inline const char * 195static inline const char *
196iwl4965_get_tx_fail_reason(u32 status) { return ""; } 196il4965_get_tx_fail_reason(u32 status) { return ""; }
197#endif 197#endif
198 198
199/* station management */ 199/* station management */
200int iwl4965_alloc_bcast_station(struct iwl_priv *priv, 200int il4965_alloc_bcast_station(struct il_priv *priv,
201 struct iwl_rxon_context *ctx); 201 struct il_rxon_context *ctx);
202int iwl4965_add_bssid_station(struct iwl_priv *priv, 202int il4965_add_bssid_station(struct il_priv *priv,
203 struct iwl_rxon_context *ctx, 203 struct il_rxon_context *ctx,
204 const u8 *addr, u8 *sta_id_r); 204 const u8 *addr, u8 *sta_id_r);
205int iwl4965_remove_default_wep_key(struct iwl_priv *priv, 205int il4965_remove_default_wep_key(struct il_priv *priv,
206 struct iwl_rxon_context *ctx, 206 struct il_rxon_context *ctx,
207 struct ieee80211_key_conf *key); 207 struct ieee80211_key_conf *key);
208int iwl4965_set_default_wep_key(struct iwl_priv *priv, 208int il4965_set_default_wep_key(struct il_priv *priv,
209 struct iwl_rxon_context *ctx, 209 struct il_rxon_context *ctx,
210 struct ieee80211_key_conf *key); 210 struct ieee80211_key_conf *key);
211int iwl4965_restore_default_wep_keys(struct iwl_priv *priv, 211int il4965_restore_default_wep_keys(struct il_priv *priv,
212 struct iwl_rxon_context *ctx); 212 struct il_rxon_context *ctx);
213int iwl4965_set_dynamic_key(struct iwl_priv *priv, 213int il4965_set_dynamic_key(struct il_priv *priv,
214 struct iwl_rxon_context *ctx, 214 struct il_rxon_context *ctx,
215 struct ieee80211_key_conf *key, u8 sta_id); 215 struct ieee80211_key_conf *key, u8 sta_id);
216int iwl4965_remove_dynamic_key(struct iwl_priv *priv, 216int il4965_remove_dynamic_key(struct il_priv *priv,
217 struct iwl_rxon_context *ctx, 217 struct il_rxon_context *ctx,
218 struct ieee80211_key_conf *key, u8 sta_id); 218 struct ieee80211_key_conf *key, u8 sta_id);
219void iwl4965_update_tkip_key(struct iwl_priv *priv, 219void il4965_update_tkip_key(struct il_priv *priv,
220 struct iwl_rxon_context *ctx, 220 struct il_rxon_context *ctx,
221 struct ieee80211_key_conf *keyconf, 221 struct ieee80211_key_conf *keyconf,
222 struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); 222 struct ieee80211_sta *sta, u32 iv32, u16 *phase1key);
223int iwl4965_sta_tx_modify_enable_tid(struct iwl_priv *priv, 223int il4965_sta_tx_modify_enable_tid(struct il_priv *priv,
224 int sta_id, int tid); 224 int sta_id, int tid);
225int iwl4965_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, 225int il4965_sta_rx_agg_start(struct il_priv *priv, struct ieee80211_sta *sta,
226 int tid, u16 ssn); 226 int tid, u16 ssn);
227int iwl4965_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, 227int il4965_sta_rx_agg_stop(struct il_priv *priv, struct ieee80211_sta *sta,
228 int tid); 228 int tid);
229void iwl4965_sta_modify_sleep_tx_count(struct iwl_priv *priv, 229void il4965_sta_modify_sleep_tx_count(struct il_priv *priv,
230 int sta_id, int cnt); 230 int sta_id, int cnt);
231int iwl4965_update_bcast_stations(struct iwl_priv *priv); 231int il4965_update_bcast_stations(struct il_priv *priv);
232 232
233/* rate */ 233/* rate */
234static inline u32 iwl4965_ant_idx_to_flags(u8 ant_idx) 234static inline u32 il4965_ant_idx_to_flags(u8 ant_idx)
235{ 235{
236 return BIT(ant_idx) << RATE_MCS_ANT_POS; 236 return BIT(ant_idx) << RATE_MCS_ANT_POS;
237} 237}
238 238
239static inline u8 iwl4965_hw_get_rate(__le32 rate_n_flags) 239static inline u8 il4965_hw_get_rate(__le32 rate_n_flags)
240{ 240{
241 return le32_to_cpu(rate_n_flags) & 0xFF; 241 return le32_to_cpu(rate_n_flags) & 0xFF;
242} 242}
243 243
244static inline __le32 iwl4965_hw_set_rate_n_flags(u8 rate, u32 flags) 244static inline __le32 il4965_hw_set_rate_n_flags(u8 rate, u32 flags)
245{ 245{
246 return cpu_to_le32(flags|(u32)rate); 246 return cpu_to_le32(flags|(u32)rate);
247} 247}
248 248
249/* eeprom */ 249/* eeprom */
250void iwl4965_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac); 250void il4965_eeprom_get_mac(const struct il_priv *priv, u8 *mac);
251int iwl4965_eeprom_acquire_semaphore(struct iwl_priv *priv); 251int il4965_eeprom_acquire_semaphore(struct il_priv *priv);
252void iwl4965_eeprom_release_semaphore(struct iwl_priv *priv); 252void il4965_eeprom_release_semaphore(struct il_priv *priv);
253int iwl4965_eeprom_check_version(struct iwl_priv *priv); 253int il4965_eeprom_check_version(struct il_priv *priv);
254 254
255/* mac80211 handlers (for 4965) */ 255/* mac80211 handlers (for 4965) */
256void iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 256void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
257int iwl4965_mac_start(struct ieee80211_hw *hw); 257int il4965_mac_start(struct ieee80211_hw *hw);
258void iwl4965_mac_stop(struct ieee80211_hw *hw); 258void il4965_mac_stop(struct ieee80211_hw *hw);
259void iwl4965_configure_filter(struct ieee80211_hw *hw, 259void il4965_configure_filter(struct ieee80211_hw *hw,
260 unsigned int changed_flags, 260 unsigned int changed_flags,
261 unsigned int *total_flags, 261 unsigned int *total_flags,
262 u64 multicast); 262 u64 multicast);
263int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 263int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
264 struct ieee80211_vif *vif, struct ieee80211_sta *sta, 264 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
265 struct ieee80211_key_conf *key); 265 struct ieee80211_key_conf *key);
266void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, 266void il4965_mac_update_tkip_key(struct ieee80211_hw *hw,
267 struct ieee80211_vif *vif, 267 struct ieee80211_vif *vif,
268 struct ieee80211_key_conf *keyconf, 268 struct ieee80211_key_conf *keyconf,
269 struct ieee80211_sta *sta, 269 struct ieee80211_sta *sta,
270 u32 iv32, u16 *phase1key); 270 u32 iv32, u16 *phase1key);
271int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, 271int il4965_mac_ampdu_action(struct ieee80211_hw *hw,
272 struct ieee80211_vif *vif, 272 struct ieee80211_vif *vif,
273 enum ieee80211_ampdu_mlme_action action, 273 enum ieee80211_ampdu_mlme_action action,
274 struct ieee80211_sta *sta, u16 tid, u16 *ssn, 274 struct ieee80211_sta *sta, u16 tid, u16 *ssn,
275 u8 buf_size); 275 u8 buf_size);
276int iwl4965_mac_sta_add(struct ieee80211_hw *hw, 276int il4965_mac_sta_add(struct ieee80211_hw *hw,
277 struct ieee80211_vif *vif, 277 struct ieee80211_vif *vif,
278 struct ieee80211_sta *sta); 278 struct ieee80211_sta *sta);
279void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, 279void il4965_mac_channel_switch(struct ieee80211_hw *hw,
280 struct ieee80211_channel_switch *ch_switch); 280 struct ieee80211_channel_switch *ch_switch);
281 281
282#endif /* __iwl_4965_h__ */ 282#endif /* __il_4965_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h
index 89904054473f..347d40284309 100644
--- a/drivers/net/wireless/iwlegacy/iwl-commands.h
+++ b/drivers/net/wireless/iwlegacy/iwl-commands.h
@@ -66,22 +66,22 @@
66 * Please use iwl-dev.h for driver implementation definitions. 66 * Please use iwl-dev.h for driver implementation definitions.
67 */ 67 */
68 68
69#ifndef __iwl_legacy_commands_h__ 69#ifndef __il_commands_h__
70#define __iwl_legacy_commands_h__ 70#define __il_commands_h__
71 71
72struct iwl_priv; 72struct il_priv;
73 73
74/* uCode version contains 4 values: Major/Minor/API/Serial */ 74/* uCode version contains 4 values: Major/Minor/API/Serial */
75#define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) 75#define IL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
76#define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) 76#define IL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
77#define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8) 77#define IL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
78#define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF) 78#define IL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
79 79
80 80
81/* Tx rates */ 81/* Tx rates */
82#define IWL_CCK_RATES 4 82#define IL_CCK_RATES 4
83#define IWL_OFDM_RATES 8 83#define IL_OFDM_RATES 8
84#define IWL_MAX_RATES (IWL_CCK_RATES + IWL_OFDM_RATES) 84#define IL_MAX_RATES (IL_CCK_RATES + IL_OFDM_RATES)
85 85
86enum { 86enum {
87 REPLY_ALIVE = 0x1, 87 REPLY_ALIVE = 0x1,
@@ -163,8 +163,8 @@ enum {
163 * 163 *
164 *****************************************************************************/ 164 *****************************************************************************/
165 165
166/* iwl_cmd_header flags value */ 166/* il_cmd_header flags value */
167#define IWL_CMD_FAILED_MSK 0x40 167#define IL_CMD_FAILED_MSK 0x40
168 168
169#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f) 169#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f)
170#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) 170#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8)
@@ -174,12 +174,12 @@ enum {
174#define SEQ_RX_FRAME cpu_to_le16(0x8000) 174#define SEQ_RX_FRAME cpu_to_le16(0x8000)
175 175
176/** 176/**
177 * struct iwl_cmd_header 177 * struct il_cmd_header
178 * 178 *
179 * This header format appears in the beginning of each command sent from the 179 * This header format appears in the beginning of each command sent from the
180 * driver, and each response/notification received from uCode. 180 * driver, and each response/notification received from uCode.
181 */ 181 */
182struct iwl_cmd_header { 182struct il_cmd_header {
183 u8 cmd; /* Command ID: REPLY_RXON, etc. */ 183 u8 cmd; /* Command ID: REPLY_RXON, etc. */
184 u8 flags; /* 0:5 reserved, 6 abort, 7 internal */ 184 u8 flags; /* 0:5 reserved, 6 abort, 7 internal */
185 /* 185 /*
@@ -212,7 +212,7 @@ struct iwl_cmd_header {
212 212
213 213
214/** 214/**
215 * struct iwl3945_tx_power 215 * struct il3945_tx_power
216 * 216 *
217 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH 217 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
218 * 218 *
@@ -223,21 +223,21 @@ struct iwl_cmd_header {
223 * 2) Radio gain. This sets the analog gain of the radio Tx path. 223 * 2) Radio gain. This sets the analog gain of the radio Tx path.
224 * It is a coarser setting, and behaves in a logarithmic (dB) fashion. 224 * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
225 * 225 *
226 * Driver obtains values from struct iwl3945_tx_power power_gain_table[][]. 226 * Driver obtains values from struct il3945_tx_power power_gain_table[][].
227 */ 227 */
228struct iwl3945_tx_power { 228struct il3945_tx_power {
229 u8 tx_gain; /* gain for analog radio */ 229 u8 tx_gain; /* gain for analog radio */
230 u8 dsp_atten; /* gain for DSP */ 230 u8 dsp_atten; /* gain for DSP */
231} __packed; 231} __packed;
232 232
233/** 233/**
234 * struct iwl3945_power_per_rate 234 * struct il3945_power_per_rate
235 * 235 *
236 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH 236 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
237 */ 237 */
238struct iwl3945_power_per_rate { 238struct il3945_power_per_rate {
239 u8 rate; /* plcp */ 239 u8 rate; /* plcp */
240 struct iwl3945_tx_power tpc; 240 struct il3945_tx_power tpc;
241 u8 reserved; 241 u8 reserved;
242} __packed; 242} __packed;
243 243
@@ -330,11 +330,11 @@ struct iwl3945_power_per_rate {
330#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 330#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32
331#define POWER_TABLE_CCK_ENTRY 32 331#define POWER_TABLE_CCK_ENTRY 32
332 332
333#define IWL_PWR_NUM_HT_OFDM_ENTRIES 24 333#define IL_PWR_NUM_HT_OFDM_ENTRIES 24
334#define IWL_PWR_CCK_ENTRIES 2 334#define IL_PWR_CCK_ENTRIES 2
335 335
336/** 336/**
337 * union iwl4965_tx_power_dual_stream 337 * union il4965_tx_power_dual_stream
338 * 338 *
339 * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH 339 * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
340 * Use __le32 version (struct tx_power_dual_stream) when building command. 340 * Use __le32 version (struct tx_power_dual_stream) when building command.
@@ -349,7 +349,7 @@ struct iwl3945_power_per_rate {
349 * 349 *
350 * See more details in doc for TXPOWER in iwl-4965-hw.h. 350 * See more details in doc for TXPOWER in iwl-4965-hw.h.
351 */ 351 */
352union iwl4965_tx_power_dual_stream { 352union il4965_tx_power_dual_stream {
353 struct { 353 struct {
354 u8 radio_tx_gain[2]; 354 u8 radio_tx_gain[2];
355 u8 dsp_predis_atten[2]; 355 u8 dsp_predis_atten[2];
@@ -362,18 +362,18 @@ union iwl4965_tx_power_dual_stream {
362 * 362 *
363 * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH 363 * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
364 * 364 *
365 * Same format as iwl_tx_power_dual_stream, but __le32 365 * Same format as il_tx_power_dual_stream, but __le32
366 */ 366 */
367struct tx_power_dual_stream { 367struct tx_power_dual_stream {
368 __le32 dw; 368 __le32 dw;
369} __packed; 369} __packed;
370 370
371/** 371/**
372 * struct iwl4965_tx_power_db 372 * struct il4965_tx_power_db
373 * 373 *
374 * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH 374 * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
375 */ 375 */
376struct iwl4965_tx_power_db { 376struct il4965_tx_power_db {
377 struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; 377 struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
378} __packed; 378} __packed;
379 379
@@ -410,7 +410,7 @@ struct iwl4965_tx_power_db {
410 * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation, 410 * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
411 * for each of 5 frequency ranges. 411 * for each of 5 frequency ranges.
412 */ 412 */
413struct iwl_init_alive_resp { 413struct il_init_alive_resp {
414 u8 ucode_minor; 414 u8 ucode_minor;
415 u8 ucode_major; 415 u8 ucode_major;
416 __le16 reserved1; 416 __le16 reserved1;
@@ -511,7 +511,7 @@ struct iwl_init_alive_resp {
511 * The Linux driver can print both logs to the system log when a uCode error 511 * The Linux driver can print both logs to the system log when a uCode error
512 * occurs. 512 * occurs.
513 */ 513 */
514struct iwl_alive_resp { 514struct il_alive_resp {
515 u8 ucode_minor; 515 u8 ucode_minor;
516 u8 ucode_major; 516 u8 ucode_major;
517 __le16 reserved1; 517 __le16 reserved1;
@@ -528,7 +528,7 @@ struct iwl_alive_resp {
528/* 528/*
529 * REPLY_ERROR = 0x2 (response only, not a command) 529 * REPLY_ERROR = 0x2 (response only, not a command)
530 */ 530 */
531struct iwl_error_resp { 531struct il_error_resp {
532 __le32 error_type; 532 __le32 error_type;
533 u8 cmd_id; 533 u8 cmd_id;
534 u8 reserved1; 534 u8 reserved1;
@@ -657,7 +657,7 @@ enum {
657 * regardless of whether RXON_FILTER_ASSOC_MSK is set. 657 * regardless of whether RXON_FILTER_ASSOC_MSK is set.
658 */ 658 */
659 659
660struct iwl3945_rxon_cmd { 660struct il3945_rxon_cmd {
661 u8 node_addr[6]; 661 u8 node_addr[6];
662 __le16 reserved1; 662 __le16 reserved1;
663 u8 bssid_addr[6]; 663 u8 bssid_addr[6];
@@ -676,7 +676,7 @@ struct iwl3945_rxon_cmd {
676 __le16 reserved5; 676 __le16 reserved5;
677} __packed; 677} __packed;
678 678
679struct iwl4965_rxon_cmd { 679struct il4965_rxon_cmd {
680 u8 node_addr[6]; 680 u8 node_addr[6];
681 __le16 reserved1; 681 __le16 reserved1;
682 u8 bssid_addr[6]; 682 u8 bssid_addr[6];
@@ -699,7 +699,7 @@ struct iwl4965_rxon_cmd {
699/* Create a common rxon cmd which will be typecast into the 3945 or 4965 699/* Create a common rxon cmd which will be typecast into the 3945 or 4965
700 * specific rxon cmd, depending on where it is called from. 700 * specific rxon cmd, depending on where it is called from.
701 */ 701 */
702struct iwl_legacy_rxon_cmd { 702struct il_rxon_cmd {
703 u8 node_addr[6]; 703 u8 node_addr[6];
704 __le16 reserved1; 704 __le16 reserved1;
705 u8 bssid_addr[6]; 705 u8 bssid_addr[6];
@@ -725,7 +725,7 @@ struct iwl_legacy_rxon_cmd {
725/* 725/*
726 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) 726 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
727 */ 727 */
728struct iwl3945_rxon_assoc_cmd { 728struct il3945_rxon_assoc_cmd {
729 __le32 flags; 729 __le32 flags;
730 __le32 filter_flags; 730 __le32 filter_flags;
731 u8 ofdm_basic_rates; 731 u8 ofdm_basic_rates;
@@ -733,7 +733,7 @@ struct iwl3945_rxon_assoc_cmd {
733 __le16 reserved; 733 __le16 reserved;
734} __packed; 734} __packed;
735 735
736struct iwl4965_rxon_assoc_cmd { 736struct il4965_rxon_assoc_cmd {
737 __le32 flags; 737 __le32 flags;
738 __le32 filter_flags; 738 __le32 filter_flags;
739 u8 ofdm_basic_rates; 739 u8 ofdm_basic_rates;
@@ -744,14 +744,14 @@ struct iwl4965_rxon_assoc_cmd {
744 __le16 reserved; 744 __le16 reserved;
745} __packed; 745} __packed;
746 746
747#define IWL_CONN_MAX_LISTEN_INTERVAL 10 747#define IL_CONN_MAX_LISTEN_INTERVAL 10
748#define IWL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */ 748#define IL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */
749#define IWL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */ 749#define IWL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */
750 750
751/* 751/*
752 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) 752 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
753 */ 753 */
754struct iwl_rxon_time_cmd { 754struct il_rxon_time_cmd {
755 __le64 timestamp; 755 __le64 timestamp;
756 __le16 beacon_interval; 756 __le16 beacon_interval;
757 __le16 atim_window; 757 __le16 atim_window;
@@ -764,30 +764,30 @@ struct iwl_rxon_time_cmd {
764/* 764/*
765 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) 765 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
766 */ 766 */
767struct iwl3945_channel_switch_cmd { 767struct il3945_channel_switch_cmd {
768 u8 band; 768 u8 band;
769 u8 expect_beacon; 769 u8 expect_beacon;
770 __le16 channel; 770 __le16 channel;
771 __le32 rxon_flags; 771 __le32 rxon_flags;
772 __le32 rxon_filter_flags; 772 __le32 rxon_filter_flags;
773 __le32 switch_time; 773 __le32 switch_time;
774 struct iwl3945_power_per_rate power[IWL_MAX_RATES]; 774 struct il3945_power_per_rate power[IL_MAX_RATES];
775} __packed; 775} __packed;
776 776
777struct iwl4965_channel_switch_cmd { 777struct il4965_channel_switch_cmd {
778 u8 band; 778 u8 band;
779 u8 expect_beacon; 779 u8 expect_beacon;
780 __le16 channel; 780 __le16 channel;
781 __le32 rxon_flags; 781 __le32 rxon_flags;
782 __le32 rxon_filter_flags; 782 __le32 rxon_filter_flags;
783 __le32 switch_time; 783 __le32 switch_time;
784 struct iwl4965_tx_power_db tx_power; 784 struct il4965_tx_power_db tx_power;
785} __packed; 785} __packed;
786 786
787/* 787/*
788 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) 788 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
789 */ 789 */
790struct iwl_csa_notification { 790struct il_csa_notification {
791 __le16 band; 791 __le16 band;
792 __le16 channel; 792 __le16 channel;
793 __le32 status; /* 0 - OK, 1 - fail */ 793 __le32 status; /* 0 - OK, 1 - fail */
@@ -800,8 +800,8 @@ struct iwl_csa_notification {
800 *****************************************************************************/ 800 *****************************************************************************/
801 801
802/** 802/**
803 * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM 803 * struct il_ac_qos -- QOS timing params for REPLY_QOS_PARAM
804 * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd 804 * One for each of 4 EDCA access categories in struct il_qosparam_cmd
805 * 805 *
806 * @cw_min: Contention window, start value in numbers of slots. 806 * @cw_min: Contention window, start value in numbers of slots.
807 * Should be a power-of-2, minus 1. Device's default is 0x0f. 807 * Should be a power-of-2, minus 1. Device's default is 0x0f.
@@ -815,7 +815,7 @@ struct iwl_csa_notification {
815 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW 815 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
816 * value, to cap the CW value. 816 * value, to cap the CW value.
817 */ 817 */
818struct iwl_ac_qos { 818struct il_ac_qos {
819 __le16 cw_min; 819 __le16 cw_min;
820 __le16 cw_max; 820 __le16 cw_max;
821 u8 aifsn; 821 u8 aifsn;
@@ -837,9 +837,9 @@ struct iwl_ac_qos {
837 * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs 837 * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
838 * 0: Background, 1: Best Effort, 2: Video, 3: Voice. 838 * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
839 */ 839 */
840struct iwl_qosparam_cmd { 840struct il_qosparam_cmd {
841 __le32 qos_flags; 841 __le32 qos_flags;
842 struct iwl_ac_qos ac[AC_NUM]; 842 struct il_ac_qos ac[AC_NUM];
843} __packed; 843} __packed;
844 844
845/****************************************************************************** 845/******************************************************************************
@@ -852,15 +852,15 @@ struct iwl_qosparam_cmd {
852 */ 852 */
853 853
854/* Special, dedicated locations within device's station table */ 854/* Special, dedicated locations within device's station table */
855#define IWL_AP_ID 0 855#define IL_AP_ID 0
856#define IWL_STA_ID 2 856#define IL_STA_ID 2
857#define IWL3945_BROADCAST_ID 24 857#define IWL3945_BROADCAST_ID 24
858#define IWL3945_STATION_COUNT 25 858#define IWL3945_STATION_COUNT 25
859#define IWL4965_BROADCAST_ID 31 859#define IWL4965_BROADCAST_ID 31
860#define IWL4965_STATION_COUNT 32 860#define IWL4965_STATION_COUNT 32
861 861
862#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ 862#define IL_STATION_COUNT 32 /* MAX(3945,4965)*/
863#define IWL_INVALID_STATION 255 863#define IL_INVALID_STATION 255
864 864
865#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) 865#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2)
866#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) 866#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8)
@@ -905,7 +905,7 @@ struct iwl_qosparam_cmd {
905 * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */ 905 * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
906#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) 906#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
907 907
908struct iwl4965_keyinfo { 908struct il4965_keyinfo {
909 __le16 key_flags; 909 __le16 key_flags;
910 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ 910 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
911 u8 reserved1; 911 u8 reserved1;
@@ -923,7 +923,7 @@ struct iwl4965_keyinfo {
923 * 923 *
924 * Driver selects unused table index when adding new station, 924 * Driver selects unused table index when adding new station,
925 * or the index to a pre-existing station entry when modifying that station. 925 * or the index to a pre-existing station entry when modifying that station.
926 * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP). 926 * Some indexes have special purposes (IL_AP_ID, index 0, is for AP).
927 * 927 *
928 * modify_mask flags select which parameters to modify vs. leave alone. 928 * modify_mask flags select which parameters to modify vs. leave alone.
929 */ 929 */
@@ -954,19 +954,19 @@ struct sta_id_modify {
954 * their own txpower/rate setup data). 954 * their own txpower/rate setup data).
955 * 955 *
956 * When getting started on a new channel, driver must set up the 956 * When getting started on a new channel, driver must set up the
957 * IWL_BROADCAST_ID entry (last entry in the table). For a client 957 * IL_BROADCAST_ID entry (last entry in the table). For a client
958 * station in a BSS, once an AP is selected, driver sets up the AP STA 958 * station in a BSS, once an AP is selected, driver sets up the AP STA
959 * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP 959 * in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP
960 * are all that are needed for a BSS client station. If the device is 960 * are all that are needed for a BSS client station. If the device is
961 * used as AP, or in an IBSS network, driver must set up station table 961 * used as AP, or in an IBSS network, driver must set up station table
962 * entries for all STAs in network, starting with index IWL_STA_ID. 962 * entries for all STAs in network, starting with index IL_STA_ID.
963 */ 963 */
964 964
965struct iwl3945_addsta_cmd { 965struct il3945_addsta_cmd {
966 u8 mode; /* 1: modify existing, 0: add new station */ 966 u8 mode; /* 1: modify existing, 0: add new station */
967 u8 reserved[3]; 967 u8 reserved[3];
968 struct sta_id_modify sta; 968 struct sta_id_modify sta;
969 struct iwl4965_keyinfo key; 969 struct il4965_keyinfo key;
970 __le32 station_flags; /* STA_FLG_* */ 970 __le32 station_flags; /* STA_FLG_* */
971 __le32 station_flags_msk; /* STA_FLG_* */ 971 __le32 station_flags_msk; /* STA_FLG_* */
972 972
@@ -990,11 +990,11 @@ struct iwl3945_addsta_cmd {
990 __le16 add_immediate_ba_ssn; 990 __le16 add_immediate_ba_ssn;
991} __packed; 991} __packed;
992 992
993struct iwl4965_addsta_cmd { 993struct il4965_addsta_cmd {
994 u8 mode; /* 1: modify existing, 0: add new station */ 994 u8 mode; /* 1: modify existing, 0: add new station */
995 u8 reserved[3]; 995 u8 reserved[3];
996 struct sta_id_modify sta; 996 struct sta_id_modify sta;
997 struct iwl4965_keyinfo key; 997 struct il4965_keyinfo key;
998 __le32 station_flags; /* STA_FLG_* */ 998 __le32 station_flags; /* STA_FLG_* */
999 __le32 station_flags_msk; /* STA_FLG_* */ 999 __le32 station_flags_msk; /* STA_FLG_* */
1000 1000
@@ -1028,11 +1028,11 @@ struct iwl4965_addsta_cmd {
1028} __packed; 1028} __packed;
1029 1029
1030/* Wrapper struct for 3945 and 4965 addsta_cmd structures */ 1030/* Wrapper struct for 3945 and 4965 addsta_cmd structures */
1031struct iwl_legacy_addsta_cmd { 1031struct il_addsta_cmd {
1032 u8 mode; /* 1: modify existing, 0: add new station */ 1032 u8 mode; /* 1: modify existing, 0: add new station */
1033 u8 reserved[3]; 1033 u8 reserved[3];
1034 struct sta_id_modify sta; 1034 struct sta_id_modify sta;
1035 struct iwl4965_keyinfo key; 1035 struct il4965_keyinfo key;
1036 __le32 station_flags; /* STA_FLG_* */ 1036 __le32 station_flags; /* STA_FLG_* */
1037 __le32 station_flags_msk; /* STA_FLG_* */ 1037 __le32 station_flags_msk; /* STA_FLG_* */
1038 1038
@@ -1073,7 +1073,7 @@ struct iwl_legacy_addsta_cmd {
1073/* 1073/*
1074 * REPLY_ADD_STA = 0x18 (response) 1074 * REPLY_ADD_STA = 0x18 (response)
1075 */ 1075 */
1076struct iwl_add_sta_resp { 1076struct il_add_sta_resp {
1077 u8 status; /* ADD_STA_* */ 1077 u8 status; /* ADD_STA_* */
1078} __packed; 1078} __packed;
1079 1079
@@ -1081,34 +1081,34 @@ struct iwl_add_sta_resp {
1081/* 1081/*
1082 * REPLY_REM_STA = 0x19 (response) 1082 * REPLY_REM_STA = 0x19 (response)
1083 */ 1083 */
1084struct iwl_rem_sta_resp { 1084struct il_rem_sta_resp {
1085 u8 status; 1085 u8 status;
1086} __packed; 1086} __packed;
1087 1087
1088/* 1088/*
1089 * REPLY_REM_STA = 0x19 (command) 1089 * REPLY_REM_STA = 0x19 (command)
1090 */ 1090 */
1091struct iwl_rem_sta_cmd { 1091struct il_rem_sta_cmd {
1092 u8 num_sta; /* number of removed stations */ 1092 u8 num_sta; /* number of removed stations */
1093 u8 reserved[3]; 1093 u8 reserved[3];
1094 u8 addr[ETH_ALEN]; /* MAC addr of the first station */ 1094 u8 addr[ETH_ALEN]; /* MAC addr of the first station */
1095 u8 reserved2[2]; 1095 u8 reserved2[2];
1096} __packed; 1096} __packed;
1097 1097
1098#define IWL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0)) 1098#define IL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0))
1099#define IWL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1)) 1099#define IL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1))
1100#define IWL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2)) 1100#define IL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2))
1101#define IWL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3)) 1101#define IL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3))
1102#define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) 1102#define IL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00)
1103 1103
1104#define IWL_DROP_SINGLE 0 1104#define IL_DROP_SINGLE 0
1105#define IWL_DROP_SELECTED 1 1105#define IL_DROP_SELECTED 1
1106#define IWL_DROP_ALL 2 1106#define IL_DROP_ALL 2
1107 1107
1108/* 1108/*
1109 * REPLY_WEP_KEY = 0x20 1109 * REPLY_WEP_KEY = 0x20
1110 */ 1110 */
1111struct iwl_wep_key { 1111struct il_wep_key {
1112 u8 key_index; 1112 u8 key_index;
1113 u8 key_offset; 1113 u8 key_offset;
1114 u8 reserved1[2]; 1114 u8 reserved1[2];
@@ -1117,12 +1117,12 @@ struct iwl_wep_key {
1117 u8 key[16]; 1117 u8 key[16];
1118} __packed; 1118} __packed;
1119 1119
1120struct iwl_wep_cmd { 1120struct il_wep_cmd {
1121 u8 num_keys; 1121 u8 num_keys;
1122 u8 global_key_type; 1122 u8 global_key_type;
1123 u8 flags; 1123 u8 flags;
1124 u8 reserved; 1124 u8 reserved;
1125 struct iwl_wep_key key[0]; 1125 struct il_wep_key key[0];
1126} __packed; 1126} __packed;
1127 1127
1128#define WEP_KEY_WEP_TYPE 1 1128#define WEP_KEY_WEP_TYPE 1
@@ -1169,7 +1169,7 @@ struct iwl_wep_cmd {
1169#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) 1169#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800)
1170 1170
1171 1171
1172struct iwl3945_rx_frame_stats { 1172struct il3945_rx_frame_stats {
1173 u8 phy_count; 1173 u8 phy_count;
1174 u8 id; 1174 u8 id;
1175 u8 rssi; 1175 u8 rssi;
@@ -1179,7 +1179,7 @@ struct iwl3945_rx_frame_stats {
1179 u8 payload[0]; 1179 u8 payload[0];
1180} __packed; 1180} __packed;
1181 1181
1182struct iwl3945_rx_frame_hdr { 1182struct il3945_rx_frame_hdr {
1183 __le16 channel; 1183 __le16 channel;
1184 __le16 phy_flags; 1184 __le16 phy_flags;
1185 u8 reserved1; 1185 u8 reserved1;
@@ -1188,7 +1188,7 @@ struct iwl3945_rx_frame_hdr {
1188 u8 payload[0]; 1188 u8 payload[0];
1189} __packed; 1189} __packed;
1190 1190
1191struct iwl3945_rx_frame_end { 1191struct il3945_rx_frame_end {
1192 __le32 status; 1192 __le32 status;
1193 __le64 timestamp; 1193 __le64 timestamp;
1194 __le32 beacon_timestamp; 1194 __le32 beacon_timestamp;
@@ -1202,13 +1202,13 @@ struct iwl3945_rx_frame_end {
1202 * The actual offsets of the hdr and end are dynamic based on 1202 * The actual offsets of the hdr and end are dynamic based on
1203 * stats.phy_count 1203 * stats.phy_count
1204 */ 1204 */
1205struct iwl3945_rx_frame { 1205struct il3945_rx_frame {
1206 struct iwl3945_rx_frame_stats stats; 1206 struct il3945_rx_frame_stats stats;
1207 struct iwl3945_rx_frame_hdr hdr; 1207 struct il3945_rx_frame_hdr hdr;
1208 struct iwl3945_rx_frame_end end; 1208 struct il3945_rx_frame_end end;
1209} __packed; 1209} __packed;
1210 1210
1211#define IWL39_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame)) 1211#define IWL39_RX_FRAME_SIZE (4 + sizeof(struct il3945_rx_frame))
1212 1212
1213/* Fixed (non-configurable) rx data from phy */ 1213/* Fixed (non-configurable) rx data from phy */
1214 1214
@@ -1217,7 +1217,7 @@ struct iwl3945_rx_frame {
1217#define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70) 1217#define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
1218#define IWL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ 1218#define IWL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
1219#define IWL49_AGC_DB_POS (7) 1219#define IWL49_AGC_DB_POS (7)
1220struct iwl4965_rx_non_cfg_phy { 1220struct il4965_rx_non_cfg_phy {
1221 __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ 1221 __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
1222 __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ 1222 __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
1223 u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ 1223 u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
@@ -1229,7 +1229,7 @@ struct iwl4965_rx_non_cfg_phy {
1229 * REPLY_RX = 0xc3 (response only, not a command) 1229 * REPLY_RX = 0xc3 (response only, not a command)
1230 * Used only for legacy (non 11n) frames. 1230 * Used only for legacy (non 11n) frames.
1231 */ 1231 */
1232struct iwl_rx_phy_res { 1232struct il_rx_phy_res {
1233 u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ 1233 u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
1234 u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ 1234 u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
1235 u8 stat_id; /* configurable DSP phy data set ID */ 1235 u8 stat_id; /* configurable DSP phy data set ID */
@@ -1244,7 +1244,7 @@ struct iwl_rx_phy_res {
1244 __le16 frame_time; /* frame's time on the air */ 1244 __le16 frame_time; /* frame's time on the air */
1245} __packed; 1245} __packed;
1246 1246
1247struct iwl_rx_mpdu_res_start { 1247struct il_rx_mpdu_res_start {
1248 __le16 byte_count; 1248 __le16 byte_count;
1249 __le16 reserved; 1249 __le16 reserved;
1250} __packed; 1250} __packed;
@@ -1372,7 +1372,7 @@ struct iwl_rx_mpdu_res_start {
1372 * REPLY_TX = 0x1c (command) 1372 * REPLY_TX = 0x1c (command)
1373 */ 1373 */
1374 1374
1375struct iwl3945_tx_cmd { 1375struct il3945_tx_cmd {
1376 /* 1376 /*
1377 * MPDU byte count: 1377 * MPDU byte count:
1378 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, 1378 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
@@ -1436,7 +1436,7 @@ struct iwl3945_tx_cmd {
1436/* 1436/*
1437 * REPLY_TX = 0x1c (response) 1437 * REPLY_TX = 0x1c (response)
1438 */ 1438 */
1439struct iwl3945_tx_resp { 1439struct il3945_tx_resp {
1440 u8 failure_rts; 1440 u8 failure_rts;
1441 u8 failure_frame; 1441 u8 failure_frame;
1442 u8 bt_kill_count; 1442 u8 bt_kill_count;
@@ -1451,13 +1451,13 @@ struct iwl3945_tx_resp {
1451 * Used for managing Tx retries when expecting block-acks. 1451 * Used for managing Tx retries when expecting block-acks.
1452 * Driver should set these fields to 0. 1452 * Driver should set these fields to 0.
1453 */ 1453 */
1454struct iwl_dram_scratch { 1454struct il_dram_scratch {
1455 u8 try_cnt; /* Tx attempts */ 1455 u8 try_cnt; /* Tx attempts */
1456 u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ 1456 u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */
1457 __le16 reserved; 1457 __le16 reserved;
1458} __packed; 1458} __packed;
1459 1459
1460struct iwl_tx_cmd { 1460struct il_tx_cmd {
1461 /* 1461 /*
1462 * MPDU byte count: 1462 * MPDU byte count:
1463 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, 1463 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
@@ -1481,7 +1481,7 @@ struct iwl_tx_cmd {
1481 1481
1482 /* uCode may modify this field of the Tx command (in host DRAM!). 1482 /* uCode may modify this field of the Tx command (in host DRAM!).
1483 * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ 1483 * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */
1484 struct iwl_dram_scratch scratch; 1484 struct il_dram_scratch scratch;
1485 1485
1486 /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ 1486 /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */
1487 __le32 rate_n_flags; /* RATE_MCS_* */ 1487 __le32 rate_n_flags; /* RATE_MCS_* */
@@ -1697,7 +1697,7 @@ struct agg_tx_status {
1697 __le16 sequence; 1697 __le16 sequence;
1698} __packed; 1698} __packed;
1699 1699
1700struct iwl4965_tx_resp { 1700struct il4965_tx_resp {
1701 u8 frame_count; /* 1 no aggregation, >1 aggregation */ 1701 u8 frame_count; /* 1 no aggregation, >1 aggregation */
1702 u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ 1702 u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */
1703 u8 failure_rts; /* # failures due to unsuccessful RTS */ 1703 u8 failure_rts; /* # failures due to unsuccessful RTS */
@@ -1739,7 +1739,7 @@ struct iwl4965_tx_resp {
1739 * 1739 *
1740 * Reports Block-Acknowledge from recipient station 1740 * Reports Block-Acknowledge from recipient station
1741 */ 1741 */
1742struct iwl_compressed_ba_resp { 1742struct il_compressed_ba_resp {
1743 __le32 sta_addr_lo32; 1743 __le32 sta_addr_lo32;
1744 __le16 sta_addr_hi16; 1744 __le16 sta_addr_hi16;
1745 __le16 reserved; 1745 __le16 reserved;
@@ -1759,23 +1759,23 @@ struct iwl_compressed_ba_resp {
1759 * See details under "TXPOWER" in iwl-4965-hw.h. 1759 * See details under "TXPOWER" in iwl-4965-hw.h.
1760 */ 1760 */
1761 1761
1762struct iwl3945_txpowertable_cmd { 1762struct il3945_txpowertable_cmd {
1763 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ 1763 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
1764 u8 reserved; 1764 u8 reserved;
1765 __le16 channel; 1765 __le16 channel;
1766 struct iwl3945_power_per_rate power[IWL_MAX_RATES]; 1766 struct il3945_power_per_rate power[IL_MAX_RATES];
1767} __packed; 1767} __packed;
1768 1768
1769struct iwl4965_txpowertable_cmd { 1769struct il4965_txpowertable_cmd {
1770 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ 1770 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
1771 u8 reserved; 1771 u8 reserved;
1772 __le16 channel; 1772 __le16 channel;
1773 struct iwl4965_tx_power_db tx_power; 1773 struct il4965_tx_power_db tx_power;
1774} __packed; 1774} __packed;
1775 1775
1776 1776
1777/** 1777/**
1778 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response 1778 * struct il3945_rate_scaling_cmd - Rate Scaling Command & Response
1779 * 1779 *
1780 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response) 1780 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
1781 * 1781 *
@@ -1789,16 +1789,16 @@ struct iwl4965_txpowertable_cmd {
1789 * when passed through ofdm_basic_rates on the REPLY_RXON 1789 * when passed through ofdm_basic_rates on the REPLY_RXON
1790 * command would be bit 0 (1 << 0) 1790 * command would be bit 0 (1 << 0)
1791 */ 1791 */
1792struct iwl3945_rate_scaling_info { 1792struct il3945_rate_scaling_info {
1793 __le16 rate_n_flags; 1793 __le16 rate_n_flags;
1794 u8 try_cnt; 1794 u8 try_cnt;
1795 u8 next_rate_index; 1795 u8 next_rate_index;
1796} __packed; 1796} __packed;
1797 1797
1798struct iwl3945_rate_scaling_cmd { 1798struct il3945_rate_scaling_cmd {
1799 u8 table_id; 1799 u8 table_id;
1800 u8 reserved[3]; 1800 u8 reserved[3];
1801 struct iwl3945_rate_scaling_info table[IWL_MAX_RATES]; 1801 struct il3945_rate_scaling_info table[IL_MAX_RATES];
1802} __packed; 1802} __packed;
1803 1803
1804 1804
@@ -1818,11 +1818,11 @@ struct iwl3945_rate_scaling_cmd {
1818 1818
1819 1819
1820/** 1820/**
1821 * struct iwl_link_qual_general_params 1821 * struct il_link_qual_general_params
1822 * 1822 *
1823 * Used in REPLY_TX_LINK_QUALITY_CMD 1823 * Used in REPLY_TX_LINK_QUALITY_CMD
1824 */ 1824 */
1825struct iwl_link_qual_general_params { 1825struct il_link_qual_general_params {
1826 u8 flags; 1826 u8 flags;
1827 1827
1828 /* No entries at or above this (driver chosen) index contain MIMO */ 1828 /* No entries at or above this (driver chosen) index contain MIMO */
@@ -1861,11 +1861,11 @@ struct iwl_link_qual_general_params {
1861#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) 1861#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0)
1862 1862
1863/** 1863/**
1864 * struct iwl_link_qual_agg_params 1864 * struct il_link_qual_agg_params
1865 * 1865 *
1866 * Used in REPLY_TX_LINK_QUALITY_CMD 1866 * Used in REPLY_TX_LINK_QUALITY_CMD
1867 */ 1867 */
1868struct iwl_link_qual_agg_params { 1868struct il_link_qual_agg_params {
1869 1869
1870 /* 1870 /*
1871 *Maximum number of uSec in aggregation. 1871 *Maximum number of uSec in aggregation.
@@ -1966,7 +1966,7 @@ struct iwl_link_qual_agg_params {
1966 * 1966 *
1967 * When using block-ack (aggregation), all frames are transmitted at the same 1967 * When using block-ack (aggregation), all frames are transmitted at the same
1968 * rate, since there is no per-attempt acknowledgment from the destination 1968 * rate, since there is no per-attempt acknowledgment from the destination
1969 * station. The Tx response struct iwl_tx_resp indicates the Tx rate in 1969 * station. The Tx response struct il_tx_resp indicates the Tx rate in
1970 * rate_n_flags field. After receiving a block-ack, the driver can update 1970 * rate_n_flags field. After receiving a block-ack, the driver can update
1971 * history for the entire block all at once. 1971 * history for the entire block all at once.
1972 * 1972 *
@@ -2079,14 +2079,14 @@ struct iwl_link_qual_agg_params {
2079 * legacy), and then repeat the search process. 2079 * legacy), and then repeat the search process.
2080 * 2080 *
2081 */ 2081 */
2082struct iwl_link_quality_cmd { 2082struct il_link_quality_cmd {
2083 2083
2084 /* Index of destination/recipient station in uCode's station table */ 2084 /* Index of destination/recipient station in uCode's station table */
2085 u8 sta_id; 2085 u8 sta_id;
2086 u8 reserved1; 2086 u8 reserved1;
2087 __le16 control; /* not used */ 2087 __le16 control; /* not used */
2088 struct iwl_link_qual_general_params general_params; 2088 struct il_link_qual_general_params general_params;
2089 struct iwl_link_qual_agg_params agg_params; 2089 struct il_link_qual_agg_params agg_params;
2090 2090
2091 /* 2091 /*
2092 * Rate info; when using rate-scaling, Tx command's initial_rate_index 2092 * Rate info; when using rate-scaling, Tx command's initial_rate_index
@@ -2094,7 +2094,7 @@ struct iwl_link_quality_cmd {
2094 * 4965 devices works its way through table when retrying Tx. 2094 * 4965 devices works its way through table when retrying Tx.
2095 */ 2095 */
2096 struct { 2096 struct {
2097 __le32 rate_n_flags; /* RATE_MCS_*, IWL_RATE_* */ 2097 __le32 rate_n_flags; /* RATE_MCS_*, IL_RATE_* */
2098 } rs_table[LINK_QUAL_MAX_RETRY_NUM]; 2098 } rs_table[LINK_QUAL_MAX_RETRY_NUM];
2099 __le32 reserved2; 2099 __le32 reserved2;
2100} __packed; 2100} __packed;
@@ -2123,7 +2123,7 @@ struct iwl_link_quality_cmd {
2123 * same platform. Bluetooth device alerts wireless device when it will Tx; 2123 * same platform. Bluetooth device alerts wireless device when it will Tx;
2124 * wireless device can delay or kill its own Tx to accommodate. 2124 * wireless device can delay or kill its own Tx to accommodate.
2125 */ 2125 */
2126struct iwl_bt_cmd { 2126struct il_bt_cmd {
2127 u8 flags; 2127 u8 flags;
2128 u8 lead_time; 2128 u8 lead_time;
2129 u8 max_kill; 2129 u8 max_kill;
@@ -2150,18 +2150,18 @@ struct iwl_bt_cmd {
2150 RXON_FILTER_ASSOC_MSK | \ 2150 RXON_FILTER_ASSOC_MSK | \
2151 RXON_FILTER_BCON_AWARE_MSK) 2151 RXON_FILTER_BCON_AWARE_MSK)
2152 2152
2153struct iwl_measure_channel { 2153struct il_measure_channel {
2154 __le32 duration; /* measurement duration in extended beacon 2154 __le32 duration; /* measurement duration in extended beacon
2155 * format */ 2155 * format */
2156 u8 channel; /* channel to measure */ 2156 u8 channel; /* channel to measure */
2157 u8 type; /* see enum iwl_measure_type */ 2157 u8 type; /* see enum il_measure_type */
2158 __le16 reserved; 2158 __le16 reserved;
2159} __packed; 2159} __packed;
2160 2160
2161/* 2161/*
2162 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) 2162 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
2163 */ 2163 */
2164struct iwl_spectrum_cmd { 2164struct il_spectrum_cmd {
2165 __le16 len; /* number of bytes starting from token */ 2165 __le16 len; /* number of bytes starting from token */
2166 u8 token; /* token id */ 2166 u8 token; /* token id */
2167 u8 id; /* measurement id -- 0 or 1 */ 2167 u8 id; /* measurement id -- 0 or 1 */
@@ -2174,13 +2174,13 @@ struct iwl_spectrum_cmd {
2174 __le32 filter_flags; /* rxon filter flags */ 2174 __le32 filter_flags; /* rxon filter flags */
2175 __le16 channel_count; /* minimum 1, maximum 10 */ 2175 __le16 channel_count; /* minimum 1, maximum 10 */
2176 __le16 reserved3; 2176 __le16 reserved3;
2177 struct iwl_measure_channel channels[10]; 2177 struct il_measure_channel channels[10];
2178} __packed; 2178} __packed;
2179 2179
2180/* 2180/*
2181 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) 2181 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
2182 */ 2182 */
2183struct iwl_spectrum_resp { 2183struct il_spectrum_resp {
2184 u8 token; 2184 u8 token;
2185 u8 id; /* id of the prior command replaced, or 0xff */ 2185 u8 id; /* id of the prior command replaced, or 0xff */
2186 __le16 status; /* 0 - command will be handled 2186 __le16 status; /* 0 - command will be handled
@@ -2188,49 +2188,49 @@ struct iwl_spectrum_resp {
2188 * measurement) */ 2188 * measurement) */
2189} __packed; 2189} __packed;
2190 2190
2191enum iwl_measurement_state { 2191enum il_measurement_state {
2192 IWL_MEASUREMENT_START = 0, 2192 IL_MEASUREMENT_START = 0,
2193 IWL_MEASUREMENT_STOP = 1, 2193 IL_MEASUREMENT_STOP = 1,
2194}; 2194};
2195 2195
2196enum iwl_measurement_status { 2196enum il_measurement_status {
2197 IWL_MEASUREMENT_OK = 0, 2197 IL_MEASUREMENT_OK = 0,
2198 IWL_MEASUREMENT_CONCURRENT = 1, 2198 IL_MEASUREMENT_CONCURRENT = 1,
2199 IWL_MEASUREMENT_CSA_CONFLICT = 2, 2199 IL_MEASUREMENT_CSA_CONFLICT = 2,
2200 IWL_MEASUREMENT_TGH_CONFLICT = 3, 2200 IL_MEASUREMENT_TGH_CONFLICT = 3,
2201 /* 4-5 reserved */ 2201 /* 4-5 reserved */
2202 IWL_MEASUREMENT_STOPPED = 6, 2202 IL_MEASUREMENT_STOPPED = 6,
2203 IWL_MEASUREMENT_TIMEOUT = 7, 2203 IL_MEASUREMENT_TIMEOUT = 7,
2204 IWL_MEASUREMENT_PERIODIC_FAILED = 8, 2204 IL_MEASUREMENT_PERIODIC_FAILED = 8,
2205}; 2205};
2206 2206
2207#define NUM_ELEMENTS_IN_HISTOGRAM 8 2207#define NUM_ELEMENTS_IN_HISTOGRAM 8
2208 2208
2209struct iwl_measurement_histogram { 2209struct il_measurement_histogram {
2210 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ 2210 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
2211 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ 2211 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
2212} __packed; 2212} __packed;
2213 2213
2214/* clear channel availability counters */ 2214/* clear channel availability counters */
2215struct iwl_measurement_cca_counters { 2215struct il_measurement_cca_counters {
2216 __le32 ofdm; 2216 __le32 ofdm;
2217 __le32 cck; 2217 __le32 cck;
2218} __packed; 2218} __packed;
2219 2219
2220enum iwl_measure_type { 2220enum il_measure_type {
2221 IWL_MEASURE_BASIC = (1 << 0), 2221 IL_MEASURE_BASIC = (1 << 0),
2222 IWL_MEASURE_CHANNEL_LOAD = (1 << 1), 2222 IL_MEASURE_CHANNEL_LOAD = (1 << 1),
2223 IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), 2223 IL_MEASURE_HISTOGRAM_RPI = (1 << 2),
2224 IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), 2224 IL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
2225 IWL_MEASURE_FRAME = (1 << 4), 2225 IL_MEASURE_FRAME = (1 << 4),
2226 /* bits 5:6 are reserved */ 2226 /* bits 5:6 are reserved */
2227 IWL_MEASURE_IDLE = (1 << 7), 2227 IL_MEASURE_IDLE = (1 << 7),
2228}; 2228};
2229 2229
2230/* 2230/*
2231 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) 2231 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
2232 */ 2232 */
2233struct iwl_spectrum_notification { 2233struct il_spectrum_notification {
2234 u8 id; /* measurement id -- 0 or 1 */ 2234 u8 id; /* measurement id -- 0 or 1 */
2235 u8 token; 2235 u8 token;
2236 u8 channel_index; /* index in measurement channel list */ 2236 u8 channel_index; /* index in measurement channel list */
@@ -2238,7 +2238,7 @@ struct iwl_spectrum_notification {
2238 __le32 start_time; /* lower 32-bits of TSF */ 2238 __le32 start_time; /* lower 32-bits of TSF */
2239 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ 2239 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
2240 u8 channel; 2240 u8 channel;
2241 u8 type; /* see enum iwl_measurement_type */ 2241 u8 type; /* see enum il_measurement_type */
2242 u8 reserved1; 2242 u8 reserved1;
2243 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only 2243 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
2244 * valid if applicable for measurement type requested. */ 2244 * valid if applicable for measurement type requested. */
@@ -2248,9 +2248,9 @@ struct iwl_spectrum_notification {
2248 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - 2248 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
2249 * unidentified */ 2249 * unidentified */
2250 u8 reserved2[3]; 2250 u8 reserved2[3];
2251 struct iwl_measurement_histogram histogram; 2251 struct il_measurement_histogram histogram;
2252 __le32 stop_time; /* lower 32-bits of TSF */ 2252 __le32 stop_time; /* lower 32-bits of TSF */
2253 __le32 status; /* see iwl_measurement_status */ 2253 __le32 status; /* see il_measurement_status */
2254} __packed; 2254} __packed;
2255 2255
2256/****************************************************************************** 2256/******************************************************************************
@@ -2260,7 +2260,7 @@ struct iwl_spectrum_notification {
2260 *****************************************************************************/ 2260 *****************************************************************************/
2261 2261
2262/** 2262/**
2263 * struct iwl_powertable_cmd - Power Table Command 2263 * struct il_powertable_cmd - Power Table Command
2264 * @flags: See below: 2264 * @flags: See below:
2265 * 2265 *
2266 * POWER_TABLE_CMD = 0x77 (command, has simple generic response) 2266 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
@@ -2294,26 +2294,26 @@ struct iwl_spectrum_notification {
2294 * ucode assume sleep over DTIM is allowed and we don't need to wake up 2294 * ucode assume sleep over DTIM is allowed and we don't need to wake up
2295 * for every DTIM. 2295 * for every DTIM.
2296 */ 2296 */
2297#define IWL_POWER_VEC_SIZE 5 2297#define IL_POWER_VEC_SIZE 5
2298 2298
2299#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) 2299#define IL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0))
2300#define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) 2300#define IL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3))
2301 2301
2302struct iwl3945_powertable_cmd { 2302struct il3945_powertable_cmd {
2303 __le16 flags; 2303 __le16 flags;
2304 u8 reserved[2]; 2304 u8 reserved[2];
2305 __le32 rx_data_timeout; 2305 __le32 rx_data_timeout;
2306 __le32 tx_data_timeout; 2306 __le32 tx_data_timeout;
2307 __le32 sleep_interval[IWL_POWER_VEC_SIZE]; 2307 __le32 sleep_interval[IL_POWER_VEC_SIZE];
2308} __packed; 2308} __packed;
2309 2309
2310struct iwl_powertable_cmd { 2310struct il_powertable_cmd {
2311 __le16 flags; 2311 __le16 flags;
2312 u8 keep_alive_seconds; /* 3945 reserved */ 2312 u8 keep_alive_seconds; /* 3945 reserved */
2313 u8 debug_flags; /* 3945 reserved */ 2313 u8 debug_flags; /* 3945 reserved */
2314 __le32 rx_data_timeout; 2314 __le32 rx_data_timeout;
2315 __le32 tx_data_timeout; 2315 __le32 tx_data_timeout;
2316 __le32 sleep_interval[IWL_POWER_VEC_SIZE]; 2316 __le32 sleep_interval[IL_POWER_VEC_SIZE];
2317 __le32 keep_alive_beacons; 2317 __le32 keep_alive_beacons;
2318} __packed; 2318} __packed;
2319 2319
@@ -2321,7 +2321,7 @@ struct iwl_powertable_cmd {
2321 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) 2321 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
2322 * all devices identical. 2322 * all devices identical.
2323 */ 2323 */
2324struct iwl_sleep_notification { 2324struct il_sleep_notification {
2325 u8 pm_sleep_mode; 2325 u8 pm_sleep_mode;
2326 u8 pm_wakeup_src; 2326 u8 pm_wakeup_src;
2327 __le16 reserved; 2327 __le16 reserved;
@@ -2332,23 +2332,23 @@ struct iwl_sleep_notification {
2332 2332
2333/* Sleep states. all devices identical. */ 2333/* Sleep states. all devices identical. */
2334enum { 2334enum {
2335 IWL_PM_NO_SLEEP = 0, 2335 IL_PM_NO_SLEEP = 0,
2336 IWL_PM_SLP_MAC = 1, 2336 IL_PM_SLP_MAC = 1,
2337 IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, 2337 IL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
2338 IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, 2338 IL_PM_SLP_FULL_MAC_CARD_STATE = 3,
2339 IWL_PM_SLP_PHY = 4, 2339 IL_PM_SLP_PHY = 4,
2340 IWL_PM_SLP_REPENT = 5, 2340 IL_PM_SLP_REPENT = 5,
2341 IWL_PM_WAKEUP_BY_TIMER = 6, 2341 IL_PM_WAKEUP_BY_TIMER = 6,
2342 IWL_PM_WAKEUP_BY_DRIVER = 7, 2342 IL_PM_WAKEUP_BY_DRIVER = 7,
2343 IWL_PM_WAKEUP_BY_RFKILL = 8, 2343 IL_PM_WAKEUP_BY_RFKILL = 8,
2344 /* 3 reserved */ 2344 /* 3 reserved */
2345 IWL_PM_NUM_OF_MODES = 12, 2345 IL_PM_NUM_OF_MODES = 12,
2346}; 2346};
2347 2347
2348/* 2348/*
2349 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) 2349 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
2350 */ 2350 */
2351struct iwl_card_state_notif { 2351struct il_card_state_notif {
2352 __le32 flags; 2352 __le32 flags;
2353} __packed; 2353} __packed;
2354 2354
@@ -2357,7 +2357,7 @@ struct iwl_card_state_notif {
2357#define CT_CARD_DISABLED 0x04 2357#define CT_CARD_DISABLED 0x04
2358#define RXON_CARD_DISABLED 0x10 2358#define RXON_CARD_DISABLED 0x10
2359 2359
2360struct iwl_ct_kill_config { 2360struct il_ct_kill_config {
2361 __le32 reserved; 2361 __le32 reserved;
2362 __le32 critical_temperature_M; 2362 __le32 critical_temperature_M;
2363 __le32 critical_temperature_R; 2363 __le32 critical_temperature_R;
@@ -2373,7 +2373,7 @@ struct iwl_ct_kill_config {
2373#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1) 2373#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1)
2374 2374
2375/** 2375/**
2376 * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table 2376 * struct il_scan_channel - entry in REPLY_SCAN_CMD channel table
2377 * 2377 *
2378 * One for each channel in the scan list. 2378 * One for each channel in the scan list.
2379 * Each channel can independently select: 2379 * Each channel can independently select:
@@ -2383,7 +2383,7 @@ struct iwl_ct_kill_config {
2383 * quiet_plcp_th, good_CRC_th) 2383 * quiet_plcp_th, good_CRC_th)
2384 * 2384 *
2385 * To avoid uCode errors, make sure the following are true (see comments 2385 * To avoid uCode errors, make sure the following are true (see comments
2386 * under struct iwl_scan_cmd about max_out_time and quiet_time): 2386 * under struct il_scan_cmd about max_out_time and quiet_time):
2387 * 1) If using passive_dwell (i.e. passive_dwell != 0): 2387 * 1) If using passive_dwell (i.e. passive_dwell != 0):
2388 * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) 2388 * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
2389 * 2) quiet_time <= active_dwell 2389 * 2) quiet_time <= active_dwell
@@ -2391,7 +2391,7 @@ struct iwl_ct_kill_config {
2391 * passive_dwell < max_out_time 2391 * passive_dwell < max_out_time
2392 * active_dwell < max_out_time 2392 * active_dwell < max_out_time
2393 */ 2393 */
2394struct iwl3945_scan_channel { 2394struct il3945_scan_channel {
2395 /* 2395 /*
2396 * type is defined as: 2396 * type is defined as:
2397 * 0:0 1 = active, 0 = passive 2397 * 0:0 1 = active, 0 = passive
@@ -2400,8 +2400,8 @@ struct iwl3945_scan_channel {
2400 * 5:7 reserved 2400 * 5:7 reserved
2401 */ 2401 */
2402 u8 type; 2402 u8 type;
2403 u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */ 2403 u8 channel; /* band is selected by il3945_scan_cmd "flags" field */
2404 struct iwl3945_tx_power tpc; 2404 struct il3945_tx_power tpc;
2405 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ 2405 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
2406 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ 2406 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
2407} __packed; 2407} __packed;
@@ -2409,7 +2409,7 @@ struct iwl3945_scan_channel {
2409/* set number of direct probes u8 type */ 2409/* set number of direct probes u8 type */
2410#define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1)))) 2410#define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
2411 2411
2412struct iwl_scan_channel { 2412struct il_scan_channel {
2413 /* 2413 /*
2414 * type is defined as: 2414 * type is defined as:
2415 * 0:0 1 = active, 0 = passive 2415 * 0:0 1 = active, 0 = passive
@@ -2418,7 +2418,7 @@ struct iwl_scan_channel {
2418 * 21:31 reserved 2418 * 21:31 reserved
2419 */ 2419 */
2420 __le32 type; 2420 __le32 type;
2421 __le16 channel; /* band is selected by iwl_scan_cmd "flags" field */ 2421 __le16 channel; /* band is selected by il_scan_cmd "flags" field */
2422 u8 tx_gain; /* gain for analog radio */ 2422 u8 tx_gain; /* gain for analog radio */
2423 u8 dsp_atten; /* gain for DSP */ 2423 u8 dsp_atten; /* gain for DSP */
2424 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ 2424 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
@@ -2426,17 +2426,17 @@ struct iwl_scan_channel {
2426} __packed; 2426} __packed;
2427 2427
2428/* set number of direct probes __le32 type */ 2428/* set number of direct probes __le32 type */
2429#define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) 2429#define IL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
2430 2430
2431/** 2431/**
2432 * struct iwl_ssid_ie - directed scan network information element 2432 * struct il_ssid_ie - directed scan network information element
2433 * 2433 *
2434 * Up to 20 of these may appear in REPLY_SCAN_CMD (Note: Only 4 are in 2434 * Up to 20 of these may appear in REPLY_SCAN_CMD (Note: Only 4 are in
2435 * 3945 SCAN api), selected by "type" bit field in struct iwl_scan_channel; 2435 * 3945 SCAN api), selected by "type" bit field in struct il_scan_channel;
2436 * each channel may select different ssids from among the 20 (4) entries. 2436 * each channel may select different ssids from among the 20 (4) entries.
2437 * SSID IEs get transmitted in reverse order of entry. 2437 * SSID IEs get transmitted in reverse order of entry.
2438 */ 2438 */
2439struct iwl_ssid_ie { 2439struct il_ssid_ie {
2440 u8 id; 2440 u8 id;
2441 u8 len; 2441 u8 len;
2442 u8 ssid[32]; 2442 u8 ssid[32];
@@ -2445,11 +2445,11 @@ struct iwl_ssid_ie {
2445#define PROBE_OPTION_MAX_3945 4 2445#define PROBE_OPTION_MAX_3945 4
2446#define PROBE_OPTION_MAX 20 2446#define PROBE_OPTION_MAX 20
2447#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) 2447#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
2448#define IWL_GOOD_CRC_TH_DISABLED 0 2448#define IL_GOOD_CRC_TH_DISABLED 0
2449#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) 2449#define IL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
2450#define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) 2450#define IL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff)
2451#define IWL_MAX_SCAN_SIZE 1024 2451#define IL_MAX_SCAN_SIZE 1024
2452#define IWL_MAX_CMD_SIZE 4096 2452#define IL_MAX_CMD_SIZE 4096
2453 2453
2454/* 2454/*
2455 * REPLY_SCAN_CMD = 0x80 (command) 2455 * REPLY_SCAN_CMD = 0x80 (command)
@@ -2501,10 +2501,10 @@ struct iwl_ssid_ie {
2501 * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. 2501 * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
2502 * 2502 *
2503 * To avoid uCode errors, see timing restrictions described under 2503 * To avoid uCode errors, see timing restrictions described under
2504 * struct iwl_scan_channel. 2504 * struct il_scan_channel.
2505 */ 2505 */
2506 2506
2507struct iwl3945_scan_cmd { 2507struct il3945_scan_cmd {
2508 __le16 len; 2508 __le16 len;
2509 u8 reserved0; 2509 u8 reserved0;
2510 u8 channel_count; /* # channels in channel list */ 2510 u8 channel_count; /* # channels in channel list */
@@ -2525,10 +2525,10 @@ struct iwl3945_scan_cmd {
2525 2525
2526 /* For active scans (set to all-0s for passive scans). 2526 /* For active scans (set to all-0s for passive scans).
2527 * Does not include payload. Must specify Tx rate; no rate scaling. */ 2527 * Does not include payload. Must specify Tx rate; no rate scaling. */
2528 struct iwl3945_tx_cmd tx_cmd; 2528 struct il3945_tx_cmd tx_cmd;
2529 2529
2530 /* For directed active scans (set to all-0s otherwise) */ 2530 /* For directed active scans (set to all-0s otherwise) */
2531 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_3945]; 2531 struct il_ssid_ie direct_scan[PROBE_OPTION_MAX_3945];
2532 2532
2533 /* 2533 /*
2534 * Probe request frame, followed by channel list. 2534 * Probe request frame, followed by channel list.
@@ -2538,7 +2538,7 @@ struct iwl3945_scan_cmd {
2538 * Number of channels in list is specified by channel_count. 2538 * Number of channels in list is specified by channel_count.
2539 * Each channel in list is of type: 2539 * Each channel in list is of type:
2540 * 2540 *
2541 * struct iwl3945_scan_channel channels[0]; 2541 * struct il3945_scan_channel channels[0];
2542 * 2542 *
2543 * NOTE: Only one band of channels can be scanned per pass. You 2543 * NOTE: Only one band of channels can be scanned per pass. You
2544 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait 2544 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
@@ -2548,7 +2548,7 @@ struct iwl3945_scan_cmd {
2548 u8 data[0]; 2548 u8 data[0];
2549} __packed; 2549} __packed;
2550 2550
2551struct iwl_scan_cmd { 2551struct il_scan_cmd {
2552 __le16 len; 2552 __le16 len;
2553 u8 reserved0; 2553 u8 reserved0;
2554 u8 channel_count; /* # channels in channel list */ 2554 u8 channel_count; /* # channels in channel list */
@@ -2569,10 +2569,10 @@ struct iwl_scan_cmd {
2569 2569
2570 /* For active scans (set to all-0s for passive scans). 2570 /* For active scans (set to all-0s for passive scans).
2571 * Does not include payload. Must specify Tx rate; no rate scaling. */ 2571 * Does not include payload. Must specify Tx rate; no rate scaling. */
2572 struct iwl_tx_cmd tx_cmd; 2572 struct il_tx_cmd tx_cmd;
2573 2573
2574 /* For directed active scans (set to all-0s otherwise) */ 2574 /* For directed active scans (set to all-0s otherwise) */
2575 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; 2575 struct il_ssid_ie direct_scan[PROBE_OPTION_MAX];
2576 2576
2577 /* 2577 /*
2578 * Probe request frame, followed by channel list. 2578 * Probe request frame, followed by channel list.
@@ -2582,7 +2582,7 @@ struct iwl_scan_cmd {
2582 * Number of channels in list is specified by channel_count. 2582 * Number of channels in list is specified by channel_count.
2583 * Each channel in list is of type: 2583 * Each channel in list is of type:
2584 * 2584 *
2585 * struct iwl_scan_channel channels[0]; 2585 * struct il_scan_channel channels[0];
2586 * 2586 *
2587 * NOTE: Only one band of channels can be scanned per pass. You 2587 * NOTE: Only one band of channels can be scanned per pass. You
2588 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait 2588 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
@@ -2600,14 +2600,14 @@ struct iwl_scan_cmd {
2600/* 2600/*
2601 * REPLY_SCAN_CMD = 0x80 (response) 2601 * REPLY_SCAN_CMD = 0x80 (response)
2602 */ 2602 */
2603struct iwl_scanreq_notification { 2603struct il_scanreq_notification {
2604 __le32 status; /* 1: okay, 2: cannot fulfill request */ 2604 __le32 status; /* 1: okay, 2: cannot fulfill request */
2605} __packed; 2605} __packed;
2606 2606
2607/* 2607/*
2608 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) 2608 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
2609 */ 2609 */
2610struct iwl_scanstart_notification { 2610struct il_scanstart_notification {
2611 __le32 tsf_low; 2611 __le32 tsf_low;
2612 __le32 tsf_high; 2612 __le32 tsf_high;
2613 __le32 beacon_timer; 2613 __le32 beacon_timer;
@@ -2620,17 +2620,17 @@ struct iwl_scanstart_notification {
2620#define SCAN_OWNER_STATUS 0x1 2620#define SCAN_OWNER_STATUS 0x1
2621#define MEASURE_OWNER_STATUS 0x2 2621#define MEASURE_OWNER_STATUS 0x2
2622 2622
2623#define IWL_PROBE_STATUS_OK 0 2623#define IL_PROBE_STATUS_OK 0
2624#define IWL_PROBE_STATUS_TX_FAILED BIT(0) 2624#define IL_PROBE_STATUS_TX_FAILED BIT(0)
2625/* error statuses combined with TX_FAILED */ 2625/* error statuses combined with TX_FAILED */
2626#define IWL_PROBE_STATUS_FAIL_TTL BIT(1) 2626#define IL_PROBE_STATUS_FAIL_TTL BIT(1)
2627#define IWL_PROBE_STATUS_FAIL_BT BIT(2) 2627#define IL_PROBE_STATUS_FAIL_BT BIT(2)
2628 2628
2629#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ 2629#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
2630/* 2630/*
2631 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) 2631 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
2632 */ 2632 */
2633struct iwl_scanresults_notification { 2633struct il_scanresults_notification {
2634 u8 channel; 2634 u8 channel;
2635 u8 band; 2635 u8 band;
2636 u8 probe_status; 2636 u8 probe_status;
@@ -2643,7 +2643,7 @@ struct iwl_scanresults_notification {
2643/* 2643/*
2644 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) 2644 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
2645 */ 2645 */
2646struct iwl_scancomplete_notification { 2646struct il_scancomplete_notification {
2647 u8 scanned_channels; 2647 u8 scanned_channels;
2648 u8 status; 2648 u8 status;
2649 u8 last_channel; 2649 u8 last_channel;
@@ -2658,24 +2658,24 @@ struct iwl_scancomplete_notification {
2658 * 2658 *
2659 *****************************************************************************/ 2659 *****************************************************************************/
2660 2660
2661enum iwl_ibss_manager { 2661enum il_ibss_manager {
2662 IWL_NOT_IBSS_MANAGER = 0, 2662 IL_NOT_IBSS_MANAGER = 0,
2663 IWL_IBSS_MANAGER = 1, 2663 IL_IBSS_MANAGER = 1,
2664}; 2664};
2665 2665
2666/* 2666/*
2667 * BEACON_NOTIFICATION = 0x90 (notification only, not a command) 2667 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
2668 */ 2668 */
2669 2669
2670struct iwl3945_beacon_notif { 2670struct il3945_beacon_notif {
2671 struct iwl3945_tx_resp beacon_notify_hdr; 2671 struct il3945_tx_resp beacon_notify_hdr;
2672 __le32 low_tsf; 2672 __le32 low_tsf;
2673 __le32 high_tsf; 2673 __le32 high_tsf;
2674 __le32 ibss_mgr_status; 2674 __le32 ibss_mgr_status;
2675} __packed; 2675} __packed;
2676 2676
2677struct iwl4965_beacon_notif { 2677struct il4965_beacon_notif {
2678 struct iwl4965_tx_resp beacon_notify_hdr; 2678 struct il4965_tx_resp beacon_notify_hdr;
2679 __le32 low_tsf; 2679 __le32 low_tsf;
2680 __le32 high_tsf; 2680 __le32 high_tsf;
2681 __le32 ibss_mgr_status; 2681 __le32 ibss_mgr_status;
@@ -2685,16 +2685,16 @@ struct iwl4965_beacon_notif {
2685 * REPLY_TX_BEACON = 0x91 (command, has simple generic response) 2685 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
2686 */ 2686 */
2687 2687
2688struct iwl3945_tx_beacon_cmd { 2688struct il3945_tx_beacon_cmd {
2689 struct iwl3945_tx_cmd tx; 2689 struct il3945_tx_cmd tx;
2690 __le16 tim_idx; 2690 __le16 tim_idx;
2691 u8 tim_size; 2691 u8 tim_size;
2692 u8 reserved1; 2692 u8 reserved1;
2693 struct ieee80211_hdr frame[0]; /* beacon frame */ 2693 struct ieee80211_hdr frame[0]; /* beacon frame */
2694} __packed; 2694} __packed;
2695 2695
2696struct iwl_tx_beacon_cmd { 2696struct il_tx_beacon_cmd {
2697 struct iwl_tx_cmd tx; 2697 struct il_tx_cmd tx;
2698 __le16 tim_idx; 2698 __le16 tim_idx;
2699 u8 tim_size; 2699 u8 tim_size;
2700 u8 reserved1; 2700 u8 reserved1;
@@ -2707,7 +2707,7 @@ struct iwl_tx_beacon_cmd {
2707 * 2707 *
2708 *****************************************************************************/ 2708 *****************************************************************************/
2709 2709
2710#define IWL_TEMP_CONVERT 260 2710#define IL_TEMP_CONVERT 260
2711 2711
2712#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 2712#define SUP_RATE_11A_MAX_NUM_CHANNELS 8
2713#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 2713#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
@@ -2977,10 +2977,10 @@ struct statistics_general {
2977 * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag 2977 * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
2978 * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. 2978 * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
2979 */ 2979 */
2980#define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ 2980#define IL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */
2981#define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ 2981#define IL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
2982struct iwl_statistics_cmd { 2982struct il_statistics_cmd {
2983 __le32 configuration_flags; /* IWL_STATS_CONF_* */ 2983 __le32 configuration_flags; /* IL_STATS_CONF_* */
2984} __packed; 2984} __packed;
2985 2985
2986/* 2986/*
@@ -3001,14 +3001,14 @@ struct iwl_statistics_cmd {
3001#define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) 3001#define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
3002#define STATISTICS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8) 3002#define STATISTICS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8)
3003 3003
3004struct iwl3945_notif_statistics { 3004struct il3945_notif_statistics {
3005 __le32 flag; 3005 __le32 flag;
3006 struct iwl39_statistics_rx rx; 3006 struct iwl39_statistics_rx rx;
3007 struct iwl39_statistics_tx tx; 3007 struct iwl39_statistics_tx tx;
3008 struct iwl39_statistics_general general; 3008 struct iwl39_statistics_general general;
3009} __packed; 3009} __packed;
3010 3010
3011struct iwl_notif_statistics { 3011struct il_notif_statistics {
3012 __le32 flag; 3012 __le32 flag;
3013 struct statistics_rx rx; 3013 struct statistics_rx rx;
3014 struct statistics_tx tx; 3014 struct statistics_tx tx;
@@ -3035,11 +3035,11 @@ struct iwl_notif_statistics {
3035 * 3035 *
3036 */ 3036 */
3037 3037
3038#define IWL_MISSED_BEACON_THRESHOLD_MIN (1) 3038#define IL_MISSED_BEACON_THRESHOLD_MIN (1)
3039#define IWL_MISSED_BEACON_THRESHOLD_DEF (5) 3039#define IL_MISSED_BEACON_THRESHOLD_DEF (5)
3040#define IWL_MISSED_BEACON_THRESHOLD_MAX IWL_MISSED_BEACON_THRESHOLD_DEF 3040#define IL_MISSED_BEACON_THRESHOLD_MAX IL_MISSED_BEACON_THRESHOLD_DEF
3041 3041
3042struct iwl_missed_beacon_notif { 3042struct il_missed_beacon_notif {
3043 __le32 consecutive_missed_beacons; 3043 __le32 consecutive_missed_beacons;
3044 __le32 total_missed_becons; 3044 __le32 total_missed_becons;
3045 __le32 num_expected_beacons; 3045 __le32 num_expected_beacons;
@@ -3111,7 +3111,7 @@ struct iwl_missed_beacon_notif {
3111 * 3111 *
3112 * Total number of false alarms = false_alarms + plcp_errs 3112 * Total number of false alarms = false_alarms + plcp_errs
3113 * 3113 *
3114 * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd 3114 * For OFDM, adjust the following table entries in struct il_sensitivity_cmd
3115 * (notice that the start points for OFDM are at or close to settings for 3115 * (notice that the start points for OFDM are at or close to settings for
3116 * maximum sensitivity): 3116 * maximum sensitivity):
3117 * 3117 *
@@ -3152,7 +3152,7 @@ struct iwl_missed_beacon_notif {
3152 * Reset this to 0 at the first beacon period that falls within the 3152 * Reset this to 0 at the first beacon period that falls within the
3153 * "good" range (5 to 50 false alarms per 204.8 milliseconds rx). 3153 * "good" range (5 to 50 false alarms per 204.8 milliseconds rx).
3154 * 3154 *
3155 * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd 3155 * Then, adjust the following CCK table entries in struct il_sensitivity_cmd
3156 * (notice that the start points for CCK are at maximum sensitivity): 3156 * (notice that the start points for CCK are at maximum sensitivity):
3157 * 3157 *
3158 * START / MIN / MAX 3158 * START / MIN / MAX
@@ -3217,7 +3217,7 @@ struct iwl_missed_beacon_notif {
3217 */ 3217 */
3218 3218
3219/* 3219/*
3220 * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd) 3220 * Table entries in SENSITIVITY_CMD (struct il_sensitivity_cmd)
3221 */ 3221 */
3222#define HD_TABLE_SIZE (11) /* number of entries */ 3222#define HD_TABLE_SIZE (11) /* number of entries */
3223#define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */ 3223#define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */
@@ -3232,18 +3232,18 @@ struct iwl_missed_beacon_notif {
3232#define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9) 3232#define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9)
3233#define HD_OFDM_ENERGY_TH_IN_INDEX (10) 3233#define HD_OFDM_ENERGY_TH_IN_INDEX (10)
3234 3234
3235/* Control field in struct iwl_sensitivity_cmd */ 3235/* Control field in struct il_sensitivity_cmd */
3236#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0) 3236#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0)
3237#define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1) 3237#define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1)
3238 3238
3239/** 3239/**
3240 * struct iwl_sensitivity_cmd 3240 * struct il_sensitivity_cmd
3241 * @control: (1) updates working table, (0) updates default table 3241 * @control: (1) updates working table, (0) updates default table
3242 * @table: energy threshold values, use HD_* as index into table 3242 * @table: energy threshold values, use HD_* as index into table
3243 * 3243 *
3244 * Always use "1" in "control" to update uCode's working table and DSP. 3244 * Always use "1" in "control" to update uCode's working table and DSP.
3245 */ 3245 */
3246struct iwl_sensitivity_cmd { 3246struct il_sensitivity_cmd {
3247 __le16 control; /* always use "1" */ 3247 __le16 control; /* always use "1" */
3248 __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */ 3248 __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */
3249} __packed; 3249} __packed;
@@ -3294,7 +3294,7 @@ struct iwl_sensitivity_cmd {
3294 * (accum_noise[i] - accum_noise[reference]) / 30 3294 * (accum_noise[i] - accum_noise[reference]) / 30
3295 * 3295 *
3296 * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB. 3296 * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB.
3297 * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the 3297 * For use in diff_gain_[abc] fields of struct il_calibration_cmd, the
3298 * driver should limit the difference results to a range of 0-3 (0-4.5 dB), 3298 * driver should limit the difference results to a range of 0-3 (0-4.5 dB),
3299 * and set bit 2 to indicate "reduce gain". The value for the reference 3299 * and set bit 2 to indicate "reduce gain". The value for the reference
3300 * (weakest) chain should be "0". 3300 * (weakest) chain should be "0".
@@ -3306,24 +3306,24 @@ struct iwl_sensitivity_cmd {
3306 3306
3307/* Phy calibration command for series */ 3307/* Phy calibration command for series */
3308/* The default calibrate table size if not specified by firmware */ 3308/* The default calibrate table size if not specified by firmware */
3309#define IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18 3309#define IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18
3310enum { 3310enum {
3311 IWL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7, 3311 IL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7,
3312 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19, 3312 IL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19,
3313}; 3313};
3314 3314
3315#define IWL_MAX_PHY_CALIBRATE_TBL_SIZE (253) 3315#define IL_MAX_PHY_CALIBRATE_TBL_SIZE (253)
3316 3316
3317struct iwl_calib_hdr { 3317struct il_calib_hdr {
3318 u8 op_code; 3318 u8 op_code;
3319 u8 first_group; 3319 u8 first_group;
3320 u8 groups_num; 3320 u8 groups_num;
3321 u8 data_valid; 3321 u8 data_valid;
3322} __packed; 3322} __packed;
3323 3323
3324/* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ 3324/* IL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
3325struct iwl_calib_diff_gain_cmd { 3325struct il_calib_diff_gain_cmd {
3326 struct iwl_calib_hdr hdr; 3326 struct il_calib_hdr hdr;
3327 s8 diff_gain_a; /* see above */ 3327 s8 diff_gain_a; /* see above */
3328 s8 diff_gain_b; 3328 s8 diff_gain_b;
3329 s8 diff_gain_c; 3329 s8 diff_gain_c;
@@ -3343,7 +3343,7 @@ struct iwl_calib_diff_gain_cmd {
3343 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), 3343 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
3344 * this command turns it on or off, or sets up a periodic blinking cycle. 3344 * this command turns it on or off, or sets up a periodic blinking cycle.
3345 */ 3345 */
3346struct iwl_led_cmd { 3346struct il_led_cmd {
3347 __le32 interval; /* "interval" in uSec */ 3347 __le32 interval; /* "interval" in uSec */
3348 u8 id; /* 1: Activity, 2: Link, 3: Tech */ 3348 u8 id; /* 1: Activity, 2: Link, 3: Tech */
3349 u8 off; /* # intervals off while blinking; 3349 u8 off; /* # intervals off while blinking;
@@ -3360,7 +3360,7 @@ struct iwl_led_cmd {
3360 * 3360 *
3361 *****************************************************************************/ 3361 *****************************************************************************/
3362 3362
3363struct iwl_rx_packet { 3363struct il_rx_packet {
3364 /* 3364 /*
3365 * The first 4 bytes of the RX frame header contain both the RX frame 3365 * The first 4 bytes of the RX frame header contain both the RX frame
3366 * size and some flags. 3366 * size and some flags.
@@ -3372,27 +3372,27 @@ struct iwl_rx_packet {
3372 * 13-00: RX frame size 3372 * 13-00: RX frame size
3373 */ 3373 */
3374 __le32 len_n_flags; 3374 __le32 len_n_flags;
3375 struct iwl_cmd_header hdr; 3375 struct il_cmd_header hdr;
3376 union { 3376 union {
3377 struct iwl3945_rx_frame rx_frame; 3377 struct il3945_rx_frame rx_frame;
3378 struct iwl3945_tx_resp tx_resp; 3378 struct il3945_tx_resp tx_resp;
3379 struct iwl3945_beacon_notif beacon_status; 3379 struct il3945_beacon_notif beacon_status;
3380 3380
3381 struct iwl_alive_resp alive_frame; 3381 struct il_alive_resp alive_frame;
3382 struct iwl_spectrum_notification spectrum_notif; 3382 struct il_spectrum_notification spectrum_notif;
3383 struct iwl_csa_notification csa_notif; 3383 struct il_csa_notification csa_notif;
3384 struct iwl_error_resp err_resp; 3384 struct il_error_resp err_resp;
3385 struct iwl_card_state_notif card_state_notif; 3385 struct il_card_state_notif card_state_notif;
3386 struct iwl_add_sta_resp add_sta; 3386 struct il_add_sta_resp add_sta;
3387 struct iwl_rem_sta_resp rem_sta; 3387 struct il_rem_sta_resp rem_sta;
3388 struct iwl_sleep_notification sleep_notif; 3388 struct il_sleep_notification sleep_notif;
3389 struct iwl_spectrum_resp spectrum; 3389 struct il_spectrum_resp spectrum;
3390 struct iwl_notif_statistics stats; 3390 struct il_notif_statistics stats;
3391 struct iwl_compressed_ba_resp compressed_ba; 3391 struct il_compressed_ba_resp compressed_ba;
3392 struct iwl_missed_beacon_notif missed_beacon; 3392 struct il_missed_beacon_notif missed_beacon;
3393 __le32 status; 3393 __le32 status;
3394 u8 raw[0]; 3394 u8 raw[0];
3395 } u; 3395 } u;
3396} __packed; 3396} __packed;
3397 3397
3398#endif /* __iwl_legacy_commands_h__ */ 3398#endif /* __il_commands_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index 2bd5659310d7..7eae279e4c69 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -76,14 +76,14 @@ EXPORT_SYMBOL(iwlegacy_bcast_addr);
76 76
77 77
78/* This function both allocates and initializes hw and priv. */ 78/* This function both allocates and initializes hw and priv. */
79struct ieee80211_hw *iwl_legacy_alloc_all(struct iwl_cfg *cfg) 79struct ieee80211_hw *il_alloc_all(struct il_cfg *cfg)
80{ 80{
81 struct iwl_priv *priv; 81 struct il_priv *priv;
82 /* mac80211 allocates memory for this device instance, including 82 /* mac80211 allocates memory for this device instance, including
83 * space for this driver's private structure */ 83 * space for this driver's private structure */
84 struct ieee80211_hw *hw; 84 struct ieee80211_hw *hw;
85 85
86 hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), 86 hw = ieee80211_alloc_hw(sizeof(struct il_priv),
87 cfg->ops->ieee80211_ops); 87 cfg->ops->ieee80211_ops);
88 if (hw == NULL) { 88 if (hw == NULL) {
89 pr_err("%s: Can not allocate network device\n", 89 pr_err("%s: Can not allocate network device\n",
@@ -97,11 +97,11 @@ struct ieee80211_hw *iwl_legacy_alloc_all(struct iwl_cfg *cfg)
97out: 97out:
98 return hw; 98 return hw;
99} 99}
100EXPORT_SYMBOL(iwl_legacy_alloc_all); 100EXPORT_SYMBOL(il_alloc_all);
101 101
102#define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ 102#define MAX_BIT_RATE_40_MHZ 150 /* Mbps */
103#define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ 103#define MAX_BIT_RATE_20_MHZ 72 /* Mbps */
104static void iwl_legacy_init_ht_hw_capab(const struct iwl_priv *priv, 104static void il_init_ht_hw_capab(const struct il_priv *priv,
105 struct ieee80211_sta_ht_cap *ht_info, 105 struct ieee80211_sta_ht_cap *ht_info,
106 enum ieee80211_band band) 106 enum ieee80211_band band)
107{ 107{
@@ -150,11 +150,11 @@ static void iwl_legacy_init_ht_hw_capab(const struct iwl_priv *priv,
150} 150}
151 151
152/** 152/**
153 * iwl_legacy_init_geos - Initialize mac80211's geo/channel info based from eeprom 153 * il_init_geos - Initialize mac80211's geo/channel info based from eeprom
154 */ 154 */
155int iwl_legacy_init_geos(struct iwl_priv *priv) 155int il_init_geos(struct il_priv *priv)
156{ 156{
157 struct iwl_channel_info *ch; 157 struct il_channel_info *ch;
158 struct ieee80211_supported_band *sband; 158 struct ieee80211_supported_band *sband;
159 struct ieee80211_channel *channels; 159 struct ieee80211_channel *channels;
160 struct ieee80211_channel *geo_ch; 160 struct ieee80211_channel *geo_ch;
@@ -164,7 +164,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
164 164
165 if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || 165 if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
166 priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { 166 priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
167 IWL_DEBUG_INFO(priv, "Geography modes already initialized.\n"); 167 IL_DEBUG_INFO(priv, "Geography modes already initialized.\n");
168 set_bit(STATUS_GEO_CONFIGURED, &priv->status); 168 set_bit(STATUS_GEO_CONFIGURED, &priv->status);
169 return 0; 169 return 0;
170 } 170 }
@@ -174,7 +174,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
174 if (!channels) 174 if (!channels)
175 return -ENOMEM; 175 return -ENOMEM;
176 176
177 rates = kzalloc((sizeof(struct ieee80211_rate) * IWL_RATE_COUNT_LEGACY), 177 rates = kzalloc((sizeof(struct ieee80211_rate) * IL_RATE_COUNT_LEGACY),
178 GFP_KERNEL); 178 GFP_KERNEL);
179 if (!rates) { 179 if (!rates) {
180 kfree(channels); 180 kfree(channels);
@@ -185,21 +185,21 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
185 sband = &priv->bands[IEEE80211_BAND_5GHZ]; 185 sband = &priv->bands[IEEE80211_BAND_5GHZ];
186 sband->channels = &channels[ARRAY_SIZE(iwlegacy_eeprom_band_1)]; 186 sband->channels = &channels[ARRAY_SIZE(iwlegacy_eeprom_band_1)];
187 /* just OFDM */ 187 /* just OFDM */
188 sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; 188 sband->bitrates = &rates[IL_FIRST_OFDM_RATE];
189 sband->n_bitrates = IWL_RATE_COUNT_LEGACY - IWL_FIRST_OFDM_RATE; 189 sband->n_bitrates = IL_RATE_COUNT_LEGACY - IL_FIRST_OFDM_RATE;
190 190
191 if (priv->cfg->sku & IWL_SKU_N) 191 if (priv->cfg->sku & IL_SKU_N)
192 iwl_legacy_init_ht_hw_capab(priv, &sband->ht_cap, 192 il_init_ht_hw_capab(priv, &sband->ht_cap,
193 IEEE80211_BAND_5GHZ); 193 IEEE80211_BAND_5GHZ);
194 194
195 sband = &priv->bands[IEEE80211_BAND_2GHZ]; 195 sband = &priv->bands[IEEE80211_BAND_2GHZ];
196 sband->channels = channels; 196 sband->channels = channels;
197 /* OFDM & CCK */ 197 /* OFDM & CCK */
198 sband->bitrates = rates; 198 sband->bitrates = rates;
199 sband->n_bitrates = IWL_RATE_COUNT_LEGACY; 199 sband->n_bitrates = IL_RATE_COUNT_LEGACY;
200 200
201 if (priv->cfg->sku & IWL_SKU_N) 201 if (priv->cfg->sku & IL_SKU_N)
202 iwl_legacy_init_ht_hw_capab(priv, &sband->ht_cap, 202 il_init_ht_hw_capab(priv, &sband->ht_cap,
203 IEEE80211_BAND_2GHZ); 203 IEEE80211_BAND_2GHZ);
204 204
205 priv->ieee_channels = channels; 205 priv->ieee_channels = channels;
@@ -208,7 +208,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
208 for (i = 0; i < priv->channel_count; i++) { 208 for (i = 0; i < priv->channel_count; i++) {
209 ch = &priv->channel_info[i]; 209 ch = &priv->channel_info[i];
210 210
211 if (!iwl_legacy_is_channel_valid(ch)) 211 if (!il_is_channel_valid(ch))
212 continue; 212 continue;
213 213
214 sband = &priv->bands[ch->band]; 214 sband = &priv->bands[ch->band];
@@ -221,7 +221,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
221 geo_ch->max_antenna_gain = 0xff; 221 geo_ch->max_antenna_gain = 0xff;
222 geo_ch->hw_value = ch->channel; 222 geo_ch->hw_value = ch->channel;
223 223
224 if (iwl_legacy_is_channel_valid(ch)) { 224 if (il_is_channel_valid(ch)) {
225 if (!(ch->flags & EEPROM_CHANNEL_IBSS)) 225 if (!(ch->flags & EEPROM_CHANNEL_IBSS))
226 geo_ch->flags |= IEEE80211_CHAN_NO_IBSS; 226 geo_ch->flags |= IEEE80211_CHAN_NO_IBSS;
227 227
@@ -239,9 +239,9 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
239 geo_ch->flags |= IEEE80211_CHAN_DISABLED; 239 geo_ch->flags |= IEEE80211_CHAN_DISABLED;
240 } 240 }
241 241
242 IWL_DEBUG_INFO(priv, "Channel %d Freq=%d[%sGHz] %s flag=0x%X\n", 242 IL_DEBUG_INFO(priv, "Channel %d Freq=%d[%sGHz] %s flag=0x%X\n",
243 ch->channel, geo_ch->center_freq, 243 ch->channel, geo_ch->center_freq,
244 iwl_legacy_is_channel_a_band(ch) ? "5.2" : "2.4", 244 il_is_channel_a_band(ch) ? "5.2" : "2.4",
245 geo_ch->flags & IEEE80211_CHAN_DISABLED ? 245 geo_ch->flags & IEEE80211_CHAN_DISABLED ?
246 "restricted" : "valid", 246 "restricted" : "valid",
247 geo_ch->flags); 247 geo_ch->flags);
@@ -252,15 +252,15 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
252 priv->tx_power_next = max_tx_power; 252 priv->tx_power_next = max_tx_power;
253 253
254 if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && 254 if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
255 priv->cfg->sku & IWL_SKU_A) { 255 priv->cfg->sku & IL_SKU_A) {
256 IWL_INFO(priv, "Incorrectly detected BG card as ABG. " 256 IL_INFO(priv, "Incorrectly detected BG card as ABG. "
257 "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n", 257 "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n",
258 priv->pci_dev->device, 258 priv->pci_dev->device,
259 priv->pci_dev->subsystem_device); 259 priv->pci_dev->subsystem_device);
260 priv->cfg->sku &= ~IWL_SKU_A; 260 priv->cfg->sku &= ~IL_SKU_A;
261 } 261 }
262 262
263 IWL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n", 263 IL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n",
264 priv->bands[IEEE80211_BAND_2GHZ].n_channels, 264 priv->bands[IEEE80211_BAND_2GHZ].n_channels,
265 priv->bands[IEEE80211_BAND_5GHZ].n_channels); 265 priv->bands[IEEE80211_BAND_5GHZ].n_channels);
266 266
@@ -268,27 +268,27 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
268 268
269 return 0; 269 return 0;
270} 270}
271EXPORT_SYMBOL(iwl_legacy_init_geos); 271EXPORT_SYMBOL(il_init_geos);
272 272
273/* 273/*
274 * iwl_legacy_free_geos - undo allocations in iwl_legacy_init_geos 274 * il_free_geos - undo allocations in il_init_geos
275 */ 275 */
276void iwl_legacy_free_geos(struct iwl_priv *priv) 276void il_free_geos(struct il_priv *priv)
277{ 277{
278 kfree(priv->ieee_channels); 278 kfree(priv->ieee_channels);
279 kfree(priv->ieee_rates); 279 kfree(priv->ieee_rates);
280 clear_bit(STATUS_GEO_CONFIGURED, &priv->status); 280 clear_bit(STATUS_GEO_CONFIGURED, &priv->status);
281} 281}
282EXPORT_SYMBOL(iwl_legacy_free_geos); 282EXPORT_SYMBOL(il_free_geos);
283 283
284static bool iwl_legacy_is_channel_extension(struct iwl_priv *priv, 284static bool il_is_channel_extension(struct il_priv *priv,
285 enum ieee80211_band band, 285 enum ieee80211_band band,
286 u16 channel, u8 extension_chan_offset) 286 u16 channel, u8 extension_chan_offset)
287{ 287{
288 const struct iwl_channel_info *ch_info; 288 const struct il_channel_info *ch_info;
289 289
290 ch_info = iwl_legacy_get_channel_info(priv, band, channel); 290 ch_info = il_get_channel_info(priv, band, channel);
291 if (!iwl_legacy_is_channel_valid(ch_info)) 291 if (!il_is_channel_valid(ch_info))
292 return false; 292 return false;
293 293
294 if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE) 294 if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE)
@@ -301,8 +301,8 @@ static bool iwl_legacy_is_channel_extension(struct iwl_priv *priv,
301 return false; 301 return false;
302} 302}
303 303
304bool iwl_legacy_is_ht40_tx_allowed(struct iwl_priv *priv, 304bool il_is_ht40_tx_allowed(struct il_priv *priv,
305 struct iwl_rxon_context *ctx, 305 struct il_rxon_context *ctx,
306 struct ieee80211_sta_ht_cap *ht_cap) 306 struct ieee80211_sta_ht_cap *ht_cap)
307{ 307{
308 if (!ctx->ht.enabled || !ctx->ht.is_40mhz) 308 if (!ctx->ht.enabled || !ctx->ht.is_40mhz)
@@ -320,13 +320,13 @@ bool iwl_legacy_is_ht40_tx_allowed(struct iwl_priv *priv,
320 return false; 320 return false;
321#endif 321#endif
322 322
323 return iwl_legacy_is_channel_extension(priv, priv->band, 323 return il_is_channel_extension(priv, priv->band,
324 le16_to_cpu(ctx->staging.channel), 324 le16_to_cpu(ctx->staging.channel),
325 ctx->ht.extension_chan_offset); 325 ctx->ht.extension_chan_offset);
326} 326}
327EXPORT_SYMBOL(iwl_legacy_is_ht40_tx_allowed); 327EXPORT_SYMBOL(il_is_ht40_tx_allowed);
328 328
329static u16 iwl_legacy_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) 329static u16 il_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val)
330{ 330{
331 u16 new_val; 331 u16 new_val;
332 u16 beacon_factor; 332 u16 beacon_factor;
@@ -360,7 +360,7 @@ static u16 iwl_legacy_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val)
360} 360}
361 361
362int 362int
363iwl_legacy_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx) 363il_send_rxon_timing(struct il_priv *priv, struct il_rxon_context *ctx)
364{ 364{
365 u64 tsf; 365 u64 tsf;
366 s32 interval_tm, rem; 366 s32 interval_tm, rem;
@@ -368,11 +368,11 @@ iwl_legacy_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
368 u16 beacon_int; 368 u16 beacon_int;
369 struct ieee80211_vif *vif = ctx->vif; 369 struct ieee80211_vif *vif = ctx->vif;
370 370
371 conf = iwl_legacy_ieee80211_get_hw_conf(priv->hw); 371 conf = il_ieee80211_get_hw_conf(priv->hw);
372 372
373 lockdep_assert_held(&priv->mutex); 373 lockdep_assert_held(&priv->mutex);
374 374
375 memset(&ctx->timing, 0, sizeof(struct iwl_rxon_time_cmd)); 375 memset(&ctx->timing, 0, sizeof(struct il_rxon_time_cmd));
376 376
377 ctx->timing.timestamp = cpu_to_le64(priv->timestamp); 377 ctx->timing.timestamp = cpu_to_le64(priv->timestamp);
378 ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval); 378 ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval);
@@ -385,7 +385,7 @@ iwl_legacy_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
385 */ 385 */
386 ctx->timing.atim_window = 0; 386 ctx->timing.atim_window = 0;
387 387
388 beacon_int = iwl_legacy_adjust_beacon_interval(beacon_int, 388 beacon_int = il_adjust_beacon_interval(beacon_int,
389 priv->hw_params.max_beacon_itrvl * TIME_UNIT); 389 priv->hw_params.max_beacon_itrvl * TIME_UNIT);
390 ctx->timing.beacon_interval = cpu_to_le16(beacon_int); 390 ctx->timing.beacon_interval = cpu_to_le16(beacon_int);
391 391
@@ -396,23 +396,23 @@ iwl_legacy_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
396 396
397 ctx->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ?: 1) : 1; 397 ctx->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ?: 1) : 1;
398 398
399 IWL_DEBUG_ASSOC(priv, 399 IL_DEBUG_ASSOC(priv,
400 "beacon interval %d beacon timer %d beacon tim %d\n", 400 "beacon interval %d beacon timer %d beacon tim %d\n",
401 le16_to_cpu(ctx->timing.beacon_interval), 401 le16_to_cpu(ctx->timing.beacon_interval),
402 le32_to_cpu(ctx->timing.beacon_init_val), 402 le32_to_cpu(ctx->timing.beacon_init_val),
403 le16_to_cpu(ctx->timing.atim_window)); 403 le16_to_cpu(ctx->timing.atim_window));
404 404
405 return iwl_legacy_send_cmd_pdu(priv, ctx->rxon_timing_cmd, 405 return il_send_cmd_pdu(priv, ctx->rxon_timing_cmd,
406 sizeof(ctx->timing), &ctx->timing); 406 sizeof(ctx->timing), &ctx->timing);
407} 407}
408EXPORT_SYMBOL(iwl_legacy_send_rxon_timing); 408EXPORT_SYMBOL(il_send_rxon_timing);
409 409
410void 410void
411iwl_legacy_set_rxon_hwcrypto(struct iwl_priv *priv, 411il_set_rxon_hwcrypto(struct il_priv *priv,
412 struct iwl_rxon_context *ctx, 412 struct il_rxon_context *ctx,
413 int hw_decrypt) 413 int hw_decrypt)
414{ 414{
415 struct iwl_legacy_rxon_cmd *rxon = &ctx->staging; 415 struct il_rxon_cmd *rxon = &ctx->staging;
416 416
417 if (hw_decrypt) 417 if (hw_decrypt)
418 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; 418 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
@@ -420,112 +420,112 @@ iwl_legacy_set_rxon_hwcrypto(struct iwl_priv *priv,
420 rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK; 420 rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK;
421 421
422} 422}
423EXPORT_SYMBOL(iwl_legacy_set_rxon_hwcrypto); 423EXPORT_SYMBOL(il_set_rxon_hwcrypto);
424 424
425/* validate RXON structure is valid */ 425/* validate RXON structure is valid */
426int 426int
427iwl_legacy_check_rxon_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx) 427il_check_rxon_cmd(struct il_priv *priv, struct il_rxon_context *ctx)
428{ 428{
429 struct iwl_legacy_rxon_cmd *rxon = &ctx->staging; 429 struct il_rxon_cmd *rxon = &ctx->staging;
430 bool error = false; 430 bool error = false;
431 431
432 if (rxon->flags & RXON_FLG_BAND_24G_MSK) { 432 if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
433 if (rxon->flags & RXON_FLG_TGJ_NARROW_BAND_MSK) { 433 if (rxon->flags & RXON_FLG_TGJ_NARROW_BAND_MSK) {
434 IWL_WARN(priv, "check 2.4G: wrong narrow\n"); 434 IL_WARN(priv, "check 2.4G: wrong narrow\n");
435 error = true; 435 error = true;
436 } 436 }
437 if (rxon->flags & RXON_FLG_RADAR_DETECT_MSK) { 437 if (rxon->flags & RXON_FLG_RADAR_DETECT_MSK) {
438 IWL_WARN(priv, "check 2.4G: wrong radar\n"); 438 IL_WARN(priv, "check 2.4G: wrong radar\n");
439 error = true; 439 error = true;
440 } 440 }
441 } else { 441 } else {
442 if (!(rxon->flags & RXON_FLG_SHORT_SLOT_MSK)) { 442 if (!(rxon->flags & RXON_FLG_SHORT_SLOT_MSK)) {
443 IWL_WARN(priv, "check 5.2G: not short slot!\n"); 443 IL_WARN(priv, "check 5.2G: not short slot!\n");
444 error = true; 444 error = true;
445 } 445 }
446 if (rxon->flags & RXON_FLG_CCK_MSK) { 446 if (rxon->flags & RXON_FLG_CCK_MSK) {
447 IWL_WARN(priv, "check 5.2G: CCK!\n"); 447 IL_WARN(priv, "check 5.2G: CCK!\n");
448 error = true; 448 error = true;
449 } 449 }
450 } 450 }
451 if ((rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1) { 451 if ((rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1) {
452 IWL_WARN(priv, "mac/bssid mcast!\n"); 452 IL_WARN(priv, "mac/bssid mcast!\n");
453 error = true; 453 error = true;
454 } 454 }
455 455
456 /* make sure basic rates 6Mbps and 1Mbps are supported */ 456 /* make sure basic rates 6Mbps and 1Mbps are supported */
457 if ((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0 && 457 if ((rxon->ofdm_basic_rates & IL_RATE_6M_MASK) == 0 &&
458 (rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0) { 458 (rxon->cck_basic_rates & IL_RATE_1M_MASK) == 0) {
459 IWL_WARN(priv, "neither 1 nor 6 are basic\n"); 459 IL_WARN(priv, "neither 1 nor 6 are basic\n");
460 error = true; 460 error = true;
461 } 461 }
462 462
463 if (le16_to_cpu(rxon->assoc_id) > 2007) { 463 if (le16_to_cpu(rxon->assoc_id) > 2007) {
464 IWL_WARN(priv, "aid > 2007\n"); 464 IL_WARN(priv, "aid > 2007\n");
465 error = true; 465 error = true;
466 } 466 }
467 467
468 if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) 468 if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
469 == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) { 469 == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) {
470 IWL_WARN(priv, "CCK and short slot\n"); 470 IL_WARN(priv, "CCK and short slot\n");
471 error = true; 471 error = true;
472 } 472 }
473 473
474 if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) 474 if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
475 == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) { 475 == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) {
476 IWL_WARN(priv, "CCK and auto detect"); 476 IL_WARN(priv, "CCK and auto detect");
477 error = true; 477 error = true;
478 } 478 }
479 479
480 if ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | 480 if ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
481 RXON_FLG_TGG_PROTECT_MSK)) == 481 RXON_FLG_TGG_PROTECT_MSK)) ==
482 RXON_FLG_TGG_PROTECT_MSK) { 482 RXON_FLG_TGG_PROTECT_MSK) {
483 IWL_WARN(priv, "TGg but no auto-detect\n"); 483 IL_WARN(priv, "TGg but no auto-detect\n");
484 error = true; 484 error = true;
485 } 485 }
486 486
487 if (error) 487 if (error)
488 IWL_WARN(priv, "Tuning to channel %d\n", 488 IL_WARN(priv, "Tuning to channel %d\n",
489 le16_to_cpu(rxon->channel)); 489 le16_to_cpu(rxon->channel));
490 490
491 if (error) { 491 if (error) {
492 IWL_ERR(priv, "Invalid RXON\n"); 492 IL_ERR(priv, "Invalid RXON\n");
493 return -EINVAL; 493 return -EINVAL;
494 } 494 }
495 return 0; 495 return 0;
496} 496}
497EXPORT_SYMBOL(iwl_legacy_check_rxon_cmd); 497EXPORT_SYMBOL(il_check_rxon_cmd);
498 498
499/** 499/**
500 * iwl_legacy_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed 500 * il_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
501 * @priv: staging_rxon is compared to active_rxon 501 * @priv: staging_rxon is compared to active_rxon
502 * 502 *
503 * If the RXON structure is changing enough to require a new tune, 503 * If the RXON structure is changing enough to require a new tune,
504 * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that 504 * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that
505 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. 505 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
506 */ 506 */
507int iwl_legacy_full_rxon_required(struct iwl_priv *priv, 507int il_full_rxon_required(struct il_priv *priv,
508 struct iwl_rxon_context *ctx) 508 struct il_rxon_context *ctx)
509{ 509{
510 const struct iwl_legacy_rxon_cmd *staging = &ctx->staging; 510 const struct il_rxon_cmd *staging = &ctx->staging;
511 const struct iwl_legacy_rxon_cmd *active = &ctx->active; 511 const struct il_rxon_cmd *active = &ctx->active;
512 512
513#define CHK(cond) \ 513#define CHK(cond) \
514 if ((cond)) { \ 514 if ((cond)) { \
515 IWL_DEBUG_INFO(priv, "need full RXON - " #cond "\n"); \ 515 IL_DEBUG_INFO(priv, "need full RXON - " #cond "\n"); \
516 return 1; \ 516 return 1; \
517 } 517 }
518 518
519#define CHK_NEQ(c1, c2) \ 519#define CHK_NEQ(c1, c2) \
520 if ((c1) != (c2)) { \ 520 if ((c1) != (c2)) { \
521 IWL_DEBUG_INFO(priv, "need full RXON - " \ 521 IL_DEBUG_INFO(priv, "need full RXON - " \
522 #c1 " != " #c2 " - %d != %d\n", \ 522 #c1 " != " #c2 " - %d != %d\n", \
523 (c1), (c2)); \ 523 (c1), (c2)); \
524 return 1; \ 524 return 1; \
525 } 525 }
526 526
527 /* These items are only settable from the full RXON command */ 527 /* These items are only settable from the full RXON command */
528 CHK(!iwl_legacy_is_associated_ctx(ctx)); 528 CHK(!il_is_associated_ctx(ctx));
529 CHK(compare_ether_addr(staging->bssid_addr, active->bssid_addr)); 529 CHK(compare_ether_addr(staging->bssid_addr, active->bssid_addr));
530 CHK(compare_ether_addr(staging->node_addr, active->node_addr)); 530 CHK(compare_ether_addr(staging->node_addr, active->node_addr));
531 CHK(compare_ether_addr(staging->wlap_bssid_addr, 531 CHK(compare_ether_addr(staging->wlap_bssid_addr,
@@ -556,27 +556,27 @@ int iwl_legacy_full_rxon_required(struct iwl_priv *priv,
556 556
557 return 0; 557 return 0;
558} 558}
559EXPORT_SYMBOL(iwl_legacy_full_rxon_required); 559EXPORT_SYMBOL(il_full_rxon_required);
560 560
561u8 iwl_legacy_get_lowest_plcp(struct iwl_priv *priv, 561u8 il_get_lowest_plcp(struct il_priv *priv,
562 struct iwl_rxon_context *ctx) 562 struct il_rxon_context *ctx)
563{ 563{
564 /* 564 /*
565 * Assign the lowest rate -- should really get this from 565 * Assign the lowest rate -- should really get this from
566 * the beacon skb from mac80211. 566 * the beacon skb from mac80211.
567 */ 567 */
568 if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) 568 if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK)
569 return IWL_RATE_1M_PLCP; 569 return IL_RATE_1M_PLCP;
570 else 570 else
571 return IWL_RATE_6M_PLCP; 571 return IL_RATE_6M_PLCP;
572} 572}
573EXPORT_SYMBOL(iwl_legacy_get_lowest_plcp); 573EXPORT_SYMBOL(il_get_lowest_plcp);
574 574
575static void _iwl_legacy_set_rxon_ht(struct iwl_priv *priv, 575static void _il_set_rxon_ht(struct il_priv *priv,
576 struct iwl_ht_config *ht_conf, 576 struct il_ht_config *ht_conf,
577 struct iwl_rxon_context *ctx) 577 struct il_rxon_context *ctx)
578{ 578{
579 struct iwl_legacy_rxon_cmd *rxon = &ctx->staging; 579 struct il_rxon_cmd *rxon = &ctx->staging;
580 580
581 if (!ctx->ht.enabled) { 581 if (!ctx->ht.enabled) {
582 rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | 582 rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK |
@@ -594,7 +594,7 @@ static void _iwl_legacy_set_rxon_ht(struct iwl_priv *priv,
594 /* clear the HT channel mode before set the mode */ 594 /* clear the HT channel mode before set the mode */
595 rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | 595 rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK |
596 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); 596 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
597 if (iwl_legacy_is_ht40_tx_allowed(priv, ctx, NULL)) { 597 if (il_is_ht40_tx_allowed(priv, ctx, NULL)) {
598 /* pure ht40 */ 598 /* pure ht40 */
599 if (ctx->ht.protection == 599 if (ctx->ht.protection ==
600 IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) { 600 IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) {
@@ -626,7 +626,7 @@ static void _iwl_legacy_set_rxon_ht(struct iwl_priv *priv,
626 case IEEE80211_HT_PARAM_CHA_SEC_NONE: 626 case IEEE80211_HT_PARAM_CHA_SEC_NONE:
627 default: 627 default:
628 /* channel location only valid if in Mixed mode */ 628 /* channel location only valid if in Mixed mode */
629 IWL_ERR(priv, 629 IL_ERR(priv,
630 "invalid extension channel offset\n"); 630 "invalid extension channel offset\n");
631 break; 631 break;
632 } 632 }
@@ -638,30 +638,30 @@ static void _iwl_legacy_set_rxon_ht(struct iwl_priv *priv,
638 if (priv->cfg->ops->hcmd->set_rxon_chain) 638 if (priv->cfg->ops->hcmd->set_rxon_chain)
639 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); 639 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
640 640
641 IWL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X " 641 IL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X "
642 "extension channel offset 0x%x\n", 642 "extension channel offset 0x%x\n",
643 le32_to_cpu(rxon->flags), ctx->ht.protection, 643 le32_to_cpu(rxon->flags), ctx->ht.protection,
644 ctx->ht.extension_chan_offset); 644 ctx->ht.extension_chan_offset);
645} 645}
646 646
647void iwl_legacy_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf) 647void il_set_rxon_ht(struct il_priv *priv, struct il_ht_config *ht_conf)
648{ 648{
649 struct iwl_rxon_context *ctx; 649 struct il_rxon_context *ctx;
650 650
651 for_each_context(priv, ctx) 651 for_each_context(priv, ctx)
652 _iwl_legacy_set_rxon_ht(priv, ht_conf, ctx); 652 _il_set_rxon_ht(priv, ht_conf, ctx);
653} 653}
654EXPORT_SYMBOL(iwl_legacy_set_rxon_ht); 654EXPORT_SYMBOL(il_set_rxon_ht);
655 655
656/* Return valid, unused, channel for a passive scan to reset the RF */ 656/* Return valid, unused, channel for a passive scan to reset the RF */
657u8 iwl_legacy_get_single_channel_number(struct iwl_priv *priv, 657u8 il_get_single_channel_number(struct il_priv *priv,
658 enum ieee80211_band band) 658 enum ieee80211_band band)
659{ 659{
660 const struct iwl_channel_info *ch_info; 660 const struct il_channel_info *ch_info;
661 int i; 661 int i;
662 u8 channel = 0; 662 u8 channel = 0;
663 u8 min, max; 663 u8 min, max;
664 struct iwl_rxon_context *ctx; 664 struct il_rxon_context *ctx;
665 665
666 if (band == IEEE80211_BAND_5GHZ) { 666 if (band == IEEE80211_BAND_5GHZ) {
667 min = 14; 667 min = 14;
@@ -685,25 +685,25 @@ u8 iwl_legacy_get_single_channel_number(struct iwl_priv *priv,
685 continue; 685 continue;
686 686
687 channel = priv->channel_info[i].channel; 687 channel = priv->channel_info[i].channel;
688 ch_info = iwl_legacy_get_channel_info(priv, band, channel); 688 ch_info = il_get_channel_info(priv, band, channel);
689 if (iwl_legacy_is_channel_valid(ch_info)) 689 if (il_is_channel_valid(ch_info))
690 break; 690 break;
691 } 691 }
692 692
693 return channel; 693 return channel;
694} 694}
695EXPORT_SYMBOL(iwl_legacy_get_single_channel_number); 695EXPORT_SYMBOL(il_get_single_channel_number);
696 696
697/** 697/**
698 * iwl_legacy_set_rxon_channel - Set the band and channel values in staging RXON 698 * il_set_rxon_channel - Set the band and channel values in staging RXON
699 * @ch: requested channel as a pointer to struct ieee80211_channel 699 * @ch: requested channel as a pointer to struct ieee80211_channel
700 700
701 * NOTE: Does not commit to the hardware; it sets appropriate bit fields 701 * NOTE: Does not commit to the hardware; it sets appropriate bit fields
702 * in the staging RXON flag structure based on the ch->band 702 * in the staging RXON flag structure based on the ch->band
703 */ 703 */
704int 704int
705iwl_legacy_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch, 705il_set_rxon_channel(struct il_priv *priv, struct ieee80211_channel *ch,
706 struct iwl_rxon_context *ctx) 706 struct il_rxon_context *ctx)
707{ 707{
708 enum ieee80211_band band = ch->band; 708 enum ieee80211_band band = ch->band;
709 u16 channel = ch->hw_value; 709 u16 channel = ch->hw_value;
@@ -720,14 +720,14 @@ iwl_legacy_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch,
720 720
721 priv->band = band; 721 priv->band = band;
722 722
723 IWL_DEBUG_INFO(priv, "Staging channel set to %d [%d]\n", channel, band); 723 IL_DEBUG_INFO(priv, "Staging channel set to %d [%d]\n", channel, band);
724 724
725 return 0; 725 return 0;
726} 726}
727EXPORT_SYMBOL(iwl_legacy_set_rxon_channel); 727EXPORT_SYMBOL(il_set_rxon_channel);
728 728
729void iwl_legacy_set_flags_for_band(struct iwl_priv *priv, 729void il_set_flags_for_band(struct il_priv *priv,
730 struct iwl_rxon_context *ctx, 730 struct il_rxon_context *ctx,
731 enum ieee80211_band band, 731 enum ieee80211_band band,
732 struct ieee80211_vif *vif) 732 struct ieee80211_vif *vif)
733{ 733{
@@ -737,7 +737,7 @@ void iwl_legacy_set_flags_for_band(struct iwl_priv *priv,
737 | RXON_FLG_CCK_MSK); 737 | RXON_FLG_CCK_MSK);
738 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; 738 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
739 } else { 739 } else {
740 /* Copied from iwl_post_associate() */ 740 /* Copied from il_post_associate() */
741 if (vif && vif->bss_conf.use_short_slot) 741 if (vif && vif->bss_conf.use_short_slot)
742 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; 742 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
743 else 743 else
@@ -748,15 +748,15 @@ void iwl_legacy_set_flags_for_band(struct iwl_priv *priv,
748 ctx->staging.flags &= ~RXON_FLG_CCK_MSK; 748 ctx->staging.flags &= ~RXON_FLG_CCK_MSK;
749 } 749 }
750} 750}
751EXPORT_SYMBOL(iwl_legacy_set_flags_for_band); 751EXPORT_SYMBOL(il_set_flags_for_band);
752 752
753/* 753/*
754 * initialize rxon structure with default values from eeprom 754 * initialize rxon structure with default values from eeprom
755 */ 755 */
756void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv, 756void il_connection_init_rx_config(struct il_priv *priv,
757 struct iwl_rxon_context *ctx) 757 struct il_rxon_context *ctx)
758{ 758{
759 const struct iwl_channel_info *ch_info; 759 const struct il_channel_info *ch_info;
760 760
761 memset(&ctx->staging, 0, sizeof(ctx->staging)); 761 memset(&ctx->staging, 0, sizeof(ctx->staging));
762 762
@@ -778,7 +778,7 @@ void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv,
778 break; 778 break;
779 779
780 default: 780 default:
781 IWL_ERR(priv, "Unsupported interface type %d\n", 781 IL_ERR(priv, "Unsupported interface type %d\n",
782 ctx->vif->type); 782 ctx->vif->type);
783 break; 783 break;
784 } 784 }
@@ -792,7 +792,7 @@ void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv,
792 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 792 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
793#endif 793#endif
794 794
795 ch_info = iwl_legacy_get_channel_info(priv, priv->band, 795 ch_info = il_get_channel_info(priv, priv->band,
796 le16_to_cpu(ctx->active.channel)); 796 le16_to_cpu(ctx->active.channel));
797 797
798 if (!ch_info) 798 if (!ch_info)
@@ -801,12 +801,12 @@ void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv,
801 ctx->staging.channel = cpu_to_le16(ch_info->channel); 801 ctx->staging.channel = cpu_to_le16(ch_info->channel);
802 priv->band = ch_info->band; 802 priv->band = ch_info->band;
803 803
804 iwl_legacy_set_flags_for_band(priv, ctx, priv->band, ctx->vif); 804 il_set_flags_for_band(priv, ctx, priv->band, ctx->vif);
805 805
806 ctx->staging.ofdm_basic_rates = 806 ctx->staging.ofdm_basic_rates =
807 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 807 (IL_OFDM_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF;
808 ctx->staging.cck_basic_rates = 808 ctx->staging.cck_basic_rates =
809 (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; 809 (IL_CCK_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF;
810 810
811 /* clear both MIX and PURE40 mode flag */ 811 /* clear both MIX and PURE40 mode flag */
812 ctx->staging.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED | 812 ctx->staging.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED |
@@ -817,18 +817,18 @@ void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv,
817 ctx->staging.ofdm_ht_single_stream_basic_rates = 0xff; 817 ctx->staging.ofdm_ht_single_stream_basic_rates = 0xff;
818 ctx->staging.ofdm_ht_dual_stream_basic_rates = 0xff; 818 ctx->staging.ofdm_ht_dual_stream_basic_rates = 0xff;
819} 819}
820EXPORT_SYMBOL(iwl_legacy_connection_init_rx_config); 820EXPORT_SYMBOL(il_connection_init_rx_config);
821 821
822void iwl_legacy_set_rate(struct iwl_priv *priv) 822void il_set_rate(struct il_priv *priv)
823{ 823{
824 const struct ieee80211_supported_band *hw = NULL; 824 const struct ieee80211_supported_band *hw = NULL;
825 struct ieee80211_rate *rate; 825 struct ieee80211_rate *rate;
826 struct iwl_rxon_context *ctx; 826 struct il_rxon_context *ctx;
827 int i; 827 int i;
828 828
829 hw = iwl_get_hw_mode(priv, priv->band); 829 hw = il_get_hw_mode(priv, priv->band);
830 if (!hw) { 830 if (!hw) {
831 IWL_ERR(priv, "Failed to set rate: unable to get hw mode\n"); 831 IL_ERR(priv, "Failed to set rate: unable to get hw mode\n");
832 return; 832 return;
833 } 833 }
834 834
@@ -836,25 +836,25 @@ void iwl_legacy_set_rate(struct iwl_priv *priv)
836 836
837 for (i = 0; i < hw->n_bitrates; i++) { 837 for (i = 0; i < hw->n_bitrates; i++) {
838 rate = &(hw->bitrates[i]); 838 rate = &(hw->bitrates[i]);
839 if (rate->hw_value < IWL_RATE_COUNT_LEGACY) 839 if (rate->hw_value < IL_RATE_COUNT_LEGACY)
840 priv->active_rate |= (1 << rate->hw_value); 840 priv->active_rate |= (1 << rate->hw_value);
841 } 841 }
842 842
843 IWL_DEBUG_RATE(priv, "Set active_rate = %0x\n", priv->active_rate); 843 IL_DEBUG_RATE(priv, "Set active_rate = %0x\n", priv->active_rate);
844 844
845 for_each_context(priv, ctx) { 845 for_each_context(priv, ctx) {
846 ctx->staging.cck_basic_rates = 846 ctx->staging.cck_basic_rates =
847 (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; 847 (IL_CCK_BASIC_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF;
848 848
849 ctx->staging.ofdm_basic_rates = 849 ctx->staging.ofdm_basic_rates =
850 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 850 (IL_OFDM_BASIC_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF;
851 } 851 }
852} 852}
853EXPORT_SYMBOL(iwl_legacy_set_rate); 853EXPORT_SYMBOL(il_set_rate);
854 854
855void iwl_legacy_chswitch_done(struct iwl_priv *priv, bool is_success) 855void il_chswitch_done(struct il_priv *priv, bool is_success)
856{ 856{
857 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 857 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
858 858
859 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 859 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
860 return; 860 return;
@@ -862,15 +862,15 @@ void iwl_legacy_chswitch_done(struct iwl_priv *priv, bool is_success)
862 if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) 862 if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
863 ieee80211_chswitch_done(ctx->vif, is_success); 863 ieee80211_chswitch_done(ctx->vif, is_success);
864} 864}
865EXPORT_SYMBOL(iwl_legacy_chswitch_done); 865EXPORT_SYMBOL(il_chswitch_done);
866 866
867void iwl_legacy_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) 867void il_rx_csa(struct il_priv *priv, struct il_rx_mem_buffer *rxb)
868{ 868{
869 struct iwl_rx_packet *pkt = rxb_addr(rxb); 869 struct il_rx_packet *pkt = rxb_addr(rxb);
870 struct iwl_csa_notification *csa = &(pkt->u.csa_notif); 870 struct il_csa_notification *csa = &(pkt->u.csa_notif);
871 871
872 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 872 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
873 struct iwl_legacy_rxon_cmd *rxon = (void *)&ctx->active; 873 struct il_rxon_cmd *rxon = (void *)&ctx->active;
874 874
875 if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) 875 if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
876 return; 876 return;
@@ -878,63 +878,63 @@ void iwl_legacy_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
878 if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) { 878 if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
879 rxon->channel = csa->channel; 879 rxon->channel = csa->channel;
880 ctx->staging.channel = csa->channel; 880 ctx->staging.channel = csa->channel;
881 IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", 881 IL_DEBUG_11H(priv, "CSA notif: channel %d\n",
882 le16_to_cpu(csa->channel)); 882 le16_to_cpu(csa->channel));
883 iwl_legacy_chswitch_done(priv, true); 883 il_chswitch_done(priv, true);
884 } else { 884 } else {
885 IWL_ERR(priv, "CSA notif (fail) : channel %d\n", 885 IL_ERR(priv, "CSA notif (fail) : channel %d\n",
886 le16_to_cpu(csa->channel)); 886 le16_to_cpu(csa->channel));
887 iwl_legacy_chswitch_done(priv, false); 887 il_chswitch_done(priv, false);
888 } 888 }
889} 889}
890EXPORT_SYMBOL(iwl_legacy_rx_csa); 890EXPORT_SYMBOL(il_rx_csa);
891 891
892#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 892#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
893void iwl_legacy_print_rx_config_cmd(struct iwl_priv *priv, 893void il_print_rx_config_cmd(struct il_priv *priv,
894 struct iwl_rxon_context *ctx) 894 struct il_rxon_context *ctx)
895{ 895{
896 struct iwl_legacy_rxon_cmd *rxon = &ctx->staging; 896 struct il_rxon_cmd *rxon = &ctx->staging;
897 897
898 IWL_DEBUG_RADIO(priv, "RX CONFIG:\n"); 898 IL_DEBUG_RADIO(priv, "RX CONFIG:\n");
899 iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); 899 il_print_hex_dump(priv, IL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
900 IWL_DEBUG_RADIO(priv, "u16 channel: 0x%x\n", 900 IL_DEBUG_RADIO(priv, "u16 channel: 0x%x\n",
901 le16_to_cpu(rxon->channel)); 901 le16_to_cpu(rxon->channel));
902 IWL_DEBUG_RADIO(priv, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); 902 IL_DEBUG_RADIO(priv, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
903 IWL_DEBUG_RADIO(priv, "u32 filter_flags: 0x%08x\n", 903 IL_DEBUG_RADIO(priv, "u32 filter_flags: 0x%08x\n",
904 le32_to_cpu(rxon->filter_flags)); 904 le32_to_cpu(rxon->filter_flags));
905 IWL_DEBUG_RADIO(priv, "u8 dev_type: 0x%x\n", rxon->dev_type); 905 IL_DEBUG_RADIO(priv, "u8 dev_type: 0x%x\n", rxon->dev_type);
906 IWL_DEBUG_RADIO(priv, "u8 ofdm_basic_rates: 0x%02x\n", 906 IL_DEBUG_RADIO(priv, "u8 ofdm_basic_rates: 0x%02x\n",
907 rxon->ofdm_basic_rates); 907 rxon->ofdm_basic_rates);
908 IWL_DEBUG_RADIO(priv, "u8 cck_basic_rates: 0x%02x\n", 908 IL_DEBUG_RADIO(priv, "u8 cck_basic_rates: 0x%02x\n",
909 rxon->cck_basic_rates); 909 rxon->cck_basic_rates);
910 IWL_DEBUG_RADIO(priv, "u8[6] node_addr: %pM\n", rxon->node_addr); 910 IL_DEBUG_RADIO(priv, "u8[6] node_addr: %pM\n", rxon->node_addr);
911 IWL_DEBUG_RADIO(priv, "u8[6] bssid_addr: %pM\n", rxon->bssid_addr); 911 IL_DEBUG_RADIO(priv, "u8[6] bssid_addr: %pM\n", rxon->bssid_addr);
912 IWL_DEBUG_RADIO(priv, "u16 assoc_id: 0x%x\n", 912 IL_DEBUG_RADIO(priv, "u16 assoc_id: 0x%x\n",
913 le16_to_cpu(rxon->assoc_id)); 913 le16_to_cpu(rxon->assoc_id));
914} 914}
915EXPORT_SYMBOL(iwl_legacy_print_rx_config_cmd); 915EXPORT_SYMBOL(il_print_rx_config_cmd);
916#endif 916#endif
917/** 917/**
918 * iwl_legacy_irq_handle_error - called for HW or SW error interrupt from card 918 * il_irq_handle_error - called for HW or SW error interrupt from card
919 */ 919 */
920void iwl_legacy_irq_handle_error(struct iwl_priv *priv) 920void il_irq_handle_error(struct il_priv *priv)
921{ 921{
922 /* Set the FW error flag -- cleared on iwl_down */ 922 /* Set the FW error flag -- cleared on il_down */
923 set_bit(STATUS_FW_ERROR, &priv->status); 923 set_bit(STATUS_FW_ERROR, &priv->status);
924 924
925 /* Cancel currently queued command. */ 925 /* Cancel currently queued command. */
926 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 926 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
927 927
928 IWL_ERR(priv, "Loaded firmware version: %s\n", 928 IL_ERR(priv, "Loaded firmware version: %s\n",
929 priv->hw->wiphy->fw_version); 929 priv->hw->wiphy->fw_version);
930 930
931 priv->cfg->ops->lib->dump_nic_error_log(priv); 931 priv->cfg->ops->lib->dump_nic_error_log(priv);
932 if (priv->cfg->ops->lib->dump_fh) 932 if (priv->cfg->ops->lib->dump_fh)
933 priv->cfg->ops->lib->dump_fh(priv, NULL, false); 933 priv->cfg->ops->lib->dump_fh(priv, NULL, false);
934#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 934#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
935 if (iwl_legacy_get_debug_level(priv) & IWL_DL_FW_ERRORS) 935 if (il_get_debug_level(priv) & IL_DL_FW_ERRORS)
936 iwl_legacy_print_rx_config_cmd(priv, 936 il_print_rx_config_cmd(priv,
937 &priv->contexts[IWL_RXON_CTX_BSS]); 937 &priv->contexts[IL_RXON_CTX_BSS]);
938#endif 938#endif
939 939
940 wake_up(&priv->wait_command_queue); 940 wake_up(&priv->wait_command_queue);
@@ -944,41 +944,41 @@ void iwl_legacy_irq_handle_error(struct iwl_priv *priv)
944 clear_bit(STATUS_READY, &priv->status); 944 clear_bit(STATUS_READY, &priv->status);
945 945
946 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) { 946 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
947 IWL_DEBUG(priv, IWL_DL_FW_ERRORS, 947 IL_DEBUG(priv, IL_DL_FW_ERRORS,
948 "Restarting adapter due to uCode error.\n"); 948 "Restarting adapter due to uCode error.\n");
949 949
950 if (priv->cfg->mod_params->restart_fw) 950 if (priv->cfg->mod_params->restart_fw)
951 queue_work(priv->workqueue, &priv->restart); 951 queue_work(priv->workqueue, &priv->restart);
952 } 952 }
953} 953}
954EXPORT_SYMBOL(iwl_legacy_irq_handle_error); 954EXPORT_SYMBOL(il_irq_handle_error);
955 955
956static int iwl_legacy_apm_stop_master(struct iwl_priv *priv) 956static int il_apm_stop_master(struct il_priv *priv)
957{ 957{
958 int ret = 0; 958 int ret = 0;
959 959
960 /* stop device's busmaster DMA activity */ 960 /* stop device's busmaster DMA activity */
961 iwl_legacy_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); 961 il_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
962 962
963 ret = iwl_poll_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, 963 ret = il_poll_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED,
964 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); 964 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
965 if (ret) 965 if (ret)
966 IWL_WARN(priv, "Master Disable Timed Out, 100 usec\n"); 966 IL_WARN(priv, "Master Disable Timed Out, 100 usec\n");
967 967
968 IWL_DEBUG_INFO(priv, "stop master\n"); 968 IL_DEBUG_INFO(priv, "stop master\n");
969 969
970 return ret; 970 return ret;
971} 971}
972 972
973void iwl_legacy_apm_stop(struct iwl_priv *priv) 973void il_apm_stop(struct il_priv *priv)
974{ 974{
975 IWL_DEBUG_INFO(priv, "Stop card, put in low power state\n"); 975 IL_DEBUG_INFO(priv, "Stop card, put in low power state\n");
976 976
977 /* Stop device's DMA activity */ 977 /* Stop device's DMA activity */
978 iwl_legacy_apm_stop_master(priv); 978 il_apm_stop_master(priv);
979 979
980 /* Reset the entire device */ 980 /* Reset the entire device */
981 iwl_legacy_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 981 il_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
982 982
983 udelay(10); 983 udelay(10);
984 984
@@ -986,23 +986,23 @@ void iwl_legacy_apm_stop(struct iwl_priv *priv)
986 * Clear "initialization complete" bit to move adapter from 986 * Clear "initialization complete" bit to move adapter from
987 * D0A* (powered-up Active) --> D0U* (Uninitialized) state. 987 * D0A* (powered-up Active) --> D0U* (Uninitialized) state.
988 */ 988 */
989 iwl_legacy_clear_bit(priv, CSR_GP_CNTRL, 989 il_clear_bit(priv, CSR_GP_CNTRL,
990 CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 990 CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
991} 991}
992EXPORT_SYMBOL(iwl_legacy_apm_stop); 992EXPORT_SYMBOL(il_apm_stop);
993 993
994 994
995/* 995/*
996 * Start up NIC's basic functionality after it has been reset 996 * Start up NIC's basic functionality after it has been reset
997 * (e.g. after platform boot, or shutdown via iwl_legacy_apm_stop()) 997 * (e.g. after platform boot, or shutdown via il_apm_stop())
998 * NOTE: This does not load uCode nor start the embedded processor 998 * NOTE: This does not load uCode nor start the embedded processor
999 */ 999 */
1000int iwl_legacy_apm_init(struct iwl_priv *priv) 1000int il_apm_init(struct il_priv *priv)
1001{ 1001{
1002 int ret = 0; 1002 int ret = 0;
1003 u16 lctl; 1003 u16 lctl;
1004 1004
1005 IWL_DEBUG_INFO(priv, "Init card's basic functions\n"); 1005 IL_DEBUG_INFO(priv, "Init card's basic functions\n");
1006 1006
1007 /* 1007 /*
1008 * Use "set_bit" below rather than "write", to preserve any hardware 1008 * Use "set_bit" below rather than "write", to preserve any hardware
@@ -1010,18 +1010,18 @@ int iwl_legacy_apm_init(struct iwl_priv *priv)
1010 */ 1010 */
1011 1011
1012 /* Disable L0S exit timer (platform NMI Work/Around) */ 1012 /* Disable L0S exit timer (platform NMI Work/Around) */
1013 iwl_legacy_set_bit(priv, CSR_GIO_CHICKEN_BITS, 1013 il_set_bit(priv, CSR_GIO_CHICKEN_BITS,
1014 CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); 1014 CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
1015 1015
1016 /* 1016 /*
1017 * Disable L0s without affecting L1; 1017 * Disable L0s without affecting L1;
1018 * don't wait for ICH L0s (ICH bug W/A) 1018 * don't wait for ICH L0s (ICH bug W/A)
1019 */ 1019 */
1020 iwl_legacy_set_bit(priv, CSR_GIO_CHICKEN_BITS, 1020 il_set_bit(priv, CSR_GIO_CHICKEN_BITS,
1021 CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); 1021 CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX);
1022 1022
1023 /* Set FH wait threshold to maximum (HW error during stress W/A) */ 1023 /* Set FH wait threshold to maximum (HW error during stress W/A) */
1024 iwl_legacy_set_bit(priv, CSR_DBG_HPET_MEM_REG, 1024 il_set_bit(priv, CSR_DBG_HPET_MEM_REG,
1025 CSR_DBG_HPET_MEM_REG_VAL); 1025 CSR_DBG_HPET_MEM_REG_VAL);
1026 1026
1027 /* 1027 /*
@@ -1029,7 +1029,7 @@ int iwl_legacy_apm_init(struct iwl_priv *priv)
1029 * wake device's PCI Express link L1a -> L0s 1029 * wake device's PCI Express link L1a -> L0s
1030 * NOTE: This is no-op for 3945 (non-existent bit) 1030 * NOTE: This is no-op for 3945 (non-existent bit)
1031 */ 1031 */
1032 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 1032 il_set_bit(priv, CSR_HW_IF_CONFIG_REG,
1033 CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); 1033 CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A);
1034 1034
1035 /* 1035 /*
@@ -1041,42 +1041,42 @@ int iwl_legacy_apm_init(struct iwl_priv *priv)
1041 * power savings, even without L1. 1041 * power savings, even without L1.
1042 */ 1042 */
1043 if (priv->cfg->base_params->set_l0s) { 1043 if (priv->cfg->base_params->set_l0s) {
1044 lctl = iwl_legacy_pcie_link_ctl(priv); 1044 lctl = il_pcie_link_ctl(priv);
1045 if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == 1045 if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) ==
1046 PCI_CFG_LINK_CTRL_VAL_L1_EN) { 1046 PCI_CFG_LINK_CTRL_VAL_L1_EN) {
1047 /* L1-ASPM enabled; disable(!) L0S */ 1047 /* L1-ASPM enabled; disable(!) L0S */
1048 iwl_legacy_set_bit(priv, CSR_GIO_REG, 1048 il_set_bit(priv, CSR_GIO_REG,
1049 CSR_GIO_REG_VAL_L0S_ENABLED); 1049 CSR_GIO_REG_VAL_L0S_ENABLED);
1050 IWL_DEBUG_POWER(priv, "L1 Enabled; Disabling L0S\n"); 1050 IL_DEBUG_POWER(priv, "L1 Enabled; Disabling L0S\n");
1051 } else { 1051 } else {
1052 /* L1-ASPM disabled; enable(!) L0S */ 1052 /* L1-ASPM disabled; enable(!) L0S */
1053 iwl_legacy_clear_bit(priv, CSR_GIO_REG, 1053 il_clear_bit(priv, CSR_GIO_REG,
1054 CSR_GIO_REG_VAL_L0S_ENABLED); 1054 CSR_GIO_REG_VAL_L0S_ENABLED);
1055 IWL_DEBUG_POWER(priv, "L1 Disabled; Enabling L0S\n"); 1055 IL_DEBUG_POWER(priv, "L1 Disabled; Enabling L0S\n");
1056 } 1056 }
1057 } 1057 }
1058 1058
1059 /* Configure analog phase-lock-loop before activating to D0A */ 1059 /* Configure analog phase-lock-loop before activating to D0A */
1060 if (priv->cfg->base_params->pll_cfg_val) 1060 if (priv->cfg->base_params->pll_cfg_val)
1061 iwl_legacy_set_bit(priv, CSR_ANA_PLL_CFG, 1061 il_set_bit(priv, CSR_ANA_PLL_CFG,
1062 priv->cfg->base_params->pll_cfg_val); 1062 priv->cfg->base_params->pll_cfg_val);
1063 1063
1064 /* 1064 /*
1065 * Set "initialization complete" bit to move adapter from 1065 * Set "initialization complete" bit to move adapter from
1066 * D0U* --> D0A* (powered-up active) state. 1066 * D0U* --> D0A* (powered-up active) state.
1067 */ 1067 */
1068 iwl_legacy_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 1068 il_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
1069 1069
1070 /* 1070 /*
1071 * Wait for clock stabilization; once stabilized, access to 1071 * Wait for clock stabilization; once stabilized, access to
1072 * device-internal resources is supported, e.g. iwl_legacy_write_prph() 1072 * device-internal resources is supported, e.g. il_write_prph()
1073 * and accesses to uCode SRAM. 1073 * and accesses to uCode SRAM.
1074 */ 1074 */
1075 ret = iwl_poll_bit(priv, CSR_GP_CNTRL, 1075 ret = il_poll_bit(priv, CSR_GP_CNTRL,
1076 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 1076 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
1077 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); 1077 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
1078 if (ret < 0) { 1078 if (ret < 0) {
1079 IWL_DEBUG_INFO(priv, "Failed to init the card\n"); 1079 IL_DEBUG_INFO(priv, "Failed to init the card\n");
1080 goto out; 1080 goto out;
1081 } 1081 }
1082 1082
@@ -1089,29 +1089,29 @@ int iwl_legacy_apm_init(struct iwl_priv *priv)
1089 * set by default in "CLK_CTRL_REG" after reset. 1089 * set by default in "CLK_CTRL_REG" after reset.
1090 */ 1090 */
1091 if (priv->cfg->base_params->use_bsm) 1091 if (priv->cfg->base_params->use_bsm)
1092 iwl_legacy_write_prph(priv, APMG_CLK_EN_REG, 1092 il_write_prph(priv, APMG_CLK_EN_REG,
1093 APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); 1093 APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT);
1094 else 1094 else
1095 iwl_legacy_write_prph(priv, APMG_CLK_EN_REG, 1095 il_write_prph(priv, APMG_CLK_EN_REG,
1096 APMG_CLK_VAL_DMA_CLK_RQT); 1096 APMG_CLK_VAL_DMA_CLK_RQT);
1097 udelay(20); 1097 udelay(20);
1098 1098
1099 /* Disable L1-Active */ 1099 /* Disable L1-Active */
1100 iwl_legacy_set_bits_prph(priv, APMG_PCIDEV_STT_REG, 1100 il_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
1101 APMG_PCIDEV_STT_VAL_L1_ACT_DIS); 1101 APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
1102 1102
1103out: 1103out:
1104 return ret; 1104 return ret;
1105} 1105}
1106EXPORT_SYMBOL(iwl_legacy_apm_init); 1106EXPORT_SYMBOL(il_apm_init);
1107 1107
1108 1108
1109int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) 1109int il_set_tx_power(struct il_priv *priv, s8 tx_power, bool force)
1110{ 1110{
1111 int ret; 1111 int ret;
1112 s8 prev_tx_power; 1112 s8 prev_tx_power;
1113 bool defer; 1113 bool defer;
1114 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1114 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
1115 1115
1116 lockdep_assert_held(&priv->mutex); 1116 lockdep_assert_held(&priv->mutex);
1117 1117
@@ -1123,20 +1123,20 @@ int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
1123 1123
1124 /* 0 dBm mean 1 milliwatt */ 1124 /* 0 dBm mean 1 milliwatt */
1125 if (tx_power < 0) { 1125 if (tx_power < 0) {
1126 IWL_WARN(priv, 1126 IL_WARN(priv,
1127 "Requested user TXPOWER %d below 1 mW.\n", 1127 "Requested user TXPOWER %d below 1 mW.\n",
1128 tx_power); 1128 tx_power);
1129 return -EINVAL; 1129 return -EINVAL;
1130 } 1130 }
1131 1131
1132 if (tx_power > priv->tx_power_device_lmt) { 1132 if (tx_power > priv->tx_power_device_lmt) {
1133 IWL_WARN(priv, 1133 IL_WARN(priv,
1134 "Requested user TXPOWER %d above upper limit %d.\n", 1134 "Requested user TXPOWER %d above upper limit %d.\n",
1135 tx_power, priv->tx_power_device_lmt); 1135 tx_power, priv->tx_power_device_lmt);
1136 return -EINVAL; 1136 return -EINVAL;
1137 } 1137 }
1138 1138
1139 if (!iwl_legacy_is_ready_rf(priv)) 1139 if (!il_is_ready_rf(priv))
1140 return -EIO; 1140 return -EIO;
1141 1141
1142 /* scan complete and commit_rxon use tx_power_next value, 1142 /* scan complete and commit_rxon use tx_power_next value,
@@ -1147,7 +1147,7 @@ int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
1147 defer = test_bit(STATUS_SCANNING, &priv->status) || 1147 defer = test_bit(STATUS_SCANNING, &priv->status) ||
1148 memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)); 1148 memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging));
1149 if (defer && !force) { 1149 if (defer && !force) {
1150 IWL_DEBUG_INFO(priv, "Deferring tx power set\n"); 1150 IL_DEBUG_INFO(priv, "Deferring tx power set\n");
1151 return 0; 1151 return 0;
1152 } 1152 }
1153 1153
@@ -1163,11 +1163,11 @@ int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
1163 } 1163 }
1164 return ret; 1164 return ret;
1165} 1165}
1166EXPORT_SYMBOL(iwl_legacy_set_tx_power); 1166EXPORT_SYMBOL(il_set_tx_power);
1167 1167
1168void iwl_legacy_send_bt_config(struct iwl_priv *priv) 1168void il_send_bt_config(struct il_priv *priv)
1169{ 1169{
1170 struct iwl_bt_cmd bt_cmd = { 1170 struct il_bt_cmd bt_cmd = {
1171 .lead_time = BT_LEAD_TIME_DEF, 1171 .lead_time = BT_LEAD_TIME_DEF,
1172 .max_kill = BT_MAX_KILL_DEF, 1172 .max_kill = BT_MAX_KILL_DEF,
1173 .kill_ack_mask = 0, 1173 .kill_ack_mask = 0,
@@ -1179,95 +1179,95 @@ void iwl_legacy_send_bt_config(struct iwl_priv *priv)
1179 else 1179 else
1180 bt_cmd.flags = BT_COEX_ENABLE; 1180 bt_cmd.flags = BT_COEX_ENABLE;
1181 1181
1182 IWL_DEBUG_INFO(priv, "BT coex %s\n", 1182 IL_DEBUG_INFO(priv, "BT coex %s\n",
1183 (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); 1183 (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active");
1184 1184
1185 if (iwl_legacy_send_cmd_pdu(priv, REPLY_BT_CONFIG, 1185 if (il_send_cmd_pdu(priv, REPLY_BT_CONFIG,
1186 sizeof(struct iwl_bt_cmd), &bt_cmd)) 1186 sizeof(struct il_bt_cmd), &bt_cmd))
1187 IWL_ERR(priv, "failed to send BT Coex Config\n"); 1187 IL_ERR(priv, "failed to send BT Coex Config\n");
1188} 1188}
1189EXPORT_SYMBOL(iwl_legacy_send_bt_config); 1189EXPORT_SYMBOL(il_send_bt_config);
1190 1190
1191int iwl_legacy_send_statistics_request(struct iwl_priv *priv, u8 flags, bool clear) 1191int il_send_statistics_request(struct il_priv *priv, u8 flags, bool clear)
1192{ 1192{
1193 struct iwl_statistics_cmd statistics_cmd = { 1193 struct il_statistics_cmd statistics_cmd = {
1194 .configuration_flags = 1194 .configuration_flags =
1195 clear ? IWL_STATS_CONF_CLEAR_STATS : 0, 1195 clear ? IL_STATS_CONF_CLEAR_STATS : 0,
1196 }; 1196 };
1197 1197
1198 if (flags & CMD_ASYNC) 1198 if (flags & CMD_ASYNC)
1199 return iwl_legacy_send_cmd_pdu_async(priv, REPLY_STATISTICS_CMD, 1199 return il_send_cmd_pdu_async(priv, REPLY_STATISTICS_CMD,
1200 sizeof(struct iwl_statistics_cmd), 1200 sizeof(struct il_statistics_cmd),
1201 &statistics_cmd, NULL); 1201 &statistics_cmd, NULL);
1202 else 1202 else
1203 return iwl_legacy_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, 1203 return il_send_cmd_pdu(priv, REPLY_STATISTICS_CMD,
1204 sizeof(struct iwl_statistics_cmd), 1204 sizeof(struct il_statistics_cmd),
1205 &statistics_cmd); 1205 &statistics_cmd);
1206} 1206}
1207EXPORT_SYMBOL(iwl_legacy_send_statistics_request); 1207EXPORT_SYMBOL(il_send_statistics_request);
1208 1208
1209void iwl_legacy_rx_pm_sleep_notif(struct iwl_priv *priv, 1209void il_rx_pm_sleep_notif(struct il_priv *priv,
1210 struct iwl_rx_mem_buffer *rxb) 1210 struct il_rx_mem_buffer *rxb)
1211{ 1211{
1212#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 1212#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
1213 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1213 struct il_rx_packet *pkt = rxb_addr(rxb);
1214 struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif); 1214 struct il_sleep_notification *sleep = &(pkt->u.sleep_notif);
1215 IWL_DEBUG_RX(priv, "sleep mode: %d, src: %d\n", 1215 IL_DEBUG_RX(priv, "sleep mode: %d, src: %d\n",
1216 sleep->pm_sleep_mode, sleep->pm_wakeup_src); 1216 sleep->pm_sleep_mode, sleep->pm_wakeup_src);
1217#endif 1217#endif
1218} 1218}
1219EXPORT_SYMBOL(iwl_legacy_rx_pm_sleep_notif); 1219EXPORT_SYMBOL(il_rx_pm_sleep_notif);
1220 1220
1221void iwl_legacy_rx_pm_debug_statistics_notif(struct iwl_priv *priv, 1221void il_rx_pm_debug_statistics_notif(struct il_priv *priv,
1222 struct iwl_rx_mem_buffer *rxb) 1222 struct il_rx_mem_buffer *rxb)
1223{ 1223{
1224 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1224 struct il_rx_packet *pkt = rxb_addr(rxb);
1225 u32 len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; 1225 u32 len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
1226 IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled " 1226 IL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled "
1227 "notification for %s:\n", len, 1227 "notification for %s:\n", len,
1228 iwl_legacy_get_cmd_string(pkt->hdr.cmd)); 1228 il_get_cmd_string(pkt->hdr.cmd));
1229 iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, len); 1229 il_print_hex_dump(priv, IL_DL_RADIO, pkt->u.raw, len);
1230} 1230}
1231EXPORT_SYMBOL(iwl_legacy_rx_pm_debug_statistics_notif); 1231EXPORT_SYMBOL(il_rx_pm_debug_statistics_notif);
1232 1232
1233void iwl_legacy_rx_reply_error(struct iwl_priv *priv, 1233void il_rx_reply_error(struct il_priv *priv,
1234 struct iwl_rx_mem_buffer *rxb) 1234 struct il_rx_mem_buffer *rxb)
1235{ 1235{
1236 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1236 struct il_rx_packet *pkt = rxb_addr(rxb);
1237 1237
1238 IWL_ERR(priv, "Error Reply type 0x%08X cmd %s (0x%02X) " 1238 IL_ERR(priv, "Error Reply type 0x%08X cmd %s (0x%02X) "
1239 "seq 0x%04X ser 0x%08X\n", 1239 "seq 0x%04X ser 0x%08X\n",
1240 le32_to_cpu(pkt->u.err_resp.error_type), 1240 le32_to_cpu(pkt->u.err_resp.error_type),
1241 iwl_legacy_get_cmd_string(pkt->u.err_resp.cmd_id), 1241 il_get_cmd_string(pkt->u.err_resp.cmd_id),
1242 pkt->u.err_resp.cmd_id, 1242 pkt->u.err_resp.cmd_id,
1243 le16_to_cpu(pkt->u.err_resp.bad_cmd_seq_num), 1243 le16_to_cpu(pkt->u.err_resp.bad_cmd_seq_num),
1244 le32_to_cpu(pkt->u.err_resp.error_info)); 1244 le32_to_cpu(pkt->u.err_resp.error_info));
1245} 1245}
1246EXPORT_SYMBOL(iwl_legacy_rx_reply_error); 1246EXPORT_SYMBOL(il_rx_reply_error);
1247 1247
1248void iwl_legacy_clear_isr_stats(struct iwl_priv *priv) 1248void il_clear_isr_stats(struct il_priv *priv)
1249{ 1249{
1250 memset(&priv->isr_stats, 0, sizeof(priv->isr_stats)); 1250 memset(&priv->isr_stats, 0, sizeof(priv->isr_stats));
1251} 1251}
1252 1252
1253int iwl_legacy_mac_conf_tx(struct ieee80211_hw *hw, 1253int il_mac_conf_tx(struct ieee80211_hw *hw,
1254 struct ieee80211_vif *vif, u16 queue, 1254 struct ieee80211_vif *vif, u16 queue,
1255 const struct ieee80211_tx_queue_params *params) 1255 const struct ieee80211_tx_queue_params *params)
1256{ 1256{
1257 struct iwl_priv *priv = hw->priv; 1257 struct il_priv *priv = hw->priv;
1258 struct iwl_rxon_context *ctx; 1258 struct il_rxon_context *ctx;
1259 unsigned long flags; 1259 unsigned long flags;
1260 int q; 1260 int q;
1261 1261
1262 IWL_DEBUG_MAC80211(priv, "enter\n"); 1262 IL_DEBUG_MAC80211(priv, "enter\n");
1263 1263
1264 if (!iwl_legacy_is_ready_rf(priv)) { 1264 if (!il_is_ready_rf(priv)) {
1265 IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); 1265 IL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
1266 return -EIO; 1266 return -EIO;
1267 } 1267 }
1268 1268
1269 if (queue >= AC_NUM) { 1269 if (queue >= AC_NUM) {
1270 IWL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue); 1270 IL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue);
1271 return 0; 1271 return 0;
1272 } 1272 }
1273 1273
@@ -1289,32 +1289,32 @@ int iwl_legacy_mac_conf_tx(struct ieee80211_hw *hw,
1289 1289
1290 spin_unlock_irqrestore(&priv->lock, flags); 1290 spin_unlock_irqrestore(&priv->lock, flags);
1291 1291
1292 IWL_DEBUG_MAC80211(priv, "leave\n"); 1292 IL_DEBUG_MAC80211(priv, "leave\n");
1293 return 0; 1293 return 0;
1294} 1294}
1295EXPORT_SYMBOL(iwl_legacy_mac_conf_tx); 1295EXPORT_SYMBOL(il_mac_conf_tx);
1296 1296
1297int iwl_legacy_mac_tx_last_beacon(struct ieee80211_hw *hw) 1297int il_mac_tx_last_beacon(struct ieee80211_hw *hw)
1298{ 1298{
1299 struct iwl_priv *priv = hw->priv; 1299 struct il_priv *priv = hw->priv;
1300 1300
1301 return priv->ibss_manager == IWL_IBSS_MANAGER; 1301 return priv->ibss_manager == IL_IBSS_MANAGER;
1302} 1302}
1303EXPORT_SYMBOL_GPL(iwl_legacy_mac_tx_last_beacon); 1303EXPORT_SYMBOL_GPL(il_mac_tx_last_beacon);
1304 1304
1305static int 1305static int
1306iwl_legacy_set_mode(struct iwl_priv *priv, struct iwl_rxon_context *ctx) 1306il_set_mode(struct il_priv *priv, struct il_rxon_context *ctx)
1307{ 1307{
1308 iwl_legacy_connection_init_rx_config(priv, ctx); 1308 il_connection_init_rx_config(priv, ctx);
1309 1309
1310 if (priv->cfg->ops->hcmd->set_rxon_chain) 1310 if (priv->cfg->ops->hcmd->set_rxon_chain)
1311 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); 1311 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
1312 1312
1313 return iwl_legacy_commit_rxon(priv, ctx); 1313 return il_commit_rxon(priv, ctx);
1314} 1314}
1315 1315
1316static int iwl_legacy_setup_interface(struct iwl_priv *priv, 1316static int il_setup_interface(struct il_priv *priv,
1317 struct iwl_rxon_context *ctx) 1317 struct il_rxon_context *ctx)
1318{ 1318{
1319 struct ieee80211_vif *vif = ctx->vif; 1319 struct ieee80211_vif *vif = ctx->vif;
1320 int err; 1320 int err;
@@ -1330,7 +1330,7 @@ static int iwl_legacy_setup_interface(struct iwl_priv *priv,
1330 1330
1331 ctx->is_active = true; 1331 ctx->is_active = true;
1332 1332
1333 err = iwl_legacy_set_mode(priv, ctx); 1333 err = il_set_mode(priv, ctx);
1334 if (err) { 1334 if (err) {
1335 if (!ctx->always_active) 1335 if (!ctx->always_active)
1336 ctx->is_active = false; 1336 ctx->is_active = false;
@@ -1341,20 +1341,20 @@ static int iwl_legacy_setup_interface(struct iwl_priv *priv,
1341} 1341}
1342 1342
1343int 1343int
1344iwl_legacy_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1344il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1345{ 1345{
1346 struct iwl_priv *priv = hw->priv; 1346 struct il_priv *priv = hw->priv;
1347 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1347 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
1348 struct iwl_rxon_context *tmp, *ctx = NULL; 1348 struct il_rxon_context *tmp, *ctx = NULL;
1349 int err; 1349 int err;
1350 1350
1351 IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", 1351 IL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n",
1352 vif->type, vif->addr); 1352 vif->type, vif->addr);
1353 1353
1354 mutex_lock(&priv->mutex); 1354 mutex_lock(&priv->mutex);
1355 1355
1356 if (!iwl_legacy_is_ready_rf(priv)) { 1356 if (!il_is_ready_rf(priv)) {
1357 IWL_WARN(priv, "Try to add interface when device not ready\n"); 1357 IL_WARN(priv, "Try to add interface when device not ready\n");
1358 err = -EINVAL; 1358 err = -EINVAL;
1359 goto out; 1359 goto out;
1360 } 1360 }
@@ -1389,7 +1389,7 @@ iwl_legacy_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1389 vif_priv->ctx = ctx; 1389 vif_priv->ctx = ctx;
1390 ctx->vif = vif; 1390 ctx->vif = vif;
1391 1391
1392 err = iwl_legacy_setup_interface(priv, ctx); 1392 err = il_setup_interface(priv, ctx);
1393 if (!err) 1393 if (!err)
1394 goto out; 1394 goto out;
1395 1395
@@ -1398,95 +1398,95 @@ iwl_legacy_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1398 out: 1398 out:
1399 mutex_unlock(&priv->mutex); 1399 mutex_unlock(&priv->mutex);
1400 1400
1401 IWL_DEBUG_MAC80211(priv, "leave\n"); 1401 IL_DEBUG_MAC80211(priv, "leave\n");
1402 return err; 1402 return err;
1403} 1403}
1404EXPORT_SYMBOL(iwl_legacy_mac_add_interface); 1404EXPORT_SYMBOL(il_mac_add_interface);
1405 1405
1406static void iwl_legacy_teardown_interface(struct iwl_priv *priv, 1406static void il_teardown_interface(struct il_priv *priv,
1407 struct ieee80211_vif *vif, 1407 struct ieee80211_vif *vif,
1408 bool mode_change) 1408 bool mode_change)
1409{ 1409{
1410 struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); 1410 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
1411 1411
1412 lockdep_assert_held(&priv->mutex); 1412 lockdep_assert_held(&priv->mutex);
1413 1413
1414 if (priv->scan_vif == vif) { 1414 if (priv->scan_vif == vif) {
1415 iwl_legacy_scan_cancel_timeout(priv, 200); 1415 il_scan_cancel_timeout(priv, 200);
1416 iwl_legacy_force_scan_end(priv); 1416 il_force_scan_end(priv);
1417 } 1417 }
1418 1418
1419 if (!mode_change) { 1419 if (!mode_change) {
1420 iwl_legacy_set_mode(priv, ctx); 1420 il_set_mode(priv, ctx);
1421 if (!ctx->always_active) 1421 if (!ctx->always_active)
1422 ctx->is_active = false; 1422 ctx->is_active = false;
1423 } 1423 }
1424} 1424}
1425 1425
1426void iwl_legacy_mac_remove_interface(struct ieee80211_hw *hw, 1426void il_mac_remove_interface(struct ieee80211_hw *hw,
1427 struct ieee80211_vif *vif) 1427 struct ieee80211_vif *vif)
1428{ 1428{
1429 struct iwl_priv *priv = hw->priv; 1429 struct il_priv *priv = hw->priv;
1430 struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); 1430 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
1431 1431
1432 IWL_DEBUG_MAC80211(priv, "enter\n"); 1432 IL_DEBUG_MAC80211(priv, "enter\n");
1433 1433
1434 mutex_lock(&priv->mutex); 1434 mutex_lock(&priv->mutex);
1435 1435
1436 WARN_ON(ctx->vif != vif); 1436 WARN_ON(ctx->vif != vif);
1437 ctx->vif = NULL; 1437 ctx->vif = NULL;
1438 1438
1439 iwl_legacy_teardown_interface(priv, vif, false); 1439 il_teardown_interface(priv, vif, false);
1440 1440
1441 memset(priv->bssid, 0, ETH_ALEN); 1441 memset(priv->bssid, 0, ETH_ALEN);
1442 mutex_unlock(&priv->mutex); 1442 mutex_unlock(&priv->mutex);
1443 1443
1444 IWL_DEBUG_MAC80211(priv, "leave\n"); 1444 IL_DEBUG_MAC80211(priv, "leave\n");
1445 1445
1446} 1446}
1447EXPORT_SYMBOL(iwl_legacy_mac_remove_interface); 1447EXPORT_SYMBOL(il_mac_remove_interface);
1448 1448
1449int iwl_legacy_alloc_txq_mem(struct iwl_priv *priv) 1449int il_alloc_txq_mem(struct il_priv *priv)
1450{ 1450{
1451 if (!priv->txq) 1451 if (!priv->txq)
1452 priv->txq = kzalloc( 1452 priv->txq = kzalloc(
1453 sizeof(struct iwl_tx_queue) * 1453 sizeof(struct il_tx_queue) *
1454 priv->cfg->base_params->num_of_queues, 1454 priv->cfg->base_params->num_of_queues,
1455 GFP_KERNEL); 1455 GFP_KERNEL);
1456 if (!priv->txq) { 1456 if (!priv->txq) {
1457 IWL_ERR(priv, "Not enough memory for txq\n"); 1457 IL_ERR(priv, "Not enough memory for txq\n");
1458 return -ENOMEM; 1458 return -ENOMEM;
1459 } 1459 }
1460 return 0; 1460 return 0;
1461} 1461}
1462EXPORT_SYMBOL(iwl_legacy_alloc_txq_mem); 1462EXPORT_SYMBOL(il_alloc_txq_mem);
1463 1463
1464void iwl_legacy_txq_mem(struct iwl_priv *priv) 1464void il_txq_mem(struct il_priv *priv)
1465{ 1465{
1466 kfree(priv->txq); 1466 kfree(priv->txq);
1467 priv->txq = NULL; 1467 priv->txq = NULL;
1468} 1468}
1469EXPORT_SYMBOL(iwl_legacy_txq_mem); 1469EXPORT_SYMBOL(il_txq_mem);
1470 1470
1471#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 1471#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
1472 1472
1473#define IWL_TRAFFIC_DUMP_SIZE (IWL_TRAFFIC_ENTRY_SIZE * IWL_TRAFFIC_ENTRIES) 1473#define IL_TRAFFIC_DUMP_SIZE (IL_TRAFFIC_ENTRY_SIZE * IL_TRAFFIC_ENTRIES)
1474 1474
1475void iwl_legacy_reset_traffic_log(struct iwl_priv *priv) 1475void il_reset_traffic_log(struct il_priv *priv)
1476{ 1476{
1477 priv->tx_traffic_idx = 0; 1477 priv->tx_traffic_idx = 0;
1478 priv->rx_traffic_idx = 0; 1478 priv->rx_traffic_idx = 0;
1479 if (priv->tx_traffic) 1479 if (priv->tx_traffic)
1480 memset(priv->tx_traffic, 0, IWL_TRAFFIC_DUMP_SIZE); 1480 memset(priv->tx_traffic, 0, IL_TRAFFIC_DUMP_SIZE);
1481 if (priv->rx_traffic) 1481 if (priv->rx_traffic)
1482 memset(priv->rx_traffic, 0, IWL_TRAFFIC_DUMP_SIZE); 1482 memset(priv->rx_traffic, 0, IL_TRAFFIC_DUMP_SIZE);
1483} 1483}
1484 1484
1485int iwl_legacy_alloc_traffic_mem(struct iwl_priv *priv) 1485int il_alloc_traffic_mem(struct il_priv *priv)
1486{ 1486{
1487 u32 traffic_size = IWL_TRAFFIC_DUMP_SIZE; 1487 u32 traffic_size = IL_TRAFFIC_DUMP_SIZE;
1488 1488
1489 if (iwlegacy_debug_level & IWL_DL_TX) { 1489 if (iwlegacy_debug_level & IL_DL_TX) {
1490 if (!priv->tx_traffic) { 1490 if (!priv->tx_traffic) {
1491 priv->tx_traffic = 1491 priv->tx_traffic =
1492 kzalloc(traffic_size, GFP_KERNEL); 1492 kzalloc(traffic_size, GFP_KERNEL);
@@ -1494,7 +1494,7 @@ int iwl_legacy_alloc_traffic_mem(struct iwl_priv *priv)
1494 return -ENOMEM; 1494 return -ENOMEM;
1495 } 1495 }
1496 } 1496 }
1497 if (iwlegacy_debug_level & IWL_DL_RX) { 1497 if (iwlegacy_debug_level & IL_DL_RX) {
1498 if (!priv->rx_traffic) { 1498 if (!priv->rx_traffic) {
1499 priv->rx_traffic = 1499 priv->rx_traffic =
1500 kzalloc(traffic_size, GFP_KERNEL); 1500 kzalloc(traffic_size, GFP_KERNEL);
@@ -1502,12 +1502,12 @@ int iwl_legacy_alloc_traffic_mem(struct iwl_priv *priv)
1502 return -ENOMEM; 1502 return -ENOMEM;
1503 } 1503 }
1504 } 1504 }
1505 iwl_legacy_reset_traffic_log(priv); 1505 il_reset_traffic_log(priv);
1506 return 0; 1506 return 0;
1507} 1507}
1508EXPORT_SYMBOL(iwl_legacy_alloc_traffic_mem); 1508EXPORT_SYMBOL(il_alloc_traffic_mem);
1509 1509
1510void iwl_legacy_free_traffic_mem(struct iwl_priv *priv) 1510void il_free_traffic_mem(struct il_priv *priv)
1511{ 1511{
1512 kfree(priv->tx_traffic); 1512 kfree(priv->tx_traffic);
1513 priv->tx_traffic = NULL; 1513 priv->tx_traffic = NULL;
@@ -1515,15 +1515,15 @@ void iwl_legacy_free_traffic_mem(struct iwl_priv *priv)
1515 kfree(priv->rx_traffic); 1515 kfree(priv->rx_traffic);
1516 priv->rx_traffic = NULL; 1516 priv->rx_traffic = NULL;
1517} 1517}
1518EXPORT_SYMBOL(iwl_legacy_free_traffic_mem); 1518EXPORT_SYMBOL(il_free_traffic_mem);
1519 1519
1520void iwl_legacy_dbg_log_tx_data_frame(struct iwl_priv *priv, 1520void il_dbg_log_tx_data_frame(struct il_priv *priv,
1521 u16 length, struct ieee80211_hdr *header) 1521 u16 length, struct ieee80211_hdr *header)
1522{ 1522{
1523 __le16 fc; 1523 __le16 fc;
1524 u16 len; 1524 u16 len;
1525 1525
1526 if (likely(!(iwlegacy_debug_level & IWL_DL_TX))) 1526 if (likely(!(iwlegacy_debug_level & IL_DL_TX)))
1527 return; 1527 return;
1528 1528
1529 if (!priv->tx_traffic) 1529 if (!priv->tx_traffic)
@@ -1531,24 +1531,24 @@ void iwl_legacy_dbg_log_tx_data_frame(struct iwl_priv *priv,
1531 1531
1532 fc = header->frame_control; 1532 fc = header->frame_control;
1533 if (ieee80211_is_data(fc)) { 1533 if (ieee80211_is_data(fc)) {
1534 len = (length > IWL_TRAFFIC_ENTRY_SIZE) 1534 len = (length > IL_TRAFFIC_ENTRY_SIZE)
1535 ? IWL_TRAFFIC_ENTRY_SIZE : length; 1535 ? IL_TRAFFIC_ENTRY_SIZE : length;
1536 memcpy((priv->tx_traffic + 1536 memcpy((priv->tx_traffic +
1537 (priv->tx_traffic_idx * IWL_TRAFFIC_ENTRY_SIZE)), 1537 (priv->tx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)),
1538 header, len); 1538 header, len);
1539 priv->tx_traffic_idx = 1539 priv->tx_traffic_idx =
1540 (priv->tx_traffic_idx + 1) % IWL_TRAFFIC_ENTRIES; 1540 (priv->tx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES;
1541 } 1541 }
1542} 1542}
1543EXPORT_SYMBOL(iwl_legacy_dbg_log_tx_data_frame); 1543EXPORT_SYMBOL(il_dbg_log_tx_data_frame);
1544 1544
1545void iwl_legacy_dbg_log_rx_data_frame(struct iwl_priv *priv, 1545void il_dbg_log_rx_data_frame(struct il_priv *priv,
1546 u16 length, struct ieee80211_hdr *header) 1546 u16 length, struct ieee80211_hdr *header)
1547{ 1547{
1548 __le16 fc; 1548 __le16 fc;
1549 u16 len; 1549 u16 len;
1550 1550
1551 if (likely(!(iwlegacy_debug_level & IWL_DL_RX))) 1551 if (likely(!(iwlegacy_debug_level & IL_DL_RX)))
1552 return; 1552 return;
1553 1553
1554 if (!priv->rx_traffic) 1554 if (!priv->rx_traffic)
@@ -1556,56 +1556,56 @@ void iwl_legacy_dbg_log_rx_data_frame(struct iwl_priv *priv,
1556 1556
1557 fc = header->frame_control; 1557 fc = header->frame_control;
1558 if (ieee80211_is_data(fc)) { 1558 if (ieee80211_is_data(fc)) {
1559 len = (length > IWL_TRAFFIC_ENTRY_SIZE) 1559 len = (length > IL_TRAFFIC_ENTRY_SIZE)
1560 ? IWL_TRAFFIC_ENTRY_SIZE : length; 1560 ? IL_TRAFFIC_ENTRY_SIZE : length;
1561 memcpy((priv->rx_traffic + 1561 memcpy((priv->rx_traffic +
1562 (priv->rx_traffic_idx * IWL_TRAFFIC_ENTRY_SIZE)), 1562 (priv->rx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)),
1563 header, len); 1563 header, len);
1564 priv->rx_traffic_idx = 1564 priv->rx_traffic_idx =
1565 (priv->rx_traffic_idx + 1) % IWL_TRAFFIC_ENTRIES; 1565 (priv->rx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES;
1566 } 1566 }
1567} 1567}
1568EXPORT_SYMBOL(iwl_legacy_dbg_log_rx_data_frame); 1568EXPORT_SYMBOL(il_dbg_log_rx_data_frame);
1569 1569
1570const char *iwl_legacy_get_mgmt_string(int cmd) 1570const char *il_get_mgmt_string(int cmd)
1571{ 1571{
1572 switch (cmd) { 1572 switch (cmd) {
1573 IWL_CMD(MANAGEMENT_ASSOC_REQ); 1573 IL_CMD(MANAGEMENT_ASSOC_REQ);
1574 IWL_CMD(MANAGEMENT_ASSOC_RESP); 1574 IL_CMD(MANAGEMENT_ASSOC_RESP);
1575 IWL_CMD(MANAGEMENT_REASSOC_REQ); 1575 IL_CMD(MANAGEMENT_REASSOC_REQ);
1576 IWL_CMD(MANAGEMENT_REASSOC_RESP); 1576 IL_CMD(MANAGEMENT_REASSOC_RESP);
1577 IWL_CMD(MANAGEMENT_PROBE_REQ); 1577 IL_CMD(MANAGEMENT_PROBE_REQ);
1578 IWL_CMD(MANAGEMENT_PROBE_RESP); 1578 IL_CMD(MANAGEMENT_PROBE_RESP);
1579 IWL_CMD(MANAGEMENT_BEACON); 1579 IL_CMD(MANAGEMENT_BEACON);
1580 IWL_CMD(MANAGEMENT_ATIM); 1580 IL_CMD(MANAGEMENT_ATIM);
1581 IWL_CMD(MANAGEMENT_DISASSOC); 1581 IL_CMD(MANAGEMENT_DISASSOC);
1582 IWL_CMD(MANAGEMENT_AUTH); 1582 IL_CMD(MANAGEMENT_AUTH);
1583 IWL_CMD(MANAGEMENT_DEAUTH); 1583 IL_CMD(MANAGEMENT_DEAUTH);
1584 IWL_CMD(MANAGEMENT_ACTION); 1584 IL_CMD(MANAGEMENT_ACTION);
1585 default: 1585 default:
1586 return "UNKNOWN"; 1586 return "UNKNOWN";
1587 1587
1588 } 1588 }
1589} 1589}
1590 1590
1591const char *iwl_legacy_get_ctrl_string(int cmd) 1591const char *il_get_ctrl_string(int cmd)
1592{ 1592{
1593 switch (cmd) { 1593 switch (cmd) {
1594 IWL_CMD(CONTROL_BACK_REQ); 1594 IL_CMD(CONTROL_BACK_REQ);
1595 IWL_CMD(CONTROL_BACK); 1595 IL_CMD(CONTROL_BACK);
1596 IWL_CMD(CONTROL_PSPOLL); 1596 IL_CMD(CONTROL_PSPOLL);
1597 IWL_CMD(CONTROL_RTS); 1597 IL_CMD(CONTROL_RTS);
1598 IWL_CMD(CONTROL_CTS); 1598 IL_CMD(CONTROL_CTS);
1599 IWL_CMD(CONTROL_ACK); 1599 IL_CMD(CONTROL_ACK);
1600 IWL_CMD(CONTROL_CFEND); 1600 IL_CMD(CONTROL_CFEND);
1601 IWL_CMD(CONTROL_CFENDACK); 1601 IL_CMD(CONTROL_CFENDACK);
1602 default: 1602 default:
1603 return "UNKNOWN"; 1603 return "UNKNOWN";
1604 1604
1605 } 1605 }
1606} 1606}
1607 1607
1608void iwl_legacy_clear_traffic_stats(struct iwl_priv *priv) 1608void il_clear_traffic_stats(struct il_priv *priv)
1609{ 1609{
1610 memset(&priv->tx_stats, 0, sizeof(struct traffic_stats)); 1610 memset(&priv->tx_stats, 0, sizeof(struct traffic_stats));
1611 memset(&priv->rx_stats, 0, sizeof(struct traffic_stats)); 1611 memset(&priv->rx_stats, 0, sizeof(struct traffic_stats));
@@ -1613,17 +1613,17 @@ void iwl_legacy_clear_traffic_stats(struct iwl_priv *priv)
1613 1613
1614/* 1614/*
1615 * if CONFIG_IWLWIFI_LEGACY_DEBUGFS defined, 1615 * if CONFIG_IWLWIFI_LEGACY_DEBUGFS defined,
1616 * iwl_legacy_update_stats function will 1616 * il_update_stats function will
1617 * record all the MGMT, CTRL and DATA pkt for both TX and Rx pass 1617 * record all the MGMT, CTRL and DATA pkt for both TX and Rx pass
1618 * Use debugFs to display the rx/rx_statistics 1618 * Use debugFs to display the rx/rx_statistics
1619 * if CONFIG_IWLWIFI_LEGACY_DEBUGFS not being defined, then no MGMT and CTRL 1619 * if CONFIG_IWLWIFI_LEGACY_DEBUGFS not being defined, then no MGMT and CTRL
1620 * information will be recorded, but DATA pkt still will be recorded 1620 * information will be recorded, but DATA pkt still will be recorded
1621 * for the reason of iwl_led.c need to control the led blinking based on 1621 * for the reason of il_led.c need to control the led blinking based on
1622 * number of tx and rx data. 1622 * number of tx and rx data.
1623 * 1623 *
1624 */ 1624 */
1625void 1625void
1626iwl_legacy_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, u16 len) 1626il_update_stats(struct il_priv *priv, bool is_tx, __le16 fc, u16 len)
1627{ 1627{
1628 struct traffic_stats *stats; 1628 struct traffic_stats *stats;
1629 1629
@@ -1704,12 +1704,12 @@ iwl_legacy_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, u16 len)
1704 stats->data_bytes += len; 1704 stats->data_bytes += len;
1705 } 1705 }
1706} 1706}
1707EXPORT_SYMBOL(iwl_legacy_update_stats); 1707EXPORT_SYMBOL(il_update_stats);
1708#endif 1708#endif
1709 1709
1710int iwl_legacy_force_reset(struct iwl_priv *priv, bool external) 1710int il_force_reset(struct il_priv *priv, bool external)
1711{ 1711{
1712 struct iwl_force_reset *force_reset; 1712 struct il_force_reset *force_reset;
1713 1713
1714 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1714 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
1715 return -EINVAL; 1715 return -EINVAL;
@@ -1720,7 +1720,7 @@ int iwl_legacy_force_reset(struct iwl_priv *priv, bool external)
1720 if (force_reset->last_force_reset_jiffies && 1720 if (force_reset->last_force_reset_jiffies &&
1721 time_after(force_reset->last_force_reset_jiffies + 1721 time_after(force_reset->last_force_reset_jiffies +
1722 force_reset->reset_duration, jiffies)) { 1722 force_reset->reset_duration, jiffies)) {
1723 IWL_DEBUG_INFO(priv, "force reset rejected\n"); 1723 IL_DEBUG_INFO(priv, "force reset rejected\n");
1724 force_reset->reset_reject_count++; 1724 force_reset->reset_reject_count++;
1725 return -EAGAIN; 1725 return -EAGAIN;
1726 } 1726 }
@@ -1738,14 +1738,14 @@ int iwl_legacy_force_reset(struct iwl_priv *priv, bool external)
1738 */ 1738 */
1739 1739
1740 if (!external && !priv->cfg->mod_params->restart_fw) { 1740 if (!external && !priv->cfg->mod_params->restart_fw) {
1741 IWL_DEBUG_INFO(priv, "Cancel firmware reload based on " 1741 IL_DEBUG_INFO(priv, "Cancel firmware reload based on "
1742 "module parameter setting\n"); 1742 "module parameter setting\n");
1743 return 0; 1743 return 0;
1744 } 1744 }
1745 1745
1746 IWL_ERR(priv, "On demand firmware reload\n"); 1746 IL_ERR(priv, "On demand firmware reload\n");
1747 1747
1748 /* Set the FW error flag -- cleared on iwl_down */ 1748 /* Set the FW error flag -- cleared on il_down */
1749 set_bit(STATUS_FW_ERROR, &priv->status); 1749 set_bit(STATUS_FW_ERROR, &priv->status);
1750 wake_up(&priv->wait_command_queue); 1750 wake_up(&priv->wait_command_queue);
1751 /* 1751 /*
@@ -1759,13 +1759,13 @@ int iwl_legacy_force_reset(struct iwl_priv *priv, bool external)
1759} 1759}
1760 1760
1761int 1761int
1762iwl_legacy_mac_change_interface(struct ieee80211_hw *hw, 1762il_mac_change_interface(struct ieee80211_hw *hw,
1763 struct ieee80211_vif *vif, 1763 struct ieee80211_vif *vif,
1764 enum nl80211_iftype newtype, bool newp2p) 1764 enum nl80211_iftype newtype, bool newp2p)
1765{ 1765{
1766 struct iwl_priv *priv = hw->priv; 1766 struct il_priv *priv = hw->priv;
1767 struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); 1767 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
1768 struct iwl_rxon_context *tmp; 1768 struct il_rxon_context *tmp;
1769 u32 interface_modes; 1769 u32 interface_modes;
1770 int err; 1770 int err;
1771 1771
@@ -1773,7 +1773,7 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw,
1773 1773
1774 mutex_lock(&priv->mutex); 1774 mutex_lock(&priv->mutex);
1775 1775
1776 if (!ctx->vif || !iwl_legacy_is_ready_rf(priv)) { 1776 if (!ctx->vif || !il_is_ready_rf(priv)) {
1777 /* 1777 /*
1778 * Huh? But wait ... this can maybe happen when 1778 * Huh? But wait ... this can maybe happen when
1779 * we're in the middle of a firmware restart! 1779 * we're in the middle of a firmware restart!
@@ -1807,10 +1807,10 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw,
1807 } 1807 }
1808 1808
1809 /* success */ 1809 /* success */
1810 iwl_legacy_teardown_interface(priv, vif, true); 1810 il_teardown_interface(priv, vif, true);
1811 vif->type = newtype; 1811 vif->type = newtype;
1812 vif->p2p = newp2p; 1812 vif->p2p = newp2p;
1813 err = iwl_legacy_setup_interface(priv, ctx); 1813 err = il_setup_interface(priv, ctx);
1814 WARN_ON(err); 1814 WARN_ON(err);
1815 /* 1815 /*
1816 * We've switched internally, but submitting to the 1816 * We've switched internally, but submitting to the
@@ -1825,16 +1825,16 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw,
1825 mutex_unlock(&priv->mutex); 1825 mutex_unlock(&priv->mutex);
1826 return err; 1826 return err;
1827} 1827}
1828EXPORT_SYMBOL(iwl_legacy_mac_change_interface); 1828EXPORT_SYMBOL(il_mac_change_interface);
1829 1829
1830/* 1830/*
1831 * On every watchdog tick we check (latest) time stamp. If it does not 1831 * On every watchdog tick we check (latest) time stamp. If it does not
1832 * change during timeout period and queue is not empty we reset firmware. 1832 * change during timeout period and queue is not empty we reset firmware.
1833 */ 1833 */
1834static int iwl_legacy_check_stuck_queue(struct iwl_priv *priv, int cnt) 1834static int il_check_stuck_queue(struct il_priv *priv, int cnt)
1835{ 1835{
1836 struct iwl_tx_queue *txq = &priv->txq[cnt]; 1836 struct il_tx_queue *txq = &priv->txq[cnt];
1837 struct iwl_queue *q = &txq->q; 1837 struct il_queue *q = &txq->q;
1838 unsigned long timeout; 1838 unsigned long timeout;
1839 int ret; 1839 int ret;
1840 1840
@@ -1847,9 +1847,9 @@ static int iwl_legacy_check_stuck_queue(struct iwl_priv *priv, int cnt)
1847 msecs_to_jiffies(priv->cfg->base_params->wd_timeout); 1847 msecs_to_jiffies(priv->cfg->base_params->wd_timeout);
1848 1848
1849 if (time_after(jiffies, timeout)) { 1849 if (time_after(jiffies, timeout)) {
1850 IWL_ERR(priv, "Queue %d stuck for %u ms.\n", 1850 IL_ERR(priv, "Queue %d stuck for %u ms.\n",
1851 q->id, priv->cfg->base_params->wd_timeout); 1851 q->id, priv->cfg->base_params->wd_timeout);
1852 ret = iwl_legacy_force_reset(priv, false); 1852 ret = il_force_reset(priv, false);
1853 return (ret == -EAGAIN) ? 0 : 1; 1853 return (ret == -EAGAIN) ? 0 : 1;
1854 } 1854 }
1855 1855
@@ -1860,15 +1860,15 @@ static int iwl_legacy_check_stuck_queue(struct iwl_priv *priv, int cnt)
1860 * Making watchdog tick be a quarter of timeout assure we will 1860 * Making watchdog tick be a quarter of timeout assure we will
1861 * discover the queue hung between timeout and 1.25*timeout 1861 * discover the queue hung between timeout and 1.25*timeout
1862 */ 1862 */
1863#define IWL_WD_TICK(timeout) ((timeout) / 4) 1863#define IL_WD_TICK(timeout) ((timeout) / 4)
1864 1864
1865/* 1865/*
1866 * Watchdog timer callback, we check each tx queue for stuck, if if hung 1866 * Watchdog timer callback, we check each tx queue for stuck, if if hung
1867 * we reset the firmware. If everything is fine just rearm the timer. 1867 * we reset the firmware. If everything is fine just rearm the timer.
1868 */ 1868 */
1869void iwl_legacy_bg_watchdog(unsigned long data) 1869void il_bg_watchdog(unsigned long data)
1870{ 1870{
1871 struct iwl_priv *priv = (struct iwl_priv *)data; 1871 struct il_priv *priv = (struct il_priv *)data;
1872 int cnt; 1872 int cnt;
1873 unsigned long timeout; 1873 unsigned long timeout;
1874 1874
@@ -1880,36 +1880,36 @@ void iwl_legacy_bg_watchdog(unsigned long data)
1880 return; 1880 return;
1881 1881
1882 /* monitor and check for stuck cmd queue */ 1882 /* monitor and check for stuck cmd queue */
1883 if (iwl_legacy_check_stuck_queue(priv, priv->cmd_queue)) 1883 if (il_check_stuck_queue(priv, priv->cmd_queue))
1884 return; 1884 return;
1885 1885
1886 /* monitor and check for other stuck queues */ 1886 /* monitor and check for other stuck queues */
1887 if (iwl_legacy_is_any_associated(priv)) { 1887 if (il_is_any_associated(priv)) {
1888 for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { 1888 for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) {
1889 /* skip as we already checked the command queue */ 1889 /* skip as we already checked the command queue */
1890 if (cnt == priv->cmd_queue) 1890 if (cnt == priv->cmd_queue)
1891 continue; 1891 continue;
1892 if (iwl_legacy_check_stuck_queue(priv, cnt)) 1892 if (il_check_stuck_queue(priv, cnt))
1893 return; 1893 return;
1894 } 1894 }
1895 } 1895 }
1896 1896
1897 mod_timer(&priv->watchdog, jiffies + 1897 mod_timer(&priv->watchdog, jiffies +
1898 msecs_to_jiffies(IWL_WD_TICK(timeout))); 1898 msecs_to_jiffies(IL_WD_TICK(timeout)));
1899} 1899}
1900EXPORT_SYMBOL(iwl_legacy_bg_watchdog); 1900EXPORT_SYMBOL(il_bg_watchdog);
1901 1901
1902void iwl_legacy_setup_watchdog(struct iwl_priv *priv) 1902void il_setup_watchdog(struct il_priv *priv)
1903{ 1903{
1904 unsigned int timeout = priv->cfg->base_params->wd_timeout; 1904 unsigned int timeout = priv->cfg->base_params->wd_timeout;
1905 1905
1906 if (timeout) 1906 if (timeout)
1907 mod_timer(&priv->watchdog, 1907 mod_timer(&priv->watchdog,
1908 jiffies + msecs_to_jiffies(IWL_WD_TICK(timeout))); 1908 jiffies + msecs_to_jiffies(IL_WD_TICK(timeout)));
1909 else 1909 else
1910 del_timer(&priv->watchdog); 1910 del_timer(&priv->watchdog);
1911} 1911}
1912EXPORT_SYMBOL(iwl_legacy_setup_watchdog); 1912EXPORT_SYMBOL(il_setup_watchdog);
1913 1913
1914/* 1914/*
1915 * extended beacon time format 1915 * extended beacon time format
@@ -1918,7 +1918,7 @@ EXPORT_SYMBOL(iwl_legacy_setup_watchdog);
1918 * the internal part is the time in usec within one beacon interval 1918 * the internal part is the time in usec within one beacon interval
1919 */ 1919 */
1920u32 1920u32
1921iwl_legacy_usecs_to_beacons(struct iwl_priv *priv, 1921il_usecs_to_beacons(struct il_priv *priv,
1922 u32 usec, u32 beacon_interval) 1922 u32 usec, u32 beacon_interval)
1923{ 1923{
1924 u32 quot; 1924 u32 quot;
@@ -1929,30 +1929,30 @@ iwl_legacy_usecs_to_beacons(struct iwl_priv *priv,
1929 return 0; 1929 return 0;
1930 1930
1931 quot = (usec / interval) & 1931 quot = (usec / interval) &
1932 (iwl_legacy_beacon_time_mask_high(priv, 1932 (il_beacon_time_mask_high(priv,
1933 priv->hw_params.beacon_time_tsf_bits) >> 1933 priv->hw_params.beacon_time_tsf_bits) >>
1934 priv->hw_params.beacon_time_tsf_bits); 1934 priv->hw_params.beacon_time_tsf_bits);
1935 rem = (usec % interval) & iwl_legacy_beacon_time_mask_low(priv, 1935 rem = (usec % interval) & il_beacon_time_mask_low(priv,
1936 priv->hw_params.beacon_time_tsf_bits); 1936 priv->hw_params.beacon_time_tsf_bits);
1937 1937
1938 return (quot << priv->hw_params.beacon_time_tsf_bits) + rem; 1938 return (quot << priv->hw_params.beacon_time_tsf_bits) + rem;
1939} 1939}
1940EXPORT_SYMBOL(iwl_legacy_usecs_to_beacons); 1940EXPORT_SYMBOL(il_usecs_to_beacons);
1941 1941
1942/* base is usually what we get from ucode with each received frame, 1942/* base is usually what we get from ucode with each received frame,
1943 * the same as HW timer counter counting down 1943 * the same as HW timer counter counting down
1944 */ 1944 */
1945__le32 iwl_legacy_add_beacon_time(struct iwl_priv *priv, u32 base, 1945__le32 il_add_beacon_time(struct il_priv *priv, u32 base,
1946 u32 addon, u32 beacon_interval) 1946 u32 addon, u32 beacon_interval)
1947{ 1947{
1948 u32 base_low = base & iwl_legacy_beacon_time_mask_low(priv, 1948 u32 base_low = base & il_beacon_time_mask_low(priv,
1949 priv->hw_params.beacon_time_tsf_bits); 1949 priv->hw_params.beacon_time_tsf_bits);
1950 u32 addon_low = addon & iwl_legacy_beacon_time_mask_low(priv, 1950 u32 addon_low = addon & il_beacon_time_mask_low(priv,
1951 priv->hw_params.beacon_time_tsf_bits); 1951 priv->hw_params.beacon_time_tsf_bits);
1952 u32 interval = beacon_interval * TIME_UNIT; 1952 u32 interval = beacon_interval * TIME_UNIT;
1953 u32 res = (base & iwl_legacy_beacon_time_mask_high(priv, 1953 u32 res = (base & il_beacon_time_mask_high(priv,
1954 priv->hw_params.beacon_time_tsf_bits)) + 1954 priv->hw_params.beacon_time_tsf_bits)) +
1955 (addon & iwl_legacy_beacon_time_mask_high(priv, 1955 (addon & il_beacon_time_mask_high(priv,
1956 priv->hw_params.beacon_time_tsf_bits)); 1956 priv->hw_params.beacon_time_tsf_bits));
1957 1957
1958 if (base_low > addon_low) 1958 if (base_low > addon_low)
@@ -1965,32 +1965,32 @@ __le32 iwl_legacy_add_beacon_time(struct iwl_priv *priv, u32 base,
1965 1965
1966 return cpu_to_le32(res); 1966 return cpu_to_le32(res);
1967} 1967}
1968EXPORT_SYMBOL(iwl_legacy_add_beacon_time); 1968EXPORT_SYMBOL(il_add_beacon_time);
1969 1969
1970#ifdef CONFIG_PM 1970#ifdef CONFIG_PM
1971 1971
1972int iwl_legacy_pci_suspend(struct device *device) 1972int il_pci_suspend(struct device *device)
1973{ 1973{
1974 struct pci_dev *pdev = to_pci_dev(device); 1974 struct pci_dev *pdev = to_pci_dev(device);
1975 struct iwl_priv *priv = pci_get_drvdata(pdev); 1975 struct il_priv *priv = pci_get_drvdata(pdev);
1976 1976
1977 /* 1977 /*
1978 * This function is called when system goes into suspend state 1978 * This function is called when system goes into suspend state
1979 * mac80211 will call iwl_mac_stop() from the mac80211 suspend function 1979 * mac80211 will call il_mac_stop() from the mac80211 suspend function
1980 * first but since iwl_mac_stop() has no knowledge of who the caller is, 1980 * first but since il_mac_stop() has no knowledge of who the caller is,
1981 * it will not call apm_ops.stop() to stop the DMA operation. 1981 * it will not call apm_ops.stop() to stop the DMA operation.
1982 * Calling apm_ops.stop here to make sure we stop the DMA. 1982 * Calling apm_ops.stop here to make sure we stop the DMA.
1983 */ 1983 */
1984 iwl_legacy_apm_stop(priv); 1984 il_apm_stop(priv);
1985 1985
1986 return 0; 1986 return 0;
1987} 1987}
1988EXPORT_SYMBOL(iwl_legacy_pci_suspend); 1988EXPORT_SYMBOL(il_pci_suspend);
1989 1989
1990int iwl_legacy_pci_resume(struct device *device) 1990int il_pci_resume(struct device *device)
1991{ 1991{
1992 struct pci_dev *pdev = to_pci_dev(device); 1992 struct pci_dev *pdev = to_pci_dev(device);
1993 struct iwl_priv *priv = pci_get_drvdata(pdev); 1993 struct il_priv *priv = pci_get_drvdata(pdev);
1994 bool hw_rfkill = false; 1994 bool hw_rfkill = false;
1995 1995
1996 /* 1996 /*
@@ -1999,9 +1999,9 @@ int iwl_legacy_pci_resume(struct device *device)
1999 */ 1999 */
2000 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); 2000 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);
2001 2001
2002 iwl_legacy_enable_interrupts(priv); 2002 il_enable_interrupts(priv);
2003 2003
2004 if (!(iwl_read32(priv, CSR_GP_CNTRL) & 2004 if (!(il_read32(priv, CSR_GP_CNTRL) &
2005 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) 2005 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
2006 hw_rfkill = true; 2006 hw_rfkill = true;
2007 2007
@@ -2014,22 +2014,22 @@ int iwl_legacy_pci_resume(struct device *device)
2014 2014
2015 return 0; 2015 return 0;
2016} 2016}
2017EXPORT_SYMBOL(iwl_legacy_pci_resume); 2017EXPORT_SYMBOL(il_pci_resume);
2018 2018
2019const struct dev_pm_ops iwl_legacy_pm_ops = { 2019const struct dev_pm_ops il_pm_ops = {
2020 .suspend = iwl_legacy_pci_suspend, 2020 .suspend = il_pci_suspend,
2021 .resume = iwl_legacy_pci_resume, 2021 .resume = il_pci_resume,
2022 .freeze = iwl_legacy_pci_suspend, 2022 .freeze = il_pci_suspend,
2023 .thaw = iwl_legacy_pci_resume, 2023 .thaw = il_pci_resume,
2024 .poweroff = iwl_legacy_pci_suspend, 2024 .poweroff = il_pci_suspend,
2025 .restore = iwl_legacy_pci_resume, 2025 .restore = il_pci_resume,
2026}; 2026};
2027EXPORT_SYMBOL(iwl_legacy_pm_ops); 2027EXPORT_SYMBOL(il_pm_ops);
2028 2028
2029#endif /* CONFIG_PM */ 2029#endif /* CONFIG_PM */
2030 2030
2031static void 2031static void
2032iwl_legacy_update_qos(struct iwl_priv *priv, struct iwl_rxon_context *ctx) 2032il_update_qos(struct il_priv *priv, struct il_rxon_context *ctx)
2033{ 2033{
2034 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2034 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2035 return; 2035 return;
@@ -2046,43 +2046,43 @@ iwl_legacy_update_qos(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
2046 if (ctx->ht.enabled) 2046 if (ctx->ht.enabled)
2047 ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; 2047 ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK;
2048 2048
2049 IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", 2049 IL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n",
2050 ctx->qos_data.qos_active, 2050 ctx->qos_data.qos_active,
2051 ctx->qos_data.def_qos_parm.qos_flags); 2051 ctx->qos_data.def_qos_parm.qos_flags);
2052 2052
2053 iwl_legacy_send_cmd_pdu_async(priv, ctx->qos_cmd, 2053 il_send_cmd_pdu_async(priv, ctx->qos_cmd,
2054 sizeof(struct iwl_qosparam_cmd), 2054 sizeof(struct il_qosparam_cmd),
2055 &ctx->qos_data.def_qos_parm, NULL); 2055 &ctx->qos_data.def_qos_parm, NULL);
2056} 2056}
2057 2057
2058/** 2058/**
2059 * iwl_legacy_mac_config - mac80211 config callback 2059 * il_mac_config - mac80211 config callback
2060 */ 2060 */
2061int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed) 2061int il_mac_config(struct ieee80211_hw *hw, u32 changed)
2062{ 2062{
2063 struct iwl_priv *priv = hw->priv; 2063 struct il_priv *priv = hw->priv;
2064 const struct iwl_channel_info *ch_info; 2064 const struct il_channel_info *ch_info;
2065 struct ieee80211_conf *conf = &hw->conf; 2065 struct ieee80211_conf *conf = &hw->conf;
2066 struct ieee80211_channel *channel = conf->channel; 2066 struct ieee80211_channel *channel = conf->channel;
2067 struct iwl_ht_config *ht_conf = &priv->current_ht_config; 2067 struct il_ht_config *ht_conf = &priv->current_ht_config;
2068 struct iwl_rxon_context *ctx; 2068 struct il_rxon_context *ctx;
2069 unsigned long flags = 0; 2069 unsigned long flags = 0;
2070 int ret = 0; 2070 int ret = 0;
2071 u16 ch; 2071 u16 ch;
2072 int scan_active = 0; 2072 int scan_active = 0;
2073 bool ht_changed[NUM_IWL_RXON_CTX] = {}; 2073 bool ht_changed[NUM_IL_RXON_CTX] = {};
2074 2074
2075 if (WARN_ON(!priv->cfg->ops->legacy)) 2075 if (WARN_ON(!priv->cfg->ops->legacy))
2076 return -EOPNOTSUPP; 2076 return -EOPNOTSUPP;
2077 2077
2078 mutex_lock(&priv->mutex); 2078 mutex_lock(&priv->mutex);
2079 2079
2080 IWL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n", 2080 IL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n",
2081 channel->hw_value, changed); 2081 channel->hw_value, changed);
2082 2082
2083 if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) { 2083 if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) {
2084 scan_active = 1; 2084 scan_active = 1;
2085 IWL_DEBUG_MAC80211(priv, "scan active\n"); 2085 IL_DEBUG_MAC80211(priv, "scan active\n");
2086 } 2086 }
2087 2087
2088 if (changed & (IEEE80211_CONF_CHANGE_SMPS | 2088 if (changed & (IEEE80211_CONF_CHANGE_SMPS |
@@ -2110,16 +2110,16 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed)
2110 goto set_ch_out; 2110 goto set_ch_out;
2111 2111
2112 ch = channel->hw_value; 2112 ch = channel->hw_value;
2113 ch_info = iwl_legacy_get_channel_info(priv, channel->band, ch); 2113 ch_info = il_get_channel_info(priv, channel->band, ch);
2114 if (!iwl_legacy_is_channel_valid(ch_info)) { 2114 if (!il_is_channel_valid(ch_info)) {
2115 IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n"); 2115 IL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
2116 ret = -EINVAL; 2116 ret = -EINVAL;
2117 goto set_ch_out; 2117 goto set_ch_out;
2118 } 2118 }
2119 2119
2120 if (priv->iw_mode == NL80211_IFTYPE_ADHOC && 2120 if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
2121 !iwl_legacy_is_channel_ibss(ch_info)) { 2121 !il_is_channel_ibss(ch_info)) {
2122 IWL_DEBUG_MAC80211(priv, "leave - not IBSS channel\n"); 2122 IL_DEBUG_MAC80211(priv, "leave - not IBSS channel\n");
2123 ret = -EINVAL; 2123 ret = -EINVAL;
2124 goto set_ch_out; 2124 goto set_ch_out;
2125 } 2125 }
@@ -2151,7 +2151,7 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed)
2151 2151
2152 /* 2152 /*
2153 * Default to no protection. Protection mode will 2153 * Default to no protection. Protection mode will
2154 * later be set from BSS config in iwl_ht_conf 2154 * later be set from BSS config in il_ht_conf
2155 */ 2155 */
2156 ctx->ht.protection = 2156 ctx->ht.protection =
2157 IEEE80211_HT_OP_MODE_PROTECTION_NONE; 2157 IEEE80211_HT_OP_MODE_PROTECTION_NONE;
@@ -2162,10 +2162,10 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed)
2162 if ((le16_to_cpu(ctx->staging.channel) != ch)) 2162 if ((le16_to_cpu(ctx->staging.channel) != ch))
2163 ctx->staging.flags = 0; 2163 ctx->staging.flags = 0;
2164 2164
2165 iwl_legacy_set_rxon_channel(priv, channel, ctx); 2165 il_set_rxon_channel(priv, channel, ctx);
2166 iwl_legacy_set_rxon_ht(priv, ht_conf); 2166 il_set_rxon_ht(priv, ht_conf);
2167 2167
2168 iwl_legacy_set_flags_for_band(priv, ctx, channel->band, 2168 il_set_flags_for_band(priv, ctx, channel->band,
2169 ctx->vif); 2169 ctx->vif);
2170 } 2170 }
2171 2171
@@ -2179,25 +2179,25 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed)
2179 /* The list of supported rates and rate mask can be different 2179 /* The list of supported rates and rate mask can be different
2180 * for each band; since the band may have changed, reset 2180 * for each band; since the band may have changed, reset
2181 * the rate mask to what mac80211 lists */ 2181 * the rate mask to what mac80211 lists */
2182 iwl_legacy_set_rate(priv); 2182 il_set_rate(priv);
2183 } 2183 }
2184 2184
2185 if (changed & (IEEE80211_CONF_CHANGE_PS | 2185 if (changed & (IEEE80211_CONF_CHANGE_PS |
2186 IEEE80211_CONF_CHANGE_IDLE)) { 2186 IEEE80211_CONF_CHANGE_IDLE)) {
2187 ret = iwl_legacy_power_update_mode(priv, false); 2187 ret = il_power_update_mode(priv, false);
2188 if (ret) 2188 if (ret)
2189 IWL_DEBUG_MAC80211(priv, "Error setting sleep level\n"); 2189 IL_DEBUG_MAC80211(priv, "Error setting sleep level\n");
2190 } 2190 }
2191 2191
2192 if (changed & IEEE80211_CONF_CHANGE_POWER) { 2192 if (changed & IEEE80211_CONF_CHANGE_POWER) {
2193 IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n", 2193 IL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n",
2194 priv->tx_power_user_lmt, conf->power_level); 2194 priv->tx_power_user_lmt, conf->power_level);
2195 2195
2196 iwl_legacy_set_tx_power(priv, conf->power_level, false); 2196 il_set_tx_power(priv, conf->power_level, false);
2197 } 2197 }
2198 2198
2199 if (!iwl_legacy_is_ready(priv)) { 2199 if (!il_is_ready(priv)) {
2200 IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); 2200 IL_DEBUG_MAC80211(priv, "leave - not ready\n");
2201 goto out; 2201 goto out;
2202 } 2202 }
2203 2203
@@ -2206,37 +2206,37 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed)
2206 2206
2207 for_each_context(priv, ctx) { 2207 for_each_context(priv, ctx) {
2208 if (memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging))) 2208 if (memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)))
2209 iwl_legacy_commit_rxon(priv, ctx); 2209 il_commit_rxon(priv, ctx);
2210 else 2210 else
2211 IWL_DEBUG_INFO(priv, 2211 IL_DEBUG_INFO(priv,
2212 "Not re-sending same RXON configuration.\n"); 2212 "Not re-sending same RXON configuration.\n");
2213 if (ht_changed[ctx->ctxid]) 2213 if (ht_changed[ctx->ctxid])
2214 iwl_legacy_update_qos(priv, ctx); 2214 il_update_qos(priv, ctx);
2215 } 2215 }
2216 2216
2217out: 2217out:
2218 IWL_DEBUG_MAC80211(priv, "leave\n"); 2218 IL_DEBUG_MAC80211(priv, "leave\n");
2219 mutex_unlock(&priv->mutex); 2219 mutex_unlock(&priv->mutex);
2220 return ret; 2220 return ret;
2221} 2221}
2222EXPORT_SYMBOL(iwl_legacy_mac_config); 2222EXPORT_SYMBOL(il_mac_config);
2223 2223
2224void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw, 2224void il_mac_reset_tsf(struct ieee80211_hw *hw,
2225 struct ieee80211_vif *vif) 2225 struct ieee80211_vif *vif)
2226{ 2226{
2227 struct iwl_priv *priv = hw->priv; 2227 struct il_priv *priv = hw->priv;
2228 unsigned long flags; 2228 unsigned long flags;
2229 /* IBSS can only be the IWL_RXON_CTX_BSS context */ 2229 /* IBSS can only be the IL_RXON_CTX_BSS context */
2230 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2230 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2231 2231
2232 if (WARN_ON(!priv->cfg->ops->legacy)) 2232 if (WARN_ON(!priv->cfg->ops->legacy))
2233 return; 2233 return;
2234 2234
2235 mutex_lock(&priv->mutex); 2235 mutex_lock(&priv->mutex);
2236 IWL_DEBUG_MAC80211(priv, "enter\n"); 2236 IL_DEBUG_MAC80211(priv, "enter\n");
2237 2237
2238 spin_lock_irqsave(&priv->lock, flags); 2238 spin_lock_irqsave(&priv->lock, flags);
2239 memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_config)); 2239 memset(&priv->current_ht_config, 0, sizeof(struct il_ht_config));
2240 spin_unlock_irqrestore(&priv->lock, flags); 2240 spin_unlock_irqrestore(&priv->lock, flags);
2241 2241
2242 spin_lock_irqsave(&priv->lock, flags); 2242 spin_lock_irqsave(&priv->lock, flags);
@@ -2251,9 +2251,9 @@ void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw,
2251 2251
2252 spin_unlock_irqrestore(&priv->lock, flags); 2252 spin_unlock_irqrestore(&priv->lock, flags);
2253 2253
2254 iwl_legacy_scan_cancel_timeout(priv, 100); 2254 il_scan_cancel_timeout(priv, 100);
2255 if (!iwl_legacy_is_ready_rf(priv)) { 2255 if (!il_is_ready_rf(priv)) {
2256 IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); 2256 IL_DEBUG_MAC80211(priv, "leave - not ready\n");
2257 mutex_unlock(&priv->mutex); 2257 mutex_unlock(&priv->mutex);
2258 return; 2258 return;
2259 } 2259 }
@@ -2262,25 +2262,25 @@ void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw,
2262 * clear RXON_FILTER_ASSOC_MSK bit 2262 * clear RXON_FILTER_ASSOC_MSK bit
2263 */ 2263 */
2264 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2264 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2265 iwl_legacy_commit_rxon(priv, ctx); 2265 il_commit_rxon(priv, ctx);
2266 2266
2267 iwl_legacy_set_rate(priv); 2267 il_set_rate(priv);
2268 2268
2269 mutex_unlock(&priv->mutex); 2269 mutex_unlock(&priv->mutex);
2270 2270
2271 IWL_DEBUG_MAC80211(priv, "leave\n"); 2271 IL_DEBUG_MAC80211(priv, "leave\n");
2272} 2272}
2273EXPORT_SYMBOL(iwl_legacy_mac_reset_tsf); 2273EXPORT_SYMBOL(il_mac_reset_tsf);
2274 2274
2275static void iwl_legacy_ht_conf(struct iwl_priv *priv, 2275static void il_ht_conf(struct il_priv *priv,
2276 struct ieee80211_vif *vif) 2276 struct ieee80211_vif *vif)
2277{ 2277{
2278 struct iwl_ht_config *ht_conf = &priv->current_ht_config; 2278 struct il_ht_config *ht_conf = &priv->current_ht_config;
2279 struct ieee80211_sta *sta; 2279 struct ieee80211_sta *sta;
2280 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; 2280 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
2281 struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); 2281 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
2282 2282
2283 IWL_DEBUG_ASSOC(priv, "enter:\n"); 2283 IL_DEBUG_ASSOC(priv, "enter:\n");
2284 2284
2285 if (!ctx->ht.enabled) 2285 if (!ctx->ht.enabled)
2286 return; 2286 return;
@@ -2329,13 +2329,13 @@ static void iwl_legacy_ht_conf(struct iwl_priv *priv,
2329 break; 2329 break;
2330 } 2330 }
2331 2331
2332 IWL_DEBUG_ASSOC(priv, "leave\n"); 2332 IL_DEBUG_ASSOC(priv, "leave\n");
2333} 2333}
2334 2334
2335static inline void iwl_legacy_set_no_assoc(struct iwl_priv *priv, 2335static inline void il_set_no_assoc(struct il_priv *priv,
2336 struct ieee80211_vif *vif) 2336 struct ieee80211_vif *vif)
2337{ 2337{
2338 struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); 2338 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
2339 2339
2340 /* 2340 /*
2341 * inform the ucode that there is no longer an 2341 * inform the ucode that there is no longer an
@@ -2344,13 +2344,13 @@ static inline void iwl_legacy_set_no_assoc(struct iwl_priv *priv,
2344 */ 2344 */
2345 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2345 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2346 ctx->staging.assoc_id = 0; 2346 ctx->staging.assoc_id = 0;
2347 iwl_legacy_commit_rxon(priv, ctx); 2347 il_commit_rxon(priv, ctx);
2348} 2348}
2349 2349
2350static void iwl_legacy_beacon_update(struct ieee80211_hw *hw, 2350static void il_beacon_update(struct ieee80211_hw *hw,
2351 struct ieee80211_vif *vif) 2351 struct ieee80211_vif *vif)
2352{ 2352{
2353 struct iwl_priv *priv = hw->priv; 2353 struct il_priv *priv = hw->priv;
2354 unsigned long flags; 2354 unsigned long flags;
2355 __le64 timestamp; 2355 __le64 timestamp;
2356 struct sk_buff *skb = ieee80211_beacon_get(hw, vif); 2356 struct sk_buff *skb = ieee80211_beacon_get(hw, vif);
@@ -2358,12 +2358,12 @@ static void iwl_legacy_beacon_update(struct ieee80211_hw *hw,
2358 if (!skb) 2358 if (!skb)
2359 return; 2359 return;
2360 2360
2361 IWL_DEBUG_MAC80211(priv, "enter\n"); 2361 IL_DEBUG_MAC80211(priv, "enter\n");
2362 2362
2363 lockdep_assert_held(&priv->mutex); 2363 lockdep_assert_held(&priv->mutex);
2364 2364
2365 if (!priv->beacon_ctx) { 2365 if (!priv->beacon_ctx) {
2366 IWL_ERR(priv, "update beacon but no beacon context!\n"); 2366 IL_ERR(priv, "update beacon but no beacon context!\n");
2367 dev_kfree_skb(skb); 2367 dev_kfree_skb(skb);
2368 return; 2368 return;
2369 } 2369 }
@@ -2378,34 +2378,34 @@ static void iwl_legacy_beacon_update(struct ieee80211_hw *hw,
2378 timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; 2378 timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp;
2379 priv->timestamp = le64_to_cpu(timestamp); 2379 priv->timestamp = le64_to_cpu(timestamp);
2380 2380
2381 IWL_DEBUG_MAC80211(priv, "leave\n"); 2381 IL_DEBUG_MAC80211(priv, "leave\n");
2382 spin_unlock_irqrestore(&priv->lock, flags); 2382 spin_unlock_irqrestore(&priv->lock, flags);
2383 2383
2384 if (!iwl_legacy_is_ready_rf(priv)) { 2384 if (!il_is_ready_rf(priv)) {
2385 IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); 2385 IL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
2386 return; 2386 return;
2387 } 2387 }
2388 2388
2389 priv->cfg->ops->legacy->post_associate(priv); 2389 priv->cfg->ops->legacy->post_associate(priv);
2390} 2390}
2391 2391
2392void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, 2392void il_mac_bss_info_changed(struct ieee80211_hw *hw,
2393 struct ieee80211_vif *vif, 2393 struct ieee80211_vif *vif,
2394 struct ieee80211_bss_conf *bss_conf, 2394 struct ieee80211_bss_conf *bss_conf,
2395 u32 changes) 2395 u32 changes)
2396{ 2396{
2397 struct iwl_priv *priv = hw->priv; 2397 struct il_priv *priv = hw->priv;
2398 struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); 2398 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
2399 int ret; 2399 int ret;
2400 2400
2401 if (WARN_ON(!priv->cfg->ops->legacy)) 2401 if (WARN_ON(!priv->cfg->ops->legacy))
2402 return; 2402 return;
2403 2403
2404 IWL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes); 2404 IL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes);
2405 2405
2406 mutex_lock(&priv->mutex); 2406 mutex_lock(&priv->mutex);
2407 2407
2408 if (!iwl_legacy_is_alive(priv)) { 2408 if (!il_is_alive(priv)) {
2409 mutex_unlock(&priv->mutex); 2409 mutex_unlock(&priv->mutex);
2410 return; 2410 return;
2411 } 2411 }
@@ -2415,7 +2415,7 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw,
2415 2415
2416 spin_lock_irqsave(&priv->lock, flags); 2416 spin_lock_irqsave(&priv->lock, flags);
2417 ctx->qos_data.qos_active = bss_conf->qos; 2417 ctx->qos_data.qos_active = bss_conf->qos;
2418 iwl_legacy_update_qos(priv, ctx); 2418 il_update_qos(priv, ctx);
2419 spin_unlock_irqrestore(&priv->lock, flags); 2419 spin_unlock_irqrestore(&priv->lock, flags);
2420 } 2420 }
2421 2421
@@ -2432,17 +2432,17 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw,
2432 } 2432 }
2433 2433
2434 if (changes & BSS_CHANGED_BSSID) { 2434 if (changes & BSS_CHANGED_BSSID) {
2435 IWL_DEBUG_MAC80211(priv, "BSSID %pM\n", bss_conf->bssid); 2435 IL_DEBUG_MAC80211(priv, "BSSID %pM\n", bss_conf->bssid);
2436 2436
2437 /* 2437 /*
2438 * If there is currently a HW scan going on in the 2438 * If there is currently a HW scan going on in the
2439 * background then we need to cancel it else the RXON 2439 * background then we need to cancel it else the RXON
2440 * below/in post_associate will fail. 2440 * below/in post_associate will fail.
2441 */ 2441 */
2442 if (iwl_legacy_scan_cancel_timeout(priv, 100)) { 2442 if (il_scan_cancel_timeout(priv, 100)) {
2443 IWL_WARN(priv, 2443 IL_WARN(priv,
2444 "Aborted scan still in progress after 100ms\n"); 2444 "Aborted scan still in progress after 100ms\n");
2445 IWL_DEBUG_MAC80211(priv, 2445 IL_DEBUG_MAC80211(priv,
2446 "leaving - scan abort failed.\n"); 2446 "leaving - scan abort failed.\n");
2447 mutex_unlock(&priv->mutex); 2447 mutex_unlock(&priv->mutex);
2448 return; 2448 return;
@@ -2468,10 +2468,10 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw,
2468 * it will invoke post_associate. 2468 * it will invoke post_associate.
2469 */ 2469 */
2470 if (vif->type == NL80211_IFTYPE_ADHOC && changes & BSS_CHANGED_BEACON) 2470 if (vif->type == NL80211_IFTYPE_ADHOC && changes & BSS_CHANGED_BEACON)
2471 iwl_legacy_beacon_update(hw, vif); 2471 il_beacon_update(hw, vif);
2472 2472
2473 if (changes & BSS_CHANGED_ERP_PREAMBLE) { 2473 if (changes & BSS_CHANGED_ERP_PREAMBLE) {
2474 IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", 2474 IL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n",
2475 bss_conf->use_short_preamble); 2475 bss_conf->use_short_preamble);
2476 if (bss_conf->use_short_preamble) 2476 if (bss_conf->use_short_preamble)
2477 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 2477 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
@@ -2480,7 +2480,7 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw,
2480 } 2480 }
2481 2481
2482 if (changes & BSS_CHANGED_ERP_CTS_PROT) { 2482 if (changes & BSS_CHANGED_ERP_CTS_PROT) {
2483 IWL_DEBUG_MAC80211(priv, 2483 IL_DEBUG_MAC80211(priv,
2484 "ERP_CTS %d\n", bss_conf->use_cts_prot); 2484 "ERP_CTS %d\n", bss_conf->use_cts_prot);
2485 if (bss_conf->use_cts_prot && 2485 if (bss_conf->use_cts_prot &&
2486 (priv->band != IEEE80211_BAND_5GHZ)) 2486 (priv->band != IEEE80211_BAND_5GHZ))
@@ -2496,7 +2496,7 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw,
2496 if (changes & BSS_CHANGED_BASIC_RATES) { 2496 if (changes & BSS_CHANGED_BASIC_RATES) {
2497 /* XXX use this information 2497 /* XXX use this information
2498 * 2498 *
2499 * To do that, remove code from iwl_legacy_set_rate() and put something 2499 * To do that, remove code from il_set_rate() and put something
2500 * like this here: 2500 * like this here:
2501 * 2501 *
2502 if (A-band) 2502 if (A-band)
@@ -2511,32 +2511,32 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw,
2511 } 2511 }
2512 2512
2513 if (changes & BSS_CHANGED_HT) { 2513 if (changes & BSS_CHANGED_HT) {
2514 iwl_legacy_ht_conf(priv, vif); 2514 il_ht_conf(priv, vif);
2515 2515
2516 if (priv->cfg->ops->hcmd->set_rxon_chain) 2516 if (priv->cfg->ops->hcmd->set_rxon_chain)
2517 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); 2517 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
2518 } 2518 }
2519 2519
2520 if (changes & BSS_CHANGED_ASSOC) { 2520 if (changes & BSS_CHANGED_ASSOC) {
2521 IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); 2521 IL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc);
2522 if (bss_conf->assoc) { 2522 if (bss_conf->assoc) {
2523 priv->timestamp = bss_conf->timestamp; 2523 priv->timestamp = bss_conf->timestamp;
2524 2524
2525 if (!iwl_legacy_is_rfkill(priv)) 2525 if (!il_is_rfkill(priv))
2526 priv->cfg->ops->legacy->post_associate(priv); 2526 priv->cfg->ops->legacy->post_associate(priv);
2527 } else 2527 } else
2528 iwl_legacy_set_no_assoc(priv, vif); 2528 il_set_no_assoc(priv, vif);
2529 } 2529 }
2530 2530
2531 if (changes && iwl_legacy_is_associated_ctx(ctx) && bss_conf->aid) { 2531 if (changes && il_is_associated_ctx(ctx) && bss_conf->aid) {
2532 IWL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n", 2532 IL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n",
2533 changes); 2533 changes);
2534 ret = iwl_legacy_send_rxon_assoc(priv, ctx); 2534 ret = il_send_rxon_assoc(priv, ctx);
2535 if (!ret) { 2535 if (!ret) {
2536 /* Sync active_rxon with latest change. */ 2536 /* Sync active_rxon with latest change. */
2537 memcpy((void *)&ctx->active, 2537 memcpy((void *)&ctx->active,
2538 &ctx->staging, 2538 &ctx->staging,
2539 sizeof(struct iwl_legacy_rxon_cmd)); 2539 sizeof(struct il_rxon_cmd));
2540 } 2540 }
2541 } 2541 }
2542 2542
@@ -2547,27 +2547,27 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw,
2547 memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); 2547 memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN);
2548 priv->cfg->ops->legacy->config_ap(priv); 2548 priv->cfg->ops->legacy->config_ap(priv);
2549 } else 2549 } else
2550 iwl_legacy_set_no_assoc(priv, vif); 2550 il_set_no_assoc(priv, vif);
2551 } 2551 }
2552 2552
2553 if (changes & BSS_CHANGED_IBSS) { 2553 if (changes & BSS_CHANGED_IBSS) {
2554 ret = priv->cfg->ops->legacy->manage_ibss_station(priv, vif, 2554 ret = priv->cfg->ops->legacy->manage_ibss_station(priv, vif,
2555 bss_conf->ibss_joined); 2555 bss_conf->ibss_joined);
2556 if (ret) 2556 if (ret)
2557 IWL_ERR(priv, "failed to %s IBSS station %pM\n", 2557 IL_ERR(priv, "failed to %s IBSS station %pM\n",
2558 bss_conf->ibss_joined ? "add" : "remove", 2558 bss_conf->ibss_joined ? "add" : "remove",
2559 bss_conf->bssid); 2559 bss_conf->bssid);
2560 } 2560 }
2561 2561
2562 mutex_unlock(&priv->mutex); 2562 mutex_unlock(&priv->mutex);
2563 2563
2564 IWL_DEBUG_MAC80211(priv, "leave\n"); 2564 IL_DEBUG_MAC80211(priv, "leave\n");
2565} 2565}
2566EXPORT_SYMBOL(iwl_legacy_mac_bss_info_changed); 2566EXPORT_SYMBOL(il_mac_bss_info_changed);
2567 2567
2568irqreturn_t iwl_legacy_isr(int irq, void *data) 2568irqreturn_t il_isr(int irq, void *data)
2569{ 2569{
2570 struct iwl_priv *priv = data; 2570 struct il_priv *priv = data;
2571 u32 inta, inta_mask; 2571 u32 inta, inta_mask;
2572 u32 inta_fh; 2572 u32 inta_fh;
2573 unsigned long flags; 2573 unsigned long flags;
@@ -2580,18 +2580,18 @@ irqreturn_t iwl_legacy_isr(int irq, void *data)
2580 * back-to-back ISRs and sporadic interrupts from our NIC. 2580 * back-to-back ISRs and sporadic interrupts from our NIC.
2581 * If we have something to service, the tasklet will re-enable ints. 2581 * If we have something to service, the tasklet will re-enable ints.
2582 * If we *don't* have something, we'll re-enable before leaving here. */ 2582 * If we *don't* have something, we'll re-enable before leaving here. */
2583 inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ 2583 inta_mask = il_read32(priv, CSR_INT_MASK); /* just for debug */
2584 iwl_write32(priv, CSR_INT_MASK, 0x00000000); 2584 il_write32(priv, CSR_INT_MASK, 0x00000000);
2585 2585
2586 /* Discover which interrupts are active/pending */ 2586 /* Discover which interrupts are active/pending */
2587 inta = iwl_read32(priv, CSR_INT); 2587 inta = il_read32(priv, CSR_INT);
2588 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 2588 inta_fh = il_read32(priv, CSR_FH_INT_STATUS);
2589 2589
2590 /* Ignore interrupt if there's nothing in NIC to service. 2590 /* Ignore interrupt if there's nothing in NIC to service.
2591 * This may be due to IRQ shared with another device, 2591 * This may be due to IRQ shared with another device,
2592 * or due to sporadic interrupts thrown from our NIC. */ 2592 * or due to sporadic interrupts thrown from our NIC. */
2593 if (!inta && !inta_fh) { 2593 if (!inta && !inta_fh) {
2594 IWL_DEBUG_ISR(priv, 2594 IL_DEBUG_ISR(priv,
2595 "Ignore interrupt, inta == 0, inta_fh == 0\n"); 2595 "Ignore interrupt, inta == 0, inta_fh == 0\n");
2596 goto none; 2596 goto none;
2597 } 2597 }
@@ -2599,16 +2599,16 @@ irqreturn_t iwl_legacy_isr(int irq, void *data)
2599 if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { 2599 if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
2600 /* Hardware disappeared. It might have already raised 2600 /* Hardware disappeared. It might have already raised
2601 * an interrupt */ 2601 * an interrupt */
2602 IWL_WARN(priv, "HARDWARE GONE?? INTA == 0x%08x\n", inta); 2602 IL_WARN(priv, "HARDWARE GONE?? INTA == 0x%08x\n", inta);
2603 goto unplugged; 2603 goto unplugged;
2604 } 2604 }
2605 2605
2606 IWL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 2606 IL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
2607 inta, inta_mask, inta_fh); 2607 inta, inta_mask, inta_fh);
2608 2608
2609 inta &= ~CSR_INT_BIT_SCD; 2609 inta &= ~CSR_INT_BIT_SCD;
2610 2610
2611 /* iwl_irq_tasklet() will service interrupts and re-enable them */ 2611 /* il_irq_tasklet() will service interrupts and re-enable them */
2612 if (likely(inta || inta_fh)) 2612 if (likely(inta || inta_fh))
2613 tasklet_schedule(&priv->irq_tasklet); 2613 tasklet_schedule(&priv->irq_tasklet);
2614 2614
@@ -2620,17 +2620,17 @@ none:
2620 /* re-enable interrupts here since we don't have anything to service. */ 2620 /* re-enable interrupts here since we don't have anything to service. */
2621 /* only Re-enable if disabled by irq */ 2621 /* only Re-enable if disabled by irq */
2622 if (test_bit(STATUS_INT_ENABLED, &priv->status)) 2622 if (test_bit(STATUS_INT_ENABLED, &priv->status))
2623 iwl_legacy_enable_interrupts(priv); 2623 il_enable_interrupts(priv);
2624 spin_unlock_irqrestore(&priv->lock, flags); 2624 spin_unlock_irqrestore(&priv->lock, flags);
2625 return IRQ_NONE; 2625 return IRQ_NONE;
2626} 2626}
2627EXPORT_SYMBOL(iwl_legacy_isr); 2627EXPORT_SYMBOL(il_isr);
2628 2628
2629/* 2629/*
2630 * iwl_legacy_tx_cmd_protection: Set rts/cts. 3945 and 4965 only share this 2630 * il_tx_cmd_protection: Set rts/cts. 3945 and 4965 only share this
2631 * function. 2631 * function.
2632 */ 2632 */
2633void iwl_legacy_tx_cmd_protection(struct iwl_priv *priv, 2633void il_tx_cmd_protection(struct il_priv *priv,
2634 struct ieee80211_tx_info *info, 2634 struct ieee80211_tx_info *info,
2635 __le16 fc, __le32 *tx_flags) 2635 __le16 fc, __le32 *tx_flags)
2636{ 2636{
@@ -2658,4 +2658,4 @@ void iwl_legacy_tx_cmd_protection(struct iwl_priv *priv,
2658 *tx_flags |= TX_CMD_FLG_FULL_TXOP_PROT_MSK; 2658 *tx_flags |= TX_CMD_FLG_FULL_TXOP_PROT_MSK;
2659 } 2659 }
2660} 2660}
2661EXPORT_SYMBOL(iwl_legacy_tx_cmd_protection); 2661EXPORT_SYMBOL(il_tx_cmd_protection);
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.h b/drivers/net/wireless/iwlegacy/iwl-core.h
index d1271fe07d4b..92f37c981797 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.h
+++ b/drivers/net/wireless/iwlegacy/iwl-core.h
@@ -60,54 +60,54 @@
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *****************************************************************************/ 61 *****************************************************************************/
62 62
63#ifndef __iwl_legacy_core_h__ 63#ifndef __il_core_h__
64#define __iwl_legacy_core_h__ 64#define __il_core_h__
65 65
66/************************ 66/************************
67 * forward declarations * 67 * forward declarations *
68 ************************/ 68 ************************/
69struct iwl_host_cmd; 69struct il_host_cmd;
70struct iwl_cmd; 70struct il_cmd;
71 71
72 72
73#define IWLWIFI_VERSION "in-tree:" 73#define IWLWIFI_VERSION "in-tree:"
74#define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation" 74#define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation"
75#define DRV_AUTHOR "<ilw@linux.intel.com>" 75#define DRV_AUTHOR "<ilw@linux.intel.com>"
76 76
77#define IWL_PCI_DEVICE(dev, subdev, cfg) \ 77#define IL_PCI_DEVICE(dev, subdev, cfg) \
78 .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ 78 .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
79 .subvendor = PCI_ANY_ID, .subdevice = (subdev), \ 79 .subvendor = PCI_ANY_ID, .subdevice = (subdev), \
80 .driver_data = (kernel_ulong_t)&(cfg) 80 .driver_data = (kernel_ulong_t)&(cfg)
81 81
82#define TIME_UNIT 1024 82#define TIME_UNIT 1024
83 83
84#define IWL_SKU_G 0x1 84#define IL_SKU_G 0x1
85#define IWL_SKU_A 0x2 85#define IL_SKU_A 0x2
86#define IWL_SKU_N 0x8 86#define IL_SKU_N 0x8
87 87
88#define IWL_CMD(x) case x: return #x 88#define IL_CMD(x) case x: return #x
89 89
90struct iwl_hcmd_ops { 90struct il_hcmd_ops {
91 int (*rxon_assoc)(struct iwl_priv *priv, struct iwl_rxon_context *ctx); 91 int (*rxon_assoc)(struct il_priv *priv, struct il_rxon_context *ctx);
92 int (*commit_rxon)(struct iwl_priv *priv, struct iwl_rxon_context *ctx); 92 int (*commit_rxon)(struct il_priv *priv, struct il_rxon_context *ctx);
93 void (*set_rxon_chain)(struct iwl_priv *priv, 93 void (*set_rxon_chain)(struct il_priv *priv,
94 struct iwl_rxon_context *ctx); 94 struct il_rxon_context *ctx);
95}; 95};
96 96
97struct iwl_hcmd_utils_ops { 97struct il_hcmd_utils_ops {
98 u16 (*get_hcmd_size)(u8 cmd_id, u16 len); 98 u16 (*get_hcmd_size)(u8 cmd_id, u16 len);
99 u16 (*build_addsta_hcmd)(const struct iwl_legacy_addsta_cmd *cmd, 99 u16 (*build_addsta_hcmd)(const struct il_addsta_cmd *cmd,
100 u8 *data); 100 u8 *data);
101 int (*request_scan)(struct iwl_priv *priv, struct ieee80211_vif *vif); 101 int (*request_scan)(struct il_priv *priv, struct ieee80211_vif *vif);
102 void (*post_scan)(struct iwl_priv *priv); 102 void (*post_scan)(struct il_priv *priv);
103}; 103};
104 104
105struct iwl_apm_ops { 105struct il_apm_ops {
106 int (*init)(struct iwl_priv *priv); 106 int (*init)(struct il_priv *priv);
107 void (*config)(struct iwl_priv *priv); 107 void (*config)(struct il_priv *priv);
108}; 108};
109 109
110struct iwl_debugfs_ops { 110struct il_debugfs_ops {
111 ssize_t (*rx_stats_read)(struct file *file, char __user *user_buf, 111 ssize_t (*rx_stats_read)(struct file *file, char __user *user_buf,
112 size_t count, loff_t *ppos); 112 size_t count, loff_t *ppos);
113 ssize_t (*tx_stats_read)(struct file *file, char __user *user_buf, 113 ssize_t (*tx_stats_read)(struct file *file, char __user *user_buf,
@@ -116,79 +116,79 @@ struct iwl_debugfs_ops {
116 size_t count, loff_t *ppos); 116 size_t count, loff_t *ppos);
117}; 117};
118 118
119struct iwl_temp_ops { 119struct il_temp_ops {
120 void (*temperature)(struct iwl_priv *priv); 120 void (*temperature)(struct il_priv *priv);
121}; 121};
122 122
123struct iwl_lib_ops { 123struct il_lib_ops {
124 /* set hw dependent parameters */ 124 /* set hw dependent parameters */
125 int (*set_hw_params)(struct iwl_priv *priv); 125 int (*set_hw_params)(struct il_priv *priv);
126 /* Handling TX */ 126 /* Handling TX */
127 void (*txq_update_byte_cnt_tbl)(struct iwl_priv *priv, 127 void (*txq_update_byte_cnt_tbl)(struct il_priv *priv,
128 struct iwl_tx_queue *txq, 128 struct il_tx_queue *txq,
129 u16 byte_cnt); 129 u16 byte_cnt);
130 int (*txq_attach_buf_to_tfd)(struct iwl_priv *priv, 130 int (*txq_attach_buf_to_tfd)(struct il_priv *priv,
131 struct iwl_tx_queue *txq, 131 struct il_tx_queue *txq,
132 dma_addr_t addr, 132 dma_addr_t addr,
133 u16 len, u8 reset, u8 pad); 133 u16 len, u8 reset, u8 pad);
134 void (*txq_free_tfd)(struct iwl_priv *priv, 134 void (*txq_free_tfd)(struct il_priv *priv,
135 struct iwl_tx_queue *txq); 135 struct il_tx_queue *txq);
136 int (*txq_init)(struct iwl_priv *priv, 136 int (*txq_init)(struct il_priv *priv,
137 struct iwl_tx_queue *txq); 137 struct il_tx_queue *txq);
138 /* setup Rx handler */ 138 /* setup Rx handler */
139 void (*rx_handler_setup)(struct iwl_priv *priv); 139 void (*rx_handler_setup)(struct il_priv *priv);
140 /* alive notification after init uCode load */ 140 /* alive notification after init uCode load */
141 void (*init_alive_start)(struct iwl_priv *priv); 141 void (*init_alive_start)(struct il_priv *priv);
142 /* check validity of rtc data address */ 142 /* check validity of rtc data address */
143 int (*is_valid_rtc_data_addr)(u32 addr); 143 int (*is_valid_rtc_data_addr)(u32 addr);
144 /* 1st ucode load */ 144 /* 1st ucode load */
145 int (*load_ucode)(struct iwl_priv *priv); 145 int (*load_ucode)(struct il_priv *priv);
146 146
147 void (*dump_nic_error_log)(struct iwl_priv *priv); 147 void (*dump_nic_error_log)(struct il_priv *priv);
148 int (*dump_fh)(struct iwl_priv *priv, char **buf, bool display); 148 int (*dump_fh)(struct il_priv *priv, char **buf, bool display);
149 int (*set_channel_switch)(struct iwl_priv *priv, 149 int (*set_channel_switch)(struct il_priv *priv,
150 struct ieee80211_channel_switch *ch_switch); 150 struct ieee80211_channel_switch *ch_switch);
151 /* power management */ 151 /* power management */
152 struct iwl_apm_ops apm_ops; 152 struct il_apm_ops apm_ops;
153 153
154 /* power */ 154 /* power */
155 int (*send_tx_power) (struct iwl_priv *priv); 155 int (*send_tx_power) (struct il_priv *priv);
156 void (*update_chain_flags)(struct iwl_priv *priv); 156 void (*update_chain_flags)(struct il_priv *priv);
157 157
158 /* eeprom operations (as defined in iwl-eeprom.h) */ 158 /* eeprom operations (as defined in iwl-eeprom.h) */
159 struct iwl_eeprom_ops eeprom_ops; 159 struct il_eeprom_ops eeprom_ops;
160 160
161 /* temperature */ 161 /* temperature */
162 struct iwl_temp_ops temp_ops; 162 struct il_temp_ops temp_ops;
163 163
164 struct iwl_debugfs_ops debugfs_ops; 164 struct il_debugfs_ops debugfs_ops;
165 165
166}; 166};
167 167
168struct iwl_led_ops { 168struct il_led_ops {
169 int (*cmd)(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd); 169 int (*cmd)(struct il_priv *priv, struct il_led_cmd *led_cmd);
170}; 170};
171 171
172struct iwl_legacy_ops { 172struct il_legacy_ops {
173 void (*post_associate)(struct iwl_priv *priv); 173 void (*post_associate)(struct il_priv *priv);
174 void (*config_ap)(struct iwl_priv *priv); 174 void (*config_ap)(struct il_priv *priv);
175 /* station management */ 175 /* station management */
176 int (*update_bcast_stations)(struct iwl_priv *priv); 176 int (*update_bcast_stations)(struct il_priv *priv);
177 int (*manage_ibss_station)(struct iwl_priv *priv, 177 int (*manage_ibss_station)(struct il_priv *priv,
178 struct ieee80211_vif *vif, bool add); 178 struct ieee80211_vif *vif, bool add);
179}; 179};
180 180
181struct iwl_ops { 181struct il_ops {
182 const struct iwl_lib_ops *lib; 182 const struct il_lib_ops *lib;
183 const struct iwl_hcmd_ops *hcmd; 183 const struct il_hcmd_ops *hcmd;
184 const struct iwl_hcmd_utils_ops *utils; 184 const struct il_hcmd_utils_ops *utils;
185 const struct iwl_led_ops *led; 185 const struct il_led_ops *led;
186 const struct iwl_nic_ops *nic; 186 const struct il_nic_ops *nic;
187 const struct iwl_legacy_ops *legacy; 187 const struct il_legacy_ops *legacy;
188 const struct ieee80211_ops *ieee80211_ops; 188 const struct ieee80211_ops *ieee80211_ops;
189}; 189};
190 190
191struct iwl_mod_params { 191struct il_mod_params {
192 int sw_crypto; /* def: 0 = using hardware encryption */ 192 int sw_crypto; /* def: 0 = using hardware encryption */
193 int disable_hw_scan; /* def: 0 = use h/w scan */ 193 int disable_hw_scan; /* def: 0 = use h/w scan */
194 int num_of_queues; /* def: HW dependent */ 194 int num_of_queues; /* def: HW dependent */
@@ -211,11 +211,11 @@ struct iwl_mod_params {
211 * @chain_noise_calib_by_driver: driver has the capability to perform 211 * @chain_noise_calib_by_driver: driver has the capability to perform
212 * chain noise calibration operation 212 * chain noise calibration operation
213 */ 213 */
214struct iwl_base_params { 214struct il_base_params {
215 int eeprom_size; 215 int eeprom_size;
216 int num_of_queues; /* def: HW dependent */ 216 int num_of_queues; /* def: HW dependent */
217 int num_of_ampdu_queues;/* def: HW dependent */ 217 int num_of_ampdu_queues;/* def: HW dependent */
218 /* for iwl_legacy_apm_init() */ 218 /* for il_apm_init() */
219 u32 pll_cfg_val; 219 u32 pll_cfg_val;
220 bool set_l0s; 220 bool set_l0s;
221 bool use_bsm; 221 bool use_bsm;
@@ -230,7 +230,7 @@ struct iwl_base_params {
230}; 230};
231 231
232/** 232/**
233 * struct iwl_cfg 233 * struct il_cfg
234 * @fw_name_pre: Firmware filename prefix. The api version and extension 234 * @fw_name_pre: Firmware filename prefix. The api version and extension
235 * (.ucode) will be added to filename before loading from disk. The 235 * (.ucode) will be added to filename before loading from disk. The
236 * filename is constructed as fw_name_pre<api>.ucode. 236 * filename is constructed as fw_name_pre<api>.ucode.
@@ -243,11 +243,11 @@ struct iwl_base_params {
243 * driver specifies which APIs it supports (with @ucode_api_max being the 243 * driver specifies which APIs it supports (with @ucode_api_max being the
244 * highest and @ucode_api_min the lowest). Firmware will only be loaded if 244 * highest and @ucode_api_min the lowest). Firmware will only be loaded if
245 * it has a supported API version. The firmware's API version will be 245 * it has a supported API version. The firmware's API version will be
246 * stored in @iwl_priv, enabling the driver to make runtime changes based 246 * stored in @il_priv, enabling the driver to make runtime changes based
247 * on firmware version used. 247 * on firmware version used.
248 * 248 *
249 * For example, 249 * For example,
250 * if (IWL_UCODE_API(priv->ucode_ver) >= 2) { 250 * if (IL_UCODE_API(priv->ucode_ver) >= 2) {
251 * Driver interacts with Firmware API version >= 2. 251 * Driver interacts with Firmware API version >= 2.
252 * } else { 252 * } else {
253 * Driver interacts with Firmware API version 1. 253 * Driver interacts with Firmware API version 1.
@@ -255,12 +255,12 @@ struct iwl_base_params {
255 * 255 *
256 * The ideal usage of this infrastructure is to treat a new ucode API 256 * The ideal usage of this infrastructure is to treat a new ucode API
257 * release as a new hardware revision. That is, through utilizing the 257 * release as a new hardware revision. That is, through utilizing the
258 * iwl_hcmd_utils_ops etc. we accommodate different command structures 258 * il_hcmd_utils_ops etc. we accommodate different command structures
259 * and flows between hardware versions as well as their API 259 * and flows between hardware versions as well as their API
260 * versions. 260 * versions.
261 * 261 *
262 */ 262 */
263struct iwl_cfg { 263struct il_cfg {
264 /* params specific to an individual device within a device family */ 264 /* params specific to an individual device within a device family */
265 const char *name; 265 const char *name;
266 const char *fw_name_pre; 266 const char *fw_name_pre;
@@ -271,97 +271,97 @@ struct iwl_cfg {
271 unsigned int sku; 271 unsigned int sku;
272 u16 eeprom_ver; 272 u16 eeprom_ver;
273 u16 eeprom_calib_ver; 273 u16 eeprom_calib_ver;
274 const struct iwl_ops *ops; 274 const struct il_ops *ops;
275 /* module based parameters which can be set from modprobe cmd */ 275 /* module based parameters which can be set from modprobe cmd */
276 const struct iwl_mod_params *mod_params; 276 const struct il_mod_params *mod_params;
277 /* params not likely to change within a device family */ 277 /* params not likely to change within a device family */
278 struct iwl_base_params *base_params; 278 struct il_base_params *base_params;
279 /* params likely to change within a device family */ 279 /* params likely to change within a device family */
280 u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; 280 u8 scan_rx_antennas[IEEE80211_NUM_BANDS];
281 enum iwl_led_mode led_mode; 281 enum il_led_mode led_mode;
282}; 282};
283 283
284/*************************** 284/***************************
285 * L i b * 285 * L i b *
286 ***************************/ 286 ***************************/
287 287
288struct ieee80211_hw *iwl_legacy_alloc_all(struct iwl_cfg *cfg); 288struct ieee80211_hw *il_alloc_all(struct il_cfg *cfg);
289int iwl_legacy_mac_conf_tx(struct ieee80211_hw *hw, 289int il_mac_conf_tx(struct ieee80211_hw *hw,
290 struct ieee80211_vif *vif, u16 queue, 290 struct ieee80211_vif *vif, u16 queue,
291 const struct ieee80211_tx_queue_params *params); 291 const struct ieee80211_tx_queue_params *params);
292int iwl_legacy_mac_tx_last_beacon(struct ieee80211_hw *hw); 292int il_mac_tx_last_beacon(struct ieee80211_hw *hw);
293void iwl_legacy_set_rxon_hwcrypto(struct iwl_priv *priv, 293void il_set_rxon_hwcrypto(struct il_priv *priv,
294 struct iwl_rxon_context *ctx, 294 struct il_rxon_context *ctx,
295 int hw_decrypt); 295 int hw_decrypt);
296int iwl_legacy_check_rxon_cmd(struct iwl_priv *priv, 296int il_check_rxon_cmd(struct il_priv *priv,
297 struct iwl_rxon_context *ctx); 297 struct il_rxon_context *ctx);
298int iwl_legacy_full_rxon_required(struct iwl_priv *priv, 298int il_full_rxon_required(struct il_priv *priv,
299 struct iwl_rxon_context *ctx); 299 struct il_rxon_context *ctx);
300int iwl_legacy_set_rxon_channel(struct iwl_priv *priv, 300int il_set_rxon_channel(struct il_priv *priv,
301 struct ieee80211_channel *ch, 301 struct ieee80211_channel *ch,
302 struct iwl_rxon_context *ctx); 302 struct il_rxon_context *ctx);
303void iwl_legacy_set_flags_for_band(struct iwl_priv *priv, 303void il_set_flags_for_band(struct il_priv *priv,
304 struct iwl_rxon_context *ctx, 304 struct il_rxon_context *ctx,
305 enum ieee80211_band band, 305 enum ieee80211_band band,
306 struct ieee80211_vif *vif); 306 struct ieee80211_vif *vif);
307u8 iwl_legacy_get_single_channel_number(struct iwl_priv *priv, 307u8 il_get_single_channel_number(struct il_priv *priv,
308 enum ieee80211_band band); 308 enum ieee80211_band band);
309void iwl_legacy_set_rxon_ht(struct iwl_priv *priv, 309void il_set_rxon_ht(struct il_priv *priv,
310 struct iwl_ht_config *ht_conf); 310 struct il_ht_config *ht_conf);
311bool iwl_legacy_is_ht40_tx_allowed(struct iwl_priv *priv, 311bool il_is_ht40_tx_allowed(struct il_priv *priv,
312 struct iwl_rxon_context *ctx, 312 struct il_rxon_context *ctx,
313 struct ieee80211_sta_ht_cap *ht_cap); 313 struct ieee80211_sta_ht_cap *ht_cap);
314void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv, 314void il_connection_init_rx_config(struct il_priv *priv,
315 struct iwl_rxon_context *ctx); 315 struct il_rxon_context *ctx);
316void iwl_legacy_set_rate(struct iwl_priv *priv); 316void il_set_rate(struct il_priv *priv);
317int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv, 317int il_set_decrypted_flag(struct il_priv *priv,
318 struct ieee80211_hdr *hdr, 318 struct ieee80211_hdr *hdr,
319 u32 decrypt_res, 319 u32 decrypt_res,
320 struct ieee80211_rx_status *stats); 320 struct ieee80211_rx_status *stats);
321void iwl_legacy_irq_handle_error(struct iwl_priv *priv); 321void il_irq_handle_error(struct il_priv *priv);
322int iwl_legacy_mac_add_interface(struct ieee80211_hw *hw, 322int il_mac_add_interface(struct ieee80211_hw *hw,
323 struct ieee80211_vif *vif); 323 struct ieee80211_vif *vif);
324void iwl_legacy_mac_remove_interface(struct ieee80211_hw *hw, 324void il_mac_remove_interface(struct ieee80211_hw *hw,
325 struct ieee80211_vif *vif); 325 struct ieee80211_vif *vif);
326int iwl_legacy_mac_change_interface(struct ieee80211_hw *hw, 326int il_mac_change_interface(struct ieee80211_hw *hw,
327 struct ieee80211_vif *vif, 327 struct ieee80211_vif *vif,
328 enum nl80211_iftype newtype, bool newp2p); 328 enum nl80211_iftype newtype, bool newp2p);
329int iwl_legacy_alloc_txq_mem(struct iwl_priv *priv); 329int il_alloc_txq_mem(struct il_priv *priv);
330void iwl_legacy_txq_mem(struct iwl_priv *priv); 330void il_txq_mem(struct il_priv *priv);
331 331
332#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 332#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
333int iwl_legacy_alloc_traffic_mem(struct iwl_priv *priv); 333int il_alloc_traffic_mem(struct il_priv *priv);
334void iwl_legacy_free_traffic_mem(struct iwl_priv *priv); 334void il_free_traffic_mem(struct il_priv *priv);
335void iwl_legacy_reset_traffic_log(struct iwl_priv *priv); 335void il_reset_traffic_log(struct il_priv *priv);
336void iwl_legacy_dbg_log_tx_data_frame(struct iwl_priv *priv, 336void il_dbg_log_tx_data_frame(struct il_priv *priv,
337 u16 length, struct ieee80211_hdr *header); 337 u16 length, struct ieee80211_hdr *header);
338void iwl_legacy_dbg_log_rx_data_frame(struct iwl_priv *priv, 338void il_dbg_log_rx_data_frame(struct il_priv *priv,
339 u16 length, struct ieee80211_hdr *header); 339 u16 length, struct ieee80211_hdr *header);
340const char *iwl_legacy_get_mgmt_string(int cmd); 340const char *il_get_mgmt_string(int cmd);
341const char *iwl_legacy_get_ctrl_string(int cmd); 341const char *il_get_ctrl_string(int cmd);
342void iwl_legacy_clear_traffic_stats(struct iwl_priv *priv); 342void il_clear_traffic_stats(struct il_priv *priv);
343void iwl_legacy_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, 343void il_update_stats(struct il_priv *priv, bool is_tx, __le16 fc,
344 u16 len); 344 u16 len);
345#else 345#else
346static inline int iwl_legacy_alloc_traffic_mem(struct iwl_priv *priv) 346static inline int il_alloc_traffic_mem(struct il_priv *priv)
347{ 347{
348 return 0; 348 return 0;
349} 349}
350static inline void iwl_legacy_free_traffic_mem(struct iwl_priv *priv) 350static inline void il_free_traffic_mem(struct il_priv *priv)
351{ 351{
352} 352}
353static inline void iwl_legacy_reset_traffic_log(struct iwl_priv *priv) 353static inline void il_reset_traffic_log(struct il_priv *priv)
354{ 354{
355} 355}
356static inline void iwl_legacy_dbg_log_tx_data_frame(struct iwl_priv *priv, 356static inline void il_dbg_log_tx_data_frame(struct il_priv *priv,
357 u16 length, struct ieee80211_hdr *header) 357 u16 length, struct ieee80211_hdr *header)
358{ 358{
359} 359}
360static inline void iwl_legacy_dbg_log_rx_data_frame(struct iwl_priv *priv, 360static inline void il_dbg_log_rx_data_frame(struct il_priv *priv,
361 u16 length, struct ieee80211_hdr *header) 361 u16 length, struct ieee80211_hdr *header)
362{ 362{
363} 363}
364static inline void iwl_legacy_update_stats(struct iwl_priv *priv, bool is_tx, 364static inline void il_update_stats(struct il_priv *priv, bool is_tx,
365 __le16 fc, u16 len) 365 __le16 fc, u16 len)
366{ 366{
367} 367}
@@ -369,83 +369,83 @@ static inline void iwl_legacy_update_stats(struct iwl_priv *priv, bool is_tx,
369/***************************************************** 369/*****************************************************
370 * RX handlers. 370 * RX handlers.
371 * **************************************************/ 371 * **************************************************/
372void iwl_legacy_rx_pm_sleep_notif(struct iwl_priv *priv, 372void il_rx_pm_sleep_notif(struct il_priv *priv,
373 struct iwl_rx_mem_buffer *rxb); 373 struct il_rx_mem_buffer *rxb);
374void iwl_legacy_rx_pm_debug_statistics_notif(struct iwl_priv *priv, 374void il_rx_pm_debug_statistics_notif(struct il_priv *priv,
375 struct iwl_rx_mem_buffer *rxb); 375 struct il_rx_mem_buffer *rxb);
376void iwl_legacy_rx_reply_error(struct iwl_priv *priv, 376void il_rx_reply_error(struct il_priv *priv,
377 struct iwl_rx_mem_buffer *rxb); 377 struct il_rx_mem_buffer *rxb);
378 378
379/***************************************************** 379/*****************************************************
380* RX 380* RX
381******************************************************/ 381******************************************************/
382void iwl_legacy_cmd_queue_unmap(struct iwl_priv *priv); 382void il_cmd_queue_unmap(struct il_priv *priv);
383void iwl_legacy_cmd_queue_free(struct iwl_priv *priv); 383void il_cmd_queue_free(struct il_priv *priv);
384int iwl_legacy_rx_queue_alloc(struct iwl_priv *priv); 384int il_rx_queue_alloc(struct il_priv *priv);
385void iwl_legacy_rx_queue_update_write_ptr(struct iwl_priv *priv, 385void il_rx_queue_update_write_ptr(struct il_priv *priv,
386 struct iwl_rx_queue *q); 386 struct il_rx_queue *q);
387int iwl_legacy_rx_queue_space(const struct iwl_rx_queue *q); 387int il_rx_queue_space(const struct il_rx_queue *q);
388void iwl_legacy_tx_cmd_complete(struct iwl_priv *priv, 388void il_tx_cmd_complete(struct il_priv *priv,
389 struct iwl_rx_mem_buffer *rxb); 389 struct il_rx_mem_buffer *rxb);
390/* Handlers */ 390/* Handlers */
391void iwl_legacy_rx_spectrum_measure_notif(struct iwl_priv *priv, 391void il_rx_spectrum_measure_notif(struct il_priv *priv,
392 struct iwl_rx_mem_buffer *rxb); 392 struct il_rx_mem_buffer *rxb);
393void iwl_legacy_recover_from_statistics(struct iwl_priv *priv, 393void il_recover_from_statistics(struct il_priv *priv,
394 struct iwl_rx_packet *pkt); 394 struct il_rx_packet *pkt);
395void iwl_legacy_chswitch_done(struct iwl_priv *priv, bool is_success); 395void il_chswitch_done(struct il_priv *priv, bool is_success);
396void iwl_legacy_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb); 396void il_rx_csa(struct il_priv *priv, struct il_rx_mem_buffer *rxb);
397 397
398/* TX helpers */ 398/* TX helpers */
399 399
400/***************************************************** 400/*****************************************************
401* TX 401* TX
402******************************************************/ 402******************************************************/
403void iwl_legacy_txq_update_write_ptr(struct iwl_priv *priv, 403void il_txq_update_write_ptr(struct il_priv *priv,
404 struct iwl_tx_queue *txq); 404 struct il_tx_queue *txq);
405int iwl_legacy_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, 405int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq,
406 int slots_num, u32 txq_id); 406 int slots_num, u32 txq_id);
407void iwl_legacy_tx_queue_reset(struct iwl_priv *priv, 407void il_tx_queue_reset(struct il_priv *priv,
408 struct iwl_tx_queue *txq, 408 struct il_tx_queue *txq,
409 int slots_num, u32 txq_id); 409 int slots_num, u32 txq_id);
410void iwl_legacy_tx_queue_unmap(struct iwl_priv *priv, int txq_id); 410void il_tx_queue_unmap(struct il_priv *priv, int txq_id);
411void iwl_legacy_tx_queue_free(struct iwl_priv *priv, int txq_id); 411void il_tx_queue_free(struct il_priv *priv, int txq_id);
412void iwl_legacy_setup_watchdog(struct iwl_priv *priv); 412void il_setup_watchdog(struct il_priv *priv);
413/***************************************************** 413/*****************************************************
414 * TX power 414 * TX power
415 ****************************************************/ 415 ****************************************************/
416int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); 416int il_set_tx_power(struct il_priv *priv, s8 tx_power, bool force);
417 417
418/******************************************************************************* 418/*******************************************************************************
419 * Rate 419 * Rate
420 ******************************************************************************/ 420 ******************************************************************************/
421 421
422u8 iwl_legacy_get_lowest_plcp(struct iwl_priv *priv, 422u8 il_get_lowest_plcp(struct il_priv *priv,
423 struct iwl_rxon_context *ctx); 423 struct il_rxon_context *ctx);
424 424
425/******************************************************************************* 425/*******************************************************************************
426 * Scanning 426 * Scanning
427 ******************************************************************************/ 427 ******************************************************************************/
428void iwl_legacy_init_scan_params(struct iwl_priv *priv); 428void il_init_scan_params(struct il_priv *priv);
429int iwl_legacy_scan_cancel(struct iwl_priv *priv); 429int il_scan_cancel(struct il_priv *priv);
430int iwl_legacy_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); 430int il_scan_cancel_timeout(struct il_priv *priv, unsigned long ms);
431void iwl_legacy_force_scan_end(struct iwl_priv *priv); 431void il_force_scan_end(struct il_priv *priv);
432int iwl_legacy_mac_hw_scan(struct ieee80211_hw *hw, 432int il_mac_hw_scan(struct ieee80211_hw *hw,
433 struct ieee80211_vif *vif, 433 struct ieee80211_vif *vif,
434 struct cfg80211_scan_request *req); 434 struct cfg80211_scan_request *req);
435void iwl_legacy_internal_short_hw_scan(struct iwl_priv *priv); 435void il_internal_short_hw_scan(struct il_priv *priv);
436int iwl_legacy_force_reset(struct iwl_priv *priv, bool external); 436int il_force_reset(struct il_priv *priv, bool external);
437u16 iwl_legacy_fill_probe_req(struct iwl_priv *priv, 437u16 il_fill_probe_req(struct il_priv *priv,
438 struct ieee80211_mgmt *frame, 438 struct ieee80211_mgmt *frame,
439 const u8 *ta, const u8 *ie, int ie_len, int left); 439 const u8 *ta, const u8 *ie, int ie_len, int left);
440void iwl_legacy_setup_rx_scan_handlers(struct iwl_priv *priv); 440void il_setup_rx_scan_handlers(struct il_priv *priv);
441u16 iwl_legacy_get_active_dwell_time(struct iwl_priv *priv, 441u16 il_get_active_dwell_time(struct il_priv *priv,
442 enum ieee80211_band band, 442 enum ieee80211_band band,
443 u8 n_probes); 443 u8 n_probes);
444u16 iwl_legacy_get_passive_dwell_time(struct iwl_priv *priv, 444u16 il_get_passive_dwell_time(struct il_priv *priv,
445 enum ieee80211_band band, 445 enum ieee80211_band band,
446 struct ieee80211_vif *vif); 446 struct ieee80211_vif *vif);
447void iwl_legacy_setup_scan_deferred_work(struct iwl_priv *priv); 447void il_setup_scan_deferred_work(struct il_priv *priv);
448void iwl_legacy_cancel_scan_deferred_work(struct iwl_priv *priv); 448void il_cancel_scan_deferred_work(struct il_priv *priv);
449 449
450/* For faster active scanning, scan will move to the next channel if fewer than 450/* For faster active scanning, scan will move to the next channel if fewer than
451 * PLCP_QUIET_THRESH packets are heard on this channel within 451 * PLCP_QUIET_THRESH packets are heard on this channel within
@@ -453,35 +453,35 @@ void iwl_legacy_cancel_scan_deferred_work(struct iwl_priv *priv);
453 * time if it's a quiet channel (nothing responded to our probe, and there's 453 * time if it's a quiet channel (nothing responded to our probe, and there's
454 * no other traffic). 454 * no other traffic).
455 * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ 455 * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */
456#define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */ 456#define IL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */
457#define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */ 457#define IL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */
458 458
459#define IWL_SCAN_CHECK_WATCHDOG (HZ * 7) 459#define IL_SCAN_CHECK_WATCHDOG (HZ * 7)
460 460
461/***************************************************** 461/*****************************************************
462 * S e n d i n g H o s t C o m m a n d s * 462 * S e n d i n g H o s t C o m m a n d s *
463 *****************************************************/ 463 *****************************************************/
464 464
465const char *iwl_legacy_get_cmd_string(u8 cmd); 465const char *il_get_cmd_string(u8 cmd);
466int __must_check iwl_legacy_send_cmd_sync(struct iwl_priv *priv, 466int __must_check il_send_cmd_sync(struct il_priv *priv,
467 struct iwl_host_cmd *cmd); 467 struct il_host_cmd *cmd);
468int iwl_legacy_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); 468int il_send_cmd(struct il_priv *priv, struct il_host_cmd *cmd);
469int __must_check iwl_legacy_send_cmd_pdu(struct iwl_priv *priv, u8 id, 469int __must_check il_send_cmd_pdu(struct il_priv *priv, u8 id,
470 u16 len, const void *data); 470 u16 len, const void *data);
471int iwl_legacy_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len, 471int il_send_cmd_pdu_async(struct il_priv *priv, u8 id, u16 len,
472 const void *data, 472 const void *data,
473 void (*callback)(struct iwl_priv *priv, 473 void (*callback)(struct il_priv *priv,
474 struct iwl_device_cmd *cmd, 474 struct il_device_cmd *cmd,
475 struct iwl_rx_packet *pkt)); 475 struct il_rx_packet *pkt));
476 476
477int iwl_legacy_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); 477int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd);
478 478
479 479
480/***************************************************** 480/*****************************************************
481 * PCI * 481 * PCI *
482 *****************************************************/ 482 *****************************************************/
483 483
484static inline u16 iwl_legacy_pcie_link_ctl(struct iwl_priv *priv) 484static inline u16 il_pcie_link_ctl(struct il_priv *priv)
485{ 485{
486 int pos; 486 int pos;
487 u16 pci_lnk_ctl; 487 u16 pci_lnk_ctl;
@@ -490,46 +490,46 @@ static inline u16 iwl_legacy_pcie_link_ctl(struct iwl_priv *priv)
490 return pci_lnk_ctl; 490 return pci_lnk_ctl;
491} 491}
492 492
493void iwl_legacy_bg_watchdog(unsigned long data); 493void il_bg_watchdog(unsigned long data);
494u32 iwl_legacy_usecs_to_beacons(struct iwl_priv *priv, 494u32 il_usecs_to_beacons(struct il_priv *priv,
495 u32 usec, u32 beacon_interval); 495 u32 usec, u32 beacon_interval);
496__le32 iwl_legacy_add_beacon_time(struct iwl_priv *priv, u32 base, 496__le32 il_add_beacon_time(struct il_priv *priv, u32 base,
497 u32 addon, u32 beacon_interval); 497 u32 addon, u32 beacon_interval);
498 498
499#ifdef CONFIG_PM 499#ifdef CONFIG_PM
500int iwl_legacy_pci_suspend(struct device *device); 500int il_pci_suspend(struct device *device);
501int iwl_legacy_pci_resume(struct device *device); 501int il_pci_resume(struct device *device);
502extern const struct dev_pm_ops iwl_legacy_pm_ops; 502extern const struct dev_pm_ops il_pm_ops;
503 503
504#define IWL_LEGACY_PM_OPS (&iwl_legacy_pm_ops) 504#define IL_LEGACY_PM_OPS (&il_pm_ops)
505 505
506#else /* !CONFIG_PM */ 506#else /* !CONFIG_PM */
507 507
508#define IWL_LEGACY_PM_OPS NULL 508#define IL_LEGACY_PM_OPS NULL
509 509
510#endif /* !CONFIG_PM */ 510#endif /* !CONFIG_PM */
511 511
512/***************************************************** 512/*****************************************************
513* Error Handling Debugging 513* Error Handling Debugging
514******************************************************/ 514******************************************************/
515void iwl4965_dump_nic_error_log(struct iwl_priv *priv); 515void il4965_dump_nic_error_log(struct il_priv *priv);
516#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 516#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
517void iwl_legacy_print_rx_config_cmd(struct iwl_priv *priv, 517void il_print_rx_config_cmd(struct il_priv *priv,
518 struct iwl_rxon_context *ctx); 518 struct il_rxon_context *ctx);
519#else 519#else
520static inline void iwl_legacy_print_rx_config_cmd(struct iwl_priv *priv, 520static inline void il_print_rx_config_cmd(struct il_priv *priv,
521 struct iwl_rxon_context *ctx) 521 struct il_rxon_context *ctx)
522{ 522{
523} 523}
524#endif 524#endif
525 525
526void iwl_legacy_clear_isr_stats(struct iwl_priv *priv); 526void il_clear_isr_stats(struct il_priv *priv);
527 527
528/***************************************************** 528/*****************************************************
529* GEOS 529* GEOS
530******************************************************/ 530******************************************************/
531int iwl_legacy_init_geos(struct iwl_priv *priv); 531int il_init_geos(struct il_priv *priv);
532void iwl_legacy_free_geos(struct iwl_priv *priv); 532void il_free_geos(struct il_priv *priv);
533 533
534/*************** DRIVER STATUS FUNCTIONS *****/ 534/*************** DRIVER STATUS FUNCTIONS *****/
535 535
@@ -552,7 +552,7 @@ void iwl_legacy_free_geos(struct iwl_priv *priv);
552#define STATUS_FW_ERROR 17 552#define STATUS_FW_ERROR 17
553#define STATUS_CHANNEL_SWITCH_PENDING 18 553#define STATUS_CHANNEL_SWITCH_PENDING 18
554 554
555static inline int iwl_legacy_is_ready(struct iwl_priv *priv) 555static inline int il_is_ready(struct il_priv *priv)
556{ 556{
557 /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are 557 /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are
558 * set but EXIT_PENDING is not */ 558 * set but EXIT_PENDING is not */
@@ -561,76 +561,76 @@ static inline int iwl_legacy_is_ready(struct iwl_priv *priv)
561 !test_bit(STATUS_EXIT_PENDING, &priv->status); 561 !test_bit(STATUS_EXIT_PENDING, &priv->status);
562} 562}
563 563
564static inline int iwl_legacy_is_alive(struct iwl_priv *priv) 564static inline int il_is_alive(struct il_priv *priv)
565{ 565{
566 return test_bit(STATUS_ALIVE, &priv->status); 566 return test_bit(STATUS_ALIVE, &priv->status);
567} 567}
568 568
569static inline int iwl_legacy_is_init(struct iwl_priv *priv) 569static inline int il_is_init(struct il_priv *priv)
570{ 570{
571 return test_bit(STATUS_INIT, &priv->status); 571 return test_bit(STATUS_INIT, &priv->status);
572} 572}
573 573
574static inline int iwl_legacy_is_rfkill_hw(struct iwl_priv *priv) 574static inline int il_is_rfkill_hw(struct il_priv *priv)
575{ 575{
576 return test_bit(STATUS_RF_KILL_HW, &priv->status); 576 return test_bit(STATUS_RF_KILL_HW, &priv->status);
577} 577}
578 578
579static inline int iwl_legacy_is_rfkill(struct iwl_priv *priv) 579static inline int il_is_rfkill(struct il_priv *priv)
580{ 580{
581 return iwl_legacy_is_rfkill_hw(priv); 581 return il_is_rfkill_hw(priv);
582} 582}
583 583
584static inline int iwl_legacy_is_ctkill(struct iwl_priv *priv) 584static inline int il_is_ctkill(struct il_priv *priv)
585{ 585{
586 return test_bit(STATUS_CT_KILL, &priv->status); 586 return test_bit(STATUS_CT_KILL, &priv->status);
587} 587}
588 588
589static inline int iwl_legacy_is_ready_rf(struct iwl_priv *priv) 589static inline int il_is_ready_rf(struct il_priv *priv)
590{ 590{
591 591
592 if (iwl_legacy_is_rfkill(priv)) 592 if (il_is_rfkill(priv))
593 return 0; 593 return 0;
594 594
595 return iwl_legacy_is_ready(priv); 595 return il_is_ready(priv);
596} 596}
597 597
598extern void iwl_legacy_send_bt_config(struct iwl_priv *priv); 598extern void il_send_bt_config(struct il_priv *priv);
599extern int iwl_legacy_send_statistics_request(struct iwl_priv *priv, 599extern int il_send_statistics_request(struct il_priv *priv,
600 u8 flags, bool clear); 600 u8 flags, bool clear);
601void iwl_legacy_apm_stop(struct iwl_priv *priv); 601void il_apm_stop(struct il_priv *priv);
602int iwl_legacy_apm_init(struct iwl_priv *priv); 602int il_apm_init(struct il_priv *priv);
603 603
604int iwl_legacy_send_rxon_timing(struct iwl_priv *priv, 604int il_send_rxon_timing(struct il_priv *priv,
605 struct iwl_rxon_context *ctx); 605 struct il_rxon_context *ctx);
606static inline int iwl_legacy_send_rxon_assoc(struct iwl_priv *priv, 606static inline int il_send_rxon_assoc(struct il_priv *priv,
607 struct iwl_rxon_context *ctx) 607 struct il_rxon_context *ctx)
608{ 608{
609 return priv->cfg->ops->hcmd->rxon_assoc(priv, ctx); 609 return priv->cfg->ops->hcmd->rxon_assoc(priv, ctx);
610} 610}
611static inline int iwl_legacy_commit_rxon(struct iwl_priv *priv, 611static inline int il_commit_rxon(struct il_priv *priv,
612 struct iwl_rxon_context *ctx) 612 struct il_rxon_context *ctx)
613{ 613{
614 return priv->cfg->ops->hcmd->commit_rxon(priv, ctx); 614 return priv->cfg->ops->hcmd->commit_rxon(priv, ctx);
615} 615}
616static inline const struct ieee80211_supported_band *iwl_get_hw_mode( 616static inline const struct ieee80211_supported_band *il_get_hw_mode(
617 struct iwl_priv *priv, enum ieee80211_band band) 617 struct il_priv *priv, enum ieee80211_band band)
618{ 618{
619 return priv->hw->wiphy->bands[band]; 619 return priv->hw->wiphy->bands[band];
620} 620}
621 621
622/* mac80211 handlers */ 622/* mac80211 handlers */
623int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed); 623int il_mac_config(struct ieee80211_hw *hw, u32 changed);
624void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw, 624void il_mac_reset_tsf(struct ieee80211_hw *hw,
625 struct ieee80211_vif *vif); 625 struct ieee80211_vif *vif);
626void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, 626void il_mac_bss_info_changed(struct ieee80211_hw *hw,
627 struct ieee80211_vif *vif, 627 struct ieee80211_vif *vif,
628 struct ieee80211_bss_conf *bss_conf, 628 struct ieee80211_bss_conf *bss_conf,
629 u32 changes); 629 u32 changes);
630void iwl_legacy_tx_cmd_protection(struct iwl_priv *priv, 630void il_tx_cmd_protection(struct il_priv *priv,
631 struct ieee80211_tx_info *info, 631 struct ieee80211_tx_info *info,
632 __le16 fc, __le32 *tx_flags); 632 __le16 fc, __le32 *tx_flags);
633 633
634irqreturn_t iwl_legacy_isr(int irq, void *data); 634irqreturn_t il_isr(int irq, void *data);
635 635
636#endif /* __iwl_legacy_core_h__ */ 636#endif /* __il_core_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-csr.h b/drivers/net/wireless/iwlegacy/iwl-csr.h
index 668a9616c269..24b71ae79040 100644
--- a/drivers/net/wireless/iwlegacy/iwl-csr.h
+++ b/drivers/net/wireless/iwlegacy/iwl-csr.h
@@ -60,8 +60,8 @@
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 * 61 *
62 *****************************************************************************/ 62 *****************************************************************************/
63#ifndef __iwl_legacy_csr_h__ 63#ifndef __il_csr_h__
64#define __iwl_legacy_csr_h__ 64#define __il_csr_h__
65/* 65/*
66 * CSR (control and status registers) 66 * CSR (control and status registers)
67 * 67 *
@@ -70,9 +70,9 @@
70 * low power states due to driver-invoked device resets 70 * low power states due to driver-invoked device resets
71 * (e.g. CSR_RESET_REG_FLAG_SW_RESET) or uCode-driven power-saving modes. 71 * (e.g. CSR_RESET_REG_FLAG_SW_RESET) or uCode-driven power-saving modes.
72 * 72 *
73 * Use iwl_write32() and iwl_read32() family to access these registers; 73 * Use il_write32() and il_read32() family to access these registers;
74 * these provide simple PCI bus access, without waking up the MAC. 74 * these provide simple PCI bus access, without waking up the MAC.
75 * Do not use iwl_legacy_write_direct32() family for these registers; 75 * Do not use il_write_direct32() family for these registers;
76 * no need to "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ. 76 * no need to "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ.
77 * The MAC (uCode processor, etc.) does not need to be powered up for accessing 77 * The MAC (uCode processor, etc.) does not need to be powered up for accessing
78 * the CSR registers. 78 * the CSR registers.
@@ -91,7 +91,7 @@
91#define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/ 91#define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/
92#define CSR_GP_CNTRL (CSR_BASE+0x024) 92#define CSR_GP_CNTRL (CSR_BASE+0x024)
93 93
94/* 2nd byte of CSR_INT_COALESCING, not accessible via iwl_write32()! */ 94/* 2nd byte of CSR_INT_COALESCING, not accessible via il_write32()! */
95#define CSR_INT_PERIODIC_REG (CSR_BASE+0x005) 95#define CSR_INT_PERIODIC_REG (CSR_BASE+0x005)
96 96
97/* 97/*
@@ -368,13 +368,13 @@
368 * to indirectly access device's internal memory or registers that 368 * to indirectly access device's internal memory or registers that
369 * may be powered-down. 369 * may be powered-down.
370 * 370 *
371 * Use iwl_legacy_write_direct32()/iwl_legacy_read_direct32() family 371 * Use il_write_direct32()/il_read_direct32() family
372 * for these registers; 372 * for these registers;
373 * host must "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ 373 * host must "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ
374 * to make sure the MAC (uCode processor, etc.) is powered up for accessing 374 * to make sure the MAC (uCode processor, etc.) is powered up for accessing
375 * internal resources. 375 * internal resources.
376 * 376 *
377 * Do not use iwl_write32()/iwl_read32() family to access these registers; 377 * Do not use il_write32()/il_read32() family to access these registers;
378 * these provide only simple PCI bus access, without waking up the MAC. 378 * these provide only simple PCI bus access, without waking up the MAC.
379 */ 379 */
380#define HBUS_BASE (0x400) 380#define HBUS_BASE (0x400)
@@ -419,4 +419,4 @@
419 */ 419 */
420#define HBUS_TARG_WRPTR (HBUS_BASE+0x060) 420#define HBUS_TARG_WRPTR (HBUS_BASE+0x060)
421 421
422#endif /* !__iwl_legacy_csr_h__ */ 422#endif /* !__il_csr_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-debug.h b/drivers/net/wireless/iwlegacy/iwl-debug.h
index ae13112701bf..1bbad766aac7 100644
--- a/drivers/net/wireless/iwlegacy/iwl-debug.h
+++ b/drivers/net/wireless/iwlegacy/iwl-debug.h
@@ -26,65 +26,65 @@
26 * 26 *
27 *****************************************************************************/ 27 *****************************************************************************/
28 28
29#ifndef __iwl_legacy_debug_h__ 29#ifndef __il_debug_h__
30#define __iwl_legacy_debug_h__ 30#define __il_debug_h__
31 31
32struct iwl_priv; 32struct il_priv;
33extern u32 iwlegacy_debug_level; 33extern u32 iwlegacy_debug_level;
34 34
35#define IWL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a) 35#define IL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a)
36#define IWL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a) 36#define IL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a)
37#define IWL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a) 37#define IL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a)
38#define IWL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a) 38#define IL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a)
39 39
40#define iwl_print_hex_error(priv, p, len) \ 40#define il_print_hex_error(priv, p, len) \
41do { \ 41do { \
42 print_hex_dump(KERN_ERR, "iwl data: ", \ 42 print_hex_dump(KERN_ERR, "iwl data: ", \
43 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ 43 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
44} while (0) 44} while (0)
45 45
46#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 46#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
47#define IWL_DEBUG(__priv, level, fmt, args...) \ 47#define IL_DEBUG(__priv, level, fmt, args...) \
48do { \ 48do { \
49 if (iwl_legacy_get_debug_level(__priv) & (level)) \ 49 if (il_get_debug_level(__priv) & (level)) \
50 dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev), \ 50 dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev), \
51 "%c %s " fmt, in_interrupt() ? 'I' : 'U', \ 51 "%c %s " fmt, in_interrupt() ? 'I' : 'U', \
52 __func__ , ## args); \ 52 __func__ , ## args); \
53} while (0) 53} while (0)
54 54
55#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...) \ 55#define IL_DEBUG_LIMIT(__priv, level, fmt, args...) \
56do { \ 56do { \
57 if ((iwl_legacy_get_debug_level(__priv) & (level)) && net_ratelimit()) \ 57 if ((il_get_debug_level(__priv) & (level)) && net_ratelimit()) \
58 dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev), \ 58 dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev), \
59 "%c %s " fmt, in_interrupt() ? 'I' : 'U', \ 59 "%c %s " fmt, in_interrupt() ? 'I' : 'U', \
60 __func__ , ## args); \ 60 __func__ , ## args); \
61} while (0) 61} while (0)
62 62
63#define iwl_print_hex_dump(priv, level, p, len) \ 63#define il_print_hex_dump(priv, level, p, len) \
64do { \ 64do { \
65 if (iwl_legacy_get_debug_level(priv) & level) \ 65 if (il_get_debug_level(priv) & level) \
66 print_hex_dump(KERN_DEBUG, "iwl data: ", \ 66 print_hex_dump(KERN_DEBUG, "iwl data: ", \
67 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ 67 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
68} while (0) 68} while (0)
69 69
70#else 70#else
71#define IWL_DEBUG(__priv, level, fmt, args...) 71#define IL_DEBUG(__priv, level, fmt, args...)
72#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...) 72#define IL_DEBUG_LIMIT(__priv, level, fmt, args...)
73static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level, 73static inline void il_print_hex_dump(struct il_priv *priv, int level,
74 const void *p, u32 len) 74 const void *p, u32 len)
75{} 75{}
76#endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */ 76#endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */
77 77
78#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 78#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
79int iwl_legacy_dbgfs_register(struct iwl_priv *priv, const char *name); 79int il_dbgfs_register(struct il_priv *priv, const char *name);
80void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv); 80void il_dbgfs_unregister(struct il_priv *priv);
81#else 81#else
82static inline int 82static inline int
83iwl_legacy_dbgfs_register(struct iwl_priv *priv, const char *name) 83il_dbgfs_register(struct il_priv *priv, const char *name)
84{ 84{
85 return 0; 85 return 0;
86} 86}
87static inline void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv) 87static inline void il_dbgfs_unregister(struct il_priv *priv)
88{ 88{
89} 89}
90#endif /* CONFIG_IWLWIFI_LEGACY_DEBUGFS */ 90#endif /* CONFIG_IWLWIFI_LEGACY_DEBUGFS */
@@ -95,12 +95,12 @@ static inline void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv)
95 * If you are defining a new debug classification, simply add it to the #define 95 * If you are defining a new debug classification, simply add it to the #define
96 * list here in the form of 96 * list here in the form of
97 * 97 *
98 * #define IWL_DL_xxxx VALUE 98 * #define IL_DL_xxxx VALUE
99 * 99 *
100 * where xxxx should be the name of the classification (for example, WEP). 100 * where xxxx should be the name of the classification (for example, WEP).
101 * 101 *
102 * You then need to either add a IWL_xxxx_DEBUG() macro definition for your 102 * You then need to either add a IL_xxxx_DEBUG() macro definition for your
103 * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want 103 * classification, or use IL_DEBUG(IL_DL_xxxx, ...) whenever you want
104 * to send output to that classification. 104 * to send output to that classification.
105 * 105 *
106 * The active debug levels can be accessed via files 106 * The active debug levels can be accessed via files
@@ -113,86 +113,86 @@ static inline void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv)
113 */ 113 */
114 114
115/* 0x0000000F - 0x00000001 */ 115/* 0x0000000F - 0x00000001 */
116#define IWL_DL_INFO (1 << 0) 116#define IL_DL_INFO (1 << 0)
117#define IWL_DL_MAC80211 (1 << 1) 117#define IL_DL_MAC80211 (1 << 1)
118#define IWL_DL_HCMD (1 << 2) 118#define IL_DL_HCMD (1 << 2)
119#define IWL_DL_STATE (1 << 3) 119#define IL_DL_STATE (1 << 3)
120/* 0x000000F0 - 0x00000010 */ 120/* 0x000000F0 - 0x00000010 */
121#define IWL_DL_MACDUMP (1 << 4) 121#define IL_DL_MACDUMP (1 << 4)
122#define IWL_DL_HCMD_DUMP (1 << 5) 122#define IL_DL_HCMD_DUMP (1 << 5)
123#define IWL_DL_EEPROM (1 << 6) 123#define IL_DL_EEPROM (1 << 6)
124#define IWL_DL_RADIO (1 << 7) 124#define IL_DL_RADIO (1 << 7)
125/* 0x00000F00 - 0x00000100 */ 125/* 0x00000F00 - 0x00000100 */
126#define IWL_DL_POWER (1 << 8) 126#define IL_DL_POWER (1 << 8)
127#define IWL_DL_TEMP (1 << 9) 127#define IL_DL_TEMP (1 << 9)
128#define IWL_DL_NOTIF (1 << 10) 128#define IL_DL_NOTIF (1 << 10)
129#define IWL_DL_SCAN (1 << 11) 129#define IL_DL_SCAN (1 << 11)
130/* 0x0000F000 - 0x00001000 */ 130/* 0x0000F000 - 0x00001000 */
131#define IWL_DL_ASSOC (1 << 12) 131#define IL_DL_ASSOC (1 << 12)
132#define IWL_DL_DROP (1 << 13) 132#define IL_DL_DROP (1 << 13)
133#define IWL_DL_TXPOWER (1 << 14) 133#define IL_DL_TXPOWER (1 << 14)
134#define IWL_DL_AP (1 << 15) 134#define IL_DL_AP (1 << 15)
135/* 0x000F0000 - 0x00010000 */ 135/* 0x000F0000 - 0x00010000 */
136#define IWL_DL_FW (1 << 16) 136#define IL_DL_FW (1 << 16)
137#define IWL_DL_RF_KILL (1 << 17) 137#define IL_DL_RF_KILL (1 << 17)
138#define IWL_DL_FW_ERRORS (1 << 18) 138#define IL_DL_FW_ERRORS (1 << 18)
139#define IWL_DL_LED (1 << 19) 139#define IL_DL_LED (1 << 19)
140/* 0x00F00000 - 0x00100000 */ 140/* 0x00F00000 - 0x00100000 */
141#define IWL_DL_RATE (1 << 20) 141#define IL_DL_RATE (1 << 20)
142#define IWL_DL_CALIB (1 << 21) 142#define IL_DL_CALIB (1 << 21)
143#define IWL_DL_WEP (1 << 22) 143#define IL_DL_WEP (1 << 22)
144#define IWL_DL_TX (1 << 23) 144#define IL_DL_TX (1 << 23)
145/* 0x0F000000 - 0x01000000 */ 145/* 0x0F000000 - 0x01000000 */
146#define IWL_DL_RX (1 << 24) 146#define IL_DL_RX (1 << 24)
147#define IWL_DL_ISR (1 << 25) 147#define IL_DL_ISR (1 << 25)
148#define IWL_DL_HT (1 << 26) 148#define IL_DL_HT (1 << 26)
149#define IWL_DL_IO (1 << 27) 149#define IL_DL_IO (1 << 27)
150/* 0xF0000000 - 0x10000000 */ 150/* 0xF0000000 - 0x10000000 */
151#define IWL_DL_11H (1 << 28) 151#define IL_DL_11H (1 << 28)
152#define IWL_DL_STATS (1 << 29) 152#define IL_DL_STATS (1 << 29)
153#define IWL_DL_TX_REPLY (1 << 30) 153#define IL_DL_TX_REPLY (1 << 30)
154#define IWL_DL_QOS (1 << 31) 154#define IL_DL_QOS (1 << 31)
155 155
156#define IWL_DEBUG_INFO(p, f, a...) IWL_DEBUG(p, IWL_DL_INFO, f, ## a) 156#define IL_DEBUG_INFO(p, f, a...) IL_DEBUG(p, IL_DL_INFO, f, ## a)
157#define IWL_DEBUG_MAC80211(p, f, a...) IWL_DEBUG(p, IWL_DL_MAC80211, f, ## a) 157#define IL_DEBUG_MAC80211(p, f, a...) IL_DEBUG(p, IL_DL_MAC80211, f, ## a)
158#define IWL_DEBUG_MACDUMP(p, f, a...) IWL_DEBUG(p, IWL_DL_MACDUMP, f, ## a) 158#define IL_DEBUG_MACDUMP(p, f, a...) IL_DEBUG(p, IL_DL_MACDUMP, f, ## a)
159#define IWL_DEBUG_TEMP(p, f, a...) IWL_DEBUG(p, IWL_DL_TEMP, f, ## a) 159#define IL_DEBUG_TEMP(p, f, a...) IL_DEBUG(p, IL_DL_TEMP, f, ## a)
160#define IWL_DEBUG_SCAN(p, f, a...) IWL_DEBUG(p, IWL_DL_SCAN, f, ## a) 160#define IL_DEBUG_SCAN(p, f, a...) IL_DEBUG(p, IL_DL_SCAN, f, ## a)
161#define IWL_DEBUG_RX(p, f, a...) IWL_DEBUG(p, IWL_DL_RX, f, ## a) 161#define IL_DEBUG_RX(p, f, a...) IL_DEBUG(p, IL_DL_RX, f, ## a)
162#define IWL_DEBUG_TX(p, f, a...) IWL_DEBUG(p, IWL_DL_TX, f, ## a) 162#define IL_DEBUG_TX(p, f, a...) IL_DEBUG(p, IL_DL_TX, f, ## a)
163#define IWL_DEBUG_ISR(p, f, a...) IWL_DEBUG(p, IWL_DL_ISR, f, ## a) 163#define IL_DEBUG_ISR(p, f, a...) IL_DEBUG(p, IL_DL_ISR, f, ## a)
164#define IWL_DEBUG_LED(p, f, a...) IWL_DEBUG(p, IWL_DL_LED, f, ## a) 164#define IL_DEBUG_LED(p, f, a...) IL_DEBUG(p, IL_DL_LED, f, ## a)
165#define IWL_DEBUG_WEP(p, f, a...) IWL_DEBUG(p, IWL_DL_WEP, f, ## a) 165#define IL_DEBUG_WEP(p, f, a...) IL_DEBUG(p, IL_DL_WEP, f, ## a)
166#define IWL_DEBUG_HC(p, f, a...) IWL_DEBUG(p, IWL_DL_HCMD, f, ## a) 166#define IL_DEBUG_HC(p, f, a...) IL_DEBUG(p, IL_DL_HCMD, f, ## a)
167#define IWL_DEBUG_HC_DUMP(p, f, a...) IWL_DEBUG(p, IWL_DL_HCMD_DUMP, f, ## a) 167#define IL_DEBUG_HC_DUMP(p, f, a...) IL_DEBUG(p, IL_DL_HCMD_DUMP, f, ## a)
168#define IWL_DEBUG_EEPROM(p, f, a...) IWL_DEBUG(p, IWL_DL_EEPROM, f, ## a) 168#define IL_DEBUG_EEPROM(p, f, a...) IL_DEBUG(p, IL_DL_EEPROM, f, ## a)
169#define IWL_DEBUG_CALIB(p, f, a...) IWL_DEBUG(p, IWL_DL_CALIB, f, ## a) 169#define IL_DEBUG_CALIB(p, f, a...) IL_DEBUG(p, IL_DL_CALIB, f, ## a)
170#define IWL_DEBUG_FW(p, f, a...) IWL_DEBUG(p, IWL_DL_FW, f, ## a) 170#define IL_DEBUG_FW(p, f, a...) IL_DEBUG(p, IL_DL_FW, f, ## a)
171#define IWL_DEBUG_RF_KILL(p, f, a...) IWL_DEBUG(p, IWL_DL_RF_KILL, f, ## a) 171#define IL_DEBUG_RF_KILL(p, f, a...) IL_DEBUG(p, IL_DL_RF_KILL, f, ## a)
172#define IWL_DEBUG_DROP(p, f, a...) IWL_DEBUG(p, IWL_DL_DROP, f, ## a) 172#define IL_DEBUG_DROP(p, f, a...) IL_DEBUG(p, IL_DL_DROP, f, ## a)
173#define IWL_DEBUG_DROP_LIMIT(p, f, a...) \ 173#define IL_DEBUG_DROP_LIMIT(p, f, a...) \
174 IWL_DEBUG_LIMIT(p, IWL_DL_DROP, f, ## a) 174 IL_DEBUG_LIMIT(p, IL_DL_DROP, f, ## a)
175#define IWL_DEBUG_AP(p, f, a...) IWL_DEBUG(p, IWL_DL_AP, f, ## a) 175#define IL_DEBUG_AP(p, f, a...) IL_DEBUG(p, IL_DL_AP, f, ## a)
176#define IWL_DEBUG_TXPOWER(p, f, a...) IWL_DEBUG(p, IWL_DL_TXPOWER, f, ## a) 176#define IL_DEBUG_TXPOWER(p, f, a...) IL_DEBUG(p, IL_DL_TXPOWER, f, ## a)
177#define IWL_DEBUG_IO(p, f, a...) IWL_DEBUG(p, IWL_DL_IO, f, ## a) 177#define IL_DEBUG_IO(p, f, a...) IL_DEBUG(p, IL_DL_IO, f, ## a)
178#define IWL_DEBUG_RATE(p, f, a...) IWL_DEBUG(p, IWL_DL_RATE, f, ## a) 178#define IL_DEBUG_RATE(p, f, a...) IL_DEBUG(p, IL_DL_RATE, f, ## a)
179#define IWL_DEBUG_RATE_LIMIT(p, f, a...) \ 179#define IL_DEBUG_RATE_LIMIT(p, f, a...) \
180 IWL_DEBUG_LIMIT(p, IWL_DL_RATE, f, ## a) 180 IL_DEBUG_LIMIT(p, IL_DL_RATE, f, ## a)
181#define IWL_DEBUG_NOTIF(p, f, a...) IWL_DEBUG(p, IWL_DL_NOTIF, f, ## a) 181#define IL_DEBUG_NOTIF(p, f, a...) IL_DEBUG(p, IL_DL_NOTIF, f, ## a)
182#define IWL_DEBUG_ASSOC(p, f, a...) \ 182#define IL_DEBUG_ASSOC(p, f, a...) \
183 IWL_DEBUG(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) 183 IL_DEBUG(p, IL_DL_ASSOC | IL_DL_INFO, f, ## a)
184#define IWL_DEBUG_ASSOC_LIMIT(p, f, a...) \ 184#define IL_DEBUG_ASSOC_LIMIT(p, f, a...) \
185 IWL_DEBUG_LIMIT(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) 185 IL_DEBUG_LIMIT(p, IL_DL_ASSOC | IL_DL_INFO, f, ## a)
186#define IWL_DEBUG_HT(p, f, a...) IWL_DEBUG(p, IWL_DL_HT, f, ## a) 186#define IL_DEBUG_HT(p, f, a...) IL_DEBUG(p, IL_DL_HT, f, ## a)
187#define IWL_DEBUG_STATS(p, f, a...) IWL_DEBUG(p, IWL_DL_STATS, f, ## a) 187#define IL_DEBUG_STATS(p, f, a...) IL_DEBUG(p, IL_DL_STATS, f, ## a)
188#define IWL_DEBUG_STATS_LIMIT(p, f, a...) \ 188#define IL_DEBUG_STATS_LIMIT(p, f, a...) \
189 IWL_DEBUG_LIMIT(p, IWL_DL_STATS, f, ## a) 189 IL_DEBUG_LIMIT(p, IL_DL_STATS, f, ## a)
190#define IWL_DEBUG_TX_REPLY(p, f, a...) IWL_DEBUG(p, IWL_DL_TX_REPLY, f, ## a) 190#define IL_DEBUG_TX_REPLY(p, f, a...) IL_DEBUG(p, IL_DL_TX_REPLY, f, ## a)
191#define IWL_DEBUG_TX_REPLY_LIMIT(p, f, a...) \ 191#define IL_DEBUG_TX_REPLY_LIMIT(p, f, a...) \
192 IWL_DEBUG_LIMIT(p, IWL_DL_TX_REPLY, f, ## a) 192 IL_DEBUG_LIMIT(p, IL_DL_TX_REPLY, f, ## a)
193#define IWL_DEBUG_QOS(p, f, a...) IWL_DEBUG(p, IWL_DL_QOS, f, ## a) 193#define IL_DEBUG_QOS(p, f, a...) IL_DEBUG(p, IL_DL_QOS, f, ## a)
194#define IWL_DEBUG_RADIO(p, f, a...) IWL_DEBUG(p, IWL_DL_RADIO, f, ## a) 194#define IL_DEBUG_RADIO(p, f, a...) IL_DEBUG(p, IL_DL_RADIO, f, ## a)
195#define IWL_DEBUG_POWER(p, f, a...) IWL_DEBUG(p, IWL_DL_POWER, f, ## a) 195#define IL_DEBUG_POWER(p, f, a...) IL_DEBUG(p, IL_DL_POWER, f, ## a)
196#define IWL_DEBUG_11H(p, f, a...) IWL_DEBUG(p, IWL_DL_11H, f, ## a) 196#define IL_DEBUG_11H(p, f, a...) IL_DEBUG(p, IL_DL_11H, f, ## a)
197 197
198#endif 198#endif
diff --git a/drivers/net/wireless/iwlegacy/iwl-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
index 996996a71657..057dec5b178c 100644
--- a/drivers/net/wireless/iwlegacy/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
@@ -37,7 +37,7 @@
37/* create and remove of files */ 37/* create and remove of files */
38#define DEBUGFS_ADD_FILE(name, parent, mode) do { \ 38#define DEBUGFS_ADD_FILE(name, parent, mode) do { \
39 if (!debugfs_create_file(#name, mode, parent, priv, \ 39 if (!debugfs_create_file(#name, mode, parent, priv, \
40 &iwl_legacy_dbgfs_##name##_ops)) \ 40 &il_dbgfs_##name##_ops)) \
41 goto err; \ 41 goto err; \
42} while (0) 42} while (0)
43 43
@@ -59,18 +59,18 @@
59 59
60/* file operation */ 60/* file operation */
61#define DEBUGFS_READ_FUNC(name) \ 61#define DEBUGFS_READ_FUNC(name) \
62static ssize_t iwl_legacy_dbgfs_##name##_read(struct file *file, \ 62static ssize_t il_dbgfs_##name##_read(struct file *file, \
63 char __user *user_buf, \ 63 char __user *user_buf, \
64 size_t count, loff_t *ppos); 64 size_t count, loff_t *ppos);
65 65
66#define DEBUGFS_WRITE_FUNC(name) \ 66#define DEBUGFS_WRITE_FUNC(name) \
67static ssize_t iwl_legacy_dbgfs_##name##_write(struct file *file, \ 67static ssize_t il_dbgfs_##name##_write(struct file *file, \
68 const char __user *user_buf, \ 68 const char __user *user_buf, \
69 size_t count, loff_t *ppos); 69 size_t count, loff_t *ppos);
70 70
71 71
72static int 72static int
73iwl_legacy_dbgfs_open_file_generic(struct inode *inode, struct file *file) 73il_dbgfs_open_file_generic(struct inode *inode, struct file *file)
74{ 74{
75 file->private_data = inode->i_private; 75 file->private_data = inode->i_private;
76 return 0; 76 return 0;
@@ -78,35 +78,35 @@ iwl_legacy_dbgfs_open_file_generic(struct inode *inode, struct file *file)
78 78
79#define DEBUGFS_READ_FILE_OPS(name) \ 79#define DEBUGFS_READ_FILE_OPS(name) \
80 DEBUGFS_READ_FUNC(name); \ 80 DEBUGFS_READ_FUNC(name); \
81static const struct file_operations iwl_legacy_dbgfs_##name##_ops = { \ 81static const struct file_operations il_dbgfs_##name##_ops = { \
82 .read = iwl_legacy_dbgfs_##name##_read, \ 82 .read = il_dbgfs_##name##_read, \
83 .open = iwl_legacy_dbgfs_open_file_generic, \ 83 .open = il_dbgfs_open_file_generic, \
84 .llseek = generic_file_llseek, \ 84 .llseek = generic_file_llseek, \
85}; 85};
86 86
87#define DEBUGFS_WRITE_FILE_OPS(name) \ 87#define DEBUGFS_WRITE_FILE_OPS(name) \
88 DEBUGFS_WRITE_FUNC(name); \ 88 DEBUGFS_WRITE_FUNC(name); \
89static const struct file_operations iwl_legacy_dbgfs_##name##_ops = { \ 89static const struct file_operations il_dbgfs_##name##_ops = { \
90 .write = iwl_legacy_dbgfs_##name##_write, \ 90 .write = il_dbgfs_##name##_write, \
91 .open = iwl_legacy_dbgfs_open_file_generic, \ 91 .open = il_dbgfs_open_file_generic, \
92 .llseek = generic_file_llseek, \ 92 .llseek = generic_file_llseek, \
93}; 93};
94 94
95#define DEBUGFS_READ_WRITE_FILE_OPS(name) \ 95#define DEBUGFS_READ_WRITE_FILE_OPS(name) \
96 DEBUGFS_READ_FUNC(name); \ 96 DEBUGFS_READ_FUNC(name); \
97 DEBUGFS_WRITE_FUNC(name); \ 97 DEBUGFS_WRITE_FUNC(name); \
98static const struct file_operations iwl_legacy_dbgfs_##name##_ops = { \ 98static const struct file_operations il_dbgfs_##name##_ops = { \
99 .write = iwl_legacy_dbgfs_##name##_write, \ 99 .write = il_dbgfs_##name##_write, \
100 .read = iwl_legacy_dbgfs_##name##_read, \ 100 .read = il_dbgfs_##name##_read, \
101 .open = iwl_legacy_dbgfs_open_file_generic, \ 101 .open = il_dbgfs_open_file_generic, \
102 .llseek = generic_file_llseek, \ 102 .llseek = generic_file_llseek, \
103}; 103};
104 104
105static ssize_t iwl_legacy_dbgfs_tx_statistics_read(struct file *file, 105static ssize_t il_dbgfs_tx_statistics_read(struct file *file,
106 char __user *user_buf, 106 char __user *user_buf,
107 size_t count, loff_t *ppos) { 107 size_t count, loff_t *ppos) {
108 108
109 struct iwl_priv *priv = file->private_data; 109 struct il_priv *priv = file->private_data;
110 char *buf; 110 char *buf;
111 int pos = 0; 111 int pos = 0;
112 112
@@ -121,14 +121,14 @@ static ssize_t iwl_legacy_dbgfs_tx_statistics_read(struct file *file,
121 for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { 121 for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
122 pos += scnprintf(buf + pos, bufsz - pos, 122 pos += scnprintf(buf + pos, bufsz - pos,
123 "\t%25s\t\t: %u\n", 123 "\t%25s\t\t: %u\n",
124 iwl_legacy_get_mgmt_string(cnt), 124 il_get_mgmt_string(cnt),
125 priv->tx_stats.mgmt[cnt]); 125 priv->tx_stats.mgmt[cnt]);
126 } 126 }
127 pos += scnprintf(buf + pos, bufsz - pos, "Control\n"); 127 pos += scnprintf(buf + pos, bufsz - pos, "Control\n");
128 for (cnt = 0; cnt < CONTROL_MAX; cnt++) { 128 for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
129 pos += scnprintf(buf + pos, bufsz - pos, 129 pos += scnprintf(buf + pos, bufsz - pos,
130 "\t%25s\t\t: %u\n", 130 "\t%25s\t\t: %u\n",
131 iwl_legacy_get_ctrl_string(cnt), 131 il_get_ctrl_string(cnt),
132 priv->tx_stats.ctrl[cnt]); 132 priv->tx_stats.ctrl[cnt]);
133 } 133 }
134 pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); 134 pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
@@ -142,11 +142,11 @@ static ssize_t iwl_legacy_dbgfs_tx_statistics_read(struct file *file,
142} 142}
143 143
144static ssize_t 144static ssize_t
145iwl_legacy_dbgfs_clear_traffic_statistics_write(struct file *file, 145il_dbgfs_clear_traffic_statistics_write(struct file *file,
146 const char __user *user_buf, 146 const char __user *user_buf,
147 size_t count, loff_t *ppos) 147 size_t count, loff_t *ppos)
148{ 148{
149 struct iwl_priv *priv = file->private_data; 149 struct il_priv *priv = file->private_data;
150 u32 clear_flag; 150 u32 clear_flag;
151 char buf[8]; 151 char buf[8];
152 int buf_size; 152 int buf_size;
@@ -157,16 +157,16 @@ iwl_legacy_dbgfs_clear_traffic_statistics_write(struct file *file,
157 return -EFAULT; 157 return -EFAULT;
158 if (sscanf(buf, "%x", &clear_flag) != 1) 158 if (sscanf(buf, "%x", &clear_flag) != 1)
159 return -EFAULT; 159 return -EFAULT;
160 iwl_legacy_clear_traffic_stats(priv); 160 il_clear_traffic_stats(priv);
161 161
162 return count; 162 return count;
163} 163}
164 164
165static ssize_t iwl_legacy_dbgfs_rx_statistics_read(struct file *file, 165static ssize_t il_dbgfs_rx_statistics_read(struct file *file,
166 char __user *user_buf, 166 char __user *user_buf,
167 size_t count, loff_t *ppos) { 167 size_t count, loff_t *ppos) {
168 168
169 struct iwl_priv *priv = file->private_data; 169 struct il_priv *priv = file->private_data;
170 char *buf; 170 char *buf;
171 int pos = 0; 171 int pos = 0;
172 int cnt; 172 int cnt;
@@ -181,14 +181,14 @@ static ssize_t iwl_legacy_dbgfs_rx_statistics_read(struct file *file,
181 for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { 181 for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
182 pos += scnprintf(buf + pos, bufsz - pos, 182 pos += scnprintf(buf + pos, bufsz - pos,
183 "\t%25s\t\t: %u\n", 183 "\t%25s\t\t: %u\n",
184 iwl_legacy_get_mgmt_string(cnt), 184 il_get_mgmt_string(cnt),
185 priv->rx_stats.mgmt[cnt]); 185 priv->rx_stats.mgmt[cnt]);
186 } 186 }
187 pos += scnprintf(buf + pos, bufsz - pos, "Control:\n"); 187 pos += scnprintf(buf + pos, bufsz - pos, "Control:\n");
188 for (cnt = 0; cnt < CONTROL_MAX; cnt++) { 188 for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
189 pos += scnprintf(buf + pos, bufsz - pos, 189 pos += scnprintf(buf + pos, bufsz - pos,
190 "\t%25s\t\t: %u\n", 190 "\t%25s\t\t: %u\n",
191 iwl_legacy_get_ctrl_string(cnt), 191 il_get_ctrl_string(cnt),
192 priv->rx_stats.ctrl[cnt]); 192 priv->rx_stats.ctrl[cnt]);
193 } 193 }
194 pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); 194 pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
@@ -205,7 +205,7 @@ static ssize_t iwl_legacy_dbgfs_rx_statistics_read(struct file *file,
205#define BYTE1_MASK 0x000000ff; 205#define BYTE1_MASK 0x000000ff;
206#define BYTE2_MASK 0x0000ffff; 206#define BYTE2_MASK 0x0000ffff;
207#define BYTE3_MASK 0x00ffffff; 207#define BYTE3_MASK 0x00ffffff;
208static ssize_t iwl_legacy_dbgfs_sram_read(struct file *file, 208static ssize_t il_dbgfs_sram_read(struct file *file,
209 char __user *user_buf, 209 char __user *user_buf,
210 size_t count, loff_t *ppos) 210 size_t count, loff_t *ppos)
211{ 211{
@@ -214,7 +214,7 @@ static ssize_t iwl_legacy_dbgfs_sram_read(struct file *file,
214 ssize_t ret; 214 ssize_t ret;
215 int i; 215 int i;
216 int pos = 0; 216 int pos = 0;
217 struct iwl_priv *priv = file->private_data; 217 struct il_priv *priv = file->private_data;
218 size_t bufsz; 218 size_t bufsz;
219 219
220 /* default is to dump the entire data segment */ 220 /* default is to dump the entire data segment */
@@ -234,7 +234,7 @@ static ssize_t iwl_legacy_dbgfs_sram_read(struct file *file,
234 pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n", 234 pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n",
235 priv->dbgfs_sram_offset); 235 priv->dbgfs_sram_offset);
236 for (i = priv->dbgfs_sram_len; i > 0; i -= 4) { 236 for (i = priv->dbgfs_sram_len; i > 0; i -= 4) {
237 val = iwl_legacy_read_targ_mem(priv, priv->dbgfs_sram_offset + \ 237 val = il_read_targ_mem(priv, priv->dbgfs_sram_offset + \
238 priv->dbgfs_sram_len - i); 238 priv->dbgfs_sram_len - i);
239 if (i < 4) { 239 if (i < 4) {
240 switch (i) { 240 switch (i) {
@@ -260,11 +260,11 @@ static ssize_t iwl_legacy_dbgfs_sram_read(struct file *file,
260 return ret; 260 return ret;
261} 261}
262 262
263static ssize_t iwl_legacy_dbgfs_sram_write(struct file *file, 263static ssize_t il_dbgfs_sram_write(struct file *file,
264 const char __user *user_buf, 264 const char __user *user_buf,
265 size_t count, loff_t *ppos) 265 size_t count, loff_t *ppos)
266{ 266{
267 struct iwl_priv *priv = file->private_data; 267 struct il_priv *priv = file->private_data;
268 char buf[64]; 268 char buf[64];
269 int buf_size; 269 int buf_size;
270 u32 offset, len; 270 u32 offset, len;
@@ -286,11 +286,11 @@ static ssize_t iwl_legacy_dbgfs_sram_write(struct file *file,
286} 286}
287 287
288static ssize_t 288static ssize_t
289iwl_legacy_dbgfs_stations_read(struct file *file, char __user *user_buf, 289il_dbgfs_stations_read(struct file *file, char __user *user_buf,
290 size_t count, loff_t *ppos) 290 size_t count, loff_t *ppos)
291{ 291{
292 struct iwl_priv *priv = file->private_data; 292 struct il_priv *priv = file->private_data;
293 struct iwl_station_entry *station; 293 struct il_station_entry *station;
294 int max_sta = priv->hw_params.max_stations; 294 int max_sta = priv->hw_params.max_stations;
295 char *buf; 295 char *buf;
296 int i, j, pos = 0; 296 int i, j, pos = 0;
@@ -343,13 +343,13 @@ iwl_legacy_dbgfs_stations_read(struct file *file, char __user *user_buf,
343 return ret; 343 return ret;
344} 344}
345 345
346static ssize_t iwl_legacy_dbgfs_nvm_read(struct file *file, 346static ssize_t il_dbgfs_nvm_read(struct file *file,
347 char __user *user_buf, 347 char __user *user_buf,
348 size_t count, 348 size_t count,
349 loff_t *ppos) 349 loff_t *ppos)
350{ 350{
351 ssize_t ret; 351 ssize_t ret;
352 struct iwl_priv *priv = file->private_data; 352 struct il_priv *priv = file->private_data;
353 int pos = 0, ofs = 0, buf_size = 0; 353 int pos = 0, ofs = 0, buf_size = 0;
354 const u8 *ptr; 354 const u8 *ptr;
355 char *buf; 355 char *buf;
@@ -358,23 +358,23 @@ static ssize_t iwl_legacy_dbgfs_nvm_read(struct file *file,
358 buf_size = 4 * eeprom_len + 256; 358 buf_size = 4 * eeprom_len + 256;
359 359
360 if (eeprom_len % 16) { 360 if (eeprom_len % 16) {
361 IWL_ERR(priv, "NVM size is not multiple of 16.\n"); 361 IL_ERR(priv, "NVM size is not multiple of 16.\n");
362 return -ENODATA; 362 return -ENODATA;
363 } 363 }
364 364
365 ptr = priv->eeprom; 365 ptr = priv->eeprom;
366 if (!ptr) { 366 if (!ptr) {
367 IWL_ERR(priv, "Invalid EEPROM memory\n"); 367 IL_ERR(priv, "Invalid EEPROM memory\n");
368 return -ENOMEM; 368 return -ENOMEM;
369 } 369 }
370 370
371 /* 4 characters for byte 0xYY */ 371 /* 4 characters for byte 0xYY */
372 buf = kzalloc(buf_size, GFP_KERNEL); 372 buf = kzalloc(buf_size, GFP_KERNEL);
373 if (!buf) { 373 if (!buf) {
374 IWL_ERR(priv, "Can not allocate Buffer\n"); 374 IL_ERR(priv, "Can not allocate Buffer\n");
375 return -ENOMEM; 375 return -ENOMEM;
376 } 376 }
377 eeprom_ver = iwl_legacy_eeprom_query16(priv, EEPROM_VERSION); 377 eeprom_ver = il_eeprom_query16(priv, EEPROM_VERSION);
378 pos += scnprintf(buf + pos, buf_size - pos, "EEPROM " 378 pos += scnprintf(buf + pos, buf_size - pos, "EEPROM "
379 "version: 0x%x\n", eeprom_ver); 379 "version: 0x%x\n", eeprom_ver);
380 for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { 380 for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
@@ -392,10 +392,10 @@ static ssize_t iwl_legacy_dbgfs_nvm_read(struct file *file,
392} 392}
393 393
394static ssize_t 394static ssize_t
395iwl_legacy_dbgfs_channels_read(struct file *file, char __user *user_buf, 395il_dbgfs_channels_read(struct file *file, char __user *user_buf,
396 size_t count, loff_t *ppos) 396 size_t count, loff_t *ppos)
397{ 397{
398 struct iwl_priv *priv = file->private_data; 398 struct il_priv *priv = file->private_data;
399 struct ieee80211_channel *channels = NULL; 399 struct ieee80211_channel *channels = NULL;
400 const struct ieee80211_supported_band *supp_band = NULL; 400 const struct ieee80211_supported_band *supp_band = NULL;
401 int pos = 0, i, bufsz = PAGE_SIZE; 401 int pos = 0, i, bufsz = PAGE_SIZE;
@@ -407,11 +407,11 @@ iwl_legacy_dbgfs_channels_read(struct file *file, char __user *user_buf,
407 407
408 buf = kzalloc(bufsz, GFP_KERNEL); 408 buf = kzalloc(bufsz, GFP_KERNEL);
409 if (!buf) { 409 if (!buf) {
410 IWL_ERR(priv, "Can not allocate Buffer\n"); 410 IL_ERR(priv, "Can not allocate Buffer\n");
411 return -ENOMEM; 411 return -ENOMEM;
412 } 412 }
413 413
414 supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); 414 supp_band = il_get_hw_mode(priv, IEEE80211_BAND_2GHZ);
415 if (supp_band) { 415 if (supp_band) {
416 channels = supp_band->channels; 416 channels = supp_band->channels;
417 417
@@ -434,7 +434,7 @@ iwl_legacy_dbgfs_channels_read(struct file *file, char __user *user_buf,
434 IEEE80211_CHAN_PASSIVE_SCAN ? 434 IEEE80211_CHAN_PASSIVE_SCAN ?
435 "passive only" : "active/passive"); 435 "passive only" : "active/passive");
436 } 436 }
437 supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ); 437 supp_band = il_get_hw_mode(priv, IEEE80211_BAND_5GHZ);
438 if (supp_band) { 438 if (supp_band) {
439 channels = supp_band->channels; 439 channels = supp_band->channels;
440 440
@@ -462,11 +462,11 @@ iwl_legacy_dbgfs_channels_read(struct file *file, char __user *user_buf,
462 return ret; 462 return ret;
463} 463}
464 464
465static ssize_t iwl_legacy_dbgfs_status_read(struct file *file, 465static ssize_t il_dbgfs_status_read(struct file *file,
466 char __user *user_buf, 466 char __user *user_buf,
467 size_t count, loff_t *ppos) { 467 size_t count, loff_t *ppos) {
468 468
469 struct iwl_priv *priv = file->private_data; 469 struct il_priv *priv = file->private_data;
470 char buf[512]; 470 char buf[512];
471 int pos = 0; 471 int pos = 0;
472 const size_t bufsz = sizeof(buf); 472 const size_t bufsz = sizeof(buf);
@@ -506,11 +506,11 @@ static ssize_t iwl_legacy_dbgfs_status_read(struct file *file,
506 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 506 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
507} 507}
508 508
509static ssize_t iwl_legacy_dbgfs_interrupt_read(struct file *file, 509static ssize_t il_dbgfs_interrupt_read(struct file *file,
510 char __user *user_buf, 510 char __user *user_buf,
511 size_t count, loff_t *ppos) { 511 size_t count, loff_t *ppos) {
512 512
513 struct iwl_priv *priv = file->private_data; 513 struct il_priv *priv = file->private_data;
514 int pos = 0; 514 int pos = 0;
515 int cnt = 0; 515 int cnt = 0;
516 char *buf; 516 char *buf;
@@ -519,7 +519,7 @@ static ssize_t iwl_legacy_dbgfs_interrupt_read(struct file *file,
519 519
520 buf = kzalloc(bufsz, GFP_KERNEL); 520 buf = kzalloc(bufsz, GFP_KERNEL);
521 if (!buf) { 521 if (!buf) {
522 IWL_ERR(priv, "Can not allocate Buffer\n"); 522 IL_ERR(priv, "Can not allocate Buffer\n");
523 return -ENOMEM; 523 return -ENOMEM;
524 } 524 }
525 525
@@ -558,7 +558,7 @@ static ssize_t iwl_legacy_dbgfs_interrupt_read(struct file *file,
558 if (priv->isr_stats.rx_handlers[cnt] > 0) 558 if (priv->isr_stats.rx_handlers[cnt] > 0)
559 pos += scnprintf(buf + pos, bufsz - pos, 559 pos += scnprintf(buf + pos, bufsz - pos,
560 "\tRx handler[%36s]:\t\t %u\n", 560 "\tRx handler[%36s]:\t\t %u\n",
561 iwl_legacy_get_cmd_string(cnt), 561 il_get_cmd_string(cnt),
562 priv->isr_stats.rx_handlers[cnt]); 562 priv->isr_stats.rx_handlers[cnt]);
563 } 563 }
564 564
@@ -573,11 +573,11 @@ static ssize_t iwl_legacy_dbgfs_interrupt_read(struct file *file,
573 return ret; 573 return ret;
574} 574}
575 575
576static ssize_t iwl_legacy_dbgfs_interrupt_write(struct file *file, 576static ssize_t il_dbgfs_interrupt_write(struct file *file,
577 const char __user *user_buf, 577 const char __user *user_buf,
578 size_t count, loff_t *ppos) 578 size_t count, loff_t *ppos)
579{ 579{
580 struct iwl_priv *priv = file->private_data; 580 struct il_priv *priv = file->private_data;
581 char buf[8]; 581 char buf[8];
582 int buf_size; 582 int buf_size;
583 u32 reset_flag; 583 u32 reset_flag;
@@ -589,19 +589,19 @@ static ssize_t iwl_legacy_dbgfs_interrupt_write(struct file *file,
589 if (sscanf(buf, "%x", &reset_flag) != 1) 589 if (sscanf(buf, "%x", &reset_flag) != 1)
590 return -EFAULT; 590 return -EFAULT;
591 if (reset_flag == 0) 591 if (reset_flag == 0)
592 iwl_legacy_clear_isr_stats(priv); 592 il_clear_isr_stats(priv);
593 593
594 return count; 594 return count;
595} 595}
596 596
597static ssize_t 597static ssize_t
598iwl_legacy_dbgfs_qos_read(struct file *file, char __user *user_buf, 598il_dbgfs_qos_read(struct file *file, char __user *user_buf,
599 size_t count, loff_t *ppos) 599 size_t count, loff_t *ppos)
600{ 600{
601 struct iwl_priv *priv = file->private_data; 601 struct il_priv *priv = file->private_data;
602 struct iwl_rxon_context *ctx; 602 struct il_rxon_context *ctx;
603 int pos = 0, i; 603 int pos = 0, i;
604 char buf[256 * NUM_IWL_RXON_CTX]; 604 char buf[256 * NUM_IL_RXON_CTX];
605 const size_t bufsz = sizeof(buf); 605 const size_t bufsz = sizeof(buf);
606 606
607 for_each_context(priv, ctx) { 607 for_each_context(priv, ctx) {
@@ -622,11 +622,11 @@ iwl_legacy_dbgfs_qos_read(struct file *file, char __user *user_buf,
622 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 622 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
623} 623}
624 624
625static ssize_t iwl_legacy_dbgfs_disable_ht40_write(struct file *file, 625static ssize_t il_dbgfs_disable_ht40_write(struct file *file,
626 const char __user *user_buf, 626 const char __user *user_buf,
627 size_t count, loff_t *ppos) 627 size_t count, loff_t *ppos)
628{ 628{
629 struct iwl_priv *priv = file->private_data; 629 struct il_priv *priv = file->private_data;
630 char buf[8]; 630 char buf[8];
631 int buf_size; 631 int buf_size;
632 int ht40; 632 int ht40;
@@ -637,10 +637,10 @@ static ssize_t iwl_legacy_dbgfs_disable_ht40_write(struct file *file,
637 return -EFAULT; 637 return -EFAULT;
638 if (sscanf(buf, "%d", &ht40) != 1) 638 if (sscanf(buf, "%d", &ht40) != 1)
639 return -EFAULT; 639 return -EFAULT;
640 if (!iwl_legacy_is_any_associated(priv)) 640 if (!il_is_any_associated(priv))
641 priv->disable_ht40 = ht40 ? true : false; 641 priv->disable_ht40 = ht40 ? true : false;
642 else { 642 else {
643 IWL_ERR(priv, "Sta associated with AP - " 643 IL_ERR(priv, "Sta associated with AP - "
644 "Change to 40MHz channel support is not allowed\n"); 644 "Change to 40MHz channel support is not allowed\n");
645 return -EINVAL; 645 return -EINVAL;
646 } 646 }
@@ -648,11 +648,11 @@ static ssize_t iwl_legacy_dbgfs_disable_ht40_write(struct file *file,
648 return count; 648 return count;
649} 649}
650 650
651static ssize_t iwl_legacy_dbgfs_disable_ht40_read(struct file *file, 651static ssize_t il_dbgfs_disable_ht40_read(struct file *file,
652 char __user *user_buf, 652 char __user *user_buf,
653 size_t count, loff_t *ppos) 653 size_t count, loff_t *ppos)
654{ 654{
655 struct iwl_priv *priv = file->private_data; 655 struct il_priv *priv = file->private_data;
656 char buf[100]; 656 char buf[100];
657 int pos = 0; 657 int pos = 0;
658 const size_t bufsz = sizeof(buf); 658 const size_t bufsz = sizeof(buf);
@@ -672,29 +672,29 @@ DEBUGFS_READ_WRITE_FILE_OPS(interrupt);
672DEBUGFS_READ_FILE_OPS(qos); 672DEBUGFS_READ_FILE_OPS(qos);
673DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40); 673DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40);
674 674
675static ssize_t iwl_legacy_dbgfs_traffic_log_read(struct file *file, 675static ssize_t il_dbgfs_traffic_log_read(struct file *file,
676 char __user *user_buf, 676 char __user *user_buf,
677 size_t count, loff_t *ppos) 677 size_t count, loff_t *ppos)
678{ 678{
679 struct iwl_priv *priv = file->private_data; 679 struct il_priv *priv = file->private_data;
680 int pos = 0, ofs = 0; 680 int pos = 0, ofs = 0;
681 int cnt = 0, entry; 681 int cnt = 0, entry;
682 struct iwl_tx_queue *txq; 682 struct il_tx_queue *txq;
683 struct iwl_queue *q; 683 struct il_queue *q;
684 struct iwl_rx_queue *rxq = &priv->rxq; 684 struct il_rx_queue *rxq = &priv->rxq;
685 char *buf; 685 char *buf;
686 int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) + 686 int bufsz = ((IL_TRAFFIC_ENTRIES * IL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
687 (priv->cfg->base_params->num_of_queues * 32 * 8) + 400; 687 (priv->cfg->base_params->num_of_queues * 32 * 8) + 400;
688 const u8 *ptr; 688 const u8 *ptr;
689 ssize_t ret; 689 ssize_t ret;
690 690
691 if (!priv->txq) { 691 if (!priv->txq) {
692 IWL_ERR(priv, "txq not ready\n"); 692 IL_ERR(priv, "txq not ready\n");
693 return -EAGAIN; 693 return -EAGAIN;
694 } 694 }
695 buf = kzalloc(bufsz, GFP_KERNEL); 695 buf = kzalloc(bufsz, GFP_KERNEL);
696 if (!buf) { 696 if (!buf) {
697 IWL_ERR(priv, "Can not allocate buffer\n"); 697 IL_ERR(priv, "Can not allocate buffer\n");
698 return -ENOMEM; 698 return -ENOMEM;
699 } 699 }
700 pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n"); 700 pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n");
@@ -705,12 +705,12 @@ static ssize_t iwl_legacy_dbgfs_traffic_log_read(struct file *file,
705 "q[%d]: read_ptr: %u, write_ptr: %u\n", 705 "q[%d]: read_ptr: %u, write_ptr: %u\n",
706 cnt, q->read_ptr, q->write_ptr); 706 cnt, q->read_ptr, q->write_ptr);
707 } 707 }
708 if (priv->tx_traffic && (iwlegacy_debug_level & IWL_DL_TX)) { 708 if (priv->tx_traffic && (iwlegacy_debug_level & IL_DL_TX)) {
709 ptr = priv->tx_traffic; 709 ptr = priv->tx_traffic;
710 pos += scnprintf(buf + pos, bufsz - pos, 710 pos += scnprintf(buf + pos, bufsz - pos,
711 "Tx Traffic idx: %u\n", priv->tx_traffic_idx); 711 "Tx Traffic idx: %u\n", priv->tx_traffic_idx);
712 for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { 712 for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) {
713 for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; 713 for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16;
714 entry++, ofs += 16) { 714 entry++, ofs += 16) {
715 pos += scnprintf(buf + pos, bufsz - pos, 715 pos += scnprintf(buf + pos, bufsz - pos,
716 "0x%.4x ", ofs); 716 "0x%.4x ", ofs);
@@ -728,12 +728,12 @@ static ssize_t iwl_legacy_dbgfs_traffic_log_read(struct file *file,
728 "read: %u, write: %u\n", 728 "read: %u, write: %u\n",
729 rxq->read, rxq->write); 729 rxq->read, rxq->write);
730 730
731 if (priv->rx_traffic && (iwlegacy_debug_level & IWL_DL_RX)) { 731 if (priv->rx_traffic && (iwlegacy_debug_level & IL_DL_RX)) {
732 ptr = priv->rx_traffic; 732 ptr = priv->rx_traffic;
733 pos += scnprintf(buf + pos, bufsz - pos, 733 pos += scnprintf(buf + pos, bufsz - pos,
734 "Rx Traffic idx: %u\n", priv->rx_traffic_idx); 734 "Rx Traffic idx: %u\n", priv->rx_traffic_idx);
735 for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { 735 for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) {
736 for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; 736 for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16;
737 entry++, ofs += 16) { 737 entry++, ofs += 16) {
738 pos += scnprintf(buf + pos, bufsz - pos, 738 pos += scnprintf(buf + pos, bufsz - pos,
739 "0x%.4x ", ofs); 739 "0x%.4x ", ofs);
@@ -751,11 +751,11 @@ static ssize_t iwl_legacy_dbgfs_traffic_log_read(struct file *file,
751 return ret; 751 return ret;
752} 752}
753 753
754static ssize_t iwl_legacy_dbgfs_traffic_log_write(struct file *file, 754static ssize_t il_dbgfs_traffic_log_write(struct file *file,
755 const char __user *user_buf, 755 const char __user *user_buf,
756 size_t count, loff_t *ppos) 756 size_t count, loff_t *ppos)
757{ 757{
758 struct iwl_priv *priv = file->private_data; 758 struct il_priv *priv = file->private_data;
759 char buf[8]; 759 char buf[8];
760 int buf_size; 760 int buf_size;
761 int traffic_log; 761 int traffic_log;
@@ -767,18 +767,18 @@ static ssize_t iwl_legacy_dbgfs_traffic_log_write(struct file *file,
767 if (sscanf(buf, "%d", &traffic_log) != 1) 767 if (sscanf(buf, "%d", &traffic_log) != 1)
768 return -EFAULT; 768 return -EFAULT;
769 if (traffic_log == 0) 769 if (traffic_log == 0)
770 iwl_legacy_reset_traffic_log(priv); 770 il_reset_traffic_log(priv);
771 771
772 return count; 772 return count;
773} 773}
774 774
775static ssize_t iwl_legacy_dbgfs_tx_queue_read(struct file *file, 775static ssize_t il_dbgfs_tx_queue_read(struct file *file,
776 char __user *user_buf, 776 char __user *user_buf,
777 size_t count, loff_t *ppos) { 777 size_t count, loff_t *ppos) {
778 778
779 struct iwl_priv *priv = file->private_data; 779 struct il_priv *priv = file->private_data;
780 struct iwl_tx_queue *txq; 780 struct il_tx_queue *txq;
781 struct iwl_queue *q; 781 struct il_queue *q;
782 char *buf; 782 char *buf;
783 int pos = 0; 783 int pos = 0;
784 int cnt; 784 int cnt;
@@ -787,7 +787,7 @@ static ssize_t iwl_legacy_dbgfs_tx_queue_read(struct file *file,
787 priv->cfg->base_params->num_of_queues; 787 priv->cfg->base_params->num_of_queues;
788 788
789 if (!priv->txq) { 789 if (!priv->txq) {
790 IWL_ERR(priv, "txq not ready\n"); 790 IL_ERR(priv, "txq not ready\n");
791 return -EAGAIN; 791 return -EAGAIN;
792 } 792 }
793 buf = kzalloc(bufsz, GFP_KERNEL); 793 buf = kzalloc(bufsz, GFP_KERNEL);
@@ -816,12 +816,12 @@ static ssize_t iwl_legacy_dbgfs_tx_queue_read(struct file *file,
816 return ret; 816 return ret;
817} 817}
818 818
819static ssize_t iwl_legacy_dbgfs_rx_queue_read(struct file *file, 819static ssize_t il_dbgfs_rx_queue_read(struct file *file,
820 char __user *user_buf, 820 char __user *user_buf,
821 size_t count, loff_t *ppos) { 821 size_t count, loff_t *ppos) {
822 822
823 struct iwl_priv *priv = file->private_data; 823 struct il_priv *priv = file->private_data;
824 struct iwl_rx_queue *rxq = &priv->rxq; 824 struct il_rx_queue *rxq = &priv->rxq;
825 char buf[256]; 825 char buf[256];
826 int pos = 0; 826 int pos = 0;
827 const size_t bufsz = sizeof(buf); 827 const size_t bufsz = sizeof(buf);
@@ -842,49 +842,49 @@ static ssize_t iwl_legacy_dbgfs_rx_queue_read(struct file *file,
842 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 842 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
843} 843}
844 844
845static ssize_t iwl_legacy_dbgfs_ucode_rx_stats_read(struct file *file, 845static ssize_t il_dbgfs_ucode_rx_stats_read(struct file *file,
846 char __user *user_buf, 846 char __user *user_buf,
847 size_t count, loff_t *ppos) 847 size_t count, loff_t *ppos)
848{ 848{
849 struct iwl_priv *priv = file->private_data; 849 struct il_priv *priv = file->private_data;
850 return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file, 850 return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file,
851 user_buf, count, ppos); 851 user_buf, count, ppos);
852} 852}
853 853
854static ssize_t iwl_legacy_dbgfs_ucode_tx_stats_read(struct file *file, 854static ssize_t il_dbgfs_ucode_tx_stats_read(struct file *file,
855 char __user *user_buf, 855 char __user *user_buf,
856 size_t count, loff_t *ppos) 856 size_t count, loff_t *ppos)
857{ 857{
858 struct iwl_priv *priv = file->private_data; 858 struct il_priv *priv = file->private_data;
859 return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file, 859 return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file,
860 user_buf, count, ppos); 860 user_buf, count, ppos);
861} 861}
862 862
863static ssize_t iwl_legacy_dbgfs_ucode_general_stats_read(struct file *file, 863static ssize_t il_dbgfs_ucode_general_stats_read(struct file *file,
864 char __user *user_buf, 864 char __user *user_buf,
865 size_t count, loff_t *ppos) 865 size_t count, loff_t *ppos)
866{ 866{
867 struct iwl_priv *priv = file->private_data; 867 struct il_priv *priv = file->private_data;
868 return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file, 868 return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file,
869 user_buf, count, ppos); 869 user_buf, count, ppos);
870} 870}
871 871
872static ssize_t iwl_legacy_dbgfs_sensitivity_read(struct file *file, 872static ssize_t il_dbgfs_sensitivity_read(struct file *file,
873 char __user *user_buf, 873 char __user *user_buf,
874 size_t count, loff_t *ppos) { 874 size_t count, loff_t *ppos) {
875 875
876 struct iwl_priv *priv = file->private_data; 876 struct il_priv *priv = file->private_data;
877 int pos = 0; 877 int pos = 0;
878 int cnt = 0; 878 int cnt = 0;
879 char *buf; 879 char *buf;
880 int bufsz = sizeof(struct iwl_sensitivity_data) * 4 + 100; 880 int bufsz = sizeof(struct il_sensitivity_data) * 4 + 100;
881 ssize_t ret; 881 ssize_t ret;
882 struct iwl_sensitivity_data *data; 882 struct il_sensitivity_data *data;
883 883
884 data = &priv->sensitivity_data; 884 data = &priv->sensitivity_data;
885 buf = kzalloc(bufsz, GFP_KERNEL); 885 buf = kzalloc(bufsz, GFP_KERNEL);
886 if (!buf) { 886 if (!buf) {
887 IWL_ERR(priv, "Can not allocate Buffer\n"); 887 IL_ERR(priv, "Can not allocate Buffer\n");
888 return -ENOMEM; 888 return -ENOMEM;
889 } 889 }
890 890
@@ -950,22 +950,22 @@ static ssize_t iwl_legacy_dbgfs_sensitivity_read(struct file *file,
950} 950}
951 951
952 952
953static ssize_t iwl_legacy_dbgfs_chain_noise_read(struct file *file, 953static ssize_t il_dbgfs_chain_noise_read(struct file *file,
954 char __user *user_buf, 954 char __user *user_buf,
955 size_t count, loff_t *ppos) { 955 size_t count, loff_t *ppos) {
956 956
957 struct iwl_priv *priv = file->private_data; 957 struct il_priv *priv = file->private_data;
958 int pos = 0; 958 int pos = 0;
959 int cnt = 0; 959 int cnt = 0;
960 char *buf; 960 char *buf;
961 int bufsz = sizeof(struct iwl_chain_noise_data) * 4 + 100; 961 int bufsz = sizeof(struct il_chain_noise_data) * 4 + 100;
962 ssize_t ret; 962 ssize_t ret;
963 struct iwl_chain_noise_data *data; 963 struct il_chain_noise_data *data;
964 964
965 data = &priv->chain_noise_data; 965 data = &priv->chain_noise_data;
966 buf = kzalloc(bufsz, GFP_KERNEL); 966 buf = kzalloc(bufsz, GFP_KERNEL);
967 if (!buf) { 967 if (!buf) {
968 IWL_ERR(priv, "Can not allocate Buffer\n"); 968 IL_ERR(priv, "Can not allocate Buffer\n");
969 return -ENOMEM; 969 return -ENOMEM;
970 } 970 }
971 971
@@ -1008,17 +1008,17 @@ static ssize_t iwl_legacy_dbgfs_chain_noise_read(struct file *file,
1008 return ret; 1008 return ret;
1009} 1009}
1010 1010
1011static ssize_t iwl_legacy_dbgfs_power_save_status_read(struct file *file, 1011static ssize_t il_dbgfs_power_save_status_read(struct file *file,
1012 char __user *user_buf, 1012 char __user *user_buf,
1013 size_t count, loff_t *ppos) 1013 size_t count, loff_t *ppos)
1014{ 1014{
1015 struct iwl_priv *priv = file->private_data; 1015 struct il_priv *priv = file->private_data;
1016 char buf[60]; 1016 char buf[60];
1017 int pos = 0; 1017 int pos = 0;
1018 const size_t bufsz = sizeof(buf); 1018 const size_t bufsz = sizeof(buf);
1019 u32 pwrsave_status; 1019 u32 pwrsave_status;
1020 1020
1021 pwrsave_status = iwl_read32(priv, CSR_GP_CNTRL) & 1021 pwrsave_status = il_read32(priv, CSR_GP_CNTRL) &
1022 CSR_GP_REG_POWER_SAVE_STATUS_MSK; 1022 CSR_GP_REG_POWER_SAVE_STATUS_MSK;
1023 1023
1024 pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); 1024 pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: ");
@@ -1031,11 +1031,11 @@ static ssize_t iwl_legacy_dbgfs_power_save_status_read(struct file *file,
1031 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 1031 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1032} 1032}
1033 1033
1034static ssize_t iwl_legacy_dbgfs_clear_ucode_statistics_write(struct file *file, 1034static ssize_t il_dbgfs_clear_ucode_statistics_write(struct file *file,
1035 const char __user *user_buf, 1035 const char __user *user_buf,
1036 size_t count, loff_t *ppos) 1036 size_t count, loff_t *ppos)
1037{ 1037{
1038 struct iwl_priv *priv = file->private_data; 1038 struct il_priv *priv = file->private_data;
1039 char buf[8]; 1039 char buf[8];
1040 int buf_size; 1040 int buf_size;
1041 int clear; 1041 int clear;
@@ -1049,43 +1049,43 @@ static ssize_t iwl_legacy_dbgfs_clear_ucode_statistics_write(struct file *file,
1049 1049
1050 /* make request to uCode to retrieve statistics information */ 1050 /* make request to uCode to retrieve statistics information */
1051 mutex_lock(&priv->mutex); 1051 mutex_lock(&priv->mutex);
1052 iwl_legacy_send_statistics_request(priv, CMD_SYNC, true); 1052 il_send_statistics_request(priv, CMD_SYNC, true);
1053 mutex_unlock(&priv->mutex); 1053 mutex_unlock(&priv->mutex);
1054 1054
1055 return count; 1055 return count;
1056} 1056}
1057 1057
1058static ssize_t iwl_legacy_dbgfs_rxon_flags_read(struct file *file, 1058static ssize_t il_dbgfs_rxon_flags_read(struct file *file,
1059 char __user *user_buf, 1059 char __user *user_buf,
1060 size_t count, loff_t *ppos) { 1060 size_t count, loff_t *ppos) {
1061 1061
1062 struct iwl_priv *priv = file->private_data; 1062 struct il_priv *priv = file->private_data;
1063 int len = 0; 1063 int len = 0;
1064 char buf[20]; 1064 char buf[20];
1065 1065
1066 len = sprintf(buf, "0x%04X\n", 1066 len = sprintf(buf, "0x%04X\n",
1067 le32_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.flags)); 1067 le32_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.flags));
1068 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 1068 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1069} 1069}
1070 1070
1071static ssize_t iwl_legacy_dbgfs_rxon_filter_flags_read(struct file *file, 1071static ssize_t il_dbgfs_rxon_filter_flags_read(struct file *file,
1072 char __user *user_buf, 1072 char __user *user_buf,
1073 size_t count, loff_t *ppos) { 1073 size_t count, loff_t *ppos) {
1074 1074
1075 struct iwl_priv *priv = file->private_data; 1075 struct il_priv *priv = file->private_data;
1076 int len = 0; 1076 int len = 0;
1077 char buf[20]; 1077 char buf[20];
1078 1078
1079 len = sprintf(buf, "0x%04X\n", 1079 len = sprintf(buf, "0x%04X\n",
1080 le32_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags)); 1080 le32_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.filter_flags));
1081 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 1081 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1082} 1082}
1083 1083
1084static ssize_t iwl_legacy_dbgfs_fh_reg_read(struct file *file, 1084static ssize_t il_dbgfs_fh_reg_read(struct file *file,
1085 char __user *user_buf, 1085 char __user *user_buf,
1086 size_t count, loff_t *ppos) 1086 size_t count, loff_t *ppos)
1087{ 1087{
1088 struct iwl_priv *priv = file->private_data; 1088 struct il_priv *priv = file->private_data;
1089 char *buf; 1089 char *buf;
1090 int pos = 0; 1090 int pos = 0;
1091 ssize_t ret = -EFAULT; 1091 ssize_t ret = -EFAULT;
@@ -1102,11 +1102,11 @@ static ssize_t iwl_legacy_dbgfs_fh_reg_read(struct file *file,
1102 return ret; 1102 return ret;
1103} 1103}
1104 1104
1105static ssize_t iwl_legacy_dbgfs_missed_beacon_read(struct file *file, 1105static ssize_t il_dbgfs_missed_beacon_read(struct file *file,
1106 char __user *user_buf, 1106 char __user *user_buf,
1107 size_t count, loff_t *ppos) { 1107 size_t count, loff_t *ppos) {
1108 1108
1109 struct iwl_priv *priv = file->private_data; 1109 struct il_priv *priv = file->private_data;
1110 int pos = 0; 1110 int pos = 0;
1111 char buf[12]; 1111 char buf[12];
1112 const size_t bufsz = sizeof(buf); 1112 const size_t bufsz = sizeof(buf);
@@ -1117,11 +1117,11 @@ static ssize_t iwl_legacy_dbgfs_missed_beacon_read(struct file *file,
1117 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 1117 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1118} 1118}
1119 1119
1120static ssize_t iwl_legacy_dbgfs_missed_beacon_write(struct file *file, 1120static ssize_t il_dbgfs_missed_beacon_write(struct file *file,
1121 const char __user *user_buf, 1121 const char __user *user_buf,
1122 size_t count, loff_t *ppos) 1122 size_t count, loff_t *ppos)
1123{ 1123{
1124 struct iwl_priv *priv = file->private_data; 1124 struct il_priv *priv = file->private_data;
1125 char buf[8]; 1125 char buf[8];
1126 int buf_size; 1126 int buf_size;
1127 int missed; 1127 int missed;
@@ -1133,25 +1133,25 @@ static ssize_t iwl_legacy_dbgfs_missed_beacon_write(struct file *file,
1133 if (sscanf(buf, "%d", &missed) != 1) 1133 if (sscanf(buf, "%d", &missed) != 1)
1134 return -EINVAL; 1134 return -EINVAL;
1135 1135
1136 if (missed < IWL_MISSED_BEACON_THRESHOLD_MIN || 1136 if (missed < IL_MISSED_BEACON_THRESHOLD_MIN ||
1137 missed > IWL_MISSED_BEACON_THRESHOLD_MAX) 1137 missed > IL_MISSED_BEACON_THRESHOLD_MAX)
1138 priv->missed_beacon_threshold = 1138 priv->missed_beacon_threshold =
1139 IWL_MISSED_BEACON_THRESHOLD_DEF; 1139 IL_MISSED_BEACON_THRESHOLD_DEF;
1140 else 1140 else
1141 priv->missed_beacon_threshold = missed; 1141 priv->missed_beacon_threshold = missed;
1142 1142
1143 return count; 1143 return count;
1144} 1144}
1145 1145
1146static ssize_t iwl_legacy_dbgfs_force_reset_read(struct file *file, 1146static ssize_t il_dbgfs_force_reset_read(struct file *file,
1147 char __user *user_buf, 1147 char __user *user_buf,
1148 size_t count, loff_t *ppos) { 1148 size_t count, loff_t *ppos) {
1149 1149
1150 struct iwl_priv *priv = file->private_data; 1150 struct il_priv *priv = file->private_data;
1151 int pos = 0; 1151 int pos = 0;
1152 char buf[300]; 1152 char buf[300];
1153 const size_t bufsz = sizeof(buf); 1153 const size_t bufsz = sizeof(buf);
1154 struct iwl_force_reset *force_reset; 1154 struct il_force_reset *force_reset;
1155 1155
1156 force_reset = &priv->force_reset; 1156 force_reset = &priv->force_reset;
1157 1157
@@ -1171,23 +1171,23 @@ static ssize_t iwl_legacy_dbgfs_force_reset_read(struct file *file,
1171 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 1171 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1172} 1172}
1173 1173
1174static ssize_t iwl_legacy_dbgfs_force_reset_write(struct file *file, 1174static ssize_t il_dbgfs_force_reset_write(struct file *file,
1175 const char __user *user_buf, 1175 const char __user *user_buf,
1176 size_t count, loff_t *ppos) { 1176 size_t count, loff_t *ppos) {
1177 1177
1178 int ret; 1178 int ret;
1179 struct iwl_priv *priv = file->private_data; 1179 struct il_priv *priv = file->private_data;
1180 1180
1181 ret = iwl_legacy_force_reset(priv, true); 1181 ret = il_force_reset(priv, true);
1182 1182
1183 return ret ? ret : count; 1183 return ret ? ret : count;
1184} 1184}
1185 1185
1186static ssize_t iwl_legacy_dbgfs_wd_timeout_write(struct file *file, 1186static ssize_t il_dbgfs_wd_timeout_write(struct file *file,
1187 const char __user *user_buf, 1187 const char __user *user_buf,
1188 size_t count, loff_t *ppos) { 1188 size_t count, loff_t *ppos) {
1189 1189
1190 struct iwl_priv *priv = file->private_data; 1190 struct il_priv *priv = file->private_data;
1191 char buf[8]; 1191 char buf[8];
1192 int buf_size; 1192 int buf_size;
1193 int timeout; 1193 int timeout;
@@ -1198,11 +1198,11 @@ static ssize_t iwl_legacy_dbgfs_wd_timeout_write(struct file *file,
1198 return -EFAULT; 1198 return -EFAULT;
1199 if (sscanf(buf, "%d", &timeout) != 1) 1199 if (sscanf(buf, "%d", &timeout) != 1)
1200 return -EINVAL; 1200 return -EINVAL;
1201 if (timeout < 0 || timeout > IWL_MAX_WD_TIMEOUT) 1201 if (timeout < 0 || timeout > IL_MAX_WD_TIMEOUT)
1202 timeout = IWL_DEF_WD_TIMEOUT; 1202 timeout = IL_DEF_WD_TIMEOUT;
1203 1203
1204 priv->cfg->base_params->wd_timeout = timeout; 1204 priv->cfg->base_params->wd_timeout = timeout;
1205 iwl_legacy_setup_watchdog(priv); 1205 il_setup_watchdog(priv);
1206 return count; 1206 return count;
1207} 1207}
1208 1208
@@ -1230,7 +1230,7 @@ DEBUGFS_WRITE_FILE_OPS(wd_timeout);
1230 * Create the debugfs files and directories 1230 * Create the debugfs files and directories
1231 * 1231 *
1232 */ 1232 */
1233int iwl_legacy_dbgfs_register(struct iwl_priv *priv, const char *name) 1233int il_dbgfs_register(struct il_priv *priv, const char *name)
1234{ 1234{
1235 struct dentry *phyd = priv->hw->wiphy->debugfsdir; 1235 struct dentry *phyd = priv->hw->wiphy->debugfsdir;
1236 struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug; 1236 struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug;
@@ -1292,17 +1292,17 @@ int iwl_legacy_dbgfs_register(struct iwl_priv *priv, const char *name)
1292 return 0; 1292 return 0;
1293 1293
1294err: 1294err:
1295 IWL_ERR(priv, "Can't create the debugfs directory\n"); 1295 IL_ERR(priv, "Can't create the debugfs directory\n");
1296 iwl_legacy_dbgfs_unregister(priv); 1296 il_dbgfs_unregister(priv);
1297 return -ENOMEM; 1297 return -ENOMEM;
1298} 1298}
1299EXPORT_SYMBOL(iwl_legacy_dbgfs_register); 1299EXPORT_SYMBOL(il_dbgfs_register);
1300 1300
1301/** 1301/**
1302 * Remove the debugfs files and directories 1302 * Remove the debugfs files and directories
1303 * 1303 *
1304 */ 1304 */
1305void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv) 1305void il_dbgfs_unregister(struct il_priv *priv)
1306{ 1306{
1307 if (!priv->debugfs_dir) 1307 if (!priv->debugfs_dir)
1308 return; 1308 return;
@@ -1310,4 +1310,4 @@ void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv)
1310 debugfs_remove_recursive(priv->debugfs_dir); 1310 debugfs_remove_recursive(priv->debugfs_dir);
1311 priv->debugfs_dir = NULL; 1311 priv->debugfs_dir = NULL;
1312} 1312}
1313EXPORT_SYMBOL(iwl_legacy_dbgfs_unregister); 1313EXPORT_SYMBOL(il_dbgfs_unregister);
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
index 9c786edf56fd..20c44f36ba77 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -29,8 +29,8 @@
29 * Please use iwl-4965-hw.h for hardware-related definitions. 29 * Please use iwl-4965-hw.h for hardware-related definitions.
30 */ 30 */
31 31
32#ifndef __iwl_legacy_dev_h__ 32#ifndef __il_dev_h__
33#define __iwl_legacy_dev_h__ 33#define __il_dev_h__
34 34
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <linux/pci.h> /* for struct pci_device_id */ 36#include <linux/pci.h> /* for struct pci_device_id */
@@ -50,7 +50,7 @@
50#include "iwl-power.h" 50#include "iwl-power.h"
51#include "iwl-legacy-rs.h" 51#include "iwl-legacy-rs.h"
52 52
53struct iwl_tx_queue; 53struct il_tx_queue;
54 54
55/* CT-KILL constants */ 55/* CT-KILL constants */
56#define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */ 56#define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */
@@ -66,7 +66,7 @@ struct iwl_tx_queue;
66 * noise info (e.g. averaging might be done in app); measured dBm values are 66 * noise info (e.g. averaging might be done in app); measured dBm values are
67 * always negative ... using a negative value as the default keeps all 67 * always negative ... using a negative value as the default keeps all
68 * averages within an s8's (used in some apps) range of negative values. */ 68 * averages within an s8's (used in some apps) range of negative values. */
69#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) 69#define IL_NOISE_MEAS_NOT_AVAILABLE (-127)
70 70
71/* 71/*
72 * RTS threshold here is total size [2347] minus 4 FCS bytes 72 * RTS threshold here is total size [2347] minus 4 FCS bytes
@@ -85,7 +85,7 @@ struct iwl_tx_queue;
85#define DEFAULT_SHORT_RETRY_LIMIT 7U 85#define DEFAULT_SHORT_RETRY_LIMIT 7U
86#define DEFAULT_LONG_RETRY_LIMIT 4U 86#define DEFAULT_LONG_RETRY_LIMIT 4U
87 87
88struct iwl_rx_mem_buffer { 88struct il_rx_mem_buffer {
89 dma_addr_t page_dma; 89 dma_addr_t page_dma;
90 struct page *page; 90 struct page *page;
91 struct list_head list; 91 struct list_head list;
@@ -94,11 +94,11 @@ struct iwl_rx_mem_buffer {
94#define rxb_addr(r) page_address(r->page) 94#define rxb_addr(r) page_address(r->page)
95 95
96/* defined below */ 96/* defined below */
97struct iwl_device_cmd; 97struct il_device_cmd;
98 98
99struct iwl_cmd_meta { 99struct il_cmd_meta {
100 /* only for SYNC commands, iff the reply skb is wanted */ 100 /* only for SYNC commands, iff the reply skb is wanted */
101 struct iwl_host_cmd *source; 101 struct il_host_cmd *source;
102 /* 102 /*
103 * only for ASYNC commands 103 * only for ASYNC commands
104 * (which is somewhat stupid -- look at iwl-sta.c for instance 104 * (which is somewhat stupid -- look at iwl-sta.c for instance
@@ -106,9 +106,9 @@ struct iwl_cmd_meta {
106 * invoked for SYNC commands, if it were and its result passed 106 * invoked for SYNC commands, if it were and its result passed
107 * through it would be simpler...) 107 * through it would be simpler...)
108 */ 108 */
109 void (*callback)(struct iwl_priv *priv, 109 void (*callback)(struct il_priv *priv,
110 struct iwl_device_cmd *cmd, 110 struct il_device_cmd *cmd,
111 struct iwl_rx_packet *pkt); 111 struct il_rx_packet *pkt);
112 112
113 /* The CMD_SIZE_HUGE flag bit indicates that the command 113 /* The CMD_SIZE_HUGE flag bit indicates that the command
114 * structure is stored at the end of the shared queue memory. */ 114 * structure is stored at the end of the shared queue memory. */
@@ -123,7 +123,7 @@ struct iwl_cmd_meta {
123 * 123 *
124 * Contains common data for Rx and Tx queues 124 * Contains common data for Rx and Tx queues
125 */ 125 */
126struct iwl_queue { 126struct il_queue {
127 int n_bd; /* number of BDs in this queue */ 127 int n_bd; /* number of BDs in this queue */
128 int write_ptr; /* 1-st empty entry (index) host_w*/ 128 int write_ptr; /* 1-st empty entry (index) host_w*/
129 int read_ptr; /* last used entry (index) host_r*/ 129 int read_ptr; /* last used entry (index) host_r*/
@@ -138,13 +138,13 @@ struct iwl_queue {
138}; 138};
139 139
140/* One for each TFD */ 140/* One for each TFD */
141struct iwl_tx_info { 141struct il_tx_info {
142 struct sk_buff *skb; 142 struct sk_buff *skb;
143 struct iwl_rxon_context *ctx; 143 struct il_rxon_context *ctx;
144}; 144};
145 145
146/** 146/**
147 * struct iwl_tx_queue - Tx Queue for DMA 147 * struct il_tx_queue - Tx Queue for DMA
148 * @q: generic Rx/Tx queue descriptor 148 * @q: generic Rx/Tx queue descriptor
149 * @bd: base of circular buffer of TFDs 149 * @bd: base of circular buffer of TFDs
150 * @cmd: array of command/TX buffer pointers 150 * @cmd: array of command/TX buffer pointers
@@ -161,12 +161,12 @@ struct iwl_tx_info {
161#define TFD_TX_CMD_SLOTS 256 161#define TFD_TX_CMD_SLOTS 256
162#define TFD_CMD_SLOTS 32 162#define TFD_CMD_SLOTS 32
163 163
164struct iwl_tx_queue { 164struct il_tx_queue {
165 struct iwl_queue q; 165 struct il_queue q;
166 void *tfds; 166 void *tfds;
167 struct iwl_device_cmd **cmd; 167 struct il_device_cmd **cmd;
168 struct iwl_cmd_meta *meta; 168 struct il_cmd_meta *meta;
169 struct iwl_tx_info *txb; 169 struct il_tx_info *txb;
170 unsigned long time_stamp; 170 unsigned long time_stamp;
171 u8 need_update; 171 u8 need_update;
172 u8 sched_retry; 172 u8 sched_retry;
@@ -174,23 +174,23 @@ struct iwl_tx_queue {
174 u8 swq_id; 174 u8 swq_id;
175}; 175};
176 176
177#define IWL_NUM_SCAN_RATES (2) 177#define IL_NUM_SCAN_RATES (2)
178 178
179struct iwl4965_channel_tgd_info { 179struct il4965_channel_tgd_info {
180 u8 type; 180 u8 type;
181 s8 max_power; 181 s8 max_power;
182}; 182};
183 183
184struct iwl4965_channel_tgh_info { 184struct il4965_channel_tgh_info {
185 s64 last_radar_time; 185 s64 last_radar_time;
186}; 186};
187 187
188#define IWL4965_MAX_RATE (33) 188#define IWL4965_MAX_RATE (33)
189 189
190struct iwl3945_clip_group { 190struct il3945_clip_group {
191 /* maximum power level to prevent clipping for each rate, derived by 191 /* maximum power level to prevent clipping for each rate, derived by
192 * us from this band's saturation power in EEPROM */ 192 * us from this band's saturation power in EEPROM */
193 const s8 clip_powers[IWL_MAX_RATES]; 193 const s8 clip_powers[IL_MAX_RATES];
194}; 194};
195 195
196/* current Tx power values to use, one for each rate for each channel. 196/* current Tx power values to use, one for each rate for each channel.
@@ -200,8 +200,8 @@ struct iwl3945_clip_group {
200 * -- spectrum management 200 * -- spectrum management
201 * -- user preference (e.g. iwconfig) 201 * -- user preference (e.g. iwconfig)
202 * when requested power is set, base power index must also be set. */ 202 * when requested power is set, base power index must also be set. */
203struct iwl3945_channel_power_info { 203struct il3945_channel_power_info {
204 struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */ 204 struct il3945_tx_power tpc; /* actual radio and DSP gain settings */
205 s8 power_table_index; /* actual (compenst'd) index into gain table */ 205 s8 power_table_index; /* actual (compenst'd) index into gain table */
206 s8 base_power_index; /* gain index for power at factory temp. */ 206 s8 base_power_index; /* gain index for power at factory temp. */
207 s8 requested_power; /* power (dBm) requested for this chnl/rate */ 207 s8 requested_power; /* power (dBm) requested for this chnl/rate */
@@ -209,8 +209,8 @@ struct iwl3945_channel_power_info {
209 209
210/* current scan Tx power values to use, one for each scan rate for each 210/* current scan Tx power values to use, one for each scan rate for each
211 * channel. */ 211 * channel. */
212struct iwl3945_scan_power_info { 212struct il3945_scan_power_info {
213 struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */ 213 struct il3945_tx_power tpc; /* actual radio and DSP gain settings */
214 s8 power_table_index; /* actual (compenst'd) index into gain table */ 214 s8 power_table_index; /* actual (compenst'd) index into gain table */
215 s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ 215 s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */
216}; 216};
@@ -220,11 +220,11 @@ struct iwl3945_scan_power_info {
220 * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant 220 * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant
221 * with one another! 221 * with one another!
222 */ 222 */
223struct iwl_channel_info { 223struct il_channel_info {
224 struct iwl4965_channel_tgd_info tgd; 224 struct il4965_channel_tgd_info tgd;
225 struct iwl4965_channel_tgh_info tgh; 225 struct il4965_channel_tgh_info tgh;
226 struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ 226 struct il_eeprom_channel eeprom; /* EEPROM regulatory limit */
227 struct iwl_eeprom_channel ht40_eeprom; /* EEPROM regulatory limit for 227 struct il_eeprom_channel ht40_eeprom; /* EEPROM regulatory limit for
228 * HT40 channel */ 228 * HT40 channel */
229 229
230 u8 channel; /* channel number */ 230 u8 channel; /* channel number */
@@ -246,34 +246,34 @@ struct iwl_channel_info {
246 /* Radio/DSP gain settings for each "normal" data Tx rate. 246 /* Radio/DSP gain settings for each "normal" data Tx rate.
247 * These include, in addition to RF and DSP gain, a few fields for 247 * These include, in addition to RF and DSP gain, a few fields for
248 * remembering/modifying gain settings (indexes). */ 248 * remembering/modifying gain settings (indexes). */
249 struct iwl3945_channel_power_info power_info[IWL4965_MAX_RATE]; 249 struct il3945_channel_power_info power_info[IWL4965_MAX_RATE];
250 250
251 /* Radio/DSP gain settings for each scan rate, for directed scans. */ 251 /* Radio/DSP gain settings for each scan rate, for directed scans. */
252 struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; 252 struct il3945_scan_power_info scan_pwr_info[IL_NUM_SCAN_RATES];
253}; 253};
254 254
255#define IWL_TX_FIFO_BK 0 /* shared */ 255#define IL_TX_FIFO_BK 0 /* shared */
256#define IWL_TX_FIFO_BE 1 256#define IL_TX_FIFO_BE 1
257#define IWL_TX_FIFO_VI 2 /* shared */ 257#define IL_TX_FIFO_VI 2 /* shared */
258#define IWL_TX_FIFO_VO 3 258#define IL_TX_FIFO_VO 3
259#define IWL_TX_FIFO_UNUSED -1 259#define IL_TX_FIFO_UNUSED -1
260 260
261/* Minimum number of queues. MAX_NUM is defined in hw specific files. 261/* Minimum number of queues. MAX_NUM is defined in hw specific files.
262 * Set the minimum to accommodate the 4 standard TX queues, 1 command 262 * Set the minimum to accommodate the 4 standard TX queues, 1 command
263 * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */ 263 * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */
264#define IWL_MIN_NUM_QUEUES 10 264#define IL_MIN_NUM_QUEUES 10
265 265
266#define IWL_DEFAULT_CMD_QUEUE_NUM 4 266#define IL_DEFAULT_CMD_QUEUE_NUM 4
267 267
268#define IEEE80211_DATA_LEN 2304 268#define IEEE80211_DATA_LEN 2304
269#define IEEE80211_4ADDR_LEN 30 269#define IEEE80211_4ADDR_LEN 30
270#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) 270#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
271#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) 271#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
272 272
273struct iwl_frame { 273struct il_frame {
274 union { 274 union {
275 struct ieee80211_hdr frame; 275 struct ieee80211_hdr frame;
276 struct iwl_tx_beacon_cmd beacon; 276 struct il_tx_beacon_cmd beacon;
277 u8 raw[IEEE80211_FRAME_LEN]; 277 u8 raw[IEEE80211_FRAME_LEN];
278 u8 cmd[360]; 278 u8 cmd[360];
279 } u; 279 } u;
@@ -297,33 +297,33 @@ enum {
297#define DEF_CMD_PAYLOAD_SIZE 320 297#define DEF_CMD_PAYLOAD_SIZE 320
298 298
299/** 299/**
300 * struct iwl_device_cmd 300 * struct il_device_cmd
301 * 301 *
302 * For allocation of the command and tx queues, this establishes the overall 302 * For allocation of the command and tx queues, this establishes the overall
303 * size of the largest command we send to uCode, except for a scan command 303 * size of the largest command we send to uCode, except for a scan command
304 * (which is relatively huge; space is allocated separately). 304 * (which is relatively huge; space is allocated separately).
305 */ 305 */
306struct iwl_device_cmd { 306struct il_device_cmd {
307 struct iwl_cmd_header hdr; /* uCode API */ 307 struct il_cmd_header hdr; /* uCode API */
308 union { 308 union {
309 u32 flags; 309 u32 flags;
310 u8 val8; 310 u8 val8;
311 u16 val16; 311 u16 val16;
312 u32 val32; 312 u32 val32;
313 struct iwl_tx_cmd tx; 313 struct il_tx_cmd tx;
314 u8 payload[DEF_CMD_PAYLOAD_SIZE]; 314 u8 payload[DEF_CMD_PAYLOAD_SIZE];
315 } __packed cmd; 315 } __packed cmd;
316} __packed; 316} __packed;
317 317
318#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd)) 318#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct il_device_cmd))
319 319
320 320
321struct iwl_host_cmd { 321struct il_host_cmd {
322 const void *data; 322 const void *data;
323 unsigned long reply_page; 323 unsigned long reply_page;
324 void (*callback)(struct iwl_priv *priv, 324 void (*callback)(struct il_priv *priv,
325 struct iwl_device_cmd *cmd, 325 struct il_device_cmd *cmd,
326 struct iwl_rx_packet *pkt); 326 struct il_rx_packet *pkt);
327 u32 flags; 327 u32 flags;
328 u16 len; 328 u16 len;
329 u8 id; 329 u8 id;
@@ -334,7 +334,7 @@ struct iwl_host_cmd {
334#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 334#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
335 335
336/** 336/**
337 * struct iwl_rx_queue - Rx queue 337 * struct il_rx_queue - Rx queue
338 * @bd: driver's pointer to buffer of receive buffer descriptors (rbd) 338 * @bd: driver's pointer to buffer of receive buffer descriptors (rbd)
339 * @bd_dma: bus address of buffer of receive buffer descriptors (rbd) 339 * @bd_dma: bus address of buffer of receive buffer descriptors (rbd)
340 * @read: Shared index to newest available Rx buffer 340 * @read: Shared index to newest available Rx buffer
@@ -346,13 +346,13 @@ struct iwl_host_cmd {
346 * @rb_stts: driver's pointer to receive buffer status 346 * @rb_stts: driver's pointer to receive buffer status
347 * @rb_stts_dma: bus address of receive buffer status 347 * @rb_stts_dma: bus address of receive buffer status
348 * 348 *
349 * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers 349 * NOTE: rx_free and rx_used are used as a FIFO for il_rx_mem_buffers
350 */ 350 */
351struct iwl_rx_queue { 351struct il_rx_queue {
352 __le32 *bd; 352 __le32 *bd;
353 dma_addr_t bd_dma; 353 dma_addr_t bd_dma;
354 struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; 354 struct il_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
355 struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; 355 struct il_rx_mem_buffer *queue[RX_QUEUE_SIZE];
356 u32 read; 356 u32 read;
357 u32 write; 357 u32 write;
358 u32 free_count; 358 u32 free_count;
@@ -360,20 +360,20 @@ struct iwl_rx_queue {
360 struct list_head rx_free; 360 struct list_head rx_free;
361 struct list_head rx_used; 361 struct list_head rx_used;
362 int need_update; 362 int need_update;
363 struct iwl_rb_status *rb_stts; 363 struct il_rb_status *rb_stts;
364 dma_addr_t rb_stts_dma; 364 dma_addr_t rb_stts_dma;
365 spinlock_t lock; 365 spinlock_t lock;
366}; 366};
367 367
368#define IWL_SUPPORTED_RATES_IE_LEN 8 368#define IL_SUPPORTED_RATES_IE_LEN 8
369 369
370#define MAX_TID_COUNT 9 370#define MAX_TID_COUNT 9
371 371
372#define IWL_INVALID_RATE 0xFF 372#define IL_INVALID_RATE 0xFF
373#define IWL_INVALID_VALUE -1 373#define IL_INVALID_VALUE -1
374 374
375/** 375/**
376 * struct iwl_ht_agg -- aggregation status while waiting for block-ack 376 * struct il_ht_agg -- aggregation status while waiting for block-ack
377 * @txq_id: Tx queue used for Tx attempt 377 * @txq_id: Tx queue used for Tx attempt
378 * @frame_count: # frames attempted by Tx command 378 * @frame_count: # frames attempted by Tx command
379 * @wait_for_ba: Expect block-ack before next Tx reply 379 * @wait_for_ba: Expect block-ack before next Tx reply
@@ -386,35 +386,35 @@ struct iwl_rx_queue {
386 * for block ack (REPLY_COMPRESSED_BA). This struct stores tx reply info 386 * for block ack (REPLY_COMPRESSED_BA). This struct stores tx reply info
387 * until block ack arrives. 387 * until block ack arrives.
388 */ 388 */
389struct iwl_ht_agg { 389struct il_ht_agg {
390 u16 txq_id; 390 u16 txq_id;
391 u16 frame_count; 391 u16 frame_count;
392 u16 wait_for_ba; 392 u16 wait_for_ba;
393 u16 start_idx; 393 u16 start_idx;
394 u64 bitmap; 394 u64 bitmap;
395 u32 rate_n_flags; 395 u32 rate_n_flags;
396#define IWL_AGG_OFF 0 396#define IL_AGG_OFF 0
397#define IWL_AGG_ON 1 397#define IL_AGG_ON 1
398#define IWL_EMPTYING_HW_QUEUE_ADDBA 2 398#define IL_EMPTYING_HW_QUEUE_ADDBA 2
399#define IWL_EMPTYING_HW_QUEUE_DELBA 3 399#define IL_EMPTYING_HW_QUEUE_DELBA 3
400 u8 state; 400 u8 state;
401}; 401};
402 402
403 403
404struct iwl_tid_data { 404struct il_tid_data {
405 u16 seq_number; /* 4965 only */ 405 u16 seq_number; /* 4965 only */
406 u16 tfds_in_queue; 406 u16 tfds_in_queue;
407 struct iwl_ht_agg agg; 407 struct il_ht_agg agg;
408}; 408};
409 409
410struct iwl_hw_key { 410struct il_hw_key {
411 u32 cipher; 411 u32 cipher;
412 int keylen; 412 int keylen;
413 u8 keyidx; 413 u8 keyidx;
414 u8 key[32]; 414 u8 key[32];
415}; 415};
416 416
417union iwl_ht_rate_supp { 417union il_ht_rate_supp {
418 u16 rates; 418 u16 rates;
419 struct { 419 struct {
420 u8 siso_rate; 420 u8 siso_rate;
@@ -445,38 +445,38 @@ union iwl_ht_rate_supp {
445#define CFG_HT_MPDU_DENSITY_MAX CFG_HT_MPDU_DENSITY_16USEC 445#define CFG_HT_MPDU_DENSITY_MAX CFG_HT_MPDU_DENSITY_16USEC
446#define CFG_HT_MPDU_DENSITY_MIN (0x1) 446#define CFG_HT_MPDU_DENSITY_MIN (0x1)
447 447
448struct iwl_ht_config { 448struct il_ht_config {
449 bool single_chain_sufficient; 449 bool single_chain_sufficient;
450 enum ieee80211_smps_mode smps; /* current smps mode */ 450 enum ieee80211_smps_mode smps; /* current smps mode */
451}; 451};
452 452
453/* QoS structures */ 453/* QoS structures */
454struct iwl_qos_info { 454struct il_qos_info {
455 int qos_active; 455 int qos_active;
456 struct iwl_qosparam_cmd def_qos_parm; 456 struct il_qosparam_cmd def_qos_parm;
457}; 457};
458 458
459/* 459/*
460 * Structure should be accessed with sta_lock held. When station addition 460 * Structure should be accessed with sta_lock held. When station addition
461 * is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only 461 * is in progress (IL_STA_UCODE_INPROGRESS) it is possible to access only
462 * the commands (iwl_legacy_addsta_cmd and iwl_link_quality_cmd) without 462 * the commands (il_addsta_cmd and il_link_quality_cmd) without
463 * sta_lock held. 463 * sta_lock held.
464 */ 464 */
465struct iwl_station_entry { 465struct il_station_entry {
466 struct iwl_legacy_addsta_cmd sta; 466 struct il_addsta_cmd sta;
467 struct iwl_tid_data tid[MAX_TID_COUNT]; 467 struct il_tid_data tid[MAX_TID_COUNT];
468 u8 used, ctxid; 468 u8 used, ctxid;
469 struct iwl_hw_key keyinfo; 469 struct il_hw_key keyinfo;
470 struct iwl_link_quality_cmd *lq; 470 struct il_link_quality_cmd *lq;
471}; 471};
472 472
473struct iwl_station_priv_common { 473struct il_station_priv_common {
474 struct iwl_rxon_context *ctx; 474 struct il_rxon_context *ctx;
475 u8 sta_id; 475 u8 sta_id;
476}; 476};
477 477
478/* 478/*
479 * iwl_station_priv: Driver's private station information 479 * il_station_priv: Driver's private station information
480 * 480 *
481 * When mac80211 creates a station it reserves some space (hw->sta_data_size) 481 * When mac80211 creates a station it reserves some space (hw->sta_data_size)
482 * in the structure for use by driver. This structure is places in that 482 * in the structure for use by driver. This structure is places in that
@@ -485,22 +485,22 @@ struct iwl_station_priv_common {
485 * The common struct MUST be first because it is shared between 485 * The common struct MUST be first because it is shared between
486 * 3945 and 4965! 486 * 3945 and 4965!
487 */ 487 */
488struct iwl_station_priv { 488struct il_station_priv {
489 struct iwl_station_priv_common common; 489 struct il_station_priv_common common;
490 struct iwl_lq_sta lq_sta; 490 struct il_lq_sta lq_sta;
491 atomic_t pending_frames; 491 atomic_t pending_frames;
492 bool client; 492 bool client;
493 bool asleep; 493 bool asleep;
494}; 494};
495 495
496/** 496/**
497 * struct iwl_vif_priv - driver's private per-interface information 497 * struct il_vif_priv - driver's private per-interface information
498 * 498 *
499 * When mac80211 allocates a virtual interface, it can allocate 499 * When mac80211 allocates a virtual interface, it can allocate
500 * space for us to put data into. 500 * space for us to put data into.
501 */ 501 */
502struct iwl_vif_priv { 502struct il_vif_priv {
503 struct iwl_rxon_context *ctx; 503 struct il_rxon_context *ctx;
504 u8 ibss_bssid_sta_id; 504 u8 ibss_bssid_sta_id;
505}; 505};
506 506
@@ -512,7 +512,7 @@ struct fw_desc {
512}; 512};
513 513
514/* uCode file layout */ 514/* uCode file layout */
515struct iwl_ucode_header { 515struct il_ucode_header {
516 __le32 ver; /* major/minor/API/serial */ 516 __le32 ver; /* major/minor/API/serial */
517 struct { 517 struct {
518 __le32 inst_size; /* bytes of runtime code */ 518 __le32 inst_size; /* bytes of runtime code */
@@ -524,7 +524,7 @@ struct iwl_ucode_header {
524 } v1; 524 } v1;
525}; 525};
526 526
527struct iwl4965_ibss_seq { 527struct il4965_ibss_seq {
528 u8 mac[ETH_ALEN]; 528 u8 mac[ETH_ALEN];
529 u16 seq_num; 529 u16 seq_num;
530 u16 frag_num; 530 u16 frag_num;
@@ -532,7 +532,7 @@ struct iwl4965_ibss_seq {
532 struct list_head list; 532 struct list_head list;
533}; 533};
534 534
535struct iwl_sensitivity_ranges { 535struct il_sensitivity_ranges {
536 u16 min_nrg_cck; 536 u16 min_nrg_cck;
537 u16 max_nrg_cck; 537 u16 max_nrg_cck;
538 538
@@ -565,7 +565,7 @@ struct iwl_sensitivity_ranges {
565 565
566 566
567/** 567/**
568 * struct iwl_hw_params 568 * struct il_hw_params
569 * @max_txq_num: Max # Tx queues supported 569 * @max_txq_num: Max # Tx queues supported
570 * @dma_chnl_num: Number of Tx DMA/FIFO channels 570 * @dma_chnl_num: Number of Tx DMA/FIFO channels
571 * @scd_bc_tbls_size: size of scheduler byte count tables 571 * @scd_bc_tbls_size: size of scheduler byte count tables
@@ -583,9 +583,9 @@ struct iwl_sensitivity_ranges {
583 * @max_xxx_size: for ucode uses 583 * @max_xxx_size: for ucode uses
584 * @ct_kill_threshold: temperature threshold 584 * @ct_kill_threshold: temperature threshold
585 * @beacon_time_tsf_bits: number of valid tsf bits for beacon time 585 * @beacon_time_tsf_bits: number of valid tsf bits for beacon time
586 * @struct iwl_sensitivity_ranges: range of sensitivity values 586 * @struct il_sensitivity_ranges: range of sensitivity values
587 */ 587 */
588struct iwl_hw_params { 588struct il_hw_params {
589 u8 max_txq_num; 589 u8 max_txq_num;
590 u8 dma_chnl_num; 590 u8 dma_chnl_num;
591 u16 scd_bc_tbls_size; 591 u16 scd_bc_tbls_size;
@@ -606,7 +606,7 @@ struct iwl_hw_params {
606 u32 max_bsm_size; 606 u32 max_bsm_size;
607 u32 ct_kill_threshold; /* value in hw-dependent units */ 607 u32 ct_kill_threshold; /* value in hw-dependent units */
608 u16 beacon_time_tsf_bits; 608 u16 beacon_time_tsf_bits;
609 const struct iwl_sensitivity_ranges *sens; 609 const struct il_sensitivity_ranges *sens;
610}; 610};
611 611
612 612
@@ -619,16 +619,16 @@ struct iwl_hw_params {
619 * which is why they are in the core module files. 619 * which is why they are in the core module files.
620 * 620 *
621 * Naming convention -- 621 * Naming convention --
622 * iwl_ <-- Is part of iwlwifi 622 * il_ <-- Is part of iwlwifi
623 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) 623 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
624 * iwl4965_bg_ <-- Called from work queue context 624 * il4965_bg_ <-- Called from work queue context
625 * iwl4965_mac_ <-- mac80211 callback 625 * il4965_mac_ <-- mac80211 callback
626 * 626 *
627 ****************************************************************************/ 627 ****************************************************************************/
628extern void iwl4965_update_chain_flags(struct iwl_priv *priv); 628extern void il4965_update_chain_flags(struct il_priv *priv);
629extern const u8 iwlegacy_bcast_addr[ETH_ALEN]; 629extern const u8 iwlegacy_bcast_addr[ETH_ALEN];
630extern int iwl_legacy_queue_space(const struct iwl_queue *q); 630extern int il_queue_space(const struct il_queue *q);
631static inline int iwl_legacy_queue_used(const struct iwl_queue *q, int i) 631static inline int il_queue_used(const struct il_queue *q, int i)
632{ 632{
633 return q->write_ptr >= q->read_ptr ? 633 return q->write_ptr >= q->read_ptr ?
634 (i >= q->read_ptr && i < q->write_ptr) : 634 (i >= q->read_ptr && i < q->write_ptr) :
@@ -636,7 +636,7 @@ static inline int iwl_legacy_queue_used(const struct iwl_queue *q, int i)
636} 636}
637 637
638 638
639static inline u8 iwl_legacy_get_cmd_index(struct iwl_queue *q, u32 index, 639static inline u8 il_get_cmd_index(struct il_queue *q, u32 index,
640 int is_huge) 640 int is_huge)
641{ 641{
642 /* 642 /*
@@ -652,26 +652,26 @@ static inline u8 iwl_legacy_get_cmd_index(struct iwl_queue *q, u32 index,
652} 652}
653 653
654 654
655struct iwl_dma_ptr { 655struct il_dma_ptr {
656 dma_addr_t dma; 656 dma_addr_t dma;
657 void *addr; 657 void *addr;
658 size_t size; 658 size_t size;
659}; 659};
660 660
661#define IWL_OPERATION_MODE_AUTO 0 661#define IL_OPERATION_MODE_AUTO 0
662#define IWL_OPERATION_MODE_HT_ONLY 1 662#define IL_OPERATION_MODE_HT_ONLY 1
663#define IWL_OPERATION_MODE_MIXED 2 663#define IL_OPERATION_MODE_MIXED 2
664#define IWL_OPERATION_MODE_20MHZ 3 664#define IL_OPERATION_MODE_20MHZ 3
665 665
666#define IWL_TX_CRC_SIZE 4 666#define IL_TX_CRC_SIZE 4
667#define IWL_TX_DELIMITER_SIZE 4 667#define IL_TX_DELIMITER_SIZE 4
668 668
669#define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000 669#define TX_POWER_IL_ILLEGAL_VOLTAGE -10000
670 670
671/* Sensitivity and chain noise calibration */ 671/* Sensitivity and chain noise calibration */
672#define INITIALIZATION_VALUE 0xFFFF 672#define INITIALIZATION_VALUE 0xFFFF
673#define IWL4965_CAL_NUM_BEACONS 20 673#define IWL4965_CAL_NUM_BEACONS 20
674#define IWL_CAL_NUM_BEACONS 16 674#define IL_CAL_NUM_BEACONS 16
675#define MAXIMUM_ALLOWED_PATHLOSS 15 675#define MAXIMUM_ALLOWED_PATHLOSS 15
676 676
677#define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3 677#define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
@@ -704,35 +704,35 @@ struct iwl_dma_ptr {
704#define NRG_NUM_PREV_STAT_L 20 704#define NRG_NUM_PREV_STAT_L 20
705#define NUM_RX_CHAINS 3 705#define NUM_RX_CHAINS 3
706 706
707enum iwl4965_false_alarm_state { 707enum il4965_false_alarm_state {
708 IWL_FA_TOO_MANY = 0, 708 IL_FA_TOO_MANY = 0,
709 IWL_FA_TOO_FEW = 1, 709 IL_FA_TOO_FEW = 1,
710 IWL_FA_GOOD_RANGE = 2, 710 IL_FA_GOOD_RANGE = 2,
711}; 711};
712 712
713enum iwl4965_chain_noise_state { 713enum il4965_chain_noise_state {
714 IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ 714 IL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */
715 IWL_CHAIN_NOISE_ACCUMULATE, 715 IL_CHAIN_NOISE_ACCUMULATE,
716 IWL_CHAIN_NOISE_CALIBRATED, 716 IL_CHAIN_NOISE_CALIBRATED,
717 IWL_CHAIN_NOISE_DONE, 717 IL_CHAIN_NOISE_DONE,
718}; 718};
719 719
720enum iwl4965_calib_enabled_state { 720enum il4965_calib_enabled_state {
721 IWL_CALIB_DISABLED = 0, /* must be 0 */ 721 IL_CALIB_DISABLED = 0, /* must be 0 */
722 IWL_CALIB_ENABLED = 1, 722 IL_CALIB_ENABLED = 1,
723}; 723};
724 724
725/* 725/*
726 * enum iwl_calib 726 * enum il_calib
727 * defines the order in which results of initial calibrations 727 * defines the order in which results of initial calibrations
728 * should be sent to the runtime uCode 728 * should be sent to the runtime uCode
729 */ 729 */
730enum iwl_calib { 730enum il_calib {
731 IWL_CALIB_MAX, 731 IL_CALIB_MAX,
732}; 732};
733 733
734/* Opaque calibration results */ 734/* Opaque calibration results */
735struct iwl_calib_result { 735struct il_calib_result {
736 void *buf; 736 void *buf;
737 size_t buf_len; 737 size_t buf_len;
738}; 738};
@@ -744,7 +744,7 @@ enum ucode_type {
744}; 744};
745 745
746/* Sensitivity calib data */ 746/* Sensitivity calib data */
747struct iwl_sensitivity_data { 747struct il_sensitivity_data {
748 u32 auto_corr_ofdm; 748 u32 auto_corr_ofdm;
749 u32 auto_corr_ofdm_mrc; 749 u32 auto_corr_ofdm_mrc;
750 u32 auto_corr_ofdm_x1; 750 u32 auto_corr_ofdm_x1;
@@ -775,7 +775,7 @@ struct iwl_sensitivity_data {
775}; 775};
776 776
777/* Chain noise (differential Rx gain) calib data */ 777/* Chain noise (differential Rx gain) calib data */
778struct iwl_chain_noise_data { 778struct il_chain_noise_data {
779 u32 active_chains; 779 u32 active_chains;
780 u32 chain_noise_a; 780 u32 chain_noise_a;
781 u32 chain_noise_b; 781 u32 chain_noise_b;
@@ -793,8 +793,8 @@ struct iwl_chain_noise_data {
793#define EEPROM_SEM_TIMEOUT 10 /* milliseconds */ 793#define EEPROM_SEM_TIMEOUT 10 /* milliseconds */
794#define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ 794#define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */
795 795
796#define IWL_TRAFFIC_ENTRIES (256) 796#define IL_TRAFFIC_ENTRIES (256)
797#define IWL_TRAFFIC_ENTRY_SIZE (64) 797#define IL_TRAFFIC_ENTRY_SIZE (64)
798 798
799enum { 799enum {
800 MEASUREMENT_READY = (1 << 0), 800 MEASUREMENT_READY = (1 << 0),
@@ -818,7 +818,7 @@ struct isr_statistics {
818}; 818};
819 819
820/* management statistics */ 820/* management statistics */
821enum iwl_mgmt_stats { 821enum il_mgmt_stats {
822 MANAGEMENT_ASSOC_REQ = 0, 822 MANAGEMENT_ASSOC_REQ = 0,
823 MANAGEMENT_ASSOC_RESP, 823 MANAGEMENT_ASSOC_RESP,
824 MANAGEMENT_REASSOC_REQ, 824 MANAGEMENT_REASSOC_REQ,
@@ -834,7 +834,7 @@ enum iwl_mgmt_stats {
834 MANAGEMENT_MAX, 834 MANAGEMENT_MAX,
835}; 835};
836/* control statistics */ 836/* control statistics */
837enum iwl_ctrl_stats { 837enum il_ctrl_stats {
838 CONTROL_BACK_REQ = 0, 838 CONTROL_BACK_REQ = 0,
839 CONTROL_BACK, 839 CONTROL_BACK,
840 CONTROL_PSPOLL, 840 CONTROL_PSPOLL,
@@ -863,21 +863,21 @@ struct traffic_stats {
863 * default interrupt coalescing timer is 64 x 32 = 2048 usecs 863 * default interrupt coalescing timer is 64 x 32 = 2048 usecs
864 * default interrupt coalescing calibration timer is 16 x 32 = 512 usecs 864 * default interrupt coalescing calibration timer is 16 x 32 = 512 usecs
865 */ 865 */
866#define IWL_HOST_INT_TIMEOUT_MAX (0xFF) 866#define IL_HOST_INT_TIMEOUT_MAX (0xFF)
867#define IWL_HOST_INT_TIMEOUT_DEF (0x40) 867#define IL_HOST_INT_TIMEOUT_DEF (0x40)
868#define IWL_HOST_INT_TIMEOUT_MIN (0x0) 868#define IL_HOST_INT_TIMEOUT_MIN (0x0)
869#define IWL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF) 869#define IL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF)
870#define IWL_HOST_INT_CALIB_TIMEOUT_DEF (0x10) 870#define IL_HOST_INT_CALIB_TIMEOUT_DEF (0x10)
871#define IWL_HOST_INT_CALIB_TIMEOUT_MIN (0x0) 871#define IL_HOST_INT_CALIB_TIMEOUT_MIN (0x0)
872 872
873#define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) 873#define IL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5)
874 874
875/* TX queue watchdog timeouts in mSecs */ 875/* TX queue watchdog timeouts in mSecs */
876#define IWL_DEF_WD_TIMEOUT (2000) 876#define IL_DEF_WD_TIMEOUT (2000)
877#define IWL_LONG_WD_TIMEOUT (10000) 877#define IL_LONG_WD_TIMEOUT (10000)
878#define IWL_MAX_WD_TIMEOUT (120000) 878#define IL_MAX_WD_TIMEOUT (120000)
879 879
880struct iwl_force_reset { 880struct il_force_reset {
881 int reset_request_count; 881 int reset_request_count;
882 int reset_success_count; 882 int reset_success_count;
883 int reset_reject_count; 883 int reset_reject_count;
@@ -899,13 +899,13 @@ struct iwl_force_reset {
899 */ 899 */
900#define IWL4965_EXT_BEACON_TIME_POS 22 900#define IWL4965_EXT_BEACON_TIME_POS 22
901 901
902enum iwl_rxon_context_id { 902enum il_rxon_context_id {
903 IWL_RXON_CTX_BSS, 903 IL_RXON_CTX_BSS,
904 904
905 NUM_IWL_RXON_CTX 905 NUM_IL_RXON_CTX
906}; 906};
907 907
908struct iwl_rxon_context { 908struct il_rxon_context {
909 struct ieee80211_vif *vif; 909 struct ieee80211_vif *vif;
910 910
911 const u8 *ac_to_fifo; 911 const u8 *ac_to_fifo;
@@ -921,7 +921,7 @@ struct iwl_rxon_context {
921 921
922 bool ht_need_multiple_chains; 922 bool ht_need_multiple_chains;
923 923
924 enum iwl_rxon_context_id ctxid; 924 enum il_rxon_context_id ctxid;
925 925
926 u32 interface_modes, exclusive_interface_modes; 926 u32 interface_modes, exclusive_interface_modes;
927 u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype; 927 u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype;
@@ -932,12 +932,12 @@ struct iwl_rxon_context {
932 * routines that actually update the physical 932 * routines that actually update the physical
933 * hardware. 933 * hardware.
934 */ 934 */
935 const struct iwl_legacy_rxon_cmd active; 935 const struct il_rxon_cmd active;
936 struct iwl_legacy_rxon_cmd staging; 936 struct il_rxon_cmd staging;
937 937
938 struct iwl_rxon_time_cmd timing; 938 struct il_rxon_time_cmd timing;
939 939
940 struct iwl_qos_info qos_data; 940 struct il_qos_info qos_data;
941 941
942 u8 bcast_sta_id, ap_sta_id; 942 u8 bcast_sta_id, ap_sta_id;
943 943
@@ -945,7 +945,7 @@ struct iwl_rxon_context {
945 u8 qos_cmd; 945 u8 qos_cmd;
946 u8 wep_key_cmd; 946 u8 wep_key_cmd;
947 947
948 struct iwl_wep_key wep_keys[WEP_KEYS_MAX]; 948 struct il_wep_key wep_keys[WEP_KEYS_MAX];
949 u8 key_mapping_keys; 949 u8 key_mapping_keys;
950 950
951 __le32 station_flags; 951 __le32 station_flags;
@@ -958,13 +958,13 @@ struct iwl_rxon_context {
958 } ht; 958 } ht;
959}; 959};
960 960
961struct iwl_priv { 961struct il_priv {
962 962
963 /* ieee device used by generic ieee processing code */ 963 /* ieee device used by generic ieee processing code */
964 struct ieee80211_hw *hw; 964 struct ieee80211_hw *hw;
965 struct ieee80211_channel *ieee_channels; 965 struct ieee80211_channel *ieee_channels;
966 struct ieee80211_rate *ieee_rates; 966 struct ieee80211_rate *ieee_rates;
967 struct iwl_cfg *cfg; 967 struct il_cfg *cfg;
968 968
969 /* temporary frame storage list */ 969 /* temporary frame storage list */
970 struct list_head free_frames; 970 struct list_head free_frames;
@@ -973,13 +973,13 @@ struct iwl_priv {
973 enum ieee80211_band band; 973 enum ieee80211_band band;
974 int alloc_rxb_page; 974 int alloc_rxb_page;
975 975
976 void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, 976 void (*rx_handlers[REPLY_MAX])(struct il_priv *priv,
977 struct iwl_rx_mem_buffer *rxb); 977 struct il_rx_mem_buffer *rxb);
978 978
979 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; 979 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
980 980
981 /* spectrum measurement report caching */ 981 /* spectrum measurement report caching */
982 struct iwl_spectrum_notification measure_report; 982 struct il_spectrum_notification measure_report;
983 u8 measurement_status; 983 u8 measurement_status;
984 984
985 /* ucode beacon time */ 985 /* ucode beacon time */
@@ -990,11 +990,11 @@ struct iwl_priv {
990 u32 ibss_manager; 990 u32 ibss_manager;
991 991
992 /* force reset */ 992 /* force reset */
993 struct iwl_force_reset force_reset; 993 struct il_force_reset force_reset;
994 994
995 /* we allocate array of iwl_channel_info for NIC's valid channels. 995 /* we allocate array of il_channel_info for NIC's valid channels.
996 * Access via channel # using indirect index array */ 996 * Access via channel # using indirect index array */
997 struct iwl_channel_info *channel_info; /* channel info array */ 997 struct il_channel_info *channel_info; /* channel info array */
998 u8 channel_count; /* # of channels */ 998 u8 channel_count; /* # of channels */
999 999
1000 /* thermal calibration */ 1000 /* thermal calibration */
@@ -1002,7 +1002,7 @@ struct iwl_priv {
1002 s32 last_temperature; 1002 s32 last_temperature;
1003 1003
1004 /* init calibration results */ 1004 /* init calibration results */
1005 struct iwl_calib_result calib_results[IWL_CALIB_MAX]; 1005 struct il_calib_result calib_results[IL_CALIB_MAX];
1006 1006
1007 /* Scan related variables */ 1007 /* Scan related variables */
1008 unsigned long scan_start; 1008 unsigned long scan_start;
@@ -1044,7 +1044,7 @@ struct iwl_priv {
1044 /* uCode images, save to reload in case of failure */ 1044 /* uCode images, save to reload in case of failure */
1045 int fw_index; /* firmware we're trying to load */ 1045 int fw_index; /* firmware we're trying to load */
1046 u32 ucode_ver; /* version of ucode, copy of 1046 u32 ucode_ver; /* version of ucode, copy of
1047 iwl_ucode.ver */ 1047 il_ucode.ver */
1048 struct fw_desc ucode_code; /* runtime inst */ 1048 struct fw_desc ucode_code; /* runtime inst */
1049 struct fw_desc ucode_data; /* runtime data original */ 1049 struct fw_desc ucode_data; /* runtime data original */
1050 struct fw_desc ucode_data_backup; /* runtime data save/restore */ 1050 struct fw_desc ucode_data_backup; /* runtime data save/restore */
@@ -1055,23 +1055,23 @@ struct iwl_priv {
1055 u8 ucode_write_complete; /* the image write is complete */ 1055 u8 ucode_write_complete; /* the image write is complete */
1056 char firmware_name[25]; 1056 char firmware_name[25];
1057 1057
1058 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; 1058 struct il_rxon_context contexts[NUM_IL_RXON_CTX];
1059 1059
1060 __le16 switch_channel; 1060 __le16 switch_channel;
1061 1061
1062 /* 1st responses from initialize and runtime uCode images. 1062 /* 1st responses from initialize and runtime uCode images.
1063 * _4965's initialize alive response contains some calibration data. */ 1063 * _4965's initialize alive response contains some calibration data. */
1064 struct iwl_init_alive_resp card_alive_init; 1064 struct il_init_alive_resp card_alive_init;
1065 struct iwl_alive_resp card_alive; 1065 struct il_alive_resp card_alive;
1066 1066
1067 u16 active_rate; 1067 u16 active_rate;
1068 1068
1069 u8 start_calib; 1069 u8 start_calib;
1070 struct iwl_sensitivity_data sensitivity_data; 1070 struct il_sensitivity_data sensitivity_data;
1071 struct iwl_chain_noise_data chain_noise_data; 1071 struct il_chain_noise_data chain_noise_data;
1072 __le16 sensitivity_tbl[HD_TABLE_SIZE]; 1072 __le16 sensitivity_tbl[HD_TABLE_SIZE];
1073 1073
1074 struct iwl_ht_config current_ht_config; 1074 struct il_ht_config current_ht_config;
1075 1075
1076 /* Rate scaling data */ 1076 /* Rate scaling data */
1077 u8 retry_rate; 1077 u8 retry_rate;
@@ -1081,11 +1081,11 @@ struct iwl_priv {
1081 int activity_timer_active; 1081 int activity_timer_active;
1082 1082
1083 /* Rx and Tx DMA processing queues */ 1083 /* Rx and Tx DMA processing queues */
1084 struct iwl_rx_queue rxq; 1084 struct il_rx_queue rxq;
1085 struct iwl_tx_queue *txq; 1085 struct il_tx_queue *txq;
1086 unsigned long txq_ctx_active_msk; 1086 unsigned long txq_ctx_active_msk;
1087 struct iwl_dma_ptr kw; /* keep warm address */ 1087 struct il_dma_ptr kw; /* keep warm address */
1088 struct iwl_dma_ptr scd_bc_tbls; 1088 struct il_dma_ptr scd_bc_tbls;
1089 1089
1090 u32 scd_base_addr; /* scheduler sram base address */ 1090 u32 scd_base_addr; /* scheduler sram base address */
1091 1091
@@ -1098,7 +1098,7 @@ struct iwl_priv {
1098 /* counts interrupts */ 1098 /* counts interrupts */
1099 struct isr_statistics isr_stats; 1099 struct isr_statistics isr_stats;
1100 1100
1101 struct iwl_power_mgr power_data; 1101 struct il_power_mgr power_data;
1102 1102
1103 /* context information */ 1103 /* context information */
1104 u8 bssid[ETH_ALEN]; /* used only on 3945 but filled by core */ 1104 u8 bssid[ETH_ALEN]; /* used only on 3945 but filled by core */
@@ -1108,12 +1108,12 @@ struct iwl_priv {
1108 /* Note: if lock and sta_lock are needed, lock must be acquired first */ 1108 /* Note: if lock and sta_lock are needed, lock must be acquired first */
1109 spinlock_t sta_lock; 1109 spinlock_t sta_lock;
1110 int num_stations; 1110 int num_stations;
1111 struct iwl_station_entry stations[IWL_STATION_COUNT]; 1111 struct il_station_entry stations[IL_STATION_COUNT];
1112 unsigned long ucode_key_table; 1112 unsigned long ucode_key_table;
1113 1113
1114 /* queue refcounts */ 1114 /* queue refcounts */
1115#define IWL_MAX_HW_QUEUES 32 1115#define IL_MAX_HW_QUEUES 32
1116 unsigned long queue_stopped[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)]; 1116 unsigned long queue_stopped[BITS_TO_LONGS(IL_MAX_HW_QUEUES)];
1117 /* for each AC */ 1117 /* for each AC */
1118 atomic_t queue_stop_count[4]; 1118 atomic_t queue_stop_count[4];
1119 1119
@@ -1124,7 +1124,7 @@ struct iwl_priv {
1124 1124
1125 /* eeprom -- this is in the card's little endian byte order */ 1125 /* eeprom -- this is in the card's little endian byte order */
1126 u8 *eeprom; 1126 u8 *eeprom;
1127 struct iwl_eeprom_calib_info *calib_info; 1127 struct il_eeprom_calib_info *calib_info;
1128 1128
1129 enum nl80211_iftype iw_mode; 1129 enum nl80211_iftype iw_mode;
1130 1130
@@ -1140,11 +1140,11 @@ struct iwl_priv {
1140 struct delayed_work thermal_periodic; 1140 struct delayed_work thermal_periodic;
1141 struct delayed_work rfkill_poll; 1141 struct delayed_work rfkill_poll;
1142 1142
1143 struct iwl3945_notif_statistics statistics; 1143 struct il3945_notif_statistics statistics;
1144#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 1144#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
1145 struct iwl3945_notif_statistics accum_statistics; 1145 struct il3945_notif_statistics accum_statistics;
1146 struct iwl3945_notif_statistics delta_statistics; 1146 struct il3945_notif_statistics delta_statistics;
1147 struct iwl3945_notif_statistics max_delta; 1147 struct il3945_notif_statistics max_delta;
1148#endif 1148#endif
1149 1149
1150 u32 sta_supp_rates; 1150 u32 sta_supp_rates;
@@ -1159,13 +1159,13 @@ struct iwl_priv {
1159 * EEPROM has a derived clip setting for 1159 * EEPROM has a derived clip setting for
1160 * each rate. 1160 * each rate.
1161 */ 1161 */
1162 const struct iwl3945_clip_group clip_groups[5]; 1162 const struct il3945_clip_group clip_groups[5];
1163 1163
1164 } _3945; 1164 } _3945;
1165#endif 1165#endif
1166#if defined(CONFIG_IWL4965) || defined(CONFIG_IWL4965_MODULE) 1166#if defined(CONFIG_IWL4965) || defined(CONFIG_IWL4965_MODULE)
1167 struct { 1167 struct {
1168 struct iwl_rx_phy_res last_phy_res; 1168 struct il_rx_phy_res last_phy_res;
1169 bool last_phy_res_valid; 1169 bool last_phy_res_valid;
1170 1170
1171 struct completion firmware_loading_complete; 1171 struct completion firmware_loading_complete;
@@ -1178,18 +1178,18 @@ struct iwl_priv {
1178 u8 phy_calib_chain_noise_reset_cmd; 1178 u8 phy_calib_chain_noise_reset_cmd;
1179 u8 phy_calib_chain_noise_gain_cmd; 1179 u8 phy_calib_chain_noise_gain_cmd;
1180 1180
1181 struct iwl_notif_statistics statistics; 1181 struct il_notif_statistics statistics;
1182#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS 1182#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
1183 struct iwl_notif_statistics accum_statistics; 1183 struct il_notif_statistics accum_statistics;
1184 struct iwl_notif_statistics delta_statistics; 1184 struct il_notif_statistics delta_statistics;
1185 struct iwl_notif_statistics max_delta; 1185 struct il_notif_statistics max_delta;
1186#endif 1186#endif
1187 1187
1188 } _4965; 1188 } _4965;
1189#endif 1189#endif
1190 }; 1190 };
1191 1191
1192 struct iwl_hw_params hw_params; 1192 struct il_hw_params hw_params;
1193 1193
1194 u32 inta_mask; 1194 u32 inta_mask;
1195 1195
@@ -1200,7 +1200,7 @@ struct iwl_priv {
1200 struct work_struct rx_replenish; 1200 struct work_struct rx_replenish;
1201 struct work_struct abort_scan; 1201 struct work_struct abort_scan;
1202 1202
1203 struct iwl_rxon_context *beacon_ctx; 1203 struct il_rxon_context *beacon_ctx;
1204 struct sk_buff *beacon_skb; 1204 struct sk_buff *beacon_skb;
1205 1205
1206 struct work_struct tx_flush; 1206 struct work_struct tx_flush;
@@ -1245,27 +1245,27 @@ struct iwl_priv {
1245 struct led_classdev led; 1245 struct led_classdev led;
1246 unsigned long blink_on, blink_off; 1246 unsigned long blink_on, blink_off;
1247 bool led_registered; 1247 bool led_registered;
1248}; /*iwl_priv */ 1248}; /*il_priv */
1249 1249
1250static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id) 1250static inline void il_txq_ctx_activate(struct il_priv *priv, int txq_id)
1251{ 1251{
1252 set_bit(txq_id, &priv->txq_ctx_active_msk); 1252 set_bit(txq_id, &priv->txq_ctx_active_msk);
1253} 1253}
1254 1254
1255static inline void iwl_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id) 1255static inline void il_txq_ctx_deactivate(struct il_priv *priv, int txq_id)
1256{ 1256{
1257 clear_bit(txq_id, &priv->txq_ctx_active_msk); 1257 clear_bit(txq_id, &priv->txq_ctx_active_msk);
1258} 1258}
1259 1259
1260#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 1260#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
1261/* 1261/*
1262 * iwl_legacy_get_debug_level: Return active debug level for device 1262 * il_get_debug_level: Return active debug level for device
1263 * 1263 *
1264 * Using sysfs it is possible to set per device debug level. This debug 1264 * Using sysfs it is possible to set per device debug level. This debug
1265 * level will be used if set, otherwise the global debug level which can be 1265 * level will be used if set, otherwise the global debug level which can be
1266 * set via module parameter is used. 1266 * set via module parameter is used.
1267 */ 1267 */
1268static inline u32 iwl_legacy_get_debug_level(struct iwl_priv *priv) 1268static inline u32 il_get_debug_level(struct il_priv *priv)
1269{ 1269{
1270 if (priv->debug_level) 1270 if (priv->debug_level)
1271 return priv->debug_level; 1271 return priv->debug_level;
@@ -1273,7 +1273,7 @@ static inline u32 iwl_legacy_get_debug_level(struct iwl_priv *priv)
1273 return iwlegacy_debug_level; 1273 return iwlegacy_debug_level;
1274} 1274}
1275#else 1275#else
1276static inline u32 iwl_legacy_get_debug_level(struct iwl_priv *priv) 1276static inline u32 il_get_debug_level(struct il_priv *priv)
1277{ 1277{
1278 return iwlegacy_debug_level; 1278 return iwlegacy_debug_level;
1279} 1279}
@@ -1281,7 +1281,7 @@ static inline u32 iwl_legacy_get_debug_level(struct iwl_priv *priv)
1281 1281
1282 1282
1283static inline struct ieee80211_hdr * 1283static inline struct ieee80211_hdr *
1284iwl_legacy_tx_queue_get_hdr(struct iwl_priv *priv, 1284il_tx_queue_get_hdr(struct il_priv *priv,
1285 int txq_id, int idx) 1285 int txq_id, int idx)
1286{ 1286{
1287 if (priv->txq[txq_id].txb[idx].skb) 1287 if (priv->txq[txq_id].txb[idx].skb)
@@ -1290,75 +1290,75 @@ iwl_legacy_tx_queue_get_hdr(struct iwl_priv *priv,
1290 return NULL; 1290 return NULL;
1291} 1291}
1292 1292
1293static inline struct iwl_rxon_context * 1293static inline struct il_rxon_context *
1294iwl_legacy_rxon_ctx_from_vif(struct ieee80211_vif *vif) 1294il_rxon_ctx_from_vif(struct ieee80211_vif *vif)
1295{ 1295{
1296 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1296 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
1297 1297
1298 return vif_priv->ctx; 1298 return vif_priv->ctx;
1299} 1299}
1300 1300
1301#define for_each_context(priv, ctx) \ 1301#define for_each_context(priv, ctx) \
1302 for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \ 1302 for (ctx = &priv->contexts[IL_RXON_CTX_BSS]; \
1303 ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \ 1303 ctx < &priv->contexts[NUM_IL_RXON_CTX]; ctx++) \
1304 if (priv->valid_contexts & BIT(ctx->ctxid)) 1304 if (priv->valid_contexts & BIT(ctx->ctxid))
1305 1305
1306static inline int iwl_legacy_is_associated(struct iwl_priv *priv, 1306static inline int il_is_associated(struct il_priv *priv,
1307 enum iwl_rxon_context_id ctxid) 1307 enum il_rxon_context_id ctxid)
1308{ 1308{
1309 return (priv->contexts[ctxid].active.filter_flags & 1309 return (priv->contexts[ctxid].active.filter_flags &
1310 RXON_FILTER_ASSOC_MSK) ? 1 : 0; 1310 RXON_FILTER_ASSOC_MSK) ? 1 : 0;
1311} 1311}
1312 1312
1313static inline int iwl_legacy_is_any_associated(struct iwl_priv *priv) 1313static inline int il_is_any_associated(struct il_priv *priv)
1314{ 1314{
1315 return iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS); 1315 return il_is_associated(priv, IL_RXON_CTX_BSS);
1316} 1316}
1317 1317
1318static inline int iwl_legacy_is_associated_ctx(struct iwl_rxon_context *ctx) 1318static inline int il_is_associated_ctx(struct il_rxon_context *ctx)
1319{ 1319{
1320 return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; 1320 return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
1321} 1321}
1322 1322
1323static inline int iwl_legacy_is_channel_valid(const struct iwl_channel_info *ch_info) 1323static inline int il_is_channel_valid(const struct il_channel_info *ch_info)
1324{ 1324{
1325 if (ch_info == NULL) 1325 if (ch_info == NULL)
1326 return 0; 1326 return 0;
1327 return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0; 1327 return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
1328} 1328}
1329 1329
1330static inline int iwl_legacy_is_channel_radar(const struct iwl_channel_info *ch_info) 1330static inline int il_is_channel_radar(const struct il_channel_info *ch_info)
1331{ 1331{
1332 return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0; 1332 return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
1333} 1333}
1334 1334
1335static inline u8 iwl_legacy_is_channel_a_band(const struct iwl_channel_info *ch_info) 1335static inline u8 il_is_channel_a_band(const struct il_channel_info *ch_info)
1336{ 1336{
1337 return ch_info->band == IEEE80211_BAND_5GHZ; 1337 return ch_info->band == IEEE80211_BAND_5GHZ;
1338} 1338}
1339 1339
1340static inline int 1340static inline int
1341iwl_legacy_is_channel_passive(const struct iwl_channel_info *ch) 1341il_is_channel_passive(const struct il_channel_info *ch)
1342{ 1342{
1343 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; 1343 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
1344} 1344}
1345 1345
1346static inline int 1346static inline int
1347iwl_legacy_is_channel_ibss(const struct iwl_channel_info *ch) 1347il_is_channel_ibss(const struct il_channel_info *ch)
1348{ 1348{
1349 return (ch->flags & EEPROM_CHANNEL_IBSS) ? 1 : 0; 1349 return (ch->flags & EEPROM_CHANNEL_IBSS) ? 1 : 0;
1350} 1350}
1351 1351
1352static inline void 1352static inline void
1353__iwl_legacy_free_pages(struct iwl_priv *priv, struct page *page) 1353__il_free_pages(struct il_priv *priv, struct page *page)
1354{ 1354{
1355 __free_pages(page, priv->hw_params.rx_page_order); 1355 __free_pages(page, priv->hw_params.rx_page_order);
1356 priv->alloc_rxb_page--; 1356 priv->alloc_rxb_page--;
1357} 1357}
1358 1358
1359static inline void iwl_legacy_free_pages(struct iwl_priv *priv, unsigned long page) 1359static inline void il_free_pages(struct il_priv *priv, unsigned long page)
1360{ 1360{
1361 free_pages(page, priv->hw_params.rx_page_order); 1361 free_pages(page, priv->hw_params.rx_page_order);
1362 priv->alloc_rxb_page--; 1362 priv->alloc_rxb_page--;
1363} 1363}
1364#endif /* __iwl_legacy_dev_h__ */ 1364#endif /* __il_dev_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
index 5bf3f49b74ab..1075f1d7f016 100644
--- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
@@ -81,7 +81,7 @@
81 * EEPROM contents to the specific channel number supported for each 81 * EEPROM contents to the specific channel number supported for each
82 * band. 82 * band.
83 * 83 *
84 * For example, iwl_priv->eeprom.band_3_channels[4] from the band_3 84 * For example, il_priv->eeprom.band_3_channels[4] from the band_3
85 * definition below maps to physical channel 42 in the 5.2GHz spectrum. 85 * definition below maps to physical channel 42 in the 5.2GHz spectrum.
86 * The specific geography and calibration information for that channel 86 * The specific geography and calibration information for that channel
87 * is contained in the eeprom map itself. 87 * is contained in the eeprom map itself.
@@ -142,18 +142,18 @@ static const u8 iwlegacy_eeprom_band_7[] = { /* 5.2 ht40 channel */
142 * 142 *
143******************************************************************************/ 143******************************************************************************/
144 144
145static int iwl_legacy_eeprom_verify_signature(struct iwl_priv *priv) 145static int il_eeprom_verify_signature(struct il_priv *priv)
146{ 146{
147 u32 gp = iwl_read32(priv, CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK; 147 u32 gp = il_read32(priv, CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK;
148 int ret = 0; 148 int ret = 0;
149 149
150 IWL_DEBUG_EEPROM(priv, "EEPROM signature=0x%08x\n", gp); 150 IL_DEBUG_EEPROM(priv, "EEPROM signature=0x%08x\n", gp);
151 switch (gp) { 151 switch (gp) {
152 case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K: 152 case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K:
153 case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K: 153 case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K:
154 break; 154 break;
155 default: 155 default:
156 IWL_ERR(priv, "bad EEPROM signature," 156 IL_ERR(priv, "bad EEPROM signature,"
157 "EEPROM_GP=0x%08x\n", gp); 157 "EEPROM_GP=0x%08x\n", gp);
158 ret = -ENOENT; 158 ret = -ENOENT;
159 break; 159 break;
@@ -162,39 +162,39 @@ static int iwl_legacy_eeprom_verify_signature(struct iwl_priv *priv)
162} 162}
163 163
164const u8 164const u8
165*iwl_legacy_eeprom_query_addr(const struct iwl_priv *priv, size_t offset) 165*il_eeprom_query_addr(const struct il_priv *priv, size_t offset)
166{ 166{
167 BUG_ON(offset >= priv->cfg->base_params->eeprom_size); 167 BUG_ON(offset >= priv->cfg->base_params->eeprom_size);
168 return &priv->eeprom[offset]; 168 return &priv->eeprom[offset];
169} 169}
170EXPORT_SYMBOL(iwl_legacy_eeprom_query_addr); 170EXPORT_SYMBOL(il_eeprom_query_addr);
171 171
172u16 iwl_legacy_eeprom_query16(const struct iwl_priv *priv, size_t offset) 172u16 il_eeprom_query16(const struct il_priv *priv, size_t offset)
173{ 173{
174 if (!priv->eeprom) 174 if (!priv->eeprom)
175 return 0; 175 return 0;
176 return (u16)priv->eeprom[offset] | ((u16)priv->eeprom[offset + 1] << 8); 176 return (u16)priv->eeprom[offset] | ((u16)priv->eeprom[offset + 1] << 8);
177} 177}
178EXPORT_SYMBOL(iwl_legacy_eeprom_query16); 178EXPORT_SYMBOL(il_eeprom_query16);
179 179
180/** 180/**
181 * iwl_legacy_eeprom_init - read EEPROM contents 181 * il_eeprom_init - read EEPROM contents
182 * 182 *
183 * Load the EEPROM contents from adapter into priv->eeprom 183 * Load the EEPROM contents from adapter into priv->eeprom
184 * 184 *
185 * NOTE: This routine uses the non-debug IO access functions. 185 * NOTE: This routine uses the non-debug IO access functions.
186 */ 186 */
187int iwl_legacy_eeprom_init(struct iwl_priv *priv) 187int il_eeprom_init(struct il_priv *priv)
188{ 188{
189 __le16 *e; 189 __le16 *e;
190 u32 gp = iwl_read32(priv, CSR_EEPROM_GP); 190 u32 gp = il_read32(priv, CSR_EEPROM_GP);
191 int sz; 191 int sz;
192 int ret; 192 int ret;
193 u16 addr; 193 u16 addr;
194 194
195 /* allocate eeprom */ 195 /* allocate eeprom */
196 sz = priv->cfg->base_params->eeprom_size; 196 sz = priv->cfg->base_params->eeprom_size;
197 IWL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz); 197 IL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz);
198 priv->eeprom = kzalloc(sz, GFP_KERNEL); 198 priv->eeprom = kzalloc(sz, GFP_KERNEL);
199 if (!priv->eeprom) { 199 if (!priv->eeprom) {
200 ret = -ENOMEM; 200 ret = -ENOMEM;
@@ -204,9 +204,9 @@ int iwl_legacy_eeprom_init(struct iwl_priv *priv)
204 204
205 priv->cfg->ops->lib->apm_ops.init(priv); 205 priv->cfg->ops->lib->apm_ops.init(priv);
206 206
207 ret = iwl_legacy_eeprom_verify_signature(priv); 207 ret = il_eeprom_verify_signature(priv);
208 if (ret < 0) { 208 if (ret < 0) {
209 IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); 209 IL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp);
210 ret = -ENOENT; 210 ret = -ENOENT;
211 goto err; 211 goto err;
212 } 212 }
@@ -214,7 +214,7 @@ int iwl_legacy_eeprom_init(struct iwl_priv *priv)
214 /* Make sure driver (instead of uCode) is allowed to read EEPROM */ 214 /* Make sure driver (instead of uCode) is allowed to read EEPROM */
215 ret = priv->cfg->ops->lib->eeprom_ops.acquire_semaphore(priv); 215 ret = priv->cfg->ops->lib->eeprom_ops.acquire_semaphore(priv);
216 if (ret < 0) { 216 if (ret < 0) {
217 IWL_ERR(priv, "Failed to acquire EEPROM semaphore.\n"); 217 IL_ERR(priv, "Failed to acquire EEPROM semaphore.\n");
218 ret = -ENOENT; 218 ret = -ENOENT;
219 goto err; 219 goto err;
220 } 220 }
@@ -223,25 +223,25 @@ int iwl_legacy_eeprom_init(struct iwl_priv *priv)
223 for (addr = 0; addr < sz; addr += sizeof(u16)) { 223 for (addr = 0; addr < sz; addr += sizeof(u16)) {
224 u32 r; 224 u32 r;
225 225
226 _iwl_legacy_write32(priv, CSR_EEPROM_REG, 226 _il_write32(priv, CSR_EEPROM_REG,
227 CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); 227 CSR_EEPROM_REG_MSK_ADDR & (addr << 1));
228 228
229 ret = iwl_poll_bit(priv, CSR_EEPROM_REG, 229 ret = il_poll_bit(priv, CSR_EEPROM_REG,
230 CSR_EEPROM_REG_READ_VALID_MSK, 230 CSR_EEPROM_REG_READ_VALID_MSK,
231 CSR_EEPROM_REG_READ_VALID_MSK, 231 CSR_EEPROM_REG_READ_VALID_MSK,
232 IWL_EEPROM_ACCESS_TIMEOUT); 232 IL_EEPROM_ACCESS_TIMEOUT);
233 if (ret < 0) { 233 if (ret < 0) {
234 IWL_ERR(priv, "Time out reading EEPROM[%d]\n", 234 IL_ERR(priv, "Time out reading EEPROM[%d]\n",
235 addr); 235 addr);
236 goto done; 236 goto done;
237 } 237 }
238 r = _iwl_legacy_read_direct32(priv, CSR_EEPROM_REG); 238 r = _il_read_direct32(priv, CSR_EEPROM_REG);
239 e[addr / 2] = cpu_to_le16(r >> 16); 239 e[addr / 2] = cpu_to_le16(r >> 16);
240 } 240 }
241 241
242 IWL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n", 242 IL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n",
243 "EEPROM", 243 "EEPROM",
244 iwl_legacy_eeprom_query16(priv, EEPROM_VERSION)); 244 il_eeprom_query16(priv, EEPROM_VERSION));
245 245
246 ret = 0; 246 ret = 0;
247done: 247done:
@@ -249,24 +249,24 @@ done:
249 249
250err: 250err:
251 if (ret) 251 if (ret)
252 iwl_legacy_eeprom_free(priv); 252 il_eeprom_free(priv);
253 /* Reset chip to save power until we load uCode during "up". */ 253 /* Reset chip to save power until we load uCode during "up". */
254 iwl_legacy_apm_stop(priv); 254 il_apm_stop(priv);
255alloc_err: 255alloc_err:
256 return ret; 256 return ret;
257} 257}
258EXPORT_SYMBOL(iwl_legacy_eeprom_init); 258EXPORT_SYMBOL(il_eeprom_init);
259 259
260void iwl_legacy_eeprom_free(struct iwl_priv *priv) 260void il_eeprom_free(struct il_priv *priv)
261{ 261{
262 kfree(priv->eeprom); 262 kfree(priv->eeprom);
263 priv->eeprom = NULL; 263 priv->eeprom = NULL;
264} 264}
265EXPORT_SYMBOL(iwl_legacy_eeprom_free); 265EXPORT_SYMBOL(il_eeprom_free);
266 266
267static void iwl_legacy_init_band_reference(const struct iwl_priv *priv, 267static void il_init_band_reference(const struct il_priv *priv,
268 int eep_band, int *eeprom_ch_count, 268 int eep_band, int *eeprom_ch_count,
269 const struct iwl_eeprom_channel **eeprom_ch_info, 269 const struct il_eeprom_channel **eeprom_ch_info,
270 const u8 **eeprom_ch_index) 270 const u8 **eeprom_ch_index)
271{ 271{
272 u32 offset = priv->cfg->ops->lib-> 272 u32 offset = priv->cfg->ops->lib->
@@ -274,44 +274,44 @@ static void iwl_legacy_init_band_reference(const struct iwl_priv *priv,
274 switch (eep_band) { 274 switch (eep_band) {
275 case 1: /* 2.4GHz band */ 275 case 1: /* 2.4GHz band */
276 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_1); 276 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_1);
277 *eeprom_ch_info = (struct iwl_eeprom_channel *) 277 *eeprom_ch_info = (struct il_eeprom_channel *)
278 iwl_legacy_eeprom_query_addr(priv, offset); 278 il_eeprom_query_addr(priv, offset);
279 *eeprom_ch_index = iwlegacy_eeprom_band_1; 279 *eeprom_ch_index = iwlegacy_eeprom_band_1;
280 break; 280 break;
281 case 2: /* 4.9GHz band */ 281 case 2: /* 4.9GHz band */
282 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_2); 282 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_2);
283 *eeprom_ch_info = (struct iwl_eeprom_channel *) 283 *eeprom_ch_info = (struct il_eeprom_channel *)
284 iwl_legacy_eeprom_query_addr(priv, offset); 284 il_eeprom_query_addr(priv, offset);
285 *eeprom_ch_index = iwlegacy_eeprom_band_2; 285 *eeprom_ch_index = iwlegacy_eeprom_band_2;
286 break; 286 break;
287 case 3: /* 5.2GHz band */ 287 case 3: /* 5.2GHz band */
288 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_3); 288 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_3);
289 *eeprom_ch_info = (struct iwl_eeprom_channel *) 289 *eeprom_ch_info = (struct il_eeprom_channel *)
290 iwl_legacy_eeprom_query_addr(priv, offset); 290 il_eeprom_query_addr(priv, offset);
291 *eeprom_ch_index = iwlegacy_eeprom_band_3; 291 *eeprom_ch_index = iwlegacy_eeprom_band_3;
292 break; 292 break;
293 case 4: /* 5.5GHz band */ 293 case 4: /* 5.5GHz band */
294 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_4); 294 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_4);
295 *eeprom_ch_info = (struct iwl_eeprom_channel *) 295 *eeprom_ch_info = (struct il_eeprom_channel *)
296 iwl_legacy_eeprom_query_addr(priv, offset); 296 il_eeprom_query_addr(priv, offset);
297 *eeprom_ch_index = iwlegacy_eeprom_band_4; 297 *eeprom_ch_index = iwlegacy_eeprom_band_4;
298 break; 298 break;
299 case 5: /* 5.7GHz band */ 299 case 5: /* 5.7GHz band */
300 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_5); 300 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_5);
301 *eeprom_ch_info = (struct iwl_eeprom_channel *) 301 *eeprom_ch_info = (struct il_eeprom_channel *)
302 iwl_legacy_eeprom_query_addr(priv, offset); 302 il_eeprom_query_addr(priv, offset);
303 *eeprom_ch_index = iwlegacy_eeprom_band_5; 303 *eeprom_ch_index = iwlegacy_eeprom_band_5;
304 break; 304 break;
305 case 6: /* 2.4GHz ht40 channels */ 305 case 6: /* 2.4GHz ht40 channels */
306 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_6); 306 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_6);
307 *eeprom_ch_info = (struct iwl_eeprom_channel *) 307 *eeprom_ch_info = (struct il_eeprom_channel *)
308 iwl_legacy_eeprom_query_addr(priv, offset); 308 il_eeprom_query_addr(priv, offset);
309 *eeprom_ch_index = iwlegacy_eeprom_band_6; 309 *eeprom_ch_index = iwlegacy_eeprom_band_6;
310 break; 310 break;
311 case 7: /* 5 GHz ht40 channels */ 311 case 7: /* 5 GHz ht40 channels */
312 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_7); 312 *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_7);
313 *eeprom_ch_info = (struct iwl_eeprom_channel *) 313 *eeprom_ch_info = (struct il_eeprom_channel *)
314 iwl_legacy_eeprom_query_addr(priv, offset); 314 il_eeprom_query_addr(priv, offset);
315 *eeprom_ch_index = iwlegacy_eeprom_band_7; 315 *eeprom_ch_index = iwlegacy_eeprom_band_7;
316 break; 316 break;
317 default: 317 default:
@@ -322,27 +322,27 @@ static void iwl_legacy_init_band_reference(const struct iwl_priv *priv,
322#define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \ 322#define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \
323 ? # x " " : "") 323 ? # x " " : "")
324/** 324/**
325 * iwl_legacy_mod_ht40_chan_info - Copy ht40 channel info into driver's priv. 325 * il_mod_ht40_chan_info - Copy ht40 channel info into driver's priv.
326 * 326 *
327 * Does not set up a command, or touch hardware. 327 * Does not set up a command, or touch hardware.
328 */ 328 */
329static int iwl_legacy_mod_ht40_chan_info(struct iwl_priv *priv, 329static int il_mod_ht40_chan_info(struct il_priv *priv,
330 enum ieee80211_band band, u16 channel, 330 enum ieee80211_band band, u16 channel,
331 const struct iwl_eeprom_channel *eeprom_ch, 331 const struct il_eeprom_channel *eeprom_ch,
332 u8 clear_ht40_extension_channel) 332 u8 clear_ht40_extension_channel)
333{ 333{
334 struct iwl_channel_info *ch_info; 334 struct il_channel_info *ch_info;
335 335
336 ch_info = (struct iwl_channel_info *) 336 ch_info = (struct il_channel_info *)
337 iwl_legacy_get_channel_info(priv, band, channel); 337 il_get_channel_info(priv, band, channel);
338 338
339 if (!iwl_legacy_is_channel_valid(ch_info)) 339 if (!il_is_channel_valid(ch_info))
340 return -1; 340 return -1;
341 341
342 IWL_DEBUG_EEPROM(priv, "HT40 Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):" 342 IL_DEBUG_EEPROM(priv, "HT40 Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):"
343 " Ad-Hoc %ssupported\n", 343 " Ad-Hoc %ssupported\n",
344 ch_info->channel, 344 ch_info->channel,
345 iwl_legacy_is_channel_a_band(ch_info) ? 345 il_is_channel_a_band(ch_info) ?
346 "5.2" : "2.4", 346 "5.2" : "2.4",
347 CHECK_AND_PRINT(IBSS), 347 CHECK_AND_PRINT(IBSS),
348 CHECK_AND_PRINT(ACTIVE), 348 CHECK_AND_PRINT(ACTIVE),
@@ -369,22 +369,22 @@ static int iwl_legacy_mod_ht40_chan_info(struct iwl_priv *priv,
369 ? # x " " : "") 369 ? # x " " : "")
370 370
371/** 371/**
372 * iwl_legacy_init_channel_map - Set up driver's info for all possible channels 372 * il_init_channel_map - Set up driver's info for all possible channels
373 */ 373 */
374int iwl_legacy_init_channel_map(struct iwl_priv *priv) 374int il_init_channel_map(struct il_priv *priv)
375{ 375{
376 int eeprom_ch_count = 0; 376 int eeprom_ch_count = 0;
377 const u8 *eeprom_ch_index = NULL; 377 const u8 *eeprom_ch_index = NULL;
378 const struct iwl_eeprom_channel *eeprom_ch_info = NULL; 378 const struct il_eeprom_channel *eeprom_ch_info = NULL;
379 int band, ch; 379 int band, ch;
380 struct iwl_channel_info *ch_info; 380 struct il_channel_info *ch_info;
381 381
382 if (priv->channel_count) { 382 if (priv->channel_count) {
383 IWL_DEBUG_EEPROM(priv, "Channel map already initialized.\n"); 383 IL_DEBUG_EEPROM(priv, "Channel map already initialized.\n");
384 return 0; 384 return 0;
385 } 385 }
386 386
387 IWL_DEBUG_EEPROM(priv, "Initializing regulatory info from EEPROM\n"); 387 IL_DEBUG_EEPROM(priv, "Initializing regulatory info from EEPROM\n");
388 388
389 priv->channel_count = 389 priv->channel_count =
390 ARRAY_SIZE(iwlegacy_eeprom_band_1) + 390 ARRAY_SIZE(iwlegacy_eeprom_band_1) +
@@ -393,13 +393,13 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv)
393 ARRAY_SIZE(iwlegacy_eeprom_band_4) + 393 ARRAY_SIZE(iwlegacy_eeprom_band_4) +
394 ARRAY_SIZE(iwlegacy_eeprom_band_5); 394 ARRAY_SIZE(iwlegacy_eeprom_band_5);
395 395
396 IWL_DEBUG_EEPROM(priv, "Parsing data for %d channels.\n", 396 IL_DEBUG_EEPROM(priv, "Parsing data for %d channels.\n",
397 priv->channel_count); 397 priv->channel_count);
398 398
399 priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) * 399 priv->channel_info = kzalloc(sizeof(struct il_channel_info) *
400 priv->channel_count, GFP_KERNEL); 400 priv->channel_count, GFP_KERNEL);
401 if (!priv->channel_info) { 401 if (!priv->channel_info) {
402 IWL_ERR(priv, "Could not allocate channel_info\n"); 402 IL_ERR(priv, "Could not allocate channel_info\n");
403 priv->channel_count = 0; 403 priv->channel_count = 0;
404 return -ENOMEM; 404 return -ENOMEM;
405 } 405 }
@@ -411,7 +411,7 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv)
411 * what just in the EEPROM) */ 411 * what just in the EEPROM) */
412 for (band = 1; band <= 5; band++) { 412 for (band = 1; band <= 5; band++) {
413 413
414 iwl_legacy_init_band_reference(priv, band, &eeprom_ch_count, 414 il_init_band_reference(priv, band, &eeprom_ch_count,
415 &eeprom_ch_info, &eeprom_ch_index); 415 &eeprom_ch_info, &eeprom_ch_index);
416 416
417 /* Loop through each band adding each of the channels */ 417 /* Loop through each band adding each of the channels */
@@ -432,13 +432,13 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv)
432 ch_info->ht40_extension_channel = 432 ch_info->ht40_extension_channel =
433 IEEE80211_CHAN_NO_HT40; 433 IEEE80211_CHAN_NO_HT40;
434 434
435 if (!(iwl_legacy_is_channel_valid(ch_info))) { 435 if (!(il_is_channel_valid(ch_info))) {
436 IWL_DEBUG_EEPROM(priv, 436 IL_DEBUG_EEPROM(priv,
437 "Ch. %d Flags %x [%sGHz] - " 437 "Ch. %d Flags %x [%sGHz] - "
438 "No traffic\n", 438 "No traffic\n",
439 ch_info->channel, 439 ch_info->channel,
440 ch_info->flags, 440 ch_info->flags,
441 iwl_legacy_is_channel_a_band(ch_info) ? 441 il_is_channel_a_band(ch_info) ?
442 "5.2" : "2.4"); 442 "5.2" : "2.4");
443 ch_info++; 443 ch_info++;
444 continue; 444 continue;
@@ -450,11 +450,11 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv)
450 ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; 450 ch_info->scan_power = eeprom_ch_info[ch].max_power_avg;
451 ch_info->min_power = 0; 451 ch_info->min_power = 0;
452 452
453 IWL_DEBUG_EEPROM(priv, "Ch. %d [%sGHz] " 453 IL_DEBUG_EEPROM(priv, "Ch. %d [%sGHz] "
454 "%s%s%s%s%s%s(0x%02x %ddBm):" 454 "%s%s%s%s%s%s(0x%02x %ddBm):"
455 " Ad-Hoc %ssupported\n", 455 " Ad-Hoc %ssupported\n",
456 ch_info->channel, 456 ch_info->channel,
457 iwl_legacy_is_channel_a_band(ch_info) ? 457 il_is_channel_a_band(ch_info) ?
458 "5.2" : "2.4", 458 "5.2" : "2.4",
459 CHECK_AND_PRINT_I(VALID), 459 CHECK_AND_PRINT_I(VALID),
460 CHECK_AND_PRINT_I(IBSS), 460 CHECK_AND_PRINT_I(IBSS),
@@ -485,7 +485,7 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv)
485 for (band = 6; band <= 7; band++) { 485 for (band = 6; band <= 7; band++) {
486 enum ieee80211_band ieeeband; 486 enum ieee80211_band ieeeband;
487 487
488 iwl_legacy_init_band_reference(priv, band, &eeprom_ch_count, 488 il_init_band_reference(priv, band, &eeprom_ch_count,
489 &eeprom_ch_info, &eeprom_ch_index); 489 &eeprom_ch_info, &eeprom_ch_index);
490 490
491 /* EEPROM band 6 is 2.4, band 7 is 5 GHz */ 491 /* EEPROM band 6 is 2.4, band 7 is 5 GHz */
@@ -495,13 +495,13 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv)
495 /* Loop through each band adding each of the channels */ 495 /* Loop through each band adding each of the channels */
496 for (ch = 0; ch < eeprom_ch_count; ch++) { 496 for (ch = 0; ch < eeprom_ch_count; ch++) {
497 /* Set up driver's info for lower half */ 497 /* Set up driver's info for lower half */
498 iwl_legacy_mod_ht40_chan_info(priv, ieeeband, 498 il_mod_ht40_chan_info(priv, ieeeband,
499 eeprom_ch_index[ch], 499 eeprom_ch_index[ch],
500 &eeprom_ch_info[ch], 500 &eeprom_ch_info[ch],
501 IEEE80211_CHAN_NO_HT40PLUS); 501 IEEE80211_CHAN_NO_HT40PLUS);
502 502
503 /* Set up driver's info for upper half */ 503 /* Set up driver's info for upper half */
504 iwl_legacy_mod_ht40_chan_info(priv, ieeeband, 504 il_mod_ht40_chan_info(priv, ieeeband,
505 eeprom_ch_index[ch] + 4, 505 eeprom_ch_index[ch] + 4,
506 &eeprom_ch_info[ch], 506 &eeprom_ch_info[ch],
507 IEEE80211_CHAN_NO_HT40MINUS); 507 IEEE80211_CHAN_NO_HT40MINUS);
@@ -510,25 +510,25 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv)
510 510
511 return 0; 511 return 0;
512} 512}
513EXPORT_SYMBOL(iwl_legacy_init_channel_map); 513EXPORT_SYMBOL(il_init_channel_map);
514 514
515/* 515/*
516 * iwl_legacy_free_channel_map - undo allocations in iwl_legacy_init_channel_map 516 * il_free_channel_map - undo allocations in il_init_channel_map
517 */ 517 */
518void iwl_legacy_free_channel_map(struct iwl_priv *priv) 518void il_free_channel_map(struct il_priv *priv)
519{ 519{
520 kfree(priv->channel_info); 520 kfree(priv->channel_info);
521 priv->channel_count = 0; 521 priv->channel_count = 0;
522} 522}
523EXPORT_SYMBOL(iwl_legacy_free_channel_map); 523EXPORT_SYMBOL(il_free_channel_map);
524 524
525/** 525/**
526 * iwl_legacy_get_channel_info - Find driver's private channel info 526 * il_get_channel_info - Find driver's private channel info
527 * 527 *
528 * Based on band and channel number. 528 * Based on band and channel number.
529 */ 529 */
530const struct 530const struct
531iwl_channel_info *iwl_legacy_get_channel_info(const struct iwl_priv *priv, 531il_channel_info *il_get_channel_info(const struct il_priv *priv,
532 enum ieee80211_band band, u16 channel) 532 enum ieee80211_band band, u16 channel)
533{ 533{
534 int i; 534 int i;
@@ -550,4 +550,4 @@ iwl_channel_info *iwl_legacy_get_channel_info(const struct iwl_priv *priv,
550 550
551 return NULL; 551 return NULL;
552} 552}
553EXPORT_SYMBOL(iwl_legacy_get_channel_info); 553EXPORT_SYMBOL(il_get_channel_info);
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.h b/drivers/net/wireless/iwlegacy/iwl-eeprom.h
index c59c81002022..9ad687161623 100644
--- a/drivers/net/wireless/iwlegacy/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.h
@@ -60,12 +60,12 @@
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *****************************************************************************/ 61 *****************************************************************************/
62 62
63#ifndef __iwl_legacy_eeprom_h__ 63#ifndef __il_eeprom_h__
64#define __iwl_legacy_eeprom_h__ 64#define __il_eeprom_h__
65 65
66#include <net/mac80211.h> 66#include <net/mac80211.h>
67 67
68struct iwl_priv; 68struct il_priv;
69 69
70/* 70/*
71 * EEPROM access time values: 71 * EEPROM access time values:
@@ -75,14 +75,14 @@ struct iwl_priv;
75 * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec. 75 * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec.
76 * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG. 76 * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG.
77 */ 77 */
78#define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ 78#define IL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */
79 79
80#define IWL_EEPROM_SEM_TIMEOUT 10 /* microseconds */ 80#define IL_EEPROM_SEM_TIMEOUT 10 /* microseconds */
81#define IWL_EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ 81#define IL_EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */
82 82
83 83
84/* 84/*
85 * Regulatory channel usage flags in EEPROM struct iwl4965_eeprom_channel.flags. 85 * Regulatory channel usage flags in EEPROM struct il4965_eeprom_channel.flags.
86 * 86 *
87 * IBSS and/or AP operation is allowed *only* on those channels with 87 * IBSS and/or AP operation is allowed *only* on those channels with
88 * (VALID && IBSS && ACTIVE && !RADAR). This restriction is in place because 88 * (VALID && IBSS && ACTIVE && !RADAR). This restriction is in place because
@@ -97,7 +97,7 @@ struct iwl_priv;
97 * 97 *
98 * NOTE: Using a channel inappropriately will result in a uCode error! 98 * NOTE: Using a channel inappropriately will result in a uCode error!
99 */ 99 */
100#define IWL_NUM_TX_CALIB_GROUPS 5 100#define IL_NUM_TX_CALIB_GROUPS 5
101enum { 101enum {
102 EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */ 102 EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */
103 EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */ 103 EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */
@@ -116,7 +116,7 @@ enum {
116 116
117/* *regulatory* channel data format in eeprom, one for each channel. 117/* *regulatory* channel data format in eeprom, one for each channel.
118 * There are separate entries for HT40 (40 MHz) vs. normal (20 MHz) channels. */ 118 * There are separate entries for HT40 (40 MHz) vs. normal (20 MHz) channels. */
119struct iwl_eeprom_channel { 119struct il_eeprom_channel {
120 u8 flags; /* EEPROM_CHANNEL_* flags copied from EEPROM */ 120 u8 flags; /* EEPROM_CHANNEL_* flags copied from EEPROM */
121 s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ 121 s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
122} __packed; 122} __packed;
@@ -160,7 +160,7 @@ extern const u8 iwlegacy_eeprom_band_1[14];
160 * 160 *
161 * 4) RF power amplifier detector level measurement (not used). 161 * 4) RF power amplifier detector level measurement (not used).
162 */ 162 */
163struct iwl_eeprom_calib_measure { 163struct il_eeprom_calib_measure {
164 u8 temperature; /* Device temperature (Celsius) */ 164 u8 temperature; /* Device temperature (Celsius) */
165 u8 gain_idx; /* Index into gain table */ 165 u8 gain_idx; /* Index into gain table */
166 u8 actual_pow; /* Measured RF output power, half-dBm */ 166 u8 actual_pow; /* Measured RF output power, half-dBm */
@@ -176,9 +176,9 @@ struct iwl_eeprom_calib_measure {
176 * 2) Measurements for each of 3 power levels for each of 2 radio transmitters 176 * 2) Measurements for each of 3 power levels for each of 2 radio transmitters
177 * (a.k.a. "tx chains") (6 measurements altogether) 177 * (a.k.a. "tx chains") (6 measurements altogether)
178 */ 178 */
179struct iwl_eeprom_calib_ch_info { 179struct il_eeprom_calib_ch_info {
180 u8 ch_num; 180 u8 ch_num;
181 struct iwl_eeprom_calib_measure 181 struct il_eeprom_calib_measure
182 measurements[EEPROM_TX_POWER_TX_CHAINS] 182 measurements[EEPROM_TX_POWER_TX_CHAINS]
183 [EEPROM_TX_POWER_MEASUREMENTS]; 183 [EEPROM_TX_POWER_MEASUREMENTS];
184} __packed; 184} __packed;
@@ -193,11 +193,11 @@ struct iwl_eeprom_calib_ch_info {
193 * 193 *
194 * 2) Sample measurement sets for 2 channels close to the range endpoints. 194 * 2) Sample measurement sets for 2 channels close to the range endpoints.
195 */ 195 */
196struct iwl_eeprom_calib_subband_info { 196struct il_eeprom_calib_subband_info {
197 u8 ch_from; /* channel number of lowest channel in subband */ 197 u8 ch_from; /* channel number of lowest channel in subband */
198 u8 ch_to; /* channel number of highest channel in subband */ 198 u8 ch_to; /* channel number of highest channel in subband */
199 struct iwl_eeprom_calib_ch_info ch1; 199 struct il_eeprom_calib_ch_info ch1;
200 struct iwl_eeprom_calib_ch_info ch2; 200 struct il_eeprom_calib_ch_info ch2;
201} __packed; 201} __packed;
202 202
203 203
@@ -218,14 +218,14 @@ struct iwl_eeprom_calib_subband_info {
218 * characteristics of the analog radio circuitry vary with frequency. 218 * characteristics of the analog radio circuitry vary with frequency.
219 * 219 *
220 * Not all sets need to be filled with data; 220 * Not all sets need to be filled with data;
221 * struct iwl_eeprom_calib_subband_info contains range of channels 221 * struct il_eeprom_calib_subband_info contains range of channels
222 * (0 if unused) for each set of data. 222 * (0 if unused) for each set of data.
223 */ 223 */
224struct iwl_eeprom_calib_info { 224struct il_eeprom_calib_info {
225 u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ 225 u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */
226 u8 saturation_power52; /* half-dBm */ 226 u8 saturation_power52; /* half-dBm */
227 __le16 voltage; /* signed */ 227 __le16 voltage; /* signed */
228 struct iwl_eeprom_calib_subband_info 228 struct il_eeprom_calib_subband_info
229 band_info[EEPROM_TX_POWER_BANDS]; 229 band_info[EEPROM_TX_POWER_BANDS];
230} __packed; 230} __packed;
231 231
@@ -323,22 +323,22 @@ struct iwl_eeprom_calib_info {
323 323
324#define EEPROM_REGULATORY_BAND_NO_HT40 (0) 324#define EEPROM_REGULATORY_BAND_NO_HT40 (0)
325 325
326struct iwl_eeprom_ops { 326struct il_eeprom_ops {
327 const u32 regulatory_bands[7]; 327 const u32 regulatory_bands[7];
328 int (*acquire_semaphore) (struct iwl_priv *priv); 328 int (*acquire_semaphore) (struct il_priv *priv);
329 void (*release_semaphore) (struct iwl_priv *priv); 329 void (*release_semaphore) (struct il_priv *priv);
330}; 330};
331 331
332 332
333int iwl_legacy_eeprom_init(struct iwl_priv *priv); 333int il_eeprom_init(struct il_priv *priv);
334void iwl_legacy_eeprom_free(struct iwl_priv *priv); 334void il_eeprom_free(struct il_priv *priv);
335const u8 *iwl_legacy_eeprom_query_addr(const struct iwl_priv *priv, 335const u8 *il_eeprom_query_addr(const struct il_priv *priv,
336 size_t offset); 336 size_t offset);
337u16 iwl_legacy_eeprom_query16(const struct iwl_priv *priv, size_t offset); 337u16 il_eeprom_query16(const struct il_priv *priv, size_t offset);
338int iwl_legacy_init_channel_map(struct iwl_priv *priv); 338int il_init_channel_map(struct il_priv *priv);
339void iwl_legacy_free_channel_map(struct iwl_priv *priv); 339void il_free_channel_map(struct il_priv *priv);
340const struct iwl_channel_info *iwl_legacy_get_channel_info( 340const struct il_channel_info *il_get_channel_info(
341 const struct iwl_priv *priv, 341 const struct il_priv *priv,
342 enum ieee80211_band band, u16 channel); 342 enum ieee80211_band band, u16 channel);
343 343
344#endif /* __iwl_legacy_eeprom_h__ */ 344#endif /* __il_eeprom_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-fh.h b/drivers/net/wireless/iwlegacy/iwl-fh.h
index 6e6091816e36..0ae36df1c293 100644
--- a/drivers/net/wireless/iwlegacy/iwl-fh.h
+++ b/drivers/net/wireless/iwlegacy/iwl-fh.h
@@ -60,8 +60,8 @@
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 * 61 *
62 *****************************************************************************/ 62 *****************************************************************************/
63#ifndef __iwl_legacy_fh_h__ 63#ifndef __il_fh_h__
64#define __iwl_legacy_fh_h__ 64#define __il_fh_h__
65 65
66/****************************/ 66/****************************/
67/* Flow Handler Definitions */ 67/* Flow Handler Definitions */
@@ -99,7 +99,7 @@
99 * 99 *
100 * 4965 has 16 base pointer registers, one for each of 16 host-DRAM-resident 100 * 4965 has 16 base pointer registers, one for each of 16 host-DRAM-resident
101 * circular buffers (CBs/queues) containing Transmit Frame Descriptors (TFDs) 101 * circular buffers (CBs/queues) containing Transmit Frame Descriptors (TFDs)
102 * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 102 * (see struct il_tfd_frame). These 16 pointer registers are offset by 0x04
103 * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte 103 * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte
104 * aligned (address bits 0-7 must be 0). 104 * aligned (address bits 0-7 must be 0).
105 * 105 *
@@ -146,7 +146,7 @@
146 * physical address [35:4] into FH_RSCSR_CHNL0_STTS_WPTR_REG [31:0]. 146 * physical address [35:4] into FH_RSCSR_CHNL0_STTS_WPTR_REG [31:0].
147 * 147 *
148 * Bit fields in lower dword of Rx status buffer (upper dword not used 148 * Bit fields in lower dword of Rx status buffer (upper dword not used
149 * by driver; see struct iwl4965_shared, val0): 149 * by driver; see struct il4965_shared, val0):
150 * 31-12: Not used by driver 150 * 31-12: Not used by driver
151 * 11- 0: Index of last filled Rx buffer descriptor 151 * 11- 0: Index of last filled Rx buffer descriptor
152 * (4965 writes, driver reads this value) 152 * (4965 writes, driver reads this value)
@@ -424,12 +424,12 @@
424#define RX_LOW_WATERMARK 8 424#define RX_LOW_WATERMARK 8
425 425
426/* Size of one Rx buffer in host DRAM */ 426/* Size of one Rx buffer in host DRAM */
427#define IWL_RX_BUF_SIZE_3K (3 * 1000) /* 3945 only */ 427#define IL_RX_BUF_SIZE_3K (3 * 1000) /* 3945 only */
428#define IWL_RX_BUF_SIZE_4K (4 * 1024) 428#define IL_RX_BUF_SIZE_4K (4 * 1024)
429#define IWL_RX_BUF_SIZE_8K (8 * 1024) 429#define IL_RX_BUF_SIZE_8K (8 * 1024)
430 430
431/** 431/**
432 * struct iwl_rb_status - reseve buffer status 432 * struct il_rb_status - reseve buffer status
433 * host memory mapped FH registers 433 * host memory mapped FH registers
434 * @closed_rb_num [0:11] - Indicates the index of the RB which was closed 434 * @closed_rb_num [0:11] - Indicates the index of the RB which was closed
435 * @closed_fr_num [0:11] - Indicates the index of the RX Frame which was closed 435 * @closed_fr_num [0:11] - Indicates the index of the RX Frame which was closed
@@ -438,7 +438,7 @@
438 * @finished_fr_num [0:11] - Indicates the index of the RX Frame 438 * @finished_fr_num [0:11] - Indicates the index of the RX Frame
439 * which was transferred 439 * which was transferred
440 */ 440 */
441struct iwl_rb_status { 441struct il_rb_status {
442 __le16 closed_rb_num; 442 __le16 closed_rb_num;
443 __le16 closed_fr_num; 443 __le16 closed_fr_num;
444 __le16 finished_rb_num; 444 __le16 finished_rb_num;
@@ -450,15 +450,15 @@ struct iwl_rb_status {
450#define TFD_QUEUE_SIZE_MAX (256) 450#define TFD_QUEUE_SIZE_MAX (256)
451#define TFD_QUEUE_SIZE_BC_DUP (64) 451#define TFD_QUEUE_SIZE_BC_DUP (64)
452#define TFD_QUEUE_BC_SIZE (TFD_QUEUE_SIZE_MAX + TFD_QUEUE_SIZE_BC_DUP) 452#define TFD_QUEUE_BC_SIZE (TFD_QUEUE_SIZE_MAX + TFD_QUEUE_SIZE_BC_DUP)
453#define IWL_TX_DMA_MASK DMA_BIT_MASK(36) 453#define IL_TX_DMA_MASK DMA_BIT_MASK(36)
454#define IWL_NUM_OF_TBS 20 454#define IL_NUM_OF_TBS 20
455 455
456static inline u8 iwl_legacy_get_dma_hi_addr(dma_addr_t addr) 456static inline u8 il_get_dma_hi_addr(dma_addr_t addr)
457{ 457{
458 return (sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0) & 0xF; 458 return (sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0) & 0xF;
459} 459}
460/** 460/**
461 * struct iwl_tfd_tb transmit buffer descriptor within transmit frame descriptor 461 * struct il_tfd_tb transmit buffer descriptor within transmit frame descriptor
462 * 462 *
463 * This structure contains dma address and length of transmission address 463 * This structure contains dma address and length of transmission address
464 * 464 *
@@ -467,13 +467,13 @@ static inline u8 iwl_legacy_get_dma_hi_addr(dma_addr_t addr)
467 * @hi_n_len 0-3 [35:32] portion of dma 467 * @hi_n_len 0-3 [35:32] portion of dma
468 * 4-15 length of the tx buffer 468 * 4-15 length of the tx buffer
469 */ 469 */
470struct iwl_tfd_tb { 470struct il_tfd_tb {
471 __le32 lo; 471 __le32 lo;
472 __le16 hi_n_len; 472 __le16 hi_n_len;
473} __packed; 473} __packed;
474 474
475/** 475/**
476 * struct iwl_tfd 476 * struct il_tfd
477 * 477 *
478 * Transmit Frame Descriptor (TFD) 478 * Transmit Frame Descriptor (TFD)
479 * 479 *
@@ -500,14 +500,14 @@ struct iwl_tfd_tb {
500 * 500 *
501 * A maximum of 255 (not 256!) TFDs may be on a queue waiting for Tx. 501 * A maximum of 255 (not 256!) TFDs may be on a queue waiting for Tx.
502 */ 502 */
503struct iwl_tfd { 503struct il_tfd {
504 u8 __reserved1[3]; 504 u8 __reserved1[3];
505 u8 num_tbs; 505 u8 num_tbs;
506 struct iwl_tfd_tb tbs[IWL_NUM_OF_TBS]; 506 struct il_tfd_tb tbs[IL_NUM_OF_TBS];
507 __le32 __pad; 507 __le32 __pad;
508} __packed; 508} __packed;
509 509
510/* Keep Warm Size */ 510/* Keep Warm Size */
511#define IWL_KW_SIZE 0x1000 /* 4k */ 511#define IL_KW_SIZE 0x1000 /* 4k */
512 512
513#endif /* !__iwl_legacy_fh_h__ */ 513#endif /* !__il_fh_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-hcmd.c b/drivers/net/wireless/iwlegacy/iwl-hcmd.c
index ce1fc9feb61f..515befc28001 100644
--- a/drivers/net/wireless/iwlegacy/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlegacy/iwl-hcmd.c
@@ -37,66 +37,66 @@
37#include "iwl-core.h" 37#include "iwl-core.h"
38 38
39 39
40const char *iwl_legacy_get_cmd_string(u8 cmd) 40const char *il_get_cmd_string(u8 cmd)
41{ 41{
42 switch (cmd) { 42 switch (cmd) {
43 IWL_CMD(REPLY_ALIVE); 43 IL_CMD(REPLY_ALIVE);
44 IWL_CMD(REPLY_ERROR); 44 IL_CMD(REPLY_ERROR);
45 IWL_CMD(REPLY_RXON); 45 IL_CMD(REPLY_RXON);
46 IWL_CMD(REPLY_RXON_ASSOC); 46 IL_CMD(REPLY_RXON_ASSOC);
47 IWL_CMD(REPLY_QOS_PARAM); 47 IL_CMD(REPLY_QOS_PARAM);
48 IWL_CMD(REPLY_RXON_TIMING); 48 IL_CMD(REPLY_RXON_TIMING);
49 IWL_CMD(REPLY_ADD_STA); 49 IL_CMD(REPLY_ADD_STA);
50 IWL_CMD(REPLY_REMOVE_STA); 50 IL_CMD(REPLY_REMOVE_STA);
51 IWL_CMD(REPLY_WEPKEY); 51 IL_CMD(REPLY_WEPKEY);
52 IWL_CMD(REPLY_3945_RX); 52 IL_CMD(REPLY_3945_RX);
53 IWL_CMD(REPLY_TX); 53 IL_CMD(REPLY_TX);
54 IWL_CMD(REPLY_RATE_SCALE); 54 IL_CMD(REPLY_RATE_SCALE);
55 IWL_CMD(REPLY_LEDS_CMD); 55 IL_CMD(REPLY_LEDS_CMD);
56 IWL_CMD(REPLY_TX_LINK_QUALITY_CMD); 56 IL_CMD(REPLY_TX_LINK_QUALITY_CMD);
57 IWL_CMD(REPLY_CHANNEL_SWITCH); 57 IL_CMD(REPLY_CHANNEL_SWITCH);
58 IWL_CMD(CHANNEL_SWITCH_NOTIFICATION); 58 IL_CMD(CHANNEL_SWITCH_NOTIFICATION);
59 IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD); 59 IL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD);
60 IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION); 60 IL_CMD(SPECTRUM_MEASURE_NOTIFICATION);
61 IWL_CMD(POWER_TABLE_CMD); 61 IL_CMD(POWER_TABLE_CMD);
62 IWL_CMD(PM_SLEEP_NOTIFICATION); 62 IL_CMD(PM_SLEEP_NOTIFICATION);
63 IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC); 63 IL_CMD(PM_DEBUG_STATISTIC_NOTIFIC);
64 IWL_CMD(REPLY_SCAN_CMD); 64 IL_CMD(REPLY_SCAN_CMD);
65 IWL_CMD(REPLY_SCAN_ABORT_CMD); 65 IL_CMD(REPLY_SCAN_ABORT_CMD);
66 IWL_CMD(SCAN_START_NOTIFICATION); 66 IL_CMD(SCAN_START_NOTIFICATION);
67 IWL_CMD(SCAN_RESULTS_NOTIFICATION); 67 IL_CMD(SCAN_RESULTS_NOTIFICATION);
68 IWL_CMD(SCAN_COMPLETE_NOTIFICATION); 68 IL_CMD(SCAN_COMPLETE_NOTIFICATION);
69 IWL_CMD(BEACON_NOTIFICATION); 69 IL_CMD(BEACON_NOTIFICATION);
70 IWL_CMD(REPLY_TX_BEACON); 70 IL_CMD(REPLY_TX_BEACON);
71 IWL_CMD(REPLY_TX_PWR_TABLE_CMD); 71 IL_CMD(REPLY_TX_PWR_TABLE_CMD);
72 IWL_CMD(REPLY_BT_CONFIG); 72 IL_CMD(REPLY_BT_CONFIG);
73 IWL_CMD(REPLY_STATISTICS_CMD); 73 IL_CMD(REPLY_STATISTICS_CMD);
74 IWL_CMD(STATISTICS_NOTIFICATION); 74 IL_CMD(STATISTICS_NOTIFICATION);
75 IWL_CMD(CARD_STATE_NOTIFICATION); 75 IL_CMD(CARD_STATE_NOTIFICATION);
76 IWL_CMD(MISSED_BEACONS_NOTIFICATION); 76 IL_CMD(MISSED_BEACONS_NOTIFICATION);
77 IWL_CMD(REPLY_CT_KILL_CONFIG_CMD); 77 IL_CMD(REPLY_CT_KILL_CONFIG_CMD);
78 IWL_CMD(SENSITIVITY_CMD); 78 IL_CMD(SENSITIVITY_CMD);
79 IWL_CMD(REPLY_PHY_CALIBRATION_CMD); 79 IL_CMD(REPLY_PHY_CALIBRATION_CMD);
80 IWL_CMD(REPLY_RX_PHY_CMD); 80 IL_CMD(REPLY_RX_PHY_CMD);
81 IWL_CMD(REPLY_RX_MPDU_CMD); 81 IL_CMD(REPLY_RX_MPDU_CMD);
82 IWL_CMD(REPLY_RX); 82 IL_CMD(REPLY_RX);
83 IWL_CMD(REPLY_COMPRESSED_BA); 83 IL_CMD(REPLY_COMPRESSED_BA);
84 default: 84 default:
85 return "UNKNOWN"; 85 return "UNKNOWN";
86 86
87 } 87 }
88} 88}
89EXPORT_SYMBOL(iwl_legacy_get_cmd_string); 89EXPORT_SYMBOL(il_get_cmd_string);
90 90
91#define HOST_COMPLETE_TIMEOUT (HZ / 2) 91#define HOST_COMPLETE_TIMEOUT (HZ / 2)
92 92
93static void iwl_legacy_generic_cmd_callback(struct iwl_priv *priv, 93static void il_generic_cmd_callback(struct il_priv *priv,
94 struct iwl_device_cmd *cmd, 94 struct il_device_cmd *cmd,
95 struct iwl_rx_packet *pkt) 95 struct il_rx_packet *pkt)
96{ 96{
97 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { 97 if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
98 IWL_ERR(priv, "Bad return from %s (0x%08X)\n", 98 IL_ERR(priv, "Bad return from %s (0x%08X)\n",
99 iwl_legacy_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 99 il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
100 return; 100 return;
101 } 101 }
102 102
@@ -104,18 +104,18 @@ static void iwl_legacy_generic_cmd_callback(struct iwl_priv *priv,
104 switch (cmd->hdr.cmd) { 104 switch (cmd->hdr.cmd) {
105 case REPLY_TX_LINK_QUALITY_CMD: 105 case REPLY_TX_LINK_QUALITY_CMD:
106 case SENSITIVITY_CMD: 106 case SENSITIVITY_CMD:
107 IWL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n", 107 IL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n",
108 iwl_legacy_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 108 il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
109 break; 109 break;
110 default: 110 default:
111 IWL_DEBUG_HC(priv, "back from %s (0x%08X)\n", 111 IL_DEBUG_HC(priv, "back from %s (0x%08X)\n",
112 iwl_legacy_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 112 il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
113 } 113 }
114#endif 114#endif
115} 115}
116 116
117static int 117static int
118iwl_legacy_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 118il_send_cmd_async(struct il_priv *priv, struct il_host_cmd *cmd)
119{ 119{
120 int ret; 120 int ret;
121 121
@@ -126,21 +126,21 @@ iwl_legacy_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
126 126
127 /* Assign a generic callback if one is not provided */ 127 /* Assign a generic callback if one is not provided */
128 if (!cmd->callback) 128 if (!cmd->callback)
129 cmd->callback = iwl_legacy_generic_cmd_callback; 129 cmd->callback = il_generic_cmd_callback;
130 130
131 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 131 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
132 return -EBUSY; 132 return -EBUSY;
133 133
134 ret = iwl_legacy_enqueue_hcmd(priv, cmd); 134 ret = il_enqueue_hcmd(priv, cmd);
135 if (ret < 0) { 135 if (ret < 0) {
136 IWL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n", 136 IL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n",
137 iwl_legacy_get_cmd_string(cmd->id), ret); 137 il_get_cmd_string(cmd->id), ret);
138 return ret; 138 return ret;
139 } 139 }
140 return 0; 140 return 0;
141} 141}
142 142
143int iwl_legacy_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 143int il_send_cmd_sync(struct il_priv *priv, struct il_host_cmd *cmd)
144{ 144{
145 int cmd_idx; 145 int cmd_idx;
146 int ret; 146 int ret;
@@ -152,18 +152,18 @@ int iwl_legacy_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
152 /* A synchronous command can not have a callback set. */ 152 /* A synchronous command can not have a callback set. */
153 BUG_ON(cmd->callback); 153 BUG_ON(cmd->callback);
154 154
155 IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n", 155 IL_DEBUG_INFO(priv, "Attempting to send sync command %s\n",
156 iwl_legacy_get_cmd_string(cmd->id)); 156 il_get_cmd_string(cmd->id));
157 157
158 set_bit(STATUS_HCMD_ACTIVE, &priv->status); 158 set_bit(STATUS_HCMD_ACTIVE, &priv->status);
159 IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n", 159 IL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n",
160 iwl_legacy_get_cmd_string(cmd->id)); 160 il_get_cmd_string(cmd->id));
161 161
162 cmd_idx = iwl_legacy_enqueue_hcmd(priv, cmd); 162 cmd_idx = il_enqueue_hcmd(priv, cmd);
163 if (cmd_idx < 0) { 163 if (cmd_idx < 0) {
164 ret = cmd_idx; 164 ret = cmd_idx;
165 IWL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n", 165 IL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n",
166 iwl_legacy_get_cmd_string(cmd->id), ret); 166 il_get_cmd_string(cmd->id), ret);
167 goto out; 167 goto out;
168 } 168 }
169 169
@@ -172,35 +172,35 @@ int iwl_legacy_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
172 HOST_COMPLETE_TIMEOUT); 172 HOST_COMPLETE_TIMEOUT);
173 if (!ret) { 173 if (!ret) {
174 if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) { 174 if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) {
175 IWL_ERR(priv, 175 IL_ERR(priv,
176 "Error sending %s: time out after %dms.\n", 176 "Error sending %s: time out after %dms.\n",
177 iwl_legacy_get_cmd_string(cmd->id), 177 il_get_cmd_string(cmd->id),
178 jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); 178 jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
179 179
180 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 180 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
181 IWL_DEBUG_INFO(priv, 181 IL_DEBUG_INFO(priv,
182 "Clearing HCMD_ACTIVE for command %s\n", 182 "Clearing HCMD_ACTIVE for command %s\n",
183 iwl_legacy_get_cmd_string(cmd->id)); 183 il_get_cmd_string(cmd->id));
184 ret = -ETIMEDOUT; 184 ret = -ETIMEDOUT;
185 goto cancel; 185 goto cancel;
186 } 186 }
187 } 187 }
188 188
189 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { 189 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
190 IWL_ERR(priv, "Command %s aborted: RF KILL Switch\n", 190 IL_ERR(priv, "Command %s aborted: RF KILL Switch\n",
191 iwl_legacy_get_cmd_string(cmd->id)); 191 il_get_cmd_string(cmd->id));
192 ret = -ECANCELED; 192 ret = -ECANCELED;
193 goto fail; 193 goto fail;
194 } 194 }
195 if (test_bit(STATUS_FW_ERROR, &priv->status)) { 195 if (test_bit(STATUS_FW_ERROR, &priv->status)) {
196 IWL_ERR(priv, "Command %s failed: FW Error\n", 196 IL_ERR(priv, "Command %s failed: FW Error\n",
197 iwl_legacy_get_cmd_string(cmd->id)); 197 il_get_cmd_string(cmd->id));
198 ret = -EIO; 198 ret = -EIO;
199 goto fail; 199 goto fail;
200 } 200 }
201 if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) { 201 if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) {
202 IWL_ERR(priv, "Error: Response NULL in '%s'\n", 202 IL_ERR(priv, "Error: Response NULL in '%s'\n",
203 iwl_legacy_get_cmd_string(cmd->id)); 203 il_get_cmd_string(cmd->id));
204 ret = -EIO; 204 ret = -EIO;
205 goto cancel; 205 goto cancel;
206 } 206 }
@@ -221,43 +221,43 @@ cancel:
221 } 221 }
222fail: 222fail:
223 if (cmd->reply_page) { 223 if (cmd->reply_page) {
224 iwl_legacy_free_pages(priv, cmd->reply_page); 224 il_free_pages(priv, cmd->reply_page);
225 cmd->reply_page = 0; 225 cmd->reply_page = 0;
226 } 226 }
227out: 227out:
228 return ret; 228 return ret;
229} 229}
230EXPORT_SYMBOL(iwl_legacy_send_cmd_sync); 230EXPORT_SYMBOL(il_send_cmd_sync);
231 231
232int iwl_legacy_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 232int il_send_cmd(struct il_priv *priv, struct il_host_cmd *cmd)
233{ 233{
234 if (cmd->flags & CMD_ASYNC) 234 if (cmd->flags & CMD_ASYNC)
235 return iwl_legacy_send_cmd_async(priv, cmd); 235 return il_send_cmd_async(priv, cmd);
236 236
237 return iwl_legacy_send_cmd_sync(priv, cmd); 237 return il_send_cmd_sync(priv, cmd);
238} 238}
239EXPORT_SYMBOL(iwl_legacy_send_cmd); 239EXPORT_SYMBOL(il_send_cmd);
240 240
241int 241int
242iwl_legacy_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data) 242il_send_cmd_pdu(struct il_priv *priv, u8 id, u16 len, const void *data)
243{ 243{
244 struct iwl_host_cmd cmd = { 244 struct il_host_cmd cmd = {
245 .id = id, 245 .id = id,
246 .len = len, 246 .len = len,
247 .data = data, 247 .data = data,
248 }; 248 };
249 249
250 return iwl_legacy_send_cmd_sync(priv, &cmd); 250 return il_send_cmd_sync(priv, &cmd);
251} 251}
252EXPORT_SYMBOL(iwl_legacy_send_cmd_pdu); 252EXPORT_SYMBOL(il_send_cmd_pdu);
253 253
254int iwl_legacy_send_cmd_pdu_async(struct iwl_priv *priv, 254int il_send_cmd_pdu_async(struct il_priv *priv,
255 u8 id, u16 len, const void *data, 255 u8 id, u16 len, const void *data,
256 void (*callback)(struct iwl_priv *priv, 256 void (*callback)(struct il_priv *priv,
257 struct iwl_device_cmd *cmd, 257 struct il_device_cmd *cmd,
258 struct iwl_rx_packet *pkt)) 258 struct il_rx_packet *pkt))
259{ 259{
260 struct iwl_host_cmd cmd = { 260 struct il_host_cmd cmd = {
261 .id = id, 261 .id = id,
262 .len = len, 262 .len = len,
263 .data = data, 263 .data = data,
@@ -266,6 +266,6 @@ int iwl_legacy_send_cmd_pdu_async(struct iwl_priv *priv,
266 cmd.flags |= CMD_ASYNC; 266 cmd.flags |= CMD_ASYNC;
267 cmd.callback = callback; 267 cmd.callback = callback;
268 268
269 return iwl_legacy_send_cmd_async(priv, &cmd); 269 return il_send_cmd_async(priv, &cmd);
270} 270}
271EXPORT_SYMBOL(iwl_legacy_send_cmd_pdu_async); 271EXPORT_SYMBOL(il_send_cmd_pdu_async);
diff --git a/drivers/net/wireless/iwlegacy/iwl-helpers.h b/drivers/net/wireless/iwlegacy/iwl-helpers.h
index 5cf23eaecbbb..e4e63b570f57 100644
--- a/drivers/net/wireless/iwlegacy/iwl-helpers.h
+++ b/drivers/net/wireless/iwlegacy/iwl-helpers.h
@@ -27,45 +27,45 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#ifndef __iwl_legacy_helpers_h__ 30#ifndef __il_helpers_h__
31#define __iwl_legacy_helpers_h__ 31#define __il_helpers_h__
32 32
33#include <linux/ctype.h> 33#include <linux/ctype.h>
34#include <net/mac80211.h> 34#include <net/mac80211.h>
35 35
36#include "iwl-io.h" 36#include "iwl-io.h"
37 37
38#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) 38#define IL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
39 39
40 40
41static inline struct ieee80211_conf *iwl_legacy_ieee80211_get_hw_conf( 41static inline struct ieee80211_conf *il_ieee80211_get_hw_conf(
42 struct ieee80211_hw *hw) 42 struct ieee80211_hw *hw)
43{ 43{
44 return &hw->conf; 44 return &hw->conf;
45} 45}
46 46
47/** 47/**
48 * iwl_legacy_queue_inc_wrap - increment queue index, wrap back to beginning 48 * il_queue_inc_wrap - increment queue index, wrap back to beginning
49 * @index -- current index 49 * @index -- current index
50 * @n_bd -- total number of entries in queue (must be power of 2) 50 * @n_bd -- total number of entries in queue (must be power of 2)
51 */ 51 */
52static inline int iwl_legacy_queue_inc_wrap(int index, int n_bd) 52static inline int il_queue_inc_wrap(int index, int n_bd)
53{ 53{
54 return ++index & (n_bd - 1); 54 return ++index & (n_bd - 1);
55} 55}
56 56
57/** 57/**
58 * iwl_legacy_queue_dec_wrap - decrement queue index, wrap back to end 58 * il_queue_dec_wrap - decrement queue index, wrap back to end
59 * @index -- current index 59 * @index -- current index
60 * @n_bd -- total number of entries in queue (must be power of 2) 60 * @n_bd -- total number of entries in queue (must be power of 2)
61 */ 61 */
62static inline int iwl_legacy_queue_dec_wrap(int index, int n_bd) 62static inline int il_queue_dec_wrap(int index, int n_bd)
63{ 63{
64 return --index & (n_bd - 1); 64 return --index & (n_bd - 1);
65} 65}
66 66
67/* TODO: Move fw_desc functions to iwl-pci.ko */ 67/* TODO: Move fw_desc functions to iwl-pci.ko */
68static inline void iwl_legacy_free_fw_desc(struct pci_dev *pci_dev, 68static inline void il_free_fw_desc(struct pci_dev *pci_dev,
69 struct fw_desc *desc) 69 struct fw_desc *desc)
70{ 70{
71 if (desc->v_addr) 71 if (desc->v_addr)
@@ -75,7 +75,7 @@ static inline void iwl_legacy_free_fw_desc(struct pci_dev *pci_dev,
75 desc->len = 0; 75 desc->len = 0;
76} 76}
77 77
78static inline int iwl_legacy_alloc_fw_desc(struct pci_dev *pci_dev, 78static inline int il_alloc_fw_desc(struct pci_dev *pci_dev,
79 struct fw_desc *desc) 79 struct fw_desc *desc)
80{ 80{
81 if (!desc->len) { 81 if (!desc->len) {
@@ -100,7 +100,7 @@ static inline int iwl_legacy_alloc_fw_desc(struct pci_dev *pci_dev,
100 * +---------------------- unused 100 * +---------------------- unused
101 */ 101 */
102static inline void 102static inline void
103iwl_legacy_set_swq_id(struct iwl_tx_queue *txq, u8 ac, u8 hwq) 103il_set_swq_id(struct il_tx_queue *txq, u8 ac, u8 hwq)
104{ 104{
105 BUG_ON(ac > 3); /* only have 2 bits */ 105 BUG_ON(ac > 3); /* only have 2 bits */
106 BUG_ON(hwq > 31); /* only use 5 bits */ 106 BUG_ON(hwq > 31); /* only use 5 bits */
@@ -108,8 +108,8 @@ iwl_legacy_set_swq_id(struct iwl_tx_queue *txq, u8 ac, u8 hwq)
108 txq->swq_id = (hwq << 2) | ac; 108 txq->swq_id = (hwq << 2) | ac;
109} 109}
110 110
111static inline void iwl_legacy_wake_queue(struct iwl_priv *priv, 111static inline void il_wake_queue(struct il_priv *priv,
112 struct iwl_tx_queue *txq) 112 struct il_tx_queue *txq)
113{ 113{
114 u8 queue = txq->swq_id; 114 u8 queue = txq->swq_id;
115 u8 ac = queue & 3; 115 u8 ac = queue & 3;
@@ -120,8 +120,8 @@ static inline void iwl_legacy_wake_queue(struct iwl_priv *priv,
120 ieee80211_wake_queue(priv->hw, ac); 120 ieee80211_wake_queue(priv->hw, ac);
121} 121}
122 122
123static inline void iwl_legacy_stop_queue(struct iwl_priv *priv, 123static inline void il_stop_queue(struct il_priv *priv,
124 struct iwl_tx_queue *txq) 124 struct il_tx_queue *txq)
125{ 125{
126 u8 queue = txq->swq_id; 126 u8 queue = txq->swq_id;
127 u8 ac = queue & 3; 127 u8 ac = queue & 3;
@@ -144,53 +144,53 @@ static inline void iwl_legacy_stop_queue(struct iwl_priv *priv,
144 144
145#define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue 145#define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue
146 146
147static inline void iwl_legacy_disable_interrupts(struct iwl_priv *priv) 147static inline void il_disable_interrupts(struct il_priv *priv)
148{ 148{
149 clear_bit(STATUS_INT_ENABLED, &priv->status); 149 clear_bit(STATUS_INT_ENABLED, &priv->status);
150 150
151 /* disable interrupts from uCode/NIC to host */ 151 /* disable interrupts from uCode/NIC to host */
152 iwl_write32(priv, CSR_INT_MASK, 0x00000000); 152 il_write32(priv, CSR_INT_MASK, 0x00000000);
153 153
154 /* acknowledge/clear/reset any interrupts still pending 154 /* acknowledge/clear/reset any interrupts still pending
155 * from uCode or flow handler (Rx/Tx DMA) */ 155 * from uCode or flow handler (Rx/Tx DMA) */
156 iwl_write32(priv, CSR_INT, 0xffffffff); 156 il_write32(priv, CSR_INT, 0xffffffff);
157 iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); 157 il_write32(priv, CSR_FH_INT_STATUS, 0xffffffff);
158 IWL_DEBUG_ISR(priv, "Disabled interrupts\n"); 158 IL_DEBUG_ISR(priv, "Disabled interrupts\n");
159} 159}
160 160
161static inline void iwl_legacy_enable_rfkill_int(struct iwl_priv *priv) 161static inline void il_enable_rfkill_int(struct il_priv *priv)
162{ 162{
163 IWL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n"); 163 IL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n");
164 iwl_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL); 164 il_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
165} 165}
166 166
167static inline void iwl_legacy_enable_interrupts(struct iwl_priv *priv) 167static inline void il_enable_interrupts(struct il_priv *priv)
168{ 168{
169 IWL_DEBUG_ISR(priv, "Enabling interrupts\n"); 169 IL_DEBUG_ISR(priv, "Enabling interrupts\n");
170 set_bit(STATUS_INT_ENABLED, &priv->status); 170 set_bit(STATUS_INT_ENABLED, &priv->status);
171 iwl_write32(priv, CSR_INT_MASK, priv->inta_mask); 171 il_write32(priv, CSR_INT_MASK, priv->inta_mask);
172} 172}
173 173
174/** 174/**
175 * iwl_legacy_beacon_time_mask_low - mask of lower 32 bit of beacon time 175 * il_beacon_time_mask_low - mask of lower 32 bit of beacon time
176 * @priv -- pointer to iwl_priv data structure 176 * @priv -- pointer to il_priv data structure
177 * @tsf_bits -- number of bits need to shift for masking) 177 * @tsf_bits -- number of bits need to shift for masking)
178 */ 178 */
179static inline u32 iwl_legacy_beacon_time_mask_low(struct iwl_priv *priv, 179static inline u32 il_beacon_time_mask_low(struct il_priv *priv,
180 u16 tsf_bits) 180 u16 tsf_bits)
181{ 181{
182 return (1 << tsf_bits) - 1; 182 return (1 << tsf_bits) - 1;
183} 183}
184 184
185/** 185/**
186 * iwl_legacy_beacon_time_mask_high - mask of higher 32 bit of beacon time 186 * il_beacon_time_mask_high - mask of higher 32 bit of beacon time
187 * @priv -- pointer to iwl_priv data structure 187 * @priv -- pointer to il_priv data structure
188 * @tsf_bits -- number of bits need to shift for masking) 188 * @tsf_bits -- number of bits need to shift for masking)
189 */ 189 */
190static inline u32 iwl_legacy_beacon_time_mask_high(struct iwl_priv *priv, 190static inline u32 il_beacon_time_mask_high(struct il_priv *priv,
191 u16 tsf_bits) 191 u16 tsf_bits)
192{ 192{
193 return ((1 << (32 - tsf_bits)) - 1) << tsf_bits; 193 return ((1 << (32 - tsf_bits)) - 1) << tsf_bits;
194} 194}
195 195
196#endif /* __iwl_legacy_helpers_h__ */ 196#endif /* __il_helpers_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-io.h b/drivers/net/wireless/iwlegacy/iwl-io.h
index 868ef01e2058..ebeb6e2aa6e7 100644
--- a/drivers/net/wireless/iwlegacy/iwl-io.h
+++ b/drivers/net/wireless/iwlegacy/iwl-io.h
@@ -26,8 +26,8 @@
26 * 26 *
27 *****************************************************************************/ 27 *****************************************************************************/
28 28
29#ifndef __iwl_legacy_io_h__ 29#ifndef __il_io_h__
30#define __iwl_legacy_io_h__ 30#define __il_io_h__
31 31
32#include <linux/io.h> 32#include <linux/io.h>
33 33
@@ -52,8 +52,8 @@
52 * 52 *
53 * If you wish to call the function without any debug or state checking, 53 * If you wish to call the function without any debug or state checking,
54 * you should use the single _ prefix version (as is used by dependent IO 54 * you should use the single _ prefix version (as is used by dependent IO
55 * routines, for example _iwl_legacy_read_direct32 calls the non-check version of 55 * routines, for example _il_read_direct32 calls the non-check version of
56 * _iwl_legacy_read32.) 56 * _il_read32.)
57 * 57 *
58 * These declarations are *extremely* useful in quickly isolating code deltas 58 * These declarations are *extremely* useful in quickly isolating code deltas
59 * which result in misconfiguration of the hardware I/O. In combination with 59 * which result in misconfiguration of the hardware I/O. In combination with
@@ -62,46 +62,46 @@
62 * 62 *
63 */ 63 */
64 64
65static inline void _iwl_legacy_write8(struct iwl_priv *priv, u32 ofs, u8 val) 65static inline void _il_write8(struct il_priv *priv, u32 ofs, u8 val)
66{ 66{
67 iowrite8(val, priv->hw_base + ofs); 67 iowrite8(val, priv->hw_base + ofs);
68} 68}
69 69
70#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 70#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
71static inline void 71static inline void
72__iwl_legacy_write8(const char *f, u32 l, struct iwl_priv *priv, 72__il_write8(const char *f, u32 l, struct il_priv *priv,
73 u32 ofs, u8 val) 73 u32 ofs, u8 val)
74{ 74{
75 IWL_DEBUG_IO(priv, "write8(0x%08X, 0x%02X) - %s %d\n", ofs, val, f, l); 75 IL_DEBUG_IO(priv, "write8(0x%08X, 0x%02X) - %s %d\n", ofs, val, f, l);
76 _iwl_legacy_write8(priv, ofs, val); 76 _il_write8(priv, ofs, val);
77} 77}
78#define iwl_write8(priv, ofs, val) \ 78#define il_write8(priv, ofs, val) \
79 __iwl_legacy_write8(__FILE__, __LINE__, priv, ofs, val) 79 __il_write8(__FILE__, __LINE__, priv, ofs, val)
80#else 80#else
81#define iwl_write8(priv, ofs, val) _iwl_legacy_write8(priv, ofs, val) 81#define il_write8(priv, ofs, val) _il_write8(priv, ofs, val)
82#endif 82#endif
83 83
84 84
85static inline void _iwl_legacy_write32(struct iwl_priv *priv, u32 ofs, u32 val) 85static inline void _il_write32(struct il_priv *priv, u32 ofs, u32 val)
86{ 86{
87 iowrite32(val, priv->hw_base + ofs); 87 iowrite32(val, priv->hw_base + ofs);
88} 88}
89 89
90#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 90#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
91static inline void 91static inline void
92__iwl_legacy_write32(const char *f, u32 l, struct iwl_priv *priv, 92__il_write32(const char *f, u32 l, struct il_priv *priv,
93 u32 ofs, u32 val) 93 u32 ofs, u32 val)
94{ 94{
95 IWL_DEBUG_IO(priv, "write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); 95 IL_DEBUG_IO(priv, "write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
96 _iwl_legacy_write32(priv, ofs, val); 96 _il_write32(priv, ofs, val);
97} 97}
98#define iwl_write32(priv, ofs, val) \ 98#define il_write32(priv, ofs, val) \
99 __iwl_legacy_write32(__FILE__, __LINE__, priv, ofs, val) 99 __il_write32(__FILE__, __LINE__, priv, ofs, val)
100#else 100#else
101#define iwl_write32(priv, ofs, val) _iwl_legacy_write32(priv, ofs, val) 101#define il_write32(priv, ofs, val) _il_write32(priv, ofs, val)
102#endif 102#endif
103 103
104static inline u32 _iwl_legacy_read32(struct iwl_priv *priv, u32 ofs) 104static inline u32 _il_read32(struct il_priv *priv, u32 ofs)
105{ 105{
106 u32 val = ioread32(priv->hw_base + ofs); 106 u32 val = ioread32(priv->hw_base + ofs);
107 return val; 107 return val;
@@ -109,122 +109,122 @@ static inline u32 _iwl_legacy_read32(struct iwl_priv *priv, u32 ofs)
109 109
110#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 110#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
111static inline u32 111static inline u32
112__iwl_legacy_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs) 112__il_read32(char *f, u32 l, struct il_priv *priv, u32 ofs)
113{ 113{
114 IWL_DEBUG_IO(priv, "read_direct32(0x%08X) - %s %d\n", ofs, f, l); 114 IL_DEBUG_IO(priv, "read_direct32(0x%08X) - %s %d\n", ofs, f, l);
115 return _iwl_legacy_read32(priv, ofs); 115 return _il_read32(priv, ofs);
116} 116}
117#define iwl_read32(priv, ofs) __iwl_legacy_read32(__FILE__, __LINE__, priv, ofs) 117#define il_read32(priv, ofs) __il_read32(__FILE__, __LINE__, priv, ofs)
118#else 118#else
119#define iwl_read32(p, o) _iwl_legacy_read32(p, o) 119#define il_read32(p, o) _il_read32(p, o)
120#endif 120#endif
121 121
122#define IWL_POLL_INTERVAL 10 /* microseconds */ 122#define IL_POLL_INTERVAL 10 /* microseconds */
123static inline int 123static inline int
124_iwl_legacy_poll_bit(struct iwl_priv *priv, u32 addr, 124_il_poll_bit(struct il_priv *priv, u32 addr,
125 u32 bits, u32 mask, int timeout) 125 u32 bits, u32 mask, int timeout)
126{ 126{
127 int t = 0; 127 int t = 0;
128 128
129 do { 129 do {
130 if ((_iwl_legacy_read32(priv, addr) & mask) == (bits & mask)) 130 if ((_il_read32(priv, addr) & mask) == (bits & mask))
131 return t; 131 return t;
132 udelay(IWL_POLL_INTERVAL); 132 udelay(IL_POLL_INTERVAL);
133 t += IWL_POLL_INTERVAL; 133 t += IL_POLL_INTERVAL;
134 } while (t < timeout); 134 } while (t < timeout);
135 135
136 return -ETIMEDOUT; 136 return -ETIMEDOUT;
137} 137}
138#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 138#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
139static inline int __iwl_legacy_poll_bit(const char *f, u32 l, 139static inline int __il_poll_bit(const char *f, u32 l,
140 struct iwl_priv *priv, u32 addr, 140 struct il_priv *priv, u32 addr,
141 u32 bits, u32 mask, int timeout) 141 u32 bits, u32 mask, int timeout)
142{ 142{
143 int ret = _iwl_legacy_poll_bit(priv, addr, bits, mask, timeout); 143 int ret = _il_poll_bit(priv, addr, bits, mask, timeout);
144 IWL_DEBUG_IO(priv, "poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n", 144 IL_DEBUG_IO(priv, "poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n",
145 addr, bits, mask, 145 addr, bits, mask,
146 unlikely(ret == -ETIMEDOUT) ? "timeout" : "", f, l); 146 unlikely(ret == -ETIMEDOUT) ? "timeout" : "", f, l);
147 return ret; 147 return ret;
148} 148}
149#define iwl_poll_bit(priv, addr, bits, mask, timeout) \ 149#define il_poll_bit(priv, addr, bits, mask, timeout) \
150 __iwl_legacy_poll_bit(__FILE__, __LINE__, priv, addr, \ 150 __il_poll_bit(__FILE__, __LINE__, priv, addr, \
151 bits, mask, timeout) 151 bits, mask, timeout)
152#else 152#else
153#define iwl_poll_bit(p, a, b, m, t) _iwl_legacy_poll_bit(p, a, b, m, t) 153#define il_poll_bit(p, a, b, m, t) _il_poll_bit(p, a, b, m, t)
154#endif 154#endif
155 155
156static inline void _iwl_legacy_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) 156static inline void _il_set_bit(struct il_priv *priv, u32 reg, u32 mask)
157{ 157{
158 _iwl_legacy_write32(priv, reg, _iwl_legacy_read32(priv, reg) | mask); 158 _il_write32(priv, reg, _il_read32(priv, reg) | mask);
159} 159}
160#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 160#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
161static inline void __iwl_legacy_set_bit(const char *f, u32 l, 161static inline void __il_set_bit(const char *f, u32 l,
162 struct iwl_priv *priv, u32 reg, u32 mask) 162 struct il_priv *priv, u32 reg, u32 mask)
163{ 163{
164 u32 val = _iwl_legacy_read32(priv, reg) | mask; 164 u32 val = _il_read32(priv, reg) | mask;
165 IWL_DEBUG_IO(priv, "set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, 165 IL_DEBUG_IO(priv, "set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg,
166 mask, val); 166 mask, val);
167 _iwl_legacy_write32(priv, reg, val); 167 _il_write32(priv, reg, val);
168} 168}
169static inline void iwl_legacy_set_bit(struct iwl_priv *p, u32 r, u32 m) 169static inline void il_set_bit(struct il_priv *p, u32 r, u32 m)
170{ 170{
171 unsigned long reg_flags; 171 unsigned long reg_flags;
172 172
173 spin_lock_irqsave(&p->reg_lock, reg_flags); 173 spin_lock_irqsave(&p->reg_lock, reg_flags);
174 __iwl_legacy_set_bit(__FILE__, __LINE__, p, r, m); 174 __il_set_bit(__FILE__, __LINE__, p, r, m);
175 spin_unlock_irqrestore(&p->reg_lock, reg_flags); 175 spin_unlock_irqrestore(&p->reg_lock, reg_flags);
176} 176}
177#else 177#else
178static inline void iwl_legacy_set_bit(struct iwl_priv *p, u32 r, u32 m) 178static inline void il_set_bit(struct il_priv *p, u32 r, u32 m)
179{ 179{
180 unsigned long reg_flags; 180 unsigned long reg_flags;
181 181
182 spin_lock_irqsave(&p->reg_lock, reg_flags); 182 spin_lock_irqsave(&p->reg_lock, reg_flags);
183 _iwl_legacy_set_bit(p, r, m); 183 _il_set_bit(p, r, m);
184 spin_unlock_irqrestore(&p->reg_lock, reg_flags); 184 spin_unlock_irqrestore(&p->reg_lock, reg_flags);
185} 185}
186#endif 186#endif
187 187
188static inline void 188static inline void
189_iwl_legacy_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) 189_il_clear_bit(struct il_priv *priv, u32 reg, u32 mask)
190{ 190{
191 _iwl_legacy_write32(priv, reg, _iwl_legacy_read32(priv, reg) & ~mask); 191 _il_write32(priv, reg, _il_read32(priv, reg) & ~mask);
192} 192}
193#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 193#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
194static inline void 194static inline void
195__iwl_legacy_clear_bit(const char *f, u32 l, 195__il_clear_bit(const char *f, u32 l,
196 struct iwl_priv *priv, u32 reg, u32 mask) 196 struct il_priv *priv, u32 reg, u32 mask)
197{ 197{
198 u32 val = _iwl_legacy_read32(priv, reg) & ~mask; 198 u32 val = _il_read32(priv, reg) & ~mask;
199 IWL_DEBUG_IO(priv, "clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); 199 IL_DEBUG_IO(priv, "clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
200 _iwl_legacy_write32(priv, reg, val); 200 _il_write32(priv, reg, val);
201} 201}
202static inline void iwl_legacy_clear_bit(struct iwl_priv *p, u32 r, u32 m) 202static inline void il_clear_bit(struct il_priv *p, u32 r, u32 m)
203{ 203{
204 unsigned long reg_flags; 204 unsigned long reg_flags;
205 205
206 spin_lock_irqsave(&p->reg_lock, reg_flags); 206 spin_lock_irqsave(&p->reg_lock, reg_flags);
207 __iwl_legacy_clear_bit(__FILE__, __LINE__, p, r, m); 207 __il_clear_bit(__FILE__, __LINE__, p, r, m);
208 spin_unlock_irqrestore(&p->reg_lock, reg_flags); 208 spin_unlock_irqrestore(&p->reg_lock, reg_flags);
209} 209}
210#else 210#else
211static inline void iwl_legacy_clear_bit(struct iwl_priv *p, u32 r, u32 m) 211static inline void il_clear_bit(struct il_priv *p, u32 r, u32 m)
212{ 212{
213 unsigned long reg_flags; 213 unsigned long reg_flags;
214 214
215 spin_lock_irqsave(&p->reg_lock, reg_flags); 215 spin_lock_irqsave(&p->reg_lock, reg_flags);
216 _iwl_legacy_clear_bit(p, r, m); 216 _il_clear_bit(p, r, m);
217 spin_unlock_irqrestore(&p->reg_lock, reg_flags); 217 spin_unlock_irqrestore(&p->reg_lock, reg_flags);
218} 218}
219#endif 219#endif
220 220
221static inline int _iwl_legacy_grab_nic_access(struct iwl_priv *priv) 221static inline int _il_grab_nic_access(struct il_priv *priv)
222{ 222{
223 int ret; 223 int ret;
224 u32 val; 224 u32 val;
225 225
226 /* this bit wakes up the NIC */ 226 /* this bit wakes up the NIC */
227 _iwl_legacy_set_bit(priv, CSR_GP_CNTRL, 227 _il_set_bit(priv, CSR_GP_CNTRL,
228 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 228 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
229 229
230 /* 230 /*
@@ -244,15 +244,15 @@ static inline int _iwl_legacy_grab_nic_access(struct iwl_priv *priv)
244 * good idea before accessing 3945/4965 SRAM (e.g. reading Event Log). 244 * good idea before accessing 3945/4965 SRAM (e.g. reading Event Log).
245 * 245 *
246 */ 246 */
247 ret = _iwl_legacy_poll_bit(priv, CSR_GP_CNTRL, 247 ret = _il_poll_bit(priv, CSR_GP_CNTRL,
248 CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, 248 CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN,
249 (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | 249 (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY |
250 CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000); 250 CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000);
251 if (ret < 0) { 251 if (ret < 0) {
252 val = _iwl_legacy_read32(priv, CSR_GP_CNTRL); 252 val = _il_read32(priv, CSR_GP_CNTRL);
253 IWL_ERR(priv, 253 IL_ERR(priv,
254 "MAC is in deep sleep!. CSR_GP_CNTRL = 0x%08X\n", val); 254 "MAC is in deep sleep!. CSR_GP_CNTRL = 0x%08X\n", val);
255 _iwl_legacy_write32(priv, CSR_RESET, 255 _il_write32(priv, CSR_RESET,
256 CSR_RESET_REG_FLAG_FORCE_NMI); 256 CSR_RESET_REG_FLAG_FORCE_NMI);
257 return -EIO; 257 return -EIO;
258 } 258 }
@@ -261,280 +261,280 @@ static inline int _iwl_legacy_grab_nic_access(struct iwl_priv *priv)
261} 261}
262 262
263#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 263#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
264static inline int __iwl_legacy_grab_nic_access(const char *f, u32 l, 264static inline int __il_grab_nic_access(const char *f, u32 l,
265 struct iwl_priv *priv) 265 struct il_priv *priv)
266{ 266{
267 IWL_DEBUG_IO(priv, "grabbing nic access - %s %d\n", f, l); 267 IL_DEBUG_IO(priv, "grabbing nic access - %s %d\n", f, l);
268 return _iwl_legacy_grab_nic_access(priv); 268 return _il_grab_nic_access(priv);
269} 269}
270#define iwl_grab_nic_access(priv) \ 270#define il_grab_nic_access(priv) \
271 __iwl_legacy_grab_nic_access(__FILE__, __LINE__, priv) 271 __il_grab_nic_access(__FILE__, __LINE__, priv)
272#else 272#else
273#define iwl_grab_nic_access(priv) \ 273#define il_grab_nic_access(priv) \
274 _iwl_legacy_grab_nic_access(priv) 274 _il_grab_nic_access(priv)
275#endif 275#endif
276 276
277static inline void _iwl_legacy_release_nic_access(struct iwl_priv *priv) 277static inline void _il_release_nic_access(struct il_priv *priv)
278{ 278{
279 _iwl_legacy_clear_bit(priv, CSR_GP_CNTRL, 279 _il_clear_bit(priv, CSR_GP_CNTRL,
280 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 280 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
281} 281}
282#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 282#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
283static inline void __iwl_legacy_release_nic_access(const char *f, u32 l, 283static inline void __il_release_nic_access(const char *f, u32 l,
284 struct iwl_priv *priv) 284 struct il_priv *priv)
285{ 285{
286 286
287 IWL_DEBUG_IO(priv, "releasing nic access - %s %d\n", f, l); 287 IL_DEBUG_IO(priv, "releasing nic access - %s %d\n", f, l);
288 _iwl_legacy_release_nic_access(priv); 288 _il_release_nic_access(priv);
289} 289}
290#define iwl_release_nic_access(priv) \ 290#define il_release_nic_access(priv) \
291 __iwl_legacy_release_nic_access(__FILE__, __LINE__, priv) 291 __il_release_nic_access(__FILE__, __LINE__, priv)
292#else 292#else
293#define iwl_release_nic_access(priv) \ 293#define il_release_nic_access(priv) \
294 _iwl_legacy_release_nic_access(priv) 294 _il_release_nic_access(priv)
295#endif 295#endif
296 296
297static inline u32 _iwl_legacy_read_direct32(struct iwl_priv *priv, u32 reg) 297static inline u32 _il_read_direct32(struct il_priv *priv, u32 reg)
298{ 298{
299 return _iwl_legacy_read32(priv, reg); 299 return _il_read32(priv, reg);
300} 300}
301#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 301#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
302static inline u32 __iwl_legacy_read_direct32(const char *f, u32 l, 302static inline u32 __il_read_direct32(const char *f, u32 l,
303 struct iwl_priv *priv, u32 reg) 303 struct il_priv *priv, u32 reg)
304{ 304{
305 u32 value = _iwl_legacy_read_direct32(priv, reg); 305 u32 value = _il_read_direct32(priv, reg);
306 IWL_DEBUG_IO(priv, 306 IL_DEBUG_IO(priv,
307 "read_direct32(0x%4X) = 0x%08x - %s %d\n", reg, value, 307 "read_direct32(0x%4X) = 0x%08x - %s %d\n", reg, value,
308 f, l); 308 f, l);
309 return value; 309 return value;
310} 310}
311static inline u32 iwl_legacy_read_direct32(struct iwl_priv *priv, u32 reg) 311static inline u32 il_read_direct32(struct il_priv *priv, u32 reg)
312{ 312{
313 u32 value; 313 u32 value;
314 unsigned long reg_flags; 314 unsigned long reg_flags;
315 315
316 spin_lock_irqsave(&priv->reg_lock, reg_flags); 316 spin_lock_irqsave(&priv->reg_lock, reg_flags);
317 iwl_grab_nic_access(priv); 317 il_grab_nic_access(priv);
318 value = __iwl_legacy_read_direct32(__FILE__, __LINE__, priv, reg); 318 value = __il_read_direct32(__FILE__, __LINE__, priv, reg);
319 iwl_release_nic_access(priv); 319 il_release_nic_access(priv);
320 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 320 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
321 return value; 321 return value;
322} 322}
323 323
324#else 324#else
325static inline u32 iwl_legacy_read_direct32(struct iwl_priv *priv, u32 reg) 325static inline u32 il_read_direct32(struct il_priv *priv, u32 reg)
326{ 326{
327 u32 value; 327 u32 value;
328 unsigned long reg_flags; 328 unsigned long reg_flags;
329 329
330 spin_lock_irqsave(&priv->reg_lock, reg_flags); 330 spin_lock_irqsave(&priv->reg_lock, reg_flags);
331 iwl_grab_nic_access(priv); 331 il_grab_nic_access(priv);
332 value = _iwl_legacy_read_direct32(priv, reg); 332 value = _il_read_direct32(priv, reg);
333 iwl_release_nic_access(priv); 333 il_release_nic_access(priv);
334 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 334 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
335 return value; 335 return value;
336 336
337} 337}
338#endif 338#endif
339 339
340static inline void _iwl_legacy_write_direct32(struct iwl_priv *priv, 340static inline void _il_write_direct32(struct il_priv *priv,
341 u32 reg, u32 value) 341 u32 reg, u32 value)
342{ 342{
343 _iwl_legacy_write32(priv, reg, value); 343 _il_write32(priv, reg, value);
344} 344}
345static inline void 345static inline void
346iwl_legacy_write_direct32(struct iwl_priv *priv, u32 reg, u32 value) 346il_write_direct32(struct il_priv *priv, u32 reg, u32 value)
347{ 347{
348 unsigned long reg_flags; 348 unsigned long reg_flags;
349 349
350 spin_lock_irqsave(&priv->reg_lock, reg_flags); 350 spin_lock_irqsave(&priv->reg_lock, reg_flags);
351 if (!iwl_grab_nic_access(priv)) { 351 if (!il_grab_nic_access(priv)) {
352 _iwl_legacy_write_direct32(priv, reg, value); 352 _il_write_direct32(priv, reg, value);
353 iwl_release_nic_access(priv); 353 il_release_nic_access(priv);
354 } 354 }
355 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 355 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
356} 356}
357 357
358static inline void iwl_legacy_write_reg_buf(struct iwl_priv *priv, 358static inline void il_write_reg_buf(struct il_priv *priv,
359 u32 reg, u32 len, u32 *values) 359 u32 reg, u32 len, u32 *values)
360{ 360{
361 u32 count = sizeof(u32); 361 u32 count = sizeof(u32);
362 362
363 if ((priv != NULL) && (values != NULL)) { 363 if ((priv != NULL) && (values != NULL)) {
364 for (; 0 < len; len -= count, reg += count, values++) 364 for (; 0 < len; len -= count, reg += count, values++)
365 iwl_legacy_write_direct32(priv, reg, *values); 365 il_write_direct32(priv, reg, *values);
366 } 366 }
367} 367}
368 368
369static inline int _iwl_legacy_poll_direct_bit(struct iwl_priv *priv, u32 addr, 369static inline int _il_poll_direct_bit(struct il_priv *priv, u32 addr,
370 u32 mask, int timeout) 370 u32 mask, int timeout)
371{ 371{
372 int t = 0; 372 int t = 0;
373 373
374 do { 374 do {
375 if ((iwl_legacy_read_direct32(priv, addr) & mask) == mask) 375 if ((il_read_direct32(priv, addr) & mask) == mask)
376 return t; 376 return t;
377 udelay(IWL_POLL_INTERVAL); 377 udelay(IL_POLL_INTERVAL);
378 t += IWL_POLL_INTERVAL; 378 t += IL_POLL_INTERVAL;
379 } while (t < timeout); 379 } while (t < timeout);
380 380
381 return -ETIMEDOUT; 381 return -ETIMEDOUT;
382} 382}
383 383
384#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 384#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
385static inline int __iwl_legacy_poll_direct_bit(const char *f, u32 l, 385static inline int __il_poll_direct_bit(const char *f, u32 l,
386 struct iwl_priv *priv, 386 struct il_priv *priv,
387 u32 addr, u32 mask, int timeout) 387 u32 addr, u32 mask, int timeout)
388{ 388{
389 int ret = _iwl_legacy_poll_direct_bit(priv, addr, mask, timeout); 389 int ret = _il_poll_direct_bit(priv, addr, mask, timeout);
390 390
391 if (unlikely(ret == -ETIMEDOUT)) 391 if (unlikely(ret == -ETIMEDOUT))
392 IWL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) - " 392 IL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) - "
393 "timedout - %s %d\n", addr, mask, f, l); 393 "timedout - %s %d\n", addr, mask, f, l);
394 else 394 else
395 IWL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) = 0x%08X " 395 IL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) = 0x%08X "
396 "- %s %d\n", addr, mask, ret, f, l); 396 "- %s %d\n", addr, mask, ret, f, l);
397 return ret; 397 return ret;
398} 398}
399#define iwl_poll_direct_bit(priv, addr, mask, timeout) \ 399#define il_poll_direct_bit(priv, addr, mask, timeout) \
400__iwl_legacy_poll_direct_bit(__FILE__, __LINE__, priv, addr, mask, timeout) 400__il_poll_direct_bit(__FILE__, __LINE__, priv, addr, mask, timeout)
401#else 401#else
402#define iwl_poll_direct_bit _iwl_legacy_poll_direct_bit 402#define il_poll_direct_bit _il_poll_direct_bit
403#endif 403#endif
404 404
405static inline u32 _iwl_legacy_read_prph(struct iwl_priv *priv, u32 reg) 405static inline u32 _il_read_prph(struct il_priv *priv, u32 reg)
406{ 406{
407 _iwl_legacy_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); 407 _il_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
408 rmb(); 408 rmb();
409 return _iwl_legacy_read_direct32(priv, HBUS_TARG_PRPH_RDAT); 409 return _il_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
410} 410}
411static inline u32 iwl_legacy_read_prph(struct iwl_priv *priv, u32 reg) 411static inline u32 il_read_prph(struct il_priv *priv, u32 reg)
412{ 412{
413 unsigned long reg_flags; 413 unsigned long reg_flags;
414 u32 val; 414 u32 val;
415 415
416 spin_lock_irqsave(&priv->reg_lock, reg_flags); 416 spin_lock_irqsave(&priv->reg_lock, reg_flags);
417 iwl_grab_nic_access(priv); 417 il_grab_nic_access(priv);
418 val = _iwl_legacy_read_prph(priv, reg); 418 val = _il_read_prph(priv, reg);
419 iwl_release_nic_access(priv); 419 il_release_nic_access(priv);
420 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 420 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
421 return val; 421 return val;
422} 422}
423 423
424static inline void _iwl_legacy_write_prph(struct iwl_priv *priv, 424static inline void _il_write_prph(struct il_priv *priv,
425 u32 addr, u32 val) 425 u32 addr, u32 val)
426{ 426{
427 _iwl_legacy_write_direct32(priv, HBUS_TARG_PRPH_WADDR, 427 _il_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
428 ((addr & 0x0000FFFF) | (3 << 24))); 428 ((addr & 0x0000FFFF) | (3 << 24)));
429 wmb(); 429 wmb();
430 _iwl_legacy_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); 430 _il_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
431} 431}
432 432
433static inline void 433static inline void
434iwl_legacy_write_prph(struct iwl_priv *priv, u32 addr, u32 val) 434il_write_prph(struct il_priv *priv, u32 addr, u32 val)
435{ 435{
436 unsigned long reg_flags; 436 unsigned long reg_flags;
437 437
438 spin_lock_irqsave(&priv->reg_lock, reg_flags); 438 spin_lock_irqsave(&priv->reg_lock, reg_flags);
439 if (!iwl_grab_nic_access(priv)) { 439 if (!il_grab_nic_access(priv)) {
440 _iwl_legacy_write_prph(priv, addr, val); 440 _il_write_prph(priv, addr, val);
441 iwl_release_nic_access(priv); 441 il_release_nic_access(priv);
442 } 442 }
443 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 443 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
444} 444}
445 445
446#define _iwl_legacy_set_bits_prph(priv, reg, mask) \ 446#define _il_set_bits_prph(priv, reg, mask) \
447_iwl_legacy_write_prph(priv, reg, (_iwl_legacy_read_prph(priv, reg) | mask)) 447_il_write_prph(priv, reg, (_il_read_prph(priv, reg) | mask))
448 448
449static inline void 449static inline void
450iwl_legacy_set_bits_prph(struct iwl_priv *priv, u32 reg, u32 mask) 450il_set_bits_prph(struct il_priv *priv, u32 reg, u32 mask)
451{ 451{
452 unsigned long reg_flags; 452 unsigned long reg_flags;
453 453
454 spin_lock_irqsave(&priv->reg_lock, reg_flags); 454 spin_lock_irqsave(&priv->reg_lock, reg_flags);
455 iwl_grab_nic_access(priv); 455 il_grab_nic_access(priv);
456 _iwl_legacy_set_bits_prph(priv, reg, mask); 456 _il_set_bits_prph(priv, reg, mask);
457 iwl_release_nic_access(priv); 457 il_release_nic_access(priv);
458 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 458 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
459} 459}
460 460
461#define _iwl_legacy_set_bits_mask_prph(priv, reg, bits, mask) \ 461#define _il_set_bits_mask_prph(priv, reg, bits, mask) \
462_iwl_legacy_write_prph(priv, reg, \ 462_il_write_prph(priv, reg, \
463 ((_iwl_legacy_read_prph(priv, reg) & mask) | bits)) 463 ((_il_read_prph(priv, reg) & mask) | bits))
464 464
465static inline void iwl_legacy_set_bits_mask_prph(struct iwl_priv *priv, u32 reg, 465static inline void il_set_bits_mask_prph(struct il_priv *priv, u32 reg,
466 u32 bits, u32 mask) 466 u32 bits, u32 mask)
467{ 467{
468 unsigned long reg_flags; 468 unsigned long reg_flags;
469 469
470 spin_lock_irqsave(&priv->reg_lock, reg_flags); 470 spin_lock_irqsave(&priv->reg_lock, reg_flags);
471 iwl_grab_nic_access(priv); 471 il_grab_nic_access(priv);
472 _iwl_legacy_set_bits_mask_prph(priv, reg, bits, mask); 472 _il_set_bits_mask_prph(priv, reg, bits, mask);
473 iwl_release_nic_access(priv); 473 il_release_nic_access(priv);
474 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 474 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
475} 475}
476 476
477static inline void iwl_legacy_clear_bits_prph(struct iwl_priv 477static inline void il_clear_bits_prph(struct il_priv
478 *priv, u32 reg, u32 mask) 478 *priv, u32 reg, u32 mask)
479{ 479{
480 unsigned long reg_flags; 480 unsigned long reg_flags;
481 u32 val; 481 u32 val;
482 482
483 spin_lock_irqsave(&priv->reg_lock, reg_flags); 483 spin_lock_irqsave(&priv->reg_lock, reg_flags);
484 iwl_grab_nic_access(priv); 484 il_grab_nic_access(priv);
485 val = _iwl_legacy_read_prph(priv, reg); 485 val = _il_read_prph(priv, reg);
486 _iwl_legacy_write_prph(priv, reg, (val & ~mask)); 486 _il_write_prph(priv, reg, (val & ~mask));
487 iwl_release_nic_access(priv); 487 il_release_nic_access(priv);
488 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 488 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
489} 489}
490 490
491static inline u32 iwl_legacy_read_targ_mem(struct iwl_priv *priv, u32 addr) 491static inline u32 il_read_targ_mem(struct il_priv *priv, u32 addr)
492{ 492{
493 unsigned long reg_flags; 493 unsigned long reg_flags;
494 u32 value; 494 u32 value;
495 495
496 spin_lock_irqsave(&priv->reg_lock, reg_flags); 496 spin_lock_irqsave(&priv->reg_lock, reg_flags);
497 iwl_grab_nic_access(priv); 497 il_grab_nic_access(priv);
498 498
499 _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); 499 _il_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
500 rmb(); 500 rmb();
501 value = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); 501 value = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT);
502 502
503 iwl_release_nic_access(priv); 503 il_release_nic_access(priv);
504 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 504 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
505 return value; 505 return value;
506} 506}
507 507
508static inline void 508static inline void
509iwl_legacy_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) 509il_write_targ_mem(struct il_priv *priv, u32 addr, u32 val)
510{ 510{
511 unsigned long reg_flags; 511 unsigned long reg_flags;
512 512
513 spin_lock_irqsave(&priv->reg_lock, reg_flags); 513 spin_lock_irqsave(&priv->reg_lock, reg_flags);
514 if (!iwl_grab_nic_access(priv)) { 514 if (!il_grab_nic_access(priv)) {
515 _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); 515 _il_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
516 wmb(); 516 wmb();
517 _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); 517 _il_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
518 iwl_release_nic_access(priv); 518 il_release_nic_access(priv);
519 } 519 }
520 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 520 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
521} 521}
522 522
523static inline void 523static inline void
524iwl_legacy_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, 524il_write_targ_mem_buf(struct il_priv *priv, u32 addr,
525 u32 len, u32 *values) 525 u32 len, u32 *values)
526{ 526{
527 unsigned long reg_flags; 527 unsigned long reg_flags;
528 528
529 spin_lock_irqsave(&priv->reg_lock, reg_flags); 529 spin_lock_irqsave(&priv->reg_lock, reg_flags);
530 if (!iwl_grab_nic_access(priv)) { 530 if (!il_grab_nic_access(priv)) {
531 _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); 531 _il_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
532 wmb(); 532 wmb();
533 for (; 0 < len; len -= sizeof(u32), values++) 533 for (; 0 < len; len -= sizeof(u32), values++)
534 _iwl_legacy_write_direct32(priv, 534 _il_write_direct32(priv,
535 HBUS_TARG_MEM_WDAT, *values); 535 HBUS_TARG_MEM_WDAT, *values);
536 536
537 iwl_release_nic_access(priv); 537 il_release_nic_access(priv);
538 } 538 }
539 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 539 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
540} 540}
diff --git a/drivers/net/wireless/iwlegacy/iwl-led.c b/drivers/net/wireless/iwlegacy/iwl-led.c
index dc568a474c5d..490b183b1347 100644
--- a/drivers/net/wireless/iwlegacy/iwl-led.c
+++ b/drivers/net/wireless/iwlegacy/iwl-led.c
@@ -41,7 +41,7 @@
41#include "iwl-core.h" 41#include "iwl-core.h"
42#include "iwl-io.h" 42#include "iwl-io.h"
43 43
44/* default: IWL_LED_BLINK(0) using blinking index table */ 44/* default: IL_LED_BLINK(0) using blinking index table */
45static int led_mode; 45static int led_mode;
46module_param(led_mode, int, S_IRUGO); 46module_param(led_mode, int, S_IRUGO);
47MODULE_PARM_DESC(led_mode, "0=system default, " 47MODULE_PARM_DESC(led_mode, "0=system default, "
@@ -60,7 +60,7 @@ MODULE_PARM_DESC(led_mode, "0=system default, "
60 * >0 to 1 167 167 60 * >0 to 1 167 167
61 * <=0 SOLID ON 61 * <=0 SOLID ON
62 */ 62 */
63static const struct ieee80211_tpt_blink iwl_blink[] = { 63static const struct ieee80211_tpt_blink il_blink[] = {
64 { .throughput = 0, .blink_time = 334 }, 64 { .throughput = 0, .blink_time = 334 },
65 { .throughput = 1 * 1024 - 1, .blink_time = 260 }, 65 { .throughput = 1 * 1024 - 1, .blink_time = 260 },
66 { .throughput = 5 * 1024 - 1, .blink_time = 220 }, 66 { .throughput = 5 * 1024 - 1, .blink_time = 220 },
@@ -84,11 +84,11 @@ static const struct ieee80211_tpt_blink iwl_blink[] = {
84 * compensation = (100 - averageDeviation) * 64 / 100 84 * compensation = (100 - averageDeviation) * 64 / 100
85 * NewBlinkTime = (compensation * BlinkTime) / 64 85 * NewBlinkTime = (compensation * BlinkTime) / 64
86 */ 86 */
87static inline u8 iwl_legacy_blink_compensation(struct iwl_priv *priv, 87static inline u8 il_blink_compensation(struct il_priv *priv,
88 u8 time, u16 compensation) 88 u8 time, u16 compensation)
89{ 89{
90 if (!compensation) { 90 if (!compensation) {
91 IWL_ERR(priv, "undefined blink compensation: " 91 IL_ERR(priv, "undefined blink compensation: "
92 "use pre-defined blinking time\n"); 92 "use pre-defined blinking time\n");
93 return time; 93 return time;
94 } 94 }
@@ -97,13 +97,13 @@ static inline u8 iwl_legacy_blink_compensation(struct iwl_priv *priv,
97} 97}
98 98
99/* Set led pattern command */ 99/* Set led pattern command */
100static int iwl_legacy_led_cmd(struct iwl_priv *priv, 100static int il_led_cmd(struct il_priv *priv,
101 unsigned long on, 101 unsigned long on,
102 unsigned long off) 102 unsigned long off)
103{ 103{
104 struct iwl_led_cmd led_cmd = { 104 struct il_led_cmd led_cmd = {
105 .id = IWL_LED_LINK, 105 .id = IL_LED_LINK,
106 .interval = IWL_DEF_LED_INTRVL 106 .interval = IL_DEF_LED_INTRVL
107 }; 107 };
108 int ret; 108 int ret;
109 109
@@ -115,14 +115,14 @@ static int iwl_legacy_led_cmd(struct iwl_priv *priv,
115 115
116 if (off == 0) { 116 if (off == 0) {
117 /* led is SOLID_ON */ 117 /* led is SOLID_ON */
118 on = IWL_LED_SOLID; 118 on = IL_LED_SOLID;
119 } 119 }
120 120
121 IWL_DEBUG_LED(priv, "Led blink time compensation=%u\n", 121 IL_DEBUG_LED(priv, "Led blink time compensation=%u\n",
122 priv->cfg->base_params->led_compensation); 122 priv->cfg->base_params->led_compensation);
123 led_cmd.on = iwl_legacy_blink_compensation(priv, on, 123 led_cmd.on = il_blink_compensation(priv, on,
124 priv->cfg->base_params->led_compensation); 124 priv->cfg->base_params->led_compensation);
125 led_cmd.off = iwl_legacy_blink_compensation(priv, off, 125 led_cmd.off = il_blink_compensation(priv, off,
126 priv->cfg->base_params->led_compensation); 126 priv->cfg->base_params->led_compensation);
127 127
128 ret = priv->cfg->ops->led->cmd(priv, &led_cmd); 128 ret = priv->cfg->ops->led->cmd(priv, &led_cmd);
@@ -133,52 +133,52 @@ static int iwl_legacy_led_cmd(struct iwl_priv *priv,
133 return ret; 133 return ret;
134} 134}
135 135
136static void iwl_legacy_led_brightness_set(struct led_classdev *led_cdev, 136static void il_led_brightness_set(struct led_classdev *led_cdev,
137 enum led_brightness brightness) 137 enum led_brightness brightness)
138{ 138{
139 struct iwl_priv *priv = container_of(led_cdev, struct iwl_priv, led); 139 struct il_priv *priv = container_of(led_cdev, struct il_priv, led);
140 unsigned long on = 0; 140 unsigned long on = 0;
141 141
142 if (brightness > 0) 142 if (brightness > 0)
143 on = IWL_LED_SOLID; 143 on = IL_LED_SOLID;
144 144
145 iwl_legacy_led_cmd(priv, on, 0); 145 il_led_cmd(priv, on, 0);
146} 146}
147 147
148static int iwl_legacy_led_blink_set(struct led_classdev *led_cdev, 148static int il_led_blink_set(struct led_classdev *led_cdev,
149 unsigned long *delay_on, 149 unsigned long *delay_on,
150 unsigned long *delay_off) 150 unsigned long *delay_off)
151{ 151{
152 struct iwl_priv *priv = container_of(led_cdev, struct iwl_priv, led); 152 struct il_priv *priv = container_of(led_cdev, struct il_priv, led);
153 153
154 return iwl_legacy_led_cmd(priv, *delay_on, *delay_off); 154 return il_led_cmd(priv, *delay_on, *delay_off);
155} 155}
156 156
157void iwl_legacy_leds_init(struct iwl_priv *priv) 157void il_leds_init(struct il_priv *priv)
158{ 158{
159 int mode = led_mode; 159 int mode = led_mode;
160 int ret; 160 int ret;
161 161
162 if (mode == IWL_LED_DEFAULT) 162 if (mode == IL_LED_DEFAULT)
163 mode = priv->cfg->led_mode; 163 mode = priv->cfg->led_mode;
164 164
165 priv->led.name = kasprintf(GFP_KERNEL, "%s-led", 165 priv->led.name = kasprintf(GFP_KERNEL, "%s-led",
166 wiphy_name(priv->hw->wiphy)); 166 wiphy_name(priv->hw->wiphy));
167 priv->led.brightness_set = iwl_legacy_led_brightness_set; 167 priv->led.brightness_set = il_led_brightness_set;
168 priv->led.blink_set = iwl_legacy_led_blink_set; 168 priv->led.blink_set = il_led_blink_set;
169 priv->led.max_brightness = 1; 169 priv->led.max_brightness = 1;
170 170
171 switch (mode) { 171 switch (mode) {
172 case IWL_LED_DEFAULT: 172 case IL_LED_DEFAULT:
173 WARN_ON(1); 173 WARN_ON(1);
174 break; 174 break;
175 case IWL_LED_BLINK: 175 case IL_LED_BLINK:
176 priv->led.default_trigger = 176 priv->led.default_trigger =
177 ieee80211_create_tpt_led_trigger(priv->hw, 177 ieee80211_create_tpt_led_trigger(priv->hw,
178 IEEE80211_TPT_LEDTRIG_FL_CONNECTED, 178 IEEE80211_TPT_LEDTRIG_FL_CONNECTED,
179 iwl_blink, ARRAY_SIZE(iwl_blink)); 179 il_blink, ARRAY_SIZE(il_blink));
180 break; 180 break;
181 case IWL_LED_RF_STATE: 181 case IL_LED_RF_STATE:
182 priv->led.default_trigger = 182 priv->led.default_trigger =
183 ieee80211_get_radio_led_name(priv->hw); 183 ieee80211_get_radio_led_name(priv->hw);
184 break; 184 break;
@@ -192,9 +192,9 @@ void iwl_legacy_leds_init(struct iwl_priv *priv)
192 192
193 priv->led_registered = true; 193 priv->led_registered = true;
194} 194}
195EXPORT_SYMBOL(iwl_legacy_leds_init); 195EXPORT_SYMBOL(il_leds_init);
196 196
197void iwl_legacy_leds_exit(struct iwl_priv *priv) 197void il_leds_exit(struct il_priv *priv)
198{ 198{
199 if (!priv->led_registered) 199 if (!priv->led_registered)
200 return; 200 return;
@@ -202,4 +202,4 @@ void iwl_legacy_leds_exit(struct iwl_priv *priv)
202 led_classdev_unregister(&priv->led); 202 led_classdev_unregister(&priv->led);
203 kfree(priv->led.name); 203 kfree(priv->led.name);
204} 204}
205EXPORT_SYMBOL(iwl_legacy_leds_exit); 205EXPORT_SYMBOL(il_leds_exit);
diff --git a/drivers/net/wireless/iwlegacy/iwl-led.h b/drivers/net/wireless/iwlegacy/iwl-led.h
index f0791f70f79d..ea7a8ea23a15 100644
--- a/drivers/net/wireless/iwlegacy/iwl-led.h
+++ b/drivers/net/wireless/iwlegacy/iwl-led.h
@@ -24,33 +24,33 @@
24 * 24 *
25 *****************************************************************************/ 25 *****************************************************************************/
26 26
27#ifndef __iwl_legacy_leds_h__ 27#ifndef __il_leds_h__
28#define __iwl_legacy_leds_h__ 28#define __il_leds_h__
29 29
30 30
31struct iwl_priv; 31struct il_priv;
32 32
33#define IWL_LED_SOLID 11 33#define IL_LED_SOLID 11
34#define IWL_DEF_LED_INTRVL cpu_to_le32(1000) 34#define IL_DEF_LED_INTRVL cpu_to_le32(1000)
35 35
36#define IWL_LED_ACTIVITY (0<<1) 36#define IL_LED_ACTIVITY (0<<1)
37#define IWL_LED_LINK (1<<1) 37#define IL_LED_LINK (1<<1)
38 38
39/* 39/*
40 * LED mode 40 * LED mode
41 * IWL_LED_DEFAULT: use device default 41 * IL_LED_DEFAULT: use device default
42 * IWL_LED_RF_STATE: turn LED on/off based on RF state 42 * IL_LED_RF_STATE: turn LED on/off based on RF state
43 * LED ON = RF ON 43 * LED ON = RF ON
44 * LED OFF = RF OFF 44 * LED OFF = RF OFF
45 * IWL_LED_BLINK: adjust led blink rate based on blink table 45 * IL_LED_BLINK: adjust led blink rate based on blink table
46 */ 46 */
47enum iwl_led_mode { 47enum il_led_mode {
48 IWL_LED_DEFAULT, 48 IL_LED_DEFAULT,
49 IWL_LED_RF_STATE, 49 IL_LED_RF_STATE,
50 IWL_LED_BLINK, 50 IL_LED_BLINK,
51}; 51};
52 52
53void iwl_legacy_leds_init(struct iwl_priv *priv); 53void il_leds_init(struct il_priv *priv);
54void iwl_legacy_leds_exit(struct iwl_priv *priv); 54void il_leds_exit(struct il_priv *priv);
55 55
56#endif /* __iwl_legacy_leds_h__ */ 56#endif /* __il_leds_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
index 38647e481eb0..72ef91e9a799 100644
--- a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
+++ b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
@@ -24,14 +24,14 @@
24 * 24 *
25 *****************************************************************************/ 25 *****************************************************************************/
26 26
27#ifndef __iwl_legacy_rs_h__ 27#ifndef __il_rs_h__
28#define __iwl_legacy_rs_h__ 28#define __il_rs_h__
29 29
30struct iwl_rate_info { 30struct il_rate_info {
31 u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ 31 u8 plcp; /* uCode API: IL_RATE_6M_PLCP, etc. */
32 u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */ 32 u8 plcp_siso; /* uCode API: IL_RATE_SISO_6M_PLCP, etc. */
33 u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */ 33 u8 plcp_mimo2; /* uCode API: IL_RATE_MIMO2_6M_PLCP, etc. */
34 u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ 34 u8 ieee; /* MAC header: IL_RATE_6M_IEEE, etc. */
35 u8 prev_ieee; /* previous rate in IEEE speeds */ 35 u8 prev_ieee; /* previous rate in IEEE speeds */
36 u8 next_ieee; /* next rate in IEEE speeds */ 36 u8 next_ieee; /* next rate in IEEE speeds */
37 u8 prev_rs; /* previous rate used in rs algo */ 37 u8 prev_rs; /* previous rate used in rs algo */
@@ -40,9 +40,9 @@ struct iwl_rate_info {
40 u8 next_rs_tgg; /* next rate used in TGG rs algo */ 40 u8 next_rs_tgg; /* next rate used in TGG rs algo */
41}; 41};
42 42
43struct iwl3945_rate_info { 43struct il3945_rate_info {
44 u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ 44 u8 plcp; /* uCode API: IL_RATE_6M_PLCP, etc. */
45 u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ 45 u8 ieee; /* MAC header: IL_RATE_6M_IEEE, etc. */
46 u8 prev_ieee; /* previous rate in IEEE speeds */ 46 u8 prev_ieee; /* previous rate in IEEE speeds */
47 u8 next_ieee; /* next rate in IEEE speeds */ 47 u8 next_ieee; /* next rate in IEEE speeds */
48 u8 prev_rs; /* previous rate used in rs algo */ 48 u8 prev_rs; /* previous rate used in rs algo */
@@ -56,210 +56,210 @@ struct iwl3945_rate_info {
56 56
57/* 57/*
58 * These serve as indexes into 58 * These serve as indexes into
59 * struct iwl_rate_info iwlegacy_rates[IWL_RATE_COUNT]; 59 * struct il_rate_info iwlegacy_rates[IL_RATE_COUNT];
60 */ 60 */
61enum { 61enum {
62 IWL_RATE_1M_INDEX = 0, 62 IL_RATE_1M_INDEX = 0,
63 IWL_RATE_2M_INDEX, 63 IL_RATE_2M_INDEX,
64 IWL_RATE_5M_INDEX, 64 IL_RATE_5M_INDEX,
65 IWL_RATE_11M_INDEX, 65 IL_RATE_11M_INDEX,
66 IWL_RATE_6M_INDEX, 66 IL_RATE_6M_INDEX,
67 IWL_RATE_9M_INDEX, 67 IL_RATE_9M_INDEX,
68 IWL_RATE_12M_INDEX, 68 IL_RATE_12M_INDEX,
69 IWL_RATE_18M_INDEX, 69 IL_RATE_18M_INDEX,
70 IWL_RATE_24M_INDEX, 70 IL_RATE_24M_INDEX,
71 IWL_RATE_36M_INDEX, 71 IL_RATE_36M_INDEX,
72 IWL_RATE_48M_INDEX, 72 IL_RATE_48M_INDEX,
73 IWL_RATE_54M_INDEX, 73 IL_RATE_54M_INDEX,
74 IWL_RATE_60M_INDEX, 74 IL_RATE_60M_INDEX,
75 IWL_RATE_COUNT, 75 IL_RATE_COUNT,
76 IWL_RATE_COUNT_LEGACY = IWL_RATE_COUNT - 1, /* Excluding 60M */ 76 IL_RATE_COUNT_LEGACY = IL_RATE_COUNT - 1, /* Excluding 60M */
77 IWL_RATE_COUNT_3945 = IWL_RATE_COUNT - 1, 77 IL_RATE_COUNT_3945 = IL_RATE_COUNT - 1,
78 IWL_RATE_INVM_INDEX = IWL_RATE_COUNT, 78 IL_RATE_INVM_INDEX = IL_RATE_COUNT,
79 IWL_RATE_INVALID = IWL_RATE_COUNT, 79 IL_RATE_INVALID = IL_RATE_COUNT,
80}; 80};
81 81
82enum { 82enum {
83 IWL_RATE_6M_INDEX_TABLE = 0, 83 IL_RATE_6M_INDEX_TABLE = 0,
84 IWL_RATE_9M_INDEX_TABLE, 84 IL_RATE_9M_INDEX_TABLE,
85 IWL_RATE_12M_INDEX_TABLE, 85 IL_RATE_12M_INDEX_TABLE,
86 IWL_RATE_18M_INDEX_TABLE, 86 IL_RATE_18M_INDEX_TABLE,
87 IWL_RATE_24M_INDEX_TABLE, 87 IL_RATE_24M_INDEX_TABLE,
88 IWL_RATE_36M_INDEX_TABLE, 88 IL_RATE_36M_INDEX_TABLE,
89 IWL_RATE_48M_INDEX_TABLE, 89 IL_RATE_48M_INDEX_TABLE,
90 IWL_RATE_54M_INDEX_TABLE, 90 IL_RATE_54M_INDEX_TABLE,
91 IWL_RATE_1M_INDEX_TABLE, 91 IL_RATE_1M_INDEX_TABLE,
92 IWL_RATE_2M_INDEX_TABLE, 92 IL_RATE_2M_INDEX_TABLE,
93 IWL_RATE_5M_INDEX_TABLE, 93 IL_RATE_5M_INDEX_TABLE,
94 IWL_RATE_11M_INDEX_TABLE, 94 IL_RATE_11M_INDEX_TABLE,
95 IWL_RATE_INVM_INDEX_TABLE = IWL_RATE_INVM_INDEX - 1, 95 IL_RATE_INVM_INDEX_TABLE = IL_RATE_INVM_INDEX - 1,
96}; 96};
97 97
98enum { 98enum {
99 IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX, 99 IL_FIRST_OFDM_RATE = IL_RATE_6M_INDEX,
100 IWL39_LAST_OFDM_RATE = IWL_RATE_54M_INDEX, 100 IWL39_LAST_OFDM_RATE = IL_RATE_54M_INDEX,
101 IWL_LAST_OFDM_RATE = IWL_RATE_60M_INDEX, 101 IL_LAST_OFDM_RATE = IL_RATE_60M_INDEX,
102 IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX, 102 IL_FIRST_CCK_RATE = IL_RATE_1M_INDEX,
103 IWL_LAST_CCK_RATE = IWL_RATE_11M_INDEX, 103 IL_LAST_CCK_RATE = IL_RATE_11M_INDEX,
104}; 104};
105 105
106/* #define vs. enum to keep from defaulting to 'large integer' */ 106/* #define vs. enum to keep from defaulting to 'large integer' */
107#define IWL_RATE_6M_MASK (1 << IWL_RATE_6M_INDEX) 107#define IL_RATE_6M_MASK (1 << IL_RATE_6M_INDEX)
108#define IWL_RATE_9M_MASK (1 << IWL_RATE_9M_INDEX) 108#define IL_RATE_9M_MASK (1 << IL_RATE_9M_INDEX)
109#define IWL_RATE_12M_MASK (1 << IWL_RATE_12M_INDEX) 109#define IL_RATE_12M_MASK (1 << IL_RATE_12M_INDEX)
110#define IWL_RATE_18M_MASK (1 << IWL_RATE_18M_INDEX) 110#define IL_RATE_18M_MASK (1 << IL_RATE_18M_INDEX)
111#define IWL_RATE_24M_MASK (1 << IWL_RATE_24M_INDEX) 111#define IL_RATE_24M_MASK (1 << IL_RATE_24M_INDEX)
112#define IWL_RATE_36M_MASK (1 << IWL_RATE_36M_INDEX) 112#define IL_RATE_36M_MASK (1 << IL_RATE_36M_INDEX)
113#define IWL_RATE_48M_MASK (1 << IWL_RATE_48M_INDEX) 113#define IL_RATE_48M_MASK (1 << IL_RATE_48M_INDEX)
114#define IWL_RATE_54M_MASK (1 << IWL_RATE_54M_INDEX) 114#define IL_RATE_54M_MASK (1 << IL_RATE_54M_INDEX)
115#define IWL_RATE_60M_MASK (1 << IWL_RATE_60M_INDEX) 115#define IL_RATE_60M_MASK (1 << IL_RATE_60M_INDEX)
116#define IWL_RATE_1M_MASK (1 << IWL_RATE_1M_INDEX) 116#define IL_RATE_1M_MASK (1 << IL_RATE_1M_INDEX)
117#define IWL_RATE_2M_MASK (1 << IWL_RATE_2M_INDEX) 117#define IL_RATE_2M_MASK (1 << IL_RATE_2M_INDEX)
118#define IWL_RATE_5M_MASK (1 << IWL_RATE_5M_INDEX) 118#define IL_RATE_5M_MASK (1 << IL_RATE_5M_INDEX)
119#define IWL_RATE_11M_MASK (1 << IWL_RATE_11M_INDEX) 119#define IL_RATE_11M_MASK (1 << IL_RATE_11M_INDEX)
120 120
121/* uCode API values for legacy bit rates, both OFDM and CCK */ 121/* uCode API values for legacy bit rates, both OFDM and CCK */
122enum { 122enum {
123 IWL_RATE_6M_PLCP = 13, 123 IL_RATE_6M_PLCP = 13,
124 IWL_RATE_9M_PLCP = 15, 124 IL_RATE_9M_PLCP = 15,
125 IWL_RATE_12M_PLCP = 5, 125 IL_RATE_12M_PLCP = 5,
126 IWL_RATE_18M_PLCP = 7, 126 IL_RATE_18M_PLCP = 7,
127 IWL_RATE_24M_PLCP = 9, 127 IL_RATE_24M_PLCP = 9,
128 IWL_RATE_36M_PLCP = 11, 128 IL_RATE_36M_PLCP = 11,
129 IWL_RATE_48M_PLCP = 1, 129 IL_RATE_48M_PLCP = 1,
130 IWL_RATE_54M_PLCP = 3, 130 IL_RATE_54M_PLCP = 3,
131 IWL_RATE_60M_PLCP = 3,/*FIXME:RS:should be removed*/ 131 IL_RATE_60M_PLCP = 3,/*FIXME:RS:should be removed*/
132 IWL_RATE_1M_PLCP = 10, 132 IL_RATE_1M_PLCP = 10,
133 IWL_RATE_2M_PLCP = 20, 133 IL_RATE_2M_PLCP = 20,
134 IWL_RATE_5M_PLCP = 55, 134 IL_RATE_5M_PLCP = 55,
135 IWL_RATE_11M_PLCP = 110, 135 IL_RATE_11M_PLCP = 110,
136 /*FIXME:RS:add IWL_RATE_LEGACY_INVM_PLCP = 0,*/ 136 /*FIXME:RS:add IL_RATE_LEGACY_INVM_PLCP = 0,*/
137}; 137};
138 138
139/* uCode API values for OFDM high-throughput (HT) bit rates */ 139/* uCode API values for OFDM high-throughput (HT) bit rates */
140enum { 140enum {
141 IWL_RATE_SISO_6M_PLCP = 0, 141 IL_RATE_SISO_6M_PLCP = 0,
142 IWL_RATE_SISO_12M_PLCP = 1, 142 IL_RATE_SISO_12M_PLCP = 1,
143 IWL_RATE_SISO_18M_PLCP = 2, 143 IL_RATE_SISO_18M_PLCP = 2,
144 IWL_RATE_SISO_24M_PLCP = 3, 144 IL_RATE_SISO_24M_PLCP = 3,
145 IWL_RATE_SISO_36M_PLCP = 4, 145 IL_RATE_SISO_36M_PLCP = 4,
146 IWL_RATE_SISO_48M_PLCP = 5, 146 IL_RATE_SISO_48M_PLCP = 5,
147 IWL_RATE_SISO_54M_PLCP = 6, 147 IL_RATE_SISO_54M_PLCP = 6,
148 IWL_RATE_SISO_60M_PLCP = 7, 148 IL_RATE_SISO_60M_PLCP = 7,
149 IWL_RATE_MIMO2_6M_PLCP = 0x8, 149 IL_RATE_MIMO2_6M_PLCP = 0x8,
150 IWL_RATE_MIMO2_12M_PLCP = 0x9, 150 IL_RATE_MIMO2_12M_PLCP = 0x9,
151 IWL_RATE_MIMO2_18M_PLCP = 0xa, 151 IL_RATE_MIMO2_18M_PLCP = 0xa,
152 IWL_RATE_MIMO2_24M_PLCP = 0xb, 152 IL_RATE_MIMO2_24M_PLCP = 0xb,
153 IWL_RATE_MIMO2_36M_PLCP = 0xc, 153 IL_RATE_MIMO2_36M_PLCP = 0xc,
154 IWL_RATE_MIMO2_48M_PLCP = 0xd, 154 IL_RATE_MIMO2_48M_PLCP = 0xd,
155 IWL_RATE_MIMO2_54M_PLCP = 0xe, 155 IL_RATE_MIMO2_54M_PLCP = 0xe,
156 IWL_RATE_MIMO2_60M_PLCP = 0xf, 156 IL_RATE_MIMO2_60M_PLCP = 0xf,
157 IWL_RATE_SISO_INVM_PLCP, 157 IL_RATE_SISO_INVM_PLCP,
158 IWL_RATE_MIMO2_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP, 158 IL_RATE_MIMO2_INVM_PLCP = IL_RATE_SISO_INVM_PLCP,
159}; 159};
160 160
161/* MAC header values for bit rates */ 161/* MAC header values for bit rates */
162enum { 162enum {
163 IWL_RATE_6M_IEEE = 12, 163 IL_RATE_6M_IEEE = 12,
164 IWL_RATE_9M_IEEE = 18, 164 IL_RATE_9M_IEEE = 18,
165 IWL_RATE_12M_IEEE = 24, 165 IL_RATE_12M_IEEE = 24,
166 IWL_RATE_18M_IEEE = 36, 166 IL_RATE_18M_IEEE = 36,
167 IWL_RATE_24M_IEEE = 48, 167 IL_RATE_24M_IEEE = 48,
168 IWL_RATE_36M_IEEE = 72, 168 IL_RATE_36M_IEEE = 72,
169 IWL_RATE_48M_IEEE = 96, 169 IL_RATE_48M_IEEE = 96,
170 IWL_RATE_54M_IEEE = 108, 170 IL_RATE_54M_IEEE = 108,
171 IWL_RATE_60M_IEEE = 120, 171 IL_RATE_60M_IEEE = 120,
172 IWL_RATE_1M_IEEE = 2, 172 IL_RATE_1M_IEEE = 2,
173 IWL_RATE_2M_IEEE = 4, 173 IL_RATE_2M_IEEE = 4,
174 IWL_RATE_5M_IEEE = 11, 174 IL_RATE_5M_IEEE = 11,
175 IWL_RATE_11M_IEEE = 22, 175 IL_RATE_11M_IEEE = 22,
176}; 176};
177 177
178#define IWL_CCK_BASIC_RATES_MASK \ 178#define IL_CCK_BASIC_RATES_MASK \
179 (IWL_RATE_1M_MASK | \ 179 (IL_RATE_1M_MASK | \
180 IWL_RATE_2M_MASK) 180 IL_RATE_2M_MASK)
181 181
182#define IWL_CCK_RATES_MASK \ 182#define IL_CCK_RATES_MASK \
183 (IWL_CCK_BASIC_RATES_MASK | \ 183 (IL_CCK_BASIC_RATES_MASK | \
184 IWL_RATE_5M_MASK | \ 184 IL_RATE_5M_MASK | \
185 IWL_RATE_11M_MASK) 185 IL_RATE_11M_MASK)
186 186
187#define IWL_OFDM_BASIC_RATES_MASK \ 187#define IL_OFDM_BASIC_RATES_MASK \
188 (IWL_RATE_6M_MASK | \ 188 (IL_RATE_6M_MASK | \
189 IWL_RATE_12M_MASK | \ 189 IL_RATE_12M_MASK | \
190 IWL_RATE_24M_MASK) 190 IL_RATE_24M_MASK)
191 191
192#define IWL_OFDM_RATES_MASK \ 192#define IL_OFDM_RATES_MASK \
193 (IWL_OFDM_BASIC_RATES_MASK | \ 193 (IL_OFDM_BASIC_RATES_MASK | \
194 IWL_RATE_9M_MASK | \ 194 IL_RATE_9M_MASK | \
195 IWL_RATE_18M_MASK | \ 195 IL_RATE_18M_MASK | \
196 IWL_RATE_36M_MASK | \ 196 IL_RATE_36M_MASK | \
197 IWL_RATE_48M_MASK | \ 197 IL_RATE_48M_MASK | \
198 IWL_RATE_54M_MASK) 198 IL_RATE_54M_MASK)
199 199
200#define IWL_BASIC_RATES_MASK \ 200#define IL_BASIC_RATES_MASK \
201 (IWL_OFDM_BASIC_RATES_MASK | \ 201 (IL_OFDM_BASIC_RATES_MASK | \
202 IWL_CCK_BASIC_RATES_MASK) 202 IL_CCK_BASIC_RATES_MASK)
203 203
204#define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1) 204#define IL_RATES_MASK ((1 << IL_RATE_COUNT) - 1)
205#define IWL_RATES_MASK_3945 ((1 << IWL_RATE_COUNT_3945) - 1) 205#define IL_RATES_MASK_3945 ((1 << IL_RATE_COUNT_3945) - 1)
206 206
207#define IWL_INVALID_VALUE -1 207#define IL_INVALID_VALUE -1
208 208
209#define IWL_MIN_RSSI_VAL -100 209#define IL_MIN_RSSI_VAL -100
210#define IWL_MAX_RSSI_VAL 0 210#define IL_MAX_RSSI_VAL 0
211 211
212/* These values specify how many Tx frame attempts before 212/* These values specify how many Tx frame attempts before
213 * searching for a new modulation mode */ 213 * searching for a new modulation mode */
214#define IWL_LEGACY_FAILURE_LIMIT 160 214#define IL_LEGACY_FAILURE_LIMIT 160
215#define IWL_LEGACY_SUCCESS_LIMIT 480 215#define IL_LEGACY_SUCCESS_LIMIT 480
216#define IWL_LEGACY_TABLE_COUNT 160 216#define IL_LEGACY_TABLE_COUNT 160
217 217
218#define IWL_NONE_LEGACY_FAILURE_LIMIT 400 218#define IL_NONE_LEGACY_FAILURE_LIMIT 400
219#define IWL_NONE_LEGACY_SUCCESS_LIMIT 4500 219#define IL_NONE_LEGACY_SUCCESS_LIMIT 4500
220#define IWL_NONE_LEGACY_TABLE_COUNT 1500 220#define IL_NONE_LEGACY_TABLE_COUNT 1500
221 221
222/* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */ 222/* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */
223#define IWL_RS_GOOD_RATIO 12800 /* 100% */ 223#define IL_RS_GOOD_RATIO 12800 /* 100% */
224#define IWL_RATE_SCALE_SWITCH 10880 /* 85% */ 224#define IL_RATE_SCALE_SWITCH 10880 /* 85% */
225#define IWL_RATE_HIGH_TH 10880 /* 85% */ 225#define IL_RATE_HIGH_TH 10880 /* 85% */
226#define IWL_RATE_INCREASE_TH 6400 /* 50% */ 226#define IL_RATE_INCREASE_TH 6400 /* 50% */
227#define IWL_RATE_DECREASE_TH 1920 /* 15% */ 227#define IL_RATE_DECREASE_TH 1920 /* 15% */
228 228
229/* possible actions when in legacy mode */ 229/* possible actions when in legacy mode */
230#define IWL_LEGACY_SWITCH_ANTENNA1 0 230#define IL_LEGACY_SWITCH_ANTENNA1 0
231#define IWL_LEGACY_SWITCH_ANTENNA2 1 231#define IL_LEGACY_SWITCH_ANTENNA2 1
232#define IWL_LEGACY_SWITCH_SISO 2 232#define IL_LEGACY_SWITCH_SISO 2
233#define IWL_LEGACY_SWITCH_MIMO2_AB 3 233#define IL_LEGACY_SWITCH_MIMO2_AB 3
234#define IWL_LEGACY_SWITCH_MIMO2_AC 4 234#define IL_LEGACY_SWITCH_MIMO2_AC 4
235#define IWL_LEGACY_SWITCH_MIMO2_BC 5 235#define IL_LEGACY_SWITCH_MIMO2_BC 5
236 236
237/* possible actions when in siso mode */ 237/* possible actions when in siso mode */
238#define IWL_SISO_SWITCH_ANTENNA1 0 238#define IL_SISO_SWITCH_ANTENNA1 0
239#define IWL_SISO_SWITCH_ANTENNA2 1 239#define IL_SISO_SWITCH_ANTENNA2 1
240#define IWL_SISO_SWITCH_MIMO2_AB 2 240#define IL_SISO_SWITCH_MIMO2_AB 2
241#define IWL_SISO_SWITCH_MIMO2_AC 3 241#define IL_SISO_SWITCH_MIMO2_AC 3
242#define IWL_SISO_SWITCH_MIMO2_BC 4 242#define IL_SISO_SWITCH_MIMO2_BC 4
243#define IWL_SISO_SWITCH_GI 5 243#define IL_SISO_SWITCH_GI 5
244 244
245/* possible actions when in mimo mode */ 245/* possible actions when in mimo mode */
246#define IWL_MIMO2_SWITCH_ANTENNA1 0 246#define IL_MIMO2_SWITCH_ANTENNA1 0
247#define IWL_MIMO2_SWITCH_ANTENNA2 1 247#define IL_MIMO2_SWITCH_ANTENNA2 1
248#define IWL_MIMO2_SWITCH_SISO_A 2 248#define IL_MIMO2_SWITCH_SISO_A 2
249#define IWL_MIMO2_SWITCH_SISO_B 3 249#define IL_MIMO2_SWITCH_SISO_B 3
250#define IWL_MIMO2_SWITCH_SISO_C 4 250#define IL_MIMO2_SWITCH_SISO_C 4
251#define IWL_MIMO2_SWITCH_GI 5 251#define IL_MIMO2_SWITCH_GI 5
252 252
253#define IWL_MAX_SEARCH IWL_MIMO2_SWITCH_GI 253#define IL_MAX_SEARCH IL_MIMO2_SWITCH_GI
254 254
255#define IWL_ACTION_LIMIT 3 /* # possible actions */ 255#define IL_ACTION_LIMIT 3 /* # possible actions */
256 256
257#define LQ_SIZE 2 /* 2 mode tables: "Active" and "Search" */ 257#define LQ_SIZE 2 /* 2 mode tables: "Active" and "Search" */
258 258
259/* load per tid defines for A-MPDU activation */ 259/* load per tid defines for A-MPDU activation */
260#define IWL_AGG_TPT_THREHOLD 0 260#define IL_AGG_TPT_THREHOLD 0
261#define IWL_AGG_LOAD_THRESHOLD 10 261#define IL_AGG_LOAD_THRESHOLD 10
262#define IWL_AGG_ALL_TID 0xff 262#define IL_AGG_ALL_TID 0xff
263#define TID_QUEUE_CELL_SPACING 50 /*mS */ 263#define TID_QUEUE_CELL_SPACING 50 /*mS */
264#define TID_QUEUE_MAX_SIZE 20 264#define TID_QUEUE_MAX_SIZE 20
265#define TID_ROUND_VALUE 5 /* mS */ 265#define TID_ROUND_VALUE 5 /* mS */
@@ -268,9 +268,9 @@ enum {
268#define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING) 268#define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING)
269#define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y)) 269#define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y))
270 270
271extern const struct iwl_rate_info iwlegacy_rates[IWL_RATE_COUNT]; 271extern const struct il_rate_info iwlegacy_rates[IL_RATE_COUNT];
272 272
273enum iwl_table_type { 273enum il_table_type {
274 LQ_NONE, 274 LQ_NONE,
275 LQ_G, /* legacy types */ 275 LQ_G, /* legacy types */
276 LQ_A, 276 LQ_A,
@@ -296,17 +296,17 @@ enum iwl_table_type {
296#define ANT_BC (ANT_B | ANT_C) 296#define ANT_BC (ANT_B | ANT_C)
297#define ANT_ABC (ANT_AB | ANT_C) 297#define ANT_ABC (ANT_AB | ANT_C)
298 298
299#define IWL_MAX_MCS_DISPLAY_SIZE 12 299#define IL_MAX_MCS_DISPLAY_SIZE 12
300 300
301struct iwl_rate_mcs_info { 301struct il_rate_mcs_info {
302 char mbps[IWL_MAX_MCS_DISPLAY_SIZE]; 302 char mbps[IL_MAX_MCS_DISPLAY_SIZE];
303 char mcs[IWL_MAX_MCS_DISPLAY_SIZE]; 303 char mcs[IL_MAX_MCS_DISPLAY_SIZE];
304}; 304};
305 305
306/** 306/**
307 * struct iwl_rate_scale_data -- tx success history for one rate 307 * struct il_rate_scale_data -- tx success history for one rate
308 */ 308 */
309struct iwl_rate_scale_data { 309struct il_rate_scale_data {
310 u64 data; /* bitmap of successful frames */ 310 u64 data; /* bitmap of successful frames */
311 s32 success_counter; /* number of frames successful */ 311 s32 success_counter; /* number of frames successful */
312 s32 success_ratio; /* per-cent * 128 */ 312 s32 success_ratio; /* per-cent * 128 */
@@ -316,25 +316,25 @@ struct iwl_rate_scale_data {
316}; 316};
317 317
318/** 318/**
319 * struct iwl_scale_tbl_info -- tx params and success history for all rates 319 * struct il_scale_tbl_info -- tx params and success history for all rates
320 * 320 *
321 * There are two of these in struct iwl_lq_sta, 321 * There are two of these in struct il_lq_sta,
322 * one for "active", and one for "search". 322 * one for "active", and one for "search".
323 */ 323 */
324struct iwl_scale_tbl_info { 324struct il_scale_tbl_info {
325 enum iwl_table_type lq_type; 325 enum il_table_type lq_type;
326 u8 ant_type; 326 u8 ant_type;
327 u8 is_SGI; /* 1 = short guard interval */ 327 u8 is_SGI; /* 1 = short guard interval */
328 u8 is_ht40; /* 1 = 40 MHz channel width */ 328 u8 is_ht40; /* 1 = 40 MHz channel width */
329 u8 is_dup; /* 1 = duplicated data streams */ 329 u8 is_dup; /* 1 = duplicated data streams */
330 u8 action; /* change modulation; IWL_[LEGACY/SISO/MIMO]_SWITCH_* */ 330 u8 action; /* change modulation; IL_[LEGACY/SISO/MIMO]_SWITCH_* */
331 u8 max_search; /* maximun number of tables we can search */ 331 u8 max_search; /* maximun number of tables we can search */
332 s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ 332 s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */
333 u32 current_rate; /* rate_n_flags, uCode API format */ 333 u32 current_rate; /* rate_n_flags, uCode API format */
334 struct iwl_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ 334 struct il_rate_scale_data win[IL_RATE_COUNT]; /* rate histories */
335}; 335};
336 336
337struct iwl_traffic_load { 337struct il_traffic_load {
338 unsigned long time_stamp; /* age of the oldest statistics */ 338 unsigned long time_stamp; /* age of the oldest statistics */
339 u32 packet_count[TID_QUEUE_MAX_SIZE]; /* packet count in this time 339 u32 packet_count[TID_QUEUE_MAX_SIZE]; /* packet count in this time
340 * slice */ 340 * slice */
@@ -346,11 +346,11 @@ struct iwl_traffic_load {
346}; 346};
347 347
348/** 348/**
349 * struct iwl_lq_sta -- driver's rate scaling private structure 349 * struct il_lq_sta -- driver's rate scaling private structure
350 * 350 *
351 * Pointer to this gets passed back and forth between driver and mac80211. 351 * Pointer to this gets passed back and forth between driver and mac80211.
352 */ 352 */
353struct iwl_lq_sta { 353struct il_lq_sta {
354 u8 active_tbl; /* index of active table, range 0-1 */ 354 u8 active_tbl; /* index of active table, range 0-1 */
355 u8 enable_counter; /* indicates HT mode */ 355 u8 enable_counter; /* indicates HT mode */
356 u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */ 356 u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */
@@ -371,7 +371,7 @@ struct iwl_lq_sta {
371 u8 is_dup; 371 u8 is_dup;
372 enum ieee80211_band band; 372 enum ieee80211_band band;
373 373
374 /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ 374 /* The following are bitmaps of rates; IL_RATE_6M_MASK, etc. */
375 u32 supp_rates; 375 u32 supp_rates;
376 u16 active_legacy_rate; 376 u16 active_legacy_rate;
377 u16 active_siso_rate; 377 u16 active_siso_rate;
@@ -379,9 +379,9 @@ struct iwl_lq_sta {
379 s8 max_rate_idx; /* Max rate set by user */ 379 s8 max_rate_idx; /* Max rate set by user */
380 u8 missed_rate_counter; 380 u8 missed_rate_counter;
381 381
382 struct iwl_link_quality_cmd lq; 382 struct il_link_quality_cmd lq;
383 struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ 383 struct il_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */
384 struct iwl_traffic_load load[TID_MAX_LOAD_COUNT]; 384 struct il_traffic_load load[TID_MAX_LOAD_COUNT];
385 u8 tx_agg_tid_en; 385 u8 tx_agg_tid_en;
386#ifdef CONFIG_MAC80211_DEBUGFS 386#ifdef CONFIG_MAC80211_DEBUGFS
387 struct dentry *rs_sta_dbgfs_scale_table_file; 387 struct dentry *rs_sta_dbgfs_scale_table_file;
@@ -390,7 +390,7 @@ struct iwl_lq_sta {
390 struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; 390 struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file;
391 u32 dbg_fixed_rate; 391 u32 dbg_fixed_rate;
392#endif 392#endif
393 struct iwl_priv *drv; 393 struct il_priv *drv;
394 394
395 /* used to be in sta_info */ 395 /* used to be in sta_info */
396 int last_txrate_idx; 396 int last_txrate_idx;
@@ -400,14 +400,14 @@ struct iwl_lq_sta {
400 u8 is_agg; 400 u8 is_agg;
401}; 401};
402 402
403static inline u8 iwl4965_num_of_ant(u8 mask) 403static inline u8 il4965_num_of_ant(u8 mask)
404{ 404{
405 return !!((mask) & ANT_A) + 405 return !!((mask) & ANT_A) +
406 !!((mask) & ANT_B) + 406 !!((mask) & ANT_B) +
407 !!((mask) & ANT_C); 407 !!((mask) & ANT_C);
408} 408}
409 409
410static inline u8 iwl4965_first_antenna(u8 mask) 410static inline u8 il4965_first_antenna(u8 mask)
411{ 411{
412 if (mask & ANT_A) 412 if (mask & ANT_A)
413 return ANT_A; 413 return ANT_A;
@@ -418,39 +418,39 @@ static inline u8 iwl4965_first_antenna(u8 mask)
418 418
419 419
420/** 420/**
421 * iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info 421 * il3945_rate_scale_init - Initialize the rate scale table based on assoc info
422 * 422 *
423 * The specific throughput table used is based on the type of network 423 * The specific throughput table used is based on the type of network
424 * the associated with, including A, B, G, and G w/ TGG protection 424 * the associated with, including A, B, G, and G w/ TGG protection
425 */ 425 */
426extern void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); 426extern void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
427 427
428/* Initialize station's rate scaling information after adding station */ 428/* Initialize station's rate scaling information after adding station */
429extern void iwl4965_rs_rate_init(struct iwl_priv *priv, 429extern void il4965_rs_rate_init(struct il_priv *priv,
430 struct ieee80211_sta *sta, u8 sta_id); 430 struct ieee80211_sta *sta, u8 sta_id);
431extern void iwl3945_rs_rate_init(struct iwl_priv *priv, 431extern void il3945_rs_rate_init(struct il_priv *priv,
432 struct ieee80211_sta *sta, u8 sta_id); 432 struct ieee80211_sta *sta, u8 sta_id);
433 433
434/** 434/**
435 * iwl_rate_control_register - Register the rate control algorithm callbacks 435 * il_rate_control_register - Register the rate control algorithm callbacks
436 * 436 *
437 * Since the rate control algorithm is hardware specific, there is no need 437 * Since the rate control algorithm is hardware specific, there is no need
438 * or reason to place it as a stand alone module. The driver can call 438 * or reason to place it as a stand alone module. The driver can call
439 * iwl_rate_control_register in order to register the rate control callbacks 439 * il_rate_control_register in order to register the rate control callbacks
440 * with the mac80211 subsystem. This should be performed prior to calling 440 * with the mac80211 subsystem. This should be performed prior to calling
441 * ieee80211_register_hw 441 * ieee80211_register_hw
442 * 442 *
443 */ 443 */
444extern int iwl4965_rate_control_register(void); 444extern int il4965_rate_control_register(void);
445extern int iwl3945_rate_control_register(void); 445extern int il3945_rate_control_register(void);
446 446
447/** 447/**
448 * iwl_rate_control_unregister - Unregister the rate control callbacks 448 * il_rate_control_unregister - Unregister the rate control callbacks
449 * 449 *
450 * This should be called after calling ieee80211_unregister_hw, but before 450 * This should be called after calling ieee80211_unregister_hw, but before
451 * the driver is unloaded. 451 * the driver is unloaded.
452 */ 452 */
453extern void iwl4965_rate_control_unregister(void); 453extern void il4965_rate_control_unregister(void);
454extern void iwl3945_rate_control_unregister(void); 454extern void il3945_rate_control_unregister(void);
455 455
456#endif /* __iwl_legacy_rs__ */ 456#endif /* __il_rs__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-power.c b/drivers/net/wireless/iwlegacy/iwl-power.c
index 903ef0d6d6cb..7ccff257736e 100644
--- a/drivers/net/wireless/iwlegacy/iwl-power.c
+++ b/drivers/net/wireless/iwlegacy/iwl-power.c
@@ -55,32 +55,32 @@
55 * (level 1) and for thermal throttle (levels 3 through 5) 55 * (level 1) and for thermal throttle (levels 3 through 5)
56 */ 56 */
57 57
58struct iwl_power_vec_entry { 58struct il_power_vec_entry {
59 struct iwl_powertable_cmd cmd; 59 struct il_powertable_cmd cmd;
60 u8 no_dtim; /* number of skip dtim */ 60 u8 no_dtim; /* number of skip dtim */
61}; 61};
62 62
63static void iwl_legacy_power_sleep_cam_cmd(struct iwl_priv *priv, 63static void il_power_sleep_cam_cmd(struct il_priv *priv,
64 struct iwl_powertable_cmd *cmd) 64 struct il_powertable_cmd *cmd)
65{ 65{
66 memset(cmd, 0, sizeof(*cmd)); 66 memset(cmd, 0, sizeof(*cmd));
67 67
68 if (priv->power_data.pci_pm) 68 if (priv->power_data.pci_pm)
69 cmd->flags |= IWL_POWER_PCI_PM_MSK; 69 cmd->flags |= IL_POWER_PCI_PM_MSK;
70 70
71 IWL_DEBUG_POWER(priv, "Sleep command for CAM\n"); 71 IL_DEBUG_POWER(priv, "Sleep command for CAM\n");
72} 72}
73 73
74static int 74static int
75iwl_legacy_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd) 75il_set_power(struct il_priv *priv, struct il_powertable_cmd *cmd)
76{ 76{
77 IWL_DEBUG_POWER(priv, "Sending power/sleep command\n"); 77 IL_DEBUG_POWER(priv, "Sending power/sleep command\n");
78 IWL_DEBUG_POWER(priv, "Flags value = 0x%08X\n", cmd->flags); 78 IL_DEBUG_POWER(priv, "Flags value = 0x%08X\n", cmd->flags);
79 IWL_DEBUG_POWER(priv, "Tx timeout = %u\n", 79 IL_DEBUG_POWER(priv, "Tx timeout = %u\n",
80 le32_to_cpu(cmd->tx_data_timeout)); 80 le32_to_cpu(cmd->tx_data_timeout));
81 IWL_DEBUG_POWER(priv, "Rx timeout = %u\n", 81 IL_DEBUG_POWER(priv, "Rx timeout = %u\n",
82 le32_to_cpu(cmd->rx_data_timeout)); 82 le32_to_cpu(cmd->rx_data_timeout));
83 IWL_DEBUG_POWER(priv, 83 IL_DEBUG_POWER(priv,
84 "Sleep interval vector = { %d , %d , %d , %d , %d }\n", 84 "Sleep interval vector = { %d , %d , %d , %d , %d }\n",
85 le32_to_cpu(cmd->sleep_interval[0]), 85 le32_to_cpu(cmd->sleep_interval[0]),
86 le32_to_cpu(cmd->sleep_interval[1]), 86 le32_to_cpu(cmd->sleep_interval[1]),
@@ -88,12 +88,12 @@ iwl_legacy_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd)
88 le32_to_cpu(cmd->sleep_interval[3]), 88 le32_to_cpu(cmd->sleep_interval[3]),
89 le32_to_cpu(cmd->sleep_interval[4])); 89 le32_to_cpu(cmd->sleep_interval[4]));
90 90
91 return iwl_legacy_send_cmd_pdu(priv, POWER_TABLE_CMD, 91 return il_send_cmd_pdu(priv, POWER_TABLE_CMD,
92 sizeof(struct iwl_powertable_cmd), cmd); 92 sizeof(struct il_powertable_cmd), cmd);
93} 93}
94 94
95int 95int
96iwl_legacy_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, 96il_power_set_mode(struct il_priv *priv, struct il_powertable_cmd *cmd,
97 bool force) 97 bool force)
98{ 98{
99 int ret; 99 int ret;
@@ -102,58 +102,58 @@ iwl_legacy_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd,
102 lockdep_assert_held(&priv->mutex); 102 lockdep_assert_held(&priv->mutex);
103 103
104 /* Don't update the RX chain when chain noise calibration is running */ 104 /* Don't update the RX chain when chain noise calibration is running */
105 update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || 105 update_chains = priv->chain_noise_data.state == IL_CHAIN_NOISE_DONE ||
106 priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE; 106 priv->chain_noise_data.state == IL_CHAIN_NOISE_ALIVE;
107 107
108 if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force) 108 if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force)
109 return 0; 109 return 0;
110 110
111 if (!iwl_legacy_is_ready_rf(priv)) 111 if (!il_is_ready_rf(priv))
112 return -EIO; 112 return -EIO;
113 113
114 /* scan complete use sleep_power_next, need to be updated */ 114 /* scan complete use sleep_power_next, need to be updated */
115 memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd)); 115 memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd));
116 if (test_bit(STATUS_SCANNING, &priv->status) && !force) { 116 if (test_bit(STATUS_SCANNING, &priv->status) && !force) {
117 IWL_DEBUG_INFO(priv, "Defer power set mode while scanning\n"); 117 IL_DEBUG_INFO(priv, "Defer power set mode while scanning\n");
118 return 0; 118 return 0;
119 } 119 }
120 120
121 if (cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK) 121 if (cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK)
122 set_bit(STATUS_POWER_PMI, &priv->status); 122 set_bit(STATUS_POWER_PMI, &priv->status);
123 123
124 ret = iwl_legacy_set_power(priv, cmd); 124 ret = il_set_power(priv, cmd);
125 if (!ret) { 125 if (!ret) {
126 if (!(cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK)) 126 if (!(cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK))
127 clear_bit(STATUS_POWER_PMI, &priv->status); 127 clear_bit(STATUS_POWER_PMI, &priv->status);
128 128
129 if (priv->cfg->ops->lib->update_chain_flags && update_chains) 129 if (priv->cfg->ops->lib->update_chain_flags && update_chains)
130 priv->cfg->ops->lib->update_chain_flags(priv); 130 priv->cfg->ops->lib->update_chain_flags(priv);
131 else if (priv->cfg->ops->lib->update_chain_flags) 131 else if (priv->cfg->ops->lib->update_chain_flags)
132 IWL_DEBUG_POWER(priv, 132 IL_DEBUG_POWER(priv,
133 "Cannot update the power, chain noise " 133 "Cannot update the power, chain noise "
134 "calibration running: %d\n", 134 "calibration running: %d\n",
135 priv->chain_noise_data.state); 135 priv->chain_noise_data.state);
136 136
137 memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)); 137 memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd));
138 } else 138 } else
139 IWL_ERR(priv, "set power fail, ret = %d", ret); 139 IL_ERR(priv, "set power fail, ret = %d", ret);
140 140
141 return ret; 141 return ret;
142} 142}
143 143
144int iwl_legacy_power_update_mode(struct iwl_priv *priv, bool force) 144int il_power_update_mode(struct il_priv *priv, bool force)
145{ 145{
146 struct iwl_powertable_cmd cmd; 146 struct il_powertable_cmd cmd;
147 147
148 iwl_legacy_power_sleep_cam_cmd(priv, &cmd); 148 il_power_sleep_cam_cmd(priv, &cmd);
149 return iwl_legacy_power_set_mode(priv, &cmd, force); 149 return il_power_set_mode(priv, &cmd, force);
150} 150}
151EXPORT_SYMBOL(iwl_legacy_power_update_mode); 151EXPORT_SYMBOL(il_power_update_mode);
152 152
153/* initialize to default */ 153/* initialize to default */
154void iwl_legacy_power_initialize(struct iwl_priv *priv) 154void il_power_initialize(struct il_priv *priv)
155{ 155{
156 u16 lctl = iwl_legacy_pcie_link_ctl(priv); 156 u16 lctl = il_pcie_link_ctl(priv);
157 157
158 priv->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN); 158 priv->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN);
159 159
@@ -162,4 +162,4 @@ void iwl_legacy_power_initialize(struct iwl_priv *priv)
162 memset(&priv->power_data.sleep_cmd, 0, 162 memset(&priv->power_data.sleep_cmd, 0,
163 sizeof(priv->power_data.sleep_cmd)); 163 sizeof(priv->power_data.sleep_cmd));
164} 164}
165EXPORT_SYMBOL(iwl_legacy_power_initialize); 165EXPORT_SYMBOL(il_power_initialize);
diff --git a/drivers/net/wireless/iwlegacy/iwl-power.h b/drivers/net/wireless/iwlegacy/iwl-power.h
index d30b36acdc4a..dba4ca9d30eb 100644
--- a/drivers/net/wireless/iwlegacy/iwl-power.h
+++ b/drivers/net/wireless/iwlegacy/iwl-power.h
@@ -25,31 +25,31 @@
25 * Intel Linux Wireless <ilw@linux.intel.com> 25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/ 27 *****************************************************************************/
28#ifndef __iwl_legacy_power_setting_h__ 28#ifndef __il_power_setting_h__
29#define __iwl_legacy_power_setting_h__ 29#define __il_power_setting_h__
30 30
31#include "iwl-commands.h" 31#include "iwl-commands.h"
32 32
33enum iwl_power_level { 33enum il_power_level {
34 IWL_POWER_INDEX_1, 34 IL_POWER_INDEX_1,
35 IWL_POWER_INDEX_2, 35 IL_POWER_INDEX_2,
36 IWL_POWER_INDEX_3, 36 IL_POWER_INDEX_3,
37 IWL_POWER_INDEX_4, 37 IL_POWER_INDEX_4,
38 IWL_POWER_INDEX_5, 38 IL_POWER_INDEX_5,
39 IWL_POWER_NUM 39 IL_POWER_NUM
40}; 40};
41 41
42struct iwl_power_mgr { 42struct il_power_mgr {
43 struct iwl_powertable_cmd sleep_cmd; 43 struct il_powertable_cmd sleep_cmd;
44 struct iwl_powertable_cmd sleep_cmd_next; 44 struct il_powertable_cmd sleep_cmd_next;
45 int debug_sleep_level_override; 45 int debug_sleep_level_override;
46 bool pci_pm; 46 bool pci_pm;
47}; 47};
48 48
49int 49int
50iwl_legacy_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, 50il_power_set_mode(struct il_priv *priv, struct il_powertable_cmd *cmd,
51 bool force); 51 bool force);
52int iwl_legacy_power_update_mode(struct iwl_priv *priv, bool force); 52int il_power_update_mode(struct il_priv *priv, bool force);
53void iwl_legacy_power_initialize(struct iwl_priv *priv); 53void il_power_initialize(struct il_priv *priv);
54 54
55#endif /* __iwl_legacy_power_setting_h__ */ 55#endif /* __il_power_setting_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-prph.h b/drivers/net/wireless/iwlegacy/iwl-prph.h
index 30a493003ab0..96788a128a61 100644
--- a/drivers/net/wireless/iwlegacy/iwl-prph.h
+++ b/drivers/net/wireless/iwlegacy/iwl-prph.h
@@ -60,8 +60,8 @@
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *****************************************************************************/ 61 *****************************************************************************/
62 62
63#ifndef __iwl_legacy_prph_h__ 63#ifndef __il_prph_h__
64#define __iwl_legacy_prph_h__ 64#define __il_prph_h__
65 65
66/* 66/*
67 * Registers in this file are internal, not PCI bus memory mapped. 67 * Registers in this file are internal, not PCI bus memory mapped.
@@ -120,13 +120,13 @@
120 * 120 *
121 * 1) Initialization -- performs hardware calibration and sets up some 121 * 1) Initialization -- performs hardware calibration and sets up some
122 * internal data, then notifies host via "initialize alive" notification 122 * internal data, then notifies host via "initialize alive" notification
123 * (struct iwl_init_alive_resp) that it has completed all of its work. 123 * (struct il_init_alive_resp) that it has completed all of its work.
124 * After signal from host, it then loads and starts the runtime program. 124 * After signal from host, it then loads and starts the runtime program.
125 * The initialization program must be used when initially setting up the 125 * The initialization program must be used when initially setting up the
126 * NIC after loading the driver. 126 * NIC after loading the driver.
127 * 127 *
128 * 2) Runtime/Protocol -- performs all normal runtime operations. This 128 * 2) Runtime/Protocol -- performs all normal runtime operations. This
129 * notifies host via "alive" notification (struct iwl_alive_resp) that it 129 * notifies host via "alive" notification (struct il_alive_resp) that it
130 * is ready to be used. 130 * is ready to be used.
131 * 131 *
132 * When initializing the NIC, the host driver does the following procedure: 132 * When initializing the NIC, the host driver does the following procedure:
@@ -287,7 +287,7 @@
287 * Tx completion may end up being out-of-order). 287 * Tx completion may end up being out-of-order).
288 * 288 *
289 * The driver must maintain the queue's Byte Count table in host DRAM 289 * The driver must maintain the queue's Byte Count table in host DRAM
290 * (struct iwl4965_sched_queue_byte_cnt_tbl) for this mode. 290 * (struct il4965_sched_queue_byte_cnt_tbl) for this mode.
291 * This mode does not support fragmentation. 291 * This mode does not support fragmentation.
292 * 292 *
293 * 2) FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order. 293 * 2) FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order.
@@ -514,10 +514,10 @@
514#define IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ 514#define IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \
515 ((IWL49_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc) 515 ((IWL49_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc)
516 516
517#define IWL_SCD_TXFIFO_POS_TID (0) 517#define IL_SCD_TXFIFO_POS_TID (0)
518#define IWL_SCD_TXFIFO_POS_RA (4) 518#define IL_SCD_TXFIFO_POS_RA (4)
519#define IWL_SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) 519#define IL_SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF)
520 520
521/*********************** END TX SCHEDULER *************************************/ 521/*********************** END TX SCHEDULER *************************************/
522 522
523#endif /* __iwl_legacy_prph_h__ */ 523#endif /* __il_prph_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c
index 9b5d0abe8be9..9a2714c7f3e8 100644
--- a/drivers/net/wireless/iwlegacy/iwl-rx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-rx.c
@@ -73,7 +73,7 @@
73 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When 73 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When
74 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled 74 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled
75 * to replenish the iwl->rxq->rx_free. 75 * to replenish the iwl->rxq->rx_free.
76 * + In iwl_rx_replenish (scheduled) if 'processed' != 'read' then the 76 * + In il_rx_replenish (scheduled) if 'processed' != 'read' then the
77 * iwl->rxq is replenished and the READ INDEX is updated (updating the 77 * iwl->rxq is replenished and the READ INDEX is updated (updating the
78 * 'processed' and 'read' driver indexes as well) 78 * 'processed' and 'read' driver indexes as well)
79 * + A received packet is processed and handed to the kernel network stack, 79 * + A received packet is processed and handed to the kernel network stack,
@@ -86,28 +86,28 @@
86 * 86 *
87 * Driver sequence: 87 * Driver sequence:
88 * 88 *
89 * iwl_legacy_rx_queue_alloc() Allocates rx_free 89 * il_rx_queue_alloc() Allocates rx_free
90 * iwl_rx_replenish() Replenishes rx_free list from rx_used, and calls 90 * il_rx_replenish() Replenishes rx_free list from rx_used, and calls
91 * iwl_rx_queue_restock 91 * il_rx_queue_restock
92 * iwl_rx_queue_restock() Moves available buffers from rx_free into Rx 92 * il_rx_queue_restock() Moves available buffers from rx_free into Rx
93 * queue, updates firmware pointers, and updates 93 * queue, updates firmware pointers, and updates
94 * the WRITE index. If insufficient rx_free buffers 94 * the WRITE index. If insufficient rx_free buffers
95 * are available, schedules iwl_rx_replenish 95 * are available, schedules il_rx_replenish
96 * 96 *
97 * -- enable interrupts -- 97 * -- enable interrupts --
98 * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the 98 * ISR - il_rx() Detach il_rx_mem_buffers from pool up to the
99 * READ INDEX, detaching the SKB from the pool. 99 * READ INDEX, detaching the SKB from the pool.
100 * Moves the packet buffer from queue to rx_used. 100 * Moves the packet buffer from queue to rx_used.
101 * Calls iwl_rx_queue_restock to refill any empty 101 * Calls il_rx_queue_restock to refill any empty
102 * slots. 102 * slots.
103 * ... 103 * ...
104 * 104 *
105 */ 105 */
106 106
107/** 107/**
108 * iwl_legacy_rx_queue_space - Return number of free slots available in queue. 108 * il_rx_queue_space - Return number of free slots available in queue.
109 */ 109 */
110int iwl_legacy_rx_queue_space(const struct iwl_rx_queue *q) 110int il_rx_queue_space(const struct il_rx_queue *q)
111{ 111{
112 int s = q->read - q->write; 112 int s = q->read - q->write;
113 if (s <= 0) 113 if (s <= 0)
@@ -118,14 +118,14 @@ int iwl_legacy_rx_queue_space(const struct iwl_rx_queue *q)
118 s = 0; 118 s = 0;
119 return s; 119 return s;
120} 120}
121EXPORT_SYMBOL(iwl_legacy_rx_queue_space); 121EXPORT_SYMBOL(il_rx_queue_space);
122 122
123/** 123/**
124 * iwl_legacy_rx_queue_update_write_ptr - Update the write pointer for the RX queue 124 * il_rx_queue_update_write_ptr - Update the write pointer for the RX queue
125 */ 125 */
126void 126void
127iwl_legacy_rx_queue_update_write_ptr(struct iwl_priv *priv, 127il_rx_queue_update_write_ptr(struct il_priv *priv,
128 struct iwl_rx_queue *q) 128 struct il_rx_queue *q)
129{ 129{
130 unsigned long flags; 130 unsigned long flags;
131 u32 rx_wrt_ptr_reg = priv->hw_params.rx_wrt_ptr_reg; 131 u32 rx_wrt_ptr_reg = priv->hw_params.rx_wrt_ptr_reg;
@@ -138,26 +138,26 @@ iwl_legacy_rx_queue_update_write_ptr(struct iwl_priv *priv,
138 138
139 /* If power-saving is in use, make sure device is awake */ 139 /* If power-saving is in use, make sure device is awake */
140 if (test_bit(STATUS_POWER_PMI, &priv->status)) { 140 if (test_bit(STATUS_POWER_PMI, &priv->status)) {
141 reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); 141 reg = il_read32(priv, CSR_UCODE_DRV_GP1);
142 142
143 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { 143 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
144 IWL_DEBUG_INFO(priv, 144 IL_DEBUG_INFO(priv,
145 "Rx queue requesting wakeup," 145 "Rx queue requesting wakeup,"
146 " GP1 = 0x%x\n", reg); 146 " GP1 = 0x%x\n", reg);
147 iwl_legacy_set_bit(priv, CSR_GP_CNTRL, 147 il_set_bit(priv, CSR_GP_CNTRL,
148 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 148 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
149 goto exit_unlock; 149 goto exit_unlock;
150 } 150 }
151 151
152 q->write_actual = (q->write & ~0x7); 152 q->write_actual = (q->write & ~0x7);
153 iwl_legacy_write_direct32(priv, rx_wrt_ptr_reg, 153 il_write_direct32(priv, rx_wrt_ptr_reg,
154 q->write_actual); 154 q->write_actual);
155 155
156 /* Else device is assumed to be awake */ 156 /* Else device is assumed to be awake */
157 } else { 157 } else {
158 /* Device expects a multiple of 8 */ 158 /* Device expects a multiple of 8 */
159 q->write_actual = (q->write & ~0x7); 159 q->write_actual = (q->write & ~0x7);
160 iwl_legacy_write_direct32(priv, rx_wrt_ptr_reg, 160 il_write_direct32(priv, rx_wrt_ptr_reg,
161 q->write_actual); 161 q->write_actual);
162 } 162 }
163 163
@@ -166,11 +166,11 @@ iwl_legacy_rx_queue_update_write_ptr(struct iwl_priv *priv,
166 exit_unlock: 166 exit_unlock:
167 spin_unlock_irqrestore(&q->lock, flags); 167 spin_unlock_irqrestore(&q->lock, flags);
168} 168}
169EXPORT_SYMBOL(iwl_legacy_rx_queue_update_write_ptr); 169EXPORT_SYMBOL(il_rx_queue_update_write_ptr);
170 170
171int iwl_legacy_rx_queue_alloc(struct iwl_priv *priv) 171int il_rx_queue_alloc(struct il_priv *priv)
172{ 172{
173 struct iwl_rx_queue *rxq = &priv->rxq; 173 struct il_rx_queue *rxq = &priv->rxq;
174 struct device *dev = &priv->pci_dev->dev; 174 struct device *dev = &priv->pci_dev->dev;
175 int i; 175 int i;
176 176
@@ -184,7 +184,7 @@ int iwl_legacy_rx_queue_alloc(struct iwl_priv *priv)
184 if (!rxq->bd) 184 if (!rxq->bd)
185 goto err_bd; 185 goto err_bd;
186 186
187 rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct iwl_rb_status), 187 rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct il_rb_status),
188 &rxq->rb_stts_dma, GFP_KERNEL); 188 &rxq->rb_stts_dma, GFP_KERNEL);
189 if (!rxq->rb_stts) 189 if (!rxq->rb_stts)
190 goto err_rb; 190 goto err_rb;
@@ -207,17 +207,17 @@ err_rb:
207err_bd: 207err_bd:
208 return -ENOMEM; 208 return -ENOMEM;
209} 209}
210EXPORT_SYMBOL(iwl_legacy_rx_queue_alloc); 210EXPORT_SYMBOL(il_rx_queue_alloc);
211 211
212 212
213void iwl_legacy_rx_spectrum_measure_notif(struct iwl_priv *priv, 213void il_rx_spectrum_measure_notif(struct il_priv *priv,
214 struct iwl_rx_mem_buffer *rxb) 214 struct il_rx_mem_buffer *rxb)
215{ 215{
216 struct iwl_rx_packet *pkt = rxb_addr(rxb); 216 struct il_rx_packet *pkt = rxb_addr(rxb);
217 struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); 217 struct il_spectrum_notification *report = &(pkt->u.spectrum_notif);
218 218
219 if (!report->state) { 219 if (!report->state) {
220 IWL_DEBUG_11H(priv, 220 IL_DEBUG_11H(priv,
221 "Spectrum Measure Notification: Start\n"); 221 "Spectrum Measure Notification: Start\n");
222 return; 222 return;
223 } 223 }
@@ -225,12 +225,12 @@ void iwl_legacy_rx_spectrum_measure_notif(struct iwl_priv *priv,
225 memcpy(&priv->measure_report, report, sizeof(*report)); 225 memcpy(&priv->measure_report, report, sizeof(*report));
226 priv->measurement_status |= MEASUREMENT_READY; 226 priv->measurement_status |= MEASUREMENT_READY;
227} 227}
228EXPORT_SYMBOL(iwl_legacy_rx_spectrum_measure_notif); 228EXPORT_SYMBOL(il_rx_spectrum_measure_notif);
229 229
230/* 230/*
231 * returns non-zero if packet should be dropped 231 * returns non-zero if packet should be dropped
232 */ 232 */
233int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv, 233int il_set_decrypted_flag(struct il_priv *priv,
234 struct ieee80211_hdr *hdr, 234 struct ieee80211_hdr *hdr,
235 u32 decrypt_res, 235 u32 decrypt_res,
236 struct ieee80211_rx_status *stats) 236 struct ieee80211_rx_status *stats)
@@ -241,14 +241,14 @@ int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv,
241 * All contexts have the same setting here due to it being 241 * All contexts have the same setting here due to it being
242 * a module parameter, so OK to check any context. 242 * a module parameter, so OK to check any context.
243 */ 243 */
244 if (priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags & 244 if (priv->contexts[IL_RXON_CTX_BSS].active.filter_flags &
245 RXON_FILTER_DIS_DECRYPT_MSK) 245 RXON_FILTER_DIS_DECRYPT_MSK)
246 return 0; 246 return 0;
247 247
248 if (!(fc & IEEE80211_FCTL_PROTECTED)) 248 if (!(fc & IEEE80211_FCTL_PROTECTED))
249 return 0; 249 return 0;
250 250
251 IWL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res); 251 IL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res);
252 switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { 252 switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) {
253 case RX_RES_STATUS_SEC_TYPE_TKIP: 253 case RX_RES_STATUS_SEC_TYPE_TKIP:
254 /* The uCode has got a bad phase 1 Key, pushes the packet. 254 /* The uCode has got a bad phase 1 Key, pushes the packet.
@@ -262,13 +262,13 @@ int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv,
262 RX_RES_STATUS_BAD_ICV_MIC) { 262 RX_RES_STATUS_BAD_ICV_MIC) {
263 /* bad ICV, the packet is destroyed since the 263 /* bad ICV, the packet is destroyed since the
264 * decryption is inplace, drop it */ 264 * decryption is inplace, drop it */
265 IWL_DEBUG_RX(priv, "Packet destroyed\n"); 265 IL_DEBUG_RX(priv, "Packet destroyed\n");
266 return -1; 266 return -1;
267 } 267 }
268 case RX_RES_STATUS_SEC_TYPE_CCMP: 268 case RX_RES_STATUS_SEC_TYPE_CCMP:
269 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == 269 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
270 RX_RES_STATUS_DECRYPT_OK) { 270 RX_RES_STATUS_DECRYPT_OK) {
271 IWL_DEBUG_RX(priv, "hw decrypt successfully!!!\n"); 271 IL_DEBUG_RX(priv, "hw decrypt successfully!!!\n");
272 stats->flag |= RX_FLAG_DECRYPTED; 272 stats->flag |= RX_FLAG_DECRYPTED;
273 } 273 }
274 break; 274 break;
@@ -278,4 +278,4 @@ int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv,
278 } 278 }
279 return 0; 279 return 0;
280} 280}
281EXPORT_SYMBOL(iwl_legacy_set_decrypted_flag); 281EXPORT_SYMBOL(il_set_decrypted_flag);
diff --git a/drivers/net/wireless/iwlegacy/iwl-scan.c b/drivers/net/wireless/iwlegacy/iwl-scan.c
index a6b5222fc59e..93e939cc9bc6 100644
--- a/drivers/net/wireless/iwlegacy/iwl-scan.c
+++ b/drivers/net/wireless/iwlegacy/iwl-scan.c
@@ -40,25 +40,25 @@
40/* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after 40/* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after
41 * sending probe req. This should be set long enough to hear probe responses 41 * sending probe req. This should be set long enough to hear probe responses
42 * from more than one AP. */ 42 * from more than one AP. */
43#define IWL_ACTIVE_DWELL_TIME_24 (30) /* all times in msec */ 43#define IL_ACTIVE_DWELL_TIME_24 (30) /* all times in msec */
44#define IWL_ACTIVE_DWELL_TIME_52 (20) 44#define IL_ACTIVE_DWELL_TIME_52 (20)
45 45
46#define IWL_ACTIVE_DWELL_FACTOR_24GHZ (3) 46#define IL_ACTIVE_DWELL_FACTOR_24GHZ (3)
47#define IWL_ACTIVE_DWELL_FACTOR_52GHZ (2) 47#define IL_ACTIVE_DWELL_FACTOR_52GHZ (2)
48 48
49/* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel. 49/* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel.
50 * Must be set longer than active dwell time. 50 * Must be set longer than active dwell time.
51 * For the most reliable scan, set > AP beacon interval (typically 100msec). */ 51 * For the most reliable scan, set > AP beacon interval (typically 100msec). */
52#define IWL_PASSIVE_DWELL_TIME_24 (20) /* all times in msec */ 52#define IL_PASSIVE_DWELL_TIME_24 (20) /* all times in msec */
53#define IWL_PASSIVE_DWELL_TIME_52 (10) 53#define IL_PASSIVE_DWELL_TIME_52 (10)
54#define IWL_PASSIVE_DWELL_BASE (100) 54#define IL_PASSIVE_DWELL_BASE (100)
55#define IWL_CHANNEL_TUNE_TIME 5 55#define IL_CHANNEL_TUNE_TIME 5
56 56
57static int iwl_legacy_send_scan_abort(struct iwl_priv *priv) 57static int il_send_scan_abort(struct il_priv *priv)
58{ 58{
59 int ret; 59 int ret;
60 struct iwl_rx_packet *pkt; 60 struct il_rx_packet *pkt;
61 struct iwl_host_cmd cmd = { 61 struct il_host_cmd cmd = {
62 .id = REPLY_SCAN_ABORT_CMD, 62 .id = REPLY_SCAN_ABORT_CMD,
63 .flags = CMD_WANT_SKB, 63 .flags = CMD_WANT_SKB,
64 }; 64 };
@@ -73,11 +73,11 @@ static int iwl_legacy_send_scan_abort(struct iwl_priv *priv)
73 test_bit(STATUS_EXIT_PENDING, &priv->status)) 73 test_bit(STATUS_EXIT_PENDING, &priv->status))
74 return -EIO; 74 return -EIO;
75 75
76 ret = iwl_legacy_send_cmd_sync(priv, &cmd); 76 ret = il_send_cmd_sync(priv, &cmd);
77 if (ret) 77 if (ret)
78 return ret; 78 return ret;
79 79
80 pkt = (struct iwl_rx_packet *)cmd.reply_page; 80 pkt = (struct il_rx_packet *)cmd.reply_page;
81 if (pkt->u.status != CAN_ABORT_STATUS) { 81 if (pkt->u.status != CAN_ABORT_STATUS) {
82 /* The scan abort will return 1 for success or 82 /* The scan abort will return 1 for success or
83 * 2 for "failure". A failure condition can be 83 * 2 for "failure". A failure condition can be
@@ -85,19 +85,19 @@ static int iwl_legacy_send_scan_abort(struct iwl_priv *priv)
85 * can occur if we send the scan abort before we 85 * can occur if we send the scan abort before we
86 * the microcode has notified us that a scan is 86 * the microcode has notified us that a scan is
87 * completed. */ 87 * completed. */
88 IWL_DEBUG_SCAN(priv, "SCAN_ABORT ret %d.\n", pkt->u.status); 88 IL_DEBUG_SCAN(priv, "SCAN_ABORT ret %d.\n", pkt->u.status);
89 ret = -EIO; 89 ret = -EIO;
90 } 90 }
91 91
92 iwl_legacy_free_pages(priv, cmd.reply_page); 92 il_free_pages(priv, cmd.reply_page);
93 return ret; 93 return ret;
94} 94}
95 95
96static void iwl_legacy_complete_scan(struct iwl_priv *priv, bool aborted) 96static void il_complete_scan(struct il_priv *priv, bool aborted)
97{ 97{
98 /* check if scan was requested from mac80211 */ 98 /* check if scan was requested from mac80211 */
99 if (priv->scan_request) { 99 if (priv->scan_request) {
100 IWL_DEBUG_SCAN(priv, "Complete scan in mac80211\n"); 100 IL_DEBUG_SCAN(priv, "Complete scan in mac80211\n");
101 ieee80211_scan_completed(priv->hw, aborted); 101 ieee80211_scan_completed(priv->hw, aborted);
102 } 102 }
103 103
@@ -105,71 +105,71 @@ static void iwl_legacy_complete_scan(struct iwl_priv *priv, bool aborted)
105 priv->scan_request = NULL; 105 priv->scan_request = NULL;
106} 106}
107 107
108void iwl_legacy_force_scan_end(struct iwl_priv *priv) 108void il_force_scan_end(struct il_priv *priv)
109{ 109{
110 lockdep_assert_held(&priv->mutex); 110 lockdep_assert_held(&priv->mutex);
111 111
112 if (!test_bit(STATUS_SCANNING, &priv->status)) { 112 if (!test_bit(STATUS_SCANNING, &priv->status)) {
113 IWL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n"); 113 IL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n");
114 return; 114 return;
115 } 115 }
116 116
117 IWL_DEBUG_SCAN(priv, "Forcing scan end\n"); 117 IL_DEBUG_SCAN(priv, "Forcing scan end\n");
118 clear_bit(STATUS_SCANNING, &priv->status); 118 clear_bit(STATUS_SCANNING, &priv->status);
119 clear_bit(STATUS_SCAN_HW, &priv->status); 119 clear_bit(STATUS_SCAN_HW, &priv->status);
120 clear_bit(STATUS_SCAN_ABORTING, &priv->status); 120 clear_bit(STATUS_SCAN_ABORTING, &priv->status);
121 iwl_legacy_complete_scan(priv, true); 121 il_complete_scan(priv, true);
122} 122}
123 123
124static void iwl_legacy_do_scan_abort(struct iwl_priv *priv) 124static void il_do_scan_abort(struct il_priv *priv)
125{ 125{
126 int ret; 126 int ret;
127 127
128 lockdep_assert_held(&priv->mutex); 128 lockdep_assert_held(&priv->mutex);
129 129
130 if (!test_bit(STATUS_SCANNING, &priv->status)) { 130 if (!test_bit(STATUS_SCANNING, &priv->status)) {
131 IWL_DEBUG_SCAN(priv, "Not performing scan to abort\n"); 131 IL_DEBUG_SCAN(priv, "Not performing scan to abort\n");
132 return; 132 return;
133 } 133 }
134 134
135 if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->status)) { 135 if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->status)) {
136 IWL_DEBUG_SCAN(priv, "Scan abort in progress\n"); 136 IL_DEBUG_SCAN(priv, "Scan abort in progress\n");
137 return; 137 return;
138 } 138 }
139 139
140 ret = iwl_legacy_send_scan_abort(priv); 140 ret = il_send_scan_abort(priv);
141 if (ret) { 141 if (ret) {
142 IWL_DEBUG_SCAN(priv, "Send scan abort failed %d\n", ret); 142 IL_DEBUG_SCAN(priv, "Send scan abort failed %d\n", ret);
143 iwl_legacy_force_scan_end(priv); 143 il_force_scan_end(priv);
144 } else 144 } else
145 IWL_DEBUG_SCAN(priv, "Successfully send scan abort\n"); 145 IL_DEBUG_SCAN(priv, "Successfully send scan abort\n");
146} 146}
147 147
148/** 148/**
149 * iwl_scan_cancel - Cancel any currently executing HW scan 149 * il_scan_cancel - Cancel any currently executing HW scan
150 */ 150 */
151int iwl_legacy_scan_cancel(struct iwl_priv *priv) 151int il_scan_cancel(struct il_priv *priv)
152{ 152{
153 IWL_DEBUG_SCAN(priv, "Queuing abort scan\n"); 153 IL_DEBUG_SCAN(priv, "Queuing abort scan\n");
154 queue_work(priv->workqueue, &priv->abort_scan); 154 queue_work(priv->workqueue, &priv->abort_scan);
155 return 0; 155 return 0;
156} 156}
157EXPORT_SYMBOL(iwl_legacy_scan_cancel); 157EXPORT_SYMBOL(il_scan_cancel);
158 158
159/** 159/**
160 * iwl_legacy_scan_cancel_timeout - Cancel any currently executing HW scan 160 * il_scan_cancel_timeout - Cancel any currently executing HW scan
161 * @ms: amount of time to wait (in milliseconds) for scan to abort 161 * @ms: amount of time to wait (in milliseconds) for scan to abort
162 * 162 *
163 */ 163 */
164int iwl_legacy_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) 164int il_scan_cancel_timeout(struct il_priv *priv, unsigned long ms)
165{ 165{
166 unsigned long timeout = jiffies + msecs_to_jiffies(ms); 166 unsigned long timeout = jiffies + msecs_to_jiffies(ms);
167 167
168 lockdep_assert_held(&priv->mutex); 168 lockdep_assert_held(&priv->mutex);
169 169
170 IWL_DEBUG_SCAN(priv, "Scan cancel timeout\n"); 170 IL_DEBUG_SCAN(priv, "Scan cancel timeout\n");
171 171
172 iwl_legacy_do_scan_abort(priv); 172 il_do_scan_abort(priv);
173 173
174 while (time_before_eq(jiffies, timeout)) { 174 while (time_before_eq(jiffies, timeout)) {
175 if (!test_bit(STATUS_SCAN_HW, &priv->status)) 175 if (!test_bit(STATUS_SCAN_HW, &priv->status))
@@ -179,30 +179,30 @@ int iwl_legacy_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
179 179
180 return test_bit(STATUS_SCAN_HW, &priv->status); 180 return test_bit(STATUS_SCAN_HW, &priv->status);
181} 181}
182EXPORT_SYMBOL(iwl_legacy_scan_cancel_timeout); 182EXPORT_SYMBOL(il_scan_cancel_timeout);
183 183
184/* Service response to REPLY_SCAN_CMD (0x80) */ 184/* Service response to REPLY_SCAN_CMD (0x80) */
185static void iwl_legacy_rx_reply_scan(struct iwl_priv *priv, 185static void il_rx_reply_scan(struct il_priv *priv,
186 struct iwl_rx_mem_buffer *rxb) 186 struct il_rx_mem_buffer *rxb)
187{ 187{
188#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 188#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
189 struct iwl_rx_packet *pkt = rxb_addr(rxb); 189 struct il_rx_packet *pkt = rxb_addr(rxb);
190 struct iwl_scanreq_notification *notif = 190 struct il_scanreq_notification *notif =
191 (struct iwl_scanreq_notification *)pkt->u.raw; 191 (struct il_scanreq_notification *)pkt->u.raw;
192 192
193 IWL_DEBUG_SCAN(priv, "Scan request status = 0x%x\n", notif->status); 193 IL_DEBUG_SCAN(priv, "Scan request status = 0x%x\n", notif->status);
194#endif 194#endif
195} 195}
196 196
197/* Service SCAN_START_NOTIFICATION (0x82) */ 197/* Service SCAN_START_NOTIFICATION (0x82) */
198static void iwl_legacy_rx_scan_start_notif(struct iwl_priv *priv, 198static void il_rx_scan_start_notif(struct il_priv *priv,
199 struct iwl_rx_mem_buffer *rxb) 199 struct il_rx_mem_buffer *rxb)
200{ 200{
201 struct iwl_rx_packet *pkt = rxb_addr(rxb); 201 struct il_rx_packet *pkt = rxb_addr(rxb);
202 struct iwl_scanstart_notification *notif = 202 struct il_scanstart_notification *notif =
203 (struct iwl_scanstart_notification *)pkt->u.raw; 203 (struct il_scanstart_notification *)pkt->u.raw;
204 priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); 204 priv->scan_start_tsf = le32_to_cpu(notif->tsf_low);
205 IWL_DEBUG_SCAN(priv, "Scan start: " 205 IL_DEBUG_SCAN(priv, "Scan start: "
206 "%d [802.11%s] " 206 "%d [802.11%s] "
207 "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n", 207 "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n",
208 notif->channel, 208 notif->channel,
@@ -213,15 +213,15 @@ static void iwl_legacy_rx_scan_start_notif(struct iwl_priv *priv,
213} 213}
214 214
215/* Service SCAN_RESULTS_NOTIFICATION (0x83) */ 215/* Service SCAN_RESULTS_NOTIFICATION (0x83) */
216static void iwl_legacy_rx_scan_results_notif(struct iwl_priv *priv, 216static void il_rx_scan_results_notif(struct il_priv *priv,
217 struct iwl_rx_mem_buffer *rxb) 217 struct il_rx_mem_buffer *rxb)
218{ 218{
219#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 219#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
220 struct iwl_rx_packet *pkt = rxb_addr(rxb); 220 struct il_rx_packet *pkt = rxb_addr(rxb);
221 struct iwl_scanresults_notification *notif = 221 struct il_scanresults_notification *notif =
222 (struct iwl_scanresults_notification *)pkt->u.raw; 222 (struct il_scanresults_notification *)pkt->u.raw;
223 223
224 IWL_DEBUG_SCAN(priv, "Scan ch.res: " 224 IL_DEBUG_SCAN(priv, "Scan ch.res: "
225 "%d [802.11%s] " 225 "%d [802.11%s] "
226 "(TSF: 0x%08X:%08X) - %d " 226 "(TSF: 0x%08X:%08X) - %d "
227 "elapsed=%lu usec\n", 227 "elapsed=%lu usec\n",
@@ -235,16 +235,16 @@ static void iwl_legacy_rx_scan_results_notif(struct iwl_priv *priv,
235} 235}
236 236
237/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ 237/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */
238static void iwl_legacy_rx_scan_complete_notif(struct iwl_priv *priv, 238static void il_rx_scan_complete_notif(struct il_priv *priv,
239 struct iwl_rx_mem_buffer *rxb) 239 struct il_rx_mem_buffer *rxb)
240{ 240{
241 241
242#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 242#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
243 struct iwl_rx_packet *pkt = rxb_addr(rxb); 243 struct il_rx_packet *pkt = rxb_addr(rxb);
244 struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; 244 struct il_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
245#endif 245#endif
246 246
247 IWL_DEBUG_SCAN(priv, 247 IL_DEBUG_SCAN(priv,
248 "Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", 248 "Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n",
249 scan_notif->scanned_channels, 249 scan_notif->scanned_channels,
250 scan_notif->tsf_low, 250 scan_notif->tsf_low,
@@ -253,49 +253,49 @@ static void iwl_legacy_rx_scan_complete_notif(struct iwl_priv *priv,
253 /* The HW is no longer scanning */ 253 /* The HW is no longer scanning */
254 clear_bit(STATUS_SCAN_HW, &priv->status); 254 clear_bit(STATUS_SCAN_HW, &priv->status);
255 255
256 IWL_DEBUG_SCAN(priv, "Scan on %sGHz took %dms\n", 256 IL_DEBUG_SCAN(priv, "Scan on %sGHz took %dms\n",
257 (priv->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2", 257 (priv->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2",
258 jiffies_to_msecs(jiffies - priv->scan_start)); 258 jiffies_to_msecs(jiffies - priv->scan_start));
259 259
260 queue_work(priv->workqueue, &priv->scan_completed); 260 queue_work(priv->workqueue, &priv->scan_completed);
261} 261}
262 262
263void iwl_legacy_setup_rx_scan_handlers(struct iwl_priv *priv) 263void il_setup_rx_scan_handlers(struct il_priv *priv)
264{ 264{
265 /* scan handlers */ 265 /* scan handlers */
266 priv->rx_handlers[REPLY_SCAN_CMD] = iwl_legacy_rx_reply_scan; 266 priv->rx_handlers[REPLY_SCAN_CMD] = il_rx_reply_scan;
267 priv->rx_handlers[SCAN_START_NOTIFICATION] = 267 priv->rx_handlers[SCAN_START_NOTIFICATION] =
268 iwl_legacy_rx_scan_start_notif; 268 il_rx_scan_start_notif;
269 priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = 269 priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] =
270 iwl_legacy_rx_scan_results_notif; 270 il_rx_scan_results_notif;
271 priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = 271 priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] =
272 iwl_legacy_rx_scan_complete_notif; 272 il_rx_scan_complete_notif;
273} 273}
274EXPORT_SYMBOL(iwl_legacy_setup_rx_scan_handlers); 274EXPORT_SYMBOL(il_setup_rx_scan_handlers);
275 275
276inline u16 iwl_legacy_get_active_dwell_time(struct iwl_priv *priv, 276inline u16 il_get_active_dwell_time(struct il_priv *priv,
277 enum ieee80211_band band, 277 enum ieee80211_band band,
278 u8 n_probes) 278 u8 n_probes)
279{ 279{
280 if (band == IEEE80211_BAND_5GHZ) 280 if (band == IEEE80211_BAND_5GHZ)
281 return IWL_ACTIVE_DWELL_TIME_52 + 281 return IL_ACTIVE_DWELL_TIME_52 +
282 IWL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1); 282 IL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1);
283 else 283 else
284 return IWL_ACTIVE_DWELL_TIME_24 + 284 return IL_ACTIVE_DWELL_TIME_24 +
285 IWL_ACTIVE_DWELL_FACTOR_24GHZ * (n_probes + 1); 285 IL_ACTIVE_DWELL_FACTOR_24GHZ * (n_probes + 1);
286} 286}
287EXPORT_SYMBOL(iwl_legacy_get_active_dwell_time); 287EXPORT_SYMBOL(il_get_active_dwell_time);
288 288
289u16 iwl_legacy_get_passive_dwell_time(struct iwl_priv *priv, 289u16 il_get_passive_dwell_time(struct il_priv *priv,
290 enum ieee80211_band band, 290 enum ieee80211_band band,
291 struct ieee80211_vif *vif) 291 struct ieee80211_vif *vif)
292{ 292{
293 struct iwl_rxon_context *ctx; 293 struct il_rxon_context *ctx;
294 u16 passive = (band == IEEE80211_BAND_2GHZ) ? 294 u16 passive = (band == IEEE80211_BAND_2GHZ) ?
295 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : 295 IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_24 :
296 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; 296 IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_52;
297 297
298 if (iwl_legacy_is_any_associated(priv)) { 298 if (il_is_any_associated(priv)) {
299 /* 299 /*
300 * If we're associated, we clamp the maximum passive 300 * If we're associated, we clamp the maximum passive
301 * dwell time to be 98% of the smallest beacon interval 301 * dwell time to be 98% of the smallest beacon interval
@@ -304,21 +304,21 @@ u16 iwl_legacy_get_passive_dwell_time(struct iwl_priv *priv,
304 for_each_context(priv, ctx) { 304 for_each_context(priv, ctx) {
305 u16 value; 305 u16 value;
306 306
307 if (!iwl_legacy_is_associated_ctx(ctx)) 307 if (!il_is_associated_ctx(ctx))
308 continue; 308 continue;
309 value = ctx->vif ? ctx->vif->bss_conf.beacon_int : 0; 309 value = ctx->vif ? ctx->vif->bss_conf.beacon_int : 0;
310 if ((value > IWL_PASSIVE_DWELL_BASE) || !value) 310 if ((value > IL_PASSIVE_DWELL_BASE) || !value)
311 value = IWL_PASSIVE_DWELL_BASE; 311 value = IL_PASSIVE_DWELL_BASE;
312 value = (value * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; 312 value = (value * 98) / 100 - IL_CHANNEL_TUNE_TIME * 2;
313 passive = min(value, passive); 313 passive = min(value, passive);
314 } 314 }
315 } 315 }
316 316
317 return passive; 317 return passive;
318} 318}
319EXPORT_SYMBOL(iwl_legacy_get_passive_dwell_time); 319EXPORT_SYMBOL(il_get_passive_dwell_time);
320 320
321void iwl_legacy_init_scan_params(struct iwl_priv *priv) 321void il_init_scan_params(struct il_priv *priv)
322{ 322{
323 u8 ant_idx = fls(priv->hw_params.valid_tx_ant) - 1; 323 u8 ant_idx = fls(priv->hw_params.valid_tx_ant) - 1;
324 if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ]) 324 if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ])
@@ -326,9 +326,9 @@ void iwl_legacy_init_scan_params(struct iwl_priv *priv)
326 if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ]) 326 if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ])
327 priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx; 327 priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx;
328} 328}
329EXPORT_SYMBOL(iwl_legacy_init_scan_params); 329EXPORT_SYMBOL(il_init_scan_params);
330 330
331static int iwl_legacy_scan_initiate(struct iwl_priv *priv, 331static int il_scan_initiate(struct il_priv *priv,
332 struct ieee80211_vif *vif) 332 struct ieee80211_vif *vif)
333{ 333{
334 int ret; 334 int ret;
@@ -340,23 +340,23 @@ static int iwl_legacy_scan_initiate(struct iwl_priv *priv,
340 340
341 cancel_delayed_work(&priv->scan_check); 341 cancel_delayed_work(&priv->scan_check);
342 342
343 if (!iwl_legacy_is_ready_rf(priv)) { 343 if (!il_is_ready_rf(priv)) {
344 IWL_WARN(priv, "Request scan called when driver not ready.\n"); 344 IL_WARN(priv, "Request scan called when driver not ready.\n");
345 return -EIO; 345 return -EIO;
346 } 346 }
347 347
348 if (test_bit(STATUS_SCAN_HW, &priv->status)) { 348 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
349 IWL_DEBUG_SCAN(priv, 349 IL_DEBUG_SCAN(priv,
350 "Multiple concurrent scan requests in parallel.\n"); 350 "Multiple concurrent scan requests in parallel.\n");
351 return -EBUSY; 351 return -EBUSY;
352 } 352 }
353 353
354 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { 354 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
355 IWL_DEBUG_SCAN(priv, "Scan request while abort pending.\n"); 355 IL_DEBUG_SCAN(priv, "Scan request while abort pending.\n");
356 return -EBUSY; 356 return -EBUSY;
357 } 357 }
358 358
359 IWL_DEBUG_SCAN(priv, "Starting scan...\n"); 359 IL_DEBUG_SCAN(priv, "Starting scan...\n");
360 360
361 set_bit(STATUS_SCANNING, &priv->status); 361 set_bit(STATUS_SCANNING, &priv->status);
362 priv->scan_start = jiffies; 362 priv->scan_start = jiffies;
@@ -368,19 +368,19 @@ static int iwl_legacy_scan_initiate(struct iwl_priv *priv,
368 } 368 }
369 369
370 queue_delayed_work(priv->workqueue, &priv->scan_check, 370 queue_delayed_work(priv->workqueue, &priv->scan_check,
371 IWL_SCAN_CHECK_WATCHDOG); 371 IL_SCAN_CHECK_WATCHDOG);
372 372
373 return 0; 373 return 0;
374} 374}
375 375
376int iwl_legacy_mac_hw_scan(struct ieee80211_hw *hw, 376int il_mac_hw_scan(struct ieee80211_hw *hw,
377 struct ieee80211_vif *vif, 377 struct ieee80211_vif *vif,
378 struct cfg80211_scan_request *req) 378 struct cfg80211_scan_request *req)
379{ 379{
380 struct iwl_priv *priv = hw->priv; 380 struct il_priv *priv = hw->priv;
381 int ret; 381 int ret;
382 382
383 IWL_DEBUG_MAC80211(priv, "enter\n"); 383 IL_DEBUG_MAC80211(priv, "enter\n");
384 384
385 if (req->n_channels == 0) 385 if (req->n_channels == 0)
386 return -EINVAL; 386 return -EINVAL;
@@ -388,7 +388,7 @@ int iwl_legacy_mac_hw_scan(struct ieee80211_hw *hw,
388 mutex_lock(&priv->mutex); 388 mutex_lock(&priv->mutex);
389 389
390 if (test_bit(STATUS_SCANNING, &priv->status)) { 390 if (test_bit(STATUS_SCANNING, &priv->status)) {
391 IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); 391 IL_DEBUG_SCAN(priv, "Scan already in progress.\n");
392 ret = -EAGAIN; 392 ret = -EAGAIN;
393 goto out_unlock; 393 goto out_unlock;
394 } 394 }
@@ -398,38 +398,38 @@ int iwl_legacy_mac_hw_scan(struct ieee80211_hw *hw,
398 priv->scan_vif = vif; 398 priv->scan_vif = vif;
399 priv->scan_band = req->channels[0]->band; 399 priv->scan_band = req->channels[0]->band;
400 400
401 ret = iwl_legacy_scan_initiate(priv, vif); 401 ret = il_scan_initiate(priv, vif);
402 402
403 IWL_DEBUG_MAC80211(priv, "leave\n"); 403 IL_DEBUG_MAC80211(priv, "leave\n");
404 404
405out_unlock: 405out_unlock:
406 mutex_unlock(&priv->mutex); 406 mutex_unlock(&priv->mutex);
407 407
408 return ret; 408 return ret;
409} 409}
410EXPORT_SYMBOL(iwl_legacy_mac_hw_scan); 410EXPORT_SYMBOL(il_mac_hw_scan);
411 411
412static void iwl_legacy_bg_scan_check(struct work_struct *data) 412static void il_bg_scan_check(struct work_struct *data)
413{ 413{
414 struct iwl_priv *priv = 414 struct il_priv *priv =
415 container_of(data, struct iwl_priv, scan_check.work); 415 container_of(data, struct il_priv, scan_check.work);
416 416
417 IWL_DEBUG_SCAN(priv, "Scan check work\n"); 417 IL_DEBUG_SCAN(priv, "Scan check work\n");
418 418
419 /* Since we are here firmware does not finish scan and 419 /* Since we are here firmware does not finish scan and
420 * most likely is in bad shape, so we don't bother to 420 * most likely is in bad shape, so we don't bother to
421 * send abort command, just force scan complete to mac80211 */ 421 * send abort command, just force scan complete to mac80211 */
422 mutex_lock(&priv->mutex); 422 mutex_lock(&priv->mutex);
423 iwl_legacy_force_scan_end(priv); 423 il_force_scan_end(priv);
424 mutex_unlock(&priv->mutex); 424 mutex_unlock(&priv->mutex);
425} 425}
426 426
427/** 427/**
428 * iwl_legacy_fill_probe_req - fill in all required fields and IE for probe request 428 * il_fill_probe_req - fill in all required fields and IE for probe request
429 */ 429 */
430 430
431u16 431u16
432iwl_legacy_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, 432il_fill_probe_req(struct il_priv *priv, struct ieee80211_mgmt *frame,
433 const u8 *ta, const u8 *ies, int ie_len, int left) 433 const u8 *ta, const u8 *ies, int ie_len, int left)
434{ 434{
435 int len = 0; 435 int len = 0;
@@ -471,28 +471,28 @@ iwl_legacy_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame,
471 471
472 return (u16)len; 472 return (u16)len;
473} 473}
474EXPORT_SYMBOL(iwl_legacy_fill_probe_req); 474EXPORT_SYMBOL(il_fill_probe_req);
475 475
476static void iwl_legacy_bg_abort_scan(struct work_struct *work) 476static void il_bg_abort_scan(struct work_struct *work)
477{ 477{
478 struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); 478 struct il_priv *priv = container_of(work, struct il_priv, abort_scan);
479 479
480 IWL_DEBUG_SCAN(priv, "Abort scan work\n"); 480 IL_DEBUG_SCAN(priv, "Abort scan work\n");
481 481
482 /* We keep scan_check work queued in case when firmware will not 482 /* We keep scan_check work queued in case when firmware will not
483 * report back scan completed notification */ 483 * report back scan completed notification */
484 mutex_lock(&priv->mutex); 484 mutex_lock(&priv->mutex);
485 iwl_legacy_scan_cancel_timeout(priv, 200); 485 il_scan_cancel_timeout(priv, 200);
486 mutex_unlock(&priv->mutex); 486 mutex_unlock(&priv->mutex);
487} 487}
488 488
489static void iwl_legacy_bg_scan_completed(struct work_struct *work) 489static void il_bg_scan_completed(struct work_struct *work)
490{ 490{
491 struct iwl_priv *priv = 491 struct il_priv *priv =
492 container_of(work, struct iwl_priv, scan_completed); 492 container_of(work, struct il_priv, scan_completed);
493 bool aborted; 493 bool aborted;
494 494
495 IWL_DEBUG_SCAN(priv, "Completed scan.\n"); 495 IL_DEBUG_SCAN(priv, "Completed scan.\n");
496 496
497 cancel_delayed_work(&priv->scan_check); 497 cancel_delayed_work(&priv->scan_check);
498 498
@@ -500,26 +500,26 @@ static void iwl_legacy_bg_scan_completed(struct work_struct *work)
500 500
501 aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->status); 501 aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->status);
502 if (aborted) 502 if (aborted)
503 IWL_DEBUG_SCAN(priv, "Aborted scan completed.\n"); 503 IL_DEBUG_SCAN(priv, "Aborted scan completed.\n");
504 504
505 if (!test_and_clear_bit(STATUS_SCANNING, &priv->status)) { 505 if (!test_and_clear_bit(STATUS_SCANNING, &priv->status)) {
506 IWL_DEBUG_SCAN(priv, "Scan already completed.\n"); 506 IL_DEBUG_SCAN(priv, "Scan already completed.\n");
507 goto out_settings; 507 goto out_settings;
508 } 508 }
509 509
510 iwl_legacy_complete_scan(priv, aborted); 510 il_complete_scan(priv, aborted);
511 511
512out_settings: 512out_settings:
513 /* Can we still talk to firmware ? */ 513 /* Can we still talk to firmware ? */
514 if (!iwl_legacy_is_ready_rf(priv)) 514 if (!il_is_ready_rf(priv))
515 goto out; 515 goto out;
516 516
517 /* 517 /*
518 * We do not commit power settings while scan is pending, 518 * We do not commit power settings while scan is pending,
519 * do it now if the settings changed. 519 * do it now if the settings changed.
520 */ 520 */
521 iwl_legacy_power_set_mode(priv, &priv->power_data.sleep_cmd_next, false); 521 il_power_set_mode(priv, &priv->power_data.sleep_cmd_next, false);
522 iwl_legacy_set_tx_power(priv, priv->tx_power_next, false); 522 il_set_tx_power(priv, priv->tx_power_next, false);
523 523
524 priv->cfg->ops->utils->post_scan(priv); 524 priv->cfg->ops->utils->post_scan(priv);
525 525
@@ -527,23 +527,23 @@ out:
527 mutex_unlock(&priv->mutex); 527 mutex_unlock(&priv->mutex);
528} 528}
529 529
530void iwl_legacy_setup_scan_deferred_work(struct iwl_priv *priv) 530void il_setup_scan_deferred_work(struct il_priv *priv)
531{ 531{
532 INIT_WORK(&priv->scan_completed, iwl_legacy_bg_scan_completed); 532 INIT_WORK(&priv->scan_completed, il_bg_scan_completed);
533 INIT_WORK(&priv->abort_scan, iwl_legacy_bg_abort_scan); 533 INIT_WORK(&priv->abort_scan, il_bg_abort_scan);
534 INIT_DELAYED_WORK(&priv->scan_check, iwl_legacy_bg_scan_check); 534 INIT_DELAYED_WORK(&priv->scan_check, il_bg_scan_check);
535} 535}
536EXPORT_SYMBOL(iwl_legacy_setup_scan_deferred_work); 536EXPORT_SYMBOL(il_setup_scan_deferred_work);
537 537
538void iwl_legacy_cancel_scan_deferred_work(struct iwl_priv *priv) 538void il_cancel_scan_deferred_work(struct il_priv *priv)
539{ 539{
540 cancel_work_sync(&priv->abort_scan); 540 cancel_work_sync(&priv->abort_scan);
541 cancel_work_sync(&priv->scan_completed); 541 cancel_work_sync(&priv->scan_completed);
542 542
543 if (cancel_delayed_work_sync(&priv->scan_check)) { 543 if (cancel_delayed_work_sync(&priv->scan_check)) {
544 mutex_lock(&priv->mutex); 544 mutex_lock(&priv->mutex);
545 iwl_legacy_force_scan_end(priv); 545 il_force_scan_end(priv);
546 mutex_unlock(&priv->mutex); 546 mutex_unlock(&priv->mutex);
547 } 547 }
548} 548}
549EXPORT_SYMBOL(iwl_legacy_cancel_scan_deferred_work); 549EXPORT_SYMBOL(il_cancel_scan_deferred_work);
diff --git a/drivers/net/wireless/iwlegacy/iwl-spectrum.h b/drivers/net/wireless/iwlegacy/iwl-spectrum.h
index 9f70a4723103..85fe48e520f9 100644
--- a/drivers/net/wireless/iwlegacy/iwl-spectrum.h
+++ b/drivers/net/wireless/iwlegacy/iwl-spectrum.h
@@ -26,8 +26,8 @@
26 * 26 *
27 *****************************************************************************/ 27 *****************************************************************************/
28 28
29#ifndef __iwl_legacy_spectrum_h__ 29#ifndef __il_spectrum_h__
30#define __iwl_legacy_spectrum_h__ 30#define __il_spectrum_h__
31enum { /* ieee80211_basic_report.map */ 31enum { /* ieee80211_basic_report.map */
32 IEEE80211_BASIC_MAP_BSS = (1 << 0), 32 IEEE80211_BASIC_MAP_BSS = (1 << 0),
33 IEEE80211_BASIC_MAP_OFDM = (1 << 1), 33 IEEE80211_BASIC_MAP_OFDM = (1 << 1),
diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.c b/drivers/net/wireless/iwlegacy/iwl-sta.c
index 66f0fb2bbe00..3773f7d64d2a 100644
--- a/drivers/net/wireless/iwlegacy/iwl-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-sta.c
@@ -37,72 +37,72 @@
37#include "iwl-sta.h" 37#include "iwl-sta.h"
38 38
39/* priv->sta_lock must be held */ 39/* priv->sta_lock must be held */
40static void iwl_legacy_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) 40static void il_sta_ucode_activate(struct il_priv *priv, u8 sta_id)
41{ 41{
42 42
43 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) 43 if (!(priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE))
44 IWL_ERR(priv, 44 IL_ERR(priv,
45 "ACTIVATE a non DRIVER active station id %u addr %pM\n", 45 "ACTIVATE a non DRIVER active station id %u addr %pM\n",
46 sta_id, priv->stations[sta_id].sta.sta.addr); 46 sta_id, priv->stations[sta_id].sta.sta.addr);
47 47
48 if (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE) { 48 if (priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE) {
49 IWL_DEBUG_ASSOC(priv, 49 IL_DEBUG_ASSOC(priv,
50 "STA id %u addr %pM already present" 50 "STA id %u addr %pM already present"
51 " in uCode (according to driver)\n", 51 " in uCode (according to driver)\n",
52 sta_id, priv->stations[sta_id].sta.sta.addr); 52 sta_id, priv->stations[sta_id].sta.sta.addr);
53 } else { 53 } else {
54 priv->stations[sta_id].used |= IWL_STA_UCODE_ACTIVE; 54 priv->stations[sta_id].used |= IL_STA_UCODE_ACTIVE;
55 IWL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n", 55 IL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n",
56 sta_id, priv->stations[sta_id].sta.sta.addr); 56 sta_id, priv->stations[sta_id].sta.sta.addr);
57 } 57 }
58} 58}
59 59
60static int iwl_legacy_process_add_sta_resp(struct iwl_priv *priv, 60static int il_process_add_sta_resp(struct il_priv *priv,
61 struct iwl_legacy_addsta_cmd *addsta, 61 struct il_addsta_cmd *addsta,
62 struct iwl_rx_packet *pkt, 62 struct il_rx_packet *pkt,
63 bool sync) 63 bool sync)
64{ 64{
65 u8 sta_id = addsta->sta.sta_id; 65 u8 sta_id = addsta->sta.sta_id;
66 unsigned long flags; 66 unsigned long flags;
67 int ret = -EIO; 67 int ret = -EIO;
68 68
69 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { 69 if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
70 IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n", 70 IL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n",
71 pkt->hdr.flags); 71 pkt->hdr.flags);
72 return ret; 72 return ret;
73 } 73 }
74 74
75 IWL_DEBUG_INFO(priv, "Processing response for adding station %u\n", 75 IL_DEBUG_INFO(priv, "Processing response for adding station %u\n",
76 sta_id); 76 sta_id);
77 77
78 spin_lock_irqsave(&priv->sta_lock, flags); 78 spin_lock_irqsave(&priv->sta_lock, flags);
79 79
80 switch (pkt->u.add_sta.status) { 80 switch (pkt->u.add_sta.status) {
81 case ADD_STA_SUCCESS_MSK: 81 case ADD_STA_SUCCESS_MSK:
82 IWL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n"); 82 IL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n");
83 iwl_legacy_sta_ucode_activate(priv, sta_id); 83 il_sta_ucode_activate(priv, sta_id);
84 ret = 0; 84 ret = 0;
85 break; 85 break;
86 case ADD_STA_NO_ROOM_IN_TABLE: 86 case ADD_STA_NO_ROOM_IN_TABLE:
87 IWL_ERR(priv, "Adding station %d failed, no room in table.\n", 87 IL_ERR(priv, "Adding station %d failed, no room in table.\n",
88 sta_id); 88 sta_id);
89 break; 89 break;
90 case ADD_STA_NO_BLOCK_ACK_RESOURCE: 90 case ADD_STA_NO_BLOCK_ACK_RESOURCE:
91 IWL_ERR(priv, 91 IL_ERR(priv,
92 "Adding station %d failed, no block ack resource.\n", 92 "Adding station %d failed, no block ack resource.\n",
93 sta_id); 93 sta_id);
94 break; 94 break;
95 case ADD_STA_MODIFY_NON_EXIST_STA: 95 case ADD_STA_MODIFY_NON_EXIST_STA:
96 IWL_ERR(priv, "Attempting to modify non-existing station %d\n", 96 IL_ERR(priv, "Attempting to modify non-existing station %d\n",
97 sta_id); 97 sta_id);
98 break; 98 break;
99 default: 99 default:
100 IWL_DEBUG_ASSOC(priv, "Received REPLY_ADD_STA:(0x%08X)\n", 100 IL_DEBUG_ASSOC(priv, "Received REPLY_ADD_STA:(0x%08X)\n",
101 pkt->u.add_sta.status); 101 pkt->u.add_sta.status);
102 break; 102 break;
103 } 103 }
104 104
105 IWL_DEBUG_INFO(priv, "%s station id %u addr %pM\n", 105 IL_DEBUG_INFO(priv, "%s station id %u addr %pM\n",
106 priv->stations[sta_id].sta.mode == 106 priv->stations[sta_id].sta.mode ==
107 STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", 107 STA_CONTROL_MODIFY_MSK ? "Modified" : "Added",
108 sta_id, priv->stations[sta_id].sta.sta.addr); 108 sta_id, priv->stations[sta_id].sta.sta.addr);
@@ -115,7 +115,7 @@ static int iwl_legacy_process_add_sta_resp(struct iwl_priv *priv,
115 * issue has not yet been resolved and this debugging is left to 115 * issue has not yet been resolved and this debugging is left to
116 * observe the problem. 116 * observe the problem.
117 */ 117 */
118 IWL_DEBUG_INFO(priv, "%s station according to cmd buffer %pM\n", 118 IL_DEBUG_INFO(priv, "%s station according to cmd buffer %pM\n",
119 priv->stations[sta_id].sta.mode == 119 priv->stations[sta_id].sta.mode ==
120 STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", 120 STA_CONTROL_MODIFY_MSK ? "Modified" : "Added",
121 addsta->sta.addr); 121 addsta->sta.addr);
@@ -124,59 +124,59 @@ static int iwl_legacy_process_add_sta_resp(struct iwl_priv *priv,
124 return ret; 124 return ret;
125} 125}
126 126
127static void iwl_legacy_add_sta_callback(struct iwl_priv *priv, 127static void il_add_sta_callback(struct il_priv *priv,
128 struct iwl_device_cmd *cmd, 128 struct il_device_cmd *cmd,
129 struct iwl_rx_packet *pkt) 129 struct il_rx_packet *pkt)
130{ 130{
131 struct iwl_legacy_addsta_cmd *addsta = 131 struct il_addsta_cmd *addsta =
132 (struct iwl_legacy_addsta_cmd *)cmd->cmd.payload; 132 (struct il_addsta_cmd *)cmd->cmd.payload;
133 133
134 iwl_legacy_process_add_sta_resp(priv, addsta, pkt, false); 134 il_process_add_sta_resp(priv, addsta, pkt, false);
135 135
136} 136}
137 137
138int iwl_legacy_send_add_sta(struct iwl_priv *priv, 138int il_send_add_sta(struct il_priv *priv,
139 struct iwl_legacy_addsta_cmd *sta, u8 flags) 139 struct il_addsta_cmd *sta, u8 flags)
140{ 140{
141 struct iwl_rx_packet *pkt = NULL; 141 struct il_rx_packet *pkt = NULL;
142 int ret = 0; 142 int ret = 0;
143 u8 data[sizeof(*sta)]; 143 u8 data[sizeof(*sta)];
144 struct iwl_host_cmd cmd = { 144 struct il_host_cmd cmd = {
145 .id = REPLY_ADD_STA, 145 .id = REPLY_ADD_STA,
146 .flags = flags, 146 .flags = flags,
147 .data = data, 147 .data = data,
148 }; 148 };
149 u8 sta_id __maybe_unused = sta->sta.sta_id; 149 u8 sta_id __maybe_unused = sta->sta.sta_id;
150 150
151 IWL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n", 151 IL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n",
152 sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); 152 sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : "");
153 153
154 if (flags & CMD_ASYNC) 154 if (flags & CMD_ASYNC)
155 cmd.callback = iwl_legacy_add_sta_callback; 155 cmd.callback = il_add_sta_callback;
156 else { 156 else {
157 cmd.flags |= CMD_WANT_SKB; 157 cmd.flags |= CMD_WANT_SKB;
158 might_sleep(); 158 might_sleep();
159 } 159 }
160 160
161 cmd.len = priv->cfg->ops->utils->build_addsta_hcmd(sta, data); 161 cmd.len = priv->cfg->ops->utils->build_addsta_hcmd(sta, data);
162 ret = iwl_legacy_send_cmd(priv, &cmd); 162 ret = il_send_cmd(priv, &cmd);
163 163
164 if (ret || (flags & CMD_ASYNC)) 164 if (ret || (flags & CMD_ASYNC))
165 return ret; 165 return ret;
166 166
167 if (ret == 0) { 167 if (ret == 0) {
168 pkt = (struct iwl_rx_packet *)cmd.reply_page; 168 pkt = (struct il_rx_packet *)cmd.reply_page;
169 ret = iwl_legacy_process_add_sta_resp(priv, sta, pkt, true); 169 ret = il_process_add_sta_resp(priv, sta, pkt, true);
170 } 170 }
171 iwl_legacy_free_pages(priv, cmd.reply_page); 171 il_free_pages(priv, cmd.reply_page);
172 172
173 return ret; 173 return ret;
174} 174}
175EXPORT_SYMBOL(iwl_legacy_send_add_sta); 175EXPORT_SYMBOL(il_send_add_sta);
176 176
177static void iwl_legacy_set_ht_add_station(struct iwl_priv *priv, u8 index, 177static void il_set_ht_add_station(struct il_priv *priv, u8 index,
178 struct ieee80211_sta *sta, 178 struct ieee80211_sta *sta,
179 struct iwl_rxon_context *ctx) 179 struct il_rxon_context *ctx)
180{ 180{
181 struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap; 181 struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap;
182 __le32 sta_flags; 182 __le32 sta_flags;
@@ -186,7 +186,7 @@ static void iwl_legacy_set_ht_add_station(struct iwl_priv *priv, u8 index,
186 goto done; 186 goto done;
187 187
188 mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2; 188 mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2;
189 IWL_DEBUG_ASSOC(priv, "spatial multiplexing power save mode: %s\n", 189 IL_DEBUG_ASSOC(priv, "spatial multiplexing power save mode: %s\n",
190 (mimo_ps_mode == WLAN_HT_CAP_SM_PS_STATIC) ? 190 (mimo_ps_mode == WLAN_HT_CAP_SM_PS_STATIC) ?
191 "static" : 191 "static" :
192 (mimo_ps_mode == WLAN_HT_CAP_SM_PS_DYNAMIC) ? 192 (mimo_ps_mode == WLAN_HT_CAP_SM_PS_DYNAMIC) ?
@@ -206,7 +206,7 @@ static void iwl_legacy_set_ht_add_station(struct iwl_priv *priv, u8 index,
206 case WLAN_HT_CAP_SM_PS_DISABLED: 206 case WLAN_HT_CAP_SM_PS_DISABLED:
207 break; 207 break;
208 default: 208 default:
209 IWL_WARN(priv, "Invalid MIMO PS mode %d\n", mimo_ps_mode); 209 IL_WARN(priv, "Invalid MIMO PS mode %d\n", mimo_ps_mode);
210 break; 210 break;
211 } 211 }
212 212
@@ -216,7 +216,7 @@ static void iwl_legacy_set_ht_add_station(struct iwl_priv *priv, u8 index,
216 sta_flags |= cpu_to_le32( 216 sta_flags |= cpu_to_le32(
217 (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); 217 (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS);
218 218
219 if (iwl_legacy_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) 219 if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
220 sta_flags |= STA_FLG_HT40_EN_MSK; 220 sta_flags |= STA_FLG_HT40_EN_MSK;
221 else 221 else
222 sta_flags &= ~STA_FLG_HT40_EN_MSK; 222 sta_flags &= ~STA_FLG_HT40_EN_MSK;
@@ -227,16 +227,16 @@ static void iwl_legacy_set_ht_add_station(struct iwl_priv *priv, u8 index,
227} 227}
228 228
229/** 229/**
230 * iwl_legacy_prep_station - Prepare station information for addition 230 * il_prep_station - Prepare station information for addition
231 * 231 *
232 * should be called with sta_lock held 232 * should be called with sta_lock held
233 */ 233 */
234u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 234u8 il_prep_station(struct il_priv *priv, struct il_rxon_context *ctx,
235 const u8 *addr, bool is_ap, struct ieee80211_sta *sta) 235 const u8 *addr, bool is_ap, struct ieee80211_sta *sta)
236{ 236{
237 struct iwl_station_entry *station; 237 struct il_station_entry *station;
238 int i; 238 int i;
239 u8 sta_id = IWL_INVALID_STATION; 239 u8 sta_id = IL_INVALID_STATION;
240 u16 rate; 240 u16 rate;
241 241
242 if (is_ap) 242 if (is_ap)
@@ -244,7 +244,7 @@ u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
244 else if (is_broadcast_ether_addr(addr)) 244 else if (is_broadcast_ether_addr(addr))
245 sta_id = ctx->bcast_sta_id; 245 sta_id = ctx->bcast_sta_id;
246 else 246 else
247 for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++) { 247 for (i = IL_STA_ID; i < priv->hw_params.max_stations; i++) {
248 if (!compare_ether_addr(priv->stations[i].sta.sta.addr, 248 if (!compare_ether_addr(priv->stations[i].sta.sta.addr,
249 addr)) { 249 addr)) {
250 sta_id = i; 250 sta_id = i;
@@ -252,7 +252,7 @@ u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
252 } 252 }
253 253
254 if (!priv->stations[i].used && 254 if (!priv->stations[i].used &&
255 sta_id == IWL_INVALID_STATION) 255 sta_id == IL_INVALID_STATION)
256 sta_id = i; 256 sta_id = i;
257 } 257 }
258 258
@@ -260,7 +260,7 @@ u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
260 * These two conditions have the same outcome, but keep them 260 * These two conditions have the same outcome, but keep them
261 * separate 261 * separate
262 */ 262 */
263 if (unlikely(sta_id == IWL_INVALID_STATION)) 263 if (unlikely(sta_id == IL_INVALID_STATION))
264 return sta_id; 264 return sta_id;
265 265
266 /* 266 /*
@@ -268,30 +268,30 @@ u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
268 * station. Keep track if one is in progress so that we do not send 268 * station. Keep track if one is in progress so that we do not send
269 * another. 269 * another.
270 */ 270 */
271 if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) { 271 if (priv->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) {
272 IWL_DEBUG_INFO(priv, 272 IL_DEBUG_INFO(priv,
273 "STA %d already in process of being added.\n", 273 "STA %d already in process of being added.\n",
274 sta_id); 274 sta_id);
275 return sta_id; 275 return sta_id;
276 } 276 }
277 277
278 if ((priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) && 278 if ((priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) &&
279 (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE) && 279 (priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE) &&
280 !compare_ether_addr(priv->stations[sta_id].sta.sta.addr, addr)) { 280 !compare_ether_addr(priv->stations[sta_id].sta.sta.addr, addr)) {
281 IWL_DEBUG_ASSOC(priv, 281 IL_DEBUG_ASSOC(priv,
282 "STA %d (%pM) already added, not adding again.\n", 282 "STA %d (%pM) already added, not adding again.\n",
283 sta_id, addr); 283 sta_id, addr);
284 return sta_id; 284 return sta_id;
285 } 285 }
286 286
287 station = &priv->stations[sta_id]; 287 station = &priv->stations[sta_id];
288 station->used = IWL_STA_DRIVER_ACTIVE; 288 station->used = IL_STA_DRIVER_ACTIVE;
289 IWL_DEBUG_ASSOC(priv, "Add STA to driver ID %d: %pM\n", 289 IL_DEBUG_ASSOC(priv, "Add STA to driver ID %d: %pM\n",
290 sta_id, addr); 290 sta_id, addr);
291 priv->num_stations++; 291 priv->num_stations++;
292 292
293 /* Set up the REPLY_ADD_STA command to send to device */ 293 /* Set up the REPLY_ADD_STA command to send to device */
294 memset(&station->sta, 0, sizeof(struct iwl_legacy_addsta_cmd)); 294 memset(&station->sta, 0, sizeof(struct il_addsta_cmd));
295 memcpy(station->sta.sta.addr, addr, ETH_ALEN); 295 memcpy(station->sta.sta.addr, addr, ETH_ALEN);
296 station->sta.mode = 0; 296 station->sta.mode = 0;
297 station->sta.sta.sta_id = sta_id; 297 station->sta.sta.sta_id = sta_id;
@@ -299,7 +299,7 @@ u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
299 station->ctxid = ctx->ctxid; 299 station->ctxid = ctx->ctxid;
300 300
301 if (sta) { 301 if (sta) {
302 struct iwl_station_priv_common *sta_priv; 302 struct il_station_priv_common *sta_priv;
303 303
304 sta_priv = (void *)sta->drv_priv; 304 sta_priv = (void *)sta->drv_priv;
305 sta_priv->ctx = ctx; 305 sta_priv->ctx = ctx;
@@ -310,40 +310,40 @@ u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
310 * STA and broadcast STA) pass in a NULL sta, and mac80211 310 * STA and broadcast STA) pass in a NULL sta, and mac80211
311 * doesn't allow HT IBSS. 311 * doesn't allow HT IBSS.
312 */ 312 */
313 iwl_legacy_set_ht_add_station(priv, sta_id, sta, ctx); 313 il_set_ht_add_station(priv, sta_id, sta, ctx);
314 314
315 /* 3945 only */ 315 /* 3945 only */
316 rate = (priv->band == IEEE80211_BAND_5GHZ) ? 316 rate = (priv->band == IEEE80211_BAND_5GHZ) ?
317 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP; 317 IL_RATE_6M_PLCP : IL_RATE_1M_PLCP;
318 /* Turn on both antennas for the station... */ 318 /* Turn on both antennas for the station... */
319 station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK); 319 station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK);
320 320
321 return sta_id; 321 return sta_id;
322 322
323} 323}
324EXPORT_SYMBOL_GPL(iwl_legacy_prep_station); 324EXPORT_SYMBOL_GPL(il_prep_station);
325 325
326#define STA_WAIT_TIMEOUT (HZ/2) 326#define STA_WAIT_TIMEOUT (HZ/2)
327 327
328/** 328/**
329 * iwl_legacy_add_station_common - 329 * il_add_station_common -
330 */ 330 */
331int 331int
332iwl_legacy_add_station_common(struct iwl_priv *priv, 332il_add_station_common(struct il_priv *priv,
333 struct iwl_rxon_context *ctx, 333 struct il_rxon_context *ctx,
334 const u8 *addr, bool is_ap, 334 const u8 *addr, bool is_ap,
335 struct ieee80211_sta *sta, u8 *sta_id_r) 335 struct ieee80211_sta *sta, u8 *sta_id_r)
336{ 336{
337 unsigned long flags_spin; 337 unsigned long flags_spin;
338 int ret = 0; 338 int ret = 0;
339 u8 sta_id; 339 u8 sta_id;
340 struct iwl_legacy_addsta_cmd sta_cmd; 340 struct il_addsta_cmd sta_cmd;
341 341
342 *sta_id_r = 0; 342 *sta_id_r = 0;
343 spin_lock_irqsave(&priv->sta_lock, flags_spin); 343 spin_lock_irqsave(&priv->sta_lock, flags_spin);
344 sta_id = iwl_legacy_prep_station(priv, ctx, addr, is_ap, sta); 344 sta_id = il_prep_station(priv, ctx, addr, is_ap, sta);
345 if (sta_id == IWL_INVALID_STATION) { 345 if (sta_id == IL_INVALID_STATION) {
346 IWL_ERR(priv, "Unable to prepare station %pM for addition\n", 346 IL_ERR(priv, "Unable to prepare station %pM for addition\n",
347 addr); 347 addr);
348 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 348 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
349 return -EINVAL; 349 return -EINVAL;
@@ -354,75 +354,75 @@ iwl_legacy_add_station_common(struct iwl_priv *priv,
354 * station. Keep track if one is in progress so that we do not send 354 * station. Keep track if one is in progress so that we do not send
355 * another. 355 * another.
356 */ 356 */
357 if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) { 357 if (priv->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) {
358 IWL_DEBUG_INFO(priv, 358 IL_DEBUG_INFO(priv,
359 "STA %d already in process of being added.\n", 359 "STA %d already in process of being added.\n",
360 sta_id); 360 sta_id);
361 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 361 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
362 return -EEXIST; 362 return -EEXIST;
363 } 363 }
364 364
365 if ((priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) && 365 if ((priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) &&
366 (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { 366 (priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) {
367 IWL_DEBUG_ASSOC(priv, 367 IL_DEBUG_ASSOC(priv,
368 "STA %d (%pM) already added, not adding again.\n", 368 "STA %d (%pM) already added, not adding again.\n",
369 sta_id, addr); 369 sta_id, addr);
370 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 370 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
371 return -EEXIST; 371 return -EEXIST;
372 } 372 }
373 373
374 priv->stations[sta_id].used |= IWL_STA_UCODE_INPROGRESS; 374 priv->stations[sta_id].used |= IL_STA_UCODE_INPROGRESS;
375 memcpy(&sta_cmd, &priv->stations[sta_id].sta, 375 memcpy(&sta_cmd, &priv->stations[sta_id].sta,
376 sizeof(struct iwl_legacy_addsta_cmd)); 376 sizeof(struct il_addsta_cmd));
377 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 377 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
378 378
379 /* Add station to device's station table */ 379 /* Add station to device's station table */
380 ret = iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); 380 ret = il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
381 if (ret) { 381 if (ret) {
382 spin_lock_irqsave(&priv->sta_lock, flags_spin); 382 spin_lock_irqsave(&priv->sta_lock, flags_spin);
383 IWL_ERR(priv, "Adding station %pM failed.\n", 383 IL_ERR(priv, "Adding station %pM failed.\n",
384 priv->stations[sta_id].sta.sta.addr); 384 priv->stations[sta_id].sta.sta.addr);
385 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; 385 priv->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE;
386 priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; 386 priv->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS;
387 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 387 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
388 } 388 }
389 *sta_id_r = sta_id; 389 *sta_id_r = sta_id;
390 return ret; 390 return ret;
391} 391}
392EXPORT_SYMBOL(iwl_legacy_add_station_common); 392EXPORT_SYMBOL(il_add_station_common);
393 393
394/** 394/**
395 * iwl_legacy_sta_ucode_deactivate - deactivate ucode status for a station 395 * il_sta_ucode_deactivate - deactivate ucode status for a station
396 * 396 *
397 * priv->sta_lock must be held 397 * priv->sta_lock must be held
398 */ 398 */
399static void iwl_legacy_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id) 399static void il_sta_ucode_deactivate(struct il_priv *priv, u8 sta_id)
400{ 400{
401 /* Ucode must be active and driver must be non active */ 401 /* Ucode must be active and driver must be non active */
402 if ((priv->stations[sta_id].used & 402 if ((priv->stations[sta_id].used &
403 (IWL_STA_UCODE_ACTIVE | IWL_STA_DRIVER_ACTIVE)) != 403 (IL_STA_UCODE_ACTIVE | IL_STA_DRIVER_ACTIVE)) !=
404 IWL_STA_UCODE_ACTIVE) 404 IL_STA_UCODE_ACTIVE)
405 IWL_ERR(priv, "removed non active STA %u\n", sta_id); 405 IL_ERR(priv, "removed non active STA %u\n", sta_id);
406 406
407 priv->stations[sta_id].used &= ~IWL_STA_UCODE_ACTIVE; 407 priv->stations[sta_id].used &= ~IL_STA_UCODE_ACTIVE;
408 408
409 memset(&priv->stations[sta_id], 0, sizeof(struct iwl_station_entry)); 409 memset(&priv->stations[sta_id], 0, sizeof(struct il_station_entry));
410 IWL_DEBUG_ASSOC(priv, "Removed STA %u\n", sta_id); 410 IL_DEBUG_ASSOC(priv, "Removed STA %u\n", sta_id);
411} 411}
412 412
413static int iwl_legacy_send_remove_station(struct iwl_priv *priv, 413static int il_send_remove_station(struct il_priv *priv,
414 const u8 *addr, int sta_id, 414 const u8 *addr, int sta_id,
415 bool temporary) 415 bool temporary)
416{ 416{
417 struct iwl_rx_packet *pkt; 417 struct il_rx_packet *pkt;
418 int ret; 418 int ret;
419 419
420 unsigned long flags_spin; 420 unsigned long flags_spin;
421 struct iwl_rem_sta_cmd rm_sta_cmd; 421 struct il_rem_sta_cmd rm_sta_cmd;
422 422
423 struct iwl_host_cmd cmd = { 423 struct il_host_cmd cmd = {
424 .id = REPLY_REMOVE_STA, 424 .id = REPLY_REMOVE_STA,
425 .len = sizeof(struct iwl_rem_sta_cmd), 425 .len = sizeof(struct il_rem_sta_cmd),
426 .flags = CMD_SYNC, 426 .flags = CMD_SYNC,
427 .data = &rm_sta_cmd, 427 .data = &rm_sta_cmd,
428 }; 428 };
@@ -433,14 +433,14 @@ static int iwl_legacy_send_remove_station(struct iwl_priv *priv,
433 433
434 cmd.flags |= CMD_WANT_SKB; 434 cmd.flags |= CMD_WANT_SKB;
435 435
436 ret = iwl_legacy_send_cmd(priv, &cmd); 436 ret = il_send_cmd(priv, &cmd);
437 437
438 if (ret) 438 if (ret)
439 return ret; 439 return ret;
440 440
441 pkt = (struct iwl_rx_packet *)cmd.reply_page; 441 pkt = (struct il_rx_packet *)cmd.reply_page;
442 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { 442 if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
443 IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", 443 IL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n",
444 pkt->hdr.flags); 444 pkt->hdr.flags);
445 ret = -EIO; 445 ret = -EIO;
446 } 446 }
@@ -450,33 +450,33 @@ static int iwl_legacy_send_remove_station(struct iwl_priv *priv,
450 case REM_STA_SUCCESS_MSK: 450 case REM_STA_SUCCESS_MSK:
451 if (!temporary) { 451 if (!temporary) {
452 spin_lock_irqsave(&priv->sta_lock, flags_spin); 452 spin_lock_irqsave(&priv->sta_lock, flags_spin);
453 iwl_legacy_sta_ucode_deactivate(priv, sta_id); 453 il_sta_ucode_deactivate(priv, sta_id);
454 spin_unlock_irqrestore(&priv->sta_lock, 454 spin_unlock_irqrestore(&priv->sta_lock,
455 flags_spin); 455 flags_spin);
456 } 456 }
457 IWL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n"); 457 IL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n");
458 break; 458 break;
459 default: 459 default:
460 ret = -EIO; 460 ret = -EIO;
461 IWL_ERR(priv, "REPLY_REMOVE_STA failed\n"); 461 IL_ERR(priv, "REPLY_REMOVE_STA failed\n");
462 break; 462 break;
463 } 463 }
464 } 464 }
465 iwl_legacy_free_pages(priv, cmd.reply_page); 465 il_free_pages(priv, cmd.reply_page);
466 466
467 return ret; 467 return ret;
468} 468}
469 469
470/** 470/**
471 * iwl_legacy_remove_station - Remove driver's knowledge of station. 471 * il_remove_station - Remove driver's knowledge of station.
472 */ 472 */
473int iwl_legacy_remove_station(struct iwl_priv *priv, const u8 sta_id, 473int il_remove_station(struct il_priv *priv, const u8 sta_id,
474 const u8 *addr) 474 const u8 *addr)
475{ 475{
476 unsigned long flags; 476 unsigned long flags;
477 477
478 if (!iwl_legacy_is_ready(priv)) { 478 if (!il_is_ready(priv)) {
479 IWL_DEBUG_INFO(priv, 479 IL_DEBUG_INFO(priv,
480 "Unable to remove station %pM, device not ready.\n", 480 "Unable to remove station %pM, device not ready.\n",
481 addr); 481 addr);
482 /* 482 /*
@@ -487,32 +487,32 @@ int iwl_legacy_remove_station(struct iwl_priv *priv, const u8 sta_id,
487 return 0; 487 return 0;
488 } 488 }
489 489
490 IWL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n", 490 IL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n",
491 sta_id, addr); 491 sta_id, addr);
492 492
493 if (WARN_ON(sta_id == IWL_INVALID_STATION)) 493 if (WARN_ON(sta_id == IL_INVALID_STATION))
494 return -EINVAL; 494 return -EINVAL;
495 495
496 spin_lock_irqsave(&priv->sta_lock, flags); 496 spin_lock_irqsave(&priv->sta_lock, flags);
497 497
498 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { 498 if (!(priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) {
499 IWL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", 499 IL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n",
500 addr); 500 addr);
501 goto out_err; 501 goto out_err;
502 } 502 }
503 503
504 if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { 504 if (!(priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) {
505 IWL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n", 505 IL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n",
506 addr); 506 addr);
507 goto out_err; 507 goto out_err;
508 } 508 }
509 509
510 if (priv->stations[sta_id].used & IWL_STA_LOCAL) { 510 if (priv->stations[sta_id].used & IL_STA_LOCAL) {
511 kfree(priv->stations[sta_id].lq); 511 kfree(priv->stations[sta_id].lq);
512 priv->stations[sta_id].lq = NULL; 512 priv->stations[sta_id].lq = NULL;
513 } 513 }
514 514
515 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; 515 priv->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE;
516 516
517 priv->num_stations--; 517 priv->num_stations--;
518 518
@@ -520,52 +520,52 @@ int iwl_legacy_remove_station(struct iwl_priv *priv, const u8 sta_id,
520 520
521 spin_unlock_irqrestore(&priv->sta_lock, flags); 521 spin_unlock_irqrestore(&priv->sta_lock, flags);
522 522
523 return iwl_legacy_send_remove_station(priv, addr, sta_id, false); 523 return il_send_remove_station(priv, addr, sta_id, false);
524out_err: 524out_err:
525 spin_unlock_irqrestore(&priv->sta_lock, flags); 525 spin_unlock_irqrestore(&priv->sta_lock, flags);
526 return -EINVAL; 526 return -EINVAL;
527} 527}
528EXPORT_SYMBOL_GPL(iwl_legacy_remove_station); 528EXPORT_SYMBOL_GPL(il_remove_station);
529 529
530/** 530/**
531 * iwl_legacy_clear_ucode_stations - clear ucode station table bits 531 * il_clear_ucode_stations - clear ucode station table bits
532 * 532 *
533 * This function clears all the bits in the driver indicating 533 * This function clears all the bits in the driver indicating
534 * which stations are active in the ucode. Call when something 534 * which stations are active in the ucode. Call when something
535 * other than explicit station management would cause this in 535 * other than explicit station management would cause this in
536 * the ucode, e.g. unassociated RXON. 536 * the ucode, e.g. unassociated RXON.
537 */ 537 */
538void iwl_legacy_clear_ucode_stations(struct iwl_priv *priv, 538void il_clear_ucode_stations(struct il_priv *priv,
539 struct iwl_rxon_context *ctx) 539 struct il_rxon_context *ctx)
540{ 540{
541 int i; 541 int i;
542 unsigned long flags_spin; 542 unsigned long flags_spin;
543 bool cleared = false; 543 bool cleared = false;
544 544
545 IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n"); 545 IL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n");
546 546
547 spin_lock_irqsave(&priv->sta_lock, flags_spin); 547 spin_lock_irqsave(&priv->sta_lock, flags_spin);
548 for (i = 0; i < priv->hw_params.max_stations; i++) { 548 for (i = 0; i < priv->hw_params.max_stations; i++) {
549 if (ctx && ctx->ctxid != priv->stations[i].ctxid) 549 if (ctx && ctx->ctxid != priv->stations[i].ctxid)
550 continue; 550 continue;
551 551
552 if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { 552 if (priv->stations[i].used & IL_STA_UCODE_ACTIVE) {
553 IWL_DEBUG_INFO(priv, 553 IL_DEBUG_INFO(priv,
554 "Clearing ucode active for station %d\n", i); 554 "Clearing ucode active for station %d\n", i);
555 priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; 555 priv->stations[i].used &= ~IL_STA_UCODE_ACTIVE;
556 cleared = true; 556 cleared = true;
557 } 557 }
558 } 558 }
559 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 559 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
560 560
561 if (!cleared) 561 if (!cleared)
562 IWL_DEBUG_INFO(priv, 562 IL_DEBUG_INFO(priv,
563 "No active stations found to be cleared\n"); 563 "No active stations found to be cleared\n");
564} 564}
565EXPORT_SYMBOL(iwl_legacy_clear_ucode_stations); 565EXPORT_SYMBOL(il_clear_ucode_stations);
566 566
567/** 567/**
568 * iwl_legacy_restore_stations() - Restore driver known stations to device 568 * il_restore_stations() - Restore driver known stations to device
569 * 569 *
570 * All stations considered active by driver, but not present in ucode, is 570 * All stations considered active by driver, but not present in ucode, is
571 * restored. 571 * restored.
@@ -573,57 +573,57 @@ EXPORT_SYMBOL(iwl_legacy_clear_ucode_stations);
573 * Function sleeps. 573 * Function sleeps.
574 */ 574 */
575void 575void
576iwl_legacy_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) 576il_restore_stations(struct il_priv *priv, struct il_rxon_context *ctx)
577{ 577{
578 struct iwl_legacy_addsta_cmd sta_cmd; 578 struct il_addsta_cmd sta_cmd;
579 struct iwl_link_quality_cmd lq; 579 struct il_link_quality_cmd lq;
580 unsigned long flags_spin; 580 unsigned long flags_spin;
581 int i; 581 int i;
582 bool found = false; 582 bool found = false;
583 int ret; 583 int ret;
584 bool send_lq; 584 bool send_lq;
585 585
586 if (!iwl_legacy_is_ready(priv)) { 586 if (!il_is_ready(priv)) {
587 IWL_DEBUG_INFO(priv, 587 IL_DEBUG_INFO(priv,
588 "Not ready yet, not restoring any stations.\n"); 588 "Not ready yet, not restoring any stations.\n");
589 return; 589 return;
590 } 590 }
591 591
592 IWL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n"); 592 IL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n");
593 spin_lock_irqsave(&priv->sta_lock, flags_spin); 593 spin_lock_irqsave(&priv->sta_lock, flags_spin);
594 for (i = 0; i < priv->hw_params.max_stations; i++) { 594 for (i = 0; i < priv->hw_params.max_stations; i++) {
595 if (ctx->ctxid != priv->stations[i].ctxid) 595 if (ctx->ctxid != priv->stations[i].ctxid)
596 continue; 596 continue;
597 if ((priv->stations[i].used & IWL_STA_DRIVER_ACTIVE) && 597 if ((priv->stations[i].used & IL_STA_DRIVER_ACTIVE) &&
598 !(priv->stations[i].used & IWL_STA_UCODE_ACTIVE)) { 598 !(priv->stations[i].used & IL_STA_UCODE_ACTIVE)) {
599 IWL_DEBUG_ASSOC(priv, "Restoring sta %pM\n", 599 IL_DEBUG_ASSOC(priv, "Restoring sta %pM\n",
600 priv->stations[i].sta.sta.addr); 600 priv->stations[i].sta.sta.addr);
601 priv->stations[i].sta.mode = 0; 601 priv->stations[i].sta.mode = 0;
602 priv->stations[i].used |= IWL_STA_UCODE_INPROGRESS; 602 priv->stations[i].used |= IL_STA_UCODE_INPROGRESS;
603 found = true; 603 found = true;
604 } 604 }
605 } 605 }
606 606
607 for (i = 0; i < priv->hw_params.max_stations; i++) { 607 for (i = 0; i < priv->hw_params.max_stations; i++) {
608 if ((priv->stations[i].used & IWL_STA_UCODE_INPROGRESS)) { 608 if ((priv->stations[i].used & IL_STA_UCODE_INPROGRESS)) {
609 memcpy(&sta_cmd, &priv->stations[i].sta, 609 memcpy(&sta_cmd, &priv->stations[i].sta,
610 sizeof(struct iwl_legacy_addsta_cmd)); 610 sizeof(struct il_addsta_cmd));
611 send_lq = false; 611 send_lq = false;
612 if (priv->stations[i].lq) { 612 if (priv->stations[i].lq) {
613 memcpy(&lq, priv->stations[i].lq, 613 memcpy(&lq, priv->stations[i].lq,
614 sizeof(struct iwl_link_quality_cmd)); 614 sizeof(struct il_link_quality_cmd));
615 send_lq = true; 615 send_lq = true;
616 } 616 }
617 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 617 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
618 ret = iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); 618 ret = il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
619 if (ret) { 619 if (ret) {
620 spin_lock_irqsave(&priv->sta_lock, flags_spin); 620 spin_lock_irqsave(&priv->sta_lock, flags_spin);
621 IWL_ERR(priv, "Adding station %pM failed.\n", 621 IL_ERR(priv, "Adding station %pM failed.\n",
622 priv->stations[i].sta.sta.addr); 622 priv->stations[i].sta.sta.addr);
623 priv->stations[i].used &= 623 priv->stations[i].used &=
624 ~IWL_STA_DRIVER_ACTIVE; 624 ~IL_STA_DRIVER_ACTIVE;
625 priv->stations[i].used &= 625 priv->stations[i].used &=
626 ~IWL_STA_UCODE_INPROGRESS; 626 ~IL_STA_UCODE_INPROGRESS;
627 spin_unlock_irqrestore(&priv->sta_lock, 627 spin_unlock_irqrestore(&priv->sta_lock,
628 flags_spin); 628 flags_spin);
629 } 629 }
@@ -632,24 +632,24 @@ iwl_legacy_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
632 * current LQ command 632 * current LQ command
633 */ 633 */
634 if (send_lq) 634 if (send_lq)
635 iwl_legacy_send_lq_cmd(priv, ctx, &lq, 635 il_send_lq_cmd(priv, ctx, &lq,
636 CMD_SYNC, true); 636 CMD_SYNC, true);
637 spin_lock_irqsave(&priv->sta_lock, flags_spin); 637 spin_lock_irqsave(&priv->sta_lock, flags_spin);
638 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; 638 priv->stations[i].used &= ~IL_STA_UCODE_INPROGRESS;
639 } 639 }
640 } 640 }
641 641
642 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 642 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
643 if (!found) 643 if (!found)
644 IWL_DEBUG_INFO(priv, "Restoring all known stations" 644 IL_DEBUG_INFO(priv, "Restoring all known stations"
645 " .... no stations to be restored.\n"); 645 " .... no stations to be restored.\n");
646 else 646 else
647 IWL_DEBUG_INFO(priv, "Restoring all known stations" 647 IL_DEBUG_INFO(priv, "Restoring all known stations"
648 " .... complete.\n"); 648 " .... complete.\n");
649} 649}
650EXPORT_SYMBOL(iwl_legacy_restore_stations); 650EXPORT_SYMBOL(il_restore_stations);
651 651
652int iwl_legacy_get_free_ucode_key_index(struct iwl_priv *priv) 652int il_get_free_ucode_key_index(struct il_priv *priv)
653{ 653{
654 int i; 654 int i;
655 655
@@ -659,19 +659,19 @@ int iwl_legacy_get_free_ucode_key_index(struct iwl_priv *priv)
659 659
660 return WEP_INVALID_OFFSET; 660 return WEP_INVALID_OFFSET;
661} 661}
662EXPORT_SYMBOL(iwl_legacy_get_free_ucode_key_index); 662EXPORT_SYMBOL(il_get_free_ucode_key_index);
663 663
664void iwl_legacy_dealloc_bcast_stations(struct iwl_priv *priv) 664void il_dealloc_bcast_stations(struct il_priv *priv)
665{ 665{
666 unsigned long flags; 666 unsigned long flags;
667 int i; 667 int i;
668 668
669 spin_lock_irqsave(&priv->sta_lock, flags); 669 spin_lock_irqsave(&priv->sta_lock, flags);
670 for (i = 0; i < priv->hw_params.max_stations; i++) { 670 for (i = 0; i < priv->hw_params.max_stations; i++) {
671 if (!(priv->stations[i].used & IWL_STA_BCAST)) 671 if (!(priv->stations[i].used & IL_STA_BCAST))
672 continue; 672 continue;
673 673
674 priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; 674 priv->stations[i].used &= ~IL_STA_UCODE_ACTIVE;
675 priv->num_stations--; 675 priv->num_stations--;
676 BUG_ON(priv->num_stations < 0); 676 BUG_ON(priv->num_stations < 0);
677 kfree(priv->stations[i].lq); 677 kfree(priv->stations[i].lq);
@@ -679,31 +679,31 @@ void iwl_legacy_dealloc_bcast_stations(struct iwl_priv *priv)
679 } 679 }
680 spin_unlock_irqrestore(&priv->sta_lock, flags); 680 spin_unlock_irqrestore(&priv->sta_lock, flags);
681} 681}
682EXPORT_SYMBOL_GPL(iwl_legacy_dealloc_bcast_stations); 682EXPORT_SYMBOL_GPL(il_dealloc_bcast_stations);
683 683
684#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 684#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
685static void iwl_legacy_dump_lq_cmd(struct iwl_priv *priv, 685static void il_dump_lq_cmd(struct il_priv *priv,
686 struct iwl_link_quality_cmd *lq) 686 struct il_link_quality_cmd *lq)
687{ 687{
688 int i; 688 int i;
689 IWL_DEBUG_RATE(priv, "lq station id 0x%x\n", lq->sta_id); 689 IL_DEBUG_RATE(priv, "lq station id 0x%x\n", lq->sta_id);
690 IWL_DEBUG_RATE(priv, "lq ant 0x%X 0x%X\n", 690 IL_DEBUG_RATE(priv, "lq ant 0x%X 0x%X\n",
691 lq->general_params.single_stream_ant_msk, 691 lq->general_params.single_stream_ant_msk,
692 lq->general_params.dual_stream_ant_msk); 692 lq->general_params.dual_stream_ant_msk);
693 693
694 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) 694 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
695 IWL_DEBUG_RATE(priv, "lq index %d 0x%X\n", 695 IL_DEBUG_RATE(priv, "lq index %d 0x%X\n",
696 i, lq->rs_table[i].rate_n_flags); 696 i, lq->rs_table[i].rate_n_flags);
697} 697}
698#else 698#else
699static inline void iwl_legacy_dump_lq_cmd(struct iwl_priv *priv, 699static inline void il_dump_lq_cmd(struct il_priv *priv,
700 struct iwl_link_quality_cmd *lq) 700 struct il_link_quality_cmd *lq)
701{ 701{
702} 702}
703#endif 703#endif
704 704
705/** 705/**
706 * iwl_legacy_is_lq_table_valid() - Test one aspect of LQ cmd for validity 706 * il_is_lq_table_valid() - Test one aspect of LQ cmd for validity
707 * 707 *
708 * It sometimes happens when a HT rate has been in use and we 708 * It sometimes happens when a HT rate has been in use and we
709 * loose connectivity with AP then mac80211 will first tell us that the 709 * loose connectivity with AP then mac80211 will first tell us that the
@@ -713,21 +713,21 @@ static inline void iwl_legacy_dump_lq_cmd(struct iwl_priv *priv,
713 * Test for this to prevent driver from sending LQ command between the time 713 * Test for this to prevent driver from sending LQ command between the time
714 * RXON flags are updated and when LQ command is updated. 714 * RXON flags are updated and when LQ command is updated.
715 */ 715 */
716static bool iwl_legacy_is_lq_table_valid(struct iwl_priv *priv, 716static bool il_is_lq_table_valid(struct il_priv *priv,
717 struct iwl_rxon_context *ctx, 717 struct il_rxon_context *ctx,
718 struct iwl_link_quality_cmd *lq) 718 struct il_link_quality_cmd *lq)
719{ 719{
720 int i; 720 int i;
721 721
722 if (ctx->ht.enabled) 722 if (ctx->ht.enabled)
723 return true; 723 return true;
724 724
725 IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", 725 IL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n",
726 ctx->active.channel); 726 ctx->active.channel);
727 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { 727 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) {
728 if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & 728 if (le32_to_cpu(lq->rs_table[i].rate_n_flags) &
729 RATE_MCS_HT_MSK) { 729 RATE_MCS_HT_MSK) {
730 IWL_DEBUG_INFO(priv, 730 IL_DEBUG_INFO(priv,
731 "index %d of LQ expects HT channel\n", 731 "index %d of LQ expects HT channel\n",
732 i); 732 i);
733 return false; 733 return false;
@@ -737,7 +737,7 @@ static bool iwl_legacy_is_lq_table_valid(struct iwl_priv *priv,
737} 737}
738 738
739/** 739/**
740 * iwl_legacy_send_lq_cmd() - Send link quality command 740 * il_send_lq_cmd() - Send link quality command
741 * @init: This command is sent as part of station initialization right 741 * @init: This command is sent as part of station initialization right
742 * after station has been added. 742 * after station has been added.
743 * 743 *
@@ -746,35 +746,35 @@ static bool iwl_legacy_is_lq_table_valid(struct iwl_priv *priv,
746 * this case to clear the state indicating that station creation is in 746 * this case to clear the state indicating that station creation is in
747 * progress. 747 * progress.
748 */ 748 */
749int iwl_legacy_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 749int il_send_lq_cmd(struct il_priv *priv, struct il_rxon_context *ctx,
750 struct iwl_link_quality_cmd *lq, u8 flags, bool init) 750 struct il_link_quality_cmd *lq, u8 flags, bool init)
751{ 751{
752 int ret = 0; 752 int ret = 0;
753 unsigned long flags_spin; 753 unsigned long flags_spin;
754 754
755 struct iwl_host_cmd cmd = { 755 struct il_host_cmd cmd = {
756 .id = REPLY_TX_LINK_QUALITY_CMD, 756 .id = REPLY_TX_LINK_QUALITY_CMD,
757 .len = sizeof(struct iwl_link_quality_cmd), 757 .len = sizeof(struct il_link_quality_cmd),
758 .flags = flags, 758 .flags = flags,
759 .data = lq, 759 .data = lq,
760 }; 760 };
761 761
762 if (WARN_ON(lq->sta_id == IWL_INVALID_STATION)) 762 if (WARN_ON(lq->sta_id == IL_INVALID_STATION))
763 return -EINVAL; 763 return -EINVAL;
764 764
765 765
766 spin_lock_irqsave(&priv->sta_lock, flags_spin); 766 spin_lock_irqsave(&priv->sta_lock, flags_spin);
767 if (!(priv->stations[lq->sta_id].used & IWL_STA_DRIVER_ACTIVE)) { 767 if (!(priv->stations[lq->sta_id].used & IL_STA_DRIVER_ACTIVE)) {
768 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 768 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
769 return -EINVAL; 769 return -EINVAL;
770 } 770 }
771 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 771 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
772 772
773 iwl_legacy_dump_lq_cmd(priv, lq); 773 il_dump_lq_cmd(priv, lq);
774 BUG_ON(init && (cmd.flags & CMD_ASYNC)); 774 BUG_ON(init && (cmd.flags & CMD_ASYNC));
775 775
776 if (iwl_legacy_is_lq_table_valid(priv, ctx, lq)) 776 if (il_is_lq_table_valid(priv, ctx, lq))
777 ret = iwl_legacy_send_cmd(priv, &cmd); 777 ret = il_send_cmd(priv, &cmd);
778 else 778 else
779 ret = -EINVAL; 779 ret = -EINVAL;
780 780
@@ -782,35 +782,35 @@ int iwl_legacy_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
782 return ret; 782 return ret;
783 783
784 if (init) { 784 if (init) {
785 IWL_DEBUG_INFO(priv, "init LQ command complete," 785 IL_DEBUG_INFO(priv, "init LQ command complete,"
786 " clearing sta addition status for sta %d\n", 786 " clearing sta addition status for sta %d\n",
787 lq->sta_id); 787 lq->sta_id);
788 spin_lock_irqsave(&priv->sta_lock, flags_spin); 788 spin_lock_irqsave(&priv->sta_lock, flags_spin);
789 priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; 789 priv->stations[lq->sta_id].used &= ~IL_STA_UCODE_INPROGRESS;
790 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 790 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
791 } 791 }
792 return ret; 792 return ret;
793} 793}
794EXPORT_SYMBOL(iwl_legacy_send_lq_cmd); 794EXPORT_SYMBOL(il_send_lq_cmd);
795 795
796int iwl_legacy_mac_sta_remove(struct ieee80211_hw *hw, 796int il_mac_sta_remove(struct ieee80211_hw *hw,
797 struct ieee80211_vif *vif, 797 struct ieee80211_vif *vif,
798 struct ieee80211_sta *sta) 798 struct ieee80211_sta *sta)
799{ 799{
800 struct iwl_priv *priv = hw->priv; 800 struct il_priv *priv = hw->priv;
801 struct iwl_station_priv_common *sta_common = (void *)sta->drv_priv; 801 struct il_station_priv_common *sta_common = (void *)sta->drv_priv;
802 int ret; 802 int ret;
803 803
804 IWL_DEBUG_INFO(priv, "received request to remove station %pM\n", 804 IL_DEBUG_INFO(priv, "received request to remove station %pM\n",
805 sta->addr); 805 sta->addr);
806 mutex_lock(&priv->mutex); 806 mutex_lock(&priv->mutex);
807 IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n", 807 IL_DEBUG_INFO(priv, "proceeding to remove station %pM\n",
808 sta->addr); 808 sta->addr);
809 ret = iwl_legacy_remove_station(priv, sta_common->sta_id, sta->addr); 809 ret = il_remove_station(priv, sta_common->sta_id, sta->addr);
810 if (ret) 810 if (ret)
811 IWL_ERR(priv, "Error removing station %pM\n", 811 IL_ERR(priv, "Error removing station %pM\n",
812 sta->addr); 812 sta->addr);
813 mutex_unlock(&priv->mutex); 813 mutex_unlock(&priv->mutex);
814 return ret; 814 return ret;
815} 815}
816EXPORT_SYMBOL(iwl_legacy_mac_sta_remove); 816EXPORT_SYMBOL(il_mac_sta_remove);
diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.h b/drivers/net/wireless/iwlegacy/iwl-sta.h
index 67bd75fe01a1..555b0602cea0 100644
--- a/drivers/net/wireless/iwlegacy/iwl-sta.h
+++ b/drivers/net/wireless/iwlegacy/iwl-sta.h
@@ -26,65 +26,65 @@
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29#ifndef __iwl_legacy_sta_h__ 29#ifndef __il_sta_h__
30#define __iwl_legacy_sta_h__ 30#define __il_sta_h__
31 31
32#include "iwl-dev.h" 32#include "iwl-dev.h"
33 33
34#define HW_KEY_DYNAMIC 0 34#define HW_KEY_DYNAMIC 0
35#define HW_KEY_DEFAULT 1 35#define HW_KEY_DEFAULT 1
36 36
37#define IWL_STA_DRIVER_ACTIVE BIT(0) /* driver entry is active */ 37#define IL_STA_DRIVER_ACTIVE BIT(0) /* driver entry is active */
38#define IWL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */ 38#define IL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */
39#define IWL_STA_UCODE_INPROGRESS BIT(2) /* ucode entry is in process of 39#define IL_STA_UCODE_INPROGRESS BIT(2) /* ucode entry is in process of
40 being activated */ 40 being activated */
41#define IWL_STA_LOCAL BIT(3) /* station state not directed by mac80211; 41#define IL_STA_LOCAL BIT(3) /* station state not directed by mac80211;
42 (this is for the IBSS BSSID stations) */ 42 (this is for the IBSS BSSID stations) */
43#define IWL_STA_BCAST BIT(4) /* this station is the special bcast station */ 43#define IL_STA_BCAST BIT(4) /* this station is the special bcast station */
44 44
45 45
46void iwl_legacy_restore_stations(struct iwl_priv *priv, 46void il_restore_stations(struct il_priv *priv,
47 struct iwl_rxon_context *ctx); 47 struct il_rxon_context *ctx);
48void iwl_legacy_clear_ucode_stations(struct iwl_priv *priv, 48void il_clear_ucode_stations(struct il_priv *priv,
49 struct iwl_rxon_context *ctx); 49 struct il_rxon_context *ctx);
50void iwl_legacy_dealloc_bcast_stations(struct iwl_priv *priv); 50void il_dealloc_bcast_stations(struct il_priv *priv);
51int iwl_legacy_get_free_ucode_key_index(struct iwl_priv *priv); 51int il_get_free_ucode_key_index(struct il_priv *priv);
52int iwl_legacy_send_add_sta(struct iwl_priv *priv, 52int il_send_add_sta(struct il_priv *priv,
53 struct iwl_legacy_addsta_cmd *sta, u8 flags); 53 struct il_addsta_cmd *sta, u8 flags);
54int iwl_legacy_add_station_common(struct iwl_priv *priv, 54int il_add_station_common(struct il_priv *priv,
55 struct iwl_rxon_context *ctx, 55 struct il_rxon_context *ctx,
56 const u8 *addr, bool is_ap, 56 const u8 *addr, bool is_ap,
57 struct ieee80211_sta *sta, u8 *sta_id_r); 57 struct ieee80211_sta *sta, u8 *sta_id_r);
58int iwl_legacy_remove_station(struct iwl_priv *priv, 58int il_remove_station(struct il_priv *priv,
59 const u8 sta_id, 59 const u8 sta_id,
60 const u8 *addr); 60 const u8 *addr);
61int iwl_legacy_mac_sta_remove(struct ieee80211_hw *hw, 61int il_mac_sta_remove(struct ieee80211_hw *hw,
62 struct ieee80211_vif *vif, 62 struct ieee80211_vif *vif,
63 struct ieee80211_sta *sta); 63 struct ieee80211_sta *sta);
64 64
65u8 iwl_legacy_prep_station(struct iwl_priv *priv, 65u8 il_prep_station(struct il_priv *priv,
66 struct iwl_rxon_context *ctx, 66 struct il_rxon_context *ctx,
67 const u8 *addr, bool is_ap, 67 const u8 *addr, bool is_ap,
68 struct ieee80211_sta *sta); 68 struct ieee80211_sta *sta);
69 69
70int iwl_legacy_send_lq_cmd(struct iwl_priv *priv, 70int il_send_lq_cmd(struct il_priv *priv,
71 struct iwl_rxon_context *ctx, 71 struct il_rxon_context *ctx,
72 struct iwl_link_quality_cmd *lq, 72 struct il_link_quality_cmd *lq,
73 u8 flags, bool init); 73 u8 flags, bool init);
74 74
75/** 75/**
76 * iwl_legacy_clear_driver_stations - clear knowledge of all stations from driver 76 * il_clear_driver_stations - clear knowledge of all stations from driver
77 * @priv: iwl priv struct 77 * @priv: iwl priv struct
78 * 78 *
79 * This is called during iwl_down() to make sure that in the case 79 * This is called during il_down() to make sure that in the case
80 * we're coming there from a hardware restart mac80211 will be 80 * we're coming there from a hardware restart mac80211 will be
81 * able to reconfigure stations -- if we're getting there in the 81 * able to reconfigure stations -- if we're getting there in the
82 * normal down flow then the stations will already be cleared. 82 * normal down flow then the stations will already be cleared.
83 */ 83 */
84static inline void iwl_legacy_clear_driver_stations(struct iwl_priv *priv) 84static inline void il_clear_driver_stations(struct il_priv *priv)
85{ 85{
86 unsigned long flags; 86 unsigned long flags;
87 struct iwl_rxon_context *ctx; 87 struct il_rxon_context *ctx;
88 88
89 spin_lock_irqsave(&priv->sta_lock, flags); 89 spin_lock_irqsave(&priv->sta_lock, flags);
90 memset(priv->stations, 0, sizeof(priv->stations)); 90 memset(priv->stations, 0, sizeof(priv->stations));
@@ -107,16 +107,16 @@ static inline void iwl_legacy_clear_driver_stations(struct iwl_priv *priv)
107 spin_unlock_irqrestore(&priv->sta_lock, flags); 107 spin_unlock_irqrestore(&priv->sta_lock, flags);
108} 108}
109 109
110static inline int iwl_legacy_sta_id(struct ieee80211_sta *sta) 110static inline int il_sta_id(struct ieee80211_sta *sta)
111{ 111{
112 if (WARN_ON(!sta)) 112 if (WARN_ON(!sta))
113 return IWL_INVALID_STATION; 113 return IL_INVALID_STATION;
114 114
115 return ((struct iwl_station_priv_common *)sta->drv_priv)->sta_id; 115 return ((struct il_station_priv_common *)sta->drv_priv)->sta_id;
116} 116}
117 117
118/** 118/**
119 * iwl_legacy_sta_id_or_broadcast - return sta_id or broadcast sta 119 * il_sta_id_or_broadcast - return sta_id or broadcast sta
120 * @priv: iwl priv 120 * @priv: iwl priv
121 * @context: the current context 121 * @context: the current context
122 * @sta: mac80211 station 122 * @sta: mac80211 station
@@ -126,8 +126,8 @@ static inline int iwl_legacy_sta_id(struct ieee80211_sta *sta)
126 * that case, we need to use the broadcast station, so this 126 * that case, we need to use the broadcast station, so this
127 * inline wraps that pattern. 127 * inline wraps that pattern.
128 */ 128 */
129static inline int iwl_legacy_sta_id_or_broadcast(struct iwl_priv *priv, 129static inline int il_sta_id_or_broadcast(struct il_priv *priv,
130 struct iwl_rxon_context *context, 130 struct il_rxon_context *context,
131 struct ieee80211_sta *sta) 131 struct ieee80211_sta *sta)
132{ 132{
133 int sta_id; 133 int sta_id;
@@ -135,14 +135,14 @@ static inline int iwl_legacy_sta_id_or_broadcast(struct iwl_priv *priv,
135 if (!sta) 135 if (!sta)
136 return context->bcast_sta_id; 136 return context->bcast_sta_id;
137 137
138 sta_id = iwl_legacy_sta_id(sta); 138 sta_id = il_sta_id(sta);
139 139
140 /* 140 /*
141 * mac80211 should not be passing a partially 141 * mac80211 should not be passing a partially
142 * initialised station! 142 * initialised station!
143 */ 143 */
144 WARN_ON(sta_id == IWL_INVALID_STATION); 144 WARN_ON(sta_id == IL_INVALID_STATION);
145 145
146 return sta_id; 146 return sta_id;
147} 147}
148#endif /* __iwl_legacy_sta_h__ */ 148#endif /* __il_sta_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c
index e1a559b8630f..1c27c60c753a 100644
--- a/drivers/net/wireless/iwlegacy/iwl-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-tx.c
@@ -39,10 +39,10 @@
39#include "iwl-helpers.h" 39#include "iwl-helpers.h"
40 40
41/** 41/**
42 * iwl_legacy_txq_update_write_ptr - Send new write index to hardware 42 * il_txq_update_write_ptr - Send new write index to hardware
43 */ 43 */
44void 44void
45iwl_legacy_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq) 45il_txq_update_write_ptr(struct il_priv *priv, struct il_tx_queue *txq)
46{ 46{
47 u32 reg = 0; 47 u32 reg = 0;
48 int txq_id = txq->q.id; 48 int txq_id = txq->q.id;
@@ -55,18 +55,18 @@ iwl_legacy_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq)
55 /* wake up nic if it's powered down ... 55 /* wake up nic if it's powered down ...
56 * uCode will wake up, and interrupt us again, so next 56 * uCode will wake up, and interrupt us again, so next
57 * time we'll skip this part. */ 57 * time we'll skip this part. */
58 reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); 58 reg = il_read32(priv, CSR_UCODE_DRV_GP1);
59 59
60 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { 60 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
61 IWL_DEBUG_INFO(priv, 61 IL_DEBUG_INFO(priv,
62 "Tx queue %d requesting wakeup," 62 "Tx queue %d requesting wakeup,"
63 " GP1 = 0x%x\n", txq_id, reg); 63 " GP1 = 0x%x\n", txq_id, reg);
64 iwl_legacy_set_bit(priv, CSR_GP_CNTRL, 64 il_set_bit(priv, CSR_GP_CNTRL,
65 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 65 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
66 return; 66 return;
67 } 67 }
68 68
69 iwl_legacy_write_direct32(priv, HBUS_TARG_WRPTR, 69 il_write_direct32(priv, HBUS_TARG_WRPTR,
70 txq->q.write_ptr | (txq_id << 8)); 70 txq->q.write_ptr | (txq_id << 8));
71 71
72 /* 72 /*
@@ -75,45 +75,45 @@ iwl_legacy_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq)
75 * trying to tx (during RFKILL, we're not trying to tx). 75 * trying to tx (during RFKILL, we're not trying to tx).
76 */ 76 */
77 } else 77 } else
78 iwl_write32(priv, HBUS_TARG_WRPTR, 78 il_write32(priv, HBUS_TARG_WRPTR,
79 txq->q.write_ptr | (txq_id << 8)); 79 txq->q.write_ptr | (txq_id << 8));
80 txq->need_update = 0; 80 txq->need_update = 0;
81} 81}
82EXPORT_SYMBOL(iwl_legacy_txq_update_write_ptr); 82EXPORT_SYMBOL(il_txq_update_write_ptr);
83 83
84/** 84/**
85 * iwl_legacy_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's 85 * il_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's
86 */ 86 */
87void iwl_legacy_tx_queue_unmap(struct iwl_priv *priv, int txq_id) 87void il_tx_queue_unmap(struct il_priv *priv, int txq_id)
88{ 88{
89 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 89 struct il_tx_queue *txq = &priv->txq[txq_id];
90 struct iwl_queue *q = &txq->q; 90 struct il_queue *q = &txq->q;
91 91
92 if (q->n_bd == 0) 92 if (q->n_bd == 0)
93 return; 93 return;
94 94
95 while (q->write_ptr != q->read_ptr) { 95 while (q->write_ptr != q->read_ptr) {
96 priv->cfg->ops->lib->txq_free_tfd(priv, txq); 96 priv->cfg->ops->lib->txq_free_tfd(priv, txq);
97 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd); 97 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd);
98 } 98 }
99} 99}
100EXPORT_SYMBOL(iwl_legacy_tx_queue_unmap); 100EXPORT_SYMBOL(il_tx_queue_unmap);
101 101
102/** 102/**
103 * iwl_legacy_tx_queue_free - Deallocate DMA queue. 103 * il_tx_queue_free - Deallocate DMA queue.
104 * @txq: Transmit queue to deallocate. 104 * @txq: Transmit queue to deallocate.
105 * 105 *
106 * Empty queue by removing and destroying all BD's. 106 * Empty queue by removing and destroying all BD's.
107 * Free all buffers. 107 * Free all buffers.
108 * 0-fill, but do not free "txq" descriptor structure. 108 * 0-fill, but do not free "txq" descriptor structure.
109 */ 109 */
110void iwl_legacy_tx_queue_free(struct iwl_priv *priv, int txq_id) 110void il_tx_queue_free(struct il_priv *priv, int txq_id)
111{ 111{
112 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 112 struct il_tx_queue *txq = &priv->txq[txq_id];
113 struct device *dev = &priv->pci_dev->dev; 113 struct device *dev = &priv->pci_dev->dev;
114 int i; 114 int i;
115 115
116 iwl_legacy_tx_queue_unmap(priv, txq_id); 116 il_tx_queue_unmap(priv, txq_id);
117 117
118 /* De-alloc array of command/tx buffers */ 118 /* De-alloc array of command/tx buffers */
119 for (i = 0; i < TFD_TX_CMD_SLOTS; i++) 119 for (i = 0; i < TFD_TX_CMD_SLOTS; i++)
@@ -137,22 +137,22 @@ void iwl_legacy_tx_queue_free(struct iwl_priv *priv, int txq_id)
137 /* 0-fill queue descriptor structure */ 137 /* 0-fill queue descriptor structure */
138 memset(txq, 0, sizeof(*txq)); 138 memset(txq, 0, sizeof(*txq));
139} 139}
140EXPORT_SYMBOL(iwl_legacy_tx_queue_free); 140EXPORT_SYMBOL(il_tx_queue_free);
141 141
142/** 142/**
143 * iwl_cmd_queue_unmap - Unmap any remaining DMA mappings from command queue 143 * il_cmd_queue_unmap - Unmap any remaining DMA mappings from command queue
144 */ 144 */
145void iwl_legacy_cmd_queue_unmap(struct iwl_priv *priv) 145void il_cmd_queue_unmap(struct il_priv *priv)
146{ 146{
147 struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; 147 struct il_tx_queue *txq = &priv->txq[priv->cmd_queue];
148 struct iwl_queue *q = &txq->q; 148 struct il_queue *q = &txq->q;
149 int i; 149 int i;
150 150
151 if (q->n_bd == 0) 151 if (q->n_bd == 0)
152 return; 152 return;
153 153
154 while (q->read_ptr != q->write_ptr) { 154 while (q->read_ptr != q->write_ptr) {
155 i = iwl_legacy_get_cmd_index(q, q->read_ptr, 0); 155 i = il_get_cmd_index(q, q->read_ptr, 0);
156 156
157 if (txq->meta[i].flags & CMD_MAPPED) { 157 if (txq->meta[i].flags & CMD_MAPPED) {
158 pci_unmap_single(priv->pci_dev, 158 pci_unmap_single(priv->pci_dev,
@@ -162,7 +162,7 @@ void iwl_legacy_cmd_queue_unmap(struct iwl_priv *priv)
162 txq->meta[i].flags = 0; 162 txq->meta[i].flags = 0;
163 } 163 }
164 164
165 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd); 165 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd);
166 } 166 }
167 167
168 i = q->n_window; 168 i = q->n_window;
@@ -174,23 +174,23 @@ void iwl_legacy_cmd_queue_unmap(struct iwl_priv *priv)
174 txq->meta[i].flags = 0; 174 txq->meta[i].flags = 0;
175 } 175 }
176} 176}
177EXPORT_SYMBOL(iwl_legacy_cmd_queue_unmap); 177EXPORT_SYMBOL(il_cmd_queue_unmap);
178 178
179/** 179/**
180 * iwl_legacy_cmd_queue_free - Deallocate DMA queue. 180 * il_cmd_queue_free - Deallocate DMA queue.
181 * @txq: Transmit queue to deallocate. 181 * @txq: Transmit queue to deallocate.
182 * 182 *
183 * Empty queue by removing and destroying all BD's. 183 * Empty queue by removing and destroying all BD's.
184 * Free all buffers. 184 * Free all buffers.
185 * 0-fill, but do not free "txq" descriptor structure. 185 * 0-fill, but do not free "txq" descriptor structure.
186 */ 186 */
187void iwl_legacy_cmd_queue_free(struct iwl_priv *priv) 187void il_cmd_queue_free(struct il_priv *priv)
188{ 188{
189 struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; 189 struct il_tx_queue *txq = &priv->txq[priv->cmd_queue];
190 struct device *dev = &priv->pci_dev->dev; 190 struct device *dev = &priv->pci_dev->dev;
191 int i; 191 int i;
192 192
193 iwl_legacy_cmd_queue_unmap(priv); 193 il_cmd_queue_unmap(priv);
194 194
195 /* De-alloc array of command/tx buffers */ 195 /* De-alloc array of command/tx buffers */
196 for (i = 0; i <= TFD_CMD_SLOTS; i++) 196 for (i = 0; i <= TFD_CMD_SLOTS; i++)
@@ -210,7 +210,7 @@ void iwl_legacy_cmd_queue_free(struct iwl_priv *priv)
210 /* 0-fill queue descriptor structure */ 210 /* 0-fill queue descriptor structure */
211 memset(txq, 0, sizeof(*txq)); 211 memset(txq, 0, sizeof(*txq));
212} 212}
213EXPORT_SYMBOL(iwl_legacy_cmd_queue_free); 213EXPORT_SYMBOL(il_cmd_queue_free);
214 214
215/*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** 215/*************** DMA-QUEUE-GENERAL-FUNCTIONS *****
216 * DMA services 216 * DMA services
@@ -235,7 +235,7 @@ EXPORT_SYMBOL(iwl_legacy_cmd_queue_free);
235 * See more detailed info in iwl-4965-hw.h. 235 * See more detailed info in iwl-4965-hw.h.
236 ***************************************************/ 236 ***************************************************/
237 237
238int iwl_legacy_queue_space(const struct iwl_queue *q) 238int il_queue_space(const struct il_queue *q)
239{ 239{
240 int s = q->read_ptr - q->write_ptr; 240 int s = q->read_ptr - q->write_ptr;
241 241
@@ -250,25 +250,25 @@ int iwl_legacy_queue_space(const struct iwl_queue *q)
250 s = 0; 250 s = 0;
251 return s; 251 return s;
252} 252}
253EXPORT_SYMBOL(iwl_legacy_queue_space); 253EXPORT_SYMBOL(il_queue_space);
254 254
255 255
256/** 256/**
257 * iwl_legacy_queue_init - Initialize queue's high/low-water and read/write indexes 257 * il_queue_init - Initialize queue's high/low-water and read/write indexes
258 */ 258 */
259static int iwl_legacy_queue_init(struct iwl_priv *priv, struct iwl_queue *q, 259static int il_queue_init(struct il_priv *priv, struct il_queue *q,
260 int count, int slots_num, u32 id) 260 int count, int slots_num, u32 id)
261{ 261{
262 q->n_bd = count; 262 q->n_bd = count;
263 q->n_window = slots_num; 263 q->n_window = slots_num;
264 q->id = id; 264 q->id = id;
265 265
266 /* count must be power-of-two size, otherwise iwl_legacy_queue_inc_wrap 266 /* count must be power-of-two size, otherwise il_queue_inc_wrap
267 * and iwl_legacy_queue_dec_wrap are broken. */ 267 * and il_queue_dec_wrap are broken. */
268 BUG_ON(!is_power_of_2(count)); 268 BUG_ON(!is_power_of_2(count));
269 269
270 /* slots_num must be power-of-two size, otherwise 270 /* slots_num must be power-of-two size, otherwise
271 * iwl_legacy_get_cmd_index is broken. */ 271 * il_get_cmd_index is broken. */
272 BUG_ON(!is_power_of_2(slots_num)); 272 BUG_ON(!is_power_of_2(slots_num));
273 273
274 q->low_mark = q->n_window / 4; 274 q->low_mark = q->n_window / 4;
@@ -285,10 +285,10 @@ static int iwl_legacy_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
285} 285}
286 286
287/** 287/**
288 * iwl_legacy_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue 288 * il_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue
289 */ 289 */
290static int iwl_legacy_tx_queue_alloc(struct iwl_priv *priv, 290static int il_tx_queue_alloc(struct il_priv *priv,
291 struct iwl_tx_queue *txq, u32 id) 291 struct il_tx_queue *txq, u32 id)
292{ 292{
293 struct device *dev = &priv->pci_dev->dev; 293 struct device *dev = &priv->pci_dev->dev;
294 size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; 294 size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX;
@@ -299,7 +299,7 @@ static int iwl_legacy_tx_queue_alloc(struct iwl_priv *priv,
299 txq->txb = kzalloc(sizeof(txq->txb[0]) * 299 txq->txb = kzalloc(sizeof(txq->txb[0]) *
300 TFD_QUEUE_SIZE_MAX, GFP_KERNEL); 300 TFD_QUEUE_SIZE_MAX, GFP_KERNEL);
301 if (!txq->txb) { 301 if (!txq->txb) {
302 IWL_ERR(priv, "kmalloc for auxiliary BD " 302 IL_ERR(priv, "kmalloc for auxiliary BD "
303 "structures failed\n"); 303 "structures failed\n");
304 goto error; 304 goto error;
305 } 305 }
@@ -312,7 +312,7 @@ static int iwl_legacy_tx_queue_alloc(struct iwl_priv *priv,
312 txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, 312 txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr,
313 GFP_KERNEL); 313 GFP_KERNEL);
314 if (!txq->tfds) { 314 if (!txq->tfds) {
315 IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz); 315 IL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz);
316 goto error; 316 goto error;
317 } 317 }
318 txq->q.id = id; 318 txq->q.id = id;
@@ -327,9 +327,9 @@ static int iwl_legacy_tx_queue_alloc(struct iwl_priv *priv,
327} 327}
328 328
329/** 329/**
330 * iwl_legacy_tx_queue_init - Allocate and initialize one tx/cmd queue 330 * il_tx_queue_init - Allocate and initialize one tx/cmd queue
331 */ 331 */
332int iwl_legacy_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, 332int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq,
333 int slots_num, u32 txq_id) 333 int slots_num, u32 txq_id)
334{ 334{
335 int i, len; 335 int i, len;
@@ -347,19 +347,19 @@ int iwl_legacy_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
347 if (txq_id == priv->cmd_queue) 347 if (txq_id == priv->cmd_queue)
348 actual_slots++; 348 actual_slots++;
349 349
350 txq->meta = kzalloc(sizeof(struct iwl_cmd_meta) * actual_slots, 350 txq->meta = kzalloc(sizeof(struct il_cmd_meta) * actual_slots,
351 GFP_KERNEL); 351 GFP_KERNEL);
352 txq->cmd = kzalloc(sizeof(struct iwl_device_cmd *) * actual_slots, 352 txq->cmd = kzalloc(sizeof(struct il_device_cmd *) * actual_slots,
353 GFP_KERNEL); 353 GFP_KERNEL);
354 354
355 if (!txq->meta || !txq->cmd) 355 if (!txq->meta || !txq->cmd)
356 goto out_free_arrays; 356 goto out_free_arrays;
357 357
358 len = sizeof(struct iwl_device_cmd); 358 len = sizeof(struct il_device_cmd);
359 for (i = 0; i < actual_slots; i++) { 359 for (i = 0; i < actual_slots; i++) {
360 /* only happens for cmd queue */ 360 /* only happens for cmd queue */
361 if (i == slots_num) 361 if (i == slots_num)
362 len = IWL_MAX_CMD_SIZE; 362 len = IL_MAX_CMD_SIZE;
363 363
364 txq->cmd[i] = kmalloc(len, GFP_KERNEL); 364 txq->cmd[i] = kmalloc(len, GFP_KERNEL);
365 if (!txq->cmd[i]) 365 if (!txq->cmd[i])
@@ -367,7 +367,7 @@ int iwl_legacy_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
367 } 367 }
368 368
369 /* Alloc driver data array and TFD circular buffer */ 369 /* Alloc driver data array and TFD circular buffer */
370 ret = iwl_legacy_tx_queue_alloc(priv, txq, txq_id); 370 ret = il_tx_queue_alloc(priv, txq, txq_id);
371 if (ret) 371 if (ret)
372 goto err; 372 goto err;
373 373
@@ -379,14 +379,14 @@ int iwl_legacy_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
379 * (if they need one at all). 379 * (if they need one at all).
380 */ 380 */
381 if (txq_id < 4) 381 if (txq_id < 4)
382 iwl_legacy_set_swq_id(txq, txq_id, txq_id); 382 il_set_swq_id(txq, txq_id, txq_id);
383 383
384 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise 384 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
385 * iwl_legacy_queue_inc_wrap and iwl_legacy_queue_dec_wrap are broken. */ 385 * il_queue_inc_wrap and il_queue_dec_wrap are broken. */
386 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); 386 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
387 387
388 /* Initialize queue's high/low-water marks, and head/tail indexes */ 388 /* Initialize queue's high/low-water marks, and head/tail indexes */
389 iwl_legacy_queue_init(priv, &txq->q, 389 il_queue_init(priv, &txq->q,
390 TFD_QUEUE_SIZE_MAX, slots_num, txq_id); 390 TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
391 391
392 /* Tell device where to find queue */ 392 /* Tell device where to find queue */
@@ -402,9 +402,9 @@ out_free_arrays:
402 402
403 return -ENOMEM; 403 return -ENOMEM;
404} 404}
405EXPORT_SYMBOL(iwl_legacy_tx_queue_init); 405EXPORT_SYMBOL(il_tx_queue_init);
406 406
407void iwl_legacy_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq, 407void il_tx_queue_reset(struct il_priv *priv, struct il_tx_queue *txq,
408 int slots_num, u32 txq_id) 408 int slots_num, u32 txq_id)
409{ 409{
410 int actual_slots = slots_num; 410 int actual_slots = slots_num;
@@ -412,23 +412,23 @@ void iwl_legacy_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq,
412 if (txq_id == priv->cmd_queue) 412 if (txq_id == priv->cmd_queue)
413 actual_slots++; 413 actual_slots++;
414 414
415 memset(txq->meta, 0, sizeof(struct iwl_cmd_meta) * actual_slots); 415 memset(txq->meta, 0, sizeof(struct il_cmd_meta) * actual_slots);
416 416
417 txq->need_update = 0; 417 txq->need_update = 0;
418 418
419 /* Initialize queue's high/low-water marks, and head/tail indexes */ 419 /* Initialize queue's high/low-water marks, and head/tail indexes */
420 iwl_legacy_queue_init(priv, &txq->q, 420 il_queue_init(priv, &txq->q,
421 TFD_QUEUE_SIZE_MAX, slots_num, txq_id); 421 TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
422 422
423 /* Tell device where to find queue */ 423 /* Tell device where to find queue */
424 priv->cfg->ops->lib->txq_init(priv, txq); 424 priv->cfg->ops->lib->txq_init(priv, txq);
425} 425}
426EXPORT_SYMBOL(iwl_legacy_tx_queue_reset); 426EXPORT_SYMBOL(il_tx_queue_reset);
427 427
428/*************** HOST COMMAND QUEUE FUNCTIONS *****/ 428/*************** HOST COMMAND QUEUE FUNCTIONS *****/
429 429
430/** 430/**
431 * iwl_legacy_enqueue_hcmd - enqueue a uCode command 431 * il_enqueue_hcmd - enqueue a uCode command
432 * @priv: device private data point 432 * @priv: device private data point
433 * @cmd: a point to the ucode command structure 433 * @cmd: a point to the ucode command structure
434 * 434 *
@@ -436,12 +436,12 @@ EXPORT_SYMBOL(iwl_legacy_tx_queue_reset);
436 * failed. On success, it turns the index (> 0) of command in the 436 * failed. On success, it turns the index (> 0) of command in the
437 * command queue. 437 * command queue.
438 */ 438 */
439int iwl_legacy_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 439int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd)
440{ 440{
441 struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; 441 struct il_tx_queue *txq = &priv->txq[priv->cmd_queue];
442 struct iwl_queue *q = &txq->q; 442 struct il_queue *q = &txq->q;
443 struct iwl_device_cmd *out_cmd; 443 struct il_device_cmd *out_cmd;
444 struct iwl_cmd_meta *out_meta; 444 struct il_cmd_meta *out_meta;
445 dma_addr_t phys_addr; 445 dma_addr_t phys_addr;
446 unsigned long flags; 446 unsigned long flags;
447 int len; 447 int len;
@@ -458,25 +458,25 @@ int iwl_legacy_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
458 * of device_cmd and max_cmd_size. */ 458 * of device_cmd and max_cmd_size. */
459 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && 459 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
460 !(cmd->flags & CMD_SIZE_HUGE)); 460 !(cmd->flags & CMD_SIZE_HUGE));
461 BUG_ON(fix_size > IWL_MAX_CMD_SIZE); 461 BUG_ON(fix_size > IL_MAX_CMD_SIZE);
462 462
463 if (iwl_legacy_is_rfkill(priv) || iwl_legacy_is_ctkill(priv)) { 463 if (il_is_rfkill(priv) || il_is_ctkill(priv)) {
464 IWL_WARN(priv, "Not sending command - %s KILL\n", 464 IL_WARN(priv, "Not sending command - %s KILL\n",
465 iwl_legacy_is_rfkill(priv) ? "RF" : "CT"); 465 il_is_rfkill(priv) ? "RF" : "CT");
466 return -EIO; 466 return -EIO;
467 } 467 }
468 468
469 spin_lock_irqsave(&priv->hcmd_lock, flags); 469 spin_lock_irqsave(&priv->hcmd_lock, flags);
470 470
471 if (iwl_legacy_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) { 471 if (il_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) {
472 spin_unlock_irqrestore(&priv->hcmd_lock, flags); 472 spin_unlock_irqrestore(&priv->hcmd_lock, flags);
473 473
474 IWL_ERR(priv, "Restarting adapter due to command queue full\n"); 474 IL_ERR(priv, "Restarting adapter due to command queue full\n");
475 queue_work(priv->workqueue, &priv->restart); 475 queue_work(priv->workqueue, &priv->restart);
476 return -ENOSPC; 476 return -ENOSPC;
477 } 477 }
478 478
479 idx = iwl_legacy_get_cmd_index(q, q->write_ptr, cmd->flags & CMD_SIZE_HUGE); 479 idx = il_get_cmd_index(q, q->write_ptr, cmd->flags & CMD_SIZE_HUGE);
480 out_cmd = txq->cmd[idx]; 480 out_cmd = txq->cmd[idx];
481 out_meta = &txq->meta[idx]; 481 out_meta = &txq->meta[idx];
482 482
@@ -503,26 +503,26 @@ int iwl_legacy_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
503 INDEX_TO_SEQ(q->write_ptr)); 503 INDEX_TO_SEQ(q->write_ptr));
504 if (cmd->flags & CMD_SIZE_HUGE) 504 if (cmd->flags & CMD_SIZE_HUGE)
505 out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; 505 out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
506 len = sizeof(struct iwl_device_cmd); 506 len = sizeof(struct il_device_cmd);
507 if (idx == TFD_CMD_SLOTS) 507 if (idx == TFD_CMD_SLOTS)
508 len = IWL_MAX_CMD_SIZE; 508 len = IL_MAX_CMD_SIZE;
509 509
510#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 510#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
511 switch (out_cmd->hdr.cmd) { 511 switch (out_cmd->hdr.cmd) {
512 case REPLY_TX_LINK_QUALITY_CMD: 512 case REPLY_TX_LINK_QUALITY_CMD:
513 case SENSITIVITY_CMD: 513 case SENSITIVITY_CMD:
514 IWL_DEBUG_HC_DUMP(priv, 514 IL_DEBUG_HC_DUMP(priv,
515 "Sending command %s (#%x), seq: 0x%04X, " 515 "Sending command %s (#%x), seq: 0x%04X, "
516 "%d bytes at %d[%d]:%d\n", 516 "%d bytes at %d[%d]:%d\n",
517 iwl_legacy_get_cmd_string(out_cmd->hdr.cmd), 517 il_get_cmd_string(out_cmd->hdr.cmd),
518 out_cmd->hdr.cmd, 518 out_cmd->hdr.cmd,
519 le16_to_cpu(out_cmd->hdr.sequence), fix_size, 519 le16_to_cpu(out_cmd->hdr.sequence), fix_size,
520 q->write_ptr, idx, priv->cmd_queue); 520 q->write_ptr, idx, priv->cmd_queue);
521 break; 521 break;
522 default: 522 default:
523 IWL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, " 523 IL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, "
524 "%d bytes at %d[%d]:%d\n", 524 "%d bytes at %d[%d]:%d\n",
525 iwl_legacy_get_cmd_string(out_cmd->hdr.cmd), 525 il_get_cmd_string(out_cmd->hdr.cmd),
526 out_cmd->hdr.cmd, 526 out_cmd->hdr.cmd,
527 le16_to_cpu(out_cmd->hdr.sequence), fix_size, 527 le16_to_cpu(out_cmd->hdr.sequence), fix_size,
528 q->write_ptr, idx, priv->cmd_queue); 528 q->write_ptr, idx, priv->cmd_queue);
@@ -544,39 +544,39 @@ int iwl_legacy_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
544 U32_PAD(cmd->len)); 544 U32_PAD(cmd->len));
545 545
546 /* Increment and update queue's write index */ 546 /* Increment and update queue's write index */
547 q->write_ptr = iwl_legacy_queue_inc_wrap(q->write_ptr, q->n_bd); 547 q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd);
548 iwl_legacy_txq_update_write_ptr(priv, txq); 548 il_txq_update_write_ptr(priv, txq);
549 549
550 spin_unlock_irqrestore(&priv->hcmd_lock, flags); 550 spin_unlock_irqrestore(&priv->hcmd_lock, flags);
551 return idx; 551 return idx;
552} 552}
553 553
554/** 554/**
555 * iwl_legacy_hcmd_queue_reclaim - Reclaim TX command queue entries already Tx'd 555 * il_hcmd_queue_reclaim - Reclaim TX command queue entries already Tx'd
556 * 556 *
557 * When FW advances 'R' index, all entries between old and new 'R' index 557 * When FW advances 'R' index, all entries between old and new 'R' index
558 * need to be reclaimed. As result, some free space forms. If there is 558 * need to be reclaimed. As result, some free space forms. If there is
559 * enough free space (> low mark), wake the stack that feeds us. 559 * enough free space (> low mark), wake the stack that feeds us.
560 */ 560 */
561static void iwl_legacy_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, 561static void il_hcmd_queue_reclaim(struct il_priv *priv, int txq_id,
562 int idx, int cmd_idx) 562 int idx, int cmd_idx)
563{ 563{
564 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 564 struct il_tx_queue *txq = &priv->txq[txq_id];
565 struct iwl_queue *q = &txq->q; 565 struct il_queue *q = &txq->q;
566 int nfreed = 0; 566 int nfreed = 0;
567 567
568 if ((idx >= q->n_bd) || (iwl_legacy_queue_used(q, idx) == 0)) { 568 if ((idx >= q->n_bd) || (il_queue_used(q, idx) == 0)) {
569 IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " 569 IL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, "
570 "is out of range [0-%d] %d %d.\n", txq_id, 570 "is out of range [0-%d] %d %d.\n", txq_id,
571 idx, q->n_bd, q->write_ptr, q->read_ptr); 571 idx, q->n_bd, q->write_ptr, q->read_ptr);
572 return; 572 return;
573 } 573 }
574 574
575 for (idx = iwl_legacy_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; 575 for (idx = il_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx;
576 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) { 576 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) {
577 577
578 if (nfreed++ > 0) { 578 if (nfreed++ > 0) {
579 IWL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", idx, 579 IL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", idx,
580 q->write_ptr, q->read_ptr); 580 q->write_ptr, q->read_ptr);
581 queue_work(priv->workqueue, &priv->restart); 581 queue_work(priv->workqueue, &priv->restart);
582 } 582 }
@@ -585,7 +585,7 @@ static void iwl_legacy_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id,
585} 585}
586 586
587/** 587/**
588 * iwl_legacy_tx_cmd_complete - Pull unused buffers off the queue and reclaim them 588 * il_tx_cmd_complete - Pull unused buffers off the queue and reclaim them
589 * @rxb: Rx buffer to reclaim 589 * @rxb: Rx buffer to reclaim
590 * 590 *
591 * If an Rx buffer has an async callback associated with it the callback 591 * If an Rx buffer has an async callback associated with it the callback
@@ -593,17 +593,17 @@ static void iwl_legacy_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id,
593 * if the callback returns 1 593 * if the callback returns 1
594 */ 594 */
595void 595void
596iwl_legacy_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) 596il_tx_cmd_complete(struct il_priv *priv, struct il_rx_mem_buffer *rxb)
597{ 597{
598 struct iwl_rx_packet *pkt = rxb_addr(rxb); 598 struct il_rx_packet *pkt = rxb_addr(rxb);
599 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 599 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
600 int txq_id = SEQ_TO_QUEUE(sequence); 600 int txq_id = SEQ_TO_QUEUE(sequence);
601 int index = SEQ_TO_INDEX(sequence); 601 int index = SEQ_TO_INDEX(sequence);
602 int cmd_index; 602 int cmd_index;
603 bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME); 603 bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME);
604 struct iwl_device_cmd *cmd; 604 struct il_device_cmd *cmd;
605 struct iwl_cmd_meta *meta; 605 struct il_cmd_meta *meta;
606 struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; 606 struct il_tx_queue *txq = &priv->txq[priv->cmd_queue];
607 unsigned long flags; 607 unsigned long flags;
608 608
609 /* If a Tx command is being handled and it isn't in the actual 609 /* If a Tx command is being handled and it isn't in the actual
@@ -614,11 +614,11 @@ iwl_legacy_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
614 txq_id, priv->cmd_queue, sequence, 614 txq_id, priv->cmd_queue, sequence,
615 priv->txq[priv->cmd_queue].q.read_ptr, 615 priv->txq[priv->cmd_queue].q.read_ptr,
616 priv->txq[priv->cmd_queue].q.write_ptr)) { 616 priv->txq[priv->cmd_queue].q.write_ptr)) {
617 iwl_print_hex_error(priv, pkt, 32); 617 il_print_hex_error(priv, pkt, 32);
618 return; 618 return;
619 } 619 }
620 620
621 cmd_index = iwl_legacy_get_cmd_index(&txq->q, index, huge); 621 cmd_index = il_get_cmd_index(&txq->q, index, huge);
622 cmd = txq->cmd[cmd_index]; 622 cmd = txq->cmd[cmd_index];
623 meta = &txq->meta[cmd_index]; 623 meta = &txq->meta[cmd_index];
624 624
@@ -638,12 +638,12 @@ iwl_legacy_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
638 638
639 spin_lock_irqsave(&priv->hcmd_lock, flags); 639 spin_lock_irqsave(&priv->hcmd_lock, flags);
640 640
641 iwl_legacy_hcmd_queue_reclaim(priv, txq_id, index, cmd_index); 641 il_hcmd_queue_reclaim(priv, txq_id, index, cmd_index);
642 642
643 if (!(meta->flags & CMD_ASYNC)) { 643 if (!(meta->flags & CMD_ASYNC)) {
644 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 644 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
645 IWL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s\n", 645 IL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s\n",
646 iwl_legacy_get_cmd_string(cmd->hdr.cmd)); 646 il_get_cmd_string(cmd->hdr.cmd));
647 wake_up(&priv->wait_command_queue); 647 wake_up(&priv->wait_command_queue);
648 } 648 }
649 649
@@ -652,4 +652,4 @@ iwl_legacy_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
652 652
653 spin_unlock_irqrestore(&priv->hcmd_lock, flags); 653 spin_unlock_irqrestore(&priv->hcmd_lock, flags);
654} 654}
655EXPORT_SYMBOL(iwl_legacy_tx_cmd_complete); 655EXPORT_SYMBOL(il_tx_cmd_complete);
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 7507819a25ad..d24937a0014a 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -89,7 +89,7 @@ MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
89MODULE_LICENSE("GPL"); 89MODULE_LICENSE("GPL");
90 90
91 /* module parameters */ 91 /* module parameters */
92struct iwl_mod_params iwl3945_mod_params = { 92struct il_mod_params il3945_mod_params = {
93 .sw_crypto = 1, 93 .sw_crypto = 1,
94 .restart_fw = 1, 94 .restart_fw = 1,
95 .disable_hw_scan = 1, 95 .disable_hw_scan = 1,
@@ -97,43 +97,43 @@ struct iwl_mod_params iwl3945_mod_params = {
97}; 97};
98 98
99/** 99/**
100 * iwl3945_get_antenna_flags - Get antenna flags for RXON command 100 * il3945_get_antenna_flags - Get antenna flags for RXON command
101 * @priv: eeprom and antenna fields are used to determine antenna flags 101 * @priv: eeprom and antenna fields are used to determine antenna flags
102 * 102 *
103 * priv->eeprom39 is used to determine if antenna AUX/MAIN are reversed 103 * priv->eeprom39 is used to determine if antenna AUX/MAIN are reversed
104 * iwl3945_mod_params.antenna specifies the antenna diversity mode: 104 * il3945_mod_params.antenna specifies the antenna diversity mode:
105 * 105 *
106 * IWL_ANTENNA_DIVERSITY - NIC selects best antenna by itself 106 * IL_ANTENNA_DIVERSITY - NIC selects best antenna by itself
107 * IWL_ANTENNA_MAIN - Force MAIN antenna 107 * IL_ANTENNA_MAIN - Force MAIN antenna
108 * IWL_ANTENNA_AUX - Force AUX antenna 108 * IL_ANTENNA_AUX - Force AUX antenna
109 */ 109 */
110__le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv) 110__le32 il3945_get_antenna_flags(const struct il_priv *priv)
111{ 111{
112 struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; 112 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom;
113 113
114 switch (iwl3945_mod_params.antenna) { 114 switch (il3945_mod_params.antenna) {
115 case IWL_ANTENNA_DIVERSITY: 115 case IL_ANTENNA_DIVERSITY:
116 return 0; 116 return 0;
117 117
118 case IWL_ANTENNA_MAIN: 118 case IL_ANTENNA_MAIN:
119 if (eeprom->antenna_switch_type) 119 if (eeprom->antenna_switch_type)
120 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK; 120 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK;
121 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK; 121 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK;
122 122
123 case IWL_ANTENNA_AUX: 123 case IL_ANTENNA_AUX:
124 if (eeprom->antenna_switch_type) 124 if (eeprom->antenna_switch_type)
125 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK; 125 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK;
126 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK; 126 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK;
127 } 127 }
128 128
129 /* bad antenna selector value */ 129 /* bad antenna selector value */
130 IWL_ERR(priv, "Bad antenna selector value (0x%x)\n", 130 IL_ERR(priv, "Bad antenna selector value (0x%x)\n",
131 iwl3945_mod_params.antenna); 131 il3945_mod_params.antenna);
132 132
133 return 0; /* "diversity" is default if error */ 133 return 0; /* "diversity" is default if error */
134} 134}
135 135
136static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, 136static int il3945_set_ccmp_dynamic_key_info(struct il_priv *priv,
137 struct ieee80211_key_conf *keyconf, 137 struct ieee80211_key_conf *keyconf,
138 u8 sta_id) 138 u8 sta_id)
139{ 139{
@@ -144,7 +144,7 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
144 key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); 144 key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK);
145 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); 145 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
146 146
147 if (sta_id == priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id) 147 if (sta_id == priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id)
148 key_flags |= STA_KEY_MULTICAST_MSK; 148 key_flags |= STA_KEY_MULTICAST_MSK;
149 149
150 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 150 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
@@ -163,7 +163,7 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
163 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) 163 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
164 == STA_KEY_FLG_NO_ENC) 164 == STA_KEY_FLG_NO_ENC)
165 priv->stations[sta_id].sta.key.key_offset = 165 priv->stations[sta_id].sta.key.key_offset =
166 iwl_legacy_get_free_ucode_key_index(priv); 166 il_get_free_ucode_key_index(priv);
167 /* else, we are overriding an existing key => no need to allocated room 167 /* else, we are overriding an existing key => no need to allocated room
168 * in uCode. */ 168 * in uCode. */
169 169
@@ -174,9 +174,9 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
174 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 174 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
175 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 175 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
176 176
177 IWL_DEBUG_INFO(priv, "hwcrypto: modify ucode station key info\n"); 177 IL_DEBUG_INFO(priv, "hwcrypto: modify ucode station key info\n");
178 178
179 ret = iwl_legacy_send_add_sta(priv, 179 ret = il_send_add_sta(priv,
180 &priv->stations[sta_id].sta, CMD_ASYNC); 180 &priv->stations[sta_id].sta, CMD_ASYNC);
181 181
182 spin_unlock_irqrestore(&priv->sta_lock, flags); 182 spin_unlock_irqrestore(&priv->sta_lock, flags);
@@ -184,40 +184,40 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
184 return ret; 184 return ret;
185} 185}
186 186
187static int iwl3945_set_tkip_dynamic_key_info(struct iwl_priv *priv, 187static int il3945_set_tkip_dynamic_key_info(struct il_priv *priv,
188 struct ieee80211_key_conf *keyconf, 188 struct ieee80211_key_conf *keyconf,
189 u8 sta_id) 189 u8 sta_id)
190{ 190{
191 return -EOPNOTSUPP; 191 return -EOPNOTSUPP;
192} 192}
193 193
194static int iwl3945_set_wep_dynamic_key_info(struct iwl_priv *priv, 194static int il3945_set_wep_dynamic_key_info(struct il_priv *priv,
195 struct ieee80211_key_conf *keyconf, 195 struct ieee80211_key_conf *keyconf,
196 u8 sta_id) 196 u8 sta_id)
197{ 197{
198 return -EOPNOTSUPP; 198 return -EOPNOTSUPP;
199} 199}
200 200
201static int iwl3945_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id) 201static int il3945_clear_sta_key_info(struct il_priv *priv, u8 sta_id)
202{ 202{
203 unsigned long flags; 203 unsigned long flags;
204 struct iwl_legacy_addsta_cmd sta_cmd; 204 struct il_addsta_cmd sta_cmd;
205 205
206 spin_lock_irqsave(&priv->sta_lock, flags); 206 spin_lock_irqsave(&priv->sta_lock, flags);
207 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key)); 207 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct il_hw_key));
208 memset(&priv->stations[sta_id].sta.key, 0, 208 memset(&priv->stations[sta_id].sta.key, 0,
209 sizeof(struct iwl4965_keyinfo)); 209 sizeof(struct il4965_keyinfo));
210 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; 210 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC;
211 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 211 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
212 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 212 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
213 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_legacy_addsta_cmd)); 213 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct il_addsta_cmd));
214 spin_unlock_irqrestore(&priv->sta_lock, flags); 214 spin_unlock_irqrestore(&priv->sta_lock, flags);
215 215
216 IWL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n"); 216 IL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n");
217 return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); 217 return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
218} 218}
219 219
220static int iwl3945_set_dynamic_key(struct iwl_priv *priv, 220static int il3945_set_dynamic_key(struct il_priv *priv,
221 struct ieee80211_key_conf *keyconf, u8 sta_id) 221 struct ieee80211_key_conf *keyconf, u8 sta_id)
222{ 222{
223 int ret = 0; 223 int ret = 0;
@@ -226,75 +226,75 @@ static int iwl3945_set_dynamic_key(struct iwl_priv *priv,
226 226
227 switch (keyconf->cipher) { 227 switch (keyconf->cipher) {
228 case WLAN_CIPHER_SUITE_CCMP: 228 case WLAN_CIPHER_SUITE_CCMP:
229 ret = iwl3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); 229 ret = il3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id);
230 break; 230 break;
231 case WLAN_CIPHER_SUITE_TKIP: 231 case WLAN_CIPHER_SUITE_TKIP:
232 ret = iwl3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id); 232 ret = il3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id);
233 break; 233 break;
234 case WLAN_CIPHER_SUITE_WEP40: 234 case WLAN_CIPHER_SUITE_WEP40:
235 case WLAN_CIPHER_SUITE_WEP104: 235 case WLAN_CIPHER_SUITE_WEP104:
236 ret = iwl3945_set_wep_dynamic_key_info(priv, keyconf, sta_id); 236 ret = il3945_set_wep_dynamic_key_info(priv, keyconf, sta_id);
237 break; 237 break;
238 default: 238 default:
239 IWL_ERR(priv, "Unknown alg: %s alg=%x\n", __func__, 239 IL_ERR(priv, "Unknown alg: %s alg=%x\n", __func__,
240 keyconf->cipher); 240 keyconf->cipher);
241 ret = -EINVAL; 241 ret = -EINVAL;
242 } 242 }
243 243
244 IWL_DEBUG_WEP(priv, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n", 244 IL_DEBUG_WEP(priv, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n",
245 keyconf->cipher, keyconf->keylen, keyconf->keyidx, 245 keyconf->cipher, keyconf->keylen, keyconf->keyidx,
246 sta_id, ret); 246 sta_id, ret);
247 247
248 return ret; 248 return ret;
249} 249}
250 250
251static int iwl3945_remove_static_key(struct iwl_priv *priv) 251static int il3945_remove_static_key(struct il_priv *priv)
252{ 252{
253 int ret = -EOPNOTSUPP; 253 int ret = -EOPNOTSUPP;
254 254
255 return ret; 255 return ret;
256} 256}
257 257
258static int iwl3945_set_static_key(struct iwl_priv *priv, 258static int il3945_set_static_key(struct il_priv *priv,
259 struct ieee80211_key_conf *key) 259 struct ieee80211_key_conf *key)
260{ 260{
261 if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || 261 if (key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
262 key->cipher == WLAN_CIPHER_SUITE_WEP104) 262 key->cipher == WLAN_CIPHER_SUITE_WEP104)
263 return -EOPNOTSUPP; 263 return -EOPNOTSUPP;
264 264
265 IWL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher); 265 IL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher);
266 return -EINVAL; 266 return -EINVAL;
267} 267}
268 268
269static void iwl3945_clear_free_frames(struct iwl_priv *priv) 269static void il3945_clear_free_frames(struct il_priv *priv)
270{ 270{
271 struct list_head *element; 271 struct list_head *element;
272 272
273 IWL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", 273 IL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n",
274 priv->frames_count); 274 priv->frames_count);
275 275
276 while (!list_empty(&priv->free_frames)) { 276 while (!list_empty(&priv->free_frames)) {
277 element = priv->free_frames.next; 277 element = priv->free_frames.next;
278 list_del(element); 278 list_del(element);
279 kfree(list_entry(element, struct iwl3945_frame, list)); 279 kfree(list_entry(element, struct il3945_frame, list));
280 priv->frames_count--; 280 priv->frames_count--;
281 } 281 }
282 282
283 if (priv->frames_count) { 283 if (priv->frames_count) {
284 IWL_WARN(priv, "%d frames still in use. Did we lose one?\n", 284 IL_WARN(priv, "%d frames still in use. Did we lose one?\n",
285 priv->frames_count); 285 priv->frames_count);
286 priv->frames_count = 0; 286 priv->frames_count = 0;
287 } 287 }
288} 288}
289 289
290static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl_priv *priv) 290static struct il3945_frame *il3945_get_free_frame(struct il_priv *priv)
291{ 291{
292 struct iwl3945_frame *frame; 292 struct il3945_frame *frame;
293 struct list_head *element; 293 struct list_head *element;
294 if (list_empty(&priv->free_frames)) { 294 if (list_empty(&priv->free_frames)) {
295 frame = kzalloc(sizeof(*frame), GFP_KERNEL); 295 frame = kzalloc(sizeof(*frame), GFP_KERNEL);
296 if (!frame) { 296 if (!frame) {
297 IWL_ERR(priv, "Could not allocate frame!\n"); 297 IL_ERR(priv, "Could not allocate frame!\n");
298 return NULL; 298 return NULL;
299 } 299 }
300 300
@@ -304,21 +304,21 @@ static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl_priv *priv)
304 304
305 element = priv->free_frames.next; 305 element = priv->free_frames.next;
306 list_del(element); 306 list_del(element);
307 return list_entry(element, struct iwl3945_frame, list); 307 return list_entry(element, struct il3945_frame, list);
308} 308}
309 309
310static void iwl3945_free_frame(struct iwl_priv *priv, struct iwl3945_frame *frame) 310static void il3945_free_frame(struct il_priv *priv, struct il3945_frame *frame)
311{ 311{
312 memset(frame, 0, sizeof(*frame)); 312 memset(frame, 0, sizeof(*frame));
313 list_add(&frame->list, &priv->free_frames); 313 list_add(&frame->list, &priv->free_frames);
314} 314}
315 315
316unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, 316unsigned int il3945_fill_beacon_frame(struct il_priv *priv,
317 struct ieee80211_hdr *hdr, 317 struct ieee80211_hdr *hdr,
318 int left) 318 int left)
319{ 319{
320 320
321 if (!iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS) || !priv->beacon_skb) 321 if (!il_is_associated(priv, IL_RXON_CTX_BSS) || !priv->beacon_skb)
322 return 0; 322 return 0;
323 323
324 if (priv->beacon_skb->len > left) 324 if (priv->beacon_skb->len > left)
@@ -329,51 +329,51 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
329 return priv->beacon_skb->len; 329 return priv->beacon_skb->len;
330} 330}
331 331
332static int iwl3945_send_beacon_cmd(struct iwl_priv *priv) 332static int il3945_send_beacon_cmd(struct il_priv *priv)
333{ 333{
334 struct iwl3945_frame *frame; 334 struct il3945_frame *frame;
335 unsigned int frame_size; 335 unsigned int frame_size;
336 int rc; 336 int rc;
337 u8 rate; 337 u8 rate;
338 338
339 frame = iwl3945_get_free_frame(priv); 339 frame = il3945_get_free_frame(priv);
340 340
341 if (!frame) { 341 if (!frame) {
342 IWL_ERR(priv, "Could not obtain free frame buffer for beacon " 342 IL_ERR(priv, "Could not obtain free frame buffer for beacon "
343 "command.\n"); 343 "command.\n");
344 return -ENOMEM; 344 return -ENOMEM;
345 } 345 }
346 346
347 rate = iwl_legacy_get_lowest_plcp(priv, 347 rate = il_get_lowest_plcp(priv,
348 &priv->contexts[IWL_RXON_CTX_BSS]); 348 &priv->contexts[IL_RXON_CTX_BSS]);
349 349
350 frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate); 350 frame_size = il3945_hw_get_beacon_cmd(priv, frame, rate);
351 351
352 rc = iwl_legacy_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, 352 rc = il_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size,
353 &frame->u.cmd[0]); 353 &frame->u.cmd[0]);
354 354
355 iwl3945_free_frame(priv, frame); 355 il3945_free_frame(priv, frame);
356 356
357 return rc; 357 return rc;
358} 358}
359 359
360static void iwl3945_unset_hw_params(struct iwl_priv *priv) 360static void il3945_unset_hw_params(struct il_priv *priv)
361{ 361{
362 if (priv->_3945.shared_virt) 362 if (priv->_3945.shared_virt)
363 dma_free_coherent(&priv->pci_dev->dev, 363 dma_free_coherent(&priv->pci_dev->dev,
364 sizeof(struct iwl3945_shared), 364 sizeof(struct il3945_shared),
365 priv->_3945.shared_virt, 365 priv->_3945.shared_virt,
366 priv->_3945.shared_phys); 366 priv->_3945.shared_phys);
367} 367}
368 368
369static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, 369static void il3945_build_tx_cmd_hwcrypto(struct il_priv *priv,
370 struct ieee80211_tx_info *info, 370 struct ieee80211_tx_info *info,
371 struct iwl_device_cmd *cmd, 371 struct il_device_cmd *cmd,
372 struct sk_buff *skb_frag, 372 struct sk_buff *skb_frag,
373 int sta_id) 373 int sta_id)
374{ 374{
375 struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; 375 struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload;
376 struct iwl_hw_key *keyinfo = &priv->stations[sta_id].keyinfo; 376 struct il_hw_key *keyinfo = &priv->stations[sta_id].keyinfo;
377 377
378 tx_cmd->sec_ctl = 0; 378 tx_cmd->sec_ctl = 0;
379 379
@@ -381,7 +381,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
381 case WLAN_CIPHER_SUITE_CCMP: 381 case WLAN_CIPHER_SUITE_CCMP:
382 tx_cmd->sec_ctl = TX_CMD_SEC_CCM; 382 tx_cmd->sec_ctl = TX_CMD_SEC_CCM;
383 memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); 383 memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen);
384 IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); 384 IL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n");
385 break; 385 break;
386 386
387 case WLAN_CIPHER_SUITE_TKIP: 387 case WLAN_CIPHER_SUITE_TKIP:
@@ -396,12 +396,12 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
396 396
397 memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); 397 memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen);
398 398
399 IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption " 399 IL_DEBUG_TX(priv, "Configuring packet for WEP encryption "
400 "with key %d\n", info->control.hw_key->hw_key_idx); 400 "with key %d\n", info->control.hw_key->hw_key_idx);
401 break; 401 break;
402 402
403 default: 403 default:
404 IWL_ERR(priv, "Unknown encode cipher %x\n", keyinfo->cipher); 404 IL_ERR(priv, "Unknown encode cipher %x\n", keyinfo->cipher);
405 break; 405 break;
406 } 406 }
407} 407}
@@ -409,12 +409,12 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
409/* 409/*
410 * handle build REPLY_TX command notification. 410 * handle build REPLY_TX command notification.
411 */ 411 */
412static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, 412static void il3945_build_tx_cmd_basic(struct il_priv *priv,
413 struct iwl_device_cmd *cmd, 413 struct il_device_cmd *cmd,
414 struct ieee80211_tx_info *info, 414 struct ieee80211_tx_info *info,
415 struct ieee80211_hdr *hdr, u8 std_id) 415 struct ieee80211_hdr *hdr, u8 std_id)
416{ 416{
417 struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; 417 struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload;
418 __le32 tx_flags = tx_cmd->tx_flags; 418 __le32 tx_flags = tx_cmd->tx_flags;
419 __le16 fc = hdr->frame_control; 419 __le16 fc = hdr->frame_control;
420 420
@@ -443,7 +443,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
443 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 443 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
444 } 444 }
445 445
446 iwl_legacy_tx_cmd_protection(priv, info, fc, &tx_flags); 446 il_tx_cmd_protection(priv, info, fc, &tx_flags);
447 447
448 tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); 448 tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
449 if (ieee80211_is_mgmt(fc)) { 449 if (ieee80211_is_mgmt(fc)) {
@@ -463,15 +463,15 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
463/* 463/*
464 * start REPLY_TX command process 464 * start REPLY_TX command process
465 */ 465 */
466static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) 466static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb)
467{ 467{
468 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 468 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
469 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 469 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
470 struct iwl3945_tx_cmd *tx_cmd; 470 struct il3945_tx_cmd *tx_cmd;
471 struct iwl_tx_queue *txq = NULL; 471 struct il_tx_queue *txq = NULL;
472 struct iwl_queue *q = NULL; 472 struct il_queue *q = NULL;
473 struct iwl_device_cmd *out_cmd; 473 struct il_device_cmd *out_cmd;
474 struct iwl_cmd_meta *out_meta; 474 struct il_cmd_meta *out_meta;
475 dma_addr_t phys_addr; 475 dma_addr_t phys_addr;
476 dma_addr_t txcmd_phys; 476 dma_addr_t txcmd_phys;
477 int txq_id = skb_get_queue_mapping(skb); 477 int txq_id = skb_get_queue_mapping(skb);
@@ -485,13 +485,13 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
485 unsigned long flags; 485 unsigned long flags;
486 486
487 spin_lock_irqsave(&priv->lock, flags); 487 spin_lock_irqsave(&priv->lock, flags);
488 if (iwl_legacy_is_rfkill(priv)) { 488 if (il_is_rfkill(priv)) {
489 IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); 489 IL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
490 goto drop_unlock; 490 goto drop_unlock;
491 } 491 }
492 492
493 if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == IWL_INVALID_RATE) { 493 if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == IL_INVALID_RATE) {
494 IWL_ERR(priv, "ERROR: No TX rate available.\n"); 494 IL_ERR(priv, "ERROR: No TX rate available.\n");
495 goto drop_unlock; 495 goto drop_unlock;
496 } 496 }
497 497
@@ -502,11 +502,11 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
502 502
503#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 503#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
504 if (ieee80211_is_auth(fc)) 504 if (ieee80211_is_auth(fc))
505 IWL_DEBUG_TX(priv, "Sending AUTH frame\n"); 505 IL_DEBUG_TX(priv, "Sending AUTH frame\n");
506 else if (ieee80211_is_assoc_req(fc)) 506 else if (ieee80211_is_assoc_req(fc))
507 IWL_DEBUG_TX(priv, "Sending ASSOC frame\n"); 507 IL_DEBUG_TX(priv, "Sending ASSOC frame\n");
508 else if (ieee80211_is_reassoc_req(fc)) 508 else if (ieee80211_is_reassoc_req(fc))
509 IWL_DEBUG_TX(priv, "Sending REASSOC frame\n"); 509 IL_DEBUG_TX(priv, "Sending REASSOC frame\n");
510#endif 510#endif
511 511
512 spin_unlock_irqrestore(&priv->lock, flags); 512 spin_unlock_irqrestore(&priv->lock, flags);
@@ -514,16 +514,16 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
514 hdr_len = ieee80211_hdrlen(fc); 514 hdr_len = ieee80211_hdrlen(fc);
515 515
516 /* Find index into station table for destination station */ 516 /* Find index into station table for destination station */
517 sta_id = iwl_legacy_sta_id_or_broadcast( 517 sta_id = il_sta_id_or_broadcast(
518 priv, &priv->contexts[IWL_RXON_CTX_BSS], 518 priv, &priv->contexts[IL_RXON_CTX_BSS],
519 info->control.sta); 519 info->control.sta);
520 if (sta_id == IWL_INVALID_STATION) { 520 if (sta_id == IL_INVALID_STATION) {
521 IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", 521 IL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
522 hdr->addr1); 522 hdr->addr1);
523 goto drop; 523 goto drop;
524 } 524 }
525 525
526 IWL_DEBUG_RATE(priv, "station Id %d\n", sta_id); 526 IL_DEBUG_RATE(priv, "station Id %d\n", sta_id);
527 527
528 if (ieee80211_is_data_qos(fc)) { 528 if (ieee80211_is_data_qos(fc)) {
529 u8 *qc = ieee80211_get_qos_ctl(hdr); 529 u8 *qc = ieee80211_get_qos_ctl(hdr);
@@ -536,22 +536,22 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
536 txq = &priv->txq[txq_id]; 536 txq = &priv->txq[txq_id];
537 q = &txq->q; 537 q = &txq->q;
538 538
539 if ((iwl_legacy_queue_space(q) < q->high_mark)) 539 if ((il_queue_space(q) < q->high_mark))
540 goto drop; 540 goto drop;
541 541
542 spin_lock_irqsave(&priv->lock, flags); 542 spin_lock_irqsave(&priv->lock, flags);
543 543
544 idx = iwl_legacy_get_cmd_index(q, q->write_ptr, 0); 544 idx = il_get_cmd_index(q, q->write_ptr, 0);
545 545
546 /* Set up driver data for this TFD */ 546 /* Set up driver data for this TFD */
547 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); 547 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info));
548 txq->txb[q->write_ptr].skb = skb; 548 txq->txb[q->write_ptr].skb = skb;
549 txq->txb[q->write_ptr].ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 549 txq->txb[q->write_ptr].ctx = &priv->contexts[IL_RXON_CTX_BSS];
550 550
551 /* Init first empty entry in queue's array of Tx/cmd buffers */ 551 /* Init first empty entry in queue's array of Tx/cmd buffers */
552 out_cmd = txq->cmd[idx]; 552 out_cmd = txq->cmd[idx];
553 out_meta = &txq->meta[idx]; 553 out_meta = &txq->meta[idx];
554 tx_cmd = (struct iwl3945_tx_cmd *)out_cmd->cmd.payload; 554 tx_cmd = (struct il3945_tx_cmd *)out_cmd->cmd.payload;
555 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); 555 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr));
556 memset(tx_cmd, 0, sizeof(*tx_cmd)); 556 memset(tx_cmd, 0, sizeof(*tx_cmd));
557 557
@@ -570,20 +570,20 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
570 570
571 571
572 if (info->control.hw_key) 572 if (info->control.hw_key)
573 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id); 573 il3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id);
574 574
575 /* TODO need this for burst mode later on */ 575 /* TODO need this for burst mode later on */
576 iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id); 576 il3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id);
577 577
578 /* set is_hcca to 0; it probably will never be implemented */ 578 /* set is_hcca to 0; it probably will never be implemented */
579 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0); 579 il3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0);
580 580
581 /* Total # bytes to be transmitted */ 581 /* Total # bytes to be transmitted */
582 len = (u16)skb->len; 582 len = (u16)skb->len;
583 tx_cmd->len = cpu_to_le16(len); 583 tx_cmd->len = cpu_to_le16(len);
584 584
585 iwl_legacy_dbg_log_tx_data_frame(priv, len, hdr); 585 il_dbg_log_tx_data_frame(priv, len, hdr);
586 iwl_legacy_update_stats(priv, true, fc, len); 586 il_update_stats(priv, true, fc, len);
587 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; 587 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
588 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; 588 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
589 589
@@ -594,11 +594,11 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
594 txq->need_update = 0; 594 txq->need_update = 0;
595 } 595 }
596 596
597 IWL_DEBUG_TX(priv, "sequence nr = 0X%x\n", 597 IL_DEBUG_TX(priv, "sequence nr = 0X%x\n",
598 le16_to_cpu(out_cmd->hdr.sequence)); 598 le16_to_cpu(out_cmd->hdr.sequence));
599 IWL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); 599 IL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags));
600 iwl_print_hex_dump(priv, IWL_DL_TX, tx_cmd, sizeof(*tx_cmd)); 600 il_print_hex_dump(priv, IL_DL_TX, tx_cmd, sizeof(*tx_cmd));
601 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, 601 il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd->hdr,
602 ieee80211_hdrlen(fc)); 602 ieee80211_hdrlen(fc));
603 603
604 /* 604 /*
@@ -610,8 +610,8 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
610 * of the MAC header (device reads on dword boundaries). 610 * of the MAC header (device reads on dword boundaries).
611 * We'll tell device about this padding later. 611 * We'll tell device about this padding later.
612 */ 612 */
613 len = sizeof(struct iwl3945_tx_cmd) + 613 len = sizeof(struct il3945_tx_cmd) +
614 sizeof(struct iwl_cmd_header) + hdr_len; 614 sizeof(struct il_cmd_header) + hdr_len;
615 len = (len + 3) & ~3; 615 len = (len + 3) & ~3;
616 616
617 /* Physical address of this Tx command's header (not MAC header!), 617 /* Physical address of this Tx command's header (not MAC header!),
@@ -642,20 +642,20 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
642 642
643 643
644 /* Tell device the write index *just past* this latest filled TFD */ 644 /* Tell device the write index *just past* this latest filled TFD */
645 q->write_ptr = iwl_legacy_queue_inc_wrap(q->write_ptr, q->n_bd); 645 q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd);
646 iwl_legacy_txq_update_write_ptr(priv, txq); 646 il_txq_update_write_ptr(priv, txq);
647 spin_unlock_irqrestore(&priv->lock, flags); 647 spin_unlock_irqrestore(&priv->lock, flags);
648 648
649 if ((iwl_legacy_queue_space(q) < q->high_mark) 649 if ((il_queue_space(q) < q->high_mark)
650 && priv->mac80211_registered) { 650 && priv->mac80211_registered) {
651 if (wait_write_ptr) { 651 if (wait_write_ptr) {
652 spin_lock_irqsave(&priv->lock, flags); 652 spin_lock_irqsave(&priv->lock, flags);
653 txq->need_update = 1; 653 txq->need_update = 1;
654 iwl_legacy_txq_update_write_ptr(priv, txq); 654 il_txq_update_write_ptr(priv, txq);
655 spin_unlock_irqrestore(&priv->lock, flags); 655 spin_unlock_irqrestore(&priv->lock, flags);
656 } 656 }
657 657
658 iwl_legacy_stop_queue(priv, txq); 658 il_stop_queue(priv, txq);
659 } 659 }
660 660
661 return 0; 661 return 0;
@@ -666,13 +666,13 @@ drop:
666 return -1; 666 return -1;
667} 667}
668 668
669static int iwl3945_get_measurement(struct iwl_priv *priv, 669static int il3945_get_measurement(struct il_priv *priv,
670 struct ieee80211_measurement_params *params, 670 struct ieee80211_measurement_params *params,
671 u8 type) 671 u8 type)
672{ 672{
673 struct iwl_spectrum_cmd spectrum; 673 struct il_spectrum_cmd spectrum;
674 struct iwl_rx_packet *pkt; 674 struct il_rx_packet *pkt;
675 struct iwl_host_cmd cmd = { 675 struct il_host_cmd cmd = {
676 .id = REPLY_SPECTRUM_MEASUREMENT_CMD, 676 .id = REPLY_SPECTRUM_MEASUREMENT_CMD,
677 .data = (void *)&spectrum, 677 .data = (void *)&spectrum,
678 .flags = CMD_WANT_SKB, 678 .flags = CMD_WANT_SKB,
@@ -681,10 +681,10 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
681 int rc; 681 int rc;
682 int spectrum_resp_status; 682 int spectrum_resp_status;
683 int duration = le16_to_cpu(params->duration); 683 int duration = le16_to_cpu(params->duration);
684 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 684 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
685 685
686 if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) 686 if (il_is_associated(priv, IL_RXON_CTX_BSS))
687 add_time = iwl_legacy_usecs_to_beacons(priv, 687 add_time = il_usecs_to_beacons(priv,
688 le64_to_cpu(params->start_time) - priv->_3945.last_tsf, 688 le64_to_cpu(params->start_time) - priv->_3945.last_tsf,
689 le16_to_cpu(ctx->timing.beacon_interval)); 689 le16_to_cpu(ctx->timing.beacon_interval));
690 690
@@ -697,9 +697,9 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
697 cmd.len = sizeof(spectrum); 697 cmd.len = sizeof(spectrum);
698 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); 698 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len));
699 699
700 if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) 700 if (il_is_associated(priv, IL_RXON_CTX_BSS))
701 spectrum.start_time = 701 spectrum.start_time =
702 iwl_legacy_add_beacon_time(priv, 702 il_add_beacon_time(priv,
703 priv->_3945.last_beacon_time, add_time, 703 priv->_3945.last_beacon_time, add_time,
704 le16_to_cpu(ctx->timing.beacon_interval)); 704 le16_to_cpu(ctx->timing.beacon_interval));
705 else 705 else
@@ -712,13 +712,13 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
712 spectrum.flags |= RXON_FLG_BAND_24G_MSK | 712 spectrum.flags |= RXON_FLG_BAND_24G_MSK |
713 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; 713 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK;
714 714
715 rc = iwl_legacy_send_cmd_sync(priv, &cmd); 715 rc = il_send_cmd_sync(priv, &cmd);
716 if (rc) 716 if (rc)
717 return rc; 717 return rc;
718 718
719 pkt = (struct iwl_rx_packet *)cmd.reply_page; 719 pkt = (struct il_rx_packet *)cmd.reply_page;
720 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { 720 if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
721 IWL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n"); 721 IL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n");
722 rc = -EIO; 722 rc = -EIO;
723 } 723 }
724 724
@@ -726,7 +726,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
726 switch (spectrum_resp_status) { 726 switch (spectrum_resp_status) {
727 case 0: /* Command will be handled */ 727 case 0: /* Command will be handled */
728 if (pkt->u.spectrum.id != 0xff) { 728 if (pkt->u.spectrum.id != 0xff) {
729 IWL_DEBUG_INFO(priv, "Replaced existing measurement: %d\n", 729 IL_DEBUG_INFO(priv, "Replaced existing measurement: %d\n",
730 pkt->u.spectrum.id); 730 pkt->u.spectrum.id);
731 priv->measurement_status &= ~MEASUREMENT_READY; 731 priv->measurement_status &= ~MEASUREMENT_READY;
732 } 732 }
@@ -739,36 +739,36 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
739 break; 739 break;
740 } 740 }
741 741
742 iwl_legacy_free_pages(priv, cmd.reply_page); 742 il_free_pages(priv, cmd.reply_page);
743 743
744 return rc; 744 return rc;
745} 745}
746 746
747static void iwl3945_rx_reply_alive(struct iwl_priv *priv, 747static void il3945_rx_reply_alive(struct il_priv *priv,
748 struct iwl_rx_mem_buffer *rxb) 748 struct il_rx_mem_buffer *rxb)
749{ 749{
750 struct iwl_rx_packet *pkt = rxb_addr(rxb); 750 struct il_rx_packet *pkt = rxb_addr(rxb);
751 struct iwl_alive_resp *palive; 751 struct il_alive_resp *palive;
752 struct delayed_work *pwork; 752 struct delayed_work *pwork;
753 753
754 palive = &pkt->u.alive_frame; 754 palive = &pkt->u.alive_frame;
755 755
756 IWL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " 756 IL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision "
757 "0x%01X 0x%01X\n", 757 "0x%01X 0x%01X\n",
758 palive->is_valid, palive->ver_type, 758 palive->is_valid, palive->ver_type,
759 palive->ver_subtype); 759 palive->ver_subtype);
760 760
761 if (palive->ver_subtype == INITIALIZE_SUBTYPE) { 761 if (palive->ver_subtype == INITIALIZE_SUBTYPE) {
762 IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); 762 IL_DEBUG_INFO(priv, "Initialization Alive received.\n");
763 memcpy(&priv->card_alive_init, &pkt->u.alive_frame, 763 memcpy(&priv->card_alive_init, &pkt->u.alive_frame,
764 sizeof(struct iwl_alive_resp)); 764 sizeof(struct il_alive_resp));
765 pwork = &priv->init_alive_start; 765 pwork = &priv->init_alive_start;
766 } else { 766 } else {
767 IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); 767 IL_DEBUG_INFO(priv, "Runtime Alive received.\n");
768 memcpy(&priv->card_alive, &pkt->u.alive_frame, 768 memcpy(&priv->card_alive, &pkt->u.alive_frame,
769 sizeof(struct iwl_alive_resp)); 769 sizeof(struct il_alive_resp));
770 pwork = &priv->alive_start; 770 pwork = &priv->alive_start;
771 iwl3945_disable_events(priv); 771 il3945_disable_events(priv);
772 } 772 }
773 773
774 /* We delay the ALIVE response by 5ms to 774 /* We delay the ALIVE response by 5ms to
@@ -777,28 +777,28 @@ static void iwl3945_rx_reply_alive(struct iwl_priv *priv,
777 queue_delayed_work(priv->workqueue, pwork, 777 queue_delayed_work(priv->workqueue, pwork,
778 msecs_to_jiffies(5)); 778 msecs_to_jiffies(5));
779 else 779 else
780 IWL_WARN(priv, "uCode did not respond OK.\n"); 780 IL_WARN(priv, "uCode did not respond OK.\n");
781} 781}
782 782
783static void iwl3945_rx_reply_add_sta(struct iwl_priv *priv, 783static void il3945_rx_reply_add_sta(struct il_priv *priv,
784 struct iwl_rx_mem_buffer *rxb) 784 struct il_rx_mem_buffer *rxb)
785{ 785{
786#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 786#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
787 struct iwl_rx_packet *pkt = rxb_addr(rxb); 787 struct il_rx_packet *pkt = rxb_addr(rxb);
788#endif 788#endif
789 789
790 IWL_DEBUG_RX(priv, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); 790 IL_DEBUG_RX(priv, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status);
791} 791}
792 792
793static void iwl3945_rx_beacon_notif(struct iwl_priv *priv, 793static void il3945_rx_beacon_notif(struct il_priv *priv,
794 struct iwl_rx_mem_buffer *rxb) 794 struct il_rx_mem_buffer *rxb)
795{ 795{
796 struct iwl_rx_packet *pkt = rxb_addr(rxb); 796 struct il_rx_packet *pkt = rxb_addr(rxb);
797 struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status); 797 struct il3945_beacon_notif *beacon = &(pkt->u.beacon_status);
798#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 798#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
799 u8 rate = beacon->beacon_notify_hdr.rate; 799 u8 rate = beacon->beacon_notify_hdr.rate;
800 800
801 IWL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " 801 IL_DEBUG_RX(priv, "beacon status %x retries %d iss %d "
802 "tsf %d %d rate %d\n", 802 "tsf %d %d rate %d\n",
803 le32_to_cpu(beacon->beacon_notify_hdr.status) & TX_STATUS_MSK, 803 le32_to_cpu(beacon->beacon_notify_hdr.status) & TX_STATUS_MSK,
804 beacon->beacon_notify_hdr.failure_frame, 804 beacon->beacon_notify_hdr.failure_frame,
@@ -813,18 +813,18 @@ static void iwl3945_rx_beacon_notif(struct iwl_priv *priv,
813 813
814/* Handle notification from uCode that card's power state is changing 814/* Handle notification from uCode that card's power state is changing
815 * due to software, hardware, or critical temperature RFKILL */ 815 * due to software, hardware, or critical temperature RFKILL */
816static void iwl3945_rx_card_state_notif(struct iwl_priv *priv, 816static void il3945_rx_card_state_notif(struct il_priv *priv,
817 struct iwl_rx_mem_buffer *rxb) 817 struct il_rx_mem_buffer *rxb)
818{ 818{
819 struct iwl_rx_packet *pkt = rxb_addr(rxb); 819 struct il_rx_packet *pkt = rxb_addr(rxb);
820 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); 820 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
821 unsigned long status = priv->status; 821 unsigned long status = priv->status;
822 822
823 IWL_WARN(priv, "Card state received: HW:%s SW:%s\n", 823 IL_WARN(priv, "Card state received: HW:%s SW:%s\n",
824 (flags & HW_CARD_DISABLED) ? "Kill" : "On", 824 (flags & HW_CARD_DISABLED) ? "Kill" : "On",
825 (flags & SW_CARD_DISABLED) ? "Kill" : "On"); 825 (flags & SW_CARD_DISABLED) ? "Kill" : "On");
826 826
827 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 827 il_write32(priv, CSR_UCODE_DRV_GP1_SET,
828 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 828 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
829 829
830 if (flags & HW_CARD_DISABLED) 830 if (flags & HW_CARD_DISABLED)
@@ -833,7 +833,7 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv,
833 clear_bit(STATUS_RF_KILL_HW, &priv->status); 833 clear_bit(STATUS_RF_KILL_HW, &priv->status);
834 834
835 835
836 iwl_legacy_scan_cancel(priv); 836 il_scan_cancel(priv);
837 837
838 if ((test_bit(STATUS_RF_KILL_HW, &status) != 838 if ((test_bit(STATUS_RF_KILL_HW, &status) !=
839 test_bit(STATUS_RF_KILL_HW, &priv->status))) 839 test_bit(STATUS_RF_KILL_HW, &priv->status)))
@@ -844,7 +844,7 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv,
844} 844}
845 845
846/** 846/**
847 * iwl3945_setup_rx_handlers - Initialize Rx handler callbacks 847 * il3945_setup_rx_handlers - Initialize Rx handler callbacks
848 * 848 *
849 * Setup the RX handlers for each of the reply types sent from the uCode 849 * Setup the RX handlers for each of the reply types sent from the uCode
850 * to the host. 850 * to the host.
@@ -852,32 +852,32 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv,
852 * This function chains into the hardware specific files for them to setup 852 * This function chains into the hardware specific files for them to setup
853 * any hardware specific handlers as well. 853 * any hardware specific handlers as well.
854 */ 854 */
855static void iwl3945_setup_rx_handlers(struct iwl_priv *priv) 855static void il3945_setup_rx_handlers(struct il_priv *priv)
856{ 856{
857 priv->rx_handlers[REPLY_ALIVE] = iwl3945_rx_reply_alive; 857 priv->rx_handlers[REPLY_ALIVE] = il3945_rx_reply_alive;
858 priv->rx_handlers[REPLY_ADD_STA] = iwl3945_rx_reply_add_sta; 858 priv->rx_handlers[REPLY_ADD_STA] = il3945_rx_reply_add_sta;
859 priv->rx_handlers[REPLY_ERROR] = iwl_legacy_rx_reply_error; 859 priv->rx_handlers[REPLY_ERROR] = il_rx_reply_error;
860 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_legacy_rx_csa; 860 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa;
861 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = 861 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
862 iwl_legacy_rx_spectrum_measure_notif; 862 il_rx_spectrum_measure_notif;
863 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_legacy_rx_pm_sleep_notif; 863 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif;
864 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = 864 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] =
865 iwl_legacy_rx_pm_debug_statistics_notif; 865 il_rx_pm_debug_statistics_notif;
866 priv->rx_handlers[BEACON_NOTIFICATION] = iwl3945_rx_beacon_notif; 866 priv->rx_handlers[BEACON_NOTIFICATION] = il3945_rx_beacon_notif;
867 867
868 /* 868 /*
869 * The same handler is used for both the REPLY to a discrete 869 * The same handler is used for both the REPLY to a discrete
870 * statistics request from the host as well as for the periodic 870 * statistics request from the host as well as for the periodic
871 * statistics notifications (after received beacons) from the uCode. 871 * statistics notifications (after received beacons) from the uCode.
872 */ 872 */
873 priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl3945_reply_statistics; 873 priv->rx_handlers[REPLY_STATISTICS_CMD] = il3945_reply_statistics;
874 priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl3945_hw_rx_statistics; 874 priv->rx_handlers[STATISTICS_NOTIFICATION] = il3945_hw_rx_statistics;
875 875
876 iwl_legacy_setup_rx_scan_handlers(priv); 876 il_setup_rx_scan_handlers(priv);
877 priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl3945_rx_card_state_notif; 877 priv->rx_handlers[CARD_STATE_NOTIFICATION] = il3945_rx_card_state_notif;
878 878
879 /* Set up hardware specific Rx handlers */ 879 /* Set up hardware specific Rx handlers */
880 iwl3945_hw_rx_handler_setup(priv); 880 il3945_hw_rx_handler_setup(priv);
881} 881}
882 882
883/************************** RX-FUNCTIONS ****************************/ 883/************************** RX-FUNCTIONS ****************************/
@@ -885,7 +885,7 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
885 * Rx theory of operation 885 * Rx theory of operation
886 * 886 *
887 * The host allocates 32 DMA target addresses and passes the host address 887 * The host allocates 32 DMA target addresses and passes the host address
888 * to the firmware at register IWL_RFDS_TABLE_LOWER + N * RFD_SIZE where N is 888 * to the firmware at register IL_RFDS_TABLE_LOWER + N * RFD_SIZE where N is
889 * 0 to 31 889 * 0 to 31
890 * 890 *
891 * Rx Queue Indexes 891 * Rx Queue Indexes
@@ -914,7 +914,7 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
914 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When 914 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When
915 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled 915 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled
916 * to replenish the iwl->rxq->rx_free. 916 * to replenish the iwl->rxq->rx_free.
917 * + In iwl3945_rx_replenish (scheduled) if 'processed' != 'read' then the 917 * + In il3945_rx_replenish (scheduled) if 'processed' != 'read' then the
918 * iwl->rxq is replenished and the READ INDEX is updated (updating the 918 * iwl->rxq is replenished and the READ INDEX is updated (updating the
919 * 'processed' and 'read' driver indexes as well) 919 * 'processed' and 'read' driver indexes as well)
920 * + A received packet is processed and handed to the kernel network stack, 920 * + A received packet is processed and handed to the kernel network stack,
@@ -927,34 +927,34 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
927 * 927 *
928 * Driver sequence: 928 * Driver sequence:
929 * 929 *
930 * iwl3945_rx_replenish() Replenishes rx_free list from rx_used, and calls 930 * il3945_rx_replenish() Replenishes rx_free list from rx_used, and calls
931 * iwl3945_rx_queue_restock 931 * il3945_rx_queue_restock
932 * iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx 932 * il3945_rx_queue_restock() Moves available buffers from rx_free into Rx
933 * queue, updates firmware pointers, and updates 933 * queue, updates firmware pointers, and updates
934 * the WRITE index. If insufficient rx_free buffers 934 * the WRITE index. If insufficient rx_free buffers
935 * are available, schedules iwl3945_rx_replenish 935 * are available, schedules il3945_rx_replenish
936 * 936 *
937 * -- enable interrupts -- 937 * -- enable interrupts --
938 * ISR - iwl3945_rx() Detach iwl_rx_mem_buffers from pool up to the 938 * ISR - il3945_rx() Detach il_rx_mem_buffers from pool up to the
939 * READ INDEX, detaching the SKB from the pool. 939 * READ INDEX, detaching the SKB from the pool.
940 * Moves the packet buffer from queue to rx_used. 940 * Moves the packet buffer from queue to rx_used.
941 * Calls iwl3945_rx_queue_restock to refill any empty 941 * Calls il3945_rx_queue_restock to refill any empty
942 * slots. 942 * slots.
943 * ... 943 * ...
944 * 944 *
945 */ 945 */
946 946
947/** 947/**
948 * iwl3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr 948 * il3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr
949 */ 949 */
950static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl_priv *priv, 950static inline __le32 il3945_dma_addr2rbd_ptr(struct il_priv *priv,
951 dma_addr_t dma_addr) 951 dma_addr_t dma_addr)
952{ 952{
953 return cpu_to_le32((u32)dma_addr); 953 return cpu_to_le32((u32)dma_addr);
954} 954}
955 955
956/** 956/**
957 * iwl3945_rx_queue_restock - refill RX queue from pre-allocated pool 957 * il3945_rx_queue_restock - refill RX queue from pre-allocated pool
958 * 958 *
959 * If there are slots in the RX queue that need to be restocked, 959 * If there are slots in the RX queue that need to be restocked,
960 * and we have free pre-allocated buffers, fill the ranks as much 960 * and we have free pre-allocated buffers, fill the ranks as much
@@ -964,24 +964,24 @@ static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl_priv *priv,
964 * also updates the memory address in the firmware to reference the new 964 * also updates the memory address in the firmware to reference the new
965 * target buffer. 965 * target buffer.
966 */ 966 */
967static void iwl3945_rx_queue_restock(struct iwl_priv *priv) 967static void il3945_rx_queue_restock(struct il_priv *priv)
968{ 968{
969 struct iwl_rx_queue *rxq = &priv->rxq; 969 struct il_rx_queue *rxq = &priv->rxq;
970 struct list_head *element; 970 struct list_head *element;
971 struct iwl_rx_mem_buffer *rxb; 971 struct il_rx_mem_buffer *rxb;
972 unsigned long flags; 972 unsigned long flags;
973 int write; 973 int write;
974 974
975 spin_lock_irqsave(&rxq->lock, flags); 975 spin_lock_irqsave(&rxq->lock, flags);
976 write = rxq->write & ~0x7; 976 write = rxq->write & ~0x7;
977 while ((iwl_legacy_rx_queue_space(rxq) > 0) && (rxq->free_count)) { 977 while ((il_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
978 /* Get next free Rx buffer, remove from free list */ 978 /* Get next free Rx buffer, remove from free list */
979 element = rxq->rx_free.next; 979 element = rxq->rx_free.next;
980 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 980 rxb = list_entry(element, struct il_rx_mem_buffer, list);
981 list_del(element); 981 list_del(element);
982 982
983 /* Point to Rx buffer via next RBD in circular buffer */ 983 /* Point to Rx buffer via next RBD in circular buffer */
984 rxq->bd[rxq->write] = iwl3945_dma_addr2rbd_ptr(priv, rxb->page_dma); 984 rxq->bd[rxq->write] = il3945_dma_addr2rbd_ptr(priv, rxb->page_dma);
985 rxq->queue[rxq->write] = rxb; 985 rxq->queue[rxq->write] = rxb;
986 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; 986 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK;
987 rxq->free_count--; 987 rxq->free_count--;
@@ -1000,23 +1000,23 @@ static void iwl3945_rx_queue_restock(struct iwl_priv *priv)
1000 spin_lock_irqsave(&rxq->lock, flags); 1000 spin_lock_irqsave(&rxq->lock, flags);
1001 rxq->need_update = 1; 1001 rxq->need_update = 1;
1002 spin_unlock_irqrestore(&rxq->lock, flags); 1002 spin_unlock_irqrestore(&rxq->lock, flags);
1003 iwl_legacy_rx_queue_update_write_ptr(priv, rxq); 1003 il_rx_queue_update_write_ptr(priv, rxq);
1004 } 1004 }
1005} 1005}
1006 1006
1007/** 1007/**
1008 * iwl3945_rx_replenish - Move all used packet from rx_used to rx_free 1008 * il3945_rx_replenish - Move all used packet from rx_used to rx_free
1009 * 1009 *
1010 * When moving to rx_free an SKB is allocated for the slot. 1010 * When moving to rx_free an SKB is allocated for the slot.
1011 * 1011 *
1012 * Also restock the Rx queue via iwl3945_rx_queue_restock. 1012 * Also restock the Rx queue via il3945_rx_queue_restock.
1013 * This is called as a scheduled work item (except for during initialization) 1013 * This is called as a scheduled work item (except for during initialization)
1014 */ 1014 */
1015static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority) 1015static void il3945_rx_allocate(struct il_priv *priv, gfp_t priority)
1016{ 1016{
1017 struct iwl_rx_queue *rxq = &priv->rxq; 1017 struct il_rx_queue *rxq = &priv->rxq;
1018 struct list_head *element; 1018 struct list_head *element;
1019 struct iwl_rx_mem_buffer *rxb; 1019 struct il_rx_mem_buffer *rxb;
1020 struct page *page; 1020 struct page *page;
1021 unsigned long flags; 1021 unsigned long flags;
1022 gfp_t gfp_mask = priority; 1022 gfp_t gfp_mask = priority;
@@ -1040,10 +1040,10 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1040 page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order); 1040 page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order);
1041 if (!page) { 1041 if (!page) {
1042 if (net_ratelimit()) 1042 if (net_ratelimit())
1043 IWL_DEBUG_INFO(priv, "Failed to allocate SKB buffer.\n"); 1043 IL_DEBUG_INFO(priv, "Failed to allocate SKB buffer.\n");
1044 if ((rxq->free_count <= RX_LOW_WATERMARK) && 1044 if ((rxq->free_count <= RX_LOW_WATERMARK) &&
1045 net_ratelimit()) 1045 net_ratelimit())
1046 IWL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n", 1046 IL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n",
1047 priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL", 1047 priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL",
1048 rxq->free_count); 1048 rxq->free_count);
1049 /* We don't reschedule replenish work here -- we will 1049 /* We don't reschedule replenish work here -- we will
@@ -1059,7 +1059,7 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1059 return; 1059 return;
1060 } 1060 }
1061 element = rxq->rx_used.next; 1061 element = rxq->rx_used.next;
1062 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 1062 rxb = list_entry(element, struct il_rx_mem_buffer, list);
1063 list_del(element); 1063 list_del(element);
1064 spin_unlock_irqrestore(&rxq->lock, flags); 1064 spin_unlock_irqrestore(&rxq->lock, flags);
1065 1065
@@ -1079,7 +1079,7 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1079 } 1079 }
1080} 1080}
1081 1081
1082void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 1082void il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq)
1083{ 1083{
1084 unsigned long flags; 1084 unsigned long flags;
1085 int i; 1085 int i;
@@ -1094,7 +1094,7 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1094 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, 1094 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
1095 PAGE_SIZE << priv->hw_params.rx_page_order, 1095 PAGE_SIZE << priv->hw_params.rx_page_order,
1096 PCI_DMA_FROMDEVICE); 1096 PCI_DMA_FROMDEVICE);
1097 __iwl_legacy_free_pages(priv, rxq->pool[i].page); 1097 __il_free_pages(priv, rxq->pool[i].page);
1098 rxq->pool[i].page = NULL; 1098 rxq->pool[i].page = NULL;
1099 } 1099 }
1100 list_add_tail(&rxq->pool[i].list, &rxq->rx_used); 1100 list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
@@ -1108,23 +1108,23 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1108 spin_unlock_irqrestore(&rxq->lock, flags); 1108 spin_unlock_irqrestore(&rxq->lock, flags);
1109} 1109}
1110 1110
1111void iwl3945_rx_replenish(void *data) 1111void il3945_rx_replenish(void *data)
1112{ 1112{
1113 struct iwl_priv *priv = data; 1113 struct il_priv *priv = data;
1114 unsigned long flags; 1114 unsigned long flags;
1115 1115
1116 iwl3945_rx_allocate(priv, GFP_KERNEL); 1116 il3945_rx_allocate(priv, GFP_KERNEL);
1117 1117
1118 spin_lock_irqsave(&priv->lock, flags); 1118 spin_lock_irqsave(&priv->lock, flags);
1119 iwl3945_rx_queue_restock(priv); 1119 il3945_rx_queue_restock(priv);
1120 spin_unlock_irqrestore(&priv->lock, flags); 1120 spin_unlock_irqrestore(&priv->lock, flags);
1121} 1121}
1122 1122
1123static void iwl3945_rx_replenish_now(struct iwl_priv *priv) 1123static void il3945_rx_replenish_now(struct il_priv *priv)
1124{ 1124{
1125 iwl3945_rx_allocate(priv, GFP_ATOMIC); 1125 il3945_rx_allocate(priv, GFP_ATOMIC);
1126 1126
1127 iwl3945_rx_queue_restock(priv); 1127 il3945_rx_queue_restock(priv);
1128} 1128}
1129 1129
1130 1130
@@ -1133,7 +1133,7 @@ static void iwl3945_rx_replenish_now(struct iwl_priv *priv)
1133 * This free routine walks the list of POOL entries and if SKB is set to 1133 * This free routine walks the list of POOL entries and if SKB is set to
1134 * non NULL it is unmapped and freed 1134 * non NULL it is unmapped and freed
1135 */ 1135 */
1136static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 1136static void il3945_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq)
1137{ 1137{
1138 int i; 1138 int i;
1139 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { 1139 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
@@ -1141,14 +1141,14 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx
1141 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, 1141 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
1142 PAGE_SIZE << priv->hw_params.rx_page_order, 1142 PAGE_SIZE << priv->hw_params.rx_page_order,
1143 PCI_DMA_FROMDEVICE); 1143 PCI_DMA_FROMDEVICE);
1144 __iwl_legacy_free_pages(priv, rxq->pool[i].page); 1144 __il_free_pages(priv, rxq->pool[i].page);
1145 rxq->pool[i].page = NULL; 1145 rxq->pool[i].page = NULL;
1146 } 1146 }
1147 } 1147 }
1148 1148
1149 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, 1149 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
1150 rxq->bd_dma); 1150 rxq->bd_dma);
1151 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), 1151 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct il_rb_status),
1152 rxq->rb_stts, rxq->rb_stts_dma); 1152 rxq->rb_stts, rxq->rb_stts_dma);
1153 rxq->bd = NULL; 1153 rxq->bd = NULL;
1154 rxq->rb_stts = NULL; 1154 rxq->rb_stts = NULL;
@@ -1173,7 +1173,7 @@ static u8 ratio2dB[100] = {
1173/* Calculates a relative dB value from a ratio of linear 1173/* Calculates a relative dB value from a ratio of linear
1174 * (i.e. not dB) signal levels. 1174 * (i.e. not dB) signal levels.
1175 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ 1175 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */
1176int iwl3945_calc_db_from_ratio(int sig_ratio) 1176int il3945_calc_db_from_ratio(int sig_ratio)
1177{ 1177{
1178 /* 1000:1 or higher just report as 60 dB */ 1178 /* 1000:1 or higher just report as 60 dB */
1179 if (sig_ratio >= 1000) 1179 if (sig_ratio >= 1000)
@@ -1193,17 +1193,17 @@ int iwl3945_calc_db_from_ratio(int sig_ratio)
1193} 1193}
1194 1194
1195/** 1195/**
1196 * iwl3945_rx_handle - Main entry function for receiving responses from uCode 1196 * il3945_rx_handle - Main entry function for receiving responses from uCode
1197 * 1197 *
1198 * Uses the priv->rx_handlers callback function array to invoke 1198 * Uses the priv->rx_handlers callback function array to invoke
1199 * the appropriate handlers, including command responses, 1199 * the appropriate handlers, including command responses,
1200 * frame-received notifications, and other notifications. 1200 * frame-received notifications, and other notifications.
1201 */ 1201 */
1202static void iwl3945_rx_handle(struct iwl_priv *priv) 1202static void il3945_rx_handle(struct il_priv *priv)
1203{ 1203{
1204 struct iwl_rx_mem_buffer *rxb; 1204 struct il_rx_mem_buffer *rxb;
1205 struct iwl_rx_packet *pkt; 1205 struct il_rx_packet *pkt;
1206 struct iwl_rx_queue *rxq = &priv->rxq; 1206 struct il_rx_queue *rxq = &priv->rxq;
1207 u32 r, i; 1207 u32 r, i;
1208 int reclaim; 1208 int reclaim;
1209 unsigned long flags; 1209 unsigned long flags;
@@ -1225,7 +1225,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1225 fill_rx = 1; 1225 fill_rx = 1;
1226 /* Rx interrupt, but nothing sent from uCode */ 1226 /* Rx interrupt, but nothing sent from uCode */
1227 if (i == r) 1227 if (i == r)
1228 IWL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); 1228 IL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i);
1229 1229
1230 while (i != r) { 1230 while (i != r) {
1231 int len; 1231 int len;
@@ -1259,17 +1259,17 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1259 1259
1260 /* Based on type of command response or notification, 1260 /* Based on type of command response or notification,
1261 * handle those that need handling via function in 1261 * handle those that need handling via function in
1262 * rx_handlers table. See iwl3945_setup_rx_handlers() */ 1262 * rx_handlers table. See il3945_setup_rx_handlers() */
1263 if (priv->rx_handlers[pkt->hdr.cmd]) { 1263 if (priv->rx_handlers[pkt->hdr.cmd]) {
1264 IWL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, i, 1264 IL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, i,
1265 iwl_legacy_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); 1265 il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd);
1266 priv->isr_stats.rx_handlers[pkt->hdr.cmd]++; 1266 priv->isr_stats.rx_handlers[pkt->hdr.cmd]++;
1267 priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); 1267 priv->rx_handlers[pkt->hdr.cmd] (priv, rxb);
1268 } else { 1268 } else {
1269 /* No handling needed */ 1269 /* No handling needed */
1270 IWL_DEBUG_RX(priv, 1270 IL_DEBUG_RX(priv,
1271 "r %d i %d No handler needed for %s, 0x%02x\n", 1271 "r %d i %d No handler needed for %s, 0x%02x\n",
1272 r, i, iwl_legacy_get_cmd_string(pkt->hdr.cmd), 1272 r, i, il_get_cmd_string(pkt->hdr.cmd),
1273 pkt->hdr.cmd); 1273 pkt->hdr.cmd);
1274 } 1274 }
1275 1275
@@ -1282,12 +1282,12 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1282 1282
1283 if (reclaim) { 1283 if (reclaim) {
1284 /* Invoke any callbacks, transfer the buffer to caller, 1284 /* Invoke any callbacks, transfer the buffer to caller,
1285 * and fire off the (possibly) blocking iwl_legacy_send_cmd() 1285 * and fire off the (possibly) blocking il_send_cmd()
1286 * as we reclaim the driver command queue */ 1286 * as we reclaim the driver command queue */
1287 if (rxb->page) 1287 if (rxb->page)
1288 iwl_legacy_tx_cmd_complete(priv, rxb); 1288 il_tx_cmd_complete(priv, rxb);
1289 else 1289 else
1290 IWL_WARN(priv, "Claim null rxb?\n"); 1290 IL_WARN(priv, "Claim null rxb?\n");
1291 } 1291 }
1292 1292
1293 /* Reuse the page if possible. For notification packets and 1293 /* Reuse the page if possible. For notification packets and
@@ -1312,7 +1312,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1312 count++; 1312 count++;
1313 if (count >= 8) { 1313 if (count >= 8) {
1314 rxq->read = i; 1314 rxq->read = i;
1315 iwl3945_rx_replenish_now(priv); 1315 il3945_rx_replenish_now(priv);
1316 count = 0; 1316 count = 0;
1317 } 1317 }
1318 } 1318 }
@@ -1321,20 +1321,20 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1321 /* Backtrack one entry */ 1321 /* Backtrack one entry */
1322 rxq->read = i; 1322 rxq->read = i;
1323 if (fill_rx) 1323 if (fill_rx)
1324 iwl3945_rx_replenish_now(priv); 1324 il3945_rx_replenish_now(priv);
1325 else 1325 else
1326 iwl3945_rx_queue_restock(priv); 1326 il3945_rx_queue_restock(priv);
1327} 1327}
1328 1328
1329/* call this function to flush any scheduled tasklet */ 1329/* call this function to flush any scheduled tasklet */
1330static inline void iwl3945_synchronize_irq(struct iwl_priv *priv) 1330static inline void il3945_synchronize_irq(struct il_priv *priv)
1331{ 1331{
1332 /* wait to make sure we flush pending tasklet*/ 1332 /* wait to make sure we flush pending tasklet*/
1333 synchronize_irq(priv->pci_dev->irq); 1333 synchronize_irq(priv->pci_dev->irq);
1334 tasklet_kill(&priv->irq_tasklet); 1334 tasklet_kill(&priv->irq_tasklet);
1335} 1335}
1336 1336
1337static const char *iwl3945_desc_lookup(int i) 1337static const char *il3945_desc_lookup(int i)
1338{ 1338{
1339 switch (i) { 1339 switch (i) {
1340 case 1: 1340 case 1:
@@ -1357,7 +1357,7 @@ static const char *iwl3945_desc_lookup(int i)
1357#define ERROR_START_OFFSET (1 * sizeof(u32)) 1357#define ERROR_START_OFFSET (1 * sizeof(u32))
1358#define ERROR_ELEM_SIZE (7 * sizeof(u32)) 1358#define ERROR_ELEM_SIZE (7 * sizeof(u32))
1359 1359
1360void iwl3945_dump_nic_error_log(struct iwl_priv *priv) 1360void il3945_dump_nic_error_log(struct il_priv *priv)
1361{ 1361{
1362 u32 i; 1362 u32 i;
1363 u32 desc, time, count, base, data1; 1363 u32 desc, time, count, base, data1;
@@ -1365,47 +1365,47 @@ void iwl3945_dump_nic_error_log(struct iwl_priv *priv)
1365 1365
1366 base = le32_to_cpu(priv->card_alive.error_event_table_ptr); 1366 base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
1367 1367
1368 if (!iwl3945_hw_valid_rtc_data_addr(base)) { 1368 if (!il3945_hw_valid_rtc_data_addr(base)) {
1369 IWL_ERR(priv, "Not valid error log pointer 0x%08X\n", base); 1369 IL_ERR(priv, "Not valid error log pointer 0x%08X\n", base);
1370 return; 1370 return;
1371 } 1371 }
1372 1372
1373 1373
1374 count = iwl_legacy_read_targ_mem(priv, base); 1374 count = il_read_targ_mem(priv, base);
1375 1375
1376 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { 1376 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
1377 IWL_ERR(priv, "Start IWL Error Log Dump:\n"); 1377 IL_ERR(priv, "Start IWL Error Log Dump:\n");
1378 IWL_ERR(priv, "Status: 0x%08lX, count: %d\n", 1378 IL_ERR(priv, "Status: 0x%08lX, count: %d\n",
1379 priv->status, count); 1379 priv->status, count);
1380 } 1380 }
1381 1381
1382 IWL_ERR(priv, "Desc Time asrtPC blink2 " 1382 IL_ERR(priv, "Desc Time asrtPC blink2 "
1383 "ilink1 nmiPC Line\n"); 1383 "ilink1 nmiPC Line\n");
1384 for (i = ERROR_START_OFFSET; 1384 for (i = ERROR_START_OFFSET;
1385 i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET; 1385 i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET;
1386 i += ERROR_ELEM_SIZE) { 1386 i += ERROR_ELEM_SIZE) {
1387 desc = iwl_legacy_read_targ_mem(priv, base + i); 1387 desc = il_read_targ_mem(priv, base + i);
1388 time = 1388 time =
1389 iwl_legacy_read_targ_mem(priv, base + i + 1 * sizeof(u32)); 1389 il_read_targ_mem(priv, base + i + 1 * sizeof(u32));
1390 blink1 = 1390 blink1 =
1391 iwl_legacy_read_targ_mem(priv, base + i + 2 * sizeof(u32)); 1391 il_read_targ_mem(priv, base + i + 2 * sizeof(u32));
1392 blink2 = 1392 blink2 =
1393 iwl_legacy_read_targ_mem(priv, base + i + 3 * sizeof(u32)); 1393 il_read_targ_mem(priv, base + i + 3 * sizeof(u32));
1394 ilink1 = 1394 ilink1 =
1395 iwl_legacy_read_targ_mem(priv, base + i + 4 * sizeof(u32)); 1395 il_read_targ_mem(priv, base + i + 4 * sizeof(u32));
1396 ilink2 = 1396 ilink2 =
1397 iwl_legacy_read_targ_mem(priv, base + i + 5 * sizeof(u32)); 1397 il_read_targ_mem(priv, base + i + 5 * sizeof(u32));
1398 data1 = 1398 data1 =
1399 iwl_legacy_read_targ_mem(priv, base + i + 6 * sizeof(u32)); 1399 il_read_targ_mem(priv, base + i + 6 * sizeof(u32));
1400 1400
1401 IWL_ERR(priv, 1401 IL_ERR(priv,
1402 "%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", 1402 "%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n",
1403 iwl3945_desc_lookup(desc), desc, time, blink1, blink2, 1403 il3945_desc_lookup(desc), desc, time, blink1, blink2,
1404 ilink1, ilink2, data1); 1404 ilink1, ilink2, data1);
1405 } 1405 }
1406} 1406}
1407 1407
1408static void iwl3945_irq_tasklet(struct iwl_priv *priv) 1408static void il3945_irq_tasklet(struct il_priv *priv)
1409{ 1409{
1410 u32 inta, handled = 0; 1410 u32 inta, handled = 0;
1411 u32 inta_fh; 1411 u32 inta_fh;
@@ -1419,20 +1419,20 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1419 /* Ack/clear/reset pending uCode interrupts. 1419 /* Ack/clear/reset pending uCode interrupts.
1420 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, 1420 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS,
1421 * and will clear only when CSR_FH_INT_STATUS gets cleared. */ 1421 * and will clear only when CSR_FH_INT_STATUS gets cleared. */
1422 inta = iwl_read32(priv, CSR_INT); 1422 inta = il_read32(priv, CSR_INT);
1423 iwl_write32(priv, CSR_INT, inta); 1423 il_write32(priv, CSR_INT, inta);
1424 1424
1425 /* Ack/clear/reset pending flow-handler (DMA) interrupts. 1425 /* Ack/clear/reset pending flow-handler (DMA) interrupts.
1426 * Any new interrupts that happen after this, either while we're 1426 * Any new interrupts that happen after this, either while we're
1427 * in this tasklet, or later, will show up in next ISR/tasklet. */ 1427 * in this tasklet, or later, will show up in next ISR/tasklet. */
1428 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 1428 inta_fh = il_read32(priv, CSR_FH_INT_STATUS);
1429 iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); 1429 il_write32(priv, CSR_FH_INT_STATUS, inta_fh);
1430 1430
1431#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 1431#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
1432 if (iwl_legacy_get_debug_level(priv) & IWL_DL_ISR) { 1432 if (il_get_debug_level(priv) & IL_DL_ISR) {
1433 /* just for debug */ 1433 /* just for debug */
1434 inta_mask = iwl_read32(priv, CSR_INT_MASK); 1434 inta_mask = il_read32(priv, CSR_INT_MASK);
1435 IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 1435 IL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
1436 inta, inta_mask, inta_fh); 1436 inta, inta_mask, inta_fh);
1437 } 1437 }
1438#endif 1438#endif
@@ -1450,13 +1450,13 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1450 1450
1451 /* Now service all interrupt bits discovered above. */ 1451 /* Now service all interrupt bits discovered above. */
1452 if (inta & CSR_INT_BIT_HW_ERR) { 1452 if (inta & CSR_INT_BIT_HW_ERR) {
1453 IWL_ERR(priv, "Hardware error detected. Restarting.\n"); 1453 IL_ERR(priv, "Hardware error detected. Restarting.\n");
1454 1454
1455 /* Tell the device to stop sending interrupts */ 1455 /* Tell the device to stop sending interrupts */
1456 iwl_legacy_disable_interrupts(priv); 1456 il_disable_interrupts(priv);
1457 1457
1458 priv->isr_stats.hw++; 1458 priv->isr_stats.hw++;
1459 iwl_legacy_irq_handle_error(priv); 1459 il_irq_handle_error(priv);
1460 1460
1461 handled |= CSR_INT_BIT_HW_ERR; 1461 handled |= CSR_INT_BIT_HW_ERR;
1462 1462
@@ -1464,17 +1464,17 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1464 } 1464 }
1465 1465
1466#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 1466#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
1467 if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) { 1467 if (il_get_debug_level(priv) & (IL_DL_ISR)) {
1468 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 1468 /* NIC fires this, but we don't use it, redundant with WAKEUP */
1469 if (inta & CSR_INT_BIT_SCD) { 1469 if (inta & CSR_INT_BIT_SCD) {
1470 IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " 1470 IL_DEBUG_ISR(priv, "Scheduler finished to transmit "
1471 "the frame/frames.\n"); 1471 "the frame/frames.\n");
1472 priv->isr_stats.sch++; 1472 priv->isr_stats.sch++;
1473 } 1473 }
1474 1474
1475 /* Alive notification via Rx interrupt will do the real work */ 1475 /* Alive notification via Rx interrupt will do the real work */
1476 if (inta & CSR_INT_BIT_ALIVE) { 1476 if (inta & CSR_INT_BIT_ALIVE) {
1477 IWL_DEBUG_ISR(priv, "Alive interrupt\n"); 1477 IL_DEBUG_ISR(priv, "Alive interrupt\n");
1478 priv->isr_stats.alive++; 1478 priv->isr_stats.alive++;
1479 } 1479 }
1480 } 1480 }
@@ -1484,23 +1484,23 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1484 1484
1485 /* Error detected by uCode */ 1485 /* Error detected by uCode */
1486 if (inta & CSR_INT_BIT_SW_ERR) { 1486 if (inta & CSR_INT_BIT_SW_ERR) {
1487 IWL_ERR(priv, "Microcode SW error detected. " 1487 IL_ERR(priv, "Microcode SW error detected. "
1488 "Restarting 0x%X.\n", inta); 1488 "Restarting 0x%X.\n", inta);
1489 priv->isr_stats.sw++; 1489 priv->isr_stats.sw++;
1490 iwl_legacy_irq_handle_error(priv); 1490 il_irq_handle_error(priv);
1491 handled |= CSR_INT_BIT_SW_ERR; 1491 handled |= CSR_INT_BIT_SW_ERR;
1492 } 1492 }
1493 1493
1494 /* uCode wakes up after power-down sleep */ 1494 /* uCode wakes up after power-down sleep */
1495 if (inta & CSR_INT_BIT_WAKEUP) { 1495 if (inta & CSR_INT_BIT_WAKEUP) {
1496 IWL_DEBUG_ISR(priv, "Wakeup interrupt\n"); 1496 IL_DEBUG_ISR(priv, "Wakeup interrupt\n");
1497 iwl_legacy_rx_queue_update_write_ptr(priv, &priv->rxq); 1497 il_rx_queue_update_write_ptr(priv, &priv->rxq);
1498 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[0]); 1498 il_txq_update_write_ptr(priv, &priv->txq[0]);
1499 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[1]); 1499 il_txq_update_write_ptr(priv, &priv->txq[1]);
1500 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[2]); 1500 il_txq_update_write_ptr(priv, &priv->txq[2]);
1501 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[3]); 1501 il_txq_update_write_ptr(priv, &priv->txq[3]);
1502 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[4]); 1502 il_txq_update_write_ptr(priv, &priv->txq[4]);
1503 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[5]); 1503 il_txq_update_write_ptr(priv, &priv->txq[5]);
1504 1504
1505 priv->isr_stats.wakeup++; 1505 priv->isr_stats.wakeup++;
1506 handled |= CSR_INT_BIT_WAKEUP; 1506 handled |= CSR_INT_BIT_WAKEUP;
@@ -1510,67 +1510,67 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1510 * Rx "responses" (frame-received notification), and other 1510 * Rx "responses" (frame-received notification), and other
1511 * notifications from uCode come through here*/ 1511 * notifications from uCode come through here*/
1512 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { 1512 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) {
1513 iwl3945_rx_handle(priv); 1513 il3945_rx_handle(priv);
1514 priv->isr_stats.rx++; 1514 priv->isr_stats.rx++;
1515 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); 1515 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX);
1516 } 1516 }
1517 1517
1518 if (inta & CSR_INT_BIT_FH_TX) { 1518 if (inta & CSR_INT_BIT_FH_TX) {
1519 IWL_DEBUG_ISR(priv, "Tx interrupt\n"); 1519 IL_DEBUG_ISR(priv, "Tx interrupt\n");
1520 priv->isr_stats.tx++; 1520 priv->isr_stats.tx++;
1521 1521
1522 iwl_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); 1522 il_write32(priv, CSR_FH_INT_STATUS, (1 << 6));
1523 iwl_legacy_write_direct32(priv, FH39_TCSR_CREDIT 1523 il_write_direct32(priv, FH39_TCSR_CREDIT
1524 (FH39_SRVC_CHNL), 0x0); 1524 (FH39_SRVC_CHNL), 0x0);
1525 handled |= CSR_INT_BIT_FH_TX; 1525 handled |= CSR_INT_BIT_FH_TX;
1526 } 1526 }
1527 1527
1528 if (inta & ~handled) { 1528 if (inta & ~handled) {
1529 IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); 1529 IL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled);
1530 priv->isr_stats.unhandled++; 1530 priv->isr_stats.unhandled++;
1531 } 1531 }
1532 1532
1533 if (inta & ~priv->inta_mask) { 1533 if (inta & ~priv->inta_mask) {
1534 IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", 1534 IL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n",
1535 inta & ~priv->inta_mask); 1535 inta & ~priv->inta_mask);
1536 IWL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh); 1536 IL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh);
1537 } 1537 }
1538 1538
1539 /* Re-enable all interrupts */ 1539 /* Re-enable all interrupts */
1540 /* only Re-enable if disabled by irq */ 1540 /* only Re-enable if disabled by irq */
1541 if (test_bit(STATUS_INT_ENABLED, &priv->status)) 1541 if (test_bit(STATUS_INT_ENABLED, &priv->status))
1542 iwl_legacy_enable_interrupts(priv); 1542 il_enable_interrupts(priv);
1543 1543
1544#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 1544#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
1545 if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) { 1545 if (il_get_debug_level(priv) & (IL_DL_ISR)) {
1546 inta = iwl_read32(priv, CSR_INT); 1546 inta = il_read32(priv, CSR_INT);
1547 inta_mask = iwl_read32(priv, CSR_INT_MASK); 1547 inta_mask = il_read32(priv, CSR_INT_MASK);
1548 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 1548 inta_fh = il_read32(priv, CSR_FH_INT_STATUS);
1549 IWL_DEBUG_ISR(priv, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " 1549 IL_DEBUG_ISR(priv, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, "
1550 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); 1550 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags);
1551 } 1551 }
1552#endif 1552#endif
1553} 1553}
1554 1554
1555static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, 1555static int il3945_get_channels_for_scan(struct il_priv *priv,
1556 enum ieee80211_band band, 1556 enum ieee80211_band band,
1557 u8 is_active, u8 n_probes, 1557 u8 is_active, u8 n_probes,
1558 struct iwl3945_scan_channel *scan_ch, 1558 struct il3945_scan_channel *scan_ch,
1559 struct ieee80211_vif *vif) 1559 struct ieee80211_vif *vif)
1560{ 1560{
1561 struct ieee80211_channel *chan; 1561 struct ieee80211_channel *chan;
1562 const struct ieee80211_supported_band *sband; 1562 const struct ieee80211_supported_band *sband;
1563 const struct iwl_channel_info *ch_info; 1563 const struct il_channel_info *ch_info;
1564 u16 passive_dwell = 0; 1564 u16 passive_dwell = 0;
1565 u16 active_dwell = 0; 1565 u16 active_dwell = 0;
1566 int added, i; 1566 int added, i;
1567 1567
1568 sband = iwl_get_hw_mode(priv, band); 1568 sband = il_get_hw_mode(priv, band);
1569 if (!sband) 1569 if (!sband)
1570 return 0; 1570 return 0;
1571 1571
1572 active_dwell = iwl_legacy_get_active_dwell_time(priv, band, n_probes); 1572 active_dwell = il_get_active_dwell_time(priv, band, n_probes);
1573 passive_dwell = iwl_legacy_get_passive_dwell_time(priv, band, vif); 1573 passive_dwell = il_get_passive_dwell_time(priv, band, vif);
1574 1574
1575 if (passive_dwell <= active_dwell) 1575 if (passive_dwell <= active_dwell)
1576 passive_dwell = active_dwell + 1; 1576 passive_dwell = active_dwell + 1;
@@ -1583,10 +1583,10 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1583 1583
1584 scan_ch->channel = chan->hw_value; 1584 scan_ch->channel = chan->hw_value;
1585 1585
1586 ch_info = iwl_legacy_get_channel_info(priv, band, 1586 ch_info = il_get_channel_info(priv, band,
1587 scan_ch->channel); 1587 scan_ch->channel);
1588 if (!iwl_legacy_is_channel_valid(ch_info)) { 1588 if (!il_is_channel_valid(ch_info)) {
1589 IWL_DEBUG_SCAN(priv, 1589 IL_DEBUG_SCAN(priv,
1590 "Channel %d is INVALID for this band.\n", 1590 "Channel %d is INVALID for this band.\n",
1591 scan_ch->channel); 1591 scan_ch->channel);
1592 continue; 1592 continue;
@@ -1597,10 +1597,10 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1597 /* If passive , set up for auto-switch 1597 /* If passive , set up for auto-switch
1598 * and use long active_dwell time. 1598 * and use long active_dwell time.
1599 */ 1599 */
1600 if (!is_active || iwl_legacy_is_channel_passive(ch_info) || 1600 if (!is_active || il_is_channel_passive(ch_info) ||
1601 (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) { 1601 (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) {
1602 scan_ch->type = 0; /* passive */ 1602 scan_ch->type = 0; /* passive */
1603 if (IWL_UCODE_API(priv->ucode_ver) == 1) 1603 if (IL_UCODE_API(priv->ucode_ver) == 1)
1604 scan_ch->active_dwell = cpu_to_le16(passive_dwell - 1); 1604 scan_ch->active_dwell = cpu_to_le16(passive_dwell - 1);
1605 } else { 1605 } else {
1606 scan_ch->type = 1; /* active */ 1606 scan_ch->type = 1; /* active */
@@ -1610,7 +1610,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1610 * scan channels (probes gets sent right away), 1610 * scan channels (probes gets sent right away),
1611 * or for passive channels (probes get se sent only after 1611 * or for passive channels (probes get se sent only after
1612 * hearing clear Rx packet).*/ 1612 * hearing clear Rx packet).*/
1613 if (IWL_UCODE_API(priv->ucode_ver) >= 2) { 1613 if (IL_UCODE_API(priv->ucode_ver) >= 2) {
1614 if (n_probes) 1614 if (n_probes)
1615 scan_ch->type |= IWL39_SCAN_PROBE_MASK(n_probes); 1615 scan_ch->type |= IWL39_SCAN_PROBE_MASK(n_probes);
1616 } else { 1616 } else {
@@ -1635,7 +1635,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1635 */ 1635 */
1636 } 1636 }
1637 1637
1638 IWL_DEBUG_SCAN(priv, "Scanning %d [%s %d]\n", 1638 IL_DEBUG_SCAN(priv, "Scanning %d [%s %d]\n",
1639 scan_ch->channel, 1639 scan_ch->channel,
1640 (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE", 1640 (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE",
1641 (scan_ch->type & 1) ? 1641 (scan_ch->type & 1) ?
@@ -1645,25 +1645,25 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1645 added++; 1645 added++;
1646 } 1646 }
1647 1647
1648 IWL_DEBUG_SCAN(priv, "total channels to scan %d\n", added); 1648 IL_DEBUG_SCAN(priv, "total channels to scan %d\n", added);
1649 return added; 1649 return added;
1650} 1650}
1651 1651
1652static void iwl3945_init_hw_rates(struct iwl_priv *priv, 1652static void il3945_init_hw_rates(struct il_priv *priv,
1653 struct ieee80211_rate *rates) 1653 struct ieee80211_rate *rates)
1654{ 1654{
1655 int i; 1655 int i;
1656 1656
1657 for (i = 0; i < IWL_RATE_COUNT_LEGACY; i++) { 1657 for (i = 0; i < IL_RATE_COUNT_LEGACY; i++) {
1658 rates[i].bitrate = iwl3945_rates[i].ieee * 5; 1658 rates[i].bitrate = il3945_rates[i].ieee * 5;
1659 rates[i].hw_value = i; /* Rate scaling will work on indexes */ 1659 rates[i].hw_value = i; /* Rate scaling will work on indexes */
1660 rates[i].hw_value_short = i; 1660 rates[i].hw_value_short = i;
1661 rates[i].flags = 0; 1661 rates[i].flags = 0;
1662 if ((i > IWL39_LAST_OFDM_RATE) || (i < IWL_FIRST_OFDM_RATE)) { 1662 if ((i > IWL39_LAST_OFDM_RATE) || (i < IL_FIRST_OFDM_RATE)) {
1663 /* 1663 /*
1664 * If CCK != 1M then set short preamble rate flag. 1664 * If CCK != 1M then set short preamble rate flag.
1665 */ 1665 */
1666 rates[i].flags |= (iwl3945_rates[i].plcp == 10) ? 1666 rates[i].flags |= (il3945_rates[i].plcp == 10) ?
1667 0 : IEEE80211_RATE_SHORT_PREAMBLE; 1667 0 : IEEE80211_RATE_SHORT_PREAMBLE;
1668 } 1668 }
1669 } 1669 }
@@ -1675,40 +1675,40 @@ static void iwl3945_init_hw_rates(struct iwl_priv *priv,
1675 * 1675 *
1676 ******************************************************************************/ 1676 ******************************************************************************/
1677 1677
1678static void iwl3945_dealloc_ucode_pci(struct iwl_priv *priv) 1678static void il3945_dealloc_ucode_pci(struct il_priv *priv)
1679{ 1679{
1680 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_code); 1680 il_free_fw_desc(priv->pci_dev, &priv->ucode_code);
1681 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data); 1681 il_free_fw_desc(priv->pci_dev, &priv->ucode_data);
1682 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); 1682 il_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
1683 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init); 1683 il_free_fw_desc(priv->pci_dev, &priv->ucode_init);
1684 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); 1684 il_free_fw_desc(priv->pci_dev, &priv->ucode_init_data);
1685 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_boot); 1685 il_free_fw_desc(priv->pci_dev, &priv->ucode_boot);
1686} 1686}
1687 1687
1688/** 1688/**
1689 * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host, 1689 * il3945_verify_inst_full - verify runtime uCode image in card vs. host,
1690 * looking at all data. 1690 * looking at all data.
1691 */ 1691 */
1692static int iwl3945_verify_inst_full(struct iwl_priv *priv, __le32 *image, u32 len) 1692static int il3945_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len)
1693{ 1693{
1694 u32 val; 1694 u32 val;
1695 u32 save_len = len; 1695 u32 save_len = len;
1696 int rc = 0; 1696 int rc = 0;
1697 u32 errcnt; 1697 u32 errcnt;
1698 1698
1699 IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); 1699 IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
1700 1700
1701 iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, 1701 il_write_direct32(priv, HBUS_TARG_MEM_RADDR,
1702 IWL39_RTC_INST_LOWER_BOUND); 1702 IWL39_RTC_INST_LOWER_BOUND);
1703 1703
1704 errcnt = 0; 1704 errcnt = 0;
1705 for (; len > 0; len -= sizeof(u32), image++) { 1705 for (; len > 0; len -= sizeof(u32), image++) {
1706 /* read data comes through single port, auto-incr addr */ 1706 /* read data comes through single port, auto-incr addr */
1707 /* NOTE: Use the debugless read so we don't flood kernel log 1707 /* NOTE: Use the debugless read so we don't flood kernel log
1708 * if IWL_DL_IO is set */ 1708 * if IL_DL_IO is set */
1709 val = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); 1709 val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT);
1710 if (val != le32_to_cpu(*image)) { 1710 if (val != le32_to_cpu(*image)) {
1711 IWL_ERR(priv, "uCode INST section is invalid at " 1711 IL_ERR(priv, "uCode INST section is invalid at "
1712 "offset 0x%x, is 0x%x, s/b 0x%x\n", 1712 "offset 0x%x, is 0x%x, s/b 0x%x\n",
1713 save_len - len, val, le32_to_cpu(*image)); 1713 save_len - len, val, le32_to_cpu(*image));
1714 rc = -EIO; 1714 rc = -EIO;
@@ -1720,7 +1720,7 @@ static int iwl3945_verify_inst_full(struct iwl_priv *priv, __le32 *image, u32 le
1720 1720
1721 1721
1722 if (!errcnt) 1722 if (!errcnt)
1723 IWL_DEBUG_INFO(priv, 1723 IL_DEBUG_INFO(priv,
1724 "ucode image in INSTRUCTION memory is good\n"); 1724 "ucode image in INSTRUCTION memory is good\n");
1725 1725
1726 return rc; 1726 return rc;
@@ -1728,29 +1728,29 @@ static int iwl3945_verify_inst_full(struct iwl_priv *priv, __le32 *image, u32 le
1728 1728
1729 1729
1730/** 1730/**
1731 * iwl3945_verify_inst_sparse - verify runtime uCode image in card vs. host, 1731 * il3945_verify_inst_sparse - verify runtime uCode image in card vs. host,
1732 * using sample data 100 bytes apart. If these sample points are good, 1732 * using sample data 100 bytes apart. If these sample points are good,
1733 * it's a pretty good bet that everything between them is good, too. 1733 * it's a pretty good bet that everything between them is good, too.
1734 */ 1734 */
1735static int iwl3945_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) 1735static int il3945_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 len)
1736{ 1736{
1737 u32 val; 1737 u32 val;
1738 int rc = 0; 1738 int rc = 0;
1739 u32 errcnt = 0; 1739 u32 errcnt = 0;
1740 u32 i; 1740 u32 i;
1741 1741
1742 IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); 1742 IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
1743 1743
1744 for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { 1744 for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) {
1745 /* read data comes through single port, auto-incr addr */ 1745 /* read data comes through single port, auto-incr addr */
1746 /* NOTE: Use the debugless read so we don't flood kernel log 1746 /* NOTE: Use the debugless read so we don't flood kernel log
1747 * if IWL_DL_IO is set */ 1747 * if IL_DL_IO is set */
1748 iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, 1748 il_write_direct32(priv, HBUS_TARG_MEM_RADDR,
1749 i + IWL39_RTC_INST_LOWER_BOUND); 1749 i + IWL39_RTC_INST_LOWER_BOUND);
1750 val = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); 1750 val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT);
1751 if (val != le32_to_cpu(*image)) { 1751 if (val != le32_to_cpu(*image)) {
1752#if 0 /* Enable this if you want to see details */ 1752#if 0 /* Enable this if you want to see details */
1753 IWL_ERR(priv, "uCode INST section is invalid at " 1753 IL_ERR(priv, "uCode INST section is invalid at "
1754 "offset 0x%x, is 0x%x, s/b 0x%x\n", 1754 "offset 0x%x, is 0x%x, s/b 0x%x\n",
1755 i, val, *image); 1755 i, val, *image);
1756#endif 1756#endif
@@ -1766,10 +1766,10 @@ static int iwl3945_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32
1766 1766
1767 1767
1768/** 1768/**
1769 * iwl3945_verify_ucode - determine which instruction image is in SRAM, 1769 * il3945_verify_ucode - determine which instruction image is in SRAM,
1770 * and verify its contents 1770 * and verify its contents
1771 */ 1771 */
1772static int iwl3945_verify_ucode(struct iwl_priv *priv) 1772static int il3945_verify_ucode(struct il_priv *priv)
1773{ 1773{
1774 __le32 *image; 1774 __le32 *image;
1775 u32 len; 1775 u32 len;
@@ -1778,60 +1778,60 @@ static int iwl3945_verify_ucode(struct iwl_priv *priv)
1778 /* Try bootstrap */ 1778 /* Try bootstrap */
1779 image = (__le32 *)priv->ucode_boot.v_addr; 1779 image = (__le32 *)priv->ucode_boot.v_addr;
1780 len = priv->ucode_boot.len; 1780 len = priv->ucode_boot.len;
1781 rc = iwl3945_verify_inst_sparse(priv, image, len); 1781 rc = il3945_verify_inst_sparse(priv, image, len);
1782 if (rc == 0) { 1782 if (rc == 0) {
1783 IWL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n"); 1783 IL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n");
1784 return 0; 1784 return 0;
1785 } 1785 }
1786 1786
1787 /* Try initialize */ 1787 /* Try initialize */
1788 image = (__le32 *)priv->ucode_init.v_addr; 1788 image = (__le32 *)priv->ucode_init.v_addr;
1789 len = priv->ucode_init.len; 1789 len = priv->ucode_init.len;
1790 rc = iwl3945_verify_inst_sparse(priv, image, len); 1790 rc = il3945_verify_inst_sparse(priv, image, len);
1791 if (rc == 0) { 1791 if (rc == 0) {
1792 IWL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n"); 1792 IL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n");
1793 return 0; 1793 return 0;
1794 } 1794 }
1795 1795
1796 /* Try runtime/protocol */ 1796 /* Try runtime/protocol */
1797 image = (__le32 *)priv->ucode_code.v_addr; 1797 image = (__le32 *)priv->ucode_code.v_addr;
1798 len = priv->ucode_code.len; 1798 len = priv->ucode_code.len;
1799 rc = iwl3945_verify_inst_sparse(priv, image, len); 1799 rc = il3945_verify_inst_sparse(priv, image, len);
1800 if (rc == 0) { 1800 if (rc == 0) {
1801 IWL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n"); 1801 IL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n");
1802 return 0; 1802 return 0;
1803 } 1803 }
1804 1804
1805 IWL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); 1805 IL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
1806 1806
1807 /* Since nothing seems to match, show first several data entries in 1807 /* Since nothing seems to match, show first several data entries in
1808 * instruction SRAM, so maybe visual inspection will give a clue. 1808 * instruction SRAM, so maybe visual inspection will give a clue.
1809 * Selection of bootstrap image (vs. other images) is arbitrary. */ 1809 * Selection of bootstrap image (vs. other images) is arbitrary. */
1810 image = (__le32 *)priv->ucode_boot.v_addr; 1810 image = (__le32 *)priv->ucode_boot.v_addr;
1811 len = priv->ucode_boot.len; 1811 len = priv->ucode_boot.len;
1812 rc = iwl3945_verify_inst_full(priv, image, len); 1812 rc = il3945_verify_inst_full(priv, image, len);
1813 1813
1814 return rc; 1814 return rc;
1815} 1815}
1816 1816
1817static void iwl3945_nic_start(struct iwl_priv *priv) 1817static void il3945_nic_start(struct il_priv *priv)
1818{ 1818{
1819 /* Remove all resets to allow NIC to operate */ 1819 /* Remove all resets to allow NIC to operate */
1820 iwl_write32(priv, CSR_RESET, 0); 1820 il_write32(priv, CSR_RESET, 0);
1821} 1821}
1822 1822
1823#define IWL3945_UCODE_GET(item) \ 1823#define IWL3945_UCODE_GET(item) \
1824static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode)\ 1824static u32 il3945_ucode_get_##item(const struct il_ucode_header *ucode)\
1825{ \ 1825{ \
1826 return le32_to_cpu(ucode->v1.item); \ 1826 return le32_to_cpu(ucode->v1.item); \
1827} 1827}
1828 1828
1829static u32 iwl3945_ucode_get_header_size(u32 api_ver) 1829static u32 il3945_ucode_get_header_size(u32 api_ver)
1830{ 1830{
1831 return 24; 1831 return 24;
1832} 1832}
1833 1833
1834static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode) 1834static u8 *il3945_ucode_get_data(const struct il_ucode_header *ucode)
1835{ 1835{
1836 return (u8 *) ucode->v1.data; 1836 return (u8 *) ucode->v1.data;
1837} 1837}
@@ -1843,13 +1843,13 @@ IWL3945_UCODE_GET(init_data_size);
1843IWL3945_UCODE_GET(boot_size); 1843IWL3945_UCODE_GET(boot_size);
1844 1844
1845/** 1845/**
1846 * iwl3945_read_ucode - Read uCode images from disk file. 1846 * il3945_read_ucode - Read uCode images from disk file.
1847 * 1847 *
1848 * Copy into buffers for card to fetch via bus-mastering 1848 * Copy into buffers for card to fetch via bus-mastering
1849 */ 1849 */
1850static int iwl3945_read_ucode(struct iwl_priv *priv) 1850static int il3945_read_ucode(struct il_priv *priv)
1851{ 1851{
1852 const struct iwl_ucode_header *ucode; 1852 const struct il_ucode_header *ucode;
1853 int ret = -EINVAL, index; 1853 int ret = -EINVAL, index;
1854 const struct firmware *ucode_raw; 1854 const struct firmware *ucode_raw;
1855 /* firmware file name contains uCode/driver compatibility version */ 1855 /* firmware file name contains uCode/driver compatibility version */
@@ -1867,7 +1867,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
1867 sprintf(buf, "%s%u%s", name_pre, index, ".ucode"); 1867 sprintf(buf, "%s%u%s", name_pre, index, ".ucode");
1868 ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev); 1868 ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev);
1869 if (ret < 0) { 1869 if (ret < 0) {
1870 IWL_ERR(priv, "%s firmware file req failed: %d\n", 1870 IL_ERR(priv, "%s firmware file req failed: %d\n",
1871 buf, ret); 1871 buf, ret);
1872 if (ret == -ENOENT) 1872 if (ret == -ENOENT)
1873 continue; 1873 continue;
@@ -1875,11 +1875,11 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
1875 goto error; 1875 goto error;
1876 } else { 1876 } else {
1877 if (index < api_max) 1877 if (index < api_max)
1878 IWL_ERR(priv, "Loaded firmware %s, " 1878 IL_ERR(priv, "Loaded firmware %s, "
1879 "which is deprecated. " 1879 "which is deprecated. "
1880 " Please use API v%u instead.\n", 1880 " Please use API v%u instead.\n",
1881 buf, api_max); 1881 buf, api_max);
1882 IWL_DEBUG_INFO(priv, "Got firmware '%s' file " 1882 IL_DEBUG_INFO(priv, "Got firmware '%s' file "
1883 "(%zd bytes) from disk\n", 1883 "(%zd bytes) from disk\n",
1884 buf, ucode_raw->size); 1884 buf, ucode_raw->size);
1885 break; 1885 break;
@@ -1890,30 +1890,30 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
1890 goto error; 1890 goto error;
1891 1891
1892 /* Make sure that we got at least our header! */ 1892 /* Make sure that we got at least our header! */
1893 if (ucode_raw->size < iwl3945_ucode_get_header_size(1)) { 1893 if (ucode_raw->size < il3945_ucode_get_header_size(1)) {
1894 IWL_ERR(priv, "File size way too small!\n"); 1894 IL_ERR(priv, "File size way too small!\n");
1895 ret = -EINVAL; 1895 ret = -EINVAL;
1896 goto err_release; 1896 goto err_release;
1897 } 1897 }
1898 1898
1899 /* Data from ucode file: header followed by uCode images */ 1899 /* Data from ucode file: header followed by uCode images */
1900 ucode = (struct iwl_ucode_header *)ucode_raw->data; 1900 ucode = (struct il_ucode_header *)ucode_raw->data;
1901 1901
1902 priv->ucode_ver = le32_to_cpu(ucode->ver); 1902 priv->ucode_ver = le32_to_cpu(ucode->ver);
1903 api_ver = IWL_UCODE_API(priv->ucode_ver); 1903 api_ver = IL_UCODE_API(priv->ucode_ver);
1904 inst_size = iwl3945_ucode_get_inst_size(ucode); 1904 inst_size = il3945_ucode_get_inst_size(ucode);
1905 data_size = iwl3945_ucode_get_data_size(ucode); 1905 data_size = il3945_ucode_get_data_size(ucode);
1906 init_size = iwl3945_ucode_get_init_size(ucode); 1906 init_size = il3945_ucode_get_init_size(ucode);
1907 init_data_size = iwl3945_ucode_get_init_data_size(ucode); 1907 init_data_size = il3945_ucode_get_init_data_size(ucode);
1908 boot_size = iwl3945_ucode_get_boot_size(ucode); 1908 boot_size = il3945_ucode_get_boot_size(ucode);
1909 src = iwl3945_ucode_get_data(ucode); 1909 src = il3945_ucode_get_data(ucode);
1910 1910
1911 /* api_ver should match the api version forming part of the 1911 /* api_ver should match the api version forming part of the
1912 * firmware filename ... but we don't check for that and only rely 1912 * firmware filename ... but we don't check for that and only rely
1913 * on the API version read from firmware header from here on forward */ 1913 * on the API version read from firmware header from here on forward */
1914 1914
1915 if (api_ver < api_min || api_ver > api_max) { 1915 if (api_ver < api_min || api_ver > api_max) {
1916 IWL_ERR(priv, "Driver unable to support your firmware API. " 1916 IL_ERR(priv, "Driver unable to support your firmware API. "
1917 "Driver supports v%u, firmware is v%u.\n", 1917 "Driver supports v%u, firmware is v%u.\n",
1918 api_max, api_ver); 1918 api_max, api_ver);
1919 priv->ucode_ver = 0; 1919 priv->ucode_ver = 0;
@@ -1921,45 +1921,45 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
1921 goto err_release; 1921 goto err_release;
1922 } 1922 }
1923 if (api_ver != api_max) 1923 if (api_ver != api_max)
1924 IWL_ERR(priv, "Firmware has old API version. Expected %u, " 1924 IL_ERR(priv, "Firmware has old API version. Expected %u, "
1925 "got %u. New firmware can be obtained " 1925 "got %u. New firmware can be obtained "
1926 "from http://www.intellinuxwireless.org.\n", 1926 "from http://www.intellinuxwireless.org.\n",
1927 api_max, api_ver); 1927 api_max, api_ver);
1928 1928
1929 IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", 1929 IL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n",
1930 IWL_UCODE_MAJOR(priv->ucode_ver), 1930 IL_UCODE_MAJOR(priv->ucode_ver),
1931 IWL_UCODE_MINOR(priv->ucode_ver), 1931 IL_UCODE_MINOR(priv->ucode_ver),
1932 IWL_UCODE_API(priv->ucode_ver), 1932 IL_UCODE_API(priv->ucode_ver),
1933 IWL_UCODE_SERIAL(priv->ucode_ver)); 1933 IL_UCODE_SERIAL(priv->ucode_ver));
1934 1934
1935 snprintf(priv->hw->wiphy->fw_version, 1935 snprintf(priv->hw->wiphy->fw_version,
1936 sizeof(priv->hw->wiphy->fw_version), 1936 sizeof(priv->hw->wiphy->fw_version),
1937 "%u.%u.%u.%u", 1937 "%u.%u.%u.%u",
1938 IWL_UCODE_MAJOR(priv->ucode_ver), 1938 IL_UCODE_MAJOR(priv->ucode_ver),
1939 IWL_UCODE_MINOR(priv->ucode_ver), 1939 IL_UCODE_MINOR(priv->ucode_ver),
1940 IWL_UCODE_API(priv->ucode_ver), 1940 IL_UCODE_API(priv->ucode_ver),
1941 IWL_UCODE_SERIAL(priv->ucode_ver)); 1941 IL_UCODE_SERIAL(priv->ucode_ver));
1942 1942
1943 IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", 1943 IL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n",
1944 priv->ucode_ver); 1944 priv->ucode_ver);
1945 IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n", 1945 IL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n",
1946 inst_size); 1946 inst_size);
1947 IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n", 1947 IL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n",
1948 data_size); 1948 data_size);
1949 IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n", 1949 IL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n",
1950 init_size); 1950 init_size);
1951 IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n", 1951 IL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n",
1952 init_data_size); 1952 init_data_size);
1953 IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n", 1953 IL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n",
1954 boot_size); 1954 boot_size);
1955 1955
1956 1956
1957 /* Verify size of file vs. image size info in file's header */ 1957 /* Verify size of file vs. image size info in file's header */
1958 if (ucode_raw->size != iwl3945_ucode_get_header_size(api_ver) + 1958 if (ucode_raw->size != il3945_ucode_get_header_size(api_ver) +
1959 inst_size + data_size + init_size + 1959 inst_size + data_size + init_size +
1960 init_data_size + boot_size) { 1960 init_data_size + boot_size) {
1961 1961
1962 IWL_DEBUG_INFO(priv, 1962 IL_DEBUG_INFO(priv,
1963 "uCode file size %zd does not match expected size\n", 1963 "uCode file size %zd does not match expected size\n",
1964 ucode_raw->size); 1964 ucode_raw->size);
1965 ret = -EINVAL; 1965 ret = -EINVAL;
@@ -1968,34 +1968,34 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
1968 1968
1969 /* Verify that uCode images will fit in card's SRAM */ 1969 /* Verify that uCode images will fit in card's SRAM */
1970 if (inst_size > IWL39_MAX_INST_SIZE) { 1970 if (inst_size > IWL39_MAX_INST_SIZE) {
1971 IWL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n", 1971 IL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n",
1972 inst_size); 1972 inst_size);
1973 ret = -EINVAL; 1973 ret = -EINVAL;
1974 goto err_release; 1974 goto err_release;
1975 } 1975 }
1976 1976
1977 if (data_size > IWL39_MAX_DATA_SIZE) { 1977 if (data_size > IWL39_MAX_DATA_SIZE) {
1978 IWL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n", 1978 IL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n",
1979 data_size); 1979 data_size);
1980 ret = -EINVAL; 1980 ret = -EINVAL;
1981 goto err_release; 1981 goto err_release;
1982 } 1982 }
1983 if (init_size > IWL39_MAX_INST_SIZE) { 1983 if (init_size > IWL39_MAX_INST_SIZE) {
1984 IWL_DEBUG_INFO(priv, 1984 IL_DEBUG_INFO(priv,
1985 "uCode init instr len %d too large to fit in\n", 1985 "uCode init instr len %d too large to fit in\n",
1986 init_size); 1986 init_size);
1987 ret = -EINVAL; 1987 ret = -EINVAL;
1988 goto err_release; 1988 goto err_release;
1989 } 1989 }
1990 if (init_data_size > IWL39_MAX_DATA_SIZE) { 1990 if (init_data_size > IWL39_MAX_DATA_SIZE) {
1991 IWL_DEBUG_INFO(priv, 1991 IL_DEBUG_INFO(priv,
1992 "uCode init data len %d too large to fit in\n", 1992 "uCode init data len %d too large to fit in\n",
1993 init_data_size); 1993 init_data_size);
1994 ret = -EINVAL; 1994 ret = -EINVAL;
1995 goto err_release; 1995 goto err_release;
1996 } 1996 }
1997 if (boot_size > IWL39_MAX_BSM_SIZE) { 1997 if (boot_size > IWL39_MAX_BSM_SIZE) {
1998 IWL_DEBUG_INFO(priv, 1998 IL_DEBUG_INFO(priv,
1999 "uCode boot instr len %d too large to fit in\n", 1999 "uCode boot instr len %d too large to fit in\n",
2000 boot_size); 2000 boot_size);
2001 ret = -EINVAL; 2001 ret = -EINVAL;
@@ -2008,13 +2008,13 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2008 * 1) unmodified from disk 2008 * 1) unmodified from disk
2009 * 2) backup cache for save/restore during power-downs */ 2009 * 2) backup cache for save/restore during power-downs */
2010 priv->ucode_code.len = inst_size; 2010 priv->ucode_code.len = inst_size;
2011 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); 2011 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_code);
2012 2012
2013 priv->ucode_data.len = data_size; 2013 priv->ucode_data.len = data_size;
2014 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); 2014 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data);
2015 2015
2016 priv->ucode_data_backup.len = data_size; 2016 priv->ucode_data_backup.len = data_size;
2017 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); 2017 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
2018 2018
2019 if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || 2019 if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr ||
2020 !priv->ucode_data_backup.v_addr) 2020 !priv->ucode_data_backup.v_addr)
@@ -2023,10 +2023,10 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2023 /* Initialization instructions and data */ 2023 /* Initialization instructions and data */
2024 if (init_size && init_data_size) { 2024 if (init_size && init_data_size) {
2025 priv->ucode_init.len = init_size; 2025 priv->ucode_init.len = init_size;
2026 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); 2026 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init);
2027 2027
2028 priv->ucode_init_data.len = init_data_size; 2028 priv->ucode_init_data.len = init_data_size;
2029 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); 2029 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data);
2030 2030
2031 if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) 2031 if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr)
2032 goto err_pci_alloc; 2032 goto err_pci_alloc;
@@ -2035,7 +2035,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2035 /* Bootstrap (instructions only, no data) */ 2035 /* Bootstrap (instructions only, no data) */
2036 if (boot_size) { 2036 if (boot_size) {
2037 priv->ucode_boot.len = boot_size; 2037 priv->ucode_boot.len = boot_size;
2038 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); 2038 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot);
2039 2039
2040 if (!priv->ucode_boot.v_addr) 2040 if (!priv->ucode_boot.v_addr)
2041 goto err_pci_alloc; 2041 goto err_pci_alloc;
@@ -2045,18 +2045,18 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2045 2045
2046 /* Runtime instructions (first block of data in file) */ 2046 /* Runtime instructions (first block of data in file) */
2047 len = inst_size; 2047 len = inst_size;
2048 IWL_DEBUG_INFO(priv, 2048 IL_DEBUG_INFO(priv,
2049 "Copying (but not loading) uCode instr len %zd\n", len); 2049 "Copying (but not loading) uCode instr len %zd\n", len);
2050 memcpy(priv->ucode_code.v_addr, src, len); 2050 memcpy(priv->ucode_code.v_addr, src, len);
2051 src += len; 2051 src += len;
2052 2052
2053 IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", 2053 IL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n",
2054 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); 2054 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
2055 2055
2056 /* Runtime data (2nd block) 2056 /* Runtime data (2nd block)
2057 * NOTE: Copy into backup buffer will be done in iwl3945_up() */ 2057 * NOTE: Copy into backup buffer will be done in il3945_up() */
2058 len = data_size; 2058 len = data_size;
2059 IWL_DEBUG_INFO(priv, 2059 IL_DEBUG_INFO(priv,
2060 "Copying (but not loading) uCode data len %zd\n", len); 2060 "Copying (but not loading) uCode data len %zd\n", len);
2061 memcpy(priv->ucode_data.v_addr, src, len); 2061 memcpy(priv->ucode_data.v_addr, src, len);
2062 memcpy(priv->ucode_data_backup.v_addr, src, len); 2062 memcpy(priv->ucode_data_backup.v_addr, src, len);
@@ -2065,7 +2065,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2065 /* Initialization instructions (3rd block) */ 2065 /* Initialization instructions (3rd block) */
2066 if (init_size) { 2066 if (init_size) {
2067 len = init_size; 2067 len = init_size;
2068 IWL_DEBUG_INFO(priv, 2068 IL_DEBUG_INFO(priv,
2069 "Copying (but not loading) init instr len %zd\n", len); 2069 "Copying (but not loading) init instr len %zd\n", len);
2070 memcpy(priv->ucode_init.v_addr, src, len); 2070 memcpy(priv->ucode_init.v_addr, src, len);
2071 src += len; 2071 src += len;
@@ -2074,7 +2074,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2074 /* Initialization data (4th block) */ 2074 /* Initialization data (4th block) */
2075 if (init_data_size) { 2075 if (init_data_size) {
2076 len = init_data_size; 2076 len = init_data_size;
2077 IWL_DEBUG_INFO(priv, 2077 IL_DEBUG_INFO(priv,
2078 "Copying (but not loading) init data len %zd\n", len); 2078 "Copying (but not loading) init data len %zd\n", len);
2079 memcpy(priv->ucode_init_data.v_addr, src, len); 2079 memcpy(priv->ucode_init_data.v_addr, src, len);
2080 src += len; 2080 src += len;
@@ -2082,7 +2082,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2082 2082
2083 /* Bootstrap instructions (5th block) */ 2083 /* Bootstrap instructions (5th block) */
2084 len = boot_size; 2084 len = boot_size;
2085 IWL_DEBUG_INFO(priv, 2085 IL_DEBUG_INFO(priv,
2086 "Copying (but not loading) boot instr len %zd\n", len); 2086 "Copying (but not loading) boot instr len %zd\n", len);
2087 memcpy(priv->ucode_boot.v_addr, src, len); 2087 memcpy(priv->ucode_boot.v_addr, src, len);
2088 2088
@@ -2091,9 +2091,9 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2091 return 0; 2091 return 0;
2092 2092
2093 err_pci_alloc: 2093 err_pci_alloc:
2094 IWL_ERR(priv, "failed to allocate pci memory\n"); 2094 IL_ERR(priv, "failed to allocate pci memory\n");
2095 ret = -ENOMEM; 2095 ret = -ENOMEM;
2096 iwl3945_dealloc_ucode_pci(priv); 2096 il3945_dealloc_ucode_pci(priv);
2097 2097
2098 err_release: 2098 err_release:
2099 release_firmware(ucode_raw); 2099 release_firmware(ucode_raw);
@@ -2104,7 +2104,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2104 2104
2105 2105
2106/** 2106/**
2107 * iwl3945_set_ucode_ptrs - Set uCode address location 2107 * il3945_set_ucode_ptrs - Set uCode address location
2108 * 2108 *
2109 * Tell initialization uCode where to find runtime uCode. 2109 * Tell initialization uCode where to find runtime uCode.
2110 * 2110 *
@@ -2112,7 +2112,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2112 * We need to replace them to load runtime uCode inst and data, 2112 * We need to replace them to load runtime uCode inst and data,
2113 * and to save runtime data when powering down. 2113 * and to save runtime data when powering down.
2114 */ 2114 */
2115static int iwl3945_set_ucode_ptrs(struct iwl_priv *priv) 2115static int il3945_set_ucode_ptrs(struct il_priv *priv)
2116{ 2116{
2117 dma_addr_t pinst; 2117 dma_addr_t pinst;
2118 dma_addr_t pdata; 2118 dma_addr_t pdata;
@@ -2122,56 +2122,56 @@ static int iwl3945_set_ucode_ptrs(struct iwl_priv *priv)
2122 pdata = priv->ucode_data_backup.p_addr; 2122 pdata = priv->ucode_data_backup.p_addr;
2123 2123
2124 /* Tell bootstrap uCode where to find image to load */ 2124 /* Tell bootstrap uCode where to find image to load */
2125 iwl_legacy_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 2125 il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
2126 iwl_legacy_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 2126 il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
2127 iwl_legacy_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, 2127 il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG,
2128 priv->ucode_data.len); 2128 priv->ucode_data.len);
2129 2129
2130 /* Inst byte count must be last to set up, bit 31 signals uCode 2130 /* Inst byte count must be last to set up, bit 31 signals uCode
2131 * that all new ptr/size info is in place */ 2131 * that all new ptr/size info is in place */
2132 iwl_legacy_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, 2132 il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG,
2133 priv->ucode_code.len | BSM_DRAM_INST_LOAD); 2133 priv->ucode_code.len | BSM_DRAM_INST_LOAD);
2134 2134
2135 IWL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); 2135 IL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n");
2136 2136
2137 return 0; 2137 return 0;
2138} 2138}
2139 2139
2140/** 2140/**
2141 * iwl3945_init_alive_start - Called after REPLY_ALIVE notification received 2141 * il3945_init_alive_start - Called after REPLY_ALIVE notification received
2142 * 2142 *
2143 * Called after REPLY_ALIVE notification received from "initialize" uCode. 2143 * Called after REPLY_ALIVE notification received from "initialize" uCode.
2144 * 2144 *
2145 * Tell "initialize" uCode to go ahead and load the runtime uCode. 2145 * Tell "initialize" uCode to go ahead and load the runtime uCode.
2146 */ 2146 */
2147static void iwl3945_init_alive_start(struct iwl_priv *priv) 2147static void il3945_init_alive_start(struct il_priv *priv)
2148{ 2148{
2149 /* Check alive response for "valid" sign from uCode */ 2149 /* Check alive response for "valid" sign from uCode */
2150 if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { 2150 if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
2151 /* We had an error bringing up the hardware, so take it 2151 /* We had an error bringing up the hardware, so take it
2152 * all the way back down so we can try again */ 2152 * all the way back down so we can try again */
2153 IWL_DEBUG_INFO(priv, "Initialize Alive failed.\n"); 2153 IL_DEBUG_INFO(priv, "Initialize Alive failed.\n");
2154 goto restart; 2154 goto restart;
2155 } 2155 }
2156 2156
2157 /* Bootstrap uCode has loaded initialize uCode ... verify inst image. 2157 /* Bootstrap uCode has loaded initialize uCode ... verify inst image.
2158 * This is a paranoid check, because we would not have gotten the 2158 * This is a paranoid check, because we would not have gotten the
2159 * "initialize" alive if code weren't properly loaded. */ 2159 * "initialize" alive if code weren't properly loaded. */
2160 if (iwl3945_verify_ucode(priv)) { 2160 if (il3945_verify_ucode(priv)) {
2161 /* Runtime instruction load was bad; 2161 /* Runtime instruction load was bad;
2162 * take it all the way back down so we can try again */ 2162 * take it all the way back down so we can try again */
2163 IWL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); 2163 IL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n");
2164 goto restart; 2164 goto restart;
2165 } 2165 }
2166 2166
2167 /* Send pointers to protocol/runtime uCode image ... init code will 2167 /* Send pointers to protocol/runtime uCode image ... init code will
2168 * load and launch runtime uCode, which will send us another "Alive" 2168 * load and launch runtime uCode, which will send us another "Alive"
2169 * notification. */ 2169 * notification. */
2170 IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); 2170 IL_DEBUG_INFO(priv, "Initialization Alive received.\n");
2171 if (iwl3945_set_ucode_ptrs(priv)) { 2171 if (il3945_set_ucode_ptrs(priv)) {
2172 /* Runtime instruction load won't happen; 2172 /* Runtime instruction load won't happen;
2173 * take it all the way back down so we can try again */ 2173 * take it all the way back down so we can try again */
2174 IWL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); 2174 IL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n");
2175 goto restart; 2175 goto restart;
2176 } 2176 }
2177 return; 2177 return;
@@ -2181,49 +2181,49 @@ static void iwl3945_init_alive_start(struct iwl_priv *priv)
2181} 2181}
2182 2182
2183/** 2183/**
2184 * iwl3945_alive_start - called after REPLY_ALIVE notification received 2184 * il3945_alive_start - called after REPLY_ALIVE notification received
2185 * from protocol/runtime uCode (initialization uCode's 2185 * from protocol/runtime uCode (initialization uCode's
2186 * Alive gets handled by iwl3945_init_alive_start()). 2186 * Alive gets handled by il3945_init_alive_start()).
2187 */ 2187 */
2188static void iwl3945_alive_start(struct iwl_priv *priv) 2188static void il3945_alive_start(struct il_priv *priv)
2189{ 2189{
2190 int thermal_spin = 0; 2190 int thermal_spin = 0;
2191 u32 rfkill; 2191 u32 rfkill;
2192 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2192 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2193 2193
2194 IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); 2194 IL_DEBUG_INFO(priv, "Runtime Alive received.\n");
2195 2195
2196 if (priv->card_alive.is_valid != UCODE_VALID_OK) { 2196 if (priv->card_alive.is_valid != UCODE_VALID_OK) {
2197 /* We had an error bringing up the hardware, so take it 2197 /* We had an error bringing up the hardware, so take it
2198 * all the way back down so we can try again */ 2198 * all the way back down so we can try again */
2199 IWL_DEBUG_INFO(priv, "Alive failed.\n"); 2199 IL_DEBUG_INFO(priv, "Alive failed.\n");
2200 goto restart; 2200 goto restart;
2201 } 2201 }
2202 2202
2203 /* Initialize uCode has loaded Runtime uCode ... verify inst image. 2203 /* Initialize uCode has loaded Runtime uCode ... verify inst image.
2204 * This is a paranoid check, because we would not have gotten the 2204 * This is a paranoid check, because we would not have gotten the
2205 * "runtime" alive if code weren't properly loaded. */ 2205 * "runtime" alive if code weren't properly loaded. */
2206 if (iwl3945_verify_ucode(priv)) { 2206 if (il3945_verify_ucode(priv)) {
2207 /* Runtime instruction load was bad; 2207 /* Runtime instruction load was bad;
2208 * take it all the way back down so we can try again */ 2208 * take it all the way back down so we can try again */
2209 IWL_DEBUG_INFO(priv, "Bad runtime uCode load.\n"); 2209 IL_DEBUG_INFO(priv, "Bad runtime uCode load.\n");
2210 goto restart; 2210 goto restart;
2211 } 2211 }
2212 2212
2213 rfkill = iwl_legacy_read_prph(priv, APMG_RFKILL_REG); 2213 rfkill = il_read_prph(priv, APMG_RFKILL_REG);
2214 IWL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill); 2214 IL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill);
2215 2215
2216 if (rfkill & 0x1) { 2216 if (rfkill & 0x1) {
2217 clear_bit(STATUS_RF_KILL_HW, &priv->status); 2217 clear_bit(STATUS_RF_KILL_HW, &priv->status);
2218 /* if RFKILL is not on, then wait for thermal 2218 /* if RFKILL is not on, then wait for thermal
2219 * sensor in adapter to kick in */ 2219 * sensor in adapter to kick in */
2220 while (iwl3945_hw_get_temperature(priv) == 0) { 2220 while (il3945_hw_get_temperature(priv) == 0) {
2221 thermal_spin++; 2221 thermal_spin++;
2222 udelay(10); 2222 udelay(10);
2223 } 2223 }
2224 2224
2225 if (thermal_spin) 2225 if (thermal_spin)
2226 IWL_DEBUG_INFO(priv, "Thermal calibration took %dus\n", 2226 IL_DEBUG_INFO(priv, "Thermal calibration took %dus\n",
2227 thermal_spin * 10); 2227 thermal_spin * 10);
2228 } else 2228 } else
2229 set_bit(STATUS_RF_KILL_HW, &priv->status); 2229 set_bit(STATUS_RF_KILL_HW, &priv->status);
@@ -2232,39 +2232,39 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2232 set_bit(STATUS_ALIVE, &priv->status); 2232 set_bit(STATUS_ALIVE, &priv->status);
2233 2233
2234 /* Enable watchdog to monitor the driver tx queues */ 2234 /* Enable watchdog to monitor the driver tx queues */
2235 iwl_legacy_setup_watchdog(priv); 2235 il_setup_watchdog(priv);
2236 2236
2237 if (iwl_legacy_is_rfkill(priv)) 2237 if (il_is_rfkill(priv))
2238 return; 2238 return;
2239 2239
2240 ieee80211_wake_queues(priv->hw); 2240 ieee80211_wake_queues(priv->hw);
2241 2241
2242 priv->active_rate = IWL_RATES_MASK_3945; 2242 priv->active_rate = IL_RATES_MASK_3945;
2243 2243
2244 iwl_legacy_power_update_mode(priv, true); 2244 il_power_update_mode(priv, true);
2245 2245
2246 if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { 2246 if (il_is_associated(priv, IL_RXON_CTX_BSS)) {
2247 struct iwl3945_rxon_cmd *active_rxon = 2247 struct il3945_rxon_cmd *active_rxon =
2248 (struct iwl3945_rxon_cmd *)(&ctx->active); 2248 (struct il3945_rxon_cmd *)(&ctx->active);
2249 2249
2250 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2250 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2251 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2251 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2252 } else { 2252 } else {
2253 /* Initialize our rx_config data */ 2253 /* Initialize our rx_config data */
2254 iwl_legacy_connection_init_rx_config(priv, ctx); 2254 il_connection_init_rx_config(priv, ctx);
2255 } 2255 }
2256 2256
2257 /* Configure Bluetooth device coexistence support */ 2257 /* Configure Bluetooth device coexistence support */
2258 iwl_legacy_send_bt_config(priv); 2258 il_send_bt_config(priv);
2259 2259
2260 set_bit(STATUS_READY, &priv->status); 2260 set_bit(STATUS_READY, &priv->status);
2261 2261
2262 /* Configure the adapter for unassociated operation */ 2262 /* Configure the adapter for unassociated operation */
2263 iwl3945_commit_rxon(priv, ctx); 2263 il3945_commit_rxon(priv, ctx);
2264 2264
2265 iwl3945_reg_txpower_periodic(priv); 2265 il3945_reg_txpower_periodic(priv);
2266 2266
2267 IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); 2267 IL_DEBUG_INFO(priv, "ALIVE processing complete.\n");
2268 wake_up(&priv->wait_command_queue); 2268 wake_up(&priv->wait_command_queue);
2269 2269
2270 return; 2270 return;
@@ -2273,16 +2273,16 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2273 queue_work(priv->workqueue, &priv->restart); 2273 queue_work(priv->workqueue, &priv->restart);
2274} 2274}
2275 2275
2276static void iwl3945_cancel_deferred_work(struct iwl_priv *priv); 2276static void il3945_cancel_deferred_work(struct il_priv *priv);
2277 2277
2278static void __iwl3945_down(struct iwl_priv *priv) 2278static void __il3945_down(struct il_priv *priv)
2279{ 2279{
2280 unsigned long flags; 2280 unsigned long flags;
2281 int exit_pending; 2281 int exit_pending;
2282 2282
2283 IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); 2283 IL_DEBUG_INFO(priv, DRV_NAME " is going down\n");
2284 2284
2285 iwl_legacy_scan_cancel_timeout(priv, 200); 2285 il_scan_cancel_timeout(priv, 200);
2286 2286
2287 exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); 2287 exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);
2288 2288
@@ -2291,9 +2291,9 @@ static void __iwl3945_down(struct iwl_priv *priv)
2291 del_timer_sync(&priv->watchdog); 2291 del_timer_sync(&priv->watchdog);
2292 2292
2293 /* Station information will now be cleared in device */ 2293 /* Station information will now be cleared in device */
2294 iwl_legacy_clear_ucode_stations(priv, NULL); 2294 il_clear_ucode_stations(priv, NULL);
2295 iwl_legacy_dealloc_bcast_stations(priv); 2295 il_dealloc_bcast_stations(priv);
2296 iwl_legacy_clear_driver_stations(priv); 2296 il_clear_driver_stations(priv);
2297 2297
2298 /* Unblock any waiting calls */ 2298 /* Unblock any waiting calls */
2299 wake_up_all(&priv->wait_command_queue); 2299 wake_up_all(&priv->wait_command_queue);
@@ -2304,20 +2304,20 @@ static void __iwl3945_down(struct iwl_priv *priv)
2304 clear_bit(STATUS_EXIT_PENDING, &priv->status); 2304 clear_bit(STATUS_EXIT_PENDING, &priv->status);
2305 2305
2306 /* stop and reset the on-board processor */ 2306 /* stop and reset the on-board processor */
2307 iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 2307 il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
2308 2308
2309 /* tell the device to stop sending interrupts */ 2309 /* tell the device to stop sending interrupts */
2310 spin_lock_irqsave(&priv->lock, flags); 2310 spin_lock_irqsave(&priv->lock, flags);
2311 iwl_legacy_disable_interrupts(priv); 2311 il_disable_interrupts(priv);
2312 spin_unlock_irqrestore(&priv->lock, flags); 2312 spin_unlock_irqrestore(&priv->lock, flags);
2313 iwl3945_synchronize_irq(priv); 2313 il3945_synchronize_irq(priv);
2314 2314
2315 if (priv->mac80211_registered) 2315 if (priv->mac80211_registered)
2316 ieee80211_stop_queues(priv->hw); 2316 ieee80211_stop_queues(priv->hw);
2317 2317
2318 /* If we have not previously called iwl3945_init() then 2318 /* If we have not previously called il3945_init() then
2319 * clear all bits but the RF Kill bits and return */ 2319 * clear all bits but the RF Kill bits and return */
2320 if (!iwl_legacy_is_init(priv)) { 2320 if (!il_is_init(priv)) {
2321 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 2321 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
2322 STATUS_RF_KILL_HW | 2322 STATUS_RF_KILL_HW |
2323 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 2323 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
@@ -2338,109 +2338,109 @@ static void __iwl3945_down(struct iwl_priv *priv)
2338 test_bit(STATUS_EXIT_PENDING, &priv->status) << 2338 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
2339 STATUS_EXIT_PENDING; 2339 STATUS_EXIT_PENDING;
2340 2340
2341 iwl3945_hw_txq_ctx_stop(priv); 2341 il3945_hw_txq_ctx_stop(priv);
2342 iwl3945_hw_rxq_stop(priv); 2342 il3945_hw_rxq_stop(priv);
2343 2343
2344 /* Power-down device's busmaster DMA clocks */ 2344 /* Power-down device's busmaster DMA clocks */
2345 iwl_legacy_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); 2345 il_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT);
2346 udelay(5); 2346 udelay(5);
2347 2347
2348 /* Stop the device, and put it in low power state */ 2348 /* Stop the device, and put it in low power state */
2349 iwl_legacy_apm_stop(priv); 2349 il_apm_stop(priv);
2350 2350
2351 exit: 2351 exit:
2352 memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); 2352 memset(&priv->card_alive, 0, sizeof(struct il_alive_resp));
2353 2353
2354 if (priv->beacon_skb) 2354 if (priv->beacon_skb)
2355 dev_kfree_skb(priv->beacon_skb); 2355 dev_kfree_skb(priv->beacon_skb);
2356 priv->beacon_skb = NULL; 2356 priv->beacon_skb = NULL;
2357 2357
2358 /* clear out any free frames */ 2358 /* clear out any free frames */
2359 iwl3945_clear_free_frames(priv); 2359 il3945_clear_free_frames(priv);
2360} 2360}
2361 2361
2362static void iwl3945_down(struct iwl_priv *priv) 2362static void il3945_down(struct il_priv *priv)
2363{ 2363{
2364 mutex_lock(&priv->mutex); 2364 mutex_lock(&priv->mutex);
2365 __iwl3945_down(priv); 2365 __il3945_down(priv);
2366 mutex_unlock(&priv->mutex); 2366 mutex_unlock(&priv->mutex);
2367 2367
2368 iwl3945_cancel_deferred_work(priv); 2368 il3945_cancel_deferred_work(priv);
2369} 2369}
2370 2370
2371#define MAX_HW_RESTARTS 5 2371#define MAX_HW_RESTARTS 5
2372 2372
2373static int iwl3945_alloc_bcast_station(struct iwl_priv *priv) 2373static int il3945_alloc_bcast_station(struct il_priv *priv)
2374{ 2374{
2375 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2375 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2376 unsigned long flags; 2376 unsigned long flags;
2377 u8 sta_id; 2377 u8 sta_id;
2378 2378
2379 spin_lock_irqsave(&priv->sta_lock, flags); 2379 spin_lock_irqsave(&priv->sta_lock, flags);
2380 sta_id = iwl_legacy_prep_station(priv, ctx, 2380 sta_id = il_prep_station(priv, ctx,
2381 iwlegacy_bcast_addr, false, NULL); 2381 iwlegacy_bcast_addr, false, NULL);
2382 if (sta_id == IWL_INVALID_STATION) { 2382 if (sta_id == IL_INVALID_STATION) {
2383 IWL_ERR(priv, "Unable to prepare broadcast station\n"); 2383 IL_ERR(priv, "Unable to prepare broadcast station\n");
2384 spin_unlock_irqrestore(&priv->sta_lock, flags); 2384 spin_unlock_irqrestore(&priv->sta_lock, flags);
2385 2385
2386 return -EINVAL; 2386 return -EINVAL;
2387 } 2387 }
2388 2388
2389 priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; 2389 priv->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE;
2390 priv->stations[sta_id].used |= IWL_STA_BCAST; 2390 priv->stations[sta_id].used |= IL_STA_BCAST;
2391 spin_unlock_irqrestore(&priv->sta_lock, flags); 2391 spin_unlock_irqrestore(&priv->sta_lock, flags);
2392 2392
2393 return 0; 2393 return 0;
2394} 2394}
2395 2395
2396static int __iwl3945_up(struct iwl_priv *priv) 2396static int __il3945_up(struct il_priv *priv)
2397{ 2397{
2398 int rc, i; 2398 int rc, i;
2399 2399
2400 rc = iwl3945_alloc_bcast_station(priv); 2400 rc = il3945_alloc_bcast_station(priv);
2401 if (rc) 2401 if (rc)
2402 return rc; 2402 return rc;
2403 2403
2404 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { 2404 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
2405 IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); 2405 IL_WARN(priv, "Exit pending; will not bring the NIC up\n");
2406 return -EIO; 2406 return -EIO;
2407 } 2407 }
2408 2408
2409 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { 2409 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
2410 IWL_ERR(priv, "ucode not available for device bring up\n"); 2410 IL_ERR(priv, "ucode not available for device bring up\n");
2411 return -EIO; 2411 return -EIO;
2412 } 2412 }
2413 2413
2414 /* If platform's RF_KILL switch is NOT set to KILL */ 2414 /* If platform's RF_KILL switch is NOT set to KILL */
2415 if (iwl_read32(priv, CSR_GP_CNTRL) & 2415 if (il_read32(priv, CSR_GP_CNTRL) &
2416 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 2416 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
2417 clear_bit(STATUS_RF_KILL_HW, &priv->status); 2417 clear_bit(STATUS_RF_KILL_HW, &priv->status);
2418 else { 2418 else {
2419 set_bit(STATUS_RF_KILL_HW, &priv->status); 2419 set_bit(STATUS_RF_KILL_HW, &priv->status);
2420 IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); 2420 IL_WARN(priv, "Radio disabled by HW RF Kill switch\n");
2421 return -ENODEV; 2421 return -ENODEV;
2422 } 2422 }
2423 2423
2424 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 2424 il_write32(priv, CSR_INT, 0xFFFFFFFF);
2425 2425
2426 rc = iwl3945_hw_nic_init(priv); 2426 rc = il3945_hw_nic_init(priv);
2427 if (rc) { 2427 if (rc) {
2428 IWL_ERR(priv, "Unable to int nic\n"); 2428 IL_ERR(priv, "Unable to int nic\n");
2429 return rc; 2429 return rc;
2430 } 2430 }
2431 2431
2432 /* make sure rfkill handshake bits are cleared */ 2432 /* make sure rfkill handshake bits are cleared */
2433 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2433 il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2434 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 2434 il_write32(priv, CSR_UCODE_DRV_GP1_CLR,
2435 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 2435 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
2436 2436
2437 /* clear (again), then enable host interrupts */ 2437 /* clear (again), then enable host interrupts */
2438 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 2438 il_write32(priv, CSR_INT, 0xFFFFFFFF);
2439 iwl_legacy_enable_interrupts(priv); 2439 il_enable_interrupts(priv);
2440 2440
2441 /* really make sure rfkill handshake bits are cleared */ 2441 /* really make sure rfkill handshake bits are cleared */
2442 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2442 il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2443 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2443 il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2444 2444
2445 /* Copy original ucode data image from disk into backup cache. 2445 /* Copy original ucode data image from disk into backup cache.
2446 * This will be used to initialize the on-board processor's 2446 * This will be used to initialize the on-board processor's
@@ -2460,26 +2460,26 @@ static int __iwl3945_up(struct iwl_priv *priv)
2460 rc = priv->cfg->ops->lib->load_ucode(priv); 2460 rc = priv->cfg->ops->lib->load_ucode(priv);
2461 2461
2462 if (rc) { 2462 if (rc) {
2463 IWL_ERR(priv, 2463 IL_ERR(priv,
2464 "Unable to set up bootstrap uCode: %d\n", rc); 2464 "Unable to set up bootstrap uCode: %d\n", rc);
2465 continue; 2465 continue;
2466 } 2466 }
2467 2467
2468 /* start card; "initialize" will load runtime ucode */ 2468 /* start card; "initialize" will load runtime ucode */
2469 iwl3945_nic_start(priv); 2469 il3945_nic_start(priv);
2470 2470
2471 IWL_DEBUG_INFO(priv, DRV_NAME " is coming up\n"); 2471 IL_DEBUG_INFO(priv, DRV_NAME " is coming up\n");
2472 2472
2473 return 0; 2473 return 0;
2474 } 2474 }
2475 2475
2476 set_bit(STATUS_EXIT_PENDING, &priv->status); 2476 set_bit(STATUS_EXIT_PENDING, &priv->status);
2477 __iwl3945_down(priv); 2477 __il3945_down(priv);
2478 clear_bit(STATUS_EXIT_PENDING, &priv->status); 2478 clear_bit(STATUS_EXIT_PENDING, &priv->status);
2479 2479
2480 /* tried to restart and config the device for as long as our 2480 /* tried to restart and config the device for as long as our
2481 * patience could withstand */ 2481 * patience could withstand */
2482 IWL_ERR(priv, "Unable to initialize device after %d attempts.\n", i); 2482 IL_ERR(priv, "Unable to initialize device after %d attempts.\n", i);
2483 return -EIO; 2483 return -EIO;
2484} 2484}
2485 2485
@@ -2490,30 +2490,30 @@ static int __iwl3945_up(struct iwl_priv *priv)
2490 * 2490 *
2491 *****************************************************************************/ 2491 *****************************************************************************/
2492 2492
2493static void iwl3945_bg_init_alive_start(struct work_struct *data) 2493static void il3945_bg_init_alive_start(struct work_struct *data)
2494{ 2494{
2495 struct iwl_priv *priv = 2495 struct il_priv *priv =
2496 container_of(data, struct iwl_priv, init_alive_start.work); 2496 container_of(data, struct il_priv, init_alive_start.work);
2497 2497
2498 mutex_lock(&priv->mutex); 2498 mutex_lock(&priv->mutex);
2499 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2499 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2500 goto out; 2500 goto out;
2501 2501
2502 iwl3945_init_alive_start(priv); 2502 il3945_init_alive_start(priv);
2503out: 2503out:
2504 mutex_unlock(&priv->mutex); 2504 mutex_unlock(&priv->mutex);
2505} 2505}
2506 2506
2507static void iwl3945_bg_alive_start(struct work_struct *data) 2507static void il3945_bg_alive_start(struct work_struct *data)
2508{ 2508{
2509 struct iwl_priv *priv = 2509 struct il_priv *priv =
2510 container_of(data, struct iwl_priv, alive_start.work); 2510 container_of(data, struct il_priv, alive_start.work);
2511 2511
2512 mutex_lock(&priv->mutex); 2512 mutex_lock(&priv->mutex);
2513 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2513 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2514 goto out; 2514 goto out;
2515 2515
2516 iwl3945_alive_start(priv); 2516 il3945_alive_start(priv);
2517out: 2517out:
2518 mutex_unlock(&priv->mutex); 2518 mutex_unlock(&priv->mutex);
2519} 2519}
@@ -2524,12 +2524,12 @@ out:
2524 * *is* readable even when device has been SW_RESET into low power mode 2524 * *is* readable even when device has been SW_RESET into low power mode
2525 * (e.g. during RF KILL). 2525 * (e.g. during RF KILL).
2526 */ 2526 */
2527static void iwl3945_rfkill_poll(struct work_struct *data) 2527static void il3945_rfkill_poll(struct work_struct *data)
2528{ 2528{
2529 struct iwl_priv *priv = 2529 struct il_priv *priv =
2530 container_of(data, struct iwl_priv, _3945.rfkill_poll.work); 2530 container_of(data, struct il_priv, _3945.rfkill_poll.work);
2531 bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status); 2531 bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status);
2532 bool new_rfkill = !(iwl_read32(priv, CSR_GP_CNTRL) 2532 bool new_rfkill = !(il_read32(priv, CSR_GP_CNTRL)
2533 & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); 2533 & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
2534 2534
2535 if (new_rfkill != old_rfkill) { 2535 if (new_rfkill != old_rfkill) {
@@ -2540,7 +2540,7 @@ static void iwl3945_rfkill_poll(struct work_struct *data)
2540 2540
2541 wiphy_rfkill_set_hw_state(priv->hw->wiphy, new_rfkill); 2541 wiphy_rfkill_set_hw_state(priv->hw->wiphy, new_rfkill);
2542 2542
2543 IWL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n", 2543 IL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n",
2544 new_rfkill ? "disable radio" : "enable radio"); 2544 new_rfkill ? "disable radio" : "enable radio");
2545 } 2545 }
2546 2546
@@ -2551,14 +2551,14 @@ static void iwl3945_rfkill_poll(struct work_struct *data)
2551 2551
2552} 2552}
2553 2553
2554int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) 2554int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif)
2555{ 2555{
2556 struct iwl_host_cmd cmd = { 2556 struct il_host_cmd cmd = {
2557 .id = REPLY_SCAN_CMD, 2557 .id = REPLY_SCAN_CMD,
2558 .len = sizeof(struct iwl3945_scan_cmd), 2558 .len = sizeof(struct il3945_scan_cmd),
2559 .flags = CMD_SIZE_HUGE, 2559 .flags = CMD_SIZE_HUGE,
2560 }; 2560 };
2561 struct iwl3945_scan_cmd *scan; 2561 struct il3945_scan_cmd *scan;
2562 u8 n_probes = 0; 2562 u8 n_probes = 0;
2563 enum ieee80211_band band; 2563 enum ieee80211_band band;
2564 bool is_active = false; 2564 bool is_active = false;
@@ -2568,26 +2568,26 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2568 lockdep_assert_held(&priv->mutex); 2568 lockdep_assert_held(&priv->mutex);
2569 2569
2570 if (!priv->scan_cmd) { 2570 if (!priv->scan_cmd) {
2571 priv->scan_cmd = kmalloc(sizeof(struct iwl3945_scan_cmd) + 2571 priv->scan_cmd = kmalloc(sizeof(struct il3945_scan_cmd) +
2572 IWL_MAX_SCAN_SIZE, GFP_KERNEL); 2572 IL_MAX_SCAN_SIZE, GFP_KERNEL);
2573 if (!priv->scan_cmd) { 2573 if (!priv->scan_cmd) {
2574 IWL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n"); 2574 IL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n");
2575 return -ENOMEM; 2575 return -ENOMEM;
2576 } 2576 }
2577 } 2577 }
2578 scan = priv->scan_cmd; 2578 scan = priv->scan_cmd;
2579 memset(scan, 0, sizeof(struct iwl3945_scan_cmd) + IWL_MAX_SCAN_SIZE); 2579 memset(scan, 0, sizeof(struct il3945_scan_cmd) + IL_MAX_SCAN_SIZE);
2580 2580
2581 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 2581 scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH;
2582 scan->quiet_time = IWL_ACTIVE_QUIET_TIME; 2582 scan->quiet_time = IL_ACTIVE_QUIET_TIME;
2583 2583
2584 if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { 2584 if (il_is_associated(priv, IL_RXON_CTX_BSS)) {
2585 u16 interval; 2585 u16 interval;
2586 u32 extra; 2586 u32 extra;
2587 u32 suspend_time = 100; 2587 u32 suspend_time = 100;
2588 u32 scan_suspend_time = 100; 2588 u32 scan_suspend_time = 100;
2589 2589
2590 IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); 2590 IL_DEBUG_INFO(priv, "Scanning while associated...\n");
2591 2591
2592 interval = vif->bss_conf.beacon_int; 2592 interval = vif->bss_conf.beacon_int;
2593 2593
@@ -2607,13 +2607,13 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2607 (extra | ((suspend_time % interval) * 1024)); 2607 (extra | ((suspend_time % interval) * 1024));
2608 2608
2609 scan->suspend_time = cpu_to_le32(scan_suspend_time); 2609 scan->suspend_time = cpu_to_le32(scan_suspend_time);
2610 IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n", 2610 IL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n",
2611 scan_suspend_time, interval); 2611 scan_suspend_time, interval);
2612 } 2612 }
2613 2613
2614 if (priv->scan_request->n_ssids) { 2614 if (priv->scan_request->n_ssids) {
2615 int i, p = 0; 2615 int i, p = 0;
2616 IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); 2616 IL_DEBUG_SCAN(priv, "Kicking off active scan\n");
2617 for (i = 0; i < priv->scan_request->n_ssids; i++) { 2617 for (i = 0; i < priv->scan_request->n_ssids; i++) {
2618 /* always does wildcard anyway */ 2618 /* always does wildcard anyway */
2619 if (!priv->scan_request->ssids[i].ssid_len) 2619 if (!priv->scan_request->ssids[i].ssid_len)
@@ -2629,12 +2629,12 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2629 } 2629 }
2630 is_active = true; 2630 is_active = true;
2631 } else 2631 } else
2632 IWL_DEBUG_SCAN(priv, "Kicking off passive scan.\n"); 2632 IL_DEBUG_SCAN(priv, "Kicking off passive scan.\n");
2633 2633
2634 /* We don't build a direct scan probe request; the uCode will do 2634 /* We don't build a direct scan probe request; the uCode will do
2635 * that based on the direct_mask added to each channel entry */ 2635 * that based on the direct_mask added to each channel entry */
2636 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 2636 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
2637 scan->tx_cmd.sta_id = priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id; 2637 scan->tx_cmd.sta_id = priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id;
2638 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 2638 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
2639 2639
2640 /* flags + rate selection */ 2640 /* flags + rate selection */
@@ -2642,15 +2642,15 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2642 switch (priv->scan_band) { 2642 switch (priv->scan_band) {
2643 case IEEE80211_BAND_2GHZ: 2643 case IEEE80211_BAND_2GHZ:
2644 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 2644 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
2645 scan->tx_cmd.rate = IWL_RATE_1M_PLCP; 2645 scan->tx_cmd.rate = IL_RATE_1M_PLCP;
2646 band = IEEE80211_BAND_2GHZ; 2646 band = IEEE80211_BAND_2GHZ;
2647 break; 2647 break;
2648 case IEEE80211_BAND_5GHZ: 2648 case IEEE80211_BAND_5GHZ:
2649 scan->tx_cmd.rate = IWL_RATE_6M_PLCP; 2649 scan->tx_cmd.rate = IL_RATE_6M_PLCP;
2650 band = IEEE80211_BAND_5GHZ; 2650 band = IEEE80211_BAND_5GHZ;
2651 break; 2651 break;
2652 default: 2652 default:
2653 IWL_WARN(priv, "Invalid scan band\n"); 2653 IL_WARN(priv, "Invalid scan band\n");
2654 return -EIO; 2654 return -EIO;
2655 } 2655 }
2656 2656
@@ -2659,67 +2659,67 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2659 * is marked passive, we can do active scanning if we 2659 * is marked passive, we can do active scanning if we
2660 * detect transmissions. 2660 * detect transmissions.
2661 */ 2661 */
2662 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT : 2662 scan->good_CRC_th = is_active ? IL_GOOD_CRC_TH_DEFAULT :
2663 IWL_GOOD_CRC_TH_DISABLED; 2663 IL_GOOD_CRC_TH_DISABLED;
2664 2664
2665 len = iwl_legacy_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, 2665 len = il_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
2666 vif->addr, priv->scan_request->ie, 2666 vif->addr, priv->scan_request->ie,
2667 priv->scan_request->ie_len, 2667 priv->scan_request->ie_len,
2668 IWL_MAX_SCAN_SIZE - sizeof(*scan)); 2668 IL_MAX_SCAN_SIZE - sizeof(*scan));
2669 scan->tx_cmd.len = cpu_to_le16(len); 2669 scan->tx_cmd.len = cpu_to_le16(len);
2670 2670
2671 /* select Rx antennas */ 2671 /* select Rx antennas */
2672 scan->flags |= iwl3945_get_antenna_flags(priv); 2672 scan->flags |= il3945_get_antenna_flags(priv);
2673 2673
2674 scan->channel_count = iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, 2674 scan->channel_count = il3945_get_channels_for_scan(priv, band, is_active, n_probes,
2675 (void *)&scan->data[len], vif); 2675 (void *)&scan->data[len], vif);
2676 if (scan->channel_count == 0) { 2676 if (scan->channel_count == 0) {
2677 IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); 2677 IL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count);
2678 return -EIO; 2678 return -EIO;
2679 } 2679 }
2680 2680
2681 cmd.len += le16_to_cpu(scan->tx_cmd.len) + 2681 cmd.len += le16_to_cpu(scan->tx_cmd.len) +
2682 scan->channel_count * sizeof(struct iwl3945_scan_channel); 2682 scan->channel_count * sizeof(struct il3945_scan_channel);
2683 cmd.data = scan; 2683 cmd.data = scan;
2684 scan->len = cpu_to_le16(cmd.len); 2684 scan->len = cpu_to_le16(cmd.len);
2685 2685
2686 set_bit(STATUS_SCAN_HW, &priv->status); 2686 set_bit(STATUS_SCAN_HW, &priv->status);
2687 ret = iwl_legacy_send_cmd_sync(priv, &cmd); 2687 ret = il_send_cmd_sync(priv, &cmd);
2688 if (ret) 2688 if (ret)
2689 clear_bit(STATUS_SCAN_HW, &priv->status); 2689 clear_bit(STATUS_SCAN_HW, &priv->status);
2690 return ret; 2690 return ret;
2691} 2691}
2692 2692
2693void iwl3945_post_scan(struct iwl_priv *priv) 2693void il3945_post_scan(struct il_priv *priv)
2694{ 2694{
2695 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2695 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2696 2696
2697 /* 2697 /*
2698 * Since setting the RXON may have been deferred while 2698 * Since setting the RXON may have been deferred while
2699 * performing the scan, fire one off if needed 2699 * performing the scan, fire one off if needed
2700 */ 2700 */
2701 if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) 2701 if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
2702 iwl3945_commit_rxon(priv, ctx); 2702 il3945_commit_rxon(priv, ctx);
2703} 2703}
2704 2704
2705static void iwl3945_bg_restart(struct work_struct *data) 2705static void il3945_bg_restart(struct work_struct *data)
2706{ 2706{
2707 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); 2707 struct il_priv *priv = container_of(data, struct il_priv, restart);
2708 2708
2709 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2709 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2710 return; 2710 return;
2711 2711
2712 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { 2712 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
2713 struct iwl_rxon_context *ctx; 2713 struct il_rxon_context *ctx;
2714 mutex_lock(&priv->mutex); 2714 mutex_lock(&priv->mutex);
2715 for_each_context(priv, ctx) 2715 for_each_context(priv, ctx)
2716 ctx->vif = NULL; 2716 ctx->vif = NULL;
2717 priv->is_open = 0; 2717 priv->is_open = 0;
2718 mutex_unlock(&priv->mutex); 2718 mutex_unlock(&priv->mutex);
2719 iwl3945_down(priv); 2719 il3945_down(priv);
2720 ieee80211_restart_hw(priv->hw); 2720 ieee80211_restart_hw(priv->hw);
2721 } else { 2721 } else {
2722 iwl3945_down(priv); 2722 il3945_down(priv);
2723 2723
2724 mutex_lock(&priv->mutex); 2724 mutex_lock(&priv->mutex);
2725 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { 2725 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
@@ -2727,57 +2727,57 @@ static void iwl3945_bg_restart(struct work_struct *data)
2727 return; 2727 return;
2728 } 2728 }
2729 2729
2730 __iwl3945_up(priv); 2730 __il3945_up(priv);
2731 mutex_unlock(&priv->mutex); 2731 mutex_unlock(&priv->mutex);
2732 } 2732 }
2733} 2733}
2734 2734
2735static void iwl3945_bg_rx_replenish(struct work_struct *data) 2735static void il3945_bg_rx_replenish(struct work_struct *data)
2736{ 2736{
2737 struct iwl_priv *priv = 2737 struct il_priv *priv =
2738 container_of(data, struct iwl_priv, rx_replenish); 2738 container_of(data, struct il_priv, rx_replenish);
2739 2739
2740 mutex_lock(&priv->mutex); 2740 mutex_lock(&priv->mutex);
2741 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2741 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2742 goto out; 2742 goto out;
2743 2743
2744 iwl3945_rx_replenish(priv); 2744 il3945_rx_replenish(priv);
2745out: 2745out:
2746 mutex_unlock(&priv->mutex); 2746 mutex_unlock(&priv->mutex);
2747} 2747}
2748 2748
2749void iwl3945_post_associate(struct iwl_priv *priv) 2749void il3945_post_associate(struct il_priv *priv)
2750{ 2750{
2751 int rc = 0; 2751 int rc = 0;
2752 struct ieee80211_conf *conf = NULL; 2752 struct ieee80211_conf *conf = NULL;
2753 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2753 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2754 2754
2755 if (!ctx->vif || !priv->is_open) 2755 if (!ctx->vif || !priv->is_open)
2756 return; 2756 return;
2757 2757
2758 IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", 2758 IL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n",
2759 ctx->vif->bss_conf.aid, ctx->active.bssid_addr); 2759 ctx->vif->bss_conf.aid, ctx->active.bssid_addr);
2760 2760
2761 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2761 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2762 return; 2762 return;
2763 2763
2764 iwl_legacy_scan_cancel_timeout(priv, 200); 2764 il_scan_cancel_timeout(priv, 200);
2765 2765
2766 conf = iwl_legacy_ieee80211_get_hw_conf(priv->hw); 2766 conf = il_ieee80211_get_hw_conf(priv->hw);
2767 2767
2768 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2768 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2769 iwl3945_commit_rxon(priv, ctx); 2769 il3945_commit_rxon(priv, ctx);
2770 2770
2771 rc = iwl_legacy_send_rxon_timing(priv, ctx); 2771 rc = il_send_rxon_timing(priv, ctx);
2772 if (rc) 2772 if (rc)
2773 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 2773 IL_WARN(priv, "REPLY_RXON_TIMING failed - "
2774 "Attempting to continue.\n"); 2774 "Attempting to continue.\n");
2775 2775
2776 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2776 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2777 2777
2778 ctx->staging.assoc_id = cpu_to_le16(ctx->vif->bss_conf.aid); 2778 ctx->staging.assoc_id = cpu_to_le16(ctx->vif->bss_conf.aid);
2779 2779
2780 IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", 2780 IL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n",
2781 ctx->vif->bss_conf.aid, ctx->vif->bss_conf.beacon_int); 2781 ctx->vif->bss_conf.aid, ctx->vif->bss_conf.beacon_int);
2782 2782
2783 if (ctx->vif->bss_conf.use_short_preamble) 2783 if (ctx->vif->bss_conf.use_short_preamble)
@@ -2792,17 +2792,17 @@ void iwl3945_post_associate(struct iwl_priv *priv)
2792 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 2792 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
2793 } 2793 }
2794 2794
2795 iwl3945_commit_rxon(priv, ctx); 2795 il3945_commit_rxon(priv, ctx);
2796 2796
2797 switch (ctx->vif->type) { 2797 switch (ctx->vif->type) {
2798 case NL80211_IFTYPE_STATION: 2798 case NL80211_IFTYPE_STATION:
2799 iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); 2799 il3945_rate_scale_init(priv->hw, IL_AP_ID);
2800 break; 2800 break;
2801 case NL80211_IFTYPE_ADHOC: 2801 case NL80211_IFTYPE_ADHOC:
2802 iwl3945_send_beacon_cmd(priv); 2802 il3945_send_beacon_cmd(priv);
2803 break; 2803 break;
2804 default: 2804 default:
2805 IWL_ERR(priv, "%s Should not be called in %d mode\n", 2805 IL_ERR(priv, "%s Should not be called in %d mode\n",
2806 __func__, ctx->vif->type); 2806 __func__, ctx->vif->type);
2807 break; 2807 break;
2808 } 2808 }
@@ -2816,12 +2816,12 @@ void iwl3945_post_associate(struct iwl_priv *priv)
2816 2816
2817#define UCODE_READY_TIMEOUT (2 * HZ) 2817#define UCODE_READY_TIMEOUT (2 * HZ)
2818 2818
2819static int iwl3945_mac_start(struct ieee80211_hw *hw) 2819static int il3945_mac_start(struct ieee80211_hw *hw)
2820{ 2820{
2821 struct iwl_priv *priv = hw->priv; 2821 struct il_priv *priv = hw->priv;
2822 int ret; 2822 int ret;
2823 2823
2824 IWL_DEBUG_MAC80211(priv, "enter\n"); 2824 IL_DEBUG_MAC80211(priv, "enter\n");
2825 2825
2826 /* we should be verifying the device is ready to be opened */ 2826 /* we should be verifying the device is ready to be opened */
2827 mutex_lock(&priv->mutex); 2827 mutex_lock(&priv->mutex);
@@ -2830,22 +2830,22 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
2830 * ucode filename and max sizes are card-specific. */ 2830 * ucode filename and max sizes are card-specific. */
2831 2831
2832 if (!priv->ucode_code.len) { 2832 if (!priv->ucode_code.len) {
2833 ret = iwl3945_read_ucode(priv); 2833 ret = il3945_read_ucode(priv);
2834 if (ret) { 2834 if (ret) {
2835 IWL_ERR(priv, "Could not read microcode: %d\n", ret); 2835 IL_ERR(priv, "Could not read microcode: %d\n", ret);
2836 mutex_unlock(&priv->mutex); 2836 mutex_unlock(&priv->mutex);
2837 goto out_release_irq; 2837 goto out_release_irq;
2838 } 2838 }
2839 } 2839 }
2840 2840
2841 ret = __iwl3945_up(priv); 2841 ret = __il3945_up(priv);
2842 2842
2843 mutex_unlock(&priv->mutex); 2843 mutex_unlock(&priv->mutex);
2844 2844
2845 if (ret) 2845 if (ret)
2846 goto out_release_irq; 2846 goto out_release_irq;
2847 2847
2848 IWL_DEBUG_INFO(priv, "Start UP work.\n"); 2848 IL_DEBUG_INFO(priv, "Start UP work.\n");
2849 2849
2850 /* Wait for START_ALIVE from ucode. Otherwise callbacks from 2850 /* Wait for START_ALIVE from ucode. Otherwise callbacks from
2851 * mac80211 will not be run successfully. */ 2851 * mac80211 will not be run successfully. */
@@ -2854,7 +2854,7 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
2854 UCODE_READY_TIMEOUT); 2854 UCODE_READY_TIMEOUT);
2855 if (!ret) { 2855 if (!ret) {
2856 if (!test_bit(STATUS_READY, &priv->status)) { 2856 if (!test_bit(STATUS_READY, &priv->status)) {
2857 IWL_ERR(priv, 2857 IL_ERR(priv,
2858 "Wait for START_ALIVE timeout after %dms.\n", 2858 "Wait for START_ALIVE timeout after %dms.\n",
2859 jiffies_to_msecs(UCODE_READY_TIMEOUT)); 2859 jiffies_to_msecs(UCODE_READY_TIMEOUT));
2860 ret = -ETIMEDOUT; 2860 ret = -ETIMEDOUT;
@@ -2867,29 +2867,29 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
2867 cancel_delayed_work(&priv->_3945.rfkill_poll); 2867 cancel_delayed_work(&priv->_3945.rfkill_poll);
2868 2868
2869 priv->is_open = 1; 2869 priv->is_open = 1;
2870 IWL_DEBUG_MAC80211(priv, "leave\n"); 2870 IL_DEBUG_MAC80211(priv, "leave\n");
2871 return 0; 2871 return 0;
2872 2872
2873out_release_irq: 2873out_release_irq:
2874 priv->is_open = 0; 2874 priv->is_open = 0;
2875 IWL_DEBUG_MAC80211(priv, "leave - failed\n"); 2875 IL_DEBUG_MAC80211(priv, "leave - failed\n");
2876 return ret; 2876 return ret;
2877} 2877}
2878 2878
2879static void iwl3945_mac_stop(struct ieee80211_hw *hw) 2879static void il3945_mac_stop(struct ieee80211_hw *hw)
2880{ 2880{
2881 struct iwl_priv *priv = hw->priv; 2881 struct il_priv *priv = hw->priv;
2882 2882
2883 IWL_DEBUG_MAC80211(priv, "enter\n"); 2883 IL_DEBUG_MAC80211(priv, "enter\n");
2884 2884
2885 if (!priv->is_open) { 2885 if (!priv->is_open) {
2886 IWL_DEBUG_MAC80211(priv, "leave - skip\n"); 2886 IL_DEBUG_MAC80211(priv, "leave - skip\n");
2887 return; 2887 return;
2888 } 2888 }
2889 2889
2890 priv->is_open = 0; 2890 priv->is_open = 0;
2891 2891
2892 iwl3945_down(priv); 2892 il3945_down(priv);
2893 2893
2894 flush_workqueue(priv->workqueue); 2894 flush_workqueue(priv->workqueue);
2895 2895
@@ -2897,27 +2897,27 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw)
2897 queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, 2897 queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll,
2898 round_jiffies_relative(2 * HZ)); 2898 round_jiffies_relative(2 * HZ));
2899 2899
2900 IWL_DEBUG_MAC80211(priv, "leave\n"); 2900 IL_DEBUG_MAC80211(priv, "leave\n");
2901} 2901}
2902 2902
2903static void iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 2903static void il3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2904{ 2904{
2905 struct iwl_priv *priv = hw->priv; 2905 struct il_priv *priv = hw->priv;
2906 2906
2907 IWL_DEBUG_MAC80211(priv, "enter\n"); 2907 IL_DEBUG_MAC80211(priv, "enter\n");
2908 2908
2909 IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 2909 IL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
2910 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); 2910 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
2911 2911
2912 if (iwl3945_tx_skb(priv, skb)) 2912 if (il3945_tx_skb(priv, skb))
2913 dev_kfree_skb_any(skb); 2913 dev_kfree_skb_any(skb);
2914 2914
2915 IWL_DEBUG_MAC80211(priv, "leave\n"); 2915 IL_DEBUG_MAC80211(priv, "leave\n");
2916} 2916}
2917 2917
2918void iwl3945_config_ap(struct iwl_priv *priv) 2918void il3945_config_ap(struct il_priv *priv)
2919{ 2919{
2920 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2920 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2921 struct ieee80211_vif *vif = ctx->vif; 2921 struct ieee80211_vif *vif = ctx->vif;
2922 int rc = 0; 2922 int rc = 0;
2923 2923
@@ -2925,16 +2925,16 @@ void iwl3945_config_ap(struct iwl_priv *priv)
2925 return; 2925 return;
2926 2926
2927 /* The following should be done only at AP bring up */ 2927 /* The following should be done only at AP bring up */
2928 if (!(iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS))) { 2928 if (!(il_is_associated(priv, IL_RXON_CTX_BSS))) {
2929 2929
2930 /* RXON - unassoc (to set timing command) */ 2930 /* RXON - unassoc (to set timing command) */
2931 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2931 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2932 iwl3945_commit_rxon(priv, ctx); 2932 il3945_commit_rxon(priv, ctx);
2933 2933
2934 /* RXON Timing */ 2934 /* RXON Timing */
2935 rc = iwl_legacy_send_rxon_timing(priv, ctx); 2935 rc = il_send_rxon_timing(priv, ctx);
2936 if (rc) 2936 if (rc)
2937 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 2937 IL_WARN(priv, "REPLY_RXON_TIMING failed - "
2938 "Attempting to continue.\n"); 2938 "Attempting to continue.\n");
2939 2939
2940 ctx->staging.assoc_id = 0; 2940 ctx->staging.assoc_id = 0;
@@ -2956,25 +2956,25 @@ void iwl3945_config_ap(struct iwl_priv *priv)
2956 } 2956 }
2957 /* restore RXON assoc */ 2957 /* restore RXON assoc */
2958 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2958 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2959 iwl3945_commit_rxon(priv, ctx); 2959 il3945_commit_rxon(priv, ctx);
2960 } 2960 }
2961 iwl3945_send_beacon_cmd(priv); 2961 il3945_send_beacon_cmd(priv);
2962} 2962}
2963 2963
2964static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 2964static int il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2965 struct ieee80211_vif *vif, 2965 struct ieee80211_vif *vif,
2966 struct ieee80211_sta *sta, 2966 struct ieee80211_sta *sta,
2967 struct ieee80211_key_conf *key) 2967 struct ieee80211_key_conf *key)
2968{ 2968{
2969 struct iwl_priv *priv = hw->priv; 2969 struct il_priv *priv = hw->priv;
2970 int ret = 0; 2970 int ret = 0;
2971 u8 sta_id = IWL_INVALID_STATION; 2971 u8 sta_id = IL_INVALID_STATION;
2972 u8 static_key; 2972 u8 static_key;
2973 2973
2974 IWL_DEBUG_MAC80211(priv, "enter\n"); 2974 IL_DEBUG_MAC80211(priv, "enter\n");
2975 2975
2976 if (iwl3945_mod_params.sw_crypto) { 2976 if (il3945_mod_params.sw_crypto) {
2977 IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); 2977 IL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n");
2978 return -EOPNOTSUPP; 2978 return -EOPNOTSUPP;
2979 } 2979 }
2980 2980
@@ -2986,66 +2986,66 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2986 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) 2986 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
2987 return -EOPNOTSUPP; 2987 return -EOPNOTSUPP;
2988 2988
2989 static_key = !iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS); 2989 static_key = !il_is_associated(priv, IL_RXON_CTX_BSS);
2990 2990
2991 if (!static_key) { 2991 if (!static_key) {
2992 sta_id = iwl_legacy_sta_id_or_broadcast( 2992 sta_id = il_sta_id_or_broadcast(
2993 priv, &priv->contexts[IWL_RXON_CTX_BSS], sta); 2993 priv, &priv->contexts[IL_RXON_CTX_BSS], sta);
2994 if (sta_id == IWL_INVALID_STATION) 2994 if (sta_id == IL_INVALID_STATION)
2995 return -EINVAL; 2995 return -EINVAL;
2996 } 2996 }
2997 2997
2998 mutex_lock(&priv->mutex); 2998 mutex_lock(&priv->mutex);
2999 iwl_legacy_scan_cancel_timeout(priv, 100); 2999 il_scan_cancel_timeout(priv, 100);
3000 3000
3001 switch (cmd) { 3001 switch (cmd) {
3002 case SET_KEY: 3002 case SET_KEY:
3003 if (static_key) 3003 if (static_key)
3004 ret = iwl3945_set_static_key(priv, key); 3004 ret = il3945_set_static_key(priv, key);
3005 else 3005 else
3006 ret = iwl3945_set_dynamic_key(priv, key, sta_id); 3006 ret = il3945_set_dynamic_key(priv, key, sta_id);
3007 IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); 3007 IL_DEBUG_MAC80211(priv, "enable hwcrypto key\n");
3008 break; 3008 break;
3009 case DISABLE_KEY: 3009 case DISABLE_KEY:
3010 if (static_key) 3010 if (static_key)
3011 ret = iwl3945_remove_static_key(priv); 3011 ret = il3945_remove_static_key(priv);
3012 else 3012 else
3013 ret = iwl3945_clear_sta_key_info(priv, sta_id); 3013 ret = il3945_clear_sta_key_info(priv, sta_id);
3014 IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); 3014 IL_DEBUG_MAC80211(priv, "disable hwcrypto key\n");
3015 break; 3015 break;
3016 default: 3016 default:
3017 ret = -EINVAL; 3017 ret = -EINVAL;
3018 } 3018 }
3019 3019
3020 mutex_unlock(&priv->mutex); 3020 mutex_unlock(&priv->mutex);
3021 IWL_DEBUG_MAC80211(priv, "leave\n"); 3021 IL_DEBUG_MAC80211(priv, "leave\n");
3022 3022
3023 return ret; 3023 return ret;
3024} 3024}
3025 3025
3026static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, 3026static int il3945_mac_sta_add(struct ieee80211_hw *hw,
3027 struct ieee80211_vif *vif, 3027 struct ieee80211_vif *vif,
3028 struct ieee80211_sta *sta) 3028 struct ieee80211_sta *sta)
3029{ 3029{
3030 struct iwl_priv *priv = hw->priv; 3030 struct il_priv *priv = hw->priv;
3031 struct iwl3945_sta_priv *sta_priv = (void *)sta->drv_priv; 3031 struct il3945_sta_priv *sta_priv = (void *)sta->drv_priv;
3032 int ret; 3032 int ret;
3033 bool is_ap = vif->type == NL80211_IFTYPE_STATION; 3033 bool is_ap = vif->type == NL80211_IFTYPE_STATION;
3034 u8 sta_id; 3034 u8 sta_id;
3035 3035
3036 IWL_DEBUG_INFO(priv, "received request to add station %pM\n", 3036 IL_DEBUG_INFO(priv, "received request to add station %pM\n",
3037 sta->addr); 3037 sta->addr);
3038 mutex_lock(&priv->mutex); 3038 mutex_lock(&priv->mutex);
3039 IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n", 3039 IL_DEBUG_INFO(priv, "proceeding to add station %pM\n",
3040 sta->addr); 3040 sta->addr);
3041 sta_priv->common.sta_id = IWL_INVALID_STATION; 3041 sta_priv->common.sta_id = IL_INVALID_STATION;
3042 3042
3043 3043
3044 ret = iwl_legacy_add_station_common(priv, 3044 ret = il_add_station_common(priv,
3045 &priv->contexts[IWL_RXON_CTX_BSS], 3045 &priv->contexts[IL_RXON_CTX_BSS],
3046 sta->addr, is_ap, sta, &sta_id); 3046 sta->addr, is_ap, sta, &sta_id);
3047 if (ret) { 3047 if (ret) {
3048 IWL_ERR(priv, "Unable to add station %pM (%d)\n", 3048 IL_ERR(priv, "Unable to add station %pM (%d)\n",
3049 sta->addr, ret); 3049 sta->addr, ret);
3050 /* Should we return success if return code is EEXIST ? */ 3050 /* Should we return success if return code is EEXIST ? */
3051 mutex_unlock(&priv->mutex); 3051 mutex_unlock(&priv->mutex);
@@ -3055,22 +3055,22 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw,
3055 sta_priv->common.sta_id = sta_id; 3055 sta_priv->common.sta_id = sta_id;
3056 3056
3057 /* Initialize rate scaling */ 3057 /* Initialize rate scaling */
3058 IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", 3058 IL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n",
3059 sta->addr); 3059 sta->addr);
3060 iwl3945_rs_rate_init(priv, sta, sta_id); 3060 il3945_rs_rate_init(priv, sta, sta_id);
3061 mutex_unlock(&priv->mutex); 3061 mutex_unlock(&priv->mutex);
3062 3062
3063 return 0; 3063 return 0;
3064} 3064}
3065 3065
3066static void iwl3945_configure_filter(struct ieee80211_hw *hw, 3066static void il3945_configure_filter(struct ieee80211_hw *hw,
3067 unsigned int changed_flags, 3067 unsigned int changed_flags,
3068 unsigned int *total_flags, 3068 unsigned int *total_flags,
3069 u64 multicast) 3069 u64 multicast)
3070{ 3070{
3071 struct iwl_priv *priv = hw->priv; 3071 struct il_priv *priv = hw->priv;
3072 __le32 filter_or = 0, filter_nand = 0; 3072 __le32 filter_or = 0, filter_nand = 0;
3073 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3073 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3074 3074
3075#define CHK(test, flag) do { \ 3075#define CHK(test, flag) do { \
3076 if (*total_flags & (test)) \ 3076 if (*total_flags & (test)) \
@@ -3079,7 +3079,7 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw,
3079 filter_nand |= (flag); \ 3079 filter_nand |= (flag); \
3080 } while (0) 3080 } while (0)
3081 3081
3082 IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", 3082 IL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n",
3083 changed_flags, *total_flags); 3083 changed_flags, *total_flags);
3084 3084
3085 CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); 3085 CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK);
@@ -3103,7 +3103,7 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw,
3103 3103
3104 /* 3104 /*
3105 * Receiving all multicast frames is always enabled by the 3105 * Receiving all multicast frames is always enabled by the
3106 * default flags setup in iwl_legacy_connection_init_rx_config() 3106 * default flags setup in il_connection_init_rx_config()
3107 * since we currently do not support programming multicast 3107 * since we currently do not support programming multicast
3108 * filters into the device. 3108 * filters into the device.
3109 */ 3109 */
@@ -3131,103 +3131,103 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw,
3131 * level that is used instead of the global debug level if it (the per 3131 * level that is used instead of the global debug level if it (the per
3132 * device debug level) is set. 3132 * device debug level) is set.
3133 */ 3133 */
3134static ssize_t iwl3945_show_debug_level(struct device *d, 3134static ssize_t il3945_show_debug_level(struct device *d,
3135 struct device_attribute *attr, char *buf) 3135 struct device_attribute *attr, char *buf)
3136{ 3136{
3137 struct iwl_priv *priv = dev_get_drvdata(d); 3137 struct il_priv *priv = dev_get_drvdata(d);
3138 return sprintf(buf, "0x%08X\n", iwl_legacy_get_debug_level(priv)); 3138 return sprintf(buf, "0x%08X\n", il_get_debug_level(priv));
3139} 3139}
3140static ssize_t iwl3945_store_debug_level(struct device *d, 3140static ssize_t il3945_store_debug_level(struct device *d,
3141 struct device_attribute *attr, 3141 struct device_attribute *attr,
3142 const char *buf, size_t count) 3142 const char *buf, size_t count)
3143{ 3143{
3144 struct iwl_priv *priv = dev_get_drvdata(d); 3144 struct il_priv *priv = dev_get_drvdata(d);
3145 unsigned long val; 3145 unsigned long val;
3146 int ret; 3146 int ret;
3147 3147
3148 ret = strict_strtoul(buf, 0, &val); 3148 ret = strict_strtoul(buf, 0, &val);
3149 if (ret) 3149 if (ret)
3150 IWL_INFO(priv, "%s is not in hex or decimal form.\n", buf); 3150 IL_INFO(priv, "%s is not in hex or decimal form.\n", buf);
3151 else { 3151 else {
3152 priv->debug_level = val; 3152 priv->debug_level = val;
3153 if (iwl_legacy_alloc_traffic_mem(priv)) 3153 if (il_alloc_traffic_mem(priv))
3154 IWL_ERR(priv, 3154 IL_ERR(priv,
3155 "Not enough memory to generate traffic log\n"); 3155 "Not enough memory to generate traffic log\n");
3156 } 3156 }
3157 return strnlen(buf, count); 3157 return strnlen(buf, count);
3158} 3158}
3159 3159
3160static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, 3160static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
3161 iwl3945_show_debug_level, iwl3945_store_debug_level); 3161 il3945_show_debug_level, il3945_store_debug_level);
3162 3162
3163#endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */ 3163#endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */
3164 3164
3165static ssize_t iwl3945_show_temperature(struct device *d, 3165static ssize_t il3945_show_temperature(struct device *d,
3166 struct device_attribute *attr, char *buf) 3166 struct device_attribute *attr, char *buf)
3167{ 3167{
3168 struct iwl_priv *priv = dev_get_drvdata(d); 3168 struct il_priv *priv = dev_get_drvdata(d);
3169 3169
3170 if (!iwl_legacy_is_alive(priv)) 3170 if (!il_is_alive(priv))
3171 return -EAGAIN; 3171 return -EAGAIN;
3172 3172
3173 return sprintf(buf, "%d\n", iwl3945_hw_get_temperature(priv)); 3173 return sprintf(buf, "%d\n", il3945_hw_get_temperature(priv));
3174} 3174}
3175 3175
3176static DEVICE_ATTR(temperature, S_IRUGO, iwl3945_show_temperature, NULL); 3176static DEVICE_ATTR(temperature, S_IRUGO, il3945_show_temperature, NULL);
3177 3177
3178static ssize_t iwl3945_show_tx_power(struct device *d, 3178static ssize_t il3945_show_tx_power(struct device *d,
3179 struct device_attribute *attr, char *buf) 3179 struct device_attribute *attr, char *buf)
3180{ 3180{
3181 struct iwl_priv *priv = dev_get_drvdata(d); 3181 struct il_priv *priv = dev_get_drvdata(d);
3182 return sprintf(buf, "%d\n", priv->tx_power_user_lmt); 3182 return sprintf(buf, "%d\n", priv->tx_power_user_lmt);
3183} 3183}
3184 3184
3185static ssize_t iwl3945_store_tx_power(struct device *d, 3185static ssize_t il3945_store_tx_power(struct device *d,
3186 struct device_attribute *attr, 3186 struct device_attribute *attr,
3187 const char *buf, size_t count) 3187 const char *buf, size_t count)
3188{ 3188{
3189 struct iwl_priv *priv = dev_get_drvdata(d); 3189 struct il_priv *priv = dev_get_drvdata(d);
3190 char *p = (char *)buf; 3190 char *p = (char *)buf;
3191 u32 val; 3191 u32 val;
3192 3192
3193 val = simple_strtoul(p, &p, 10); 3193 val = simple_strtoul(p, &p, 10);
3194 if (p == buf) 3194 if (p == buf)
3195 IWL_INFO(priv, ": %s is not in decimal form.\n", buf); 3195 IL_INFO(priv, ": %s is not in decimal form.\n", buf);
3196 else 3196 else
3197 iwl3945_hw_reg_set_txpower(priv, val); 3197 il3945_hw_reg_set_txpower(priv, val);
3198 3198
3199 return count; 3199 return count;
3200} 3200}
3201 3201
3202static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, iwl3945_show_tx_power, iwl3945_store_tx_power); 3202static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, il3945_show_tx_power, il3945_store_tx_power);
3203 3203
3204static ssize_t iwl3945_show_flags(struct device *d, 3204static ssize_t il3945_show_flags(struct device *d,
3205 struct device_attribute *attr, char *buf) 3205 struct device_attribute *attr, char *buf)
3206{ 3206{
3207 struct iwl_priv *priv = dev_get_drvdata(d); 3207 struct il_priv *priv = dev_get_drvdata(d);
3208 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3208 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3209 3209
3210 return sprintf(buf, "0x%04X\n", ctx->active.flags); 3210 return sprintf(buf, "0x%04X\n", ctx->active.flags);
3211} 3211}
3212 3212
3213static ssize_t iwl3945_store_flags(struct device *d, 3213static ssize_t il3945_store_flags(struct device *d,
3214 struct device_attribute *attr, 3214 struct device_attribute *attr,
3215 const char *buf, size_t count) 3215 const char *buf, size_t count)
3216{ 3216{
3217 struct iwl_priv *priv = dev_get_drvdata(d); 3217 struct il_priv *priv = dev_get_drvdata(d);
3218 u32 flags = simple_strtoul(buf, NULL, 0); 3218 u32 flags = simple_strtoul(buf, NULL, 0);
3219 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3219 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3220 3220
3221 mutex_lock(&priv->mutex); 3221 mutex_lock(&priv->mutex);
3222 if (le32_to_cpu(ctx->staging.flags) != flags) { 3222 if (le32_to_cpu(ctx->staging.flags) != flags) {
3223 /* Cancel any currently running scans... */ 3223 /* Cancel any currently running scans... */
3224 if (iwl_legacy_scan_cancel_timeout(priv, 100)) 3224 if (il_scan_cancel_timeout(priv, 100))
3225 IWL_WARN(priv, "Could not cancel scan.\n"); 3225 IL_WARN(priv, "Could not cancel scan.\n");
3226 else { 3226 else {
3227 IWL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n", 3227 IL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n",
3228 flags); 3228 flags);
3229 ctx->staging.flags = cpu_to_le32(flags); 3229 ctx->staging.flags = cpu_to_le32(flags);
3230 iwl3945_commit_rxon(priv, ctx); 3230 il3945_commit_rxon(priv, ctx);
3231 } 3231 }
3232 } 3232 }
3233 mutex_unlock(&priv->mutex); 3233 mutex_unlock(&priv->mutex);
@@ -3235,37 +3235,37 @@ static ssize_t iwl3945_store_flags(struct device *d,
3235 return count; 3235 return count;
3236} 3236}
3237 3237
3238static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, iwl3945_show_flags, iwl3945_store_flags); 3238static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, il3945_show_flags, il3945_store_flags);
3239 3239
3240static ssize_t iwl3945_show_filter_flags(struct device *d, 3240static ssize_t il3945_show_filter_flags(struct device *d,
3241 struct device_attribute *attr, char *buf) 3241 struct device_attribute *attr, char *buf)
3242{ 3242{
3243 struct iwl_priv *priv = dev_get_drvdata(d); 3243 struct il_priv *priv = dev_get_drvdata(d);
3244 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3244 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3245 3245
3246 return sprintf(buf, "0x%04X\n", 3246 return sprintf(buf, "0x%04X\n",
3247 le32_to_cpu(ctx->active.filter_flags)); 3247 le32_to_cpu(ctx->active.filter_flags));
3248} 3248}
3249 3249
3250static ssize_t iwl3945_store_filter_flags(struct device *d, 3250static ssize_t il3945_store_filter_flags(struct device *d,
3251 struct device_attribute *attr, 3251 struct device_attribute *attr,
3252 const char *buf, size_t count) 3252 const char *buf, size_t count)
3253{ 3253{
3254 struct iwl_priv *priv = dev_get_drvdata(d); 3254 struct il_priv *priv = dev_get_drvdata(d);
3255 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3255 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3256 u32 filter_flags = simple_strtoul(buf, NULL, 0); 3256 u32 filter_flags = simple_strtoul(buf, NULL, 0);
3257 3257
3258 mutex_lock(&priv->mutex); 3258 mutex_lock(&priv->mutex);
3259 if (le32_to_cpu(ctx->staging.filter_flags) != filter_flags) { 3259 if (le32_to_cpu(ctx->staging.filter_flags) != filter_flags) {
3260 /* Cancel any currently running scans... */ 3260 /* Cancel any currently running scans... */
3261 if (iwl_legacy_scan_cancel_timeout(priv, 100)) 3261 if (il_scan_cancel_timeout(priv, 100))
3262 IWL_WARN(priv, "Could not cancel scan.\n"); 3262 IL_WARN(priv, "Could not cancel scan.\n");
3263 else { 3263 else {
3264 IWL_DEBUG_INFO(priv, "Committing rxon.filter_flags = " 3264 IL_DEBUG_INFO(priv, "Committing rxon.filter_flags = "
3265 "0x%04X\n", filter_flags); 3265 "0x%04X\n", filter_flags);
3266 ctx->staging.filter_flags = 3266 ctx->staging.filter_flags =
3267 cpu_to_le32(filter_flags); 3267 cpu_to_le32(filter_flags);
3268 iwl3945_commit_rxon(priv, ctx); 3268 il3945_commit_rxon(priv, ctx);
3269 } 3269 }
3270 } 3270 }
3271 mutex_unlock(&priv->mutex); 3271 mutex_unlock(&priv->mutex);
@@ -3273,14 +3273,14 @@ static ssize_t iwl3945_store_filter_flags(struct device *d,
3273 return count; 3273 return count;
3274} 3274}
3275 3275
3276static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, iwl3945_show_filter_flags, 3276static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, il3945_show_filter_flags,
3277 iwl3945_store_filter_flags); 3277 il3945_store_filter_flags);
3278 3278
3279static ssize_t iwl3945_show_measurement(struct device *d, 3279static ssize_t il3945_show_measurement(struct device *d,
3280 struct device_attribute *attr, char *buf) 3280 struct device_attribute *attr, char *buf)
3281{ 3281{
3282 struct iwl_priv *priv = dev_get_drvdata(d); 3282 struct il_priv *priv = dev_get_drvdata(d);
3283 struct iwl_spectrum_notification measure_report; 3283 struct il_spectrum_notification measure_report;
3284 u32 size = sizeof(measure_report), len = 0, ofs = 0; 3284 u32 size = sizeof(measure_report), len = 0, ofs = 0;
3285 u8 *data = (u8 *)&measure_report; 3285 u8 *data = (u8 *)&measure_report;
3286 unsigned long flags; 3286 unsigned long flags;
@@ -3308,18 +3308,18 @@ static ssize_t iwl3945_show_measurement(struct device *d,
3308 return len; 3308 return len;
3309} 3309}
3310 3310
3311static ssize_t iwl3945_store_measurement(struct device *d, 3311static ssize_t il3945_store_measurement(struct device *d,
3312 struct device_attribute *attr, 3312 struct device_attribute *attr,
3313 const char *buf, size_t count) 3313 const char *buf, size_t count)
3314{ 3314{
3315 struct iwl_priv *priv = dev_get_drvdata(d); 3315 struct il_priv *priv = dev_get_drvdata(d);
3316 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3316 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3317 struct ieee80211_measurement_params params = { 3317 struct ieee80211_measurement_params params = {
3318 .channel = le16_to_cpu(ctx->active.channel), 3318 .channel = le16_to_cpu(ctx->active.channel),
3319 .start_time = cpu_to_le64(priv->_3945.last_tsf), 3319 .start_time = cpu_to_le64(priv->_3945.last_tsf),
3320 .duration = cpu_to_le16(1), 3320 .duration = cpu_to_le16(1),
3321 }; 3321 };
3322 u8 type = IWL_MEASURE_BASIC; 3322 u8 type = IL_MEASURE_BASIC;
3323 u8 buffer[32]; 3323 u8 buffer[32];
3324 u8 channel; 3324 u8 channel;
3325 3325
@@ -3337,21 +3337,21 @@ static ssize_t iwl3945_store_measurement(struct device *d,
3337 type = simple_strtoul(p + 1, NULL, 0); 3337 type = simple_strtoul(p + 1, NULL, 0);
3338 } 3338 }
3339 3339
3340 IWL_DEBUG_INFO(priv, "Invoking measurement of type %d on " 3340 IL_DEBUG_INFO(priv, "Invoking measurement of type %d on "
3341 "channel %d (for '%s')\n", type, params.channel, buf); 3341 "channel %d (for '%s')\n", type, params.channel, buf);
3342 iwl3945_get_measurement(priv, &params, type); 3342 il3945_get_measurement(priv, &params, type);
3343 3343
3344 return count; 3344 return count;
3345} 3345}
3346 3346
3347static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR, 3347static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR,
3348 iwl3945_show_measurement, iwl3945_store_measurement); 3348 il3945_show_measurement, il3945_store_measurement);
3349 3349
3350static ssize_t iwl3945_store_retry_rate(struct device *d, 3350static ssize_t il3945_store_retry_rate(struct device *d,
3351 struct device_attribute *attr, 3351 struct device_attribute *attr,
3352 const char *buf, size_t count) 3352 const char *buf, size_t count)
3353{ 3353{
3354 struct iwl_priv *priv = dev_get_drvdata(d); 3354 struct il_priv *priv = dev_get_drvdata(d);
3355 3355
3356 priv->retry_rate = simple_strtoul(buf, NULL, 0); 3356 priv->retry_rate = simple_strtoul(buf, NULL, 0);
3357 if (priv->retry_rate <= 0) 3357 if (priv->retry_rate <= 0)
@@ -3360,89 +3360,89 @@ static ssize_t iwl3945_store_retry_rate(struct device *d,
3360 return count; 3360 return count;
3361} 3361}
3362 3362
3363static ssize_t iwl3945_show_retry_rate(struct device *d, 3363static ssize_t il3945_show_retry_rate(struct device *d,
3364 struct device_attribute *attr, char *buf) 3364 struct device_attribute *attr, char *buf)
3365{ 3365{
3366 struct iwl_priv *priv = dev_get_drvdata(d); 3366 struct il_priv *priv = dev_get_drvdata(d);
3367 return sprintf(buf, "%d", priv->retry_rate); 3367 return sprintf(buf, "%d", priv->retry_rate);
3368} 3368}
3369 3369
3370static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, iwl3945_show_retry_rate, 3370static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, il3945_show_retry_rate,
3371 iwl3945_store_retry_rate); 3371 il3945_store_retry_rate);
3372 3372
3373 3373
3374static ssize_t iwl3945_show_channels(struct device *d, 3374static ssize_t il3945_show_channels(struct device *d,
3375 struct device_attribute *attr, char *buf) 3375 struct device_attribute *attr, char *buf)
3376{ 3376{
3377 /* all this shit doesn't belong into sysfs anyway */ 3377 /* all this shit doesn't belong into sysfs anyway */
3378 return 0; 3378 return 0;
3379} 3379}
3380 3380
3381static DEVICE_ATTR(channels, S_IRUSR, iwl3945_show_channels, NULL); 3381static DEVICE_ATTR(channels, S_IRUSR, il3945_show_channels, NULL);
3382 3382
3383static ssize_t iwl3945_show_antenna(struct device *d, 3383static ssize_t il3945_show_antenna(struct device *d,
3384 struct device_attribute *attr, char *buf) 3384 struct device_attribute *attr, char *buf)
3385{ 3385{
3386 struct iwl_priv *priv = dev_get_drvdata(d); 3386 struct il_priv *priv = dev_get_drvdata(d);
3387 3387
3388 if (!iwl_legacy_is_alive(priv)) 3388 if (!il_is_alive(priv))
3389 return -EAGAIN; 3389 return -EAGAIN;
3390 3390
3391 return sprintf(buf, "%d\n", iwl3945_mod_params.antenna); 3391 return sprintf(buf, "%d\n", il3945_mod_params.antenna);
3392} 3392}
3393 3393
3394static ssize_t iwl3945_store_antenna(struct device *d, 3394static ssize_t il3945_store_antenna(struct device *d,
3395 struct device_attribute *attr, 3395 struct device_attribute *attr,
3396 const char *buf, size_t count) 3396 const char *buf, size_t count)
3397{ 3397{
3398 struct iwl_priv *priv __maybe_unused = dev_get_drvdata(d); 3398 struct il_priv *priv __maybe_unused = dev_get_drvdata(d);
3399 int ant; 3399 int ant;
3400 3400
3401 if (count == 0) 3401 if (count == 0)
3402 return 0; 3402 return 0;
3403 3403
3404 if (sscanf(buf, "%1i", &ant) != 1) { 3404 if (sscanf(buf, "%1i", &ant) != 1) {
3405 IWL_DEBUG_INFO(priv, "not in hex or decimal form.\n"); 3405 IL_DEBUG_INFO(priv, "not in hex or decimal form.\n");
3406 return count; 3406 return count;
3407 } 3407 }
3408 3408
3409 if ((ant >= 0) && (ant <= 2)) { 3409 if ((ant >= 0) && (ant <= 2)) {
3410 IWL_DEBUG_INFO(priv, "Setting antenna select to %d.\n", ant); 3410 IL_DEBUG_INFO(priv, "Setting antenna select to %d.\n", ant);
3411 iwl3945_mod_params.antenna = (enum iwl3945_antenna)ant; 3411 il3945_mod_params.antenna = (enum il3945_antenna)ant;
3412 } else 3412 } else
3413 IWL_DEBUG_INFO(priv, "Bad antenna select value %d.\n", ant); 3413 IL_DEBUG_INFO(priv, "Bad antenna select value %d.\n", ant);
3414 3414
3415 3415
3416 return count; 3416 return count;
3417} 3417}
3418 3418
3419static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, iwl3945_show_antenna, iwl3945_store_antenna); 3419static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, il3945_show_antenna, il3945_store_antenna);
3420 3420
3421static ssize_t iwl3945_show_status(struct device *d, 3421static ssize_t il3945_show_status(struct device *d,
3422 struct device_attribute *attr, char *buf) 3422 struct device_attribute *attr, char *buf)
3423{ 3423{
3424 struct iwl_priv *priv = dev_get_drvdata(d); 3424 struct il_priv *priv = dev_get_drvdata(d);
3425 if (!iwl_legacy_is_alive(priv)) 3425 if (!il_is_alive(priv))
3426 return -EAGAIN; 3426 return -EAGAIN;
3427 return sprintf(buf, "0x%08x\n", (int)priv->status); 3427 return sprintf(buf, "0x%08x\n", (int)priv->status);
3428} 3428}
3429 3429
3430static DEVICE_ATTR(status, S_IRUGO, iwl3945_show_status, NULL); 3430static DEVICE_ATTR(status, S_IRUGO, il3945_show_status, NULL);
3431 3431
3432static ssize_t iwl3945_dump_error_log(struct device *d, 3432static ssize_t il3945_dump_error_log(struct device *d,
3433 struct device_attribute *attr, 3433 struct device_attribute *attr,
3434 const char *buf, size_t count) 3434 const char *buf, size_t count)
3435{ 3435{
3436 struct iwl_priv *priv = dev_get_drvdata(d); 3436 struct il_priv *priv = dev_get_drvdata(d);
3437 char *p = (char *)buf; 3437 char *p = (char *)buf;
3438 3438
3439 if (p[0] == '1') 3439 if (p[0] == '1')
3440 iwl3945_dump_nic_error_log(priv); 3440 il3945_dump_nic_error_log(priv);
3441 3441
3442 return strnlen(buf, count); 3442 return strnlen(buf, count);
3443} 3443}
3444 3444
3445static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, iwl3945_dump_error_log); 3445static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, il3945_dump_error_log);
3446 3446
3447/***************************************************************************** 3447/*****************************************************************************
3448 * 3448 *
@@ -3450,41 +3450,41 @@ static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, iwl3945_dump_error_log);
3450 * 3450 *
3451 *****************************************************************************/ 3451 *****************************************************************************/
3452 3452
3453static void iwl3945_setup_deferred_work(struct iwl_priv *priv) 3453static void il3945_setup_deferred_work(struct il_priv *priv)
3454{ 3454{
3455 priv->workqueue = create_singlethread_workqueue(DRV_NAME); 3455 priv->workqueue = create_singlethread_workqueue(DRV_NAME);
3456 3456
3457 init_waitqueue_head(&priv->wait_command_queue); 3457 init_waitqueue_head(&priv->wait_command_queue);
3458 3458
3459 INIT_WORK(&priv->restart, iwl3945_bg_restart); 3459 INIT_WORK(&priv->restart, il3945_bg_restart);
3460 INIT_WORK(&priv->rx_replenish, iwl3945_bg_rx_replenish); 3460 INIT_WORK(&priv->rx_replenish, il3945_bg_rx_replenish);
3461 INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); 3461 INIT_DELAYED_WORK(&priv->init_alive_start, il3945_bg_init_alive_start);
3462 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); 3462 INIT_DELAYED_WORK(&priv->alive_start, il3945_bg_alive_start);
3463 INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); 3463 INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, il3945_rfkill_poll);
3464 3464
3465 iwl_legacy_setup_scan_deferred_work(priv); 3465 il_setup_scan_deferred_work(priv);
3466 3466
3467 iwl3945_hw_setup_deferred_work(priv); 3467 il3945_hw_setup_deferred_work(priv);
3468 3468
3469 init_timer(&priv->watchdog); 3469 init_timer(&priv->watchdog);
3470 priv->watchdog.data = (unsigned long)priv; 3470 priv->watchdog.data = (unsigned long)priv;
3471 priv->watchdog.function = iwl_legacy_bg_watchdog; 3471 priv->watchdog.function = il_bg_watchdog;
3472 3472
3473 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 3473 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
3474 iwl3945_irq_tasklet, (unsigned long)priv); 3474 il3945_irq_tasklet, (unsigned long)priv);
3475} 3475}
3476 3476
3477static void iwl3945_cancel_deferred_work(struct iwl_priv *priv) 3477static void il3945_cancel_deferred_work(struct il_priv *priv)
3478{ 3478{
3479 iwl3945_hw_cancel_deferred_work(priv); 3479 il3945_hw_cancel_deferred_work(priv);
3480 3480
3481 cancel_delayed_work_sync(&priv->init_alive_start); 3481 cancel_delayed_work_sync(&priv->init_alive_start);
3482 cancel_delayed_work(&priv->alive_start); 3482 cancel_delayed_work(&priv->alive_start);
3483 3483
3484 iwl_legacy_cancel_scan_deferred_work(priv); 3484 il_cancel_scan_deferred_work(priv);
3485} 3485}
3486 3486
3487static struct attribute *iwl3945_sysfs_entries[] = { 3487static struct attribute *il3945_sysfs_entries[] = {
3488 &dev_attr_antenna.attr, 3488 &dev_attr_antenna.attr,
3489 &dev_attr_channels.attr, 3489 &dev_attr_channels.attr,
3490 &dev_attr_dump_errors.attr, 3490 &dev_attr_dump_errors.attr,
@@ -3501,34 +3501,34 @@ static struct attribute *iwl3945_sysfs_entries[] = {
3501 NULL 3501 NULL
3502}; 3502};
3503 3503
3504static struct attribute_group iwl3945_attribute_group = { 3504static struct attribute_group il3945_attribute_group = {
3505 .name = NULL, /* put in device directory */ 3505 .name = NULL, /* put in device directory */
3506 .attrs = iwl3945_sysfs_entries, 3506 .attrs = il3945_sysfs_entries,
3507}; 3507};
3508 3508
3509struct ieee80211_ops iwl3945_hw_ops = { 3509struct ieee80211_ops il3945_hw_ops = {
3510 .tx = iwl3945_mac_tx, 3510 .tx = il3945_mac_tx,
3511 .start = iwl3945_mac_start, 3511 .start = il3945_mac_start,
3512 .stop = iwl3945_mac_stop, 3512 .stop = il3945_mac_stop,
3513 .add_interface = iwl_legacy_mac_add_interface, 3513 .add_interface = il_mac_add_interface,
3514 .remove_interface = iwl_legacy_mac_remove_interface, 3514 .remove_interface = il_mac_remove_interface,
3515 .change_interface = iwl_legacy_mac_change_interface, 3515 .change_interface = il_mac_change_interface,
3516 .config = iwl_legacy_mac_config, 3516 .config = il_mac_config,
3517 .configure_filter = iwl3945_configure_filter, 3517 .configure_filter = il3945_configure_filter,
3518 .set_key = iwl3945_mac_set_key, 3518 .set_key = il3945_mac_set_key,
3519 .conf_tx = iwl_legacy_mac_conf_tx, 3519 .conf_tx = il_mac_conf_tx,
3520 .reset_tsf = iwl_legacy_mac_reset_tsf, 3520 .reset_tsf = il_mac_reset_tsf,
3521 .bss_info_changed = iwl_legacy_mac_bss_info_changed, 3521 .bss_info_changed = il_mac_bss_info_changed,
3522 .hw_scan = iwl_legacy_mac_hw_scan, 3522 .hw_scan = il_mac_hw_scan,
3523 .sta_add = iwl3945_mac_sta_add, 3523 .sta_add = il3945_mac_sta_add,
3524 .sta_remove = iwl_legacy_mac_sta_remove, 3524 .sta_remove = il_mac_sta_remove,
3525 .tx_last_beacon = iwl_legacy_mac_tx_last_beacon, 3525 .tx_last_beacon = il_mac_tx_last_beacon,
3526}; 3526};
3527 3527
3528static int iwl3945_init_drv(struct iwl_priv *priv) 3528static int il3945_init_drv(struct il_priv *priv)
3529{ 3529{
3530 int ret; 3530 int ret;
3531 struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; 3531 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom;
3532 3532
3533 priv->retry_rate = 1; 3533 priv->retry_rate = 1;
3534 priv->beacon_skb = NULL; 3534 priv->beacon_skb = NULL;
@@ -3545,61 +3545,61 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
3545 priv->band = IEEE80211_BAND_2GHZ; 3545 priv->band = IEEE80211_BAND_2GHZ;
3546 3546
3547 priv->iw_mode = NL80211_IFTYPE_STATION; 3547 priv->iw_mode = NL80211_IFTYPE_STATION;
3548 priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; 3548 priv->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF;
3549 3549
3550 /* initialize force reset */ 3550 /* initialize force reset */
3551 priv->force_reset.reset_duration = IWL_DELAY_NEXT_FORCE_FW_RELOAD; 3551 priv->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD;
3552 3552
3553 if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { 3553 if (eeprom->version < EEPROM_3945_EEPROM_VERSION) {
3554 IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", 3554 IL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n",
3555 eeprom->version); 3555 eeprom->version);
3556 ret = -EINVAL; 3556 ret = -EINVAL;
3557 goto err; 3557 goto err;
3558 } 3558 }
3559 ret = iwl_legacy_init_channel_map(priv); 3559 ret = il_init_channel_map(priv);
3560 if (ret) { 3560 if (ret) {
3561 IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); 3561 IL_ERR(priv, "initializing regulatory failed: %d\n", ret);
3562 goto err; 3562 goto err;
3563 } 3563 }
3564 3564
3565 /* Set up txpower settings in driver for all channels */ 3565 /* Set up txpower settings in driver for all channels */
3566 if (iwl3945_txpower_set_from_eeprom(priv)) { 3566 if (il3945_txpower_set_from_eeprom(priv)) {
3567 ret = -EIO; 3567 ret = -EIO;
3568 goto err_free_channel_map; 3568 goto err_free_channel_map;
3569 } 3569 }
3570 3570
3571 ret = iwl_legacy_init_geos(priv); 3571 ret = il_init_geos(priv);
3572 if (ret) { 3572 if (ret) {
3573 IWL_ERR(priv, "initializing geos failed: %d\n", ret); 3573 IL_ERR(priv, "initializing geos failed: %d\n", ret);
3574 goto err_free_channel_map; 3574 goto err_free_channel_map;
3575 } 3575 }
3576 iwl3945_init_hw_rates(priv, priv->ieee_rates); 3576 il3945_init_hw_rates(priv, priv->ieee_rates);
3577 3577
3578 return 0; 3578 return 0;
3579 3579
3580err_free_channel_map: 3580err_free_channel_map:
3581 iwl_legacy_free_channel_map(priv); 3581 il_free_channel_map(priv);
3582err: 3582err:
3583 return ret; 3583 return ret;
3584} 3584}
3585 3585
3586#define IWL3945_MAX_PROBE_REQUEST 200 3586#define IWL3945_MAX_PROBE_REQUEST 200
3587 3587
3588static int iwl3945_setup_mac(struct iwl_priv *priv) 3588static int il3945_setup_mac(struct il_priv *priv)
3589{ 3589{
3590 int ret; 3590 int ret;
3591 struct ieee80211_hw *hw = priv->hw; 3591 struct ieee80211_hw *hw = priv->hw;
3592 3592
3593 hw->rate_control_algorithm = "iwl-3945-rs"; 3593 hw->rate_control_algorithm = "iwl-3945-rs";
3594 hw->sta_data_size = sizeof(struct iwl3945_sta_priv); 3594 hw->sta_data_size = sizeof(struct il3945_sta_priv);
3595 hw->vif_data_size = sizeof(struct iwl_vif_priv); 3595 hw->vif_data_size = sizeof(struct il_vif_priv);
3596 3596
3597 /* Tell mac80211 our characteristics */ 3597 /* Tell mac80211 our characteristics */
3598 hw->flags = IEEE80211_HW_SIGNAL_DBM | 3598 hw->flags = IEEE80211_HW_SIGNAL_DBM |
3599 IEEE80211_HW_SPECTRUM_MGMT; 3599 IEEE80211_HW_SPECTRUM_MGMT;
3600 3600
3601 hw->wiphy->interface_modes = 3601 hw->wiphy->interface_modes =
3602 priv->contexts[IWL_RXON_CTX_BSS].interface_modes; 3602 priv->contexts[IL_RXON_CTX_BSS].interface_modes;
3603 3603
3604 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | 3604 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
3605 WIPHY_FLAG_DISABLE_BEACON_HINTS | 3605 WIPHY_FLAG_DISABLE_BEACON_HINTS |
@@ -3620,11 +3620,11 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
3620 priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = 3620 priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
3621 &priv->bands[IEEE80211_BAND_5GHZ]; 3621 &priv->bands[IEEE80211_BAND_5GHZ];
3622 3622
3623 iwl_legacy_leds_init(priv); 3623 il_leds_init(priv);
3624 3624
3625 ret = ieee80211_register_hw(priv->hw); 3625 ret = ieee80211_register_hw(priv->hw);
3626 if (ret) { 3626 if (ret) {
3627 IWL_ERR(priv, "Failed to register hw (error %d)\n", ret); 3627 IL_ERR(priv, "Failed to register hw (error %d)\n", ret);
3628 return ret; 3628 return ret;
3629 } 3629 }
3630 priv->mac80211_registered = 1; 3630 priv->mac80211_registered = 1;
@@ -3632,13 +3632,13 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
3632 return 0; 3632 return 0;
3633} 3633}
3634 3634
3635static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 3635static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3636{ 3636{
3637 int err = 0, i; 3637 int err = 0, i;
3638 struct iwl_priv *priv; 3638 struct il_priv *priv;
3639 struct ieee80211_hw *hw; 3639 struct ieee80211_hw *hw;
3640 struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); 3640 struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data);
3641 struct iwl3945_eeprom *eeprom; 3641 struct il3945_eeprom *eeprom;
3642 unsigned long flags; 3642 unsigned long flags;
3643 3643
3644 /*********************** 3644 /***********************
@@ -3647,7 +3647,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3647 3647
3648 /* mac80211 allocates memory for this device instance, including 3648 /* mac80211 allocates memory for this device instance, including
3649 * space for this driver's private structure */ 3649 * space for this driver's private structure */
3650 hw = iwl_legacy_alloc_all(cfg); 3650 hw = il_alloc_all(cfg);
3651 if (hw == NULL) { 3651 if (hw == NULL) {
3652 pr_err("Can not allocate network device\n"); 3652 pr_err("Can not allocate network device\n");
3653 err = -ENOMEM; 3653 err = -ENOMEM;
@@ -3659,40 +3659,40 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3659 priv->cmd_queue = IWL39_CMD_QUEUE_NUM; 3659 priv->cmd_queue = IWL39_CMD_QUEUE_NUM;
3660 3660
3661 /* 3945 has only one valid context */ 3661 /* 3945 has only one valid context */
3662 priv->valid_contexts = BIT(IWL_RXON_CTX_BSS); 3662 priv->valid_contexts = BIT(IL_RXON_CTX_BSS);
3663 3663
3664 for (i = 0; i < NUM_IWL_RXON_CTX; i++) 3664 for (i = 0; i < NUM_IL_RXON_CTX; i++)
3665 priv->contexts[i].ctxid = i; 3665 priv->contexts[i].ctxid = i;
3666 3666
3667 priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; 3667 priv->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON;
3668 priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; 3668 priv->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING;
3669 priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; 3669 priv->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC;
3670 priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; 3670 priv->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM;
3671 priv->contexts[IWL_RXON_CTX_BSS].ap_sta_id = IWL_AP_ID; 3671 priv->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID;
3672 priv->contexts[IWL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; 3672 priv->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY;
3673 priv->contexts[IWL_RXON_CTX_BSS].interface_modes = 3673 priv->contexts[IL_RXON_CTX_BSS].interface_modes =
3674 BIT(NL80211_IFTYPE_STATION) | 3674 BIT(NL80211_IFTYPE_STATION) |
3675 BIT(NL80211_IFTYPE_ADHOC); 3675 BIT(NL80211_IFTYPE_ADHOC);
3676 priv->contexts[IWL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; 3676 priv->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS;
3677 priv->contexts[IWL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; 3677 priv->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS;
3678 priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; 3678 priv->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS;
3679 3679
3680 /* 3680 /*
3681 * Disabling hardware scan means that mac80211 will perform scans 3681 * Disabling hardware scan means that mac80211 will perform scans
3682 * "the hard way", rather than using device's scan. 3682 * "the hard way", rather than using device's scan.
3683 */ 3683 */
3684 if (iwl3945_mod_params.disable_hw_scan) { 3684 if (il3945_mod_params.disable_hw_scan) {
3685 IWL_DEBUG_INFO(priv, "Disabling hw_scan\n"); 3685 IL_DEBUG_INFO(priv, "Disabling hw_scan\n");
3686 iwl3945_hw_ops.hw_scan = NULL; 3686 il3945_hw_ops.hw_scan = NULL;
3687 } 3687 }
3688 3688
3689 IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); 3689 IL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n");
3690 priv->cfg = cfg; 3690 priv->cfg = cfg;
3691 priv->pci_dev = pdev; 3691 priv->pci_dev = pdev;
3692 priv->inta_mask = CSR_INI_SET_MASK; 3692 priv->inta_mask = CSR_INI_SET_MASK;
3693 3693
3694 if (iwl_legacy_alloc_traffic_mem(priv)) 3694 if (il_alloc_traffic_mem(priv))
3695 IWL_ERR(priv, "Not enough memory to generate traffic log\n"); 3695 IL_ERR(priv, "Not enough memory to generate traffic log\n");
3696 3696
3697 /*************************** 3697 /***************************
3698 * 2. Initializing PCI bus 3698 * 2. Initializing PCI bus
@@ -3711,7 +3711,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3711 if (!err) 3711 if (!err)
3712 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 3712 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
3713 if (err) { 3713 if (err) {
3714 IWL_WARN(priv, "No suitable DMA available.\n"); 3714 IL_WARN(priv, "No suitable DMA available.\n");
3715 goto out_pci_disable_device; 3715 goto out_pci_disable_device;
3716 } 3716 }
3717 3717
@@ -3729,9 +3729,9 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3729 goto out_pci_release_regions; 3729 goto out_pci_release_regions;
3730 } 3730 }
3731 3731
3732 IWL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", 3732 IL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n",
3733 (unsigned long long) pci_resource_len(pdev, 0)); 3733 (unsigned long long) pci_resource_len(pdev, 0));
3734 IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); 3734 IL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base);
3735 3735
3736 /* We disable the RETRY_TIMEOUT register (0x41) to keep 3736 /* We disable the RETRY_TIMEOUT register (0x41) to keep
3737 * PCI Tx retries from interfering with C3 CPU state */ 3737 * PCI Tx retries from interfering with C3 CPU state */
@@ -3748,29 +3748,29 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3748 * strange state ... like being left stranded by a primary kernel 3748 * strange state ... like being left stranded by a primary kernel
3749 * and this is now the kdump kernel trying to start up 3749 * and this is now the kdump kernel trying to start up
3750 */ 3750 */
3751 iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 3751 il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
3752 3752
3753 /*********************** 3753 /***********************
3754 * 4. Read EEPROM 3754 * 4. Read EEPROM
3755 * ********************/ 3755 * ********************/
3756 3756
3757 /* Read the EEPROM */ 3757 /* Read the EEPROM */
3758 err = iwl_legacy_eeprom_init(priv); 3758 err = il_eeprom_init(priv);
3759 if (err) { 3759 if (err) {
3760 IWL_ERR(priv, "Unable to init EEPROM\n"); 3760 IL_ERR(priv, "Unable to init EEPROM\n");
3761 goto out_iounmap; 3761 goto out_iounmap;
3762 } 3762 }
3763 /* MAC Address location in EEPROM same for 3945/4965 */ 3763 /* MAC Address location in EEPROM same for 3945/4965 */
3764 eeprom = (struct iwl3945_eeprom *)priv->eeprom; 3764 eeprom = (struct il3945_eeprom *)priv->eeprom;
3765 IWL_DEBUG_INFO(priv, "MAC address: %pM\n", eeprom->mac_address); 3765 IL_DEBUG_INFO(priv, "MAC address: %pM\n", eeprom->mac_address);
3766 SET_IEEE80211_PERM_ADDR(priv->hw, eeprom->mac_address); 3766 SET_IEEE80211_PERM_ADDR(priv->hw, eeprom->mac_address);
3767 3767
3768 /*********************** 3768 /***********************
3769 * 5. Setup HW Constants 3769 * 5. Setup HW Constants
3770 * ********************/ 3770 * ********************/
3771 /* Device-specific setup */ 3771 /* Device-specific setup */
3772 if (iwl3945_hw_set_hw_params(priv)) { 3772 if (il3945_hw_set_hw_params(priv)) {
3773 IWL_ERR(priv, "failed to set hw settings\n"); 3773 IL_ERR(priv, "failed to set hw settings\n");
3774 goto out_eeprom_free; 3774 goto out_eeprom_free;
3775 } 3775 }
3776 3776
@@ -3778,13 +3778,13 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3778 * 6. Setup priv 3778 * 6. Setup priv
3779 * ********************/ 3779 * ********************/
3780 3780
3781 err = iwl3945_init_drv(priv); 3781 err = il3945_init_drv(priv);
3782 if (err) { 3782 if (err) {
3783 IWL_ERR(priv, "initializing driver failed\n"); 3783 IL_ERR(priv, "initializing driver failed\n");
3784 goto out_unset_hw_params; 3784 goto out_unset_hw_params;
3785 } 3785 }
3786 3786
3787 IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n", 3787 IL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n",
3788 priv->cfg->name); 3788 priv->cfg->name);
3789 3789
3790 /*********************** 3790 /***********************
@@ -3792,44 +3792,44 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3792 * ********************/ 3792 * ********************/
3793 3793
3794 spin_lock_irqsave(&priv->lock, flags); 3794 spin_lock_irqsave(&priv->lock, flags);
3795 iwl_legacy_disable_interrupts(priv); 3795 il_disable_interrupts(priv);
3796 spin_unlock_irqrestore(&priv->lock, flags); 3796 spin_unlock_irqrestore(&priv->lock, flags);
3797 3797
3798 pci_enable_msi(priv->pci_dev); 3798 pci_enable_msi(priv->pci_dev);
3799 3799
3800 err = request_irq(priv->pci_dev->irq, iwl_legacy_isr, 3800 err = request_irq(priv->pci_dev->irq, il_isr,
3801 IRQF_SHARED, DRV_NAME, priv); 3801 IRQF_SHARED, DRV_NAME, priv);
3802 if (err) { 3802 if (err) {
3803 IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); 3803 IL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);
3804 goto out_disable_msi; 3804 goto out_disable_msi;
3805 } 3805 }
3806 3806
3807 err = sysfs_create_group(&pdev->dev.kobj, &iwl3945_attribute_group); 3807 err = sysfs_create_group(&pdev->dev.kobj, &il3945_attribute_group);
3808 if (err) { 3808 if (err) {
3809 IWL_ERR(priv, "failed to create sysfs device attributes\n"); 3809 IL_ERR(priv, "failed to create sysfs device attributes\n");
3810 goto out_release_irq; 3810 goto out_release_irq;
3811 } 3811 }
3812 3812
3813 iwl_legacy_set_rxon_channel(priv, 3813 il_set_rxon_channel(priv,
3814 &priv->bands[IEEE80211_BAND_2GHZ].channels[5], 3814 &priv->bands[IEEE80211_BAND_2GHZ].channels[5],
3815 &priv->contexts[IWL_RXON_CTX_BSS]); 3815 &priv->contexts[IL_RXON_CTX_BSS]);
3816 iwl3945_setup_deferred_work(priv); 3816 il3945_setup_deferred_work(priv);
3817 iwl3945_setup_rx_handlers(priv); 3817 il3945_setup_rx_handlers(priv);
3818 iwl_legacy_power_initialize(priv); 3818 il_power_initialize(priv);
3819 3819
3820 /********************************* 3820 /*********************************
3821 * 8. Setup and Register mac80211 3821 * 8. Setup and Register mac80211
3822 * *******************************/ 3822 * *******************************/
3823 3823
3824 iwl_legacy_enable_interrupts(priv); 3824 il_enable_interrupts(priv);
3825 3825
3826 err = iwl3945_setup_mac(priv); 3826 err = il3945_setup_mac(priv);
3827 if (err) 3827 if (err)
3828 goto out_remove_sysfs; 3828 goto out_remove_sysfs;
3829 3829
3830 err = iwl_legacy_dbgfs_register(priv, DRV_NAME); 3830 err = il_dbgfs_register(priv, DRV_NAME);
3831 if (err) 3831 if (err)
3832 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); 3832 IL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);
3833 3833
3834 /* Start monitoring the killswitch */ 3834 /* Start monitoring the killswitch */
3835 queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, 3835 queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll,
@@ -3840,17 +3840,17 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3840 out_remove_sysfs: 3840 out_remove_sysfs:
3841 destroy_workqueue(priv->workqueue); 3841 destroy_workqueue(priv->workqueue);
3842 priv->workqueue = NULL; 3842 priv->workqueue = NULL;
3843 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); 3843 sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group);
3844 out_release_irq: 3844 out_release_irq:
3845 free_irq(priv->pci_dev->irq, priv); 3845 free_irq(priv->pci_dev->irq, priv);
3846 out_disable_msi: 3846 out_disable_msi:
3847 pci_disable_msi(priv->pci_dev); 3847 pci_disable_msi(priv->pci_dev);
3848 iwl_legacy_free_geos(priv); 3848 il_free_geos(priv);
3849 iwl_legacy_free_channel_map(priv); 3849 il_free_channel_map(priv);
3850 out_unset_hw_params: 3850 out_unset_hw_params:
3851 iwl3945_unset_hw_params(priv); 3851 il3945_unset_hw_params(priv);
3852 out_eeprom_free: 3852 out_eeprom_free:
3853 iwl_legacy_eeprom_free(priv); 3853 il_eeprom_free(priv);
3854 out_iounmap: 3854 out_iounmap:
3855 pci_iounmap(pdev, priv->hw_base); 3855 pci_iounmap(pdev, priv->hw_base);
3856 out_pci_release_regions: 3856 out_pci_release_regions:
@@ -3859,74 +3859,74 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3859 pci_set_drvdata(pdev, NULL); 3859 pci_set_drvdata(pdev, NULL);
3860 pci_disable_device(pdev); 3860 pci_disable_device(pdev);
3861 out_ieee80211_free_hw: 3861 out_ieee80211_free_hw:
3862 iwl_legacy_free_traffic_mem(priv); 3862 il_free_traffic_mem(priv);
3863 ieee80211_free_hw(priv->hw); 3863 ieee80211_free_hw(priv->hw);
3864 out: 3864 out:
3865 return err; 3865 return err;
3866} 3866}
3867 3867
3868static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) 3868static void __devexit il3945_pci_remove(struct pci_dev *pdev)
3869{ 3869{
3870 struct iwl_priv *priv = pci_get_drvdata(pdev); 3870 struct il_priv *priv = pci_get_drvdata(pdev);
3871 unsigned long flags; 3871 unsigned long flags;
3872 3872
3873 if (!priv) 3873 if (!priv)
3874 return; 3874 return;
3875 3875
3876 IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); 3876 IL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n");
3877 3877
3878 iwl_legacy_dbgfs_unregister(priv); 3878 il_dbgfs_unregister(priv);
3879 3879
3880 set_bit(STATUS_EXIT_PENDING, &priv->status); 3880 set_bit(STATUS_EXIT_PENDING, &priv->status);
3881 3881
3882 iwl_legacy_leds_exit(priv); 3882 il_leds_exit(priv);
3883 3883
3884 if (priv->mac80211_registered) { 3884 if (priv->mac80211_registered) {
3885 ieee80211_unregister_hw(priv->hw); 3885 ieee80211_unregister_hw(priv->hw);
3886 priv->mac80211_registered = 0; 3886 priv->mac80211_registered = 0;
3887 } else { 3887 } else {
3888 iwl3945_down(priv); 3888 il3945_down(priv);
3889 } 3889 }
3890 3890
3891 /* 3891 /*
3892 * Make sure device is reset to low power before unloading driver. 3892 * Make sure device is reset to low power before unloading driver.
3893 * This may be redundant with iwl_down(), but there are paths to 3893 * This may be redundant with il_down(), but there are paths to
3894 * run iwl_down() without calling apm_ops.stop(), and there are 3894 * run il_down() without calling apm_ops.stop(), and there are
3895 * paths to avoid running iwl_down() at all before leaving driver. 3895 * paths to avoid running il_down() at all before leaving driver.
3896 * This (inexpensive) call *makes sure* device is reset. 3896 * This (inexpensive) call *makes sure* device is reset.
3897 */ 3897 */
3898 iwl_legacy_apm_stop(priv); 3898 il_apm_stop(priv);
3899 3899
3900 /* make sure we flush any pending irq or 3900 /* make sure we flush any pending irq or
3901 * tasklet for the driver 3901 * tasklet for the driver
3902 */ 3902 */
3903 spin_lock_irqsave(&priv->lock, flags); 3903 spin_lock_irqsave(&priv->lock, flags);
3904 iwl_legacy_disable_interrupts(priv); 3904 il_disable_interrupts(priv);
3905 spin_unlock_irqrestore(&priv->lock, flags); 3905 spin_unlock_irqrestore(&priv->lock, flags);
3906 3906
3907 iwl3945_synchronize_irq(priv); 3907 il3945_synchronize_irq(priv);
3908 3908
3909 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); 3909 sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group);
3910 3910
3911 cancel_delayed_work_sync(&priv->_3945.rfkill_poll); 3911 cancel_delayed_work_sync(&priv->_3945.rfkill_poll);
3912 3912
3913 iwl3945_dealloc_ucode_pci(priv); 3913 il3945_dealloc_ucode_pci(priv);
3914 3914
3915 if (priv->rxq.bd) 3915 if (priv->rxq.bd)
3916 iwl3945_rx_queue_free(priv, &priv->rxq); 3916 il3945_rx_queue_free(priv, &priv->rxq);
3917 iwl3945_hw_txq_ctx_free(priv); 3917 il3945_hw_txq_ctx_free(priv);
3918 3918
3919 iwl3945_unset_hw_params(priv); 3919 il3945_unset_hw_params(priv);
3920 3920
3921 /*netif_stop_queue(dev); */ 3921 /*netif_stop_queue(dev); */
3922 flush_workqueue(priv->workqueue); 3922 flush_workqueue(priv->workqueue);
3923 3923
3924 /* ieee80211_unregister_hw calls iwl3945_mac_stop, which flushes 3924 /* ieee80211_unregister_hw calls il3945_mac_stop, which flushes
3925 * priv->workqueue... so we can't take down the workqueue 3925 * priv->workqueue... so we can't take down the workqueue
3926 * until now... */ 3926 * until now... */
3927 destroy_workqueue(priv->workqueue); 3927 destroy_workqueue(priv->workqueue);
3928 priv->workqueue = NULL; 3928 priv->workqueue = NULL;
3929 iwl_legacy_free_traffic_mem(priv); 3929 il_free_traffic_mem(priv);
3930 3930
3931 free_irq(pdev->irq, priv); 3931 free_irq(pdev->irq, priv);
3932 pci_disable_msi(pdev); 3932 pci_disable_msi(pdev);
@@ -3936,8 +3936,8 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
3936 pci_disable_device(pdev); 3936 pci_disable_device(pdev);
3937 pci_set_drvdata(pdev, NULL); 3937 pci_set_drvdata(pdev, NULL);
3938 3938
3939 iwl_legacy_free_channel_map(priv); 3939 il_free_channel_map(priv);
3940 iwl_legacy_free_geos(priv); 3940 il_free_geos(priv);
3941 kfree(priv->scan_cmd); 3941 kfree(priv->scan_cmd);
3942 if (priv->beacon_skb) 3942 if (priv->beacon_skb)
3943 dev_kfree_skb(priv->beacon_skb); 3943 dev_kfree_skb(priv->beacon_skb);
@@ -3952,28 +3952,28 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
3952 * 3952 *
3953 *****************************************************************************/ 3953 *****************************************************************************/
3954 3954
3955static struct pci_driver iwl3945_driver = { 3955static struct pci_driver il3945_driver = {
3956 .name = DRV_NAME, 3956 .name = DRV_NAME,
3957 .id_table = iwl3945_hw_card_ids, 3957 .id_table = il3945_hw_card_ids,
3958 .probe = iwl3945_pci_probe, 3958 .probe = il3945_pci_probe,
3959 .remove = __devexit_p(iwl3945_pci_remove), 3959 .remove = __devexit_p(il3945_pci_remove),
3960 .driver.pm = IWL_LEGACY_PM_OPS, 3960 .driver.pm = IL_LEGACY_PM_OPS,
3961}; 3961};
3962 3962
3963static int __init iwl3945_init(void) 3963static int __init il3945_init(void)
3964{ 3964{
3965 3965
3966 int ret; 3966 int ret;
3967 pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); 3967 pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n");
3968 pr_info(DRV_COPYRIGHT "\n"); 3968 pr_info(DRV_COPYRIGHT "\n");
3969 3969
3970 ret = iwl3945_rate_control_register(); 3970 ret = il3945_rate_control_register();
3971 if (ret) { 3971 if (ret) {
3972 pr_err("Unable to register rate control algorithm: %d\n", ret); 3972 pr_err("Unable to register rate control algorithm: %d\n", ret);
3973 return ret; 3973 return ret;
3974 } 3974 }
3975 3975
3976 ret = pci_register_driver(&iwl3945_driver); 3976 ret = pci_register_driver(&il3945_driver);
3977 if (ret) { 3977 if (ret) {
3978 pr_err("Unable to initialize PCI module\n"); 3978 pr_err("Unable to initialize PCI module\n");
3979 goto error_register; 3979 goto error_register;
@@ -3982,32 +3982,32 @@ static int __init iwl3945_init(void)
3982 return ret; 3982 return ret;
3983 3983
3984error_register: 3984error_register:
3985 iwl3945_rate_control_unregister(); 3985 il3945_rate_control_unregister();
3986 return ret; 3986 return ret;
3987} 3987}
3988 3988
3989static void __exit iwl3945_exit(void) 3989static void __exit il3945_exit(void)
3990{ 3990{
3991 pci_unregister_driver(&iwl3945_driver); 3991 pci_unregister_driver(&il3945_driver);
3992 iwl3945_rate_control_unregister(); 3992 il3945_rate_control_unregister();
3993} 3993}
3994 3994
3995MODULE_FIRMWARE(IWL3945_MODULE_FIRMWARE(IWL3945_UCODE_API_MAX)); 3995MODULE_FIRMWARE(IWL3945_MODULE_FIRMWARE(IWL3945_UCODE_API_MAX));
3996 3996
3997module_param_named(antenna, iwl3945_mod_params.antenna, int, S_IRUGO); 3997module_param_named(antenna, il3945_mod_params.antenna, int, S_IRUGO);
3998MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); 3998MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");
3999module_param_named(swcrypto, iwl3945_mod_params.sw_crypto, int, S_IRUGO); 3999module_param_named(swcrypto, il3945_mod_params.sw_crypto, int, S_IRUGO);
4000MODULE_PARM_DESC(swcrypto, 4000MODULE_PARM_DESC(swcrypto,
4001 "using software crypto (default 1 [software])"); 4001 "using software crypto (default 1 [software])");
4002module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan, 4002module_param_named(disable_hw_scan, il3945_mod_params.disable_hw_scan,
4003 int, S_IRUGO); 4003 int, S_IRUGO);
4004MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 1)"); 4004MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 1)");
4005#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 4005#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
4006module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR); 4006module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR);
4007MODULE_PARM_DESC(debug, "debug output mask"); 4007MODULE_PARM_DESC(debug, "debug output mask");
4008#endif 4008#endif
4009module_param_named(fw_restart, iwl3945_mod_params.restart_fw, int, S_IRUGO); 4009module_param_named(fw_restart, il3945_mod_params.restart_fw, int, S_IRUGO);
4010MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); 4010MODULE_PARM_DESC(fw_restart, "restart firmware in case of error");
4011 4011
4012module_exit(iwl3945_exit); 4012module_exit(il3945_exit);
4013module_init(iwl3945_init); 4013module_init(il3945_init);
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index fd2f7a40dd9a..bd37c9226e65 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -87,48 +87,48 @@ MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
87MODULE_LICENSE("GPL"); 87MODULE_LICENSE("GPL");
88MODULE_ALIAS("iwl4965"); 88MODULE_ALIAS("iwl4965");
89 89
90void iwl4965_update_chain_flags(struct iwl_priv *priv) 90void il4965_update_chain_flags(struct il_priv *priv)
91{ 91{
92 struct iwl_rxon_context *ctx; 92 struct il_rxon_context *ctx;
93 93
94 if (priv->cfg->ops->hcmd->set_rxon_chain) { 94 if (priv->cfg->ops->hcmd->set_rxon_chain) {
95 for_each_context(priv, ctx) { 95 for_each_context(priv, ctx) {
96 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); 96 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
97 if (ctx->active.rx_chain != ctx->staging.rx_chain) 97 if (ctx->active.rx_chain != ctx->staging.rx_chain)
98 iwl_legacy_commit_rxon(priv, ctx); 98 il_commit_rxon(priv, ctx);
99 } 99 }
100 } 100 }
101} 101}
102 102
103static void iwl4965_clear_free_frames(struct iwl_priv *priv) 103static void il4965_clear_free_frames(struct il_priv *priv)
104{ 104{
105 struct list_head *element; 105 struct list_head *element;
106 106
107 IWL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", 107 IL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n",
108 priv->frames_count); 108 priv->frames_count);
109 109
110 while (!list_empty(&priv->free_frames)) { 110 while (!list_empty(&priv->free_frames)) {
111 element = priv->free_frames.next; 111 element = priv->free_frames.next;
112 list_del(element); 112 list_del(element);
113 kfree(list_entry(element, struct iwl_frame, list)); 113 kfree(list_entry(element, struct il_frame, list));
114 priv->frames_count--; 114 priv->frames_count--;
115 } 115 }
116 116
117 if (priv->frames_count) { 117 if (priv->frames_count) {
118 IWL_WARN(priv, "%d frames still in use. Did we lose one?\n", 118 IL_WARN(priv, "%d frames still in use. Did we lose one?\n",
119 priv->frames_count); 119 priv->frames_count);
120 priv->frames_count = 0; 120 priv->frames_count = 0;
121 } 121 }
122} 122}
123 123
124static struct iwl_frame *iwl4965_get_free_frame(struct iwl_priv *priv) 124static struct il_frame *il4965_get_free_frame(struct il_priv *priv)
125{ 125{
126 struct iwl_frame *frame; 126 struct il_frame *frame;
127 struct list_head *element; 127 struct list_head *element;
128 if (list_empty(&priv->free_frames)) { 128 if (list_empty(&priv->free_frames)) {
129 frame = kzalloc(sizeof(*frame), GFP_KERNEL); 129 frame = kzalloc(sizeof(*frame), GFP_KERNEL);
130 if (!frame) { 130 if (!frame) {
131 IWL_ERR(priv, "Could not allocate frame!\n"); 131 IL_ERR(priv, "Could not allocate frame!\n");
132 return NULL; 132 return NULL;
133 } 133 }
134 134
@@ -138,16 +138,16 @@ static struct iwl_frame *iwl4965_get_free_frame(struct iwl_priv *priv)
138 138
139 element = priv->free_frames.next; 139 element = priv->free_frames.next;
140 list_del(element); 140 list_del(element);
141 return list_entry(element, struct iwl_frame, list); 141 return list_entry(element, struct il_frame, list);
142} 142}
143 143
144static void iwl4965_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) 144static void il4965_free_frame(struct il_priv *priv, struct il_frame *frame)
145{ 145{
146 memset(frame, 0, sizeof(*frame)); 146 memset(frame, 0, sizeof(*frame));
147 list_add(&frame->list, &priv->free_frames); 147 list_add(&frame->list, &priv->free_frames);
148} 148}
149 149
150static u32 iwl4965_fill_beacon_frame(struct iwl_priv *priv, 150static u32 il4965_fill_beacon_frame(struct il_priv *priv,
151 struct ieee80211_hdr *hdr, 151 struct ieee80211_hdr *hdr,
152 int left) 152 int left)
153{ 153{
@@ -165,8 +165,8 @@ static u32 iwl4965_fill_beacon_frame(struct iwl_priv *priv,
165} 165}
166 166
167/* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */ 167/* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */
168static void iwl4965_set_beacon_tim(struct iwl_priv *priv, 168static void il4965_set_beacon_tim(struct il_priv *priv,
169 struct iwl_tx_beacon_cmd *tx_beacon_cmd, 169 struct il_tx_beacon_cmd *tx_beacon_cmd,
170 u8 *beacon, u32 frame_size) 170 u8 *beacon, u32 frame_size)
171{ 171{
172 u16 tim_idx; 172 u16 tim_idx;
@@ -188,13 +188,13 @@ static void iwl4965_set_beacon_tim(struct iwl_priv *priv,
188 tx_beacon_cmd->tim_idx = cpu_to_le16(tim_idx); 188 tx_beacon_cmd->tim_idx = cpu_to_le16(tim_idx);
189 tx_beacon_cmd->tim_size = beacon[tim_idx+1]; 189 tx_beacon_cmd->tim_size = beacon[tim_idx+1];
190 } else 190 } else
191 IWL_WARN(priv, "Unable to find TIM Element in beacon\n"); 191 IL_WARN(priv, "Unable to find TIM Element in beacon\n");
192} 192}
193 193
194static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, 194static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *priv,
195 struct iwl_frame *frame) 195 struct il_frame *frame)
196{ 196{
197 struct iwl_tx_beacon_cmd *tx_beacon_cmd; 197 struct il_tx_beacon_cmd *tx_beacon_cmd;
198 u32 frame_size; 198 u32 frame_size;
199 u32 rate_flags; 199 u32 rate_flags;
200 u32 rate; 200 u32 rate;
@@ -206,7 +206,7 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
206 lockdep_assert_held(&priv->mutex); 206 lockdep_assert_held(&priv->mutex);
207 207
208 if (!priv->beacon_ctx) { 208 if (!priv->beacon_ctx) {
209 IWL_ERR(priv, "trying to build beacon w/o beacon context!\n"); 209 IL_ERR(priv, "trying to build beacon w/o beacon context!\n");
210 return 0; 210 return 0;
211 } 211 }
212 212
@@ -215,7 +215,7 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
215 memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); 215 memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
216 216
217 /* Set up TX beacon contents */ 217 /* Set up TX beacon contents */
218 frame_size = iwl4965_fill_beacon_frame(priv, tx_beacon_cmd->frame, 218 frame_size = il4965_fill_beacon_frame(priv, tx_beacon_cmd->frame,
219 sizeof(frame->u) - sizeof(*tx_beacon_cmd)); 219 sizeof(frame->u) - sizeof(*tx_beacon_cmd));
220 if (WARN_ON_ONCE(frame_size > MAX_MPDU_SIZE)) 220 if (WARN_ON_ONCE(frame_size > MAX_MPDU_SIZE))
221 return 0; 221 return 0;
@@ -230,53 +230,53 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
230 TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK; 230 TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK;
231 231
232 /* Set up TX beacon command fields */ 232 /* Set up TX beacon command fields */
233 iwl4965_set_beacon_tim(priv, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame, 233 il4965_set_beacon_tim(priv, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame,
234 frame_size); 234 frame_size);
235 235
236 /* Set up packet rate and flags */ 236 /* Set up packet rate and flags */
237 rate = iwl_legacy_get_lowest_plcp(priv, priv->beacon_ctx); 237 rate = il_get_lowest_plcp(priv, priv->beacon_ctx);
238 priv->mgmt_tx_ant = iwl4965_toggle_tx_ant(priv, priv->mgmt_tx_ant, 238 priv->mgmt_tx_ant = il4965_toggle_tx_ant(priv, priv->mgmt_tx_ant,
239 priv->hw_params.valid_tx_ant); 239 priv->hw_params.valid_tx_ant);
240 rate_flags = iwl4965_ant_idx_to_flags(priv->mgmt_tx_ant); 240 rate_flags = il4965_ant_idx_to_flags(priv->mgmt_tx_ant);
241 if ((rate >= IWL_FIRST_CCK_RATE) && (rate <= IWL_LAST_CCK_RATE)) 241 if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE))
242 rate_flags |= RATE_MCS_CCK_MSK; 242 rate_flags |= RATE_MCS_CCK_MSK;
243 tx_beacon_cmd->tx.rate_n_flags = iwl4965_hw_set_rate_n_flags(rate, 243 tx_beacon_cmd->tx.rate_n_flags = il4965_hw_set_rate_n_flags(rate,
244 rate_flags); 244 rate_flags);
245 245
246 return sizeof(*tx_beacon_cmd) + frame_size; 246 return sizeof(*tx_beacon_cmd) + frame_size;
247} 247}
248 248
249int iwl4965_send_beacon_cmd(struct iwl_priv *priv) 249int il4965_send_beacon_cmd(struct il_priv *priv)
250{ 250{
251 struct iwl_frame *frame; 251 struct il_frame *frame;
252 unsigned int frame_size; 252 unsigned int frame_size;
253 int rc; 253 int rc;
254 254
255 frame = iwl4965_get_free_frame(priv); 255 frame = il4965_get_free_frame(priv);
256 if (!frame) { 256 if (!frame) {
257 IWL_ERR(priv, "Could not obtain free frame buffer for beacon " 257 IL_ERR(priv, "Could not obtain free frame buffer for beacon "
258 "command.\n"); 258 "command.\n");
259 return -ENOMEM; 259 return -ENOMEM;
260 } 260 }
261 261
262 frame_size = iwl4965_hw_get_beacon_cmd(priv, frame); 262 frame_size = il4965_hw_get_beacon_cmd(priv, frame);
263 if (!frame_size) { 263 if (!frame_size) {
264 IWL_ERR(priv, "Error configuring the beacon command\n"); 264 IL_ERR(priv, "Error configuring the beacon command\n");
265 iwl4965_free_frame(priv, frame); 265 il4965_free_frame(priv, frame);
266 return -EINVAL; 266 return -EINVAL;
267 } 267 }
268 268
269 rc = iwl_legacy_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, 269 rc = il_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size,
270 &frame->u.cmd[0]); 270 &frame->u.cmd[0]);
271 271
272 iwl4965_free_frame(priv, frame); 272 il4965_free_frame(priv, frame);
273 273
274 return rc; 274 return rc;
275} 275}
276 276
277static inline dma_addr_t iwl4965_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx) 277static inline dma_addr_t il4965_tfd_tb_get_addr(struct il_tfd *tfd, u8 idx)
278{ 278{
279 struct iwl_tfd_tb *tb = &tfd->tbs[idx]; 279 struct il_tfd_tb *tb = &tfd->tbs[idx];
280 280
281 dma_addr_t addr = get_unaligned_le32(&tb->lo); 281 dma_addr_t addr = get_unaligned_le32(&tb->lo);
282 if (sizeof(dma_addr_t) > sizeof(u32)) 282 if (sizeof(dma_addr_t) > sizeof(u32))
@@ -286,17 +286,17 @@ static inline dma_addr_t iwl4965_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx)
286 return addr; 286 return addr;
287} 287}
288 288
289static inline u16 iwl4965_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) 289static inline u16 il4965_tfd_tb_get_len(struct il_tfd *tfd, u8 idx)
290{ 290{
291 struct iwl_tfd_tb *tb = &tfd->tbs[idx]; 291 struct il_tfd_tb *tb = &tfd->tbs[idx];
292 292
293 return le16_to_cpu(tb->hi_n_len) >> 4; 293 return le16_to_cpu(tb->hi_n_len) >> 4;
294} 294}
295 295
296static inline void iwl4965_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, 296static inline void il4965_tfd_set_tb(struct il_tfd *tfd, u8 idx,
297 dma_addr_t addr, u16 len) 297 dma_addr_t addr, u16 len)
298{ 298{
299 struct iwl_tfd_tb *tb = &tfd->tbs[idx]; 299 struct il_tfd_tb *tb = &tfd->tbs[idx];
300 u16 hi_n_len = len << 4; 300 u16 hi_n_len = len << 4;
301 301
302 put_unaligned_le32(addr, &tb->lo); 302 put_unaligned_le32(addr, &tb->lo);
@@ -308,23 +308,23 @@ static inline void iwl4965_tfd_set_tb(struct iwl_tfd *tfd, u8 idx,
308 tfd->num_tbs = idx + 1; 308 tfd->num_tbs = idx + 1;
309} 309}
310 310
311static inline u8 iwl4965_tfd_get_num_tbs(struct iwl_tfd *tfd) 311static inline u8 il4965_tfd_get_num_tbs(struct il_tfd *tfd)
312{ 312{
313 return tfd->num_tbs & 0x1f; 313 return tfd->num_tbs & 0x1f;
314} 314}
315 315
316/** 316/**
317 * iwl4965_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] 317 * il4965_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr]
318 * @priv - driver private data 318 * @priv - driver private data
319 * @txq - tx queue 319 * @txq - tx queue
320 * 320 *
321 * Does NOT advance any TFD circular buffer read/write indexes 321 * Does NOT advance any TFD circular buffer read/write indexes
322 * Does NOT free the TFD itself (which is within circular buffer) 322 * Does NOT free the TFD itself (which is within circular buffer)
323 */ 323 */
324void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) 324void il4965_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq)
325{ 325{
326 struct iwl_tfd *tfd_tmp = (struct iwl_tfd *)txq->tfds; 326 struct il_tfd *tfd_tmp = (struct il_tfd *)txq->tfds;
327 struct iwl_tfd *tfd; 327 struct il_tfd *tfd;
328 struct pci_dev *dev = priv->pci_dev; 328 struct pci_dev *dev = priv->pci_dev;
329 int index = txq->q.read_ptr; 329 int index = txq->q.read_ptr;
330 int i; 330 int i;
@@ -333,10 +333,10 @@ void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
333 tfd = &tfd_tmp[index]; 333 tfd = &tfd_tmp[index];
334 334
335 /* Sanity check on number of chunks */ 335 /* Sanity check on number of chunks */
336 num_tbs = iwl4965_tfd_get_num_tbs(tfd); 336 num_tbs = il4965_tfd_get_num_tbs(tfd);
337 337
338 if (num_tbs >= IWL_NUM_OF_TBS) { 338 if (num_tbs >= IL_NUM_OF_TBS) {
339 IWL_ERR(priv, "Too many chunks: %i\n", num_tbs); 339 IL_ERR(priv, "Too many chunks: %i\n", num_tbs);
340 /* @todo issue fatal error, it is quite serious situation */ 340 /* @todo issue fatal error, it is quite serious situation */
341 return; 341 return;
342 } 342 }
@@ -350,8 +350,8 @@ void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
350 350
351 /* Unmap chunks, if any. */ 351 /* Unmap chunks, if any. */
352 for (i = 1; i < num_tbs; i++) 352 for (i = 1; i < num_tbs; i++)
353 pci_unmap_single(dev, iwl4965_tfd_tb_get_addr(tfd, i), 353 pci_unmap_single(dev, il4965_tfd_tb_get_addr(tfd, i),
354 iwl4965_tfd_tb_get_len(tfd, i), 354 il4965_tfd_tb_get_len(tfd, i),
355 PCI_DMA_TODEVICE); 355 PCI_DMA_TODEVICE);
356 356
357 /* free SKB */ 357 /* free SKB */
@@ -368,37 +368,37 @@ void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
368 } 368 }
369} 369}
370 370
371int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, 371int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *priv,
372 struct iwl_tx_queue *txq, 372 struct il_tx_queue *txq,
373 dma_addr_t addr, u16 len, 373 dma_addr_t addr, u16 len,
374 u8 reset, u8 pad) 374 u8 reset, u8 pad)
375{ 375{
376 struct iwl_queue *q; 376 struct il_queue *q;
377 struct iwl_tfd *tfd, *tfd_tmp; 377 struct il_tfd *tfd, *tfd_tmp;
378 u32 num_tbs; 378 u32 num_tbs;
379 379
380 q = &txq->q; 380 q = &txq->q;
381 tfd_tmp = (struct iwl_tfd *)txq->tfds; 381 tfd_tmp = (struct il_tfd *)txq->tfds;
382 tfd = &tfd_tmp[q->write_ptr]; 382 tfd = &tfd_tmp[q->write_ptr];
383 383
384 if (reset) 384 if (reset)
385 memset(tfd, 0, sizeof(*tfd)); 385 memset(tfd, 0, sizeof(*tfd));
386 386
387 num_tbs = iwl4965_tfd_get_num_tbs(tfd); 387 num_tbs = il4965_tfd_get_num_tbs(tfd);
388 388
389 /* Each TFD can point to a maximum 20 Tx buffers */ 389 /* Each TFD can point to a maximum 20 Tx buffers */
390 if (num_tbs >= IWL_NUM_OF_TBS) { 390 if (num_tbs >= IL_NUM_OF_TBS) {
391 IWL_ERR(priv, "Error can not send more than %d chunks\n", 391 IL_ERR(priv, "Error can not send more than %d chunks\n",
392 IWL_NUM_OF_TBS); 392 IL_NUM_OF_TBS);
393 return -EINVAL; 393 return -EINVAL;
394 } 394 }
395 395
396 BUG_ON(addr & ~DMA_BIT_MASK(36)); 396 BUG_ON(addr & ~DMA_BIT_MASK(36));
397 if (unlikely(addr & ~IWL_TX_DMA_MASK)) 397 if (unlikely(addr & ~IL_TX_DMA_MASK))
398 IWL_ERR(priv, "Unaligned address = %llx\n", 398 IL_ERR(priv, "Unaligned address = %llx\n",
399 (unsigned long long)addr); 399 (unsigned long long)addr);
400 400
401 iwl4965_tfd_set_tb(tfd, num_tbs, addr, len); 401 il4965_tfd_set_tb(tfd, num_tbs, addr, len);
402 402
403 return 0; 403 return 0;
404} 404}
@@ -410,13 +410,13 @@ int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
410 * 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA 410 * 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA
411 * channels supported in hardware. 411 * channels supported in hardware.
412 */ 412 */
413int iwl4965_hw_tx_queue_init(struct iwl_priv *priv, 413int il4965_hw_tx_queue_init(struct il_priv *priv,
414 struct iwl_tx_queue *txq) 414 struct il_tx_queue *txq)
415{ 415{
416 int txq_id = txq->q.id; 416 int txq_id = txq->q.id;
417 417
418 /* Circular buffer (TFD queue in DRAM) physical base address */ 418 /* Circular buffer (TFD queue in DRAM) physical base address */
419 iwl_legacy_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), 419 il_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id),
420 txq->q.dma_addr >> 8); 420 txq->q.dma_addr >> 8);
421 421
422 return 0; 422 return 0;
@@ -427,30 +427,30 @@ int iwl4965_hw_tx_queue_init(struct iwl_priv *priv,
427 * Generic RX handler implementations 427 * Generic RX handler implementations
428 * 428 *
429 ******************************************************************************/ 429 ******************************************************************************/
430static void iwl4965_rx_reply_alive(struct iwl_priv *priv, 430static void il4965_rx_reply_alive(struct il_priv *priv,
431 struct iwl_rx_mem_buffer *rxb) 431 struct il_rx_mem_buffer *rxb)
432{ 432{
433 struct iwl_rx_packet *pkt = rxb_addr(rxb); 433 struct il_rx_packet *pkt = rxb_addr(rxb);
434 struct iwl_alive_resp *palive; 434 struct il_alive_resp *palive;
435 struct delayed_work *pwork; 435 struct delayed_work *pwork;
436 436
437 palive = &pkt->u.alive_frame; 437 palive = &pkt->u.alive_frame;
438 438
439 IWL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " 439 IL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision "
440 "0x%01X 0x%01X\n", 440 "0x%01X 0x%01X\n",
441 palive->is_valid, palive->ver_type, 441 palive->is_valid, palive->ver_type,
442 palive->ver_subtype); 442 palive->ver_subtype);
443 443
444 if (palive->ver_subtype == INITIALIZE_SUBTYPE) { 444 if (palive->ver_subtype == INITIALIZE_SUBTYPE) {
445 IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); 445 IL_DEBUG_INFO(priv, "Initialization Alive received.\n");
446 memcpy(&priv->card_alive_init, 446 memcpy(&priv->card_alive_init,
447 &pkt->u.alive_frame, 447 &pkt->u.alive_frame,
448 sizeof(struct iwl_init_alive_resp)); 448 sizeof(struct il_init_alive_resp));
449 pwork = &priv->init_alive_start; 449 pwork = &priv->init_alive_start;
450 } else { 450 } else {
451 IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); 451 IL_DEBUG_INFO(priv, "Runtime Alive received.\n");
452 memcpy(&priv->card_alive, &pkt->u.alive_frame, 452 memcpy(&priv->card_alive, &pkt->u.alive_frame,
453 sizeof(struct iwl_alive_resp)); 453 sizeof(struct il_alive_resp));
454 pwork = &priv->alive_start; 454 pwork = &priv->alive_start;
455 } 455 }
456 456
@@ -460,11 +460,11 @@ static void iwl4965_rx_reply_alive(struct iwl_priv *priv,
460 queue_delayed_work(priv->workqueue, pwork, 460 queue_delayed_work(priv->workqueue, pwork,
461 msecs_to_jiffies(5)); 461 msecs_to_jiffies(5));
462 else 462 else
463 IWL_WARN(priv, "uCode did not respond OK.\n"); 463 IL_WARN(priv, "uCode did not respond OK.\n");
464} 464}
465 465
466/** 466/**
467 * iwl4965_bg_statistics_periodic - Timer callback to queue statistics 467 * il4965_bg_statistics_periodic - Timer callback to queue statistics
468 * 468 *
469 * This callback is provided in order to send a statistics request. 469 * This callback is provided in order to send a statistics request.
470 * 470 *
@@ -473,30 +473,30 @@ static void iwl4965_rx_reply_alive(struct iwl_priv *priv,
473 * was received. We need to ensure we receive the statistics in order 473 * was received. We need to ensure we receive the statistics in order
474 * to update the temperature used for calibrating the TXPOWER. 474 * to update the temperature used for calibrating the TXPOWER.
475 */ 475 */
476static void iwl4965_bg_statistics_periodic(unsigned long data) 476static void il4965_bg_statistics_periodic(unsigned long data)
477{ 477{
478 struct iwl_priv *priv = (struct iwl_priv *)data; 478 struct il_priv *priv = (struct il_priv *)data;
479 479
480 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 480 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
481 return; 481 return;
482 482
483 /* dont send host command if rf-kill is on */ 483 /* dont send host command if rf-kill is on */
484 if (!iwl_legacy_is_ready_rf(priv)) 484 if (!il_is_ready_rf(priv))
485 return; 485 return;
486 486
487 iwl_legacy_send_statistics_request(priv, CMD_ASYNC, false); 487 il_send_statistics_request(priv, CMD_ASYNC, false);
488} 488}
489 489
490static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, 490static void il4965_rx_beacon_notif(struct il_priv *priv,
491 struct iwl_rx_mem_buffer *rxb) 491 struct il_rx_mem_buffer *rxb)
492{ 492{
493 struct iwl_rx_packet *pkt = rxb_addr(rxb); 493 struct il_rx_packet *pkt = rxb_addr(rxb);
494 struct iwl4965_beacon_notif *beacon = 494 struct il4965_beacon_notif *beacon =
495 (struct iwl4965_beacon_notif *)pkt->u.raw; 495 (struct il4965_beacon_notif *)pkt->u.raw;
496#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 496#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
497 u8 rate = iwl4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); 497 u8 rate = il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags);
498 498
499 IWL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " 499 IL_DEBUG_RX(priv, "beacon status %x retries %d iss %d "
500 "tsf %d %d rate %d\n", 500 "tsf %d %d rate %d\n",
501 le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, 501 le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK,
502 beacon->beacon_notify_hdr.failure_frame, 502 beacon->beacon_notify_hdr.failure_frame,
@@ -508,35 +508,35 @@ static void iwl4965_rx_beacon_notif(struct iwl_priv *priv,
508 priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); 508 priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status);
509} 509}
510 510
511static void iwl4965_perform_ct_kill_task(struct iwl_priv *priv) 511static void il4965_perform_ct_kill_task(struct il_priv *priv)
512{ 512{
513 unsigned long flags; 513 unsigned long flags;
514 514
515 IWL_DEBUG_POWER(priv, "Stop all queues\n"); 515 IL_DEBUG_POWER(priv, "Stop all queues\n");
516 516
517 if (priv->mac80211_registered) 517 if (priv->mac80211_registered)
518 ieee80211_stop_queues(priv->hw); 518 ieee80211_stop_queues(priv->hw);
519 519
520 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 520 il_write32(priv, CSR_UCODE_DRV_GP1_SET,
521 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); 521 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
522 iwl_read32(priv, CSR_UCODE_DRV_GP1); 522 il_read32(priv, CSR_UCODE_DRV_GP1);
523 523
524 spin_lock_irqsave(&priv->reg_lock, flags); 524 spin_lock_irqsave(&priv->reg_lock, flags);
525 if (!iwl_grab_nic_access(priv)) 525 if (!il_grab_nic_access(priv))
526 iwl_release_nic_access(priv); 526 il_release_nic_access(priv);
527 spin_unlock_irqrestore(&priv->reg_lock, flags); 527 spin_unlock_irqrestore(&priv->reg_lock, flags);
528} 528}
529 529
530/* Handle notification from uCode that card's power state is changing 530/* Handle notification from uCode that card's power state is changing
531 * due to software, hardware, or critical temperature RFKILL */ 531 * due to software, hardware, or critical temperature RFKILL */
532static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, 532static void il4965_rx_card_state_notif(struct il_priv *priv,
533 struct iwl_rx_mem_buffer *rxb) 533 struct il_rx_mem_buffer *rxb)
534{ 534{
535 struct iwl_rx_packet *pkt = rxb_addr(rxb); 535 struct il_rx_packet *pkt = rxb_addr(rxb);
536 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); 536 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
537 unsigned long status = priv->status; 537 unsigned long status = priv->status;
538 538
539 IWL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s CT:%s\n", 539 IL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s CT:%s\n",
540 (flags & HW_CARD_DISABLED) ? "Kill" : "On", 540 (flags & HW_CARD_DISABLED) ? "Kill" : "On",
541 (flags & SW_CARD_DISABLED) ? "Kill" : "On", 541 (flags & SW_CARD_DISABLED) ? "Kill" : "On",
542 (flags & CT_CARD_DISABLED) ? 542 (flags & CT_CARD_DISABLED) ?
@@ -545,22 +545,22 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
545 if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | 545 if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED |
546 CT_CARD_DISABLED)) { 546 CT_CARD_DISABLED)) {
547 547
548 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 548 il_write32(priv, CSR_UCODE_DRV_GP1_SET,
549 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 549 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
550 550
551 iwl_legacy_write_direct32(priv, HBUS_TARG_MBX_C, 551 il_write_direct32(priv, HBUS_TARG_MBX_C,
552 HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); 552 HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED);
553 553
554 if (!(flags & RXON_CARD_DISABLED)) { 554 if (!(flags & RXON_CARD_DISABLED)) {
555 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 555 il_write32(priv, CSR_UCODE_DRV_GP1_CLR,
556 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 556 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
557 iwl_legacy_write_direct32(priv, HBUS_TARG_MBX_C, 557 il_write_direct32(priv, HBUS_TARG_MBX_C,
558 HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); 558 HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED);
559 } 559 }
560 } 560 }
561 561
562 if (flags & CT_CARD_DISABLED) 562 if (flags & CT_CARD_DISABLED)
563 iwl4965_perform_ct_kill_task(priv); 563 il4965_perform_ct_kill_task(priv);
564 564
565 if (flags & HW_CARD_DISABLED) 565 if (flags & HW_CARD_DISABLED)
566 set_bit(STATUS_RF_KILL_HW, &priv->status); 566 set_bit(STATUS_RF_KILL_HW, &priv->status);
@@ -568,7 +568,7 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
568 clear_bit(STATUS_RF_KILL_HW, &priv->status); 568 clear_bit(STATUS_RF_KILL_HW, &priv->status);
569 569
570 if (!(flags & RXON_CARD_DISABLED)) 570 if (!(flags & RXON_CARD_DISABLED))
571 iwl_legacy_scan_cancel(priv); 571 il_scan_cancel(priv);
572 572
573 if ((test_bit(STATUS_RF_KILL_HW, &status) != 573 if ((test_bit(STATUS_RF_KILL_HW, &status) !=
574 test_bit(STATUS_RF_KILL_HW, &priv->status))) 574 test_bit(STATUS_RF_KILL_HW, &priv->status)))
@@ -579,7 +579,7 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
579} 579}
580 580
581/** 581/**
582 * iwl4965_setup_rx_handlers - Initialize Rx handler callbacks 582 * il4965_setup_rx_handlers - Initialize Rx handler callbacks
583 * 583 *
584 * Setup the RX handlers for each of the reply types sent from the uCode 584 * Setup the RX handlers for each of the reply types sent from the uCode
585 * to the host. 585 * to the host.
@@ -587,55 +587,55 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
587 * This function chains into the hardware specific files for them to setup 587 * This function chains into the hardware specific files for them to setup
588 * any hardware specific handlers as well. 588 * any hardware specific handlers as well.
589 */ 589 */
590static void iwl4965_setup_rx_handlers(struct iwl_priv *priv) 590static void il4965_setup_rx_handlers(struct il_priv *priv)
591{ 591{
592 priv->rx_handlers[REPLY_ALIVE] = iwl4965_rx_reply_alive; 592 priv->rx_handlers[REPLY_ALIVE] = il4965_rx_reply_alive;
593 priv->rx_handlers[REPLY_ERROR] = iwl_legacy_rx_reply_error; 593 priv->rx_handlers[REPLY_ERROR] = il_rx_reply_error;
594 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_legacy_rx_csa; 594 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa;
595 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = 595 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
596 iwl_legacy_rx_spectrum_measure_notif; 596 il_rx_spectrum_measure_notif;
597 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_legacy_rx_pm_sleep_notif; 597 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif;
598 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = 598 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] =
599 iwl_legacy_rx_pm_debug_statistics_notif; 599 il_rx_pm_debug_statistics_notif;
600 priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif; 600 priv->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif;
601 601
602 /* 602 /*
603 * The same handler is used for both the REPLY to a discrete 603 * The same handler is used for both the REPLY to a discrete
604 * statistics request from the host as well as for the periodic 604 * statistics request from the host as well as for the periodic
605 * statistics notifications (after received beacons) from the uCode. 605 * statistics notifications (after received beacons) from the uCode.
606 */ 606 */
607 priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl4965_reply_statistics; 607 priv->rx_handlers[REPLY_STATISTICS_CMD] = il4965_reply_statistics;
608 priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl4965_rx_statistics; 608 priv->rx_handlers[STATISTICS_NOTIFICATION] = il4965_rx_statistics;
609 609
610 iwl_legacy_setup_rx_scan_handlers(priv); 610 il_setup_rx_scan_handlers(priv);
611 611
612 /* status change handler */ 612 /* status change handler */
613 priv->rx_handlers[CARD_STATE_NOTIFICATION] = 613 priv->rx_handlers[CARD_STATE_NOTIFICATION] =
614 iwl4965_rx_card_state_notif; 614 il4965_rx_card_state_notif;
615 615
616 priv->rx_handlers[MISSED_BEACONS_NOTIFICATION] = 616 priv->rx_handlers[MISSED_BEACONS_NOTIFICATION] =
617 iwl4965_rx_missed_beacon_notif; 617 il4965_rx_missed_beacon_notif;
618 /* Rx handlers */ 618 /* Rx handlers */
619 priv->rx_handlers[REPLY_RX_PHY_CMD] = iwl4965_rx_reply_rx_phy; 619 priv->rx_handlers[REPLY_RX_PHY_CMD] = il4965_rx_reply_rx_phy;
620 priv->rx_handlers[REPLY_RX_MPDU_CMD] = iwl4965_rx_reply_rx; 620 priv->rx_handlers[REPLY_RX_MPDU_CMD] = il4965_rx_reply_rx;
621 /* block ack */ 621 /* block ack */
622 priv->rx_handlers[REPLY_COMPRESSED_BA] = iwl4965_rx_reply_compressed_ba; 622 priv->rx_handlers[REPLY_COMPRESSED_BA] = il4965_rx_reply_compressed_ba;
623 /* Set up hardware specific Rx handlers */ 623 /* Set up hardware specific Rx handlers */
624 priv->cfg->ops->lib->rx_handler_setup(priv); 624 priv->cfg->ops->lib->rx_handler_setup(priv);
625} 625}
626 626
627/** 627/**
628 * iwl4965_rx_handle - Main entry function for receiving responses from uCode 628 * il4965_rx_handle - Main entry function for receiving responses from uCode
629 * 629 *
630 * Uses the priv->rx_handlers callback function array to invoke 630 * Uses the priv->rx_handlers callback function array to invoke
631 * the appropriate handlers, including command responses, 631 * the appropriate handlers, including command responses,
632 * frame-received notifications, and other notifications. 632 * frame-received notifications, and other notifications.
633 */ 633 */
634void iwl4965_rx_handle(struct iwl_priv *priv) 634void il4965_rx_handle(struct il_priv *priv)
635{ 635{
636 struct iwl_rx_mem_buffer *rxb; 636 struct il_rx_mem_buffer *rxb;
637 struct iwl_rx_packet *pkt; 637 struct il_rx_packet *pkt;
638 struct iwl_rx_queue *rxq = &priv->rxq; 638 struct il_rx_queue *rxq = &priv->rxq;
639 u32 r, i; 639 u32 r, i;
640 int reclaim; 640 int reclaim;
641 unsigned long flags; 641 unsigned long flags;
@@ -650,7 +650,7 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
650 650
651 /* Rx interrupt, but nothing sent from uCode */ 651 /* Rx interrupt, but nothing sent from uCode */
652 if (i == r) 652 if (i == r)
653 IWL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); 653 IL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i);
654 654
655 /* calculate total frames need to be restock after handling RX */ 655 /* calculate total frames need to be restock after handling RX */
656 total_empty = r - rxq->write_actual; 656 total_empty = r - rxq->write_actual;
@@ -696,18 +696,18 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
696 696
697 /* Based on type of command response or notification, 697 /* Based on type of command response or notification,
698 * handle those that need handling via function in 698 * handle those that need handling via function in
699 * rx_handlers table. See iwl4965_setup_rx_handlers() */ 699 * rx_handlers table. See il4965_setup_rx_handlers() */
700 if (priv->rx_handlers[pkt->hdr.cmd]) { 700 if (priv->rx_handlers[pkt->hdr.cmd]) {
701 IWL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, 701 IL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r,
702 i, iwl_legacy_get_cmd_string(pkt->hdr.cmd), 702 i, il_get_cmd_string(pkt->hdr.cmd),
703 pkt->hdr.cmd); 703 pkt->hdr.cmd);
704 priv->isr_stats.rx_handlers[pkt->hdr.cmd]++; 704 priv->isr_stats.rx_handlers[pkt->hdr.cmd]++;
705 priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); 705 priv->rx_handlers[pkt->hdr.cmd] (priv, rxb);
706 } else { 706 } else {
707 /* No handling needed */ 707 /* No handling needed */
708 IWL_DEBUG_RX(priv, 708 IL_DEBUG_RX(priv,
709 "r %d i %d No handler needed for %s, 0x%02x\n", 709 "r %d i %d No handler needed for %s, 0x%02x\n",
710 r, i, iwl_legacy_get_cmd_string(pkt->hdr.cmd), 710 r, i, il_get_cmd_string(pkt->hdr.cmd),
711 pkt->hdr.cmd); 711 pkt->hdr.cmd);
712 } 712 }
713 713
@@ -720,12 +720,12 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
720 720
721 if (reclaim) { 721 if (reclaim) {
722 /* Invoke any callbacks, transfer the buffer to caller, 722 /* Invoke any callbacks, transfer the buffer to caller,
723 * and fire off the (possibly) blocking iwl_legacy_send_cmd() 723 * and fire off the (possibly) blocking il_send_cmd()
724 * as we reclaim the driver command queue */ 724 * as we reclaim the driver command queue */
725 if (rxb->page) 725 if (rxb->page)
726 iwl_legacy_tx_cmd_complete(priv, rxb); 726 il_tx_cmd_complete(priv, rxb);
727 else 727 else
728 IWL_WARN(priv, "Claim null rxb?\n"); 728 IL_WARN(priv, "Claim null rxb?\n");
729 } 729 }
730 730
731 /* Reuse the page if possible. For notification packets and 731 /* Reuse the page if possible. For notification packets and
@@ -750,7 +750,7 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
750 count++; 750 count++;
751 if (count >= 8) { 751 if (count >= 8) {
752 rxq->read = i; 752 rxq->read = i;
753 iwl4965_rx_replenish_now(priv); 753 il4965_rx_replenish_now(priv);
754 count = 0; 754 count = 0;
755 } 755 }
756 } 756 }
@@ -759,20 +759,20 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
759 /* Backtrack one entry */ 759 /* Backtrack one entry */
760 rxq->read = i; 760 rxq->read = i;
761 if (fill_rx) 761 if (fill_rx)
762 iwl4965_rx_replenish_now(priv); 762 il4965_rx_replenish_now(priv);
763 else 763 else
764 iwl4965_rx_queue_restock(priv); 764 il4965_rx_queue_restock(priv);
765} 765}
766 766
767/* call this function to flush any scheduled tasklet */ 767/* call this function to flush any scheduled tasklet */
768static inline void iwl4965_synchronize_irq(struct iwl_priv *priv) 768static inline void il4965_synchronize_irq(struct il_priv *priv)
769{ 769{
770 /* wait to make sure we flush pending tasklet*/ 770 /* wait to make sure we flush pending tasklet*/
771 synchronize_irq(priv->pci_dev->irq); 771 synchronize_irq(priv->pci_dev->irq);
772 tasklet_kill(&priv->irq_tasklet); 772 tasklet_kill(&priv->irq_tasklet);
773} 773}
774 774
775static void iwl4965_irq_tasklet(struct iwl_priv *priv) 775static void il4965_irq_tasklet(struct il_priv *priv)
776{ 776{
777 u32 inta, handled = 0; 777 u32 inta, handled = 0;
778 u32 inta_fh; 778 u32 inta_fh;
@@ -787,20 +787,20 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
787 /* Ack/clear/reset pending uCode interrupts. 787 /* Ack/clear/reset pending uCode interrupts.
788 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, 788 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS,
789 * and will clear only when CSR_FH_INT_STATUS gets cleared. */ 789 * and will clear only when CSR_FH_INT_STATUS gets cleared. */
790 inta = iwl_read32(priv, CSR_INT); 790 inta = il_read32(priv, CSR_INT);
791 iwl_write32(priv, CSR_INT, inta); 791 il_write32(priv, CSR_INT, inta);
792 792
793 /* Ack/clear/reset pending flow-handler (DMA) interrupts. 793 /* Ack/clear/reset pending flow-handler (DMA) interrupts.
794 * Any new interrupts that happen after this, either while we're 794 * Any new interrupts that happen after this, either while we're
795 * in this tasklet, or later, will show up in next ISR/tasklet. */ 795 * in this tasklet, or later, will show up in next ISR/tasklet. */
796 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 796 inta_fh = il_read32(priv, CSR_FH_INT_STATUS);
797 iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); 797 il_write32(priv, CSR_FH_INT_STATUS, inta_fh);
798 798
799#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 799#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
800 if (iwl_legacy_get_debug_level(priv) & IWL_DL_ISR) { 800 if (il_get_debug_level(priv) & IL_DL_ISR) {
801 /* just for debug */ 801 /* just for debug */
802 inta_mask = iwl_read32(priv, CSR_INT_MASK); 802 inta_mask = il_read32(priv, CSR_INT_MASK);
803 IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 803 IL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
804 inta, inta_mask, inta_fh); 804 inta, inta_mask, inta_fh);
805 } 805 }
806#endif 806#endif
@@ -818,13 +818,13 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
818 818
819 /* Now service all interrupt bits discovered above. */ 819 /* Now service all interrupt bits discovered above. */
820 if (inta & CSR_INT_BIT_HW_ERR) { 820 if (inta & CSR_INT_BIT_HW_ERR) {
821 IWL_ERR(priv, "Hardware error detected. Restarting.\n"); 821 IL_ERR(priv, "Hardware error detected. Restarting.\n");
822 822
823 /* Tell the device to stop sending interrupts */ 823 /* Tell the device to stop sending interrupts */
824 iwl_legacy_disable_interrupts(priv); 824 il_disable_interrupts(priv);
825 825
826 priv->isr_stats.hw++; 826 priv->isr_stats.hw++;
827 iwl_legacy_irq_handle_error(priv); 827 il_irq_handle_error(priv);
828 828
829 handled |= CSR_INT_BIT_HW_ERR; 829 handled |= CSR_INT_BIT_HW_ERR;
830 830
@@ -832,17 +832,17 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
832 } 832 }
833 833
834#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 834#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
835 if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) { 835 if (il_get_debug_level(priv) & (IL_DL_ISR)) {
836 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 836 /* NIC fires this, but we don't use it, redundant with WAKEUP */
837 if (inta & CSR_INT_BIT_SCD) { 837 if (inta & CSR_INT_BIT_SCD) {
838 IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " 838 IL_DEBUG_ISR(priv, "Scheduler finished to transmit "
839 "the frame/frames.\n"); 839 "the frame/frames.\n");
840 priv->isr_stats.sch++; 840 priv->isr_stats.sch++;
841 } 841 }
842 842
843 /* Alive notification via Rx interrupt will do the real work */ 843 /* Alive notification via Rx interrupt will do the real work */
844 if (inta & CSR_INT_BIT_ALIVE) { 844 if (inta & CSR_INT_BIT_ALIVE) {
845 IWL_DEBUG_ISR(priv, "Alive interrupt\n"); 845 IL_DEBUG_ISR(priv, "Alive interrupt\n");
846 priv->isr_stats.alive++; 846 priv->isr_stats.alive++;
847 } 847 }
848 } 848 }
@@ -853,11 +853,11 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
853 /* HW RF KILL switch toggled */ 853 /* HW RF KILL switch toggled */
854 if (inta & CSR_INT_BIT_RF_KILL) { 854 if (inta & CSR_INT_BIT_RF_KILL) {
855 int hw_rf_kill = 0; 855 int hw_rf_kill = 0;
856 if (!(iwl_read32(priv, CSR_GP_CNTRL) & 856 if (!(il_read32(priv, CSR_GP_CNTRL) &
857 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) 857 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
858 hw_rf_kill = 1; 858 hw_rf_kill = 1;
859 859
860 IWL_WARN(priv, "RF_KILL bit toggled to %s.\n", 860 IL_WARN(priv, "RF_KILL bit toggled to %s.\n",
861 hw_rf_kill ? "disable radio" : "enable radio"); 861 hw_rf_kill ? "disable radio" : "enable radio");
862 862
863 priv->isr_stats.rfkill++; 863 priv->isr_stats.rfkill++;
@@ -880,17 +880,17 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
880 880
881 /* Chip got too hot and stopped itself */ 881 /* Chip got too hot and stopped itself */
882 if (inta & CSR_INT_BIT_CT_KILL) { 882 if (inta & CSR_INT_BIT_CT_KILL) {
883 IWL_ERR(priv, "Microcode CT kill error detected.\n"); 883 IL_ERR(priv, "Microcode CT kill error detected.\n");
884 priv->isr_stats.ctkill++; 884 priv->isr_stats.ctkill++;
885 handled |= CSR_INT_BIT_CT_KILL; 885 handled |= CSR_INT_BIT_CT_KILL;
886 } 886 }
887 887
888 /* Error detected by uCode */ 888 /* Error detected by uCode */
889 if (inta & CSR_INT_BIT_SW_ERR) { 889 if (inta & CSR_INT_BIT_SW_ERR) {
890 IWL_ERR(priv, "Microcode SW error detected. " 890 IL_ERR(priv, "Microcode SW error detected. "
891 " Restarting 0x%X.\n", inta); 891 " Restarting 0x%X.\n", inta);
892 priv->isr_stats.sw++; 892 priv->isr_stats.sw++;
893 iwl_legacy_irq_handle_error(priv); 893 il_irq_handle_error(priv);
894 handled |= CSR_INT_BIT_SW_ERR; 894 handled |= CSR_INT_BIT_SW_ERR;
895 } 895 }
896 896
@@ -900,10 +900,10 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
900 * and about any Rx buffers made available while asleep. 900 * and about any Rx buffers made available while asleep.
901 */ 901 */
902 if (inta & CSR_INT_BIT_WAKEUP) { 902 if (inta & CSR_INT_BIT_WAKEUP) {
903 IWL_DEBUG_ISR(priv, "Wakeup interrupt\n"); 903 IL_DEBUG_ISR(priv, "Wakeup interrupt\n");
904 iwl_legacy_rx_queue_update_write_ptr(priv, &priv->rxq); 904 il_rx_queue_update_write_ptr(priv, &priv->rxq);
905 for (i = 0; i < priv->hw_params.max_txq_num; i++) 905 for (i = 0; i < priv->hw_params.max_txq_num; i++)
906 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[i]); 906 il_txq_update_write_ptr(priv, &priv->txq[i]);
907 priv->isr_stats.wakeup++; 907 priv->isr_stats.wakeup++;
908 handled |= CSR_INT_BIT_WAKEUP; 908 handled |= CSR_INT_BIT_WAKEUP;
909 } 909 }
@@ -912,14 +912,14 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
912 * Rx "responses" (frame-received notification), and other 912 * Rx "responses" (frame-received notification), and other
913 * notifications from uCode come through here*/ 913 * notifications from uCode come through here*/
914 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { 914 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) {
915 iwl4965_rx_handle(priv); 915 il4965_rx_handle(priv);
916 priv->isr_stats.rx++; 916 priv->isr_stats.rx++;
917 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); 917 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX);
918 } 918 }
919 919
920 /* This "Tx" DMA channel is used only for loading uCode */ 920 /* This "Tx" DMA channel is used only for loading uCode */
921 if (inta & CSR_INT_BIT_FH_TX) { 921 if (inta & CSR_INT_BIT_FH_TX) {
922 IWL_DEBUG_ISR(priv, "uCode load interrupt\n"); 922 IL_DEBUG_ISR(priv, "uCode load interrupt\n");
923 priv->isr_stats.tx++; 923 priv->isr_stats.tx++;
924 handled |= CSR_INT_BIT_FH_TX; 924 handled |= CSR_INT_BIT_FH_TX;
925 /* Wake up uCode load routine, now that load is complete */ 925 /* Wake up uCode load routine, now that load is complete */
@@ -928,30 +928,30 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
928 } 928 }
929 929
930 if (inta & ~handled) { 930 if (inta & ~handled) {
931 IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); 931 IL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled);
932 priv->isr_stats.unhandled++; 932 priv->isr_stats.unhandled++;
933 } 933 }
934 934
935 if (inta & ~(priv->inta_mask)) { 935 if (inta & ~(priv->inta_mask)) {
936 IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", 936 IL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n",
937 inta & ~priv->inta_mask); 937 inta & ~priv->inta_mask);
938 IWL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh); 938 IL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh);
939 } 939 }
940 940
941 /* Re-enable all interrupts */ 941 /* Re-enable all interrupts */
942 /* only Re-enable if disabled by irq */ 942 /* only Re-enable if disabled by irq */
943 if (test_bit(STATUS_INT_ENABLED, &priv->status)) 943 if (test_bit(STATUS_INT_ENABLED, &priv->status))
944 iwl_legacy_enable_interrupts(priv); 944 il_enable_interrupts(priv);
945 /* Re-enable RF_KILL if it occurred */ 945 /* Re-enable RF_KILL if it occurred */
946 else if (handled & CSR_INT_BIT_RF_KILL) 946 else if (handled & CSR_INT_BIT_RF_KILL)
947 iwl_legacy_enable_rfkill_int(priv); 947 il_enable_rfkill_int(priv);
948 948
949#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 949#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
950 if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) { 950 if (il_get_debug_level(priv) & (IL_DL_ISR)) {
951 inta = iwl_read32(priv, CSR_INT); 951 inta = il_read32(priv, CSR_INT);
952 inta_mask = iwl_read32(priv, CSR_INT_MASK); 952 inta_mask = il_read32(priv, CSR_INT_MASK);
953 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 953 inta_fh = il_read32(priv, CSR_FH_INT_STATUS);
954 IWL_DEBUG_ISR(priv, 954 IL_DEBUG_ISR(priv,
955 "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " 955 "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, "
956 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); 956 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags);
957 } 957 }
@@ -977,78 +977,78 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
977 * level that is used instead of the global debug level if it (the per 977 * level that is used instead of the global debug level if it (the per
978 * device debug level) is set. 978 * device debug level) is set.
979 */ 979 */
980static ssize_t iwl4965_show_debug_level(struct device *d, 980static ssize_t il4965_show_debug_level(struct device *d,
981 struct device_attribute *attr, char *buf) 981 struct device_attribute *attr, char *buf)
982{ 982{
983 struct iwl_priv *priv = dev_get_drvdata(d); 983 struct il_priv *priv = dev_get_drvdata(d);
984 return sprintf(buf, "0x%08X\n", iwl_legacy_get_debug_level(priv)); 984 return sprintf(buf, "0x%08X\n", il_get_debug_level(priv));
985} 985}
986static ssize_t iwl4965_store_debug_level(struct device *d, 986static ssize_t il4965_store_debug_level(struct device *d,
987 struct device_attribute *attr, 987 struct device_attribute *attr,
988 const char *buf, size_t count) 988 const char *buf, size_t count)
989{ 989{
990 struct iwl_priv *priv = dev_get_drvdata(d); 990 struct il_priv *priv = dev_get_drvdata(d);
991 unsigned long val; 991 unsigned long val;
992 int ret; 992 int ret;
993 993
994 ret = strict_strtoul(buf, 0, &val); 994 ret = strict_strtoul(buf, 0, &val);
995 if (ret) 995 if (ret)
996 IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf); 996 IL_ERR(priv, "%s is not in hex or decimal form.\n", buf);
997 else { 997 else {
998 priv->debug_level = val; 998 priv->debug_level = val;
999 if (iwl_legacy_alloc_traffic_mem(priv)) 999 if (il_alloc_traffic_mem(priv))
1000 IWL_ERR(priv, 1000 IL_ERR(priv,
1001 "Not enough memory to generate traffic log\n"); 1001 "Not enough memory to generate traffic log\n");
1002 } 1002 }
1003 return strnlen(buf, count); 1003 return strnlen(buf, count);
1004} 1004}
1005 1005
1006static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, 1006static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
1007 iwl4965_show_debug_level, iwl4965_store_debug_level); 1007 il4965_show_debug_level, il4965_store_debug_level);
1008 1008
1009 1009
1010#endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */ 1010#endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */
1011 1011
1012 1012
1013static ssize_t iwl4965_show_temperature(struct device *d, 1013static ssize_t il4965_show_temperature(struct device *d,
1014 struct device_attribute *attr, char *buf) 1014 struct device_attribute *attr, char *buf)
1015{ 1015{
1016 struct iwl_priv *priv = dev_get_drvdata(d); 1016 struct il_priv *priv = dev_get_drvdata(d);
1017 1017
1018 if (!iwl_legacy_is_alive(priv)) 1018 if (!il_is_alive(priv))
1019 return -EAGAIN; 1019 return -EAGAIN;
1020 1020
1021 return sprintf(buf, "%d\n", priv->temperature); 1021 return sprintf(buf, "%d\n", priv->temperature);
1022} 1022}
1023 1023
1024static DEVICE_ATTR(temperature, S_IRUGO, iwl4965_show_temperature, NULL); 1024static DEVICE_ATTR(temperature, S_IRUGO, il4965_show_temperature, NULL);
1025 1025
1026static ssize_t iwl4965_show_tx_power(struct device *d, 1026static ssize_t il4965_show_tx_power(struct device *d,
1027 struct device_attribute *attr, char *buf) 1027 struct device_attribute *attr, char *buf)
1028{ 1028{
1029 struct iwl_priv *priv = dev_get_drvdata(d); 1029 struct il_priv *priv = dev_get_drvdata(d);
1030 1030
1031 if (!iwl_legacy_is_ready_rf(priv)) 1031 if (!il_is_ready_rf(priv))
1032 return sprintf(buf, "off\n"); 1032 return sprintf(buf, "off\n");
1033 else 1033 else
1034 return sprintf(buf, "%d\n", priv->tx_power_user_lmt); 1034 return sprintf(buf, "%d\n", priv->tx_power_user_lmt);
1035} 1035}
1036 1036
1037static ssize_t iwl4965_store_tx_power(struct device *d, 1037static ssize_t il4965_store_tx_power(struct device *d,
1038 struct device_attribute *attr, 1038 struct device_attribute *attr,
1039 const char *buf, size_t count) 1039 const char *buf, size_t count)
1040{ 1040{
1041 struct iwl_priv *priv = dev_get_drvdata(d); 1041 struct il_priv *priv = dev_get_drvdata(d);
1042 unsigned long val; 1042 unsigned long val;
1043 int ret; 1043 int ret;
1044 1044
1045 ret = strict_strtoul(buf, 10, &val); 1045 ret = strict_strtoul(buf, 10, &val);
1046 if (ret) 1046 if (ret)
1047 IWL_INFO(priv, "%s is not in decimal form.\n", buf); 1047 IL_INFO(priv, "%s is not in decimal form.\n", buf);
1048 else { 1048 else {
1049 ret = iwl_legacy_set_tx_power(priv, val, false); 1049 ret = il_set_tx_power(priv, val, false);
1050 if (ret) 1050 if (ret)
1051 IWL_ERR(priv, "failed setting tx power (0x%d).\n", 1051 IL_ERR(priv, "failed setting tx power (0x%d).\n",
1052 ret); 1052 ret);
1053 else 1053 else
1054 ret = count; 1054 ret = count;
@@ -1057,9 +1057,9 @@ static ssize_t iwl4965_store_tx_power(struct device *d,
1057} 1057}
1058 1058
1059static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, 1059static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO,
1060 iwl4965_show_tx_power, iwl4965_store_tx_power); 1060 il4965_show_tx_power, il4965_store_tx_power);
1061 1061
1062static struct attribute *iwl_sysfs_entries[] = { 1062static struct attribute *il_sysfs_entries[] = {
1063 &dev_attr_temperature.attr, 1063 &dev_attr_temperature.attr,
1064 &dev_attr_tx_power.attr, 1064 &dev_attr_tx_power.attr,
1065#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 1065#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
@@ -1068,9 +1068,9 @@ static struct attribute *iwl_sysfs_entries[] = {
1068 NULL 1068 NULL
1069}; 1069};
1070 1070
1071static struct attribute_group iwl_attribute_group = { 1071static struct attribute_group il_attribute_group = {
1072 .name = NULL, /* put in device directory */ 1072 .name = NULL, /* put in device directory */
1073 .attrs = iwl_sysfs_entries, 1073 .attrs = il_sysfs_entries,
1074}; 1074};
1075 1075
1076/****************************************************************************** 1076/******************************************************************************
@@ -1079,28 +1079,28 @@ static struct attribute_group iwl_attribute_group = {
1079 * 1079 *
1080 ******************************************************************************/ 1080 ******************************************************************************/
1081 1081
1082static void iwl4965_dealloc_ucode_pci(struct iwl_priv *priv) 1082static void il4965_dealloc_ucode_pci(struct il_priv *priv)
1083{ 1083{
1084 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_code); 1084 il_free_fw_desc(priv->pci_dev, &priv->ucode_code);
1085 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data); 1085 il_free_fw_desc(priv->pci_dev, &priv->ucode_data);
1086 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); 1086 il_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
1087 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init); 1087 il_free_fw_desc(priv->pci_dev, &priv->ucode_init);
1088 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); 1088 il_free_fw_desc(priv->pci_dev, &priv->ucode_init_data);
1089 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_boot); 1089 il_free_fw_desc(priv->pci_dev, &priv->ucode_boot);
1090} 1090}
1091 1091
1092static void iwl4965_nic_start(struct iwl_priv *priv) 1092static void il4965_nic_start(struct il_priv *priv)
1093{ 1093{
1094 /* Remove all resets to allow NIC to operate */ 1094 /* Remove all resets to allow NIC to operate */
1095 iwl_write32(priv, CSR_RESET, 0); 1095 il_write32(priv, CSR_RESET, 0);
1096} 1096}
1097 1097
1098static void iwl4965_ucode_callback(const struct firmware *ucode_raw, 1098static void il4965_ucode_callback(const struct firmware *ucode_raw,
1099 void *context); 1099 void *context);
1100static int iwl4965_mac_setup_register(struct iwl_priv *priv, 1100static int il4965_mac_setup_register(struct il_priv *priv,
1101 u32 max_probe_length); 1101 u32 max_probe_length);
1102 1102
1103static int __must_check iwl4965_request_firmware(struct iwl_priv *priv, bool first) 1103static int __must_check il4965_request_firmware(struct il_priv *priv, bool first)
1104{ 1104{
1105 const char *name_pre = priv->cfg->fw_name_pre; 1105 const char *name_pre = priv->cfg->fw_name_pre;
1106 char tag[8]; 1106 char tag[8];
@@ -1114,35 +1114,35 @@ static int __must_check iwl4965_request_firmware(struct iwl_priv *priv, bool fir
1114 } 1114 }
1115 1115
1116 if (priv->fw_index < priv->cfg->ucode_api_min) { 1116 if (priv->fw_index < priv->cfg->ucode_api_min) {
1117 IWL_ERR(priv, "no suitable firmware found!\n"); 1117 IL_ERR(priv, "no suitable firmware found!\n");
1118 return -ENOENT; 1118 return -ENOENT;
1119 } 1119 }
1120 1120
1121 sprintf(priv->firmware_name, "%s%s%s", name_pre, tag, ".ucode"); 1121 sprintf(priv->firmware_name, "%s%s%s", name_pre, tag, ".ucode");
1122 1122
1123 IWL_DEBUG_INFO(priv, "attempting to load firmware '%s'\n", 1123 IL_DEBUG_INFO(priv, "attempting to load firmware '%s'\n",
1124 priv->firmware_name); 1124 priv->firmware_name);
1125 1125
1126 return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, 1126 return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name,
1127 &priv->pci_dev->dev, GFP_KERNEL, priv, 1127 &priv->pci_dev->dev, GFP_KERNEL, priv,
1128 iwl4965_ucode_callback); 1128 il4965_ucode_callback);
1129} 1129}
1130 1130
1131struct iwl4965_firmware_pieces { 1131struct il4965_firmware_pieces {
1132 const void *inst, *data, *init, *init_data, *boot; 1132 const void *inst, *data, *init, *init_data, *boot;
1133 size_t inst_size, data_size, init_size, init_data_size, boot_size; 1133 size_t inst_size, data_size, init_size, init_data_size, boot_size;
1134}; 1134};
1135 1135
1136static int iwl4965_load_firmware(struct iwl_priv *priv, 1136static int il4965_load_firmware(struct il_priv *priv,
1137 const struct firmware *ucode_raw, 1137 const struct firmware *ucode_raw,
1138 struct iwl4965_firmware_pieces *pieces) 1138 struct il4965_firmware_pieces *pieces)
1139{ 1139{
1140 struct iwl_ucode_header *ucode = (void *)ucode_raw->data; 1140 struct il_ucode_header *ucode = (void *)ucode_raw->data;
1141 u32 api_ver, hdr_size; 1141 u32 api_ver, hdr_size;
1142 const u8 *src; 1142 const u8 *src;
1143 1143
1144 priv->ucode_ver = le32_to_cpu(ucode->ver); 1144 priv->ucode_ver = le32_to_cpu(ucode->ver);
1145 api_ver = IWL_UCODE_API(priv->ucode_ver); 1145 api_ver = IL_UCODE_API(priv->ucode_ver);
1146 1146
1147 switch (api_ver) { 1147 switch (api_ver) {
1148 default: 1148 default:
@@ -1151,7 +1151,7 @@ static int iwl4965_load_firmware(struct iwl_priv *priv,
1151 case 2: 1151 case 2:
1152 hdr_size = 24; 1152 hdr_size = 24;
1153 if (ucode_raw->size < hdr_size) { 1153 if (ucode_raw->size < hdr_size) {
1154 IWL_ERR(priv, "File size too small!\n"); 1154 IL_ERR(priv, "File size too small!\n");
1155 return -EINVAL; 1155 return -EINVAL;
1156 } 1156 }
1157 pieces->inst_size = le32_to_cpu(ucode->v1.inst_size); 1157 pieces->inst_size = le32_to_cpu(ucode->v1.inst_size);
@@ -1169,7 +1169,7 @@ static int iwl4965_load_firmware(struct iwl_priv *priv,
1169 pieces->data_size + pieces->init_size + 1169 pieces->data_size + pieces->init_size +
1170 pieces->init_data_size + pieces->boot_size) { 1170 pieces->init_data_size + pieces->boot_size) {
1171 1171
1172 IWL_ERR(priv, 1172 IL_ERR(priv,
1173 "uCode file size %d does not match expected size\n", 1173 "uCode file size %d does not match expected size\n",
1174 (int)ucode_raw->size); 1174 (int)ucode_raw->size);
1175 return -EINVAL; 1175 return -EINVAL;
@@ -1190,54 +1190,54 @@ static int iwl4965_load_firmware(struct iwl_priv *priv,
1190} 1190}
1191 1191
1192/** 1192/**
1193 * iwl4965_ucode_callback - callback when firmware was loaded 1193 * il4965_ucode_callback - callback when firmware was loaded
1194 * 1194 *
1195 * If loaded successfully, copies the firmware into buffers 1195 * If loaded successfully, copies the firmware into buffers
1196 * for the card to fetch (via DMA). 1196 * for the card to fetch (via DMA).
1197 */ 1197 */
1198static void 1198static void
1199iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context) 1199il4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1200{ 1200{
1201 struct iwl_priv *priv = context; 1201 struct il_priv *priv = context;
1202 struct iwl_ucode_header *ucode; 1202 struct il_ucode_header *ucode;
1203 int err; 1203 int err;
1204 struct iwl4965_firmware_pieces pieces; 1204 struct il4965_firmware_pieces pieces;
1205 const unsigned int api_max = priv->cfg->ucode_api_max; 1205 const unsigned int api_max = priv->cfg->ucode_api_max;
1206 const unsigned int api_min = priv->cfg->ucode_api_min; 1206 const unsigned int api_min = priv->cfg->ucode_api_min;
1207 u32 api_ver; 1207 u32 api_ver;
1208 1208
1209 u32 max_probe_length = 200; 1209 u32 max_probe_length = 200;
1210 u32 standard_phy_calibration_size = 1210 u32 standard_phy_calibration_size =
1211 IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE; 1211 IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE;
1212 1212
1213 memset(&pieces, 0, sizeof(pieces)); 1213 memset(&pieces, 0, sizeof(pieces));
1214 1214
1215 if (!ucode_raw) { 1215 if (!ucode_raw) {
1216 if (priv->fw_index <= priv->cfg->ucode_api_max) 1216 if (priv->fw_index <= priv->cfg->ucode_api_max)
1217 IWL_ERR(priv, 1217 IL_ERR(priv,
1218 "request for firmware file '%s' failed.\n", 1218 "request for firmware file '%s' failed.\n",
1219 priv->firmware_name); 1219 priv->firmware_name);
1220 goto try_again; 1220 goto try_again;
1221 } 1221 }
1222 1222
1223 IWL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n", 1223 IL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n",
1224 priv->firmware_name, ucode_raw->size); 1224 priv->firmware_name, ucode_raw->size);
1225 1225
1226 /* Make sure that we got at least the API version number */ 1226 /* Make sure that we got at least the API version number */
1227 if (ucode_raw->size < 4) { 1227 if (ucode_raw->size < 4) {
1228 IWL_ERR(priv, "File size way too small!\n"); 1228 IL_ERR(priv, "File size way too small!\n");
1229 goto try_again; 1229 goto try_again;
1230 } 1230 }
1231 1231
1232 /* Data from ucode file: header followed by uCode images */ 1232 /* Data from ucode file: header followed by uCode images */
1233 ucode = (struct iwl_ucode_header *)ucode_raw->data; 1233 ucode = (struct il_ucode_header *)ucode_raw->data;
1234 1234
1235 err = iwl4965_load_firmware(priv, ucode_raw, &pieces); 1235 err = il4965_load_firmware(priv, ucode_raw, &pieces);
1236 1236
1237 if (err) 1237 if (err)
1238 goto try_again; 1238 goto try_again;
1239 1239
1240 api_ver = IWL_UCODE_API(priv->ucode_ver); 1240 api_ver = IL_UCODE_API(priv->ucode_ver);
1241 1241
1242 /* 1242 /*
1243 * api_ver should match the api version forming part of the 1243 * api_ver should match the api version forming part of the
@@ -1245,7 +1245,7 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1245 * on the API version read from firmware header from here on forward 1245 * on the API version read from firmware header from here on forward
1246 */ 1246 */
1247 if (api_ver < api_min || api_ver > api_max) { 1247 if (api_ver < api_min || api_ver > api_max) {
1248 IWL_ERR(priv, 1248 IL_ERR(priv,
1249 "Driver unable to support your firmware API. " 1249 "Driver unable to support your firmware API. "
1250 "Driver supports v%u, firmware is v%u.\n", 1250 "Driver supports v%u, firmware is v%u.\n",
1251 api_max, api_ver); 1251 api_max, api_ver);
@@ -1253,25 +1253,25 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1253 } 1253 }
1254 1254
1255 if (api_ver != api_max) 1255 if (api_ver != api_max)
1256 IWL_ERR(priv, 1256 IL_ERR(priv,
1257 "Firmware has old API version. Expected v%u, " 1257 "Firmware has old API version. Expected v%u, "
1258 "got v%u. New firmware can be obtained " 1258 "got v%u. New firmware can be obtained "
1259 "from http://www.intellinuxwireless.org.\n", 1259 "from http://www.intellinuxwireless.org.\n",
1260 api_max, api_ver); 1260 api_max, api_ver);
1261 1261
1262 IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", 1262 IL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n",
1263 IWL_UCODE_MAJOR(priv->ucode_ver), 1263 IL_UCODE_MAJOR(priv->ucode_ver),
1264 IWL_UCODE_MINOR(priv->ucode_ver), 1264 IL_UCODE_MINOR(priv->ucode_ver),
1265 IWL_UCODE_API(priv->ucode_ver), 1265 IL_UCODE_API(priv->ucode_ver),
1266 IWL_UCODE_SERIAL(priv->ucode_ver)); 1266 IL_UCODE_SERIAL(priv->ucode_ver));
1267 1267
1268 snprintf(priv->hw->wiphy->fw_version, 1268 snprintf(priv->hw->wiphy->fw_version,
1269 sizeof(priv->hw->wiphy->fw_version), 1269 sizeof(priv->hw->wiphy->fw_version),
1270 "%u.%u.%u.%u", 1270 "%u.%u.%u.%u",
1271 IWL_UCODE_MAJOR(priv->ucode_ver), 1271 IL_UCODE_MAJOR(priv->ucode_ver),
1272 IWL_UCODE_MINOR(priv->ucode_ver), 1272 IL_UCODE_MINOR(priv->ucode_ver),
1273 IWL_UCODE_API(priv->ucode_ver), 1273 IL_UCODE_API(priv->ucode_ver),
1274 IWL_UCODE_SERIAL(priv->ucode_ver)); 1274 IL_UCODE_SERIAL(priv->ucode_ver));
1275 1275
1276 /* 1276 /*
1277 * For any of the failures below (before allocating pci memory) 1277 * For any of the failures below (before allocating pci memory)
@@ -1279,46 +1279,46 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1279 * user just got a corrupted version of the latest API. 1279 * user just got a corrupted version of the latest API.
1280 */ 1280 */
1281 1281
1282 IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", 1282 IL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n",
1283 priv->ucode_ver); 1283 priv->ucode_ver);
1284 IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %Zd\n", 1284 IL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %Zd\n",
1285 pieces.inst_size); 1285 pieces.inst_size);
1286 IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %Zd\n", 1286 IL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %Zd\n",
1287 pieces.data_size); 1287 pieces.data_size);
1288 IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %Zd\n", 1288 IL_DEBUG_INFO(priv, "f/w package hdr init inst size = %Zd\n",
1289 pieces.init_size); 1289 pieces.init_size);
1290 IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %Zd\n", 1290 IL_DEBUG_INFO(priv, "f/w package hdr init data size = %Zd\n",
1291 pieces.init_data_size); 1291 pieces.init_data_size);
1292 IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %Zd\n", 1292 IL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %Zd\n",
1293 pieces.boot_size); 1293 pieces.boot_size);
1294 1294
1295 /* Verify that uCode images will fit in card's SRAM */ 1295 /* Verify that uCode images will fit in card's SRAM */
1296 if (pieces.inst_size > priv->hw_params.max_inst_size) { 1296 if (pieces.inst_size > priv->hw_params.max_inst_size) {
1297 IWL_ERR(priv, "uCode instr len %Zd too large to fit in\n", 1297 IL_ERR(priv, "uCode instr len %Zd too large to fit in\n",
1298 pieces.inst_size); 1298 pieces.inst_size);
1299 goto try_again; 1299 goto try_again;
1300 } 1300 }
1301 1301
1302 if (pieces.data_size > priv->hw_params.max_data_size) { 1302 if (pieces.data_size > priv->hw_params.max_data_size) {
1303 IWL_ERR(priv, "uCode data len %Zd too large to fit in\n", 1303 IL_ERR(priv, "uCode data len %Zd too large to fit in\n",
1304 pieces.data_size); 1304 pieces.data_size);
1305 goto try_again; 1305 goto try_again;
1306 } 1306 }
1307 1307
1308 if (pieces.init_size > priv->hw_params.max_inst_size) { 1308 if (pieces.init_size > priv->hw_params.max_inst_size) {
1309 IWL_ERR(priv, "uCode init instr len %Zd too large to fit in\n", 1309 IL_ERR(priv, "uCode init instr len %Zd too large to fit in\n",
1310 pieces.init_size); 1310 pieces.init_size);
1311 goto try_again; 1311 goto try_again;
1312 } 1312 }
1313 1313
1314 if (pieces.init_data_size > priv->hw_params.max_data_size) { 1314 if (pieces.init_data_size > priv->hw_params.max_data_size) {
1315 IWL_ERR(priv, "uCode init data len %Zd too large to fit in\n", 1315 IL_ERR(priv, "uCode init data len %Zd too large to fit in\n",
1316 pieces.init_data_size); 1316 pieces.init_data_size);
1317 goto try_again; 1317 goto try_again;
1318 } 1318 }
1319 1319
1320 if (pieces.boot_size > priv->hw_params.max_bsm_size) { 1320 if (pieces.boot_size > priv->hw_params.max_bsm_size) {
1321 IWL_ERR(priv, "uCode boot instr len %Zd too large to fit in\n", 1321 IL_ERR(priv, "uCode boot instr len %Zd too large to fit in\n",
1322 pieces.boot_size); 1322 pieces.boot_size);
1323 goto try_again; 1323 goto try_again;
1324 } 1324 }
@@ -1329,13 +1329,13 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1329 * 1) unmodified from disk 1329 * 1) unmodified from disk
1330 * 2) backup cache for save/restore during power-downs */ 1330 * 2) backup cache for save/restore during power-downs */
1331 priv->ucode_code.len = pieces.inst_size; 1331 priv->ucode_code.len = pieces.inst_size;
1332 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); 1332 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_code);
1333 1333
1334 priv->ucode_data.len = pieces.data_size; 1334 priv->ucode_data.len = pieces.data_size;
1335 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); 1335 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data);
1336 1336
1337 priv->ucode_data_backup.len = pieces.data_size; 1337 priv->ucode_data_backup.len = pieces.data_size;
1338 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); 1338 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
1339 1339
1340 if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || 1340 if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr ||
1341 !priv->ucode_data_backup.v_addr) 1341 !priv->ucode_data_backup.v_addr)
@@ -1344,10 +1344,10 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1344 /* Initialization instructions and data */ 1344 /* Initialization instructions and data */
1345 if (pieces.init_size && pieces.init_data_size) { 1345 if (pieces.init_size && pieces.init_data_size) {
1346 priv->ucode_init.len = pieces.init_size; 1346 priv->ucode_init.len = pieces.init_size;
1347 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); 1347 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init);
1348 1348
1349 priv->ucode_init_data.len = pieces.init_data_size; 1349 priv->ucode_init_data.len = pieces.init_data_size;
1350 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); 1350 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data);
1351 1351
1352 if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) 1352 if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr)
1353 goto err_pci_alloc; 1353 goto err_pci_alloc;
@@ -1356,7 +1356,7 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1356 /* Bootstrap (instructions only, no data) */ 1356 /* Bootstrap (instructions only, no data) */
1357 if (pieces.boot_size) { 1357 if (pieces.boot_size) {
1358 priv->ucode_boot.len = pieces.boot_size; 1358 priv->ucode_boot.len = pieces.boot_size;
1359 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); 1359 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot);
1360 1360
1361 if (!priv->ucode_boot.v_addr) 1361 if (!priv->ucode_boot.v_addr)
1362 goto err_pci_alloc; 1362 goto err_pci_alloc;
@@ -1369,25 +1369,25 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1369 /* Copy images into buffers for card's bus-master reads ... */ 1369 /* Copy images into buffers for card's bus-master reads ... */
1370 1370
1371 /* Runtime instructions (first block of data in file) */ 1371 /* Runtime instructions (first block of data in file) */
1372 IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n", 1372 IL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n",
1373 pieces.inst_size); 1373 pieces.inst_size);
1374 memcpy(priv->ucode_code.v_addr, pieces.inst, pieces.inst_size); 1374 memcpy(priv->ucode_code.v_addr, pieces.inst, pieces.inst_size);
1375 1375
1376 IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", 1376 IL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n",
1377 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); 1377 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
1378 1378
1379 /* 1379 /*
1380 * Runtime data 1380 * Runtime data
1381 * NOTE: Copy into backup buffer will be done in iwl_up() 1381 * NOTE: Copy into backup buffer will be done in il_up()
1382 */ 1382 */
1383 IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n", 1383 IL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n",
1384 pieces.data_size); 1384 pieces.data_size);
1385 memcpy(priv->ucode_data.v_addr, pieces.data, pieces.data_size); 1385 memcpy(priv->ucode_data.v_addr, pieces.data, pieces.data_size);
1386 memcpy(priv->ucode_data_backup.v_addr, pieces.data, pieces.data_size); 1386 memcpy(priv->ucode_data_backup.v_addr, pieces.data, pieces.data_size);
1387 1387
1388 /* Initialization instructions */ 1388 /* Initialization instructions */
1389 if (pieces.init_size) { 1389 if (pieces.init_size) {
1390 IWL_DEBUG_INFO(priv, 1390 IL_DEBUG_INFO(priv,
1391 "Copying (but not loading) init instr len %Zd\n", 1391 "Copying (but not loading) init instr len %Zd\n",
1392 pieces.init_size); 1392 pieces.init_size);
1393 memcpy(priv->ucode_init.v_addr, pieces.init, pieces.init_size); 1393 memcpy(priv->ucode_init.v_addr, pieces.init, pieces.init_size);
@@ -1395,7 +1395,7 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1395 1395
1396 /* Initialization data */ 1396 /* Initialization data */
1397 if (pieces.init_data_size) { 1397 if (pieces.init_data_size) {
1398 IWL_DEBUG_INFO(priv, 1398 IL_DEBUG_INFO(priv,
1399 "Copying (but not loading) init data len %Zd\n", 1399 "Copying (but not loading) init data len %Zd\n",
1400 pieces.init_data_size); 1400 pieces.init_data_size);
1401 memcpy(priv->ucode_init_data.v_addr, pieces.init_data, 1401 memcpy(priv->ucode_init_data.v_addr, pieces.init_data,
@@ -1403,7 +1403,7 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1403 } 1403 }
1404 1404
1405 /* Bootstrap instructions */ 1405 /* Bootstrap instructions */
1406 IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", 1406 IL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n",
1407 pieces.boot_size); 1407 pieces.boot_size);
1408 memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size); 1408 memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size);
1409 1409
@@ -1421,19 +1421,19 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1421 * 1421 *
1422 * 9. Setup and register with mac80211 and debugfs 1422 * 9. Setup and register with mac80211 and debugfs
1423 **************************************************/ 1423 **************************************************/
1424 err = iwl4965_mac_setup_register(priv, max_probe_length); 1424 err = il4965_mac_setup_register(priv, max_probe_length);
1425 if (err) 1425 if (err)
1426 goto out_unbind; 1426 goto out_unbind;
1427 1427
1428 err = iwl_legacy_dbgfs_register(priv, DRV_NAME); 1428 err = il_dbgfs_register(priv, DRV_NAME);
1429 if (err) 1429 if (err)
1430 IWL_ERR(priv, 1430 IL_ERR(priv,
1431 "failed to create debugfs files. Ignoring error: %d\n", err); 1431 "failed to create debugfs files. Ignoring error: %d\n", err);
1432 1432
1433 err = sysfs_create_group(&priv->pci_dev->dev.kobj, 1433 err = sysfs_create_group(&priv->pci_dev->dev.kobj,
1434 &iwl_attribute_group); 1434 &il_attribute_group);
1435 if (err) { 1435 if (err) {
1436 IWL_ERR(priv, "failed to create sysfs device attributes\n"); 1436 IL_ERR(priv, "failed to create sysfs device attributes\n");
1437 goto out_unbind; 1437 goto out_unbind;
1438 } 1438 }
1439 1439
@@ -1444,14 +1444,14 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
1444 1444
1445 try_again: 1445 try_again:
1446 /* try next, if any */ 1446 /* try next, if any */
1447 if (iwl4965_request_firmware(priv, false)) 1447 if (il4965_request_firmware(priv, false))
1448 goto out_unbind; 1448 goto out_unbind;
1449 release_firmware(ucode_raw); 1449 release_firmware(ucode_raw);
1450 return; 1450 return;
1451 1451
1452 err_pci_alloc: 1452 err_pci_alloc:
1453 IWL_ERR(priv, "failed to allocate pci memory\n"); 1453 IL_ERR(priv, "failed to allocate pci memory\n");
1454 iwl4965_dealloc_ucode_pci(priv); 1454 il4965_dealloc_ucode_pci(priv);
1455 out_unbind: 1455 out_unbind:
1456 complete(&priv->_4965.firmware_loading_complete); 1456 complete(&priv->_4965.firmware_loading_complete);
1457 device_release_driver(&priv->pci_dev->dev); 1457 device_release_driver(&priv->pci_dev->dev);
@@ -1508,7 +1508,7 @@ static struct { char *name; u8 num; } advanced_lookup[] = {
1508 { "ADVANCED_SYSASSERT", 0 }, 1508 { "ADVANCED_SYSASSERT", 0 },
1509}; 1509};
1510 1510
1511static const char *iwl4965_desc_lookup(u32 num) 1511static const char *il4965_desc_lookup(u32 num)
1512{ 1512{
1513 int i; 1513 int i;
1514 int max = ARRAY_SIZE(desc_lookup_text); 1514 int max = ARRAY_SIZE(desc_lookup_text);
@@ -1527,7 +1527,7 @@ static const char *iwl4965_desc_lookup(u32 num)
1527#define ERROR_START_OFFSET (1 * sizeof(u32)) 1527#define ERROR_START_OFFSET (1 * sizeof(u32))
1528#define ERROR_ELEM_SIZE (7 * sizeof(u32)) 1528#define ERROR_ELEM_SIZE (7 * sizeof(u32))
1529 1529
1530void iwl4965_dump_nic_error_log(struct iwl_priv *priv) 1530void il4965_dump_nic_error_log(struct il_priv *priv)
1531{ 1531{
1532 u32 data2, line; 1532 u32 data2, line;
1533 u32 desc, time, count, base, data1; 1533 u32 desc, time, count, base, data1;
@@ -1541,78 +1541,78 @@ void iwl4965_dump_nic_error_log(struct iwl_priv *priv)
1541 } 1541 }
1542 1542
1543 if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) { 1543 if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
1544 IWL_ERR(priv, 1544 IL_ERR(priv,
1545 "Not valid error log pointer 0x%08X for %s uCode\n", 1545 "Not valid error log pointer 0x%08X for %s uCode\n",
1546 base, (priv->ucode_type == UCODE_INIT) ? "Init" : "RT"); 1546 base, (priv->ucode_type == UCODE_INIT) ? "Init" : "RT");
1547 return; 1547 return;
1548 } 1548 }
1549 1549
1550 count = iwl_legacy_read_targ_mem(priv, base); 1550 count = il_read_targ_mem(priv, base);
1551 1551
1552 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { 1552 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
1553 IWL_ERR(priv, "Start IWL Error Log Dump:\n"); 1553 IL_ERR(priv, "Start IWL Error Log Dump:\n");
1554 IWL_ERR(priv, "Status: 0x%08lX, count: %d\n", 1554 IL_ERR(priv, "Status: 0x%08lX, count: %d\n",
1555 priv->status, count); 1555 priv->status, count);
1556 } 1556 }
1557 1557
1558 desc = iwl_legacy_read_targ_mem(priv, base + 1 * sizeof(u32)); 1558 desc = il_read_targ_mem(priv, base + 1 * sizeof(u32));
1559 priv->isr_stats.err_code = desc; 1559 priv->isr_stats.err_code = desc;
1560 pc = iwl_legacy_read_targ_mem(priv, base + 2 * sizeof(u32)); 1560 pc = il_read_targ_mem(priv, base + 2 * sizeof(u32));
1561 blink1 = iwl_legacy_read_targ_mem(priv, base + 3 * sizeof(u32)); 1561 blink1 = il_read_targ_mem(priv, base + 3 * sizeof(u32));
1562 blink2 = iwl_legacy_read_targ_mem(priv, base + 4 * sizeof(u32)); 1562 blink2 = il_read_targ_mem(priv, base + 4 * sizeof(u32));
1563 ilink1 = iwl_legacy_read_targ_mem(priv, base + 5 * sizeof(u32)); 1563 ilink1 = il_read_targ_mem(priv, base + 5 * sizeof(u32));
1564 ilink2 = iwl_legacy_read_targ_mem(priv, base + 6 * sizeof(u32)); 1564 ilink2 = il_read_targ_mem(priv, base + 6 * sizeof(u32));
1565 data1 = iwl_legacy_read_targ_mem(priv, base + 7 * sizeof(u32)); 1565 data1 = il_read_targ_mem(priv, base + 7 * sizeof(u32));
1566 data2 = iwl_legacy_read_targ_mem(priv, base + 8 * sizeof(u32)); 1566 data2 = il_read_targ_mem(priv, base + 8 * sizeof(u32));
1567 line = iwl_legacy_read_targ_mem(priv, base + 9 * sizeof(u32)); 1567 line = il_read_targ_mem(priv, base + 9 * sizeof(u32));
1568 time = iwl_legacy_read_targ_mem(priv, base + 11 * sizeof(u32)); 1568 time = il_read_targ_mem(priv, base + 11 * sizeof(u32));
1569 hcmd = iwl_legacy_read_targ_mem(priv, base + 22 * sizeof(u32)); 1569 hcmd = il_read_targ_mem(priv, base + 22 * sizeof(u32));
1570 1570
1571 IWL_ERR(priv, "Desc Time " 1571 IL_ERR(priv, "Desc Time "
1572 "data1 data2 line\n"); 1572 "data1 data2 line\n");
1573 IWL_ERR(priv, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n", 1573 IL_ERR(priv, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n",
1574 iwl4965_desc_lookup(desc), desc, time, data1, data2, line); 1574 il4965_desc_lookup(desc), desc, time, data1, data2, line);
1575 IWL_ERR(priv, "pc blink1 blink2 ilink1 ilink2 hcmd\n"); 1575 IL_ERR(priv, "pc blink1 blink2 ilink1 ilink2 hcmd\n");
1576 IWL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n", 1576 IL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n",
1577 pc, blink1, blink2, ilink1, ilink2, hcmd); 1577 pc, blink1, blink2, ilink1, ilink2, hcmd);
1578} 1578}
1579 1579
1580static void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) 1580static void il4965_rf_kill_ct_config(struct il_priv *priv)
1581{ 1581{
1582 struct iwl_ct_kill_config cmd; 1582 struct il_ct_kill_config cmd;
1583 unsigned long flags; 1583 unsigned long flags;
1584 int ret = 0; 1584 int ret = 0;
1585 1585
1586 spin_lock_irqsave(&priv->lock, flags); 1586 spin_lock_irqsave(&priv->lock, flags);
1587 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 1587 il_write32(priv, CSR_UCODE_DRV_GP1_CLR,
1588 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); 1588 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
1589 spin_unlock_irqrestore(&priv->lock, flags); 1589 spin_unlock_irqrestore(&priv->lock, flags);
1590 1590
1591 cmd.critical_temperature_R = 1591 cmd.critical_temperature_R =
1592 cpu_to_le32(priv->hw_params.ct_kill_threshold); 1592 cpu_to_le32(priv->hw_params.ct_kill_threshold);
1593 1593
1594 ret = iwl_legacy_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD, 1594 ret = il_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD,
1595 sizeof(cmd), &cmd); 1595 sizeof(cmd), &cmd);
1596 if (ret) 1596 if (ret)
1597 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); 1597 IL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
1598 else 1598 else
1599 IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD " 1599 IL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD "
1600 "succeeded, " 1600 "succeeded, "
1601 "critical temperature is %d\n", 1601 "critical temperature is %d\n",
1602 priv->hw_params.ct_kill_threshold); 1602 priv->hw_params.ct_kill_threshold);
1603} 1603}
1604 1604
1605static const s8 default_queue_to_tx_fifo[] = { 1605static const s8 default_queue_to_tx_fifo[] = {
1606 IWL_TX_FIFO_VO, 1606 IL_TX_FIFO_VO,
1607 IWL_TX_FIFO_VI, 1607 IL_TX_FIFO_VI,
1608 IWL_TX_FIFO_BE, 1608 IL_TX_FIFO_BE,
1609 IWL_TX_FIFO_BK, 1609 IL_TX_FIFO_BK,
1610 IWL49_CMD_FIFO_NUM, 1610 IWL49_CMD_FIFO_NUM,
1611 IWL_TX_FIFO_UNUSED, 1611 IL_TX_FIFO_UNUSED,
1612 IWL_TX_FIFO_UNUSED, 1612 IL_TX_FIFO_UNUSED,
1613}; 1613};
1614 1614
1615static int iwl4965_alive_notify(struct iwl_priv *priv) 1615static int il4965_alive_notify(struct il_priv *priv)
1616{ 1616{
1617 u32 a; 1617 u32 a;
1618 unsigned long flags; 1618 unsigned long flags;
@@ -1622,52 +1622,52 @@ static int iwl4965_alive_notify(struct iwl_priv *priv)
1622 spin_lock_irqsave(&priv->lock, flags); 1622 spin_lock_irqsave(&priv->lock, flags);
1623 1623
1624 /* Clear 4965's internal Tx Scheduler data base */ 1624 /* Clear 4965's internal Tx Scheduler data base */
1625 priv->scd_base_addr = iwl_legacy_read_prph(priv, 1625 priv->scd_base_addr = il_read_prph(priv,
1626 IWL49_SCD_SRAM_BASE_ADDR); 1626 IWL49_SCD_SRAM_BASE_ADDR);
1627 a = priv->scd_base_addr + IWL49_SCD_CONTEXT_DATA_OFFSET; 1627 a = priv->scd_base_addr + IWL49_SCD_CONTEXT_DATA_OFFSET;
1628 for (; a < priv->scd_base_addr + IWL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4) 1628 for (; a < priv->scd_base_addr + IWL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4)
1629 iwl_legacy_write_targ_mem(priv, a, 0); 1629 il_write_targ_mem(priv, a, 0);
1630 for (; a < priv->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET; a += 4) 1630 for (; a < priv->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET; a += 4)
1631 iwl_legacy_write_targ_mem(priv, a, 0); 1631 il_write_targ_mem(priv, a, 0);
1632 for (; a < priv->scd_base_addr + 1632 for (; a < priv->scd_base_addr +
1633 IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4) 1633 IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4)
1634 iwl_legacy_write_targ_mem(priv, a, 0); 1634 il_write_targ_mem(priv, a, 0);
1635 1635
1636 /* Tel 4965 where to find Tx byte count tables */ 1636 /* Tel 4965 where to find Tx byte count tables */
1637 iwl_legacy_write_prph(priv, IWL49_SCD_DRAM_BASE_ADDR, 1637 il_write_prph(priv, IWL49_SCD_DRAM_BASE_ADDR,
1638 priv->scd_bc_tbls.dma >> 10); 1638 priv->scd_bc_tbls.dma >> 10);
1639 1639
1640 /* Enable DMA channel */ 1640 /* Enable DMA channel */
1641 for (chan = 0; chan < FH49_TCSR_CHNL_NUM ; chan++) 1641 for (chan = 0; chan < FH49_TCSR_CHNL_NUM ; chan++)
1642 iwl_legacy_write_direct32(priv, 1642 il_write_direct32(priv,
1643 FH_TCSR_CHNL_TX_CONFIG_REG(chan), 1643 FH_TCSR_CHNL_TX_CONFIG_REG(chan),
1644 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | 1644 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
1645 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE); 1645 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE);
1646 1646
1647 /* Update FH chicken bits */ 1647 /* Update FH chicken bits */
1648 reg_val = iwl_legacy_read_direct32(priv, FH_TX_CHICKEN_BITS_REG); 1648 reg_val = il_read_direct32(priv, FH_TX_CHICKEN_BITS_REG);
1649 iwl_legacy_write_direct32(priv, FH_TX_CHICKEN_BITS_REG, 1649 il_write_direct32(priv, FH_TX_CHICKEN_BITS_REG,
1650 reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); 1650 reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
1651 1651
1652 /* Disable chain mode for all queues */ 1652 /* Disable chain mode for all queues */
1653 iwl_legacy_write_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, 0); 1653 il_write_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, 0);
1654 1654
1655 /* Initialize each Tx queue (including the command queue) */ 1655 /* Initialize each Tx queue (including the command queue) */
1656 for (i = 0; i < priv->hw_params.max_txq_num; i++) { 1656 for (i = 0; i < priv->hw_params.max_txq_num; i++) {
1657 1657
1658 /* TFD circular buffer read/write indexes */ 1658 /* TFD circular buffer read/write indexes */
1659 iwl_legacy_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(i), 0); 1659 il_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(i), 0);
1660 iwl_legacy_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); 1660 il_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8));
1661 1661
1662 /* Max Tx Window size for Scheduler-ACK mode */ 1662 /* Max Tx Window size for Scheduler-ACK mode */
1663 iwl_legacy_write_targ_mem(priv, priv->scd_base_addr + 1663 il_write_targ_mem(priv, priv->scd_base_addr +
1664 IWL49_SCD_CONTEXT_QUEUE_OFFSET(i), 1664 IWL49_SCD_CONTEXT_QUEUE_OFFSET(i),
1665 (SCD_WIN_SIZE << 1665 (SCD_WIN_SIZE <<
1666 IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & 1666 IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) &
1667 IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); 1667 IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK);
1668 1668
1669 /* Frame limit */ 1669 /* Frame limit */
1670 iwl_legacy_write_targ_mem(priv, priv->scd_base_addr + 1670 il_write_targ_mem(priv, priv->scd_base_addr +
1671 IWL49_SCD_CONTEXT_QUEUE_OFFSET(i) + 1671 IWL49_SCD_CONTEXT_QUEUE_OFFSET(i) +
1672 sizeof(u32), 1672 sizeof(u32),
1673 (SCD_FRAME_LIMIT << 1673 (SCD_FRAME_LIMIT <<
@@ -1675,13 +1675,13 @@ static int iwl4965_alive_notify(struct iwl_priv *priv)
1675 IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); 1675 IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK);
1676 1676
1677 } 1677 }
1678 iwl_legacy_write_prph(priv, IWL49_SCD_INTERRUPT_MASK, 1678 il_write_prph(priv, IWL49_SCD_INTERRUPT_MASK,
1679 (1 << priv->hw_params.max_txq_num) - 1); 1679 (1 << priv->hw_params.max_txq_num) - 1);
1680 1680
1681 /* Activate all Tx DMA/FIFO channels */ 1681 /* Activate all Tx DMA/FIFO channels */
1682 iwl4965_txq_set_sched(priv, IWL_MASK(0, 6)); 1682 il4965_txq_set_sched(priv, IL_MASK(0, 6));
1683 1683
1684 iwl4965_set_wr_ptrs(priv, IWL_DEFAULT_CMD_QUEUE_NUM, 0); 1684 il4965_set_wr_ptrs(priv, IL_DEFAULT_CMD_QUEUE_NUM, 0);
1685 1685
1686 /* make sure all queue are not stopped */ 1686 /* make sure all queue are not stopped */
1687 memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped)); 1687 memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped));
@@ -1696,12 +1696,12 @@ static int iwl4965_alive_notify(struct iwl_priv *priv)
1696 for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) { 1696 for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) {
1697 int ac = default_queue_to_tx_fifo[i]; 1697 int ac = default_queue_to_tx_fifo[i];
1698 1698
1699 iwl_txq_ctx_activate(priv, i); 1699 il_txq_ctx_activate(priv, i);
1700 1700
1701 if (ac == IWL_TX_FIFO_UNUSED) 1701 if (ac == IL_TX_FIFO_UNUSED)
1702 continue; 1702 continue;
1703 1703
1704 iwl4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0); 1704 il4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0);
1705 } 1705 }
1706 1706
1707 spin_unlock_irqrestore(&priv->lock, flags); 1707 spin_unlock_irqrestore(&priv->lock, flags);
@@ -1710,37 +1710,37 @@ static int iwl4965_alive_notify(struct iwl_priv *priv)
1710} 1710}
1711 1711
1712/** 1712/**
1713 * iwl4965_alive_start - called after REPLY_ALIVE notification received 1713 * il4965_alive_start - called after REPLY_ALIVE notification received
1714 * from protocol/runtime uCode (initialization uCode's 1714 * from protocol/runtime uCode (initialization uCode's
1715 * Alive gets handled by iwl_init_alive_start()). 1715 * Alive gets handled by il_init_alive_start()).
1716 */ 1716 */
1717static void iwl4965_alive_start(struct iwl_priv *priv) 1717static void il4965_alive_start(struct il_priv *priv)
1718{ 1718{
1719 int ret = 0; 1719 int ret = 0;
1720 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1720 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
1721 1721
1722 IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); 1722 IL_DEBUG_INFO(priv, "Runtime Alive received.\n");
1723 1723
1724 if (priv->card_alive.is_valid != UCODE_VALID_OK) { 1724 if (priv->card_alive.is_valid != UCODE_VALID_OK) {
1725 /* We had an error bringing up the hardware, so take it 1725 /* We had an error bringing up the hardware, so take it
1726 * all the way back down so we can try again */ 1726 * all the way back down so we can try again */
1727 IWL_DEBUG_INFO(priv, "Alive failed.\n"); 1727 IL_DEBUG_INFO(priv, "Alive failed.\n");
1728 goto restart; 1728 goto restart;
1729 } 1729 }
1730 1730
1731 /* Initialize uCode has loaded Runtime uCode ... verify inst image. 1731 /* Initialize uCode has loaded Runtime uCode ... verify inst image.
1732 * This is a paranoid check, because we would not have gotten the 1732 * This is a paranoid check, because we would not have gotten the
1733 * "runtime" alive if code weren't properly loaded. */ 1733 * "runtime" alive if code weren't properly loaded. */
1734 if (iwl4965_verify_ucode(priv)) { 1734 if (il4965_verify_ucode(priv)) {
1735 /* Runtime instruction load was bad; 1735 /* Runtime instruction load was bad;
1736 * take it all the way back down so we can try again */ 1736 * take it all the way back down so we can try again */
1737 IWL_DEBUG_INFO(priv, "Bad runtime uCode load.\n"); 1737 IL_DEBUG_INFO(priv, "Bad runtime uCode load.\n");
1738 goto restart; 1738 goto restart;
1739 } 1739 }
1740 1740
1741 ret = iwl4965_alive_notify(priv); 1741 ret = il4965_alive_notify(priv);
1742 if (ret) { 1742 if (ret) {
1743 IWL_WARN(priv, 1743 IL_WARN(priv,
1744 "Could not complete ALIVE transition [ntf]: %d\n", ret); 1744 "Could not complete ALIVE transition [ntf]: %d\n", ret);
1745 goto restart; 1745 goto restart;
1746 } 1746 }
@@ -1750,49 +1750,49 @@ static void iwl4965_alive_start(struct iwl_priv *priv)
1750 set_bit(STATUS_ALIVE, &priv->status); 1750 set_bit(STATUS_ALIVE, &priv->status);
1751 1751
1752 /* Enable watchdog to monitor the driver tx queues */ 1752 /* Enable watchdog to monitor the driver tx queues */
1753 iwl_legacy_setup_watchdog(priv); 1753 il_setup_watchdog(priv);
1754 1754
1755 if (iwl_legacy_is_rfkill(priv)) 1755 if (il_is_rfkill(priv))
1756 return; 1756 return;
1757 1757
1758 ieee80211_wake_queues(priv->hw); 1758 ieee80211_wake_queues(priv->hw);
1759 1759
1760 priv->active_rate = IWL_RATES_MASK; 1760 priv->active_rate = IL_RATES_MASK;
1761 1761
1762 if (iwl_legacy_is_associated_ctx(ctx)) { 1762 if (il_is_associated_ctx(ctx)) {
1763 struct iwl_legacy_rxon_cmd *active_rxon = 1763 struct il_rxon_cmd *active_rxon =
1764 (struct iwl_legacy_rxon_cmd *)&ctx->active; 1764 (struct il_rxon_cmd *)&ctx->active;
1765 /* apply any changes in staging */ 1765 /* apply any changes in staging */
1766 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 1766 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
1767 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1767 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1768 } else { 1768 } else {
1769 struct iwl_rxon_context *tmp; 1769 struct il_rxon_context *tmp;
1770 /* Initialize our rx_config data */ 1770 /* Initialize our rx_config data */
1771 for_each_context(priv, tmp) 1771 for_each_context(priv, tmp)
1772 iwl_legacy_connection_init_rx_config(priv, tmp); 1772 il_connection_init_rx_config(priv, tmp);
1773 1773
1774 if (priv->cfg->ops->hcmd->set_rxon_chain) 1774 if (priv->cfg->ops->hcmd->set_rxon_chain)
1775 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); 1775 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
1776 } 1776 }
1777 1777
1778 /* Configure bluetooth coexistence if enabled */ 1778 /* Configure bluetooth coexistence if enabled */
1779 iwl_legacy_send_bt_config(priv); 1779 il_send_bt_config(priv);
1780 1780
1781 iwl4965_reset_run_time_calib(priv); 1781 il4965_reset_run_time_calib(priv);
1782 1782
1783 set_bit(STATUS_READY, &priv->status); 1783 set_bit(STATUS_READY, &priv->status);
1784 1784
1785 /* Configure the adapter for unassociated operation */ 1785 /* Configure the adapter for unassociated operation */
1786 iwl_legacy_commit_rxon(priv, ctx); 1786 il_commit_rxon(priv, ctx);
1787 1787
1788 /* At this point, the NIC is initialized and operational */ 1788 /* At this point, the NIC is initialized and operational */
1789 iwl4965_rf_kill_ct_config(priv); 1789 il4965_rf_kill_ct_config(priv);
1790 1790
1791 IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); 1791 IL_DEBUG_INFO(priv, "ALIVE processing complete.\n");
1792 wake_up(&priv->wait_command_queue); 1792 wake_up(&priv->wait_command_queue);
1793 1793
1794 iwl_legacy_power_update_mode(priv, true); 1794 il_power_update_mode(priv, true);
1795 IWL_DEBUG_INFO(priv, "Updated power mode\n"); 1795 IL_DEBUG_INFO(priv, "Updated power mode\n");
1796 1796
1797 return; 1797 return;
1798 1798
@@ -1800,16 +1800,16 @@ static void iwl4965_alive_start(struct iwl_priv *priv)
1800 queue_work(priv->workqueue, &priv->restart); 1800 queue_work(priv->workqueue, &priv->restart);
1801} 1801}
1802 1802
1803static void iwl4965_cancel_deferred_work(struct iwl_priv *priv); 1803static void il4965_cancel_deferred_work(struct il_priv *priv);
1804 1804
1805static void __iwl4965_down(struct iwl_priv *priv) 1805static void __il4965_down(struct il_priv *priv)
1806{ 1806{
1807 unsigned long flags; 1807 unsigned long flags;
1808 int exit_pending; 1808 int exit_pending;
1809 1809
1810 IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); 1810 IL_DEBUG_INFO(priv, DRV_NAME " is going down\n");
1811 1811
1812 iwl_legacy_scan_cancel_timeout(priv, 200); 1812 il_scan_cancel_timeout(priv, 200);
1813 1813
1814 exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); 1814 exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);
1815 1815
@@ -1817,9 +1817,9 @@ static void __iwl4965_down(struct iwl_priv *priv)
1817 * to prevent rearm timer */ 1817 * to prevent rearm timer */
1818 del_timer_sync(&priv->watchdog); 1818 del_timer_sync(&priv->watchdog);
1819 1819
1820 iwl_legacy_clear_ucode_stations(priv, NULL); 1820 il_clear_ucode_stations(priv, NULL);
1821 iwl_legacy_dealloc_bcast_stations(priv); 1821 il_dealloc_bcast_stations(priv);
1822 iwl_legacy_clear_driver_stations(priv); 1822 il_clear_driver_stations(priv);
1823 1823
1824 /* Unblock any waiting calls */ 1824 /* Unblock any waiting calls */
1825 wake_up_all(&priv->wait_command_queue); 1825 wake_up_all(&priv->wait_command_queue);
@@ -1830,20 +1830,20 @@ static void __iwl4965_down(struct iwl_priv *priv)
1830 clear_bit(STATUS_EXIT_PENDING, &priv->status); 1830 clear_bit(STATUS_EXIT_PENDING, &priv->status);
1831 1831
1832 /* stop and reset the on-board processor */ 1832 /* stop and reset the on-board processor */
1833 iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 1833 il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
1834 1834
1835 /* tell the device to stop sending interrupts */ 1835 /* tell the device to stop sending interrupts */
1836 spin_lock_irqsave(&priv->lock, flags); 1836 spin_lock_irqsave(&priv->lock, flags);
1837 iwl_legacy_disable_interrupts(priv); 1837 il_disable_interrupts(priv);
1838 spin_unlock_irqrestore(&priv->lock, flags); 1838 spin_unlock_irqrestore(&priv->lock, flags);
1839 iwl4965_synchronize_irq(priv); 1839 il4965_synchronize_irq(priv);
1840 1840
1841 if (priv->mac80211_registered) 1841 if (priv->mac80211_registered)
1842 ieee80211_stop_queues(priv->hw); 1842 ieee80211_stop_queues(priv->hw);
1843 1843
1844 /* If we have not previously called iwl_init() then 1844 /* If we have not previously called il_init() then
1845 * clear all bits but the RF Kill bit and return */ 1845 * clear all bits but the RF Kill bit and return */
1846 if (!iwl_legacy_is_init(priv)) { 1846 if (!il_is_init(priv)) {
1847 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 1847 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
1848 STATUS_RF_KILL_HW | 1848 STATUS_RF_KILL_HW |
1849 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 1849 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
@@ -1864,50 +1864,50 @@ static void __iwl4965_down(struct iwl_priv *priv)
1864 test_bit(STATUS_EXIT_PENDING, &priv->status) << 1864 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
1865 STATUS_EXIT_PENDING; 1865 STATUS_EXIT_PENDING;
1866 1866
1867 iwl4965_txq_ctx_stop(priv); 1867 il4965_txq_ctx_stop(priv);
1868 iwl4965_rxq_stop(priv); 1868 il4965_rxq_stop(priv);
1869 1869
1870 /* Power-down device's busmaster DMA clocks */ 1870 /* Power-down device's busmaster DMA clocks */
1871 iwl_legacy_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); 1871 il_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT);
1872 udelay(5); 1872 udelay(5);
1873 1873
1874 /* Make sure (redundant) we've released our request to stay awake */ 1874 /* Make sure (redundant) we've released our request to stay awake */
1875 iwl_legacy_clear_bit(priv, CSR_GP_CNTRL, 1875 il_clear_bit(priv, CSR_GP_CNTRL,
1876 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 1876 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
1877 1877
1878 /* Stop the device, and put it in low power state */ 1878 /* Stop the device, and put it in low power state */
1879 iwl_legacy_apm_stop(priv); 1879 il_apm_stop(priv);
1880 1880
1881 exit: 1881 exit:
1882 memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); 1882 memset(&priv->card_alive, 0, sizeof(struct il_alive_resp));
1883 1883
1884 dev_kfree_skb(priv->beacon_skb); 1884 dev_kfree_skb(priv->beacon_skb);
1885 priv->beacon_skb = NULL; 1885 priv->beacon_skb = NULL;
1886 1886
1887 /* clear out any free frames */ 1887 /* clear out any free frames */
1888 iwl4965_clear_free_frames(priv); 1888 il4965_clear_free_frames(priv);
1889} 1889}
1890 1890
1891static void iwl4965_down(struct iwl_priv *priv) 1891static void il4965_down(struct il_priv *priv)
1892{ 1892{
1893 mutex_lock(&priv->mutex); 1893 mutex_lock(&priv->mutex);
1894 __iwl4965_down(priv); 1894 __il4965_down(priv);
1895 mutex_unlock(&priv->mutex); 1895 mutex_unlock(&priv->mutex);
1896 1896
1897 iwl4965_cancel_deferred_work(priv); 1897 il4965_cancel_deferred_work(priv);
1898} 1898}
1899 1899
1900#define HW_READY_TIMEOUT (50) 1900#define HW_READY_TIMEOUT (50)
1901 1901
1902static int iwl4965_set_hw_ready(struct iwl_priv *priv) 1902static int il4965_set_hw_ready(struct il_priv *priv)
1903{ 1903{
1904 int ret = 0; 1904 int ret = 0;
1905 1905
1906 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 1906 il_set_bit(priv, CSR_HW_IF_CONFIG_REG,
1907 CSR_HW_IF_CONFIG_REG_BIT_NIC_READY); 1907 CSR_HW_IF_CONFIG_REG_BIT_NIC_READY);
1908 1908
1909 /* See if we got it */ 1909 /* See if we got it */
1910 ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG, 1910 ret = il_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
1911 CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, 1911 CSR_HW_IF_CONFIG_REG_BIT_NIC_READY,
1912 CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, 1912 CSR_HW_IF_CONFIG_REG_BIT_NIC_READY,
1913 HW_READY_TIMEOUT); 1913 HW_READY_TIMEOUT);
@@ -1916,107 +1916,107 @@ static int iwl4965_set_hw_ready(struct iwl_priv *priv)
1916 else 1916 else
1917 priv->hw_ready = false; 1917 priv->hw_ready = false;
1918 1918
1919 IWL_DEBUG_INFO(priv, "hardware %s\n", 1919 IL_DEBUG_INFO(priv, "hardware %s\n",
1920 (priv->hw_ready == 1) ? "ready" : "not ready"); 1920 (priv->hw_ready == 1) ? "ready" : "not ready");
1921 return ret; 1921 return ret;
1922} 1922}
1923 1923
1924static int iwl4965_prepare_card_hw(struct iwl_priv *priv) 1924static int il4965_prepare_card_hw(struct il_priv *priv)
1925{ 1925{
1926 int ret = 0; 1926 int ret = 0;
1927 1927
1928 IWL_DEBUG_INFO(priv, "iwl4965_prepare_card_hw enter\n"); 1928 IL_DEBUG_INFO(priv, "il4965_prepare_card_hw enter\n");
1929 1929
1930 ret = iwl4965_set_hw_ready(priv); 1930 ret = il4965_set_hw_ready(priv);
1931 if (priv->hw_ready) 1931 if (priv->hw_ready)
1932 return ret; 1932 return ret;
1933 1933
1934 /* If HW is not ready, prepare the conditions to check again */ 1934 /* If HW is not ready, prepare the conditions to check again */
1935 iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, 1935 il_set_bit(priv, CSR_HW_IF_CONFIG_REG,
1936 CSR_HW_IF_CONFIG_REG_PREPARE); 1936 CSR_HW_IF_CONFIG_REG_PREPARE);
1937 1937
1938 ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG, 1938 ret = il_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
1939 ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 1939 ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE,
1940 CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000); 1940 CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000);
1941 1941
1942 /* HW should be ready by now, check again. */ 1942 /* HW should be ready by now, check again. */
1943 if (ret != -ETIMEDOUT) 1943 if (ret != -ETIMEDOUT)
1944 iwl4965_set_hw_ready(priv); 1944 il4965_set_hw_ready(priv);
1945 1945
1946 return ret; 1946 return ret;
1947} 1947}
1948 1948
1949#define MAX_HW_RESTARTS 5 1949#define MAX_HW_RESTARTS 5
1950 1950
1951static int __iwl4965_up(struct iwl_priv *priv) 1951static int __il4965_up(struct il_priv *priv)
1952{ 1952{
1953 struct iwl_rxon_context *ctx; 1953 struct il_rxon_context *ctx;
1954 int i; 1954 int i;
1955 int ret; 1955 int ret;
1956 1956
1957 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { 1957 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
1958 IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); 1958 IL_WARN(priv, "Exit pending; will not bring the NIC up\n");
1959 return -EIO; 1959 return -EIO;
1960 } 1960 }
1961 1961
1962 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { 1962 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
1963 IWL_ERR(priv, "ucode not available for device bringup\n"); 1963 IL_ERR(priv, "ucode not available for device bringup\n");
1964 return -EIO; 1964 return -EIO;
1965 } 1965 }
1966 1966
1967 for_each_context(priv, ctx) { 1967 for_each_context(priv, ctx) {
1968 ret = iwl4965_alloc_bcast_station(priv, ctx); 1968 ret = il4965_alloc_bcast_station(priv, ctx);
1969 if (ret) { 1969 if (ret) {
1970 iwl_legacy_dealloc_bcast_stations(priv); 1970 il_dealloc_bcast_stations(priv);
1971 return ret; 1971 return ret;
1972 } 1972 }
1973 } 1973 }
1974 1974
1975 iwl4965_prepare_card_hw(priv); 1975 il4965_prepare_card_hw(priv);
1976 1976
1977 if (!priv->hw_ready) { 1977 if (!priv->hw_ready) {
1978 IWL_WARN(priv, "Exit HW not ready\n"); 1978 IL_WARN(priv, "Exit HW not ready\n");
1979 return -EIO; 1979 return -EIO;
1980 } 1980 }
1981 1981
1982 /* If platform's RF_KILL switch is NOT set to KILL */ 1982 /* If platform's RF_KILL switch is NOT set to KILL */
1983 if (iwl_read32(priv, 1983 if (il_read32(priv,
1984 CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 1984 CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
1985 clear_bit(STATUS_RF_KILL_HW, &priv->status); 1985 clear_bit(STATUS_RF_KILL_HW, &priv->status);
1986 else 1986 else
1987 set_bit(STATUS_RF_KILL_HW, &priv->status); 1987 set_bit(STATUS_RF_KILL_HW, &priv->status);
1988 1988
1989 if (iwl_legacy_is_rfkill(priv)) { 1989 if (il_is_rfkill(priv)) {
1990 wiphy_rfkill_set_hw_state(priv->hw->wiphy, true); 1990 wiphy_rfkill_set_hw_state(priv->hw->wiphy, true);
1991 1991
1992 iwl_legacy_enable_interrupts(priv); 1992 il_enable_interrupts(priv);
1993 IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); 1993 IL_WARN(priv, "Radio disabled by HW RF Kill switch\n");
1994 return 0; 1994 return 0;
1995 } 1995 }
1996 1996
1997 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 1997 il_write32(priv, CSR_INT, 0xFFFFFFFF);
1998 1998
1999 /* must be initialised before iwl_hw_nic_init */ 1999 /* must be initialised before il_hw_nic_init */
2000 priv->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM; 2000 priv->cmd_queue = IL_DEFAULT_CMD_QUEUE_NUM;
2001 2001
2002 ret = iwl4965_hw_nic_init(priv); 2002 ret = il4965_hw_nic_init(priv);
2003 if (ret) { 2003 if (ret) {
2004 IWL_ERR(priv, "Unable to init nic\n"); 2004 IL_ERR(priv, "Unable to init nic\n");
2005 return ret; 2005 return ret;
2006 } 2006 }
2007 2007
2008 /* make sure rfkill handshake bits are cleared */ 2008 /* make sure rfkill handshake bits are cleared */
2009 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2009 il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2010 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 2010 il_write32(priv, CSR_UCODE_DRV_GP1_CLR,
2011 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 2011 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
2012 2012
2013 /* clear (again), then enable host interrupts */ 2013 /* clear (again), then enable host interrupts */
2014 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 2014 il_write32(priv, CSR_INT, 0xFFFFFFFF);
2015 iwl_legacy_enable_interrupts(priv); 2015 il_enable_interrupts(priv);
2016 2016
2017 /* really make sure rfkill handshake bits are cleared */ 2017 /* really make sure rfkill handshake bits are cleared */
2018 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2018 il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2019 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2019 il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2020 2020
2021 /* Copy original ucode data image from disk into backup cache. 2021 /* Copy original ucode data image from disk into backup cache.
2022 * This will be used to initialize the on-board processor's 2022 * This will be used to initialize the on-board processor's
@@ -2032,26 +2032,26 @@ static int __iwl4965_up(struct iwl_priv *priv)
2032 ret = priv->cfg->ops->lib->load_ucode(priv); 2032 ret = priv->cfg->ops->lib->load_ucode(priv);
2033 2033
2034 if (ret) { 2034 if (ret) {
2035 IWL_ERR(priv, "Unable to set up bootstrap uCode: %d\n", 2035 IL_ERR(priv, "Unable to set up bootstrap uCode: %d\n",
2036 ret); 2036 ret);
2037 continue; 2037 continue;
2038 } 2038 }
2039 2039
2040 /* start card; "initialize" will load runtime ucode */ 2040 /* start card; "initialize" will load runtime ucode */
2041 iwl4965_nic_start(priv); 2041 il4965_nic_start(priv);
2042 2042
2043 IWL_DEBUG_INFO(priv, DRV_NAME " is coming up\n"); 2043 IL_DEBUG_INFO(priv, DRV_NAME " is coming up\n");
2044 2044
2045 return 0; 2045 return 0;
2046 } 2046 }
2047 2047
2048 set_bit(STATUS_EXIT_PENDING, &priv->status); 2048 set_bit(STATUS_EXIT_PENDING, &priv->status);
2049 __iwl4965_down(priv); 2049 __il4965_down(priv);
2050 clear_bit(STATUS_EXIT_PENDING, &priv->status); 2050 clear_bit(STATUS_EXIT_PENDING, &priv->status);
2051 2051
2052 /* tried to restart and config the device for as long as our 2052 /* tried to restart and config the device for as long as our
2053 * patience could withstand */ 2053 * patience could withstand */
2054 IWL_ERR(priv, "Unable to initialize device after %d attempts.\n", i); 2054 IL_ERR(priv, "Unable to initialize device after %d attempts.\n", i);
2055 return -EIO; 2055 return -EIO;
2056} 2056}
2057 2057
@@ -2062,10 +2062,10 @@ static int __iwl4965_up(struct iwl_priv *priv)
2062 * 2062 *
2063 *****************************************************************************/ 2063 *****************************************************************************/
2064 2064
2065static void iwl4965_bg_init_alive_start(struct work_struct *data) 2065static void il4965_bg_init_alive_start(struct work_struct *data)
2066{ 2066{
2067 struct iwl_priv *priv = 2067 struct il_priv *priv =
2068 container_of(data, struct iwl_priv, init_alive_start.work); 2068 container_of(data, struct il_priv, init_alive_start.work);
2069 2069
2070 mutex_lock(&priv->mutex); 2070 mutex_lock(&priv->mutex);
2071 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2071 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
@@ -2076,23 +2076,23 @@ out:
2076 mutex_unlock(&priv->mutex); 2076 mutex_unlock(&priv->mutex);
2077} 2077}
2078 2078
2079static void iwl4965_bg_alive_start(struct work_struct *data) 2079static void il4965_bg_alive_start(struct work_struct *data)
2080{ 2080{
2081 struct iwl_priv *priv = 2081 struct il_priv *priv =
2082 container_of(data, struct iwl_priv, alive_start.work); 2082 container_of(data, struct il_priv, alive_start.work);
2083 2083
2084 mutex_lock(&priv->mutex); 2084 mutex_lock(&priv->mutex);
2085 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2085 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2086 goto out; 2086 goto out;
2087 2087
2088 iwl4965_alive_start(priv); 2088 il4965_alive_start(priv);
2089out: 2089out:
2090 mutex_unlock(&priv->mutex); 2090 mutex_unlock(&priv->mutex);
2091} 2091}
2092 2092
2093static void iwl4965_bg_run_time_calib_work(struct work_struct *work) 2093static void il4965_bg_run_time_calib_work(struct work_struct *work)
2094{ 2094{
2095 struct iwl_priv *priv = container_of(work, struct iwl_priv, 2095 struct il_priv *priv = container_of(work, struct il_priv,
2096 run_time_calib_work); 2096 run_time_calib_work);
2097 2097
2098 mutex_lock(&priv->mutex); 2098 mutex_lock(&priv->mutex);
@@ -2104,37 +2104,37 @@ static void iwl4965_bg_run_time_calib_work(struct work_struct *work)
2104 } 2104 }
2105 2105
2106 if (priv->start_calib) { 2106 if (priv->start_calib) {
2107 iwl4965_chain_noise_calibration(priv, 2107 il4965_chain_noise_calibration(priv,
2108 (void *)&priv->_4965.statistics); 2108 (void *)&priv->_4965.statistics);
2109 iwl4965_sensitivity_calibration(priv, 2109 il4965_sensitivity_calibration(priv,
2110 (void *)&priv->_4965.statistics); 2110 (void *)&priv->_4965.statistics);
2111 } 2111 }
2112 2112
2113 mutex_unlock(&priv->mutex); 2113 mutex_unlock(&priv->mutex);
2114} 2114}
2115 2115
2116static void iwl4965_bg_restart(struct work_struct *data) 2116static void il4965_bg_restart(struct work_struct *data)
2117{ 2117{
2118 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); 2118 struct il_priv *priv = container_of(data, struct il_priv, restart);
2119 2119
2120 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2120 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2121 return; 2121 return;
2122 2122
2123 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { 2123 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
2124 struct iwl_rxon_context *ctx; 2124 struct il_rxon_context *ctx;
2125 2125
2126 mutex_lock(&priv->mutex); 2126 mutex_lock(&priv->mutex);
2127 for_each_context(priv, ctx) 2127 for_each_context(priv, ctx)
2128 ctx->vif = NULL; 2128 ctx->vif = NULL;
2129 priv->is_open = 0; 2129 priv->is_open = 0;
2130 2130
2131 __iwl4965_down(priv); 2131 __il4965_down(priv);
2132 2132
2133 mutex_unlock(&priv->mutex); 2133 mutex_unlock(&priv->mutex);
2134 iwl4965_cancel_deferred_work(priv); 2134 il4965_cancel_deferred_work(priv);
2135 ieee80211_restart_hw(priv->hw); 2135 ieee80211_restart_hw(priv->hw);
2136 } else { 2136 } else {
2137 iwl4965_down(priv); 2137 il4965_down(priv);
2138 2138
2139 mutex_lock(&priv->mutex); 2139 mutex_lock(&priv->mutex);
2140 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { 2140 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
@@ -2142,21 +2142,21 @@ static void iwl4965_bg_restart(struct work_struct *data)
2142 return; 2142 return;
2143 } 2143 }
2144 2144
2145 __iwl4965_up(priv); 2145 __il4965_up(priv);
2146 mutex_unlock(&priv->mutex); 2146 mutex_unlock(&priv->mutex);
2147 } 2147 }
2148} 2148}
2149 2149
2150static void iwl4965_bg_rx_replenish(struct work_struct *data) 2150static void il4965_bg_rx_replenish(struct work_struct *data)
2151{ 2151{
2152 struct iwl_priv *priv = 2152 struct il_priv *priv =
2153 container_of(data, struct iwl_priv, rx_replenish); 2153 container_of(data, struct il_priv, rx_replenish);
2154 2154
2155 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2155 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2156 return; 2156 return;
2157 2157
2158 mutex_lock(&priv->mutex); 2158 mutex_lock(&priv->mutex);
2159 iwl4965_rx_replenish(priv); 2159 il4965_rx_replenish(priv);
2160 mutex_unlock(&priv->mutex); 2160 mutex_unlock(&priv->mutex);
2161} 2161}
2162 2162
@@ -2172,12 +2172,12 @@ static void iwl4965_bg_rx_replenish(struct work_struct *data)
2172 * Not a mac80211 entry point function, but it fits in with all the 2172 * Not a mac80211 entry point function, but it fits in with all the
2173 * other mac80211 functions grouped here. 2173 * other mac80211 functions grouped here.
2174 */ 2174 */
2175static int iwl4965_mac_setup_register(struct iwl_priv *priv, 2175static int il4965_mac_setup_register(struct il_priv *priv,
2176 u32 max_probe_length) 2176 u32 max_probe_length)
2177{ 2177{
2178 int ret; 2178 int ret;
2179 struct ieee80211_hw *hw = priv->hw; 2179 struct ieee80211_hw *hw = priv->hw;
2180 struct iwl_rxon_context *ctx; 2180 struct il_rxon_context *ctx;
2181 2181
2182 hw->rate_control_algorithm = "iwl-4965-rs"; 2182 hw->rate_control_algorithm = "iwl-4965-rs";
2183 2183
@@ -2188,12 +2188,12 @@ static int iwl4965_mac_setup_register(struct iwl_priv *priv,
2188 IEEE80211_HW_SPECTRUM_MGMT | 2188 IEEE80211_HW_SPECTRUM_MGMT |
2189 IEEE80211_HW_REPORTS_TX_ACK_STATUS; 2189 IEEE80211_HW_REPORTS_TX_ACK_STATUS;
2190 2190
2191 if (priv->cfg->sku & IWL_SKU_N) 2191 if (priv->cfg->sku & IL_SKU_N)
2192 hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | 2192 hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
2193 IEEE80211_HW_SUPPORTS_STATIC_SMPS; 2193 IEEE80211_HW_SUPPORTS_STATIC_SMPS;
2194 2194
2195 hw->sta_data_size = sizeof(struct iwl_station_priv); 2195 hw->sta_data_size = sizeof(struct il_station_priv);
2196 hw->vif_data_size = sizeof(struct iwl_vif_priv); 2196 hw->vif_data_size = sizeof(struct il_vif_priv);
2197 2197
2198 for_each_context(priv, ctx) { 2198 for_each_context(priv, ctx) {
2199 hw->wiphy->interface_modes |= ctx->interface_modes; 2199 hw->wiphy->interface_modes |= ctx->interface_modes;
@@ -2216,7 +2216,7 @@ static int iwl4965_mac_setup_register(struct iwl_priv *priv,
2216 /* Default value; 4 EDCA QOS priorities */ 2216 /* Default value; 4 EDCA QOS priorities */
2217 hw->queues = 4; 2217 hw->queues = 4;
2218 2218
2219 hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; 2219 hw->max_listen_interval = IL_CONN_MAX_LISTEN_INTERVAL;
2220 2220
2221 if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) 2221 if (priv->bands[IEEE80211_BAND_2GHZ].n_channels)
2222 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = 2222 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
@@ -2225,11 +2225,11 @@ static int iwl4965_mac_setup_register(struct iwl_priv *priv,
2225 priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = 2225 priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
2226 &priv->bands[IEEE80211_BAND_5GHZ]; 2226 &priv->bands[IEEE80211_BAND_5GHZ];
2227 2227
2228 iwl_legacy_leds_init(priv); 2228 il_leds_init(priv);
2229 2229
2230 ret = ieee80211_register_hw(priv->hw); 2230 ret = ieee80211_register_hw(priv->hw);
2231 if (ret) { 2231 if (ret) {
2232 IWL_ERR(priv, "Failed to register hw (error %d)\n", ret); 2232 IL_ERR(priv, "Failed to register hw (error %d)\n", ret);
2233 return ret; 2233 return ret;
2234 } 2234 }
2235 priv->mac80211_registered = 1; 2235 priv->mac80211_registered = 1;
@@ -2238,25 +2238,25 @@ static int iwl4965_mac_setup_register(struct iwl_priv *priv,
2238} 2238}
2239 2239
2240 2240
2241int iwl4965_mac_start(struct ieee80211_hw *hw) 2241int il4965_mac_start(struct ieee80211_hw *hw)
2242{ 2242{
2243 struct iwl_priv *priv = hw->priv; 2243 struct il_priv *priv = hw->priv;
2244 int ret; 2244 int ret;
2245 2245
2246 IWL_DEBUG_MAC80211(priv, "enter\n"); 2246 IL_DEBUG_MAC80211(priv, "enter\n");
2247 2247
2248 /* we should be verifying the device is ready to be opened */ 2248 /* we should be verifying the device is ready to be opened */
2249 mutex_lock(&priv->mutex); 2249 mutex_lock(&priv->mutex);
2250 ret = __iwl4965_up(priv); 2250 ret = __il4965_up(priv);
2251 mutex_unlock(&priv->mutex); 2251 mutex_unlock(&priv->mutex);
2252 2252
2253 if (ret) 2253 if (ret)
2254 return ret; 2254 return ret;
2255 2255
2256 if (iwl_legacy_is_rfkill(priv)) 2256 if (il_is_rfkill(priv))
2257 goto out; 2257 goto out;
2258 2258
2259 IWL_DEBUG_INFO(priv, "Start UP work done.\n"); 2259 IL_DEBUG_INFO(priv, "Start UP work done.\n");
2260 2260
2261 /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from 2261 /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from
2262 * mac80211 will not be run successfully. */ 2262 * mac80211 will not be run successfully. */
@@ -2265,99 +2265,99 @@ int iwl4965_mac_start(struct ieee80211_hw *hw)
2265 UCODE_READY_TIMEOUT); 2265 UCODE_READY_TIMEOUT);
2266 if (!ret) { 2266 if (!ret) {
2267 if (!test_bit(STATUS_READY, &priv->status)) { 2267 if (!test_bit(STATUS_READY, &priv->status)) {
2268 IWL_ERR(priv, "START_ALIVE timeout after %dms.\n", 2268 IL_ERR(priv, "START_ALIVE timeout after %dms.\n",
2269 jiffies_to_msecs(UCODE_READY_TIMEOUT)); 2269 jiffies_to_msecs(UCODE_READY_TIMEOUT));
2270 return -ETIMEDOUT; 2270 return -ETIMEDOUT;
2271 } 2271 }
2272 } 2272 }
2273 2273
2274 iwl4965_led_enable(priv); 2274 il4965_led_enable(priv);
2275 2275
2276out: 2276out:
2277 priv->is_open = 1; 2277 priv->is_open = 1;
2278 IWL_DEBUG_MAC80211(priv, "leave\n"); 2278 IL_DEBUG_MAC80211(priv, "leave\n");
2279 return 0; 2279 return 0;
2280} 2280}
2281 2281
2282void iwl4965_mac_stop(struct ieee80211_hw *hw) 2282void il4965_mac_stop(struct ieee80211_hw *hw)
2283{ 2283{
2284 struct iwl_priv *priv = hw->priv; 2284 struct il_priv *priv = hw->priv;
2285 2285
2286 IWL_DEBUG_MAC80211(priv, "enter\n"); 2286 IL_DEBUG_MAC80211(priv, "enter\n");
2287 2287
2288 if (!priv->is_open) 2288 if (!priv->is_open)
2289 return; 2289 return;
2290 2290
2291 priv->is_open = 0; 2291 priv->is_open = 0;
2292 2292
2293 iwl4965_down(priv); 2293 il4965_down(priv);
2294 2294
2295 flush_workqueue(priv->workqueue); 2295 flush_workqueue(priv->workqueue);
2296 2296
2297 /* User space software may expect getting rfkill changes 2297 /* User space software may expect getting rfkill changes
2298 * even if interface is down */ 2298 * even if interface is down */
2299 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 2299 il_write32(priv, CSR_INT, 0xFFFFFFFF);
2300 iwl_legacy_enable_rfkill_int(priv); 2300 il_enable_rfkill_int(priv);
2301 2301
2302 IWL_DEBUG_MAC80211(priv, "leave\n"); 2302 IL_DEBUG_MAC80211(priv, "leave\n");
2303} 2303}
2304 2304
2305void iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 2305void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2306{ 2306{
2307 struct iwl_priv *priv = hw->priv; 2307 struct il_priv *priv = hw->priv;
2308 2308
2309 IWL_DEBUG_MACDUMP(priv, "enter\n"); 2309 IL_DEBUG_MACDUMP(priv, "enter\n");
2310 2310
2311 IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 2311 IL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
2312 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); 2312 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
2313 2313
2314 if (iwl4965_tx_skb(priv, skb)) 2314 if (il4965_tx_skb(priv, skb))
2315 dev_kfree_skb_any(skb); 2315 dev_kfree_skb_any(skb);
2316 2316
2317 IWL_DEBUG_MACDUMP(priv, "leave\n"); 2317 IL_DEBUG_MACDUMP(priv, "leave\n");
2318} 2318}
2319 2319
2320void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, 2320void il4965_mac_update_tkip_key(struct ieee80211_hw *hw,
2321 struct ieee80211_vif *vif, 2321 struct ieee80211_vif *vif,
2322 struct ieee80211_key_conf *keyconf, 2322 struct ieee80211_key_conf *keyconf,
2323 struct ieee80211_sta *sta, 2323 struct ieee80211_sta *sta,
2324 u32 iv32, u16 *phase1key) 2324 u32 iv32, u16 *phase1key)
2325{ 2325{
2326 struct iwl_priv *priv = hw->priv; 2326 struct il_priv *priv = hw->priv;
2327 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 2327 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
2328 2328
2329 IWL_DEBUG_MAC80211(priv, "enter\n"); 2329 IL_DEBUG_MAC80211(priv, "enter\n");
2330 2330
2331 iwl4965_update_tkip_key(priv, vif_priv->ctx, keyconf, sta, 2331 il4965_update_tkip_key(priv, vif_priv->ctx, keyconf, sta,
2332 iv32, phase1key); 2332 iv32, phase1key);
2333 2333
2334 IWL_DEBUG_MAC80211(priv, "leave\n"); 2334 IL_DEBUG_MAC80211(priv, "leave\n");
2335} 2335}
2336 2336
2337int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 2337int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2338 struct ieee80211_vif *vif, struct ieee80211_sta *sta, 2338 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
2339 struct ieee80211_key_conf *key) 2339 struct ieee80211_key_conf *key)
2340{ 2340{
2341 struct iwl_priv *priv = hw->priv; 2341 struct il_priv *priv = hw->priv;
2342 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 2342 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
2343 struct iwl_rxon_context *ctx = vif_priv->ctx; 2343 struct il_rxon_context *ctx = vif_priv->ctx;
2344 int ret; 2344 int ret;
2345 u8 sta_id; 2345 u8 sta_id;
2346 bool is_default_wep_key = false; 2346 bool is_default_wep_key = false;
2347 2347
2348 IWL_DEBUG_MAC80211(priv, "enter\n"); 2348 IL_DEBUG_MAC80211(priv, "enter\n");
2349 2349
2350 if (priv->cfg->mod_params->sw_crypto) { 2350 if (priv->cfg->mod_params->sw_crypto) {
2351 IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); 2351 IL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n");
2352 return -EOPNOTSUPP; 2352 return -EOPNOTSUPP;
2353 } 2353 }
2354 2354
2355 sta_id = iwl_legacy_sta_id_or_broadcast(priv, vif_priv->ctx, sta); 2355 sta_id = il_sta_id_or_broadcast(priv, vif_priv->ctx, sta);
2356 if (sta_id == IWL_INVALID_STATION) 2356 if (sta_id == IL_INVALID_STATION)
2357 return -EINVAL; 2357 return -EINVAL;
2358 2358
2359 mutex_lock(&priv->mutex); 2359 mutex_lock(&priv->mutex);
2360 iwl_legacy_scan_cancel_timeout(priv, 100); 2360 il_scan_cancel_timeout(priv, 100);
2361 2361
2362 /* 2362 /*
2363 * If we are getting WEP group key and we didn't receive any key mapping 2363 * If we are getting WEP group key and we didn't receive any key mapping
@@ -2378,68 +2378,68 @@ int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2378 switch (cmd) { 2378 switch (cmd) {
2379 case SET_KEY: 2379 case SET_KEY:
2380 if (is_default_wep_key) 2380 if (is_default_wep_key)
2381 ret = iwl4965_set_default_wep_key(priv, 2381 ret = il4965_set_default_wep_key(priv,
2382 vif_priv->ctx, key); 2382 vif_priv->ctx, key);
2383 else 2383 else
2384 ret = iwl4965_set_dynamic_key(priv, vif_priv->ctx, 2384 ret = il4965_set_dynamic_key(priv, vif_priv->ctx,
2385 key, sta_id); 2385 key, sta_id);
2386 2386
2387 IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); 2387 IL_DEBUG_MAC80211(priv, "enable hwcrypto key\n");
2388 break; 2388 break;
2389 case DISABLE_KEY: 2389 case DISABLE_KEY:
2390 if (is_default_wep_key) 2390 if (is_default_wep_key)
2391 ret = iwl4965_remove_default_wep_key(priv, ctx, key); 2391 ret = il4965_remove_default_wep_key(priv, ctx, key);
2392 else 2392 else
2393 ret = iwl4965_remove_dynamic_key(priv, ctx, 2393 ret = il4965_remove_dynamic_key(priv, ctx,
2394 key, sta_id); 2394 key, sta_id);
2395 2395
2396 IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); 2396 IL_DEBUG_MAC80211(priv, "disable hwcrypto key\n");
2397 break; 2397 break;
2398 default: 2398 default:
2399 ret = -EINVAL; 2399 ret = -EINVAL;
2400 } 2400 }
2401 2401
2402 mutex_unlock(&priv->mutex); 2402 mutex_unlock(&priv->mutex);
2403 IWL_DEBUG_MAC80211(priv, "leave\n"); 2403 IL_DEBUG_MAC80211(priv, "leave\n");
2404 2404
2405 return ret; 2405 return ret;
2406} 2406}
2407 2407
2408int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, 2408int il4965_mac_ampdu_action(struct ieee80211_hw *hw,
2409 struct ieee80211_vif *vif, 2409 struct ieee80211_vif *vif,
2410 enum ieee80211_ampdu_mlme_action action, 2410 enum ieee80211_ampdu_mlme_action action,
2411 struct ieee80211_sta *sta, u16 tid, u16 *ssn, 2411 struct ieee80211_sta *sta, u16 tid, u16 *ssn,
2412 u8 buf_size) 2412 u8 buf_size)
2413{ 2413{
2414 struct iwl_priv *priv = hw->priv; 2414 struct il_priv *priv = hw->priv;
2415 int ret = -EINVAL; 2415 int ret = -EINVAL;
2416 2416
2417 IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", 2417 IL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n",
2418 sta->addr, tid); 2418 sta->addr, tid);
2419 2419
2420 if (!(priv->cfg->sku & IWL_SKU_N)) 2420 if (!(priv->cfg->sku & IL_SKU_N))
2421 return -EACCES; 2421 return -EACCES;
2422 2422
2423 mutex_lock(&priv->mutex); 2423 mutex_lock(&priv->mutex);
2424 2424
2425 switch (action) { 2425 switch (action) {
2426 case IEEE80211_AMPDU_RX_START: 2426 case IEEE80211_AMPDU_RX_START:
2427 IWL_DEBUG_HT(priv, "start Rx\n"); 2427 IL_DEBUG_HT(priv, "start Rx\n");
2428 ret = iwl4965_sta_rx_agg_start(priv, sta, tid, *ssn); 2428 ret = il4965_sta_rx_agg_start(priv, sta, tid, *ssn);
2429 break; 2429 break;
2430 case IEEE80211_AMPDU_RX_STOP: 2430 case IEEE80211_AMPDU_RX_STOP:
2431 IWL_DEBUG_HT(priv, "stop Rx\n"); 2431 IL_DEBUG_HT(priv, "stop Rx\n");
2432 ret = iwl4965_sta_rx_agg_stop(priv, sta, tid); 2432 ret = il4965_sta_rx_agg_stop(priv, sta, tid);
2433 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2433 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2434 ret = 0; 2434 ret = 0;
2435 break; 2435 break;
2436 case IEEE80211_AMPDU_TX_START: 2436 case IEEE80211_AMPDU_TX_START:
2437 IWL_DEBUG_HT(priv, "start Tx\n"); 2437 IL_DEBUG_HT(priv, "start Tx\n");
2438 ret = iwl4965_tx_agg_start(priv, vif, sta, tid, ssn); 2438 ret = il4965_tx_agg_start(priv, vif, sta, tid, ssn);
2439 break; 2439 break;
2440 case IEEE80211_AMPDU_TX_STOP: 2440 case IEEE80211_AMPDU_TX_STOP:
2441 IWL_DEBUG_HT(priv, "stop Tx\n"); 2441 IL_DEBUG_HT(priv, "stop Tx\n");
2442 ret = iwl4965_tx_agg_stop(priv, vif, sta, tid); 2442 ret = il4965_tx_agg_stop(priv, vif, sta, tid);
2443 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2443 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2444 ret = 0; 2444 ret = 0;
2445 break; 2445 break;
@@ -2452,30 +2452,30 @@ int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
2452 return ret; 2452 return ret;
2453} 2453}
2454 2454
2455int iwl4965_mac_sta_add(struct ieee80211_hw *hw, 2455int il4965_mac_sta_add(struct ieee80211_hw *hw,
2456 struct ieee80211_vif *vif, 2456 struct ieee80211_vif *vif,
2457 struct ieee80211_sta *sta) 2457 struct ieee80211_sta *sta)
2458{ 2458{
2459 struct iwl_priv *priv = hw->priv; 2459 struct il_priv *priv = hw->priv;
2460 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 2460 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
2461 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 2461 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
2462 bool is_ap = vif->type == NL80211_IFTYPE_STATION; 2462 bool is_ap = vif->type == NL80211_IFTYPE_STATION;
2463 int ret; 2463 int ret;
2464 u8 sta_id; 2464 u8 sta_id;
2465 2465
2466 IWL_DEBUG_INFO(priv, "received request to add station %pM\n", 2466 IL_DEBUG_INFO(priv, "received request to add station %pM\n",
2467 sta->addr); 2467 sta->addr);
2468 mutex_lock(&priv->mutex); 2468 mutex_lock(&priv->mutex);
2469 IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n", 2469 IL_DEBUG_INFO(priv, "proceeding to add station %pM\n",
2470 sta->addr); 2470 sta->addr);
2471 sta_priv->common.sta_id = IWL_INVALID_STATION; 2471 sta_priv->common.sta_id = IL_INVALID_STATION;
2472 2472
2473 atomic_set(&sta_priv->pending_frames, 0); 2473 atomic_set(&sta_priv->pending_frames, 0);
2474 2474
2475 ret = iwl_legacy_add_station_common(priv, vif_priv->ctx, sta->addr, 2475 ret = il_add_station_common(priv, vif_priv->ctx, sta->addr,
2476 is_ap, sta, &sta_id); 2476 is_ap, sta, &sta_id);
2477 if (ret) { 2477 if (ret) {
2478 IWL_ERR(priv, "Unable to add station %pM (%d)\n", 2478 IL_ERR(priv, "Unable to add station %pM (%d)\n",
2479 sta->addr, ret); 2479 sta->addr, ret);
2480 /* Should we return success if return code is EEXIST ? */ 2480 /* Should we return success if return code is EEXIST ? */
2481 mutex_unlock(&priv->mutex); 2481 mutex_unlock(&priv->mutex);
@@ -2485,31 +2485,31 @@ int iwl4965_mac_sta_add(struct ieee80211_hw *hw,
2485 sta_priv->common.sta_id = sta_id; 2485 sta_priv->common.sta_id = sta_id;
2486 2486
2487 /* Initialize rate scaling */ 2487 /* Initialize rate scaling */
2488 IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", 2488 IL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n",
2489 sta->addr); 2489 sta->addr);
2490 iwl4965_rs_rate_init(priv, sta, sta_id); 2490 il4965_rs_rate_init(priv, sta, sta_id);
2491 mutex_unlock(&priv->mutex); 2491 mutex_unlock(&priv->mutex);
2492 2492
2493 return 0; 2493 return 0;
2494} 2494}
2495 2495
2496void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, 2496void il4965_mac_channel_switch(struct ieee80211_hw *hw,
2497 struct ieee80211_channel_switch *ch_switch) 2497 struct ieee80211_channel_switch *ch_switch)
2498{ 2498{
2499 struct iwl_priv *priv = hw->priv; 2499 struct il_priv *priv = hw->priv;
2500 const struct iwl_channel_info *ch_info; 2500 const struct il_channel_info *ch_info;
2501 struct ieee80211_conf *conf = &hw->conf; 2501 struct ieee80211_conf *conf = &hw->conf;
2502 struct ieee80211_channel *channel = ch_switch->channel; 2502 struct ieee80211_channel *channel = ch_switch->channel;
2503 struct iwl_ht_config *ht_conf = &priv->current_ht_config; 2503 struct il_ht_config *ht_conf = &priv->current_ht_config;
2504 2504
2505 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2505 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2506 u16 ch; 2506 u16 ch;
2507 2507
2508 IWL_DEBUG_MAC80211(priv, "enter\n"); 2508 IL_DEBUG_MAC80211(priv, "enter\n");
2509 2509
2510 mutex_lock(&priv->mutex); 2510 mutex_lock(&priv->mutex);
2511 2511
2512 if (iwl_legacy_is_rfkill(priv)) 2512 if (il_is_rfkill(priv))
2513 goto out; 2513 goto out;
2514 2514
2515 if (test_bit(STATUS_EXIT_PENDING, &priv->status) || 2515 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
@@ -2517,7 +2517,7 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
2517 test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) 2517 test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
2518 goto out; 2518 goto out;
2519 2519
2520 if (!iwl_legacy_is_associated_ctx(ctx)) 2520 if (!il_is_associated_ctx(ctx))
2521 goto out; 2521 goto out;
2522 2522
2523 if (!priv->cfg->ops->lib->set_channel_switch) 2523 if (!priv->cfg->ops->lib->set_channel_switch)
@@ -2527,9 +2527,9 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
2527 if (le16_to_cpu(ctx->active.channel) == ch) 2527 if (le16_to_cpu(ctx->active.channel) == ch)
2528 goto out; 2528 goto out;
2529 2529
2530 ch_info = iwl_legacy_get_channel_info(priv, channel->band, ch); 2530 ch_info = il_get_channel_info(priv, channel->band, ch);
2531 if (!iwl_legacy_is_channel_valid(ch_info)) { 2531 if (!il_is_channel_valid(ch_info)) {
2532 IWL_DEBUG_MAC80211(priv, "invalid channel\n"); 2532 IL_DEBUG_MAC80211(priv, "invalid channel\n");
2533 goto out; 2533 goto out;
2534 } 2534 }
2535 2535
@@ -2559,13 +2559,13 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
2559 if ((le16_to_cpu(ctx->staging.channel) != ch)) 2559 if ((le16_to_cpu(ctx->staging.channel) != ch))
2560 ctx->staging.flags = 0; 2560 ctx->staging.flags = 0;
2561 2561
2562 iwl_legacy_set_rxon_channel(priv, channel, ctx); 2562 il_set_rxon_channel(priv, channel, ctx);
2563 iwl_legacy_set_rxon_ht(priv, ht_conf); 2563 il_set_rxon_ht(priv, ht_conf);
2564 iwl_legacy_set_flags_for_band(priv, ctx, channel->band, ctx->vif); 2564 il_set_flags_for_band(priv, ctx, channel->band, ctx->vif);
2565 2565
2566 spin_unlock_irq(&priv->lock); 2566 spin_unlock_irq(&priv->lock);
2567 2567
2568 iwl_legacy_set_rate(priv); 2568 il_set_rate(priv);
2569 /* 2569 /*
2570 * at this point, staging_rxon has the 2570 * at this point, staging_rxon has the
2571 * configuration for channel switch 2571 * configuration for channel switch
@@ -2580,17 +2580,17 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
2580 2580
2581out: 2581out:
2582 mutex_unlock(&priv->mutex); 2582 mutex_unlock(&priv->mutex);
2583 IWL_DEBUG_MAC80211(priv, "leave\n"); 2583 IL_DEBUG_MAC80211(priv, "leave\n");
2584} 2584}
2585 2585
2586void iwl4965_configure_filter(struct ieee80211_hw *hw, 2586void il4965_configure_filter(struct ieee80211_hw *hw,
2587 unsigned int changed_flags, 2587 unsigned int changed_flags,
2588 unsigned int *total_flags, 2588 unsigned int *total_flags,
2589 u64 multicast) 2589 u64 multicast)
2590{ 2590{
2591 struct iwl_priv *priv = hw->priv; 2591 struct il_priv *priv = hw->priv;
2592 __le32 filter_or = 0, filter_nand = 0; 2592 __le32 filter_or = 0, filter_nand = 0;
2593 struct iwl_rxon_context *ctx; 2593 struct il_rxon_context *ctx;
2594 2594
2595#define CHK(test, flag) do { \ 2595#define CHK(test, flag) do { \
2596 if (*total_flags & (test)) \ 2596 if (*total_flags & (test)) \
@@ -2599,7 +2599,7 @@ void iwl4965_configure_filter(struct ieee80211_hw *hw,
2599 filter_nand |= (flag); \ 2599 filter_nand |= (flag); \
2600 } while (0) 2600 } while (0)
2601 2601
2602 IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", 2602 IL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n",
2603 changed_flags, *total_flags); 2603 changed_flags, *total_flags);
2604 2604
2605 CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); 2605 CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK);
@@ -2625,7 +2625,7 @@ void iwl4965_configure_filter(struct ieee80211_hw *hw,
2625 2625
2626 /* 2626 /*
2627 * Receiving all multicast frames is always enabled by the 2627 * Receiving all multicast frames is always enabled by the
2628 * default flags setup in iwl_legacy_connection_init_rx_config() 2628 * default flags setup in il_connection_init_rx_config()
2629 * since we currently do not support programming multicast 2629 * since we currently do not support programming multicast
2630 * filters into the device. 2630 * filters into the device.
2631 */ 2631 */
@@ -2639,9 +2639,9 @@ void iwl4965_configure_filter(struct ieee80211_hw *hw,
2639 * 2639 *
2640 *****************************************************************************/ 2640 *****************************************************************************/
2641 2641
2642static void iwl4965_bg_txpower_work(struct work_struct *work) 2642static void il4965_bg_txpower_work(struct work_struct *work)
2643{ 2643{
2644 struct iwl_priv *priv = container_of(work, struct iwl_priv, 2644 struct il_priv *priv = container_of(work, struct il_priv,
2645 txpower_work); 2645 txpower_work);
2646 2646
2647 mutex_lock(&priv->mutex); 2647 mutex_lock(&priv->mutex);
@@ -2666,62 +2666,62 @@ out:
2666 mutex_unlock(&priv->mutex); 2666 mutex_unlock(&priv->mutex);
2667} 2667}
2668 2668
2669static void iwl4965_setup_deferred_work(struct iwl_priv *priv) 2669static void il4965_setup_deferred_work(struct il_priv *priv)
2670{ 2670{
2671 priv->workqueue = create_singlethread_workqueue(DRV_NAME); 2671 priv->workqueue = create_singlethread_workqueue(DRV_NAME);
2672 2672
2673 init_waitqueue_head(&priv->wait_command_queue); 2673 init_waitqueue_head(&priv->wait_command_queue);
2674 2674
2675 INIT_WORK(&priv->restart, iwl4965_bg_restart); 2675 INIT_WORK(&priv->restart, il4965_bg_restart);
2676 INIT_WORK(&priv->rx_replenish, iwl4965_bg_rx_replenish); 2676 INIT_WORK(&priv->rx_replenish, il4965_bg_rx_replenish);
2677 INIT_WORK(&priv->run_time_calib_work, iwl4965_bg_run_time_calib_work); 2677 INIT_WORK(&priv->run_time_calib_work, il4965_bg_run_time_calib_work);
2678 INIT_DELAYED_WORK(&priv->init_alive_start, iwl4965_bg_init_alive_start); 2678 INIT_DELAYED_WORK(&priv->init_alive_start, il4965_bg_init_alive_start);
2679 INIT_DELAYED_WORK(&priv->alive_start, iwl4965_bg_alive_start); 2679 INIT_DELAYED_WORK(&priv->alive_start, il4965_bg_alive_start);
2680 2680
2681 iwl_legacy_setup_scan_deferred_work(priv); 2681 il_setup_scan_deferred_work(priv);
2682 2682
2683 INIT_WORK(&priv->txpower_work, iwl4965_bg_txpower_work); 2683 INIT_WORK(&priv->txpower_work, il4965_bg_txpower_work);
2684 2684
2685 init_timer(&priv->statistics_periodic); 2685 init_timer(&priv->statistics_periodic);
2686 priv->statistics_periodic.data = (unsigned long)priv; 2686 priv->statistics_periodic.data = (unsigned long)priv;
2687 priv->statistics_periodic.function = iwl4965_bg_statistics_periodic; 2687 priv->statistics_periodic.function = il4965_bg_statistics_periodic;
2688 2688
2689 init_timer(&priv->watchdog); 2689 init_timer(&priv->watchdog);
2690 priv->watchdog.data = (unsigned long)priv; 2690 priv->watchdog.data = (unsigned long)priv;
2691 priv->watchdog.function = iwl_legacy_bg_watchdog; 2691 priv->watchdog.function = il_bg_watchdog;
2692 2692
2693 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 2693 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
2694 iwl4965_irq_tasklet, (unsigned long)priv); 2694 il4965_irq_tasklet, (unsigned long)priv);
2695} 2695}
2696 2696
2697static void iwl4965_cancel_deferred_work(struct iwl_priv *priv) 2697static void il4965_cancel_deferred_work(struct il_priv *priv)
2698{ 2698{
2699 cancel_work_sync(&priv->txpower_work); 2699 cancel_work_sync(&priv->txpower_work);
2700 cancel_delayed_work_sync(&priv->init_alive_start); 2700 cancel_delayed_work_sync(&priv->init_alive_start);
2701 cancel_delayed_work(&priv->alive_start); 2701 cancel_delayed_work(&priv->alive_start);
2702 cancel_work_sync(&priv->run_time_calib_work); 2702 cancel_work_sync(&priv->run_time_calib_work);
2703 2703
2704 iwl_legacy_cancel_scan_deferred_work(priv); 2704 il_cancel_scan_deferred_work(priv);
2705 2705
2706 del_timer_sync(&priv->statistics_periodic); 2706 del_timer_sync(&priv->statistics_periodic);
2707} 2707}
2708 2708
2709static void iwl4965_init_hw_rates(struct iwl_priv *priv, 2709static void il4965_init_hw_rates(struct il_priv *priv,
2710 struct ieee80211_rate *rates) 2710 struct ieee80211_rate *rates)
2711{ 2711{
2712 int i; 2712 int i;
2713 2713
2714 for (i = 0; i < IWL_RATE_COUNT_LEGACY; i++) { 2714 for (i = 0; i < IL_RATE_COUNT_LEGACY; i++) {
2715 rates[i].bitrate = iwlegacy_rates[i].ieee * 5; 2715 rates[i].bitrate = iwlegacy_rates[i].ieee * 5;
2716 rates[i].hw_value = i; /* Rate scaling will work on indexes */ 2716 rates[i].hw_value = i; /* Rate scaling will work on indexes */
2717 rates[i].hw_value_short = i; 2717 rates[i].hw_value_short = i;
2718 rates[i].flags = 0; 2718 rates[i].flags = 0;
2719 if ((i >= IWL_FIRST_CCK_RATE) && (i <= IWL_LAST_CCK_RATE)) { 2719 if ((i >= IL_FIRST_CCK_RATE) && (i <= IL_LAST_CCK_RATE)) {
2720 /* 2720 /*
2721 * If CCK != 1M then set short preamble rate flag. 2721 * If CCK != 1M then set short preamble rate flag.
2722 */ 2722 */
2723 rates[i].flags |= 2723 rates[i].flags |=
2724 (iwlegacy_rates[i].plcp == IWL_RATE_1M_PLCP) ? 2724 (iwlegacy_rates[i].plcp == IL_RATE_1M_PLCP) ?
2725 0 : IEEE80211_RATE_SHORT_PREAMBLE; 2725 0 : IEEE80211_RATE_SHORT_PREAMBLE;
2726 } 2726 }
2727 } 2727 }
@@ -2729,15 +2729,15 @@ static void iwl4965_init_hw_rates(struct iwl_priv *priv,
2729/* 2729/*
2730 * Acquire priv->lock before calling this function ! 2730 * Acquire priv->lock before calling this function !
2731 */ 2731 */
2732void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index) 2732void il4965_set_wr_ptrs(struct il_priv *priv, int txq_id, u32 index)
2733{ 2733{
2734 iwl_legacy_write_direct32(priv, HBUS_TARG_WRPTR, 2734 il_write_direct32(priv, HBUS_TARG_WRPTR,
2735 (index & 0xff) | (txq_id << 8)); 2735 (index & 0xff) | (txq_id << 8));
2736 iwl_legacy_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(txq_id), index); 2736 il_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(txq_id), index);
2737} 2737}
2738 2738
2739void iwl4965_tx_queue_set_status(struct iwl_priv *priv, 2739void il4965_tx_queue_set_status(struct il_priv *priv,
2740 struct iwl_tx_queue *txq, 2740 struct il_tx_queue *txq,
2741 int tx_fifo_id, int scd_retry) 2741 int tx_fifo_id, int scd_retry)
2742{ 2742{
2743 int txq_id = txq->q.id; 2743 int txq_id = txq->q.id;
@@ -2746,7 +2746,7 @@ void iwl4965_tx_queue_set_status(struct iwl_priv *priv,
2746 int active = test_bit(txq_id, &priv->txq_ctx_active_msk) ? 1 : 0; 2746 int active = test_bit(txq_id, &priv->txq_ctx_active_msk) ? 1 : 0;
2747 2747
2748 /* Set up and activate */ 2748 /* Set up and activate */
2749 iwl_legacy_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), 2749 il_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id),
2750 (active << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) | 2750 (active << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
2751 (tx_fifo_id << IWL49_SCD_QUEUE_STTS_REG_POS_TXF) | 2751 (tx_fifo_id << IWL49_SCD_QUEUE_STTS_REG_POS_TXF) |
2752 (scd_retry << IWL49_SCD_QUEUE_STTS_REG_POS_WSL) | 2752 (scd_retry << IWL49_SCD_QUEUE_STTS_REG_POS_WSL) |
@@ -2755,13 +2755,13 @@ void iwl4965_tx_queue_set_status(struct iwl_priv *priv,
2755 2755
2756 txq->sched_retry = scd_retry; 2756 txq->sched_retry = scd_retry;
2757 2757
2758 IWL_DEBUG_INFO(priv, "%s %s Queue %d on AC %d\n", 2758 IL_DEBUG_INFO(priv, "%s %s Queue %d on AC %d\n",
2759 active ? "Activate" : "Deactivate", 2759 active ? "Activate" : "Deactivate",
2760 scd_retry ? "BA" : "AC", txq_id, tx_fifo_id); 2760 scd_retry ? "BA" : "AC", txq_id, tx_fifo_id);
2761} 2761}
2762 2762
2763 2763
2764static int iwl4965_init_drv(struct iwl_priv *priv) 2764static int il4965_init_drv(struct il_priv *priv)
2765{ 2765{
2766 int ret; 2766 int ret;
2767 2767
@@ -2778,91 +2778,91 @@ static int iwl4965_init_drv(struct iwl_priv *priv)
2778 2778
2779 priv->iw_mode = NL80211_IFTYPE_STATION; 2779 priv->iw_mode = NL80211_IFTYPE_STATION;
2780 priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; 2780 priv->current_ht_config.smps = IEEE80211_SMPS_STATIC;
2781 priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; 2781 priv->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF;
2782 2782
2783 /* initialize force reset */ 2783 /* initialize force reset */
2784 priv->force_reset.reset_duration = IWL_DELAY_NEXT_FORCE_FW_RELOAD; 2784 priv->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD;
2785 2785
2786 /* Choose which receivers/antennas to use */ 2786 /* Choose which receivers/antennas to use */
2787 if (priv->cfg->ops->hcmd->set_rxon_chain) 2787 if (priv->cfg->ops->hcmd->set_rxon_chain)
2788 priv->cfg->ops->hcmd->set_rxon_chain(priv, 2788 priv->cfg->ops->hcmd->set_rxon_chain(priv,
2789 &priv->contexts[IWL_RXON_CTX_BSS]); 2789 &priv->contexts[IL_RXON_CTX_BSS]);
2790 2790
2791 iwl_legacy_init_scan_params(priv); 2791 il_init_scan_params(priv);
2792 2792
2793 ret = iwl_legacy_init_channel_map(priv); 2793 ret = il_init_channel_map(priv);
2794 if (ret) { 2794 if (ret) {
2795 IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); 2795 IL_ERR(priv, "initializing regulatory failed: %d\n", ret);
2796 goto err; 2796 goto err;
2797 } 2797 }
2798 2798
2799 ret = iwl_legacy_init_geos(priv); 2799 ret = il_init_geos(priv);
2800 if (ret) { 2800 if (ret) {
2801 IWL_ERR(priv, "initializing geos failed: %d\n", ret); 2801 IL_ERR(priv, "initializing geos failed: %d\n", ret);
2802 goto err_free_channel_map; 2802 goto err_free_channel_map;
2803 } 2803 }
2804 iwl4965_init_hw_rates(priv, priv->ieee_rates); 2804 il4965_init_hw_rates(priv, priv->ieee_rates);
2805 2805
2806 return 0; 2806 return 0;
2807 2807
2808err_free_channel_map: 2808err_free_channel_map:
2809 iwl_legacy_free_channel_map(priv); 2809 il_free_channel_map(priv);
2810err: 2810err:
2811 return ret; 2811 return ret;
2812} 2812}
2813 2813
2814static void iwl4965_uninit_drv(struct iwl_priv *priv) 2814static void il4965_uninit_drv(struct il_priv *priv)
2815{ 2815{
2816 iwl4965_calib_free_results(priv); 2816 il4965_calib_free_results(priv);
2817 iwl_legacy_free_geos(priv); 2817 il_free_geos(priv);
2818 iwl_legacy_free_channel_map(priv); 2818 il_free_channel_map(priv);
2819 kfree(priv->scan_cmd); 2819 kfree(priv->scan_cmd);
2820} 2820}
2821 2821
2822static void iwl4965_hw_detect(struct iwl_priv *priv) 2822static void il4965_hw_detect(struct il_priv *priv)
2823{ 2823{
2824 priv->hw_rev = _iwl_legacy_read32(priv, CSR_HW_REV); 2824 priv->hw_rev = _il_read32(priv, CSR_HW_REV);
2825 priv->hw_wa_rev = _iwl_legacy_read32(priv, CSR_HW_REV_WA_REG); 2825 priv->hw_wa_rev = _il_read32(priv, CSR_HW_REV_WA_REG);
2826 priv->rev_id = priv->pci_dev->revision; 2826 priv->rev_id = priv->pci_dev->revision;
2827 IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", priv->rev_id); 2827 IL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", priv->rev_id);
2828} 2828}
2829 2829
2830static int iwl4965_set_hw_params(struct iwl_priv *priv) 2830static int il4965_set_hw_params(struct il_priv *priv)
2831{ 2831{
2832 priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; 2832 priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
2833 priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; 2833 priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
2834 if (priv->cfg->mod_params->amsdu_size_8K) 2834 if (priv->cfg->mod_params->amsdu_size_8K)
2835 priv->hw_params.rx_page_order = get_order(IWL_RX_BUF_SIZE_8K); 2835 priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_8K);
2836 else 2836 else
2837 priv->hw_params.rx_page_order = get_order(IWL_RX_BUF_SIZE_4K); 2837 priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_4K);
2838 2838
2839 priv->hw_params.max_beacon_itrvl = IWL_MAX_UCODE_BEACON_INTERVAL; 2839 priv->hw_params.max_beacon_itrvl = IL_MAX_UCODE_BEACON_INTERVAL;
2840 2840
2841 if (priv->cfg->mod_params->disable_11n) 2841 if (priv->cfg->mod_params->disable_11n)
2842 priv->cfg->sku &= ~IWL_SKU_N; 2842 priv->cfg->sku &= ~IL_SKU_N;
2843 2843
2844 /* Device-specific setup */ 2844 /* Device-specific setup */
2845 return priv->cfg->ops->lib->set_hw_params(priv); 2845 return priv->cfg->ops->lib->set_hw_params(priv);
2846} 2846}
2847 2847
2848static const u8 iwl4965_bss_ac_to_fifo[] = { 2848static const u8 il4965_bss_ac_to_fifo[] = {
2849 IWL_TX_FIFO_VO, 2849 IL_TX_FIFO_VO,
2850 IWL_TX_FIFO_VI, 2850 IL_TX_FIFO_VI,
2851 IWL_TX_FIFO_BE, 2851 IL_TX_FIFO_BE,
2852 IWL_TX_FIFO_BK, 2852 IL_TX_FIFO_BK,
2853}; 2853};
2854 2854
2855static const u8 iwl4965_bss_ac_to_queue[] = { 2855static const u8 il4965_bss_ac_to_queue[] = {
2856 0, 1, 2, 3, 2856 0, 1, 2, 3,
2857}; 2857};
2858 2858
2859static int 2859static int
2860iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 2860il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2861{ 2861{
2862 int err = 0, i; 2862 int err = 0, i;
2863 struct iwl_priv *priv; 2863 struct il_priv *priv;
2864 struct ieee80211_hw *hw; 2864 struct ieee80211_hw *hw;
2865 struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); 2865 struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data);
2866 unsigned long flags; 2866 unsigned long flags;
2867 u16 pci_cmd; 2867 u16 pci_cmd;
2868 2868
@@ -2870,7 +2870,7 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2870 * 1. Allocating HW data 2870 * 1. Allocating HW data
2871 ************************/ 2871 ************************/
2872 2872
2873 hw = iwl_legacy_alloc_all(cfg); 2873 hw = il_alloc_all(cfg);
2874 if (!hw) { 2874 if (!hw) {
2875 err = -ENOMEM; 2875 err = -ENOMEM;
2876 goto out; 2876 goto out;
@@ -2883,41 +2883,41 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2883 * more may be discovered when firmware 2883 * more may be discovered when firmware
2884 * is loaded. 2884 * is loaded.
2885 */ 2885 */
2886 priv->valid_contexts = BIT(IWL_RXON_CTX_BSS); 2886 priv->valid_contexts = BIT(IL_RXON_CTX_BSS);
2887 2887
2888 for (i = 0; i < NUM_IWL_RXON_CTX; i++) 2888 for (i = 0; i < NUM_IL_RXON_CTX; i++)
2889 priv->contexts[i].ctxid = i; 2889 priv->contexts[i].ctxid = i;
2890 2890
2891 priv->contexts[IWL_RXON_CTX_BSS].always_active = true; 2891 priv->contexts[IL_RXON_CTX_BSS].always_active = true;
2892 priv->contexts[IWL_RXON_CTX_BSS].is_active = true; 2892 priv->contexts[IL_RXON_CTX_BSS].is_active = true;
2893 priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; 2893 priv->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON;
2894 priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; 2894 priv->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING;
2895 priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; 2895 priv->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC;
2896 priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; 2896 priv->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM;
2897 priv->contexts[IWL_RXON_CTX_BSS].ap_sta_id = IWL_AP_ID; 2897 priv->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID;
2898 priv->contexts[IWL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; 2898 priv->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY;
2899 priv->contexts[IWL_RXON_CTX_BSS].ac_to_fifo = iwl4965_bss_ac_to_fifo; 2899 priv->contexts[IL_RXON_CTX_BSS].ac_to_fifo = il4965_bss_ac_to_fifo;
2900 priv->contexts[IWL_RXON_CTX_BSS].ac_to_queue = iwl4965_bss_ac_to_queue; 2900 priv->contexts[IL_RXON_CTX_BSS].ac_to_queue = il4965_bss_ac_to_queue;
2901 priv->contexts[IWL_RXON_CTX_BSS].exclusive_interface_modes = 2901 priv->contexts[IL_RXON_CTX_BSS].exclusive_interface_modes =
2902 BIT(NL80211_IFTYPE_ADHOC); 2902 BIT(NL80211_IFTYPE_ADHOC);
2903 priv->contexts[IWL_RXON_CTX_BSS].interface_modes = 2903 priv->contexts[IL_RXON_CTX_BSS].interface_modes =
2904 BIT(NL80211_IFTYPE_STATION); 2904 BIT(NL80211_IFTYPE_STATION);
2905 priv->contexts[IWL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP; 2905 priv->contexts[IL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP;
2906 priv->contexts[IWL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; 2906 priv->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS;
2907 priv->contexts[IWL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; 2907 priv->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS;
2908 priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; 2908 priv->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS;
2909 2909
2910 BUILD_BUG_ON(NUM_IWL_RXON_CTX != 1); 2910 BUILD_BUG_ON(NUM_IL_RXON_CTX != 1);
2911 2911
2912 SET_IEEE80211_DEV(hw, &pdev->dev); 2912 SET_IEEE80211_DEV(hw, &pdev->dev);
2913 2913
2914 IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); 2914 IL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n");
2915 priv->cfg = cfg; 2915 priv->cfg = cfg;
2916 priv->pci_dev = pdev; 2916 priv->pci_dev = pdev;
2917 priv->inta_mask = CSR_INI_SET_MASK; 2917 priv->inta_mask = CSR_INI_SET_MASK;
2918 2918
2919 if (iwl_legacy_alloc_traffic_mem(priv)) 2919 if (il_alloc_traffic_mem(priv))
2920 IWL_ERR(priv, "Not enough memory to generate traffic log\n"); 2920 IL_ERR(priv, "Not enough memory to generate traffic log\n");
2921 2921
2922 /************************** 2922 /**************************
2923 * 2. Initializing PCI bus 2923 * 2. Initializing PCI bus
@@ -2942,7 +2942,7 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2942 DMA_BIT_MASK(32)); 2942 DMA_BIT_MASK(32));
2943 /* both attempts failed: */ 2943 /* both attempts failed: */
2944 if (err) { 2944 if (err) {
2945 IWL_WARN(priv, "No suitable DMA available.\n"); 2945 IL_WARN(priv, "No suitable DMA available.\n");
2946 goto out_pci_disable_device; 2946 goto out_pci_disable_device;
2947 } 2947 }
2948 } 2948 }
@@ -2963,9 +2963,9 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2963 goto out_pci_release_regions; 2963 goto out_pci_release_regions;
2964 } 2964 }
2965 2965
2966 IWL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", 2966 IL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n",
2967 (unsigned long long) pci_resource_len(pdev, 0)); 2967 (unsigned long long) pci_resource_len(pdev, 0));
2968 IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); 2968 IL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base);
2969 2969
2970 /* these spin locks will be used in apm_ops.init and EEPROM access 2970 /* these spin locks will be used in apm_ops.init and EEPROM access
2971 * we should init now 2971 * we should init now
@@ -2978,19 +2978,19 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2978 * strange state ... like being left stranded by a primary kernel 2978 * strange state ... like being left stranded by a primary kernel
2979 * and this is now the kdump kernel trying to start up 2979 * and this is now the kdump kernel trying to start up
2980 */ 2980 */
2981 iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 2981 il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
2982 2982
2983 iwl4965_hw_detect(priv); 2983 il4965_hw_detect(priv);
2984 IWL_INFO(priv, "Detected %s, REV=0x%X\n", 2984 IL_INFO(priv, "Detected %s, REV=0x%X\n",
2985 priv->cfg->name, priv->hw_rev); 2985 priv->cfg->name, priv->hw_rev);
2986 2986
2987 /* We disable the RETRY_TIMEOUT register (0x41) to keep 2987 /* We disable the RETRY_TIMEOUT register (0x41) to keep
2988 * PCI Tx retries from interfering with C3 CPU state */ 2988 * PCI Tx retries from interfering with C3 CPU state */
2989 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); 2989 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);
2990 2990
2991 iwl4965_prepare_card_hw(priv); 2991 il4965_prepare_card_hw(priv);
2992 if (!priv->hw_ready) { 2992 if (!priv->hw_ready) {
2993 IWL_WARN(priv, "Failed, HW not ready\n"); 2993 IL_WARN(priv, "Failed, HW not ready\n");
2994 goto out_iounmap; 2994 goto out_iounmap;
2995 } 2995 }
2996 2996
@@ -2998,12 +2998,12 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2998 * 4. Read EEPROM 2998 * 4. Read EEPROM
2999 *****************/ 2999 *****************/
3000 /* Read the EEPROM */ 3000 /* Read the EEPROM */
3001 err = iwl_legacy_eeprom_init(priv); 3001 err = il_eeprom_init(priv);
3002 if (err) { 3002 if (err) {
3003 IWL_ERR(priv, "Unable to init EEPROM\n"); 3003 IL_ERR(priv, "Unable to init EEPROM\n");
3004 goto out_iounmap; 3004 goto out_iounmap;
3005 } 3005 }
3006 err = iwl4965_eeprom_check_version(priv); 3006 err = il4965_eeprom_check_version(priv);
3007 if (err) 3007 if (err)
3008 goto out_free_eeprom; 3008 goto out_free_eeprom;
3009 3009
@@ -3011,16 +3011,16 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3011 goto out_free_eeprom; 3011 goto out_free_eeprom;
3012 3012
3013 /* extract MAC Address */ 3013 /* extract MAC Address */
3014 iwl4965_eeprom_get_mac(priv, priv->addresses[0].addr); 3014 il4965_eeprom_get_mac(priv, priv->addresses[0].addr);
3015 IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr); 3015 IL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr);
3016 priv->hw->wiphy->addresses = priv->addresses; 3016 priv->hw->wiphy->addresses = priv->addresses;
3017 priv->hw->wiphy->n_addresses = 1; 3017 priv->hw->wiphy->n_addresses = 1;
3018 3018
3019 /************************ 3019 /************************
3020 * 5. Setup HW constants 3020 * 5. Setup HW constants
3021 ************************/ 3021 ************************/
3022 if (iwl4965_set_hw_params(priv)) { 3022 if (il4965_set_hw_params(priv)) {
3023 IWL_ERR(priv, "failed to set hw parameters\n"); 3023 IL_ERR(priv, "failed to set hw parameters\n");
3024 goto out_free_eeprom; 3024 goto out_free_eeprom;
3025 } 3025 }
3026 3026
@@ -3028,7 +3028,7 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3028 * 6. Setup priv 3028 * 6. Setup priv
3029 *******************/ 3029 *******************/
3030 3030
3031 err = iwl4965_init_drv(priv); 3031 err = il4965_init_drv(priv);
3032 if (err) 3032 if (err)
3033 goto out_free_eeprom; 3033 goto out_free_eeprom;
3034 /* At this point both hw and priv are initialized. */ 3034 /* At this point both hw and priv are initialized. */
@@ -3037,20 +3037,20 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3037 * 7. Setup services 3037 * 7. Setup services
3038 ********************/ 3038 ********************/
3039 spin_lock_irqsave(&priv->lock, flags); 3039 spin_lock_irqsave(&priv->lock, flags);
3040 iwl_legacy_disable_interrupts(priv); 3040 il_disable_interrupts(priv);
3041 spin_unlock_irqrestore(&priv->lock, flags); 3041 spin_unlock_irqrestore(&priv->lock, flags);
3042 3042
3043 pci_enable_msi(priv->pci_dev); 3043 pci_enable_msi(priv->pci_dev);
3044 3044
3045 err = request_irq(priv->pci_dev->irq, iwl_legacy_isr, 3045 err = request_irq(priv->pci_dev->irq, il_isr,
3046 IRQF_SHARED, DRV_NAME, priv); 3046 IRQF_SHARED, DRV_NAME, priv);
3047 if (err) { 3047 if (err) {
3048 IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); 3048 IL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);
3049 goto out_disable_msi; 3049 goto out_disable_msi;
3050 } 3050 }
3051 3051
3052 iwl4965_setup_deferred_work(priv); 3052 il4965_setup_deferred_work(priv);
3053 iwl4965_setup_rx_handlers(priv); 3053 il4965_setup_rx_handlers(priv);
3054 3054
3055 /********************************************* 3055 /*********************************************
3056 * 8. Enable interrupts and read RFKILL state 3056 * 8. Enable interrupts and read RFKILL state
@@ -3063,10 +3063,10 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3063 pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); 3063 pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
3064 } 3064 }
3065 3065
3066 iwl_legacy_enable_rfkill_int(priv); 3066 il_enable_rfkill_int(priv);
3067 3067
3068 /* If platform's RF_KILL switch is NOT set to KILL */ 3068 /* If platform's RF_KILL switch is NOT set to KILL */
3069 if (iwl_read32(priv, CSR_GP_CNTRL) & 3069 if (il_read32(priv, CSR_GP_CNTRL) &
3070 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 3070 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
3071 clear_bit(STATUS_RF_KILL_HW, &priv->status); 3071 clear_bit(STATUS_RF_KILL_HW, &priv->status);
3072 else 3072 else
@@ -3075,11 +3075,11 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3075 wiphy_rfkill_set_hw_state(priv->hw->wiphy, 3075 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
3076 test_bit(STATUS_RF_KILL_HW, &priv->status)); 3076 test_bit(STATUS_RF_KILL_HW, &priv->status));
3077 3077
3078 iwl_legacy_power_initialize(priv); 3078 il_power_initialize(priv);
3079 3079
3080 init_completion(&priv->_4965.firmware_loading_complete); 3080 init_completion(&priv->_4965.firmware_loading_complete);
3081 3081
3082 err = iwl4965_request_firmware(priv, true); 3082 err = il4965_request_firmware(priv, true);
3083 if (err) 3083 if (err)
3084 goto out_destroy_workqueue; 3084 goto out_destroy_workqueue;
3085 3085
@@ -3091,9 +3091,9 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3091 free_irq(priv->pci_dev->irq, priv); 3091 free_irq(priv->pci_dev->irq, priv);
3092 out_disable_msi: 3092 out_disable_msi:
3093 pci_disable_msi(priv->pci_dev); 3093 pci_disable_msi(priv->pci_dev);
3094 iwl4965_uninit_drv(priv); 3094 il4965_uninit_drv(priv);
3095 out_free_eeprom: 3095 out_free_eeprom:
3096 iwl_legacy_eeprom_free(priv); 3096 il_eeprom_free(priv);
3097 out_iounmap: 3097 out_iounmap:
3098 pci_iounmap(pdev, priv->hw_base); 3098 pci_iounmap(pdev, priv->hw_base);
3099 out_pci_release_regions: 3099 out_pci_release_regions:
@@ -3102,15 +3102,15 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3102 out_pci_disable_device: 3102 out_pci_disable_device:
3103 pci_disable_device(pdev); 3103 pci_disable_device(pdev);
3104 out_ieee80211_free_hw: 3104 out_ieee80211_free_hw:
3105 iwl_legacy_free_traffic_mem(priv); 3105 il_free_traffic_mem(priv);
3106 ieee80211_free_hw(priv->hw); 3106 ieee80211_free_hw(priv->hw);
3107 out: 3107 out:
3108 return err; 3108 return err;
3109} 3109}
3110 3110
3111static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) 3111static void __devexit il4965_pci_remove(struct pci_dev *pdev)
3112{ 3112{
3113 struct iwl_priv *priv = pci_get_drvdata(pdev); 3113 struct il_priv *priv = pci_get_drvdata(pdev);
3114 unsigned long flags; 3114 unsigned long flags;
3115 3115
3116 if (!priv) 3116 if (!priv)
@@ -3118,62 +3118,62 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
3118 3118
3119 wait_for_completion(&priv->_4965.firmware_loading_complete); 3119 wait_for_completion(&priv->_4965.firmware_loading_complete);
3120 3120
3121 IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); 3121 IL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n");
3122 3122
3123 iwl_legacy_dbgfs_unregister(priv); 3123 il_dbgfs_unregister(priv);
3124 sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); 3124 sysfs_remove_group(&pdev->dev.kobj, &il_attribute_group);
3125 3125
3126 /* ieee80211_unregister_hw call wil cause iwl_mac_stop to 3126 /* ieee80211_unregister_hw call wil cause il_mac_stop to
3127 * to be called and iwl4965_down since we are removing the device 3127 * to be called and il4965_down since we are removing the device
3128 * we need to set STATUS_EXIT_PENDING bit. 3128 * we need to set STATUS_EXIT_PENDING bit.
3129 */ 3129 */
3130 set_bit(STATUS_EXIT_PENDING, &priv->status); 3130 set_bit(STATUS_EXIT_PENDING, &priv->status);
3131 3131
3132 iwl_legacy_leds_exit(priv); 3132 il_leds_exit(priv);
3133 3133
3134 if (priv->mac80211_registered) { 3134 if (priv->mac80211_registered) {
3135 ieee80211_unregister_hw(priv->hw); 3135 ieee80211_unregister_hw(priv->hw);
3136 priv->mac80211_registered = 0; 3136 priv->mac80211_registered = 0;
3137 } else { 3137 } else {
3138 iwl4965_down(priv); 3138 il4965_down(priv);
3139 } 3139 }
3140 3140
3141 /* 3141 /*
3142 * Make sure device is reset to low power before unloading driver. 3142 * Make sure device is reset to low power before unloading driver.
3143 * This may be redundant with iwl4965_down(), but there are paths to 3143 * This may be redundant with il4965_down(), but there are paths to
3144 * run iwl4965_down() without calling apm_ops.stop(), and there are 3144 * run il4965_down() without calling apm_ops.stop(), and there are
3145 * paths to avoid running iwl4965_down() at all before leaving driver. 3145 * paths to avoid running il4965_down() at all before leaving driver.
3146 * This (inexpensive) call *makes sure* device is reset. 3146 * This (inexpensive) call *makes sure* device is reset.
3147 */ 3147 */
3148 iwl_legacy_apm_stop(priv); 3148 il_apm_stop(priv);
3149 3149
3150 /* make sure we flush any pending irq or 3150 /* make sure we flush any pending irq or
3151 * tasklet for the driver 3151 * tasklet for the driver
3152 */ 3152 */
3153 spin_lock_irqsave(&priv->lock, flags); 3153 spin_lock_irqsave(&priv->lock, flags);
3154 iwl_legacy_disable_interrupts(priv); 3154 il_disable_interrupts(priv);
3155 spin_unlock_irqrestore(&priv->lock, flags); 3155 spin_unlock_irqrestore(&priv->lock, flags);
3156 3156
3157 iwl4965_synchronize_irq(priv); 3157 il4965_synchronize_irq(priv);
3158 3158
3159 iwl4965_dealloc_ucode_pci(priv); 3159 il4965_dealloc_ucode_pci(priv);
3160 3160
3161 if (priv->rxq.bd) 3161 if (priv->rxq.bd)
3162 iwl4965_rx_queue_free(priv, &priv->rxq); 3162 il4965_rx_queue_free(priv, &priv->rxq);
3163 iwl4965_hw_txq_ctx_free(priv); 3163 il4965_hw_txq_ctx_free(priv);
3164 3164
3165 iwl_legacy_eeprom_free(priv); 3165 il_eeprom_free(priv);
3166 3166
3167 3167
3168 /*netif_stop_queue(dev); */ 3168 /*netif_stop_queue(dev); */
3169 flush_workqueue(priv->workqueue); 3169 flush_workqueue(priv->workqueue);
3170 3170
3171 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes 3171 /* ieee80211_unregister_hw calls il_mac_stop, which flushes
3172 * priv->workqueue... so we can't take down the workqueue 3172 * priv->workqueue... so we can't take down the workqueue
3173 * until now... */ 3173 * until now... */
3174 destroy_workqueue(priv->workqueue); 3174 destroy_workqueue(priv->workqueue);
3175 priv->workqueue = NULL; 3175 priv->workqueue = NULL;
3176 iwl_legacy_free_traffic_mem(priv); 3176 il_free_traffic_mem(priv);
3177 3177
3178 free_irq(priv->pci_dev->irq, priv); 3178 free_irq(priv->pci_dev->irq, priv);
3179 pci_disable_msi(priv->pci_dev); 3179 pci_disable_msi(priv->pci_dev);
@@ -3182,7 +3182,7 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
3182 pci_disable_device(pdev); 3182 pci_disable_device(pdev);
3183 pci_set_drvdata(pdev, NULL); 3183 pci_set_drvdata(pdev, NULL);
3184 3184
3185 iwl4965_uninit_drv(priv); 3185 il4965_uninit_drv(priv);
3186 3186
3187 dev_kfree_skb(priv->beacon_skb); 3187 dev_kfree_skb(priv->beacon_skb);
3188 3188
@@ -3193,9 +3193,9 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
3193 * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask 3193 * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask
3194 * must be called under priv->lock and mac access 3194 * must be called under priv->lock and mac access
3195 */ 3195 */
3196void iwl4965_txq_set_sched(struct iwl_priv *priv, u32 mask) 3196void il4965_txq_set_sched(struct il_priv *priv, u32 mask)
3197{ 3197{
3198 iwl_legacy_write_prph(priv, IWL49_SCD_TXFACT, mask); 3198 il_write_prph(priv, IWL49_SCD_TXFACT, mask);
3199} 3199}
3200 3200
3201/***************************************************************************** 3201/*****************************************************************************
@@ -3205,38 +3205,38 @@ void iwl4965_txq_set_sched(struct iwl_priv *priv, u32 mask)
3205 *****************************************************************************/ 3205 *****************************************************************************/
3206 3206
3207/* Hardware specific file defines the PCI IDs table for that hardware module */ 3207/* Hardware specific file defines the PCI IDs table for that hardware module */
3208static DEFINE_PCI_DEVICE_TABLE(iwl4965_hw_card_ids) = { 3208static DEFINE_PCI_DEVICE_TABLE(il4965_hw_card_ids) = {
3209#if defined(CONFIG_IWL4965_MODULE) || defined(CONFIG_IWL4965) 3209#if defined(CONFIG_IWL4965_MODULE) || defined(CONFIG_IWL4965)
3210 {IWL_PCI_DEVICE(0x4229, PCI_ANY_ID, iwl4965_cfg)}, 3210 {IL_PCI_DEVICE(0x4229, PCI_ANY_ID, il4965_cfg)},
3211 {IWL_PCI_DEVICE(0x4230, PCI_ANY_ID, iwl4965_cfg)}, 3211 {IL_PCI_DEVICE(0x4230, PCI_ANY_ID, il4965_cfg)},
3212#endif /* CONFIG_IWL4965 */ 3212#endif /* CONFIG_IWL4965 */
3213 3213
3214 {0} 3214 {0}
3215}; 3215};
3216MODULE_DEVICE_TABLE(pci, iwl4965_hw_card_ids); 3216MODULE_DEVICE_TABLE(pci, il4965_hw_card_ids);
3217 3217
3218static struct pci_driver iwl4965_driver = { 3218static struct pci_driver il4965_driver = {
3219 .name = DRV_NAME, 3219 .name = DRV_NAME,
3220 .id_table = iwl4965_hw_card_ids, 3220 .id_table = il4965_hw_card_ids,
3221 .probe = iwl4965_pci_probe, 3221 .probe = il4965_pci_probe,
3222 .remove = __devexit_p(iwl4965_pci_remove), 3222 .remove = __devexit_p(il4965_pci_remove),
3223 .driver.pm = IWL_LEGACY_PM_OPS, 3223 .driver.pm = IL_LEGACY_PM_OPS,
3224}; 3224};
3225 3225
3226static int __init iwl4965_init(void) 3226static int __init il4965_init(void)
3227{ 3227{
3228 3228
3229 int ret; 3229 int ret;
3230 pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); 3230 pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n");
3231 pr_info(DRV_COPYRIGHT "\n"); 3231 pr_info(DRV_COPYRIGHT "\n");
3232 3232
3233 ret = iwl4965_rate_control_register(); 3233 ret = il4965_rate_control_register();
3234 if (ret) { 3234 if (ret) {
3235 pr_err("Unable to register rate control algorithm: %d\n", ret); 3235 pr_err("Unable to register rate control algorithm: %d\n", ret);
3236 return ret; 3236 return ret;
3237 } 3237 }
3238 3238
3239 ret = pci_register_driver(&iwl4965_driver); 3239 ret = pci_register_driver(&il4965_driver);
3240 if (ret) { 3240 if (ret) {
3241 pr_err("Unable to initialize PCI module\n"); 3241 pr_err("Unable to initialize PCI module\n");
3242 goto error_register; 3242 goto error_register;
@@ -3245,32 +3245,32 @@ static int __init iwl4965_init(void)
3245 return ret; 3245 return ret;
3246 3246
3247error_register: 3247error_register:
3248 iwl4965_rate_control_unregister(); 3248 il4965_rate_control_unregister();
3249 return ret; 3249 return ret;
3250} 3250}
3251 3251
3252static void __exit iwl4965_exit(void) 3252static void __exit il4965_exit(void)
3253{ 3253{
3254 pci_unregister_driver(&iwl4965_driver); 3254 pci_unregister_driver(&il4965_driver);
3255 iwl4965_rate_control_unregister(); 3255 il4965_rate_control_unregister();
3256} 3256}
3257 3257
3258module_exit(iwl4965_exit); 3258module_exit(il4965_exit);
3259module_init(iwl4965_init); 3259module_init(il4965_init);
3260 3260
3261#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 3261#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
3262module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR); 3262module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR);
3263MODULE_PARM_DESC(debug, "debug output mask"); 3263MODULE_PARM_DESC(debug, "debug output mask");
3264#endif 3264#endif
3265 3265
3266module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, S_IRUGO); 3266module_param_named(swcrypto, il4965_mod_params.sw_crypto, int, S_IRUGO);
3267MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); 3267MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])");
3268module_param_named(queues_num, iwl4965_mod_params.num_of_queues, int, S_IRUGO); 3268module_param_named(queues_num, il4965_mod_params.num_of_queues, int, S_IRUGO);
3269MODULE_PARM_DESC(queues_num, "number of hw queues."); 3269MODULE_PARM_DESC(queues_num, "number of hw queues.");
3270module_param_named(11n_disable, iwl4965_mod_params.disable_11n, int, S_IRUGO); 3270module_param_named(11n_disable, il4965_mod_params.disable_11n, int, S_IRUGO);
3271MODULE_PARM_DESC(11n_disable, "disable 11n functionality"); 3271MODULE_PARM_DESC(11n_disable, "disable 11n functionality");
3272module_param_named(amsdu_size_8K, iwl4965_mod_params.amsdu_size_8K, 3272module_param_named(amsdu_size_8K, il4965_mod_params.amsdu_size_8K,
3273 int, S_IRUGO); 3273 int, S_IRUGO);
3274MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size"); 3274MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size");
3275module_param_named(fw_restart, iwl4965_mod_params.restart_fw, int, S_IRUGO); 3275module_param_named(fw_restart, il4965_mod_params.restart_fw, int, S_IRUGO);
3276MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); 3276MODULE_PARM_DESC(fw_restart, "restart firmware in case of error");