From e2ebc8337d116acdc25469ec8547ae665f50a4c1 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Mon, 24 Oct 2011 15:41:30 +0200 Subject: [PATCH] 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 --- drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c | 32 +- drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h | 12 +- drivers/net/wireless/iwlegacy/iwl-3945-fh.h | 12 +- drivers/net/wireless/iwlegacy/iwl-3945-hw.h | 46 +- drivers/net/wireless/iwlegacy/iwl-3945-led.c | 14 +- drivers/net/wireless/iwlegacy/iwl-3945-led.h | 8 +- drivers/net/wireless/iwlegacy/iwl-3945-rs.c | 468 +++--- drivers/net/wireless/iwlegacy/iwl-3945.c | 1200 ++++++++-------- drivers/net/wireless/iwlegacy/iwl-3945.h | 186 +-- drivers/net/wireless/iwlegacy/iwl-4965-calib.c | 210 +-- drivers/net/wireless/iwlegacy/iwl-4965-calib.h | 16 +- drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c | 32 +- drivers/net/wireless/iwlegacy/iwl-4965-debugfs.h | 12 +- drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c | 26 +- drivers/net/wireless/iwlegacy/iwl-4965-hw.h | 82 +- drivers/net/wireless/iwlegacy/iwl-4965-led.c | 20 +- drivers/net/wireless/iwlegacy/iwl-4965-led.h | 10 +- drivers/net/wireless/iwlegacy/iwl-4965-lib.c | 380 ++--- drivers/net/wireless/iwlegacy/iwl-4965-rs.c | 1112 +++++++-------- drivers/net/wireless/iwlegacy/iwl-4965-rx.c | 52 +- drivers/net/wireless/iwlegacy/iwl-4965-sta.c | 258 ++-- drivers/net/wireless/iwlegacy/iwl-4965-tx.c | 442 +++--- drivers/net/wireless/iwlegacy/iwl-4965-ucode.c | 50 +- drivers/net/wireless/iwlegacy/iwl-4965.c | 846 +++++------ drivers/net/wireless/iwlegacy/iwl-4965.h | 202 +-- drivers/net/wireless/iwlegacy/iwl-commands.h | 506 +++---- drivers/net/wireless/iwlegacy/iwl-core.c | 994 ++++++------- drivers/net/wireless/iwlegacy/iwl-core.h | 434 +++--- drivers/net/wireless/iwlegacy/iwl-csr.h | 16 +- drivers/net/wireless/iwlegacy/iwl-debug.h | 194 +-- drivers/net/wireless/iwlegacy/iwl-debugfs.c | 284 ++-- drivers/net/wireless/iwlegacy/iwl-dev.h | 440 +++--- drivers/net/wireless/iwlegacy/iwl-eeprom.c | 156 +- drivers/net/wireless/iwlegacy/iwl-eeprom.h | 60 +- drivers/net/wireless/iwlegacy/iwl-fh.h | 38 +- drivers/net/wireless/iwlegacy/iwl-hcmd.c | 186 +-- drivers/net/wireless/iwlegacy/iwl-helpers.h | 66 +- drivers/net/wireless/iwlegacy/iwl-io.h | 326 ++--- drivers/net/wireless/iwlegacy/iwl-led.c | 60 +- drivers/net/wireless/iwlegacy/iwl-led.h | 34 +- drivers/net/wireless/iwlegacy/iwl-legacy-rs.h | 404 +++--- drivers/net/wireless/iwlegacy/iwl-power.c | 64 +- drivers/net/wireless/iwlegacy/iwl-power.h | 32 +- drivers/net/wireless/iwlegacy/iwl-prph.h | 18 +- drivers/net/wireless/iwlegacy/iwl-rx.c | 72 +- drivers/net/wireless/iwlegacy/iwl-scan.c | 258 ++-- drivers/net/wireless/iwlegacy/iwl-spectrum.h | 4 +- drivers/net/wireless/iwlegacy/iwl-sta.c | 376 ++--- drivers/net/wireless/iwlegacy/iwl-sta.h | 78 +- drivers/net/wireless/iwlegacy/iwl-tx.c | 200 +-- drivers/net/wireless/iwlegacy/iwl3945-base.c | 1664 +++++++++++----------- drivers/net/wireless/iwlegacy/iwl4965-base.c | 1382 +++++++++--------- 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 cfabb38..954aed4 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c @@ -29,7 +29,7 @@ #include "iwl-3945-debugfs.h" -static int iwl3945_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz) +static int il3945_statistics_flag(struct il_priv *priv, char *buf, int bufsz) { int p = 0; @@ -50,11 +50,11 @@ static int iwl3945_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz) return p; } -ssize_t iwl3945_ucode_rx_stats_read(struct file *file, +ssize_t il3945_ucode_rx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0; char *buf; int bufsz = sizeof(struct iwl39_statistics_rx_phy) * 40 + @@ -66,12 +66,12 @@ ssize_t iwl3945_ucode_rx_stats_read(struct file *file, struct iwl39_statistics_rx_non_phy *general, *accum_general; struct iwl39_statistics_rx_non_phy *delta_general, *max_general; - if (!iwl_legacy_is_alive(priv)) + if (!il_is_alive(priv)) return -EAGAIN; buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate Buffer\n"); + IL_ERR(priv, "Can not allocate Buffer\n"); return -ENOMEM; } @@ -93,7 +93,7 @@ ssize_t iwl3945_ucode_rx_stats_read(struct file *file, max_cck = &priv->_3945.max_delta.rx.cck; max_general = &priv->_3945.max_delta.rx.general; - pos += iwl3945_statistics_flag(priv, buf, bufsz); + pos += il3945_statistics_flag(priv, buf, bufsz); pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" "acumulative delta max\n", "Statistics_Rx - OFDM:"); @@ -325,23 +325,23 @@ ssize_t iwl3945_ucode_rx_stats_read(struct file *file, return ret; } -ssize_t iwl3945_ucode_tx_stats_read(struct file *file, +ssize_t il3945_ucode_tx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0; char *buf; int bufsz = (sizeof(struct iwl39_statistics_tx) * 48) + 250; ssize_t ret; struct iwl39_statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; - if (!iwl_legacy_is_alive(priv)) + if (!il_is_alive(priv)) return -EAGAIN; buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate Buffer\n"); + IL_ERR(priv, "Can not allocate Buffer\n"); return -ENOMEM; } @@ -354,7 +354,7 @@ ssize_t iwl3945_ucode_tx_stats_read(struct file *file, accum_tx = &priv->_3945.accum_statistics.tx; delta_tx = &priv->_3945.delta_statistics.tx; max_tx = &priv->_3945.max_delta.tx; - pos += iwl3945_statistics_flag(priv, buf, bufsz); + pos += il3945_statistics_flag(priv, buf, bufsz); pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" "acumulative delta max\n", "Statistics_Tx:"); @@ -421,11 +421,11 @@ ssize_t iwl3945_ucode_tx_stats_read(struct file *file, return ret; } -ssize_t iwl3945_ucode_general_stats_read(struct file *file, +ssize_t il3945_ucode_general_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0; char *buf; int bufsz = sizeof(struct iwl39_statistics_general) * 10 + 300; @@ -435,12 +435,12 @@ ssize_t iwl3945_ucode_general_stats_read(struct file *file, struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; struct iwl39_statistics_div *div, *accum_div, *delta_div, *max_div; - if (!iwl_legacy_is_alive(priv)) + if (!il_is_alive(priv)) return -EAGAIN; buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate Buffer\n"); + IL_ERR(priv, "Can not allocate Buffer\n"); return -ENOMEM; } @@ -461,7 +461,7 @@ ssize_t iwl3945_ucode_general_stats_read(struct file *file, accum_div = &priv->_3945.accum_statistics.general.div; delta_div = &priv->_3945.delta_statistics.general.div; max_div = &priv->_3945.max_delta.general.div; - pos += iwl3945_statistics_flag(priv, buf, bufsz); + pos += il3945_statistics_flag(priv, buf, bufsz); pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" "acumulative delta max\n", "Statistics_General:"); diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h index 8fef4b3..54334ac 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h +++ b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h @@ -31,27 +31,27 @@ #include "iwl-debug.h" #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS -ssize_t iwl3945_ucode_rx_stats_read(struct file *file, char __user *user_buf, +ssize_t il3945_ucode_rx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos); -ssize_t iwl3945_ucode_tx_stats_read(struct file *file, char __user *user_buf, +ssize_t il3945_ucode_tx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos); -ssize_t iwl3945_ucode_general_stats_read(struct file *file, +ssize_t il3945_ucode_general_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos); #else -static ssize_t iwl3945_ucode_rx_stats_read(struct file *file, +static ssize_t il3945_ucode_rx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { return 0; } -static ssize_t iwl3945_ucode_tx_stats_read(struct file *file, +static ssize_t il3945_ucode_tx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { return 0; } -static ssize_t iwl3945_ucode_general_stats_read(struct file *file, +static ssize_t il3945_ucode_general_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-fh.h b/drivers/net/wireless/iwlegacy/iwl-3945-fh.h index 836c991..b98cabb 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-fh.h +++ b/drivers/net/wireless/iwlegacy/iwl-3945-fh.h @@ -60,8 +60,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *****************************************************************************/ -#ifndef __iwl_3945_fh_h__ -#define __iwl_3945_fh_h__ +#ifndef __il_3945_fh_h__ +#define __il_3945_fh_h__ /************************************/ /* iwl3945 Flow Handler Definitions */ @@ -172,16 +172,16 @@ #define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) -struct iwl3945_tfd_tb { +struct il3945_tfd_tb { __le32 addr; __le32 len; } __packed; -struct iwl3945_tfd { +struct il3945_tfd { __le32 control_flags; - struct iwl3945_tfd_tb tbs[4]; + struct il3945_tfd_tb tbs[4]; u8 __pad[28]; } __packed; -#endif /* __iwl_3945_fh_h__ */ +#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 5c3a68d..ad05093 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h @@ -66,8 +66,8 @@ * Please use iwl-3945.h for driver implementation definitions. */ -#ifndef __iwl_3945_hw__ -#define __iwl_3945_hw__ +#ifndef __il_3945_hw__ +#define __il_3945_hw__ #include "iwl-eeprom.h" @@ -90,7 +90,7 @@ * Data copied from EEPROM. * DO NOT ALTER THIS STRUCTURE!!! */ -struct iwl3945_eeprom_txpower_sample { +struct il3945_eeprom_txpower_sample { u8 gain_index; /* index into power (gain) setup table ... */ s8 power; /* ... for this pwr level for this chnl group */ u16 v_det; /* PA output voltage */ @@ -104,8 +104,8 @@ struct iwl3945_eeprom_txpower_sample { * Data copied from EEPROM. * DO NOT ALTER THIS STRUCTURE!!! */ -struct iwl3945_eeprom_txpower_group { - struct iwl3945_eeprom_txpower_sample samples[5]; /* 5 power levels */ +struct il3945_eeprom_txpower_group { + struct il3945_eeprom_txpower_sample samples[5]; /* 5 power levels */ s32 a, b, c, d, e; /* coefficients for voltage->power * formula (signed) */ s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on @@ -123,7 +123,7 @@ struct iwl3945_eeprom_txpower_group { * difference between current temperature and factory calib temperature. * Data copied from EEPROM. */ -struct iwl3945_eeprom_temperature_corr { +struct il3945_eeprom_temperature_corr { u32 Ta; u32 Tb; u32 Tc; @@ -134,7 +134,7 @@ struct iwl3945_eeprom_temperature_corr { /* * EEPROM map */ -struct iwl3945_eeprom { +struct il3945_eeprom { u8 reserved0[16]; u16 device_id; /* abs.ofs: 16 */ u8 reserved1[2]; @@ -171,7 +171,7 @@ struct iwl3945_eeprom { * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 */ u16 band_1_count; /* abs.ofs: 196 */ - struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 198 */ + struct il_eeprom_channel band_1_channels[14]; /* abs.ofs: 198 */ /* * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196, @@ -179,38 +179,38 @@ struct iwl3945_eeprom { * (4915-5080MHz) (none of these is ever supported) */ u16 band_2_count; /* abs.ofs: 226 */ - struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ + struct il_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ /* * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 * (5170-5320MHz) */ u16 band_3_count; /* abs.ofs: 254 */ - struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ + struct il_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ /* * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 * (5500-5700MHz) */ u16 band_4_count; /* abs.ofs: 280 */ - struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ + struct il_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ /* * 5.7 GHz channels 145, 149, 153, 157, 161, 165 * (5725-5825MHz) */ u16 band_5_count; /* abs.ofs: 304 */ - struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ + struct il_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ u8 reserved9[194]; /* * 3945 Txpower calibration data. */ -#define IWL_NUM_TX_CALIB_GROUPS 5 - struct iwl3945_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS]; +#define IL_NUM_TX_CALIB_GROUPS 5 + struct il3945_eeprom_txpower_group groups[IL_NUM_TX_CALIB_GROUPS]; /* abs.ofs: 512 */ - struct iwl3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ + struct il3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ u8 reserved16[172]; /* fill out to full 1024 byte block */ } __packed; @@ -225,7 +225,7 @@ struct iwl3945_eeprom { #define IWL39_NUM_QUEUES 5 #define IWL39_CMD_QUEUE_NUM 4 -#define IWL_DEFAULT_TX_RETRY 15 +#define IL_DEFAULT_TX_RETRY 15 /*********************************************/ @@ -262,29 +262,29 @@ struct iwl3945_eeprom { /* Size of uCode instruction memory in bootstrap state machine */ #define IWL39_MAX_BSM_SIZE IWL39_RTC_INST_SIZE -static inline int iwl3945_hw_valid_rtc_data_addr(u32 addr) +static inline int il3945_hw_valid_rtc_data_addr(u32 addr) { return (addr >= IWL39_RTC_DATA_LOWER_BOUND) && (addr < IWL39_RTC_DATA_UPPER_BOUND); } -/* Base physical address of iwl3945_shared is provided to FH_TSSR_CBB_BASE - * and &iwl3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */ -struct iwl3945_shared { +/* Base physical address of il3945_shared is provided to FH_TSSR_CBB_BASE + * and &il3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */ +struct il3945_shared { __le32 tx_base_ptr[8]; } __packed; -static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags) +static inline u8 il3945_hw_get_rate(__le16 rate_n_flags) { return le16_to_cpu(rate_n_flags) & 0xFF; } -static inline u16 iwl3945_hw_get_rate_n_flags(__le16 rate_n_flags) +static inline u16 il3945_hw_get_rate_n_flags(__le16 rate_n_flags) { return le16_to_cpu(rate_n_flags); } -static inline __le16 iwl3945_hw_set_rate_n_flags(u8 rate, u16 flags) +static inline __le16 il3945_hw_set_rate_n_flags(u8 rate, u16 flags) { return cpu_to_le16((u16)rate|flags); } diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-led.c b/drivers/net/wireless/iwlegacy/iwl-3945-led.c index 7a7f0f3..69703b0 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-led.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945-led.c @@ -44,20 +44,20 @@ /* Send led command */ -static int iwl3945_send_led_cmd(struct iwl_priv *priv, - struct iwl_led_cmd *led_cmd) +static int il3945_send_led_cmd(struct il_priv *priv, + struct il_led_cmd *led_cmd) { - struct iwl_host_cmd cmd = { + struct il_host_cmd cmd = { .id = REPLY_LEDS_CMD, - .len = sizeof(struct iwl_led_cmd), + .len = sizeof(struct il_led_cmd), .data = led_cmd, .flags = CMD_ASYNC, .callback = NULL, }; - return iwl_legacy_send_cmd(priv, &cmd); + return il_send_cmd(priv, &cmd); } -const struct iwl_led_ops iwl3945_led_ops = { - .cmd = iwl3945_send_led_cmd, +const struct il_led_ops il3945_led_ops = { + .cmd = il3945_send_led_cmd, }; diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-led.h b/drivers/net/wireless/iwlegacy/iwl-3945-led.h index 9671627..369c72d 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-led.h +++ b/drivers/net/wireless/iwlegacy/iwl-3945-led.h @@ -24,9 +24,9 @@ * *****************************************************************************/ -#ifndef __iwl_3945_led_h__ -#define __iwl_3945_led_h__ +#ifndef __il_3945_led_h__ +#define __il_3945_led_h__ -extern const struct iwl_led_ops iwl3945_led_ops; +extern const struct il_led_ops il3945_led_ops; -#endif /* __iwl_3945_led_h__ */ +#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 8faeaf2..d97f24b 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c @@ -42,80 +42,80 @@ #define RS_NAME "iwl-3945-rs" -static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT_3945] = { +static s32 il3945_expected_tpt_g[IL_RATE_COUNT_3945] = { 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 }; -static s32 iwl3945_expected_tpt_g_prot[IWL_RATE_COUNT_3945] = { +static s32 il3945_expected_tpt_g_prot[IL_RATE_COUNT_3945] = { 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125 }; -static s32 iwl3945_expected_tpt_a[IWL_RATE_COUNT_3945] = { +static s32 il3945_expected_tpt_a[IL_RATE_COUNT_3945] = { 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186 }; -static s32 iwl3945_expected_tpt_b[IWL_RATE_COUNT_3945] = { +static s32 il3945_expected_tpt_b[IL_RATE_COUNT_3945] = { 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0 }; -struct iwl3945_tpt_entry { +struct il3945_tpt_entry { s8 min_rssi; u8 index; }; -static struct iwl3945_tpt_entry iwl3945_tpt_table_a[] = { - {-60, IWL_RATE_54M_INDEX}, - {-64, IWL_RATE_48M_INDEX}, - {-72, IWL_RATE_36M_INDEX}, - {-80, IWL_RATE_24M_INDEX}, - {-84, IWL_RATE_18M_INDEX}, - {-85, IWL_RATE_12M_INDEX}, - {-87, IWL_RATE_9M_INDEX}, - {-89, IWL_RATE_6M_INDEX} +static struct il3945_tpt_entry il3945_tpt_table_a[] = { + {-60, IL_RATE_54M_INDEX}, + {-64, IL_RATE_48M_INDEX}, + {-72, IL_RATE_36M_INDEX}, + {-80, IL_RATE_24M_INDEX}, + {-84, IL_RATE_18M_INDEX}, + {-85, IL_RATE_12M_INDEX}, + {-87, IL_RATE_9M_INDEX}, + {-89, IL_RATE_6M_INDEX} }; -static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = { - {-60, IWL_RATE_54M_INDEX}, - {-64, IWL_RATE_48M_INDEX}, - {-68, IWL_RATE_36M_INDEX}, - {-80, IWL_RATE_24M_INDEX}, - {-84, IWL_RATE_18M_INDEX}, - {-85, IWL_RATE_12M_INDEX}, - {-86, IWL_RATE_11M_INDEX}, - {-88, IWL_RATE_5M_INDEX}, - {-90, IWL_RATE_2M_INDEX}, - {-92, IWL_RATE_1M_INDEX} +static struct il3945_tpt_entry il3945_tpt_table_g[] = { + {-60, IL_RATE_54M_INDEX}, + {-64, IL_RATE_48M_INDEX}, + {-68, IL_RATE_36M_INDEX}, + {-80, IL_RATE_24M_INDEX}, + {-84, IL_RATE_18M_INDEX}, + {-85, IL_RATE_12M_INDEX}, + {-86, IL_RATE_11M_INDEX}, + {-88, IL_RATE_5M_INDEX}, + {-90, IL_RATE_2M_INDEX}, + {-92, IL_RATE_1M_INDEX} }; -#define IWL_RATE_MAX_WINDOW 62 -#define IWL_RATE_FLUSH (3*HZ) -#define IWL_RATE_WIN_FLUSH (HZ/2) +#define IL_RATE_MAX_WINDOW 62 +#define IL_RATE_FLUSH (3*HZ) +#define IL_RATE_WIN_FLUSH (HZ/2) #define IWL39_RATE_HIGH_TH 11520 -#define IWL_SUCCESS_UP_TH 8960 -#define IWL_SUCCESS_DOWN_TH 10880 -#define IWL_RATE_MIN_FAILURE_TH 6 -#define IWL_RATE_MIN_SUCCESS_TH 8 -#define IWL_RATE_DECREASE_TH 1920 -#define IWL_RATE_RETRY_TH 15 - -static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) +#define IL_SUCCESS_UP_TH 8960 +#define IL_SUCCESS_DOWN_TH 10880 +#define IL_RATE_MIN_FAILURE_TH 6 +#define IL_RATE_MIN_SUCCESS_TH 8 +#define IL_RATE_DECREASE_TH 1920 +#define IL_RATE_RETRY_TH 15 + +static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) { u32 index = 0; u32 table_size = 0; - struct iwl3945_tpt_entry *tpt_table = NULL; + struct il3945_tpt_entry *tpt_table = NULL; - if ((rssi < IWL_MIN_RSSI_VAL) || (rssi > IWL_MAX_RSSI_VAL)) - rssi = IWL_MIN_RSSI_VAL; + if ((rssi < IL_MIN_RSSI_VAL) || (rssi > IL_MAX_RSSI_VAL)) + rssi = IL_MIN_RSSI_VAL; switch (band) { case IEEE80211_BAND_2GHZ: - tpt_table = iwl3945_tpt_table_g; - table_size = ARRAY_SIZE(iwl3945_tpt_table_g); + tpt_table = il3945_tpt_table_g; + table_size = ARRAY_SIZE(il3945_tpt_table_g); break; case IEEE80211_BAND_5GHZ: - tpt_table = iwl3945_tpt_table_a; - table_size = ARRAY_SIZE(iwl3945_tpt_table_a); + tpt_table = il3945_tpt_table_a; + table_size = ARRAY_SIZE(il3945_tpt_table_a); break; default: @@ -131,46 +131,46 @@ static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) return tpt_table[index].index; } -static void iwl3945_clear_window(struct iwl3945_rate_scale_data *window) +static void il3945_clear_window(struct il3945_rate_scale_data *window) { window->data = 0; window->success_counter = 0; window->success_ratio = -1; window->counter = 0; - window->average_tpt = IWL_INVALID_VALUE; + window->average_tpt = IL_INVALID_VALUE; window->stamp = 0; } /** - * iwl3945_rate_scale_flush_windows - flush out the rate scale windows + * il3945_rate_scale_flush_windows - flush out the rate scale windows * * Returns the number of windows that have gathered data but were * not flushed. If there were any that were not flushed, then * reschedule the rate flushing routine. */ -static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta) +static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta) { int unflushed = 0; int i; unsigned long flags; - struct iwl_priv *priv __maybe_unused = rs_sta->priv; + struct il_priv *priv __maybe_unused = rs_sta->priv; /* * For each rate, if we have collected data on that rate - * and it has been more than IWL_RATE_WIN_FLUSH + * and it has been more than IL_RATE_WIN_FLUSH * since we flushed, clear out the gathered statistics */ - for (i = 0; i < IWL_RATE_COUNT_3945; i++) { + for (i = 0; i < IL_RATE_COUNT_3945; i++) { if (!rs_sta->win[i].counter) continue; spin_lock_irqsave(&rs_sta->lock, flags); if (time_after(jiffies, rs_sta->win[i].stamp + - IWL_RATE_WIN_FLUSH)) { - IWL_DEBUG_RATE(priv, "flushing %d samples of rate " + IL_RATE_WIN_FLUSH)) { + IL_DEBUG_RATE(priv, "flushing %d samples of rate " "index %d\n", rs_sta->win[i].counter, i); - iwl3945_clear_window(&rs_sta->win[i]); + il3945_clear_window(&rs_sta->win[i]); } else unflushed++; spin_unlock_irqrestore(&rs_sta->lock, flags); @@ -179,21 +179,21 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta) return unflushed; } -#define IWL_RATE_FLUSH_MAX 5000 /* msec */ -#define IWL_RATE_FLUSH_MIN 50 /* msec */ -#define IWL_AVERAGE_PACKETS 1500 +#define IL_RATE_FLUSH_MAX 5000 /* msec */ +#define IL_RATE_FLUSH_MIN 50 /* msec */ +#define IL_AVERAGE_PACKETS 1500 -static void iwl3945_bg_rate_scale_flush(unsigned long data) +static void il3945_bg_rate_scale_flush(unsigned long data) { - struct iwl3945_rs_sta *rs_sta = (void *)data; - struct iwl_priv *priv __maybe_unused = rs_sta->priv; + struct il3945_rs_sta *rs_sta = (void *)data; + struct il_priv *priv __maybe_unused = rs_sta->priv; int unflushed = 0; unsigned long flags; u32 packet_count, duration, pps; - IWL_DEBUG_RATE(priv, "enter\n"); + IL_DEBUG_RATE(priv, "enter\n"); - unflushed = iwl3945_rate_scale_flush_windows(rs_sta); + unflushed = il3945_rate_scale_flush_windows(rs_sta); spin_lock_irqsave(&rs_sta->lock, flags); @@ -206,7 +206,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data) duration = jiffies_to_msecs(jiffies - rs_sta->last_partial_flush); - IWL_DEBUG_RATE(priv, "Tx'd %d packets in %dms\n", + IL_DEBUG_RATE(priv, "Tx'd %d packets in %dms\n", packet_count, duration); /* Determine packets per second */ @@ -216,17 +216,17 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data) pps = 0; if (pps) { - duration = (IWL_AVERAGE_PACKETS * 1000) / pps; - if (duration < IWL_RATE_FLUSH_MIN) - duration = IWL_RATE_FLUSH_MIN; - else if (duration > IWL_RATE_FLUSH_MAX) - duration = IWL_RATE_FLUSH_MAX; + duration = (IL_AVERAGE_PACKETS * 1000) / pps; + if (duration < IL_RATE_FLUSH_MIN) + duration = IL_RATE_FLUSH_MIN; + else if (duration > IL_RATE_FLUSH_MAX) + duration = IL_RATE_FLUSH_MAX; } else - duration = IWL_RATE_FLUSH_MAX; + duration = IL_RATE_FLUSH_MAX; rs_sta->flush_time = msecs_to_jiffies(duration); - IWL_DEBUG_RATE(priv, "new flush period: %d msec ave %d\n", + IL_DEBUG_RATE(priv, "new flush period: %d msec ave %d\n", duration, packet_count); mod_timer(&rs_sta->rate_scale_flush, jiffies + @@ -234,7 +234,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data) rs_sta->last_partial_flush = jiffies; } else { - rs_sta->flush_time = IWL_RATE_FLUSH; + rs_sta->flush_time = IL_RATE_FLUSH; rs_sta->flush_pending = 0; } /* 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) spin_unlock_irqrestore(&rs_sta->lock, flags); - IWL_DEBUG_RATE(priv, "leave\n"); + IL_DEBUG_RATE(priv, "leave\n"); } /** - * iwl3945_collect_tx_data - Update the success/failure sliding window + * il3945_collect_tx_data - Update the success/failure sliding window * * We keep a sliding window of the last 64 packets transmitted * at this rate. window->data contains the bitmask of successful * packets. */ -static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, - struct iwl3945_rate_scale_data *window, +static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, + struct il3945_rate_scale_data *window, int success, int retries, int index) { unsigned long flags; s32 fail_count; - struct iwl_priv *priv __maybe_unused = rs_sta->priv; + struct il_priv *priv __maybe_unused = rs_sta->priv; if (!retries) { - IWL_DEBUG_RATE(priv, "leave: retries == 0 -- should be at least 1\n"); + IL_DEBUG_RATE(priv, "leave: retries == 0 -- should be at least 1\n"); return; } @@ -278,13 +278,13 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, * we keep these bitmaps!). * */ while (retries > 0) { - if (window->counter >= IWL_RATE_MAX_WINDOW) { + if (window->counter >= IL_RATE_MAX_WINDOW) { /* remove earliest */ - window->counter = IWL_RATE_MAX_WINDOW - 1; + window->counter = IL_RATE_MAX_WINDOW - 1; - if (window->data & (1ULL << (IWL_RATE_MAX_WINDOW - 1))) { - window->data &= ~(1ULL << (IWL_RATE_MAX_WINDOW - 1)); + if (window->data & (1ULL << (IL_RATE_MAX_WINDOW - 1))) { + window->data &= ~(1ULL << (IL_RATE_MAX_WINDOW - 1)); window->success_counter--; } } @@ -310,17 +310,17 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, window->success_ratio = 128 * (100 * window->success_counter) / window->counter; else - window->success_ratio = IWL_INVALID_VALUE; + window->success_ratio = IL_INVALID_VALUE; fail_count = window->counter - window->success_counter; /* Calculate average throughput, if we have enough history. */ - if ((fail_count >= IWL_RATE_MIN_FAILURE_TH) || - (window->success_counter >= IWL_RATE_MIN_SUCCESS_TH)) + if ((fail_count >= IL_RATE_MIN_FAILURE_TH) || + (window->success_counter >= IL_RATE_MIN_SUCCESS_TH)) window->average_tpt = ((window->success_ratio * rs_sta->expected_tpt[index] + 64) / 128); else - window->average_tpt = IWL_INVALID_VALUE; + window->average_tpt = IL_INVALID_VALUE; /* Tag this window as having been updated */ window->stamp = jiffies; @@ -332,40 +332,40 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, /* * Called after adding a new station to initialize rate scaling */ -void iwl3945_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_id) +void il3945_rs_rate_init(struct il_priv *priv, struct ieee80211_sta *sta, u8 sta_id) { struct ieee80211_hw *hw = priv->hw; struct ieee80211_conf *conf = &priv->hw->conf; - struct iwl3945_sta_priv *psta; - struct iwl3945_rs_sta *rs_sta; + struct il3945_sta_priv *psta; + struct il3945_rs_sta *rs_sta; struct ieee80211_supported_band *sband; int i; - IWL_DEBUG_INFO(priv, "enter\n"); - if (sta_id == priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id) + IL_DEBUG_INFO(priv, "enter\n"); + if (sta_id == priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id) goto out; - psta = (struct iwl3945_sta_priv *) sta->drv_priv; + psta = (struct il3945_sta_priv *) sta->drv_priv; rs_sta = &psta->rs_sta; sband = hw->wiphy->bands[conf->channel->band]; rs_sta->priv = priv; - rs_sta->start_rate = IWL_RATE_INVALID; + rs_sta->start_rate = IL_RATE_INVALID; /* default to just 802.11b */ - rs_sta->expected_tpt = iwl3945_expected_tpt_b; + rs_sta->expected_tpt = il3945_expected_tpt_b; rs_sta->last_partial_flush = jiffies; rs_sta->last_flush = jiffies; - rs_sta->flush_time = IWL_RATE_FLUSH; + rs_sta->flush_time = IL_RATE_FLUSH; rs_sta->last_tx_packets = 0; rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; - rs_sta->rate_scale_flush.function = iwl3945_bg_rate_scale_flush; + rs_sta->rate_scale_flush.function = il3945_bg_rate_scale_flush; - for (i = 0; i < IWL_RATE_COUNT_3945; i++) - iwl3945_clear_window(&rs_sta->win[i]); + for (i = 0; i < IL_RATE_COUNT_3945; i++) + il3945_clear_window(&rs_sta->win[i]); /* TODO: what is a good starting rate for STA? About middle? Maybe not * 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 } priv->_3945.sta_supp_rates = sta->supp_rates[sband->band]; - /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ + /* For 5 GHz band it start at IL_FIRST_OFDM_RATE */ if (sband->band == IEEE80211_BAND_5GHZ) { - rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; + rs_sta->last_txrate_idx += IL_FIRST_OFDM_RATE; priv->_3945.sta_supp_rates = priv->_3945.sta_supp_rates << - IWL_FIRST_OFDM_RATE; + IL_FIRST_OFDM_RATE; } out: - priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; + priv->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS; - IWL_DEBUG_INFO(priv, "leave\n"); + IL_DEBUG_INFO(priv, "leave\n"); } -static void *iwl3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) +static void *il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) { return hw->priv; } /* rate scale requires free function to be implemented */ -static void iwl3945_rs_free(void *priv) +static void il3945_rs_free(void *priv) { return; } -static void *iwl3945_rs_alloc_sta(void *iwl_priv, struct ieee80211_sta *sta, gfp_t gfp) +static void *il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t gfp) { - struct iwl3945_rs_sta *rs_sta; - struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; - struct iwl_priv *priv __maybe_unused = iwl_priv; + struct il3945_rs_sta *rs_sta; + struct il3945_sta_priv *psta = (void *) sta->drv_priv; + struct il_priv *priv __maybe_unused = il_priv; - IWL_DEBUG_RATE(priv, "enter\n"); + IL_DEBUG_RATE(priv, "enter\n"); rs_sta = &psta->rs_sta; spin_lock_init(&rs_sta->lock); init_timer(&rs_sta->rate_scale_flush); - IWL_DEBUG_RATE(priv, "leave\n"); + IL_DEBUG_RATE(priv, "leave\n"); return rs_sta; } -static void iwl3945_rs_free_sta(void *iwl_priv, struct ieee80211_sta *sta, +static void il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta, void *priv_sta) { - struct iwl3945_rs_sta *rs_sta = priv_sta; + struct il3945_rs_sta *rs_sta = priv_sta; /* - * Be careful not to use any members of iwl3945_rs_sta (like trying - * to use iwl_priv to print out debugging) since it may not be fully + * Be careful not to use any members of il3945_rs_sta (like trying + * to use il_priv to print out debugging) since it may not be fully * initialized at this point. */ 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, /** - * iwl3945_rs_tx_status - Update rate control values based on Tx results + * il3945_rs_tx_status - Update rate control values based on Tx results * - * NOTE: Uses iwl_priv->retry_rate for the # of retries attempted by + * NOTE: Uses il_priv->retry_rate for the # of retries attempted by * the hardware for each rate. */ -static void iwl3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband, +static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband, struct ieee80211_sta *sta, void *priv_sta, struct sk_buff *skb) { s8 retries = 0, current_count; int scale_rate_index, first_index, last_index; unsigned long flags; - struct iwl_priv *priv = (struct iwl_priv *)priv_rate; - struct iwl3945_rs_sta *rs_sta = priv_sta; + struct il_priv *priv = (struct il_priv *)priv_rate; + struct il3945_rs_sta *rs_sta = priv_sta; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - IWL_DEBUG_RATE(priv, "enter\n"); + IL_DEBUG_RATE(priv, "enter\n"); retries = info->status.rates[0].count; /* Sanity Check for retries */ - if (retries > IWL_RATE_RETRY_TH) - retries = IWL_RATE_RETRY_TH; + if (retries > IL_RATE_RETRY_TH) + retries = IL_RATE_RETRY_TH; first_index = sband->bitrates[info->status.rates[0].idx].hw_value; - if ((first_index < 0) || (first_index >= IWL_RATE_COUNT_3945)) { - IWL_DEBUG_RATE(priv, "leave: Rate out of bounds: %d\n", first_index); + if ((first_index < 0) || (first_index >= IL_RATE_COUNT_3945)) { + IL_DEBUG_RATE(priv, "leave: Rate out of bounds: %d\n", first_index); return; } if (!priv_sta) { - IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n"); + IL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n"); return; } /* Treat uninitialized rate scaling data same as non-existing. */ if (!rs_sta->priv) { - IWL_DEBUG_RATE(priv, "leave: STA priv data uninitialized!\n"); + IL_DEBUG_RATE(priv, "leave: STA priv data uninitialized!\n"); return; } @@ -499,16 +499,16 @@ static void iwl3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_ban last_index = scale_rate_index; } else { current_count = priv->retry_rate; - last_index = iwl3945_rs_next_rate(priv, + last_index = il3945_rs_next_rate(priv, scale_rate_index); } /* Update this rate accounting for as many retries * as was used for it (per current_count) */ - iwl3945_collect_tx_data(rs_sta, + il3945_collect_tx_data(rs_sta, &rs_sta->win[scale_rate_index], 0, current_count, scale_rate_index); - IWL_DEBUG_RATE(priv, "Update rate %d for %d retries.\n", + IL_DEBUG_RATE(priv, "Update rate %d for %d retries.\n", scale_rate_index, current_count); retries -= current_count; @@ -518,11 +518,11 @@ static void iwl3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_ban /* Update the last index window with success/failure based on ACK */ - IWL_DEBUG_RATE(priv, "Update rate %d with %s.\n", + IL_DEBUG_RATE(priv, "Update rate %d with %s.\n", last_index, (info->flags & IEEE80211_TX_STAT_ACK) ? "success" : "failure"); - iwl3945_collect_tx_data(rs_sta, + il3945_collect_tx_data(rs_sta, &rs_sta->win[last_index], info->flags & IEEE80211_TX_STAT_ACK, 1, last_index); @@ -543,15 +543,15 @@ static void iwl3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_ban spin_unlock_irqrestore(&rs_sta->lock, flags); - IWL_DEBUG_RATE(priv, "leave\n"); + IL_DEBUG_RATE(priv, "leave\n"); } -static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, +static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, u8 index, u16 rate_mask, enum ieee80211_band band) { - u8 high = IWL_RATE_INVALID; - u8 low = IWL_RATE_INVALID; - struct iwl_priv *priv __maybe_unused = rs_sta->priv; + u8 high = IL_RATE_INVALID; + u8 low = IL_RATE_INVALID; + struct il_priv *priv __maybe_unused = rs_sta->priv; /* 802.11A walks to the next literal adjacent rate in * the rate table */ @@ -570,7 +570,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, /* Find the next rate that is in the rate mask */ i = index + 1; - for (mask = (1 << i); i < IWL_RATE_COUNT_3945; + for (mask = (1 << i); i < IL_RATE_COUNT_3945; i++, mask <<= 1) { if (rate_mask & mask) { high = i; @@ -582,36 +582,36 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, } low = index; - while (low != IWL_RATE_INVALID) { + while (low != IL_RATE_INVALID) { if (rs_sta->tgg) - low = iwl3945_rates[low].prev_rs_tgg; + low = il3945_rates[low].prev_rs_tgg; else - low = iwl3945_rates[low].prev_rs; - if (low == IWL_RATE_INVALID) + low = il3945_rates[low].prev_rs; + if (low == IL_RATE_INVALID) break; if (rate_mask & (1 << low)) break; - IWL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low); + IL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low); } high = index; - while (high != IWL_RATE_INVALID) { + while (high != IL_RATE_INVALID) { if (rs_sta->tgg) - high = iwl3945_rates[high].next_rs_tgg; + high = il3945_rates[high].next_rs_tgg; else - high = iwl3945_rates[high].next_rs; - if (high == IWL_RATE_INVALID) + high = il3945_rates[high].next_rs; + if (high == IL_RATE_INVALID) break; if (rate_mask & (1 << high)) break; - IWL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high); + IL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high); } return (high << 8) | low; } /** - * iwl3945_rs_get_rate - find the rate for the requested packet + * il3945_rs_get_rate - find the rate for the requested packet * * Returns the ieee80211_rate structure allocated by the driver. * @@ -626,33 +626,33 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, * rate table and must reference the driver allocated rate table * */ -static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, +static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, struct ieee80211_tx_rate_control *txrc) { struct ieee80211_supported_band *sband = txrc->sband; struct sk_buff *skb = txrc->skb; - u8 low = IWL_RATE_INVALID; - u8 high = IWL_RATE_INVALID; + u8 low = IL_RATE_INVALID; + u8 high = IL_RATE_INVALID; u16 high_low; int index; - struct iwl3945_rs_sta *rs_sta = priv_sta; - struct iwl3945_rate_scale_data *window = NULL; - int current_tpt = IWL_INVALID_VALUE; - int low_tpt = IWL_INVALID_VALUE; - int high_tpt = IWL_INVALID_VALUE; + struct il3945_rs_sta *rs_sta = priv_sta; + struct il3945_rate_scale_data *window = NULL; + int current_tpt = IL_INVALID_VALUE; + int low_tpt = IL_INVALID_VALUE; + int high_tpt = IL_INVALID_VALUE; u32 fail_count; s8 scale_action = 0; unsigned long flags; u16 rate_mask; s8 max_rate_idx = -1; - struct iwl_priv *priv __maybe_unused = (struct iwl_priv *)priv_r; + struct il_priv *priv __maybe_unused = (struct il_priv *)priv_r; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - IWL_DEBUG_RATE(priv, "enter\n"); + IL_DEBUG_RATE(priv, "enter\n"); /* Treat uninitialized rate scaling data same as non-existing. */ if (rs_sta && !rs_sta->priv) { - IWL_DEBUG_RATE(priv, "Rate scaling information not initialized yet.\n"); + IL_DEBUG_RATE(priv, "Rate scaling information not initialized yet.\n"); priv_sta = NULL; } @@ -664,25 +664,25 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, /* get user max rate if set */ max_rate_idx = txrc->max_rate_idx; if ((sband->band == IEEE80211_BAND_5GHZ) && (max_rate_idx != -1)) - max_rate_idx += IWL_FIRST_OFDM_RATE; - if ((max_rate_idx < 0) || (max_rate_idx >= IWL_RATE_COUNT)) + max_rate_idx += IL_FIRST_OFDM_RATE; + if ((max_rate_idx < 0) || (max_rate_idx >= IL_RATE_COUNT)) max_rate_idx = -1; - index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT_3945 - 1); + index = min(rs_sta->last_txrate_idx & 0xffff, IL_RATE_COUNT_3945 - 1); if (sband->band == IEEE80211_BAND_5GHZ) - rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; + rate_mask = rate_mask << IL_FIRST_OFDM_RATE; spin_lock_irqsave(&rs_sta->lock, flags); /* for recent assoc, choose best rate regarding * to rssi value */ - if (rs_sta->start_rate != IWL_RATE_INVALID) { + if (rs_sta->start_rate != IL_RATE_INVALID) { if (rs_sta->start_rate < index && (rate_mask & (1 << rs_sta->start_rate))) index = rs_sta->start_rate; - rs_sta->start_rate = IWL_RATE_INVALID; + rs_sta->start_rate = IL_RATE_INVALID; } /* 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, fail_count = window->counter - window->success_counter; - if (((fail_count < IWL_RATE_MIN_FAILURE_TH) && - (window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) { + if (((fail_count < IL_RATE_MIN_FAILURE_TH) && + (window->success_counter < IL_RATE_MIN_SUCCESS_TH))) { spin_unlock_irqrestore(&rs_sta->lock, flags); - IWL_DEBUG_RATE(priv, "Invalid average_tpt on rate %d: " + IL_DEBUG_RATE(priv, "Invalid average_tpt on rate %d: " "counter: %d, success_counter: %d, " "expected_tpt is %sNULL\n", index, @@ -708,27 +708,27 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, rs_sta->expected_tpt ? "not " : ""); /* Can't calculate this yet; not enough history */ - window->average_tpt = IWL_INVALID_VALUE; + window->average_tpt = IL_INVALID_VALUE; goto out; } current_tpt = window->average_tpt; - high_low = iwl3945_get_adjacent_rate(rs_sta, index, rate_mask, + high_low = il3945_get_adjacent_rate(rs_sta, index, rate_mask, sband->band); low = high_low & 0xff; high = (high_low >> 8) & 0xff; /* If user set max rate, dont allow higher than user constrain */ if ((max_rate_idx != -1) && (max_rate_idx < high)) - high = IWL_RATE_INVALID; + high = IL_RATE_INVALID; /* Collect Measured throughputs of adjacent rates */ - if (low != IWL_RATE_INVALID) + if (low != IL_RATE_INVALID) low_tpt = rs_sta->win[low].average_tpt; - if (high != IWL_RATE_INVALID) + if (high != IL_RATE_INVALID) high_tpt = rs_sta->win[high].average_tpt; spin_unlock_irqrestore(&rs_sta->lock, flags); @@ -736,51 +736,51 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, scale_action = 0; /* Low success ratio , need to drop the rate */ - if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) { - IWL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n"); + if ((window->success_ratio < IL_RATE_DECREASE_TH) || !current_tpt) { + IL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n"); scale_action = -1; /* No throughput measured yet for adjacent rates, * try increase */ - } else if ((low_tpt == IWL_INVALID_VALUE) && - (high_tpt == IWL_INVALID_VALUE)) { + } else if ((low_tpt == IL_INVALID_VALUE) && + (high_tpt == IL_INVALID_VALUE)) { - if (high != IWL_RATE_INVALID && window->success_ratio >= IWL_RATE_INCREASE_TH) + if (high != IL_RATE_INVALID && window->success_ratio >= IL_RATE_INCREASE_TH) scale_action = 1; - else if (low != IWL_RATE_INVALID) + else if (low != IL_RATE_INVALID) scale_action = 0; /* Both adjacent throughputs are measured, but neither one has * better throughput; we're using the best rate, don't change * it! */ - } else if ((low_tpt != IWL_INVALID_VALUE) && - (high_tpt != IWL_INVALID_VALUE) && + } else if ((low_tpt != IL_INVALID_VALUE) && + (high_tpt != IL_INVALID_VALUE) && (low_tpt < current_tpt) && (high_tpt < current_tpt)) { - IWL_DEBUG_RATE(priv, "No action -- low [%d] & high [%d] < " + IL_DEBUG_RATE(priv, "No action -- low [%d] & high [%d] < " "current_tpt [%d]\n", low_tpt, high_tpt, current_tpt); scale_action = 0; /* At least one of the rates has better throughput */ } else { - if (high_tpt != IWL_INVALID_VALUE) { + if (high_tpt != IL_INVALID_VALUE) { /* High rate has better throughput, Increase * rate */ if (high_tpt > current_tpt && - window->success_ratio >= IWL_RATE_INCREASE_TH) + window->success_ratio >= IL_RATE_INCREASE_TH) scale_action = 1; else { - IWL_DEBUG_RATE(priv, + IL_DEBUG_RATE(priv, "decrease rate because of high tpt\n"); scale_action = 0; } - } else if (low_tpt != IWL_INVALID_VALUE) { + } else if (low_tpt != IL_INVALID_VALUE) { if (low_tpt > current_tpt) { - IWL_DEBUG_RATE(priv, + IL_DEBUG_RATE(priv, "decrease rate because of low tpt\n"); scale_action = -1; - } else if (window->success_ratio >= IWL_RATE_INCREASE_TH) { + } else if (window->success_ratio >= IL_RATE_INCREASE_TH) { /* Lower rate has better * throughput,decrease rate */ scale_action = 1; @@ -790,8 +790,8 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, /* Sanity check; asked for decrease, but success rate or throughput * has been good at old rate. Don't change it. */ - if ((scale_action == -1) && (low != IWL_RATE_INVALID) && - ((window->success_ratio > IWL_RATE_HIGH_TH) || + if ((scale_action == -1) && (low != IL_RATE_INVALID) && + ((window->success_ratio > IL_RATE_HIGH_TH) || (current_tpt > (100 * rs_sta->expected_tpt[low])))) scale_action = 0; @@ -799,13 +799,13 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, case -1: /* Decrese rate */ - if (low != IWL_RATE_INVALID) + if (low != IL_RATE_INVALID) index = low; break; case 1: /* Increase rate */ - if (high != IWL_RATE_INVALID) + if (high != IL_RATE_INVALID) index = high; break; @@ -816,32 +816,32 @@ static void iwl3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, break; } - IWL_DEBUG_RATE(priv, "Selected %d (action %d) - low %d high %d\n", + IL_DEBUG_RATE(priv, "Selected %d (action %d) - low %d high %d\n", index, scale_action, low, high); out: if (sband->band == IEEE80211_BAND_5GHZ) { - if (WARN_ON_ONCE(index < IWL_FIRST_OFDM_RATE)) - index = IWL_FIRST_OFDM_RATE; + if (WARN_ON_ONCE(index < IL_FIRST_OFDM_RATE)) + index = IL_FIRST_OFDM_RATE; rs_sta->last_txrate_idx = index; - info->control.rates[0].idx = index - IWL_FIRST_OFDM_RATE; + info->control.rates[0].idx = index - IL_FIRST_OFDM_RATE; } else { rs_sta->last_txrate_idx = index; info->control.rates[0].idx = rs_sta->last_txrate_idx; } - IWL_DEBUG_RATE(priv, "leave: %d\n", index); + IL_DEBUG_RATE(priv, "leave: %d\n", index); } #ifdef CONFIG_MAC80211_DEBUGFS -static int iwl3945_open_file_generic(struct inode *inode, struct file *file) +static int il3945_open_file_generic(struct inode *inode, struct file *file) { file->private_data = inode->i_private; return 0; } -static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file, +static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { @@ -849,7 +849,7 @@ static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file, int desc = 0; int j; ssize_t ret; - struct iwl3945_rs_sta *lq_sta = file->private_data; + struct il3945_rs_sta *lq_sta = file->private_data; buff = kmalloc(1024, GFP_KERNEL); if (!buff) @@ -860,7 +860,7 @@ static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file, lq_sta->tx_packets, lq_sta->last_txrate_idx, lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time)); - for (j = 0; j < IWL_RATE_COUNT_3945; j++) { + for (j = 0; j < IL_RATE_COUNT_3945; j++) { desc += sprintf(buff+desc, "counter=%d success=%d %%=%d\n", lq_sta->win[j].counter, @@ -873,15 +873,15 @@ static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file, } static const struct file_operations rs_sta_dbgfs_stats_table_ops = { - .read = iwl3945_sta_dbgfs_stats_table_read, - .open = iwl3945_open_file_generic, + .read = il3945_sta_dbgfs_stats_table_read, + .open = il3945_open_file_generic, .llseek = default_llseek, }; -static void iwl3945_add_debugfs(void *priv, void *priv_sta, +static void il3945_add_debugfs(void *priv, void *priv_sta, struct dentry *dir) { - struct iwl3945_rs_sta *lq_sta = priv_sta; + struct il3945_rs_sta *lq_sta = priv_sta; lq_sta->rs_sta_dbgfs_stats_table_file = debugfs_create_file("rate_stats_table", 0600, dir, @@ -889,9 +889,9 @@ static void iwl3945_add_debugfs(void *priv, void *priv_sta, } -static void iwl3945_remove_debugfs(void *priv, void *priv_sta) +static void il3945_remove_debugfs(void *priv, void *priv_sta) { - struct iwl3945_rs_sta *lq_sta = priv_sta; + struct il3945_rs_sta *lq_sta = priv_sta; debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); } #endif @@ -901,7 +901,7 @@ static void iwl3945_remove_debugfs(void *priv, void *priv_sta) * the station is added. Since mac80211 calls this function before a * station is added we ignore it. */ -static void iwl3945_rs_rate_init_stub(void *priv_r, +static void il3945_rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband, struct ieee80211_sta *sta, void *priv_sta) { @@ -910,36 +910,36 @@ static void iwl3945_rs_rate_init_stub(void *priv_r, static struct rate_control_ops rs_ops = { .module = NULL, .name = RS_NAME, - .tx_status = iwl3945_rs_tx_status, - .get_rate = iwl3945_rs_get_rate, - .rate_init = iwl3945_rs_rate_init_stub, - .alloc = iwl3945_rs_alloc, - .free = iwl3945_rs_free, - .alloc_sta = iwl3945_rs_alloc_sta, - .free_sta = iwl3945_rs_free_sta, + .tx_status = il3945_rs_tx_status, + .get_rate = il3945_rs_get_rate, + .rate_init = il3945_rs_rate_init_stub, + .alloc = il3945_rs_alloc, + .free = il3945_rs_free, + .alloc_sta = il3945_rs_alloc_sta, + .free_sta = il3945_rs_free_sta, #ifdef CONFIG_MAC80211_DEBUGFS - .add_sta_debugfs = iwl3945_add_debugfs, - .remove_sta_debugfs = iwl3945_remove_debugfs, + .add_sta_debugfs = il3945_add_debugfs, + .remove_sta_debugfs = il3945_remove_debugfs, #endif }; -void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) +void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; s32 rssi = 0; unsigned long flags; - struct iwl3945_rs_sta *rs_sta; + struct il3945_rs_sta *rs_sta; struct ieee80211_sta *sta; - struct iwl3945_sta_priv *psta; + struct il3945_sta_priv *psta; - IWL_DEBUG_RATE(priv, "enter\n"); + IL_DEBUG_RATE(priv, "enter\n"); rcu_read_lock(); - sta = ieee80211_find_sta(priv->contexts[IWL_RXON_CTX_BSS].vif, + sta = ieee80211_find_sta(priv->contexts[IL_RXON_CTX_BSS].vif, priv->stations[sta_id].sta.sta.addr); if (!sta) { - IWL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n"); + IL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n"); rcu_read_unlock(); return; } @@ -953,16 +953,16 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) switch (priv->band) { case IEEE80211_BAND_2GHZ: /* TODO: this always does G, not a regression */ - if (priv->contexts[IWL_RXON_CTX_BSS].active.flags & + if (priv->contexts[IL_RXON_CTX_BSS].active.flags & RXON_FLG_TGG_PROTECT_MSK) { rs_sta->tgg = 1; - rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot; + rs_sta->expected_tpt = il3945_expected_tpt_g_prot; } else - rs_sta->expected_tpt = iwl3945_expected_tpt_g; + rs_sta->expected_tpt = il3945_expected_tpt_g; break; case IEEE80211_BAND_5GHZ: - rs_sta->expected_tpt = iwl3945_expected_tpt_a; + rs_sta->expected_tpt = il3945_expected_tpt_a; break; case IEEE80211_NUM_BANDS: BUG(); @@ -973,24 +973,24 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) rssi = priv->_3945.last_rx_rssi; if (rssi == 0) - rssi = IWL_MIN_RSSI_VAL; + rssi = IL_MIN_RSSI_VAL; - IWL_DEBUG_RATE(priv, "Network RSSI: %d\n", rssi); + IL_DEBUG_RATE(priv, "Network RSSI: %d\n", rssi); - rs_sta->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->band); + rs_sta->start_rate = il3945_get_rate_index_by_rssi(rssi, priv->band); - IWL_DEBUG_RATE(priv, "leave: rssi %d assign rate index: " + IL_DEBUG_RATE(priv, "leave: rssi %d assign rate index: " "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, - iwl3945_rates[rs_sta->start_rate].plcp); + il3945_rates[rs_sta->start_rate].plcp); rcu_read_unlock(); } -int iwl3945_rate_control_register(void) +int il3945_rate_control_register(void) { return ieee80211_rate_control_register(&rs_ops); } -void iwl3945_rate_control_unregister(void) +void il3945_rate_control_unregister(void) { ieee80211_rate_control_unregister(&rs_ops); } diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c index f7c0a74..6d1740b 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945.c @@ -51,70 +51,70 @@ #include "iwl-3945-led.h" #include "iwl-3945-debugfs.h" -#define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \ - [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ - IWL_RATE_##r##M_IEEE, \ - IWL_RATE_##ip##M_INDEX, \ - IWL_RATE_##in##M_INDEX, \ - IWL_RATE_##rp##M_INDEX, \ - IWL_RATE_##rn##M_INDEX, \ - IWL_RATE_##pp##M_INDEX, \ - IWL_RATE_##np##M_INDEX, \ - IWL_RATE_##r##M_INDEX_TABLE, \ - IWL_RATE_##ip##M_INDEX_TABLE } +#define IL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \ + [IL_RATE_##r##M_INDEX] = { IL_RATE_##r##M_PLCP, \ + IL_RATE_##r##M_IEEE, \ + IL_RATE_##ip##M_INDEX, \ + IL_RATE_##in##M_INDEX, \ + IL_RATE_##rp##M_INDEX, \ + IL_RATE_##rn##M_INDEX, \ + IL_RATE_##pp##M_INDEX, \ + IL_RATE_##np##M_INDEX, \ + IL_RATE_##r##M_INDEX_TABLE, \ + IL_RATE_##ip##M_INDEX_TABLE } /* * Parameter order: * rate, prev rate, next rate, prev tgg rate, next tgg rate * * If there isn't a valid next or previous rate then INV is used which - * maps to IWL_RATE_INVALID + * maps to IL_RATE_INVALID * */ -const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT_3945] = { - IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */ - IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */ - IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */ - IWL_DECLARE_RATE_INFO(11, 9, 12, 5, 12, 5, 18), /* 11mbps */ - IWL_DECLARE_RATE_INFO(6, 5, 9, 5, 11, 5, 11), /* 6mbps */ - IWL_DECLARE_RATE_INFO(9, 6, 11, 5, 11, 5, 11), /* 9mbps */ - IWL_DECLARE_RATE_INFO(12, 11, 18, 11, 18, 11, 18), /* 12mbps */ - IWL_DECLARE_RATE_INFO(18, 12, 24, 12, 24, 11, 24), /* 18mbps */ - IWL_DECLARE_RATE_INFO(24, 18, 36, 18, 36, 18, 36), /* 24mbps */ - IWL_DECLARE_RATE_INFO(36, 24, 48, 24, 48, 24, 48), /* 36mbps */ - IWL_DECLARE_RATE_INFO(48, 36, 54, 36, 54, 36, 54), /* 48mbps */ - IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */ +const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945] = { + IL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */ + IL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */ + IL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */ + IL_DECLARE_RATE_INFO(11, 9, 12, 5, 12, 5, 18), /* 11mbps */ + IL_DECLARE_RATE_INFO(6, 5, 9, 5, 11, 5, 11), /* 6mbps */ + IL_DECLARE_RATE_INFO(9, 6, 11, 5, 11, 5, 11), /* 9mbps */ + IL_DECLARE_RATE_INFO(12, 11, 18, 11, 18, 11, 18), /* 12mbps */ + IL_DECLARE_RATE_INFO(18, 12, 24, 12, 24, 11, 24), /* 18mbps */ + IL_DECLARE_RATE_INFO(24, 18, 36, 18, 36, 18, 36), /* 24mbps */ + IL_DECLARE_RATE_INFO(36, 24, 48, 24, 48, 24, 48), /* 36mbps */ + IL_DECLARE_RATE_INFO(48, 36, 54, 36, 54, 36, 54), /* 48mbps */ + IL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */ }; -static inline u8 iwl3945_get_prev_ieee_rate(u8 rate_index) +static inline u8 il3945_get_prev_ieee_rate(u8 rate_index) { - u8 rate = iwl3945_rates[rate_index].prev_ieee; + u8 rate = il3945_rates[rate_index].prev_ieee; - if (rate == IWL_RATE_INVALID) + if (rate == IL_RATE_INVALID) rate = rate_index; return rate; } -/* 1 = enable the iwl3945_disable_events() function */ -#define IWL_EVT_DISABLE (0) -#define IWL_EVT_DISABLE_SIZE (1532/32) +/* 1 = enable the il3945_disable_events() function */ +#define IL_EVT_DISABLE (0) +#define IL_EVT_DISABLE_SIZE (1532/32) /** - * iwl3945_disable_events - Disable selected events in uCode event log + * il3945_disable_events - Disable selected events in uCode event log * * Disable an event by writing "1"s into "disable" * bitmap in SRAM. Bit position corresponds to Event # (id/type). * Default values of 0 enable uCode events to be logged. * Use for only special debugging. This function is just a placeholder as-is, * you'll need to provide the special bits! ... - * ... and set IWL_EVT_DISABLE to 1. */ -void iwl3945_disable_events(struct iwl_priv *priv) + * ... and set IL_EVT_DISABLE to 1. */ +void il3945_disable_events(struct il_priv *priv) { int i; u32 base; /* SRAM address of event log header */ u32 disable_ptr; /* SRAM address of event-disable bitmap array */ u32 array_size; /* # of u32 entries in array */ - static const u32 evt_disable[IWL_EVT_DISABLE_SIZE] = { + static const u32 evt_disable[IL_EVT_DISABLE_SIZE] = { 0x00000000, /* 31 - 0 Event id numbers */ 0x00000000, /* 63 - 32 */ 0x00000000, /* 95 - 64 */ @@ -165,37 +165,37 @@ void iwl3945_disable_events(struct iwl_priv *priv) }; base = le32_to_cpu(priv->card_alive.log_event_table_ptr); - if (!iwl3945_hw_valid_rtc_data_addr(base)) { - IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base); + if (!il3945_hw_valid_rtc_data_addr(base)) { + IL_ERR(priv, "Invalid event log pointer 0x%08X\n", base); return; } - disable_ptr = iwl_legacy_read_targ_mem(priv, base + (4 * sizeof(u32))); - array_size = iwl_legacy_read_targ_mem(priv, base + (5 * sizeof(u32))); + disable_ptr = il_read_targ_mem(priv, base + (4 * sizeof(u32))); + array_size = il_read_targ_mem(priv, base + (5 * sizeof(u32))); - if (IWL_EVT_DISABLE && (array_size == IWL_EVT_DISABLE_SIZE)) { - IWL_DEBUG_INFO(priv, "Disabling selected uCode log events at 0x%x\n", + if (IL_EVT_DISABLE && (array_size == IL_EVT_DISABLE_SIZE)) { + IL_DEBUG_INFO(priv, "Disabling selected uCode log events at 0x%x\n", disable_ptr); - for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++) - iwl_legacy_write_targ_mem(priv, + for (i = 0; i < IL_EVT_DISABLE_SIZE; i++) + il_write_targ_mem(priv, disable_ptr + (i * sizeof(u32)), evt_disable[i]); } else { - IWL_DEBUG_INFO(priv, "Selected uCode log events may be disabled\n"); - IWL_DEBUG_INFO(priv, " by writing \"1\"s into disable bitmap\n"); - IWL_DEBUG_INFO(priv, " in SRAM at 0x%x, size %d u32s\n", + IL_DEBUG_INFO(priv, "Selected uCode log events may be disabled\n"); + IL_DEBUG_INFO(priv, " by writing \"1\"s into disable bitmap\n"); + IL_DEBUG_INFO(priv, " in SRAM at 0x%x, size %d u32s\n", disable_ptr, array_size); } } -static int iwl3945_hwrate_to_plcp_idx(u8 plcp) +static int il3945_hwrate_to_plcp_idx(u8 plcp) { int idx; - for (idx = 0; idx < IWL_RATE_COUNT_3945; idx++) - if (iwl3945_rates[idx].plcp == plcp) + for (idx = 0; idx < IL_RATE_COUNT_3945; idx++) + if (il3945_rates[idx].plcp == plcp) return idx; return -1; } @@ -203,7 +203,7 @@ static int iwl3945_hwrate_to_plcp_idx(u8 plcp) #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG #define TX_STATUS_ENTRY(x) case TX_3945_STATUS_FAIL_ ## x: return #x -static const char *iwl3945_get_tx_fail_reason(u32 status) +static const char *il3945_get_tx_fail_reason(u32 status) { switch (status & TX_STATUS_MSK) { case TX_3945_STATUS_SUCCESS: @@ -229,7 +229,7 @@ static const char *iwl3945_get_tx_fail_reason(u32 status) return "UNKNOWN"; } #else -static inline const char *iwl3945_get_tx_fail_reason(u32 status) +static inline const char *il3945_get_tx_fail_reason(u32 status) { return ""; } @@ -240,22 +240,22 @@ static inline const char *iwl3945_get_tx_fail_reason(u32 status) * for A and B mode we need to overright prev * value */ -int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate) +int il3945_rs_next_rate(struct il_priv *priv, int rate) { - int next_rate = iwl3945_get_prev_ieee_rate(rate); + int next_rate = il3945_get_prev_ieee_rate(rate); switch (priv->band) { case IEEE80211_BAND_5GHZ: - if (rate == IWL_RATE_12M_INDEX) - next_rate = IWL_RATE_9M_INDEX; - else if (rate == IWL_RATE_6M_INDEX) - next_rate = IWL_RATE_6M_INDEX; + if (rate == IL_RATE_12M_INDEX) + next_rate = IL_RATE_9M_INDEX; + else if (rate == IL_RATE_6M_INDEX) + next_rate = IL_RATE_6M_INDEX; break; case IEEE80211_BAND_2GHZ: - if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && - iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { - if (rate == IWL_RATE_11M_INDEX) - next_rate = IWL_RATE_5M_INDEX; + if (!(priv->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && + il_is_associated(priv, IL_RXON_CTX_BSS)) { + if (rate == IL_RATE_11M_INDEX) + next_rate = IL_RATE_5M_INDEX; } break; @@ -268,24 +268,24 @@ int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate) /** - * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd + * il3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd * * When FW advances 'R' index, all entries between old and new 'R' index * need to be reclaimed. As result, some free space forms. If there is * enough free space (> low mark), wake the stack that feeds us. */ -static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv, +static void il3945_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index) { - struct iwl_tx_queue *txq = &priv->txq[txq_id]; - struct iwl_queue *q = &txq->q; - struct iwl_tx_info *tx_info; + struct il_tx_queue *txq = &priv->txq[txq_id]; + struct il_queue *q = &txq->q; + struct il_tx_info *tx_info; BUG_ON(txq_id == IWL39_CMD_QUEUE_NUM); - for (index = iwl_legacy_queue_inc_wrap(index, q->n_bd); + for (index = il_queue_inc_wrap(index, q->n_bd); q->read_ptr != index; - q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) { + q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { tx_info = &txq->txb[txq->q.read_ptr]; ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb); @@ -293,31 +293,31 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv, priv->cfg->ops->lib->txq_free_tfd(priv, txq); } - if (iwl_legacy_queue_space(q) > q->low_mark && (txq_id >= 0) && + if (il_queue_space(q) > q->low_mark && (txq_id >= 0) && (txq_id != IWL39_CMD_QUEUE_NUM) && priv->mac80211_registered) - iwl_legacy_wake_queue(priv, txq); + il_wake_queue(priv, txq); } /** - * iwl3945_rx_reply_tx - Handle Tx response + * il3945_rx_reply_tx - Handle Tx response */ -static void iwl3945_rx_reply_tx(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il3945_rx_reply_tx(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); u16 sequence = le16_to_cpu(pkt->hdr.sequence); int txq_id = SEQ_TO_QUEUE(sequence); int index = SEQ_TO_INDEX(sequence); - struct iwl_tx_queue *txq = &priv->txq[txq_id]; + struct il_tx_queue *txq = &priv->txq[txq_id]; struct ieee80211_tx_info *info; - struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; + struct il3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; u32 status = le32_to_cpu(tx_resp->status); int rate_idx; int fail; - if ((index >= txq->q.n_bd) || (iwl_legacy_queue_used(&txq->q, index) == 0)) { - IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " + if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) { + IL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " "is out of range [0-%d] %d %d\n", txq_id, index, txq->q.n_bd, txq->q.write_ptr, txq->q.read_ptr); @@ -329,9 +329,9 @@ static void iwl3945_rx_reply_tx(struct iwl_priv *priv, ieee80211_tx_info_clear_status(info); /* Fill the MRR chain with some info about on-chip retransmissions */ - rate_idx = iwl3945_hwrate_to_plcp_idx(tx_resp->rate); + rate_idx = il3945_hwrate_to_plcp_idx(tx_resp->rate); if (info->band == IEEE80211_BAND_5GHZ) - rate_idx -= IWL_FIRST_OFDM_RATE; + rate_idx -= IL_FIRST_OFDM_RATE; fail = tx_resp->failure_frame; @@ -342,15 +342,15 @@ static void iwl3945_rx_reply_tx(struct iwl_priv *priv, info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ? IEEE80211_TX_STAT_ACK : 0; - IWL_DEBUG_TX(priv, "Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", - txq_id, iwl3945_get_tx_fail_reason(status), status, + IL_DEBUG_TX(priv, "Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", + txq_id, il3945_get_tx_fail_reason(status), status, tx_resp->rate, tx_resp->failure_frame); - IWL_DEBUG_TX_REPLY(priv, "Tx queue reclaim %d\n", index); - iwl3945_tx_queue_reclaim(priv, txq_id, index); + IL_DEBUG_TX_REPLY(priv, "Tx queue reclaim %d\n", index); + il3945_tx_queue_reclaim(priv, txq_id, index); if (status & TX_ABORT_REQUIRED_MSK) - IWL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n"); + IL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n"); } @@ -363,7 +363,7 @@ static void iwl3945_rx_reply_tx(struct iwl_priv *priv, * *****************************************************************************/ #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS -static void iwl3945_accumulative_statistics(struct iwl_priv *priv, +static void il3945_accumulative_statistics(struct il_priv *priv, __le32 *stats) { int i; @@ -376,7 +376,7 @@ static void iwl3945_accumulative_statistics(struct iwl_priv *priv, delta = (u32 *)&priv->_3945.delta_statistics; max_delta = (u32 *)&priv->_3945.max_delta; - for (i = sizeof(__le32); i < sizeof(struct iwl3945_notif_statistics); + for (i = sizeof(__le32); i < sizeof(struct il3945_notif_statistics); i += sizeof(__le32), stats++, prev_stats++, delta++, max_delta++, accum_stats++) { if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) { @@ -396,39 +396,39 @@ static void iwl3945_accumulative_statistics(struct iwl_priv *priv, } #endif -void iwl3945_hw_rx_statistics(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il3945_hw_rx_statistics(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); - IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", - (int)sizeof(struct iwl3945_notif_statistics), + IL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", + (int)sizeof(struct il3945_notif_statistics), le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS - iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw); + il3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw); #endif memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); } -void iwl3945_reply_statistics(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il3945_reply_statistics(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); __le32 *flag = (__le32 *)&pkt->u.raw; if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) { #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS memset(&priv->_3945.accum_statistics, 0, - sizeof(struct iwl3945_notif_statistics)); + sizeof(struct il3945_notif_statistics)); memset(&priv->_3945.delta_statistics, 0, - sizeof(struct iwl3945_notif_statistics)); + sizeof(struct il3945_notif_statistics)); memset(&priv->_3945.max_delta, 0, - sizeof(struct iwl3945_notif_statistics)); + sizeof(struct il3945_notif_statistics)); #endif - IWL_DEBUG_RX(priv, "Statistics have been cleared\n"); + IL_DEBUG_RX(priv, "Statistics have been cleared\n"); } - iwl3945_hw_rx_statistics(priv, rxb); + il3945_hw_rx_statistics(priv, rxb); } @@ -439,7 +439,7 @@ void iwl3945_reply_statistics(struct iwl_priv *priv, ******************************************************************************/ /* This is necessary only for a number of statistics, see the caller. */ -static int iwl3945_is_network_packet(struct iwl_priv *priv, +static int il3945_is_network_packet(struct il_priv *priv, struct ieee80211_hdr *header) { /* Filter incoming packets to determine if they are targeted toward @@ -456,14 +456,14 @@ static int iwl3945_is_network_packet(struct iwl_priv *priv, } } -static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb, +static void il3945_pass_packet_to_mac80211(struct il_priv *priv, + struct il_rx_mem_buffer *rxb, struct ieee80211_rx_status *stats) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); - struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); - struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); + struct il_rx_packet *pkt = rxb_addr(rxb); + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IL_RX_DATA(pkt); + struct il3945_rx_frame_hdr *rx_hdr = IL_RX_HDR(pkt); + struct il3945_rx_frame_end *rx_end = IL_RX_END(pkt); u16 len = le16_to_cpu(rx_hdr->len); struct sk_buff *skb; __le16 fc = hdr->frame_control; @@ -471,32 +471,32 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv, /* We received data from the HW, so stop the watchdog */ if (unlikely(len + IWL39_RX_FRAME_SIZE > PAGE_SIZE << priv->hw_params.rx_page_order)) { - IWL_DEBUG_DROP(priv, "Corruption detected!\n"); + IL_DEBUG_DROP(priv, "Corruption detected!\n"); return; } /* We only process data packets if the interface is open */ if (unlikely(!priv->is_open)) { - IWL_DEBUG_DROP_LIMIT(priv, + IL_DEBUG_DROP_LIMIT(priv, "Dropping packet while interface is not open.\n"); return; } skb = dev_alloc_skb(128); if (!skb) { - IWL_ERR(priv, "dev_alloc_skb failed\n"); + IL_ERR(priv, "dev_alloc_skb failed\n"); return; } - if (!iwl3945_mod_params.sw_crypto) - iwl_legacy_set_decrypted_flag(priv, + if (!il3945_mod_params.sw_crypto) + il_set_decrypted_flag(priv, (struct ieee80211_hdr *)rxb_addr(rxb), le32_to_cpu(rx_end->status), stats); skb_add_rx_frag(skb, 0, rxb->page, (void *)rx_hdr->payload - (void *)pkt, len); - iwl_legacy_update_stats(priv, false, fc, len); + il_update_stats(priv, false, fc, len); memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); ieee80211_rx(priv->hw, skb); @@ -504,17 +504,17 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv, rxb->page = NULL; } -#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) +#define IL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) -static void iwl3945_rx_reply_rx(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il3945_rx_reply_rx(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { struct ieee80211_hdr *header; struct ieee80211_rx_status rx_status; - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); - struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); - struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il3945_rx_frame_stats *rx_stats = IL_RX_STATS(pkt); + struct il3945_rx_frame_hdr *rx_hdr = IL_RX_HDR(pkt); + struct il3945_rx_frame_end *rx_end = IL_RX_END(pkt); u16 rx_stats_sig_avg __maybe_unused = le16_to_cpu(rx_stats->sig_avg); u16 rx_stats_noise_diff __maybe_unused = le16_to_cpu(rx_stats->noise_diff); u8 network_packet; @@ -527,9 +527,9 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, ieee80211_channel_to_frequency(le16_to_cpu(rx_hdr->channel), rx_status.band); - rx_status.rate_idx = iwl3945_hwrate_to_plcp_idx(rx_hdr->rate); + rx_status.rate_idx = il3945_hwrate_to_plcp_idx(rx_hdr->rate); if (rx_status.band == IEEE80211_BAND_5GHZ) - rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; + rx_status.rate_idx -= IL_FIRST_OFDM_RATE; rx_status.antenna = (le16_to_cpu(rx_hdr->phy_flags) & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; @@ -539,14 +539,14 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, rx_status.flag |= RX_FLAG_SHORTPRE; if ((unlikely(rx_stats->phy_count > 20))) { - IWL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n", + IL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n", rx_stats->phy_count); return; } if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR) || !(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { - IWL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", rx_end->status); + IL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", rx_end->status); return; } @@ -555,21 +555,21 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, /* Convert 3945's rssi indicator to dBm */ rx_status.signal = rx_stats->rssi - IWL39_RSSI_OFFSET; - IWL_DEBUG_STATS(priv, "Rssi %d sig_avg %d noise_diff %d\n", + IL_DEBUG_STATS(priv, "Rssi %d sig_avg %d noise_diff %d\n", rx_status.signal, rx_stats_sig_avg, rx_stats_noise_diff); - header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); + header = (struct ieee80211_hdr *)IL_RX_DATA(pkt); - network_packet = iwl3945_is_network_packet(priv, header); + network_packet = il3945_is_network_packet(priv, header); - IWL_DEBUG_STATS_LIMIT(priv, "[%c] %d RSSI:%d Signal:%u, Rate:%u\n", + IL_DEBUG_STATS_LIMIT(priv, "[%c] %d RSSI:%d Signal:%u, Rate:%u\n", network_packet ? '*' : ' ', le16_to_cpu(rx_hdr->channel), rx_status.signal, rx_status.signal, rx_status.rate_idx); - iwl_legacy_dbg_log_rx_data_frame(priv, le16_to_cpu(rx_hdr->len), + il_dbg_log_rx_data_frame(priv, le16_to_cpu(rx_hdr->len), header); if (network_packet) { @@ -579,19 +579,19 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, priv->_3945.last_rx_rssi = rx_status.signal; } - iwl3945_pass_packet_to_mac80211(priv, rxb, &rx_status); + il3945_pass_packet_to_mac80211(priv, rxb, &rx_status); } -int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, - struct iwl_tx_queue *txq, +int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv, + struct il_tx_queue *txq, dma_addr_t addr, u16 len, u8 reset, u8 pad) { int count; - struct iwl_queue *q; - struct iwl3945_tfd *tfd, *tfd_tmp; + struct il_queue *q; + struct il3945_tfd *tfd, *tfd_tmp; q = &txq->q; - tfd_tmp = (struct iwl3945_tfd *)txq->tfds; + tfd_tmp = (struct il3945_tfd *)txq->tfds; tfd = &tfd_tmp[q->write_ptr]; if (reset) @@ -600,7 +600,7 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); if ((count >= NUM_TFD_CHUNKS) || (count < 0)) { - IWL_ERR(priv, "Error can not send more than %d chunks\n", + IL_ERR(priv, "Error can not send more than %d chunks\n", NUM_TFD_CHUNKS); return -EINVAL; } @@ -617,15 +617,15 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, } /** - * iwl3945_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] + * il3945_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] * * Does NOT advance any indexes */ -void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) +void il3945_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq) { - struct iwl3945_tfd *tfd_tmp = (struct iwl3945_tfd *)txq->tfds; + struct il3945_tfd *tfd_tmp = (struct il3945_tfd *)txq->tfds; int index = txq->q.read_ptr; - struct iwl3945_tfd *tfd = &tfd_tmp[index]; + struct il3945_tfd *tfd = &tfd_tmp[index]; struct pci_dev *dev = priv->pci_dev; int i; int counter; @@ -633,7 +633,7 @@ void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) /* sanity check */ counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); if (counter > NUM_TFD_CHUNKS) { - IWL_ERR(priv, "Too many chunks: %i\n", counter); + IL_ERR(priv, "Too many chunks: %i\n", counter); /* @todo issue fatal error, it is quite serious situation */ return; } @@ -666,37 +666,37 @@ void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) } /** - * iwl3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: + * il3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: * */ -void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, - struct iwl_device_cmd *cmd, +void il3945_hw_build_tx_cmd_rate(struct il_priv *priv, + struct il_device_cmd *cmd, struct ieee80211_tx_info *info, struct ieee80211_hdr *hdr, int sta_id, int tx_id) { u16 hw_value = ieee80211_get_tx_rate(priv->hw, info)->hw_value; - u16 rate_index = min(hw_value & 0xffff, IWL_RATE_COUNT_3945); + u16 rate_index = min(hw_value & 0xffff, IL_RATE_COUNT_3945); u16 rate_mask; int rate; u8 rts_retry_limit; u8 data_retry_limit; __le32 tx_flags; __le16 fc = hdr->frame_control; - struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; + struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; - rate = iwl3945_rates[rate_index].plcp; + rate = il3945_rates[rate_index].plcp; tx_flags = tx_cmd->tx_flags; /* We need to figure out how to get the sta->supp_rates while * in this running context */ - rate_mask = IWL_RATES_MASK_3945; + rate_mask = IL_RATES_MASK_3945; /* Set retry limit on DATA packets and Probe Responses*/ if (ieee80211_is_probe_resp(fc)) data_retry_limit = 3; else - data_retry_limit = IWL_DEFAULT_TX_RETRY; + data_retry_limit = IL_DEFAULT_TX_RETRY; tx_cmd->data_retry_limit = data_retry_limit; if (tx_id >= IWL39_CMD_QUEUE_NUM) @@ -713,24 +713,24 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, /* OFDM */ tx_cmd->supp_rates[0] = - ((rate_mask & IWL_OFDM_RATES_MASK) >> IWL_FIRST_OFDM_RATE) & 0xFF; + ((rate_mask & IL_OFDM_RATES_MASK) >> IL_FIRST_OFDM_RATE) & 0xFF; /* CCK */ tx_cmd->supp_rates[1] = (rate_mask & 0xF); - IWL_DEBUG_RATE(priv, "Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " + IL_DEBUG_RATE(priv, "Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " "cck/ofdm mask: 0x%x/0x%x\n", sta_id, tx_cmd->rate, le32_to_cpu(tx_cmd->tx_flags), tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]); } -static u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate) +static u8 il3945_sync_sta(struct il_priv *priv, int sta_id, u16 tx_rate) { unsigned long flags_spin; - struct iwl_station_entry *station; + struct il_station_entry *station; - if (sta_id == IWL_INVALID_STATION) - return IWL_INVALID_STATION; + if (sta_id == IL_INVALID_STATION) + return IL_INVALID_STATION; spin_lock_irqsave(&priv->sta_lock, flags_spin); station = &priv->stations[sta_id]; @@ -738,46 +738,46 @@ static u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate) station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK; station->sta.rate_n_flags = cpu_to_le16(tx_rate); station->sta.mode = STA_CONTROL_MODIFY_MSK; - iwl_legacy_send_add_sta(priv, &station->sta, CMD_ASYNC); + il_send_add_sta(priv, &station->sta, CMD_ASYNC); spin_unlock_irqrestore(&priv->sta_lock, flags_spin); - IWL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n", + IL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n", sta_id, tx_rate); return sta_id; } -static void iwl3945_set_pwr_vmain(struct iwl_priv *priv) +static void il3945_set_pwr_vmain(struct il_priv *priv) { /* * (for documentation purposes) * to set power to V_AUX, do if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) { - iwl_legacy_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, + il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VAUX, ~APMG_PS_CTRL_MSK_PWR_SRC); - iwl_poll_bit(priv, CSR_GPIO_IN, + il_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VAUX_PWR_SRC, CSR_GPIO_IN_BIT_AUX_POWER, 5000); } */ - iwl_legacy_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, + il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, ~APMG_PS_CTRL_MSK_PWR_SRC); - iwl_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, + il_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, CSR_GPIO_IN_BIT_AUX_POWER, 5000); /* uS */ } -static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +static int il3945_rx_init(struct il_priv *priv, struct il_rx_queue *rxq) { - iwl_legacy_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->bd_dma); - iwl_legacy_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0), + il_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->bd_dma); + il_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0), rxq->rb_stts_dma); - iwl_legacy_write_direct32(priv, FH39_RCSR_WPTR(0), 0); - iwl_legacy_write_direct32(priv, FH39_RCSR_CONFIG(0), + il_write_direct32(priv, FH39_RCSR_WPTR(0), 0); + il_write_direct32(priv, FH39_RCSR_CONFIG(0), FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE | FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE | 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) FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH); /* fake read to flush all prev I/O */ - iwl_legacy_read_direct32(priv, FH39_RSSR_CTRL); + il_read_direct32(priv, FH39_RSSR_CTRL); return 0; } -static int iwl3945_tx_reset(struct iwl_priv *priv) +static int il3945_tx_reset(struct il_priv *priv) { /* bypass mode */ - iwl_legacy_write_prph(priv, ALM_SCD_MODE_REG, 0x2); + il_write_prph(priv, ALM_SCD_MODE_REG, 0x2); /* RA 0 is active */ - iwl_legacy_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01); + il_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01); /* all 6 fifo are active */ - iwl_legacy_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f); + il_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f); - iwl_legacy_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000); - iwl_legacy_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002); - iwl_legacy_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004); - iwl_legacy_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); + il_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000); + il_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002); + il_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004); + il_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); - iwl_legacy_write_direct32(priv, FH39_TSSR_CBB_BASE, + il_write_direct32(priv, FH39_TSSR_CBB_BASE, priv->_3945.shared_phys); - iwl_legacy_write_direct32(priv, FH39_TSSR_MSG_CONFIG, + il_write_direct32(priv, FH39_TSSR_MSG_CONFIG, FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B | @@ -827,24 +827,24 @@ static int iwl3945_tx_reset(struct iwl_priv *priv) } /** - * iwl3945_txq_ctx_reset - Reset TX queue context + * il3945_txq_ctx_reset - Reset TX queue context * * Destroys all DMA structures and initialize them again */ -static int iwl3945_txq_ctx_reset(struct iwl_priv *priv) +static int il3945_txq_ctx_reset(struct il_priv *priv) { int rc; int txq_id, slots_num; - iwl3945_hw_txq_ctx_free(priv); + il3945_hw_txq_ctx_free(priv); /* allocate tx queue structure */ - rc = iwl_legacy_alloc_txq_mem(priv); + rc = il_alloc_txq_mem(priv); if (rc) return rc; /* Tx CMD queue */ - rc = iwl3945_tx_reset(priv); + rc = il3945_tx_reset(priv); if (rc) goto error; @@ -852,10 +852,10 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv) for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { slots_num = (txq_id == IWL39_CMD_QUEUE_NUM) ? TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; - rc = iwl_legacy_tx_queue_init(priv, &priv->txq[txq_id], + rc = il_tx_queue_init(priv, &priv->txq[txq_id], slots_num, txq_id); if (rc) { - IWL_ERR(priv, "Tx %d queue init failed\n", txq_id); + IL_ERR(priv, "Tx %d queue init failed\n", txq_id); goto error; } } @@ -863,133 +863,133 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv) return rc; error: - iwl3945_hw_txq_ctx_free(priv); + il3945_hw_txq_ctx_free(priv); return rc; } /* * Start up 3945's basic functionality after it has been reset - * (e.g. after platform boot, or shutdown via iwl_legacy_apm_stop()) + * (e.g. after platform boot, or shutdown via il_apm_stop()) * NOTE: This does not load uCode nor start the embedded processor */ -static int iwl3945_apm_init(struct iwl_priv *priv) +static int il3945_apm_init(struct il_priv *priv) { - int ret = iwl_legacy_apm_init(priv); + int ret = il_apm_init(priv); /* Clear APMG (NIC's internal power management) interrupts */ - iwl_legacy_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0); - iwl_legacy_write_prph(priv, APMG_RTC_INT_STT_REG, 0xFFFFFFFF); + il_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0); + il_write_prph(priv, APMG_RTC_INT_STT_REG, 0xFFFFFFFF); /* Reset radio chip */ - iwl_legacy_set_bits_prph(priv, APMG_PS_CTRL_REG, + il_set_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); udelay(5); - iwl_legacy_clear_bits_prph(priv, APMG_PS_CTRL_REG, + il_clear_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); return ret; } -static void iwl3945_nic_config(struct iwl_priv *priv) +static void il3945_nic_config(struct il_priv *priv) { - struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; unsigned long flags; u8 rev_id = priv->pci_dev->revision; spin_lock_irqsave(&priv->lock, flags); /* Determine HW type */ - IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id); + IL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id); if (rev_id & PCI_CFG_REV_ID_BIT_RTP) - IWL_DEBUG_INFO(priv, "RTP type\n"); + IL_DEBUG_INFO(priv, "RTP type\n"); else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) { - IWL_DEBUG_INFO(priv, "3945 RADIO-MB type\n"); - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + IL_DEBUG_INFO(priv, "3945 RADIO-MB type\n"); + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BIT_3945_MB); } else { - IWL_DEBUG_INFO(priv, "3945 RADIO-MM type\n"); - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + IL_DEBUG_INFO(priv, "3945 RADIO-MM type\n"); + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BIT_3945_MM); } if (EEPROM_SKU_CAP_OP_MODE_MRC == eeprom->sku_cap) { - IWL_DEBUG_INFO(priv, "SKU OP mode is mrc\n"); - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + IL_DEBUG_INFO(priv, "SKU OP mode is mrc\n"); + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC); } else - IWL_DEBUG_INFO(priv, "SKU OP mode is basic\n"); + IL_DEBUG_INFO(priv, "SKU OP mode is basic\n"); if ((eeprom->board_revision & 0xF0) == 0xD0) { - IWL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n", + IL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n", eeprom->board_revision); - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); } else { - IWL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n", + IL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n", eeprom->board_revision); - iwl_legacy_clear_bit(priv, CSR_HW_IF_CONFIG_REG, + il_clear_bit(priv, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); } if (eeprom->almgor_m_version <= 1) { - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A); - IWL_DEBUG_INFO(priv, "Card M type A version is 0x%X\n", + IL_DEBUG_INFO(priv, "Card M type A version is 0x%X\n", eeprom->almgor_m_version); } else { - IWL_DEBUG_INFO(priv, "Card M type B version is 0x%X\n", + IL_DEBUG_INFO(priv, "Card M type B version is 0x%X\n", eeprom->almgor_m_version); - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B); } spin_unlock_irqrestore(&priv->lock, flags); if (eeprom->sku_cap & EEPROM_SKU_CAP_SW_RF_KILL_ENABLE) - IWL_DEBUG_RF_KILL(priv, "SW RF KILL supported in EEPROM.\n"); + IL_DEBUG_RF_KILL(priv, "SW RF KILL supported in EEPROM.\n"); if (eeprom->sku_cap & EEPROM_SKU_CAP_HW_RF_KILL_ENABLE) - IWL_DEBUG_RF_KILL(priv, "HW RF KILL supported in EEPROM.\n"); + IL_DEBUG_RF_KILL(priv, "HW RF KILL supported in EEPROM.\n"); } -int iwl3945_hw_nic_init(struct iwl_priv *priv) +int il3945_hw_nic_init(struct il_priv *priv) { int rc; unsigned long flags; - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_rx_queue *rxq = &priv->rxq; spin_lock_irqsave(&priv->lock, flags); priv->cfg->ops->lib->apm_ops.init(priv); spin_unlock_irqrestore(&priv->lock, flags); - iwl3945_set_pwr_vmain(priv); + il3945_set_pwr_vmain(priv); priv->cfg->ops->lib->apm_ops.config(priv); /* Allocate the RX queue, or reset if it is already allocated */ if (!rxq->bd) { - rc = iwl_legacy_rx_queue_alloc(priv); + rc = il_rx_queue_alloc(priv); if (rc) { - IWL_ERR(priv, "Unable to initialize Rx queue\n"); + IL_ERR(priv, "Unable to initialize Rx queue\n"); return -ENOMEM; } } else - iwl3945_rx_queue_reset(priv, rxq); + il3945_rx_queue_reset(priv, rxq); - iwl3945_rx_replenish(priv); + il3945_rx_replenish(priv); - iwl3945_rx_init(priv, rxq); + il3945_rx_init(priv, rxq); /* Look at using this instead: rxq->need_update = 1; - iwl_legacy_rx_queue_update_write_ptr(priv, rxq); + il_rx_queue_update_write_ptr(priv, rxq); */ - iwl_legacy_write_direct32(priv, FH39_RCSR_WPTR(0), rxq->write & ~7); + il_write_direct32(priv, FH39_RCSR_WPTR(0), rxq->write & ~7); - rc = iwl3945_txq_ctx_reset(priv); + rc = il3945_txq_ctx_reset(priv); if (rc) return rc; @@ -999,11 +999,11 @@ int iwl3945_hw_nic_init(struct iwl_priv *priv) } /** - * iwl3945_hw_txq_ctx_free - Free TXQ Context + * il3945_hw_txq_ctx_free - Free TXQ Context * * Destroy all TX DMA queues and structures */ -void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv) +void il3945_hw_txq_ctx_free(struct il_priv *priv) { int txq_id; @@ -1012,73 +1012,73 @@ void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv) for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) if (txq_id == IWL39_CMD_QUEUE_NUM) - iwl_legacy_cmd_queue_free(priv); + il_cmd_queue_free(priv); else - iwl_legacy_tx_queue_free(priv, txq_id); + il_tx_queue_free(priv, txq_id); /* free tx queue structure */ - iwl_legacy_txq_mem(priv); + il_txq_mem(priv); } -void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv) +void il3945_hw_txq_ctx_stop(struct il_priv *priv) { int txq_id; /* stop SCD */ - iwl_legacy_write_prph(priv, ALM_SCD_MODE_REG, 0); - iwl_legacy_write_prph(priv, ALM_SCD_TXFACT_REG, 0); + il_write_prph(priv, ALM_SCD_MODE_REG, 0); + il_write_prph(priv, ALM_SCD_TXFACT_REG, 0); /* reset TFD queues */ for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { - iwl_legacy_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), 0x0); - iwl_poll_direct_bit(priv, FH39_TSSR_TX_STATUS, + il_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), 0x0); + il_poll_direct_bit(priv, FH39_TSSR_TX_STATUS, FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(txq_id), 1000); } - iwl3945_hw_txq_ctx_free(priv); + il3945_hw_txq_ctx_free(priv); } /** - * iwl3945_hw_reg_adjust_power_by_temp + * il3945_hw_reg_adjust_power_by_temp * return index delta into power gain settings table */ -static int iwl3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading) +static int il3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading) { return (new_reading - old_reading) * (-11) / 100; } /** - * iwl3945_hw_reg_temp_out_of_range - Keep temperature in sane range + * il3945_hw_reg_temp_out_of_range - Keep temperature in sane range */ -static inline int iwl3945_hw_reg_temp_out_of_range(int temperature) +static inline int il3945_hw_reg_temp_out_of_range(int temperature) { return ((temperature < -260) || (temperature > 25)) ? 1 : 0; } -int iwl3945_hw_get_temperature(struct iwl_priv *priv) +int il3945_hw_get_temperature(struct il_priv *priv) { - return iwl_read32(priv, CSR_UCODE_DRV_GP2); + return il_read32(priv, CSR_UCODE_DRV_GP2); } /** - * iwl3945_hw_reg_txpower_get_temperature + * il3945_hw_reg_txpower_get_temperature * get the current temperature by reading from NIC */ -static int iwl3945_hw_reg_txpower_get_temperature(struct iwl_priv *priv) +static int il3945_hw_reg_txpower_get_temperature(struct il_priv *priv) { - struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; int temperature; - temperature = iwl3945_hw_get_temperature(priv); + temperature = il3945_hw_get_temperature(priv); /* driver's okay range is -260 to +25. * human readable okay range is 0 to +285 */ - IWL_DEBUG_INFO(priv, "Temperature: %d\n", temperature + IWL_TEMP_CONVERT); + IL_DEBUG_INFO(priv, "Temperature: %d\n", temperature + IL_TEMP_CONVERT); /* handle insane temp reading */ - if (iwl3945_hw_reg_temp_out_of_range(temperature)) { - IWL_ERR(priv, "Error bad temperature value %d\n", temperature); + if (il3945_hw_reg_temp_out_of_range(temperature)) { + IL_ERR(priv, "Error bad temperature value %d\n", temperature); /* if really really hot(?), * 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) /* Adjust Txpower only if temperature variance is greater than threshold. * * Both are lower than older versions' 9 degrees */ -#define IWL_TEMPERATURE_LIMIT_TIMER 6 +#define IL_TEMPERATURE_LIMIT_TIMER 6 /** - * iwl3945_is_temp_calib_needed - determines if new calibration is needed + * il3945_is_temp_calib_needed - determines if new calibration is needed * * records new temperature in tx_mgr->temperature. * replaces tx_mgr->last_temperature *only* if calib needed * (assumes caller will actually do the calibration!). */ -static int iwl3945_is_temp_calib_needed(struct iwl_priv *priv) +static int il3945_is_temp_calib_needed(struct il_priv *priv) { int temp_diff; - priv->temperature = iwl3945_hw_reg_txpower_get_temperature(priv); + priv->temperature = il3945_hw_reg_txpower_get_temperature(priv); temp_diff = priv->temperature - priv->last_temperature; /* get absolute value */ if (temp_diff < 0) { - IWL_DEBUG_POWER(priv, "Getting cooler, delta %d,\n", temp_diff); + IL_DEBUG_POWER(priv, "Getting cooler, delta %d,\n", temp_diff); temp_diff = -temp_diff; } else if (temp_diff == 0) - IWL_DEBUG_POWER(priv, "Same temp,\n"); + IL_DEBUG_POWER(priv, "Same temp,\n"); else - IWL_DEBUG_POWER(priv, "Getting warmer, delta %d,\n", temp_diff); + IL_DEBUG_POWER(priv, "Getting warmer, delta %d,\n", temp_diff); /* if we don't need calibration, *don't* update last_temperature */ - if (temp_diff < IWL_TEMPERATURE_LIMIT_TIMER) { - IWL_DEBUG_POWER(priv, "Timed thermal calib not needed\n"); + if (temp_diff < IL_TEMPERATURE_LIMIT_TIMER) { + IL_DEBUG_POWER(priv, "Timed thermal calib not needed\n"); return 0; } - IWL_DEBUG_POWER(priv, "Timed thermal calib needed\n"); + IL_DEBUG_POWER(priv, "Timed thermal calib needed\n"); /* assume that caller will actually do calib ... * update the "last temperature" value */ @@ -1132,13 +1132,13 @@ static int iwl3945_is_temp_calib_needed(struct iwl_priv *priv) return 1; } -#define IWL_MAX_GAIN_ENTRIES 78 -#define IWL_CCK_FROM_OFDM_POWER_DIFF -5 -#define IWL_CCK_FROM_OFDM_INDEX_DIFF (10) +#define IL_MAX_GAIN_ENTRIES 78 +#define IL_CCK_FROM_OFDM_POWER_DIFF -5 +#define IL_CCK_FROM_OFDM_INDEX_DIFF (10) /* radio and DSP power table, each step is 1/2 dB. * 1st number is for RF analog gain, 2nd number is for DSP pre-DAC gain. */ -static struct iwl3945_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = { +static struct il3945_tx_power power_gain_table[2][IL_MAX_GAIN_ENTRIES] = { { {251, 127}, /* 2.4 GHz, highest power */ {251, 127}, @@ -1299,12 +1299,12 @@ static struct iwl3945_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = { {3, 120} } /* 5.x GHz, lowest power */ }; -static inline u8 iwl3945_hw_reg_fix_power_index(int index) +static inline u8 il3945_hw_reg_fix_power_index(int index) { if (index < 0) return 0; - if (index >= IWL_MAX_GAIN_ENTRIES) - return IWL_MAX_GAIN_ENTRIES - 1; + if (index >= IL_MAX_GAIN_ENTRIES) + return IL_MAX_GAIN_ENTRIES - 1; return (u8) index; } @@ -1312,17 +1312,17 @@ static inline u8 iwl3945_hw_reg_fix_power_index(int index) #define REG_RECALIB_PERIOD (60) /** - * iwl3945_hw_reg_set_scan_power - Set Tx power for scan probe requests + * il3945_hw_reg_set_scan_power - Set Tx power for scan probe requests * * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK) * or 6 Mbit (OFDM) rates. */ -static void iwl3945_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index, +static void il3945_hw_reg_set_scan_power(struct il_priv *priv, u32 scan_tbl_index, s32 rate_index, const s8 *clip_pwrs, - struct iwl_channel_info *ch_info, + struct il_channel_info *ch_info, int band_index) { - struct iwl3945_scan_power_info *scan_power_info; + struct il3945_scan_power_info *scan_power_info; s8 power; u8 power_index; @@ -1331,7 +1331,7 @@ static void iwl3945_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_in /* use this channel group's 6Mbit clipping/saturation pwr, * but cap at regulatory scan power restriction (set during init * based on eeprom channel data) for this channel. */ - power = min(ch_info->scan_power, clip_pwrs[IWL_RATE_6M_INDEX_TABLE]); + power = min(ch_info->scan_power, clip_pwrs[IL_RATE_6M_INDEX_TABLE]); power = min(power, priv->tx_power_user_lmt); 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 * *index*. */ power_index = ch_info->power_info[rate_index].power_table_index - (power - ch_info->power_info - [IWL_RATE_6M_INDEX_TABLE].requested_power) * 2; + [IL_RATE_6M_INDEX_TABLE].requested_power) * 2; /* store reference index that we use when adjusting *all* scan * 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 * of the table. */ /* don't exceed table bounds for "real" setting */ - power_index = iwl3945_hw_reg_fix_power_index(power_index); + power_index = il3945_hw_reg_fix_power_index(power_index); scan_power_info->power_table_index = power_index; 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 } /** - * iwl3945_send_tx_power - fill in Tx Power command with gain settings + * il3945_send_tx_power - fill in Tx Power command with gain settings * * Configures power settings for all rates for the current channel, * using values from channel info struct, and send to NIC */ -static int iwl3945_send_tx_power(struct iwl_priv *priv) +static int il3945_send_tx_power(struct il_priv *priv) { int rate_idx, i; - const struct iwl_channel_info *ch_info = NULL; - struct iwl3945_txpowertable_cmd txpower = { - .channel = priv->contexts[IWL_RXON_CTX_BSS].active.channel, + const struct il_channel_info *ch_info = NULL; + struct il3945_txpowertable_cmd txpower = { + .channel = priv->contexts[IL_RXON_CTX_BSS].active.channel, }; u16 chan; @@ -1383,32 +1383,32 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv) "TX Power requested while scanning!\n")) return -EAGAIN; - chan = le16_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.channel); + chan = le16_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.channel); txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1; - ch_info = iwl_legacy_get_channel_info(priv, priv->band, chan); + ch_info = il_get_channel_info(priv, priv->band, chan); if (!ch_info) { - IWL_ERR(priv, + IL_ERR(priv, "Failed to get channel info for channel %d [%d]\n", chan, priv->band); return -EINVAL; } - if (!iwl_legacy_is_channel_valid(ch_info)) { - IWL_DEBUG_POWER(priv, "Not calling TX_PWR_TABLE_CMD on " + if (!il_is_channel_valid(ch_info)) { + IL_DEBUG_POWER(priv, "Not calling TX_PWR_TABLE_CMD on " "non-Tx channel.\n"); return 0; } /* fill cmd with power settings for all rates for current channel */ /* Fill OFDM rate */ - for (rate_idx = IWL_FIRST_OFDM_RATE, i = 0; + for (rate_idx = IL_FIRST_OFDM_RATE, i = 0; rate_idx <= IWL39_LAST_OFDM_RATE; rate_idx++, i++) { txpower.power[i].tpc = ch_info->power_info[i].tpc; - txpower.power[i].rate = iwl3945_rates[rate_idx].plcp; + txpower.power[i].rate = il3945_rates[rate_idx].plcp; - IWL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", + IL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", le16_to_cpu(txpower.channel), txpower.band, txpower.power[i].tpc.tx_gain, @@ -1416,12 +1416,12 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv) txpower.power[i].rate); } /* Fill CCK rates */ - for (rate_idx = IWL_FIRST_CCK_RATE; - rate_idx <= IWL_LAST_CCK_RATE; rate_idx++, i++) { + for (rate_idx = IL_FIRST_CCK_RATE; + rate_idx <= IL_LAST_CCK_RATE; rate_idx++, i++) { txpower.power[i].tpc = ch_info->power_info[i].tpc; - txpower.power[i].rate = iwl3945_rates[rate_idx].plcp; + txpower.power[i].rate = il3945_rates[rate_idx].plcp; - IWL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", + IL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", le16_to_cpu(txpower.channel), txpower.band, txpower.power[i].tpc.tx_gain, @@ -1429,14 +1429,14 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv) txpower.power[i].rate); } - return iwl_legacy_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, - sizeof(struct iwl3945_txpowertable_cmd), + return il_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, + sizeof(struct il3945_txpowertable_cmd), &txpower); } /** - * iwl3945_hw_reg_set_new_power - Configures power tables at new levels + * il3945_hw_reg_set_new_power - Configures power tables at new levels * @ch_info: Channel to update. Uses power_info.requested_power. * * 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) * properly fill out the scan powers, and actual h/w gain settings, * and send changes to NIC */ -static int iwl3945_hw_reg_set_new_power(struct iwl_priv *priv, - struct iwl_channel_info *ch_info) +static int il3945_hw_reg_set_new_power(struct il_priv *priv, + struct il_channel_info *ch_info) { - struct iwl3945_channel_power_info *power_info; + struct il3945_channel_power_info *power_info; int power_changed = 0; int i; const s8 *clip_pwrs; @@ -1467,7 +1467,7 @@ static int iwl3945_hw_reg_set_new_power(struct iwl_priv *priv, power_info = ch_info->power_info; /* update OFDM Txpower settings */ - for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; + for (i = IL_RATE_6M_INDEX_TABLE; i <= IL_RATE_54M_INDEX_TABLE; i++, ++power_info) { int delta_idx; @@ -1491,15 +1491,15 @@ static int iwl3945_hw_reg_set_new_power(struct iwl_priv *priv, * ... all CCK power settings for a given channel are the *same*. */ if (power_changed) { power = - ch_info->power_info[IWL_RATE_12M_INDEX_TABLE]. - requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF; + ch_info->power_info[IL_RATE_12M_INDEX_TABLE]. + requested_power + IL_CCK_FROM_OFDM_POWER_DIFF; - /* do all CCK rates' iwl3945_channel_power_info structures */ - for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) { + /* do all CCK rates' il3945_channel_power_info structures */ + for (i = IL_RATE_1M_INDEX_TABLE; i <= IL_RATE_11M_INDEX_TABLE; i++) { power_info->requested_power = power; power_info->base_power_index = - ch_info->power_info[IWL_RATE_12M_INDEX_TABLE]. - base_power_index + IWL_CCK_FROM_OFDM_INDEX_DIFF; + ch_info->power_info[IL_RATE_12M_INDEX_TABLE]. + base_power_index + IL_CCK_FROM_OFDM_INDEX_DIFF; ++power_info; } } @@ -1508,13 +1508,13 @@ static int iwl3945_hw_reg_set_new_power(struct iwl_priv *priv, } /** - * iwl3945_hw_reg_get_ch_txpower_limit - returns new power limit for channel + * il3945_hw_reg_get_ch_txpower_limit - returns new power limit for channel * * NOTE: Returned power limit may be less (but not more) than requested, * based strictly on regulatory (eeprom and spectrum mgt) limitations * (no consideration for h/w clipping limitations). */ -static int iwl3945_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info) +static int il3945_hw_reg_get_ch_txpower_limit(struct il_channel_info *ch_info) { s8 max_power; @@ -1533,7 +1533,7 @@ static int iwl3945_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info) } /** - * iwl3945_hw_reg_comp_txpower_temp - Compensate for temperature + * il3945_hw_reg_comp_txpower_temp - Compensate for temperature * * Compensate txpower settings of *all* channels for temperature. * 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) * * If RxOn is "associated", this sends the new Txpower to NIC! */ -static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv) +static int il3945_hw_reg_comp_txpower_temp(struct il_priv *priv) { - struct iwl_channel_info *ch_info = NULL; - struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; + struct il_channel_info *ch_info = NULL; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; int delta_index; const s8 *clip_pwrs; /* array of h/w max power levels for each rate */ u8 a_band; @@ -1563,7 +1563,7 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv) /* set up new Tx power info for each and every channel, 2.4 and 5.x */ for (i = 0; i < priv->channel_count; i++) { ch_info = &priv->channel_info[i]; - a_band = iwl_legacy_is_channel_a_band(ch_info); + a_band = il_is_channel_a_band(ch_info); /* Get this chnlgrp's factory calibration temperature */ 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) /* get power index adjustment based on current and factory * temps */ - delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature, + delta_index = il3945_hw_reg_adjust_power_by_temp(temperature, ref_temp); /* set tx power value for all rates, OFDM and CCK */ - for (rate_index = 0; rate_index < IWL_RATE_COUNT_3945; + for (rate_index = 0; rate_index < IL_RATE_COUNT_3945; rate_index++) { int power_idx = 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) power_idx += delta_index; /* stay within table range */ - power_idx = iwl3945_hw_reg_fix_power_index(power_idx); + power_idx = il3945_hw_reg_fix_power_index(power_idx); ch_info->power_info[rate_index]. power_table_index = (u8) power_idx; ch_info->power_info[rate_index].tpc = @@ -1596,10 +1596,10 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv) /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */ for (scan_tbl_index = 0; - scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { + scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { s32 actual_index = (scan_tbl_index == 0) ? - IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE; - iwl3945_hw_reg_set_scan_power(priv, scan_tbl_index, + IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; + il3945_hw_reg_set_scan_power(priv, scan_tbl_index, actual_index, clip_pwrs, ch_info, a_band); } @@ -1609,68 +1609,68 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv) return priv->cfg->ops->lib->send_tx_power(priv); } -int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) +int il3945_hw_reg_set_txpower(struct il_priv *priv, s8 power) { - struct iwl_channel_info *ch_info; + struct il_channel_info *ch_info; s8 max_power; u8 a_band; u8 i; if (priv->tx_power_user_lmt == power) { - IWL_DEBUG_POWER(priv, "Requested Tx power same as current " + IL_DEBUG_POWER(priv, "Requested Tx power same as current " "limit: %ddBm.\n", power); return 0; } - IWL_DEBUG_POWER(priv, "Setting upper limit clamp to %ddBm.\n", power); + IL_DEBUG_POWER(priv, "Setting upper limit clamp to %ddBm.\n", power); priv->tx_power_user_lmt = power; /* set up new Tx powers for each and every channel, 2.4 and 5.x */ for (i = 0; i < priv->channel_count; i++) { ch_info = &priv->channel_info[i]; - a_band = iwl_legacy_is_channel_a_band(ch_info); + a_band = il_is_channel_a_band(ch_info); /* find minimum power of all user and regulatory constraints * (does not consider h/w clipping limitations) */ - max_power = iwl3945_hw_reg_get_ch_txpower_limit(ch_info); + max_power = il3945_hw_reg_get_ch_txpower_limit(ch_info); max_power = min(power, max_power); if (max_power != ch_info->curr_txpow) { ch_info->curr_txpow = max_power; /* this considers the h/w clipping limitations */ - iwl3945_hw_reg_set_new_power(priv, ch_info); + il3945_hw_reg_set_new_power(priv, ch_info); } } /* update txpower settings for all channels, * send to NIC if associated. */ - iwl3945_is_temp_calib_needed(priv); - iwl3945_hw_reg_comp_txpower_temp(priv); + il3945_is_temp_calib_needed(priv); + il3945_hw_reg_comp_txpower_temp(priv); return 0; } -static int iwl3945_send_rxon_assoc(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +static int il3945_send_rxon_assoc(struct il_priv *priv, + struct il_rxon_context *ctx) { int rc = 0; - struct iwl_rx_packet *pkt; - struct iwl3945_rxon_assoc_cmd rxon_assoc; - struct iwl_host_cmd cmd = { + struct il_rx_packet *pkt; + struct il3945_rxon_assoc_cmd rxon_assoc; + struct il_host_cmd cmd = { .id = REPLY_RXON_ASSOC, .len = sizeof(rxon_assoc), .flags = CMD_WANT_SKB, .data = &rxon_assoc, }; - const struct iwl_legacy_rxon_cmd *rxon1 = &ctx->staging; - const struct iwl_legacy_rxon_cmd *rxon2 = &ctx->active; + const struct il_rxon_cmd *rxon1 = &ctx->staging; + const struct il_rxon_cmd *rxon2 = &ctx->active; if ((rxon1->flags == rxon2->flags) && (rxon1->filter_flags == rxon2->filter_flags) && (rxon1->cck_basic_rates == rxon2->cck_basic_rates) && (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { - IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); + IL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); return 0; } @@ -1680,41 +1680,41 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv, rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; rxon_assoc.reserved = 0; - rc = iwl_legacy_send_cmd_sync(priv, &cmd); + rc = il_send_cmd_sync(priv, &cmd); if (rc) return rc; - pkt = (struct iwl_rx_packet *)cmd.reply_page; - if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { - IWL_ERR(priv, "Bad return from REPLY_RXON_ASSOC command\n"); + pkt = (struct il_rx_packet *)cmd.reply_page; + if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { + IL_ERR(priv, "Bad return from REPLY_RXON_ASSOC command\n"); rc = -EIO; } - iwl_legacy_free_pages(priv, cmd.reply_page); + il_free_pages(priv, cmd.reply_page); return rc; } /** - * iwl3945_commit_rxon - commit staging_rxon to hardware + * il3945_commit_rxon - commit staging_rxon to hardware * * The RXON command in staging_rxon is committed to the hardware and * the active_rxon structure is updated with the new data. This * function correctly transitions out of the RXON_ASSOC_MSK state if * a HW tune is required based on the RXON structure changes. */ -int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) +int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) { /* cast away the const for active_rxon in this function */ - struct iwl3945_rxon_cmd *active_rxon = (void *)&ctx->active; - struct iwl3945_rxon_cmd *staging_rxon = (void *)&ctx->staging; + struct il3945_rxon_cmd *active_rxon = (void *)&ctx->active; + struct il3945_rxon_cmd *staging_rxon = (void *)&ctx->staging; int rc = 0; bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return -EINVAL; - if (!iwl_legacy_is_alive(priv)) + if (!il_is_alive(priv)) return -1; /* always get timestamp with Rx frame */ @@ -1723,23 +1723,23 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) /* select antenna */ staging_rxon->flags &= ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); - staging_rxon->flags |= iwl3945_get_antenna_flags(priv); + staging_rxon->flags |= il3945_get_antenna_flags(priv); - rc = iwl_legacy_check_rxon_cmd(priv, ctx); + rc = il_check_rxon_cmd(priv, ctx); if (rc) { - IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); + IL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); return -EINVAL; } /* If we don't need to send a full RXON, we can use - * iwl3945_rxon_assoc_cmd which is used to reconfigure filter + * il3945_rxon_assoc_cmd which is used to reconfigure filter * and other flags for the current radio configuration. */ - if (!iwl_legacy_full_rxon_required(priv, - &priv->contexts[IWL_RXON_CTX_BSS])) { - rc = iwl_legacy_send_rxon_assoc(priv, - &priv->contexts[IWL_RXON_CTX_BSS]); + if (!il_full_rxon_required(priv, + &priv->contexts[IL_RXON_CTX_BSS])) { + rc = il_send_rxon_assoc(priv, + &priv->contexts[IL_RXON_CTX_BSS]); if (rc) { - IWL_ERR(priv, "Error setting RXON_ASSOC " + IL_ERR(priv, "Error setting RXON_ASSOC " "configuration (%d).\n", rc); return rc; } @@ -1749,7 +1749,7 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) * We do not commit tx power settings while channel changing, * do it now if tx power changed. */ - iwl_legacy_set_tx_power(priv, priv->tx_power_next, false); + il_set_tx_power(priv, priv->tx_power_next, false); return 0; } @@ -1757,8 +1757,8 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) * an RXON_ASSOC and the new config wants the associated mask enabled, * we must clear the associated from the active configuration * before we apply the new config */ - if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS) && new_assoc) { - IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); + if (il_is_associated(priv, IL_RXON_CTX_BSS) && new_assoc) { + IL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; /* @@ -1767,25 +1767,25 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) */ active_rxon->reserved4 = 0; active_rxon->reserved5 = 0; - rc = iwl_legacy_send_cmd_pdu(priv, REPLY_RXON, - sizeof(struct iwl3945_rxon_cmd), - &priv->contexts[IWL_RXON_CTX_BSS].active); + rc = il_send_cmd_pdu(priv, REPLY_RXON, + sizeof(struct il3945_rxon_cmd), + &priv->contexts[IL_RXON_CTX_BSS].active); /* If the mask clearing failed then we set * active_rxon back to what it was previously */ if (rc) { active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; - IWL_ERR(priv, "Error clearing ASSOC_MSK on current " + IL_ERR(priv, "Error clearing ASSOC_MSK on current " "configuration (%d).\n", rc); return rc; } - iwl_legacy_clear_ucode_stations(priv, - &priv->contexts[IWL_RXON_CTX_BSS]); - iwl_legacy_restore_stations(priv, - &priv->contexts[IWL_RXON_CTX_BSS]); + il_clear_ucode_stations(priv, + &priv->contexts[IL_RXON_CTX_BSS]); + il_restore_stations(priv, + &priv->contexts[IL_RXON_CTX_BSS]); } - IWL_DEBUG_INFO(priv, "Sending RXON\n" + IL_DEBUG_INFO(priv, "Sending RXON\n" "* with%s RXON_FILTER_ASSOC_MSK\n" "* channel = %d\n" "* bssid = %pM\n", @@ -1800,38 +1800,38 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) staging_rxon->reserved4 = 0; staging_rxon->reserved5 = 0; - iwl_legacy_set_rxon_hwcrypto(priv, ctx, !iwl3945_mod_params.sw_crypto); + il_set_rxon_hwcrypto(priv, ctx, !il3945_mod_params.sw_crypto); /* Apply the new configuration */ - rc = iwl_legacy_send_cmd_pdu(priv, REPLY_RXON, - sizeof(struct iwl3945_rxon_cmd), + rc = il_send_cmd_pdu(priv, REPLY_RXON, + sizeof(struct il3945_rxon_cmd), staging_rxon); if (rc) { - IWL_ERR(priv, "Error setting new configuration (%d).\n", rc); + IL_ERR(priv, "Error setting new configuration (%d).\n", rc); return rc; } memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); if (!new_assoc) { - iwl_legacy_clear_ucode_stations(priv, - &priv->contexts[IWL_RXON_CTX_BSS]); - iwl_legacy_restore_stations(priv, - &priv->contexts[IWL_RXON_CTX_BSS]); + il_clear_ucode_stations(priv, + &priv->contexts[IL_RXON_CTX_BSS]); + il_restore_stations(priv, + &priv->contexts[IL_RXON_CTX_BSS]); } /* If we issue a new RXON command which required a tune then we must * send a new TXPOWER command or we won't be able to Tx any frames */ - rc = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true); + rc = il_set_tx_power(priv, priv->tx_power_next, true); if (rc) { - IWL_ERR(priv, "Error setting Tx power (%d).\n", rc); + IL_ERR(priv, "Error setting Tx power (%d).\n", rc); return rc; } /* Init the hardware's rate fallback order based on the band */ - rc = iwl3945_init_hw_rate_table(priv); + rc = il3945_init_hw_rate_table(priv); if (rc) { - IWL_ERR(priv, "Error setting HW rate table: %02X\n", rc); + IL_ERR(priv, "Error setting HW rate table: %02X\n", rc); return -EIO; } @@ -1839,7 +1839,7 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) } /** - * iwl3945_reg_txpower_periodic - called when time to check our temperature. + * il3945_reg_txpower_periodic - called when time to check our temperature. * * -- reset periodic timer * -- 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) * -- send new set of gain settings to NIC * NOTE: This should continue working, even when we're not associated, * so we can keep our internal table of scan powers current. */ -void iwl3945_reg_txpower_periodic(struct iwl_priv *priv) +void il3945_reg_txpower_periodic(struct il_priv *priv) { /* This will kick in the "brute force" - * iwl3945_hw_reg_comp_txpower_temp() below */ - if (!iwl3945_is_temp_calib_needed(priv)) + * il3945_hw_reg_comp_txpower_temp() below */ + if (!il3945_is_temp_calib_needed(priv)) goto reschedule; /* Set up a new set of temp-adjusted TxPowers, send to NIC. * This is based *only* on current temperature, * ignoring any previous power measurements */ - iwl3945_hw_reg_comp_txpower_temp(priv); + il3945_hw_reg_comp_txpower_temp(priv); reschedule: queue_delayed_work(priv->workqueue, &priv->_3945.thermal_periodic, REG_RECALIB_PERIOD * HZ); } -static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) +static void il3945_bg_reg_txpower_periodic(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, + struct il_priv *priv = container_of(work, struct il_priv, _3945.thermal_periodic.work); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; mutex_lock(&priv->mutex); - iwl3945_reg_txpower_periodic(priv); + il3945_reg_txpower_periodic(priv); mutex_unlock(&priv->mutex); } /** - * iwl3945_hw_reg_get_ch_grp_index - find the channel-group index (0-4) + * il3945_hw_reg_get_ch_grp_index - find the channel-group index (0-4) * for the channel. * * This function is used when initializing channel-info structs. @@ -1889,17 +1889,17 @@ static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) * on A-band, EEPROM's "group frequency" entries represent the top * channel in each group 1-4. Group 5 All B/G channels are in group 0. */ -static u16 iwl3945_hw_reg_get_ch_grp_index(struct iwl_priv *priv, - const struct iwl_channel_info *ch_info) +static u16 il3945_hw_reg_get_ch_grp_index(struct il_priv *priv, + const struct il_channel_info *ch_info) { - struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; - struct iwl3945_eeprom_txpower_group *ch_grp = &eeprom->groups[0]; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; + struct il3945_eeprom_txpower_group *ch_grp = &eeprom->groups[0]; u8 group; u16 group_index = 0; /* based on factory calib frequencies */ u8 grp_channel; /* Find the group index for the channel ... don't use index 1(?) */ - if (iwl_legacy_is_channel_a_band(ch_info)) { + if (il_is_channel_a_band(ch_info)) { for (group = 1; group < 5; group++) { grp_channel = ch_grp[group].group_channel; if (ch_info->channel <= grp_channel) { @@ -1913,27 +1913,27 @@ static u16 iwl3945_hw_reg_get_ch_grp_index(struct iwl_priv *priv, } else group_index = 0; /* 2.4 GHz, group 0 */ - IWL_DEBUG_POWER(priv, "Chnl %d mapped to grp %d\n", ch_info->channel, + IL_DEBUG_POWER(priv, "Chnl %d mapped to grp %d\n", ch_info->channel, group_index); return group_index; } /** - * iwl3945_hw_reg_get_matched_power_index - Interpolate to get nominal index + * il3945_hw_reg_get_matched_power_index - Interpolate to get nominal index * * Interpolate to get nominal (i.e. at factory calibration temperature) index * into radio/DSP gain settings table for requested power. */ -static int iwl3945_hw_reg_get_matched_power_index(struct iwl_priv *priv, +static int il3945_hw_reg_get_matched_power_index(struct il_priv *priv, s8 requested_power, s32 setting_index, s32 *new_index) { - const struct iwl3945_eeprom_txpower_group *chnl_grp = NULL; - struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; + const struct il3945_eeprom_txpower_group *chnl_grp = NULL; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; s32 index0, index1; s32 power = 2 * requested_power; s32 i; - const struct iwl3945_eeprom_txpower_sample *samples; + const struct il3945_eeprom_txpower_sample *samples; s32 gains0, gains1; s32 res; s32 denominator; @@ -1973,23 +1973,23 @@ static int iwl3945_hw_reg_get_matched_power_index(struct iwl_priv *priv, return 0; } -static void iwl3945_hw_reg_init_channel_groups(struct iwl_priv *priv) +static void il3945_hw_reg_init_channel_groups(struct il_priv *priv) { u32 i; s32 rate_index; - struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; - const struct iwl3945_eeprom_txpower_group *group; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; + const struct il3945_eeprom_txpower_group *group; - IWL_DEBUG_POWER(priv, "Initializing factory calib info from EEPROM\n"); + IL_DEBUG_POWER(priv, "Initializing factory calib info from EEPROM\n"); - for (i = 0; i < IWL_NUM_TX_CALIB_GROUPS; i++) { + for (i = 0; i < IL_NUM_TX_CALIB_GROUPS; i++) { s8 *clip_pwrs; /* table of power levels for each rate */ s8 satur_pwr; /* saturation power for each chnl group */ group = &eeprom->groups[i]; /* sanity check on factory saturation power value */ if (group->saturation_power < 40) { - IWL_WARN(priv, "Error: saturation power is %d, " + IL_WARN(priv, "Error: saturation power is %d, " "less than minimum expected 40\n", group->saturation_power); return; @@ -2011,21 +2011,21 @@ static void iwl3945_hw_reg_init_channel_groups(struct iwl_priv *priv) /* fill in channel group's nominal powers for each rate */ for (rate_index = 0; - rate_index < IWL_RATE_COUNT_3945; rate_index++, clip_pwrs++) { + rate_index < IL_RATE_COUNT_3945; rate_index++, clip_pwrs++) { switch (rate_index) { - case IWL_RATE_36M_INDEX_TABLE: + case IL_RATE_36M_INDEX_TABLE: if (i == 0) /* B/G */ *clip_pwrs = satur_pwr; else /* A */ *clip_pwrs = satur_pwr - 5; break; - case IWL_RATE_48M_INDEX_TABLE: + case IL_RATE_48M_INDEX_TABLE: if (i == 0) *clip_pwrs = satur_pwr - 7; else *clip_pwrs = satur_pwr - 10; break; - case IWL_RATE_54M_INDEX_TABLE: + case IL_RATE_54M_INDEX_TABLE: if (i == 0) *clip_pwrs = satur_pwr - 9; else @@ -2040,7 +2040,7 @@ static void iwl3945_hw_reg_init_channel_groups(struct iwl_priv *priv) } /** - * iwl3945_txpower_set_from_eeprom - Set channel power info based on EEPROM + * il3945_txpower_set_from_eeprom - Set channel power info based on EEPROM * * Second pass (during init) to set up priv->channel_info * @@ -2054,11 +2054,11 @@ static void iwl3945_hw_reg_init_channel_groups(struct iwl_priv *priv) * * This does *not* write values to NIC, just sets up our internal table. */ -int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) +int il3945_txpower_set_from_eeprom(struct il_priv *priv) { - struct iwl_channel_info *ch_info = NULL; - struct iwl3945_channel_power_info *pwr_info; - struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; + struct il_channel_info *ch_info = NULL; + struct il3945_channel_power_info *pwr_info; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; int delta_index; u8 rate_index; u8 scan_tbl_index; @@ -2071,37 +2071,37 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) /* save temperature reference, * so we can determine next time to calibrate */ - temperature = iwl3945_hw_reg_txpower_get_temperature(priv); + temperature = il3945_hw_reg_txpower_get_temperature(priv); priv->last_temperature = temperature; - iwl3945_hw_reg_init_channel_groups(priv); + il3945_hw_reg_init_channel_groups(priv); /* initialize Tx power info for each and every channel, 2.4 and 5.x */ for (i = 0, ch_info = priv->channel_info; i < priv->channel_count; i++, ch_info++) { - a_band = iwl_legacy_is_channel_a_band(ch_info); - if (!iwl_legacy_is_channel_valid(ch_info)) + a_band = il_is_channel_a_band(ch_info); + if (!il_is_channel_valid(ch_info)) continue; /* find this channel's channel group (*not* "band") index */ ch_info->group_index = - iwl3945_hw_reg_get_ch_grp_index(priv, ch_info); + il3945_hw_reg_get_ch_grp_index(priv, ch_info); /* Get this chnlgrp's rate->max/clip-powers table */ clip_pwrs = priv->_3945.clip_groups[ch_info->group_index].clip_powers; /* calculate power index *adjustment* value according to * diff between current temperature and factory temperature */ - delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature, + delta_index = il3945_hw_reg_adjust_power_by_temp(temperature, eeprom->groups[ch_info->group_index]. temperature); - IWL_DEBUG_POWER(priv, "Delta index for channel %d: %d [%d]\n", + IL_DEBUG_POWER(priv, "Delta index for channel %d: %d [%d]\n", ch_info->channel, delta_index, temperature + - IWL_TEMP_CONVERT); + IL_TEMP_CONVERT); /* set tx power value for all OFDM rates */ - for (rate_index = 0; rate_index < IWL_OFDM_RATES; + for (rate_index = 0; rate_index < IL_OFDM_RATES; rate_index++) { s32 uninitialized_var(power_idx); int rc; @@ -2115,11 +2115,11 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) /* get base (i.e. at factory-measured temperature) * power table index for this rate's power */ - rc = iwl3945_hw_reg_get_matched_power_index(priv, pwr, + rc = il3945_hw_reg_get_matched_power_index(priv, pwr, ch_info->group_index, &power_idx); if (rc) { - IWL_ERR(priv, "Invalid power index\n"); + IL_ERR(priv, "Invalid power index\n"); return rc; } pwr_info->base_power_index = (u8) power_idx; @@ -2128,9 +2128,9 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) power_idx += delta_index; /* stay within range of gain table */ - power_idx = iwl3945_hw_reg_fix_power_index(power_idx); + power_idx = il3945_hw_reg_fix_power_index(power_idx); - /* fill 1 OFDM rate's iwl3945_channel_power_info struct */ + /* fill 1 OFDM rate's il3945_channel_power_info struct */ pwr_info->requested_power = pwr; pwr_info->power_table_index = (u8) power_idx; pwr_info->tpc.tx_gain = @@ -2140,25 +2140,25 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) } /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/ - pwr_info = &ch_info->power_info[IWL_RATE_12M_INDEX_TABLE]; + pwr_info = &ch_info->power_info[IL_RATE_12M_INDEX_TABLE]; power = pwr_info->requested_power + - IWL_CCK_FROM_OFDM_POWER_DIFF; + IL_CCK_FROM_OFDM_POWER_DIFF; pwr_index = pwr_info->power_table_index + - IWL_CCK_FROM_OFDM_INDEX_DIFF; + IL_CCK_FROM_OFDM_INDEX_DIFF; base_pwr_index = pwr_info->base_power_index + - IWL_CCK_FROM_OFDM_INDEX_DIFF; + IL_CCK_FROM_OFDM_INDEX_DIFF; /* stay within table range */ - pwr_index = iwl3945_hw_reg_fix_power_index(pwr_index); + pwr_index = il3945_hw_reg_fix_power_index(pwr_index); gain = power_gain_table[a_band][pwr_index].tx_gain; dsp_atten = power_gain_table[a_band][pwr_index].dsp_atten; - /* fill each CCK rate's iwl3945_channel_power_info structure + /* fill each CCK rate's il3945_channel_power_info structure * NOTE: All CCK-rate Txpwrs are the same for a given chnl! * NOTE: CCK rates start at end of OFDM rates! */ for (rate_index = 0; - rate_index < IWL_CCK_RATES; rate_index++) { - pwr_info = &ch_info->power_info[rate_index+IWL_OFDM_RATES]; + rate_index < IL_CCK_RATES; rate_index++) { + pwr_info = &ch_info->power_info[rate_index+IL_OFDM_RATES]; pwr_info->requested_power = power; pwr_info->power_table_index = pwr_index; pwr_info->base_power_index = base_pwr_index; @@ -2168,10 +2168,10 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */ for (scan_tbl_index = 0; - scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { + scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { s32 actual_index = (scan_tbl_index == 0) ? - IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE; - iwl3945_hw_reg_set_scan_power(priv, scan_tbl_index, + IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; + il3945_hw_reg_set_scan_power(priv, scan_tbl_index, actual_index, clip_pwrs, ch_info, a_band); } } @@ -2179,31 +2179,31 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) return 0; } -int iwl3945_hw_rxq_stop(struct iwl_priv *priv) +int il3945_hw_rxq_stop(struct il_priv *priv) { int rc; - iwl_legacy_write_direct32(priv, FH39_RCSR_CONFIG(0), 0); - rc = iwl_poll_direct_bit(priv, FH39_RSSR_STATUS, + il_write_direct32(priv, FH39_RCSR_CONFIG(0), 0); + rc = il_poll_direct_bit(priv, FH39_RSSR_STATUS, FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); if (rc < 0) - IWL_ERR(priv, "Can't stop Rx DMA.\n"); + IL_ERR(priv, "Can't stop Rx DMA.\n"); return 0; } -int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) +int il3945_hw_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq) { int txq_id = txq->q.id; - struct iwl3945_shared *shared_data = priv->_3945.shared_virt; + struct il3945_shared *shared_data = priv->_3945.shared_virt; shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); - iwl_legacy_write_direct32(priv, FH39_CBCC_CTRL(txq_id), 0); - iwl_legacy_write_direct32(priv, FH39_CBCC_BASE(txq_id), 0); + il_write_direct32(priv, FH39_CBCC_CTRL(txq_id), 0); + il_write_direct32(priv, FH39_CBCC_BASE(txq_id), 0); - iwl_legacy_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), + il_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT | FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF | 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) FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE); /* fake read to flush all prev. writes */ - iwl_read32(priv, FH39_TSSR_CBB_BASE); + il_read32(priv, FH39_TSSR_CBB_BASE); return 0; } @@ -2219,26 +2219,26 @@ int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) /* * HCMD utils */ -static u16 iwl3945_get_hcmd_size(u8 cmd_id, u16 len) +static u16 il3945_get_hcmd_size(u8 cmd_id, u16 len) { switch (cmd_id) { case REPLY_RXON: - return sizeof(struct iwl3945_rxon_cmd); + return sizeof(struct il3945_rxon_cmd); case POWER_TABLE_CMD: - return sizeof(struct iwl3945_powertable_cmd); + return sizeof(struct il3945_powertable_cmd); default: return len; } } -static u16 iwl3945_build_addsta_hcmd(const struct iwl_legacy_addsta_cmd *cmd, +static u16 il3945_build_addsta_hcmd(const struct il_addsta_cmd *cmd, u8 *data) { - struct iwl3945_addsta_cmd *addsta = (struct iwl3945_addsta_cmd *)data; + struct il3945_addsta_cmd *addsta = (struct il3945_addsta_cmd *)data; addsta->mode = cmd->mode; memcpy(&addsta->sta, &cmd->sta, sizeof(struct sta_id_modify)); - memcpy(&addsta->key, &cmd->key, sizeof(struct iwl4965_keyinfo)); + memcpy(&addsta->key, &cmd->key, sizeof(struct il4965_keyinfo)); addsta->station_flags = cmd->station_flags; addsta->station_flags_msk = cmd->station_flags_msk; 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, addsta->remove_immediate_ba_tid = cmd->remove_immediate_ba_tid; addsta->add_immediate_ba_ssn = cmd->add_immediate_ba_ssn; - return (u16)sizeof(struct iwl3945_addsta_cmd); + return (u16)sizeof(struct il3945_addsta_cmd); } -static int iwl3945_add_bssid_station(struct iwl_priv *priv, +static int il3945_add_bssid_station(struct il_priv *priv, const u8 *addr, u8 *sta_id_r) { - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; int ret; u8 sta_id; unsigned long flags; if (sta_id_r) - *sta_id_r = IWL_INVALID_STATION; + *sta_id_r = IL_INVALID_STATION; - ret = iwl_legacy_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); + ret = il_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); if (ret) { - IWL_ERR(priv, "Unable to add station %pM\n", addr); + IL_ERR(priv, "Unable to add station %pM\n", addr); return ret; } @@ -2271,93 +2271,93 @@ static int iwl3945_add_bssid_station(struct iwl_priv *priv, *sta_id_r = sta_id; spin_lock_irqsave(&priv->sta_lock, flags); - priv->stations[sta_id].used |= IWL_STA_LOCAL; + priv->stations[sta_id].used |= IL_STA_LOCAL; spin_unlock_irqrestore(&priv->sta_lock, flags); return 0; } -static int iwl3945_manage_ibss_station(struct iwl_priv *priv, +static int il3945_manage_ibss_station(struct il_priv *priv, struct ieee80211_vif *vif, bool add) { - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; + struct il_vif_priv *vif_priv = (void *)vif->drv_priv; int ret; if (add) { - ret = iwl3945_add_bssid_station(priv, vif->bss_conf.bssid, + ret = il3945_add_bssid_station(priv, vif->bss_conf.bssid, &vif_priv->ibss_bssid_sta_id); if (ret) return ret; - iwl3945_sync_sta(priv, vif_priv->ibss_bssid_sta_id, + il3945_sync_sta(priv, vif_priv->ibss_bssid_sta_id, (priv->band == IEEE80211_BAND_5GHZ) ? - IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP); - iwl3945_rate_scale_init(priv->hw, vif_priv->ibss_bssid_sta_id); + IL_RATE_6M_PLCP : IL_RATE_1M_PLCP); + il3945_rate_scale_init(priv->hw, vif_priv->ibss_bssid_sta_id); return 0; } - return iwl_legacy_remove_station(priv, vif_priv->ibss_bssid_sta_id, + return il_remove_station(priv, vif_priv->ibss_bssid_sta_id, vif->bss_conf.bssid); } /** - * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table + * il3945_init_hw_rate_table - Initialize the hardware rate fallback table */ -int iwl3945_init_hw_rate_table(struct iwl_priv *priv) +int il3945_init_hw_rate_table(struct il_priv *priv) { int rc, i, index, prev_index; - struct iwl3945_rate_scaling_cmd rate_cmd = { + struct il3945_rate_scaling_cmd rate_cmd = { .reserved = {0, 0, 0}, }; - struct iwl3945_rate_scaling_info *table = rate_cmd.table; + struct il3945_rate_scaling_info *table = rate_cmd.table; - for (i = 0; i < ARRAY_SIZE(iwl3945_rates); i++) { - index = iwl3945_rates[i].table_rs_index; + for (i = 0; i < ARRAY_SIZE(il3945_rates); i++) { + index = il3945_rates[i].table_rs_index; table[index].rate_n_flags = - iwl3945_hw_set_rate_n_flags(iwl3945_rates[i].plcp, 0); + il3945_hw_set_rate_n_flags(il3945_rates[i].plcp, 0); table[index].try_cnt = priv->retry_rate; - prev_index = iwl3945_get_prev_ieee_rate(i); + prev_index = il3945_get_prev_ieee_rate(i); table[index].next_rate_index = - iwl3945_rates[prev_index].table_rs_index; + il3945_rates[prev_index].table_rs_index; } switch (priv->band) { case IEEE80211_BAND_5GHZ: - IWL_DEBUG_RATE(priv, "Select A mode rate scale\n"); + IL_DEBUG_RATE(priv, "Select A mode rate scale\n"); /* If one of the following CCK rates is used, * have it fall back to the 6M OFDM rate */ - for (i = IWL_RATE_1M_INDEX_TABLE; - i <= IWL_RATE_11M_INDEX_TABLE; i++) + for (i = IL_RATE_1M_INDEX_TABLE; + i <= IL_RATE_11M_INDEX_TABLE; i++) table[i].next_rate_index = - iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index; + il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index; /* Don't fall back to CCK rates */ - table[IWL_RATE_12M_INDEX_TABLE].next_rate_index = - IWL_RATE_9M_INDEX_TABLE; + table[IL_RATE_12M_INDEX_TABLE].next_rate_index = + IL_RATE_9M_INDEX_TABLE; /* Don't drop out of OFDM rates */ - table[IWL_RATE_6M_INDEX_TABLE].next_rate_index = - iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index; + table[IL_RATE_6M_INDEX_TABLE].next_rate_index = + il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index; break; case IEEE80211_BAND_2GHZ: - IWL_DEBUG_RATE(priv, "Select B/G mode rate scale\n"); + IL_DEBUG_RATE(priv, "Select B/G mode rate scale\n"); /* If an OFDM rate is used, have it fall back to the * 1M CCK rates */ - if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && - iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { + if (!(priv->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && + il_is_associated(priv, IL_RXON_CTX_BSS)) { - index = IWL_FIRST_CCK_RATE; - for (i = IWL_RATE_6M_INDEX_TABLE; - i <= IWL_RATE_54M_INDEX_TABLE; i++) + index = IL_FIRST_CCK_RATE; + for (i = IL_RATE_6M_INDEX_TABLE; + i <= IL_RATE_54M_INDEX_TABLE; i++) table[i].next_rate_index = - iwl3945_rates[index].table_rs_index; + il3945_rates[index].table_rs_index; - index = IWL_RATE_11M_INDEX_TABLE; + index = IL_RATE_11M_INDEX_TABLE; /* CCK shouldn't fall back to OFDM... */ - table[index].next_rate_index = IWL_RATE_5M_INDEX_TABLE; + table[index].next_rate_index = IL_RATE_5M_INDEX_TABLE; } break; @@ -2368,41 +2368,41 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv) /* Update the rate scaling for control frame Tx */ rate_cmd.table_id = 0; - rc = iwl_legacy_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), + rc = il_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), &rate_cmd); if (rc) return rc; /* Update the rate scaling for data frame Tx */ rate_cmd.table_id = 1; - return iwl_legacy_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), + return il_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), &rate_cmd); } /* Called when initializing driver */ -int iwl3945_hw_set_hw_params(struct iwl_priv *priv) +int il3945_hw_set_hw_params(struct il_priv *priv) { memset((void *)&priv->hw_params, 0, - sizeof(struct iwl_hw_params)); + sizeof(struct il_hw_params)); priv->_3945.shared_virt = dma_alloc_coherent(&priv->pci_dev->dev, - sizeof(struct iwl3945_shared), + sizeof(struct il3945_shared), &priv->_3945.shared_phys, GFP_KERNEL); if (!priv->_3945.shared_virt) { - IWL_ERR(priv, "failed to allocate pci memory\n"); + IL_ERR(priv, "failed to allocate pci memory\n"); return -ENOMEM; } /* Assign number of Usable TX queues */ priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; - priv->hw_params.tfd_size = sizeof(struct iwl3945_tfd); - priv->hw_params.rx_page_order = get_order(IWL_RX_BUF_SIZE_3K); + priv->hw_params.tfd_size = sizeof(struct il3945_tfd); + priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_3K); priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; priv->hw_params.max_stations = IWL3945_STATION_COUNT; - priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWL3945_BROADCAST_ID; + priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL3945_BROADCAST_ID; priv->sta_key_max_num = STA_KEY_MAX_NUM; @@ -2413,20 +2413,20 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv) return 0; } -unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv, - struct iwl3945_frame *frame, u8 rate) +unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv, + struct il3945_frame *frame, u8 rate) { - struct iwl3945_tx_beacon_cmd *tx_beacon_cmd; + struct il3945_tx_beacon_cmd *tx_beacon_cmd; unsigned int frame_size; - tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u; + tx_beacon_cmd = (struct il3945_tx_beacon_cmd *)&frame->u; memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); tx_beacon_cmd->tx.sta_id = - priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id; + priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id; tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - frame_size = iwl3945_fill_beacon_frame(priv, + frame_size = il3945_fill_beacon_frame(priv, tx_beacon_cmd->frame, sizeof(frame->u) - sizeof(*tx_beacon_cmd)); @@ -2437,51 +2437,51 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv, tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | TX_CMD_FLG_TSF_MSK); - /* supp_rates[0] == OFDM start at IWL_FIRST_OFDM_RATE*/ + /* supp_rates[0] == OFDM start at IL_FIRST_OFDM_RATE*/ tx_beacon_cmd->tx.supp_rates[0] = - (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; + (IL_OFDM_BASIC_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; tx_beacon_cmd->tx.supp_rates[1] = - (IWL_CCK_BASIC_RATES_MASK & 0xF); + (IL_CCK_BASIC_RATES_MASK & 0xF); - return sizeof(struct iwl3945_tx_beacon_cmd) + frame_size; + return sizeof(struct il3945_tx_beacon_cmd) + frame_size; } -void iwl3945_hw_rx_handler_setup(struct iwl_priv *priv) +void il3945_hw_rx_handler_setup(struct il_priv *priv) { - priv->rx_handlers[REPLY_TX] = iwl3945_rx_reply_tx; - priv->rx_handlers[REPLY_3945_RX] = iwl3945_rx_reply_rx; + priv->rx_handlers[REPLY_TX] = il3945_rx_reply_tx; + priv->rx_handlers[REPLY_3945_RX] = il3945_rx_reply_rx; } -void iwl3945_hw_setup_deferred_work(struct iwl_priv *priv) +void il3945_hw_setup_deferred_work(struct il_priv *priv) { INIT_DELAYED_WORK(&priv->_3945.thermal_periodic, - iwl3945_bg_reg_txpower_periodic); + il3945_bg_reg_txpower_periodic); } -void iwl3945_hw_cancel_deferred_work(struct iwl_priv *priv) +void il3945_hw_cancel_deferred_work(struct il_priv *priv) { cancel_delayed_work(&priv->_3945.thermal_periodic); } /* check contents of special bootstrap uCode SRAM */ -static int iwl3945_verify_bsm(struct iwl_priv *priv) +static int il3945_verify_bsm(struct il_priv *priv) { __le32 *image = priv->ucode_boot.v_addr; u32 len = priv->ucode_boot.len; u32 reg; u32 val; - IWL_DEBUG_INFO(priv, "Begin verify bsm\n"); + IL_DEBUG_INFO(priv, "Begin verify bsm\n"); /* verify BSM SRAM contents */ - val = iwl_legacy_read_prph(priv, BSM_WR_DWCOUNT_REG); + val = il_read_prph(priv, BSM_WR_DWCOUNT_REG); for (reg = BSM_SRAM_LOWER_BOUND; reg < BSM_SRAM_LOWER_BOUND + len; reg += sizeof(u32), image++) { - val = iwl_legacy_read_prph(priv, reg); + val = il_read_prph(priv, reg); if (val != le32_to_cpu(*image)) { - IWL_ERR(priv, "BSM uCode verification failed at " + IL_ERR(priv, "BSM uCode verification failed at " "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", BSM_SRAM_LOWER_BOUND, reg - BSM_SRAM_LOWER_BOUND, len, @@ -2490,7 +2490,7 @@ static int iwl3945_verify_bsm(struct iwl_priv *priv) } } - IWL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n"); + IL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n"); return 0; } @@ -2510,20 +2510,20 @@ static int iwl3945_verify_bsm(struct iwl_priv *priv) * simply claims ownership, which should be safe when this function is called * (i.e. before loading uCode!). */ -static int iwl3945_eeprom_acquire_semaphore(struct iwl_priv *priv) +static int il3945_eeprom_acquire_semaphore(struct il_priv *priv) { - _iwl_legacy_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); + _il_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); return 0; } -static void iwl3945_eeprom_release_semaphore(struct iwl_priv *priv) +static void il3945_eeprom_release_semaphore(struct il_priv *priv) { return; } /** - * iwl3945_load_bsm - Load bootstrap instructions + * il3945_load_bsm - Load bootstrap instructions * * BSM operation: * @@ -2554,7 +2554,7 @@ static void iwl3945_eeprom_release_semaphore(struct iwl_priv *priv) * the runtime uCode instructions and the backup data cache into SRAM, * and re-launches the runtime uCode from where it left off. */ -static int iwl3945_load_bsm(struct iwl_priv *priv) +static int il3945_load_bsm(struct il_priv *priv) { __le32 *image = priv->ucode_boot.v_addr; u32 len = priv->ucode_boot.len; @@ -2567,7 +2567,7 @@ static int iwl3945_load_bsm(struct iwl_priv *priv) u32 done; u32 reg_offset; - IWL_DEBUG_INFO(priv, "Begin load bsm\n"); + IL_DEBUG_INFO(priv, "Begin load bsm\n"); /* make sure bootstrap program is no larger than BSM's SRAM size */ if (len > IWL39_MAX_BSM_SIZE) @@ -2575,7 +2575,7 @@ static int iwl3945_load_bsm(struct iwl_priv *priv) /* Tell bootstrap uCode where to find the "Initialize" uCode * in host DRAM ... host DRAM physical address bits 31:0 for 3945. - * NOTE: iwl3945_initialize_alive_start() will replace these values, + * NOTE: il3945_initialize_alive_start() will replace these values, * after the "initialize" uCode has run, to point to * runtime/protocol instructions and backup data cache. */ pinst = priv->ucode_init.p_addr; @@ -2583,69 +2583,69 @@ static int iwl3945_load_bsm(struct iwl_priv *priv) inst_len = priv->ucode_init.len; data_len = priv->ucode_init_data.len; - iwl_legacy_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_legacy_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_legacy_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); - iwl_legacy_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); + il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); + il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); /* Fill BSM memory with bootstrap instructions */ for (reg_offset = BSM_SRAM_LOWER_BOUND; reg_offset < BSM_SRAM_LOWER_BOUND + len; reg_offset += sizeof(u32), image++) - _iwl_legacy_write_prph(priv, reg_offset, + _il_write_prph(priv, reg_offset, le32_to_cpu(*image)); - rc = iwl3945_verify_bsm(priv); + rc = il3945_verify_bsm(priv); if (rc) return rc; /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ - iwl_legacy_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); - iwl_legacy_write_prph(priv, BSM_WR_MEM_DST_REG, + il_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); + il_write_prph(priv, BSM_WR_MEM_DST_REG, IWL39_RTC_INST_LOWER_BOUND); - iwl_legacy_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); + il_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); /* Load bootstrap code into instruction SRAM now, * to prepare to load "initialize" uCode */ - iwl_legacy_write_prph(priv, BSM_WR_CTRL_REG, + il_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); /* Wait for load of bootstrap uCode to finish */ for (i = 0; i < 100; i++) { - done = iwl_legacy_read_prph(priv, BSM_WR_CTRL_REG); + done = il_read_prph(priv, BSM_WR_CTRL_REG); if (!(done & BSM_WR_CTRL_REG_BIT_START)) break; udelay(10); } if (i < 100) - IWL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i); + IL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i); else { - IWL_ERR(priv, "BSM write did not complete!\n"); + IL_ERR(priv, "BSM write did not complete!\n"); return -EIO; } /* Enable future boot loads whenever power management unit triggers it * (e.g. when powering back up after power-save shutdown) */ - iwl_legacy_write_prph(priv, BSM_WR_CTRL_REG, + il_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); return 0; } -static struct iwl_hcmd_ops iwl3945_hcmd = { - .rxon_assoc = iwl3945_send_rxon_assoc, - .commit_rxon = iwl3945_commit_rxon, +static struct il_hcmd_ops il3945_hcmd = { + .rxon_assoc = il3945_send_rxon_assoc, + .commit_rxon = il3945_commit_rxon, }; -static struct iwl_lib_ops iwl3945_lib = { - .txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd, - .txq_free_tfd = iwl3945_hw_txq_free_tfd, - .txq_init = iwl3945_hw_tx_queue_init, - .load_ucode = iwl3945_load_bsm, - .dump_nic_error_log = iwl3945_dump_nic_error_log, +static struct il_lib_ops il3945_lib = { + .txq_attach_buf_to_tfd = il3945_hw_txq_attach_buf_to_tfd, + .txq_free_tfd = il3945_hw_txq_free_tfd, + .txq_init = il3945_hw_tx_queue_init, + .load_ucode = il3945_load_bsm, + .dump_nic_error_log = il3945_dump_nic_error_log, .apm_ops = { - .init = iwl3945_apm_init, - .config = iwl3945_nic_config, + .init = il3945_apm_init, + .config = il3945_nic_config, }, .eeprom_ops = { .regulatory_bands = { @@ -2657,85 +2657,85 @@ static struct iwl_lib_ops iwl3945_lib = { EEPROM_REGULATORY_BAND_NO_HT40, EEPROM_REGULATORY_BAND_NO_HT40, }, - .acquire_semaphore = iwl3945_eeprom_acquire_semaphore, - .release_semaphore = iwl3945_eeprom_release_semaphore, + .acquire_semaphore = il3945_eeprom_acquire_semaphore, + .release_semaphore = il3945_eeprom_release_semaphore, }, - .send_tx_power = iwl3945_send_tx_power, - .is_valid_rtc_data_addr = iwl3945_hw_valid_rtc_data_addr, + .send_tx_power = il3945_send_tx_power, + .is_valid_rtc_data_addr = il3945_hw_valid_rtc_data_addr, .debugfs_ops = { - .rx_stats_read = iwl3945_ucode_rx_stats_read, - .tx_stats_read = iwl3945_ucode_tx_stats_read, - .general_stats_read = iwl3945_ucode_general_stats_read, + .rx_stats_read = il3945_ucode_rx_stats_read, + .tx_stats_read = il3945_ucode_tx_stats_read, + .general_stats_read = il3945_ucode_general_stats_read, }, }; -static const struct iwl_legacy_ops iwl3945_legacy_ops = { - .post_associate = iwl3945_post_associate, - .config_ap = iwl3945_config_ap, - .manage_ibss_station = iwl3945_manage_ibss_station, +static const struct il_legacy_ops il3945_legacy_ops = { + .post_associate = il3945_post_associate, + .config_ap = il3945_config_ap, + .manage_ibss_station = il3945_manage_ibss_station, }; -static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { - .get_hcmd_size = iwl3945_get_hcmd_size, - .build_addsta_hcmd = iwl3945_build_addsta_hcmd, - .request_scan = iwl3945_request_scan, - .post_scan = iwl3945_post_scan, +static struct il_hcmd_utils_ops il3945_hcmd_utils = { + .get_hcmd_size = il3945_get_hcmd_size, + .build_addsta_hcmd = il3945_build_addsta_hcmd, + .request_scan = il3945_request_scan, + .post_scan = il3945_post_scan, }; -static const struct iwl_ops iwl3945_ops = { - .lib = &iwl3945_lib, - .hcmd = &iwl3945_hcmd, - .utils = &iwl3945_hcmd_utils, - .led = &iwl3945_led_ops, - .legacy = &iwl3945_legacy_ops, - .ieee80211_ops = &iwl3945_hw_ops, +static const struct il_ops il3945_ops = { + .lib = &il3945_lib, + .hcmd = &il3945_hcmd, + .utils = &il3945_hcmd_utils, + .led = &il3945_led_ops, + .legacy = &il3945_legacy_ops, + .ieee80211_ops = &il3945_hw_ops, }; -static struct iwl_base_params iwl3945_base_params = { +static struct il_base_params il3945_base_params = { .eeprom_size = IWL3945_EEPROM_IMG_SIZE, .num_of_queues = IWL39_NUM_QUEUES, .pll_cfg_val = CSR39_ANA_PLL_CFG_VAL, .set_l0s = false, .use_bsm = true, .led_compensation = 64, - .wd_timeout = IWL_DEF_WD_TIMEOUT, + .wd_timeout = IL_DEF_WD_TIMEOUT, }; -static struct iwl_cfg iwl3945_bg_cfg = { +static struct il_cfg il3945_bg_cfg = { .name = "3945BG", .fw_name_pre = IWL3945_FW_PRE, .ucode_api_max = IWL3945_UCODE_API_MAX, .ucode_api_min = IWL3945_UCODE_API_MIN, - .sku = IWL_SKU_G, + .sku = IL_SKU_G, .eeprom_ver = EEPROM_3945_EEPROM_VERSION, - .ops = &iwl3945_ops, - .mod_params = &iwl3945_mod_params, - .base_params = &iwl3945_base_params, - .led_mode = IWL_LED_BLINK, + .ops = &il3945_ops, + .mod_params = &il3945_mod_params, + .base_params = &il3945_base_params, + .led_mode = IL_LED_BLINK, }; -static struct iwl_cfg iwl3945_abg_cfg = { +static struct il_cfg il3945_abg_cfg = { .name = "3945ABG", .fw_name_pre = IWL3945_FW_PRE, .ucode_api_max = IWL3945_UCODE_API_MAX, .ucode_api_min = IWL3945_UCODE_API_MIN, - .sku = IWL_SKU_A|IWL_SKU_G, + .sku = IL_SKU_A|IL_SKU_G, .eeprom_ver = EEPROM_3945_EEPROM_VERSION, - .ops = &iwl3945_ops, - .mod_params = &iwl3945_mod_params, - .base_params = &iwl3945_base_params, - .led_mode = IWL_LED_BLINK, + .ops = &il3945_ops, + .mod_params = &il3945_mod_params, + .base_params = &il3945_base_params, + .led_mode = IL_LED_BLINK, }; -DEFINE_PCI_DEVICE_TABLE(iwl3945_hw_card_ids) = { - {IWL_PCI_DEVICE(0x4222, 0x1005, iwl3945_bg_cfg)}, - {IWL_PCI_DEVICE(0x4222, 0x1034, iwl3945_bg_cfg)}, - {IWL_PCI_DEVICE(0x4222, 0x1044, iwl3945_bg_cfg)}, - {IWL_PCI_DEVICE(0x4227, 0x1014, iwl3945_bg_cfg)}, - {IWL_PCI_DEVICE(0x4222, PCI_ANY_ID, iwl3945_abg_cfg)}, - {IWL_PCI_DEVICE(0x4227, PCI_ANY_ID, iwl3945_abg_cfg)}, +DEFINE_PCI_DEVICE_TABLE(il3945_hw_card_ids) = { + {IL_PCI_DEVICE(0x4222, 0x1005, il3945_bg_cfg)}, + {IL_PCI_DEVICE(0x4222, 0x1034, il3945_bg_cfg)}, + {IL_PCI_DEVICE(0x4222, 0x1044, il3945_bg_cfg)}, + {IL_PCI_DEVICE(0x4227, 0x1014, il3945_bg_cfg)}, + {IL_PCI_DEVICE(0x4222, PCI_ANY_ID, il3945_abg_cfg)}, + {IL_PCI_DEVICE(0x4227, PCI_ANY_ID, il3945_abg_cfg)}, {0} }; -MODULE_DEVICE_TABLE(pci, iwl3945_hw_card_ids); +MODULE_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 b118b59..167eedc 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945.h +++ b/drivers/net/wireless/iwlegacy/iwl-3945.h @@ -29,15 +29,15 @@ * Please use iwl-3945-hw.h for hardware-related definitions. */ -#ifndef __iwl_3945_h__ -#define __iwl_3945_h__ +#ifndef __il_3945_h__ +#define __il_3945_h__ #include /* for struct pci_device_id */ #include #include /* Hardware specific file defines the PCI IDs table for that hardware module */ -extern const struct pci_device_id iwl3945_hw_card_ids[]; +extern const struct pci_device_id il3945_hw_card_ids[]; #include "iwl-csr.h" #include "iwl-prph.h" @@ -69,12 +69,12 @@ extern const struct pci_device_id iwl3945_hw_card_ids[]; * noise info (e.g. averaging might be done in app); measured dBm values are * always negative ... using a negative value as the default keeps all * averages within an s8's (used in some apps) range of negative values. */ -#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) +#define IL_NOISE_MEAS_NOT_AVAILABLE (-127) /* Module parameters accessible from iwl-*.c */ -extern struct iwl_mod_params iwl3945_mod_params; +extern struct il_mod_params il3945_mod_params; -struct iwl3945_rate_scale_data { +struct il3945_rate_scale_data { u64 data; s32 success_counter; s32 success_ratio; @@ -83,9 +83,9 @@ struct iwl3945_rate_scale_data { unsigned long stamp; }; -struct iwl3945_rs_sta { +struct il3945_rs_sta { spinlock_t lock; - struct iwl_priv *priv; + struct il_priv *priv; s32 *expected_tpt; unsigned long last_partial_flush; unsigned long last_flush; @@ -96,7 +96,7 @@ struct iwl3945_rs_sta { u8 flush_pending; u8 start_rate; struct timer_list rate_scale_flush; - struct iwl3945_rate_scale_data win[IWL_RATE_COUNT_3945]; + struct il3945_rate_scale_data win[IL_RATE_COUNT_3945]; #ifdef CONFIG_MAC80211_DEBUGFS struct dentry *rs_sta_dbgfs_stats_table_file; #endif @@ -110,15 +110,15 @@ struct iwl3945_rs_sta { * The common struct MUST be first because it is shared between * 3945 and 4965! */ -struct iwl3945_sta_priv { - struct iwl_station_priv_common common; - struct iwl3945_rs_sta rs_sta; +struct il3945_sta_priv { + struct il_station_priv_common common; + struct il3945_rs_sta rs_sta; }; -enum iwl3945_antenna { - IWL_ANTENNA_DIVERSITY, - IWL_ANTENNA_MAIN, - IWL_ANTENNA_AUX +enum il3945_antenna { + IL_ANTENNA_DIVERSITY, + IL_ANTENNA_MAIN, + IL_ANTENNA_AUX }; /* @@ -138,23 +138,23 @@ enum iwl3945_antenna { #define DEFAULT_SHORT_RETRY_LIMIT 7U #define DEFAULT_LONG_RETRY_LIMIT 4U -#define IWL_TX_FIFO_AC0 0 -#define IWL_TX_FIFO_AC1 1 -#define IWL_TX_FIFO_AC2 2 -#define IWL_TX_FIFO_AC3 3 -#define IWL_TX_FIFO_HCCA_1 5 -#define IWL_TX_FIFO_HCCA_2 6 -#define IWL_TX_FIFO_NONE 7 +#define IL_TX_FIFO_AC0 0 +#define IL_TX_FIFO_AC1 1 +#define IL_TX_FIFO_AC2 2 +#define IL_TX_FIFO_AC3 3 +#define IL_TX_FIFO_HCCA_1 5 +#define IL_TX_FIFO_HCCA_2 6 +#define IL_TX_FIFO_NONE 7 #define IEEE80211_DATA_LEN 2304 #define IEEE80211_4ADDR_LEN 30 #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) -struct iwl3945_frame { +struct il3945_frame { union { struct ieee80211_hdr frame; - struct iwl3945_tx_beacon_cmd beacon; + struct il3945_tx_beacon_cmd beacon; u8 raw[IEEE80211_FRAME_LEN]; u8 cmd[360]; } u; @@ -169,19 +169,19 @@ struct iwl3945_frame { #define SUP_RATE_11B_MAX_NUM_CHANNELS 4 #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 -#define IWL_SUPPORTED_RATES_IE_LEN 8 +#define IL_SUPPORTED_RATES_IE_LEN 8 #define SCAN_INTERVAL 100 #define MAX_TID_COUNT 9 -#define IWL_INVALID_RATE 0xFF -#define IWL_INVALID_VALUE -1 +#define IL_INVALID_RATE 0xFF +#define IL_INVALID_VALUE -1 #define STA_PS_STATUS_WAKE 0 #define STA_PS_STATUS_SLEEP 1 -struct iwl3945_ibss_seq { +struct il3945_ibss_seq { u8 mac[ETH_ALEN]; u16 seq_num; u16 frag_num; @@ -189,14 +189,14 @@ struct iwl3945_ibss_seq { struct list_head list; }; -#define IWL_RX_HDR(x) ((struct iwl3945_rx_frame_hdr *)(\ +#define IL_RX_HDR(x) ((struct il3945_rx_frame_hdr *)(\ x->u.rx_frame.stats.payload + \ x->u.rx_frame.stats.phy_count)) -#define IWL_RX_END(x) ((struct iwl3945_rx_frame_end *)(\ - IWL_RX_HDR(x)->payload + \ - le16_to_cpu(IWL_RX_HDR(x)->len))) -#define IWL_RX_STATS(x) (&x->u.rx_frame.stats) -#define IWL_RX_DATA(x) (IWL_RX_HDR(x)->payload) +#define IL_RX_END(x) ((struct il3945_rx_frame_end *)(\ + IL_RX_HDR(x)->payload + \ + le16_to_cpu(IL_RX_HDR(x)->len))) +#define IL_RX_STATS(x) (&x->u.rx_frame.stats) +#define IL_RX_DATA(x) (IL_RX_HDR(x)->payload) /****************************************************************************** @@ -205,14 +205,14 @@ struct iwl3945_ibss_seq { * for use by iwl-*.c * *****************************************************************************/ -extern int iwl3945_calc_db_from_ratio(int sig_ratio); -extern void iwl3945_rx_replenish(void *data); -extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); -extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, +extern int il3945_calc_db_from_ratio(int sig_ratio); +extern void il3945_rx_replenish(void *data); +extern void il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq); +extern unsigned int il3945_fill_beacon_frame(struct il_priv *priv, struct ieee80211_hdr *hdr, int left); -extern int iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log, +extern int il3945_dump_nic_event_log(struct il_priv *priv, bool full_log, char **buf, bool display); -extern void iwl3945_dump_nic_error_log(struct iwl_priv *priv); +extern void il3945_dump_nic_error_log(struct il_priv *priv); /****************************************************************************** * @@ -223,86 +223,86 @@ extern void iwl3945_dump_nic_error_log(struct iwl_priv *priv); * which is why they are in the hardware specific files (vs. iwl-base.c) * * Naming convention -- - * iwl3945_ <-- Its part of iwlwifi (should be changed to iwl3945_) - * iwl3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) + * il3945_ <-- Its part of iwlwifi (should be changed to il3945_) + * il3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) - * iwl3945_bg_ <-- Called from work queue context - * iwl3945_mac_ <-- mac80211 callback + * il3945_bg_ <-- Called from work queue context + * il3945_mac_ <-- mac80211 callback * ****************************************************************************/ -extern void iwl3945_hw_rx_handler_setup(struct iwl_priv *priv); -extern void iwl3945_hw_setup_deferred_work(struct iwl_priv *priv); -extern void iwl3945_hw_cancel_deferred_work(struct iwl_priv *priv); -extern int iwl3945_hw_rxq_stop(struct iwl_priv *priv); -extern int iwl3945_hw_set_hw_params(struct iwl_priv *priv); -extern int iwl3945_hw_nic_init(struct iwl_priv *priv); -extern int iwl3945_hw_nic_stop_master(struct iwl_priv *priv); -extern void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv); -extern void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv); -extern int iwl3945_hw_nic_reset(struct iwl_priv *priv); -extern int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, - struct iwl_tx_queue *txq, +extern void il3945_hw_rx_handler_setup(struct il_priv *priv); +extern void il3945_hw_setup_deferred_work(struct il_priv *priv); +extern void il3945_hw_cancel_deferred_work(struct il_priv *priv); +extern int il3945_hw_rxq_stop(struct il_priv *priv); +extern int il3945_hw_set_hw_params(struct il_priv *priv); +extern int il3945_hw_nic_init(struct il_priv *priv); +extern int il3945_hw_nic_stop_master(struct il_priv *priv); +extern void il3945_hw_txq_ctx_free(struct il_priv *priv); +extern void il3945_hw_txq_ctx_stop(struct il_priv *priv); +extern int il3945_hw_nic_reset(struct il_priv *priv); +extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv, + struct il_tx_queue *txq, dma_addr_t addr, u16 len, u8 reset, u8 pad); -extern void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, - struct iwl_tx_queue *txq); -extern int iwl3945_hw_get_temperature(struct iwl_priv *priv); -extern int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, - struct iwl_tx_queue *txq); -extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv, - struct iwl3945_frame *frame, u8 rate); -void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, - struct iwl_device_cmd *cmd, +extern void il3945_hw_txq_free_tfd(struct il_priv *priv, + struct il_tx_queue *txq); +extern int il3945_hw_get_temperature(struct il_priv *priv); +extern int il3945_hw_tx_queue_init(struct il_priv *priv, + struct il_tx_queue *txq); +extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv, + struct il3945_frame *frame, u8 rate); +void il3945_hw_build_tx_cmd_rate(struct il_priv *priv, + struct il_device_cmd *cmd, struct ieee80211_tx_info *info, struct ieee80211_hdr *hdr, int sta_id, int tx_id); -extern int iwl3945_hw_reg_send_txpower(struct iwl_priv *priv); -extern int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power); -extern void iwl3945_hw_rx_statistics(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -void iwl3945_reply_statistics(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -extern void iwl3945_disable_events(struct iwl_priv *priv); -extern int iwl4965_get_temperature(const struct iwl_priv *priv); -extern void iwl3945_post_associate(struct iwl_priv *priv); -extern void iwl3945_config_ap(struct iwl_priv *priv); - -extern int iwl3945_commit_rxon(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); +extern int il3945_hw_reg_send_txpower(struct il_priv *priv); +extern int il3945_hw_reg_set_txpower(struct il_priv *priv, s8 power); +extern void il3945_hw_rx_statistics(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); +void il3945_reply_statistics(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); +extern void il3945_disable_events(struct il_priv *priv); +extern int il4965_get_temperature(const struct il_priv *priv); +extern void il3945_post_associate(struct il_priv *priv); +extern void il3945_config_ap(struct il_priv *priv); + +extern int il3945_commit_rxon(struct il_priv *priv, + struct il_rxon_context *ctx); /** - * iwl3945_hw_find_station - Find station id for a given BSSID + * il3945_hw_find_station - Find station id for a given BSSID * @bssid: MAC address of station ID to find * * NOTE: This should not be hardware specific but the code has * not yet been merged into a single common layer for managing the * station tables. */ -extern u8 iwl3945_hw_find_station(struct iwl_priv *priv, const u8 *bssid); +extern u8 il3945_hw_find_station(struct il_priv *priv, const u8 *bssid); -extern struct ieee80211_ops iwl3945_hw_ops; +extern struct ieee80211_ops il3945_hw_ops; /* * Forward declare iwl-3945.c functions for iwl3945-base.c */ -extern __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv); -extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv); -extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv); -extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv); +extern __le32 il3945_get_antenna_flags(const struct il_priv *priv); +extern int il3945_init_hw_rate_table(struct il_priv *priv); +extern void il3945_reg_txpower_periodic(struct il_priv *priv); +extern int il3945_txpower_set_from_eeprom(struct il_priv *priv); -extern const struct iwl_channel_info *iwl3945_get_channel_info( - const struct iwl_priv *priv, enum ieee80211_band band, u16 channel); +extern const struct il_channel_info *il3945_get_channel_info( + const struct il_priv *priv, enum ieee80211_band band, u16 channel); -extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate); +extern int il3945_rs_next_rate(struct il_priv *priv, int rate); /* scanning */ -int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif); -void iwl3945_post_scan(struct iwl_priv *priv); +int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif); +void il3945_post_scan(struct il_priv *priv); /* rates */ -extern const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT_3945]; +extern const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945]; -/* Requires full declaration of iwl_priv before including */ +/* Requires full declaration of il_priv before including */ #include "iwl-io.h" #endif diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c index 162d877..115eeb3 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 { u32 beacon_energy_c; }; -void iwl4965_calib_free_results(struct iwl_priv *priv) +void il4965_calib_free_results(struct il_priv *priv) { int i; - for (i = 0; i < IWL_CALIB_MAX; i++) { + for (i = 0; i < IL_CALIB_MAX; i++) { kfree(priv->calib_results[i].buf); priv->calib_results[i].buf = NULL; priv->calib_results[i].buf_len = 0; @@ -103,7 +103,7 @@ void iwl4965_calib_free_results(struct iwl_priv *priv) * enough to receive all of our own network traffic, but not so * high that our DSP gets too busy trying to lock onto non-network * activity/noise. */ -static int iwl4965_sens_energy_cck(struct iwl_priv *priv, +static int il4965_sens_energy_cck(struct il_priv *priv, u32 norm_fa, u32 rx_enable_time, struct statistics_general_data *rx_info) @@ -129,8 +129,8 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, u32 false_alarms = norm_fa * 200 * 1024; u32 max_false_alarms = MAX_FA_CCK * rx_enable_time; u32 min_false_alarms = MIN_FA_CCK * rx_enable_time; - struct iwl_sensitivity_data *data = NULL; - const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; + struct il_sensitivity_data *data = NULL; + const struct il_sensitivity_ranges *ranges = priv->hw_params.sens; data = &(priv->sensitivity_data); @@ -160,7 +160,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, val = data->nrg_silence_rssi[i]; silence_ref = max(silence_ref, val); } - IWL_DEBUG_CALIB(priv, "silence a %u, b %u, c %u, 20-bcn max %u\n", + IL_DEBUG_CALIB(priv, "silence a %u, b %u, c %u, 20-bcn max %u\n", silence_rssi_a, silence_rssi_b, silence_rssi_c, silence_ref); @@ -184,7 +184,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, max_nrg_cck = (u32) max(max_nrg_cck, (data->nrg_value[i])); max_nrg_cck += 6; - IWL_DEBUG_CALIB(priv, "rx energy a %u, b %u, c %u, 10-bcn max/min %u\n", + IL_DEBUG_CALIB(priv, "rx energy a %u, b %u, c %u, 10-bcn max/min %u\n", rx_info->beacon_energy_a, rx_info->beacon_energy_b, rx_info->beacon_energy_c, max_nrg_cck - 6); @@ -194,16 +194,16 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, data->num_in_cck_no_fa++; else data->num_in_cck_no_fa = 0; - IWL_DEBUG_CALIB(priv, "consecutive bcns with few false alarms = %u\n", + IL_DEBUG_CALIB(priv, "consecutive bcns with few false alarms = %u\n", data->num_in_cck_no_fa); /* If we got too many false alarms this time, reduce sensitivity */ if ((false_alarms > max_false_alarms) && (data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK)) { - IWL_DEBUG_CALIB(priv, "norm FA %u > max FA %u\n", + IL_DEBUG_CALIB(priv, "norm FA %u > max FA %u\n", false_alarms, max_false_alarms); - IWL_DEBUG_CALIB(priv, "... reducing sensitivity\n"); - data->nrg_curr_state = IWL_FA_TOO_MANY; + IL_DEBUG_CALIB(priv, "... reducing sensitivity\n"); + data->nrg_curr_state = IL_FA_TOO_MANY; /* Store for "fewer than desired" on later beacon */ data->nrg_silence_ref = silence_ref; @@ -212,14 +212,14 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, data->nrg_th_cck = data->nrg_th_cck - NRG_STEP_CCK; /* Else if we got fewer than desired, increase sensitivity */ } else if (false_alarms < min_false_alarms) { - data->nrg_curr_state = IWL_FA_TOO_FEW; + data->nrg_curr_state = IL_FA_TOO_FEW; /* Compare silence level with silence level for most recent * healthy number or too many false alarms */ data->nrg_auto_corr_silence_diff = (s32)data->nrg_silence_ref - (s32)silence_ref; - IWL_DEBUG_CALIB(priv, + IL_DEBUG_CALIB(priv, "norm FA %u < min FA %u, silence diff %d\n", false_alarms, min_false_alarms, data->nrg_auto_corr_silence_diff); @@ -230,23 +230,23 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, * from a previous beacon with too many, or healthy # FAs * OR 2) We've seen a lot of beacons (100) with too few * false alarms */ - if ((data->nrg_prev_state != IWL_FA_TOO_MANY) && + if ((data->nrg_prev_state != IL_FA_TOO_MANY) && ((data->nrg_auto_corr_silence_diff > NRG_DIFF) || (data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) { - IWL_DEBUG_CALIB(priv, "... increasing sensitivity\n"); + IL_DEBUG_CALIB(priv, "... increasing sensitivity\n"); /* Increase nrg value to increase sensitivity */ val = data->nrg_th_cck + NRG_STEP_CCK; data->nrg_th_cck = min((u32)ranges->min_nrg_cck, val); } else { - IWL_DEBUG_CALIB(priv, + IL_DEBUG_CALIB(priv, "... but not changing sensitivity\n"); } /* Else we got a healthy number of false alarms, keep status quo */ } else { - IWL_DEBUG_CALIB(priv, " FA in safe zone\n"); - data->nrg_curr_state = IWL_FA_GOOD_RANGE; + IL_DEBUG_CALIB(priv, " FA in safe zone\n"); + data->nrg_curr_state = IL_FA_GOOD_RANGE; /* Store for use in "fewer than desired" with later beacon */ data->nrg_silence_ref = silence_ref; @@ -254,8 +254,8 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, /* If previous beacon had too many false alarms, * give it some extra margin by reducing sensitivity again * (but don't go below measured energy of desired Rx) */ - if (IWL_FA_TOO_MANY == data->nrg_prev_state) { - IWL_DEBUG_CALIB(priv, "... increasing margin\n"); + if (IL_FA_TOO_MANY == data->nrg_prev_state) { + IL_DEBUG_CALIB(priv, "... increasing margin\n"); if (data->nrg_th_cck > (max_nrg_cck + NRG_MARGIN)) data->nrg_th_cck -= NRG_MARGIN; else @@ -269,7 +269,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, * Lower value is higher energy, so we use max()! */ data->nrg_th_cck = max(max_nrg_cck, data->nrg_th_cck); - IWL_DEBUG_CALIB(priv, "new nrg_th_cck %u\n", data->nrg_th_cck); + IL_DEBUG_CALIB(priv, "new nrg_th_cck %u\n", data->nrg_th_cck); data->nrg_prev_state = data->nrg_curr_state; @@ -306,7 +306,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, } -static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv, +static int il4965_sens_auto_corr_ofdm(struct il_priv *priv, u32 norm_fa, u32 rx_enable_time) { @@ -314,15 +314,15 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv, u32 false_alarms = norm_fa * 200 * 1024; u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time; u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time; - struct iwl_sensitivity_data *data = NULL; - const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; + struct il_sensitivity_data *data = NULL; + const struct il_sensitivity_ranges *ranges = priv->hw_params.sens; data = &(priv->sensitivity_data); /* If we got too many false alarms this time, reduce sensitivity */ if (false_alarms > max_false_alarms) { - IWL_DEBUG_CALIB(priv, "norm FA %u > max FA %u)\n", + IL_DEBUG_CALIB(priv, "norm FA %u > max FA %u)\n", false_alarms, max_false_alarms); val = data->auto_corr_ofdm + AUTO_CORR_STEP_OFDM; @@ -345,7 +345,7 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv, /* Else if we got fewer than desired, increase sensitivity */ else if (false_alarms < min_false_alarms) { - IWL_DEBUG_CALIB(priv, "norm FA %u < min FA %u\n", + IL_DEBUG_CALIB(priv, "norm FA %u < min FA %u\n", false_alarms, min_false_alarms); val = data->auto_corr_ofdm - AUTO_CORR_STEP_OFDM; @@ -364,14 +364,14 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv, data->auto_corr_ofdm_mrc_x1 = max((u32)ranges->auto_corr_min_ofdm_mrc_x1, val); } else { - IWL_DEBUG_CALIB(priv, "min FA %u < norm FA %u < max FA %u OK\n", + IL_DEBUG_CALIB(priv, "min FA %u < norm FA %u < max FA %u OK\n", min_false_alarms, false_alarms, max_false_alarms); } return 0; } -static void iwl4965_prepare_legacy_sensitivity_tbl(struct iwl_priv *priv, - struct iwl_sensitivity_data *data, +static void il4965_prepare_legacy_sensitivity_tbl(struct il_priv *priv, + struct il_sensitivity_data *data, __le16 *tbl) { tbl[HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX] = @@ -400,24 +400,24 @@ static void iwl4965_prepare_legacy_sensitivity_tbl(struct iwl_priv *priv, tbl[HD_OFDM_ENERGY_TH_IN_INDEX] = cpu_to_le16(data->nrg_th_cca); - IWL_DEBUG_CALIB(priv, "ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n", + IL_DEBUG_CALIB(priv, "ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n", data->auto_corr_ofdm, data->auto_corr_ofdm_mrc, data->auto_corr_ofdm_x1, data->auto_corr_ofdm_mrc_x1, data->nrg_th_ofdm); - IWL_DEBUG_CALIB(priv, "cck: ac %u mrc %u thresh %u\n", + IL_DEBUG_CALIB(priv, "cck: ac %u mrc %u thresh %u\n", data->auto_corr_cck, data->auto_corr_cck_mrc, data->nrg_th_cck); } /* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ -static int iwl4965_sensitivity_write(struct iwl_priv *priv) +static int il4965_sensitivity_write(struct il_priv *priv) { - struct iwl_sensitivity_cmd cmd; - struct iwl_sensitivity_data *data = NULL; - struct iwl_host_cmd cmd_out = { + struct il_sensitivity_cmd cmd; + struct il_sensitivity_data *data = NULL; + struct il_host_cmd cmd_out = { .id = SENSITIVITY_CMD, - .len = sizeof(struct iwl_sensitivity_cmd), + .len = sizeof(struct il_sensitivity_cmd), .flags = CMD_ASYNC, .data = &cmd, }; @@ -426,7 +426,7 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv) memset(&cmd, 0, sizeof(cmd)); - iwl4965_prepare_legacy_sensitivity_tbl(priv, data, &cmd.table[0]); + il4965_prepare_legacy_sensitivity_tbl(priv, data, &cmd.table[0]); /* Update uCode's "work" table, and copy it to DSP */ cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE; @@ -434,7 +434,7 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv) /* Don't send command to uCode if nothing has changed */ if (!memcmp(&cmd.table[0], &(priv->sensitivity_tbl[0]), sizeof(u16)*HD_TABLE_SIZE)) { - IWL_DEBUG_CALIB(priv, "No change in SENSITIVITY_CMD\n"); + IL_DEBUG_CALIB(priv, "No change in SENSITIVITY_CMD\n"); return 0; } @@ -442,20 +442,20 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv) memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]), sizeof(u16)*HD_TABLE_SIZE); - return iwl_legacy_send_cmd(priv, &cmd_out); + return il_send_cmd(priv, &cmd_out); } -void iwl4965_init_sensitivity(struct iwl_priv *priv) +void il4965_init_sensitivity(struct il_priv *priv) { int ret = 0; int i; - struct iwl_sensitivity_data *data = NULL; - const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; + struct il_sensitivity_data *data = NULL; + const struct il_sensitivity_ranges *ranges = priv->hw_params.sens; if (priv->disable_sens_cal) return; - IWL_DEBUG_CALIB(priv, "Start iwl4965_init_sensitivity\n"); + IL_DEBUG_CALIB(priv, "Start il4965_init_sensitivity\n"); /* Clear driver's sensitivity algo data */ data = &(priv->sensitivity_data); @@ -463,11 +463,11 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv) if (ranges == NULL) return; - memset(data, 0, sizeof(struct iwl_sensitivity_data)); + memset(data, 0, sizeof(struct il_sensitivity_data)); data->num_in_cck_no_fa = 0; - data->nrg_curr_state = IWL_FA_TOO_MANY; - data->nrg_prev_state = IWL_FA_TOO_MANY; + data->nrg_curr_state = IL_FA_TOO_MANY; + data->nrg_prev_state = IL_FA_TOO_MANY; data->nrg_silence_ref = 0; data->nrg_silence_idx = 0; data->nrg_energy_idx = 0; @@ -495,11 +495,11 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv) data->last_bad_plcp_cnt_cck = 0; data->last_fa_cnt_cck = 0; - ret |= iwl4965_sensitivity_write(priv); - IWL_DEBUG_CALIB(priv, "<sensitivity_data); - if (!iwl_legacy_is_any_associated(priv)) { - IWL_DEBUG_CALIB(priv, "<< - not associated\n"); + if (!il_is_any_associated(priv)) { + IL_DEBUG_CALIB(priv, "<< - not associated\n"); return; } spin_lock_irqsave(&priv->lock, flags); - rx_info = &(((struct iwl_notif_statistics *)resp)->rx.general); - ofdm = &(((struct iwl_notif_statistics *)resp)->rx.ofdm); - cck = &(((struct iwl_notif_statistics *)resp)->rx.cck); + rx_info = &(((struct il_notif_statistics *)resp)->rx.general); + ofdm = &(((struct il_notif_statistics *)resp)->rx.ofdm); + cck = &(((struct il_notif_statistics *)resp)->rx.cck); if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { - IWL_DEBUG_CALIB(priv, "<< invalid data.\n"); + IL_DEBUG_CALIB(priv, "<< invalid data.\n"); spin_unlock_irqrestore(&priv->lock, flags); return; } @@ -558,10 +558,10 @@ void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp) spin_unlock_irqrestore(&priv->lock, flags); - IWL_DEBUG_CALIB(priv, "rx_enable_time = %u usecs\n", rx_enable_time); + IL_DEBUG_CALIB(priv, "rx_enable_time = %u usecs\n", rx_enable_time); if (!rx_enable_time) { - IWL_DEBUG_CALIB(priv, "<< RX Enable Time == 0!\n"); + IL_DEBUG_CALIB(priv, "<< RX Enable Time == 0!\n"); return; } @@ -600,17 +600,17 @@ void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp) norm_fa_ofdm = fa_ofdm + bad_plcp_ofdm; norm_fa_cck = fa_cck + bad_plcp_cck; - IWL_DEBUG_CALIB(priv, + IL_DEBUG_CALIB(priv, "cck: fa %u badp %u ofdm: fa %u badp %u\n", fa_cck, bad_plcp_cck, fa_ofdm, bad_plcp_ofdm); - iwl4965_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time); - iwl4965_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis); + il4965_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time); + il4965_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis); - iwl4965_sensitivity_write(priv); + il4965_sensitivity_write(priv); } -static inline u8 iwl4965_find_first_chain(u8 mask) +static inline u8 il4965_find_first_chain(u8 mask) { if (mask & ANT_A) return CHAIN_A; @@ -624,8 +624,8 @@ static inline u8 iwl4965_find_first_chain(u8 mask) * disconnected. */ static void -iwl4965_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, - struct iwl_chain_noise_data *data) +il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig, + struct il_chain_noise_data *data) { u32 active_chains = 0; u32 max_average_sig; @@ -657,9 +657,9 @@ iwl4965_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, active_chains = (1 << max_average_sig_antenna_i); } - IWL_DEBUG_CALIB(priv, "average_sig: a %d b %d c %d\n", + IL_DEBUG_CALIB(priv, "average_sig: a %d b %d c %d\n", average_sig[0], average_sig[1], average_sig[2]); - IWL_DEBUG_CALIB(priv, "max_average_sig = %d, antenna %d\n", + IL_DEBUG_CALIB(priv, "max_average_sig = %d, antenna %d\n", max_average_sig, max_average_sig_antenna_i); /* Compare signal strengths for all 3 receivers. */ @@ -673,7 +673,7 @@ iwl4965_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, data->disconn_array[i] = 1; else active_chains |= (1 << i); - IWL_DEBUG_CALIB(priv, "i = %d rssiDelta = %d " + IL_DEBUG_CALIB(priv, "i = %d rssiDelta = %d " "disconn_array[i] = %d\n", i, rssi_delta, data->disconn_array[i]); } @@ -710,10 +710,10 @@ iwl4965_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, * connect the first valid tx chain */ first_chain = - iwl4965_find_first_chain(priv->cfg->valid_tx_ant); + il4965_find_first_chain(priv->cfg->valid_tx_ant); data->disconn_array[first_chain] = 0; active_chains |= BIT(first_chain); - IWL_DEBUG_CALIB(priv, + IL_DEBUG_CALIB(priv, "All Tx chains are disconnected W/A - declare %d as connected\n", first_chain); break; @@ -722,25 +722,25 @@ iwl4965_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, if (active_chains != priv->hw_params.valid_rx_ant && active_chains != priv->chain_noise_data.active_chains) - IWL_DEBUG_CALIB(priv, + IL_DEBUG_CALIB(priv, "Detected that not all antennas are connected! " "Connected: %#x, valid: %#x.\n", active_chains, priv->hw_params.valid_rx_ant); /* Save for use within RXON, TX, SCAN commands, etc. */ data->active_chains = active_chains; - IWL_DEBUG_CALIB(priv, "active_chains (bitwise) = 0x%x\n", + IL_DEBUG_CALIB(priv, "active_chains (bitwise) = 0x%x\n", active_chains); } -static void iwl4965_gain_computation(struct iwl_priv *priv, +static void il4965_gain_computation(struct il_priv *priv, u32 *average_noise, u16 min_average_noise_antenna_i, u32 min_average_noise, u8 default_chain) { int i, ret; - struct iwl_chain_noise_data *data = &priv->chain_noise_data; + struct il_chain_noise_data *data = &priv->chain_noise_data; data->delta_gain_code[min_average_noise_antenna_i] = 0; @@ -762,32 +762,32 @@ static void iwl4965_gain_computation(struct iwl_priv *priv, data->delta_gain_code[i] = 0; } } - IWL_DEBUG_CALIB(priv, "delta_gain_codes: a %d b %d c %d\n", + IL_DEBUG_CALIB(priv, "delta_gain_codes: a %d b %d c %d\n", data->delta_gain_code[0], data->delta_gain_code[1], data->delta_gain_code[2]); /* Differential gain gets sent to uCode only once */ if (!data->radio_write) { - struct iwl_calib_diff_gain_cmd cmd; + struct il_calib_diff_gain_cmd cmd; data->radio_write = 1; memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.op_code = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD; + cmd.hdr.op_code = IL_PHY_CALIBRATE_DIFF_GAIN_CMD; cmd.diff_gain_a = data->delta_gain_code[0]; cmd.diff_gain_b = data->delta_gain_code[1]; cmd.diff_gain_c = data->delta_gain_code[2]; - ret = iwl_legacy_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, + ret = il_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, sizeof(cmd), &cmd); if (ret) - IWL_DEBUG_CALIB(priv, "fail sending cmd " + IL_DEBUG_CALIB(priv, "fail sending cmd " "REPLY_PHY_CALIBRATION_CMD\n"); /* TODO we might want recalculate * rx_chain in rxon cmd */ /* Mark so we run this algo only once! */ - data->state = IWL_CHAIN_NOISE_CALIBRATED; + data->state = IL_CHAIN_NOISE_CALIBRATED; } } @@ -799,9 +799,9 @@ static void iwl4965_gain_computation(struct iwl_priv *priv, * 1) Which antennas are connected. * 2) Differential rx gain settings to balance the 3 receivers. */ -void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) +void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp) { - struct iwl_chain_noise_data *data = NULL; + struct il_chain_noise_data *data = NULL; u32 chain_noise_a; u32 chain_noise_b; @@ -821,7 +821,7 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) unsigned long flags; struct statistics_rx_non_phy *rx_info; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; if (priv->disable_chain_noise_cal) return; @@ -832,19 +832,19 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) * Accumulate just the first "chain_noise_num_beacons" after * the first association, then we're done forever. */ - if (data->state != IWL_CHAIN_NOISE_ACCUMULATE) { - if (data->state == IWL_CHAIN_NOISE_ALIVE) - IWL_DEBUG_CALIB(priv, "Wait for noise calib reset\n"); + if (data->state != IL_CHAIN_NOISE_ACCUMULATE) { + if (data->state == IL_CHAIN_NOISE_ALIVE) + IL_DEBUG_CALIB(priv, "Wait for noise calib reset\n"); return; } spin_lock_irqsave(&priv->lock, flags); - rx_info = &(((struct iwl_notif_statistics *)stat_resp)-> + rx_info = &(((struct il_notif_statistics *)stat_resp)-> rx.general); if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { - IWL_DEBUG_CALIB(priv, " << Interference data unavailable\n"); + IL_DEBUG_CALIB(priv, " << Interference data unavailable\n"); spin_unlock_irqrestore(&priv->lock, flags); return; } @@ -852,16 +852,16 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK); rxon_chnum = le16_to_cpu(ctx->staging.channel); - stat_band24 = !!(((struct iwl_notif_statistics *) + stat_band24 = !!(((struct il_notif_statistics *) stat_resp)->flag & STATISTICS_REPLY_FLG_BAND_24G_MSK); - stat_chnum = le32_to_cpu(((struct iwl_notif_statistics *) + stat_chnum = le32_to_cpu(((struct il_notif_statistics *) stat_resp)->flag) >> 16; /* Make sure we accumulate data for just the associated channel * (even if scanning). */ if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) { - IWL_DEBUG_CALIB(priv, "Stats not from chan=%d, band24=%d\n", + IL_DEBUG_CALIB(priv, "Stats not from chan=%d, band24=%d\n", rxon_chnum, rxon_band24); spin_unlock_irqrestore(&priv->lock, flags); return; @@ -894,11 +894,11 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) data->chain_signal_b = (chain_sig_b + data->chain_signal_b); data->chain_signal_c = (chain_sig_c + data->chain_signal_c); - IWL_DEBUG_CALIB(priv, "chan=%d, band24=%d, beacon=%d\n", + IL_DEBUG_CALIB(priv, "chan=%d, band24=%d, beacon=%d\n", rxon_chnum, rxon_band24, data->beacon_count); - IWL_DEBUG_CALIB(priv, "chain_sig: a %d b %d c %d\n", + IL_DEBUG_CALIB(priv, "chain_sig: a %d b %d c %d\n", chain_sig_a, chain_sig_b, chain_sig_c); - IWL_DEBUG_CALIB(priv, "chain_noise: a %d b %d c %d\n", + IL_DEBUG_CALIB(priv, "chain_noise: a %d b %d c %d\n", chain_noise_a, chain_noise_b, chain_noise_c); /* 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) return; /* Analyze signal for disconnected antenna */ - iwl4965_find_disconn_antenna(priv, average_sig, data); + il4965_find_disconn_antenna(priv, average_sig, data); /* Analyze noise for rx balance */ average_noise[0] = data->chain_noise_a / @@ -929,16 +929,16 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) } } - IWL_DEBUG_CALIB(priv, "average_noise: a %d b %d c %d\n", + IL_DEBUG_CALIB(priv, "average_noise: a %d b %d c %d\n", average_noise[0], average_noise[1], average_noise[2]); - IWL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n", + IL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n", min_average_noise, min_average_noise_antenna_i); - iwl4965_gain_computation(priv, average_noise, + il4965_gain_computation(priv, average_noise, min_average_noise_antenna_i, min_average_noise, - iwl4965_find_first_chain(priv->cfg->valid_rx_ant)); + il4965_find_first_chain(priv->cfg->valid_rx_ant)); /* Some power changes may have been made during the calibration. * Update and commit the RXON @@ -946,22 +946,22 @@ void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) if (priv->cfg->ops->lib->update_chain_flags) priv->cfg->ops->lib->update_chain_flags(priv); - data->state = IWL_CHAIN_NOISE_DONE; - iwl_legacy_power_update_mode(priv, false); + data->state = IL_CHAIN_NOISE_DONE; + il_power_update_mode(priv, false); } -void iwl4965_reset_run_time_calib(struct iwl_priv *priv) +void il4965_reset_run_time_calib(struct il_priv *priv) { int i; memset(&(priv->sensitivity_data), 0, - sizeof(struct iwl_sensitivity_data)); + sizeof(struct il_sensitivity_data)); memset(&(priv->chain_noise_data), 0, - sizeof(struct iwl_chain_noise_data)); + sizeof(struct il_chain_noise_data)); for (i = 0; i < NUM_RX_CHAINS; i++) priv->chain_noise_data.delta_gain_code[i] = CHAIN_NOISE_DELTA_GAIN_INIT_VAL; /* Ask for statistics now, the uCode will send notification * periodically after association */ - iwl_legacy_send_statistics_request(priv, CMD_ASYNC, true); + il_send_statistics_request(priv, CMD_ASYNC, true); } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-calib.h b/drivers/net/wireless/iwlegacy/iwl-4965-calib.h index f46c80e..a23081f 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-calib.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965-calib.h @@ -59,17 +59,17 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#ifndef __iwl_4965_calib_h__ -#define __iwl_4965_calib_h__ +#ifndef __il_4965_calib_h__ +#define __il_4965_calib_h__ #include "iwl-dev.h" #include "iwl-core.h" #include "iwl-commands.h" -void iwl4965_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp); -void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp); -void iwl4965_init_sensitivity(struct iwl_priv *priv); -void iwl4965_reset_run_time_calib(struct iwl_priv *priv); -void iwl4965_calib_free_results(struct iwl_priv *priv); +void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp); +void il4965_sensitivity_calibration(struct il_priv *priv, void *resp); +void il4965_init_sensitivity(struct il_priv *priv); +void il4965_reset_run_time_calib(struct il_priv *priv); +void il4965_calib_free_results(struct il_priv *priv); -#endif /* __iwl_4965_calib_h__ */ +#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 1c93665..3c2876f 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"; static const char *fmt_header = "%-32s current cumulative delta max\n"; -static int iwl4965_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz) +static int il4965_statistics_flag(struct il_priv *priv, char *buf, int bufsz) { int p = 0; u32 flag; @@ -54,10 +54,10 @@ static int iwl4965_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz) return p; } -ssize_t iwl4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, +ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0; char *buf; 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, struct statistics_rx_non_phy *delta_general, *max_general; struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; - if (!iwl_legacy_is_alive(priv)) + if (!il_is_alive(priv)) return -EAGAIN; buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate Buffer\n"); + IL_ERR(priv, "Can not allocate Buffer\n"); return -ENOMEM; } @@ -101,7 +101,7 @@ ssize_t iwl4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, max_general = &priv->_4965.max_delta.rx.general; max_ht = &priv->_4965.max_delta.rx.ofdm_ht; - pos += iwl4965_statistics_flag(priv, buf, bufsz); + pos += il4965_statistics_flag(priv, buf, bufsz); pos += scnprintf(buf + pos, bufsz - pos, fmt_header, "Statistics_Rx - OFDM:"); pos += scnprintf(buf + pos, bufsz - pos, @@ -485,23 +485,23 @@ ssize_t iwl4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, return ret; } -ssize_t iwl4965_ucode_tx_stats_read(struct file *file, +ssize_t il4965_ucode_tx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0; char *buf; int bufsz = (sizeof(struct statistics_tx) * 48) + 250; ssize_t ret; struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; - if (!iwl_legacy_is_alive(priv)) + if (!il_is_alive(priv)) return -EAGAIN; buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate Buffer\n"); + IL_ERR(priv, "Can not allocate Buffer\n"); return -ENOMEM; } @@ -514,7 +514,7 @@ ssize_t iwl4965_ucode_tx_stats_read(struct file *file, delta_tx = &priv->_4965.delta_statistics.tx; max_tx = &priv->_4965.max_delta.tx; - pos += iwl4965_statistics_flag(priv, buf, bufsz); + pos += il4965_statistics_flag(priv, buf, bufsz); pos += scnprintf(buf + pos, bufsz - pos, fmt_header, "Statistics_Tx:"); pos += scnprintf(buf + pos, bufsz - pos, @@ -661,10 +661,10 @@ ssize_t iwl4965_ucode_tx_stats_read(struct file *file, } ssize_t -iwl4965_ucode_general_stats_read(struct file *file, char __user *user_buf, +il4965_ucode_general_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0; char *buf; int bufsz = sizeof(struct statistics_general) * 10 + 300; @@ -674,12 +674,12 @@ iwl4965_ucode_general_stats_read(struct file *file, char __user *user_buf, struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; struct statistics_div *div, *accum_div, *delta_div, *max_div; - if (!iwl_legacy_is_alive(priv)) + if (!il_is_alive(priv)) return -EAGAIN; buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate Buffer\n"); + IL_ERR(priv, "Can not allocate Buffer\n"); return -ENOMEM; } @@ -700,7 +700,7 @@ iwl4965_ucode_general_stats_read(struct file *file, char __user *user_buf, delta_div = &priv->_4965.delta_statistics.general.common.div; max_div = &priv->_4965.max_delta.general.common.div; - pos += iwl4965_statistics_flag(priv, buf, bufsz); + pos += il4965_statistics_flag(priv, buf, bufsz); pos += scnprintf(buf + pos, bufsz - pos, fmt_header, "Statistics_General:"); 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 6c8e353..ca1cf58 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.h @@ -31,27 +31,27 @@ #include "iwl-debug.h" #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS -ssize_t iwl4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, +ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos); -ssize_t iwl4965_ucode_tx_stats_read(struct file *file, char __user *user_buf, +ssize_t il4965_ucode_tx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos); -ssize_t iwl4965_ucode_general_stats_read(struct file *file, +ssize_t il4965_ucode_general_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos); #else static ssize_t -iwl4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, +il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { return 0; } static ssize_t -iwl4965_ucode_tx_stats_read(struct file *file, char __user *user_buf, +il4965_ucode_tx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { return 0; } static ssize_t -iwl4965_ucode_general_stats_read(struct file *file, char __user *user_buf, +il4965_ucode_general_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { return 0; diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c index cb9baab..e657b44 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c @@ -87,23 +87,23 @@ * EEPROM chip, not a single event, so even reads could conflict if they * weren't arbitrated by the semaphore. */ -int iwl4965_eeprom_acquire_semaphore(struct iwl_priv *priv) +int il4965_eeprom_acquire_semaphore(struct il_priv *priv) { u16 count; int ret; for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) { /* Request semaphore */ - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); /* See if we got it */ - ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG, + ret = il_poll_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, EEPROM_SEM_TIMEOUT); if (ret >= 0) { - IWL_DEBUG_IO(priv, + IL_DEBUG_IO(priv, "Acquired semaphore after %d tries.\n", count+1); return ret; @@ -113,32 +113,32 @@ int iwl4965_eeprom_acquire_semaphore(struct iwl_priv *priv) return ret; } -void iwl4965_eeprom_release_semaphore(struct iwl_priv *priv) +void il4965_eeprom_release_semaphore(struct il_priv *priv) { - iwl_legacy_clear_bit(priv, CSR_HW_IF_CONFIG_REG, + il_clear_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); } -int iwl4965_eeprom_check_version(struct iwl_priv *priv) +int il4965_eeprom_check_version(struct il_priv *priv) { u16 eeprom_ver; u16 calib_ver; - eeprom_ver = iwl_legacy_eeprom_query16(priv, EEPROM_VERSION); - calib_ver = iwl_legacy_eeprom_query16(priv, + eeprom_ver = il_eeprom_query16(priv, EEPROM_VERSION); + calib_ver = il_eeprom_query16(priv, EEPROM_4965_CALIB_VERSION_OFFSET); if (eeprom_ver < priv->cfg->eeprom_ver || calib_ver < priv->cfg->eeprom_calib_ver) goto err; - IWL_INFO(priv, "device EEPROM VER=0x%x, CALIB=0x%x\n", + IL_INFO(priv, "device EEPROM VER=0x%x, CALIB=0x%x\n", eeprom_ver, calib_ver); return 0; err: - IWL_ERR(priv, "Unsupported (too old) EEPROM VER=0x%x < 0x%x " + IL_ERR(priv, "Unsupported (too old) EEPROM VER=0x%x < 0x%x " "CALIB=0x%x < 0x%x\n", eeprom_ver, priv->cfg->eeprom_ver, calib_ver, priv->cfg->eeprom_calib_ver); @@ -146,9 +146,9 @@ err: } -void iwl4965_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac) +void il4965_eeprom_get_mac(const struct il_priv *priv, u8 *mac) { - const u8 *addr = iwl_legacy_eeprom_query_addr(priv, + const u8 *addr = il_eeprom_query_addr(priv, EEPROM_MAC_ADDRESS); memcpy(mac, addr, ETH_ALEN); } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h index fc6fa28..b6b7fe2 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h @@ -66,8 +66,8 @@ * Use iwl-dev.h for driver implementation definitions. */ -#ifndef __iwl_4965_hw_h__ -#define __iwl_4965_hw_h__ +#ifndef __il_4965_hw_h__ +#define __il_4965_hw_h__ #include "iwl-fh.h" @@ -100,7 +100,7 @@ /* Size of uCode instruction memory in bootstrap state machine */ #define IWL49_MAX_BSM_SIZE BSM_SRAM_SIZE -static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) +static inline int il4965_hw_valid_rtc_data_addr(u32 addr) { return (addr >= IWL49_RTC_DATA_LOWER_BOUND) && (addr < IWL49_RTC_DATA_UPPER_BOUND); @@ -118,7 +118,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) * real-time temperature indicator. * * uCode provides all 4 values to the driver via the "initialize alive" - * notification (see struct iwl4965_init_alive_resp). After the runtime uCode + * notification (see struct il4965_init_alive_resp). After the runtime uCode * image loads, uCode updates the R4 value via statistics notifications * (see STATISTICS_NOTIFICATION), which occur after each received beacon * 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) #define TEMPERATURE_CALIB_A_VAL 259 /* Limit range of calculated temperature to be between these Kelvin values */ -#define IWL_TX_POWER_TEMPERATURE_MIN (263) -#define IWL_TX_POWER_TEMPERATURE_MAX (410) +#define IL_TX_POWER_TEMPERATURE_MIN (263) +#define IL_TX_POWER_TEMPERATURE_MAX (410) -#define IWL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \ - (((t) < IWL_TX_POWER_TEMPERATURE_MIN) || \ - ((t) > IWL_TX_POWER_TEMPERATURE_MAX)) +#define IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \ + (((t) < IL_TX_POWER_TEMPERATURE_MIN) || \ + ((t) > IL_TX_POWER_TEMPERATURE_MAX)) /********************* END TEMPERATURE ***************************************/ @@ -168,7 +168,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) * 40 MHz wide (.11n HT40) channels are listed separately from 20 MHz * (legacy) channels. * - * See struct iwl4965_eeprom_channel for format, and struct iwl4965_eeprom + * See struct il4965_eeprom_channel for format, and struct il4965_eeprom * for locations in EEPROM. * * 2) Factory txpower calibration information is provided separately for @@ -177,11 +177,11 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) * * In addition, per-band (2.4 and 5 Ghz) saturation txpowers are provided. * - * See struct iwl4965_eeprom_calib_info (and the tree of structures - * contained within it) for format, and struct iwl4965_eeprom for + * See struct il4965_eeprom_calib_info (and the tree of structures + * contained within it) for format, and struct il4965_eeprom for * locations in EEPROM. * - * "Initialization alive" notification (see struct iwl4965_init_alive_resp) + * "Initialization alive" notification (see struct il4965_init_alive_resp) * consists of: * * 1) Temperature calculation parameters. @@ -238,7 +238,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) * * 3) Determine (EEPROM) calibration sub band for the target channel, by * comparing against first and last channels in each sub band - * (see struct iwl4965_eeprom_calib_subband_info). + * (see struct il4965_eeprom_calib_subband_info). * * * 4) Linearly interpolate (EEPROM) factory calibration measurement sets, @@ -254,7 +254,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) * span of the sampled channels. * * Driver may choose the pair (for 2 Tx chains) of measurements (see - * struct iwl4965_eeprom_calib_ch_info) for which the actual measured + * struct il4965_eeprom_calib_ch_info) for which the actual measured * txpower comes closest to the desired txpower. Usually, though, * the middle set of measurements is closest to the regulatory limits, * 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) * * * 11) Read gain table entries for DSP and radio gain, place into appropriate - * location(s) in command (struct iwl4965_txpowertable_cmd). + * location(s) in command (struct il4965_txpowertable_cmd). */ /** @@ -382,7 +382,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) * The value "6" represents number of steps in gain table to reduce power 3 dB. * Each step is 1/2 dB. */ -#define IWL_TX_POWER_MIMO_REGULATORY_COMPENSATION (6) +#define IL_TX_POWER_MIMO_REGULATORY_COMPENSATION (6) /** * CCK gain compensation. @@ -394,13 +394,13 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG, * bits [3:2], 1 = B, 2 = C. */ -#define IWL_TX_POWER_CCK_COMPENSATION_B_STEP (9) -#define IWL_TX_POWER_CCK_COMPENSATION_C_STEP (5) +#define IL_TX_POWER_CCK_COMPENSATION_B_STEP (9) +#define IL_TX_POWER_CCK_COMPENSATION_C_STEP (5) /* * 4965 power supply voltage compensation for txpower */ -#define TX_POWER_IWL_VOLTAGE_CODES_PER_03V (7) +#define TX_POWER_IL_VOLTAGE_CODES_PER_03V (7) /** * Gain tables. @@ -668,10 +668,10 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) * * Units are in half-dBm (i.e. "34" means 17 dBm). */ -#define IWL_TX_POWER_DEFAULT_REGULATORY_24 (34) -#define IWL_TX_POWER_DEFAULT_REGULATORY_52 (34) -#define IWL_TX_POWER_REGULATORY_MIN (0) -#define IWL_TX_POWER_REGULATORY_MAX (34) +#define IL_TX_POWER_DEFAULT_REGULATORY_24 (34) +#define IL_TX_POWER_DEFAULT_REGULATORY_52 (34) +#define IL_TX_POWER_REGULATORY_MIN (0) +#define IL_TX_POWER_REGULATORY_MAX (34) /** * Sanity checks and default values for EEPROM saturation levels. @@ -689,10 +689,10 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) * * Units are in half-dBm (i.e. "38" means 19 dBm). */ -#define IWL_TX_POWER_DEFAULT_SATURATION_24 (38) -#define IWL_TX_POWER_DEFAULT_SATURATION_52 (38) -#define IWL_TX_POWER_SATURATION_MIN (20) -#define IWL_TX_POWER_SATURATION_MAX (50) +#define IL_TX_POWER_DEFAULT_SATURATION_24 (38) +#define IL_TX_POWER_DEFAULT_SATURATION_52 (38) +#define IL_TX_POWER_SATURATION_MIN (20) +#define IL_TX_POWER_SATURATION_MAX (50) /** * 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) * Different frequency ranges require different compensation, as shown below. */ /* Group 0, 5.2 GHz ch 34-43: 4.5 degrees per 1/2 dB. */ -#define CALIB_IWL_TX_ATTEN_GR1_FCH 34 -#define CALIB_IWL_TX_ATTEN_GR1_LCH 43 +#define CALIB_IL_TX_ATTEN_GR1_FCH 34 +#define CALIB_IL_TX_ATTEN_GR1_LCH 43 /* Group 1, 5.3 GHz ch 44-70: 4.0 degrees per 1/2 dB. */ -#define CALIB_IWL_TX_ATTEN_GR2_FCH 44 -#define CALIB_IWL_TX_ATTEN_GR2_LCH 70 +#define CALIB_IL_TX_ATTEN_GR2_FCH 44 +#define CALIB_IL_TX_ATTEN_GR2_LCH 70 /* Group 2, 5.5 GHz ch 71-124: 4.0 degrees per 1/2 dB. */ -#define CALIB_IWL_TX_ATTEN_GR3_FCH 71 -#define CALIB_IWL_TX_ATTEN_GR3_LCH 124 +#define CALIB_IL_TX_ATTEN_GR3_FCH 71 +#define CALIB_IL_TX_ATTEN_GR3_LCH 124 /* Group 3, 5.7 GHz ch 125-200: 4.0 degrees per 1/2 dB. */ -#define CALIB_IWL_TX_ATTEN_GR4_FCH 125 -#define CALIB_IWL_TX_ATTEN_GR4_LCH 200 +#define CALIB_IL_TX_ATTEN_GR4_FCH 125 +#define CALIB_IL_TX_ATTEN_GR4_LCH 200 /* Group 4, 2.4 GHz all channels: 3.5 degrees per 1/2 dB. */ -#define CALIB_IWL_TX_ATTEN_GR5_FCH 1 -#define CALIB_IWL_TX_ATTEN_GR5_LCH 20 +#define CALIB_IL_TX_ATTEN_GR5_FCH 1 +#define CALIB_IL_TX_ATTEN_GR5_LCH 20 enum { CALIB_CH_GROUP_1 = 0, @@ -767,7 +767,7 @@ enum { /** - * struct iwl4965_schedq_bc_tbl + * struct il4965_schedq_bc_tbl * * Byte Count table * @@ -784,7 +784,7 @@ enum { * padding puts each byte count table on a 1024-byte boundary; * 4965 assumes tables are separated by 1024 bytes. */ -struct iwl4965_scd_bc_tbl { +struct il4965_scd_bc_tbl { __le16 tfd_offset[TFD_QUEUE_BC_SIZE]; u8 pad[1024 - (TFD_QUEUE_BC_SIZE) * sizeof(__le16)]; } __packed; @@ -808,4 +808,4 @@ struct iwl4965_scd_bc_tbl { #define IWL4965_FIRST_AMPDU_QUEUE 10 -#endif /* !__iwl_4965_hw_h__ */ +#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 6862fdc..d2c8eac 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-led.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-led.c @@ -44,30 +44,30 @@ /* Send led command */ static int -iwl4965_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd) +il4965_send_led_cmd(struct il_priv *priv, struct il_led_cmd *led_cmd) { - struct iwl_host_cmd cmd = { + struct il_host_cmd cmd = { .id = REPLY_LEDS_CMD, - .len = sizeof(struct iwl_led_cmd), + .len = sizeof(struct il_led_cmd), .data = led_cmd, .flags = CMD_ASYNC, .callback = NULL, }; u32 reg; - reg = iwl_read32(priv, CSR_LED_REG); + reg = il_read32(priv, CSR_LED_REG); if (reg != (reg & CSR_LED_BSM_CTRL_MSK)) - iwl_write32(priv, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK); + il_write32(priv, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK); - return iwl_legacy_send_cmd(priv, &cmd); + return il_send_cmd(priv, &cmd); } /* Set led register off */ -void iwl4965_led_enable(struct iwl_priv *priv) +void il4965_led_enable(struct il_priv *priv) { - iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_ON); + il_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_ON); } -const struct iwl_led_ops iwl4965_led_ops = { - .cmd = iwl4965_send_led_cmd, +const struct il_led_ops il4965_led_ops = { + .cmd = il4965_send_led_cmd, }; diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-led.h b/drivers/net/wireless/iwlegacy/iwl-4965-led.h index 5ed3615..ab03dff 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-led.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965-led.h @@ -24,10 +24,10 @@ * *****************************************************************************/ -#ifndef __iwl_4965_led_h__ -#define __iwl_4965_led_h__ +#ifndef __il_4965_led_h__ +#define __il_4965_led_h__ -extern const struct iwl_led_ops iwl4965_led_ops; -void iwl4965_led_enable(struct iwl_priv *priv); +extern const struct il_led_ops il4965_led_ops; +void il4965_led_enable(struct il_priv *priv); -#endif /* __iwl_4965_led_h__ */ +#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 2be6d9e..25f1d47 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c @@ -40,11 +40,11 @@ #include "iwl-4965.h" #include "iwl-sta.h" -void iwl4965_check_abort_status(struct iwl_priv *priv, +void il4965_check_abort_status(struct il_priv *priv, u8 frame_count, u32 status) { if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) { - IWL_ERR(priv, "Tx flush command to flush out all frames\n"); + IL_ERR(priv, "Tx flush command to flush out all frames\n"); if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) queue_work(priv->workqueue, &priv->tx_flush); } @@ -53,13 +53,13 @@ void iwl4965_check_abort_status(struct iwl_priv *priv, /* * EEPROM */ -struct iwl_mod_params iwl4965_mod_params = { +struct il_mod_params il4965_mod_params = { .amsdu_size_8K = 1, .restart_fw = 1, /* the rest are 0 by default */ }; -void iwl4965_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +void il4965_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq) { unsigned long flags; int i; @@ -74,7 +74,7 @@ void iwl4965_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, PAGE_SIZE << priv->hw_params.rx_page_order, PCI_DMA_FROMDEVICE); - __iwl_legacy_free_pages(priv, rxq->pool[i].page); + __il_free_pages(priv, rxq->pool[i].page); rxq->pool[i].page = NULL; } 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) spin_unlock_irqrestore(&rxq->lock, flags); } -int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +int il4965_rx_init(struct il_priv *priv, struct il_rx_queue *rxq) { u32 rb_size; 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) rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K; /* Stop Rx DMA */ - iwl_legacy_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); + il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); /* Reset driver's Rx queue write index */ - iwl_legacy_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); + il_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); /* Tell device where to find RBD circular buffer in DRAM */ - iwl_legacy_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, + il_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, (u32)(rxq->bd_dma >> 8)); /* Tell device where in DRAM to update its Rx status */ - iwl_legacy_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, + il_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, rxq->rb_stts_dma >> 4); /* Enable Rx DMA @@ -122,7 +122,7 @@ int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) * RB timeout 0x10 * 256 RBDs */ - iwl_legacy_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, + il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | 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) (rfdnlog << FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS)); /* Set interrupt coalescing timer to default (2048 usecs) */ - iwl_write8(priv, CSR_INT_COALESCING, IWL_HOST_INT_TIMEOUT_DEF); + il_write8(priv, CSR_INT_COALESCING, IL_HOST_INT_TIMEOUT_DEF); return 0; } -static void iwl4965_set_pwr_vmain(struct iwl_priv *priv) +static void il4965_set_pwr_vmain(struct il_priv *priv) { /* * (for documentation purposes) * to set power to V_AUX, do: if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) - iwl_legacy_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, + il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VAUX, ~APMG_PS_CTRL_MSK_PWR_SRC); */ - iwl_legacy_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, + il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, ~APMG_PS_CTRL_MSK_PWR_SRC); } -int iwl4965_hw_nic_init(struct iwl_priv *priv) +int il4965_hw_nic_init(struct il_priv *priv) { unsigned long flags; - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_rx_queue *rxq = &priv->rxq; int ret; /* nic_init */ @@ -164,42 +164,42 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv) priv->cfg->ops->lib->apm_ops.init(priv); /* Set interrupt coalescing calibration timer to default (512 usecs) */ - iwl_write8(priv, CSR_INT_COALESCING, IWL_HOST_INT_CALIB_TIMEOUT_DEF); + il_write8(priv, CSR_INT_COALESCING, IL_HOST_INT_CALIB_TIMEOUT_DEF); spin_unlock_irqrestore(&priv->lock, flags); - iwl4965_set_pwr_vmain(priv); + il4965_set_pwr_vmain(priv); priv->cfg->ops->lib->apm_ops.config(priv); /* Allocate the RX queue, or reset if it is already allocated */ if (!rxq->bd) { - ret = iwl_legacy_rx_queue_alloc(priv); + ret = il_rx_queue_alloc(priv); if (ret) { - IWL_ERR(priv, "Unable to initialize Rx queue\n"); + IL_ERR(priv, "Unable to initialize Rx queue\n"); return -ENOMEM; } } else - iwl4965_rx_queue_reset(priv, rxq); + il4965_rx_queue_reset(priv, rxq); - iwl4965_rx_replenish(priv); + il4965_rx_replenish(priv); - iwl4965_rx_init(priv, rxq); + il4965_rx_init(priv, rxq); spin_lock_irqsave(&priv->lock, flags); rxq->need_update = 1; - iwl_legacy_rx_queue_update_write_ptr(priv, rxq); + il_rx_queue_update_write_ptr(priv, rxq); spin_unlock_irqrestore(&priv->lock, flags); /* Allocate or reset and init all Tx and Command queues */ if (!priv->txq) { - ret = iwl4965_txq_ctx_alloc(priv); + ret = il4965_txq_ctx_alloc(priv); if (ret) return ret; } else - iwl4965_txq_ctx_reset(priv); + il4965_txq_ctx_reset(priv); set_bit(STATUS_INIT, &priv->status); @@ -207,16 +207,16 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv) } /** - * iwl4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr + * il4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr */ -static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl_priv *priv, +static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *priv, dma_addr_t dma_addr) { return cpu_to_le32((u32)(dma_addr >> 8)); } /** - * iwl4965_rx_queue_restock - refill RX queue from pre-allocated pool + * il4965_rx_queue_restock - refill RX queue from pre-allocated pool * * If there are slots in the RX queue that need to be restocked, * 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, * also updates the memory address in the firmware to reference the new * target buffer. */ -void iwl4965_rx_queue_restock(struct iwl_priv *priv) +void il4965_rx_queue_restock(struct il_priv *priv) { - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_rx_queue *rxq = &priv->rxq; struct list_head *element; - struct iwl_rx_mem_buffer *rxb; + struct il_rx_mem_buffer *rxb; unsigned long flags; spin_lock_irqsave(&rxq->lock, flags); - while ((iwl_legacy_rx_queue_space(rxq) > 0) && (rxq->free_count)) { + while ((il_rx_queue_space(rxq) > 0) && (rxq->free_count)) { /* The overwritten rxb must be a used one */ rxb = rxq->queue[rxq->write]; BUG_ON(rxb && rxb->page); /* Get next free Rx buffer, remove from free list */ element = rxq->rx_free.next; - rxb = list_entry(element, struct iwl_rx_mem_buffer, list); + rxb = list_entry(element, struct il_rx_mem_buffer, list); list_del(element); /* Point to Rx buffer via next RBD in circular buffer */ - rxq->bd[rxq->write] = iwl4965_dma_addr2rbd_ptr(priv, + rxq->bd[rxq->write] = il4965_dma_addr2rbd_ptr(priv, rxb->page_dma); rxq->queue[rxq->write] = rxb; rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; @@ -264,23 +264,23 @@ void iwl4965_rx_queue_restock(struct iwl_priv *priv) spin_lock_irqsave(&rxq->lock, flags); rxq->need_update = 1; spin_unlock_irqrestore(&rxq->lock, flags); - iwl_legacy_rx_queue_update_write_ptr(priv, rxq); + il_rx_queue_update_write_ptr(priv, rxq); } } /** - * iwl4965_rx_replenish - Move all used packet from rx_used to rx_free + * il4965_rx_replenish - Move all used packet from rx_used to rx_free * * When moving to rx_free an SKB is allocated for the slot. * - * Also restock the Rx queue via iwl_rx_queue_restock. + * Also restock the Rx queue via il_rx_queue_restock. * This is called as a scheduled work item (except for during initialization) */ -static void iwl4965_rx_allocate(struct iwl_priv *priv, gfp_t priority) +static void il4965_rx_allocate(struct il_priv *priv, gfp_t priority) { - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_rx_queue *rxq = &priv->rxq; struct list_head *element; - struct iwl_rx_mem_buffer *rxb; + struct il_rx_mem_buffer *rxb; struct page *page; unsigned long flags; gfp_t gfp_mask = priority; @@ -303,13 +303,13 @@ static void iwl4965_rx_allocate(struct iwl_priv *priv, gfp_t priority) page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order); if (!page) { if (net_ratelimit()) - IWL_DEBUG_INFO(priv, "alloc_pages failed, " + IL_DEBUG_INFO(priv, "alloc_pages failed, " "order: %d\n", priv->hw_params.rx_page_order); if ((rxq->free_count <= RX_LOW_WATERMARK) && net_ratelimit()) - IWL_CRIT(priv, + IL_CRIT(priv, "Failed to alloc_pages with %s. " "Only %u free buffers remaining.\n", priority == GFP_ATOMIC ? @@ -329,7 +329,7 @@ static void iwl4965_rx_allocate(struct iwl_priv *priv, gfp_t priority) return; } element = rxq->rx_used.next; - rxb = list_entry(element, struct iwl_rx_mem_buffer, list); + rxb = list_entry(element, struct il_rx_mem_buffer, list); list_del(element); spin_unlock_irqrestore(&rxq->lock, flags); @@ -355,22 +355,22 @@ static void iwl4965_rx_allocate(struct iwl_priv *priv, gfp_t priority) } } -void iwl4965_rx_replenish(struct iwl_priv *priv) +void il4965_rx_replenish(struct il_priv *priv) { unsigned long flags; - iwl4965_rx_allocate(priv, GFP_KERNEL); + il4965_rx_allocate(priv, GFP_KERNEL); spin_lock_irqsave(&priv->lock, flags); - iwl4965_rx_queue_restock(priv); + il4965_rx_queue_restock(priv); spin_unlock_irqrestore(&priv->lock, flags); } -void iwl4965_rx_replenish_now(struct iwl_priv *priv) +void il4965_rx_replenish_now(struct il_priv *priv) { - iwl4965_rx_allocate(priv, GFP_ATOMIC); + il4965_rx_allocate(priv, GFP_ATOMIC); - iwl4965_rx_queue_restock(priv); + il4965_rx_queue_restock(priv); } /* 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) * This free routine walks the list of POOL entries and if SKB is set to * non NULL it is unmapped and freed */ -void iwl4965_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +void il4965_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq) { int i; 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) pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, PAGE_SIZE << priv->hw_params.rx_page_order, PCI_DMA_FROMDEVICE); - __iwl_legacy_free_pages(priv, rxq->pool[i].page); + __il_free_pages(priv, rxq->pool[i].page); rxq->pool[i].page = NULL; } } dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, rxq->bd_dma); - dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), + dma_free_coherent(&priv->pci_dev->dev, sizeof(struct il_rb_status), rxq->rb_stts, rxq->rb_stts_dma); rxq->bd = NULL; rxq->rb_stts = NULL; } -int iwl4965_rxq_stop(struct iwl_priv *priv) +int il4965_rxq_stop(struct il_priv *priv) { /* stop Rx DMA */ - iwl_legacy_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); - iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, + il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); + il_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); return 0; } -int iwl4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) +int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) { int idx = 0; int band_offset = 0; @@ -422,8 +422,8 @@ int iwl4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) /* Legacy rate format, search for match in table */ } else { if (band == IEEE80211_BAND_5GHZ) - band_offset = IWL_FIRST_OFDM_RATE; - for (idx = band_offset; idx < IWL_RATE_COUNT_LEGACY; idx++) + band_offset = IL_FIRST_OFDM_RATE; + for (idx = band_offset; idx < IL_RATE_COUNT_LEGACY; idx++) if (iwlegacy_rates[idx].plcp == (rate_n_flags & 0xFF)) return idx - band_offset; } @@ -431,13 +431,13 @@ int iwl4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) return -1; } -static int iwl4965_calc_rssi(struct iwl_priv *priv, - struct iwl_rx_phy_res *rx_resp) +static int il4965_calc_rssi(struct il_priv *priv, + struct il_rx_phy_res *rx_resp) { /* data from PHY/DSP regarding signal strength, etc., * contents are always there, not configurable by host. */ - struct iwl4965_rx_non_cfg_phy *ncphy = - (struct iwl4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy_buf; + struct il4965_rx_non_cfg_phy *ncphy = + (struct il4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy_buf; u32 agc = (le16_to_cpu(ncphy->agc_info) & IWL49_AGC_DB_MASK) >> IWL49_AGC_DB_POS; @@ -456,7 +456,7 @@ static int iwl4965_calc_rssi(struct iwl_priv *priv, if (valid_antennae & (1 << i)) max_rssi = max(ncphy->rssi_info[i << 1], max_rssi); - IWL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n", + IL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n", ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4], max_rssi, agc); @@ -466,7 +466,7 @@ static int iwl4965_calc_rssi(struct iwl_priv *priv, } -static u32 iwl4965_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in) +static u32 il4965_translate_rx_status(struct il_priv *priv, u32 decrypt_in) { u32 decrypt_out = 0; @@ -519,17 +519,17 @@ static u32 iwl4965_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in) break; } - IWL_DEBUG_RX(priv, "decrypt_in:0x%x decrypt_out = 0x%x\n", + IL_DEBUG_RX(priv, "decrypt_in:0x%x decrypt_out = 0x%x\n", decrypt_in, decrypt_out); return decrypt_out; } -static void iwl4965_pass_packet_to_mac80211(struct iwl_priv *priv, +static void il4965_pass_packet_to_mac80211(struct il_priv *priv, struct ieee80211_hdr *hdr, u16 len, u32 ampdu_status, - struct iwl_rx_mem_buffer *rxb, + struct il_rx_mem_buffer *rxb, struct ieee80211_rx_status *stats) { struct sk_buff *skb; @@ -537,25 +537,25 @@ static void iwl4965_pass_packet_to_mac80211(struct iwl_priv *priv, /* We only process data packets if the interface is open */ if (unlikely(!priv->is_open)) { - IWL_DEBUG_DROP_LIMIT(priv, + IL_DEBUG_DROP_LIMIT(priv, "Dropping packet while interface is not open.\n"); return; } /* In case of HW accelerated crypto and bad decryption, drop */ if (!priv->cfg->mod_params->sw_crypto && - iwl_legacy_set_decrypted_flag(priv, hdr, ampdu_status, stats)) + il_set_decrypted_flag(priv, hdr, ampdu_status, stats)) return; skb = dev_alloc_skb(128); if (!skb) { - IWL_ERR(priv, "dev_alloc_skb failed\n"); + IL_ERR(priv, "dev_alloc_skb failed\n"); return; } skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len); - iwl_legacy_update_stats(priv, false, fc, len); + il_update_stats(priv, false, fc, len); memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); ieee80211_rx(priv->hw, skb); @@ -565,15 +565,15 @@ static void iwl4965_pass_packet_to_mac80211(struct iwl_priv *priv, /* Called for REPLY_RX (legacy ABG frames), or * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ -void iwl4965_rx_reply_rx(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il4965_rx_reply_rx(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { struct ieee80211_hdr *header; struct ieee80211_rx_status rx_status; - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_rx_phy_res *phy_res; + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_phy_res *phy_res; __le32 rx_pkt_status; - struct iwl_rx_mpdu_res_start *amsdu; + struct il_rx_mpdu_res_start *amsdu; u32 len; u32 ampdu_status; u32 rate_n_flags; @@ -588,7 +588,7 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv, * received. */ if (pkt->hdr.cmd == REPLY_RX) { - phy_res = (struct iwl_rx_phy_res *)pkt->u.raw; + phy_res = (struct il_rx_phy_res *)pkt->u.raw; header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*phy_res) + phy_res->cfg_phy_cnt); @@ -598,27 +598,27 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv, ampdu_status = le32_to_cpu(rx_pkt_status); } else { if (!priv->_4965.last_phy_res_valid) { - IWL_ERR(priv, "MPDU frame without cached PHY data\n"); + IL_ERR(priv, "MPDU frame without cached PHY data\n"); return; } phy_res = &priv->_4965.last_phy_res; - amsdu = (struct iwl_rx_mpdu_res_start *)pkt->u.raw; + amsdu = (struct il_rx_mpdu_res_start *)pkt->u.raw; header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*amsdu)); len = le16_to_cpu(amsdu->byte_count); rx_pkt_status = *(__le32 *)(pkt->u.raw + sizeof(*amsdu) + len); - ampdu_status = iwl4965_translate_rx_status(priv, + ampdu_status = il4965_translate_rx_status(priv, le32_to_cpu(rx_pkt_status)); } if ((unlikely(phy_res->cfg_phy_cnt > 20))) { - IWL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n", + IL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n", phy_res->cfg_phy_cnt); return; } if (!(rx_pkt_status & RX_RES_STATUS_NO_CRC32_ERROR) || !(rx_pkt_status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { - IWL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", + IL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", le32_to_cpu(rx_pkt_status)); return; } @@ -634,7 +634,7 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv, ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel), rx_status.band); rx_status.rate_idx = - iwl4965_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band); + il4965_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band); rx_status.flag = 0; /* TSF isn't reliable. In order to allow smooth user experience, @@ -644,10 +644,10 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv, priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp); /* Find max signal strength (dBm) among 3 antenna/receiver chains */ - rx_status.signal = iwl4965_calc_rssi(priv, phy_res); + rx_status.signal = il4965_calc_rssi(priv, phy_res); - iwl_legacy_dbg_log_rx_data_frame(priv, len, header); - IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n", + il_dbg_log_rx_data_frame(priv, len, header); + IL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n", rx_status.signal, (unsigned long long)rx_status.mactime); /* @@ -679,41 +679,41 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv, if (rate_n_flags & RATE_MCS_SGI_MSK) rx_status.flag |= RX_FLAG_SHORT_GI; - iwl4965_pass_packet_to_mac80211(priv, header, len, ampdu_status, + il4965_pass_packet_to_mac80211(priv, header, len, ampdu_status, rxb, &rx_status); } /* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD). - * This will be used later in iwl_rx_reply_rx() for REPLY_RX_MPDU_CMD. */ -void iwl4965_rx_reply_rx_phy(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) + * This will be used later in il_rx_reply_rx() for REPLY_RX_MPDU_CMD. */ +void il4965_rx_reply_rx_phy(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); priv->_4965.last_phy_res_valid = true; memcpy(&priv->_4965.last_phy_res, pkt->u.raw, - sizeof(struct iwl_rx_phy_res)); + sizeof(struct il_rx_phy_res)); } -static int iwl4965_get_channels_for_scan(struct iwl_priv *priv, +static int il4965_get_channels_for_scan(struct il_priv *priv, struct ieee80211_vif *vif, enum ieee80211_band band, u8 is_active, u8 n_probes, - struct iwl_scan_channel *scan_ch) + struct il_scan_channel *scan_ch) { struct ieee80211_channel *chan; const struct ieee80211_supported_band *sband; - const struct iwl_channel_info *ch_info; + const struct il_channel_info *ch_info; u16 passive_dwell = 0; u16 active_dwell = 0; int added, i; u16 channel; - sband = iwl_get_hw_mode(priv, band); + sband = il_get_hw_mode(priv, band); if (!sband) return 0; - active_dwell = iwl_legacy_get_active_dwell_time(priv, band, n_probes); - passive_dwell = iwl_legacy_get_passive_dwell_time(priv, band, vif); + active_dwell = il_get_active_dwell_time(priv, band, n_probes); + passive_dwell = il_get_passive_dwell_time(priv, band, vif); if (passive_dwell <= active_dwell) passive_dwell = active_dwell + 1; @@ -727,22 +727,22 @@ static int iwl4965_get_channels_for_scan(struct iwl_priv *priv, channel = chan->hw_value; scan_ch->channel = cpu_to_le16(channel); - ch_info = iwl_legacy_get_channel_info(priv, band, channel); - if (!iwl_legacy_is_channel_valid(ch_info)) { - IWL_DEBUG_SCAN(priv, + ch_info = il_get_channel_info(priv, band, channel); + if (!il_is_channel_valid(ch_info)) { + IL_DEBUG_SCAN(priv, "Channel %d is INVALID for this band.\n", channel); continue; } - if (!is_active || iwl_legacy_is_channel_passive(ch_info) || + if (!is_active || il_is_channel_passive(ch_info) || (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; else scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; if (n_probes) - scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); + scan_ch->type |= IL_SCAN_PROBE_MASK(n_probes); scan_ch->active_dwell = cpu_to_le16(active_dwell); scan_ch->passive_dwell = cpu_to_le16(passive_dwell); @@ -759,7 +759,7 @@ static int iwl4965_get_channels_for_scan(struct iwl_priv *priv, else scan_ch->tx_gain = ((1 << 5) | (5 << 3)); - IWL_DEBUG_SCAN(priv, "Scanning ch=%d prob=0x%X [%s %d]\n", + IL_DEBUG_SCAN(priv, "Scanning ch=%d prob=0x%X [%s %d]\n", channel, le32_to_cpu(scan_ch->type), (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ? "ACTIVE" : "PASSIVE", @@ -770,19 +770,19 @@ static int iwl4965_get_channels_for_scan(struct iwl_priv *priv, added++; } - IWL_DEBUG_SCAN(priv, "total channels to scan %d\n", added); + IL_DEBUG_SCAN(priv, "total channels to scan %d\n", added); return added; } -int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) +int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) { - struct iwl_host_cmd cmd = { + struct il_host_cmd cmd = { .id = REPLY_SCAN_CMD, - .len = sizeof(struct iwl_scan_cmd), + .len = sizeof(struct il_scan_cmd), .flags = CMD_SIZE_HUGE, }; - struct iwl_scan_cmd *scan; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_scan_cmd *scan; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; u32 rate_flags = 0; u16 cmd_len; u16 rx_chain = 0; @@ -799,30 +799,30 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) lockdep_assert_held(&priv->mutex); if (vif) - ctx = iwl_legacy_rxon_ctx_from_vif(vif); + ctx = il_rxon_ctx_from_vif(vif); if (!priv->scan_cmd) { - priv->scan_cmd = kmalloc(sizeof(struct iwl_scan_cmd) + - IWL_MAX_SCAN_SIZE, GFP_KERNEL); + priv->scan_cmd = kmalloc(sizeof(struct il_scan_cmd) + + IL_MAX_SCAN_SIZE, GFP_KERNEL); if (!priv->scan_cmd) { - IWL_DEBUG_SCAN(priv, + IL_DEBUG_SCAN(priv, "fail to allocate memory for scan\n"); return -ENOMEM; } } scan = priv->scan_cmd; - memset(scan, 0, sizeof(struct iwl_scan_cmd) + IWL_MAX_SCAN_SIZE); + memset(scan, 0, sizeof(struct il_scan_cmd) + IL_MAX_SCAN_SIZE); - scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; - scan->quiet_time = IWL_ACTIVE_QUIET_TIME; + scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH; + scan->quiet_time = IL_ACTIVE_QUIET_TIME; - if (iwl_legacy_is_any_associated(priv)) { + if (il_is_any_associated(priv)) { u16 interval; u32 extra; u32 suspend_time = 100; u32 scan_suspend_time = 100; - IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); + IL_DEBUG_INFO(priv, "Scanning while associated...\n"); interval = vif->bss_conf.beacon_int; scan->suspend_time = 0; @@ -834,13 +834,13 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) scan_suspend_time = (extra | ((suspend_time % interval) * 1024)); scan->suspend_time = cpu_to_le32(scan_suspend_time); - IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n", + IL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n", scan_suspend_time, interval); } if (priv->scan_request->n_ssids) { int i, p = 0; - IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); + IL_DEBUG_SCAN(priv, "Kicking off active scan\n"); for (i = 0; i < priv->scan_request->n_ssids; i++) { /* always does wildcard anyway */ if (!priv->scan_request->ssids[i].ssid_len) @@ -856,7 +856,7 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) } is_active = true; } else - IWL_DEBUG_SCAN(priv, "Start passive scan.\n"); + IL_DEBUG_SCAN(priv, "Start passive scan.\n"); scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 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) case IEEE80211_BAND_2GHZ: scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; chan_mod = le32_to_cpu( - priv->contexts[IWL_RXON_CTX_BSS].active.flags & + priv->contexts[IL_RXON_CTX_BSS].active.flags & RXON_FLG_CHANNEL_MODE_MSK) >> RXON_FLG_CHANNEL_MODE_POS; if (chan_mod == CHANNEL_MODE_PURE_40) { - rate = IWL_RATE_6M_PLCP; + rate = IL_RATE_6M_PLCP; } else { - rate = IWL_RATE_1M_PLCP; + rate = IL_RATE_1M_PLCP; rate_flags = RATE_MCS_CCK_MSK; } break; case IEEE80211_BAND_5GHZ: - rate = IWL_RATE_6M_PLCP; + rate = IL_RATE_6M_PLCP; break; default: - IWL_WARN(priv, "Invalid scan band\n"); + IL_WARN(priv, "Invalid scan band\n"); return -EIO; } @@ -898,22 +898,22 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) * need to receive during our dwell time on a channel before * sending out probes -- setting this to a huge value will * mean we never reach it, but at the same time work around - * the aforementioned issue. Thus use IWL_GOOD_CRC_TH_NEVER - * here instead of IWL_GOOD_CRC_TH_DISABLED. + * the aforementioned issue. Thus use IL_GOOD_CRC_TH_NEVER + * here instead of IL_GOOD_CRC_TH_DISABLED. */ - scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT : - IWL_GOOD_CRC_TH_NEVER; + scan->good_CRC_th = is_active ? IL_GOOD_CRC_TH_DEFAULT : + IL_GOOD_CRC_TH_NEVER; band = priv->scan_band; if (priv->cfg->scan_rx_antennas[band]) rx_ant = priv->cfg->scan_rx_antennas[band]; - priv->scan_tx_ant[band] = iwl4965_toggle_tx_ant(priv, + priv->scan_tx_ant[band] = il4965_toggle_tx_ant(priv, priv->scan_tx_ant[band], scan_tx_antennas); - rate_flags |= iwl4965_ant_idx_to_flags(priv->scan_tx_ant[band]); - scan->tx_cmd.rate_n_flags = iwl4965_hw_set_rate_n_flags(rate, rate_flags); + rate_flags |= il4965_ant_idx_to_flags(priv->scan_tx_ant[band]); + scan->tx_cmd.rate_n_flags = il4965_hw_set_rate_n_flags(rate, rate_flags); /* In power save mode use one chain, otherwise use all chains */ if (test_bit(STATUS_POWER_PMI, &priv->status)) { @@ -923,10 +923,10 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) if (!active_chains) active_chains = rx_ant; - IWL_DEBUG_SCAN(priv, "chain_noise_data.active_chains: %u\n", + IL_DEBUG_SCAN(priv, "chain_noise_data.active_chains: %u\n", priv->chain_noise_data.active_chains); - rx_ant = iwl4965_first_antenna(active_chains); + rx_ant = il4965_first_antenna(active_chains); } /* 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) rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; scan->rx_chain = cpu_to_le16(rx_chain); - cmd_len = iwl_legacy_fill_probe_req(priv, + cmd_len = il_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, vif->addr, priv->scan_request->ie, priv->scan_request->ie_len, - IWL_MAX_SCAN_SIZE - sizeof(*scan)); + IL_MAX_SCAN_SIZE - sizeof(*scan)); scan->tx_cmd.len = cpu_to_le16(cmd_len); scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | RXON_FILTER_BCON_AWARE_MSK); - scan->channel_count = iwl4965_get_channels_for_scan(priv, vif, band, + scan->channel_count = il4965_get_channels_for_scan(priv, vif, band, is_active, n_probes, (void *)&scan->data[cmd_len]); if (scan->channel_count == 0) { - IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); + IL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); return -EIO; } cmd.len += le16_to_cpu(scan->tx_cmd.len) + - scan->channel_count * sizeof(struct iwl_scan_channel); + scan->channel_count * sizeof(struct il_scan_channel); cmd.data = scan; scan->len = cpu_to_le16(cmd.len); set_bit(STATUS_SCAN_HW, &priv->status); - ret = iwl_legacy_send_cmd_sync(priv, &cmd); + ret = il_send_cmd_sync(priv, &cmd); if (ret) clear_bit(STATUS_SCAN_HW, &priv->status); return ret; } -int iwl4965_manage_ibss_station(struct iwl_priv *priv, +int il4965_manage_ibss_station(struct il_priv *priv, struct ieee80211_vif *vif, bool add) { - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; + struct il_vif_priv *vif_priv = (void *)vif->drv_priv; if (add) - return iwl4965_add_bssid_station(priv, vif_priv->ctx, + return il4965_add_bssid_station(priv, vif_priv->ctx, vif->bss_conf.bssid, &vif_priv->ibss_bssid_sta_id); - return iwl_legacy_remove_station(priv, vif_priv->ibss_bssid_sta_id, + return il_remove_station(priv, vif_priv->ibss_bssid_sta_id, vif->bss_conf.bssid); } -void iwl4965_free_tfds_in_queue(struct iwl_priv *priv, +void il4965_free_tfds_in_queue(struct il_priv *priv, int sta_id, int tid, int freed) { lockdep_assert_held(&priv->sta_lock); @@ -990,25 +990,25 @@ void iwl4965_free_tfds_in_queue(struct iwl_priv *priv, if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed) priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; else { - IWL_DEBUG_TX(priv, "free more than tfds_in_queue (%u:%d)\n", + IL_DEBUG_TX(priv, "free more than tfds_in_queue (%u:%d)\n", priv->stations[sta_id].tid[tid].tfds_in_queue, freed); priv->stations[sta_id].tid[tid].tfds_in_queue = 0; } } -#define IWL_TX_QUEUE_MSK 0xfffff +#define IL_TX_QUEUE_MSK 0xfffff -static bool iwl4965_is_single_rx_stream(struct iwl_priv *priv) +static bool il4965_is_single_rx_stream(struct il_priv *priv) { return priv->current_ht_config.smps == IEEE80211_SMPS_STATIC || priv->current_ht_config.single_chain_sufficient; } -#define IWL_NUM_RX_CHAINS_MULTIPLE 3 -#define IWL_NUM_RX_CHAINS_SINGLE 2 -#define IWL_NUM_IDLE_CHAINS_DUAL 2 -#define IWL_NUM_IDLE_CHAINS_SINGLE 1 +#define IL_NUM_RX_CHAINS_MULTIPLE 3 +#define IL_NUM_RX_CHAINS_SINGLE 2 +#define IL_NUM_IDLE_CHAINS_DUAL 2 +#define IL_NUM_IDLE_CHAINS_SINGLE 1 /* * Determine how many receiver/antenna chains to use. @@ -1020,13 +1020,13 @@ static bool iwl4965_is_single_rx_stream(struct iwl_priv *priv) * MIMO (dual stream) requires at least 2, but works better with 3. * This does not determine *which* chains to use, just how many. */ -static int iwl4965_get_active_rx_chain_count(struct iwl_priv *priv) +static int il4965_get_active_rx_chain_count(struct il_priv *priv) { /* # of Rx chains to use when expecting MIMO. */ - if (iwl4965_is_single_rx_stream(priv)) - return IWL_NUM_RX_CHAINS_SINGLE; + if (il4965_is_single_rx_stream(priv)) + return IL_NUM_RX_CHAINS_SINGLE; else - return IWL_NUM_RX_CHAINS_MULTIPLE; + return IL_NUM_RX_CHAINS_MULTIPLE; } /* @@ -1034,13 +1034,13 @@ static int iwl4965_get_active_rx_chain_count(struct iwl_priv *priv) * multiplexing power save, use the active count for rx chain count. */ static int -iwl4965_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) +il4965_get_idle_rx_chain_count(struct il_priv *priv, int active_cnt) { /* # Rx chains when idling, depending on SMPS mode */ switch (priv->current_ht_config.smps) { case IEEE80211_SMPS_STATIC: case IEEE80211_SMPS_DYNAMIC: - return IWL_NUM_IDLE_CHAINS_SINGLE; + return IL_NUM_IDLE_CHAINS_SINGLE; case IEEE80211_SMPS_OFF: return active_cnt; default: @@ -1051,7 +1051,7 @@ iwl4965_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) } /* up to 4 chains */ -static u8 iwl4965_count_chain_bitmap(u32 chain_bitmap) +static u8 il4965_count_chain_bitmap(u32 chain_bitmap) { u8 res; res = (chain_bitmap & BIT(0)) >> 0; @@ -1062,14 +1062,14 @@ static u8 iwl4965_count_chain_bitmap(u32 chain_bitmap) } /** - * iwl4965_set_rxon_chain - Set up Rx chain usage in "staging" RXON image + * il4965_set_rxon_chain - Set up Rx chain usage in "staging" RXON image * * Selects how many and which Rx receivers/antennas/chains to use. * This should not be used for scan command ... it puts data in wrong place. */ -void iwl4965_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx) +void il4965_set_rxon_chain(struct il_priv *priv, struct il_rxon_context *ctx) { - bool is_single = iwl4965_is_single_rx_stream(priv); + bool is_single = il4965_is_single_rx_stream(priv); bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt; u32 active_chains; @@ -1077,7 +1077,7 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx) /* Tell uCode which antennas are actually connected. * Before first association, we assume all antennas are connected. - * Just after first association, iwl4965_chain_noise_calibration() + * Just after first association, il4965_chain_noise_calibration() * checks which antennas actually *are* connected. */ if (priv->chain_noise_data.active_chains) 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) rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS; /* How many receivers should we use? */ - active_rx_cnt = iwl4965_get_active_rx_chain_count(priv); - idle_rx_cnt = iwl4965_get_idle_rx_chain_count(priv, active_rx_cnt); + active_rx_cnt = il4965_get_active_rx_chain_count(priv); + idle_rx_cnt = il4965_get_idle_rx_chain_count(priv, active_rx_cnt); /* correct rx chain count according hw settings * and chain noise calibration */ - valid_rx_cnt = iwl4965_count_chain_bitmap(active_chains); + valid_rx_cnt = il4965_count_chain_bitmap(active_chains); if (valid_rx_cnt < active_rx_cnt) active_rx_cnt = valid_rx_cnt; @@ -1106,12 +1106,12 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ctx->staging.rx_chain = cpu_to_le16(rx_chain); - if (!is_single && (active_rx_cnt >= IWL_NUM_RX_CHAINS_SINGLE) && is_cam) + if (!is_single && (active_rx_cnt >= IL_NUM_RX_CHAINS_SINGLE) && is_cam) ctx->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; else ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; - IWL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n", + IL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n", ctx->staging.rx_chain, active_rx_cnt, idle_rx_cnt); @@ -1119,7 +1119,7 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx) active_rx_cnt < idle_rx_cnt); } -u8 iwl4965_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid) +u8 il4965_toggle_tx_ant(struct il_priv *priv, u8 ant, u8 valid) { int i; u8 ind = ant; @@ -1132,24 +1132,24 @@ u8 iwl4965_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid) return ant; } -static const char *iwl4965_get_fh_string(int cmd) +static const char *il4965_get_fh_string(int cmd) { switch (cmd) { - IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG); - IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG); - IWL_CMD(FH_RSCSR_CHNL0_WPTR); - IWL_CMD(FH_MEM_RCSR_CHNL0_CONFIG_REG); - IWL_CMD(FH_MEM_RSSR_SHARED_CTRL_REG); - IWL_CMD(FH_MEM_RSSR_RX_STATUS_REG); - IWL_CMD(FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV); - IWL_CMD(FH_TSSR_TX_STATUS_REG); - IWL_CMD(FH_TSSR_TX_ERROR_REG); + IL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG); + IL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG); + IL_CMD(FH_RSCSR_CHNL0_WPTR); + IL_CMD(FH_MEM_RCSR_CHNL0_CONFIG_REG); + IL_CMD(FH_MEM_RSSR_SHARED_CTRL_REG); + IL_CMD(FH_MEM_RSSR_RX_STATUS_REG); + IL_CMD(FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV); + IL_CMD(FH_TSSR_TX_STATUS_REG); + IL_CMD(FH_TSSR_TX_ERROR_REG); default: return "UNKNOWN"; } } -int iwl4965_dump_fh(struct iwl_priv *priv, char **buf, bool display) +int il4965_dump_fh(struct il_priv *priv, char **buf, bool display) { int i; #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG @@ -1178,17 +1178,17 @@ int iwl4965_dump_fh(struct iwl_priv *priv, char **buf, bool display) for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) { pos += scnprintf(*buf + pos, bufsz - pos, " %34s: 0X%08x\n", - iwl4965_get_fh_string(fh_tbl[i]), - iwl_legacy_read_direct32(priv, fh_tbl[i])); + il4965_get_fh_string(fh_tbl[i]), + il_read_direct32(priv, fh_tbl[i])); } return pos; } #endif - IWL_ERR(priv, "FH register values:\n"); + IL_ERR(priv, "FH register values:\n"); for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) { - IWL_ERR(priv, " %34s: 0X%08x\n", - iwl4965_get_fh_string(fh_tbl[i]), - iwl_legacy_read_direct32(priv, fh_tbl[i])); + IL_ERR(priv, " %34s: 0X%08x\n", + il4965_get_fh_string(fh_tbl[i]), + il_read_direct32(priv, fh_tbl[i])); } return 0; } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c index 57ebe21..a7298f5 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c @@ -43,26 +43,26 @@ #define IWL4965_RS_NAME "iwl-4965-rs" #define NUM_TRY_BEFORE_ANT_TOGGLE 1 -#define IWL_NUMBER_TRY 1 -#define IWL_HT_NUMBER_TRY 3 +#define IL_NUMBER_TRY 1 +#define IL_HT_NUMBER_TRY 3 -#define IWL_RATE_MAX_WINDOW 62 /* # tx in history window */ -#define IWL_RATE_MIN_FAILURE_TH 6 /* min failures to calc tpt */ -#define IWL_RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */ +#define IL_RATE_MAX_WINDOW 62 /* # tx in history window */ +#define IL_RATE_MIN_FAILURE_TH 6 /* min failures to calc tpt */ +#define IL_RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */ /* max allowed rate miss before sync LQ cmd */ -#define IWL_MISSED_RATE_MAX 15 +#define IL_MISSED_RATE_MAX 15 /* max time to accum history 2 seconds */ -#define IWL_RATE_SCALE_FLUSH_INTVL (3*HZ) +#define IL_RATE_SCALE_FLUSH_INTVL (3*HZ) static u8 rs_ht_to_legacy[] = { - IWL_RATE_6M_INDEX, IWL_RATE_6M_INDEX, - IWL_RATE_6M_INDEX, IWL_RATE_6M_INDEX, - IWL_RATE_6M_INDEX, - IWL_RATE_6M_INDEX, IWL_RATE_9M_INDEX, - IWL_RATE_12M_INDEX, IWL_RATE_18M_INDEX, - IWL_RATE_24M_INDEX, IWL_RATE_36M_INDEX, - IWL_RATE_48M_INDEX, IWL_RATE_54M_INDEX + IL_RATE_6M_INDEX, IL_RATE_6M_INDEX, + IL_RATE_6M_INDEX, IL_RATE_6M_INDEX, + IL_RATE_6M_INDEX, + IL_RATE_6M_INDEX, IL_RATE_9M_INDEX, + IL_RATE_12M_INDEX, IL_RATE_18M_INDEX, + IL_RATE_24M_INDEX, IL_RATE_36M_INDEX, + IL_RATE_48M_INDEX, IL_RATE_54M_INDEX }; static const u8 ant_toggle_lookup[] = { @@ -76,43 +76,43 @@ static const u8 ant_toggle_lookup[] = { /*ANT_ABC -> */ ANT_ABC, }; -#define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ - [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ - IWL_RATE_SISO_##s##M_PLCP, \ - IWL_RATE_MIMO2_##s##M_PLCP,\ - IWL_RATE_##r##M_IEEE, \ - IWL_RATE_##ip##M_INDEX, \ - IWL_RATE_##in##M_INDEX, \ - IWL_RATE_##rp##M_INDEX, \ - IWL_RATE_##rn##M_INDEX, \ - IWL_RATE_##pp##M_INDEX, \ - IWL_RATE_##np##M_INDEX } +#define IL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ + [IL_RATE_##r##M_INDEX] = { IL_RATE_##r##M_PLCP, \ + IL_RATE_SISO_##s##M_PLCP, \ + IL_RATE_MIMO2_##s##M_PLCP,\ + IL_RATE_##r##M_IEEE, \ + IL_RATE_##ip##M_INDEX, \ + IL_RATE_##in##M_INDEX, \ + IL_RATE_##rp##M_INDEX, \ + IL_RATE_##rn##M_INDEX, \ + IL_RATE_##pp##M_INDEX, \ + IL_RATE_##np##M_INDEX } /* * Parameter order: * rate, ht rate, prev rate, next rate, prev tgg rate, next tgg rate * * If there isn't a valid next or previous rate then INV is used which - * maps to IWL_RATE_INVALID + * maps to IL_RATE_INVALID * */ -const struct iwl_rate_info iwlegacy_rates[IWL_RATE_COUNT] = { - IWL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */ - IWL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */ - IWL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */ - IWL_DECLARE_RATE_INFO(11, INV, 9, 12, 9, 12, 5, 18), /* 11mbps */ - IWL_DECLARE_RATE_INFO(6, 6, 5, 9, 5, 11, 5, 11), /* 6mbps */ - IWL_DECLARE_RATE_INFO(9, 6, 6, 11, 6, 11, 5, 11), /* 9mbps */ - IWL_DECLARE_RATE_INFO(12, 12, 11, 18, 11, 18, 11, 18), /* 12mbps */ - IWL_DECLARE_RATE_INFO(18, 18, 12, 24, 12, 24, 11, 24), /* 18mbps */ - IWL_DECLARE_RATE_INFO(24, 24, 18, 36, 18, 36, 18, 36), /* 24mbps */ - IWL_DECLARE_RATE_INFO(36, 36, 24, 48, 24, 48, 24, 48), /* 36mbps */ - IWL_DECLARE_RATE_INFO(48, 48, 36, 54, 36, 54, 36, 54), /* 48mbps */ - IWL_DECLARE_RATE_INFO(54, 54, 48, INV, 48, INV, 48, INV),/* 54mbps */ - IWL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */ +const struct il_rate_info iwlegacy_rates[IL_RATE_COUNT] = { + IL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */ + IL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */ + IL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */ + IL_DECLARE_RATE_INFO(11, INV, 9, 12, 9, 12, 5, 18), /* 11mbps */ + IL_DECLARE_RATE_INFO(6, 6, 5, 9, 5, 11, 5, 11), /* 6mbps */ + IL_DECLARE_RATE_INFO(9, 6, 6, 11, 6, 11, 5, 11), /* 9mbps */ + IL_DECLARE_RATE_INFO(12, 12, 11, 18, 11, 18, 11, 18), /* 12mbps */ + IL_DECLARE_RATE_INFO(18, 18, 12, 24, 12, 24, 11, 24), /* 18mbps */ + IL_DECLARE_RATE_INFO(24, 24, 18, 36, 18, 36, 18, 36), /* 24mbps */ + IL_DECLARE_RATE_INFO(36, 36, 24, 48, 24, 48, 24, 48), /* 36mbps */ + IL_DECLARE_RATE_INFO(48, 48, 36, 54, 36, 54, 36, 54), /* 48mbps */ + IL_DECLARE_RATE_INFO(54, 54, 48, INV, 48, INV, 48, INV),/* 54mbps */ + IL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */ }; -static int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags) +static int il4965_hwrate_to_plcp_idx(u32 rate_n_flags) { int idx = 0; @@ -120,14 +120,14 @@ static int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags) if (rate_n_flags & RATE_MCS_HT_MSK) { idx = (rate_n_flags & 0xff); - if (idx >= IWL_RATE_MIMO2_6M_PLCP) - idx = idx - IWL_RATE_MIMO2_6M_PLCP; + if (idx >= IL_RATE_MIMO2_6M_PLCP) + idx = idx - IL_RATE_MIMO2_6M_PLCP; - idx += IWL_FIRST_OFDM_RATE; + idx += IL_FIRST_OFDM_RATE; /* skip 9M not supported in ht*/ - if (idx >= IWL_RATE_9M_INDEX) + if (idx >= IL_RATE_9M_INDEX) idx += 1; - if ((idx >= IWL_FIRST_OFDM_RATE) && (idx <= IWL_LAST_OFDM_RATE)) + if ((idx >= IL_FIRST_OFDM_RATE) && (idx <= IL_LAST_OFDM_RATE)) return idx; /* legacy rate format, search for match in table */ @@ -140,20 +140,20 @@ static int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags) return -1; } -static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, +static void il4965_rs_rate_scale_perform(struct il_priv *priv, struct sk_buff *skb, struct ieee80211_sta *sta, - struct iwl_lq_sta *lq_sta); -static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, u32 rate_n_flags); -static void iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, + struct il_lq_sta *lq_sta); +static void il4965_rs_fill_link_cmd(struct il_priv *priv, + struct il_lq_sta *lq_sta, u32 rate_n_flags); +static void il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search); #ifdef CONFIG_MAC80211_DEBUGFS -static void iwl4965_rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, +static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 *rate_n_flags, int index); #else -static void iwl4965_rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, +static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 *rate_n_flags, int index) {} #endif @@ -169,32 +169,32 @@ static void iwl4965_rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, * (2.4 GHz) band. */ -static s32 expected_tpt_legacy[IWL_RATE_COUNT] = { +static s32 expected_tpt_legacy[IL_RATE_COUNT] = { 7, 13, 35, 58, 40, 57, 72, 98, 121, 154, 177, 186, 0 }; -static s32 expected_tpt_siso20MHz[4][IWL_RATE_COUNT] = { +static s32 expected_tpt_siso20MHz[4][IL_RATE_COUNT] = { {0, 0, 0, 0, 42, 0, 76, 102, 124, 158, 183, 193, 202}, /* Norm */ {0, 0, 0, 0, 46, 0, 82, 110, 132, 167, 192, 202, 210}, /* SGI */ {0, 0, 0, 0, 48, 0, 93, 135, 176, 251, 319, 351, 381}, /* AGG */ {0, 0, 0, 0, 53, 0, 102, 149, 193, 275, 348, 381, 413}, /* AGG+SGI */ }; -static s32 expected_tpt_siso40MHz[4][IWL_RATE_COUNT] = { +static s32 expected_tpt_siso40MHz[4][IL_RATE_COUNT] = { {0, 0, 0, 0, 77, 0, 127, 160, 184, 220, 242, 250, 257}, /* Norm */ {0, 0, 0, 0, 83, 0, 135, 169, 193, 229, 250, 257, 264}, /* SGI */ {0, 0, 0, 0, 96, 0, 182, 259, 328, 451, 553, 598, 640}, /* AGG */ {0, 0, 0, 0, 106, 0, 199, 282, 357, 487, 593, 640, 683}, /* AGG+SGI */ }; -static s32 expected_tpt_mimo2_20MHz[4][IWL_RATE_COUNT] = { +static s32 expected_tpt_mimo2_20MHz[4][IL_RATE_COUNT] = { {0, 0, 0, 0, 74, 0, 123, 155, 179, 213, 235, 243, 250}, /* Norm */ {0, 0, 0, 0, 81, 0, 131, 164, 187, 221, 242, 250, 256}, /* SGI */ {0, 0, 0, 0, 92, 0, 175, 250, 317, 436, 534, 578, 619}, /* AGG */ {0, 0, 0, 0, 102, 0, 192, 273, 344, 470, 573, 619, 660}, /* AGG+SGI*/ }; -static s32 expected_tpt_mimo2_40MHz[4][IWL_RATE_COUNT] = { +static s32 expected_tpt_mimo2_40MHz[4][IL_RATE_COUNT] = { {0, 0, 0, 0, 123, 0, 182, 214, 235, 264, 279, 285, 289}, /* Norm */ {0, 0, 0, 0, 131, 0, 191, 222, 242, 270, 284, 289, 293}, /* SGI */ {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] = { }; /* mbps, mcs */ -static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { +static const struct il_rate_mcs_info il_rate_mcs[IL_RATE_COUNT] = { { "1", "BPSK DSSS"}, { "2", "QPSK DSSS"}, {"5.5", "BPSK CCK"}, @@ -220,23 +220,23 @@ static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { #define MCS_INDEX_PER_STREAM (8) -static inline u8 iwl4965_rs_extract_rate(u32 rate_n_flags) +static inline u8 il4965_rs_extract_rate(u32 rate_n_flags) { return (u8)(rate_n_flags & 0xFF); } static void -iwl4965_rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) +il4965_rs_rate_scale_clear_window(struct il_rate_scale_data *window) { window->data = 0; window->success_counter = 0; - window->success_ratio = IWL_INVALID_VALUE; + window->success_ratio = IL_INVALID_VALUE; window->counter = 0; - window->average_tpt = IWL_INVALID_VALUE; + window->average_tpt = IL_INVALID_VALUE; window->stamp = 0; } -static inline u8 iwl4965_rs_is_valid_ant(u8 valid_antenna, u8 ant_type) +static inline u8 il4965_rs_is_valid_ant(u8 valid_antenna, u8 ant_type) { return (ant_type & valid_antenna) == ant_type; } @@ -246,7 +246,7 @@ static inline u8 iwl4965_rs_is_valid_ant(u8 valid_antenna, u8 ant_type) * TID_MAX_TIME_DIFF, will be deleted. */ static void -iwl4965_rs_tl_rm_old_stats(struct iwl_traffic_load *tl, u32 curr_time) +il4965_rs_tl_rm_old_stats(struct il_traffic_load *tl, u32 curr_time) { /* The oldest age we want to keep */ 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) * increment traffic load value for tid and also remove * any old values if passed the certain time period */ -static u8 iwl4965_rs_tl_add_packet(struct iwl_lq_sta *lq_data, +static u8 il4965_rs_tl_add_packet(struct il_lq_sta *lq_data, struct ieee80211_hdr *hdr) { u32 curr_time = jiffies_to_msecs(jiffies); u32 time_diff; s32 index; - struct iwl_traffic_load *tl = NULL; + struct il_traffic_load *tl = NULL; u8 tid; 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, /* The history is too long: remove data that is older than */ /* TID_MAX_TIME_DIFF */ if (index >= TID_QUEUE_MAX_SIZE) - iwl4965_rs_tl_rm_old_stats(tl, curr_time); + il4965_rs_tl_rm_old_stats(tl, curr_time); index = (tl->head + index) % TID_QUEUE_MAX_SIZE; 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, /* get the traffic load value for tid */ -static u32 iwl4965_rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid) +static u32 il4965_rs_tl_get_load(struct il_lq_sta *lq_data, u8 tid) { u32 curr_time = jiffies_to_msecs(jiffies); u32 time_diff; s32 index; - struct iwl_traffic_load *tl = NULL; + struct il_traffic_load *tl = NULL; if (tid >= TID_MAX_LOAD_COUNT) return 0; @@ -343,22 +343,22 @@ static u32 iwl4965_rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid) /* The history is too long: remove data that is older than */ /* TID_MAX_TIME_DIFF */ if (index >= TID_QUEUE_MAX_SIZE) - iwl4965_rs_tl_rm_old_stats(tl, curr_time); + il4965_rs_tl_rm_old_stats(tl, curr_time); return tl->total; } -static int iwl4965_rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, - struct iwl_lq_sta *lq_data, u8 tid, +static int il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *priv, + struct il_lq_sta *lq_data, u8 tid, struct ieee80211_sta *sta) { int ret = -EAGAIN; u32 load; - load = iwl4965_rs_tl_get_load(lq_data, tid); + load = il4965_rs_tl_get_load(lq_data, tid); - if (load > IWL_AGG_LOAD_THRESHOLD) { - IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", + if (load > IL_AGG_LOAD_THRESHOLD) { + IL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", sta->addr, tid); ret = ieee80211_start_tx_ba_session(sta, tid, 5000); if (ret == -EAGAIN) { @@ -367,29 +367,29 @@ static int iwl4965_rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, * this might be cause by reloading firmware * stop the tx ba session here */ - IWL_ERR(priv, "Fail start Tx agg on tid: %d\n", + IL_ERR(priv, "Fail start Tx agg on tid: %d\n", tid); ieee80211_stop_tx_ba_session(sta, tid); } } else { - IWL_ERR(priv, "Aggregation not enabled for tid %d " + IL_ERR(priv, "Aggregation not enabled for tid %d " "because load = %u\n", tid, load); } return ret; } -static void iwl4965_rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, - struct iwl_lq_sta *lq_data, +static void il4965_rs_tl_turn_on_agg(struct il_priv *priv, u8 tid, + struct il_lq_sta *lq_data, struct ieee80211_sta *sta) { if (tid < TID_MAX_LOAD_COUNT) - iwl4965_rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); + il4965_rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); else - IWL_ERR(priv, "tid exceeds max load count: %d/%d\n", + IL_ERR(priv, "tid exceeds max load count: %d/%d\n", tid, TID_MAX_LOAD_COUNT); } -static inline int iwl4965_get_iwl4965_num_of_ant_from_rate(u32 rate_n_flags) +static inline int il4965_get_il4965_num_of_ant_from_rate(u32 rate_n_flags) { return !!(rate_n_flags & RATE_MCS_ANT_A_MSK) + !!(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) } /* - * Static function to get the expected throughput from an iwl_scale_tbl_info + * Static function to get the expected throughput from an il_scale_tbl_info * that wraps a NULL pointer check */ static s32 -iwl4965_get_expected_tpt(struct iwl_scale_tbl_info *tbl, int rs_index) +il4965_get_expected_tpt(struct il_scale_tbl_info *tbl, int rs_index) { if (tbl->expected_tpt) return tbl->expected_tpt[rs_index]; @@ -409,27 +409,27 @@ iwl4965_get_expected_tpt(struct iwl_scale_tbl_info *tbl, int rs_index) } /** - * iwl4965_rs_collect_tx_data - Update the success/failure sliding window + * il4965_rs_collect_tx_data - Update the success/failure sliding window * * We keep a sliding window of the last 62 packets transmitted * at this rate. window->data contains the bitmask of successful * packets. */ -static int iwl4965_rs_collect_tx_data(struct iwl_scale_tbl_info *tbl, +static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl, int scale_index, int attempts, int successes) { - struct iwl_rate_scale_data *window = NULL; - static const u64 mask = (((u64)1) << (IWL_RATE_MAX_WINDOW - 1)); + struct il_rate_scale_data *window = NULL; + static const u64 mask = (((u64)1) << (IL_RATE_MAX_WINDOW - 1)); s32 fail_count, tpt; - if (scale_index < 0 || scale_index >= IWL_RATE_COUNT) + if (scale_index < 0 || scale_index >= IL_RATE_COUNT) return -EINVAL; /* Select window for current tx bit rate */ window = &(tbl->win[scale_index]); /* Get expected throughput */ - tpt = iwl4965_get_expected_tpt(tbl, scale_index); + tpt = il4965_get_expected_tpt(tbl, scale_index); /* * 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, * we keep these bitmaps!). */ while (attempts > 0) { - if (window->counter >= IWL_RATE_MAX_WINDOW) { + if (window->counter >= IL_RATE_MAX_WINDOW) { /* remove earliest */ - window->counter = IWL_RATE_MAX_WINDOW - 1; + window->counter = IL_RATE_MAX_WINDOW - 1; if (window->data & mask) { window->data &= ~mask; @@ -472,16 +472,16 @@ static int iwl4965_rs_collect_tx_data(struct iwl_scale_tbl_info *tbl, window->success_ratio = 128 * (100 * window->success_counter) / window->counter; else - window->success_ratio = IWL_INVALID_VALUE; + window->success_ratio = IL_INVALID_VALUE; fail_count = window->counter - window->success_counter; /* Calculate average throughput, if we have enough history. */ - if ((fail_count >= IWL_RATE_MIN_FAILURE_TH) || - (window->success_counter >= IWL_RATE_MIN_SUCCESS_TH)) + if ((fail_count >= IL_RATE_MIN_FAILURE_TH) || + (window->success_counter >= IL_RATE_MIN_SUCCESS_TH)) window->average_tpt = (window->success_ratio * tpt + 64) / 128; else - window->average_tpt = IWL_INVALID_VALUE; + window->average_tpt = IL_INVALID_VALUE; /* Tag this window as having been updated */ window->stamp = jiffies; @@ -492,21 +492,21 @@ static int iwl4965_rs_collect_tx_data(struct iwl_scale_tbl_info *tbl, /* * Fill uCode API rate_n_flags field, based on "search" or "active" table. */ -static u32 iwl4965_rate_n_flags_from_tbl(struct iwl_priv *priv, - struct iwl_scale_tbl_info *tbl, +static u32 il4965_rate_n_flags_from_tbl(struct il_priv *priv, + struct il_scale_tbl_info *tbl, int index, u8 use_green) { u32 rate_n_flags = 0; if (is_legacy(tbl->lq_type)) { rate_n_flags = iwlegacy_rates[index].plcp; - if (index >= IWL_FIRST_CCK_RATE && index <= IWL_LAST_CCK_RATE) + if (index >= IL_FIRST_CCK_RATE && index <= IL_LAST_CCK_RATE) rate_n_flags |= RATE_MCS_CCK_MSK; } else if (is_Ht(tbl->lq_type)) { - if (index > IWL_LAST_OFDM_RATE) { - IWL_ERR(priv, "Invalid HT rate index %d\n", index); - index = IWL_LAST_OFDM_RATE; + if (index > IL_LAST_OFDM_RATE) { + IL_ERR(priv, "Invalid HT rate index %d\n", index); + index = IL_LAST_OFDM_RATE; } rate_n_flags = RATE_MCS_HT_MSK; @@ -515,7 +515,7 @@ static u32 iwl4965_rate_n_flags_from_tbl(struct iwl_priv *priv, else rate_n_flags |= iwlegacy_rates[index].plcp_mimo2; } else { - IWL_ERR(priv, "Invalid tbl->lq_type %d\n", tbl->lq_type); + IL_ERR(priv, "Invalid tbl->lq_type %d\n", tbl->lq_type); } 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, rate_n_flags |= RATE_MCS_GF_MSK; if (is_siso(tbl->lq_type) && tbl->is_SGI) { rate_n_flags &= ~RATE_MCS_SGI_MSK; - IWL_ERR(priv, "GF was set with SGI:SISO\n"); + IL_ERR(priv, "GF was set with SGI:SISO\n"); } } } @@ -546,19 +546,19 @@ static u32 iwl4965_rate_n_flags_from_tbl(struct iwl_priv *priv, * Interpret uCode API's rate_n_flags format, * fill "search" or "active" tx mode table. */ -static int iwl4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags, +static int il4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags, enum ieee80211_band band, - struct iwl_scale_tbl_info *tbl, + struct il_scale_tbl_info *tbl, int *rate_idx) { u32 ant_msk = (rate_n_flags & RATE_MCS_ANT_ABC_MSK); - u8 iwl4965_num_of_ant = iwl4965_get_iwl4965_num_of_ant_from_rate(rate_n_flags); + u8 il4965_num_of_ant = il4965_get_il4965_num_of_ant_from_rate(rate_n_flags); u8 mcs; - memset(tbl, 0, sizeof(struct iwl_scale_tbl_info)); - *rate_idx = iwl4965_hwrate_to_plcp_idx(rate_n_flags); + memset(tbl, 0, sizeof(struct il_scale_tbl_info)); + *rate_idx = il4965_hwrate_to_plcp_idx(rate_n_flags); - if (*rate_idx == IWL_RATE_INVALID) { + if (*rate_idx == IL_RATE_INVALID) { *rate_idx = -1; return -EINVAL; } @@ -567,11 +567,11 @@ static int iwl4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags, tbl->is_dup = 0; tbl->ant_type = (ant_msk >> RATE_MCS_ANT_POS); tbl->lq_type = LQ_NONE; - tbl->max_search = IWL_MAX_SEARCH; + tbl->max_search = IL_MAX_SEARCH; /* legacy rate format */ if (!(rate_n_flags & RATE_MCS_HT_MSK)) { - if (iwl4965_num_of_ant == 1) { + if (il4965_num_of_ant == 1) { if (band == IEEE80211_BAND_5GHZ) tbl->lq_type = LQ_A; else @@ -589,15 +589,15 @@ static int iwl4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags, if (rate_n_flags & RATE_MCS_DUP_MSK) tbl->is_dup = 1; - mcs = iwl4965_rs_extract_rate(rate_n_flags); + mcs = il4965_rs_extract_rate(rate_n_flags); /* SISO */ - if (mcs <= IWL_RATE_SISO_60M_PLCP) { - if (iwl4965_num_of_ant == 1) + if (mcs <= IL_RATE_SISO_60M_PLCP) { + if (il4965_num_of_ant == 1) tbl->lq_type = LQ_SISO; /*else NONE*/ /* MIMO2 */ } else { - if (iwl4965_num_of_ant == 2) + if (il4965_num_of_ant == 2) tbl->lq_type = LQ_MIMO2; } } @@ -606,21 +606,21 @@ static int iwl4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags, /* switch to another antenna/antennas and return 1 */ /* if no other valid antenna found, return 0 */ -static int iwl4965_rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags, - struct iwl_scale_tbl_info *tbl) +static int il4965_rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags, + struct il_scale_tbl_info *tbl) { u8 new_ant_type; if (!tbl->ant_type || tbl->ant_type > ANT_ABC) return 0; - if (!iwl4965_rs_is_valid_ant(valid_ant, tbl->ant_type)) + if (!il4965_rs_is_valid_ant(valid_ant, tbl->ant_type)) return 0; new_ant_type = ant_toggle_lookup[tbl->ant_type]; while ((new_ant_type != tbl->ant_type) && - !iwl4965_rs_is_valid_ant(valid_ant, new_ant_type)) + !il4965_rs_is_valid_ant(valid_ant, new_ant_type)) new_ant_type = ant_toggle_lookup[new_ant_type]; if (new_ant_type == tbl->ant_type) @@ -636,25 +636,25 @@ static int iwl4965_rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags, * Green-field mode is valid if the station supports it and * there are no non-GF stations present in the BSS. */ -static bool iwl4965_rs_use_green(struct ieee80211_sta *sta) +static bool il4965_rs_use_green(struct ieee80211_sta *sta) { - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_rxon_context *ctx = sta_priv->common.ctx; + struct il_station_priv *sta_priv = (void *)sta->drv_priv; + struct il_rxon_context *ctx = sta_priv->common.ctx; return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && !(ctx->ht.non_gf_sta_present); } /** - * iwl4965_rs_get_supported_rates - get the available rates + * il4965_rs_get_supported_rates - get the available rates * * if management frame or broadcast frame only return * basic available rates. * */ -static u16 iwl4965_rs_get_supported_rates(struct iwl_lq_sta *lq_sta, +static u16 il4965_rs_get_supported_rates(struct il_lq_sta *lq_sta, struct ieee80211_hdr *hdr, - enum iwl_table_type rate_type) + enum il_table_type rate_type) { if (is_legacy(rate_type)) { return lq_sta->active_legacy_rate; @@ -667,11 +667,11 @@ static u16 iwl4965_rs_get_supported_rates(struct iwl_lq_sta *lq_sta, } static u16 -iwl4965_rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask, +il4965_rs_get_adjacent_rate(struct il_priv *priv, u8 index, u16 rate_mask, int rate_type) { - u8 high = IWL_RATE_INVALID; - u8 low = IWL_RATE_INVALID; + u8 high = IL_RATE_INVALID; + u8 low = IL_RATE_INVALID; /* 802.11A or ht walks to the next literal adjacent rate in * the rate table */ @@ -690,7 +690,7 @@ iwl4965_rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask, /* Find the next rate that is in the rate mask */ i = index + 1; - for (mask = (1 << i); i < IWL_RATE_COUNT; i++, mask <<= 1) { + for (mask = (1 << i); i < IL_RATE_COUNT; i++, mask <<= 1) { if (rate_mask & mask) { high = i; break; @@ -701,30 +701,30 @@ iwl4965_rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask, } low = index; - while (low != IWL_RATE_INVALID) { + while (low != IL_RATE_INVALID) { low = iwlegacy_rates[low].prev_rs; - if (low == IWL_RATE_INVALID) + if (low == IL_RATE_INVALID) break; if (rate_mask & (1 << low)) break; - IWL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low); + IL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low); } high = index; - while (high != IWL_RATE_INVALID) { + while (high != IL_RATE_INVALID) { high = iwlegacy_rates[high].next_rs; - if (high == IWL_RATE_INVALID) + if (high == IL_RATE_INVALID) break; if (rate_mask & (1 << high)) break; - IWL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high); + IL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high); } return (high << 8) | low; } -static u32 iwl4965_rs_get_lower_rate(struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl, +static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta, + struct il_scale_tbl_info *tbl, u8 scale_index, u8 ht_possible) { s32 low; @@ -732,7 +732,7 @@ static u32 iwl4965_rs_get_lower_rate(struct iwl_lq_sta *lq_sta, u16 high_low; u8 switch_to_legacy = 0; u8 is_green = lq_sta->is_green; - struct iwl_priv *priv = lq_sta->drv; + struct il_priv *priv = lq_sta->drv; /* check if we need to switch from HT to legacy rates. * 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, else tbl->lq_type = LQ_G; - if (iwl4965_num_of_ant(tbl->ant_type) > 1) + if (il4965_num_of_ant(tbl->ant_type) > 1) tbl->ant_type = - iwl4965_first_antenna(priv->hw_params.valid_tx_ant); + il4965_first_antenna(priv->hw_params.valid_tx_ant); tbl->is_ht40 = 0; tbl->is_SGI = 0; - tbl->max_search = IWL_MAX_SEARCH; + tbl->max_search = IL_MAX_SEARCH; } - rate_mask = iwl4965_rs_get_supported_rates(lq_sta, NULL, tbl->lq_type); + rate_mask = il4965_rs_get_supported_rates(lq_sta, NULL, tbl->lq_type); /* Mask with station rate restriction */ if (is_legacy(tbl->lq_type)) { /* supp_rates has no CCK bits in A mode */ if (lq_sta->band == IEEE80211_BAND_5GHZ) rate_mask = (u16)(rate_mask & - (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); + (lq_sta->supp_rates << IL_FIRST_OFDM_RATE)); else rate_mask = (u16)(rate_mask & lq_sta->supp_rates); } @@ -772,23 +772,23 @@ static u32 iwl4965_rs_get_lower_rate(struct iwl_lq_sta *lq_sta, goto out; } - high_low = iwl4965_rs_get_adjacent_rate(lq_sta->drv, + high_low = il4965_rs_get_adjacent_rate(lq_sta->drv, scale_index, rate_mask, tbl->lq_type); low = high_low & 0xff; - if (low == IWL_RATE_INVALID) + if (low == IL_RATE_INVALID) low = scale_index; out: - return iwl4965_rate_n_flags_from_tbl(lq_sta->drv, tbl, low, is_green); + return il4965_rate_n_flags_from_tbl(lq_sta->drv, tbl, low, is_green); } /* * Simple function to compare two rate scale table types */ -static bool iwl4965_table_type_matches(struct iwl_scale_tbl_info *a, - struct iwl_scale_tbl_info *b) +static bool il4965_table_type_matches(struct il_scale_tbl_info *a, + struct il_scale_tbl_info *b) { return (a->lq_type == b->lq_type) && (a->ant_type == b->ant_type) && (a->is_SGI == b->is_SGI); @@ -798,34 +798,34 @@ static bool iwl4965_table_type_matches(struct iwl_scale_tbl_info *a, * mac80211 sends us Tx status */ static void -iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, +il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, struct ieee80211_sta *sta, void *priv_sta, struct sk_buff *skb) { int legacy_success; int retries; int rs_index, mac_index, i; - struct iwl_lq_sta *lq_sta = priv_sta; - struct iwl_link_quality_cmd *table; + struct il_lq_sta *lq_sta = priv_sta; + struct il_link_quality_cmd *table; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct iwl_priv *priv = (struct iwl_priv *)priv_r; + struct il_priv *priv = (struct il_priv *)priv_r; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); enum mac80211_rate_control_flags mac_flags; u32 tx_rate; - struct iwl_scale_tbl_info tbl_type; - struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_rxon_context *ctx = sta_priv->common.ctx; + struct il_scale_tbl_info tbl_type; + struct il_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; + struct il_station_priv *sta_priv = (void *)sta->drv_priv; + struct il_rxon_context *ctx = sta_priv->common.ctx; - IWL_DEBUG_RATE_LIMIT(priv, + IL_DEBUG_RATE_LIMIT(priv, "get frame ack response, update rate scale window\n"); /* Treat uninitialized rate scaling data same as non-existing. */ if (!lq_sta) { - IWL_DEBUG_RATE(priv, "Station rate scaling not created yet.\n"); + IL_DEBUG_RATE(priv, "Station rate scaling not created yet.\n"); return; } else if (!lq_sta->drv) { - IWL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); + IL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); return; } @@ -848,23 +848,23 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, */ table = &lq_sta->lq; tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); - iwl4965_rs_get_tbl_info_from_mcs(tx_rate, + il4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index); if (priv->band == IEEE80211_BAND_5GHZ) - rs_index -= IWL_FIRST_OFDM_RATE; + rs_index -= IL_FIRST_OFDM_RATE; mac_flags = info->status.rates[0].flags; mac_index = info->status.rates[0].idx; /* For HT packets, map MCS to PLCP */ if (mac_flags & IEEE80211_TX_RC_MCS) { mac_index &= RATE_MCS_CODE_MSK; /* Remove # of streams */ - if (mac_index >= (IWL_RATE_9M_INDEX - IWL_FIRST_OFDM_RATE)) + if (mac_index >= (IL_RATE_9M_INDEX - IL_FIRST_OFDM_RATE)) mac_index++; /* * mac80211 HT index is always zero-indexed; we need to move * HT OFDM rates after CCK rates in 2.4 GHz band */ if (priv->band == IEEE80211_BAND_2GHZ) - mac_index += IWL_FIRST_OFDM_RATE; + mac_index += IL_FIRST_OFDM_RATE; } /* Here we actually compare this rate to the latest LQ command */ if ((mac_index < 0) || @@ -880,18 +880,18 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, (!!(tx_rate & RATE_MCS_GF_MSK) != !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD)) || (rs_index != mac_index)) { - IWL_DEBUG_RATE(priv, + IL_DEBUG_RATE(priv, "initial rate %d does not match %d (0x%x)\n", mac_index, rs_index, tx_rate); /* * Since rates mis-match, the last LQ command may have failed. - * After IWL_MISSED_RATE_MAX mis-matches, resync the uCode with + * After IL_MISSED_RATE_MAX mis-matches, resync the uCode with * ... driver. */ lq_sta->missed_rate_counter++; - if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) { + if (lq_sta->missed_rate_counter > IL_MISSED_RATE_MAX) { lq_sta->missed_rate_counter = 0; - iwl_legacy_send_lq_cmd(priv, ctx, &lq_sta->lq, + il_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); } /* Regardless, ignore this status info for outdated rate */ @@ -901,30 +901,30 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, lq_sta->missed_rate_counter = 0; /* Figure out if rate scale algorithm is in active or search table */ - if (iwl4965_table_type_matches(&tbl_type, + if (il4965_table_type_matches(&tbl_type, &(lq_sta->lq_info[lq_sta->active_tbl]))) { curr_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); other_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - } else if (iwl4965_table_type_matches(&tbl_type, + } else if (il4965_table_type_matches(&tbl_type, &lq_sta->lq_info[1 - lq_sta->active_tbl])) { curr_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); other_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); } else { - IWL_DEBUG_RATE(priv, + IL_DEBUG_RATE(priv, "Neither active nor search matches tx rate\n"); tmp_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - IWL_DEBUG_RATE(priv, "active- lq:%x, ant:%x, SGI:%d\n", + IL_DEBUG_RATE(priv, "active- lq:%x, ant:%x, SGI:%d\n", tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); tmp_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - IWL_DEBUG_RATE(priv, "search- lq:%x, ant:%x, SGI:%d\n", + IL_DEBUG_RATE(priv, "search- lq:%x, ant:%x, SGI:%d\n", tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); - IWL_DEBUG_RATE(priv, "actual- lq:%x, ant:%x, SGI:%d\n", + IL_DEBUG_RATE(priv, "actual- lq:%x, ant:%x, SGI:%d\n", tbl_type.lq_type, tbl_type.ant_type, tbl_type.is_SGI); /* * no matching table found, let's by-pass the data collection * and continue to perform rate scale to find the rate table */ - iwl4965_rs_stay_in_table(lq_sta, true); + il4965_rs_stay_in_table(lq_sta, true); goto done; } @@ -937,9 +937,9 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, */ if (info->flags & IEEE80211_TX_STAT_AMPDU) { tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); - iwl4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, + il4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index); - iwl4965_rs_collect_tx_data(curr_tbl, rs_index, + il4965_rs_collect_tx_data(curr_tbl, rs_index, info->status.ampdu_len, info->status.ampdu_ack_len); @@ -962,20 +962,20 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, /* Collect data for each rate used during failed TX attempts */ for (i = 0; i <= retries; ++i) { tx_rate = le32_to_cpu(table->rs_table[i].rate_n_flags); - iwl4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, + il4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index); /* * Only collect stats if retried rate is in the same RS * table as active/search. */ - if (iwl4965_table_type_matches(&tbl_type, curr_tbl)) + if (il4965_table_type_matches(&tbl_type, curr_tbl)) tmp_tbl = curr_tbl; - else if (iwl4965_table_type_matches(&tbl_type, + else if (il4965_table_type_matches(&tbl_type, other_tbl)) tmp_tbl = other_tbl; else continue; - iwl4965_rs_collect_tx_data(tmp_tbl, rs_index, 1, + il4965_rs_collect_tx_data(tmp_tbl, rs_index, 1, i < retries ? 0 : legacy_success); } @@ -990,7 +990,7 @@ iwl4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, done: /* See if there's a better rate or modulation mode to try. */ if (sta && sta->supp_rates[sband->band]) - iwl4965_rs_rate_scale_perform(priv, skb, sta, lq_sta); + il4965_rs_rate_scale_perform(priv, skb, sta, lq_sta); } /* @@ -1001,19 +1001,19 @@ done: * These control how long we stay using same modulation mode before * searching for a new mode. */ -static void iwl4965_rs_set_stay_in_table(struct iwl_priv *priv, u8 is_legacy, - struct iwl_lq_sta *lq_sta) +static void il4965_rs_set_stay_in_table(struct il_priv *priv, u8 is_legacy, + struct il_lq_sta *lq_sta) { - IWL_DEBUG_RATE(priv, "we are staying in the same table\n"); + IL_DEBUG_RATE(priv, "we are staying in the same table\n"); lq_sta->stay_in_tbl = 1; /* only place this gets set */ if (is_legacy) { - lq_sta->table_count_limit = IWL_LEGACY_TABLE_COUNT; - lq_sta->max_failure_limit = IWL_LEGACY_FAILURE_LIMIT; - lq_sta->max_success_limit = IWL_LEGACY_SUCCESS_LIMIT; + lq_sta->table_count_limit = IL_LEGACY_TABLE_COUNT; + lq_sta->max_failure_limit = IL_LEGACY_FAILURE_LIMIT; + lq_sta->max_success_limit = IL_LEGACY_SUCCESS_LIMIT; } else { - lq_sta->table_count_limit = IWL_NONE_LEGACY_TABLE_COUNT; - lq_sta->max_failure_limit = IWL_NONE_LEGACY_FAILURE_LIMIT; - lq_sta->max_success_limit = IWL_NONE_LEGACY_SUCCESS_LIMIT; + lq_sta->table_count_limit = IL_NONE_LEGACY_TABLE_COUNT; + lq_sta->max_failure_limit = IL_NONE_LEGACY_FAILURE_LIMIT; + lq_sta->max_success_limit = IL_NONE_LEGACY_SUCCESS_LIMIT; } lq_sta->table_count = 0; lq_sta->total_failed = 0; @@ -1025,11 +1025,11 @@ static void iwl4965_rs_set_stay_in_table(struct iwl_priv *priv, u8 is_legacy, /* * Find correct throughput table for given mode of modulation */ -static void iwl4965_rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl) +static void il4965_rs_set_expected_tpt_table(struct il_lq_sta *lq_sta, + struct il_scale_tbl_info *tbl) { /* Used to choose among HT tables */ - s32 (*ht_tbl_pointer)[IWL_RATE_COUNT]; + s32 (*ht_tbl_pointer)[IL_RATE_COUNT]; /* Check for invalid LQ type */ 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, * to decrease to match "active" throughput. When moving from MIMO to SISO, * bit rate will typically need to increase, but not if performance was bad. */ -static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl, /* "search" */ +static s32 il4965_rs_get_best_rate(struct il_priv *priv, + struct il_lq_sta *lq_sta, + struct il_scale_tbl_info *tbl, /* "search" */ u16 rate_mask, s8 index) { /* "active" values */ - struct iwl_scale_tbl_info *active_tbl = + struct il_scale_tbl_info *active_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); s32 active_sr = active_tbl->win[index].success_ratio; s32 active_tpt = active_tbl->expected_tpt[index]; @@ -1095,10 +1095,10 @@ static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv, u16 high_low; s8 rate = index; - new_rate = high = low = start_hi = IWL_RATE_INVALID; + new_rate = high = low = start_hi = IL_RATE_INVALID; for (; ;) { - high_low = iwl4965_rs_get_adjacent_rate(priv, rate, rate_mask, + high_low = il4965_rs_get_adjacent_rate(priv, rate, rate_mask, tbl->lq_type); low = high_low & 0xff; @@ -1120,16 +1120,16 @@ static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv, * "active" throughput (under perfect conditions). */ if ((((100 * tpt_tbl[rate]) > lq_sta->last_tpt) && - ((active_sr > IWL_RATE_DECREASE_TH) && - (active_sr <= IWL_RATE_HIGH_TH) && + ((active_sr > IL_RATE_DECREASE_TH) && + (active_sr <= IL_RATE_HIGH_TH) && (tpt_tbl[rate] <= active_tpt))) || - ((active_sr >= IWL_RATE_SCALE_SWITCH) && + ((active_sr >= IL_RATE_SCALE_SWITCH) && (tpt_tbl[rate] > active_tpt))) { /* (2nd or later pass) * If we've already tried to raise the rate, and are * now trying to lower it, use the higher rate. */ - if (start_hi != IWL_RATE_INVALID) { + if (start_hi != IL_RATE_INVALID) { new_rate = start_hi; break; } @@ -1137,7 +1137,7 @@ static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv, new_rate = rate; /* Loop again with lower rate */ - if (low != IWL_RATE_INVALID) + if (low != IL_RATE_INVALID) rate = low; /* Lower rate not available, use the original */ @@ -1149,11 +1149,11 @@ static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv, /* (2nd or later pass) * If we've already tried to lower the rate, and are * now trying to raise it, use the lower rate. */ - if (new_rate != IWL_RATE_INVALID) + if (new_rate != IL_RATE_INVALID) break; /* Loop again with higher rate */ - else if (high != IWL_RATE_INVALID) { + else if (high != IL_RATE_INVALID) { start_hi = high; rate = high; @@ -1171,17 +1171,17 @@ static s32 iwl4965_rs_get_best_rate(struct iwl_priv *priv, /* * Set up search table for MIMO2 */ -static int iwl4965_rs_switch_to_mimo2(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, +static int il4965_rs_switch_to_mimo2(struct il_priv *priv, + struct il_lq_sta *lq_sta, struct ieee80211_conf *conf, struct ieee80211_sta *sta, - struct iwl_scale_tbl_info *tbl, int index) + struct il_scale_tbl_info *tbl, int index) { u16 rate_mask; s32 rate; s8 is_green = lq_sta->is_green; - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_rxon_context *ctx = sta_priv->common.ctx; + struct il_station_priv *sta_priv = (void *)sta->drv_priv; + struct il_rxon_context *ctx = sta_priv->common.ctx; if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) return -1; @@ -1194,35 +1194,35 @@ static int iwl4965_rs_switch_to_mimo2(struct iwl_priv *priv, if (priv->hw_params.tx_chains_num < 2) return -1; - IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n"); + IL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n"); tbl->lq_type = LQ_MIMO2; tbl->is_dup = lq_sta->is_dup; tbl->action = 0; - tbl->max_search = IWL_MAX_SEARCH; + tbl->max_search = IL_MAX_SEARCH; rate_mask = lq_sta->active_mimo2_rate; - if (iwl_legacy_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) + if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) tbl->is_ht40 = 1; else tbl->is_ht40 = 0; - iwl4965_rs_set_expected_tpt_table(lq_sta, tbl); + il4965_rs_set_expected_tpt_table(lq_sta, tbl); - rate = iwl4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); + rate = il4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); - IWL_DEBUG_RATE(priv, "LQ: MIMO2 best rate %d mask %X\n", + IL_DEBUG_RATE(priv, "LQ: MIMO2 best rate %d mask %X\n", rate, rate_mask); - if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { - IWL_DEBUG_RATE(priv, + if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) { + IL_DEBUG_RATE(priv, "Can't switch with index %d rate mask %x\n", rate, rate_mask); return -1; } - tbl->current_rate = iwl4965_rate_n_flags_from_tbl(priv, + tbl->current_rate = il4965_rate_n_flags_from_tbl(priv, tbl, rate, is_green); - IWL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", + IL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", tbl->current_rate, is_green); return 0; } @@ -1230,30 +1230,30 @@ static int iwl4965_rs_switch_to_mimo2(struct iwl_priv *priv, /* * Set up search table for SISO */ -static int iwl4965_rs_switch_to_siso(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, +static int il4965_rs_switch_to_siso(struct il_priv *priv, + struct il_lq_sta *lq_sta, struct ieee80211_conf *conf, struct ieee80211_sta *sta, - struct iwl_scale_tbl_info *tbl, int index) + struct il_scale_tbl_info *tbl, int index) { u16 rate_mask; u8 is_green = lq_sta->is_green; s32 rate; - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_rxon_context *ctx = sta_priv->common.ctx; + struct il_station_priv *sta_priv = (void *)sta->drv_priv; + struct il_rxon_context *ctx = sta_priv->common.ctx; if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) return -1; - IWL_DEBUG_RATE(priv, "LQ: try to switch to SISO\n"); + IL_DEBUG_RATE(priv, "LQ: try to switch to SISO\n"); tbl->is_dup = lq_sta->is_dup; tbl->lq_type = LQ_SISO; tbl->action = 0; - tbl->max_search = IWL_MAX_SEARCH; + tbl->max_search = IL_MAX_SEARCH; rate_mask = lq_sta->active_siso_rate; - if (iwl_legacy_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) + if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) tbl->is_ht40 = 1; else tbl->is_ht40 = 0; @@ -1261,19 +1261,19 @@ static int iwl4965_rs_switch_to_siso(struct iwl_priv *priv, if (is_green) tbl->is_SGI = 0; /*11n spec: no SGI in SISO+Greenfield*/ - iwl4965_rs_set_expected_tpt_table(lq_sta, tbl); - rate = iwl4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); + il4965_rs_set_expected_tpt_table(lq_sta, tbl); + rate = il4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); - IWL_DEBUG_RATE(priv, "LQ: get best rate %d mask %X\n", rate, rate_mask); - if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { - IWL_DEBUG_RATE(priv, + IL_DEBUG_RATE(priv, "LQ: get best rate %d mask %X\n", rate, rate_mask); + if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) { + IL_DEBUG_RATE(priv, "can not switch with index %d rate mask %x\n", rate, rate_mask); return -1; } - tbl->current_rate = iwl4965_rate_n_flags_from_tbl(priv, + tbl->current_rate = il4965_rate_n_flags_from_tbl(priv, tbl, rate, is_green); - IWL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", + IL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", tbl->current_rate, is_green); return 0; } @@ -1281,62 +1281,62 @@ static int iwl4965_rs_switch_to_siso(struct iwl_priv *priv, /* * Try to switch to new modulation mode from legacy */ -static int iwl4965_rs_move_legacy_other(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, +static int il4965_rs_move_legacy_other(struct il_priv *priv, + struct il_lq_sta *lq_sta, struct ieee80211_conf *conf, struct ieee80211_sta *sta, int index) { - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = + struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); + struct il_scale_tbl_info *search_tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); + struct il_rate_scale_data *window = &(tbl->win[index]); + u32 sz = (sizeof(struct il_scale_tbl_info) - + (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); u8 start_action; u8 valid_tx_ant = priv->hw_params.valid_tx_ant; u8 tx_chains_num = priv->hw_params.tx_chains_num; int ret = 0; u8 update_search_tbl_counter = 0; - tbl->action = IWL_LEGACY_SWITCH_SISO; + tbl->action = IL_LEGACY_SWITCH_SISO; start_action = tbl->action; for (; ;) { lq_sta->action_counter++; switch (tbl->action) { - case IWL_LEGACY_SWITCH_ANTENNA1: - case IWL_LEGACY_SWITCH_ANTENNA2: - IWL_DEBUG_RATE(priv, "LQ: Legacy toggle Antenna\n"); + case IL_LEGACY_SWITCH_ANTENNA1: + case IL_LEGACY_SWITCH_ANTENNA2: + IL_DEBUG_RATE(priv, "LQ: Legacy toggle Antenna\n"); - if ((tbl->action == IWL_LEGACY_SWITCH_ANTENNA1 && + if ((tbl->action == IL_LEGACY_SWITCH_ANTENNA1 && tx_chains_num <= 1) || - (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2 && + (tbl->action == IL_LEGACY_SWITCH_ANTENNA2 && tx_chains_num <= 2)) break; /* Don't change antenna if success has been great */ - if (window->success_ratio >= IWL_RS_GOOD_RATIO) + if (window->success_ratio >= IL_RS_GOOD_RATIO) break; /* Set up search table to try other antenna */ memcpy(search_tbl, tbl, sz); - if (iwl4965_rs_toggle_antenna(valid_tx_ant, + if (il4965_rs_toggle_antenna(valid_tx_ant, &search_tbl->current_rate, search_tbl)) { update_search_tbl_counter = 1; - iwl4965_rs_set_expected_tpt_table(lq_sta, + il4965_rs_set_expected_tpt_table(lq_sta, search_tbl); goto out; } break; - case IWL_LEGACY_SWITCH_SISO: - IWL_DEBUG_RATE(priv, "LQ: Legacy switch to SISO\n"); + case IL_LEGACY_SWITCH_SISO: + IL_DEBUG_RATE(priv, "LQ: Legacy switch to SISO\n"); /* Set up search table to try SISO */ memcpy(search_tbl, tbl, sz); search_tbl->is_SGI = 0; - ret = iwl4965_rs_switch_to_siso(priv, lq_sta, conf, sta, + ret = il4965_rs_switch_to_siso(priv, lq_sta, conf, sta, search_tbl, index); if (!ret) { lq_sta->action_counter = 0; @@ -1344,27 +1344,27 @@ static int iwl4965_rs_move_legacy_other(struct iwl_priv *priv, } break; - case IWL_LEGACY_SWITCH_MIMO2_AB: - case IWL_LEGACY_SWITCH_MIMO2_AC: - case IWL_LEGACY_SWITCH_MIMO2_BC: - IWL_DEBUG_RATE(priv, "LQ: Legacy switch to MIMO2\n"); + case IL_LEGACY_SWITCH_MIMO2_AB: + case IL_LEGACY_SWITCH_MIMO2_AC: + case IL_LEGACY_SWITCH_MIMO2_BC: + IL_DEBUG_RATE(priv, "LQ: Legacy switch to MIMO2\n"); /* Set up search table to try MIMO */ memcpy(search_tbl, tbl, sz); search_tbl->is_SGI = 0; - if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AB) + if (tbl->action == IL_LEGACY_SWITCH_MIMO2_AB) search_tbl->ant_type = ANT_AB; - else if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AC) + else if (tbl->action == IL_LEGACY_SWITCH_MIMO2_AC) search_tbl->ant_type = ANT_AC; else search_tbl->ant_type = ANT_BC; - if (!iwl4965_rs_is_valid_ant(valid_tx_ant, + if (!il4965_rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) break; - ret = iwl4965_rs_switch_to_mimo2(priv, lq_sta, + ret = il4965_rs_switch_to_mimo2(priv, lq_sta, conf, sta, search_tbl, index); if (!ret) { @@ -1374,8 +1374,8 @@ static int iwl4965_rs_move_legacy_other(struct iwl_priv *priv, break; } tbl->action++; - if (tbl->action > IWL_LEGACY_SWITCH_MIMO2_BC) - tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; + if (tbl->action > IL_LEGACY_SWITCH_MIMO2_BC) + tbl->action = IL_LEGACY_SWITCH_ANTENNA1; if (tbl->action == start_action) break; @@ -1387,8 +1387,8 @@ static int iwl4965_rs_move_legacy_other(struct iwl_priv *priv, out: lq_sta->search_better_tbl = 1; tbl->action++; - if (tbl->action > IWL_LEGACY_SWITCH_MIMO2_BC) - tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; + if (tbl->action > IL_LEGACY_SWITCH_MIMO2_BC) + tbl->action = IL_LEGACY_SWITCH_ANTENNA1; if (update_search_tbl_counter) search_tbl->action = tbl->action; return 0; @@ -1398,19 +1398,19 @@ out: /* * Try to switch to new modulation mode from SISO */ -static int iwl4965_rs_move_siso_to_other(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, +static int il4965_rs_move_siso_to_other(struct il_priv *priv, + struct il_lq_sta *lq_sta, struct ieee80211_conf *conf, struct ieee80211_sta *sta, int index) { u8 is_green = lq_sta->is_green; - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = + struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); + struct il_scale_tbl_info *search_tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); + struct il_rate_scale_data *window = &(tbl->win[index]); struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); + u32 sz = (sizeof(struct il_scale_tbl_info) - + (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); u8 start_action; u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 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, for (;;) { lq_sta->action_counter++; switch (tbl->action) { - case IWL_SISO_SWITCH_ANTENNA1: - case IWL_SISO_SWITCH_ANTENNA2: - IWL_DEBUG_RATE(priv, "LQ: SISO toggle Antenna\n"); - if ((tbl->action == IWL_SISO_SWITCH_ANTENNA1 && + case IL_SISO_SWITCH_ANTENNA1: + case IL_SISO_SWITCH_ANTENNA2: + IL_DEBUG_RATE(priv, "LQ: SISO toggle Antenna\n"); + if ((tbl->action == IL_SISO_SWITCH_ANTENNA1 && tx_chains_num <= 1) || - (tbl->action == IWL_SISO_SWITCH_ANTENNA2 && + (tbl->action == IL_SISO_SWITCH_ANTENNA2 && tx_chains_num <= 2)) break; - if (window->success_ratio >= IWL_RS_GOOD_RATIO) + if (window->success_ratio >= IL_RS_GOOD_RATIO) break; memcpy(search_tbl, tbl, sz); - if (iwl4965_rs_toggle_antenna(valid_tx_ant, + if (il4965_rs_toggle_antenna(valid_tx_ant, &search_tbl->current_rate, search_tbl)) { update_search_tbl_counter = 1; goto out; } break; - case IWL_SISO_SWITCH_MIMO2_AB: - case IWL_SISO_SWITCH_MIMO2_AC: - case IWL_SISO_SWITCH_MIMO2_BC: - IWL_DEBUG_RATE(priv, "LQ: SISO switch to MIMO2\n"); + case IL_SISO_SWITCH_MIMO2_AB: + case IL_SISO_SWITCH_MIMO2_AC: + case IL_SISO_SWITCH_MIMO2_BC: + IL_DEBUG_RATE(priv, "LQ: SISO switch to MIMO2\n"); memcpy(search_tbl, tbl, sz); search_tbl->is_SGI = 0; - if (tbl->action == IWL_SISO_SWITCH_MIMO2_AB) + if (tbl->action == IL_SISO_SWITCH_MIMO2_AB) search_tbl->ant_type = ANT_AB; - else if (tbl->action == IWL_SISO_SWITCH_MIMO2_AC) + else if (tbl->action == IL_SISO_SWITCH_MIMO2_AC) search_tbl->ant_type = ANT_AC; else search_tbl->ant_type = ANT_BC; - if (!iwl4965_rs_is_valid_ant(valid_tx_ant, + if (!il4965_rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) break; - ret = iwl4965_rs_switch_to_mimo2(priv, lq_sta, + ret = il4965_rs_switch_to_mimo2(priv, lq_sta, conf, sta, search_tbl, index); if (!ret) goto out; break; - case IWL_SISO_SWITCH_GI: + case IL_SISO_SWITCH_GI: if (!tbl->is_ht40 && !(ht_cap->cap & IEEE80211_HT_CAP_SGI_20)) break; @@ -1473,32 +1473,32 @@ static int iwl4965_rs_move_siso_to_other(struct iwl_priv *priv, IEEE80211_HT_CAP_SGI_40)) break; - IWL_DEBUG_RATE(priv, "LQ: SISO toggle SGI/NGI\n"); + IL_DEBUG_RATE(priv, "LQ: SISO toggle SGI/NGI\n"); memcpy(search_tbl, tbl, sz); if (is_green) { if (!tbl->is_SGI) break; else - IWL_ERR(priv, + IL_ERR(priv, "SGI was set in GF+SISO\n"); } search_tbl->is_SGI = !tbl->is_SGI; - iwl4965_rs_set_expected_tpt_table(lq_sta, search_tbl); + il4965_rs_set_expected_tpt_table(lq_sta, search_tbl); if (tbl->is_SGI) { s32 tpt = lq_sta->last_tpt / 100; if (tpt >= search_tbl->expected_tpt[index]) break; } search_tbl->current_rate = - iwl4965_rate_n_flags_from_tbl(priv, search_tbl, + il4965_rate_n_flags_from_tbl(priv, search_tbl, index, is_green); update_search_tbl_counter = 1; goto out; } tbl->action++; - if (tbl->action > IWL_SISO_SWITCH_GI) - tbl->action = IWL_SISO_SWITCH_ANTENNA1; + if (tbl->action > IL_SISO_SWITCH_GI) + tbl->action = IL_SISO_SWITCH_ANTENNA1; if (tbl->action == start_action) break; @@ -1509,8 +1509,8 @@ static int iwl4965_rs_move_siso_to_other(struct iwl_priv *priv, out: lq_sta->search_better_tbl = 1; tbl->action++; - if (tbl->action > IWL_SISO_SWITCH_GI) - tbl->action = IWL_SISO_SWITCH_ANTENNA1; + if (tbl->action > IL_SISO_SWITCH_GI) + tbl->action = IL_SISO_SWITCH_ANTENNA1; if (update_search_tbl_counter) search_tbl->action = tbl->action; @@ -1520,19 +1520,19 @@ static int iwl4965_rs_move_siso_to_other(struct iwl_priv *priv, /* * Try to switch to new modulation mode from MIMO2 */ -static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, +static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, + struct il_lq_sta *lq_sta, struct ieee80211_conf *conf, struct ieee80211_sta *sta, int index) { s8 is_green = lq_sta->is_green; - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = + struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); + struct il_scale_tbl_info *search_tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); + struct il_rate_scale_data *window = &(tbl->win[index]); struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); + u32 sz = (sizeof(struct il_scale_tbl_info) - + (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); u8 start_action; u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 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, for (;;) { lq_sta->action_counter++; switch (tbl->action) { - case IWL_MIMO2_SWITCH_ANTENNA1: - case IWL_MIMO2_SWITCH_ANTENNA2: - IWL_DEBUG_RATE(priv, "LQ: MIMO2 toggle Antennas\n"); + case IL_MIMO2_SWITCH_ANTENNA1: + case IL_MIMO2_SWITCH_ANTENNA2: + IL_DEBUG_RATE(priv, "LQ: MIMO2 toggle Antennas\n"); if (tx_chains_num <= 2) break; - if (window->success_ratio >= IWL_RS_GOOD_RATIO) + if (window->success_ratio >= IL_RS_GOOD_RATIO) break; memcpy(search_tbl, tbl, sz); - if (iwl4965_rs_toggle_antenna(valid_tx_ant, + if (il4965_rs_toggle_antenna(valid_tx_ant, &search_tbl->current_rate, search_tbl)) { update_search_tbl_counter = 1; goto out; } break; - case IWL_MIMO2_SWITCH_SISO_A: - case IWL_MIMO2_SWITCH_SISO_B: - case IWL_MIMO2_SWITCH_SISO_C: - IWL_DEBUG_RATE(priv, "LQ: MIMO2 switch to SISO\n"); + case IL_MIMO2_SWITCH_SISO_A: + case IL_MIMO2_SWITCH_SISO_B: + case IL_MIMO2_SWITCH_SISO_C: + IL_DEBUG_RATE(priv, "LQ: MIMO2 switch to SISO\n"); /* Set up new search table for SISO */ memcpy(search_tbl, tbl, sz); - if (tbl->action == IWL_MIMO2_SWITCH_SISO_A) + if (tbl->action == IL_MIMO2_SWITCH_SISO_A) search_tbl->ant_type = ANT_A; - else if (tbl->action == IWL_MIMO2_SWITCH_SISO_B) + else if (tbl->action == IL_MIMO2_SWITCH_SISO_B) search_tbl->ant_type = ANT_B; else search_tbl->ant_type = ANT_C; - if (!iwl4965_rs_is_valid_ant(valid_tx_ant, + if (!il4965_rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) break; - ret = iwl4965_rs_switch_to_siso(priv, lq_sta, + ret = il4965_rs_switch_to_siso(priv, lq_sta, conf, sta, search_tbl, index); if (!ret) @@ -1587,7 +1587,7 @@ static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv, break; - case IWL_MIMO2_SWITCH_GI: + case IL_MIMO2_SWITCH_GI: if (!tbl->is_ht40 && !(ht_cap->cap & IEEE80211_HT_CAP_SGI_20)) break; @@ -1595,12 +1595,12 @@ static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv, IEEE80211_HT_CAP_SGI_40)) break; - IWL_DEBUG_RATE(priv, "LQ: MIMO2 toggle SGI/NGI\n"); + IL_DEBUG_RATE(priv, "LQ: MIMO2 toggle SGI/NGI\n"); /* Set up new search table for MIMO2 */ memcpy(search_tbl, tbl, sz); search_tbl->is_SGI = !tbl->is_SGI; - iwl4965_rs_set_expected_tpt_table(lq_sta, search_tbl); + il4965_rs_set_expected_tpt_table(lq_sta, search_tbl); /* * If active table already uses the fastest possible * modulation (dual stream with short guard interval), @@ -1613,15 +1613,15 @@ static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv, break; } search_tbl->current_rate = - iwl4965_rate_n_flags_from_tbl(priv, search_tbl, + il4965_rate_n_flags_from_tbl(priv, search_tbl, index, is_green); update_search_tbl_counter = 1; goto out; } tbl->action++; - if (tbl->action > IWL_MIMO2_SWITCH_GI) - tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; + if (tbl->action > IL_MIMO2_SWITCH_GI) + tbl->action = IL_MIMO2_SWITCH_ANTENNA1; if (tbl->action == start_action) break; @@ -1631,8 +1631,8 @@ static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv, out: lq_sta->search_better_tbl = 1; tbl->action++; - if (tbl->action > IWL_MIMO2_SWITCH_GI) - tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; + if (tbl->action > IL_MIMO2_SWITCH_GI) + tbl->action = IL_MIMO2_SWITCH_ANTENNA1; if (update_search_tbl_counter) search_tbl->action = tbl->action; @@ -1648,13 +1648,13 @@ static int iwl4965_rs_move_mimo2_to_other(struct iwl_priv *priv, * 3) elapsed time in this mode (not used, for now) */ static void -iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) +il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search) { - struct iwl_scale_tbl_info *tbl; + struct il_scale_tbl_info *tbl; int i; int active_tbl; int flush_interval_passed = 0; - struct iwl_priv *priv; + struct il_priv *priv; priv = lq_sta->drv; active_tbl = lq_sta->active_tbl; @@ -1669,7 +1669,7 @@ iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) flush_interval_passed = time_after(jiffies, (unsigned long)(lq_sta->flush_timer + - IWL_RATE_SCALE_FLUSH_INTVL)); + IL_RATE_SCALE_FLUSH_INTVL)); /* * 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) (lq_sta->total_success > lq_sta->max_success_limit) || ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer) && (flush_interval_passed))) { - IWL_DEBUG_RATE(priv, "LQ: stay is expired %d %d %d\n:", + IL_DEBUG_RATE(priv, "LQ: stay is expired %d %d %d\n:", lq_sta->total_failed, lq_sta->total_success, flush_interval_passed); @@ -1707,10 +1707,10 @@ iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) lq_sta->table_count_limit) { lq_sta->table_count = 0; - IWL_DEBUG_RATE(priv, + IL_DEBUG_RATE(priv, "LQ: stay in table clear win\n"); - for (i = 0; i < IWL_RATE_COUNT; i++) - iwl4965_rs_rate_scale_clear_window( + for (i = 0; i < IL_RATE_COUNT; i++) + il4965_rs_rate_scale_clear_window( &(tbl->win[i])); } } @@ -1719,8 +1719,8 @@ iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) * bitmaps and stats in active table (this will become the new * "search" table). */ if (!lq_sta->stay_in_tbl) { - for (i = 0; i < IWL_RATE_COUNT; i++) - iwl4965_rs_rate_scale_clear_window( + for (i = 0; i < IL_RATE_COUNT; i++) + il4965_rs_rate_scale_clear_window( &(tbl->win[i])); } } @@ -1730,18 +1730,18 @@ iwl4965_rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) * setup rate table in uCode * return rate_n_flags as used in the table */ -static u32 iwl4965_rs_update_rate_tbl(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl, +static u32 il4965_rs_update_rate_tbl(struct il_priv *priv, + struct il_rxon_context *ctx, + struct il_lq_sta *lq_sta, + struct il_scale_tbl_info *tbl, int index, u8 is_green) { u32 rate; /* Update uCode's rate table. */ - rate = iwl4965_rate_n_flags_from_tbl(priv, tbl, index, is_green); - iwl4965_rs_fill_link_cmd(priv, lq_sta, rate); - iwl_legacy_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); + rate = il4965_rate_n_flags_from_tbl(priv, tbl, index, is_green); + il4965_rs_fill_link_cmd(priv, lq_sta, rate); + il_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); return rate; } @@ -1749,28 +1749,28 @@ static u32 iwl4965_rs_update_rate_tbl(struct iwl_priv *priv, /* * Do rate scaling and search for new modulation mode. */ -static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, +static void il4965_rs_rate_scale_perform(struct il_priv *priv, struct sk_buff *skb, struct ieee80211_sta *sta, - struct iwl_lq_sta *lq_sta) + struct il_lq_sta *lq_sta) { struct ieee80211_hw *hw = priv->hw; struct ieee80211_conf *conf = &hw->conf; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - int low = IWL_RATE_INVALID; - int high = IWL_RATE_INVALID; + int low = IL_RATE_INVALID; + int high = IL_RATE_INVALID; int index; int i; - struct iwl_rate_scale_data *window = NULL; - int current_tpt = IWL_INVALID_VALUE; - int low_tpt = IWL_INVALID_VALUE; - int high_tpt = IWL_INVALID_VALUE; + struct il_rate_scale_data *window = NULL; + int current_tpt = IL_INVALID_VALUE; + int low_tpt = IL_INVALID_VALUE; + int high_tpt = IL_INVALID_VALUE; u32 fail_count; s8 scale_action = 0; u16 rate_mask; u8 update_lq = 0; - struct iwl_scale_tbl_info *tbl, *tbl1; + struct il_scale_tbl_info *tbl, *tbl1; u16 rate_scale_index_msk = 0; u32 rate; u8 is_green = 0; @@ -1779,11 +1779,11 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, u16 high_low; s32 sr; u8 tid = MAX_TID_COUNT; - struct iwl_tid_data *tid_data; - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_rxon_context *ctx = sta_priv->common.ctx; + struct il_tid_data *tid_data; + struct il_station_priv *sta_priv = (void *)sta->drv_priv; + struct il_rxon_context *ctx = sta_priv->common.ctx; - IWL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n"); + IL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n"); /* Send management frames and NO_ACK data using lowest rate. */ /* TODO: this could probably be improved.. */ @@ -1796,10 +1796,10 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, lq_sta->supp_rates = sta->supp_rates[lq_sta->band]; - tid = iwl4965_rs_tl_add_packet(lq_sta, hdr); + tid = il4965_rs_tl_add_packet(lq_sta, hdr); if ((tid != MAX_TID_COUNT) && (lq_sta->tx_agg_tid_en & (1 << tid))) { tid_data = &priv->stations[lq_sta->lq.sta_id].tid[tid]; - if (tid_data->agg.state == IWL_AGG_OFF) + if (tid_data->agg.state == IL_AGG_OFF) lq_sta->is_agg = 0; else lq_sta->is_agg = 1; @@ -1820,26 +1820,26 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, if (is_legacy(tbl->lq_type)) lq_sta->is_green = 0; else - lq_sta->is_green = iwl4965_rs_use_green(sta); + lq_sta->is_green = il4965_rs_use_green(sta); is_green = lq_sta->is_green; /* current tx rate */ index = lq_sta->last_txrate_idx; - IWL_DEBUG_RATE(priv, "Rate scale index %d for type %d\n", index, + IL_DEBUG_RATE(priv, "Rate scale index %d for type %d\n", index, tbl->lq_type); /* rates available for this association, and for modulation mode */ - rate_mask = iwl4965_rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); + rate_mask = il4965_rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); - IWL_DEBUG_RATE(priv, "mask 0x%04X\n", rate_mask); + IL_DEBUG_RATE(priv, "mask 0x%04X\n", rate_mask); /* mask with station rate restriction */ if (is_legacy(tbl->lq_type)) { if (lq_sta->band == IEEE80211_BAND_5GHZ) /* supp_rates has no CCK bits in A mode */ rate_scale_index_msk = (u16) (rate_mask & - (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); + (lq_sta->supp_rates << IL_FIRST_OFDM_RATE)); else rate_scale_index_msk = (u16) (rate_mask & lq_sta->supp_rates); @@ -1851,15 +1851,15 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, rate_scale_index_msk = rate_mask; if (!((1 << index) & rate_scale_index_msk)) { - IWL_ERR(priv, "Current Rate is not valid\n"); + IL_ERR(priv, "Current Rate is not valid\n"); if (lq_sta->search_better_tbl) { /* revert to active table if search table is not valid*/ tbl->lq_type = LQ_NONE; lq_sta->search_better_tbl = 0; tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); /* get "active" rate info */ - index = iwl4965_hwrate_to_plcp_idx(tbl->current_rate); - rate = iwl4965_rs_update_rate_tbl(priv, ctx, lq_sta, + index = il4965_hwrate_to_plcp_idx(tbl->current_rate); + rate = il4965_rs_update_rate_tbl(priv, ctx, lq_sta, tbl, index, is_green); } return; @@ -1867,7 +1867,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, /* Get expected throughput table and history window for current rate */ if (!tbl->expected_tpt) { - IWL_ERR(priv, "tbl->expected_tpt is NULL\n"); + IL_ERR(priv, "tbl->expected_tpt is NULL\n"); return; } @@ -1890,18 +1890,18 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, * in current association (use new rate found above). */ fail_count = window->counter - window->success_counter; - if ((fail_count < IWL_RATE_MIN_FAILURE_TH) && - (window->success_counter < IWL_RATE_MIN_SUCCESS_TH)) { - IWL_DEBUG_RATE(priv, "LQ: still below TH. succ=%d total=%d " + if ((fail_count < IL_RATE_MIN_FAILURE_TH) && + (window->success_counter < IL_RATE_MIN_SUCCESS_TH)) { + IL_DEBUG_RATE(priv, "LQ: still below TH. succ=%d total=%d " "for index %d\n", window->success_counter, window->counter, index); /* Can't calculate this yet; not enough history */ - window->average_tpt = IWL_INVALID_VALUE; + window->average_tpt = IL_INVALID_VALUE; /* Should we stay with this modulation mode, * or search for a new one? */ - iwl4965_rs_stay_in_table(lq_sta, false); + il4965_rs_stay_in_table(lq_sta, false); goto out; } @@ -1909,7 +1909,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, * actual average throughput */ if (window->average_tpt != ((window->success_ratio * tbl->expected_tpt[index] + 64) / 128)) { - IWL_ERR(priv, + IL_ERR(priv, "expected_tpt should have been calculated by now\n"); window->average_tpt = ((window->success_ratio * tbl->expected_tpt[index] + 64) / 128); @@ -1922,7 +1922,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, * continuing to use the setup that we've been trying. */ if (window->average_tpt > lq_sta->last_tpt) { - IWL_DEBUG_RATE(priv, "LQ: SWITCHING TO NEW TABLE " + IL_DEBUG_RATE(priv, "LQ: SWITCHING TO NEW TABLE " "suc=%d cur-tpt=%d old-tpt=%d\n", window->success_ratio, window->average_tpt, @@ -1938,7 +1938,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, /* Else poor success; go back to mode in "active" table */ } else { - IWL_DEBUG_RATE(priv, "LQ: GOING BACK TO THE OLD TABLE " + IL_DEBUG_RATE(priv, "LQ: GOING BACK TO THE OLD TABLE " "suc=%d cur-tpt=%d old-tpt=%d\n", window->success_ratio, window->average_tpt, @@ -1952,7 +1952,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, tbl = &(lq_sta->lq_info[active_tbl]); /* Revert to "active" rate and throughput info */ - index = iwl4965_hwrate_to_plcp_idx(tbl->current_rate); + index = il4965_hwrate_to_plcp_idx(tbl->current_rate); current_tpt = lq_sta->last_tpt; /* 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, /* (Else) not in search of better modulation mode, try for better * starting rate, while staying in this mode. */ - high_low = iwl4965_rs_get_adjacent_rate(priv, index, + high_low = il4965_rs_get_adjacent_rate(priv, index, rate_scale_index_msk, tbl->lq_type); low = high_low & 0xff; @@ -1977,39 +1977,39 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, /* If user set max rate, dont allow higher than user constrain */ if ((lq_sta->max_rate_idx != -1) && (lq_sta->max_rate_idx < high)) - high = IWL_RATE_INVALID; + high = IL_RATE_INVALID; sr = window->success_ratio; /* Collect measured throughputs for current and adjacent rates */ current_tpt = window->average_tpt; - if (low != IWL_RATE_INVALID) + if (low != IL_RATE_INVALID) low_tpt = tbl->win[low].average_tpt; - if (high != IWL_RATE_INVALID) + if (high != IL_RATE_INVALID) high_tpt = tbl->win[high].average_tpt; scale_action = 0; /* Too many failures, decrease rate */ - if ((sr <= IWL_RATE_DECREASE_TH) || (current_tpt == 0)) { - IWL_DEBUG_RATE(priv, + if ((sr <= IL_RATE_DECREASE_TH) || (current_tpt == 0)) { + IL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n"); scale_action = -1; /* No throughput measured yet for adjacent rates; try increase. */ - } else if ((low_tpt == IWL_INVALID_VALUE) && - (high_tpt == IWL_INVALID_VALUE)) { + } else if ((low_tpt == IL_INVALID_VALUE) && + (high_tpt == IL_INVALID_VALUE)) { - if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) + if (high != IL_RATE_INVALID && sr >= IL_RATE_INCREASE_TH) scale_action = 1; - else if (low != IWL_RATE_INVALID) + else if (low != IL_RATE_INVALID) scale_action = 0; } /* Both adjacent throughputs are measured, but neither one has better * throughput; we're using the best rate, don't change it! */ - else if ((low_tpt != IWL_INVALID_VALUE) && - (high_tpt != IWL_INVALID_VALUE) && + else if ((low_tpt != IL_INVALID_VALUE) && + (high_tpt != IL_INVALID_VALUE) && (low_tpt < current_tpt) && (high_tpt < current_tpt)) scale_action = 0; @@ -2018,23 +2018,23 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, * and may have better performance. */ else { /* Higher adjacent rate's throughput is measured */ - if (high_tpt != IWL_INVALID_VALUE) { + if (high_tpt != IL_INVALID_VALUE) { /* Higher rate has better throughput */ if (high_tpt > current_tpt && - sr >= IWL_RATE_INCREASE_TH) { + sr >= IL_RATE_INCREASE_TH) { scale_action = 1; } else { scale_action = 0; } /* Lower adjacent rate's throughput is measured */ - } else if (low_tpt != IWL_INVALID_VALUE) { + } else if (low_tpt != IL_INVALID_VALUE) { /* Lower rate has better throughput */ if (low_tpt > current_tpt) { - IWL_DEBUG_RATE(priv, + IL_DEBUG_RATE(priv, "decrease rate because of low tpt\n"); scale_action = -1; - } else if (sr >= IWL_RATE_INCREASE_TH) { + } else if (sr >= IL_RATE_INCREASE_TH) { scale_action = 1; } } @@ -2042,15 +2042,15 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, /* Sanity check; asked for decrease, but success rate or throughput * has been good at old rate. Don't change it. */ - if ((scale_action == -1) && (low != IWL_RATE_INVALID) && - ((sr > IWL_RATE_HIGH_TH) || + if ((scale_action == -1) && (low != IL_RATE_INVALID) && + ((sr > IL_RATE_HIGH_TH) || (current_tpt > (100 * tbl->expected_tpt[low])))) scale_action = 0; switch (scale_action) { case -1: /* Decrease starting rate, update uCode's rate table */ - if (low != IWL_RATE_INVALID) { + if (low != IL_RATE_INVALID) { update_lq = 1; index = low; } @@ -2058,7 +2058,7 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, break; case 1: /* Increase starting rate, update uCode's rate table */ - if (high != IWL_RATE_INVALID) { + if (high != IL_RATE_INVALID) { update_lq = 1; index = high; } @@ -2070,19 +2070,19 @@ static void iwl4965_rs_rate_scale_perform(struct iwl_priv *priv, break; } - IWL_DEBUG_RATE(priv, "choose rate scale index %d action %d low %d " + IL_DEBUG_RATE(priv, "choose rate scale index %d action %d low %d " "high %d type %d\n", index, scale_action, low, high, tbl->lq_type); lq_update: /* Replace uCode's rate table for the destination station. */ if (update_lq) - rate = iwl4965_rs_update_rate_tbl(priv, ctx, lq_sta, + rate = il4965_rs_update_rate_tbl(priv, ctx, lq_sta, tbl, index, is_green); /* Should we stay with this modulation mode, * or search for a new one? */ - iwl4965_rs_stay_in_table(lq_sta, false); + il4965_rs_stay_in_table(lq_sta, false); /* * Search for new modulation mode if we're: @@ -2098,32 +2098,32 @@ lq_update: /* Select a new "search" modulation mode to try. * If one is found, set up the new "search" table. */ if (is_legacy(tbl->lq_type)) - iwl4965_rs_move_legacy_other(priv, lq_sta, + il4965_rs_move_legacy_other(priv, lq_sta, conf, sta, index); else if (is_siso(tbl->lq_type)) - iwl4965_rs_move_siso_to_other(priv, lq_sta, + il4965_rs_move_siso_to_other(priv, lq_sta, conf, sta, index); else /* (is_mimo2(tbl->lq_type)) */ - iwl4965_rs_move_mimo2_to_other(priv, lq_sta, + il4965_rs_move_mimo2_to_other(priv, lq_sta, conf, sta, index); /* If new "search" mode was selected, set up in uCode table */ if (lq_sta->search_better_tbl) { /* Access the "search" table, clear its history. */ tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - for (i = 0; i < IWL_RATE_COUNT; i++) - iwl4965_rs_rate_scale_clear_window( + for (i = 0; i < IL_RATE_COUNT; i++) + il4965_rs_rate_scale_clear_window( &(tbl->win[i])); /* Use new "search" start rate */ - index = iwl4965_hwrate_to_plcp_idx(tbl->current_rate); + index = il4965_hwrate_to_plcp_idx(tbl->current_rate); - IWL_DEBUG_RATE(priv, + IL_DEBUG_RATE(priv, "Switch current mcs: %X index: %d\n", tbl->current_rate, index); - iwl4965_rs_fill_link_cmd(priv, lq_sta, + il4965_rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); - iwl_legacy_send_lq_cmd(priv, ctx, + il_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); } else done_search = 1; @@ -2138,8 +2138,8 @@ lq_update: tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); if (is_legacy(tbl1->lq_type) && !conf_is_ht(conf) && lq_sta->action_counter > tbl1->max_search) { - IWL_DEBUG_RATE(priv, "LQ: STAY in legacy table\n"); - iwl4965_rs_set_stay_in_table(priv, 1, lq_sta); + IL_DEBUG_RATE(priv, "LQ: STAY in legacy table\n"); + il4965_rs_set_stay_in_table(priv, 1, lq_sta); } /* If we're in an HT mode, and all 3 mode switch actions @@ -2147,32 +2147,32 @@ lq_update: * mode for a while before next round of mode comparisons. */ if (lq_sta->enable_counter && (lq_sta->action_counter >= tbl1->max_search)) { - if ((lq_sta->last_tpt > IWL_AGG_TPT_THREHOLD) && + if ((lq_sta->last_tpt > IL_AGG_TPT_THREHOLD) && (lq_sta->tx_agg_tid_en & (1 << tid)) && (tid != MAX_TID_COUNT)) { tid_data = &priv->stations[lq_sta->lq.sta_id].tid[tid]; - if (tid_data->agg.state == IWL_AGG_OFF) { - IWL_DEBUG_RATE(priv, + if (tid_data->agg.state == IL_AGG_OFF) { + IL_DEBUG_RATE(priv, "try to aggregate tid %d\n", tid); - iwl4965_rs_tl_turn_on_agg(priv, tid, + il4965_rs_tl_turn_on_agg(priv, tid, lq_sta, sta); } } - iwl4965_rs_set_stay_in_table(priv, 0, lq_sta); + il4965_rs_set_stay_in_table(priv, 0, lq_sta); } } out: - tbl->current_rate = iwl4965_rate_n_flags_from_tbl(priv, tbl, + tbl->current_rate = il4965_rate_n_flags_from_tbl(priv, tbl, index, is_green); i = index; lq_sta->last_txrate_idx = i; } /** - * iwl4965_rs_initialize_lq - Initialize a station's hardware rate table + * il4965_rs_initialize_lq - Initialize a station's hardware rate table * * The uCode's station table contains a table of fallback rates * for automatic fallback during transmission. @@ -2185,20 +2185,20 @@ out: * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD, * which requires station table entry to exist). */ -static void iwl4965_rs_initialize_lq(struct iwl_priv *priv, +static void il4965_rs_initialize_lq(struct il_priv *priv, struct ieee80211_conf *conf, struct ieee80211_sta *sta, - struct iwl_lq_sta *lq_sta) + struct il_lq_sta *lq_sta) { - struct iwl_scale_tbl_info *tbl; + struct il_scale_tbl_info *tbl; int rate_idx; int i; u32 rate; - u8 use_green = iwl4965_rs_use_green(sta); + u8 use_green = il4965_rs_use_green(sta); u8 active_tbl = 0; u8 valid_tx_ant; - struct iwl_station_priv *sta_priv; - struct iwl_rxon_context *ctx; + struct il_station_priv *sta_priv; + struct il_rxon_context *ctx; if (!sta || !lq_sta) return; @@ -2217,56 +2217,56 @@ static void iwl4965_rs_initialize_lq(struct iwl_priv *priv, tbl = &(lq_sta->lq_info[active_tbl]); - if ((i < 0) || (i >= IWL_RATE_COUNT)) + if ((i < 0) || (i >= IL_RATE_COUNT)) i = 0; rate = iwlegacy_rates[i].plcp; - tbl->ant_type = iwl4965_first_antenna(valid_tx_ant); + tbl->ant_type = il4965_first_antenna(valid_tx_ant); rate |= tbl->ant_type << RATE_MCS_ANT_POS; - if (i >= IWL_FIRST_CCK_RATE && i <= IWL_LAST_CCK_RATE) + if (i >= IL_FIRST_CCK_RATE && i <= IL_LAST_CCK_RATE) rate |= RATE_MCS_CCK_MSK; - iwl4965_rs_get_tbl_info_from_mcs(rate, priv->band, tbl, &rate_idx); - if (!iwl4965_rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) - iwl4965_rs_toggle_antenna(valid_tx_ant, &rate, tbl); + il4965_rs_get_tbl_info_from_mcs(rate, priv->band, tbl, &rate_idx); + if (!il4965_rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) + il4965_rs_toggle_antenna(valid_tx_ant, &rate, tbl); - rate = iwl4965_rate_n_flags_from_tbl(priv, tbl, rate_idx, use_green); + rate = il4965_rate_n_flags_from_tbl(priv, tbl, rate_idx, use_green); tbl->current_rate = rate; - iwl4965_rs_set_expected_tpt_table(lq_sta, tbl); - iwl4965_rs_fill_link_cmd(NULL, lq_sta, rate); + il4965_rs_set_expected_tpt_table(lq_sta, tbl); + il4965_rs_fill_link_cmd(NULL, lq_sta, rate); priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; - iwl_legacy_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true); + il_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true); } static void -iwl4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, +il4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, struct ieee80211_tx_rate_control *txrc) { struct sk_buff *skb = txrc->skb; struct ieee80211_supported_band *sband = txrc->sband; - struct iwl_priv *priv __maybe_unused = (struct iwl_priv *)priv_r; + struct il_priv *priv __maybe_unused = (struct il_priv *)priv_r; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct iwl_lq_sta *lq_sta = priv_sta; + struct il_lq_sta *lq_sta = priv_sta; int rate_idx; - IWL_DEBUG_RATE_LIMIT(priv, "rate scale calculate new rate for skb\n"); + IL_DEBUG_RATE_LIMIT(priv, "rate scale calculate new rate for skb\n"); /* Get max rate if user set max rate */ if (lq_sta) { lq_sta->max_rate_idx = txrc->max_rate_idx; if ((sband->band == IEEE80211_BAND_5GHZ) && (lq_sta->max_rate_idx != -1)) - lq_sta->max_rate_idx += IWL_FIRST_OFDM_RATE; + lq_sta->max_rate_idx += IL_FIRST_OFDM_RATE; if ((lq_sta->max_rate_idx < 0) || - (lq_sta->max_rate_idx >= IWL_RATE_COUNT)) + (lq_sta->max_rate_idx >= IL_RATE_COUNT)) lq_sta->max_rate_idx = -1; } /* Treat uninitialized rate scaling data same as non-existing. */ if (lq_sta && !lq_sta->drv) { - IWL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); + IL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); priv_sta = NULL; } @@ -2280,11 +2280,11 @@ iwl4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, rate_idx = lq_sta->last_txrate_idx; if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) { - rate_idx -= IWL_FIRST_OFDM_RATE; + rate_idx -= IL_FIRST_OFDM_RATE; /* 6M and 9M shared same MCS index */ rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0; - if (iwl4965_rs_extract_rate(lq_sta->last_rate_n_flags) >= - IWL_RATE_MIMO2_6M_PLCP) + if (il4965_rs_extract_rate(lq_sta->last_rate_n_flags) >= + IL_RATE_MIMO2_6M_PLCP) rate_idx = rate_idx + MCS_INDEX_PER_STREAM; info->control.rates[0].flags = IEEE80211_TX_RC_MCS; 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, IEEE80211_TX_RC_GREEN_FIELD; } else { /* Check for invalid rates */ - if ((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT_LEGACY) || + if ((rate_idx < 0) || (rate_idx >= IL_RATE_COUNT_LEGACY) || ((sband->band == IEEE80211_BAND_5GHZ) && - (rate_idx < IWL_FIRST_OFDM_RATE))) + (rate_idx < IL_FIRST_OFDM_RATE))) rate_idx = rate_lowest_index(sband, sta); /* On valid 5 GHz rate, adjust index */ else if (sband->band == IEEE80211_BAND_5GHZ) - rate_idx -= IWL_FIRST_OFDM_RATE; + rate_idx -= IL_FIRST_OFDM_RATE; info->control.rates[0].flags = 0; } info->control.rates[0].idx = rate_idx; } -static void *iwl4965_rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, +static void *il4965_rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, gfp_t gfp) { - struct iwl_lq_sta *lq_sta; - struct iwl_station_priv *sta_priv = - (struct iwl_station_priv *) sta->drv_priv; - struct iwl_priv *priv; + struct il_lq_sta *lq_sta; + struct il_station_priv *sta_priv = + (struct il_station_priv *) sta->drv_priv; + struct il_priv *priv; - priv = (struct iwl_priv *)priv_rate; - IWL_DEBUG_RATE(priv, "create station rate scale window\n"); + priv = (struct il_priv *)priv_rate; + IL_DEBUG_RATE(priv, "create station rate scale window\n"); lq_sta = &sta_priv->lq_sta; @@ -2334,7 +2334,7 @@ static void *iwl4965_rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, * Called after adding a new station to initialize rate scaling */ void -iwl4965_rs_rate_init(struct iwl_priv *priv, +il4965_rs_rate_init(struct il_priv *priv, struct ieee80211_sta *sta, u8 sta_id) { @@ -2342,11 +2342,11 @@ iwl4965_rs_rate_init(struct iwl_priv *priv, struct ieee80211_hw *hw = priv->hw; struct ieee80211_conf *conf = &priv->hw->conf; struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - struct iwl_station_priv *sta_priv; - struct iwl_lq_sta *lq_sta; + struct il_station_priv *sta_priv; + struct il_lq_sta *lq_sta; struct ieee80211_supported_band *sband; - sta_priv = (struct iwl_station_priv *) sta->drv_priv; + sta_priv = (struct il_station_priv *) sta->drv_priv; lq_sta = &sta_priv->lq_sta; sband = hw->wiphy->bands[conf->channel->band]; @@ -2354,18 +2354,18 @@ iwl4965_rs_rate_init(struct iwl_priv *priv, lq_sta->lq.sta_id = sta_id; for (j = 0; j < LQ_SIZE; j++) - for (i = 0; i < IWL_RATE_COUNT; i++) - iwl4965_rs_rate_scale_clear_window( + for (i = 0; i < IL_RATE_COUNT; i++) + il4965_rs_rate_scale_clear_window( &lq_sta->lq_info[j].win[i]); lq_sta->flush_timer = 0; lq_sta->supp_rates = sta->supp_rates[sband->band]; for (j = 0; j < LQ_SIZE; j++) - for (i = 0; i < IWL_RATE_COUNT; i++) - iwl4965_rs_rate_scale_clear_window( + for (i = 0; i < IL_RATE_COUNT; i++) + il4965_rs_rate_scale_clear_window( &lq_sta->lq_info[j].win[i]); - IWL_DEBUG_RATE(priv, "LQ:" + IL_DEBUG_RATE(priv, "LQ:" "*** rate scale station global init for station %d ***\n", sta_id); /* 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, lq_sta->is_dup = 0; lq_sta->max_rate_idx = -1; - lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX; - lq_sta->is_green = iwl4965_rs_use_green(sta); + lq_sta->missed_rate_counter = IL_MISSED_RATE_MAX; + lq_sta->is_green = il4965_rs_use_green(sta); lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); lq_sta->band = priv->band; /* @@ -2386,69 +2386,69 @@ iwl4965_rs_rate_init(struct iwl_priv *priv, lq_sta->active_siso_rate = ht_cap->mcs.rx_mask[0] << 1; lq_sta->active_siso_rate |= ht_cap->mcs.rx_mask[0] & 0x1; lq_sta->active_siso_rate &= ~((u16)0x2); - lq_sta->active_siso_rate <<= IWL_FIRST_OFDM_RATE; + lq_sta->active_siso_rate <<= IL_FIRST_OFDM_RATE; /* Same here */ lq_sta->active_mimo2_rate = ht_cap->mcs.rx_mask[1] << 1; lq_sta->active_mimo2_rate |= ht_cap->mcs.rx_mask[1] & 0x1; lq_sta->active_mimo2_rate &= ~((u16)0x2); - lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE; + lq_sta->active_mimo2_rate <<= IL_FIRST_OFDM_RATE; /* These values will be overridden later */ lq_sta->lq.general_params.single_stream_ant_msk = - iwl4965_first_antenna(priv->hw_params.valid_tx_ant); + il4965_first_antenna(priv->hw_params.valid_tx_ant); lq_sta->lq.general_params.dual_stream_ant_msk = priv->hw_params.valid_tx_ant & - ~iwl4965_first_antenna(priv->hw_params.valid_tx_ant); + ~il4965_first_antenna(priv->hw_params.valid_tx_ant); if (!lq_sta->lq.general_params.dual_stream_ant_msk) { lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; - } else if (iwl4965_num_of_ant(priv->hw_params.valid_tx_ant) == 2) { + } else if (il4965_num_of_ant(priv->hw_params.valid_tx_ant) == 2) { lq_sta->lq.general_params.dual_stream_ant_msk = priv->hw_params.valid_tx_ant; } /* as default allow aggregation for all tids */ - lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; + lq_sta->tx_agg_tid_en = IL_AGG_ALL_TID; lq_sta->drv = priv; /* Set last_txrate_idx to lowest rate */ lq_sta->last_txrate_idx = rate_lowest_index(sband, sta); if (sband->band == IEEE80211_BAND_5GHZ) - lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; + lq_sta->last_txrate_idx += IL_FIRST_OFDM_RATE; lq_sta->is_agg = 0; #ifdef CONFIG_MAC80211_DEBUGFS lq_sta->dbg_fixed_rate = 0; #endif - iwl4965_rs_initialize_lq(priv, conf, sta, lq_sta); + il4965_rs_initialize_lq(priv, conf, sta, lq_sta); } -static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, u32 new_rate) +static void il4965_rs_fill_link_cmd(struct il_priv *priv, + struct il_lq_sta *lq_sta, u32 new_rate) { - struct iwl_scale_tbl_info tbl_type; + struct il_scale_tbl_info tbl_type; int index = 0; int rate_idx; int repeat_rate = 0; u8 ant_toggle_cnt = 0; u8 use_ht_possible = 1; u8 valid_tx_ant = 0; - struct iwl_link_quality_cmd *lq_cmd = &lq_sta->lq; + struct il_link_quality_cmd *lq_cmd = &lq_sta->lq; /* Override starting rate (index 0) if needed for debug purposes */ - iwl4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); + il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); /* Interpret new_rate (rate_n_flags) */ - iwl4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, + il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, &tbl_type, &rate_idx); /* How many times should we repeat the initial rate? */ if (is_legacy(tbl_type.lq_type)) { ant_toggle_cnt = 1; - repeat_rate = IWL_NUMBER_TRY; + repeat_rate = IL_NUMBER_TRY; } else { - repeat_rate = IWL_HT_NUMBER_TRY; + repeat_rate = IL_HT_NUMBER_TRY; } lq_cmd->general_params.mimo_delimiter = @@ -2457,10 +2457,10 @@ static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv, /* Fill 1st table entry (index 0) */ lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(new_rate); - if (iwl4965_num_of_ant(tbl_type.ant_type) == 1) { + if (il4965_num_of_ant(tbl_type.ant_type) == 1) { lq_cmd->general_params.single_stream_ant_msk = tbl_type.ant_type; - } else if (iwl4965_num_of_ant(tbl_type.ant_type) == 2) { + } else if (il4965_num_of_ant(tbl_type.ant_type) == 2) { lq_cmd->general_params.dual_stream_ant_msk = tbl_type.ant_type; } /* otherwise we don't modify the existing value */ @@ -2473,20 +2473,20 @@ static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv, /* Fill rest of rate table */ while (index < LINK_QUAL_MAX_RETRY_NUM) { /* Repeat initial/next rate. - * For legacy IWL_NUMBER_TRY == 1, this loop will not execute. - * For HT IWL_HT_NUMBER_TRY == 3, this executes twice. */ + * For legacy IL_NUMBER_TRY == 1, this loop will not execute. + * For HT IL_HT_NUMBER_TRY == 3, this executes twice. */ while (repeat_rate > 0 && (index < LINK_QUAL_MAX_RETRY_NUM)) { if (is_legacy(tbl_type.lq_type)) { if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) ant_toggle_cnt++; else if (priv && - iwl4965_rs_toggle_antenna(valid_tx_ant, + il4965_rs_toggle_antenna(valid_tx_ant, &new_rate, &tbl_type)) ant_toggle_cnt = 1; } /* Override next rate if needed for debug purposes */ - iwl4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); + il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); /* Fill next table entry */ lq_cmd->rs_table[index].rate_n_flags = @@ -2495,18 +2495,18 @@ static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv, index++; } - iwl4965_rs_get_tbl_info_from_mcs(new_rate, + il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, &tbl_type, &rate_idx); /* Indicate to uCode which entries might be MIMO. * If initial rate was MIMO, this will finally end up - * as (IWL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */ + * as (IL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */ if (is_mimo(tbl_type.lq_type)) lq_cmd->general_params.mimo_delimiter = index; /* Get next rate */ - new_rate = iwl4965_rs_get_lower_rate(lq_sta, + new_rate = il4965_rs_get_lower_rate(lq_sta, &tbl_type, rate_idx, use_ht_possible); @@ -2515,21 +2515,21 @@ static void iwl4965_rs_fill_link_cmd(struct iwl_priv *priv, if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) ant_toggle_cnt++; else if (priv && - iwl4965_rs_toggle_antenna(valid_tx_ant, + il4965_rs_toggle_antenna(valid_tx_ant, &new_rate, &tbl_type)) ant_toggle_cnt = 1; - repeat_rate = IWL_NUMBER_TRY; + repeat_rate = IL_NUMBER_TRY; } else { - repeat_rate = IWL_HT_NUMBER_TRY; + repeat_rate = IL_HT_NUMBER_TRY; } /* Don't allow HT rates after next pass. - * iwl4965_rs_get_lower_rate() will change type to LQ_A or LQ_G. */ + * il4965_rs_get_lower_rate() will change type to LQ_A or LQ_G. */ use_ht_possible = 0; /* Override next rate if needed for debug purposes */ - iwl4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); + il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); /* Fill next table entry */ 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, } static void -*iwl4965_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) +*il4965_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) { return hw->priv; } /* rate scale requires free function to be implemented */ -static void iwl4965_rs_free(void *priv_rate) +static void il4965_rs_free(void *priv_rate) { return; } -static void iwl4965_rs_free_sta(void *priv_r, struct ieee80211_sta *sta, +static void il4965_rs_free_sta(void *priv_r, struct ieee80211_sta *sta, void *priv_sta) { - struct iwl_priv *priv __maybe_unused = priv_r; + struct il_priv *priv __maybe_unused = priv_r; - IWL_DEBUG_RATE(priv, "enter\n"); - IWL_DEBUG_RATE(priv, "leave\n"); + IL_DEBUG_RATE(priv, "enter\n"); + IL_DEBUG_RATE(priv, "leave\n"); } #ifdef CONFIG_MAC80211_DEBUGFS -static int iwl4965_open_file_generic(struct inode *inode, struct file *file) +static int il4965_open_file_generic(struct inode *inode, struct file *file) { file->private_data = inode->i_private; return 0; } -static void iwl4965_rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, +static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 *rate_n_flags, int index) { - struct iwl_priv *priv; + struct il_priv *priv; u8 valid_tx_ant; u8 ant_sel_tx; @@ -2587,30 +2587,30 @@ static void iwl4965_rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, >> RATE_MCS_ANT_POS); if ((valid_tx_ant & ant_sel_tx) == ant_sel_tx) { *rate_n_flags = lq_sta->dbg_fixed_rate; - IWL_DEBUG_RATE(priv, "Fixed rate ON\n"); + IL_DEBUG_RATE(priv, "Fixed rate ON\n"); } else { lq_sta->dbg_fixed_rate = 0; - IWL_ERR(priv, + IL_ERR(priv, "Invalid antenna selection 0x%X, Valid is 0x%X\n", ant_sel_tx, valid_tx_ant); - IWL_DEBUG_RATE(priv, "Fixed rate OFF\n"); + IL_DEBUG_RATE(priv, "Fixed rate OFF\n"); } } else { - IWL_DEBUG_RATE(priv, "Fixed rate OFF\n"); + IL_DEBUG_RATE(priv, "Fixed rate OFF\n"); } } -static ssize_t iwl4965_rs_sta_dbgfs_scale_table_write(struct file *file, +static ssize_t il4965_rs_sta_dbgfs_scale_table_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_lq_sta *lq_sta = file->private_data; - struct iwl_priv *priv; + struct il_lq_sta *lq_sta = file->private_data; + struct il_priv *priv; char buf[64]; size_t buf_size; u32 parsed_rate; - struct iwl_station_priv *sta_priv = - container_of(lq_sta, struct iwl_station_priv, lq_sta); - struct iwl_rxon_context *ctx = sta_priv->common.ctx; + struct il_station_priv *sta_priv = + container_of(lq_sta, struct il_station_priv, lq_sta); + struct il_rxon_context *ctx = sta_priv->common.ctx; priv = lq_sta->drv; memset(buf, 0, sizeof(buf)); @@ -2627,19 +2627,19 @@ static ssize_t iwl4965_rs_sta_dbgfs_scale_table_write(struct file *file, lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ - IWL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n", + IL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n", lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate); if (lq_sta->dbg_fixed_rate) { - iwl4965_rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); - iwl_legacy_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC, + il4965_rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); + il_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC, false); } return count; } -static ssize_t iwl4965_rs_sta_dbgfs_scale_table_read(struct file *file, +static ssize_t il4965_rs_sta_dbgfs_scale_table_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { char *buff; @@ -2648,9 +2648,9 @@ static ssize_t iwl4965_rs_sta_dbgfs_scale_table_read(struct file *file, int index = 0; ssize_t ret; - struct iwl_lq_sta *lq_sta = file->private_data; - struct iwl_priv *priv; - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); + struct il_lq_sta *lq_sta = file->private_data; + struct il_priv *priv; + struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); priv = lq_sta->drv; buff = kmalloc(1024, GFP_KERNEL); @@ -2702,19 +2702,19 @@ static ssize_t iwl4965_rs_sta_dbgfs_scale_table_read(struct file *file, lq_sta->lq.general_params.start_rate_index[3]); for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { - index = iwl4965_hwrate_to_plcp_idx( + index = il4965_hwrate_to_plcp_idx( le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags)); if (is_legacy(tbl->lq_type)) { desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n", i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), - iwl_rate_mcs[index].mbps); + il_rate_mcs[index].mbps); } else { desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps (%s)\n", i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), - iwl_rate_mcs[index].mbps, iwl_rate_mcs[index].mcs); + il_rate_mcs[index].mbps, il_rate_mcs[index].mcs); } } @@ -2724,12 +2724,12 @@ static ssize_t iwl4965_rs_sta_dbgfs_scale_table_read(struct file *file, } static const struct file_operations rs_sta_dbgfs_scale_table_ops = { - .write = iwl4965_rs_sta_dbgfs_scale_table_write, - .read = iwl4965_rs_sta_dbgfs_scale_table_read, - .open = iwl4965_open_file_generic, + .write = il4965_rs_sta_dbgfs_scale_table_write, + .read = il4965_rs_sta_dbgfs_scale_table_read, + .open = il4965_open_file_generic, .llseek = default_llseek, }; -static ssize_t iwl4965_rs_sta_dbgfs_stats_table_read(struct file *file, +static ssize_t il4965_rs_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { char *buff; @@ -2737,7 +2737,7 @@ static ssize_t iwl4965_rs_sta_dbgfs_stats_table_read(struct file *file, int i, j; ssize_t ret; - struct iwl_lq_sta *lq_sta = file->private_data; + struct il_lq_sta *lq_sta = file->private_data; buff = kmalloc(1024, GFP_KERNEL); if (!buff) @@ -2754,7 +2754,7 @@ static ssize_t iwl4965_rs_sta_dbgfs_stats_table_read(struct file *file, lq_sta->lq_info[i].is_dup, lq_sta->is_green, lq_sta->lq_info[i].current_rate); - for (j = 0; j < IWL_RATE_COUNT; j++) { + for (j = 0; j < IL_RATE_COUNT; j++) { desc += sprintf(buff+desc, "counter=%d success=%d %%=%d\n", 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, } static const struct file_operations rs_sta_dbgfs_stats_table_ops = { - .read = iwl4965_rs_sta_dbgfs_stats_table_read, - .open = iwl4965_open_file_generic, + .read = il4965_rs_sta_dbgfs_stats_table_read, + .open = il4965_open_file_generic, .llseek = default_llseek, }; -static ssize_t iwl4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file, +static ssize_t il4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { char buff[120]; int desc = 0; ssize_t ret; - struct iwl_lq_sta *lq_sta = file->private_data; - struct iwl_priv *priv; - struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; + struct il_lq_sta *lq_sta = file->private_data; + struct il_priv *priv; + struct il_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; priv = lq_sta->drv; @@ -2800,15 +2800,15 @@ static ssize_t iwl4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file, } static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { - .read = iwl4965_rs_sta_dbgfs_rate_scale_data_read, - .open = iwl4965_open_file_generic, + .read = il4965_rs_sta_dbgfs_rate_scale_data_read, + .open = il4965_open_file_generic, .llseek = default_llseek, }; -static void iwl4965_rs_add_debugfs(void *priv, void *priv_sta, +static void il4965_rs_add_debugfs(void *priv, void *priv_sta, struct dentry *dir) { - struct iwl_lq_sta *lq_sta = priv_sta; + struct il_lq_sta *lq_sta = priv_sta; lq_sta->rs_sta_dbgfs_scale_table_file = debugfs_create_file("rate_scale_table", S_IRUSR | S_IWUSR, dir, lq_sta, &rs_sta_dbgfs_scale_table_ops); @@ -2824,9 +2824,9 @@ static void iwl4965_rs_add_debugfs(void *priv, void *priv_sta, } -static void iwl4965_rs_remove_debugfs(void *priv, void *priv_sta) +static void il4965_rs_remove_debugfs(void *priv, void *priv_sta) { - struct iwl_lq_sta *lq_sta = priv_sta; + struct il_lq_sta *lq_sta = priv_sta; debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); 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) * station is added we ignore it. */ static void -iwl4965_rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband, +il4965_rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband, struct ieee80211_sta *sta, void *priv_sta) { } static struct rate_control_ops rs_4965_ops = { .module = NULL, .name = IWL4965_RS_NAME, - .tx_status = iwl4965_rs_tx_status, - .get_rate = iwl4965_rs_get_rate, - .rate_init = iwl4965_rs_rate_init_stub, - .alloc = iwl4965_rs_alloc, - .free = iwl4965_rs_free, - .alloc_sta = iwl4965_rs_alloc_sta, - .free_sta = iwl4965_rs_free_sta, + .tx_status = il4965_rs_tx_status, + .get_rate = il4965_rs_get_rate, + .rate_init = il4965_rs_rate_init_stub, + .alloc = il4965_rs_alloc, + .free = il4965_rs_free, + .alloc_sta = il4965_rs_alloc_sta, + .free_sta = il4965_rs_free_sta, #ifdef CONFIG_MAC80211_DEBUGFS - .add_sta_debugfs = iwl4965_rs_add_debugfs, - .remove_sta_debugfs = iwl4965_rs_remove_debugfs, + .add_sta_debugfs = il4965_rs_add_debugfs, + .remove_sta_debugfs = il4965_rs_remove_debugfs, #endif }; -int iwl4965_rate_control_register(void) +int il4965_rate_control_register(void) { return ieee80211_rate_control_register(&rs_4965_ops); } -void iwl4965_rate_control_unregister(void) +void il4965_rate_control_unregister(void) { ieee80211_rate_control_unregister(&rs_4965_ops); } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rx.c b/drivers/net/wireless/iwlegacy/iwl-4965-rx.c index 2b144bb..47cbe56 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-rx.c @@ -41,31 +41,31 @@ #include "iwl-4965-hw.h" #include "iwl-4965.h" -void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il4965_rx_missed_beacon_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_missed_beacon_notif *missed_beacon; + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_missed_beacon_notif *missed_beacon; missed_beacon = &pkt->u.missed_beacon; if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) > priv->missed_beacon_threshold) { - IWL_DEBUG_CALIB(priv, + IL_DEBUG_CALIB(priv, "missed bcn cnsq %d totl %d rcd %d expctd %d\n", le32_to_cpu(missed_beacon->consecutive_missed_beacons), le32_to_cpu(missed_beacon->total_missed_becons), le32_to_cpu(missed_beacon->num_recvd_beacons), le32_to_cpu(missed_beacon->num_expected_beacons)); if (!test_bit(STATUS_SCANNING, &priv->status)) - iwl4965_init_sensitivity(priv); + il4965_init_sensitivity(priv); } } /* Calculate noise level, based on measurements during network silence just * before arriving beacon. This measurement can be done only if we know * exactly when to expect beacons, therefore only when we're associated. */ -static void iwl4965_rx_calc_noise(struct iwl_priv *priv) +static void il4965_rx_calc_noise(struct il_priv *priv) { struct statistics_rx_non_phy *rx_info; int num_active_rx = 0; @@ -98,9 +98,9 @@ static void iwl4965_rx_calc_noise(struct iwl_priv *priv) if (num_active_rx) last_rx_noise = (total_silence / num_active_rx) - 107; else - last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; + last_rx_noise = IL_NOISE_MEAS_NOT_AVAILABLE; - IWL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n", + IL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n", bcn_silence_a, bcn_silence_b, bcn_silence_c, last_rx_noise); } @@ -111,7 +111,7 @@ static void iwl4965_rx_calc_noise(struct iwl_priv *priv) * FIXME: This function is for debugging, do not deal with * the case of counters roll-over. */ -static void iwl4965_accumulative_statistics(struct iwl_priv *priv, +static void il4965_accumulative_statistics(struct il_priv *priv, __le32 *stats) { int i, size; @@ -123,7 +123,7 @@ static void iwl4965_accumulative_statistics(struct iwl_priv *priv, prev_stats = (__le32 *)&priv->_4965.statistics; accum_stats = (u32 *)&priv->_4965.accum_statistics; - size = sizeof(struct iwl_notif_statistics); + size = sizeof(struct il_notif_statistics); general = &priv->_4965.statistics.general.common; accum_general = &priv->_4965.accum_statistics.general.common; tx = &priv->_4965.statistics.tx; @@ -151,15 +151,15 @@ static void iwl4965_accumulative_statistics(struct iwl_priv *priv, #define REG_RECALIB_PERIOD (60) -void iwl4965_rx_statistics(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il4965_rx_statistics(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { int change; - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); - IWL_DEBUG_RX(priv, + IL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", - (int)sizeof(struct iwl_notif_statistics), + (int)sizeof(struct il_notif_statistics), le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); @@ -170,7 +170,7 @@ void iwl4965_rx_statistics(struct iwl_priv *priv, (pkt->u.stats.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK))); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS - iwl4965_accumulative_statistics(priv, (__le32 *)&pkt->u.stats); + il4965_accumulative_statistics(priv, (__le32 *)&pkt->u.stats); #endif /* TODO: reading some of statistics is unneeded */ @@ -188,28 +188,28 @@ void iwl4965_rx_statistics(struct iwl_priv *priv, if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) { - iwl4965_rx_calc_noise(priv); + il4965_rx_calc_noise(priv); queue_work(priv->workqueue, &priv->run_time_calib_work); } if (priv->cfg->ops->lib->temp_ops.temperature && change) priv->cfg->ops->lib->temp_ops.temperature(priv); } -void iwl4965_reply_statistics(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il4965_reply_statistics(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) { #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS memset(&priv->_4965.accum_statistics, 0, - sizeof(struct iwl_notif_statistics)); + sizeof(struct il_notif_statistics)); memset(&priv->_4965.delta_statistics, 0, - sizeof(struct iwl_notif_statistics)); + sizeof(struct il_notif_statistics)); memset(&priv->_4965.max_delta, 0, - sizeof(struct iwl_notif_statistics)); + sizeof(struct il_notif_statistics)); #endif - IWL_DEBUG_RX(priv, "Statistics have been cleared\n"); + IL_DEBUG_RX(priv, "Statistics have been cleared\n"); } - iwl4965_rx_statistics(priv, rxb); + il4965_rx_statistics(priv, rxb); } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c index a262c23..3ac9aef 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c @@ -34,45 +34,45 @@ #include "iwl-sta.h" #include "iwl-4965.h" -static struct iwl_link_quality_cmd * -iwl4965_sta_alloc_lq(struct iwl_priv *priv, u8 sta_id) +static struct il_link_quality_cmd * +il4965_sta_alloc_lq(struct il_priv *priv, u8 sta_id) { int i, r; - struct iwl_link_quality_cmd *link_cmd; + struct il_link_quality_cmd *link_cmd; u32 rate_flags = 0; __le32 rate_n_flags; - link_cmd = kzalloc(sizeof(struct iwl_link_quality_cmd), GFP_KERNEL); + link_cmd = kzalloc(sizeof(struct il_link_quality_cmd), GFP_KERNEL); if (!link_cmd) { - IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n"); + IL_ERR(priv, "Unable to allocate memory for LQ cmd.\n"); return NULL; } /* Set up the rate scaling to start at selected rate, fall back * all the way down to 1M in IEEE order, and then spin on 1M */ if (priv->band == IEEE80211_BAND_5GHZ) - r = IWL_RATE_6M_INDEX; + r = IL_RATE_6M_INDEX; else - r = IWL_RATE_1M_INDEX; + r = IL_RATE_1M_INDEX; - if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) + if (r >= IL_FIRST_CCK_RATE && r <= IL_LAST_CCK_RATE) rate_flags |= RATE_MCS_CCK_MSK; - rate_flags |= iwl4965_first_antenna(priv->hw_params.valid_tx_ant) << + rate_flags |= il4965_first_antenna(priv->hw_params.valid_tx_ant) << RATE_MCS_ANT_POS; - rate_n_flags = iwl4965_hw_set_rate_n_flags(iwlegacy_rates[r].plcp, + rate_n_flags = il4965_hw_set_rate_n_flags(iwlegacy_rates[r].plcp, rate_flags); for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) link_cmd->rs_table[i].rate_n_flags = rate_n_flags; link_cmd->general_params.single_stream_ant_msk = - iwl4965_first_antenna(priv->hw_params.valid_tx_ant); + il4965_first_antenna(priv->hw_params.valid_tx_ant); link_cmd->general_params.dual_stream_ant_msk = priv->hw_params.valid_tx_ant & - ~iwl4965_first_antenna(priv->hw_params.valid_tx_ant); + ~il4965_first_antenna(priv->hw_params.valid_tx_ant); if (!link_cmd->general_params.dual_stream_ant_msk) { link_cmd->general_params.dual_stream_ant_msk = ANT_AB; - } else if (iwl4965_num_of_ant(priv->hw_params.valid_tx_ant) == 2) { + } else if (il4965_num_of_ant(priv->hw_params.valid_tx_ant) == 2) { link_cmd->general_params.dual_stream_ant_msk = priv->hw_params.valid_tx_ant; } @@ -87,25 +87,25 @@ iwl4965_sta_alloc_lq(struct iwl_priv *priv, u8 sta_id) } /* - * iwl4965_add_bssid_station - Add the special IBSS BSSID station + * il4965_add_bssid_station - Add the special IBSS BSSID station * * Function sleeps. */ int -iwl4965_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, +il4965_add_bssid_station(struct il_priv *priv, struct il_rxon_context *ctx, const u8 *addr, u8 *sta_id_r) { int ret; u8 sta_id; - struct iwl_link_quality_cmd *link_cmd; + struct il_link_quality_cmd *link_cmd; unsigned long flags; if (sta_id_r) - *sta_id_r = IWL_INVALID_STATION; + *sta_id_r = IL_INVALID_STATION; - ret = iwl_legacy_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); + ret = il_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); if (ret) { - IWL_ERR(priv, "Unable to add station %pM\n", addr); + IL_ERR(priv, "Unable to add station %pM\n", addr); return ret; } @@ -113,21 +113,21 @@ iwl4965_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, *sta_id_r = sta_id; spin_lock_irqsave(&priv->sta_lock, flags); - priv->stations[sta_id].used |= IWL_STA_LOCAL; + priv->stations[sta_id].used |= IL_STA_LOCAL; spin_unlock_irqrestore(&priv->sta_lock, flags); /* Set up default rate scaling table in device's station table */ - link_cmd = iwl4965_sta_alloc_lq(priv, sta_id); + link_cmd = il4965_sta_alloc_lq(priv, sta_id); if (!link_cmd) { - IWL_ERR(priv, + IL_ERR(priv, "Unable to initialize rate scaling for station %pM.\n", addr); return -ENOMEM; } - ret = iwl_legacy_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true); + ret = il_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true); if (ret) - IWL_ERR(priv, "Link quality command failed (%d)\n", ret); + IL_ERR(priv, "Link quality command failed (%d)\n", ret); spin_lock_irqsave(&priv->sta_lock, flags); priv->stations[sta_id].lq = link_cmd; @@ -136,16 +136,16 @@ iwl4965_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, return 0; } -static int iwl4965_static_wepkey_cmd(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +static int il4965_static_wepkey_cmd(struct il_priv *priv, + struct il_rxon_context *ctx, bool send_if_empty) { int i, not_empty = 0; - u8 buff[sizeof(struct iwl_wep_cmd) + - sizeof(struct iwl_wep_key) * WEP_KEYS_MAX]; - struct iwl_wep_cmd *wep_cmd = (struct iwl_wep_cmd *)buff; - size_t cmd_size = sizeof(struct iwl_wep_cmd); - struct iwl_host_cmd cmd = { + u8 buff[sizeof(struct il_wep_cmd) + + sizeof(struct il_wep_key) * WEP_KEYS_MAX]; + struct il_wep_cmd *wep_cmd = (struct il_wep_cmd *)buff; + size_t cmd_size = sizeof(struct il_wep_cmd); + struct il_host_cmd cmd = { .id = ctx->wep_key_cmd, .data = wep_cmd, .flags = CMD_SYNC, @@ -154,7 +154,7 @@ static int iwl4965_static_wepkey_cmd(struct iwl_priv *priv, might_sleep(); memset(wep_cmd, 0, cmd_size + - (sizeof(struct iwl_wep_key) * WEP_KEYS_MAX)); + (sizeof(struct il_wep_key) * WEP_KEYS_MAX)); for (i = 0; i < WEP_KEYS_MAX ; i++) { wep_cmd->key[i].key_index = i; @@ -173,51 +173,51 @@ static int iwl4965_static_wepkey_cmd(struct iwl_priv *priv, wep_cmd->global_key_type = WEP_KEY_WEP_TYPE; wep_cmd->num_keys = WEP_KEYS_MAX; - cmd_size += sizeof(struct iwl_wep_key) * WEP_KEYS_MAX; + cmd_size += sizeof(struct il_wep_key) * WEP_KEYS_MAX; cmd.len = cmd_size; if (not_empty || send_if_empty) - return iwl_legacy_send_cmd(priv, &cmd); + return il_send_cmd(priv, &cmd); else return 0; } -int iwl4965_restore_default_wep_keys(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +int il4965_restore_default_wep_keys(struct il_priv *priv, + struct il_rxon_context *ctx) { lockdep_assert_held(&priv->mutex); - return iwl4965_static_wepkey_cmd(priv, ctx, false); + return il4965_static_wepkey_cmd(priv, ctx, false); } -int iwl4965_remove_default_wep_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +int il4965_remove_default_wep_key(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *keyconf) { int ret; lockdep_assert_held(&priv->mutex); - IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", + IL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", keyconf->keyidx); memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0])); - if (iwl_legacy_is_rfkill(priv)) { - IWL_DEBUG_WEP(priv, + if (il_is_rfkill(priv)) { + IL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n"); /* but keys in device are clear anyway so return success */ return 0; } - ret = iwl4965_static_wepkey_cmd(priv, ctx, 1); - IWL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n", + ret = il4965_static_wepkey_cmd(priv, ctx, 1); + IL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n", keyconf->keyidx, ret); return ret; } -int iwl4965_set_default_wep_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +int il4965_set_default_wep_key(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *keyconf) { int ret; @@ -226,7 +226,7 @@ int iwl4965_set_default_wep_key(struct iwl_priv *priv, if (keyconf->keylen != WEP_KEY_LEN_128 && keyconf->keylen != WEP_KEY_LEN_64) { - IWL_DEBUG_WEP(priv, "Bad WEP key length %d\n", keyconf->keylen); + IL_DEBUG_WEP(priv, "Bad WEP key length %d\n", keyconf->keylen); return -EINVAL; } @@ -238,21 +238,21 @@ int iwl4965_set_default_wep_key(struct iwl_priv *priv, memcpy(&ctx->wep_keys[keyconf->keyidx].key, &keyconf->key, keyconf->keylen); - ret = iwl4965_static_wepkey_cmd(priv, ctx, false); - IWL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n", + ret = il4965_static_wepkey_cmd(priv, ctx, false); + IL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n", keyconf->keylen, keyconf->keyidx, ret); return ret; } -static int iwl4965_set_wep_dynamic_key_info(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +static int il4965_set_wep_dynamic_key_info(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *keyconf, u8 sta_id) { unsigned long flags; __le16 key_flags = 0; - struct iwl_legacy_addsta_cmd sta_cmd; + struct il_addsta_cmd sta_cmd; lockdep_assert_held(&priv->mutex); @@ -283,7 +283,7 @@ static int iwl4965_set_wep_dynamic_key_info(struct iwl_priv *priv, if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) == STA_KEY_FLG_NO_ENC) priv->stations[sta_id].sta.key.key_offset = - iwl_legacy_get_free_ucode_key_index(priv); + il_get_free_ucode_key_index(priv); /* else, we are overriding an existing key => no need to allocated room * in uCode. */ @@ -295,20 +295,20 @@ static int iwl4965_set_wep_dynamic_key_info(struct iwl_priv *priv, priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; memcpy(&sta_cmd, &priv->stations[sta_id].sta, - sizeof(struct iwl_legacy_addsta_cmd)); + sizeof(struct il_addsta_cmd)); spin_unlock_irqrestore(&priv->sta_lock, flags); - return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); + return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); } -static int iwl4965_set_ccmp_dynamic_key_info(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +static int il4965_set_ccmp_dynamic_key_info(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *keyconf, u8 sta_id) { unsigned long flags; __le16 key_flags = 0; - struct iwl_legacy_addsta_cmd sta_cmd; + struct il_addsta_cmd sta_cmd; lockdep_assert_held(&priv->mutex); @@ -334,7 +334,7 @@ static int iwl4965_set_ccmp_dynamic_key_info(struct iwl_priv *priv, if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) == STA_KEY_FLG_NO_ENC) priv->stations[sta_id].sta.key.key_offset = - iwl_legacy_get_free_ucode_key_index(priv); + il_get_free_ucode_key_index(priv); /* else, we are overriding an existing key => no need to allocated room * in uCode. */ @@ -346,14 +346,14 @@ static int iwl4965_set_ccmp_dynamic_key_info(struct iwl_priv *priv, priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; memcpy(&sta_cmd, &priv->stations[sta_id].sta, - sizeof(struct iwl_legacy_addsta_cmd)); + sizeof(struct il_addsta_cmd)); spin_unlock_irqrestore(&priv->sta_lock, flags); - return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); + return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); } -static int iwl4965_set_tkip_dynamic_key_info(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +static int il4965_set_tkip_dynamic_key_info(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *keyconf, u8 sta_id) { @@ -379,7 +379,7 @@ static int iwl4965_set_tkip_dynamic_key_info(struct iwl_priv *priv, if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) == STA_KEY_FLG_NO_ENC) priv->stations[sta_id].sta.key.key_offset = - iwl_legacy_get_free_ucode_key_index(priv); + il_get_free_ucode_key_index(priv); /* else, we are overriding an existing key => no need to allocated room * in uCode. */ @@ -399,8 +399,8 @@ static int iwl4965_set_tkip_dynamic_key_info(struct iwl_priv *priv, return ret; } -void iwl4965_update_tkip_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +void il4965_update_tkip_key(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *keyconf, struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) { @@ -408,14 +408,14 @@ void iwl4965_update_tkip_key(struct iwl_priv *priv, unsigned long flags; int i; - if (iwl_legacy_scan_cancel(priv)) { + if (il_scan_cancel(priv)) { /* cancel scan failed, just live w/ bad key and rely briefly on SW decryption */ return; } - sta_id = iwl_legacy_sta_id_or_broadcast(priv, ctx, sta); - if (sta_id == IWL_INVALID_STATION) + sta_id = il_sta_id_or_broadcast(priv, ctx, sta); + if (sta_id == IL_INVALID_STATION) return; spin_lock_irqsave(&priv->sta_lock, flags); @@ -429,21 +429,21 @@ void iwl4965_update_tkip_key(struct iwl_priv *priv, priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - iwl_legacy_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); + il_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); spin_unlock_irqrestore(&priv->sta_lock, flags); } -int iwl4965_remove_dynamic_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +int il4965_remove_dynamic_key(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *keyconf, u8 sta_id) { unsigned long flags; u16 key_flags; u8 keyidx; - struct iwl_legacy_addsta_cmd sta_cmd; + struct il_addsta_cmd sta_cmd; lockdep_assert_held(&priv->mutex); @@ -453,7 +453,7 @@ int iwl4965_remove_dynamic_key(struct iwl_priv *priv, key_flags = le16_to_cpu(priv->stations[sta_id].sta.key.key_flags); keyidx = (key_flags >> STA_KEY_FLG_KEYID_POS) & 0x3; - IWL_DEBUG_WEP(priv, "Remove dynamic key: idx=%d sta=%d\n", + IL_DEBUG_WEP(priv, "Remove dynamic key: idx=%d sta=%d\n", keyconf->keyidx, sta_id); if (keyconf->keyidx != keyidx) { @@ -467,7 +467,7 @@ int iwl4965_remove_dynamic_key(struct iwl_priv *priv, } if (priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) { - IWL_WARN(priv, "Removing wrong key %d 0x%x\n", + IL_WARN(priv, "Removing wrong key %d 0x%x\n", keyconf->keyidx, key_flags); spin_unlock_irqrestore(&priv->sta_lock, flags); return 0; @@ -475,32 +475,32 @@ int iwl4965_remove_dynamic_key(struct iwl_priv *priv, if (!test_and_clear_bit(priv->stations[sta_id].sta.key.key_offset, &priv->ucode_key_table)) - IWL_ERR(priv, "index %d not used in uCode key table.\n", + IL_ERR(priv, "index %d not used in uCode key table.\n", priv->stations[sta_id].sta.key.key_offset); memset(&priv->stations[sta_id].keyinfo, 0, - sizeof(struct iwl_hw_key)); + sizeof(struct il_hw_key)); memset(&priv->stations[sta_id].sta.key, 0, - sizeof(struct iwl4965_keyinfo)); + sizeof(struct il4965_keyinfo)); priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID; priv->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET; priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - if (iwl_legacy_is_rfkill(priv)) { - IWL_DEBUG_WEP(priv, + if (il_is_rfkill(priv)) { + IL_DEBUG_WEP(priv, "Not sending REPLY_ADD_STA command because RFKILL enabled.\n"); spin_unlock_irqrestore(&priv->sta_lock, flags); return 0; } memcpy(&sta_cmd, &priv->stations[sta_id].sta, - sizeof(struct iwl_legacy_addsta_cmd)); + sizeof(struct il_addsta_cmd)); spin_unlock_irqrestore(&priv->sta_lock, flags); - return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); + return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); } -int iwl4965_set_dynamic_key(struct iwl_priv *priv, struct iwl_rxon_context *ctx, +int il4965_set_dynamic_key(struct il_priv *priv, struct il_rxon_context *ctx, struct ieee80211_key_conf *keyconf, u8 sta_id) { int ret; @@ -512,26 +512,26 @@ int iwl4965_set_dynamic_key(struct iwl_priv *priv, struct iwl_rxon_context *ctx, switch (keyconf->cipher) { case WLAN_CIPHER_SUITE_CCMP: - ret = iwl4965_set_ccmp_dynamic_key_info(priv, ctx, + ret = il4965_set_ccmp_dynamic_key_info(priv, ctx, keyconf, sta_id); break; case WLAN_CIPHER_SUITE_TKIP: - ret = iwl4965_set_tkip_dynamic_key_info(priv, ctx, + ret = il4965_set_tkip_dynamic_key_info(priv, ctx, keyconf, sta_id); break; case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: - ret = iwl4965_set_wep_dynamic_key_info(priv, ctx, + ret = il4965_set_wep_dynamic_key_info(priv, ctx, keyconf, sta_id); break; default: - IWL_ERR(priv, + IL_ERR(priv, "Unknown alg: %s cipher = %x\n", __func__, keyconf->cipher); ret = -EINVAL; } - IWL_DEBUG_WEP(priv, + IL_DEBUG_WEP(priv, "Set dynamic key: cipher=%x len=%d idx=%d sta=%d ret=%d\n", keyconf->cipher, keyconf->keylen, keyconf->keyidx, sta_id, ret); @@ -540,36 +540,36 @@ int iwl4965_set_dynamic_key(struct iwl_priv *priv, struct iwl_rxon_context *ctx, } /** - * iwl4965_alloc_bcast_station - add broadcast station into driver's station table. + * il4965_alloc_bcast_station - add broadcast station into driver's station table. * * This adds the broadcast station into the driver's station table * and marks it driver active, so that it will be restored to the * device at the next best time. */ -int iwl4965_alloc_bcast_station(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +int il4965_alloc_bcast_station(struct il_priv *priv, + struct il_rxon_context *ctx) { - struct iwl_link_quality_cmd *link_cmd; + struct il_link_quality_cmd *link_cmd; unsigned long flags; u8 sta_id; spin_lock_irqsave(&priv->sta_lock, flags); - sta_id = iwl_legacy_prep_station(priv, ctx, iwlegacy_bcast_addr, + sta_id = il_prep_station(priv, ctx, iwlegacy_bcast_addr, false, NULL); - if (sta_id == IWL_INVALID_STATION) { - IWL_ERR(priv, "Unable to prepare broadcast station\n"); + if (sta_id == IL_INVALID_STATION) { + IL_ERR(priv, "Unable to prepare broadcast station\n"); spin_unlock_irqrestore(&priv->sta_lock, flags); return -EINVAL; } - priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; - priv->stations[sta_id].used |= IWL_STA_BCAST; + priv->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE; + priv->stations[sta_id].used |= IL_STA_BCAST; spin_unlock_irqrestore(&priv->sta_lock, flags); - link_cmd = iwl4965_sta_alloc_lq(priv, sta_id); + link_cmd = il4965_sta_alloc_lq(priv, sta_id); if (!link_cmd) { - IWL_ERR(priv, + IL_ERR(priv, "Unable to initialize rate scaling for bcast station.\n"); return -ENOMEM; } @@ -582,21 +582,21 @@ int iwl4965_alloc_bcast_station(struct iwl_priv *priv, } /** - * iwl4965_update_bcast_station - update broadcast station's LQ command + * il4965_update_bcast_station - update broadcast station's LQ command * * Only used by iwl4965. Placed here to have all bcast station management * code together. */ -static int iwl4965_update_bcast_station(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +static int il4965_update_bcast_station(struct il_priv *priv, + struct il_rxon_context *ctx) { unsigned long flags; - struct iwl_link_quality_cmd *link_cmd; + struct il_link_quality_cmd *link_cmd; u8 sta_id = ctx->bcast_sta_id; - link_cmd = iwl4965_sta_alloc_lq(priv, sta_id); + link_cmd = il4965_sta_alloc_lq(priv, sta_id); if (!link_cmd) { - IWL_ERR(priv, + IL_ERR(priv, "Unable to initialize rate scaling for bcast station.\n"); return -ENOMEM; } @@ -605,7 +605,7 @@ static int iwl4965_update_bcast_station(struct iwl_priv *priv, if (priv->stations[sta_id].lq) kfree(priv->stations[sta_id].lq); else - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Bcast station rate scaling has not been initialized yet.\n"); priv->stations[sta_id].lq = link_cmd; spin_unlock_irqrestore(&priv->sta_lock, flags); @@ -613,13 +613,13 @@ static int iwl4965_update_bcast_station(struct iwl_priv *priv, return 0; } -int iwl4965_update_bcast_stations(struct iwl_priv *priv) +int il4965_update_bcast_stations(struct il_priv *priv) { - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; int ret = 0; for_each_context(priv, ctx) { - ret = iwl4965_update_bcast_station(priv, ctx); + ret = il4965_update_bcast_station(priv, ctx); if (ret) break; } @@ -628,12 +628,12 @@ int iwl4965_update_bcast_stations(struct iwl_priv *priv) } /** - * iwl4965_sta_tx_modify_enable_tid - Enable Tx for this TID in station table + * il4965_sta_tx_modify_enable_tid - Enable Tx for this TID in station table */ -int iwl4965_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) +int il4965_sta_tx_modify_enable_tid(struct il_priv *priv, int sta_id, int tid) { unsigned long flags; - struct iwl_legacy_addsta_cmd sta_cmd; + struct il_addsta_cmd sta_cmd; lockdep_assert_held(&priv->mutex); @@ -643,23 +643,23 @@ int iwl4965_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid)); priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; memcpy(&sta_cmd, &priv->stations[sta_id].sta, - sizeof(struct iwl_legacy_addsta_cmd)); + sizeof(struct il_addsta_cmd)); spin_unlock_irqrestore(&priv->sta_lock, flags); - return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); + return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); } -int iwl4965_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, +int il4965_sta_rx_agg_start(struct il_priv *priv, struct ieee80211_sta *sta, int tid, u16 ssn) { unsigned long flags; int sta_id; - struct iwl_legacy_addsta_cmd sta_cmd; + struct il_addsta_cmd sta_cmd; lockdep_assert_held(&priv->mutex); - sta_id = iwl_legacy_sta_id(sta); - if (sta_id == IWL_INVALID_STATION) + sta_id = il_sta_id(sta); + if (sta_id == IL_INVALID_STATION) return -ENXIO; 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, priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; memcpy(&sta_cmd, &priv->stations[sta_id].sta, - sizeof(struct iwl_legacy_addsta_cmd)); + sizeof(struct il_addsta_cmd)); spin_unlock_irqrestore(&priv->sta_lock, flags); - return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); + return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); } -int iwl4965_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, +int il4965_sta_rx_agg_stop(struct il_priv *priv, struct ieee80211_sta *sta, int tid) { unsigned long flags; int sta_id; - struct iwl_legacy_addsta_cmd sta_cmd; + struct il_addsta_cmd sta_cmd; lockdep_assert_held(&priv->mutex); - sta_id = iwl_legacy_sta_id(sta); - if (sta_id == IWL_INVALID_STATION) { - IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); + sta_id = il_sta_id(sta); + if (sta_id == IL_INVALID_STATION) { + IL_ERR(priv, "Invalid station for AGG tid %d\n", tid); return -ENXIO; } @@ -696,14 +696,14 @@ int iwl4965_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; memcpy(&sta_cmd, &priv->stations[sta_id].sta, - sizeof(struct iwl_legacy_addsta_cmd)); + sizeof(struct il_addsta_cmd)); spin_unlock_irqrestore(&priv->sta_lock, flags); - return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); + return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); } void -iwl4965_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) +il4965_sta_modify_sleep_tx_count(struct il_priv *priv, int sta_id, int cnt) { unsigned long flags; @@ -714,7 +714,7 @@ iwl4965_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) STA_MODIFY_SLEEP_TX_COUNT_MSK; priv->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt); priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - iwl_legacy_send_add_sta(priv, + il_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); spin_unlock_irqrestore(&priv->sta_lock, flags); diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c index e421fdf..3fdb9d9 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[] = { IEEE80211_AC_VO }; -static inline int iwl4965_get_ac_from_tid(u16 tid) +static inline int il4965_get_ac_from_tid(u16 tid) { if (likely(tid < ARRAY_SIZE(tid_to_ac))) return tid_to_ac[tid]; @@ -87,7 +87,7 @@ static inline int iwl4965_get_ac_from_tid(u16 tid) } static inline int -iwl4965_get_fifo_from_tid(struct iwl_rxon_context *ctx, u16 tid) +il4965_get_fifo_from_tid(struct il_rxon_context *ctx, u16 tid) { if (likely(tid < ARRAY_SIZE(tid_to_ac))) 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) /* * handle build REPLY_TX command notification. */ -static void iwl4965_tx_cmd_build_basic(struct iwl_priv *priv, +static void il4965_tx_cmd_build_basic(struct il_priv *priv, struct sk_buff *skb, - struct iwl_tx_cmd *tx_cmd, + struct il_tx_cmd *tx_cmd, struct ieee80211_tx_info *info, struct ieee80211_hdr *hdr, u8 std_id) @@ -137,7 +137,7 @@ static void iwl4965_tx_cmd_build_basic(struct iwl_priv *priv, tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; } - iwl_legacy_tx_cmd_protection(priv, info, fc, &tx_flags); + il_tx_cmd_protection(priv, info, fc, &tx_flags); tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); if (ieee80211_is_mgmt(fc)) { @@ -156,8 +156,8 @@ static void iwl4965_tx_cmd_build_basic(struct iwl_priv *priv, #define RTS_DFAULT_RETRY_LIMIT 60 -static void iwl4965_tx_cmd_build_rate(struct iwl_priv *priv, - struct iwl_tx_cmd *tx_cmd, +static void il4965_tx_cmd_build_rate(struct il_priv *priv, + struct il_tx_cmd *tx_cmd, struct ieee80211_tx_info *info, __le16 fc) { @@ -196,34 +196,34 @@ static void iwl4965_tx_cmd_build_rate(struct iwl_priv *priv, */ rate_idx = info->control.rates[0].idx; if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS || - (rate_idx < 0) || (rate_idx > IWL_RATE_COUNT_LEGACY)) + (rate_idx < 0) || (rate_idx > IL_RATE_COUNT_LEGACY)) rate_idx = rate_lowest_index(&priv->bands[info->band], info->control.sta); /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ if (info->band == IEEE80211_BAND_5GHZ) - rate_idx += IWL_FIRST_OFDM_RATE; + rate_idx += IL_FIRST_OFDM_RATE; /* Get PLCP rate for tx_cmd->rate_n_flags */ rate_plcp = iwlegacy_rates[rate_idx].plcp; /* Zero out flags for this packet */ rate_flags = 0; /* Set CCK flag as needed */ - if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE)) + if ((rate_idx >= IL_FIRST_CCK_RATE) && (rate_idx <= IL_LAST_CCK_RATE)) rate_flags |= RATE_MCS_CCK_MSK; /* Set up antennas */ - priv->mgmt_tx_ant = iwl4965_toggle_tx_ant(priv, priv->mgmt_tx_ant, + priv->mgmt_tx_ant = il4965_toggle_tx_ant(priv, priv->mgmt_tx_ant, priv->hw_params.valid_tx_ant); - rate_flags |= iwl4965_ant_idx_to_flags(priv->mgmt_tx_ant); + rate_flags |= il4965_ant_idx_to_flags(priv->mgmt_tx_ant); /* Set the rate in the TX cmd */ - tx_cmd->rate_n_flags = iwl4965_hw_set_rate_n_flags(rate_plcp, rate_flags); + tx_cmd->rate_n_flags = il4965_hw_set_rate_n_flags(rate_plcp, rate_flags); } -static void iwl4965_tx_cmd_build_hwcrypto(struct iwl_priv *priv, +static void il4965_tx_cmd_build_hwcrypto(struct il_priv *priv, struct ieee80211_tx_info *info, - struct iwl_tx_cmd *tx_cmd, + struct il_tx_cmd *tx_cmd, struct sk_buff *skb_frag, int sta_id) { @@ -235,13 +235,13 @@ static void iwl4965_tx_cmd_build_hwcrypto(struct iwl_priv *priv, memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); if (info->flags & IEEE80211_TX_CTL_AMPDU) tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK; - IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); + IL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); break; case WLAN_CIPHER_SUITE_TKIP: tx_cmd->sec_ctl = TX_CMD_SEC_TKIP; ieee80211_get_tkip_p2k(keyconf, skb_frag, tx_cmd->key); - IWL_DEBUG_TX(priv, "tx_cmd with tkip hwcrypto\n"); + IL_DEBUG_TX(priv, "tx_cmd with tkip hwcrypto\n"); break; case WLAN_CIPHER_SUITE_WEP104: @@ -253,12 +253,12 @@ static void iwl4965_tx_cmd_build_hwcrypto(struct iwl_priv *priv, memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen); - IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption " + IL_DEBUG_TX(priv, "Configuring packet for WEP encryption " "with key %d\n", keyconf->keyidx); break; default: - IWL_ERR(priv, "Unknown encode cipher %x\n", keyconf->cipher); + IL_ERR(priv, "Unknown encode cipher %x\n", keyconf->cipher); break; } } @@ -266,18 +266,18 @@ static void iwl4965_tx_cmd_build_hwcrypto(struct iwl_priv *priv, /* * start REPLY_TX command process */ -int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) +int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_sta *sta = info->control.sta; - struct iwl_station_priv *sta_priv = NULL; - struct iwl_tx_queue *txq; - struct iwl_queue *q; - struct iwl_device_cmd *out_cmd; - struct iwl_cmd_meta *out_meta; - struct iwl_tx_cmd *tx_cmd; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_station_priv *sta_priv = NULL; + struct il_tx_queue *txq; + struct il_queue *q; + struct il_device_cmd *out_cmd; + struct il_cmd_meta *out_meta; + struct il_tx_cmd *tx_cmd; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; int txq_id; dma_addr_t phys_addr; dma_addr_t txcmd_phys; @@ -294,11 +294,11 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) bool is_agg = false; if (info->control.vif) - ctx = iwl_legacy_rxon_ctx_from_vif(info->control.vif); + ctx = il_rxon_ctx_from_vif(info->control.vif); spin_lock_irqsave(&priv->lock, flags); - if (iwl_legacy_is_rfkill(priv)) { - IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); + if (il_is_rfkill(priv)) { + IL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); goto drop_unlock; } @@ -306,11 +306,11 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG if (ieee80211_is_auth(fc)) - IWL_DEBUG_TX(priv, "Sending AUTH frame\n"); + IL_DEBUG_TX(priv, "Sending AUTH frame\n"); else if (ieee80211_is_assoc_req(fc)) - IWL_DEBUG_TX(priv, "Sending ASSOC frame\n"); + IL_DEBUG_TX(priv, "Sending ASSOC frame\n"); else if (ieee80211_is_reassoc_req(fc)) - IWL_DEBUG_TX(priv, "Sending REASSOC frame\n"); + IL_DEBUG_TX(priv, "Sending REASSOC frame\n"); #endif hdr_len = ieee80211_hdrlen(fc); @@ -320,16 +320,16 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) sta_id = ctx->bcast_sta_id; else { /* Find index into station table for destination station */ - sta_id = iwl_legacy_sta_id_or_broadcast(priv, ctx, info->control.sta); + sta_id = il_sta_id_or_broadcast(priv, ctx, info->control.sta); - if (sta_id == IWL_INVALID_STATION) { - IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", + if (sta_id == IL_INVALID_STATION) { + IL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", hdr->addr1); goto drop_unlock; } } - IWL_DEBUG_TX(priv, "station Id %d\n", sta_id); + IL_DEBUG_TX(priv, "station Id %d\n", sta_id); if (sta) sta_priv = (void *)sta->drv_priv; @@ -345,7 +345,7 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) * For now set the counter to just 1 since we do not * support uAPSD yet. */ - iwl4965_sta_modify_sleep_tx_count(priv, sta_id, 1); + il4965_sta_modify_sleep_tx_count(priv, sta_id, 1); } /* @@ -381,7 +381,7 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) seq_number += 0x10; /* aggregation is on for this */ if (info->flags & IEEE80211_TX_CTL_AMPDU && - priv->stations[sta_id].tid[tid].agg.state == IWL_AGG_ON) { + priv->stations[sta_id].tid[tid].agg.state == IL_AGG_ON) { txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; is_agg = true; } @@ -390,7 +390,7 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) txq = &priv->txq[txq_id]; q = &txq->q; - if (unlikely(iwl_legacy_queue_space(q) < q->high_mark)) { + if (unlikely(il_queue_space(q) < q->high_mark)) { spin_unlock(&priv->sta_lock); goto drop_unlock; } @@ -404,7 +404,7 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) spin_unlock(&priv->sta_lock); /* Set up driver data for this TFD */ - memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); + memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info)); txq->txb[q->write_ptr].skb = skb; txq->txb[q->write_ptr].ctx = ctx; @@ -413,7 +413,7 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) out_meta = &txq->meta[q->write_ptr]; tx_cmd = &out_cmd->cmd.tx; memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); - memset(tx_cmd, 0, sizeof(struct iwl_tx_cmd)); + memset(tx_cmd, 0, sizeof(struct il_tx_cmd)); /* * Set up the Tx-command (not MAC!) header. @@ -434,15 +434,15 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) tx_cmd->len = cpu_to_le16(len); if (info->control.hw_key) - iwl4965_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); + il4965_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); /* TODO need this for burst mode later on */ - iwl4965_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); - iwl_legacy_dbg_log_tx_data_frame(priv, len, hdr); + il4965_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); + il_dbg_log_tx_data_frame(priv, len, hdr); - iwl4965_tx_cmd_build_rate(priv, tx_cmd, info, fc); + il4965_tx_cmd_build_rate(priv, tx_cmd, info, fc); - iwl_legacy_update_stats(priv, true, fc, len); + il_update_stats(priv, true, fc, len); /* * Use the first empty entry in this queue's command buffer array * 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) * of the MAC header (device reads on dword boundaries). * We'll tell device about this padding later. */ - len = sizeof(struct iwl_tx_cmd) + - sizeof(struct iwl_cmd_header) + hdr_len; + len = sizeof(struct il_tx_cmd) + + sizeof(struct il_cmd_header) + hdr_len; firstlen = (len + 3) & ~3; /* 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) 0, 0); } - scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + - offsetof(struct iwl_tx_cmd, scratch); + scratch_phys = txcmd_phys + sizeof(struct il_cmd_header) + + offsetof(struct il_tx_cmd, scratch); /* take back ownership of DMA buffer to enable update */ pci_dma_sync_single_for_cpu(priv->pci_dev, txcmd_phys, firstlen, PCI_DMA_BIDIRECTIONAL); tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); - tx_cmd->dram_msb_ptr = iwl_legacy_get_dma_hi_addr(scratch_phys); + tx_cmd->dram_msb_ptr = il_get_dma_hi_addr(scratch_phys); - IWL_DEBUG_TX(priv, "sequence nr = 0X%x\n", + IL_DEBUG_TX(priv, "sequence nr = 0X%x\n", le16_to_cpu(out_cmd->hdr.sequence)); - IWL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); - iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); - iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); + IL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); + il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); + il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); /* Set up entry for this TFD in Tx byte-count array */ if (info->flags & IEEE80211_TX_CTL_AMPDU) @@ -514,8 +514,8 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) firstlen, PCI_DMA_BIDIRECTIONAL); /* Tell device the write index *just past* this latest filled TFD */ - q->write_ptr = iwl_legacy_queue_inc_wrap(q->write_ptr, q->n_bd); - iwl_legacy_txq_update_write_ptr(priv, txq); + q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); + il_txq_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); /* @@ -535,15 +535,15 @@ int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) if (sta_priv && sta_priv->client && !is_agg) atomic_inc(&sta_priv->pending_frames); - if ((iwl_legacy_queue_space(q) < q->high_mark) && + if ((il_queue_space(q) < q->high_mark) && priv->mac80211_registered) { if (wait_write_ptr) { spin_lock_irqsave(&priv->lock, flags); txq->need_update = 1; - iwl_legacy_txq_update_write_ptr(priv, txq); + il_txq_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); } else { - iwl_legacy_stop_queue(priv, txq); + il_stop_queue(priv, txq); } } @@ -554,8 +554,8 @@ drop_unlock: return -1; } -static inline int iwl4965_alloc_dma_ptr(struct iwl_priv *priv, - struct iwl_dma_ptr *ptr, size_t size) +static inline int il4965_alloc_dma_ptr(struct il_priv *priv, + struct il_dma_ptr *ptr, size_t size) { ptr->addr = dma_alloc_coherent(&priv->pci_dev->dev, size, &ptr->dma, GFP_KERNEL); @@ -565,8 +565,8 @@ static inline int iwl4965_alloc_dma_ptr(struct iwl_priv *priv, return 0; } -static inline void iwl4965_free_dma_ptr(struct iwl_priv *priv, - struct iwl_dma_ptr *ptr) +static inline void il4965_free_dma_ptr(struct il_priv *priv, + struct il_dma_ptr *ptr) { if (unlikely(!ptr->addr)) return; @@ -576,11 +576,11 @@ static inline void iwl4965_free_dma_ptr(struct iwl_priv *priv, } /** - * iwl4965_hw_txq_ctx_free - Free TXQ Context + * il4965_hw_txq_ctx_free - Free TXQ Context * * Destroy all TX DMA queues and structures */ -void iwl4965_hw_txq_ctx_free(struct iwl_priv *priv) +void il4965_hw_txq_ctx_free(struct il_priv *priv) { int txq_id; @@ -588,59 +588,59 @@ void iwl4965_hw_txq_ctx_free(struct iwl_priv *priv) if (priv->txq) { for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) if (txq_id == priv->cmd_queue) - iwl_legacy_cmd_queue_free(priv); + il_cmd_queue_free(priv); else - iwl_legacy_tx_queue_free(priv, txq_id); + il_tx_queue_free(priv, txq_id); } - iwl4965_free_dma_ptr(priv, &priv->kw); + il4965_free_dma_ptr(priv, &priv->kw); - iwl4965_free_dma_ptr(priv, &priv->scd_bc_tbls); + il4965_free_dma_ptr(priv, &priv->scd_bc_tbls); /* free tx queue structure */ - iwl_legacy_txq_mem(priv); + il_txq_mem(priv); } /** - * iwl4965_txq_ctx_alloc - allocate TX queue context + * il4965_txq_ctx_alloc - allocate TX queue context * Allocate all Tx DMA structures and initialize them * * @param priv * @return error code */ -int iwl4965_txq_ctx_alloc(struct iwl_priv *priv) +int il4965_txq_ctx_alloc(struct il_priv *priv) { int ret; int txq_id, slots_num; unsigned long flags; /* Free all tx/cmd queues and keep-warm buffer */ - iwl4965_hw_txq_ctx_free(priv); + il4965_hw_txq_ctx_free(priv); - ret = iwl4965_alloc_dma_ptr(priv, &priv->scd_bc_tbls, + ret = il4965_alloc_dma_ptr(priv, &priv->scd_bc_tbls, priv->hw_params.scd_bc_tbls_size); if (ret) { - IWL_ERR(priv, "Scheduler BC Table allocation failed\n"); + IL_ERR(priv, "Scheduler BC Table allocation failed\n"); goto error_bc_tbls; } /* Alloc keep-warm buffer */ - ret = iwl4965_alloc_dma_ptr(priv, &priv->kw, IWL_KW_SIZE); + ret = il4965_alloc_dma_ptr(priv, &priv->kw, IL_KW_SIZE); if (ret) { - IWL_ERR(priv, "Keep Warm allocation failed\n"); + IL_ERR(priv, "Keep Warm allocation failed\n"); goto error_kw; } /* allocate tx queue structure */ - ret = iwl_legacy_alloc_txq_mem(priv); + ret = il_alloc_txq_mem(priv); if (ret) goto error; spin_lock_irqsave(&priv->lock, flags); /* Turn off all Tx DMA fifos */ - iwl4965_txq_set_sched(priv, 0); + il4965_txq_set_sched(priv, 0); /* Tell NIC where to find the "keep warm" buffer */ - iwl_legacy_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); + il_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); spin_unlock_irqrestore(&priv->lock, flags); @@ -648,11 +648,11 @@ int iwl4965_txq_ctx_alloc(struct iwl_priv *priv) for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { slots_num = (txq_id == priv->cmd_queue) ? TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; - ret = iwl_legacy_tx_queue_init(priv, + ret = il_tx_queue_init(priv, &priv->txq[txq_id], slots_num, txq_id); if (ret) { - IWL_ERR(priv, "Tx %d queue init failed\n", txq_id); + IL_ERR(priv, "Tx %d queue init failed\n", txq_id); goto error; } } @@ -660,15 +660,15 @@ int iwl4965_txq_ctx_alloc(struct iwl_priv *priv) return ret; error: - iwl4965_hw_txq_ctx_free(priv); - iwl4965_free_dma_ptr(priv, &priv->kw); + il4965_hw_txq_ctx_free(priv); + il4965_free_dma_ptr(priv, &priv->kw); error_kw: - iwl4965_free_dma_ptr(priv, &priv->scd_bc_tbls); + il4965_free_dma_ptr(priv, &priv->scd_bc_tbls); error_bc_tbls: return ret; } -void iwl4965_txq_ctx_reset(struct iwl_priv *priv) +void il4965_txq_ctx_reset(struct il_priv *priv) { int txq_id, slots_num; unsigned long flags; @@ -676,10 +676,10 @@ void iwl4965_txq_ctx_reset(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); /* Turn off all Tx DMA fifos */ - iwl4965_txq_set_sched(priv, 0); + il4965_txq_set_sched(priv, 0); /* Tell NIC where to find the "keep warm" buffer */ - iwl_legacy_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); + il_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); spin_unlock_irqrestore(&priv->lock, flags); @@ -687,15 +687,15 @@ void iwl4965_txq_ctx_reset(struct iwl_priv *priv) for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { slots_num = txq_id == priv->cmd_queue ? TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; - iwl_legacy_tx_queue_reset(priv, &priv->txq[txq_id], + il_tx_queue_reset(priv, &priv->txq[txq_id], slots_num, txq_id); } } /** - * iwl4965_txq_ctx_stop - Stop all Tx DMA channels + * il4965_txq_ctx_stop - Stop all Tx DMA channels */ -void iwl4965_txq_ctx_stop(struct iwl_priv *priv) +void il4965_txq_ctx_stop(struct il_priv *priv) { int ch, txq_id; unsigned long flags; @@ -703,18 +703,18 @@ void iwl4965_txq_ctx_stop(struct iwl_priv *priv) /* Turn off all Tx DMA fifos */ spin_lock_irqsave(&priv->lock, flags); - iwl4965_txq_set_sched(priv, 0); + il4965_txq_set_sched(priv, 0); /* Stop each Tx DMA channel, and wait for it to be idle */ for (ch = 0; ch < priv->hw_params.dma_chnl_num; ch++) { - iwl_legacy_write_direct32(priv, + il_write_direct32(priv, FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0); - if (iwl_poll_direct_bit(priv, FH_TSSR_TX_STATUS_REG, + if (il_poll_direct_bit(priv, FH_TSSR_TX_STATUS_REG, FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), 1000)) - IWL_ERR(priv, "Failing on timeout while stopping" + IL_ERR(priv, "Failing on timeout while stopping" " DMA channel %d [0x%08x]", ch, - iwl_legacy_read_direct32(priv, + il_read_direct32(priv, FH_TSSR_TX_STATUS_REG)); } spin_unlock_irqrestore(&priv->lock, flags); @@ -725,9 +725,9 @@ void iwl4965_txq_ctx_stop(struct iwl_priv *priv) /* Unmap DMA from host system and free skb's */ for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) if (txq_id == priv->cmd_queue) - iwl_legacy_cmd_queue_unmap(priv); + il_cmd_queue_unmap(priv); else - iwl_legacy_tx_queue_unmap(priv, txq_id); + il_tx_queue_unmap(priv, txq_id); } /* @@ -736,7 +736,7 @@ void iwl4965_txq_ctx_stop(struct iwl_priv *priv) * Should never return anything < 7, because they should already * be in use as EDCA AC (0-3), Command (4), reserved (5, 6) */ -static int iwl4965_txq_ctx_activate_free(struct iwl_priv *priv) +static int il4965_txq_ctx_activate_free(struct il_priv *priv) { int txq_id; @@ -747,53 +747,53 @@ static int iwl4965_txq_ctx_activate_free(struct iwl_priv *priv) } /** - * iwl4965_tx_queue_stop_scheduler - Stop queue, but keep configuration + * il4965_tx_queue_stop_scheduler - Stop queue, but keep configuration */ -static void iwl4965_tx_queue_stop_scheduler(struct iwl_priv *priv, +static void il4965_tx_queue_stop_scheduler(struct il_priv *priv, u16 txq_id) { /* Simply stop the queue, but don't change any configuration; * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */ - iwl_legacy_write_prph(priv, + il_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), (0 << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE)| (1 << IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); } /** - * iwl4965_tx_queue_set_q2ratid - Map unique receiver/tid combination to a queue + * il4965_tx_queue_set_q2ratid - Map unique receiver/tid combination to a queue */ -static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, +static int il4965_tx_queue_set_q2ratid(struct il_priv *priv, u16 ra_tid, u16 txq_id) { u32 tbl_dw_addr; u32 tbl_dw; u16 scd_q2ratid; - scd_q2ratid = ra_tid & IWL_SCD_QUEUE_RA_TID_MAP_RATID_MSK; + scd_q2ratid = ra_tid & IL_SCD_QUEUE_RA_TID_MAP_RATID_MSK; tbl_dw_addr = priv->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); - tbl_dw = iwl_legacy_read_targ_mem(priv, tbl_dw_addr); + tbl_dw = il_read_targ_mem(priv, tbl_dw_addr); if (txq_id & 0x1) tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF); else tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000); - iwl_legacy_write_targ_mem(priv, tbl_dw_addr, tbl_dw); + il_write_targ_mem(priv, tbl_dw_addr, tbl_dw); return 0; } /** - * iwl4965_tx_queue_agg_enable - Set up & enable aggregation for selected queue + * il4965_tx_queue_agg_enable - Set up & enable aggregation for selected queue * * NOTE: txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE, * i.e. it must be one of the higher queues used for aggregation */ -static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id, +static int il4965_txq_agg_enable(struct il_priv *priv, int txq_id, int tx_fifo, int sta_id, int tid, u16 ssn_idx) { unsigned long flags; @@ -803,7 +803,7 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id, if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || (IWL49_FIRST_AMPDU_QUEUE + priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) { - IWL_WARN(priv, + IL_WARN(priv, "queue number out of range: %d, must be %d to %d\n", txq_id, IWL49_FIRST_AMPDU_QUEUE, IWL49_FIRST_AMPDU_QUEUE + @@ -814,42 +814,42 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id, ra_tid = BUILD_RAxTID(sta_id, tid); /* Modify device's station table to Tx this TID */ - ret = iwl4965_sta_tx_modify_enable_tid(priv, sta_id, tid); + ret = il4965_sta_tx_modify_enable_tid(priv, sta_id, tid); if (ret) return ret; spin_lock_irqsave(&priv->lock, flags); /* Stop this Tx queue before configuring it */ - iwl4965_tx_queue_stop_scheduler(priv, txq_id); + il4965_tx_queue_stop_scheduler(priv, txq_id); /* Map receiver-address / traffic-ID to this queue */ - iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id); + il4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id); /* Set this queue as a chain-building queue */ - iwl_legacy_set_bits_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); + il_set_bits_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); /* Place first TFD at index corresponding to start sequence number. * Assumes that ssn_idx is valid (!= 0xFFF) */ priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); - iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); + il4965_set_wr_ptrs(priv, txq_id, ssn_idx); /* Set up Tx window size and frame limit for this queue */ - iwl_legacy_write_targ_mem(priv, + il_write_targ_mem(priv, priv->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id), (SCD_WIN_SIZE << IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); - iwl_legacy_write_targ_mem(priv, priv->scd_base_addr + + il_write_targ_mem(priv, priv->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), (SCD_FRAME_LIMIT << IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); - iwl_legacy_set_bits_prph(priv, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); + il_set_bits_prph(priv, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */ - iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); + il4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); spin_unlock_irqrestore(&priv->lock, flags); @@ -857,7 +857,7 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id, } -int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, +int il4965_tx_agg_start(struct il_priv *priv, struct ieee80211_vif *vif, struct ieee80211_sta *sta, u16 tid, u16 *ssn) { int sta_id; @@ -865,31 +865,31 @@ int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, int txq_id; int ret; unsigned long flags; - struct iwl_tid_data *tid_data; + struct il_tid_data *tid_data; - tx_fifo = iwl4965_get_fifo_from_tid(iwl_legacy_rxon_ctx_from_vif(vif), tid); + tx_fifo = il4965_get_fifo_from_tid(il_rxon_ctx_from_vif(vif), tid); if (unlikely(tx_fifo < 0)) return tx_fifo; - IWL_WARN(priv, "%s on ra = %pM tid = %d\n", + IL_WARN(priv, "%s on ra = %pM tid = %d\n", __func__, sta->addr, tid); - sta_id = iwl_legacy_sta_id(sta); - if (sta_id == IWL_INVALID_STATION) { - IWL_ERR(priv, "Start AGG on invalid station\n"); + sta_id = il_sta_id(sta); + if (sta_id == IL_INVALID_STATION) { + IL_ERR(priv, "Start AGG on invalid station\n"); return -ENXIO; } if (unlikely(tid >= MAX_TID_COUNT)) return -EINVAL; - if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) { - IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n"); + if (priv->stations[sta_id].tid[tid].agg.state != IL_AGG_OFF) { + IL_ERR(priv, "Start AGG when state is not IL_AGG_OFF !\n"); return -ENXIO; } - txq_id = iwl4965_txq_ctx_activate_free(priv); + txq_id = il4965_txq_ctx_activate_free(priv); if (txq_id == -1) { - IWL_ERR(priv, "No free aggregation queue available\n"); + IL_ERR(priv, "No free aggregation queue available\n"); return -ENXIO; } @@ -897,11 +897,11 @@ int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, tid_data = &priv->stations[sta_id].tid[tid]; *ssn = SEQ_TO_SN(tid_data->seq_number); tid_data->agg.txq_id = txq_id; - iwl_legacy_set_swq_id(&priv->txq[txq_id], - iwl4965_get_ac_from_tid(tid), txq_id); + il_set_swq_id(&priv->txq[txq_id], + il4965_get_ac_from_tid(tid), txq_id); spin_unlock_irqrestore(&priv->sta_lock, flags); - ret = iwl4965_txq_agg_enable(priv, txq_id, tx_fifo, + ret = il4965_txq_agg_enable(priv, txq_id, tx_fifo, sta_id, tid, *ssn); if (ret) return ret; @@ -909,14 +909,14 @@ int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, spin_lock_irqsave(&priv->sta_lock, flags); tid_data = &priv->stations[sta_id].tid[tid]; if (tid_data->tfds_in_queue == 0) { - IWL_DEBUG_HT(priv, "HW queue is empty\n"); - tid_data->agg.state = IWL_AGG_ON; + IL_DEBUG_HT(priv, "HW queue is empty\n"); + tid_data->agg.state = IL_AGG_ON; ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); } else { - IWL_DEBUG_HT(priv, + IL_DEBUG_HT(priv, "HW queue is NOT empty: %d packets in HW queue\n", tid_data->tfds_in_queue); - tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA; + tid_data->agg.state = IL_EMPTYING_HW_QUEUE_ADDBA; } spin_unlock_irqrestore(&priv->sta_lock, flags); return ret; @@ -926,13 +926,13 @@ int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, * txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE * priv->lock must be held by the caller */ -static int iwl4965_txq_agg_disable(struct iwl_priv *priv, u16 txq_id, +static int il4965_txq_agg_disable(struct il_priv *priv, u16 txq_id, u16 ssn_idx, u8 tx_fifo) { if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || (IWL49_FIRST_AMPDU_QUEUE + priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) { - IWL_WARN(priv, + IL_WARN(priv, "queue number out of range: %d, must be %d to %d\n", txq_id, IWL49_FIRST_AMPDU_QUEUE, IWL49_FIRST_AMPDU_QUEUE + @@ -940,40 +940,40 @@ static int iwl4965_txq_agg_disable(struct iwl_priv *priv, u16 txq_id, return -EINVAL; } - iwl4965_tx_queue_stop_scheduler(priv, txq_id); + il4965_tx_queue_stop_scheduler(priv, txq_id); - iwl_legacy_clear_bits_prph(priv, + il_clear_bits_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); /* supposes that ssn_idx is valid (!= 0xFFF) */ - iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); + il4965_set_wr_ptrs(priv, txq_id, ssn_idx); - iwl_legacy_clear_bits_prph(priv, + il_clear_bits_prph(priv, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); - iwl_txq_ctx_deactivate(priv, txq_id); - iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0); + il_txq_ctx_deactivate(priv, txq_id); + il4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0); return 0; } -int iwl4965_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, +int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif, struct ieee80211_sta *sta, u16 tid) { int tx_fifo_id, txq_id, sta_id, ssn; - struct iwl_tid_data *tid_data; + struct il_tid_data *tid_data; int write_ptr, read_ptr; unsigned long flags; - tx_fifo_id = iwl4965_get_fifo_from_tid(iwl_legacy_rxon_ctx_from_vif(vif), tid); + tx_fifo_id = il4965_get_fifo_from_tid(il_rxon_ctx_from_vif(vif), tid); if (unlikely(tx_fifo_id < 0)) return tx_fifo_id; - sta_id = iwl_legacy_sta_id(sta); + sta_id = il_sta_id(sta); - if (sta_id == IWL_INVALID_STATION) { - IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); + if (sta_id == IL_INVALID_STATION) { + IL_ERR(priv, "Invalid station for AGG tid %d\n", tid); return -ENXIO; } @@ -984,19 +984,19 @@ int iwl4965_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, txq_id = tid_data->agg.txq_id; switch (priv->stations[sta_id].tid[tid].agg.state) { - case IWL_EMPTYING_HW_QUEUE_ADDBA: + case IL_EMPTYING_HW_QUEUE_ADDBA: /* * This can happen if the peer stops aggregation * again before we've had a chance to drain the * queue we selected previously, i.e. before the * session was really started completely. */ - IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); + IL_DEBUG_HT(priv, "AGG stop before setup done\n"); goto turn_off; - case IWL_AGG_ON: + case IL_AGG_ON: break; default: - IWL_WARN(priv, "Stopping AGG while state not ON or starting\n"); + IL_WARN(priv, "Stopping AGG while state not ON or starting\n"); } 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, /* The queue is not empty */ if (write_ptr != read_ptr) { - IWL_DEBUG_HT(priv, "Stopping a non empty AGG HW QUEUE\n"); + IL_DEBUG_HT(priv, "Stopping a non empty AGG HW QUEUE\n"); priv->stations[sta_id].tid[tid].agg.state = - IWL_EMPTYING_HW_QUEUE_DELBA; + IL_EMPTYING_HW_QUEUE_DELBA; spin_unlock_irqrestore(&priv->sta_lock, flags); return 0; } - IWL_DEBUG_HT(priv, "HW queue is empty\n"); + IL_DEBUG_HT(priv, "HW queue is empty\n"); turn_off: - priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; + priv->stations[sta_id].tid[tid].agg.state = IL_AGG_OFF; /* do not restore/save irqs */ spin_unlock(&priv->sta_lock); @@ -1026,7 +1026,7 @@ int iwl4965_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, * to deactivate the uCode queue, just return "success" to allow * mac80211 to clean up it own data. */ - iwl4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo_id); + il4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo_id); spin_unlock_irqrestore(&priv->lock, flags); 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, return 0; } -int iwl4965_txq_check_empty(struct iwl_priv *priv, +int il4965_txq_check_empty(struct il_priv *priv, int sta_id, u8 tid, int txq_id) { - struct iwl_queue *q = &priv->txq[txq_id].q; + struct il_queue *q = &priv->txq[txq_id].q; u8 *addr = priv->stations[sta_id].sta.sta.addr; - struct iwl_tid_data *tid_data = &priv->stations[sta_id].tid[tid]; - struct iwl_rxon_context *ctx; + struct il_tid_data *tid_data = &priv->stations[sta_id].tid[tid]; + struct il_rxon_context *ctx; ctx = &priv->contexts[priv->stations[sta_id].ctxid]; lockdep_assert_held(&priv->sta_lock); switch (priv->stations[sta_id].tid[tid].agg.state) { - case IWL_EMPTYING_HW_QUEUE_DELBA: + case IL_EMPTYING_HW_QUEUE_DELBA: /* We are reclaiming the last packet of the */ /* aggregated HW queue */ if ((txq_id == tid_data->agg.txq_id) && (q->read_ptr == q->write_ptr)) { u16 ssn = SEQ_TO_SN(tid_data->seq_number); - int tx_fifo = iwl4965_get_fifo_from_tid(ctx, tid); - IWL_DEBUG_HT(priv, + int tx_fifo = il4965_get_fifo_from_tid(ctx, tid); + IL_DEBUG_HT(priv, "HW queue empty: continue DELBA flow\n"); - iwl4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo); - tid_data->agg.state = IWL_AGG_OFF; + il4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo); + tid_data->agg.state = IL_AGG_OFF; ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid); } break; - case IWL_EMPTYING_HW_QUEUE_ADDBA: + case IL_EMPTYING_HW_QUEUE_ADDBA: /* We are reclaiming the last packet of the queue */ if (tid_data->tfds_in_queue == 0) { - IWL_DEBUG_HT(priv, + IL_DEBUG_HT(priv, "HW queue empty: continue ADDBA flow\n"); - tid_data->agg.state = IWL_AGG_ON; + tid_data->agg.state = IL_AGG_ON; ieee80211_start_tx_ba_cb_irqsafe(ctx->vif, addr, tid); } break; @@ -1075,12 +1075,12 @@ int iwl4965_txq_check_empty(struct iwl_priv *priv, return 0; } -static void iwl4965_non_agg_tx_status(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +static void il4965_non_agg_tx_status(struct il_priv *priv, + struct il_rxon_context *ctx, const u8 *addr1) { struct ieee80211_sta *sta; - struct iwl_station_priv *sta_priv; + struct il_station_priv *sta_priv; rcu_read_lock(); sta = ieee80211_find_sta(ctx->vif, addr1); @@ -1095,35 +1095,35 @@ static void iwl4965_non_agg_tx_status(struct iwl_priv *priv, } static void -iwl4965_tx_status(struct iwl_priv *priv, struct iwl_tx_info *tx_info, +il4965_tx_status(struct il_priv *priv, struct il_tx_info *tx_info, bool is_agg) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data; if (!is_agg) - iwl4965_non_agg_tx_status(priv, tx_info->ctx, hdr->addr1); + il4965_non_agg_tx_status(priv, tx_info->ctx, hdr->addr1); ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb); } -int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) +int il4965_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index) { - struct iwl_tx_queue *txq = &priv->txq[txq_id]; - struct iwl_queue *q = &txq->q; - struct iwl_tx_info *tx_info; + struct il_tx_queue *txq = &priv->txq[txq_id]; + struct il_queue *q = &txq->q; + struct il_tx_info *tx_info; int nfreed = 0; struct ieee80211_hdr *hdr; - if ((index >= q->n_bd) || (iwl_legacy_queue_used(q, index) == 0)) { - IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " + if ((index >= q->n_bd) || (il_queue_used(q, index) == 0)) { + IL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " "is out of range [0-%d] %d %d.\n", txq_id, index, q->n_bd, q->write_ptr, q->read_ptr); return 0; } - for (index = iwl_legacy_queue_inc_wrap(index, q->n_bd); + for (index = il_queue_inc_wrap(index, q->n_bd); q->read_ptr != index; - q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) { + q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { tx_info = &txq->txb[txq->q.read_ptr]; @@ -1134,7 +1134,7 @@ int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) if (ieee80211_is_data_qos(hdr->frame_control)) nfreed++; - iwl4965_tx_status(priv, tx_info, + il4965_tx_status(priv, tx_info, txq_id >= IWL4965_FIRST_AMPDU_QUEUE); tx_info->skb = NULL; @@ -1144,14 +1144,14 @@ int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) } /** - * iwl4965_tx_status_reply_compressed_ba - Update tx status from block-ack + * il4965_tx_status_reply_compressed_ba - Update tx status from block-ack * * Go through block-ack's bitmap of ACK'd frames, update driver's record of * ACK vs. not. This gets sent to mac80211, then to rate scaling algo. */ -static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv, - struct iwl_ht_agg *agg, - struct iwl_compressed_ba_resp *ba_resp) +static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, + struct il_ht_agg *agg, + struct il_compressed_ba_resp *ba_resp) { int i, sh, ack; @@ -1163,13 +1163,13 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv, if (unlikely(!agg->wait_for_ba)) { if (unlikely(ba_resp->bitmap)) - IWL_ERR(priv, "Received BA when not expected\n"); + IL_ERR(priv, "Received BA when not expected\n"); return -EINVAL; } /* Mark that the expected block-ack response arrived */ agg->wait_for_ba = 0; - IWL_DEBUG_TX_REPLY(priv, "BA %d %d\n", agg->start_idx, + IL_DEBUG_TX_REPLY(priv, "BA %d %d\n", agg->start_idx, ba_resp->seq_ctl); /* 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, sh += 0x100; if (agg->frame_count > (64 - sh)) { - IWL_DEBUG_TX_REPLY(priv, "more frames than bitmap size"); + IL_DEBUG_TX_REPLY(priv, "more frames than bitmap size"); return -1; } @@ -1195,7 +1195,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv, while (sent_bitmap) { ack = sent_bitmap & 1ULL; successes += ack; - IWL_DEBUG_TX_REPLY(priv, "%s ON i=%d idx=%d raw=%d\n", + IL_DEBUG_TX_REPLY(priv, "%s ON i=%d idx=%d raw=%d\n", ack ? "ACK" : "NACK", i, (agg->start_idx + i) & 0xff, agg->start_idx + i); @@ -1203,7 +1203,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv, ++i; } - IWL_DEBUG_TX_REPLY(priv, "Bitmap %llx\n", + IL_DEBUG_TX_REPLY(priv, "Bitmap %llx\n", (unsigned long long)bitmap); 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, info->flags |= IEEE80211_TX_STAT_AMPDU; info->status.ampdu_ack_len = successes; info->status.ampdu_len = agg->frame_count; - iwl4965_hwrate_to_tx_control(priv, agg->rate_n_flags, info); + il4965_hwrate_to_tx_control(priv, agg->rate_n_flags, info); return 0; } @@ -1220,7 +1220,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv, /** * translate ucode response to mac80211 tx status control values */ -void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, +void il4965_hwrate_to_tx_control(struct il_priv *priv, u32 rate_n_flags, struct ieee80211_tx_info *info) { 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, r->flags |= IEEE80211_TX_RC_DUP_DATA; if (rate_n_flags & RATE_MCS_SGI_MSK) r->flags |= IEEE80211_TX_RC_SHORT_GI; - r->idx = iwl4965_hwrate_to_mac80211_idx(rate_n_flags, info->band); + r->idx = il4965_hwrate_to_mac80211_idx(rate_n_flags, info->band); } /** - * iwl4965_rx_reply_compressed_ba - Handler for REPLY_COMPRESSED_BA + * il4965_rx_reply_compressed_ba - Handler for REPLY_COMPRESSED_BA * * Handles block-acknowledge notification from device, which reports success * of frames sent via aggregation. */ -void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il4965_rx_reply_compressed_ba(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba; - struct iwl_tx_queue *txq = NULL; - struct iwl_ht_agg *agg; + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba; + struct il_tx_queue *txq = NULL; + struct il_ht_agg *agg; int index; int sta_id; int tid; @@ -1266,7 +1266,7 @@ void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); if (scd_flow >= priv->hw_params.max_txq_num) { - IWL_ERR(priv, + IL_ERR(priv, "BUG_ON scd_flow is bigger than number of queues\n"); return; } @@ -1282,23 +1282,23 @@ void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, * since it is possible happen very often and in order * not to fill the syslog, don't enable the logging by default */ - IWL_DEBUG_TX_REPLY(priv, + IL_DEBUG_TX_REPLY(priv, "BA scd_flow %d does not match txq_id %d\n", scd_flow, agg->txq_id); return; } /* Find index just before block-ack window */ - index = iwl_legacy_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); + index = il_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); spin_lock_irqsave(&priv->sta_lock, flags); - IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, " + IL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, " "sta_id = %d\n", agg->wait_for_ba, (u8 *) &ba_resp->sta_addr_lo32, ba_resp->sta_id); - IWL_DEBUG_TX_REPLY(priv, "TID = %d, SeqCtl = %d, bitmap = 0x%llx," + IL_DEBUG_TX_REPLY(priv, "TID = %d, SeqCtl = %d, bitmap = 0x%llx," "scd_flow = " "%d, scd_ssn = %d\n", ba_resp->tid, @@ -1306,34 +1306,34 @@ void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, (unsigned long long)le64_to_cpu(ba_resp->bitmap), ba_resp->scd_flow, ba_resp->scd_ssn); - IWL_DEBUG_TX_REPLY(priv, "DAT start_idx = %d, bitmap = 0x%llx\n", + IL_DEBUG_TX_REPLY(priv, "DAT start_idx = %d, bitmap = 0x%llx\n", agg->start_idx, (unsigned long long)agg->bitmap); /* Update driver's record of ACK vs. not for each frame in window */ - iwl4965_tx_status_reply_compressed_ba(priv, agg, ba_resp); + il4965_tx_status_reply_compressed_ba(priv, agg, ba_resp); /* Release all TFDs before the SSN, i.e. all TFDs in front of * block-ack window (we assume that they've been successfully * transmitted ... if not, it's too late anyway). */ if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { /* calculate mac80211 ampdu sw queue to wake */ - int freed = iwl4965_tx_queue_reclaim(priv, scd_flow, index); - iwl4965_free_tfds_in_queue(priv, sta_id, tid, freed); + int freed = il4965_tx_queue_reclaim(priv, scd_flow, index); + il4965_free_tfds_in_queue(priv, sta_id, tid, freed); - if ((iwl_legacy_queue_space(&txq->q) > txq->q.low_mark) && + if ((il_queue_space(&txq->q) > txq->q.low_mark) && priv->mac80211_registered && - (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)) - iwl_legacy_wake_queue(priv, txq); + (agg->state != IL_EMPTYING_HW_QUEUE_DELBA)) + il_wake_queue(priv, txq); - iwl4965_txq_check_empty(priv, sta_id, tid, scd_flow); + il4965_txq_check_empty(priv, sta_id, tid, scd_flow); } spin_unlock_irqrestore(&priv->sta_lock, flags); } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -const char *iwl4965_get_tx_fail_reason(u32 status) +const char *il4965_get_tx_fail_reason(u32 status) { #define TX_STATUS_FAIL(x) case TX_STATUS_FAIL_ ## x: return #x #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 001d148..3c9df1b 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c @@ -40,30 +40,30 @@ #include "iwl-4965.h" #include "iwl-4965-calib.h" -#define IWL_AC_UNSET -1 +#define IL_AC_UNSET -1 /** - * iwl_verify_inst_sparse - verify runtime uCode image in card vs. host, + * il_verify_inst_sparse - verify runtime uCode image in card vs. host, * using sample data 100 bytes apart. If these sample points are good, * it's a pretty good bet that everything between them is good, too. */ static int -iwl4965_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) +il4965_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 len) { u32 val; int ret = 0; u32 errcnt = 0; u32 i; - IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); + IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log - * if IWL_DL_IO is set */ - iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, + * if IL_DL_IO is set */ + il_write_direct32(priv, HBUS_TARG_MEM_RADDR, i + IWL4965_RTC_INST_LOWER_BOUND); - val = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); + val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { ret = -EIO; errcnt++; @@ -76,10 +76,10 @@ iwl4965_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) } /** - * iwl4965_verify_inst_full - verify runtime uCode image in card vs. host, + * il4965_verify_inst_full - verify runtime uCode image in card vs. host, * looking at all data. */ -static int iwl4965_verify_inst_full(struct iwl_priv *priv, __le32 *image, +static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len) { u32 val; @@ -87,19 +87,19 @@ static int iwl4965_verify_inst_full(struct iwl_priv *priv, __le32 *image, int ret = 0; u32 errcnt; - IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); + IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); - iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, + il_write_direct32(priv, HBUS_TARG_MEM_RADDR, IWL4965_RTC_INST_LOWER_BOUND); errcnt = 0; for (; len > 0; len -= sizeof(u32), image++) { /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log - * if IWL_DL_IO is set */ - val = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); + * if IL_DL_IO is set */ + val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { - IWL_ERR(priv, "uCode INST section is invalid at " + IL_ERR(priv, "uCode INST section is invalid at " "offset 0x%x, is 0x%x, s/b 0x%x\n", save_len - len, val, le32_to_cpu(*image)); ret = -EIO; @@ -110,17 +110,17 @@ static int iwl4965_verify_inst_full(struct iwl_priv *priv, __le32 *image, } if (!errcnt) - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "ucode image in INSTRUCTION memory is good\n"); return ret; } /** - * iwl4965_verify_ucode - determine which instruction image is in SRAM, + * il4965_verify_ucode - determine which instruction image is in SRAM, * and verify its contents */ -int iwl4965_verify_ucode(struct iwl_priv *priv) +int il4965_verify_ucode(struct il_priv *priv) { __le32 *image; u32 len; @@ -129,38 +129,38 @@ int iwl4965_verify_ucode(struct iwl_priv *priv) /* Try bootstrap */ image = (__le32 *)priv->ucode_boot.v_addr; len = priv->ucode_boot.len; - ret = iwl4965_verify_inst_sparse(priv, image, len); + ret = il4965_verify_inst_sparse(priv, image, len); if (!ret) { - IWL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n"); + IL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n"); return 0; } /* Try initialize */ image = (__le32 *)priv->ucode_init.v_addr; len = priv->ucode_init.len; - ret = iwl4965_verify_inst_sparse(priv, image, len); + ret = il4965_verify_inst_sparse(priv, image, len); if (!ret) { - IWL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n"); + IL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n"); return 0; } /* Try runtime/protocol */ image = (__le32 *)priv->ucode_code.v_addr; len = priv->ucode_code.len; - ret = iwl4965_verify_inst_sparse(priv, image, len); + ret = il4965_verify_inst_sparse(priv, image, len); if (!ret) { - IWL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n"); + IL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n"); return 0; } - IWL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); + IL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); /* Since nothing seems to match, show first several data entries in * instruction SRAM, so maybe visual inspection will give a clue. * Selection of bootstrap image (vs. other images) is arbitrary. */ image = (__le32 *)priv->ucode_boot.v_addr; len = priv->ucode_boot.len; - ret = iwl4965_verify_inst_full(priv, image, len); + ret = il4965_verify_inst_full(priv, image, len); return ret; } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c index 86f4fce..0f2bc5f 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965.c @@ -48,8 +48,8 @@ #include "iwl-4965.h" #include "iwl-4965-debugfs.h" -static int iwl4965_send_tx_power(struct iwl_priv *priv); -static int iwl4965_hw_get_temperature(struct iwl_priv *priv); +static int il4965_send_tx_power(struct il_priv *priv); +static int il4965_hw_get_temperature(struct il_priv *priv); /* Highest firmware API version supported */ #define IWL4965_UCODE_API_MAX 2 @@ -62,23 +62,23 @@ static int iwl4965_hw_get_temperature(struct iwl_priv *priv); #define IWL4965_MODULE_FIRMWARE(api) _IWL4965_MODULE_FIRMWARE(api) /* check contents of special bootstrap uCode SRAM */ -static int iwl4965_verify_bsm(struct iwl_priv *priv) +static int il4965_verify_bsm(struct il_priv *priv) { __le32 *image = priv->ucode_boot.v_addr; u32 len = priv->ucode_boot.len; u32 reg; u32 val; - IWL_DEBUG_INFO(priv, "Begin verify bsm\n"); + IL_DEBUG_INFO(priv, "Begin verify bsm\n"); /* verify BSM SRAM contents */ - val = iwl_legacy_read_prph(priv, BSM_WR_DWCOUNT_REG); + val = il_read_prph(priv, BSM_WR_DWCOUNT_REG); for (reg = BSM_SRAM_LOWER_BOUND; reg < BSM_SRAM_LOWER_BOUND + len; reg += sizeof(u32), image++) { - val = iwl_legacy_read_prph(priv, reg); + val = il_read_prph(priv, reg); if (val != le32_to_cpu(*image)) { - IWL_ERR(priv, "BSM uCode verification failed at " + IL_ERR(priv, "BSM uCode verification failed at " "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", BSM_SRAM_LOWER_BOUND, reg - BSM_SRAM_LOWER_BOUND, len, @@ -87,13 +87,13 @@ static int iwl4965_verify_bsm(struct iwl_priv *priv) } } - IWL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n"); + IL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n"); return 0; } /** - * iwl4965_load_bsm - Load bootstrap instructions + * il4965_load_bsm - Load bootstrap instructions * * BSM operation: * @@ -124,7 +124,7 @@ static int iwl4965_verify_bsm(struct iwl_priv *priv) * the runtime uCode instructions and the backup data cache into SRAM, * and re-launches the runtime uCode from where it left off. */ -static int iwl4965_load_bsm(struct iwl_priv *priv) +static int il4965_load_bsm(struct il_priv *priv) { __le32 *image = priv->ucode_boot.v_addr; u32 len = priv->ucode_boot.len; @@ -137,7 +137,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv) u32 reg_offset; int ret; - IWL_DEBUG_INFO(priv, "Begin load bsm\n"); + IL_DEBUG_INFO(priv, "Begin load bsm\n"); priv->ucode_type = UCODE_RT; @@ -147,7 +147,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv) /* Tell bootstrap uCode where to find the "Initialize" uCode * in host DRAM ... host DRAM physical address bits 35:4 for 4965. - * NOTE: iwl_init_alive_start() will replace these values, + * NOTE: il_init_alive_start() will replace these values, * after the "initialize" uCode has run, to point to * runtime/protocol instructions and backup data cache. */ @@ -156,48 +156,48 @@ static int iwl4965_load_bsm(struct iwl_priv *priv) inst_len = priv->ucode_init.len; data_len = priv->ucode_init_data.len; - iwl_legacy_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_legacy_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_legacy_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); - iwl_legacy_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); + il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); + il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); /* Fill BSM memory with bootstrap instructions */ for (reg_offset = BSM_SRAM_LOWER_BOUND; reg_offset < BSM_SRAM_LOWER_BOUND + len; reg_offset += sizeof(u32), image++) - _iwl_legacy_write_prph(priv, reg_offset, le32_to_cpu(*image)); + _il_write_prph(priv, reg_offset, le32_to_cpu(*image)); - ret = iwl4965_verify_bsm(priv); + ret = il4965_verify_bsm(priv); if (ret) return ret; /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ - iwl_legacy_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); - iwl_legacy_write_prph(priv, + il_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); + il_write_prph(priv, BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND); - iwl_legacy_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); + il_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); /* Load bootstrap code into instruction SRAM now, * to prepare to load "initialize" uCode */ - iwl_legacy_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); + il_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); /* Wait for load of bootstrap uCode to finish */ for (i = 0; i < 100; i++) { - done = iwl_legacy_read_prph(priv, BSM_WR_CTRL_REG); + done = il_read_prph(priv, BSM_WR_CTRL_REG); if (!(done & BSM_WR_CTRL_REG_BIT_START)) break; udelay(10); } if (i < 100) - IWL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i); + IL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i); else { - IWL_ERR(priv, "BSM write did not complete!\n"); + IL_ERR(priv, "BSM write did not complete!\n"); return -EIO; } /* Enable future boot loads whenever power management unit triggers it * (e.g. when powering back up after power-save shutdown) */ - iwl_legacy_write_prph(priv, + il_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); @@ -205,7 +205,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv) } /** - * iwl4965_set_ucode_ptrs - Set uCode address location + * il4965_set_ucode_ptrs - Set uCode address location * * Tell initialization uCode where to find runtime uCode. * @@ -213,7 +213,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv) * We need to replace them to load runtime uCode inst and data, * and to save runtime data when powering down. */ -static int iwl4965_set_ucode_ptrs(struct iwl_priv *priv) +static int il4965_set_ucode_ptrs(struct il_priv *priv) { dma_addr_t pinst; dma_addr_t pdata; @@ -224,22 +224,22 @@ static int iwl4965_set_ucode_ptrs(struct iwl_priv *priv) pdata = priv->ucode_data_backup.p_addr >> 4; /* Tell bootstrap uCode where to find image to load */ - iwl_legacy_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_legacy_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_legacy_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, + il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, priv->ucode_data.len); /* Inst byte count must be last to set up, bit 31 signals uCode * that all new ptr/size info is in place */ - iwl_legacy_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, + il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, priv->ucode_code.len | BSM_DRAM_INST_LOAD); - IWL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); + IL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); return ret; } /** - * iwl4965_init_alive_start - Called after REPLY_ALIVE notification received + * il4965_init_alive_start - Called after REPLY_ALIVE notification received * * Called after REPLY_ALIVE notification received from "initialize" uCode. * @@ -249,29 +249,29 @@ static int iwl4965_set_ucode_ptrs(struct iwl_priv *priv) * * Tell "initialize" uCode to go ahead and load the runtime uCode. */ -static void iwl4965_init_alive_start(struct iwl_priv *priv) +static void il4965_init_alive_start(struct il_priv *priv) { /* Bootstrap uCode has loaded initialize uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "initialize" alive if code weren't properly loaded. */ - if (iwl4965_verify_ucode(priv)) { + if (il4965_verify_ucode(priv)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ - IWL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); + IL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); goto restart; } /* Calculate temperature */ - priv->temperature = iwl4965_hw_get_temperature(priv); + priv->temperature = il4965_hw_get_temperature(priv); /* Send pointers to protocol/runtime uCode image ... init code will * load and launch runtime uCode, which will send us another "Alive" * notification. */ - IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); - if (iwl4965_set_ucode_ptrs(priv)) { + IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); + if (il4965_set_ucode_ptrs(priv)) { /* Runtime instruction load won't happen; * take it all the way back down so we can try again */ - IWL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); + IL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); goto restart; } return; @@ -288,29 +288,29 @@ static bool iw4965_is_ht40_channel(__le32 rxon_flags) (chan_mod == CHANNEL_MODE_MIXED)); } -static void iwl4965_nic_config(struct iwl_priv *priv) +static void il4965_nic_config(struct il_priv *priv) { unsigned long flags; u16 radio_cfg; spin_lock_irqsave(&priv->lock, flags); - radio_cfg = iwl_legacy_eeprom_query16(priv, EEPROM_RADIO_CONFIG); + radio_cfg = il_eeprom_query16(priv, EEPROM_RADIO_CONFIG); /* write radio config values to register */ if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) == EEPROM_4965_RF_CFG_TYPE_MAX) - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | EEPROM_RF_CFG_STEP_MSK(radio_cfg) | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); /* set CSR_HW_CONFIG_REG for uCode use */ - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); - priv->calib_info = (struct iwl_eeprom_calib_info *) - iwl_legacy_eeprom_query_addr(priv, + priv->calib_info = (struct il_eeprom_calib_info *) + il_eeprom_query_addr(priv, EEPROM_4965_CALIB_TXPOWER_OFFSET); spin_unlock_irqrestore(&priv->lock, flags); @@ -319,13 +319,13 @@ static void iwl4965_nic_config(struct iwl_priv *priv) /* Reset differential Rx gains in NIC to prepare for chain noise calibration. * Called after every association, but this runs only once! * ... once chain noise is calibrated the first time, it's good forever. */ -static void iwl4965_chain_noise_reset(struct iwl_priv *priv) +static void il4965_chain_noise_reset(struct il_priv *priv) { - struct iwl_chain_noise_data *data = &(priv->chain_noise_data); + struct il_chain_noise_data *data = &(priv->chain_noise_data); - if ((data->state == IWL_CHAIN_NOISE_ALIVE) && - iwl_legacy_is_any_associated(priv)) { - struct iwl_calib_diff_gain_cmd cmd; + if ((data->state == IL_CHAIN_NOISE_ALIVE) && + il_is_any_associated(priv)) { + struct il_calib_diff_gain_cmd cmd; /* clear data for chain noise calibration algorithm */ data->chain_noise_a = 0; @@ -337,20 +337,20 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv) data->beacon_count = 0; memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.op_code = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD; + cmd.hdr.op_code = IL_PHY_CALIBRATE_DIFF_GAIN_CMD; cmd.diff_gain_a = 0; cmd.diff_gain_b = 0; cmd.diff_gain_c = 0; - if (iwl_legacy_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, + if (il_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, sizeof(cmd), &cmd)) - IWL_ERR(priv, + IL_ERR(priv, "Could not send REPLY_PHY_CALIBRATION_CMD\n"); - data->state = IWL_CHAIN_NOISE_ACCUMULATE; - IWL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n"); + data->state = IL_CHAIN_NOISE_ACCUMULATE; + IL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n"); } } -static struct iwl_sensitivity_ranges iwl4965_sensitivity = { +static struct il_sensitivity_ranges il4965_sensitivity = { .min_nrg_cck = 97, .max_nrg_cck = 0, /* not used, set to 0 */ @@ -377,7 +377,7 @@ static struct iwl_sensitivity_ranges iwl4965_sensitivity = { .nrg_th_cca = 62, }; -static void iwl4965_set_ct_threshold(struct iwl_priv *priv) +static void il4965_set_ct_threshold(struct il_priv *priv) { /* want Kelvin */ priv->hw_params.ct_kill_threshold = @@ -385,13 +385,13 @@ static void iwl4965_set_ct_threshold(struct iwl_priv *priv) } /** - * iwl4965_hw_set_hw_params + * il4965_hw_set_hw_params * * Called when initializing driver */ -static int iwl4965_hw_set_hw_params(struct iwl_priv *priv) +static int il4965_hw_set_hw_params(struct il_priv *priv) { - if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES && + if (priv->cfg->mod_params->num_of_queues >= IL_MIN_NUM_QUEUES && priv->cfg->mod_params->num_of_queues <= IWL49_NUM_QUEUES) priv->cfg->base_params->num_of_queues = priv->cfg->mod_params->num_of_queues; @@ -400,10 +400,10 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv) priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM; priv->hw_params.scd_bc_tbls_size = priv->cfg->base_params->num_of_queues * - sizeof(struct iwl4965_scd_bc_tbl); - priv->hw_params.tfd_size = sizeof(struct iwl_tfd); + sizeof(struct il4965_scd_bc_tbl); + priv->hw_params.tfd_size = sizeof(struct il_tfd); priv->hw_params.max_stations = IWL4965_STATION_COUNT; - priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID; + priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID; priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; priv->hw_params.max_inst_size = IWL49_RTC_INST_SIZE; priv->hw_params.max_bsm_size = BSM_SRAM_SIZE; @@ -411,20 +411,20 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv) priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR; - priv->hw_params.tx_chains_num = iwl4965_num_of_ant(priv->cfg->valid_tx_ant); - priv->hw_params.rx_chains_num = iwl4965_num_of_ant(priv->cfg->valid_rx_ant); + priv->hw_params.tx_chains_num = il4965_num_of_ant(priv->cfg->valid_tx_ant); + priv->hw_params.rx_chains_num = il4965_num_of_ant(priv->cfg->valid_rx_ant); priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; - iwl4965_set_ct_threshold(priv); + il4965_set_ct_threshold(priv); - priv->hw_params.sens = &iwl4965_sensitivity; + priv->hw_params.sens = &il4965_sensitivity; priv->hw_params.beacon_time_tsf_bits = IWL4965_EXT_BEACON_TIME_POS; return 0; } -static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) +static s32 il4965_math_div_round(s32 num, s32 denom, s32 *res) { s32 sign = 1; @@ -443,7 +443,7 @@ static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) } /** - * iwl4965_get_voltage_compensation - Power supply voltage comp for txpower + * il4965_get_voltage_compensation - Power supply voltage comp for txpower * * Determines power supply voltage compensation for txpower calculations. * 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) * Voltage indication is higher for lower voltage. * Lower voltage requires more gain (lower gain table index). */ -static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage, +static s32 il4965_get_voltage_compensation(s32 eeprom_voltage, s32 current_voltage) { s32 comp = 0; - if ((TX_POWER_IWL_ILLEGAL_VOLTAGE == eeprom_voltage) || - (TX_POWER_IWL_ILLEGAL_VOLTAGE == current_voltage)) + if ((TX_POWER_IL_ILLEGAL_VOLTAGE == eeprom_voltage) || + (TX_POWER_IL_ILLEGAL_VOLTAGE == current_voltage)) return 0; - iwl4965_math_div_round(current_voltage - eeprom_voltage, - TX_POWER_IWL_VOLTAGE_CODES_PER_03V, &comp); + il4965_math_div_round(current_voltage - eeprom_voltage, + TX_POWER_IL_VOLTAGE_CODES_PER_03V, &comp); if (current_voltage > eeprom_voltage) comp *= 2; @@ -473,32 +473,32 @@ static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage, return comp; } -static s32 iwl4965_get_tx_atten_grp(u16 channel) +static s32 il4965_get_tx_atten_grp(u16 channel) { - if (channel >= CALIB_IWL_TX_ATTEN_GR5_FCH && - channel <= CALIB_IWL_TX_ATTEN_GR5_LCH) + if (channel >= CALIB_IL_TX_ATTEN_GR5_FCH && + channel <= CALIB_IL_TX_ATTEN_GR5_LCH) return CALIB_CH_GROUP_5; - if (channel >= CALIB_IWL_TX_ATTEN_GR1_FCH && - channel <= CALIB_IWL_TX_ATTEN_GR1_LCH) + if (channel >= CALIB_IL_TX_ATTEN_GR1_FCH && + channel <= CALIB_IL_TX_ATTEN_GR1_LCH) return CALIB_CH_GROUP_1; - if (channel >= CALIB_IWL_TX_ATTEN_GR2_FCH && - channel <= CALIB_IWL_TX_ATTEN_GR2_LCH) + if (channel >= CALIB_IL_TX_ATTEN_GR2_FCH && + channel <= CALIB_IL_TX_ATTEN_GR2_LCH) return CALIB_CH_GROUP_2; - if (channel >= CALIB_IWL_TX_ATTEN_GR3_FCH && - channel <= CALIB_IWL_TX_ATTEN_GR3_LCH) + if (channel >= CALIB_IL_TX_ATTEN_GR3_FCH && + channel <= CALIB_IL_TX_ATTEN_GR3_LCH) return CALIB_CH_GROUP_3; - if (channel >= CALIB_IWL_TX_ATTEN_GR4_FCH && - channel <= CALIB_IWL_TX_ATTEN_GR4_LCH) + if (channel >= CALIB_IL_TX_ATTEN_GR4_FCH && + channel <= CALIB_IL_TX_ATTEN_GR4_LCH) return CALIB_CH_GROUP_4; return -EINVAL; } -static u32 iwl4965_get_sub_band(const struct iwl_priv *priv, u32 channel) +static u32 il4965_get_sub_band(const struct il_priv *priv, u32 channel) { s32 b = -1; @@ -514,41 +514,41 @@ static u32 iwl4965_get_sub_band(const struct iwl_priv *priv, u32 channel) return b; } -static s32 iwl4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2) +static s32 il4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2) { s32 val; if (x2 == x1) return y1; else { - iwl4965_math_div_round((x2 - x) * (y1 - y2), (x2 - x1), &val); + il4965_math_div_round((x2 - x) * (y1 - y2), (x2 - x1), &val); return val + y2; } } /** - * iwl4965_interpolate_chan - Interpolate factory measurements for one channel + * il4965_interpolate_chan - Interpolate factory measurements for one channel * * Interpolates factory measurements from the two sample channels within a * sub-band, to apply to channel of interest. Interpolation is proportional to * differences in channel frequencies, which is proportional to differences * in channel number. */ -static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel, - struct iwl_eeprom_calib_ch_info *chan_info) +static int il4965_interpolate_chan(struct il_priv *priv, u32 channel, + struct il_eeprom_calib_ch_info *chan_info) { s32 s = -1; u32 c; u32 m; - const struct iwl_eeprom_calib_measure *m1; - const struct iwl_eeprom_calib_measure *m2; - struct iwl_eeprom_calib_measure *omeas; + const struct il_eeprom_calib_measure *m1; + const struct il_eeprom_calib_measure *m2; + struct il_eeprom_calib_measure *omeas; u32 ch_i1; u32 ch_i2; - s = iwl4965_get_sub_band(priv, channel); + s = il4965_get_sub_band(priv, channel); if (s >= EEPROM_TX_POWER_BANDS) { - IWL_ERR(priv, "Tx Power can not find channel %d\n", channel); + IL_ERR(priv, "Tx Power can not find channel %d\n", channel); return -1; } @@ -556,7 +556,7 @@ static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel, ch_i2 = priv->calib_info->band_info[s].ch2.ch_num; chan_info->ch_num = (u8) channel; - IWL_DEBUG_TXPOWER(priv, "channel %d subband %d factory cal ch %d & %d\n", + IL_DEBUG_TXPOWER(priv, "channel %d subband %d factory cal ch %d & %d\n", channel, s, ch_i1, ch_i2); 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, omeas = &(chan_info->measurements[c][m]); omeas->actual_pow = - (u8) iwl4965_interpolate_value(channel, ch_i1, + (u8) il4965_interpolate_value(channel, ch_i1, m1->actual_pow, ch_i2, m2->actual_pow); omeas->gain_idx = - (u8) iwl4965_interpolate_value(channel, ch_i1, + (u8) il4965_interpolate_value(channel, ch_i1, m1->gain_idx, ch_i2, m2->gain_idx); omeas->temperature = - (u8) iwl4965_interpolate_value(channel, ch_i1, + (u8) il4965_interpolate_value(channel, ch_i1, m1->temperature, ch_i2, m2->temperature); omeas->pa_det = - (s8) iwl4965_interpolate_value(channel, ch_i1, + (s8) il4965_interpolate_value(channel, ch_i1, m1->pa_det, ch_i2, m2->pa_det); - IWL_DEBUG_TXPOWER(priv, + IL_DEBUG_TXPOWER(priv, "chain %d meas %d AP1=%d AP2=%d AP=%d\n", c, m, m1->actual_pow, m2->actual_pow, omeas->actual_pow); - IWL_DEBUG_TXPOWER(priv, + IL_DEBUG_TXPOWER(priv, "chain %d meas %d NI1=%d NI2=%d NI=%d\n", c, m, m1->gain_idx, m2->gain_idx, omeas->gain_idx); - IWL_DEBUG_TXPOWER(priv, + IL_DEBUG_TXPOWER(priv, "chain %d meas %d PA1=%d PA2=%d PA=%d\n", c, m, m1->pa_det, m2->pa_det, omeas->pa_det); - IWL_DEBUG_TXPOWER(priv, + IL_DEBUG_TXPOWER(priv, "chain %d meas %d T1=%d T2=%d T=%d\n", c, m, m1->temperature, m2->temperature, omeas->temperature); @@ -617,7 +617,7 @@ static s32 back_off_table[] = { /* Thermal compensation values for txpower for various frequency ranges ... * ratios from 3:1 to 4.5:1 of degrees (Celsius) per half-dB gain adjust */ -static struct iwl4965_txpower_comp_entry { +static struct il4965_txpower_comp_entry { s32 degrees_per_05db_a; s32 degrees_per_05db_a_denom; } tx_power_cmp_tble[CALIB_CH_GROUP_MAX] = { @@ -867,9 +867,9 @@ static const struct gain_entry gain_table[2][108] = { } }; -static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, +static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, u8 is_ht40, u8 ctrl_chan_high, - struct iwl4965_tx_power_db *tx_power_tbl) + struct il4965_tx_power_db *tx_power_tbl) { u8 saturation_power; s32 target_power; @@ -881,9 +881,9 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, s32 txatten_grp = CALIB_CH_GROUP_MAX; int i; int c; - const struct iwl_channel_info *ch_info = NULL; - struct iwl_eeprom_calib_ch_info ch_eeprom_info; - const struct iwl_eeprom_calib_measure *measurement; + const struct il_channel_info *ch_info = NULL; + struct il_eeprom_calib_ch_info ch_eeprom_info; + const struct il_eeprom_calib_measure *measurement; s16 voltage; s32 init_voltage; s32 voltage_compensation; @@ -900,24 +900,24 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, user_target_power = 2 * priv->tx_power_user_lmt; /* Get current (RXON) channel, band, width */ - IWL_DEBUG_TXPOWER(priv, "chan %d band %d is_ht40 %d\n", channel, band, + IL_DEBUG_TXPOWER(priv, "chan %d band %d is_ht40 %d\n", channel, band, is_ht40); - ch_info = iwl_legacy_get_channel_info(priv, priv->band, channel); + ch_info = il_get_channel_info(priv, priv->band, channel); - if (!iwl_legacy_is_channel_valid(ch_info)) + if (!il_is_channel_valid(ch_info)) return -EINVAL; /* get txatten group, used to select 1) thermal txpower adjustment * and 2) mimo txpower balance between Tx chains. */ - txatten_grp = iwl4965_get_tx_atten_grp(channel); + txatten_grp = il4965_get_tx_atten_grp(channel); if (txatten_grp < 0) { - IWL_ERR(priv, "Can't find txatten group for channel %d.\n", + IL_ERR(priv, "Can't find txatten group for channel %d.\n", channel); return txatten_grp; } - IWL_DEBUG_TXPOWER(priv, "channel %d belongs to txatten group %d\n", + IL_DEBUG_TXPOWER(priv, "channel %d belongs to txatten group %d\n", channel, txatten_grp); if (is_ht40) { @@ -934,12 +934,12 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, else saturation_power = priv->calib_info->saturation_power52; - if (saturation_power < IWL_TX_POWER_SATURATION_MIN || - saturation_power > IWL_TX_POWER_SATURATION_MAX) { + if (saturation_power < IL_TX_POWER_SATURATION_MIN || + saturation_power > IL_TX_POWER_SATURATION_MAX) { if (band) - saturation_power = IWL_TX_POWER_DEFAULT_SATURATION_24; + saturation_power = IL_TX_POWER_DEFAULT_SATURATION_24; else - saturation_power = IWL_TX_POWER_DEFAULT_SATURATION_52; + saturation_power = IL_TX_POWER_DEFAULT_SATURATION_52; } /* 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, else reg_limit = ch_info->max_power_avg * 2; - if ((reg_limit < IWL_TX_POWER_REGULATORY_MIN) || - (reg_limit > IWL_TX_POWER_REGULATORY_MAX)) { + if ((reg_limit < IL_TX_POWER_REGULATORY_MIN) || + (reg_limit > IL_TX_POWER_REGULATORY_MAX)) { if (band) - reg_limit = IWL_TX_POWER_DEFAULT_REGULATORY_24; + reg_limit = IL_TX_POWER_DEFAULT_REGULATORY_24; else - reg_limit = IWL_TX_POWER_DEFAULT_REGULATORY_52; + reg_limit = IL_TX_POWER_DEFAULT_REGULATORY_52; } /* Interpolate txpower calibration values for this channel, * based on factory calibration tests on spaced channels. */ - iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info); + il4965_interpolate_chan(priv, channel, &ch_eeprom_info); /* calculate tx gain adjustment based on power supply voltage */ voltage = le16_to_cpu(priv->calib_info->voltage); init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); voltage_compensation = - iwl4965_get_voltage_compensation(voltage, init_voltage); + il4965_get_voltage_compensation(voltage, init_voltage); - IWL_DEBUG_TXPOWER(priv, "curr volt %d eeprom volt %d volt comp %d\n", + IL_DEBUG_TXPOWER(priv, "curr volt %d eeprom volt %d volt comp %d\n", init_voltage, voltage, voltage_compensation); /* get current temperature (Celsius) */ - current_temp = max(priv->temperature, IWL_TX_POWER_TEMPERATURE_MIN); - current_temp = min(priv->temperature, IWL_TX_POWER_TEMPERATURE_MAX); + current_temp = max(priv->temperature, IL_TX_POWER_TEMPERATURE_MIN); + current_temp = min(priv->temperature, IL_TX_POWER_TEMPERATURE_MAX); current_temp = KELVIN_TO_CELSIUS(current_temp); /* 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, /* txgain adjustment (in half-dB steps) based on difference * between factory and current temperature */ factory_temp = measurement->temperature; - iwl4965_math_div_round((current_temp - factory_temp) * + il4965_math_div_round((current_temp - factory_temp) * degrees_per_05db_denom, degrees_per_05db_num, &temperature_comp[c]); @@ -998,13 +998,13 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, factory_gain_index[c] = measurement->gain_idx; factory_actual_pwr[c] = measurement->actual_pow; - IWL_DEBUG_TXPOWER(priv, "chain = %d\n", c); - IWL_DEBUG_TXPOWER(priv, "fctry tmp %d, " + IL_DEBUG_TXPOWER(priv, "chain = %d\n", c); + IL_DEBUG_TXPOWER(priv, "fctry tmp %d, " "curr tmp %d, comp %d steps\n", factory_temp, current_temp, temperature_comp[c]); - IWL_DEBUG_TXPOWER(priv, "fctry idx %d, fctry pwr %d\n", + IL_DEBUG_TXPOWER(priv, "fctry idx %d, fctry pwr %d\n", factory_gain_index[c], factory_actual_pwr[c]); } @@ -1012,14 +1012,14 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, /* for each of 33 bit-rates (including 1 for CCK) */ for (i = 0; i < POWER_TABLE_NUM_ENTRIES; i++) { u8 is_mimo_rate; - union iwl4965_tx_power_dual_stream tx_power; + union il4965_tx_power_dual_stream tx_power; /* for mimo, reduce each chain's txpower by half * (3dB, 6 steps), so total output power is regulatory * compliant. */ if (i & 0x8) { current_regulatory = reg_limit - - IWL_TX_POWER_MIMO_REGULATORY_COMPENSATION; + IL_TX_POWER_MIMO_REGULATORY_COMPENSATION; is_mimo_rate = 1; } else { current_regulatory = reg_limit; @@ -1037,7 +1037,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, if (target_power > power_limit) target_power = power_limit; - IWL_DEBUG_TXPOWER(priv, "rate %d sat %d reg %d usr %d tgt %d\n", + IL_DEBUG_TXPOWER(priv, "rate %d sat %d reg %d usr %d tgt %d\n", i, saturation_power - back_off_table[i], current_regulatory, user_target_power, target_power); @@ -1061,7 +1061,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, voltage_compensation + atten_value); -/* IWL_DEBUG_TXPOWER(priv, "calculated txpower index %d\n", +/* IL_DEBUG_TXPOWER(priv, "calculated txpower index %d\n", power_index); */ 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, /* CCK, rate 32, reduce txpower for CCK */ if (i == POWER_TABLE_CCK_ENTRY) power_index += - IWL_TX_POWER_CCK_COMPENSATION_C_STEP; + IL_TX_POWER_CCK_COMPENSATION_C_STEP; /* stay within the table! */ if (power_index > 107) { - IWL_WARN(priv, "txpower index %d > 107\n", + IL_WARN(priv, "txpower index %d > 107\n", power_index); power_index = 107; } if (power_index < 0) { - IWL_WARN(priv, "txpower index %d < 0\n", + IL_WARN(priv, "txpower index %d < 0\n", power_index); power_index = 0; } @@ -1094,7 +1094,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, tx_power.s.dsp_predis_atten[c] = gain_table[band][power_index].dsp; - IWL_DEBUG_TXPOWER(priv, "chain %d mimo %d index %d " + IL_DEBUG_TXPOWER(priv, "chain %d mimo %d index %d " "gain 0x%02x dsp %d\n", c, atten_value, power_index, 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, } /** - * iwl4965_send_tx_power - Configure the TXPOWER level user limit + * il4965_send_tx_power - Configure the TXPOWER level user limit * * Uses the active RXON for channel, band, and characteristics (ht40, high) * The power limit is taken from priv->tx_power_user_lmt. */ -static int iwl4965_send_tx_power(struct iwl_priv *priv) +static int il4965_send_tx_power(struct il_priv *priv) { - struct iwl4965_txpowertable_cmd cmd = { 0 }; + struct il4965_txpowertable_cmd cmd = { 0 }; int ret; u8 band = 0; bool is_ht40 = false; u8 ctrl_chan_high = 0; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status), "TX Power requested while scanning!\n")) @@ -1137,26 +1137,26 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv) cmd.band = band; cmd.channel = ctx->active.channel; - ret = iwl4965_fill_txpower_tbl(priv, band, + ret = il4965_fill_txpower_tbl(priv, band, le16_to_cpu(ctx->active.channel), is_ht40, ctrl_chan_high, &cmd.tx_power); if (ret) goto out; - ret = iwl_legacy_send_cmd_pdu(priv, + ret = il_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd); out: return ret; } -static int iwl4965_send_rxon_assoc(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +static int il4965_send_rxon_assoc(struct il_priv *priv, + struct il_rxon_context *ctx) { int ret = 0; - struct iwl4965_rxon_assoc_cmd rxon_assoc; - const struct iwl_legacy_rxon_cmd *rxon1 = &ctx->staging; - const struct iwl_legacy_rxon_cmd *rxon2 = &ctx->active; + struct il4965_rxon_assoc_cmd rxon_assoc; + const struct il_rxon_cmd *rxon1 = &ctx->staging; + const struct il_rxon_cmd *rxon2 = &ctx->active; if ((rxon1->flags == rxon2->flags) && (rxon1->filter_flags == rxon2->filter_flags) && @@ -1167,7 +1167,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv, rxon2->ofdm_ht_dual_stream_basic_rates) && (rxon1->rx_chain == rxon2->rx_chain) && (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { - IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); + IL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); return 0; } @@ -1182,21 +1182,21 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv, ctx->staging.ofdm_ht_dual_stream_basic_rates; rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain; - ret = iwl_legacy_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, + ret = il_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, sizeof(rxon_assoc), &rxon_assoc, NULL); return ret; } -static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) +static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) { /* cast away the const for active_rxon in this function */ - struct iwl_legacy_rxon_cmd *active_rxon = (void *)&ctx->active; + struct il_rxon_cmd *active_rxon = (void *)&ctx->active; int ret; bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK); - if (!iwl_legacy_is_alive(priv)) + if (!il_is_alive(priv)) return -EBUSY; if (!ctx->is_active) @@ -1205,9 +1205,9 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c /* always get timestamp with Rx frame */ ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; - ret = iwl_legacy_check_rxon_cmd(priv, ctx); + ret = il_check_rxon_cmd(priv, ctx); if (ret) { - IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); + IL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); return -EINVAL; } @@ -1217,28 +1217,28 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c */ if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) && (priv->switch_channel != ctx->staging.channel)) { - IWL_DEBUG_11H(priv, "abort channel switch on %d\n", + IL_DEBUG_11H(priv, "abort channel switch on %d\n", le16_to_cpu(priv->switch_channel)); - iwl_legacy_chswitch_done(priv, false); + il_chswitch_done(priv, false); } /* If we don't need to send a full RXON, we can use - * iwl_rxon_assoc_cmd which is used to reconfigure filter + * il_rxon_assoc_cmd which is used to reconfigure filter * and other flags for the current radio configuration. */ - if (!iwl_legacy_full_rxon_required(priv, ctx)) { - ret = iwl_legacy_send_rxon_assoc(priv, ctx); + if (!il_full_rxon_required(priv, ctx)) { + ret = il_send_rxon_assoc(priv, ctx); if (ret) { - IWL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret); + IL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret); return ret; } memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); - iwl_legacy_print_rx_config_cmd(priv, ctx); + il_print_rx_config_cmd(priv, ctx); /* * We do not commit tx power settings while channel changing, * do it now if tx power changed. */ - iwl_legacy_set_tx_power(priv, priv->tx_power_next, false); + il_set_tx_power(priv, priv->tx_power_next, false); return 0; } @@ -1246,31 +1246,31 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c * an RXON_ASSOC and the new config wants the associated mask enabled, * we must clear the associated from the active configuration * before we apply the new config */ - if (iwl_legacy_is_associated_ctx(ctx) && new_assoc) { - IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); + if (il_is_associated_ctx(ctx) && new_assoc) { + IL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - ret = iwl_legacy_send_cmd_pdu(priv, ctx->rxon_cmd, - sizeof(struct iwl_legacy_rxon_cmd), + ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, + sizeof(struct il_rxon_cmd), active_rxon); /* If the mask clearing failed then we set * active_rxon back to what it was previously */ if (ret) { active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; - IWL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); + IL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); return ret; } - iwl_legacy_clear_ucode_stations(priv, ctx); - iwl_legacy_restore_stations(priv, ctx); - ret = iwl4965_restore_default_wep_keys(priv, ctx); + il_clear_ucode_stations(priv, ctx); + il_restore_stations(priv, ctx); + ret = il4965_restore_default_wep_keys(priv, ctx); if (ret) { - IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); + IL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); return ret; } } - IWL_DEBUG_INFO(priv, "Sending RXON\n" + IL_DEBUG_INFO(priv, "Sending RXON\n" "* with%s RXON_FILTER_ASSOC_MSK\n" "* channel = %d\n" "* bssid = %pM\n", @@ -1278,7 +1278,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c le16_to_cpu(ctx->staging.channel), ctx->staging.bssid_addr); - iwl_legacy_set_rxon_hwcrypto(priv, ctx, + il_set_rxon_hwcrypto(priv, ctx, !priv->cfg->mod_params->sw_crypto); /* Apply the new configuration @@ -1286,19 +1286,19 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c * stations is needed after it (the RXON command) completes */ if (!new_assoc) { - ret = iwl_legacy_send_cmd_pdu(priv, ctx->rxon_cmd, - sizeof(struct iwl_legacy_rxon_cmd), &ctx->staging); + ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, + sizeof(struct il_rxon_cmd), &ctx->staging); if (ret) { - IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); + IL_ERR(priv, "Error setting new RXON (%d)\n", ret); return ret; } - IWL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); + IL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); - iwl_legacy_clear_ucode_stations(priv, ctx); - iwl_legacy_restore_stations(priv, ctx); - ret = iwl4965_restore_default_wep_keys(priv, ctx); + il_clear_ucode_stations(priv, ctx); + il_restore_stations(priv, ctx); + ret = il4965_restore_default_wep_keys(priv, ctx); if (ret) { - IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); + IL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); return ret; } } @@ -1307,39 +1307,39 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c /* Apply the new configuration * RXON assoc doesn't clear the station table in uCode, */ - ret = iwl_legacy_send_cmd_pdu(priv, ctx->rxon_cmd, - sizeof(struct iwl_legacy_rxon_cmd), &ctx->staging); + ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, + sizeof(struct il_rxon_cmd), &ctx->staging); if (ret) { - IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); + IL_ERR(priv, "Error setting new RXON (%d)\n", ret); return ret; } memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); } - iwl_legacy_print_rx_config_cmd(priv, ctx); + il_print_rx_config_cmd(priv, ctx); - iwl4965_init_sensitivity(priv); + il4965_init_sensitivity(priv); /* If we issue a new RXON command which required a tune then we must * send a new TXPOWER command or we won't be able to Tx any frames */ - ret = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true); + ret = il_set_tx_power(priv, priv->tx_power_next, true); if (ret) { - IWL_ERR(priv, "Error sending TX power (%d)\n", ret); + IL_ERR(priv, "Error sending TX power (%d)\n", ret); return ret; } return 0; } -static int iwl4965_hw_channel_switch(struct iwl_priv *priv, +static int il4965_hw_channel_switch(struct il_priv *priv, struct ieee80211_channel_switch *ch_switch) { - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; int rc; u8 band = 0; bool is_ht40 = false; u8 ctrl_chan_high = 0; - struct iwl4965_channel_switch_cmd cmd; - const struct iwl_channel_info *ch_info; + struct il4965_channel_switch_cmd cmd; + const struct il_channel_info *ch_info; u32 switch_time_in_usec, ucode_switch_time; u16 ch; u32 tsf_low; @@ -1379,47 +1379,47 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv, else { switch_time_in_usec = vif->bss_conf.beacon_int * switch_count * TIME_UNIT; - ucode_switch_time = iwl_legacy_usecs_to_beacons(priv, + ucode_switch_time = il_usecs_to_beacons(priv, switch_time_in_usec, beacon_interval); - cmd.switch_time = iwl_legacy_add_beacon_time(priv, + cmd.switch_time = il_add_beacon_time(priv, priv->ucode_beacon_time, ucode_switch_time, beacon_interval); } - IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", + IL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", cmd.switch_time); - ch_info = iwl_legacy_get_channel_info(priv, priv->band, ch); + ch_info = il_get_channel_info(priv, priv->band, ch); if (ch_info) - cmd.expect_beacon = iwl_legacy_is_channel_radar(ch_info); + cmd.expect_beacon = il_is_channel_radar(ch_info); else { - IWL_ERR(priv, "invalid channel switch from %u to %u\n", + IL_ERR(priv, "invalid channel switch from %u to %u\n", ctx->active.channel, ch); return -EFAULT; } - rc = iwl4965_fill_txpower_tbl(priv, band, ch, is_ht40, + rc = il4965_fill_txpower_tbl(priv, band, ch, is_ht40, ctrl_chan_high, &cmd.tx_power); if (rc) { - IWL_DEBUG_11H(priv, "error:%d fill txpower_tbl\n", rc); + IL_DEBUG_11H(priv, "error:%d fill txpower_tbl\n", rc); return rc; } - return iwl_legacy_send_cmd_pdu(priv, + return il_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); } /** - * iwl4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array + * il4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array */ -static void iwl4965_txq_update_byte_cnt_tbl(struct iwl_priv *priv, - struct iwl_tx_queue *txq, +static void il4965_txq_update_byte_cnt_tbl(struct il_priv *priv, + struct il_tx_queue *txq, u16 byte_cnt) { - struct iwl4965_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; + struct il4965_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; int txq_id = txq->q.id; int write_ptr = txq->q.write_ptr; - int len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; + int len = byte_cnt + IL_TX_CRC_SIZE + IL_TX_DELIMITER_SIZE; __le16 bc_ent; 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, } /** - * iwl4965_hw_get_temperature - return the calibrated temperature (in Kelvin) + * il4965_hw_get_temperature - return the calibrated temperature (in Kelvin) * @statistics: Provides the temperature reading from the uCode * * A return of <0 indicates bogus data in the statistics */ -static int iwl4965_hw_get_temperature(struct iwl_priv *priv) +static int il4965_hw_get_temperature(struct il_priv *priv) { s32 temperature; s32 vt; @@ -1450,13 +1450,13 @@ static int iwl4965_hw_get_temperature(struct iwl_priv *priv) if (test_bit(STATUS_TEMPERATURE, &priv->status) && (priv->_4965.statistics.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK)) { - IWL_DEBUG_TEMP(priv, "Running HT40 temperature calibration\n"); + IL_DEBUG_TEMP(priv, "Running HT40 temperature calibration\n"); R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[1]); R2 = (s32)le32_to_cpu(priv->card_alive_init.therm_r2[1]); R3 = (s32)le32_to_cpu(priv->card_alive_init.therm_r3[1]); R4 = le32_to_cpu(priv->card_alive_init.therm_r4[1]); } else { - IWL_DEBUG_TEMP(priv, "Running temperature calibration\n"); + IL_DEBUG_TEMP(priv, "Running temperature calibration\n"); R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[0]); R2 = (s32)le32_to_cpu(priv->card_alive_init.therm_r2[0]); 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) vt = sign_extend32(le32_to_cpu(priv->_4965.statistics. general.common.temperature), 23); - IWL_DEBUG_TEMP(priv, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); + IL_DEBUG_TEMP(priv, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); if (R3 == R1) { - IWL_ERR(priv, "Calibration conflict R1 == R3\n"); + IL_ERR(priv, "Calibration conflict R1 == R3\n"); return -1; } @@ -1489,17 +1489,17 @@ static int iwl4965_hw_get_temperature(struct iwl_priv *priv) temperature /= (R3 - R1); temperature = (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET; - IWL_DEBUG_TEMP(priv, "Calibrated temperature: %dK, %dC\n", + IL_DEBUG_TEMP(priv, "Calibrated temperature: %dK, %dC\n", temperature, KELVIN_TO_CELSIUS(temperature)); return temperature; } /* Adjust Txpower only if temperature variance is greater than threshold. */ -#define IWL_TEMPERATURE_THRESHOLD 3 +#define IL_TEMPERATURE_THRESHOLD 3 /** - * iwl4965_is_temp_calib_needed - determines if new calibration is needed + * il4965_is_temp_calib_needed - determines if new calibration is needed * * If the temperature changed has changed sufficiently, then a recalibration * is needed. @@ -1507,12 +1507,12 @@ static int iwl4965_hw_get_temperature(struct iwl_priv *priv) * Assumes caller will replace priv->last_temperature once calibration * executed. */ -static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv) +static int il4965_is_temp_calib_needed(struct il_priv *priv) { int temp_diff; if (!test_bit(STATUS_STATISTICS, &priv->status)) { - IWL_DEBUG_TEMP(priv, "Temperature not updated -- no statistics.\n"); + IL_DEBUG_TEMP(priv, "Temperature not updated -- no statistics.\n"); return 0; } @@ -1520,39 +1520,39 @@ static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv) /* get absolute value */ if (temp_diff < 0) { - IWL_DEBUG_POWER(priv, "Getting cooler, delta %d\n", temp_diff); + IL_DEBUG_POWER(priv, "Getting cooler, delta %d\n", temp_diff); temp_diff = -temp_diff; } else if (temp_diff == 0) - IWL_DEBUG_POWER(priv, "Temperature unchanged\n"); + IL_DEBUG_POWER(priv, "Temperature unchanged\n"); else - IWL_DEBUG_POWER(priv, "Getting warmer, delta %d\n", temp_diff); + IL_DEBUG_POWER(priv, "Getting warmer, delta %d\n", temp_diff); - if (temp_diff < IWL_TEMPERATURE_THRESHOLD) { - IWL_DEBUG_POWER(priv, " => thermal txpower calib not needed\n"); + if (temp_diff < IL_TEMPERATURE_THRESHOLD) { + IL_DEBUG_POWER(priv, " => thermal txpower calib not needed\n"); return 0; } - IWL_DEBUG_POWER(priv, " => thermal txpower calib needed\n"); + IL_DEBUG_POWER(priv, " => thermal txpower calib needed\n"); return 1; } -static void iwl4965_temperature_calib(struct iwl_priv *priv) +static void il4965_temperature_calib(struct il_priv *priv) { s32 temp; - temp = iwl4965_hw_get_temperature(priv); - if (IWL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(temp)) + temp = il4965_hw_get_temperature(priv); + if (IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(temp)) return; if (priv->temperature != temp) { if (priv->temperature) - IWL_DEBUG_TEMP(priv, "Temperature changed " + IL_DEBUG_TEMP(priv, "Temperature changed " "from %dC to %dC\n", KELVIN_TO_CELSIUS(priv->temperature), KELVIN_TO_CELSIUS(temp)); else - IWL_DEBUG_TEMP(priv, "Temperature " + IL_DEBUG_TEMP(priv, "Temperature " "initialized to %dC\n", KELVIN_TO_CELSIUS(temp)); } @@ -1562,27 +1562,27 @@ static void iwl4965_temperature_calib(struct iwl_priv *priv) if (!priv->disable_tx_power_cal && unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && - iwl4965_is_temp_calib_needed(priv)) + il4965_is_temp_calib_needed(priv)) queue_work(priv->workqueue, &priv->txpower_work); } -static u16 iwl4965_get_hcmd_size(u8 cmd_id, u16 len) +static u16 il4965_get_hcmd_size(u8 cmd_id, u16 len) { switch (cmd_id) { case REPLY_RXON: - return (u16) sizeof(struct iwl4965_rxon_cmd); + return (u16) sizeof(struct il4965_rxon_cmd); default: return len; } } -static u16 iwl4965_build_addsta_hcmd(const struct iwl_legacy_addsta_cmd *cmd, +static u16 il4965_build_addsta_hcmd(const struct il_addsta_cmd *cmd, u8 *data) { - struct iwl4965_addsta_cmd *addsta = (struct iwl4965_addsta_cmd *)data; + struct il4965_addsta_cmd *addsta = (struct il4965_addsta_cmd *)data; addsta->mode = cmd->mode; memcpy(&addsta->sta, &cmd->sta, sizeof(struct sta_id_modify)); - memcpy(&addsta->key, &cmd->key, sizeof(struct iwl4965_keyinfo)); + memcpy(&addsta->key, &cmd->key, sizeof(struct il4965_keyinfo)); addsta->station_flags = cmd->station_flags; addsta->station_flags_msk = cmd->station_flags_msk; 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, addsta->reserved1 = cpu_to_le16(0); addsta->reserved2 = cpu_to_le16(0); - return (u16)sizeof(struct iwl4965_addsta_cmd); + return (u16)sizeof(struct il4965_addsta_cmd); } -static inline u32 iwl4965_get_scd_ssn(struct iwl4965_tx_resp *tx_resp) +static inline u32 il4965_get_scd_ssn(struct il4965_tx_resp *tx_resp) { return le32_to_cpup(&tx_resp->u.status + tx_resp->frame_count) & MAX_SN; } /** - * iwl4965_tx_status_reply_tx - Handle Tx response for frames in aggregation queue + * il4965_tx_status_reply_tx - Handle Tx response for frames in aggregation queue */ -static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, - struct iwl_ht_agg *agg, - struct iwl4965_tx_resp *tx_resp, +static int il4965_tx_status_reply_tx(struct il_priv *priv, + struct il_ht_agg *agg, + struct il4965_tx_resp *tx_resp, int txq_id, u16 start_idx) { u16 status; @@ -1617,7 +1617,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, int i, sh, idx; u16 seq; if (agg->wait_for_ba) - IWL_DEBUG_TX_REPLY(priv, "got tx response w/o block-ack\n"); + IL_DEBUG_TX_REPLY(priv, "got tx response w/o block-ack\n"); agg->frame_count = tx_resp->frame_count; agg->start_idx = start_idx; @@ -1630,18 +1630,18 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, status = le16_to_cpu(frame_status[0].status); idx = start_idx; - IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n", + IL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n", agg->frame_count, agg->start_idx, idx); info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb); info->status.rates[0].count = tx_resp->failure_frame + 1; info->flags &= ~IEEE80211_TX_CTL_AMPDU; - info->flags |= iwl4965_tx_status_to_mac80211(status); - iwl4965_hwrate_to_tx_control(priv, rate_n_flags, info); + info->flags |= il4965_tx_status_to_mac80211(status); + il4965_hwrate_to_tx_control(priv, rate_n_flags, info); - IWL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n", + IL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n", status & 0xff, tx_resp->failure_frame); - IWL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags); + IL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags); agg->wait_for_ba = 0; } else { @@ -1661,12 +1661,12 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, AGG_TX_STATE_ABORT_MSK)) continue; - IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n", + IL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n", agg->frame_count, txq_id, idx); - hdr = iwl_legacy_tx_queue_get_hdr(priv, txq_id, idx); + hdr = il_tx_queue_get_hdr(priv, txq_id, idx); if (!hdr) { - IWL_ERR(priv, + IL_ERR(priv, "BUG_ON idx doesn't point to valid skb" " idx=%d, txq_id=%d\n", idx, txq_id); return -1; @@ -1674,14 +1674,14 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, sc = le16_to_cpu(hdr->seq_ctrl); if (idx != (SEQ_TO_SN(sc) & 0xff)) { - IWL_ERR(priv, + IL_ERR(priv, "BUG_ON idx doesn't match seq control" " idx=%d, seq_idx=%d, seq=%d\n", idx, SEQ_TO_SN(sc), hdr->seq_ctrl); return -1; } - IWL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n", + IL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n", i, idx, SEQ_TO_SN(sc)); sh = idx - start; @@ -1699,13 +1699,13 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, sh = 0; } bitmap |= 1ULL << sh; - IWL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n", + IL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n", start, (unsigned long long)bitmap); } agg->bitmap = bitmap; agg->start_idx = start; - IWL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n", + IL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n", agg->frame_count, agg->start_idx, (unsigned long long)agg->bitmap); @@ -1715,18 +1715,18 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, return 0; } -static u8 iwl4965_find_station(struct iwl_priv *priv, const u8 *addr) +static u8 il4965_find_station(struct il_priv *priv, const u8 *addr) { int i; int start = 0; - int ret = IWL_INVALID_STATION; + int ret = IL_INVALID_STATION; unsigned long flags; if ((priv->iw_mode == NL80211_IFTYPE_ADHOC)) - start = IWL_STA_ID; + start = IL_STA_ID; if (is_broadcast_ether_addr(addr)) - return priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id; + return priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id; spin_lock_irqsave(&priv->sta_lock, flags); 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) goto out; } - IWL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n", + IL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n", addr, priv->num_stations); out: @@ -1746,42 +1746,42 @@ static u8 iwl4965_find_station(struct iwl_priv *priv, const u8 *addr) * arrive before we completed processing the adding of * station */ - if (ret != IWL_INVALID_STATION && - (!(priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) || - ((priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) && - (priv->stations[ret].used & IWL_STA_UCODE_INPROGRESS)))) { - IWL_ERR(priv, "Requested station info for sta %d before ready.\n", + if (ret != IL_INVALID_STATION && + (!(priv->stations[ret].used & IL_STA_UCODE_ACTIVE) || + ((priv->stations[ret].used & IL_STA_UCODE_ACTIVE) && + (priv->stations[ret].used & IL_STA_UCODE_INPROGRESS)))) { + IL_ERR(priv, "Requested station info for sta %d before ready.\n", ret); - ret = IWL_INVALID_STATION; + ret = IL_INVALID_STATION; } spin_unlock_irqrestore(&priv->sta_lock, flags); return ret; } -static int iwl4965_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) +static int il4965_get_ra_sta_id(struct il_priv *priv, struct ieee80211_hdr *hdr) { if (priv->iw_mode == NL80211_IFTYPE_STATION) { - return IWL_AP_ID; + return IL_AP_ID; } else { u8 *da = ieee80211_get_DA(hdr); - return iwl4965_find_station(priv, da); + return il4965_find_station(priv, da); } } /** - * iwl4965_rx_reply_tx - Handle standard (non-aggregation) Tx response + * il4965_rx_reply_tx - Handle standard (non-aggregation) Tx response */ -static void iwl4965_rx_reply_tx(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il4965_rx_reply_tx(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); u16 sequence = le16_to_cpu(pkt->hdr.sequence); int txq_id = SEQ_TO_QUEUE(sequence); int index = SEQ_TO_INDEX(sequence); - struct iwl_tx_queue *txq = &priv->txq[txq_id]; + struct il_tx_queue *txq = &priv->txq[txq_id]; struct ieee80211_hdr *hdr; struct ieee80211_tx_info *info; - struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; + struct il4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; u32 status = le32_to_cpu(tx_resp->u.status); int uninitialized_var(tid); int sta_id; @@ -1789,8 +1789,8 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, u8 *qc = NULL; unsigned long flags; - if ((index >= txq->q.n_bd) || (iwl_legacy_queue_used(&txq->q, index) == 0)) { - IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " + if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) { + IL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " "is out of range [0-%d] %d %d\n", txq_id, index, txq->q.n_bd, txq->q.write_ptr, txq->q.read_ptr); @@ -1801,88 +1801,88 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb); memset(&info->status, 0, sizeof(info->status)); - hdr = iwl_legacy_tx_queue_get_hdr(priv, txq_id, index); + hdr = il_tx_queue_get_hdr(priv, txq_id, index); if (ieee80211_is_data_qos(hdr->frame_control)) { qc = ieee80211_get_qos_ctl(hdr); tid = qc[0] & 0xf; } - sta_id = iwl4965_get_ra_sta_id(priv, hdr); - if (txq->sched_retry && unlikely(sta_id == IWL_INVALID_STATION)) { - IWL_ERR(priv, "Station not known\n"); + sta_id = il4965_get_ra_sta_id(priv, hdr); + if (txq->sched_retry && unlikely(sta_id == IL_INVALID_STATION)) { + IL_ERR(priv, "Station not known\n"); return; } spin_lock_irqsave(&priv->sta_lock, flags); if (txq->sched_retry) { - const u32 scd_ssn = iwl4965_get_scd_ssn(tx_resp); - struct iwl_ht_agg *agg = NULL; + const u32 scd_ssn = il4965_get_scd_ssn(tx_resp); + struct il_ht_agg *agg = NULL; WARN_ON(!qc); agg = &priv->stations[sta_id].tid[tid].agg; - iwl4965_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); + il4965_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); /* check if BAR is needed */ - if ((tx_resp->frame_count == 1) && !iwl4965_is_tx_success(status)) + if ((tx_resp->frame_count == 1) && !il4965_is_tx_success(status)) info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; if (txq->q.read_ptr != (scd_ssn & 0xff)) { - index = iwl_legacy_queue_dec_wrap(scd_ssn & 0xff, + index = il_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); - IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn " + IL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn " "%d index %d\n", scd_ssn , index); - freed = iwl4965_tx_queue_reclaim(priv, txq_id, index); + freed = il4965_tx_queue_reclaim(priv, txq_id, index); if (qc) - iwl4965_free_tfds_in_queue(priv, sta_id, + il4965_free_tfds_in_queue(priv, sta_id, tid, freed); if (priv->mac80211_registered && - (iwl_legacy_queue_space(&txq->q) > txq->q.low_mark) - && (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)) - iwl_legacy_wake_queue(priv, txq); + (il_queue_space(&txq->q) > txq->q.low_mark) + && (agg->state != IL_EMPTYING_HW_QUEUE_DELBA)) + il_wake_queue(priv, txq); } } else { info->status.rates[0].count = tx_resp->failure_frame + 1; - info->flags |= iwl4965_tx_status_to_mac80211(status); - iwl4965_hwrate_to_tx_control(priv, + info->flags |= il4965_tx_status_to_mac80211(status); + il4965_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags), info); - IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) " + IL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) " "rate_n_flags 0x%x retries %d\n", txq_id, - iwl4965_get_tx_fail_reason(status), status, + il4965_get_tx_fail_reason(status), status, le32_to_cpu(tx_resp->rate_n_flags), tx_resp->failure_frame); - freed = iwl4965_tx_queue_reclaim(priv, txq_id, index); - if (qc && likely(sta_id != IWL_INVALID_STATION)) - iwl4965_free_tfds_in_queue(priv, sta_id, tid, freed); - else if (sta_id == IWL_INVALID_STATION) - IWL_DEBUG_TX_REPLY(priv, "Station not known\n"); + freed = il4965_tx_queue_reclaim(priv, txq_id, index); + if (qc && likely(sta_id != IL_INVALID_STATION)) + il4965_free_tfds_in_queue(priv, sta_id, tid, freed); + else if (sta_id == IL_INVALID_STATION) + IL_DEBUG_TX_REPLY(priv, "Station not known\n"); if (priv->mac80211_registered && - (iwl_legacy_queue_space(&txq->q) > txq->q.low_mark)) - iwl_legacy_wake_queue(priv, txq); + (il_queue_space(&txq->q) > txq->q.low_mark)) + il_wake_queue(priv, txq); } - if (qc && likely(sta_id != IWL_INVALID_STATION)) - iwl4965_txq_check_empty(priv, sta_id, tid, txq_id); + if (qc && likely(sta_id != IL_INVALID_STATION)) + il4965_txq_check_empty(priv, sta_id, tid, txq_id); - iwl4965_check_abort_status(priv, tx_resp->frame_count, status); + il4965_check_abort_status(priv, tx_resp->frame_count, status); spin_unlock_irqrestore(&priv->sta_lock, flags); } -static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il4965_rx_beacon_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl4965_beacon_notif *beacon = (void *)pkt->u.raw; + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il4965_beacon_notif *beacon = (void *)pkt->u.raw; u8 rate __maybe_unused = - iwl4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); + il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); - IWL_DEBUG_RX(priv, "beacon status %#x, retries:%d ibssmgr:%d " + IL_DEBUG_RX(priv, "beacon status %#x, retries:%d ibssmgr:%d " "tsf:0x%.8x%.8x rate:%d\n", le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, beacon->beacon_notify_hdr.failure_frame, @@ -1894,36 +1894,36 @@ static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, } /* Set up 4965-specific Rx frame reply handlers */ -static void iwl4965_rx_handler_setup(struct iwl_priv *priv) +static void il4965_rx_handler_setup(struct il_priv *priv) { /* Legacy Rx frames */ - priv->rx_handlers[REPLY_RX] = iwl4965_rx_reply_rx; + priv->rx_handlers[REPLY_RX] = il4965_rx_reply_rx; /* Tx response */ - priv->rx_handlers[REPLY_TX] = iwl4965_rx_reply_tx; - priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif; + priv->rx_handlers[REPLY_TX] = il4965_rx_reply_tx; + priv->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif; } -static struct iwl_hcmd_ops iwl4965_hcmd = { - .rxon_assoc = iwl4965_send_rxon_assoc, - .commit_rxon = iwl4965_commit_rxon, - .set_rxon_chain = iwl4965_set_rxon_chain, +static struct il_hcmd_ops il4965_hcmd = { + .rxon_assoc = il4965_send_rxon_assoc, + .commit_rxon = il4965_commit_rxon, + .set_rxon_chain = il4965_set_rxon_chain, }; -static void iwl4965_post_scan(struct iwl_priv *priv) +static void il4965_post_scan(struct il_priv *priv) { - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; /* * Since setting the RXON may have been deferred while * performing the scan, fire one off if needed */ if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) - iwl_legacy_commit_rxon(priv, ctx); + il_commit_rxon(priv, ctx); } -static void iwl4965_post_associate(struct iwl_priv *priv) +static void il4965_post_associate(struct il_priv *priv) { - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; struct ieee80211_vif *vif = ctx->vif; struct ieee80211_conf *conf = NULL; int ret = 0; @@ -1934,28 +1934,28 @@ static void iwl4965_post_associate(struct iwl_priv *priv) if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; - iwl_legacy_scan_cancel_timeout(priv, 200); + il_scan_cancel_timeout(priv, 200); - conf = iwl_legacy_ieee80211_get_hw_conf(priv->hw); + conf = il_ieee80211_get_hw_conf(priv->hw); ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_legacy_commit_rxon(priv, ctx); + il_commit_rxon(priv, ctx); - ret = iwl_legacy_send_rxon_timing(priv, ctx); + ret = il_send_rxon_timing(priv, ctx); if (ret) - IWL_WARN(priv, "RXON timing - " + IL_WARN(priv, "RXON timing - " "Attempting to continue.\n"); ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - iwl_legacy_set_rxon_ht(priv, &priv->current_ht_config); + il_set_rxon_ht(priv, &priv->current_ht_config); if (priv->cfg->ops->hcmd->set_rxon_chain) priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid); - IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", + IL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", vif->bss_conf.aid, vif->bss_conf.beacon_int); if (vif->bss_conf.use_short_preamble) @@ -1970,19 +1970,19 @@ static void iwl4965_post_associate(struct iwl_priv *priv) ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; } - iwl_legacy_commit_rxon(priv, ctx); + il_commit_rxon(priv, ctx); - IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", + IL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", vif->bss_conf.aid, ctx->active.bssid_addr); switch (vif->type) { case NL80211_IFTYPE_STATION: break; case NL80211_IFTYPE_ADHOC: - iwl4965_send_beacon_cmd(priv); + il4965_send_beacon_cmd(priv); break; default: - IWL_ERR(priv, "%s Should not be called in %d mode\n", + IL_ERR(priv, "%s Should not be called in %d mode\n", __func__, vif->type); break; } @@ -1990,17 +1990,17 @@ static void iwl4965_post_associate(struct iwl_priv *priv) /* the chain noise calibration will enabled PM upon completion * If chain noise has already been run, then we need to enable * power management here */ - if (priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE) - iwl_legacy_power_update_mode(priv, false); + if (priv->chain_noise_data.state == IL_CHAIN_NOISE_DONE) + il_power_update_mode(priv, false); /* Enable Rx differential gain and sensitivity calibrations */ - iwl4965_chain_noise_reset(priv); + il4965_chain_noise_reset(priv); priv->start_calib = 1; } -static void iwl4965_config_ap(struct iwl_priv *priv) +static void il4965_config_ap(struct il_priv *priv) { - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; struct ieee80211_vif *vif = ctx->vif; int ret = 0; @@ -2010,22 +2010,22 @@ static void iwl4965_config_ap(struct iwl_priv *priv) return; /* The following should be done only at AP bring up */ - if (!iwl_legacy_is_associated_ctx(ctx)) { + if (!il_is_associated_ctx(ctx)) { /* RXON - unassoc (to set timing command) */ ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_legacy_commit_rxon(priv, ctx); + il_commit_rxon(priv, ctx); /* RXON Timing */ - ret = iwl_legacy_send_rxon_timing(priv, ctx); + ret = il_send_rxon_timing(priv, ctx); if (ret) - IWL_WARN(priv, "RXON timing failed - " + IL_WARN(priv, "RXON timing failed - " "Attempting to continue.\n"); /* AP has all antennas */ priv->chain_noise_data.active_chains = priv->hw_params.valid_rx_ant; - iwl_legacy_set_rxon_ht(priv, &priv->current_ht_config); + il_set_rxon_ht(priv, &priv->current_ht_config); if (priv->cfg->ops->hcmd->set_rxon_chain) priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); @@ -2047,37 +2047,37 @@ static void iwl4965_config_ap(struct iwl_priv *priv) ~RXON_FLG_SHORT_SLOT_MSK; } /* need to send beacon cmd before committing assoc RXON! */ - iwl4965_send_beacon_cmd(priv); + il4965_send_beacon_cmd(priv); /* restore RXON assoc */ ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - iwl_legacy_commit_rxon(priv, ctx); + il_commit_rxon(priv, ctx); } - iwl4965_send_beacon_cmd(priv); + il4965_send_beacon_cmd(priv); } -static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { - .get_hcmd_size = iwl4965_get_hcmd_size, - .build_addsta_hcmd = iwl4965_build_addsta_hcmd, - .request_scan = iwl4965_request_scan, - .post_scan = iwl4965_post_scan, +static struct il_hcmd_utils_ops il4965_hcmd_utils = { + .get_hcmd_size = il4965_get_hcmd_size, + .build_addsta_hcmd = il4965_build_addsta_hcmd, + .request_scan = il4965_request_scan, + .post_scan = il4965_post_scan, }; -static struct iwl_lib_ops iwl4965_lib = { - .set_hw_params = iwl4965_hw_set_hw_params, - .txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl, - .txq_attach_buf_to_tfd = iwl4965_hw_txq_attach_buf_to_tfd, - .txq_free_tfd = iwl4965_hw_txq_free_tfd, - .txq_init = iwl4965_hw_tx_queue_init, - .rx_handler_setup = iwl4965_rx_handler_setup, - .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr, - .init_alive_start = iwl4965_init_alive_start, - .load_ucode = iwl4965_load_bsm, - .dump_nic_error_log = iwl4965_dump_nic_error_log, - .dump_fh = iwl4965_dump_fh, - .set_channel_switch = iwl4965_hw_channel_switch, +static struct il_lib_ops il4965_lib = { + .set_hw_params = il4965_hw_set_hw_params, + .txq_update_byte_cnt_tbl = il4965_txq_update_byte_cnt_tbl, + .txq_attach_buf_to_tfd = il4965_hw_txq_attach_buf_to_tfd, + .txq_free_tfd = il4965_hw_txq_free_tfd, + .txq_init = il4965_hw_tx_queue_init, + .rx_handler_setup = il4965_rx_handler_setup, + .is_valid_rtc_data_addr = il4965_hw_valid_rtc_data_addr, + .init_alive_start = il4965_init_alive_start, + .load_ucode = il4965_load_bsm, + .dump_nic_error_log = il4965_dump_nic_error_log, + .dump_fh = il4965_dump_fh, + .set_channel_switch = il4965_hw_channel_switch, .apm_ops = { - .init = iwl_legacy_apm_init, - .config = iwl4965_nic_config, + .init = il_apm_init, + .config = il4965_nic_config, }, .eeprom_ops = { .regulatory_bands = { @@ -2089,60 +2089,60 @@ static struct iwl_lib_ops iwl4965_lib = { EEPROM_4965_REGULATORY_BAND_24_HT40_CHANNELS, EEPROM_4965_REGULATORY_BAND_52_HT40_CHANNELS }, - .acquire_semaphore = iwl4965_eeprom_acquire_semaphore, - .release_semaphore = iwl4965_eeprom_release_semaphore, + .acquire_semaphore = il4965_eeprom_acquire_semaphore, + .release_semaphore = il4965_eeprom_release_semaphore, }, - .send_tx_power = iwl4965_send_tx_power, - .update_chain_flags = iwl4965_update_chain_flags, + .send_tx_power = il4965_send_tx_power, + .update_chain_flags = il4965_update_chain_flags, .temp_ops = { - .temperature = iwl4965_temperature_calib, + .temperature = il4965_temperature_calib, }, .debugfs_ops = { - .rx_stats_read = iwl4965_ucode_rx_stats_read, - .tx_stats_read = iwl4965_ucode_tx_stats_read, - .general_stats_read = iwl4965_ucode_general_stats_read, + .rx_stats_read = il4965_ucode_rx_stats_read, + .tx_stats_read = il4965_ucode_tx_stats_read, + .general_stats_read = il4965_ucode_general_stats_read, }, }; -static const struct iwl_legacy_ops iwl4965_legacy_ops = { - .post_associate = iwl4965_post_associate, - .config_ap = iwl4965_config_ap, - .manage_ibss_station = iwl4965_manage_ibss_station, - .update_bcast_stations = iwl4965_update_bcast_stations, +static const struct il_legacy_ops il4965_legacy_ops = { + .post_associate = il4965_post_associate, + .config_ap = il4965_config_ap, + .manage_ibss_station = il4965_manage_ibss_station, + .update_bcast_stations = il4965_update_bcast_stations, }; -struct ieee80211_ops iwl4965_hw_ops = { - .tx = iwl4965_mac_tx, - .start = iwl4965_mac_start, - .stop = iwl4965_mac_stop, - .add_interface = iwl_legacy_mac_add_interface, - .remove_interface = iwl_legacy_mac_remove_interface, - .change_interface = iwl_legacy_mac_change_interface, - .config = iwl_legacy_mac_config, - .configure_filter = iwl4965_configure_filter, - .set_key = iwl4965_mac_set_key, - .update_tkip_key = iwl4965_mac_update_tkip_key, - .conf_tx = iwl_legacy_mac_conf_tx, - .reset_tsf = iwl_legacy_mac_reset_tsf, - .bss_info_changed = iwl_legacy_mac_bss_info_changed, - .ampdu_action = iwl4965_mac_ampdu_action, - .hw_scan = iwl_legacy_mac_hw_scan, - .sta_add = iwl4965_mac_sta_add, - .sta_remove = iwl_legacy_mac_sta_remove, - .channel_switch = iwl4965_mac_channel_switch, - .tx_last_beacon = iwl_legacy_mac_tx_last_beacon, +struct ieee80211_ops il4965_hw_ops = { + .tx = il4965_mac_tx, + .start = il4965_mac_start, + .stop = il4965_mac_stop, + .add_interface = il_mac_add_interface, + .remove_interface = il_mac_remove_interface, + .change_interface = il_mac_change_interface, + .config = il_mac_config, + .configure_filter = il4965_configure_filter, + .set_key = il4965_mac_set_key, + .update_tkip_key = il4965_mac_update_tkip_key, + .conf_tx = il_mac_conf_tx, + .reset_tsf = il_mac_reset_tsf, + .bss_info_changed = il_mac_bss_info_changed, + .ampdu_action = il4965_mac_ampdu_action, + .hw_scan = il_mac_hw_scan, + .sta_add = il4965_mac_sta_add, + .sta_remove = il_mac_sta_remove, + .channel_switch = il4965_mac_channel_switch, + .tx_last_beacon = il_mac_tx_last_beacon, }; -static const struct iwl_ops iwl4965_ops = { - .lib = &iwl4965_lib, - .hcmd = &iwl4965_hcmd, - .utils = &iwl4965_hcmd_utils, - .led = &iwl4965_led_ops, - .legacy = &iwl4965_legacy_ops, - .ieee80211_ops = &iwl4965_hw_ops, +static const struct il_ops il4965_ops = { + .lib = &il4965_lib, + .hcmd = &il4965_hcmd, + .utils = &il4965_hcmd_utils, + .led = &il4965_led_ops, + .legacy = &il4965_legacy_ops, + .ieee80211_ops = &il4965_hw_ops, }; -static struct iwl_base_params iwl4965_base_params = { +static struct il_base_params il4965_base_params = { .eeprom_size = IWL4965_EEPROM_IMG_SIZE, .num_of_queues = IWL49_NUM_QUEUES, .num_of_ampdu_queues = IWL49_NUM_AMPDU_QUEUES, @@ -2151,27 +2151,27 @@ static struct iwl_base_params iwl4965_base_params = { .use_bsm = true, .led_compensation = 61, .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, - .wd_timeout = IWL_DEF_WD_TIMEOUT, + .wd_timeout = IL_DEF_WD_TIMEOUT, .temperature_kelvin = true, .ucode_tracing = true, .sensitivity_calib_by_driver = true, .chain_noise_calib_by_driver = true, }; -struct iwl_cfg iwl4965_cfg = { +struct il_cfg il4965_cfg = { .name = "Intel(R) Wireless WiFi Link 4965AGN", .fw_name_pre = IWL4965_FW_PRE, .ucode_api_max = IWL4965_UCODE_API_MAX, .ucode_api_min = IWL4965_UCODE_API_MIN, - .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, + .sku = IL_SKU_A|IL_SKU_G|IL_SKU_N, .valid_tx_ant = ANT_AB, .valid_rx_ant = ANT_ABC, .eeprom_ver = EEPROM_4965_EEPROM_VERSION, .eeprom_calib_ver = EEPROM_4965_TX_POWER_VERSION, - .ops = &iwl4965_ops, - .mod_params = &iwl4965_mod_params, - .base_params = &iwl4965_base_params, - .led_mode = IWL_LED_BLINK, + .ops = &il4965_ops, + .mod_params = &il4965_mod_params, + .base_params = &il4965_base_params, + .led_mode = IL_LED_BLINK, /* * Force use of chains B and C for scan RX on 5 GHz band * 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 01f8163..7b32216 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965.h @@ -60,92 +60,92 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#ifndef __iwl_4965_h__ -#define __iwl_4965_h__ +#ifndef __il_4965_h__ +#define __il_4965_h__ #include "iwl-dev.h" /* configuration for the _4965 devices */ -extern struct iwl_cfg iwl4965_cfg; +extern struct il_cfg il4965_cfg; -extern struct iwl_mod_params iwl4965_mod_params; +extern struct il_mod_params il4965_mod_params; -extern struct ieee80211_ops iwl4965_hw_ops; +extern struct ieee80211_ops il4965_hw_ops; /* tx queue */ -void iwl4965_free_tfds_in_queue(struct iwl_priv *priv, +void il4965_free_tfds_in_queue(struct il_priv *priv, int sta_id, int tid, int freed); /* RXON */ -void iwl4965_set_rxon_chain(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); +void il4965_set_rxon_chain(struct il_priv *priv, + struct il_rxon_context *ctx); /* uCode */ -int iwl4965_verify_ucode(struct iwl_priv *priv); +int il4965_verify_ucode(struct il_priv *priv); /* lib */ -void iwl4965_check_abort_status(struct iwl_priv *priv, +void il4965_check_abort_status(struct il_priv *priv, u8 frame_count, u32 status); -void iwl4965_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); -int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq); -int iwl4965_hw_nic_init(struct iwl_priv *priv); -int iwl4965_dump_fh(struct iwl_priv *priv, char **buf, bool display); +void il4965_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq); +int il4965_rx_init(struct il_priv *priv, struct il_rx_queue *rxq); +int il4965_hw_nic_init(struct il_priv *priv); +int il4965_dump_fh(struct il_priv *priv, char **buf, bool display); /* rx */ -void iwl4965_rx_queue_restock(struct iwl_priv *priv); -void iwl4965_rx_replenish(struct iwl_priv *priv); -void iwl4965_rx_replenish_now(struct iwl_priv *priv); -void iwl4965_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq); -int iwl4965_rxq_stop(struct iwl_priv *priv); -int iwl4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band); -void iwl4965_rx_reply_rx(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -void iwl4965_rx_reply_rx_phy(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -void iwl4965_rx_handle(struct iwl_priv *priv); +void il4965_rx_queue_restock(struct il_priv *priv); +void il4965_rx_replenish(struct il_priv *priv); +void il4965_rx_replenish_now(struct il_priv *priv); +void il4965_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq); +int il4965_rxq_stop(struct il_priv *priv); +int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band); +void il4965_rx_reply_rx(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); +void il4965_rx_reply_rx_phy(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); +void il4965_rx_handle(struct il_priv *priv); /* tx */ -void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); -int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, - struct iwl_tx_queue *txq, +void il4965_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq); +int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *priv, + struct il_tx_queue *txq, dma_addr_t addr, u16 len, u8 reset, u8 pad); -int iwl4965_hw_tx_queue_init(struct iwl_priv *priv, - struct iwl_tx_queue *txq); -void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, +int il4965_hw_tx_queue_init(struct il_priv *priv, + struct il_tx_queue *txq); +void il4965_hwrate_to_tx_control(struct il_priv *priv, u32 rate_n_flags, struct ieee80211_tx_info *info); -int iwl4965_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); -int iwl4965_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, +int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb); +int il4965_tx_agg_start(struct il_priv *priv, struct ieee80211_vif *vif, struct ieee80211_sta *sta, u16 tid, u16 *ssn); -int iwl4965_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, +int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif, struct ieee80211_sta *sta, u16 tid); -int iwl4965_txq_check_empty(struct iwl_priv *priv, +int il4965_txq_check_empty(struct il_priv *priv, int sta_id, u8 tid, int txq_id); -void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index); -void iwl4965_hw_txq_ctx_free(struct iwl_priv *priv); -int iwl4965_txq_ctx_alloc(struct iwl_priv *priv); -void iwl4965_txq_ctx_reset(struct iwl_priv *priv); -void iwl4965_txq_ctx_stop(struct iwl_priv *priv); -void iwl4965_txq_set_sched(struct iwl_priv *priv, u32 mask); +void il4965_rx_reply_compressed_ba(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); +int il4965_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index); +void il4965_hw_txq_ctx_free(struct il_priv *priv); +int il4965_txq_ctx_alloc(struct il_priv *priv); +void il4965_txq_ctx_reset(struct il_priv *priv); +void il4965_txq_ctx_stop(struct il_priv *priv); +void il4965_txq_set_sched(struct il_priv *priv, u32 mask); /* * Acquire priv->lock before calling this function ! */ -void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index); +void il4965_set_wr_ptrs(struct il_priv *priv, int txq_id, u32 index); /** - * iwl4965_tx_queue_set_status - (optionally) start Tx/Cmd queue + * il4965_tx_queue_set_status - (optionally) start Tx/Cmd queue * @tx_fifo_id: Tx DMA/FIFO channel (range 0-7) that the queue will feed * @scd_retry: (1) Indicates queue will be used in aggregation mode * * NOTE: Acquire priv->lock before calling this function ! */ -void iwl4965_tx_queue_set_status(struct iwl_priv *priv, - struct iwl_tx_queue *txq, +void il4965_tx_queue_set_status(struct il_priv *priv, + struct il_tx_queue *txq, int tx_fifo_id, int scd_retry); -static inline u32 iwl4965_tx_status_to_mac80211(u32 status) +static inline u32 il4965_tx_status_to_mac80211(u32 status) { status &= TX_STATUS_MSK; @@ -160,123 +160,123 @@ static inline u32 iwl4965_tx_status_to_mac80211(u32 status) } } -static inline bool iwl4965_is_tx_success(u32 status) +static inline bool il4965_is_tx_success(u32 status) { status &= TX_STATUS_MSK; return (status == TX_STATUS_SUCCESS) || (status == TX_STATUS_DIRECT_DONE); } -u8 iwl4965_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx, u8 valid); +u8 il4965_toggle_tx_ant(struct il_priv *priv, u8 ant_idx, u8 valid); /* rx */ -void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -bool iwl4965_good_plcp_health(struct iwl_priv *priv, - struct iwl_rx_packet *pkt); -void iwl4965_rx_statistics(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -void iwl4965_reply_statistics(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); +void il4965_rx_missed_beacon_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); +bool il4965_good_plcp_health(struct il_priv *priv, + struct il_rx_packet *pkt); +void il4965_rx_statistics(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); +void il4965_reply_statistics(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); /* scan */ -int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif); +int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif); /* station mgmt */ -int iwl4965_manage_ibss_station(struct iwl_priv *priv, +int il4965_manage_ibss_station(struct il_priv *priv, struct ieee80211_vif *vif, bool add); /* hcmd */ -int iwl4965_send_beacon_cmd(struct iwl_priv *priv); +int il4965_send_beacon_cmd(struct il_priv *priv); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -const char *iwl4965_get_tx_fail_reason(u32 status); +const char *il4965_get_tx_fail_reason(u32 status); #else static inline const char * -iwl4965_get_tx_fail_reason(u32 status) { return ""; } +il4965_get_tx_fail_reason(u32 status) { return ""; } #endif /* station management */ -int iwl4965_alloc_bcast_station(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -int iwl4965_add_bssid_station(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +int il4965_alloc_bcast_station(struct il_priv *priv, + struct il_rxon_context *ctx); +int il4965_add_bssid_station(struct il_priv *priv, + struct il_rxon_context *ctx, const u8 *addr, u8 *sta_id_r); -int iwl4965_remove_default_wep_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +int il4965_remove_default_wep_key(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *key); -int iwl4965_set_default_wep_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +int il4965_set_default_wep_key(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *key); -int iwl4965_restore_default_wep_keys(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -int iwl4965_set_dynamic_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +int il4965_restore_default_wep_keys(struct il_priv *priv, + struct il_rxon_context *ctx); +int il4965_set_dynamic_key(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *key, u8 sta_id); -int iwl4965_remove_dynamic_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +int il4965_remove_dynamic_key(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *key, u8 sta_id); -void iwl4965_update_tkip_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +void il4965_update_tkip_key(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_key_conf *keyconf, struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); -int iwl4965_sta_tx_modify_enable_tid(struct iwl_priv *priv, +int il4965_sta_tx_modify_enable_tid(struct il_priv *priv, int sta_id, int tid); -int iwl4965_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, +int il4965_sta_rx_agg_start(struct il_priv *priv, struct ieee80211_sta *sta, int tid, u16 ssn); -int iwl4965_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, +int il4965_sta_rx_agg_stop(struct il_priv *priv, struct ieee80211_sta *sta, int tid); -void iwl4965_sta_modify_sleep_tx_count(struct iwl_priv *priv, +void il4965_sta_modify_sleep_tx_count(struct il_priv *priv, int sta_id, int cnt); -int iwl4965_update_bcast_stations(struct iwl_priv *priv); +int il4965_update_bcast_stations(struct il_priv *priv); /* rate */ -static inline u32 iwl4965_ant_idx_to_flags(u8 ant_idx) +static inline u32 il4965_ant_idx_to_flags(u8 ant_idx) { return BIT(ant_idx) << RATE_MCS_ANT_POS; } -static inline u8 iwl4965_hw_get_rate(__le32 rate_n_flags) +static inline u8 il4965_hw_get_rate(__le32 rate_n_flags) { return le32_to_cpu(rate_n_flags) & 0xFF; } -static inline __le32 iwl4965_hw_set_rate_n_flags(u8 rate, u32 flags) +static inline __le32 il4965_hw_set_rate_n_flags(u8 rate, u32 flags) { return cpu_to_le32(flags|(u32)rate); } /* eeprom */ -void iwl4965_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac); -int iwl4965_eeprom_acquire_semaphore(struct iwl_priv *priv); -void iwl4965_eeprom_release_semaphore(struct iwl_priv *priv); -int iwl4965_eeprom_check_version(struct iwl_priv *priv); +void il4965_eeprom_get_mac(const struct il_priv *priv, u8 *mac); +int il4965_eeprom_acquire_semaphore(struct il_priv *priv); +void il4965_eeprom_release_semaphore(struct il_priv *priv); +int il4965_eeprom_check_version(struct il_priv *priv); /* mac80211 handlers (for 4965) */ -void iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); -int iwl4965_mac_start(struct ieee80211_hw *hw); -void iwl4965_mac_stop(struct ieee80211_hw *hw); -void iwl4965_configure_filter(struct ieee80211_hw *hw, +void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); +int il4965_mac_start(struct ieee80211_hw *hw); +void il4965_mac_stop(struct ieee80211_hw *hw); +void il4965_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, u64 multicast); -int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, +int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key); -void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, +void il4965_mac_update_tkip_key(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_key_conf *keyconf, struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); -int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, +int il4965_mac_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum ieee80211_ampdu_mlme_action action, struct ieee80211_sta *sta, u16 tid, u16 *ssn, u8 buf_size); -int iwl4965_mac_sta_add(struct ieee80211_hw *hw, +int il4965_mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta); -void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, +void il4965_mac_channel_switch(struct ieee80211_hw *hw, struct ieee80211_channel_switch *ch_switch); -#endif /* __iwl_4965_h__ */ +#endif /* __il_4965_h__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h index 8990405..347d402 100644 --- a/drivers/net/wireless/iwlegacy/iwl-commands.h +++ b/drivers/net/wireless/iwlegacy/iwl-commands.h @@ -66,22 +66,22 @@ * Please use iwl-dev.h for driver implementation definitions. */ -#ifndef __iwl_legacy_commands_h__ -#define __iwl_legacy_commands_h__ +#ifndef __il_commands_h__ +#define __il_commands_h__ -struct iwl_priv; +struct il_priv; /* uCode version contains 4 values: Major/Minor/API/Serial */ -#define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) -#define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) -#define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8) -#define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF) +#define IL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) +#define IL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) +#define IL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8) +#define IL_UCODE_SERIAL(ver) ((ver) & 0x000000FF) /* Tx rates */ -#define IWL_CCK_RATES 4 -#define IWL_OFDM_RATES 8 -#define IWL_MAX_RATES (IWL_CCK_RATES + IWL_OFDM_RATES) +#define IL_CCK_RATES 4 +#define IL_OFDM_RATES 8 +#define IL_MAX_RATES (IL_CCK_RATES + IL_OFDM_RATES) enum { REPLY_ALIVE = 0x1, @@ -163,8 +163,8 @@ enum { * *****************************************************************************/ -/* iwl_cmd_header flags value */ -#define IWL_CMD_FAILED_MSK 0x40 +/* il_cmd_header flags value */ +#define IL_CMD_FAILED_MSK 0x40 #define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f) #define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) @@ -174,12 +174,12 @@ enum { #define SEQ_RX_FRAME cpu_to_le16(0x8000) /** - * struct iwl_cmd_header + * struct il_cmd_header * * This header format appears in the beginning of each command sent from the * driver, and each response/notification received from uCode. */ -struct iwl_cmd_header { +struct il_cmd_header { u8 cmd; /* Command ID: REPLY_RXON, etc. */ u8 flags; /* 0:5 reserved, 6 abort, 7 internal */ /* @@ -212,7 +212,7 @@ struct iwl_cmd_header { /** - * struct iwl3945_tx_power + * struct il3945_tx_power * * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH * @@ -223,21 +223,21 @@ struct iwl_cmd_header { * 2) Radio gain. This sets the analog gain of the radio Tx path. * It is a coarser setting, and behaves in a logarithmic (dB) fashion. * - * Driver obtains values from struct iwl3945_tx_power power_gain_table[][]. + * Driver obtains values from struct il3945_tx_power power_gain_table[][]. */ -struct iwl3945_tx_power { +struct il3945_tx_power { u8 tx_gain; /* gain for analog radio */ u8 dsp_atten; /* gain for DSP */ } __packed; /** - * struct iwl3945_power_per_rate + * struct il3945_power_per_rate * * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH */ -struct iwl3945_power_per_rate { +struct il3945_power_per_rate { u8 rate; /* plcp */ - struct iwl3945_tx_power tpc; + struct il3945_tx_power tpc; u8 reserved; } __packed; @@ -330,11 +330,11 @@ struct iwl3945_power_per_rate { #define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 #define POWER_TABLE_CCK_ENTRY 32 -#define IWL_PWR_NUM_HT_OFDM_ENTRIES 24 -#define IWL_PWR_CCK_ENTRIES 2 +#define IL_PWR_NUM_HT_OFDM_ENTRIES 24 +#define IL_PWR_CCK_ENTRIES 2 /** - * union iwl4965_tx_power_dual_stream + * union il4965_tx_power_dual_stream * * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH * Use __le32 version (struct tx_power_dual_stream) when building command. @@ -349,7 +349,7 @@ struct iwl3945_power_per_rate { * * See more details in doc for TXPOWER in iwl-4965-hw.h. */ -union iwl4965_tx_power_dual_stream { +union il4965_tx_power_dual_stream { struct { u8 radio_tx_gain[2]; u8 dsp_predis_atten[2]; @@ -362,18 +362,18 @@ union iwl4965_tx_power_dual_stream { * * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH * - * Same format as iwl_tx_power_dual_stream, but __le32 + * Same format as il_tx_power_dual_stream, but __le32 */ struct tx_power_dual_stream { __le32 dw; } __packed; /** - * struct iwl4965_tx_power_db + * struct il4965_tx_power_db * * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH */ -struct iwl4965_tx_power_db { +struct il4965_tx_power_db { struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; } __packed; @@ -410,7 +410,7 @@ struct iwl4965_tx_power_db { * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation, * for each of 5 frequency ranges. */ -struct iwl_init_alive_resp { +struct il_init_alive_resp { u8 ucode_minor; u8 ucode_major; __le16 reserved1; @@ -511,7 +511,7 @@ struct iwl_init_alive_resp { * The Linux driver can print both logs to the system log when a uCode error * occurs. */ -struct iwl_alive_resp { +struct il_alive_resp { u8 ucode_minor; u8 ucode_major; __le16 reserved1; @@ -528,7 +528,7 @@ struct iwl_alive_resp { /* * REPLY_ERROR = 0x2 (response only, not a command) */ -struct iwl_error_resp { +struct il_error_resp { __le32 error_type; u8 cmd_id; u8 reserved1; @@ -657,7 +657,7 @@ enum { * regardless of whether RXON_FILTER_ASSOC_MSK is set. */ -struct iwl3945_rxon_cmd { +struct il3945_rxon_cmd { u8 node_addr[6]; __le16 reserved1; u8 bssid_addr[6]; @@ -676,7 +676,7 @@ struct iwl3945_rxon_cmd { __le16 reserved5; } __packed; -struct iwl4965_rxon_cmd { +struct il4965_rxon_cmd { u8 node_addr[6]; __le16 reserved1; u8 bssid_addr[6]; @@ -699,7 +699,7 @@ struct iwl4965_rxon_cmd { /* Create a common rxon cmd which will be typecast into the 3945 or 4965 * specific rxon cmd, depending on where it is called from. */ -struct iwl_legacy_rxon_cmd { +struct il_rxon_cmd { u8 node_addr[6]; __le16 reserved1; u8 bssid_addr[6]; @@ -725,7 +725,7 @@ struct iwl_legacy_rxon_cmd { /* * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) */ -struct iwl3945_rxon_assoc_cmd { +struct il3945_rxon_assoc_cmd { __le32 flags; __le32 filter_flags; u8 ofdm_basic_rates; @@ -733,7 +733,7 @@ struct iwl3945_rxon_assoc_cmd { __le16 reserved; } __packed; -struct iwl4965_rxon_assoc_cmd { +struct il4965_rxon_assoc_cmd { __le32 flags; __le32 filter_flags; u8 ofdm_basic_rates; @@ -744,14 +744,14 @@ struct iwl4965_rxon_assoc_cmd { __le16 reserved; } __packed; -#define IWL_CONN_MAX_LISTEN_INTERVAL 10 -#define IWL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */ +#define IL_CONN_MAX_LISTEN_INTERVAL 10 +#define IL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */ #define IWL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */ /* * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) */ -struct iwl_rxon_time_cmd { +struct il_rxon_time_cmd { __le64 timestamp; __le16 beacon_interval; __le16 atim_window; @@ -764,30 +764,30 @@ struct iwl_rxon_time_cmd { /* * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) */ -struct iwl3945_channel_switch_cmd { +struct il3945_channel_switch_cmd { u8 band; u8 expect_beacon; __le16 channel; __le32 rxon_flags; __le32 rxon_filter_flags; __le32 switch_time; - struct iwl3945_power_per_rate power[IWL_MAX_RATES]; + struct il3945_power_per_rate power[IL_MAX_RATES]; } __packed; -struct iwl4965_channel_switch_cmd { +struct il4965_channel_switch_cmd { u8 band; u8 expect_beacon; __le16 channel; __le32 rxon_flags; __le32 rxon_filter_flags; __le32 switch_time; - struct iwl4965_tx_power_db tx_power; + struct il4965_tx_power_db tx_power; } __packed; /* * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) */ -struct iwl_csa_notification { +struct il_csa_notification { __le16 band; __le16 channel; __le32 status; /* 0 - OK, 1 - fail */ @@ -800,8 +800,8 @@ struct iwl_csa_notification { *****************************************************************************/ /** - * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM - * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd + * struct il_ac_qos -- QOS timing params for REPLY_QOS_PARAM + * One for each of 4 EDCA access categories in struct il_qosparam_cmd * * @cw_min: Contention window, start value in numbers of slots. * Should be a power-of-2, minus 1. Device's default is 0x0f. @@ -815,7 +815,7 @@ struct iwl_csa_notification { * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW * value, to cap the CW value. */ -struct iwl_ac_qos { +struct il_ac_qos { __le16 cw_min; __le16 cw_max; u8 aifsn; @@ -837,9 +837,9 @@ struct iwl_ac_qos { * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs * 0: Background, 1: Best Effort, 2: Video, 3: Voice. */ -struct iwl_qosparam_cmd { +struct il_qosparam_cmd { __le32 qos_flags; - struct iwl_ac_qos ac[AC_NUM]; + struct il_ac_qos ac[AC_NUM]; } __packed; /****************************************************************************** @@ -852,15 +852,15 @@ struct iwl_qosparam_cmd { */ /* Special, dedicated locations within device's station table */ -#define IWL_AP_ID 0 -#define IWL_STA_ID 2 +#define IL_AP_ID 0 +#define IL_STA_ID 2 #define IWL3945_BROADCAST_ID 24 #define IWL3945_STATION_COUNT 25 #define IWL4965_BROADCAST_ID 31 #define IWL4965_STATION_COUNT 32 -#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ -#define IWL_INVALID_STATION 255 +#define IL_STATION_COUNT 32 /* MAX(3945,4965)*/ +#define IL_INVALID_STATION 255 #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) @@ -905,7 +905,7 @@ struct iwl_qosparam_cmd { * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */ #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) -struct iwl4965_keyinfo { +struct il4965_keyinfo { __le16 key_flags; u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ u8 reserved1; @@ -923,7 +923,7 @@ struct iwl4965_keyinfo { * * Driver selects unused table index when adding new station, * or the index to a pre-existing station entry when modifying that station. - * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP). + * Some indexes have special purposes (IL_AP_ID, index 0, is for AP). * * modify_mask flags select which parameters to modify vs. leave alone. */ @@ -954,19 +954,19 @@ struct sta_id_modify { * their own txpower/rate setup data). * * When getting started on a new channel, driver must set up the - * IWL_BROADCAST_ID entry (last entry in the table). For a client + * IL_BROADCAST_ID entry (last entry in the table). For a client * station in a BSS, once an AP is selected, driver sets up the AP STA - * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP + * in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP * are all that are needed for a BSS client station. If the device is * used as AP, or in an IBSS network, driver must set up station table - * entries for all STAs in network, starting with index IWL_STA_ID. + * entries for all STAs in network, starting with index IL_STA_ID. */ -struct iwl3945_addsta_cmd { +struct il3945_addsta_cmd { u8 mode; /* 1: modify existing, 0: add new station */ u8 reserved[3]; struct sta_id_modify sta; - struct iwl4965_keyinfo key; + struct il4965_keyinfo key; __le32 station_flags; /* STA_FLG_* */ __le32 station_flags_msk; /* STA_FLG_* */ @@ -990,11 +990,11 @@ struct iwl3945_addsta_cmd { __le16 add_immediate_ba_ssn; } __packed; -struct iwl4965_addsta_cmd { +struct il4965_addsta_cmd { u8 mode; /* 1: modify existing, 0: add new station */ u8 reserved[3]; struct sta_id_modify sta; - struct iwl4965_keyinfo key; + struct il4965_keyinfo key; __le32 station_flags; /* STA_FLG_* */ __le32 station_flags_msk; /* STA_FLG_* */ @@ -1028,11 +1028,11 @@ struct iwl4965_addsta_cmd { } __packed; /* Wrapper struct for 3945 and 4965 addsta_cmd structures */ -struct iwl_legacy_addsta_cmd { +struct il_addsta_cmd { u8 mode; /* 1: modify existing, 0: add new station */ u8 reserved[3]; struct sta_id_modify sta; - struct iwl4965_keyinfo key; + struct il4965_keyinfo key; __le32 station_flags; /* STA_FLG_* */ __le32 station_flags_msk; /* STA_FLG_* */ @@ -1073,7 +1073,7 @@ struct iwl_legacy_addsta_cmd { /* * REPLY_ADD_STA = 0x18 (response) */ -struct iwl_add_sta_resp { +struct il_add_sta_resp { u8 status; /* ADD_STA_* */ } __packed; @@ -1081,34 +1081,34 @@ struct iwl_add_sta_resp { /* * REPLY_REM_STA = 0x19 (response) */ -struct iwl_rem_sta_resp { +struct il_rem_sta_resp { u8 status; } __packed; /* * REPLY_REM_STA = 0x19 (command) */ -struct iwl_rem_sta_cmd { +struct il_rem_sta_cmd { u8 num_sta; /* number of removed stations */ u8 reserved[3]; u8 addr[ETH_ALEN]; /* MAC addr of the first station */ u8 reserved2[2]; } __packed; -#define IWL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0)) -#define IWL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1)) -#define IWL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2)) -#define IWL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3)) -#define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) +#define IL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0)) +#define IL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1)) +#define IL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2)) +#define IL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3)) +#define IL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) -#define IWL_DROP_SINGLE 0 -#define IWL_DROP_SELECTED 1 -#define IWL_DROP_ALL 2 +#define IL_DROP_SINGLE 0 +#define IL_DROP_SELECTED 1 +#define IL_DROP_ALL 2 /* * REPLY_WEP_KEY = 0x20 */ -struct iwl_wep_key { +struct il_wep_key { u8 key_index; u8 key_offset; u8 reserved1[2]; @@ -1117,12 +1117,12 @@ struct iwl_wep_key { u8 key[16]; } __packed; -struct iwl_wep_cmd { +struct il_wep_cmd { u8 num_keys; u8 global_key_type; u8 flags; u8 reserved; - struct iwl_wep_key key[0]; + struct il_wep_key key[0]; } __packed; #define WEP_KEY_WEP_TYPE 1 @@ -1169,7 +1169,7 @@ struct iwl_wep_cmd { #define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) -struct iwl3945_rx_frame_stats { +struct il3945_rx_frame_stats { u8 phy_count; u8 id; u8 rssi; @@ -1179,7 +1179,7 @@ struct iwl3945_rx_frame_stats { u8 payload[0]; } __packed; -struct iwl3945_rx_frame_hdr { +struct il3945_rx_frame_hdr { __le16 channel; __le16 phy_flags; u8 reserved1; @@ -1188,7 +1188,7 @@ struct iwl3945_rx_frame_hdr { u8 payload[0]; } __packed; -struct iwl3945_rx_frame_end { +struct il3945_rx_frame_end { __le32 status; __le64 timestamp; __le32 beacon_timestamp; @@ -1202,13 +1202,13 @@ struct iwl3945_rx_frame_end { * The actual offsets of the hdr and end are dynamic based on * stats.phy_count */ -struct iwl3945_rx_frame { - struct iwl3945_rx_frame_stats stats; - struct iwl3945_rx_frame_hdr hdr; - struct iwl3945_rx_frame_end end; +struct il3945_rx_frame { + struct il3945_rx_frame_stats stats; + struct il3945_rx_frame_hdr hdr; + struct il3945_rx_frame_end end; } __packed; -#define IWL39_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame)) +#define IWL39_RX_FRAME_SIZE (4 + sizeof(struct il3945_rx_frame)) /* Fixed (non-configurable) rx data from phy */ @@ -1217,7 +1217,7 @@ struct iwl3945_rx_frame { #define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70) #define IWL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ #define IWL49_AGC_DB_POS (7) -struct iwl4965_rx_non_cfg_phy { +struct il4965_rx_non_cfg_phy { __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ 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 { * REPLY_RX = 0xc3 (response only, not a command) * Used only for legacy (non 11n) frames. */ -struct iwl_rx_phy_res { +struct il_rx_phy_res { u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ u8 stat_id; /* configurable DSP phy data set ID */ @@ -1244,7 +1244,7 @@ struct iwl_rx_phy_res { __le16 frame_time; /* frame's time on the air */ } __packed; -struct iwl_rx_mpdu_res_start { +struct il_rx_mpdu_res_start { __le16 byte_count; __le16 reserved; } __packed; @@ -1372,7 +1372,7 @@ struct iwl_rx_mpdu_res_start { * REPLY_TX = 0x1c (command) */ -struct iwl3945_tx_cmd { +struct il3945_tx_cmd { /* * MPDU byte count: * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, @@ -1436,7 +1436,7 @@ struct iwl3945_tx_cmd { /* * REPLY_TX = 0x1c (response) */ -struct iwl3945_tx_resp { +struct il3945_tx_resp { u8 failure_rts; u8 failure_frame; u8 bt_kill_count; @@ -1451,13 +1451,13 @@ struct iwl3945_tx_resp { * Used for managing Tx retries when expecting block-acks. * Driver should set these fields to 0. */ -struct iwl_dram_scratch { +struct il_dram_scratch { u8 try_cnt; /* Tx attempts */ u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ __le16 reserved; } __packed; -struct iwl_tx_cmd { +struct il_tx_cmd { /* * MPDU byte count: * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, @@ -1481,7 +1481,7 @@ struct iwl_tx_cmd { /* uCode may modify this field of the Tx command (in host DRAM!). * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ - struct iwl_dram_scratch scratch; + struct il_dram_scratch scratch; /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ __le32 rate_n_flags; /* RATE_MCS_* */ @@ -1697,7 +1697,7 @@ struct agg_tx_status { __le16 sequence; } __packed; -struct iwl4965_tx_resp { +struct il4965_tx_resp { u8 frame_count; /* 1 no aggregation, >1 aggregation */ u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ u8 failure_rts; /* # failures due to unsuccessful RTS */ @@ -1739,7 +1739,7 @@ struct iwl4965_tx_resp { * * Reports Block-Acknowledge from recipient station */ -struct iwl_compressed_ba_resp { +struct il_compressed_ba_resp { __le32 sta_addr_lo32; __le16 sta_addr_hi16; __le16 reserved; @@ -1759,23 +1759,23 @@ struct iwl_compressed_ba_resp { * See details under "TXPOWER" in iwl-4965-hw.h. */ -struct iwl3945_txpowertable_cmd { +struct il3945_txpowertable_cmd { u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ u8 reserved; __le16 channel; - struct iwl3945_power_per_rate power[IWL_MAX_RATES]; + struct il3945_power_per_rate power[IL_MAX_RATES]; } __packed; -struct iwl4965_txpowertable_cmd { +struct il4965_txpowertable_cmd { u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ u8 reserved; __le16 channel; - struct iwl4965_tx_power_db tx_power; + struct il4965_tx_power_db tx_power; } __packed; /** - * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response + * struct il3945_rate_scaling_cmd - Rate Scaling Command & Response * * REPLY_RATE_SCALE = 0x47 (command, has simple generic response) * @@ -1789,16 +1789,16 @@ struct iwl4965_txpowertable_cmd { * when passed through ofdm_basic_rates on the REPLY_RXON * command would be bit 0 (1 << 0) */ -struct iwl3945_rate_scaling_info { +struct il3945_rate_scaling_info { __le16 rate_n_flags; u8 try_cnt; u8 next_rate_index; } __packed; -struct iwl3945_rate_scaling_cmd { +struct il3945_rate_scaling_cmd { u8 table_id; u8 reserved[3]; - struct iwl3945_rate_scaling_info table[IWL_MAX_RATES]; + struct il3945_rate_scaling_info table[IL_MAX_RATES]; } __packed; @@ -1818,11 +1818,11 @@ struct iwl3945_rate_scaling_cmd { /** - * struct iwl_link_qual_general_params + * struct il_link_qual_general_params * * Used in REPLY_TX_LINK_QUALITY_CMD */ -struct iwl_link_qual_general_params { +struct il_link_qual_general_params { u8 flags; /* No entries at or above this (driver chosen) index contain MIMO */ @@ -1861,11 +1861,11 @@ struct iwl_link_qual_general_params { #define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) /** - * struct iwl_link_qual_agg_params + * struct il_link_qual_agg_params * * Used in REPLY_TX_LINK_QUALITY_CMD */ -struct iwl_link_qual_agg_params { +struct il_link_qual_agg_params { /* *Maximum number of uSec in aggregation. @@ -1966,7 +1966,7 @@ struct iwl_link_qual_agg_params { * * When using block-ack (aggregation), all frames are transmitted at the same * rate, since there is no per-attempt acknowledgment from the destination - * station. The Tx response struct iwl_tx_resp indicates the Tx rate in + * station. The Tx response struct il_tx_resp indicates the Tx rate in * rate_n_flags field. After receiving a block-ack, the driver can update * history for the entire block all at once. * @@ -2079,14 +2079,14 @@ struct iwl_link_qual_agg_params { * legacy), and then repeat the search process. * */ -struct iwl_link_quality_cmd { +struct il_link_quality_cmd { /* Index of destination/recipient station in uCode's station table */ u8 sta_id; u8 reserved1; __le16 control; /* not used */ - struct iwl_link_qual_general_params general_params; - struct iwl_link_qual_agg_params agg_params; + struct il_link_qual_general_params general_params; + struct il_link_qual_agg_params agg_params; /* * Rate info; when using rate-scaling, Tx command's initial_rate_index @@ -2094,7 +2094,7 @@ struct iwl_link_quality_cmd { * 4965 devices works its way through table when retrying Tx. */ struct { - __le32 rate_n_flags; /* RATE_MCS_*, IWL_RATE_* */ + __le32 rate_n_flags; /* RATE_MCS_*, IL_RATE_* */ } rs_table[LINK_QUAL_MAX_RETRY_NUM]; __le32 reserved2; } __packed; @@ -2123,7 +2123,7 @@ struct iwl_link_quality_cmd { * same platform. Bluetooth device alerts wireless device when it will Tx; * wireless device can delay or kill its own Tx to accommodate. */ -struct iwl_bt_cmd { +struct il_bt_cmd { u8 flags; u8 lead_time; u8 max_kill; @@ -2150,18 +2150,18 @@ struct iwl_bt_cmd { RXON_FILTER_ASSOC_MSK | \ RXON_FILTER_BCON_AWARE_MSK) -struct iwl_measure_channel { +struct il_measure_channel { __le32 duration; /* measurement duration in extended beacon * format */ u8 channel; /* channel to measure */ - u8 type; /* see enum iwl_measure_type */ + u8 type; /* see enum il_measure_type */ __le16 reserved; } __packed; /* * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) */ -struct iwl_spectrum_cmd { +struct il_spectrum_cmd { __le16 len; /* number of bytes starting from token */ u8 token; /* token id */ u8 id; /* measurement id -- 0 or 1 */ @@ -2174,13 +2174,13 @@ struct iwl_spectrum_cmd { __le32 filter_flags; /* rxon filter flags */ __le16 channel_count; /* minimum 1, maximum 10 */ __le16 reserved3; - struct iwl_measure_channel channels[10]; + struct il_measure_channel channels[10]; } __packed; /* * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) */ -struct iwl_spectrum_resp { +struct il_spectrum_resp { u8 token; u8 id; /* id of the prior command replaced, or 0xff */ __le16 status; /* 0 - command will be handled @@ -2188,49 +2188,49 @@ struct iwl_spectrum_resp { * measurement) */ } __packed; -enum iwl_measurement_state { - IWL_MEASUREMENT_START = 0, - IWL_MEASUREMENT_STOP = 1, +enum il_measurement_state { + IL_MEASUREMENT_START = 0, + IL_MEASUREMENT_STOP = 1, }; -enum iwl_measurement_status { - IWL_MEASUREMENT_OK = 0, - IWL_MEASUREMENT_CONCURRENT = 1, - IWL_MEASUREMENT_CSA_CONFLICT = 2, - IWL_MEASUREMENT_TGH_CONFLICT = 3, +enum il_measurement_status { + IL_MEASUREMENT_OK = 0, + IL_MEASUREMENT_CONCURRENT = 1, + IL_MEASUREMENT_CSA_CONFLICT = 2, + IL_MEASUREMENT_TGH_CONFLICT = 3, /* 4-5 reserved */ - IWL_MEASUREMENT_STOPPED = 6, - IWL_MEASUREMENT_TIMEOUT = 7, - IWL_MEASUREMENT_PERIODIC_FAILED = 8, + IL_MEASUREMENT_STOPPED = 6, + IL_MEASUREMENT_TIMEOUT = 7, + IL_MEASUREMENT_PERIODIC_FAILED = 8, }; #define NUM_ELEMENTS_IN_HISTOGRAM 8 -struct iwl_measurement_histogram { +struct il_measurement_histogram { __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ } __packed; /* clear channel availability counters */ -struct iwl_measurement_cca_counters { +struct il_measurement_cca_counters { __le32 ofdm; __le32 cck; } __packed; -enum iwl_measure_type { - IWL_MEASURE_BASIC = (1 << 0), - IWL_MEASURE_CHANNEL_LOAD = (1 << 1), - IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), - IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), - IWL_MEASURE_FRAME = (1 << 4), +enum il_measure_type { + IL_MEASURE_BASIC = (1 << 0), + IL_MEASURE_CHANNEL_LOAD = (1 << 1), + IL_MEASURE_HISTOGRAM_RPI = (1 << 2), + IL_MEASURE_HISTOGRAM_NOISE = (1 << 3), + IL_MEASURE_FRAME = (1 << 4), /* bits 5:6 are reserved */ - IWL_MEASURE_IDLE = (1 << 7), + IL_MEASURE_IDLE = (1 << 7), }; /* * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) */ -struct iwl_spectrum_notification { +struct il_spectrum_notification { u8 id; /* measurement id -- 0 or 1 */ u8 token; u8 channel_index; /* index in measurement channel list */ @@ -2238,7 +2238,7 @@ struct iwl_spectrum_notification { __le32 start_time; /* lower 32-bits of TSF */ u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ u8 channel; - u8 type; /* see enum iwl_measurement_type */ + u8 type; /* see enum il_measurement_type */ u8 reserved1; /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only * valid if applicable for measurement type requested. */ @@ -2248,9 +2248,9 @@ struct iwl_spectrum_notification { u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - * unidentified */ u8 reserved2[3]; - struct iwl_measurement_histogram histogram; + struct il_measurement_histogram histogram; __le32 stop_time; /* lower 32-bits of TSF */ - __le32 status; /* see iwl_measurement_status */ + __le32 status; /* see il_measurement_status */ } __packed; /****************************************************************************** @@ -2260,7 +2260,7 @@ struct iwl_spectrum_notification { *****************************************************************************/ /** - * struct iwl_powertable_cmd - Power Table Command + * struct il_powertable_cmd - Power Table Command * @flags: See below: * * POWER_TABLE_CMD = 0x77 (command, has simple generic response) @@ -2294,26 +2294,26 @@ struct iwl_spectrum_notification { * ucode assume sleep over DTIM is allowed and we don't need to wake up * for every DTIM. */ -#define IWL_POWER_VEC_SIZE 5 +#define IL_POWER_VEC_SIZE 5 -#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) -#define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) +#define IL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) +#define IL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) -struct iwl3945_powertable_cmd { +struct il3945_powertable_cmd { __le16 flags; u8 reserved[2]; __le32 rx_data_timeout; __le32 tx_data_timeout; - __le32 sleep_interval[IWL_POWER_VEC_SIZE]; + __le32 sleep_interval[IL_POWER_VEC_SIZE]; } __packed; -struct iwl_powertable_cmd { +struct il_powertable_cmd { __le16 flags; u8 keep_alive_seconds; /* 3945 reserved */ u8 debug_flags; /* 3945 reserved */ __le32 rx_data_timeout; __le32 tx_data_timeout; - __le32 sleep_interval[IWL_POWER_VEC_SIZE]; + __le32 sleep_interval[IL_POWER_VEC_SIZE]; __le32 keep_alive_beacons; } __packed; @@ -2321,7 +2321,7 @@ struct iwl_powertable_cmd { * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) * all devices identical. */ -struct iwl_sleep_notification { +struct il_sleep_notification { u8 pm_sleep_mode; u8 pm_wakeup_src; __le16 reserved; @@ -2332,23 +2332,23 @@ struct iwl_sleep_notification { /* Sleep states. all devices identical. */ enum { - IWL_PM_NO_SLEEP = 0, - IWL_PM_SLP_MAC = 1, - IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, - IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, - IWL_PM_SLP_PHY = 4, - IWL_PM_SLP_REPENT = 5, - IWL_PM_WAKEUP_BY_TIMER = 6, - IWL_PM_WAKEUP_BY_DRIVER = 7, - IWL_PM_WAKEUP_BY_RFKILL = 8, + IL_PM_NO_SLEEP = 0, + IL_PM_SLP_MAC = 1, + IL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, + IL_PM_SLP_FULL_MAC_CARD_STATE = 3, + IL_PM_SLP_PHY = 4, + IL_PM_SLP_REPENT = 5, + IL_PM_WAKEUP_BY_TIMER = 6, + IL_PM_WAKEUP_BY_DRIVER = 7, + IL_PM_WAKEUP_BY_RFKILL = 8, /* 3 reserved */ - IWL_PM_NUM_OF_MODES = 12, + IL_PM_NUM_OF_MODES = 12, }; /* * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) */ -struct iwl_card_state_notif { +struct il_card_state_notif { __le32 flags; } __packed; @@ -2357,7 +2357,7 @@ struct iwl_card_state_notif { #define CT_CARD_DISABLED 0x04 #define RXON_CARD_DISABLED 0x10 -struct iwl_ct_kill_config { +struct il_ct_kill_config { __le32 reserved; __le32 critical_temperature_M; __le32 critical_temperature_R; @@ -2373,7 +2373,7 @@ struct iwl_ct_kill_config { #define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1) /** - * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table + * struct il_scan_channel - entry in REPLY_SCAN_CMD channel table * * One for each channel in the scan list. * Each channel can independently select: @@ -2383,7 +2383,7 @@ struct iwl_ct_kill_config { * quiet_plcp_th, good_CRC_th) * * To avoid uCode errors, make sure the following are true (see comments - * under struct iwl_scan_cmd about max_out_time and quiet_time): + * under struct il_scan_cmd about max_out_time and quiet_time): * 1) If using passive_dwell (i.e. passive_dwell != 0): * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) * 2) quiet_time <= active_dwell @@ -2391,7 +2391,7 @@ struct iwl_ct_kill_config { * passive_dwell < max_out_time * active_dwell < max_out_time */ -struct iwl3945_scan_channel { +struct il3945_scan_channel { /* * type is defined as: * 0:0 1 = active, 0 = passive @@ -2400,8 +2400,8 @@ struct iwl3945_scan_channel { * 5:7 reserved */ u8 type; - u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */ - struct iwl3945_tx_power tpc; + u8 channel; /* band is selected by il3945_scan_cmd "flags" field */ + struct il3945_tx_power tpc; __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ } __packed; @@ -2409,7 +2409,7 @@ struct iwl3945_scan_channel { /* set number of direct probes u8 type */ #define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1)))) -struct iwl_scan_channel { +struct il_scan_channel { /* * type is defined as: * 0:0 1 = active, 0 = passive @@ -2418,7 +2418,7 @@ struct iwl_scan_channel { * 21:31 reserved */ __le32 type; - __le16 channel; /* band is selected by iwl_scan_cmd "flags" field */ + __le16 channel; /* band is selected by il_scan_cmd "flags" field */ u8 tx_gain; /* gain for analog radio */ u8 dsp_atten; /* gain for DSP */ __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ @@ -2426,17 +2426,17 @@ struct iwl_scan_channel { } __packed; /* set number of direct probes __le32 type */ -#define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) +#define IL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) /** - * struct iwl_ssid_ie - directed scan network information element + * struct il_ssid_ie - directed scan network information element * * Up to 20 of these may appear in REPLY_SCAN_CMD (Note: Only 4 are in - * 3945 SCAN api), selected by "type" bit field in struct iwl_scan_channel; + * 3945 SCAN api), selected by "type" bit field in struct il_scan_channel; * each channel may select different ssids from among the 20 (4) entries. * SSID IEs get transmitted in reverse order of entry. */ -struct iwl_ssid_ie { +struct il_ssid_ie { u8 id; u8 len; u8 ssid[32]; @@ -2445,11 +2445,11 @@ struct iwl_ssid_ie { #define PROBE_OPTION_MAX_3945 4 #define PROBE_OPTION_MAX 20 #define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) -#define IWL_GOOD_CRC_TH_DISABLED 0 -#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) -#define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) -#define IWL_MAX_SCAN_SIZE 1024 -#define IWL_MAX_CMD_SIZE 4096 +#define IL_GOOD_CRC_TH_DISABLED 0 +#define IL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) +#define IL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) +#define IL_MAX_SCAN_SIZE 1024 +#define IL_MAX_CMD_SIZE 4096 /* * REPLY_SCAN_CMD = 0x80 (command) @@ -2501,10 +2501,10 @@ struct iwl_ssid_ie { * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. * * To avoid uCode errors, see timing restrictions described under - * struct iwl_scan_channel. + * struct il_scan_channel. */ -struct iwl3945_scan_cmd { +struct il3945_scan_cmd { __le16 len; u8 reserved0; u8 channel_count; /* # channels in channel list */ @@ -2525,10 +2525,10 @@ struct iwl3945_scan_cmd { /* For active scans (set to all-0s for passive scans). * Does not include payload. Must specify Tx rate; no rate scaling. */ - struct iwl3945_tx_cmd tx_cmd; + struct il3945_tx_cmd tx_cmd; /* For directed active scans (set to all-0s otherwise) */ - struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_3945]; + struct il_ssid_ie direct_scan[PROBE_OPTION_MAX_3945]; /* * Probe request frame, followed by channel list. @@ -2538,7 +2538,7 @@ struct iwl3945_scan_cmd { * Number of channels in list is specified by channel_count. * Each channel in list is of type: * - * struct iwl3945_scan_channel channels[0]; + * struct il3945_scan_channel channels[0]; * * NOTE: Only one band of channels can be scanned per pass. You * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait @@ -2548,7 +2548,7 @@ struct iwl3945_scan_cmd { u8 data[0]; } __packed; -struct iwl_scan_cmd { +struct il_scan_cmd { __le16 len; u8 reserved0; u8 channel_count; /* # channels in channel list */ @@ -2569,10 +2569,10 @@ struct iwl_scan_cmd { /* For active scans (set to all-0s for passive scans). * Does not include payload. Must specify Tx rate; no rate scaling. */ - struct iwl_tx_cmd tx_cmd; + struct il_tx_cmd tx_cmd; /* For directed active scans (set to all-0s otherwise) */ - struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; + struct il_ssid_ie direct_scan[PROBE_OPTION_MAX]; /* * Probe request frame, followed by channel list. @@ -2582,7 +2582,7 @@ struct iwl_scan_cmd { * Number of channels in list is specified by channel_count. * Each channel in list is of type: * - * struct iwl_scan_channel channels[0]; + * struct il_scan_channel channels[0]; * * NOTE: Only one band of channels can be scanned per pass. You * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait @@ -2600,14 +2600,14 @@ struct iwl_scan_cmd { /* * REPLY_SCAN_CMD = 0x80 (response) */ -struct iwl_scanreq_notification { +struct il_scanreq_notification { __le32 status; /* 1: okay, 2: cannot fulfill request */ } __packed; /* * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) */ -struct iwl_scanstart_notification { +struct il_scanstart_notification { __le32 tsf_low; __le32 tsf_high; __le32 beacon_timer; @@ -2620,17 +2620,17 @@ struct iwl_scanstart_notification { #define SCAN_OWNER_STATUS 0x1 #define MEASURE_OWNER_STATUS 0x2 -#define IWL_PROBE_STATUS_OK 0 -#define IWL_PROBE_STATUS_TX_FAILED BIT(0) +#define IL_PROBE_STATUS_OK 0 +#define IL_PROBE_STATUS_TX_FAILED BIT(0) /* error statuses combined with TX_FAILED */ -#define IWL_PROBE_STATUS_FAIL_TTL BIT(1) -#define IWL_PROBE_STATUS_FAIL_BT BIT(2) +#define IL_PROBE_STATUS_FAIL_TTL BIT(1) +#define IL_PROBE_STATUS_FAIL_BT BIT(2) #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ /* * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) */ -struct iwl_scanresults_notification { +struct il_scanresults_notification { u8 channel; u8 band; u8 probe_status; @@ -2643,7 +2643,7 @@ struct iwl_scanresults_notification { /* * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) */ -struct iwl_scancomplete_notification { +struct il_scancomplete_notification { u8 scanned_channels; u8 status; u8 last_channel; @@ -2658,24 +2658,24 @@ struct iwl_scancomplete_notification { * *****************************************************************************/ -enum iwl_ibss_manager { - IWL_NOT_IBSS_MANAGER = 0, - IWL_IBSS_MANAGER = 1, +enum il_ibss_manager { + IL_NOT_IBSS_MANAGER = 0, + IL_IBSS_MANAGER = 1, }; /* * BEACON_NOTIFICATION = 0x90 (notification only, not a command) */ -struct iwl3945_beacon_notif { - struct iwl3945_tx_resp beacon_notify_hdr; +struct il3945_beacon_notif { + struct il3945_tx_resp beacon_notify_hdr; __le32 low_tsf; __le32 high_tsf; __le32 ibss_mgr_status; } __packed; -struct iwl4965_beacon_notif { - struct iwl4965_tx_resp beacon_notify_hdr; +struct il4965_beacon_notif { + struct il4965_tx_resp beacon_notify_hdr; __le32 low_tsf; __le32 high_tsf; __le32 ibss_mgr_status; @@ -2685,16 +2685,16 @@ struct iwl4965_beacon_notif { * REPLY_TX_BEACON = 0x91 (command, has simple generic response) */ -struct iwl3945_tx_beacon_cmd { - struct iwl3945_tx_cmd tx; +struct il3945_tx_beacon_cmd { + struct il3945_tx_cmd tx; __le16 tim_idx; u8 tim_size; u8 reserved1; struct ieee80211_hdr frame[0]; /* beacon frame */ } __packed; -struct iwl_tx_beacon_cmd { - struct iwl_tx_cmd tx; +struct il_tx_beacon_cmd { + struct il_tx_cmd tx; __le16 tim_idx; u8 tim_size; u8 reserved1; @@ -2707,7 +2707,7 @@ struct iwl_tx_beacon_cmd { * *****************************************************************************/ -#define IWL_TEMP_CONVERT 260 +#define IL_TEMP_CONVERT 260 #define SUP_RATE_11A_MAX_NUM_CHANNELS 8 #define SUP_RATE_11B_MAX_NUM_CHANNELS 4 @@ -2977,10 +2977,10 @@ struct statistics_general { * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. */ -#define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ -#define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ -struct iwl_statistics_cmd { - __le32 configuration_flags; /* IWL_STATS_CONF_* */ +#define IL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ +#define IL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ +struct il_statistics_cmd { + __le32 configuration_flags; /* IL_STATS_CONF_* */ } __packed; /* @@ -3001,14 +3001,14 @@ struct iwl_statistics_cmd { #define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) #define STATISTICS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8) -struct iwl3945_notif_statistics { +struct il3945_notif_statistics { __le32 flag; struct iwl39_statistics_rx rx; struct iwl39_statistics_tx tx; struct iwl39_statistics_general general; } __packed; -struct iwl_notif_statistics { +struct il_notif_statistics { __le32 flag; struct statistics_rx rx; struct statistics_tx tx; @@ -3035,11 +3035,11 @@ struct iwl_notif_statistics { * */ -#define IWL_MISSED_BEACON_THRESHOLD_MIN (1) -#define IWL_MISSED_BEACON_THRESHOLD_DEF (5) -#define IWL_MISSED_BEACON_THRESHOLD_MAX IWL_MISSED_BEACON_THRESHOLD_DEF +#define IL_MISSED_BEACON_THRESHOLD_MIN (1) +#define IL_MISSED_BEACON_THRESHOLD_DEF (5) +#define IL_MISSED_BEACON_THRESHOLD_MAX IL_MISSED_BEACON_THRESHOLD_DEF -struct iwl_missed_beacon_notif { +struct il_missed_beacon_notif { __le32 consecutive_missed_beacons; __le32 total_missed_becons; __le32 num_expected_beacons; @@ -3111,7 +3111,7 @@ struct iwl_missed_beacon_notif { * * Total number of false alarms = false_alarms + plcp_errs * - * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd + * For OFDM, adjust the following table entries in struct il_sensitivity_cmd * (notice that the start points for OFDM are at or close to settings for * maximum sensitivity): * @@ -3152,7 +3152,7 @@ struct iwl_missed_beacon_notif { * Reset this to 0 at the first beacon period that falls within the * "good" range (5 to 50 false alarms per 204.8 milliseconds rx). * - * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd + * Then, adjust the following CCK table entries in struct il_sensitivity_cmd * (notice that the start points for CCK are at maximum sensitivity): * * START / MIN / MAX @@ -3217,7 +3217,7 @@ struct iwl_missed_beacon_notif { */ /* - * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd) + * Table entries in SENSITIVITY_CMD (struct il_sensitivity_cmd) */ #define HD_TABLE_SIZE (11) /* number of entries */ #define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */ @@ -3232,18 +3232,18 @@ struct iwl_missed_beacon_notif { #define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9) #define HD_OFDM_ENERGY_TH_IN_INDEX (10) -/* Control field in struct iwl_sensitivity_cmd */ +/* Control field in struct il_sensitivity_cmd */ #define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0) #define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1) /** - * struct iwl_sensitivity_cmd + * struct il_sensitivity_cmd * @control: (1) updates working table, (0) updates default table * @table: energy threshold values, use HD_* as index into table * * Always use "1" in "control" to update uCode's working table and DSP. */ -struct iwl_sensitivity_cmd { +struct il_sensitivity_cmd { __le16 control; /* always use "1" */ __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */ } __packed; @@ -3294,7 +3294,7 @@ struct iwl_sensitivity_cmd { * (accum_noise[i] - accum_noise[reference]) / 30 * * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB. - * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the + * For use in diff_gain_[abc] fields of struct il_calibration_cmd, the * driver should limit the difference results to a range of 0-3 (0-4.5 dB), * and set bit 2 to indicate "reduce gain". The value for the reference * (weakest) chain should be "0". @@ -3306,24 +3306,24 @@ struct iwl_sensitivity_cmd { /* Phy calibration command for series */ /* The default calibrate table size if not specified by firmware */ -#define IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18 +#define IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18 enum { - IWL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7, - IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19, + IL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7, + IL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19, }; -#define IWL_MAX_PHY_CALIBRATE_TBL_SIZE (253) +#define IL_MAX_PHY_CALIBRATE_TBL_SIZE (253) -struct iwl_calib_hdr { +struct il_calib_hdr { u8 op_code; u8 first_group; u8 groups_num; u8 data_valid; } __packed; -/* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ -struct iwl_calib_diff_gain_cmd { - struct iwl_calib_hdr hdr; +/* IL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ +struct il_calib_diff_gain_cmd { + struct il_calib_hdr hdr; s8 diff_gain_a; /* see above */ s8 diff_gain_b; s8 diff_gain_c; @@ -3343,7 +3343,7 @@ struct iwl_calib_diff_gain_cmd { * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), * this command turns it on or off, or sets up a periodic blinking cycle. */ -struct iwl_led_cmd { +struct il_led_cmd { __le32 interval; /* "interval" in uSec */ u8 id; /* 1: Activity, 2: Link, 3: Tech */ u8 off; /* # intervals off while blinking; @@ -3360,7 +3360,7 @@ struct iwl_led_cmd { * *****************************************************************************/ -struct iwl_rx_packet { +struct il_rx_packet { /* * The first 4 bytes of the RX frame header contain both the RX frame * size and some flags. @@ -3372,27 +3372,27 @@ struct iwl_rx_packet { * 13-00: RX frame size */ __le32 len_n_flags; - struct iwl_cmd_header hdr; + struct il_cmd_header hdr; union { - struct iwl3945_rx_frame rx_frame; - struct iwl3945_tx_resp tx_resp; - struct iwl3945_beacon_notif beacon_status; - - struct iwl_alive_resp alive_frame; - struct iwl_spectrum_notification spectrum_notif; - struct iwl_csa_notification csa_notif; - struct iwl_error_resp err_resp; - struct iwl_card_state_notif card_state_notif; - struct iwl_add_sta_resp add_sta; - struct iwl_rem_sta_resp rem_sta; - struct iwl_sleep_notification sleep_notif; - struct iwl_spectrum_resp spectrum; - struct iwl_notif_statistics stats; - struct iwl_compressed_ba_resp compressed_ba; - struct iwl_missed_beacon_notif missed_beacon; + struct il3945_rx_frame rx_frame; + struct il3945_tx_resp tx_resp; + struct il3945_beacon_notif beacon_status; + + struct il_alive_resp alive_frame; + struct il_spectrum_notification spectrum_notif; + struct il_csa_notification csa_notif; + struct il_error_resp err_resp; + struct il_card_state_notif card_state_notif; + struct il_add_sta_resp add_sta; + struct il_rem_sta_resp rem_sta; + struct il_sleep_notification sleep_notif; + struct il_spectrum_resp spectrum; + struct il_notif_statistics stats; + struct il_compressed_ba_resp compressed_ba; + struct il_missed_beacon_notif missed_beacon; __le32 status; u8 raw[0]; } u; } __packed; -#endif /* __iwl_legacy_commands_h__ */ +#endif /* __il_commands_h__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c index 2bd5659..7eae279 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); /* This function both allocates and initializes hw and priv. */ -struct ieee80211_hw *iwl_legacy_alloc_all(struct iwl_cfg *cfg) +struct ieee80211_hw *il_alloc_all(struct il_cfg *cfg) { - struct iwl_priv *priv; + struct il_priv *priv; /* mac80211 allocates memory for this device instance, including * space for this driver's private structure */ struct ieee80211_hw *hw; - hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), + hw = ieee80211_alloc_hw(sizeof(struct il_priv), cfg->ops->ieee80211_ops); if (hw == NULL) { pr_err("%s: Can not allocate network device\n", @@ -97,11 +97,11 @@ struct ieee80211_hw *iwl_legacy_alloc_all(struct iwl_cfg *cfg) out: return hw; } -EXPORT_SYMBOL(iwl_legacy_alloc_all); +EXPORT_SYMBOL(il_alloc_all); #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ #define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ -static void iwl_legacy_init_ht_hw_capab(const struct iwl_priv *priv, +static void il_init_ht_hw_capab(const struct il_priv *priv, struct ieee80211_sta_ht_cap *ht_info, enum ieee80211_band band) { @@ -150,11 +150,11 @@ static void iwl_legacy_init_ht_hw_capab(const struct iwl_priv *priv, } /** - * iwl_legacy_init_geos - Initialize mac80211's geo/channel info based from eeprom + * il_init_geos - Initialize mac80211's geo/channel info based from eeprom */ -int iwl_legacy_init_geos(struct iwl_priv *priv) +int il_init_geos(struct il_priv *priv) { - struct iwl_channel_info *ch; + struct il_channel_info *ch; struct ieee80211_supported_band *sband; struct ieee80211_channel *channels; struct ieee80211_channel *geo_ch; @@ -164,7 +164,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { - IWL_DEBUG_INFO(priv, "Geography modes already initialized.\n"); + IL_DEBUG_INFO(priv, "Geography modes already initialized.\n"); set_bit(STATUS_GEO_CONFIGURED, &priv->status); return 0; } @@ -174,7 +174,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) if (!channels) return -ENOMEM; - rates = kzalloc((sizeof(struct ieee80211_rate) * IWL_RATE_COUNT_LEGACY), + rates = kzalloc((sizeof(struct ieee80211_rate) * IL_RATE_COUNT_LEGACY), GFP_KERNEL); if (!rates) { kfree(channels); @@ -185,21 +185,21 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) sband = &priv->bands[IEEE80211_BAND_5GHZ]; sband->channels = &channels[ARRAY_SIZE(iwlegacy_eeprom_band_1)]; /* just OFDM */ - sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; - sband->n_bitrates = IWL_RATE_COUNT_LEGACY - IWL_FIRST_OFDM_RATE; + sband->bitrates = &rates[IL_FIRST_OFDM_RATE]; + sband->n_bitrates = IL_RATE_COUNT_LEGACY - IL_FIRST_OFDM_RATE; - if (priv->cfg->sku & IWL_SKU_N) - iwl_legacy_init_ht_hw_capab(priv, &sband->ht_cap, + if (priv->cfg->sku & IL_SKU_N) + il_init_ht_hw_capab(priv, &sband->ht_cap, IEEE80211_BAND_5GHZ); sband = &priv->bands[IEEE80211_BAND_2GHZ]; sband->channels = channels; /* OFDM & CCK */ sband->bitrates = rates; - sband->n_bitrates = IWL_RATE_COUNT_LEGACY; + sband->n_bitrates = IL_RATE_COUNT_LEGACY; - if (priv->cfg->sku & IWL_SKU_N) - iwl_legacy_init_ht_hw_capab(priv, &sband->ht_cap, + if (priv->cfg->sku & IL_SKU_N) + il_init_ht_hw_capab(priv, &sband->ht_cap, IEEE80211_BAND_2GHZ); priv->ieee_channels = channels; @@ -208,7 +208,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) for (i = 0; i < priv->channel_count; i++) { ch = &priv->channel_info[i]; - if (!iwl_legacy_is_channel_valid(ch)) + if (!il_is_channel_valid(ch)) continue; sband = &priv->bands[ch->band]; @@ -221,7 +221,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) geo_ch->max_antenna_gain = 0xff; geo_ch->hw_value = ch->channel; - if (iwl_legacy_is_channel_valid(ch)) { + if (il_is_channel_valid(ch)) { if (!(ch->flags & EEPROM_CHANNEL_IBSS)) geo_ch->flags |= IEEE80211_CHAN_NO_IBSS; @@ -239,9 +239,9 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) geo_ch->flags |= IEEE80211_CHAN_DISABLED; } - IWL_DEBUG_INFO(priv, "Channel %d Freq=%d[%sGHz] %s flag=0x%X\n", + IL_DEBUG_INFO(priv, "Channel %d Freq=%d[%sGHz] %s flag=0x%X\n", ch->channel, geo_ch->center_freq, - iwl_legacy_is_channel_a_band(ch) ? "5.2" : "2.4", + il_is_channel_a_band(ch) ? "5.2" : "2.4", geo_ch->flags & IEEE80211_CHAN_DISABLED ? "restricted" : "valid", geo_ch->flags); @@ -252,15 +252,15 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) priv->tx_power_next = max_tx_power; if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && - priv->cfg->sku & IWL_SKU_A) { - IWL_INFO(priv, "Incorrectly detected BG card as ABG. " + priv->cfg->sku & IL_SKU_A) { + IL_INFO(priv, "Incorrectly detected BG card as ABG. " "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n", priv->pci_dev->device, priv->pci_dev->subsystem_device); - priv->cfg->sku &= ~IWL_SKU_A; + priv->cfg->sku &= ~IL_SKU_A; } - IWL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n", + IL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n", priv->bands[IEEE80211_BAND_2GHZ].n_channels, priv->bands[IEEE80211_BAND_5GHZ].n_channels); @@ -268,27 +268,27 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) return 0; } -EXPORT_SYMBOL(iwl_legacy_init_geos); +EXPORT_SYMBOL(il_init_geos); /* - * iwl_legacy_free_geos - undo allocations in iwl_legacy_init_geos + * il_free_geos - undo allocations in il_init_geos */ -void iwl_legacy_free_geos(struct iwl_priv *priv) +void il_free_geos(struct il_priv *priv) { kfree(priv->ieee_channels); kfree(priv->ieee_rates); clear_bit(STATUS_GEO_CONFIGURED, &priv->status); } -EXPORT_SYMBOL(iwl_legacy_free_geos); +EXPORT_SYMBOL(il_free_geos); -static bool iwl_legacy_is_channel_extension(struct iwl_priv *priv, +static bool il_is_channel_extension(struct il_priv *priv, enum ieee80211_band band, u16 channel, u8 extension_chan_offset) { - const struct iwl_channel_info *ch_info; + const struct il_channel_info *ch_info; - ch_info = iwl_legacy_get_channel_info(priv, band, channel); - if (!iwl_legacy_is_channel_valid(ch_info)) + ch_info = il_get_channel_info(priv, band, channel); + if (!il_is_channel_valid(ch_info)) return false; 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, return false; } -bool iwl_legacy_is_ht40_tx_allowed(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +bool il_is_ht40_tx_allowed(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_sta_ht_cap *ht_cap) { if (!ctx->ht.enabled || !ctx->ht.is_40mhz) @@ -320,13 +320,13 @@ bool iwl_legacy_is_ht40_tx_allowed(struct iwl_priv *priv, return false; #endif - return iwl_legacy_is_channel_extension(priv, priv->band, + return il_is_channel_extension(priv, priv->band, le16_to_cpu(ctx->staging.channel), ctx->ht.extension_chan_offset); } -EXPORT_SYMBOL(iwl_legacy_is_ht40_tx_allowed); +EXPORT_SYMBOL(il_is_ht40_tx_allowed); -static u16 iwl_legacy_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) +static u16 il_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) { u16 new_val; u16 beacon_factor; @@ -360,7 +360,7 @@ static u16 iwl_legacy_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) } int -iwl_legacy_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx) +il_send_rxon_timing(struct il_priv *priv, struct il_rxon_context *ctx) { u64 tsf; s32 interval_tm, rem; @@ -368,11 +368,11 @@ iwl_legacy_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx) u16 beacon_int; struct ieee80211_vif *vif = ctx->vif; - conf = iwl_legacy_ieee80211_get_hw_conf(priv->hw); + conf = il_ieee80211_get_hw_conf(priv->hw); lockdep_assert_held(&priv->mutex); - memset(&ctx->timing, 0, sizeof(struct iwl_rxon_time_cmd)); + memset(&ctx->timing, 0, sizeof(struct il_rxon_time_cmd)); ctx->timing.timestamp = cpu_to_le64(priv->timestamp); 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) */ ctx->timing.atim_window = 0; - beacon_int = iwl_legacy_adjust_beacon_interval(beacon_int, + beacon_int = il_adjust_beacon_interval(beacon_int, priv->hw_params.max_beacon_itrvl * TIME_UNIT); ctx->timing.beacon_interval = cpu_to_le16(beacon_int); @@ -396,23 +396,23 @@ iwl_legacy_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ctx->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ?: 1) : 1; - IWL_DEBUG_ASSOC(priv, + IL_DEBUG_ASSOC(priv, "beacon interval %d beacon timer %d beacon tim %d\n", le16_to_cpu(ctx->timing.beacon_interval), le32_to_cpu(ctx->timing.beacon_init_val), le16_to_cpu(ctx->timing.atim_window)); - return iwl_legacy_send_cmd_pdu(priv, ctx->rxon_timing_cmd, + return il_send_cmd_pdu(priv, ctx->rxon_timing_cmd, sizeof(ctx->timing), &ctx->timing); } -EXPORT_SYMBOL(iwl_legacy_send_rxon_timing); +EXPORT_SYMBOL(il_send_rxon_timing); void -iwl_legacy_set_rxon_hwcrypto(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +il_set_rxon_hwcrypto(struct il_priv *priv, + struct il_rxon_context *ctx, int hw_decrypt) { - struct iwl_legacy_rxon_cmd *rxon = &ctx->staging; + struct il_rxon_cmd *rxon = &ctx->staging; if (hw_decrypt) rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; @@ -420,112 +420,112 @@ iwl_legacy_set_rxon_hwcrypto(struct iwl_priv *priv, rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK; } -EXPORT_SYMBOL(iwl_legacy_set_rxon_hwcrypto); +EXPORT_SYMBOL(il_set_rxon_hwcrypto); /* validate RXON structure is valid */ int -iwl_legacy_check_rxon_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx) +il_check_rxon_cmd(struct il_priv *priv, struct il_rxon_context *ctx) { - struct iwl_legacy_rxon_cmd *rxon = &ctx->staging; + struct il_rxon_cmd *rxon = &ctx->staging; bool error = false; if (rxon->flags & RXON_FLG_BAND_24G_MSK) { if (rxon->flags & RXON_FLG_TGJ_NARROW_BAND_MSK) { - IWL_WARN(priv, "check 2.4G: wrong narrow\n"); + IL_WARN(priv, "check 2.4G: wrong narrow\n"); error = true; } if (rxon->flags & RXON_FLG_RADAR_DETECT_MSK) { - IWL_WARN(priv, "check 2.4G: wrong radar\n"); + IL_WARN(priv, "check 2.4G: wrong radar\n"); error = true; } } else { if (!(rxon->flags & RXON_FLG_SHORT_SLOT_MSK)) { - IWL_WARN(priv, "check 5.2G: not short slot!\n"); + IL_WARN(priv, "check 5.2G: not short slot!\n"); error = true; } if (rxon->flags & RXON_FLG_CCK_MSK) { - IWL_WARN(priv, "check 5.2G: CCK!\n"); + IL_WARN(priv, "check 5.2G: CCK!\n"); error = true; } } if ((rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1) { - IWL_WARN(priv, "mac/bssid mcast!\n"); + IL_WARN(priv, "mac/bssid mcast!\n"); error = true; } /* make sure basic rates 6Mbps and 1Mbps are supported */ - if ((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0 && - (rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0) { - IWL_WARN(priv, "neither 1 nor 6 are basic\n"); + if ((rxon->ofdm_basic_rates & IL_RATE_6M_MASK) == 0 && + (rxon->cck_basic_rates & IL_RATE_1M_MASK) == 0) { + IL_WARN(priv, "neither 1 nor 6 are basic\n"); error = true; } if (le16_to_cpu(rxon->assoc_id) > 2007) { - IWL_WARN(priv, "aid > 2007\n"); + IL_WARN(priv, "aid > 2007\n"); error = true; } if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) { - IWL_WARN(priv, "CCK and short slot\n"); + IL_WARN(priv, "CCK and short slot\n"); error = true; } if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) { - IWL_WARN(priv, "CCK and auto detect"); + IL_WARN(priv, "CCK and auto detect"); error = true; } if ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK) { - IWL_WARN(priv, "TGg but no auto-detect\n"); + IL_WARN(priv, "TGg but no auto-detect\n"); error = true; } if (error) - IWL_WARN(priv, "Tuning to channel %d\n", + IL_WARN(priv, "Tuning to channel %d\n", le16_to_cpu(rxon->channel)); if (error) { - IWL_ERR(priv, "Invalid RXON\n"); + IL_ERR(priv, "Invalid RXON\n"); return -EINVAL; } return 0; } -EXPORT_SYMBOL(iwl_legacy_check_rxon_cmd); +EXPORT_SYMBOL(il_check_rxon_cmd); /** - * iwl_legacy_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed + * il_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed * @priv: staging_rxon is compared to active_rxon * * If the RXON structure is changing enough to require a new tune, * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. */ -int iwl_legacy_full_rxon_required(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +int il_full_rxon_required(struct il_priv *priv, + struct il_rxon_context *ctx) { - const struct iwl_legacy_rxon_cmd *staging = &ctx->staging; - const struct iwl_legacy_rxon_cmd *active = &ctx->active; + const struct il_rxon_cmd *staging = &ctx->staging; + const struct il_rxon_cmd *active = &ctx->active; #define CHK(cond) \ if ((cond)) { \ - IWL_DEBUG_INFO(priv, "need full RXON - " #cond "\n"); \ + IL_DEBUG_INFO(priv, "need full RXON - " #cond "\n"); \ return 1; \ } #define CHK_NEQ(c1, c2) \ if ((c1) != (c2)) { \ - IWL_DEBUG_INFO(priv, "need full RXON - " \ + IL_DEBUG_INFO(priv, "need full RXON - " \ #c1 " != " #c2 " - %d != %d\n", \ (c1), (c2)); \ return 1; \ } /* These items are only settable from the full RXON command */ - CHK(!iwl_legacy_is_associated_ctx(ctx)); + CHK(!il_is_associated_ctx(ctx)); CHK(compare_ether_addr(staging->bssid_addr, active->bssid_addr)); CHK(compare_ether_addr(staging->node_addr, active->node_addr)); CHK(compare_ether_addr(staging->wlap_bssid_addr, @@ -556,27 +556,27 @@ int iwl_legacy_full_rxon_required(struct iwl_priv *priv, return 0; } -EXPORT_SYMBOL(iwl_legacy_full_rxon_required); +EXPORT_SYMBOL(il_full_rxon_required); -u8 iwl_legacy_get_lowest_plcp(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +u8 il_get_lowest_plcp(struct il_priv *priv, + struct il_rxon_context *ctx) { /* * Assign the lowest rate -- should really get this from * the beacon skb from mac80211. */ if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) - return IWL_RATE_1M_PLCP; + return IL_RATE_1M_PLCP; else - return IWL_RATE_6M_PLCP; + return IL_RATE_6M_PLCP; } -EXPORT_SYMBOL(iwl_legacy_get_lowest_plcp); +EXPORT_SYMBOL(il_get_lowest_plcp); -static void _iwl_legacy_set_rxon_ht(struct iwl_priv *priv, - struct iwl_ht_config *ht_conf, - struct iwl_rxon_context *ctx) +static void _il_set_rxon_ht(struct il_priv *priv, + struct il_ht_config *ht_conf, + struct il_rxon_context *ctx) { - struct iwl_legacy_rxon_cmd *rxon = &ctx->staging; + struct il_rxon_cmd *rxon = &ctx->staging; if (!ctx->ht.enabled) { rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | @@ -594,7 +594,7 @@ static void _iwl_legacy_set_rxon_ht(struct iwl_priv *priv, /* clear the HT channel mode before set the mode */ rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); - if (iwl_legacy_is_ht40_tx_allowed(priv, ctx, NULL)) { + if (il_is_ht40_tx_allowed(priv, ctx, NULL)) { /* pure ht40 */ if (ctx->ht.protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) { @@ -626,7 +626,7 @@ static void _iwl_legacy_set_rxon_ht(struct iwl_priv *priv, case IEEE80211_HT_PARAM_CHA_SEC_NONE: default: /* channel location only valid if in Mixed mode */ - IWL_ERR(priv, + IL_ERR(priv, "invalid extension channel offset\n"); break; } @@ -638,30 +638,30 @@ static void _iwl_legacy_set_rxon_ht(struct iwl_priv *priv, if (priv->cfg->ops->hcmd->set_rxon_chain) priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); - IWL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X " + IL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X " "extension channel offset 0x%x\n", le32_to_cpu(rxon->flags), ctx->ht.protection, ctx->ht.extension_chan_offset); } -void iwl_legacy_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf) +void il_set_rxon_ht(struct il_priv *priv, struct il_ht_config *ht_conf) { - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; for_each_context(priv, ctx) - _iwl_legacy_set_rxon_ht(priv, ht_conf, ctx); + _il_set_rxon_ht(priv, ht_conf, ctx); } -EXPORT_SYMBOL(iwl_legacy_set_rxon_ht); +EXPORT_SYMBOL(il_set_rxon_ht); /* Return valid, unused, channel for a passive scan to reset the RF */ -u8 iwl_legacy_get_single_channel_number(struct iwl_priv *priv, +u8 il_get_single_channel_number(struct il_priv *priv, enum ieee80211_band band) { - const struct iwl_channel_info *ch_info; + const struct il_channel_info *ch_info; int i; u8 channel = 0; u8 min, max; - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; if (band == IEEE80211_BAND_5GHZ) { min = 14; @@ -685,25 +685,25 @@ u8 iwl_legacy_get_single_channel_number(struct iwl_priv *priv, continue; channel = priv->channel_info[i].channel; - ch_info = iwl_legacy_get_channel_info(priv, band, channel); - if (iwl_legacy_is_channel_valid(ch_info)) + ch_info = il_get_channel_info(priv, band, channel); + if (il_is_channel_valid(ch_info)) break; } return channel; } -EXPORT_SYMBOL(iwl_legacy_get_single_channel_number); +EXPORT_SYMBOL(il_get_single_channel_number); /** - * iwl_legacy_set_rxon_channel - Set the band and channel values in staging RXON + * il_set_rxon_channel - Set the band and channel values in staging RXON * @ch: requested channel as a pointer to struct ieee80211_channel * NOTE: Does not commit to the hardware; it sets appropriate bit fields * in the staging RXON flag structure based on the ch->band */ int -iwl_legacy_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch, - struct iwl_rxon_context *ctx) +il_set_rxon_channel(struct il_priv *priv, struct ieee80211_channel *ch, + struct il_rxon_context *ctx) { enum ieee80211_band band = ch->band; u16 channel = ch->hw_value; @@ -720,14 +720,14 @@ iwl_legacy_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch, priv->band = band; - IWL_DEBUG_INFO(priv, "Staging channel set to %d [%d]\n", channel, band); + IL_DEBUG_INFO(priv, "Staging channel set to %d [%d]\n", channel, band); return 0; } -EXPORT_SYMBOL(iwl_legacy_set_rxon_channel); +EXPORT_SYMBOL(il_set_rxon_channel); -void iwl_legacy_set_flags_for_band(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +void il_set_flags_for_band(struct il_priv *priv, + struct il_rxon_context *ctx, enum ieee80211_band band, struct ieee80211_vif *vif) { @@ -737,7 +737,7 @@ void iwl_legacy_set_flags_for_band(struct iwl_priv *priv, | RXON_FLG_CCK_MSK); ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; } else { - /* Copied from iwl_post_associate() */ + /* Copied from il_post_associate() */ if (vif && vif->bss_conf.use_short_slot) ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; else @@ -748,15 +748,15 @@ void iwl_legacy_set_flags_for_band(struct iwl_priv *priv, ctx->staging.flags &= ~RXON_FLG_CCK_MSK; } } -EXPORT_SYMBOL(iwl_legacy_set_flags_for_band); +EXPORT_SYMBOL(il_set_flags_for_band); /* * initialize rxon structure with default values from eeprom */ -void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +void il_connection_init_rx_config(struct il_priv *priv, + struct il_rxon_context *ctx) { - const struct iwl_channel_info *ch_info; + const struct il_channel_info *ch_info; memset(&ctx->staging, 0, sizeof(ctx->staging)); @@ -778,7 +778,7 @@ void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv, break; default: - IWL_ERR(priv, "Unsupported interface type %d\n", + IL_ERR(priv, "Unsupported interface type %d\n", ctx->vif->type); break; } @@ -792,7 +792,7 @@ void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv, ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; #endif - ch_info = iwl_legacy_get_channel_info(priv, priv->band, + ch_info = il_get_channel_info(priv, priv->band, le16_to_cpu(ctx->active.channel)); if (!ch_info) @@ -801,12 +801,12 @@ void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv, ctx->staging.channel = cpu_to_le16(ch_info->channel); priv->band = ch_info->band; - iwl_legacy_set_flags_for_band(priv, ctx, priv->band, ctx->vif); + il_set_flags_for_band(priv, ctx, priv->band, ctx->vif); ctx->staging.ofdm_basic_rates = - (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; + (IL_OFDM_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; ctx->staging.cck_basic_rates = - (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; + (IL_CCK_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF; /* clear both MIX and PURE40 mode flag */ ctx->staging.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED | @@ -817,18 +817,18 @@ void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv, ctx->staging.ofdm_ht_single_stream_basic_rates = 0xff; ctx->staging.ofdm_ht_dual_stream_basic_rates = 0xff; } -EXPORT_SYMBOL(iwl_legacy_connection_init_rx_config); +EXPORT_SYMBOL(il_connection_init_rx_config); -void iwl_legacy_set_rate(struct iwl_priv *priv) +void il_set_rate(struct il_priv *priv) { const struct ieee80211_supported_band *hw = NULL; struct ieee80211_rate *rate; - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; int i; - hw = iwl_get_hw_mode(priv, priv->band); + hw = il_get_hw_mode(priv, priv->band); if (!hw) { - IWL_ERR(priv, "Failed to set rate: unable to get hw mode\n"); + IL_ERR(priv, "Failed to set rate: unable to get hw mode\n"); return; } @@ -836,25 +836,25 @@ void iwl_legacy_set_rate(struct iwl_priv *priv) for (i = 0; i < hw->n_bitrates; i++) { rate = &(hw->bitrates[i]); - if (rate->hw_value < IWL_RATE_COUNT_LEGACY) + if (rate->hw_value < IL_RATE_COUNT_LEGACY) priv->active_rate |= (1 << rate->hw_value); } - IWL_DEBUG_RATE(priv, "Set active_rate = %0x\n", priv->active_rate); + IL_DEBUG_RATE(priv, "Set active_rate = %0x\n", priv->active_rate); for_each_context(priv, ctx) { ctx->staging.cck_basic_rates = - (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; + (IL_CCK_BASIC_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF; ctx->staging.ofdm_basic_rates = - (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; + (IL_OFDM_BASIC_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; } } -EXPORT_SYMBOL(iwl_legacy_set_rate); +EXPORT_SYMBOL(il_set_rate); -void iwl_legacy_chswitch_done(struct iwl_priv *priv, bool is_success) +void il_chswitch_done(struct il_priv *priv, bool is_success) { - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; @@ -862,15 +862,15 @@ void iwl_legacy_chswitch_done(struct iwl_priv *priv, bool is_success) if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) ieee80211_chswitch_done(ctx->vif, is_success); } -EXPORT_SYMBOL(iwl_legacy_chswitch_done); +EXPORT_SYMBOL(il_chswitch_done); -void iwl_legacy_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) +void il_rx_csa(struct il_priv *priv, struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_csa_notification *csa = &(pkt->u.csa_notif); + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_csa_notification *csa = &(pkt->u.csa_notif); - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - struct iwl_legacy_rxon_cmd *rxon = (void *)&ctx->active; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_cmd *rxon = (void *)&ctx->active; if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) return; @@ -878,63 +878,63 @@ void iwl_legacy_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) { rxon->channel = csa->channel; ctx->staging.channel = csa->channel; - IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", + IL_DEBUG_11H(priv, "CSA notif: channel %d\n", le16_to_cpu(csa->channel)); - iwl_legacy_chswitch_done(priv, true); + il_chswitch_done(priv, true); } else { - IWL_ERR(priv, "CSA notif (fail) : channel %d\n", + IL_ERR(priv, "CSA notif (fail) : channel %d\n", le16_to_cpu(csa->channel)); - iwl_legacy_chswitch_done(priv, false); + il_chswitch_done(priv, false); } } -EXPORT_SYMBOL(iwl_legacy_rx_csa); +EXPORT_SYMBOL(il_rx_csa); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -void iwl_legacy_print_rx_config_cmd(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +void il_print_rx_config_cmd(struct il_priv *priv, + struct il_rxon_context *ctx) { - struct iwl_legacy_rxon_cmd *rxon = &ctx->staging; + struct il_rxon_cmd *rxon = &ctx->staging; - IWL_DEBUG_RADIO(priv, "RX CONFIG:\n"); - iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); - IWL_DEBUG_RADIO(priv, "u16 channel: 0x%x\n", + IL_DEBUG_RADIO(priv, "RX CONFIG:\n"); + il_print_hex_dump(priv, IL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); + IL_DEBUG_RADIO(priv, "u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); - IWL_DEBUG_RADIO(priv, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); - IWL_DEBUG_RADIO(priv, "u32 filter_flags: 0x%08x\n", + IL_DEBUG_RADIO(priv, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); + IL_DEBUG_RADIO(priv, "u32 filter_flags: 0x%08x\n", le32_to_cpu(rxon->filter_flags)); - IWL_DEBUG_RADIO(priv, "u8 dev_type: 0x%x\n", rxon->dev_type); - IWL_DEBUG_RADIO(priv, "u8 ofdm_basic_rates: 0x%02x\n", + IL_DEBUG_RADIO(priv, "u8 dev_type: 0x%x\n", rxon->dev_type); + IL_DEBUG_RADIO(priv, "u8 ofdm_basic_rates: 0x%02x\n", rxon->ofdm_basic_rates); - IWL_DEBUG_RADIO(priv, "u8 cck_basic_rates: 0x%02x\n", + IL_DEBUG_RADIO(priv, "u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates); - IWL_DEBUG_RADIO(priv, "u8[6] node_addr: %pM\n", rxon->node_addr); - IWL_DEBUG_RADIO(priv, "u8[6] bssid_addr: %pM\n", rxon->bssid_addr); - IWL_DEBUG_RADIO(priv, "u16 assoc_id: 0x%x\n", + IL_DEBUG_RADIO(priv, "u8[6] node_addr: %pM\n", rxon->node_addr); + IL_DEBUG_RADIO(priv, "u8[6] bssid_addr: %pM\n", rxon->bssid_addr); + IL_DEBUG_RADIO(priv, "u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id)); } -EXPORT_SYMBOL(iwl_legacy_print_rx_config_cmd); +EXPORT_SYMBOL(il_print_rx_config_cmd); #endif /** - * iwl_legacy_irq_handle_error - called for HW or SW error interrupt from card + * il_irq_handle_error - called for HW or SW error interrupt from card */ -void iwl_legacy_irq_handle_error(struct iwl_priv *priv) +void il_irq_handle_error(struct il_priv *priv) { - /* Set the FW error flag -- cleared on iwl_down */ + /* Set the FW error flag -- cleared on il_down */ set_bit(STATUS_FW_ERROR, &priv->status); /* Cancel currently queued command. */ clear_bit(STATUS_HCMD_ACTIVE, &priv->status); - IWL_ERR(priv, "Loaded firmware version: %s\n", + IL_ERR(priv, "Loaded firmware version: %s\n", priv->hw->wiphy->fw_version); priv->cfg->ops->lib->dump_nic_error_log(priv); if (priv->cfg->ops->lib->dump_fh) priv->cfg->ops->lib->dump_fh(priv, NULL, false); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (iwl_legacy_get_debug_level(priv) & IWL_DL_FW_ERRORS) - iwl_legacy_print_rx_config_cmd(priv, - &priv->contexts[IWL_RXON_CTX_BSS]); + if (il_get_debug_level(priv) & IL_DL_FW_ERRORS) + il_print_rx_config_cmd(priv, + &priv->contexts[IL_RXON_CTX_BSS]); #endif wake_up(&priv->wait_command_queue); @@ -944,41 +944,41 @@ void iwl_legacy_irq_handle_error(struct iwl_priv *priv) clear_bit(STATUS_READY, &priv->status); if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) { - IWL_DEBUG(priv, IWL_DL_FW_ERRORS, + IL_DEBUG(priv, IL_DL_FW_ERRORS, "Restarting adapter due to uCode error.\n"); if (priv->cfg->mod_params->restart_fw) queue_work(priv->workqueue, &priv->restart); } } -EXPORT_SYMBOL(iwl_legacy_irq_handle_error); +EXPORT_SYMBOL(il_irq_handle_error); -static int iwl_legacy_apm_stop_master(struct iwl_priv *priv) +static int il_apm_stop_master(struct il_priv *priv) { int ret = 0; /* stop device's busmaster DMA activity */ - iwl_legacy_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); + il_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); - ret = iwl_poll_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, + ret = il_poll_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); if (ret) - IWL_WARN(priv, "Master Disable Timed Out, 100 usec\n"); + IL_WARN(priv, "Master Disable Timed Out, 100 usec\n"); - IWL_DEBUG_INFO(priv, "stop master\n"); + IL_DEBUG_INFO(priv, "stop master\n"); return ret; } -void iwl_legacy_apm_stop(struct iwl_priv *priv) +void il_apm_stop(struct il_priv *priv) { - IWL_DEBUG_INFO(priv, "Stop card, put in low power state\n"); + IL_DEBUG_INFO(priv, "Stop card, put in low power state\n"); /* Stop device's DMA activity */ - iwl_legacy_apm_stop_master(priv); + il_apm_stop_master(priv); /* Reset the entire device */ - iwl_legacy_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); + il_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); udelay(10); @@ -986,23 +986,23 @@ void iwl_legacy_apm_stop(struct iwl_priv *priv) * Clear "initialization complete" bit to move adapter from * D0A* (powered-up Active) --> D0U* (Uninitialized) state. */ - iwl_legacy_clear_bit(priv, CSR_GP_CNTRL, + il_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); } -EXPORT_SYMBOL(iwl_legacy_apm_stop); +EXPORT_SYMBOL(il_apm_stop); /* * Start up NIC's basic functionality after it has been reset - * (e.g. after platform boot, or shutdown via iwl_legacy_apm_stop()) + * (e.g. after platform boot, or shutdown via il_apm_stop()) * NOTE: This does not load uCode nor start the embedded processor */ -int iwl_legacy_apm_init(struct iwl_priv *priv) +int il_apm_init(struct il_priv *priv) { int ret = 0; u16 lctl; - IWL_DEBUG_INFO(priv, "Init card's basic functions\n"); + IL_DEBUG_INFO(priv, "Init card's basic functions\n"); /* * Use "set_bit" below rather than "write", to preserve any hardware @@ -1010,18 +1010,18 @@ int iwl_legacy_apm_init(struct iwl_priv *priv) */ /* Disable L0S exit timer (platform NMI Work/Around) */ - iwl_legacy_set_bit(priv, CSR_GIO_CHICKEN_BITS, + il_set_bit(priv, CSR_GIO_CHICKEN_BITS, CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); /* * Disable L0s without affecting L1; * don't wait for ICH L0s (ICH bug W/A) */ - iwl_legacy_set_bit(priv, CSR_GIO_CHICKEN_BITS, + il_set_bit(priv, CSR_GIO_CHICKEN_BITS, CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); /* Set FH wait threshold to maximum (HW error during stress W/A) */ - iwl_legacy_set_bit(priv, CSR_DBG_HPET_MEM_REG, + il_set_bit(priv, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL); /* @@ -1029,7 +1029,7 @@ int iwl_legacy_apm_init(struct iwl_priv *priv) * wake device's PCI Express link L1a -> L0s * NOTE: This is no-op for 3945 (non-existent bit) */ - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); /* @@ -1041,42 +1041,42 @@ int iwl_legacy_apm_init(struct iwl_priv *priv) * power savings, even without L1. */ if (priv->cfg->base_params->set_l0s) { - lctl = iwl_legacy_pcie_link_ctl(priv); + lctl = il_pcie_link_ctl(priv); if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) { /* L1-ASPM enabled; disable(!) L0S */ - iwl_legacy_set_bit(priv, CSR_GIO_REG, + il_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); - IWL_DEBUG_POWER(priv, "L1 Enabled; Disabling L0S\n"); + IL_DEBUG_POWER(priv, "L1 Enabled; Disabling L0S\n"); } else { /* L1-ASPM disabled; enable(!) L0S */ - iwl_legacy_clear_bit(priv, CSR_GIO_REG, + il_clear_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); - IWL_DEBUG_POWER(priv, "L1 Disabled; Enabling L0S\n"); + IL_DEBUG_POWER(priv, "L1 Disabled; Enabling L0S\n"); } } /* Configure analog phase-lock-loop before activating to D0A */ if (priv->cfg->base_params->pll_cfg_val) - iwl_legacy_set_bit(priv, CSR_ANA_PLL_CFG, + il_set_bit(priv, CSR_ANA_PLL_CFG, priv->cfg->base_params->pll_cfg_val); /* * Set "initialization complete" bit to move adapter from * D0U* --> D0A* (powered-up active) state. */ - iwl_legacy_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); + il_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); /* * Wait for clock stabilization; once stabilized, access to - * device-internal resources is supported, e.g. iwl_legacy_write_prph() + * device-internal resources is supported, e.g. il_write_prph() * and accesses to uCode SRAM. */ - ret = iwl_poll_bit(priv, CSR_GP_CNTRL, + ret = il_poll_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); if (ret < 0) { - IWL_DEBUG_INFO(priv, "Failed to init the card\n"); + IL_DEBUG_INFO(priv, "Failed to init the card\n"); goto out; } @@ -1089,29 +1089,29 @@ int iwl_legacy_apm_init(struct iwl_priv *priv) * set by default in "CLK_CTRL_REG" after reset. */ if (priv->cfg->base_params->use_bsm) - iwl_legacy_write_prph(priv, APMG_CLK_EN_REG, + il_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); else - iwl_legacy_write_prph(priv, APMG_CLK_EN_REG, + il_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT); udelay(20); /* Disable L1-Active */ - iwl_legacy_set_bits_prph(priv, APMG_PCIDEV_STT_REG, + il_set_bits_prph(priv, APMG_PCIDEV_STT_REG, APMG_PCIDEV_STT_VAL_L1_ACT_DIS); out: return ret; } -EXPORT_SYMBOL(iwl_legacy_apm_init); +EXPORT_SYMBOL(il_apm_init); -int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) +int il_set_tx_power(struct il_priv *priv, s8 tx_power, bool force) { int ret; s8 prev_tx_power; bool defer; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; lockdep_assert_held(&priv->mutex); @@ -1123,20 +1123,20 @@ int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) /* 0 dBm mean 1 milliwatt */ if (tx_power < 0) { - IWL_WARN(priv, + IL_WARN(priv, "Requested user TXPOWER %d below 1 mW.\n", tx_power); return -EINVAL; } if (tx_power > priv->tx_power_device_lmt) { - IWL_WARN(priv, + IL_WARN(priv, "Requested user TXPOWER %d above upper limit %d.\n", tx_power, priv->tx_power_device_lmt); return -EINVAL; } - if (!iwl_legacy_is_ready_rf(priv)) + if (!il_is_ready_rf(priv)) return -EIO; /* 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) defer = test_bit(STATUS_SCANNING, &priv->status) || memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)); if (defer && !force) { - IWL_DEBUG_INFO(priv, "Deferring tx power set\n"); + IL_DEBUG_INFO(priv, "Deferring tx power set\n"); return 0; } @@ -1163,11 +1163,11 @@ int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) } return ret; } -EXPORT_SYMBOL(iwl_legacy_set_tx_power); +EXPORT_SYMBOL(il_set_tx_power); -void iwl_legacy_send_bt_config(struct iwl_priv *priv) +void il_send_bt_config(struct il_priv *priv) { - struct iwl_bt_cmd bt_cmd = { + struct il_bt_cmd bt_cmd = { .lead_time = BT_LEAD_TIME_DEF, .max_kill = BT_MAX_KILL_DEF, .kill_ack_mask = 0, @@ -1179,95 +1179,95 @@ void iwl_legacy_send_bt_config(struct iwl_priv *priv) else bt_cmd.flags = BT_COEX_ENABLE; - IWL_DEBUG_INFO(priv, "BT coex %s\n", + IL_DEBUG_INFO(priv, "BT coex %s\n", (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); - if (iwl_legacy_send_cmd_pdu(priv, REPLY_BT_CONFIG, - sizeof(struct iwl_bt_cmd), &bt_cmd)) - IWL_ERR(priv, "failed to send BT Coex Config\n"); + if (il_send_cmd_pdu(priv, REPLY_BT_CONFIG, + sizeof(struct il_bt_cmd), &bt_cmd)) + IL_ERR(priv, "failed to send BT Coex Config\n"); } -EXPORT_SYMBOL(iwl_legacy_send_bt_config); +EXPORT_SYMBOL(il_send_bt_config); -int iwl_legacy_send_statistics_request(struct iwl_priv *priv, u8 flags, bool clear) +int il_send_statistics_request(struct il_priv *priv, u8 flags, bool clear) { - struct iwl_statistics_cmd statistics_cmd = { + struct il_statistics_cmd statistics_cmd = { .configuration_flags = - clear ? IWL_STATS_CONF_CLEAR_STATS : 0, + clear ? IL_STATS_CONF_CLEAR_STATS : 0, }; if (flags & CMD_ASYNC) - return iwl_legacy_send_cmd_pdu_async(priv, REPLY_STATISTICS_CMD, - sizeof(struct iwl_statistics_cmd), + return il_send_cmd_pdu_async(priv, REPLY_STATISTICS_CMD, + sizeof(struct il_statistics_cmd), &statistics_cmd, NULL); else - return iwl_legacy_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, - sizeof(struct iwl_statistics_cmd), + return il_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, + sizeof(struct il_statistics_cmd), &statistics_cmd); } -EXPORT_SYMBOL(iwl_legacy_send_statistics_request); +EXPORT_SYMBOL(il_send_statistics_request); -void iwl_legacy_rx_pm_sleep_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il_rx_pm_sleep_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif); - IWL_DEBUG_RX(priv, "sleep mode: %d, src: %d\n", + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_sleep_notification *sleep = &(pkt->u.sleep_notif); + IL_DEBUG_RX(priv, "sleep mode: %d, src: %d\n", sleep->pm_sleep_mode, sleep->pm_wakeup_src); #endif } -EXPORT_SYMBOL(iwl_legacy_rx_pm_sleep_notif); +EXPORT_SYMBOL(il_rx_pm_sleep_notif); -void iwl_legacy_rx_pm_debug_statistics_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il_rx_pm_debug_statistics_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); u32 len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled " + IL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled " "notification for %s:\n", len, - iwl_legacy_get_cmd_string(pkt->hdr.cmd)); - iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, len); + il_get_cmd_string(pkt->hdr.cmd)); + il_print_hex_dump(priv, IL_DL_RADIO, pkt->u.raw, len); } -EXPORT_SYMBOL(iwl_legacy_rx_pm_debug_statistics_notif); +EXPORT_SYMBOL(il_rx_pm_debug_statistics_notif); -void iwl_legacy_rx_reply_error(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il_rx_reply_error(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); - IWL_ERR(priv, "Error Reply type 0x%08X cmd %s (0x%02X) " + IL_ERR(priv, "Error Reply type 0x%08X cmd %s (0x%02X) " "seq 0x%04X ser 0x%08X\n", le32_to_cpu(pkt->u.err_resp.error_type), - iwl_legacy_get_cmd_string(pkt->u.err_resp.cmd_id), + il_get_cmd_string(pkt->u.err_resp.cmd_id), pkt->u.err_resp.cmd_id, le16_to_cpu(pkt->u.err_resp.bad_cmd_seq_num), le32_to_cpu(pkt->u.err_resp.error_info)); } -EXPORT_SYMBOL(iwl_legacy_rx_reply_error); +EXPORT_SYMBOL(il_rx_reply_error); -void iwl_legacy_clear_isr_stats(struct iwl_priv *priv) +void il_clear_isr_stats(struct il_priv *priv) { memset(&priv->isr_stats, 0, sizeof(priv->isr_stats)); } -int iwl_legacy_mac_conf_tx(struct ieee80211_hw *hw, +int il_mac_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, const struct ieee80211_tx_queue_params *params) { - struct iwl_priv *priv = hw->priv; - struct iwl_rxon_context *ctx; + struct il_priv *priv = hw->priv; + struct il_rxon_context *ctx; unsigned long flags; int q; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); - if (!iwl_legacy_is_ready_rf(priv)) { - IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); + if (!il_is_ready_rf(priv)) { + IL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); return -EIO; } if (queue >= AC_NUM) { - IWL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue); + IL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue); return 0; } @@ -1289,32 +1289,32 @@ int iwl_legacy_mac_conf_tx(struct ieee80211_hw *hw, spin_unlock_irqrestore(&priv->lock, flags); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); return 0; } -EXPORT_SYMBOL(iwl_legacy_mac_conf_tx); +EXPORT_SYMBOL(il_mac_conf_tx); -int iwl_legacy_mac_tx_last_beacon(struct ieee80211_hw *hw) +int il_mac_tx_last_beacon(struct ieee80211_hw *hw) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; - return priv->ibss_manager == IWL_IBSS_MANAGER; + return priv->ibss_manager == IL_IBSS_MANAGER; } -EXPORT_SYMBOL_GPL(iwl_legacy_mac_tx_last_beacon); +EXPORT_SYMBOL_GPL(il_mac_tx_last_beacon); static int -iwl_legacy_set_mode(struct iwl_priv *priv, struct iwl_rxon_context *ctx) +il_set_mode(struct il_priv *priv, struct il_rxon_context *ctx) { - iwl_legacy_connection_init_rx_config(priv, ctx); + il_connection_init_rx_config(priv, ctx); if (priv->cfg->ops->hcmd->set_rxon_chain) priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); - return iwl_legacy_commit_rxon(priv, ctx); + return il_commit_rxon(priv, ctx); } -static int iwl_legacy_setup_interface(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +static int il_setup_interface(struct il_priv *priv, + struct il_rxon_context *ctx) { struct ieee80211_vif *vif = ctx->vif; int err; @@ -1330,7 +1330,7 @@ static int iwl_legacy_setup_interface(struct iwl_priv *priv, ctx->is_active = true; - err = iwl_legacy_set_mode(priv, ctx); + err = il_set_mode(priv, ctx); if (err) { if (!ctx->always_active) ctx->is_active = false; @@ -1341,20 +1341,20 @@ static int iwl_legacy_setup_interface(struct iwl_priv *priv, } int -iwl_legacy_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { - struct iwl_priv *priv = hw->priv; - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; - struct iwl_rxon_context *tmp, *ctx = NULL; + struct il_priv *priv = hw->priv; + struct il_vif_priv *vif_priv = (void *)vif->drv_priv; + struct il_rxon_context *tmp, *ctx = NULL; int err; - IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", + IL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", vif->type, vif->addr); mutex_lock(&priv->mutex); - if (!iwl_legacy_is_ready_rf(priv)) { - IWL_WARN(priv, "Try to add interface when device not ready\n"); + if (!il_is_ready_rf(priv)) { + IL_WARN(priv, "Try to add interface when device not ready\n"); err = -EINVAL; goto out; } @@ -1389,7 +1389,7 @@ iwl_legacy_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) vif_priv->ctx = ctx; ctx->vif = vif; - err = iwl_legacy_setup_interface(priv, ctx); + err = il_setup_interface(priv, ctx); if (!err) goto out; @@ -1398,95 +1398,95 @@ iwl_legacy_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) out: mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); return err; } -EXPORT_SYMBOL(iwl_legacy_mac_add_interface); +EXPORT_SYMBOL(il_mac_add_interface); -static void iwl_legacy_teardown_interface(struct iwl_priv *priv, +static void il_teardown_interface(struct il_priv *priv, struct ieee80211_vif *vif, bool mode_change) { - struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); + struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); lockdep_assert_held(&priv->mutex); if (priv->scan_vif == vif) { - iwl_legacy_scan_cancel_timeout(priv, 200); - iwl_legacy_force_scan_end(priv); + il_scan_cancel_timeout(priv, 200); + il_force_scan_end(priv); } if (!mode_change) { - iwl_legacy_set_mode(priv, ctx); + il_set_mode(priv, ctx); if (!ctx->always_active) ctx->is_active = false; } } -void iwl_legacy_mac_remove_interface(struct ieee80211_hw *hw, +void il_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { - struct iwl_priv *priv = hw->priv; - struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); + struct il_priv *priv = hw->priv; + struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); mutex_lock(&priv->mutex); WARN_ON(ctx->vif != vif); ctx->vif = NULL; - iwl_legacy_teardown_interface(priv, vif, false); + il_teardown_interface(priv, vif, false); memset(priv->bssid, 0, ETH_ALEN); mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); } -EXPORT_SYMBOL(iwl_legacy_mac_remove_interface); +EXPORT_SYMBOL(il_mac_remove_interface); -int iwl_legacy_alloc_txq_mem(struct iwl_priv *priv) +int il_alloc_txq_mem(struct il_priv *priv) { if (!priv->txq) priv->txq = kzalloc( - sizeof(struct iwl_tx_queue) * + sizeof(struct il_tx_queue) * priv->cfg->base_params->num_of_queues, GFP_KERNEL); if (!priv->txq) { - IWL_ERR(priv, "Not enough memory for txq\n"); + IL_ERR(priv, "Not enough memory for txq\n"); return -ENOMEM; } return 0; } -EXPORT_SYMBOL(iwl_legacy_alloc_txq_mem); +EXPORT_SYMBOL(il_alloc_txq_mem); -void iwl_legacy_txq_mem(struct iwl_priv *priv) +void il_txq_mem(struct il_priv *priv) { kfree(priv->txq); priv->txq = NULL; } -EXPORT_SYMBOL(iwl_legacy_txq_mem); +EXPORT_SYMBOL(il_txq_mem); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS -#define IWL_TRAFFIC_DUMP_SIZE (IWL_TRAFFIC_ENTRY_SIZE * IWL_TRAFFIC_ENTRIES) +#define IL_TRAFFIC_DUMP_SIZE (IL_TRAFFIC_ENTRY_SIZE * IL_TRAFFIC_ENTRIES) -void iwl_legacy_reset_traffic_log(struct iwl_priv *priv) +void il_reset_traffic_log(struct il_priv *priv) { priv->tx_traffic_idx = 0; priv->rx_traffic_idx = 0; if (priv->tx_traffic) - memset(priv->tx_traffic, 0, IWL_TRAFFIC_DUMP_SIZE); + memset(priv->tx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); if (priv->rx_traffic) - memset(priv->rx_traffic, 0, IWL_TRAFFIC_DUMP_SIZE); + memset(priv->rx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); } -int iwl_legacy_alloc_traffic_mem(struct iwl_priv *priv) +int il_alloc_traffic_mem(struct il_priv *priv) { - u32 traffic_size = IWL_TRAFFIC_DUMP_SIZE; + u32 traffic_size = IL_TRAFFIC_DUMP_SIZE; - if (iwlegacy_debug_level & IWL_DL_TX) { + if (iwlegacy_debug_level & IL_DL_TX) { if (!priv->tx_traffic) { priv->tx_traffic = kzalloc(traffic_size, GFP_KERNEL); @@ -1494,7 +1494,7 @@ int iwl_legacy_alloc_traffic_mem(struct iwl_priv *priv) return -ENOMEM; } } - if (iwlegacy_debug_level & IWL_DL_RX) { + if (iwlegacy_debug_level & IL_DL_RX) { if (!priv->rx_traffic) { priv->rx_traffic = kzalloc(traffic_size, GFP_KERNEL); @@ -1502,12 +1502,12 @@ int iwl_legacy_alloc_traffic_mem(struct iwl_priv *priv) return -ENOMEM; } } - iwl_legacy_reset_traffic_log(priv); + il_reset_traffic_log(priv); return 0; } -EXPORT_SYMBOL(iwl_legacy_alloc_traffic_mem); +EXPORT_SYMBOL(il_alloc_traffic_mem); -void iwl_legacy_free_traffic_mem(struct iwl_priv *priv) +void il_free_traffic_mem(struct il_priv *priv) { kfree(priv->tx_traffic); priv->tx_traffic = NULL; @@ -1515,15 +1515,15 @@ void iwl_legacy_free_traffic_mem(struct iwl_priv *priv) kfree(priv->rx_traffic); priv->rx_traffic = NULL; } -EXPORT_SYMBOL(iwl_legacy_free_traffic_mem); +EXPORT_SYMBOL(il_free_traffic_mem); -void iwl_legacy_dbg_log_tx_data_frame(struct iwl_priv *priv, +void il_dbg_log_tx_data_frame(struct il_priv *priv, u16 length, struct ieee80211_hdr *header) { __le16 fc; u16 len; - if (likely(!(iwlegacy_debug_level & IWL_DL_TX))) + if (likely(!(iwlegacy_debug_level & IL_DL_TX))) return; if (!priv->tx_traffic) @@ -1531,24 +1531,24 @@ void iwl_legacy_dbg_log_tx_data_frame(struct iwl_priv *priv, fc = header->frame_control; if (ieee80211_is_data(fc)) { - len = (length > IWL_TRAFFIC_ENTRY_SIZE) - ? IWL_TRAFFIC_ENTRY_SIZE : length; + len = (length > IL_TRAFFIC_ENTRY_SIZE) + ? IL_TRAFFIC_ENTRY_SIZE : length; memcpy((priv->tx_traffic + - (priv->tx_traffic_idx * IWL_TRAFFIC_ENTRY_SIZE)), + (priv->tx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), header, len); priv->tx_traffic_idx = - (priv->tx_traffic_idx + 1) % IWL_TRAFFIC_ENTRIES; + (priv->tx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; } } -EXPORT_SYMBOL(iwl_legacy_dbg_log_tx_data_frame); +EXPORT_SYMBOL(il_dbg_log_tx_data_frame); -void iwl_legacy_dbg_log_rx_data_frame(struct iwl_priv *priv, +void il_dbg_log_rx_data_frame(struct il_priv *priv, u16 length, struct ieee80211_hdr *header) { __le16 fc; u16 len; - if (likely(!(iwlegacy_debug_level & IWL_DL_RX))) + if (likely(!(iwlegacy_debug_level & IL_DL_RX))) return; if (!priv->rx_traffic) @@ -1556,56 +1556,56 @@ void iwl_legacy_dbg_log_rx_data_frame(struct iwl_priv *priv, fc = header->frame_control; if (ieee80211_is_data(fc)) { - len = (length > IWL_TRAFFIC_ENTRY_SIZE) - ? IWL_TRAFFIC_ENTRY_SIZE : length; + len = (length > IL_TRAFFIC_ENTRY_SIZE) + ? IL_TRAFFIC_ENTRY_SIZE : length; memcpy((priv->rx_traffic + - (priv->rx_traffic_idx * IWL_TRAFFIC_ENTRY_SIZE)), + (priv->rx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), header, len); priv->rx_traffic_idx = - (priv->rx_traffic_idx + 1) % IWL_TRAFFIC_ENTRIES; + (priv->rx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; } } -EXPORT_SYMBOL(iwl_legacy_dbg_log_rx_data_frame); +EXPORT_SYMBOL(il_dbg_log_rx_data_frame); -const char *iwl_legacy_get_mgmt_string(int cmd) +const char *il_get_mgmt_string(int cmd) { switch (cmd) { - IWL_CMD(MANAGEMENT_ASSOC_REQ); - IWL_CMD(MANAGEMENT_ASSOC_RESP); - IWL_CMD(MANAGEMENT_REASSOC_REQ); - IWL_CMD(MANAGEMENT_REASSOC_RESP); - IWL_CMD(MANAGEMENT_PROBE_REQ); - IWL_CMD(MANAGEMENT_PROBE_RESP); - IWL_CMD(MANAGEMENT_BEACON); - IWL_CMD(MANAGEMENT_ATIM); - IWL_CMD(MANAGEMENT_DISASSOC); - IWL_CMD(MANAGEMENT_AUTH); - IWL_CMD(MANAGEMENT_DEAUTH); - IWL_CMD(MANAGEMENT_ACTION); + IL_CMD(MANAGEMENT_ASSOC_REQ); + IL_CMD(MANAGEMENT_ASSOC_RESP); + IL_CMD(MANAGEMENT_REASSOC_REQ); + IL_CMD(MANAGEMENT_REASSOC_RESP); + IL_CMD(MANAGEMENT_PROBE_REQ); + IL_CMD(MANAGEMENT_PROBE_RESP); + IL_CMD(MANAGEMENT_BEACON); + IL_CMD(MANAGEMENT_ATIM); + IL_CMD(MANAGEMENT_DISASSOC); + IL_CMD(MANAGEMENT_AUTH); + IL_CMD(MANAGEMENT_DEAUTH); + IL_CMD(MANAGEMENT_ACTION); default: return "UNKNOWN"; } } -const char *iwl_legacy_get_ctrl_string(int cmd) +const char *il_get_ctrl_string(int cmd) { switch (cmd) { - IWL_CMD(CONTROL_BACK_REQ); - IWL_CMD(CONTROL_BACK); - IWL_CMD(CONTROL_PSPOLL); - IWL_CMD(CONTROL_RTS); - IWL_CMD(CONTROL_CTS); - IWL_CMD(CONTROL_ACK); - IWL_CMD(CONTROL_CFEND); - IWL_CMD(CONTROL_CFENDACK); + IL_CMD(CONTROL_BACK_REQ); + IL_CMD(CONTROL_BACK); + IL_CMD(CONTROL_PSPOLL); + IL_CMD(CONTROL_RTS); + IL_CMD(CONTROL_CTS); + IL_CMD(CONTROL_ACK); + IL_CMD(CONTROL_CFEND); + IL_CMD(CONTROL_CFENDACK); default: return "UNKNOWN"; } } -void iwl_legacy_clear_traffic_stats(struct iwl_priv *priv) +void il_clear_traffic_stats(struct il_priv *priv) { memset(&priv->tx_stats, 0, sizeof(struct traffic_stats)); memset(&priv->rx_stats, 0, sizeof(struct traffic_stats)); @@ -1613,17 +1613,17 @@ void iwl_legacy_clear_traffic_stats(struct iwl_priv *priv) /* * if CONFIG_IWLWIFI_LEGACY_DEBUGFS defined, - * iwl_legacy_update_stats function will + * il_update_stats function will * record all the MGMT, CTRL and DATA pkt for both TX and Rx pass * Use debugFs to display the rx/rx_statistics * if CONFIG_IWLWIFI_LEGACY_DEBUGFS not being defined, then no MGMT and CTRL * information will be recorded, but DATA pkt still will be recorded - * for the reason of iwl_led.c need to control the led blinking based on + * for the reason of il_led.c need to control the led blinking based on * number of tx and rx data. * */ void -iwl_legacy_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, u16 len) +il_update_stats(struct il_priv *priv, bool is_tx, __le16 fc, u16 len) { struct traffic_stats *stats; @@ -1704,12 +1704,12 @@ iwl_legacy_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, u16 len) stats->data_bytes += len; } } -EXPORT_SYMBOL(iwl_legacy_update_stats); +EXPORT_SYMBOL(il_update_stats); #endif -int iwl_legacy_force_reset(struct iwl_priv *priv, bool external) +int il_force_reset(struct il_priv *priv, bool external) { - struct iwl_force_reset *force_reset; + struct il_force_reset *force_reset; if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return -EINVAL; @@ -1720,7 +1720,7 @@ int iwl_legacy_force_reset(struct iwl_priv *priv, bool external) if (force_reset->last_force_reset_jiffies && time_after(force_reset->last_force_reset_jiffies + force_reset->reset_duration, jiffies)) { - IWL_DEBUG_INFO(priv, "force reset rejected\n"); + IL_DEBUG_INFO(priv, "force reset rejected\n"); force_reset->reset_reject_count++; return -EAGAIN; } @@ -1738,14 +1738,14 @@ int iwl_legacy_force_reset(struct iwl_priv *priv, bool external) */ if (!external && !priv->cfg->mod_params->restart_fw) { - IWL_DEBUG_INFO(priv, "Cancel firmware reload based on " + IL_DEBUG_INFO(priv, "Cancel firmware reload based on " "module parameter setting\n"); return 0; } - IWL_ERR(priv, "On demand firmware reload\n"); + IL_ERR(priv, "On demand firmware reload\n"); - /* Set the FW error flag -- cleared on iwl_down */ + /* Set the FW error flag -- cleared on il_down */ set_bit(STATUS_FW_ERROR, &priv->status); wake_up(&priv->wait_command_queue); /* @@ -1759,13 +1759,13 @@ int iwl_legacy_force_reset(struct iwl_priv *priv, bool external) } int -iwl_legacy_mac_change_interface(struct ieee80211_hw *hw, +il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum nl80211_iftype newtype, bool newp2p) { - struct iwl_priv *priv = hw->priv; - struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); - struct iwl_rxon_context *tmp; + struct il_priv *priv = hw->priv; + struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); + struct il_rxon_context *tmp; u32 interface_modes; int err; @@ -1773,7 +1773,7 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw, mutex_lock(&priv->mutex); - if (!ctx->vif || !iwl_legacy_is_ready_rf(priv)) { + if (!ctx->vif || !il_is_ready_rf(priv)) { /* * Huh? But wait ... this can maybe happen when * we're in the middle of a firmware restart! @@ -1807,10 +1807,10 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw, } /* success */ - iwl_legacy_teardown_interface(priv, vif, true); + il_teardown_interface(priv, vif, true); vif->type = newtype; vif->p2p = newp2p; - err = iwl_legacy_setup_interface(priv, ctx); + err = il_setup_interface(priv, ctx); WARN_ON(err); /* * We've switched internally, but submitting to the @@ -1825,16 +1825,16 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw, mutex_unlock(&priv->mutex); return err; } -EXPORT_SYMBOL(iwl_legacy_mac_change_interface); +EXPORT_SYMBOL(il_mac_change_interface); /* * On every watchdog tick we check (latest) time stamp. If it does not * change during timeout period and queue is not empty we reset firmware. */ -static int iwl_legacy_check_stuck_queue(struct iwl_priv *priv, int cnt) +static int il_check_stuck_queue(struct il_priv *priv, int cnt) { - struct iwl_tx_queue *txq = &priv->txq[cnt]; - struct iwl_queue *q = &txq->q; + struct il_tx_queue *txq = &priv->txq[cnt]; + struct il_queue *q = &txq->q; unsigned long timeout; int ret; @@ -1847,9 +1847,9 @@ static int iwl_legacy_check_stuck_queue(struct iwl_priv *priv, int cnt) msecs_to_jiffies(priv->cfg->base_params->wd_timeout); if (time_after(jiffies, timeout)) { - IWL_ERR(priv, "Queue %d stuck for %u ms.\n", + IL_ERR(priv, "Queue %d stuck for %u ms.\n", q->id, priv->cfg->base_params->wd_timeout); - ret = iwl_legacy_force_reset(priv, false); + ret = il_force_reset(priv, false); return (ret == -EAGAIN) ? 0 : 1; } @@ -1860,15 +1860,15 @@ static int iwl_legacy_check_stuck_queue(struct iwl_priv *priv, int cnt) * Making watchdog tick be a quarter of timeout assure we will * discover the queue hung between timeout and 1.25*timeout */ -#define IWL_WD_TICK(timeout) ((timeout) / 4) +#define IL_WD_TICK(timeout) ((timeout) / 4) /* * Watchdog timer callback, we check each tx queue for stuck, if if hung * we reset the firmware. If everything is fine just rearm the timer. */ -void iwl_legacy_bg_watchdog(unsigned long data) +void il_bg_watchdog(unsigned long data) { - struct iwl_priv *priv = (struct iwl_priv *)data; + struct il_priv *priv = (struct il_priv *)data; int cnt; unsigned long timeout; @@ -1880,36 +1880,36 @@ void iwl_legacy_bg_watchdog(unsigned long data) return; /* monitor and check for stuck cmd queue */ - if (iwl_legacy_check_stuck_queue(priv, priv->cmd_queue)) + if (il_check_stuck_queue(priv, priv->cmd_queue)) return; /* monitor and check for other stuck queues */ - if (iwl_legacy_is_any_associated(priv)) { + if (il_is_any_associated(priv)) { for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { /* skip as we already checked the command queue */ if (cnt == priv->cmd_queue) continue; - if (iwl_legacy_check_stuck_queue(priv, cnt)) + if (il_check_stuck_queue(priv, cnt)) return; } } mod_timer(&priv->watchdog, jiffies + - msecs_to_jiffies(IWL_WD_TICK(timeout))); + msecs_to_jiffies(IL_WD_TICK(timeout))); } -EXPORT_SYMBOL(iwl_legacy_bg_watchdog); +EXPORT_SYMBOL(il_bg_watchdog); -void iwl_legacy_setup_watchdog(struct iwl_priv *priv) +void il_setup_watchdog(struct il_priv *priv) { unsigned int timeout = priv->cfg->base_params->wd_timeout; if (timeout) mod_timer(&priv->watchdog, - jiffies + msecs_to_jiffies(IWL_WD_TICK(timeout))); + jiffies + msecs_to_jiffies(IL_WD_TICK(timeout))); else del_timer(&priv->watchdog); } -EXPORT_SYMBOL(iwl_legacy_setup_watchdog); +EXPORT_SYMBOL(il_setup_watchdog); /* * extended beacon time format @@ -1918,7 +1918,7 @@ EXPORT_SYMBOL(iwl_legacy_setup_watchdog); * the internal part is the time in usec within one beacon interval */ u32 -iwl_legacy_usecs_to_beacons(struct iwl_priv *priv, +il_usecs_to_beacons(struct il_priv *priv, u32 usec, u32 beacon_interval) { u32 quot; @@ -1929,30 +1929,30 @@ iwl_legacy_usecs_to_beacons(struct iwl_priv *priv, return 0; quot = (usec / interval) & - (iwl_legacy_beacon_time_mask_high(priv, + (il_beacon_time_mask_high(priv, priv->hw_params.beacon_time_tsf_bits) >> priv->hw_params.beacon_time_tsf_bits); - rem = (usec % interval) & iwl_legacy_beacon_time_mask_low(priv, + rem = (usec % interval) & il_beacon_time_mask_low(priv, priv->hw_params.beacon_time_tsf_bits); return (quot << priv->hw_params.beacon_time_tsf_bits) + rem; } -EXPORT_SYMBOL(iwl_legacy_usecs_to_beacons); +EXPORT_SYMBOL(il_usecs_to_beacons); /* base is usually what we get from ucode with each received frame, * the same as HW timer counter counting down */ -__le32 iwl_legacy_add_beacon_time(struct iwl_priv *priv, u32 base, +__le32 il_add_beacon_time(struct il_priv *priv, u32 base, u32 addon, u32 beacon_interval) { - u32 base_low = base & iwl_legacy_beacon_time_mask_low(priv, + u32 base_low = base & il_beacon_time_mask_low(priv, priv->hw_params.beacon_time_tsf_bits); - u32 addon_low = addon & iwl_legacy_beacon_time_mask_low(priv, + u32 addon_low = addon & il_beacon_time_mask_low(priv, priv->hw_params.beacon_time_tsf_bits); u32 interval = beacon_interval * TIME_UNIT; - u32 res = (base & iwl_legacy_beacon_time_mask_high(priv, + u32 res = (base & il_beacon_time_mask_high(priv, priv->hw_params.beacon_time_tsf_bits)) + - (addon & iwl_legacy_beacon_time_mask_high(priv, + (addon & il_beacon_time_mask_high(priv, priv->hw_params.beacon_time_tsf_bits)); if (base_low > addon_low) @@ -1965,32 +1965,32 @@ __le32 iwl_legacy_add_beacon_time(struct iwl_priv *priv, u32 base, return cpu_to_le32(res); } -EXPORT_SYMBOL(iwl_legacy_add_beacon_time); +EXPORT_SYMBOL(il_add_beacon_time); #ifdef CONFIG_PM -int iwl_legacy_pci_suspend(struct device *device) +int il_pci_suspend(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); - struct iwl_priv *priv = pci_get_drvdata(pdev); + struct il_priv *priv = pci_get_drvdata(pdev); /* * This function is called when system goes into suspend state - * mac80211 will call iwl_mac_stop() from the mac80211 suspend function - * first but since iwl_mac_stop() has no knowledge of who the caller is, + * mac80211 will call il_mac_stop() from the mac80211 suspend function + * first but since il_mac_stop() has no knowledge of who the caller is, * it will not call apm_ops.stop() to stop the DMA operation. * Calling apm_ops.stop here to make sure we stop the DMA. */ - iwl_legacy_apm_stop(priv); + il_apm_stop(priv); return 0; } -EXPORT_SYMBOL(iwl_legacy_pci_suspend); +EXPORT_SYMBOL(il_pci_suspend); -int iwl_legacy_pci_resume(struct device *device) +int il_pci_resume(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); - struct iwl_priv *priv = pci_get_drvdata(pdev); + struct il_priv *priv = pci_get_drvdata(pdev); bool hw_rfkill = false; /* @@ -1999,9 +1999,9 @@ int iwl_legacy_pci_resume(struct device *device) */ pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); - iwl_legacy_enable_interrupts(priv); + il_enable_interrupts(priv); - if (!(iwl_read32(priv, CSR_GP_CNTRL) & + if (!(il_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) hw_rfkill = true; @@ -2014,22 +2014,22 @@ int iwl_legacy_pci_resume(struct device *device) return 0; } -EXPORT_SYMBOL(iwl_legacy_pci_resume); +EXPORT_SYMBOL(il_pci_resume); -const struct dev_pm_ops iwl_legacy_pm_ops = { - .suspend = iwl_legacy_pci_suspend, - .resume = iwl_legacy_pci_resume, - .freeze = iwl_legacy_pci_suspend, - .thaw = iwl_legacy_pci_resume, - .poweroff = iwl_legacy_pci_suspend, - .restore = iwl_legacy_pci_resume, +const struct dev_pm_ops il_pm_ops = { + .suspend = il_pci_suspend, + .resume = il_pci_resume, + .freeze = il_pci_suspend, + .thaw = il_pci_resume, + .poweroff = il_pci_suspend, + .restore = il_pci_resume, }; -EXPORT_SYMBOL(iwl_legacy_pm_ops); +EXPORT_SYMBOL(il_pm_ops); #endif /* CONFIG_PM */ static void -iwl_legacy_update_qos(struct iwl_priv *priv, struct iwl_rxon_context *ctx) +il_update_qos(struct il_priv *priv, struct il_rxon_context *ctx) { if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; @@ -2046,43 +2046,43 @@ iwl_legacy_update_qos(struct iwl_priv *priv, struct iwl_rxon_context *ctx) if (ctx->ht.enabled) ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; - IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", + IL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", ctx->qos_data.qos_active, ctx->qos_data.def_qos_parm.qos_flags); - iwl_legacy_send_cmd_pdu_async(priv, ctx->qos_cmd, - sizeof(struct iwl_qosparam_cmd), + il_send_cmd_pdu_async(priv, ctx->qos_cmd, + sizeof(struct il_qosparam_cmd), &ctx->qos_data.def_qos_parm, NULL); } /** - * iwl_legacy_mac_config - mac80211 config callback + * il_mac_config - mac80211 config callback */ -int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed) +int il_mac_config(struct ieee80211_hw *hw, u32 changed) { - struct iwl_priv *priv = hw->priv; - const struct iwl_channel_info *ch_info; + struct il_priv *priv = hw->priv; + const struct il_channel_info *ch_info; struct ieee80211_conf *conf = &hw->conf; struct ieee80211_channel *channel = conf->channel; - struct iwl_ht_config *ht_conf = &priv->current_ht_config; - struct iwl_rxon_context *ctx; + struct il_ht_config *ht_conf = &priv->current_ht_config; + struct il_rxon_context *ctx; unsigned long flags = 0; int ret = 0; u16 ch; int scan_active = 0; - bool ht_changed[NUM_IWL_RXON_CTX] = {}; + bool ht_changed[NUM_IL_RXON_CTX] = {}; if (WARN_ON(!priv->cfg->ops->legacy)) return -EOPNOTSUPP; mutex_lock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n", + IL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n", channel->hw_value, changed); if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) { scan_active = 1; - IWL_DEBUG_MAC80211(priv, "scan active\n"); + IL_DEBUG_MAC80211(priv, "scan active\n"); } if (changed & (IEEE80211_CONF_CHANGE_SMPS | @@ -2110,16 +2110,16 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed) goto set_ch_out; ch = channel->hw_value; - ch_info = iwl_legacy_get_channel_info(priv, channel->band, ch); - if (!iwl_legacy_is_channel_valid(ch_info)) { - IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n"); + ch_info = il_get_channel_info(priv, channel->band, ch); + if (!il_is_channel_valid(ch_info)) { + IL_DEBUG_MAC80211(priv, "leave - invalid channel\n"); ret = -EINVAL; goto set_ch_out; } if (priv->iw_mode == NL80211_IFTYPE_ADHOC && - !iwl_legacy_is_channel_ibss(ch_info)) { - IWL_DEBUG_MAC80211(priv, "leave - not IBSS channel\n"); + !il_is_channel_ibss(ch_info)) { + IL_DEBUG_MAC80211(priv, "leave - not IBSS channel\n"); ret = -EINVAL; goto set_ch_out; } @@ -2151,7 +2151,7 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed) /* * Default to no protection. Protection mode will - * later be set from BSS config in iwl_ht_conf + * later be set from BSS config in il_ht_conf */ ctx->ht.protection = IEEE80211_HT_OP_MODE_PROTECTION_NONE; @@ -2162,10 +2162,10 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed) if ((le16_to_cpu(ctx->staging.channel) != ch)) ctx->staging.flags = 0; - iwl_legacy_set_rxon_channel(priv, channel, ctx); - iwl_legacy_set_rxon_ht(priv, ht_conf); + il_set_rxon_channel(priv, channel, ctx); + il_set_rxon_ht(priv, ht_conf); - iwl_legacy_set_flags_for_band(priv, ctx, channel->band, + il_set_flags_for_band(priv, ctx, channel->band, ctx->vif); } @@ -2179,25 +2179,25 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed) /* The list of supported rates and rate mask can be different * for each band; since the band may have changed, reset * the rate mask to what mac80211 lists */ - iwl_legacy_set_rate(priv); + il_set_rate(priv); } if (changed & (IEEE80211_CONF_CHANGE_PS | IEEE80211_CONF_CHANGE_IDLE)) { - ret = iwl_legacy_power_update_mode(priv, false); + ret = il_power_update_mode(priv, false); if (ret) - IWL_DEBUG_MAC80211(priv, "Error setting sleep level\n"); + IL_DEBUG_MAC80211(priv, "Error setting sleep level\n"); } if (changed & IEEE80211_CONF_CHANGE_POWER) { - IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n", + IL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n", priv->tx_power_user_lmt, conf->power_level); - iwl_legacy_set_tx_power(priv, conf->power_level, false); + il_set_tx_power(priv, conf->power_level, false); } - if (!iwl_legacy_is_ready(priv)) { - IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); + if (!il_is_ready(priv)) { + IL_DEBUG_MAC80211(priv, "leave - not ready\n"); goto out; } @@ -2206,37 +2206,37 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed) for_each_context(priv, ctx) { if (memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging))) - iwl_legacy_commit_rxon(priv, ctx); + il_commit_rxon(priv, ctx); else - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Not re-sending same RXON configuration.\n"); if (ht_changed[ctx->ctxid]) - iwl_legacy_update_qos(priv, ctx); + il_update_qos(priv, ctx); } out: - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); mutex_unlock(&priv->mutex); return ret; } -EXPORT_SYMBOL(iwl_legacy_mac_config); +EXPORT_SYMBOL(il_mac_config); -void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw, +void il_mac_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; unsigned long flags; - /* IBSS can only be the IWL_RXON_CTX_BSS context */ - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + /* IBSS can only be the IL_RXON_CTX_BSS context */ + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; if (WARN_ON(!priv->cfg->ops->legacy)) return; mutex_lock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); spin_lock_irqsave(&priv->lock, flags); - memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_config)); + memset(&priv->current_ht_config, 0, sizeof(struct il_ht_config)); spin_unlock_irqrestore(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags); @@ -2251,9 +2251,9 @@ void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw, spin_unlock_irqrestore(&priv->lock, flags); - iwl_legacy_scan_cancel_timeout(priv, 100); - if (!iwl_legacy_is_ready_rf(priv)) { - IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); + il_scan_cancel_timeout(priv, 100); + if (!il_is_ready_rf(priv)) { + IL_DEBUG_MAC80211(priv, "leave - not ready\n"); mutex_unlock(&priv->mutex); return; } @@ -2262,25 +2262,25 @@ void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw, * clear RXON_FILTER_ASSOC_MSK bit */ ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_legacy_commit_rxon(priv, ctx); + il_commit_rxon(priv, ctx); - iwl_legacy_set_rate(priv); + il_set_rate(priv); mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); } -EXPORT_SYMBOL(iwl_legacy_mac_reset_tsf); +EXPORT_SYMBOL(il_mac_reset_tsf); -static void iwl_legacy_ht_conf(struct iwl_priv *priv, +static void il_ht_conf(struct il_priv *priv, struct ieee80211_vif *vif) { - struct iwl_ht_config *ht_conf = &priv->current_ht_config; + struct il_ht_config *ht_conf = &priv->current_ht_config; struct ieee80211_sta *sta; struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); + struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); - IWL_DEBUG_ASSOC(priv, "enter:\n"); + IL_DEBUG_ASSOC(priv, "enter:\n"); if (!ctx->ht.enabled) return; @@ -2329,13 +2329,13 @@ static void iwl_legacy_ht_conf(struct iwl_priv *priv, break; } - IWL_DEBUG_ASSOC(priv, "leave\n"); + IL_DEBUG_ASSOC(priv, "leave\n"); } -static inline void iwl_legacy_set_no_assoc(struct iwl_priv *priv, +static inline void il_set_no_assoc(struct il_priv *priv, struct ieee80211_vif *vif) { - struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); + struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); /* * 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, */ ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; ctx->staging.assoc_id = 0; - iwl_legacy_commit_rxon(priv, ctx); + il_commit_rxon(priv, ctx); } -static void iwl_legacy_beacon_update(struct ieee80211_hw *hw, +static void il_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; unsigned long flags; __le64 timestamp; struct sk_buff *skb = ieee80211_beacon_get(hw, vif); @@ -2358,12 +2358,12 @@ static void iwl_legacy_beacon_update(struct ieee80211_hw *hw, if (!skb) return; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); lockdep_assert_held(&priv->mutex); if (!priv->beacon_ctx) { - IWL_ERR(priv, "update beacon but no beacon context!\n"); + IL_ERR(priv, "update beacon but no beacon context!\n"); dev_kfree_skb(skb); return; } @@ -2378,34 +2378,34 @@ static void iwl_legacy_beacon_update(struct ieee80211_hw *hw, timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; priv->timestamp = le64_to_cpu(timestamp); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); spin_unlock_irqrestore(&priv->lock, flags); - if (!iwl_legacy_is_ready_rf(priv)) { - IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); + if (!il_is_ready_rf(priv)) { + IL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); return; } priv->cfg->ops->legacy->post_associate(priv); } -void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, +void il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *bss_conf, u32 changes) { - struct iwl_priv *priv = hw->priv; - struct iwl_rxon_context *ctx = iwl_legacy_rxon_ctx_from_vif(vif); + struct il_priv *priv = hw->priv; + struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); int ret; if (WARN_ON(!priv->cfg->ops->legacy)) return; - IWL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes); + IL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes); mutex_lock(&priv->mutex); - if (!iwl_legacy_is_alive(priv)) { + if (!il_is_alive(priv)) { mutex_unlock(&priv->mutex); return; } @@ -2415,7 +2415,7 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, spin_lock_irqsave(&priv->lock, flags); ctx->qos_data.qos_active = bss_conf->qos; - iwl_legacy_update_qos(priv, ctx); + il_update_qos(priv, ctx); spin_unlock_irqrestore(&priv->lock, flags); } @@ -2432,17 +2432,17 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, } if (changes & BSS_CHANGED_BSSID) { - IWL_DEBUG_MAC80211(priv, "BSSID %pM\n", bss_conf->bssid); + IL_DEBUG_MAC80211(priv, "BSSID %pM\n", bss_conf->bssid); /* * If there is currently a HW scan going on in the * background then we need to cancel it else the RXON * below/in post_associate will fail. */ - if (iwl_legacy_scan_cancel_timeout(priv, 100)) { - IWL_WARN(priv, + if (il_scan_cancel_timeout(priv, 100)) { + IL_WARN(priv, "Aborted scan still in progress after 100ms\n"); - IWL_DEBUG_MAC80211(priv, + IL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); mutex_unlock(&priv->mutex); return; @@ -2468,10 +2468,10 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, * it will invoke post_associate. */ if (vif->type == NL80211_IFTYPE_ADHOC && changes & BSS_CHANGED_BEACON) - iwl_legacy_beacon_update(hw, vif); + il_beacon_update(hw, vif); if (changes & BSS_CHANGED_ERP_PREAMBLE) { - IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", + IL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", bss_conf->use_short_preamble); if (bss_conf->use_short_preamble) ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; @@ -2480,7 +2480,7 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, } if (changes & BSS_CHANGED_ERP_CTS_PROT) { - IWL_DEBUG_MAC80211(priv, + IL_DEBUG_MAC80211(priv, "ERP_CTS %d\n", bss_conf->use_cts_prot); if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) @@ -2496,7 +2496,7 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, if (changes & BSS_CHANGED_BASIC_RATES) { /* XXX use this information * - * To do that, remove code from iwl_legacy_set_rate() and put something + * To do that, remove code from il_set_rate() and put something * like this here: * if (A-band) @@ -2511,32 +2511,32 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, } if (changes & BSS_CHANGED_HT) { - iwl_legacy_ht_conf(priv, vif); + il_ht_conf(priv, vif); if (priv->cfg->ops->hcmd->set_rxon_chain) priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); } if (changes & BSS_CHANGED_ASSOC) { - IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); + IL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); if (bss_conf->assoc) { priv->timestamp = bss_conf->timestamp; - if (!iwl_legacy_is_rfkill(priv)) + if (!il_is_rfkill(priv)) priv->cfg->ops->legacy->post_associate(priv); } else - iwl_legacy_set_no_assoc(priv, vif); + il_set_no_assoc(priv, vif); } - if (changes && iwl_legacy_is_associated_ctx(ctx) && bss_conf->aid) { - IWL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n", + if (changes && il_is_associated_ctx(ctx) && bss_conf->aid) { + IL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n", changes); - ret = iwl_legacy_send_rxon_assoc(priv, ctx); + ret = il_send_rxon_assoc(priv, ctx); if (!ret) { /* Sync active_rxon with latest change. */ memcpy((void *)&ctx->active, &ctx->staging, - sizeof(struct iwl_legacy_rxon_cmd)); + sizeof(struct il_rxon_cmd)); } } @@ -2547,27 +2547,27 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); priv->cfg->ops->legacy->config_ap(priv); } else - iwl_legacy_set_no_assoc(priv, vif); + il_set_no_assoc(priv, vif); } if (changes & BSS_CHANGED_IBSS) { ret = priv->cfg->ops->legacy->manage_ibss_station(priv, vif, bss_conf->ibss_joined); if (ret) - IWL_ERR(priv, "failed to %s IBSS station %pM\n", + IL_ERR(priv, "failed to %s IBSS station %pM\n", bss_conf->ibss_joined ? "add" : "remove", bss_conf->bssid); } mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); } -EXPORT_SYMBOL(iwl_legacy_mac_bss_info_changed); +EXPORT_SYMBOL(il_mac_bss_info_changed); -irqreturn_t iwl_legacy_isr(int irq, void *data) +irqreturn_t il_isr(int irq, void *data) { - struct iwl_priv *priv = data; + struct il_priv *priv = data; u32 inta, inta_mask; u32 inta_fh; unsigned long flags; @@ -2580,18 +2580,18 @@ irqreturn_t iwl_legacy_isr(int irq, void *data) * back-to-back ISRs and sporadic interrupts from our NIC. * If we have something to service, the tasklet will re-enable ints. * If we *don't* have something, we'll re-enable before leaving here. */ - inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ - iwl_write32(priv, CSR_INT_MASK, 0x00000000); + inta_mask = il_read32(priv, CSR_INT_MASK); /* just for debug */ + il_write32(priv, CSR_INT_MASK, 0x00000000); /* Discover which interrupts are active/pending */ - inta = iwl_read32(priv, CSR_INT); - inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); + inta = il_read32(priv, CSR_INT); + inta_fh = il_read32(priv, CSR_FH_INT_STATUS); /* Ignore interrupt if there's nothing in NIC to service. * This may be due to IRQ shared with another device, * or due to sporadic interrupts thrown from our NIC. */ if (!inta && !inta_fh) { - IWL_DEBUG_ISR(priv, + IL_DEBUG_ISR(priv, "Ignore interrupt, inta == 0, inta_fh == 0\n"); goto none; } @@ -2599,16 +2599,16 @@ irqreturn_t iwl_legacy_isr(int irq, void *data) if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { /* Hardware disappeared. It might have already raised * an interrupt */ - IWL_WARN(priv, "HARDWARE GONE?? INTA == 0x%08x\n", inta); + IL_WARN(priv, "HARDWARE GONE?? INTA == 0x%08x\n", inta); goto unplugged; } - IWL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", + IL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); inta &= ~CSR_INT_BIT_SCD; - /* iwl_irq_tasklet() will service interrupts and re-enable them */ + /* il_irq_tasklet() will service interrupts and re-enable them */ if (likely(inta || inta_fh)) tasklet_schedule(&priv->irq_tasklet); @@ -2620,17 +2620,17 @@ none: /* re-enable interrupts here since we don't have anything to service. */ /* only Re-enable if disabled by irq */ if (test_bit(STATUS_INT_ENABLED, &priv->status)) - iwl_legacy_enable_interrupts(priv); + il_enable_interrupts(priv); spin_unlock_irqrestore(&priv->lock, flags); return IRQ_NONE; } -EXPORT_SYMBOL(iwl_legacy_isr); +EXPORT_SYMBOL(il_isr); /* - * iwl_legacy_tx_cmd_protection: Set rts/cts. 3945 and 4965 only share this + * il_tx_cmd_protection: Set rts/cts. 3945 and 4965 only share this * function. */ -void iwl_legacy_tx_cmd_protection(struct iwl_priv *priv, +void il_tx_cmd_protection(struct il_priv *priv, struct ieee80211_tx_info *info, __le16 fc, __le32 *tx_flags) { @@ -2658,4 +2658,4 @@ void iwl_legacy_tx_cmd_protection(struct iwl_priv *priv, *tx_flags |= TX_CMD_FLG_FULL_TXOP_PROT_MSK; } } -EXPORT_SYMBOL(iwl_legacy_tx_cmd_protection); +EXPORT_SYMBOL(il_tx_cmd_protection); diff --git a/drivers/net/wireless/iwlegacy/iwl-core.h b/drivers/net/wireless/iwlegacy/iwl-core.h index d1271fe..92f37c9 100644 --- a/drivers/net/wireless/iwlegacy/iwl-core.h +++ b/drivers/net/wireless/iwlegacy/iwl-core.h @@ -60,54 +60,54 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#ifndef __iwl_legacy_core_h__ -#define __iwl_legacy_core_h__ +#ifndef __il_core_h__ +#define __il_core_h__ /************************ * forward declarations * ************************/ -struct iwl_host_cmd; -struct iwl_cmd; +struct il_host_cmd; +struct il_cmd; #define IWLWIFI_VERSION "in-tree:" #define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation" #define DRV_AUTHOR "" -#define IWL_PCI_DEVICE(dev, subdev, cfg) \ +#define IL_PCI_DEVICE(dev, subdev, cfg) \ .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ .subvendor = PCI_ANY_ID, .subdevice = (subdev), \ .driver_data = (kernel_ulong_t)&(cfg) #define TIME_UNIT 1024 -#define IWL_SKU_G 0x1 -#define IWL_SKU_A 0x2 -#define IWL_SKU_N 0x8 +#define IL_SKU_G 0x1 +#define IL_SKU_A 0x2 +#define IL_SKU_N 0x8 -#define IWL_CMD(x) case x: return #x +#define IL_CMD(x) case x: return #x -struct iwl_hcmd_ops { - int (*rxon_assoc)(struct iwl_priv *priv, struct iwl_rxon_context *ctx); - int (*commit_rxon)(struct iwl_priv *priv, struct iwl_rxon_context *ctx); - void (*set_rxon_chain)(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); +struct il_hcmd_ops { + int (*rxon_assoc)(struct il_priv *priv, struct il_rxon_context *ctx); + int (*commit_rxon)(struct il_priv *priv, struct il_rxon_context *ctx); + void (*set_rxon_chain)(struct il_priv *priv, + struct il_rxon_context *ctx); }; -struct iwl_hcmd_utils_ops { +struct il_hcmd_utils_ops { u16 (*get_hcmd_size)(u8 cmd_id, u16 len); - u16 (*build_addsta_hcmd)(const struct iwl_legacy_addsta_cmd *cmd, + u16 (*build_addsta_hcmd)(const struct il_addsta_cmd *cmd, u8 *data); - int (*request_scan)(struct iwl_priv *priv, struct ieee80211_vif *vif); - void (*post_scan)(struct iwl_priv *priv); + int (*request_scan)(struct il_priv *priv, struct ieee80211_vif *vif); + void (*post_scan)(struct il_priv *priv); }; -struct iwl_apm_ops { - int (*init)(struct iwl_priv *priv); - void (*config)(struct iwl_priv *priv); +struct il_apm_ops { + int (*init)(struct il_priv *priv); + void (*config)(struct il_priv *priv); }; -struct iwl_debugfs_ops { +struct il_debugfs_ops { ssize_t (*rx_stats_read)(struct file *file, char __user *user_buf, size_t count, loff_t *ppos); ssize_t (*tx_stats_read)(struct file *file, char __user *user_buf, @@ -116,79 +116,79 @@ struct iwl_debugfs_ops { size_t count, loff_t *ppos); }; -struct iwl_temp_ops { - void (*temperature)(struct iwl_priv *priv); +struct il_temp_ops { + void (*temperature)(struct il_priv *priv); }; -struct iwl_lib_ops { +struct il_lib_ops { /* set hw dependent parameters */ - int (*set_hw_params)(struct iwl_priv *priv); + int (*set_hw_params)(struct il_priv *priv); /* Handling TX */ - void (*txq_update_byte_cnt_tbl)(struct iwl_priv *priv, - struct iwl_tx_queue *txq, + void (*txq_update_byte_cnt_tbl)(struct il_priv *priv, + struct il_tx_queue *txq, u16 byte_cnt); - int (*txq_attach_buf_to_tfd)(struct iwl_priv *priv, - struct iwl_tx_queue *txq, + int (*txq_attach_buf_to_tfd)(struct il_priv *priv, + struct il_tx_queue *txq, dma_addr_t addr, u16 len, u8 reset, u8 pad); - void (*txq_free_tfd)(struct iwl_priv *priv, - struct iwl_tx_queue *txq); - int (*txq_init)(struct iwl_priv *priv, - struct iwl_tx_queue *txq); + void (*txq_free_tfd)(struct il_priv *priv, + struct il_tx_queue *txq); + int (*txq_init)(struct il_priv *priv, + struct il_tx_queue *txq); /* setup Rx handler */ - void (*rx_handler_setup)(struct iwl_priv *priv); + void (*rx_handler_setup)(struct il_priv *priv); /* alive notification after init uCode load */ - void (*init_alive_start)(struct iwl_priv *priv); + void (*init_alive_start)(struct il_priv *priv); /* check validity of rtc data address */ int (*is_valid_rtc_data_addr)(u32 addr); /* 1st ucode load */ - int (*load_ucode)(struct iwl_priv *priv); + int (*load_ucode)(struct il_priv *priv); - void (*dump_nic_error_log)(struct iwl_priv *priv); - int (*dump_fh)(struct iwl_priv *priv, char **buf, bool display); - int (*set_channel_switch)(struct iwl_priv *priv, + void (*dump_nic_error_log)(struct il_priv *priv); + int (*dump_fh)(struct il_priv *priv, char **buf, bool display); + int (*set_channel_switch)(struct il_priv *priv, struct ieee80211_channel_switch *ch_switch); /* power management */ - struct iwl_apm_ops apm_ops; + struct il_apm_ops apm_ops; /* power */ - int (*send_tx_power) (struct iwl_priv *priv); - void (*update_chain_flags)(struct iwl_priv *priv); + int (*send_tx_power) (struct il_priv *priv); + void (*update_chain_flags)(struct il_priv *priv); /* eeprom operations (as defined in iwl-eeprom.h) */ - struct iwl_eeprom_ops eeprom_ops; + struct il_eeprom_ops eeprom_ops; /* temperature */ - struct iwl_temp_ops temp_ops; + struct il_temp_ops temp_ops; - struct iwl_debugfs_ops debugfs_ops; + struct il_debugfs_ops debugfs_ops; }; -struct iwl_led_ops { - int (*cmd)(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd); +struct il_led_ops { + int (*cmd)(struct il_priv *priv, struct il_led_cmd *led_cmd); }; -struct iwl_legacy_ops { - void (*post_associate)(struct iwl_priv *priv); - void (*config_ap)(struct iwl_priv *priv); +struct il_legacy_ops { + void (*post_associate)(struct il_priv *priv); + void (*config_ap)(struct il_priv *priv); /* station management */ - int (*update_bcast_stations)(struct iwl_priv *priv); - int (*manage_ibss_station)(struct iwl_priv *priv, + int (*update_bcast_stations)(struct il_priv *priv); + int (*manage_ibss_station)(struct il_priv *priv, struct ieee80211_vif *vif, bool add); }; -struct iwl_ops { - const struct iwl_lib_ops *lib; - const struct iwl_hcmd_ops *hcmd; - const struct iwl_hcmd_utils_ops *utils; - const struct iwl_led_ops *led; - const struct iwl_nic_ops *nic; - const struct iwl_legacy_ops *legacy; +struct il_ops { + const struct il_lib_ops *lib; + const struct il_hcmd_ops *hcmd; + const struct il_hcmd_utils_ops *utils; + const struct il_led_ops *led; + const struct il_nic_ops *nic; + const struct il_legacy_ops *legacy; const struct ieee80211_ops *ieee80211_ops; }; -struct iwl_mod_params { +struct il_mod_params { int sw_crypto; /* def: 0 = using hardware encryption */ int disable_hw_scan; /* def: 0 = use h/w scan */ int num_of_queues; /* def: HW dependent */ @@ -211,11 +211,11 @@ struct iwl_mod_params { * @chain_noise_calib_by_driver: driver has the capability to perform * chain noise calibration operation */ -struct iwl_base_params { +struct il_base_params { int eeprom_size; int num_of_queues; /* def: HW dependent */ int num_of_ampdu_queues;/* def: HW dependent */ - /* for iwl_legacy_apm_init() */ + /* for il_apm_init() */ u32 pll_cfg_val; bool set_l0s; bool use_bsm; @@ -230,7 +230,7 @@ struct iwl_base_params { }; /** - * struct iwl_cfg + * struct il_cfg * @fw_name_pre: Firmware filename prefix. The api version and extension * (.ucode) will be added to filename before loading from disk. The * filename is constructed as fw_name_pre.ucode. @@ -243,11 +243,11 @@ struct iwl_base_params { * driver specifies which APIs it supports (with @ucode_api_max being the * highest and @ucode_api_min the lowest). Firmware will only be loaded if * it has a supported API version. The firmware's API version will be - * stored in @iwl_priv, enabling the driver to make runtime changes based + * stored in @il_priv, enabling the driver to make runtime changes based * on firmware version used. * * For example, - * if (IWL_UCODE_API(priv->ucode_ver) >= 2) { + * if (IL_UCODE_API(priv->ucode_ver) >= 2) { * Driver interacts with Firmware API version >= 2. * } else { * Driver interacts with Firmware API version 1. @@ -255,12 +255,12 @@ struct iwl_base_params { * * The ideal usage of this infrastructure is to treat a new ucode API * release as a new hardware revision. That is, through utilizing the - * iwl_hcmd_utils_ops etc. we accommodate different command structures + * il_hcmd_utils_ops etc. we accommodate different command structures * and flows between hardware versions as well as their API * versions. * */ -struct iwl_cfg { +struct il_cfg { /* params specific to an individual device within a device family */ const char *name; const char *fw_name_pre; @@ -271,97 +271,97 @@ struct iwl_cfg { unsigned int sku; u16 eeprom_ver; u16 eeprom_calib_ver; - const struct iwl_ops *ops; + const struct il_ops *ops; /* module based parameters which can be set from modprobe cmd */ - const struct iwl_mod_params *mod_params; + const struct il_mod_params *mod_params; /* params not likely to change within a device family */ - struct iwl_base_params *base_params; + struct il_base_params *base_params; /* params likely to change within a device family */ u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; - enum iwl_led_mode led_mode; + enum il_led_mode led_mode; }; /*************************** * L i b * ***************************/ -struct ieee80211_hw *iwl_legacy_alloc_all(struct iwl_cfg *cfg); -int iwl_legacy_mac_conf_tx(struct ieee80211_hw *hw, +struct ieee80211_hw *il_alloc_all(struct il_cfg *cfg); +int il_mac_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, const struct ieee80211_tx_queue_params *params); -int iwl_legacy_mac_tx_last_beacon(struct ieee80211_hw *hw); -void iwl_legacy_set_rxon_hwcrypto(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +int il_mac_tx_last_beacon(struct ieee80211_hw *hw); +void il_set_rxon_hwcrypto(struct il_priv *priv, + struct il_rxon_context *ctx, int hw_decrypt); -int iwl_legacy_check_rxon_cmd(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -int iwl_legacy_full_rxon_required(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -int iwl_legacy_set_rxon_channel(struct iwl_priv *priv, +int il_check_rxon_cmd(struct il_priv *priv, + struct il_rxon_context *ctx); +int il_full_rxon_required(struct il_priv *priv, + struct il_rxon_context *ctx); +int il_set_rxon_channel(struct il_priv *priv, struct ieee80211_channel *ch, - struct iwl_rxon_context *ctx); -void iwl_legacy_set_flags_for_band(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, + struct il_rxon_context *ctx); +void il_set_flags_for_band(struct il_priv *priv, + struct il_rxon_context *ctx, enum ieee80211_band band, struct ieee80211_vif *vif); -u8 iwl_legacy_get_single_channel_number(struct iwl_priv *priv, +u8 il_get_single_channel_number(struct il_priv *priv, enum ieee80211_band band); -void iwl_legacy_set_rxon_ht(struct iwl_priv *priv, - struct iwl_ht_config *ht_conf); -bool iwl_legacy_is_ht40_tx_allowed(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +void il_set_rxon_ht(struct il_priv *priv, + struct il_ht_config *ht_conf); +bool il_is_ht40_tx_allowed(struct il_priv *priv, + struct il_rxon_context *ctx, struct ieee80211_sta_ht_cap *ht_cap); -void iwl_legacy_connection_init_rx_config(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -void iwl_legacy_set_rate(struct iwl_priv *priv); -int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv, +void il_connection_init_rx_config(struct il_priv *priv, + struct il_rxon_context *ctx); +void il_set_rate(struct il_priv *priv); +int il_set_decrypted_flag(struct il_priv *priv, struct ieee80211_hdr *hdr, u32 decrypt_res, struct ieee80211_rx_status *stats); -void iwl_legacy_irq_handle_error(struct iwl_priv *priv); -int iwl_legacy_mac_add_interface(struct ieee80211_hw *hw, +void il_irq_handle_error(struct il_priv *priv); +int il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -void iwl_legacy_mac_remove_interface(struct ieee80211_hw *hw, +void il_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -int iwl_legacy_mac_change_interface(struct ieee80211_hw *hw, +int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum nl80211_iftype newtype, bool newp2p); -int iwl_legacy_alloc_txq_mem(struct iwl_priv *priv); -void iwl_legacy_txq_mem(struct iwl_priv *priv); +int il_alloc_txq_mem(struct il_priv *priv); +void il_txq_mem(struct il_priv *priv); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS -int iwl_legacy_alloc_traffic_mem(struct iwl_priv *priv); -void iwl_legacy_free_traffic_mem(struct iwl_priv *priv); -void iwl_legacy_reset_traffic_log(struct iwl_priv *priv); -void iwl_legacy_dbg_log_tx_data_frame(struct iwl_priv *priv, +int il_alloc_traffic_mem(struct il_priv *priv); +void il_free_traffic_mem(struct il_priv *priv); +void il_reset_traffic_log(struct il_priv *priv); +void il_dbg_log_tx_data_frame(struct il_priv *priv, u16 length, struct ieee80211_hdr *header); -void iwl_legacy_dbg_log_rx_data_frame(struct iwl_priv *priv, +void il_dbg_log_rx_data_frame(struct il_priv *priv, u16 length, struct ieee80211_hdr *header); -const char *iwl_legacy_get_mgmt_string(int cmd); -const char *iwl_legacy_get_ctrl_string(int cmd); -void iwl_legacy_clear_traffic_stats(struct iwl_priv *priv); -void iwl_legacy_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, +const char *il_get_mgmt_string(int cmd); +const char *il_get_ctrl_string(int cmd); +void il_clear_traffic_stats(struct il_priv *priv); +void il_update_stats(struct il_priv *priv, bool is_tx, __le16 fc, u16 len); #else -static inline int iwl_legacy_alloc_traffic_mem(struct iwl_priv *priv) +static inline int il_alloc_traffic_mem(struct il_priv *priv) { return 0; } -static inline void iwl_legacy_free_traffic_mem(struct iwl_priv *priv) +static inline void il_free_traffic_mem(struct il_priv *priv) { } -static inline void iwl_legacy_reset_traffic_log(struct iwl_priv *priv) +static inline void il_reset_traffic_log(struct il_priv *priv) { } -static inline void iwl_legacy_dbg_log_tx_data_frame(struct iwl_priv *priv, +static inline void il_dbg_log_tx_data_frame(struct il_priv *priv, u16 length, struct ieee80211_hdr *header) { } -static inline void iwl_legacy_dbg_log_rx_data_frame(struct iwl_priv *priv, +static inline void il_dbg_log_rx_data_frame(struct il_priv *priv, u16 length, struct ieee80211_hdr *header) { } -static inline void iwl_legacy_update_stats(struct iwl_priv *priv, bool is_tx, +static inline void il_update_stats(struct il_priv *priv, bool is_tx, __le16 fc, u16 len) { } @@ -369,83 +369,83 @@ static inline void iwl_legacy_update_stats(struct iwl_priv *priv, bool is_tx, /***************************************************** * RX handlers. * **************************************************/ -void iwl_legacy_rx_pm_sleep_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -void iwl_legacy_rx_pm_debug_statistics_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -void iwl_legacy_rx_reply_error(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); +void il_rx_pm_sleep_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); +void il_rx_pm_debug_statistics_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); +void il_rx_reply_error(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); /***************************************************** * RX ******************************************************/ -void iwl_legacy_cmd_queue_unmap(struct iwl_priv *priv); -void iwl_legacy_cmd_queue_free(struct iwl_priv *priv); -int iwl_legacy_rx_queue_alloc(struct iwl_priv *priv); -void iwl_legacy_rx_queue_update_write_ptr(struct iwl_priv *priv, - struct iwl_rx_queue *q); -int iwl_legacy_rx_queue_space(const struct iwl_rx_queue *q); -void iwl_legacy_tx_cmd_complete(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); +void il_cmd_queue_unmap(struct il_priv *priv); +void il_cmd_queue_free(struct il_priv *priv); +int il_rx_queue_alloc(struct il_priv *priv); +void il_rx_queue_update_write_ptr(struct il_priv *priv, + struct il_rx_queue *q); +int il_rx_queue_space(const struct il_rx_queue *q); +void il_tx_cmd_complete(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); /* Handlers */ -void iwl_legacy_rx_spectrum_measure_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -void iwl_legacy_recover_from_statistics(struct iwl_priv *priv, - struct iwl_rx_packet *pkt); -void iwl_legacy_chswitch_done(struct iwl_priv *priv, bool is_success); -void iwl_legacy_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb); +void il_rx_spectrum_measure_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); +void il_recover_from_statistics(struct il_priv *priv, + struct il_rx_packet *pkt); +void il_chswitch_done(struct il_priv *priv, bool is_success); +void il_rx_csa(struct il_priv *priv, struct il_rx_mem_buffer *rxb); /* TX helpers */ /***************************************************** * TX ******************************************************/ -void iwl_legacy_txq_update_write_ptr(struct iwl_priv *priv, - struct iwl_tx_queue *txq); -int iwl_legacy_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, +void il_txq_update_write_ptr(struct il_priv *priv, + struct il_tx_queue *txq); +int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq, int slots_num, u32 txq_id); -void iwl_legacy_tx_queue_reset(struct iwl_priv *priv, - struct iwl_tx_queue *txq, +void il_tx_queue_reset(struct il_priv *priv, + struct il_tx_queue *txq, int slots_num, u32 txq_id); -void iwl_legacy_tx_queue_unmap(struct iwl_priv *priv, int txq_id); -void iwl_legacy_tx_queue_free(struct iwl_priv *priv, int txq_id); -void iwl_legacy_setup_watchdog(struct iwl_priv *priv); +void il_tx_queue_unmap(struct il_priv *priv, int txq_id); +void il_tx_queue_free(struct il_priv *priv, int txq_id); +void il_setup_watchdog(struct il_priv *priv); /***************************************************** * TX power ****************************************************/ -int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); +int il_set_tx_power(struct il_priv *priv, s8 tx_power, bool force); /******************************************************************************* * Rate ******************************************************************************/ -u8 iwl_legacy_get_lowest_plcp(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); +u8 il_get_lowest_plcp(struct il_priv *priv, + struct il_rxon_context *ctx); /******************************************************************************* * Scanning ******************************************************************************/ -void iwl_legacy_init_scan_params(struct iwl_priv *priv); -int iwl_legacy_scan_cancel(struct iwl_priv *priv); -int iwl_legacy_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); -void iwl_legacy_force_scan_end(struct iwl_priv *priv); -int iwl_legacy_mac_hw_scan(struct ieee80211_hw *hw, +void il_init_scan_params(struct il_priv *priv); +int il_scan_cancel(struct il_priv *priv); +int il_scan_cancel_timeout(struct il_priv *priv, unsigned long ms); +void il_force_scan_end(struct il_priv *priv); +int il_mac_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct cfg80211_scan_request *req); -void iwl_legacy_internal_short_hw_scan(struct iwl_priv *priv); -int iwl_legacy_force_reset(struct iwl_priv *priv, bool external); -u16 iwl_legacy_fill_probe_req(struct iwl_priv *priv, +void il_internal_short_hw_scan(struct il_priv *priv); +int il_force_reset(struct il_priv *priv, bool external); +u16 il_fill_probe_req(struct il_priv *priv, struct ieee80211_mgmt *frame, const u8 *ta, const u8 *ie, int ie_len, int left); -void iwl_legacy_setup_rx_scan_handlers(struct iwl_priv *priv); -u16 iwl_legacy_get_active_dwell_time(struct iwl_priv *priv, +void il_setup_rx_scan_handlers(struct il_priv *priv); +u16 il_get_active_dwell_time(struct il_priv *priv, enum ieee80211_band band, u8 n_probes); -u16 iwl_legacy_get_passive_dwell_time(struct iwl_priv *priv, +u16 il_get_passive_dwell_time(struct il_priv *priv, enum ieee80211_band band, struct ieee80211_vif *vif); -void iwl_legacy_setup_scan_deferred_work(struct iwl_priv *priv); -void iwl_legacy_cancel_scan_deferred_work(struct iwl_priv *priv); +void il_setup_scan_deferred_work(struct il_priv *priv); +void il_cancel_scan_deferred_work(struct il_priv *priv); /* For faster active scanning, scan will move to the next channel if fewer than * 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); * time if it's a quiet channel (nothing responded to our probe, and there's * no other traffic). * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ -#define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */ -#define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */ +#define IL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */ +#define IL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */ -#define IWL_SCAN_CHECK_WATCHDOG (HZ * 7) +#define IL_SCAN_CHECK_WATCHDOG (HZ * 7) /***************************************************** * S e n d i n g H o s t C o m m a n d s * *****************************************************/ -const char *iwl_legacy_get_cmd_string(u8 cmd); -int __must_check iwl_legacy_send_cmd_sync(struct iwl_priv *priv, - struct iwl_host_cmd *cmd); -int iwl_legacy_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); -int __must_check iwl_legacy_send_cmd_pdu(struct iwl_priv *priv, u8 id, +const char *il_get_cmd_string(u8 cmd); +int __must_check il_send_cmd_sync(struct il_priv *priv, + struct il_host_cmd *cmd); +int il_send_cmd(struct il_priv *priv, struct il_host_cmd *cmd); +int __must_check il_send_cmd_pdu(struct il_priv *priv, u8 id, u16 len, const void *data); -int iwl_legacy_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len, +int il_send_cmd_pdu_async(struct il_priv *priv, u8 id, u16 len, const void *data, - void (*callback)(struct iwl_priv *priv, - struct iwl_device_cmd *cmd, - struct iwl_rx_packet *pkt)); + void (*callback)(struct il_priv *priv, + struct il_device_cmd *cmd, + struct il_rx_packet *pkt)); -int iwl_legacy_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); +int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd); /***************************************************** * PCI * *****************************************************/ -static inline u16 iwl_legacy_pcie_link_ctl(struct iwl_priv *priv) +static inline u16 il_pcie_link_ctl(struct il_priv *priv) { int pos; u16 pci_lnk_ctl; @@ -490,46 +490,46 @@ static inline u16 iwl_legacy_pcie_link_ctl(struct iwl_priv *priv) return pci_lnk_ctl; } -void iwl_legacy_bg_watchdog(unsigned long data); -u32 iwl_legacy_usecs_to_beacons(struct iwl_priv *priv, +void il_bg_watchdog(unsigned long data); +u32 il_usecs_to_beacons(struct il_priv *priv, u32 usec, u32 beacon_interval); -__le32 iwl_legacy_add_beacon_time(struct iwl_priv *priv, u32 base, +__le32 il_add_beacon_time(struct il_priv *priv, u32 base, u32 addon, u32 beacon_interval); #ifdef CONFIG_PM -int iwl_legacy_pci_suspend(struct device *device); -int iwl_legacy_pci_resume(struct device *device); -extern const struct dev_pm_ops iwl_legacy_pm_ops; +int il_pci_suspend(struct device *device); +int il_pci_resume(struct device *device); +extern const struct dev_pm_ops il_pm_ops; -#define IWL_LEGACY_PM_OPS (&iwl_legacy_pm_ops) +#define IL_LEGACY_PM_OPS (&il_pm_ops) #else /* !CONFIG_PM */ -#define IWL_LEGACY_PM_OPS NULL +#define IL_LEGACY_PM_OPS NULL #endif /* !CONFIG_PM */ /***************************************************** * Error Handling Debugging ******************************************************/ -void iwl4965_dump_nic_error_log(struct iwl_priv *priv); +void il4965_dump_nic_error_log(struct il_priv *priv); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -void iwl_legacy_print_rx_config_cmd(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); +void il_print_rx_config_cmd(struct il_priv *priv, + struct il_rxon_context *ctx); #else -static inline void iwl_legacy_print_rx_config_cmd(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +static inline void il_print_rx_config_cmd(struct il_priv *priv, + struct il_rxon_context *ctx) { } #endif -void iwl_legacy_clear_isr_stats(struct iwl_priv *priv); +void il_clear_isr_stats(struct il_priv *priv); /***************************************************** * GEOS ******************************************************/ -int iwl_legacy_init_geos(struct iwl_priv *priv); -void iwl_legacy_free_geos(struct iwl_priv *priv); +int il_init_geos(struct il_priv *priv); +void il_free_geos(struct il_priv *priv); /*************** DRIVER STATUS FUNCTIONS *****/ @@ -552,7 +552,7 @@ void iwl_legacy_free_geos(struct iwl_priv *priv); #define STATUS_FW_ERROR 17 #define STATUS_CHANNEL_SWITCH_PENDING 18 -static inline int iwl_legacy_is_ready(struct iwl_priv *priv) +static inline int il_is_ready(struct il_priv *priv) { /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are * set but EXIT_PENDING is not */ @@ -561,76 +561,76 @@ static inline int iwl_legacy_is_ready(struct iwl_priv *priv) !test_bit(STATUS_EXIT_PENDING, &priv->status); } -static inline int iwl_legacy_is_alive(struct iwl_priv *priv) +static inline int il_is_alive(struct il_priv *priv) { return test_bit(STATUS_ALIVE, &priv->status); } -static inline int iwl_legacy_is_init(struct iwl_priv *priv) +static inline int il_is_init(struct il_priv *priv) { return test_bit(STATUS_INIT, &priv->status); } -static inline int iwl_legacy_is_rfkill_hw(struct iwl_priv *priv) +static inline int il_is_rfkill_hw(struct il_priv *priv) { return test_bit(STATUS_RF_KILL_HW, &priv->status); } -static inline int iwl_legacy_is_rfkill(struct iwl_priv *priv) +static inline int il_is_rfkill(struct il_priv *priv) { - return iwl_legacy_is_rfkill_hw(priv); + return il_is_rfkill_hw(priv); } -static inline int iwl_legacy_is_ctkill(struct iwl_priv *priv) +static inline int il_is_ctkill(struct il_priv *priv) { return test_bit(STATUS_CT_KILL, &priv->status); } -static inline int iwl_legacy_is_ready_rf(struct iwl_priv *priv) +static inline int il_is_ready_rf(struct il_priv *priv) { - if (iwl_legacy_is_rfkill(priv)) + if (il_is_rfkill(priv)) return 0; - return iwl_legacy_is_ready(priv); + return il_is_ready(priv); } -extern void iwl_legacy_send_bt_config(struct iwl_priv *priv); -extern int iwl_legacy_send_statistics_request(struct iwl_priv *priv, +extern void il_send_bt_config(struct il_priv *priv); +extern int il_send_statistics_request(struct il_priv *priv, u8 flags, bool clear); -void iwl_legacy_apm_stop(struct iwl_priv *priv); -int iwl_legacy_apm_init(struct iwl_priv *priv); +void il_apm_stop(struct il_priv *priv); +int il_apm_init(struct il_priv *priv); -int iwl_legacy_send_rxon_timing(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -static inline int iwl_legacy_send_rxon_assoc(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +int il_send_rxon_timing(struct il_priv *priv, + struct il_rxon_context *ctx); +static inline int il_send_rxon_assoc(struct il_priv *priv, + struct il_rxon_context *ctx) { return priv->cfg->ops->hcmd->rxon_assoc(priv, ctx); } -static inline int iwl_legacy_commit_rxon(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +static inline int il_commit_rxon(struct il_priv *priv, + struct il_rxon_context *ctx) { return priv->cfg->ops->hcmd->commit_rxon(priv, ctx); } -static inline const struct ieee80211_supported_band *iwl_get_hw_mode( - struct iwl_priv *priv, enum ieee80211_band band) +static inline const struct ieee80211_supported_band *il_get_hw_mode( + struct il_priv *priv, enum ieee80211_band band) { return priv->hw->wiphy->bands[band]; } /* mac80211 handlers */ -int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed); -void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw, +int il_mac_config(struct ieee80211_hw *hw, u32 changed); +void il_mac_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, +void il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *bss_conf, u32 changes); -void iwl_legacy_tx_cmd_protection(struct iwl_priv *priv, +void il_tx_cmd_protection(struct il_priv *priv, struct ieee80211_tx_info *info, __le16 fc, __le32 *tx_flags); -irqreturn_t iwl_legacy_isr(int irq, void *data); +irqreturn_t il_isr(int irq, void *data); -#endif /* __iwl_legacy_core_h__ */ +#endif /* __il_core_h__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-csr.h b/drivers/net/wireless/iwlegacy/iwl-csr.h index 668a961..24b71ae 100644 --- a/drivers/net/wireless/iwlegacy/iwl-csr.h +++ b/drivers/net/wireless/iwlegacy/iwl-csr.h @@ -60,8 +60,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *****************************************************************************/ -#ifndef __iwl_legacy_csr_h__ -#define __iwl_legacy_csr_h__ +#ifndef __il_csr_h__ +#define __il_csr_h__ /* * CSR (control and status registers) * @@ -70,9 +70,9 @@ * low power states due to driver-invoked device resets * (e.g. CSR_RESET_REG_FLAG_SW_RESET) or uCode-driven power-saving modes. * - * Use iwl_write32() and iwl_read32() family to access these registers; + * Use il_write32() and il_read32() family to access these registers; * these provide simple PCI bus access, without waking up the MAC. - * Do not use iwl_legacy_write_direct32() family for these registers; + * Do not use il_write_direct32() family for these registers; * no need to "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ. * The MAC (uCode processor, etc.) does not need to be powered up for accessing * the CSR registers. @@ -91,7 +91,7 @@ #define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/ #define CSR_GP_CNTRL (CSR_BASE+0x024) -/* 2nd byte of CSR_INT_COALESCING, not accessible via iwl_write32()! */ +/* 2nd byte of CSR_INT_COALESCING, not accessible via il_write32()! */ #define CSR_INT_PERIODIC_REG (CSR_BASE+0x005) /* @@ -368,13 +368,13 @@ * to indirectly access device's internal memory or registers that * may be powered-down. * - * Use iwl_legacy_write_direct32()/iwl_legacy_read_direct32() family + * Use il_write_direct32()/il_read_direct32() family * for these registers; * host must "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ * to make sure the MAC (uCode processor, etc.) is powered up for accessing * internal resources. * - * Do not use iwl_write32()/iwl_read32() family to access these registers; + * Do not use il_write32()/il_read32() family to access these registers; * these provide only simple PCI bus access, without waking up the MAC. */ #define HBUS_BASE (0x400) @@ -419,4 +419,4 @@ */ #define HBUS_TARG_WRPTR (HBUS_BASE+0x060) -#endif /* !__iwl_legacy_csr_h__ */ +#endif /* !__il_csr_h__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-debug.h b/drivers/net/wireless/iwlegacy/iwl-debug.h index ae13112..1bbad76 100644 --- a/drivers/net/wireless/iwlegacy/iwl-debug.h +++ b/drivers/net/wireless/iwlegacy/iwl-debug.h @@ -26,65 +26,65 @@ * *****************************************************************************/ -#ifndef __iwl_legacy_debug_h__ -#define __iwl_legacy_debug_h__ +#ifndef __il_debug_h__ +#define __il_debug_h__ -struct iwl_priv; +struct il_priv; extern u32 iwlegacy_debug_level; -#define IWL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a) -#define IWL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a) -#define IWL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a) -#define IWL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a) +#define IL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a) +#define IL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a) +#define IL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a) +#define IL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a) -#define iwl_print_hex_error(priv, p, len) \ +#define il_print_hex_error(priv, p, len) \ do { \ print_hex_dump(KERN_ERR, "iwl data: ", \ DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ } while (0) #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -#define IWL_DEBUG(__priv, level, fmt, args...) \ +#define IL_DEBUG(__priv, level, fmt, args...) \ do { \ - if (iwl_legacy_get_debug_level(__priv) & (level)) \ + if (il_get_debug_level(__priv) & (level)) \ dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev), \ "%c %s " fmt, in_interrupt() ? 'I' : 'U', \ __func__ , ## args); \ } while (0) -#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...) \ +#define IL_DEBUG_LIMIT(__priv, level, fmt, args...) \ do { \ - if ((iwl_legacy_get_debug_level(__priv) & (level)) && net_ratelimit()) \ + if ((il_get_debug_level(__priv) & (level)) && net_ratelimit()) \ dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev), \ "%c %s " fmt, in_interrupt() ? 'I' : 'U', \ __func__ , ## args); \ } while (0) -#define iwl_print_hex_dump(priv, level, p, len) \ +#define il_print_hex_dump(priv, level, p, len) \ do { \ - if (iwl_legacy_get_debug_level(priv) & level) \ + if (il_get_debug_level(priv) & level) \ print_hex_dump(KERN_DEBUG, "iwl data: ", \ DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ } while (0) #else -#define IWL_DEBUG(__priv, level, fmt, args...) -#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...) -static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level, +#define IL_DEBUG(__priv, level, fmt, args...) +#define IL_DEBUG_LIMIT(__priv, level, fmt, args...) +static inline void il_print_hex_dump(struct il_priv *priv, int level, const void *p, u32 len) {} #endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */ #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS -int iwl_legacy_dbgfs_register(struct iwl_priv *priv, const char *name); -void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv); +int il_dbgfs_register(struct il_priv *priv, const char *name); +void il_dbgfs_unregister(struct il_priv *priv); #else static inline int -iwl_legacy_dbgfs_register(struct iwl_priv *priv, const char *name) +il_dbgfs_register(struct il_priv *priv, const char *name) { return 0; } -static inline void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv) +static inline void il_dbgfs_unregister(struct il_priv *priv) { } #endif /* CONFIG_IWLWIFI_LEGACY_DEBUGFS */ @@ -95,12 +95,12 @@ static inline void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv) * If you are defining a new debug classification, simply add it to the #define * list here in the form of * - * #define IWL_DL_xxxx VALUE + * #define IL_DL_xxxx VALUE * * where xxxx should be the name of the classification (for example, WEP). * - * You then need to either add a IWL_xxxx_DEBUG() macro definition for your - * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want + * You then need to either add a IL_xxxx_DEBUG() macro definition for your + * classification, or use IL_DEBUG(IL_DL_xxxx, ...) whenever you want * to send output to that classification. * * The active debug levels can be accessed via files @@ -113,86 +113,86 @@ static inline void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv) */ /* 0x0000000F - 0x00000001 */ -#define IWL_DL_INFO (1 << 0) -#define IWL_DL_MAC80211 (1 << 1) -#define IWL_DL_HCMD (1 << 2) -#define IWL_DL_STATE (1 << 3) +#define IL_DL_INFO (1 << 0) +#define IL_DL_MAC80211 (1 << 1) +#define IL_DL_HCMD (1 << 2) +#define IL_DL_STATE (1 << 3) /* 0x000000F0 - 0x00000010 */ -#define IWL_DL_MACDUMP (1 << 4) -#define IWL_DL_HCMD_DUMP (1 << 5) -#define IWL_DL_EEPROM (1 << 6) -#define IWL_DL_RADIO (1 << 7) +#define IL_DL_MACDUMP (1 << 4) +#define IL_DL_HCMD_DUMP (1 << 5) +#define IL_DL_EEPROM (1 << 6) +#define IL_DL_RADIO (1 << 7) /* 0x00000F00 - 0x00000100 */ -#define IWL_DL_POWER (1 << 8) -#define IWL_DL_TEMP (1 << 9) -#define IWL_DL_NOTIF (1 << 10) -#define IWL_DL_SCAN (1 << 11) +#define IL_DL_POWER (1 << 8) +#define IL_DL_TEMP (1 << 9) +#define IL_DL_NOTIF (1 << 10) +#define IL_DL_SCAN (1 << 11) /* 0x0000F000 - 0x00001000 */ -#define IWL_DL_ASSOC (1 << 12) -#define IWL_DL_DROP (1 << 13) -#define IWL_DL_TXPOWER (1 << 14) -#define IWL_DL_AP (1 << 15) +#define IL_DL_ASSOC (1 << 12) +#define IL_DL_DROP (1 << 13) +#define IL_DL_TXPOWER (1 << 14) +#define IL_DL_AP (1 << 15) /* 0x000F0000 - 0x00010000 */ -#define IWL_DL_FW (1 << 16) -#define IWL_DL_RF_KILL (1 << 17) -#define IWL_DL_FW_ERRORS (1 << 18) -#define IWL_DL_LED (1 << 19) +#define IL_DL_FW (1 << 16) +#define IL_DL_RF_KILL (1 << 17) +#define IL_DL_FW_ERRORS (1 << 18) +#define IL_DL_LED (1 << 19) /* 0x00F00000 - 0x00100000 */ -#define IWL_DL_RATE (1 << 20) -#define IWL_DL_CALIB (1 << 21) -#define IWL_DL_WEP (1 << 22) -#define IWL_DL_TX (1 << 23) +#define IL_DL_RATE (1 << 20) +#define IL_DL_CALIB (1 << 21) +#define IL_DL_WEP (1 << 22) +#define IL_DL_TX (1 << 23) /* 0x0F000000 - 0x01000000 */ -#define IWL_DL_RX (1 << 24) -#define IWL_DL_ISR (1 << 25) -#define IWL_DL_HT (1 << 26) -#define IWL_DL_IO (1 << 27) +#define IL_DL_RX (1 << 24) +#define IL_DL_ISR (1 << 25) +#define IL_DL_HT (1 << 26) +#define IL_DL_IO (1 << 27) /* 0xF0000000 - 0x10000000 */ -#define IWL_DL_11H (1 << 28) -#define IWL_DL_STATS (1 << 29) -#define IWL_DL_TX_REPLY (1 << 30) -#define IWL_DL_QOS (1 << 31) +#define IL_DL_11H (1 << 28) +#define IL_DL_STATS (1 << 29) +#define IL_DL_TX_REPLY (1 << 30) +#define IL_DL_QOS (1 << 31) -#define IWL_DEBUG_INFO(p, f, a...) IWL_DEBUG(p, IWL_DL_INFO, f, ## a) -#define IWL_DEBUG_MAC80211(p, f, a...) IWL_DEBUG(p, IWL_DL_MAC80211, f, ## a) -#define IWL_DEBUG_MACDUMP(p, f, a...) IWL_DEBUG(p, IWL_DL_MACDUMP, f, ## a) -#define IWL_DEBUG_TEMP(p, f, a...) IWL_DEBUG(p, IWL_DL_TEMP, f, ## a) -#define IWL_DEBUG_SCAN(p, f, a...) IWL_DEBUG(p, IWL_DL_SCAN, f, ## a) -#define IWL_DEBUG_RX(p, f, a...) IWL_DEBUG(p, IWL_DL_RX, f, ## a) -#define IWL_DEBUG_TX(p, f, a...) IWL_DEBUG(p, IWL_DL_TX, f, ## a) -#define IWL_DEBUG_ISR(p, f, a...) IWL_DEBUG(p, IWL_DL_ISR, f, ## a) -#define IWL_DEBUG_LED(p, f, a...) IWL_DEBUG(p, IWL_DL_LED, f, ## a) -#define IWL_DEBUG_WEP(p, f, a...) IWL_DEBUG(p, IWL_DL_WEP, f, ## a) -#define IWL_DEBUG_HC(p, f, a...) IWL_DEBUG(p, IWL_DL_HCMD, f, ## a) -#define IWL_DEBUG_HC_DUMP(p, f, a...) IWL_DEBUG(p, IWL_DL_HCMD_DUMP, f, ## a) -#define IWL_DEBUG_EEPROM(p, f, a...) IWL_DEBUG(p, IWL_DL_EEPROM, f, ## a) -#define IWL_DEBUG_CALIB(p, f, a...) IWL_DEBUG(p, IWL_DL_CALIB, f, ## a) -#define IWL_DEBUG_FW(p, f, a...) IWL_DEBUG(p, IWL_DL_FW, f, ## a) -#define IWL_DEBUG_RF_KILL(p, f, a...) IWL_DEBUG(p, IWL_DL_RF_KILL, f, ## a) -#define IWL_DEBUG_DROP(p, f, a...) IWL_DEBUG(p, IWL_DL_DROP, f, ## a) -#define IWL_DEBUG_DROP_LIMIT(p, f, a...) \ - IWL_DEBUG_LIMIT(p, IWL_DL_DROP, f, ## a) -#define IWL_DEBUG_AP(p, f, a...) IWL_DEBUG(p, IWL_DL_AP, f, ## a) -#define IWL_DEBUG_TXPOWER(p, f, a...) IWL_DEBUG(p, IWL_DL_TXPOWER, f, ## a) -#define IWL_DEBUG_IO(p, f, a...) IWL_DEBUG(p, IWL_DL_IO, f, ## a) -#define IWL_DEBUG_RATE(p, f, a...) IWL_DEBUG(p, IWL_DL_RATE, f, ## a) -#define IWL_DEBUG_RATE_LIMIT(p, f, a...) \ - IWL_DEBUG_LIMIT(p, IWL_DL_RATE, f, ## a) -#define IWL_DEBUG_NOTIF(p, f, a...) IWL_DEBUG(p, IWL_DL_NOTIF, f, ## a) -#define IWL_DEBUG_ASSOC(p, f, a...) \ - IWL_DEBUG(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) -#define IWL_DEBUG_ASSOC_LIMIT(p, f, a...) \ - IWL_DEBUG_LIMIT(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) -#define IWL_DEBUG_HT(p, f, a...) IWL_DEBUG(p, IWL_DL_HT, f, ## a) -#define IWL_DEBUG_STATS(p, f, a...) IWL_DEBUG(p, IWL_DL_STATS, f, ## a) -#define IWL_DEBUG_STATS_LIMIT(p, f, a...) \ - IWL_DEBUG_LIMIT(p, IWL_DL_STATS, f, ## a) -#define IWL_DEBUG_TX_REPLY(p, f, a...) IWL_DEBUG(p, IWL_DL_TX_REPLY, f, ## a) -#define IWL_DEBUG_TX_REPLY_LIMIT(p, f, a...) \ - IWL_DEBUG_LIMIT(p, IWL_DL_TX_REPLY, f, ## a) -#define IWL_DEBUG_QOS(p, f, a...) IWL_DEBUG(p, IWL_DL_QOS, f, ## a) -#define IWL_DEBUG_RADIO(p, f, a...) IWL_DEBUG(p, IWL_DL_RADIO, f, ## a) -#define IWL_DEBUG_POWER(p, f, a...) IWL_DEBUG(p, IWL_DL_POWER, f, ## a) -#define IWL_DEBUG_11H(p, f, a...) IWL_DEBUG(p, IWL_DL_11H, f, ## a) +#define IL_DEBUG_INFO(p, f, a...) IL_DEBUG(p, IL_DL_INFO, f, ## a) +#define IL_DEBUG_MAC80211(p, f, a...) IL_DEBUG(p, IL_DL_MAC80211, f, ## a) +#define IL_DEBUG_MACDUMP(p, f, a...) IL_DEBUG(p, IL_DL_MACDUMP, f, ## a) +#define IL_DEBUG_TEMP(p, f, a...) IL_DEBUG(p, IL_DL_TEMP, f, ## a) +#define IL_DEBUG_SCAN(p, f, a...) IL_DEBUG(p, IL_DL_SCAN, f, ## a) +#define IL_DEBUG_RX(p, f, a...) IL_DEBUG(p, IL_DL_RX, f, ## a) +#define IL_DEBUG_TX(p, f, a...) IL_DEBUG(p, IL_DL_TX, f, ## a) +#define IL_DEBUG_ISR(p, f, a...) IL_DEBUG(p, IL_DL_ISR, f, ## a) +#define IL_DEBUG_LED(p, f, a...) IL_DEBUG(p, IL_DL_LED, f, ## a) +#define IL_DEBUG_WEP(p, f, a...) IL_DEBUG(p, IL_DL_WEP, f, ## a) +#define IL_DEBUG_HC(p, f, a...) IL_DEBUG(p, IL_DL_HCMD, f, ## a) +#define IL_DEBUG_HC_DUMP(p, f, a...) IL_DEBUG(p, IL_DL_HCMD_DUMP, f, ## a) +#define IL_DEBUG_EEPROM(p, f, a...) IL_DEBUG(p, IL_DL_EEPROM, f, ## a) +#define IL_DEBUG_CALIB(p, f, a...) IL_DEBUG(p, IL_DL_CALIB, f, ## a) +#define IL_DEBUG_FW(p, f, a...) IL_DEBUG(p, IL_DL_FW, f, ## a) +#define IL_DEBUG_RF_KILL(p, f, a...) IL_DEBUG(p, IL_DL_RF_KILL, f, ## a) +#define IL_DEBUG_DROP(p, f, a...) IL_DEBUG(p, IL_DL_DROP, f, ## a) +#define IL_DEBUG_DROP_LIMIT(p, f, a...) \ + IL_DEBUG_LIMIT(p, IL_DL_DROP, f, ## a) +#define IL_DEBUG_AP(p, f, a...) IL_DEBUG(p, IL_DL_AP, f, ## a) +#define IL_DEBUG_TXPOWER(p, f, a...) IL_DEBUG(p, IL_DL_TXPOWER, f, ## a) +#define IL_DEBUG_IO(p, f, a...) IL_DEBUG(p, IL_DL_IO, f, ## a) +#define IL_DEBUG_RATE(p, f, a...) IL_DEBUG(p, IL_DL_RATE, f, ## a) +#define IL_DEBUG_RATE_LIMIT(p, f, a...) \ + IL_DEBUG_LIMIT(p, IL_DL_RATE, f, ## a) +#define IL_DEBUG_NOTIF(p, f, a...) IL_DEBUG(p, IL_DL_NOTIF, f, ## a) +#define IL_DEBUG_ASSOC(p, f, a...) \ + IL_DEBUG(p, IL_DL_ASSOC | IL_DL_INFO, f, ## a) +#define IL_DEBUG_ASSOC_LIMIT(p, f, a...) \ + IL_DEBUG_LIMIT(p, IL_DL_ASSOC | IL_DL_INFO, f, ## a) +#define IL_DEBUG_HT(p, f, a...) IL_DEBUG(p, IL_DL_HT, f, ## a) +#define IL_DEBUG_STATS(p, f, a...) IL_DEBUG(p, IL_DL_STATS, f, ## a) +#define IL_DEBUG_STATS_LIMIT(p, f, a...) \ + IL_DEBUG_LIMIT(p, IL_DL_STATS, f, ## a) +#define IL_DEBUG_TX_REPLY(p, f, a...) IL_DEBUG(p, IL_DL_TX_REPLY, f, ## a) +#define IL_DEBUG_TX_REPLY_LIMIT(p, f, a...) \ + IL_DEBUG_LIMIT(p, IL_DL_TX_REPLY, f, ## a) +#define IL_DEBUG_QOS(p, f, a...) IL_DEBUG(p, IL_DL_QOS, f, ## a) +#define IL_DEBUG_RADIO(p, f, a...) IL_DEBUG(p, IL_DL_RADIO, f, ## a) +#define IL_DEBUG_POWER(p, f, a...) IL_DEBUG(p, IL_DL_POWER, f, ## a) +#define IL_DEBUG_11H(p, f, a...) IL_DEBUG(p, IL_DL_11H, f, ## a) #endif diff --git a/drivers/net/wireless/iwlegacy/iwl-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-debugfs.c index 996996a..057dec5 100644 --- a/drivers/net/wireless/iwlegacy/iwl-debugfs.c +++ b/drivers/net/wireless/iwlegacy/iwl-debugfs.c @@ -37,7 +37,7 @@ /* create and remove of files */ #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ if (!debugfs_create_file(#name, mode, parent, priv, \ - &iwl_legacy_dbgfs_##name##_ops)) \ + &il_dbgfs_##name##_ops)) \ goto err; \ } while (0) @@ -59,18 +59,18 @@ /* file operation */ #define DEBUGFS_READ_FUNC(name) \ -static ssize_t iwl_legacy_dbgfs_##name##_read(struct file *file, \ +static ssize_t il_dbgfs_##name##_read(struct file *file, \ char __user *user_buf, \ size_t count, loff_t *ppos); #define DEBUGFS_WRITE_FUNC(name) \ -static ssize_t iwl_legacy_dbgfs_##name##_write(struct file *file, \ +static ssize_t il_dbgfs_##name##_write(struct file *file, \ const char __user *user_buf, \ size_t count, loff_t *ppos); static int -iwl_legacy_dbgfs_open_file_generic(struct inode *inode, struct file *file) +il_dbgfs_open_file_generic(struct inode *inode, struct file *file) { file->private_data = inode->i_private; return 0; @@ -78,35 +78,35 @@ iwl_legacy_dbgfs_open_file_generic(struct inode *inode, struct file *file) #define DEBUGFS_READ_FILE_OPS(name) \ DEBUGFS_READ_FUNC(name); \ -static const struct file_operations iwl_legacy_dbgfs_##name##_ops = { \ - .read = iwl_legacy_dbgfs_##name##_read, \ - .open = iwl_legacy_dbgfs_open_file_generic, \ +static const struct file_operations il_dbgfs_##name##_ops = { \ + .read = il_dbgfs_##name##_read, \ + .open = il_dbgfs_open_file_generic, \ .llseek = generic_file_llseek, \ }; #define DEBUGFS_WRITE_FILE_OPS(name) \ DEBUGFS_WRITE_FUNC(name); \ -static const struct file_operations iwl_legacy_dbgfs_##name##_ops = { \ - .write = iwl_legacy_dbgfs_##name##_write, \ - .open = iwl_legacy_dbgfs_open_file_generic, \ +static const struct file_operations il_dbgfs_##name##_ops = { \ + .write = il_dbgfs_##name##_write, \ + .open = il_dbgfs_open_file_generic, \ .llseek = generic_file_llseek, \ }; #define DEBUGFS_READ_WRITE_FILE_OPS(name) \ DEBUGFS_READ_FUNC(name); \ DEBUGFS_WRITE_FUNC(name); \ -static const struct file_operations iwl_legacy_dbgfs_##name##_ops = { \ - .write = iwl_legacy_dbgfs_##name##_write, \ - .read = iwl_legacy_dbgfs_##name##_read, \ - .open = iwl_legacy_dbgfs_open_file_generic, \ +static const struct file_operations il_dbgfs_##name##_ops = { \ + .write = il_dbgfs_##name##_write, \ + .read = il_dbgfs_##name##_read, \ + .open = il_dbgfs_open_file_generic, \ .llseek = generic_file_llseek, \ }; -static ssize_t iwl_legacy_dbgfs_tx_statistics_read(struct file *file, +static ssize_t il_dbgfs_tx_statistics_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char *buf; int pos = 0; @@ -121,14 +121,14 @@ static ssize_t iwl_legacy_dbgfs_tx_statistics_read(struct file *file, for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { pos += scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n", - iwl_legacy_get_mgmt_string(cnt), + il_get_mgmt_string(cnt), priv->tx_stats.mgmt[cnt]); } pos += scnprintf(buf + pos, bufsz - pos, "Control\n"); for (cnt = 0; cnt < CONTROL_MAX; cnt++) { pos += scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n", - iwl_legacy_get_ctrl_string(cnt), + il_get_ctrl_string(cnt), priv->tx_stats.ctrl[cnt]); } pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); @@ -142,11 +142,11 @@ static ssize_t iwl_legacy_dbgfs_tx_statistics_read(struct file *file, } static ssize_t -iwl_legacy_dbgfs_clear_traffic_statistics_write(struct file *file, +il_dbgfs_clear_traffic_statistics_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; u32 clear_flag; char buf[8]; int buf_size; @@ -157,16 +157,16 @@ iwl_legacy_dbgfs_clear_traffic_statistics_write(struct file *file, return -EFAULT; if (sscanf(buf, "%x", &clear_flag) != 1) return -EFAULT; - iwl_legacy_clear_traffic_stats(priv); + il_clear_traffic_stats(priv); return count; } -static ssize_t iwl_legacy_dbgfs_rx_statistics_read(struct file *file, +static ssize_t il_dbgfs_rx_statistics_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char *buf; int pos = 0; int cnt; @@ -181,14 +181,14 @@ static ssize_t iwl_legacy_dbgfs_rx_statistics_read(struct file *file, for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { pos += scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n", - iwl_legacy_get_mgmt_string(cnt), + il_get_mgmt_string(cnt), priv->rx_stats.mgmt[cnt]); } pos += scnprintf(buf + pos, bufsz - pos, "Control:\n"); for (cnt = 0; cnt < CONTROL_MAX; cnt++) { pos += scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n", - iwl_legacy_get_ctrl_string(cnt), + il_get_ctrl_string(cnt), priv->rx_stats.ctrl[cnt]); } pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); @@ -205,7 +205,7 @@ static ssize_t iwl_legacy_dbgfs_rx_statistics_read(struct file *file, #define BYTE1_MASK 0x000000ff; #define BYTE2_MASK 0x0000ffff; #define BYTE3_MASK 0x00ffffff; -static ssize_t iwl_legacy_dbgfs_sram_read(struct file *file, +static ssize_t il_dbgfs_sram_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { @@ -214,7 +214,7 @@ static ssize_t iwl_legacy_dbgfs_sram_read(struct file *file, ssize_t ret; int i; int pos = 0; - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; size_t bufsz; /* default is to dump the entire data segment */ @@ -234,7 +234,7 @@ static ssize_t iwl_legacy_dbgfs_sram_read(struct file *file, pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n", priv->dbgfs_sram_offset); for (i = priv->dbgfs_sram_len; i > 0; i -= 4) { - val = iwl_legacy_read_targ_mem(priv, priv->dbgfs_sram_offset + \ + val = il_read_targ_mem(priv, priv->dbgfs_sram_offset + \ priv->dbgfs_sram_len - i); if (i < 4) { switch (i) { @@ -260,11 +260,11 @@ static ssize_t iwl_legacy_dbgfs_sram_read(struct file *file, return ret; } -static ssize_t iwl_legacy_dbgfs_sram_write(struct file *file, +static ssize_t il_dbgfs_sram_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char buf[64]; int buf_size; u32 offset, len; @@ -286,11 +286,11 @@ static ssize_t iwl_legacy_dbgfs_sram_write(struct file *file, } static ssize_t -iwl_legacy_dbgfs_stations_read(struct file *file, char __user *user_buf, +il_dbgfs_stations_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; - struct iwl_station_entry *station; + struct il_priv *priv = file->private_data; + struct il_station_entry *station; int max_sta = priv->hw_params.max_stations; char *buf; int i, j, pos = 0; @@ -343,13 +343,13 @@ iwl_legacy_dbgfs_stations_read(struct file *file, char __user *user_buf, return ret; } -static ssize_t iwl_legacy_dbgfs_nvm_read(struct file *file, +static ssize_t il_dbgfs_nvm_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { ssize_t ret; - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0, ofs = 0, buf_size = 0; const u8 *ptr; char *buf; @@ -358,23 +358,23 @@ static ssize_t iwl_legacy_dbgfs_nvm_read(struct file *file, buf_size = 4 * eeprom_len + 256; if (eeprom_len % 16) { - IWL_ERR(priv, "NVM size is not multiple of 16.\n"); + IL_ERR(priv, "NVM size is not multiple of 16.\n"); return -ENODATA; } ptr = priv->eeprom; if (!ptr) { - IWL_ERR(priv, "Invalid EEPROM memory\n"); + IL_ERR(priv, "Invalid EEPROM memory\n"); return -ENOMEM; } /* 4 characters for byte 0xYY */ buf = kzalloc(buf_size, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate Buffer\n"); + IL_ERR(priv, "Can not allocate Buffer\n"); return -ENOMEM; } - eeprom_ver = iwl_legacy_eeprom_query16(priv, EEPROM_VERSION); + eeprom_ver = il_eeprom_query16(priv, EEPROM_VERSION); pos += scnprintf(buf + pos, buf_size - pos, "EEPROM " "version: 0x%x\n", eeprom_ver); for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { @@ -392,10 +392,10 @@ static ssize_t iwl_legacy_dbgfs_nvm_read(struct file *file, } static ssize_t -iwl_legacy_dbgfs_channels_read(struct file *file, char __user *user_buf, +il_dbgfs_channels_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; struct ieee80211_channel *channels = NULL; const struct ieee80211_supported_band *supp_band = NULL; int pos = 0, i, bufsz = PAGE_SIZE; @@ -407,11 +407,11 @@ iwl_legacy_dbgfs_channels_read(struct file *file, char __user *user_buf, buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate Buffer\n"); + IL_ERR(priv, "Can not allocate Buffer\n"); return -ENOMEM; } - supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); + supp_band = il_get_hw_mode(priv, IEEE80211_BAND_2GHZ); if (supp_band) { channels = supp_band->channels; @@ -434,7 +434,7 @@ iwl_legacy_dbgfs_channels_read(struct file *file, char __user *user_buf, IEEE80211_CHAN_PASSIVE_SCAN ? "passive only" : "active/passive"); } - supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ); + supp_band = il_get_hw_mode(priv, IEEE80211_BAND_5GHZ); if (supp_band) { channels = supp_band->channels; @@ -462,11 +462,11 @@ iwl_legacy_dbgfs_channels_read(struct file *file, char __user *user_buf, return ret; } -static ssize_t iwl_legacy_dbgfs_status_read(struct file *file, +static ssize_t il_dbgfs_status_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char buf[512]; int pos = 0; const size_t bufsz = sizeof(buf); @@ -506,11 +506,11 @@ static ssize_t iwl_legacy_dbgfs_status_read(struct file *file, return simple_read_from_buffer(user_buf, count, ppos, buf, pos); } -static ssize_t iwl_legacy_dbgfs_interrupt_read(struct file *file, +static ssize_t il_dbgfs_interrupt_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0; int cnt = 0; char *buf; @@ -519,7 +519,7 @@ static ssize_t iwl_legacy_dbgfs_interrupt_read(struct file *file, buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate Buffer\n"); + IL_ERR(priv, "Can not allocate Buffer\n"); return -ENOMEM; } @@ -558,7 +558,7 @@ static ssize_t iwl_legacy_dbgfs_interrupt_read(struct file *file, if (priv->isr_stats.rx_handlers[cnt] > 0) pos += scnprintf(buf + pos, bufsz - pos, "\tRx handler[%36s]:\t\t %u\n", - iwl_legacy_get_cmd_string(cnt), + il_get_cmd_string(cnt), priv->isr_stats.rx_handlers[cnt]); } @@ -573,11 +573,11 @@ static ssize_t iwl_legacy_dbgfs_interrupt_read(struct file *file, return ret; } -static ssize_t iwl_legacy_dbgfs_interrupt_write(struct file *file, +static ssize_t il_dbgfs_interrupt_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char buf[8]; int buf_size; u32 reset_flag; @@ -589,19 +589,19 @@ static ssize_t iwl_legacy_dbgfs_interrupt_write(struct file *file, if (sscanf(buf, "%x", &reset_flag) != 1) return -EFAULT; if (reset_flag == 0) - iwl_legacy_clear_isr_stats(priv); + il_clear_isr_stats(priv); return count; } static ssize_t -iwl_legacy_dbgfs_qos_read(struct file *file, char __user *user_buf, +il_dbgfs_qos_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; - struct iwl_rxon_context *ctx; + struct il_priv *priv = file->private_data; + struct il_rxon_context *ctx; int pos = 0, i; - char buf[256 * NUM_IWL_RXON_CTX]; + char buf[256 * NUM_IL_RXON_CTX]; const size_t bufsz = sizeof(buf); for_each_context(priv, ctx) { @@ -622,11 +622,11 @@ iwl_legacy_dbgfs_qos_read(struct file *file, char __user *user_buf, return simple_read_from_buffer(user_buf, count, ppos, buf, pos); } -static ssize_t iwl_legacy_dbgfs_disable_ht40_write(struct file *file, +static ssize_t il_dbgfs_disable_ht40_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char buf[8]; int buf_size; int ht40; @@ -637,10 +637,10 @@ static ssize_t iwl_legacy_dbgfs_disable_ht40_write(struct file *file, return -EFAULT; if (sscanf(buf, "%d", &ht40) != 1) return -EFAULT; - if (!iwl_legacy_is_any_associated(priv)) + if (!il_is_any_associated(priv)) priv->disable_ht40 = ht40 ? true : false; else { - IWL_ERR(priv, "Sta associated with AP - " + IL_ERR(priv, "Sta associated with AP - " "Change to 40MHz channel support is not allowed\n"); return -EINVAL; } @@ -648,11 +648,11 @@ static ssize_t iwl_legacy_dbgfs_disable_ht40_write(struct file *file, return count; } -static ssize_t iwl_legacy_dbgfs_disable_ht40_read(struct file *file, +static ssize_t il_dbgfs_disable_ht40_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char buf[100]; int pos = 0; const size_t bufsz = sizeof(buf); @@ -672,29 +672,29 @@ DEBUGFS_READ_WRITE_FILE_OPS(interrupt); DEBUGFS_READ_FILE_OPS(qos); DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40); -static ssize_t iwl_legacy_dbgfs_traffic_log_read(struct file *file, +static ssize_t il_dbgfs_traffic_log_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0, ofs = 0; int cnt = 0, entry; - struct iwl_tx_queue *txq; - struct iwl_queue *q; - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_tx_queue *txq; + struct il_queue *q; + struct il_rx_queue *rxq = &priv->rxq; char *buf; - int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) + + int bufsz = ((IL_TRAFFIC_ENTRIES * IL_TRAFFIC_ENTRY_SIZE * 64) * 2) + (priv->cfg->base_params->num_of_queues * 32 * 8) + 400; const u8 *ptr; ssize_t ret; if (!priv->txq) { - IWL_ERR(priv, "txq not ready\n"); + IL_ERR(priv, "txq not ready\n"); return -EAGAIN; } buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate buffer\n"); + IL_ERR(priv, "Can not allocate buffer\n"); return -ENOMEM; } 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, "q[%d]: read_ptr: %u, write_ptr: %u\n", cnt, q->read_ptr, q->write_ptr); } - if (priv->tx_traffic && (iwlegacy_debug_level & IWL_DL_TX)) { + if (priv->tx_traffic && (iwlegacy_debug_level & IL_DL_TX)) { ptr = priv->tx_traffic; pos += scnprintf(buf + pos, bufsz - pos, "Tx Traffic idx: %u\n", priv->tx_traffic_idx); - for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { - for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; + for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) { + for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16; entry++, ofs += 16) { pos += scnprintf(buf + pos, bufsz - pos, "0x%.4x ", ofs); @@ -728,12 +728,12 @@ static ssize_t iwl_legacy_dbgfs_traffic_log_read(struct file *file, "read: %u, write: %u\n", rxq->read, rxq->write); - if (priv->rx_traffic && (iwlegacy_debug_level & IWL_DL_RX)) { + if (priv->rx_traffic && (iwlegacy_debug_level & IL_DL_RX)) { ptr = priv->rx_traffic; pos += scnprintf(buf + pos, bufsz - pos, "Rx Traffic idx: %u\n", priv->rx_traffic_idx); - for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { - for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; + for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) { + for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16; entry++, ofs += 16) { pos += scnprintf(buf + pos, bufsz - pos, "0x%.4x ", ofs); @@ -751,11 +751,11 @@ static ssize_t iwl_legacy_dbgfs_traffic_log_read(struct file *file, return ret; } -static ssize_t iwl_legacy_dbgfs_traffic_log_write(struct file *file, +static ssize_t il_dbgfs_traffic_log_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char buf[8]; int buf_size; int traffic_log; @@ -767,18 +767,18 @@ static ssize_t iwl_legacy_dbgfs_traffic_log_write(struct file *file, if (sscanf(buf, "%d", &traffic_log) != 1) return -EFAULT; if (traffic_log == 0) - iwl_legacy_reset_traffic_log(priv); + il_reset_traffic_log(priv); return count; } -static ssize_t iwl_legacy_dbgfs_tx_queue_read(struct file *file, +static ssize_t il_dbgfs_tx_queue_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; - struct iwl_tx_queue *txq; - struct iwl_queue *q; + struct il_priv *priv = file->private_data; + struct il_tx_queue *txq; + struct il_queue *q; char *buf; int pos = 0; int cnt; @@ -787,7 +787,7 @@ static ssize_t iwl_legacy_dbgfs_tx_queue_read(struct file *file, priv->cfg->base_params->num_of_queues; if (!priv->txq) { - IWL_ERR(priv, "txq not ready\n"); + IL_ERR(priv, "txq not ready\n"); return -EAGAIN; } buf = kzalloc(bufsz, GFP_KERNEL); @@ -816,12 +816,12 @@ static ssize_t iwl_legacy_dbgfs_tx_queue_read(struct file *file, return ret; } -static ssize_t iwl_legacy_dbgfs_rx_queue_read(struct file *file, +static ssize_t il_dbgfs_rx_queue_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_priv *priv = file->private_data; + struct il_rx_queue *rxq = &priv->rxq; char buf[256]; int pos = 0; const size_t bufsz = sizeof(buf); @@ -842,49 +842,49 @@ static ssize_t iwl_legacy_dbgfs_rx_queue_read(struct file *file, return simple_read_from_buffer(user_buf, count, ppos, buf, pos); } -static ssize_t iwl_legacy_dbgfs_ucode_rx_stats_read(struct file *file, +static ssize_t il_dbgfs_ucode_rx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file, user_buf, count, ppos); } -static ssize_t iwl_legacy_dbgfs_ucode_tx_stats_read(struct file *file, +static ssize_t il_dbgfs_ucode_tx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file, user_buf, count, ppos); } -static ssize_t iwl_legacy_dbgfs_ucode_general_stats_read(struct file *file, +static ssize_t il_dbgfs_ucode_general_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file, user_buf, count, ppos); } -static ssize_t iwl_legacy_dbgfs_sensitivity_read(struct file *file, +static ssize_t il_dbgfs_sensitivity_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0; int cnt = 0; char *buf; - int bufsz = sizeof(struct iwl_sensitivity_data) * 4 + 100; + int bufsz = sizeof(struct il_sensitivity_data) * 4 + 100; ssize_t ret; - struct iwl_sensitivity_data *data; + struct il_sensitivity_data *data; data = &priv->sensitivity_data; buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate Buffer\n"); + IL_ERR(priv, "Can not allocate Buffer\n"); return -ENOMEM; } @@ -950,22 +950,22 @@ static ssize_t iwl_legacy_dbgfs_sensitivity_read(struct file *file, } -static ssize_t iwl_legacy_dbgfs_chain_noise_read(struct file *file, +static ssize_t il_dbgfs_chain_noise_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0; int cnt = 0; char *buf; - int bufsz = sizeof(struct iwl_chain_noise_data) * 4 + 100; + int bufsz = sizeof(struct il_chain_noise_data) * 4 + 100; ssize_t ret; - struct iwl_chain_noise_data *data; + struct il_chain_noise_data *data; data = &priv->chain_noise_data; buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) { - IWL_ERR(priv, "Can not allocate Buffer\n"); + IL_ERR(priv, "Can not allocate Buffer\n"); return -ENOMEM; } @@ -1008,17 +1008,17 @@ static ssize_t iwl_legacy_dbgfs_chain_noise_read(struct file *file, return ret; } -static ssize_t iwl_legacy_dbgfs_power_save_status_read(struct file *file, +static ssize_t il_dbgfs_power_save_status_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char buf[60]; int pos = 0; const size_t bufsz = sizeof(buf); u32 pwrsave_status; - pwrsave_status = iwl_read32(priv, CSR_GP_CNTRL) & + pwrsave_status = il_read32(priv, CSR_GP_CNTRL) & CSR_GP_REG_POWER_SAVE_STATUS_MSK; 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, return simple_read_from_buffer(user_buf, count, ppos, buf, pos); } -static ssize_t iwl_legacy_dbgfs_clear_ucode_statistics_write(struct file *file, +static ssize_t il_dbgfs_clear_ucode_statistics_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char buf[8]; int buf_size; int clear; @@ -1049,43 +1049,43 @@ static ssize_t iwl_legacy_dbgfs_clear_ucode_statistics_write(struct file *file, /* make request to uCode to retrieve statistics information */ mutex_lock(&priv->mutex); - iwl_legacy_send_statistics_request(priv, CMD_SYNC, true); + il_send_statistics_request(priv, CMD_SYNC, true); mutex_unlock(&priv->mutex); return count; } -static ssize_t iwl_legacy_dbgfs_rxon_flags_read(struct file *file, +static ssize_t il_dbgfs_rxon_flags_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int len = 0; char buf[20]; len = sprintf(buf, "0x%04X\n", - le32_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.flags)); + le32_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.flags)); return simple_read_from_buffer(user_buf, count, ppos, buf, len); } -static ssize_t iwl_legacy_dbgfs_rxon_filter_flags_read(struct file *file, +static ssize_t il_dbgfs_rxon_filter_flags_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int len = 0; char buf[20]; len = sprintf(buf, "0x%04X\n", - le32_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags)); + le32_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.filter_flags)); return simple_read_from_buffer(user_buf, count, ppos, buf, len); } -static ssize_t iwl_legacy_dbgfs_fh_reg_read(struct file *file, +static ssize_t il_dbgfs_fh_reg_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char *buf; int pos = 0; ssize_t ret = -EFAULT; @@ -1102,11 +1102,11 @@ static ssize_t iwl_legacy_dbgfs_fh_reg_read(struct file *file, return ret; } -static ssize_t iwl_legacy_dbgfs_missed_beacon_read(struct file *file, +static ssize_t il_dbgfs_missed_beacon_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0; char buf[12]; const size_t bufsz = sizeof(buf); @@ -1117,11 +1117,11 @@ static ssize_t iwl_legacy_dbgfs_missed_beacon_read(struct file *file, return simple_read_from_buffer(user_buf, count, ppos, buf, pos); } -static ssize_t iwl_legacy_dbgfs_missed_beacon_write(struct file *file, +static ssize_t il_dbgfs_missed_beacon_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char buf[8]; int buf_size; int missed; @@ -1133,25 +1133,25 @@ static ssize_t iwl_legacy_dbgfs_missed_beacon_write(struct file *file, if (sscanf(buf, "%d", &missed) != 1) return -EINVAL; - if (missed < IWL_MISSED_BEACON_THRESHOLD_MIN || - missed > IWL_MISSED_BEACON_THRESHOLD_MAX) + if (missed < IL_MISSED_BEACON_THRESHOLD_MIN || + missed > IL_MISSED_BEACON_THRESHOLD_MAX) priv->missed_beacon_threshold = - IWL_MISSED_BEACON_THRESHOLD_DEF; + IL_MISSED_BEACON_THRESHOLD_DEF; else priv->missed_beacon_threshold = missed; return count; } -static ssize_t iwl_legacy_dbgfs_force_reset_read(struct file *file, +static ssize_t il_dbgfs_force_reset_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; int pos = 0; char buf[300]; const size_t bufsz = sizeof(buf); - struct iwl_force_reset *force_reset; + struct il_force_reset *force_reset; force_reset = &priv->force_reset; @@ -1171,23 +1171,23 @@ static ssize_t iwl_legacy_dbgfs_force_reset_read(struct file *file, return simple_read_from_buffer(user_buf, count, ppos, buf, pos); } -static ssize_t iwl_legacy_dbgfs_force_reset_write(struct file *file, +static ssize_t il_dbgfs_force_reset_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { int ret; - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; - ret = iwl_legacy_force_reset(priv, true); + ret = il_force_reset(priv, true); return ret ? ret : count; } -static ssize_t iwl_legacy_dbgfs_wd_timeout_write(struct file *file, +static ssize_t il_dbgfs_wd_timeout_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_priv *priv = file->private_data; + struct il_priv *priv = file->private_data; char buf[8]; int buf_size; int timeout; @@ -1198,11 +1198,11 @@ static ssize_t iwl_legacy_dbgfs_wd_timeout_write(struct file *file, return -EFAULT; if (sscanf(buf, "%d", &timeout) != 1) return -EINVAL; - if (timeout < 0 || timeout > IWL_MAX_WD_TIMEOUT) - timeout = IWL_DEF_WD_TIMEOUT; + if (timeout < 0 || timeout > IL_MAX_WD_TIMEOUT) + timeout = IL_DEF_WD_TIMEOUT; priv->cfg->base_params->wd_timeout = timeout; - iwl_legacy_setup_watchdog(priv); + il_setup_watchdog(priv); return count; } @@ -1230,7 +1230,7 @@ DEBUGFS_WRITE_FILE_OPS(wd_timeout); * Create the debugfs files and directories * */ -int iwl_legacy_dbgfs_register(struct iwl_priv *priv, const char *name) +int il_dbgfs_register(struct il_priv *priv, const char *name) { struct dentry *phyd = priv->hw->wiphy->debugfsdir; 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) return 0; err: - IWL_ERR(priv, "Can't create the debugfs directory\n"); - iwl_legacy_dbgfs_unregister(priv); + IL_ERR(priv, "Can't create the debugfs directory\n"); + il_dbgfs_unregister(priv); return -ENOMEM; } -EXPORT_SYMBOL(iwl_legacy_dbgfs_register); +EXPORT_SYMBOL(il_dbgfs_register); /** * Remove the debugfs files and directories * */ -void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv) +void il_dbgfs_unregister(struct il_priv *priv) { if (!priv->debugfs_dir) return; @@ -1310,4 +1310,4 @@ void iwl_legacy_dbgfs_unregister(struct iwl_priv *priv) debugfs_remove_recursive(priv->debugfs_dir); priv->debugfs_dir = NULL; } -EXPORT_SYMBOL(iwl_legacy_dbgfs_unregister); +EXPORT_SYMBOL(il_dbgfs_unregister); diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h index 9c786ed..20c44f3 100644 --- a/drivers/net/wireless/iwlegacy/iwl-dev.h +++ b/drivers/net/wireless/iwlegacy/iwl-dev.h @@ -29,8 +29,8 @@ * Please use iwl-4965-hw.h for hardware-related definitions. */ -#ifndef __iwl_legacy_dev_h__ -#define __iwl_legacy_dev_h__ +#ifndef __il_dev_h__ +#define __il_dev_h__ #include #include /* for struct pci_device_id */ @@ -50,7 +50,7 @@ #include "iwl-power.h" #include "iwl-legacy-rs.h" -struct iwl_tx_queue; +struct il_tx_queue; /* CT-KILL constants */ #define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */ @@ -66,7 +66,7 @@ struct iwl_tx_queue; * noise info (e.g. averaging might be done in app); measured dBm values are * always negative ... using a negative value as the default keeps all * averages within an s8's (used in some apps) range of negative values. */ -#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) +#define IL_NOISE_MEAS_NOT_AVAILABLE (-127) /* * RTS threshold here is total size [2347] minus 4 FCS bytes @@ -85,7 +85,7 @@ struct iwl_tx_queue; #define DEFAULT_SHORT_RETRY_LIMIT 7U #define DEFAULT_LONG_RETRY_LIMIT 4U -struct iwl_rx_mem_buffer { +struct il_rx_mem_buffer { dma_addr_t page_dma; struct page *page; struct list_head list; @@ -94,11 +94,11 @@ struct iwl_rx_mem_buffer { #define rxb_addr(r) page_address(r->page) /* defined below */ -struct iwl_device_cmd; +struct il_device_cmd; -struct iwl_cmd_meta { +struct il_cmd_meta { /* only for SYNC commands, iff the reply skb is wanted */ - struct iwl_host_cmd *source; + struct il_host_cmd *source; /* * only for ASYNC commands * (which is somewhat stupid -- look at iwl-sta.c for instance @@ -106,9 +106,9 @@ struct iwl_cmd_meta { * invoked for SYNC commands, if it were and its result passed * through it would be simpler...) */ - void (*callback)(struct iwl_priv *priv, - struct iwl_device_cmd *cmd, - struct iwl_rx_packet *pkt); + void (*callback)(struct il_priv *priv, + struct il_device_cmd *cmd, + struct il_rx_packet *pkt); /* The CMD_SIZE_HUGE flag bit indicates that the command * structure is stored at the end of the shared queue memory. */ @@ -123,7 +123,7 @@ struct iwl_cmd_meta { * * Contains common data for Rx and Tx queues */ -struct iwl_queue { +struct il_queue { int n_bd; /* number of BDs in this queue */ int write_ptr; /* 1-st empty entry (index) host_w*/ int read_ptr; /* last used entry (index) host_r*/ @@ -138,13 +138,13 @@ struct iwl_queue { }; /* One for each TFD */ -struct iwl_tx_info { +struct il_tx_info { struct sk_buff *skb; - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; }; /** - * struct iwl_tx_queue - Tx Queue for DMA + * struct il_tx_queue - Tx Queue for DMA * @q: generic Rx/Tx queue descriptor * @bd: base of circular buffer of TFDs * @cmd: array of command/TX buffer pointers @@ -161,12 +161,12 @@ struct iwl_tx_info { #define TFD_TX_CMD_SLOTS 256 #define TFD_CMD_SLOTS 32 -struct iwl_tx_queue { - struct iwl_queue q; +struct il_tx_queue { + struct il_queue q; void *tfds; - struct iwl_device_cmd **cmd; - struct iwl_cmd_meta *meta; - struct iwl_tx_info *txb; + struct il_device_cmd **cmd; + struct il_cmd_meta *meta; + struct il_tx_info *txb; unsigned long time_stamp; u8 need_update; u8 sched_retry; @@ -174,23 +174,23 @@ struct iwl_tx_queue { u8 swq_id; }; -#define IWL_NUM_SCAN_RATES (2) +#define IL_NUM_SCAN_RATES (2) -struct iwl4965_channel_tgd_info { +struct il4965_channel_tgd_info { u8 type; s8 max_power; }; -struct iwl4965_channel_tgh_info { +struct il4965_channel_tgh_info { s64 last_radar_time; }; #define IWL4965_MAX_RATE (33) -struct iwl3945_clip_group { +struct il3945_clip_group { /* maximum power level to prevent clipping for each rate, derived by * us from this band's saturation power in EEPROM */ - const s8 clip_powers[IWL_MAX_RATES]; + const s8 clip_powers[IL_MAX_RATES]; }; /* current Tx power values to use, one for each rate for each channel. @@ -200,8 +200,8 @@ struct iwl3945_clip_group { * -- spectrum management * -- user preference (e.g. iwconfig) * when requested power is set, base power index must also be set. */ -struct iwl3945_channel_power_info { - struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */ +struct il3945_channel_power_info { + struct il3945_tx_power tpc; /* actual radio and DSP gain settings */ s8 power_table_index; /* actual (compenst'd) index into gain table */ s8 base_power_index; /* gain index for power at factory temp. */ s8 requested_power; /* power (dBm) requested for this chnl/rate */ @@ -209,8 +209,8 @@ struct iwl3945_channel_power_info { /* current scan Tx power values to use, one for each scan rate for each * channel. */ -struct iwl3945_scan_power_info { - struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */ +struct il3945_scan_power_info { + struct il3945_tx_power tpc; /* actual radio and DSP gain settings */ s8 power_table_index; /* actual (compenst'd) index into gain table */ s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ }; @@ -220,11 +220,11 @@ struct iwl3945_scan_power_info { * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant * with one another! */ -struct iwl_channel_info { - struct iwl4965_channel_tgd_info tgd; - struct iwl4965_channel_tgh_info tgh; - struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ - struct iwl_eeprom_channel ht40_eeprom; /* EEPROM regulatory limit for +struct il_channel_info { + struct il4965_channel_tgd_info tgd; + struct il4965_channel_tgh_info tgh; + struct il_eeprom_channel eeprom; /* EEPROM regulatory limit */ + struct il_eeprom_channel ht40_eeprom; /* EEPROM regulatory limit for * HT40 channel */ u8 channel; /* channel number */ @@ -246,34 +246,34 @@ struct iwl_channel_info { /* Radio/DSP gain settings for each "normal" data Tx rate. * These include, in addition to RF and DSP gain, a few fields for * remembering/modifying gain settings (indexes). */ - struct iwl3945_channel_power_info power_info[IWL4965_MAX_RATE]; + struct il3945_channel_power_info power_info[IWL4965_MAX_RATE]; /* Radio/DSP gain settings for each scan rate, for directed scans. */ - struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; + struct il3945_scan_power_info scan_pwr_info[IL_NUM_SCAN_RATES]; }; -#define IWL_TX_FIFO_BK 0 /* shared */ -#define IWL_TX_FIFO_BE 1 -#define IWL_TX_FIFO_VI 2 /* shared */ -#define IWL_TX_FIFO_VO 3 -#define IWL_TX_FIFO_UNUSED -1 +#define IL_TX_FIFO_BK 0 /* shared */ +#define IL_TX_FIFO_BE 1 +#define IL_TX_FIFO_VI 2 /* shared */ +#define IL_TX_FIFO_VO 3 +#define IL_TX_FIFO_UNUSED -1 /* Minimum number of queues. MAX_NUM is defined in hw specific files. * Set the minimum to accommodate the 4 standard TX queues, 1 command * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */ -#define IWL_MIN_NUM_QUEUES 10 +#define IL_MIN_NUM_QUEUES 10 -#define IWL_DEFAULT_CMD_QUEUE_NUM 4 +#define IL_DEFAULT_CMD_QUEUE_NUM 4 #define IEEE80211_DATA_LEN 2304 #define IEEE80211_4ADDR_LEN 30 #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) -struct iwl_frame { +struct il_frame { union { struct ieee80211_hdr frame; - struct iwl_tx_beacon_cmd beacon; + struct il_tx_beacon_cmd beacon; u8 raw[IEEE80211_FRAME_LEN]; u8 cmd[360]; } u; @@ -297,33 +297,33 @@ enum { #define DEF_CMD_PAYLOAD_SIZE 320 /** - * struct iwl_device_cmd + * struct il_device_cmd * * For allocation of the command and tx queues, this establishes the overall * size of the largest command we send to uCode, except for a scan command * (which is relatively huge; space is allocated separately). */ -struct iwl_device_cmd { - struct iwl_cmd_header hdr; /* uCode API */ +struct il_device_cmd { + struct il_cmd_header hdr; /* uCode API */ union { u32 flags; u8 val8; u16 val16; u32 val32; - struct iwl_tx_cmd tx; + struct il_tx_cmd tx; u8 payload[DEF_CMD_PAYLOAD_SIZE]; } __packed cmd; } __packed; -#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd)) +#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct il_device_cmd)) -struct iwl_host_cmd { +struct il_host_cmd { const void *data; unsigned long reply_page; - void (*callback)(struct iwl_priv *priv, - struct iwl_device_cmd *cmd, - struct iwl_rx_packet *pkt); + void (*callback)(struct il_priv *priv, + struct il_device_cmd *cmd, + struct il_rx_packet *pkt); u32 flags; u16 len; u8 id; @@ -334,7 +334,7 @@ struct iwl_host_cmd { #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 /** - * struct iwl_rx_queue - Rx queue + * struct il_rx_queue - Rx queue * @bd: driver's pointer to buffer of receive buffer descriptors (rbd) * @bd_dma: bus address of buffer of receive buffer descriptors (rbd) * @read: Shared index to newest available Rx buffer @@ -346,13 +346,13 @@ struct iwl_host_cmd { * @rb_stts: driver's pointer to receive buffer status * @rb_stts_dma: bus address of receive buffer status * - * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers + * NOTE: rx_free and rx_used are used as a FIFO for il_rx_mem_buffers */ -struct iwl_rx_queue { +struct il_rx_queue { __le32 *bd; dma_addr_t bd_dma; - struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; - struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; + struct il_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; + struct il_rx_mem_buffer *queue[RX_QUEUE_SIZE]; u32 read; u32 write; u32 free_count; @@ -360,20 +360,20 @@ struct iwl_rx_queue { struct list_head rx_free; struct list_head rx_used; int need_update; - struct iwl_rb_status *rb_stts; + struct il_rb_status *rb_stts; dma_addr_t rb_stts_dma; spinlock_t lock; }; -#define IWL_SUPPORTED_RATES_IE_LEN 8 +#define IL_SUPPORTED_RATES_IE_LEN 8 #define MAX_TID_COUNT 9 -#define IWL_INVALID_RATE 0xFF -#define IWL_INVALID_VALUE -1 +#define IL_INVALID_RATE 0xFF +#define IL_INVALID_VALUE -1 /** - * struct iwl_ht_agg -- aggregation status while waiting for block-ack + * struct il_ht_agg -- aggregation status while waiting for block-ack * @txq_id: Tx queue used for Tx attempt * @frame_count: # frames attempted by Tx command * @wait_for_ba: Expect block-ack before next Tx reply @@ -386,35 +386,35 @@ struct iwl_rx_queue { * for block ack (REPLY_COMPRESSED_BA). This struct stores tx reply info * until block ack arrives. */ -struct iwl_ht_agg { +struct il_ht_agg { u16 txq_id; u16 frame_count; u16 wait_for_ba; u16 start_idx; u64 bitmap; u32 rate_n_flags; -#define IWL_AGG_OFF 0 -#define IWL_AGG_ON 1 -#define IWL_EMPTYING_HW_QUEUE_ADDBA 2 -#define IWL_EMPTYING_HW_QUEUE_DELBA 3 +#define IL_AGG_OFF 0 +#define IL_AGG_ON 1 +#define IL_EMPTYING_HW_QUEUE_ADDBA 2 +#define IL_EMPTYING_HW_QUEUE_DELBA 3 u8 state; }; -struct iwl_tid_data { +struct il_tid_data { u16 seq_number; /* 4965 only */ u16 tfds_in_queue; - struct iwl_ht_agg agg; + struct il_ht_agg agg; }; -struct iwl_hw_key { +struct il_hw_key { u32 cipher; int keylen; u8 keyidx; u8 key[32]; }; -union iwl_ht_rate_supp { +union il_ht_rate_supp { u16 rates; struct { u8 siso_rate; @@ -445,38 +445,38 @@ union iwl_ht_rate_supp { #define CFG_HT_MPDU_DENSITY_MAX CFG_HT_MPDU_DENSITY_16USEC #define CFG_HT_MPDU_DENSITY_MIN (0x1) -struct iwl_ht_config { +struct il_ht_config { bool single_chain_sufficient; enum ieee80211_smps_mode smps; /* current smps mode */ }; /* QoS structures */ -struct iwl_qos_info { +struct il_qos_info { int qos_active; - struct iwl_qosparam_cmd def_qos_parm; + struct il_qosparam_cmd def_qos_parm; }; /* * Structure should be accessed with sta_lock held. When station addition - * is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only - * the commands (iwl_legacy_addsta_cmd and iwl_link_quality_cmd) without + * is in progress (IL_STA_UCODE_INPROGRESS) it is possible to access only + * the commands (il_addsta_cmd and il_link_quality_cmd) without * sta_lock held. */ -struct iwl_station_entry { - struct iwl_legacy_addsta_cmd sta; - struct iwl_tid_data tid[MAX_TID_COUNT]; +struct il_station_entry { + struct il_addsta_cmd sta; + struct il_tid_data tid[MAX_TID_COUNT]; u8 used, ctxid; - struct iwl_hw_key keyinfo; - struct iwl_link_quality_cmd *lq; + struct il_hw_key keyinfo; + struct il_link_quality_cmd *lq; }; -struct iwl_station_priv_common { - struct iwl_rxon_context *ctx; +struct il_station_priv_common { + struct il_rxon_context *ctx; u8 sta_id; }; /* - * iwl_station_priv: Driver's private station information + * il_station_priv: Driver's private station information * * When mac80211 creates a station it reserves some space (hw->sta_data_size) * in the structure for use by driver. This structure is places in that @@ -485,22 +485,22 @@ struct iwl_station_priv_common { * The common struct MUST be first because it is shared between * 3945 and 4965! */ -struct iwl_station_priv { - struct iwl_station_priv_common common; - struct iwl_lq_sta lq_sta; +struct il_station_priv { + struct il_station_priv_common common; + struct il_lq_sta lq_sta; atomic_t pending_frames; bool client; bool asleep; }; /** - * struct iwl_vif_priv - driver's private per-interface information + * struct il_vif_priv - driver's private per-interface information * * When mac80211 allocates a virtual interface, it can allocate * space for us to put data into. */ -struct iwl_vif_priv { - struct iwl_rxon_context *ctx; +struct il_vif_priv { + struct il_rxon_context *ctx; u8 ibss_bssid_sta_id; }; @@ -512,7 +512,7 @@ struct fw_desc { }; /* uCode file layout */ -struct iwl_ucode_header { +struct il_ucode_header { __le32 ver; /* major/minor/API/serial */ struct { __le32 inst_size; /* bytes of runtime code */ @@ -524,7 +524,7 @@ struct iwl_ucode_header { } v1; }; -struct iwl4965_ibss_seq { +struct il4965_ibss_seq { u8 mac[ETH_ALEN]; u16 seq_num; u16 frag_num; @@ -532,7 +532,7 @@ struct iwl4965_ibss_seq { struct list_head list; }; -struct iwl_sensitivity_ranges { +struct il_sensitivity_ranges { u16 min_nrg_cck; u16 max_nrg_cck; @@ -565,7 +565,7 @@ struct iwl_sensitivity_ranges { /** - * struct iwl_hw_params + * struct il_hw_params * @max_txq_num: Max # Tx queues supported * @dma_chnl_num: Number of Tx DMA/FIFO channels * @scd_bc_tbls_size: size of scheduler byte count tables @@ -583,9 +583,9 @@ struct iwl_sensitivity_ranges { * @max_xxx_size: for ucode uses * @ct_kill_threshold: temperature threshold * @beacon_time_tsf_bits: number of valid tsf bits for beacon time - * @struct iwl_sensitivity_ranges: range of sensitivity values + * @struct il_sensitivity_ranges: range of sensitivity values */ -struct iwl_hw_params { +struct il_hw_params { u8 max_txq_num; u8 dma_chnl_num; u16 scd_bc_tbls_size; @@ -606,7 +606,7 @@ struct iwl_hw_params { u32 max_bsm_size; u32 ct_kill_threshold; /* value in hw-dependent units */ u16 beacon_time_tsf_bits; - const struct iwl_sensitivity_ranges *sens; + const struct il_sensitivity_ranges *sens; }; @@ -619,16 +619,16 @@ struct iwl_hw_params { * which is why they are in the core module files. * * Naming convention -- - * iwl_ <-- Is part of iwlwifi + * il_ <-- Is part of iwlwifi * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) - * iwl4965_bg_ <-- Called from work queue context - * iwl4965_mac_ <-- mac80211 callback + * il4965_bg_ <-- Called from work queue context + * il4965_mac_ <-- mac80211 callback * ****************************************************************************/ -extern void iwl4965_update_chain_flags(struct iwl_priv *priv); +extern void il4965_update_chain_flags(struct il_priv *priv); extern const u8 iwlegacy_bcast_addr[ETH_ALEN]; -extern int iwl_legacy_queue_space(const struct iwl_queue *q); -static inline int iwl_legacy_queue_used(const struct iwl_queue *q, int i) +extern int il_queue_space(const struct il_queue *q); +static inline int il_queue_used(const struct il_queue *q, int i) { return q->write_ptr >= q->read_ptr ? (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) } -static inline u8 iwl_legacy_get_cmd_index(struct iwl_queue *q, u32 index, +static inline u8 il_get_cmd_index(struct il_queue *q, u32 index, int is_huge) { /* @@ -652,26 +652,26 @@ static inline u8 iwl_legacy_get_cmd_index(struct iwl_queue *q, u32 index, } -struct iwl_dma_ptr { +struct il_dma_ptr { dma_addr_t dma; void *addr; size_t size; }; -#define IWL_OPERATION_MODE_AUTO 0 -#define IWL_OPERATION_MODE_HT_ONLY 1 -#define IWL_OPERATION_MODE_MIXED 2 -#define IWL_OPERATION_MODE_20MHZ 3 +#define IL_OPERATION_MODE_AUTO 0 +#define IL_OPERATION_MODE_HT_ONLY 1 +#define IL_OPERATION_MODE_MIXED 2 +#define IL_OPERATION_MODE_20MHZ 3 -#define IWL_TX_CRC_SIZE 4 -#define IWL_TX_DELIMITER_SIZE 4 +#define IL_TX_CRC_SIZE 4 +#define IL_TX_DELIMITER_SIZE 4 -#define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000 +#define TX_POWER_IL_ILLEGAL_VOLTAGE -10000 /* Sensitivity and chain noise calibration */ #define INITIALIZATION_VALUE 0xFFFF #define IWL4965_CAL_NUM_BEACONS 20 -#define IWL_CAL_NUM_BEACONS 16 +#define IL_CAL_NUM_BEACONS 16 #define MAXIMUM_ALLOWED_PATHLOSS 15 #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3 @@ -704,35 +704,35 @@ struct iwl_dma_ptr { #define NRG_NUM_PREV_STAT_L 20 #define NUM_RX_CHAINS 3 -enum iwl4965_false_alarm_state { - IWL_FA_TOO_MANY = 0, - IWL_FA_TOO_FEW = 1, - IWL_FA_GOOD_RANGE = 2, +enum il4965_false_alarm_state { + IL_FA_TOO_MANY = 0, + IL_FA_TOO_FEW = 1, + IL_FA_GOOD_RANGE = 2, }; -enum iwl4965_chain_noise_state { - IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ - IWL_CHAIN_NOISE_ACCUMULATE, - IWL_CHAIN_NOISE_CALIBRATED, - IWL_CHAIN_NOISE_DONE, +enum il4965_chain_noise_state { + IL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ + IL_CHAIN_NOISE_ACCUMULATE, + IL_CHAIN_NOISE_CALIBRATED, + IL_CHAIN_NOISE_DONE, }; -enum iwl4965_calib_enabled_state { - IWL_CALIB_DISABLED = 0, /* must be 0 */ - IWL_CALIB_ENABLED = 1, +enum il4965_calib_enabled_state { + IL_CALIB_DISABLED = 0, /* must be 0 */ + IL_CALIB_ENABLED = 1, }; /* - * enum iwl_calib + * enum il_calib * defines the order in which results of initial calibrations * should be sent to the runtime uCode */ -enum iwl_calib { - IWL_CALIB_MAX, +enum il_calib { + IL_CALIB_MAX, }; /* Opaque calibration results */ -struct iwl_calib_result { +struct il_calib_result { void *buf; size_t buf_len; }; @@ -744,7 +744,7 @@ enum ucode_type { }; /* Sensitivity calib data */ -struct iwl_sensitivity_data { +struct il_sensitivity_data { u32 auto_corr_ofdm; u32 auto_corr_ofdm_mrc; u32 auto_corr_ofdm_x1; @@ -775,7 +775,7 @@ struct iwl_sensitivity_data { }; /* Chain noise (differential Rx gain) calib data */ -struct iwl_chain_noise_data { +struct il_chain_noise_data { u32 active_chains; u32 chain_noise_a; u32 chain_noise_b; @@ -793,8 +793,8 @@ struct iwl_chain_noise_data { #define EEPROM_SEM_TIMEOUT 10 /* milliseconds */ #define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ -#define IWL_TRAFFIC_ENTRIES (256) -#define IWL_TRAFFIC_ENTRY_SIZE (64) +#define IL_TRAFFIC_ENTRIES (256) +#define IL_TRAFFIC_ENTRY_SIZE (64) enum { MEASUREMENT_READY = (1 << 0), @@ -818,7 +818,7 @@ struct isr_statistics { }; /* management statistics */ -enum iwl_mgmt_stats { +enum il_mgmt_stats { MANAGEMENT_ASSOC_REQ = 0, MANAGEMENT_ASSOC_RESP, MANAGEMENT_REASSOC_REQ, @@ -834,7 +834,7 @@ enum iwl_mgmt_stats { MANAGEMENT_MAX, }; /* control statistics */ -enum iwl_ctrl_stats { +enum il_ctrl_stats { CONTROL_BACK_REQ = 0, CONTROL_BACK, CONTROL_PSPOLL, @@ -863,21 +863,21 @@ struct traffic_stats { * default interrupt coalescing timer is 64 x 32 = 2048 usecs * default interrupt coalescing calibration timer is 16 x 32 = 512 usecs */ -#define IWL_HOST_INT_TIMEOUT_MAX (0xFF) -#define IWL_HOST_INT_TIMEOUT_DEF (0x40) -#define IWL_HOST_INT_TIMEOUT_MIN (0x0) -#define IWL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF) -#define IWL_HOST_INT_CALIB_TIMEOUT_DEF (0x10) -#define IWL_HOST_INT_CALIB_TIMEOUT_MIN (0x0) +#define IL_HOST_INT_TIMEOUT_MAX (0xFF) +#define IL_HOST_INT_TIMEOUT_DEF (0x40) +#define IL_HOST_INT_TIMEOUT_MIN (0x0) +#define IL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF) +#define IL_HOST_INT_CALIB_TIMEOUT_DEF (0x10) +#define IL_HOST_INT_CALIB_TIMEOUT_MIN (0x0) -#define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) +#define IL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) /* TX queue watchdog timeouts in mSecs */ -#define IWL_DEF_WD_TIMEOUT (2000) -#define IWL_LONG_WD_TIMEOUT (10000) -#define IWL_MAX_WD_TIMEOUT (120000) +#define IL_DEF_WD_TIMEOUT (2000) +#define IL_LONG_WD_TIMEOUT (10000) +#define IL_MAX_WD_TIMEOUT (120000) -struct iwl_force_reset { +struct il_force_reset { int reset_request_count; int reset_success_count; int reset_reject_count; @@ -899,13 +899,13 @@ struct iwl_force_reset { */ #define IWL4965_EXT_BEACON_TIME_POS 22 -enum iwl_rxon_context_id { - IWL_RXON_CTX_BSS, +enum il_rxon_context_id { + IL_RXON_CTX_BSS, - NUM_IWL_RXON_CTX + NUM_IL_RXON_CTX }; -struct iwl_rxon_context { +struct il_rxon_context { struct ieee80211_vif *vif; const u8 *ac_to_fifo; @@ -921,7 +921,7 @@ struct iwl_rxon_context { bool ht_need_multiple_chains; - enum iwl_rxon_context_id ctxid; + enum il_rxon_context_id ctxid; u32 interface_modes, exclusive_interface_modes; u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype; @@ -932,12 +932,12 @@ struct iwl_rxon_context { * routines that actually update the physical * hardware. */ - const struct iwl_legacy_rxon_cmd active; - struct iwl_legacy_rxon_cmd staging; + const struct il_rxon_cmd active; + struct il_rxon_cmd staging; - struct iwl_rxon_time_cmd timing; + struct il_rxon_time_cmd timing; - struct iwl_qos_info qos_data; + struct il_qos_info qos_data; u8 bcast_sta_id, ap_sta_id; @@ -945,7 +945,7 @@ struct iwl_rxon_context { u8 qos_cmd; u8 wep_key_cmd; - struct iwl_wep_key wep_keys[WEP_KEYS_MAX]; + struct il_wep_key wep_keys[WEP_KEYS_MAX]; u8 key_mapping_keys; __le32 station_flags; @@ -958,13 +958,13 @@ struct iwl_rxon_context { } ht; }; -struct iwl_priv { +struct il_priv { /* ieee device used by generic ieee processing code */ struct ieee80211_hw *hw; struct ieee80211_channel *ieee_channels; struct ieee80211_rate *ieee_rates; - struct iwl_cfg *cfg; + struct il_cfg *cfg; /* temporary frame storage list */ struct list_head free_frames; @@ -973,13 +973,13 @@ struct iwl_priv { enum ieee80211_band band; int alloc_rxb_page; - void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); + void (*rx_handlers[REPLY_MAX])(struct il_priv *priv, + struct il_rx_mem_buffer *rxb); struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; /* spectrum measurement report caching */ - struct iwl_spectrum_notification measure_report; + struct il_spectrum_notification measure_report; u8 measurement_status; /* ucode beacon time */ @@ -990,11 +990,11 @@ struct iwl_priv { u32 ibss_manager; /* force reset */ - struct iwl_force_reset force_reset; + struct il_force_reset force_reset; - /* we allocate array of iwl_channel_info for NIC's valid channels. + /* we allocate array of il_channel_info for NIC's valid channels. * Access via channel # using indirect index array */ - struct iwl_channel_info *channel_info; /* channel info array */ + struct il_channel_info *channel_info; /* channel info array */ u8 channel_count; /* # of channels */ /* thermal calibration */ @@ -1002,7 +1002,7 @@ struct iwl_priv { s32 last_temperature; /* init calibration results */ - struct iwl_calib_result calib_results[IWL_CALIB_MAX]; + struct il_calib_result calib_results[IL_CALIB_MAX]; /* Scan related variables */ unsigned long scan_start; @@ -1044,7 +1044,7 @@ struct iwl_priv { /* uCode images, save to reload in case of failure */ int fw_index; /* firmware we're trying to load */ u32 ucode_ver; /* version of ucode, copy of - iwl_ucode.ver */ + il_ucode.ver */ struct fw_desc ucode_code; /* runtime inst */ struct fw_desc ucode_data; /* runtime data original */ struct fw_desc ucode_data_backup; /* runtime data save/restore */ @@ -1055,23 +1055,23 @@ struct iwl_priv { u8 ucode_write_complete; /* the image write is complete */ char firmware_name[25]; - struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; + struct il_rxon_context contexts[NUM_IL_RXON_CTX]; __le16 switch_channel; /* 1st responses from initialize and runtime uCode images. * _4965's initialize alive response contains some calibration data. */ - struct iwl_init_alive_resp card_alive_init; - struct iwl_alive_resp card_alive; + struct il_init_alive_resp card_alive_init; + struct il_alive_resp card_alive; u16 active_rate; u8 start_calib; - struct iwl_sensitivity_data sensitivity_data; - struct iwl_chain_noise_data chain_noise_data; + struct il_sensitivity_data sensitivity_data; + struct il_chain_noise_data chain_noise_data; __le16 sensitivity_tbl[HD_TABLE_SIZE]; - struct iwl_ht_config current_ht_config; + struct il_ht_config current_ht_config; /* Rate scaling data */ u8 retry_rate; @@ -1081,11 +1081,11 @@ struct iwl_priv { int activity_timer_active; /* Rx and Tx DMA processing queues */ - struct iwl_rx_queue rxq; - struct iwl_tx_queue *txq; + struct il_rx_queue rxq; + struct il_tx_queue *txq; unsigned long txq_ctx_active_msk; - struct iwl_dma_ptr kw; /* keep warm address */ - struct iwl_dma_ptr scd_bc_tbls; + struct il_dma_ptr kw; /* keep warm address */ + struct il_dma_ptr scd_bc_tbls; u32 scd_base_addr; /* scheduler sram base address */ @@ -1098,7 +1098,7 @@ struct iwl_priv { /* counts interrupts */ struct isr_statistics isr_stats; - struct iwl_power_mgr power_data; + struct il_power_mgr power_data; /* context information */ u8 bssid[ETH_ALEN]; /* used only on 3945 but filled by core */ @@ -1108,12 +1108,12 @@ struct iwl_priv { /* Note: if lock and sta_lock are needed, lock must be acquired first */ spinlock_t sta_lock; int num_stations; - struct iwl_station_entry stations[IWL_STATION_COUNT]; + struct il_station_entry stations[IL_STATION_COUNT]; unsigned long ucode_key_table; /* queue refcounts */ -#define IWL_MAX_HW_QUEUES 32 - unsigned long queue_stopped[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)]; +#define IL_MAX_HW_QUEUES 32 + unsigned long queue_stopped[BITS_TO_LONGS(IL_MAX_HW_QUEUES)]; /* for each AC */ atomic_t queue_stop_count[4]; @@ -1124,7 +1124,7 @@ struct iwl_priv { /* eeprom -- this is in the card's little endian byte order */ u8 *eeprom; - struct iwl_eeprom_calib_info *calib_info; + struct il_eeprom_calib_info *calib_info; enum nl80211_iftype iw_mode; @@ -1140,11 +1140,11 @@ struct iwl_priv { struct delayed_work thermal_periodic; struct delayed_work rfkill_poll; - struct iwl3945_notif_statistics statistics; + struct il3945_notif_statistics statistics; #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS - struct iwl3945_notif_statistics accum_statistics; - struct iwl3945_notif_statistics delta_statistics; - struct iwl3945_notif_statistics max_delta; + struct il3945_notif_statistics accum_statistics; + struct il3945_notif_statistics delta_statistics; + struct il3945_notif_statistics max_delta; #endif u32 sta_supp_rates; @@ -1159,13 +1159,13 @@ struct iwl_priv { * EEPROM has a derived clip setting for * each rate. */ - const struct iwl3945_clip_group clip_groups[5]; + const struct il3945_clip_group clip_groups[5]; } _3945; #endif #if defined(CONFIG_IWL4965) || defined(CONFIG_IWL4965_MODULE) struct { - struct iwl_rx_phy_res last_phy_res; + struct il_rx_phy_res last_phy_res; bool last_phy_res_valid; struct completion firmware_loading_complete; @@ -1178,18 +1178,18 @@ struct iwl_priv { u8 phy_calib_chain_noise_reset_cmd; u8 phy_calib_chain_noise_gain_cmd; - struct iwl_notif_statistics statistics; + struct il_notif_statistics statistics; #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS - struct iwl_notif_statistics accum_statistics; - struct iwl_notif_statistics delta_statistics; - struct iwl_notif_statistics max_delta; + struct il_notif_statistics accum_statistics; + struct il_notif_statistics delta_statistics; + struct il_notif_statistics max_delta; #endif } _4965; #endif }; - struct iwl_hw_params hw_params; + struct il_hw_params hw_params; u32 inta_mask; @@ -1200,7 +1200,7 @@ struct iwl_priv { struct work_struct rx_replenish; struct work_struct abort_scan; - struct iwl_rxon_context *beacon_ctx; + struct il_rxon_context *beacon_ctx; struct sk_buff *beacon_skb; struct work_struct tx_flush; @@ -1245,27 +1245,27 @@ struct iwl_priv { struct led_classdev led; unsigned long blink_on, blink_off; bool led_registered; -}; /*iwl_priv */ +}; /*il_priv */ -static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id) +static inline void il_txq_ctx_activate(struct il_priv *priv, int txq_id) { set_bit(txq_id, &priv->txq_ctx_active_msk); } -static inline void iwl_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id) +static inline void il_txq_ctx_deactivate(struct il_priv *priv, int txq_id) { clear_bit(txq_id, &priv->txq_ctx_active_msk); } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG /* - * iwl_legacy_get_debug_level: Return active debug level for device + * il_get_debug_level: Return active debug level for device * * Using sysfs it is possible to set per device debug level. This debug * level will be used if set, otherwise the global debug level which can be * set via module parameter is used. */ -static inline u32 iwl_legacy_get_debug_level(struct iwl_priv *priv) +static inline u32 il_get_debug_level(struct il_priv *priv) { if (priv->debug_level) return priv->debug_level; @@ -1273,7 +1273,7 @@ static inline u32 iwl_legacy_get_debug_level(struct iwl_priv *priv) return iwlegacy_debug_level; } #else -static inline u32 iwl_legacy_get_debug_level(struct iwl_priv *priv) +static inline u32 il_get_debug_level(struct il_priv *priv) { return iwlegacy_debug_level; } @@ -1281,7 +1281,7 @@ static inline u32 iwl_legacy_get_debug_level(struct iwl_priv *priv) static inline struct ieee80211_hdr * -iwl_legacy_tx_queue_get_hdr(struct iwl_priv *priv, +il_tx_queue_get_hdr(struct il_priv *priv, int txq_id, int idx) { if (priv->txq[txq_id].txb[idx].skb) @@ -1290,75 +1290,75 @@ iwl_legacy_tx_queue_get_hdr(struct iwl_priv *priv, return NULL; } -static inline struct iwl_rxon_context * -iwl_legacy_rxon_ctx_from_vif(struct ieee80211_vif *vif) +static inline struct il_rxon_context * +il_rxon_ctx_from_vif(struct ieee80211_vif *vif) { - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; + struct il_vif_priv *vif_priv = (void *)vif->drv_priv; return vif_priv->ctx; } #define for_each_context(priv, ctx) \ - for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \ - ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \ + for (ctx = &priv->contexts[IL_RXON_CTX_BSS]; \ + ctx < &priv->contexts[NUM_IL_RXON_CTX]; ctx++) \ if (priv->valid_contexts & BIT(ctx->ctxid)) -static inline int iwl_legacy_is_associated(struct iwl_priv *priv, - enum iwl_rxon_context_id ctxid) +static inline int il_is_associated(struct il_priv *priv, + enum il_rxon_context_id ctxid) { return (priv->contexts[ctxid].active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; } -static inline int iwl_legacy_is_any_associated(struct iwl_priv *priv) +static inline int il_is_any_associated(struct il_priv *priv) { - return iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS); + return il_is_associated(priv, IL_RXON_CTX_BSS); } -static inline int iwl_legacy_is_associated_ctx(struct iwl_rxon_context *ctx) +static inline int il_is_associated_ctx(struct il_rxon_context *ctx) { return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; } -static inline int iwl_legacy_is_channel_valid(const struct iwl_channel_info *ch_info) +static inline int il_is_channel_valid(const struct il_channel_info *ch_info) { if (ch_info == NULL) return 0; return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0; } -static inline int iwl_legacy_is_channel_radar(const struct iwl_channel_info *ch_info) +static inline int il_is_channel_radar(const struct il_channel_info *ch_info) { return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0; } -static inline u8 iwl_legacy_is_channel_a_band(const struct iwl_channel_info *ch_info) +static inline u8 il_is_channel_a_band(const struct il_channel_info *ch_info) { return ch_info->band == IEEE80211_BAND_5GHZ; } static inline int -iwl_legacy_is_channel_passive(const struct iwl_channel_info *ch) +il_is_channel_passive(const struct il_channel_info *ch) { return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; } static inline int -iwl_legacy_is_channel_ibss(const struct iwl_channel_info *ch) +il_is_channel_ibss(const struct il_channel_info *ch) { return (ch->flags & EEPROM_CHANNEL_IBSS) ? 1 : 0; } static inline void -__iwl_legacy_free_pages(struct iwl_priv *priv, struct page *page) +__il_free_pages(struct il_priv *priv, struct page *page) { __free_pages(page, priv->hw_params.rx_page_order); priv->alloc_rxb_page--; } -static inline void iwl_legacy_free_pages(struct iwl_priv *priv, unsigned long page) +static inline void il_free_pages(struct il_priv *priv, unsigned long page) { free_pages(page, priv->hw_params.rx_page_order); priv->alloc_rxb_page--; } -#endif /* __iwl_legacy_dev_h__ */ +#endif /* __il_dev_h__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c index 5bf3f49..1075f1d 100644 --- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c +++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c @@ -81,7 +81,7 @@ * EEPROM contents to the specific channel number supported for each * band. * - * For example, iwl_priv->eeprom.band_3_channels[4] from the band_3 + * For example, il_priv->eeprom.band_3_channels[4] from the band_3 * definition below maps to physical channel 42 in the 5.2GHz spectrum. * The specific geography and calibration information for that channel * is contained in the eeprom map itself. @@ -142,18 +142,18 @@ static const u8 iwlegacy_eeprom_band_7[] = { /* 5.2 ht40 channel */ * ******************************************************************************/ -static int iwl_legacy_eeprom_verify_signature(struct iwl_priv *priv) +static int il_eeprom_verify_signature(struct il_priv *priv) { - u32 gp = iwl_read32(priv, CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK; + u32 gp = il_read32(priv, CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK; int ret = 0; - IWL_DEBUG_EEPROM(priv, "EEPROM signature=0x%08x\n", gp); + IL_DEBUG_EEPROM(priv, "EEPROM signature=0x%08x\n", gp); switch (gp) { case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K: case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K: break; default: - IWL_ERR(priv, "bad EEPROM signature," + IL_ERR(priv, "bad EEPROM signature," "EEPROM_GP=0x%08x\n", gp); ret = -ENOENT; break; @@ -162,39 +162,39 @@ static int iwl_legacy_eeprom_verify_signature(struct iwl_priv *priv) } const u8 -*iwl_legacy_eeprom_query_addr(const struct iwl_priv *priv, size_t offset) +*il_eeprom_query_addr(const struct il_priv *priv, size_t offset) { BUG_ON(offset >= priv->cfg->base_params->eeprom_size); return &priv->eeprom[offset]; } -EXPORT_SYMBOL(iwl_legacy_eeprom_query_addr); +EXPORT_SYMBOL(il_eeprom_query_addr); -u16 iwl_legacy_eeprom_query16(const struct iwl_priv *priv, size_t offset) +u16 il_eeprom_query16(const struct il_priv *priv, size_t offset) { if (!priv->eeprom) return 0; return (u16)priv->eeprom[offset] | ((u16)priv->eeprom[offset + 1] << 8); } -EXPORT_SYMBOL(iwl_legacy_eeprom_query16); +EXPORT_SYMBOL(il_eeprom_query16); /** - * iwl_legacy_eeprom_init - read EEPROM contents + * il_eeprom_init - read EEPROM contents * * Load the EEPROM contents from adapter into priv->eeprom * * NOTE: This routine uses the non-debug IO access functions. */ -int iwl_legacy_eeprom_init(struct iwl_priv *priv) +int il_eeprom_init(struct il_priv *priv) { __le16 *e; - u32 gp = iwl_read32(priv, CSR_EEPROM_GP); + u32 gp = il_read32(priv, CSR_EEPROM_GP); int sz; int ret; u16 addr; /* allocate eeprom */ sz = priv->cfg->base_params->eeprom_size; - IWL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz); + IL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz); priv->eeprom = kzalloc(sz, GFP_KERNEL); if (!priv->eeprom) { ret = -ENOMEM; @@ -204,9 +204,9 @@ int iwl_legacy_eeprom_init(struct iwl_priv *priv) priv->cfg->ops->lib->apm_ops.init(priv); - ret = iwl_legacy_eeprom_verify_signature(priv); + ret = il_eeprom_verify_signature(priv); if (ret < 0) { - IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); + IL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); ret = -ENOENT; goto err; } @@ -214,7 +214,7 @@ int iwl_legacy_eeprom_init(struct iwl_priv *priv) /* Make sure driver (instead of uCode) is allowed to read EEPROM */ ret = priv->cfg->ops->lib->eeprom_ops.acquire_semaphore(priv); if (ret < 0) { - IWL_ERR(priv, "Failed to acquire EEPROM semaphore.\n"); + IL_ERR(priv, "Failed to acquire EEPROM semaphore.\n"); ret = -ENOENT; goto err; } @@ -223,25 +223,25 @@ int iwl_legacy_eeprom_init(struct iwl_priv *priv) for (addr = 0; addr < sz; addr += sizeof(u16)) { u32 r; - _iwl_legacy_write32(priv, CSR_EEPROM_REG, + _il_write32(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); - ret = iwl_poll_bit(priv, CSR_EEPROM_REG, + ret = il_poll_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_READ_VALID_MSK, CSR_EEPROM_REG_READ_VALID_MSK, - IWL_EEPROM_ACCESS_TIMEOUT); + IL_EEPROM_ACCESS_TIMEOUT); if (ret < 0) { - IWL_ERR(priv, "Time out reading EEPROM[%d]\n", + IL_ERR(priv, "Time out reading EEPROM[%d]\n", addr); goto done; } - r = _iwl_legacy_read_direct32(priv, CSR_EEPROM_REG); + r = _il_read_direct32(priv, CSR_EEPROM_REG); e[addr / 2] = cpu_to_le16(r >> 16); } - IWL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n", + IL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n", "EEPROM", - iwl_legacy_eeprom_query16(priv, EEPROM_VERSION)); + il_eeprom_query16(priv, EEPROM_VERSION)); ret = 0; done: @@ -249,24 +249,24 @@ done: err: if (ret) - iwl_legacy_eeprom_free(priv); + il_eeprom_free(priv); /* Reset chip to save power until we load uCode during "up". */ - iwl_legacy_apm_stop(priv); + il_apm_stop(priv); alloc_err: return ret; } -EXPORT_SYMBOL(iwl_legacy_eeprom_init); +EXPORT_SYMBOL(il_eeprom_init); -void iwl_legacy_eeprom_free(struct iwl_priv *priv) +void il_eeprom_free(struct il_priv *priv) { kfree(priv->eeprom); priv->eeprom = NULL; } -EXPORT_SYMBOL(iwl_legacy_eeprom_free); +EXPORT_SYMBOL(il_eeprom_free); -static void iwl_legacy_init_band_reference(const struct iwl_priv *priv, +static void il_init_band_reference(const struct il_priv *priv, int eep_band, int *eeprom_ch_count, - const struct iwl_eeprom_channel **eeprom_ch_info, + const struct il_eeprom_channel **eeprom_ch_info, const u8 **eeprom_ch_index) { u32 offset = priv->cfg->ops->lib-> @@ -274,44 +274,44 @@ static void iwl_legacy_init_band_reference(const struct iwl_priv *priv, switch (eep_band) { case 1: /* 2.4GHz band */ *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_1); - *eeprom_ch_info = (struct iwl_eeprom_channel *) - iwl_legacy_eeprom_query_addr(priv, offset); + *eeprom_ch_info = (struct il_eeprom_channel *) + il_eeprom_query_addr(priv, offset); *eeprom_ch_index = iwlegacy_eeprom_band_1; break; case 2: /* 4.9GHz band */ *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_2); - *eeprom_ch_info = (struct iwl_eeprom_channel *) - iwl_legacy_eeprom_query_addr(priv, offset); + *eeprom_ch_info = (struct il_eeprom_channel *) + il_eeprom_query_addr(priv, offset); *eeprom_ch_index = iwlegacy_eeprom_band_2; break; case 3: /* 5.2GHz band */ *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_3); - *eeprom_ch_info = (struct iwl_eeprom_channel *) - iwl_legacy_eeprom_query_addr(priv, offset); + *eeprom_ch_info = (struct il_eeprom_channel *) + il_eeprom_query_addr(priv, offset); *eeprom_ch_index = iwlegacy_eeprom_band_3; break; case 4: /* 5.5GHz band */ *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_4); - *eeprom_ch_info = (struct iwl_eeprom_channel *) - iwl_legacy_eeprom_query_addr(priv, offset); + *eeprom_ch_info = (struct il_eeprom_channel *) + il_eeprom_query_addr(priv, offset); *eeprom_ch_index = iwlegacy_eeprom_band_4; break; case 5: /* 5.7GHz band */ *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_5); - *eeprom_ch_info = (struct iwl_eeprom_channel *) - iwl_legacy_eeprom_query_addr(priv, offset); + *eeprom_ch_info = (struct il_eeprom_channel *) + il_eeprom_query_addr(priv, offset); *eeprom_ch_index = iwlegacy_eeprom_band_5; break; case 6: /* 2.4GHz ht40 channels */ *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_6); - *eeprom_ch_info = (struct iwl_eeprom_channel *) - iwl_legacy_eeprom_query_addr(priv, offset); + *eeprom_ch_info = (struct il_eeprom_channel *) + il_eeprom_query_addr(priv, offset); *eeprom_ch_index = iwlegacy_eeprom_band_6; break; case 7: /* 5 GHz ht40 channels */ *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_7); - *eeprom_ch_info = (struct iwl_eeprom_channel *) - iwl_legacy_eeprom_query_addr(priv, offset); + *eeprom_ch_info = (struct il_eeprom_channel *) + il_eeprom_query_addr(priv, offset); *eeprom_ch_index = iwlegacy_eeprom_band_7; break; default: @@ -322,27 +322,27 @@ static void iwl_legacy_init_band_reference(const struct iwl_priv *priv, #define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \ ? # x " " : "") /** - * iwl_legacy_mod_ht40_chan_info - Copy ht40 channel info into driver's priv. + * il_mod_ht40_chan_info - Copy ht40 channel info into driver's priv. * * Does not set up a command, or touch hardware. */ -static int iwl_legacy_mod_ht40_chan_info(struct iwl_priv *priv, +static int il_mod_ht40_chan_info(struct il_priv *priv, enum ieee80211_band band, u16 channel, - const struct iwl_eeprom_channel *eeprom_ch, + const struct il_eeprom_channel *eeprom_ch, u8 clear_ht40_extension_channel) { - struct iwl_channel_info *ch_info; + struct il_channel_info *ch_info; - ch_info = (struct iwl_channel_info *) - iwl_legacy_get_channel_info(priv, band, channel); + ch_info = (struct il_channel_info *) + il_get_channel_info(priv, band, channel); - if (!iwl_legacy_is_channel_valid(ch_info)) + if (!il_is_channel_valid(ch_info)) return -1; - IWL_DEBUG_EEPROM(priv, "HT40 Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):" + IL_DEBUG_EEPROM(priv, "HT40 Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):" " Ad-Hoc %ssupported\n", ch_info->channel, - iwl_legacy_is_channel_a_band(ch_info) ? + il_is_channel_a_band(ch_info) ? "5.2" : "2.4", CHECK_AND_PRINT(IBSS), CHECK_AND_PRINT(ACTIVE), @@ -369,22 +369,22 @@ static int iwl_legacy_mod_ht40_chan_info(struct iwl_priv *priv, ? # x " " : "") /** - * iwl_legacy_init_channel_map - Set up driver's info for all possible channels + * il_init_channel_map - Set up driver's info for all possible channels */ -int iwl_legacy_init_channel_map(struct iwl_priv *priv) +int il_init_channel_map(struct il_priv *priv) { int eeprom_ch_count = 0; const u8 *eeprom_ch_index = NULL; - const struct iwl_eeprom_channel *eeprom_ch_info = NULL; + const struct il_eeprom_channel *eeprom_ch_info = NULL; int band, ch; - struct iwl_channel_info *ch_info; + struct il_channel_info *ch_info; if (priv->channel_count) { - IWL_DEBUG_EEPROM(priv, "Channel map already initialized.\n"); + IL_DEBUG_EEPROM(priv, "Channel map already initialized.\n"); return 0; } - IWL_DEBUG_EEPROM(priv, "Initializing regulatory info from EEPROM\n"); + IL_DEBUG_EEPROM(priv, "Initializing regulatory info from EEPROM\n"); priv->channel_count = ARRAY_SIZE(iwlegacy_eeprom_band_1) + @@ -393,13 +393,13 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv) ARRAY_SIZE(iwlegacy_eeprom_band_4) + ARRAY_SIZE(iwlegacy_eeprom_band_5); - IWL_DEBUG_EEPROM(priv, "Parsing data for %d channels.\n", + IL_DEBUG_EEPROM(priv, "Parsing data for %d channels.\n", priv->channel_count); - priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) * + priv->channel_info = kzalloc(sizeof(struct il_channel_info) * priv->channel_count, GFP_KERNEL); if (!priv->channel_info) { - IWL_ERR(priv, "Could not allocate channel_info\n"); + IL_ERR(priv, "Could not allocate channel_info\n"); priv->channel_count = 0; return -ENOMEM; } @@ -411,7 +411,7 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv) * what just in the EEPROM) */ for (band = 1; band <= 5; band++) { - iwl_legacy_init_band_reference(priv, band, &eeprom_ch_count, + il_init_band_reference(priv, band, &eeprom_ch_count, &eeprom_ch_info, &eeprom_ch_index); /* Loop through each band adding each of the channels */ @@ -432,13 +432,13 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv) ch_info->ht40_extension_channel = IEEE80211_CHAN_NO_HT40; - if (!(iwl_legacy_is_channel_valid(ch_info))) { - IWL_DEBUG_EEPROM(priv, + if (!(il_is_channel_valid(ch_info))) { + IL_DEBUG_EEPROM(priv, "Ch. %d Flags %x [%sGHz] - " "No traffic\n", ch_info->channel, ch_info->flags, - iwl_legacy_is_channel_a_band(ch_info) ? + il_is_channel_a_band(ch_info) ? "5.2" : "2.4"); ch_info++; continue; @@ -450,11 +450,11 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv) ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; ch_info->min_power = 0; - IWL_DEBUG_EEPROM(priv, "Ch. %d [%sGHz] " + IL_DEBUG_EEPROM(priv, "Ch. %d [%sGHz] " "%s%s%s%s%s%s(0x%02x %ddBm):" " Ad-Hoc %ssupported\n", ch_info->channel, - iwl_legacy_is_channel_a_band(ch_info) ? + il_is_channel_a_band(ch_info) ? "5.2" : "2.4", CHECK_AND_PRINT_I(VALID), CHECK_AND_PRINT_I(IBSS), @@ -485,7 +485,7 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv) for (band = 6; band <= 7; band++) { enum ieee80211_band ieeeband; - iwl_legacy_init_band_reference(priv, band, &eeprom_ch_count, + il_init_band_reference(priv, band, &eeprom_ch_count, &eeprom_ch_info, &eeprom_ch_index); /* 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) /* Loop through each band adding each of the channels */ for (ch = 0; ch < eeprom_ch_count; ch++) { /* Set up driver's info for lower half */ - iwl_legacy_mod_ht40_chan_info(priv, ieeeband, + il_mod_ht40_chan_info(priv, ieeeband, eeprom_ch_index[ch], &eeprom_ch_info[ch], IEEE80211_CHAN_NO_HT40PLUS); /* Set up driver's info for upper half */ - iwl_legacy_mod_ht40_chan_info(priv, ieeeband, + il_mod_ht40_chan_info(priv, ieeeband, eeprom_ch_index[ch] + 4, &eeprom_ch_info[ch], IEEE80211_CHAN_NO_HT40MINUS); @@ -510,25 +510,25 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv) return 0; } -EXPORT_SYMBOL(iwl_legacy_init_channel_map); +EXPORT_SYMBOL(il_init_channel_map); /* - * iwl_legacy_free_channel_map - undo allocations in iwl_legacy_init_channel_map + * il_free_channel_map - undo allocations in il_init_channel_map */ -void iwl_legacy_free_channel_map(struct iwl_priv *priv) +void il_free_channel_map(struct il_priv *priv) { kfree(priv->channel_info); priv->channel_count = 0; } -EXPORT_SYMBOL(iwl_legacy_free_channel_map); +EXPORT_SYMBOL(il_free_channel_map); /** - * iwl_legacy_get_channel_info - Find driver's private channel info + * il_get_channel_info - Find driver's private channel info * * Based on band and channel number. */ const struct -iwl_channel_info *iwl_legacy_get_channel_info(const struct iwl_priv *priv, +il_channel_info *il_get_channel_info(const struct il_priv *priv, enum ieee80211_band band, u16 channel) { int i; @@ -550,4 +550,4 @@ iwl_channel_info *iwl_legacy_get_channel_info(const struct iwl_priv *priv, return NULL; } -EXPORT_SYMBOL(iwl_legacy_get_channel_info); +EXPORT_SYMBOL(il_get_channel_info); diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.h b/drivers/net/wireless/iwlegacy/iwl-eeprom.h index c59c810..9ad6871 100644 --- a/drivers/net/wireless/iwlegacy/iwl-eeprom.h +++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.h @@ -60,12 +60,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#ifndef __iwl_legacy_eeprom_h__ -#define __iwl_legacy_eeprom_h__ +#ifndef __il_eeprom_h__ +#define __il_eeprom_h__ #include -struct iwl_priv; +struct il_priv; /* * EEPROM access time values: @@ -75,14 +75,14 @@ struct iwl_priv; * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec. * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG. */ -#define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ +#define IL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ -#define IWL_EEPROM_SEM_TIMEOUT 10 /* microseconds */ -#define IWL_EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ +#define IL_EEPROM_SEM_TIMEOUT 10 /* microseconds */ +#define IL_EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ /* - * Regulatory channel usage flags in EEPROM struct iwl4965_eeprom_channel.flags. + * Regulatory channel usage flags in EEPROM struct il4965_eeprom_channel.flags. * * IBSS and/or AP operation is allowed *only* on those channels with * (VALID && IBSS && ACTIVE && !RADAR). This restriction is in place because @@ -97,7 +97,7 @@ struct iwl_priv; * * NOTE: Using a channel inappropriately will result in a uCode error! */ -#define IWL_NUM_TX_CALIB_GROUPS 5 +#define IL_NUM_TX_CALIB_GROUPS 5 enum { EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */ EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */ @@ -116,7 +116,7 @@ enum { /* *regulatory* channel data format in eeprom, one for each channel. * There are separate entries for HT40 (40 MHz) vs. normal (20 MHz) channels. */ -struct iwl_eeprom_channel { +struct il_eeprom_channel { u8 flags; /* EEPROM_CHANNEL_* flags copied from EEPROM */ s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ } __packed; @@ -160,7 +160,7 @@ extern const u8 iwlegacy_eeprom_band_1[14]; * * 4) RF power amplifier detector level measurement (not used). */ -struct iwl_eeprom_calib_measure { +struct il_eeprom_calib_measure { u8 temperature; /* Device temperature (Celsius) */ u8 gain_idx; /* Index into gain table */ u8 actual_pow; /* Measured RF output power, half-dBm */ @@ -176,9 +176,9 @@ struct iwl_eeprom_calib_measure { * 2) Measurements for each of 3 power levels for each of 2 radio transmitters * (a.k.a. "tx chains") (6 measurements altogether) */ -struct iwl_eeprom_calib_ch_info { +struct il_eeprom_calib_ch_info { u8 ch_num; - struct iwl_eeprom_calib_measure + struct il_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS] [EEPROM_TX_POWER_MEASUREMENTS]; } __packed; @@ -193,11 +193,11 @@ struct iwl_eeprom_calib_ch_info { * * 2) Sample measurement sets for 2 channels close to the range endpoints. */ -struct iwl_eeprom_calib_subband_info { +struct il_eeprom_calib_subband_info { u8 ch_from; /* channel number of lowest channel in subband */ u8 ch_to; /* channel number of highest channel in subband */ - struct iwl_eeprom_calib_ch_info ch1; - struct iwl_eeprom_calib_ch_info ch2; + struct il_eeprom_calib_ch_info ch1; + struct il_eeprom_calib_ch_info ch2; } __packed; @@ -218,14 +218,14 @@ struct iwl_eeprom_calib_subband_info { * characteristics of the analog radio circuitry vary with frequency. * * Not all sets need to be filled with data; - * struct iwl_eeprom_calib_subband_info contains range of channels + * struct il_eeprom_calib_subband_info contains range of channels * (0 if unused) for each set of data. */ -struct iwl_eeprom_calib_info { +struct il_eeprom_calib_info { u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ u8 saturation_power52; /* half-dBm */ __le16 voltage; /* signed */ - struct iwl_eeprom_calib_subband_info + struct il_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS]; } __packed; @@ -323,22 +323,22 @@ struct iwl_eeprom_calib_info { #define EEPROM_REGULATORY_BAND_NO_HT40 (0) -struct iwl_eeprom_ops { +struct il_eeprom_ops { const u32 regulatory_bands[7]; - int (*acquire_semaphore) (struct iwl_priv *priv); - void (*release_semaphore) (struct iwl_priv *priv); + int (*acquire_semaphore) (struct il_priv *priv); + void (*release_semaphore) (struct il_priv *priv); }; -int iwl_legacy_eeprom_init(struct iwl_priv *priv); -void iwl_legacy_eeprom_free(struct iwl_priv *priv); -const u8 *iwl_legacy_eeprom_query_addr(const struct iwl_priv *priv, +int il_eeprom_init(struct il_priv *priv); +void il_eeprom_free(struct il_priv *priv); +const u8 *il_eeprom_query_addr(const struct il_priv *priv, size_t offset); -u16 iwl_legacy_eeprom_query16(const struct iwl_priv *priv, size_t offset); -int iwl_legacy_init_channel_map(struct iwl_priv *priv); -void iwl_legacy_free_channel_map(struct iwl_priv *priv); -const struct iwl_channel_info *iwl_legacy_get_channel_info( - const struct iwl_priv *priv, +u16 il_eeprom_query16(const struct il_priv *priv, size_t offset); +int il_init_channel_map(struct il_priv *priv); +void il_free_channel_map(struct il_priv *priv); +const struct il_channel_info *il_get_channel_info( + const struct il_priv *priv, enum ieee80211_band band, u16 channel); -#endif /* __iwl_legacy_eeprom_h__ */ +#endif /* __il_eeprom_h__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-fh.h b/drivers/net/wireless/iwlegacy/iwl-fh.h index 6e60918..0ae36df 100644 --- a/drivers/net/wireless/iwlegacy/iwl-fh.h +++ b/drivers/net/wireless/iwlegacy/iwl-fh.h @@ -60,8 +60,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *****************************************************************************/ -#ifndef __iwl_legacy_fh_h__ -#define __iwl_legacy_fh_h__ +#ifndef __il_fh_h__ +#define __il_fh_h__ /****************************/ /* Flow Handler Definitions */ @@ -99,7 +99,7 @@ * * 4965 has 16 base pointer registers, one for each of 16 host-DRAM-resident * circular buffers (CBs/queues) containing Transmit Frame Descriptors (TFDs) - * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 + * (see struct il_tfd_frame). These 16 pointer registers are offset by 0x04 * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte * aligned (address bits 0-7 must be 0). * @@ -146,7 +146,7 @@ * physical address [35:4] into FH_RSCSR_CHNL0_STTS_WPTR_REG [31:0]. * * Bit fields in lower dword of Rx status buffer (upper dword not used - * by driver; see struct iwl4965_shared, val0): + * by driver; see struct il4965_shared, val0): * 31-12: Not used by driver * 11- 0: Index of last filled Rx buffer descriptor * (4965 writes, driver reads this value) @@ -424,12 +424,12 @@ #define RX_LOW_WATERMARK 8 /* Size of one Rx buffer in host DRAM */ -#define IWL_RX_BUF_SIZE_3K (3 * 1000) /* 3945 only */ -#define IWL_RX_BUF_SIZE_4K (4 * 1024) -#define IWL_RX_BUF_SIZE_8K (8 * 1024) +#define IL_RX_BUF_SIZE_3K (3 * 1000) /* 3945 only */ +#define IL_RX_BUF_SIZE_4K (4 * 1024) +#define IL_RX_BUF_SIZE_8K (8 * 1024) /** - * struct iwl_rb_status - reseve buffer status + * struct il_rb_status - reseve buffer status * host memory mapped FH registers * @closed_rb_num [0:11] - Indicates the index of the RB which was closed * @closed_fr_num [0:11] - Indicates the index of the RX Frame which was closed @@ -438,7 +438,7 @@ * @finished_fr_num [0:11] - Indicates the index of the RX Frame * which was transferred */ -struct iwl_rb_status { +struct il_rb_status { __le16 closed_rb_num; __le16 closed_fr_num; __le16 finished_rb_num; @@ -450,15 +450,15 @@ struct iwl_rb_status { #define TFD_QUEUE_SIZE_MAX (256) #define TFD_QUEUE_SIZE_BC_DUP (64) #define TFD_QUEUE_BC_SIZE (TFD_QUEUE_SIZE_MAX + TFD_QUEUE_SIZE_BC_DUP) -#define IWL_TX_DMA_MASK DMA_BIT_MASK(36) -#define IWL_NUM_OF_TBS 20 +#define IL_TX_DMA_MASK DMA_BIT_MASK(36) +#define IL_NUM_OF_TBS 20 -static inline u8 iwl_legacy_get_dma_hi_addr(dma_addr_t addr) +static inline u8 il_get_dma_hi_addr(dma_addr_t addr) { return (sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0) & 0xF; } /** - * struct iwl_tfd_tb transmit buffer descriptor within transmit frame descriptor + * struct il_tfd_tb transmit buffer descriptor within transmit frame descriptor * * This structure contains dma address and length of transmission address * @@ -467,13 +467,13 @@ static inline u8 iwl_legacy_get_dma_hi_addr(dma_addr_t addr) * @hi_n_len 0-3 [35:32] portion of dma * 4-15 length of the tx buffer */ -struct iwl_tfd_tb { +struct il_tfd_tb { __le32 lo; __le16 hi_n_len; } __packed; /** - * struct iwl_tfd + * struct il_tfd * * Transmit Frame Descriptor (TFD) * @@ -500,14 +500,14 @@ struct iwl_tfd_tb { * * A maximum of 255 (not 256!) TFDs may be on a queue waiting for Tx. */ -struct iwl_tfd { +struct il_tfd { u8 __reserved1[3]; u8 num_tbs; - struct iwl_tfd_tb tbs[IWL_NUM_OF_TBS]; + struct il_tfd_tb tbs[IL_NUM_OF_TBS]; __le32 __pad; } __packed; /* Keep Warm Size */ -#define IWL_KW_SIZE 0x1000 /* 4k */ +#define IL_KW_SIZE 0x1000 /* 4k */ -#endif /* !__iwl_legacy_fh_h__ */ +#endif /* !__il_fh_h__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-hcmd.c b/drivers/net/wireless/iwlegacy/iwl-hcmd.c index ce1fc9f..515befc 100644 --- a/drivers/net/wireless/iwlegacy/iwl-hcmd.c +++ b/drivers/net/wireless/iwlegacy/iwl-hcmd.c @@ -37,66 +37,66 @@ #include "iwl-core.h" -const char *iwl_legacy_get_cmd_string(u8 cmd) +const char *il_get_cmd_string(u8 cmd) { switch (cmd) { - IWL_CMD(REPLY_ALIVE); - IWL_CMD(REPLY_ERROR); - IWL_CMD(REPLY_RXON); - IWL_CMD(REPLY_RXON_ASSOC); - IWL_CMD(REPLY_QOS_PARAM); - IWL_CMD(REPLY_RXON_TIMING); - IWL_CMD(REPLY_ADD_STA); - IWL_CMD(REPLY_REMOVE_STA); - IWL_CMD(REPLY_WEPKEY); - IWL_CMD(REPLY_3945_RX); - IWL_CMD(REPLY_TX); - IWL_CMD(REPLY_RATE_SCALE); - IWL_CMD(REPLY_LEDS_CMD); - IWL_CMD(REPLY_TX_LINK_QUALITY_CMD); - IWL_CMD(REPLY_CHANNEL_SWITCH); - IWL_CMD(CHANNEL_SWITCH_NOTIFICATION); - IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD); - IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION); - IWL_CMD(POWER_TABLE_CMD); - IWL_CMD(PM_SLEEP_NOTIFICATION); - IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC); - IWL_CMD(REPLY_SCAN_CMD); - IWL_CMD(REPLY_SCAN_ABORT_CMD); - IWL_CMD(SCAN_START_NOTIFICATION); - IWL_CMD(SCAN_RESULTS_NOTIFICATION); - IWL_CMD(SCAN_COMPLETE_NOTIFICATION); - IWL_CMD(BEACON_NOTIFICATION); - IWL_CMD(REPLY_TX_BEACON); - IWL_CMD(REPLY_TX_PWR_TABLE_CMD); - IWL_CMD(REPLY_BT_CONFIG); - IWL_CMD(REPLY_STATISTICS_CMD); - IWL_CMD(STATISTICS_NOTIFICATION); - IWL_CMD(CARD_STATE_NOTIFICATION); - IWL_CMD(MISSED_BEACONS_NOTIFICATION); - IWL_CMD(REPLY_CT_KILL_CONFIG_CMD); - IWL_CMD(SENSITIVITY_CMD); - IWL_CMD(REPLY_PHY_CALIBRATION_CMD); - IWL_CMD(REPLY_RX_PHY_CMD); - IWL_CMD(REPLY_RX_MPDU_CMD); - IWL_CMD(REPLY_RX); - IWL_CMD(REPLY_COMPRESSED_BA); + IL_CMD(REPLY_ALIVE); + IL_CMD(REPLY_ERROR); + IL_CMD(REPLY_RXON); + IL_CMD(REPLY_RXON_ASSOC); + IL_CMD(REPLY_QOS_PARAM); + IL_CMD(REPLY_RXON_TIMING); + IL_CMD(REPLY_ADD_STA); + IL_CMD(REPLY_REMOVE_STA); + IL_CMD(REPLY_WEPKEY); + IL_CMD(REPLY_3945_RX); + IL_CMD(REPLY_TX); + IL_CMD(REPLY_RATE_SCALE); + IL_CMD(REPLY_LEDS_CMD); + IL_CMD(REPLY_TX_LINK_QUALITY_CMD); + IL_CMD(REPLY_CHANNEL_SWITCH); + IL_CMD(CHANNEL_SWITCH_NOTIFICATION); + IL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD); + IL_CMD(SPECTRUM_MEASURE_NOTIFICATION); + IL_CMD(POWER_TABLE_CMD); + IL_CMD(PM_SLEEP_NOTIFICATION); + IL_CMD(PM_DEBUG_STATISTIC_NOTIFIC); + IL_CMD(REPLY_SCAN_CMD); + IL_CMD(REPLY_SCAN_ABORT_CMD); + IL_CMD(SCAN_START_NOTIFICATION); + IL_CMD(SCAN_RESULTS_NOTIFICATION); + IL_CMD(SCAN_COMPLETE_NOTIFICATION); + IL_CMD(BEACON_NOTIFICATION); + IL_CMD(REPLY_TX_BEACON); + IL_CMD(REPLY_TX_PWR_TABLE_CMD); + IL_CMD(REPLY_BT_CONFIG); + IL_CMD(REPLY_STATISTICS_CMD); + IL_CMD(STATISTICS_NOTIFICATION); + IL_CMD(CARD_STATE_NOTIFICATION); + IL_CMD(MISSED_BEACONS_NOTIFICATION); + IL_CMD(REPLY_CT_KILL_CONFIG_CMD); + IL_CMD(SENSITIVITY_CMD); + IL_CMD(REPLY_PHY_CALIBRATION_CMD); + IL_CMD(REPLY_RX_PHY_CMD); + IL_CMD(REPLY_RX_MPDU_CMD); + IL_CMD(REPLY_RX); + IL_CMD(REPLY_COMPRESSED_BA); default: return "UNKNOWN"; } } -EXPORT_SYMBOL(iwl_legacy_get_cmd_string); +EXPORT_SYMBOL(il_get_cmd_string); #define HOST_COMPLETE_TIMEOUT (HZ / 2) -static void iwl_legacy_generic_cmd_callback(struct iwl_priv *priv, - struct iwl_device_cmd *cmd, - struct iwl_rx_packet *pkt) +static void il_generic_cmd_callback(struct il_priv *priv, + struct il_device_cmd *cmd, + struct il_rx_packet *pkt) { - if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { - IWL_ERR(priv, "Bad return from %s (0x%08X)\n", - iwl_legacy_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); + if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { + IL_ERR(priv, "Bad return from %s (0x%08X)\n", + il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); return; } @@ -104,18 +104,18 @@ static void iwl_legacy_generic_cmd_callback(struct iwl_priv *priv, switch (cmd->hdr.cmd) { case REPLY_TX_LINK_QUALITY_CMD: case SENSITIVITY_CMD: - IWL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n", - iwl_legacy_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); + IL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n", + il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); break; default: - IWL_DEBUG_HC(priv, "back from %s (0x%08X)\n", - iwl_legacy_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); + IL_DEBUG_HC(priv, "back from %s (0x%08X)\n", + il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); } #endif } static int -iwl_legacy_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +il_send_cmd_async(struct il_priv *priv, struct il_host_cmd *cmd) { int ret; @@ -126,21 +126,21 @@ iwl_legacy_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) /* Assign a generic callback if one is not provided */ if (!cmd->callback) - cmd->callback = iwl_legacy_generic_cmd_callback; + cmd->callback = il_generic_cmd_callback; if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return -EBUSY; - ret = iwl_legacy_enqueue_hcmd(priv, cmd); + ret = il_enqueue_hcmd(priv, cmd); if (ret < 0) { - IWL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n", - iwl_legacy_get_cmd_string(cmd->id), ret); + IL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n", + il_get_cmd_string(cmd->id), ret); return ret; } return 0; } -int iwl_legacy_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +int il_send_cmd_sync(struct il_priv *priv, struct il_host_cmd *cmd) { int cmd_idx; int ret; @@ -152,18 +152,18 @@ int iwl_legacy_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) /* A synchronous command can not have a callback set. */ BUG_ON(cmd->callback); - IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n", - iwl_legacy_get_cmd_string(cmd->id)); + IL_DEBUG_INFO(priv, "Attempting to send sync command %s\n", + il_get_cmd_string(cmd->id)); set_bit(STATUS_HCMD_ACTIVE, &priv->status); - IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n", - iwl_legacy_get_cmd_string(cmd->id)); + IL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n", + il_get_cmd_string(cmd->id)); - cmd_idx = iwl_legacy_enqueue_hcmd(priv, cmd); + cmd_idx = il_enqueue_hcmd(priv, cmd); if (cmd_idx < 0) { ret = cmd_idx; - IWL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n", - iwl_legacy_get_cmd_string(cmd->id), ret); + IL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n", + il_get_cmd_string(cmd->id), ret); goto out; } @@ -172,35 +172,35 @@ int iwl_legacy_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) HOST_COMPLETE_TIMEOUT); if (!ret) { if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) { - IWL_ERR(priv, + IL_ERR(priv, "Error sending %s: time out after %dms.\n", - iwl_legacy_get_cmd_string(cmd->id), + il_get_cmd_string(cmd->id), jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); clear_bit(STATUS_HCMD_ACTIVE, &priv->status); - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s\n", - iwl_legacy_get_cmd_string(cmd->id)); + il_get_cmd_string(cmd->id)); ret = -ETIMEDOUT; goto cancel; } } if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { - IWL_ERR(priv, "Command %s aborted: RF KILL Switch\n", - iwl_legacy_get_cmd_string(cmd->id)); + IL_ERR(priv, "Command %s aborted: RF KILL Switch\n", + il_get_cmd_string(cmd->id)); ret = -ECANCELED; goto fail; } if (test_bit(STATUS_FW_ERROR, &priv->status)) { - IWL_ERR(priv, "Command %s failed: FW Error\n", - iwl_legacy_get_cmd_string(cmd->id)); + IL_ERR(priv, "Command %s failed: FW Error\n", + il_get_cmd_string(cmd->id)); ret = -EIO; goto fail; } if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) { - IWL_ERR(priv, "Error: Response NULL in '%s'\n", - iwl_legacy_get_cmd_string(cmd->id)); + IL_ERR(priv, "Error: Response NULL in '%s'\n", + il_get_cmd_string(cmd->id)); ret = -EIO; goto cancel; } @@ -221,43 +221,43 @@ cancel: } fail: if (cmd->reply_page) { - iwl_legacy_free_pages(priv, cmd->reply_page); + il_free_pages(priv, cmd->reply_page); cmd->reply_page = 0; } out: return ret; } -EXPORT_SYMBOL(iwl_legacy_send_cmd_sync); +EXPORT_SYMBOL(il_send_cmd_sync); -int iwl_legacy_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +int il_send_cmd(struct il_priv *priv, struct il_host_cmd *cmd) { if (cmd->flags & CMD_ASYNC) - return iwl_legacy_send_cmd_async(priv, cmd); + return il_send_cmd_async(priv, cmd); - return iwl_legacy_send_cmd_sync(priv, cmd); + return il_send_cmd_sync(priv, cmd); } -EXPORT_SYMBOL(iwl_legacy_send_cmd); +EXPORT_SYMBOL(il_send_cmd); int -iwl_legacy_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data) +il_send_cmd_pdu(struct il_priv *priv, u8 id, u16 len, const void *data) { - struct iwl_host_cmd cmd = { + struct il_host_cmd cmd = { .id = id, .len = len, .data = data, }; - return iwl_legacy_send_cmd_sync(priv, &cmd); + return il_send_cmd_sync(priv, &cmd); } -EXPORT_SYMBOL(iwl_legacy_send_cmd_pdu); +EXPORT_SYMBOL(il_send_cmd_pdu); -int iwl_legacy_send_cmd_pdu_async(struct iwl_priv *priv, +int il_send_cmd_pdu_async(struct il_priv *priv, u8 id, u16 len, const void *data, - void (*callback)(struct iwl_priv *priv, - struct iwl_device_cmd *cmd, - struct iwl_rx_packet *pkt)) + void (*callback)(struct il_priv *priv, + struct il_device_cmd *cmd, + struct il_rx_packet *pkt)) { - struct iwl_host_cmd cmd = { + struct il_host_cmd cmd = { .id = id, .len = len, .data = data, @@ -266,6 +266,6 @@ int iwl_legacy_send_cmd_pdu_async(struct iwl_priv *priv, cmd.flags |= CMD_ASYNC; cmd.callback = callback; - return iwl_legacy_send_cmd_async(priv, &cmd); + return il_send_cmd_async(priv, &cmd); } -EXPORT_SYMBOL(iwl_legacy_send_cmd_pdu_async); +EXPORT_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 5cf23ea..e4e63b5 100644 --- a/drivers/net/wireless/iwlegacy/iwl-helpers.h +++ b/drivers/net/wireless/iwlegacy/iwl-helpers.h @@ -27,45 +27,45 @@ * *****************************************************************************/ -#ifndef __iwl_legacy_helpers_h__ -#define __iwl_legacy_helpers_h__ +#ifndef __il_helpers_h__ +#define __il_helpers_h__ #include #include #include "iwl-io.h" -#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) +#define IL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) -static inline struct ieee80211_conf *iwl_legacy_ieee80211_get_hw_conf( +static inline struct ieee80211_conf *il_ieee80211_get_hw_conf( struct ieee80211_hw *hw) { return &hw->conf; } /** - * iwl_legacy_queue_inc_wrap - increment queue index, wrap back to beginning + * il_queue_inc_wrap - increment queue index, wrap back to beginning * @index -- current index * @n_bd -- total number of entries in queue (must be power of 2) */ -static inline int iwl_legacy_queue_inc_wrap(int index, int n_bd) +static inline int il_queue_inc_wrap(int index, int n_bd) { return ++index & (n_bd - 1); } /** - * iwl_legacy_queue_dec_wrap - decrement queue index, wrap back to end + * il_queue_dec_wrap - decrement queue index, wrap back to end * @index -- current index * @n_bd -- total number of entries in queue (must be power of 2) */ -static inline int iwl_legacy_queue_dec_wrap(int index, int n_bd) +static inline int il_queue_dec_wrap(int index, int n_bd) { return --index & (n_bd - 1); } /* TODO: Move fw_desc functions to iwl-pci.ko */ -static inline void iwl_legacy_free_fw_desc(struct pci_dev *pci_dev, +static inline void il_free_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) { if (desc->v_addr) @@ -75,7 +75,7 @@ static inline void iwl_legacy_free_fw_desc(struct pci_dev *pci_dev, desc->len = 0; } -static inline int iwl_legacy_alloc_fw_desc(struct pci_dev *pci_dev, +static inline int il_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) { if (!desc->len) { @@ -100,7 +100,7 @@ static inline int iwl_legacy_alloc_fw_desc(struct pci_dev *pci_dev, * +---------------------- unused */ static inline void -iwl_legacy_set_swq_id(struct iwl_tx_queue *txq, u8 ac, u8 hwq) +il_set_swq_id(struct il_tx_queue *txq, u8 ac, u8 hwq) { BUG_ON(ac > 3); /* only have 2 bits */ 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) txq->swq_id = (hwq << 2) | ac; } -static inline void iwl_legacy_wake_queue(struct iwl_priv *priv, - struct iwl_tx_queue *txq) +static inline void il_wake_queue(struct il_priv *priv, + struct il_tx_queue *txq) { u8 queue = txq->swq_id; u8 ac = queue & 3; @@ -120,8 +120,8 @@ static inline void iwl_legacy_wake_queue(struct iwl_priv *priv, ieee80211_wake_queue(priv->hw, ac); } -static inline void iwl_legacy_stop_queue(struct iwl_priv *priv, - struct iwl_tx_queue *txq) +static inline void il_stop_queue(struct il_priv *priv, + struct il_tx_queue *txq) { u8 queue = txq->swq_id; u8 ac = queue & 3; @@ -144,53 +144,53 @@ static inline void iwl_legacy_stop_queue(struct iwl_priv *priv, #define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue -static inline void iwl_legacy_disable_interrupts(struct iwl_priv *priv) +static inline void il_disable_interrupts(struct il_priv *priv) { clear_bit(STATUS_INT_ENABLED, &priv->status); /* disable interrupts from uCode/NIC to host */ - iwl_write32(priv, CSR_INT_MASK, 0x00000000); + il_write32(priv, CSR_INT_MASK, 0x00000000); /* acknowledge/clear/reset any interrupts still pending * from uCode or flow handler (Rx/Tx DMA) */ - iwl_write32(priv, CSR_INT, 0xffffffff); - iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); - IWL_DEBUG_ISR(priv, "Disabled interrupts\n"); + il_write32(priv, CSR_INT, 0xffffffff); + il_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); + IL_DEBUG_ISR(priv, "Disabled interrupts\n"); } -static inline void iwl_legacy_enable_rfkill_int(struct iwl_priv *priv) +static inline void il_enable_rfkill_int(struct il_priv *priv) { - IWL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n"); - iwl_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL); + IL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n"); + il_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL); } -static inline void iwl_legacy_enable_interrupts(struct iwl_priv *priv) +static inline void il_enable_interrupts(struct il_priv *priv) { - IWL_DEBUG_ISR(priv, "Enabling interrupts\n"); + IL_DEBUG_ISR(priv, "Enabling interrupts\n"); set_bit(STATUS_INT_ENABLED, &priv->status); - iwl_write32(priv, CSR_INT_MASK, priv->inta_mask); + il_write32(priv, CSR_INT_MASK, priv->inta_mask); } /** - * iwl_legacy_beacon_time_mask_low - mask of lower 32 bit of beacon time - * @priv -- pointer to iwl_priv data structure + * il_beacon_time_mask_low - mask of lower 32 bit of beacon time + * @priv -- pointer to il_priv data structure * @tsf_bits -- number of bits need to shift for masking) */ -static inline u32 iwl_legacy_beacon_time_mask_low(struct iwl_priv *priv, +static inline u32 il_beacon_time_mask_low(struct il_priv *priv, u16 tsf_bits) { return (1 << tsf_bits) - 1; } /** - * iwl_legacy_beacon_time_mask_high - mask of higher 32 bit of beacon time - * @priv -- pointer to iwl_priv data structure + * il_beacon_time_mask_high - mask of higher 32 bit of beacon time + * @priv -- pointer to il_priv data structure * @tsf_bits -- number of bits need to shift for masking) */ -static inline u32 iwl_legacy_beacon_time_mask_high(struct iwl_priv *priv, +static inline u32 il_beacon_time_mask_high(struct il_priv *priv, u16 tsf_bits) { return ((1 << (32 - tsf_bits)) - 1) << tsf_bits; } -#endif /* __iwl_legacy_helpers_h__ */ +#endif /* __il_helpers_h__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-io.h b/drivers/net/wireless/iwlegacy/iwl-io.h index 868ef01..ebeb6e2 100644 --- a/drivers/net/wireless/iwlegacy/iwl-io.h +++ b/drivers/net/wireless/iwlegacy/iwl-io.h @@ -26,8 +26,8 @@ * *****************************************************************************/ -#ifndef __iwl_legacy_io_h__ -#define __iwl_legacy_io_h__ +#ifndef __il_io_h__ +#define __il_io_h__ #include @@ -52,8 +52,8 @@ * * If you wish to call the function without any debug or state checking, * you should use the single _ prefix version (as is used by dependent IO - * routines, for example _iwl_legacy_read_direct32 calls the non-check version of - * _iwl_legacy_read32.) + * routines, for example _il_read_direct32 calls the non-check version of + * _il_read32.) * * These declarations are *extremely* useful in quickly isolating code deltas * which result in misconfiguration of the hardware I/O. In combination with @@ -62,46 +62,46 @@ * */ -static inline void _iwl_legacy_write8(struct iwl_priv *priv, u32 ofs, u8 val) +static inline void _il_write8(struct il_priv *priv, u32 ofs, u8 val) { iowrite8(val, priv->hw_base + ofs); } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG static inline void -__iwl_legacy_write8(const char *f, u32 l, struct iwl_priv *priv, +__il_write8(const char *f, u32 l, struct il_priv *priv, u32 ofs, u8 val) { - IWL_DEBUG_IO(priv, "write8(0x%08X, 0x%02X) - %s %d\n", ofs, val, f, l); - _iwl_legacy_write8(priv, ofs, val); + IL_DEBUG_IO(priv, "write8(0x%08X, 0x%02X) - %s %d\n", ofs, val, f, l); + _il_write8(priv, ofs, val); } -#define iwl_write8(priv, ofs, val) \ - __iwl_legacy_write8(__FILE__, __LINE__, priv, ofs, val) +#define il_write8(priv, ofs, val) \ + __il_write8(__FILE__, __LINE__, priv, ofs, val) #else -#define iwl_write8(priv, ofs, val) _iwl_legacy_write8(priv, ofs, val) +#define il_write8(priv, ofs, val) _il_write8(priv, ofs, val) #endif -static inline void _iwl_legacy_write32(struct iwl_priv *priv, u32 ofs, u32 val) +static inline void _il_write32(struct il_priv *priv, u32 ofs, u32 val) { iowrite32(val, priv->hw_base + ofs); } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG static inline void -__iwl_legacy_write32(const char *f, u32 l, struct iwl_priv *priv, +__il_write32(const char *f, u32 l, struct il_priv *priv, u32 ofs, u32 val) { - IWL_DEBUG_IO(priv, "write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); - _iwl_legacy_write32(priv, ofs, val); + IL_DEBUG_IO(priv, "write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); + _il_write32(priv, ofs, val); } -#define iwl_write32(priv, ofs, val) \ - __iwl_legacy_write32(__FILE__, __LINE__, priv, ofs, val) +#define il_write32(priv, ofs, val) \ + __il_write32(__FILE__, __LINE__, priv, ofs, val) #else -#define iwl_write32(priv, ofs, val) _iwl_legacy_write32(priv, ofs, val) +#define il_write32(priv, ofs, val) _il_write32(priv, ofs, val) #endif -static inline u32 _iwl_legacy_read32(struct iwl_priv *priv, u32 ofs) +static inline u32 _il_read32(struct il_priv *priv, u32 ofs) { u32 val = ioread32(priv->hw_base + ofs); return val; @@ -109,122 +109,122 @@ static inline u32 _iwl_legacy_read32(struct iwl_priv *priv, u32 ofs) #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG static inline u32 -__iwl_legacy_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs) +__il_read32(char *f, u32 l, struct il_priv *priv, u32 ofs) { - IWL_DEBUG_IO(priv, "read_direct32(0x%08X) - %s %d\n", ofs, f, l); - return _iwl_legacy_read32(priv, ofs); + IL_DEBUG_IO(priv, "read_direct32(0x%08X) - %s %d\n", ofs, f, l); + return _il_read32(priv, ofs); } -#define iwl_read32(priv, ofs) __iwl_legacy_read32(__FILE__, __LINE__, priv, ofs) +#define il_read32(priv, ofs) __il_read32(__FILE__, __LINE__, priv, ofs) #else -#define iwl_read32(p, o) _iwl_legacy_read32(p, o) +#define il_read32(p, o) _il_read32(p, o) #endif -#define IWL_POLL_INTERVAL 10 /* microseconds */ +#define IL_POLL_INTERVAL 10 /* microseconds */ static inline int -_iwl_legacy_poll_bit(struct iwl_priv *priv, u32 addr, +_il_poll_bit(struct il_priv *priv, u32 addr, u32 bits, u32 mask, int timeout) { int t = 0; do { - if ((_iwl_legacy_read32(priv, addr) & mask) == (bits & mask)) + if ((_il_read32(priv, addr) & mask) == (bits & mask)) return t; - udelay(IWL_POLL_INTERVAL); - t += IWL_POLL_INTERVAL; + udelay(IL_POLL_INTERVAL); + t += IL_POLL_INTERVAL; } while (t < timeout); return -ETIMEDOUT; } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -static inline int __iwl_legacy_poll_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 addr, +static inline int __il_poll_bit(const char *f, u32 l, + struct il_priv *priv, u32 addr, u32 bits, u32 mask, int timeout) { - int ret = _iwl_legacy_poll_bit(priv, addr, bits, mask, timeout); - IWL_DEBUG_IO(priv, "poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n", + int ret = _il_poll_bit(priv, addr, bits, mask, timeout); + IL_DEBUG_IO(priv, "poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n", addr, bits, mask, unlikely(ret == -ETIMEDOUT) ? "timeout" : "", f, l); return ret; } -#define iwl_poll_bit(priv, addr, bits, mask, timeout) \ - __iwl_legacy_poll_bit(__FILE__, __LINE__, priv, addr, \ +#define il_poll_bit(priv, addr, bits, mask, timeout) \ + __il_poll_bit(__FILE__, __LINE__, priv, addr, \ bits, mask, timeout) #else -#define iwl_poll_bit(p, a, b, m, t) _iwl_legacy_poll_bit(p, a, b, m, t) +#define il_poll_bit(p, a, b, m, t) _il_poll_bit(p, a, b, m, t) #endif -static inline void _iwl_legacy_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) +static inline void _il_set_bit(struct il_priv *priv, u32 reg, u32 mask) { - _iwl_legacy_write32(priv, reg, _iwl_legacy_read32(priv, reg) | mask); + _il_write32(priv, reg, _il_read32(priv, reg) | mask); } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -static inline void __iwl_legacy_set_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 reg, u32 mask) +static inline void __il_set_bit(const char *f, u32 l, + struct il_priv *priv, u32 reg, u32 mask) { - u32 val = _iwl_legacy_read32(priv, reg) | mask; - IWL_DEBUG_IO(priv, "set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, + u32 val = _il_read32(priv, reg) | mask; + IL_DEBUG_IO(priv, "set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); - _iwl_legacy_write32(priv, reg, val); + _il_write32(priv, reg, val); } -static inline void iwl_legacy_set_bit(struct iwl_priv *p, u32 r, u32 m) +static inline void il_set_bit(struct il_priv *p, u32 r, u32 m) { unsigned long reg_flags; spin_lock_irqsave(&p->reg_lock, reg_flags); - __iwl_legacy_set_bit(__FILE__, __LINE__, p, r, m); + __il_set_bit(__FILE__, __LINE__, p, r, m); spin_unlock_irqrestore(&p->reg_lock, reg_flags); } #else -static inline void iwl_legacy_set_bit(struct iwl_priv *p, u32 r, u32 m) +static inline void il_set_bit(struct il_priv *p, u32 r, u32 m) { unsigned long reg_flags; spin_lock_irqsave(&p->reg_lock, reg_flags); - _iwl_legacy_set_bit(p, r, m); + _il_set_bit(p, r, m); spin_unlock_irqrestore(&p->reg_lock, reg_flags); } #endif static inline void -_iwl_legacy_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) +_il_clear_bit(struct il_priv *priv, u32 reg, u32 mask) { - _iwl_legacy_write32(priv, reg, _iwl_legacy_read32(priv, reg) & ~mask); + _il_write32(priv, reg, _il_read32(priv, reg) & ~mask); } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG static inline void -__iwl_legacy_clear_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 reg, u32 mask) +__il_clear_bit(const char *f, u32 l, + struct il_priv *priv, u32 reg, u32 mask) { - u32 val = _iwl_legacy_read32(priv, reg) & ~mask; - IWL_DEBUG_IO(priv, "clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); - _iwl_legacy_write32(priv, reg, val); + u32 val = _il_read32(priv, reg) & ~mask; + IL_DEBUG_IO(priv, "clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); + _il_write32(priv, reg, val); } -static inline void iwl_legacy_clear_bit(struct iwl_priv *p, u32 r, u32 m) +static inline void il_clear_bit(struct il_priv *p, u32 r, u32 m) { unsigned long reg_flags; spin_lock_irqsave(&p->reg_lock, reg_flags); - __iwl_legacy_clear_bit(__FILE__, __LINE__, p, r, m); + __il_clear_bit(__FILE__, __LINE__, p, r, m); spin_unlock_irqrestore(&p->reg_lock, reg_flags); } #else -static inline void iwl_legacy_clear_bit(struct iwl_priv *p, u32 r, u32 m) +static inline void il_clear_bit(struct il_priv *p, u32 r, u32 m) { unsigned long reg_flags; spin_lock_irqsave(&p->reg_lock, reg_flags); - _iwl_legacy_clear_bit(p, r, m); + _il_clear_bit(p, r, m); spin_unlock_irqrestore(&p->reg_lock, reg_flags); } #endif -static inline int _iwl_legacy_grab_nic_access(struct iwl_priv *priv) +static inline int _il_grab_nic_access(struct il_priv *priv) { int ret; u32 val; /* this bit wakes up the NIC */ - _iwl_legacy_set_bit(priv, CSR_GP_CNTRL, + _il_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); /* @@ -244,15 +244,15 @@ static inline int _iwl_legacy_grab_nic_access(struct iwl_priv *priv) * good idea before accessing 3945/4965 SRAM (e.g. reading Event Log). * */ - ret = _iwl_legacy_poll_bit(priv, CSR_GP_CNTRL, + ret = _il_poll_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000); if (ret < 0) { - val = _iwl_legacy_read32(priv, CSR_GP_CNTRL); - IWL_ERR(priv, + val = _il_read32(priv, CSR_GP_CNTRL); + IL_ERR(priv, "MAC is in deep sleep!. CSR_GP_CNTRL = 0x%08X\n", val); - _iwl_legacy_write32(priv, CSR_RESET, + _il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_FORCE_NMI); return -EIO; } @@ -261,280 +261,280 @@ static inline int _iwl_legacy_grab_nic_access(struct iwl_priv *priv) } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -static inline int __iwl_legacy_grab_nic_access(const char *f, u32 l, - struct iwl_priv *priv) +static inline int __il_grab_nic_access(const char *f, u32 l, + struct il_priv *priv) { - IWL_DEBUG_IO(priv, "grabbing nic access - %s %d\n", f, l); - return _iwl_legacy_grab_nic_access(priv); + IL_DEBUG_IO(priv, "grabbing nic access - %s %d\n", f, l); + return _il_grab_nic_access(priv); } -#define iwl_grab_nic_access(priv) \ - __iwl_legacy_grab_nic_access(__FILE__, __LINE__, priv) +#define il_grab_nic_access(priv) \ + __il_grab_nic_access(__FILE__, __LINE__, priv) #else -#define iwl_grab_nic_access(priv) \ - _iwl_legacy_grab_nic_access(priv) +#define il_grab_nic_access(priv) \ + _il_grab_nic_access(priv) #endif -static inline void _iwl_legacy_release_nic_access(struct iwl_priv *priv) +static inline void _il_release_nic_access(struct il_priv *priv) { - _iwl_legacy_clear_bit(priv, CSR_GP_CNTRL, + _il_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -static inline void __iwl_legacy_release_nic_access(const char *f, u32 l, - struct iwl_priv *priv) +static inline void __il_release_nic_access(const char *f, u32 l, + struct il_priv *priv) { - IWL_DEBUG_IO(priv, "releasing nic access - %s %d\n", f, l); - _iwl_legacy_release_nic_access(priv); + IL_DEBUG_IO(priv, "releasing nic access - %s %d\n", f, l); + _il_release_nic_access(priv); } -#define iwl_release_nic_access(priv) \ - __iwl_legacy_release_nic_access(__FILE__, __LINE__, priv) +#define il_release_nic_access(priv) \ + __il_release_nic_access(__FILE__, __LINE__, priv) #else -#define iwl_release_nic_access(priv) \ - _iwl_legacy_release_nic_access(priv) +#define il_release_nic_access(priv) \ + _il_release_nic_access(priv) #endif -static inline u32 _iwl_legacy_read_direct32(struct iwl_priv *priv, u32 reg) +static inline u32 _il_read_direct32(struct il_priv *priv, u32 reg) { - return _iwl_legacy_read32(priv, reg); + return _il_read32(priv, reg); } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -static inline u32 __iwl_legacy_read_direct32(const char *f, u32 l, - struct iwl_priv *priv, u32 reg) +static inline u32 __il_read_direct32(const char *f, u32 l, + struct il_priv *priv, u32 reg) { - u32 value = _iwl_legacy_read_direct32(priv, reg); - IWL_DEBUG_IO(priv, + u32 value = _il_read_direct32(priv, reg); + IL_DEBUG_IO(priv, "read_direct32(0x%4X) = 0x%08x - %s %d\n", reg, value, f, l); return value; } -static inline u32 iwl_legacy_read_direct32(struct iwl_priv *priv, u32 reg) +static inline u32 il_read_direct32(struct il_priv *priv, u32 reg) { u32 value; unsigned long reg_flags; spin_lock_irqsave(&priv->reg_lock, reg_flags); - iwl_grab_nic_access(priv); - value = __iwl_legacy_read_direct32(__FILE__, __LINE__, priv, reg); - iwl_release_nic_access(priv); + il_grab_nic_access(priv); + value = __il_read_direct32(__FILE__, __LINE__, priv, reg); + il_release_nic_access(priv); spin_unlock_irqrestore(&priv->reg_lock, reg_flags); return value; } #else -static inline u32 iwl_legacy_read_direct32(struct iwl_priv *priv, u32 reg) +static inline u32 il_read_direct32(struct il_priv *priv, u32 reg) { u32 value; unsigned long reg_flags; spin_lock_irqsave(&priv->reg_lock, reg_flags); - iwl_grab_nic_access(priv); - value = _iwl_legacy_read_direct32(priv, reg); - iwl_release_nic_access(priv); + il_grab_nic_access(priv); + value = _il_read_direct32(priv, reg); + il_release_nic_access(priv); spin_unlock_irqrestore(&priv->reg_lock, reg_flags); return value; } #endif -static inline void _iwl_legacy_write_direct32(struct iwl_priv *priv, +static inline void _il_write_direct32(struct il_priv *priv, u32 reg, u32 value) { - _iwl_legacy_write32(priv, reg, value); + _il_write32(priv, reg, value); } static inline void -iwl_legacy_write_direct32(struct iwl_priv *priv, u32 reg, u32 value) +il_write_direct32(struct il_priv *priv, u32 reg, u32 value) { unsigned long reg_flags; spin_lock_irqsave(&priv->reg_lock, reg_flags); - if (!iwl_grab_nic_access(priv)) { - _iwl_legacy_write_direct32(priv, reg, value); - iwl_release_nic_access(priv); + if (!il_grab_nic_access(priv)) { + _il_write_direct32(priv, reg, value); + il_release_nic_access(priv); } spin_unlock_irqrestore(&priv->reg_lock, reg_flags); } -static inline void iwl_legacy_write_reg_buf(struct iwl_priv *priv, +static inline void il_write_reg_buf(struct il_priv *priv, u32 reg, u32 len, u32 *values) { u32 count = sizeof(u32); if ((priv != NULL) && (values != NULL)) { for (; 0 < len; len -= count, reg += count, values++) - iwl_legacy_write_direct32(priv, reg, *values); + il_write_direct32(priv, reg, *values); } } -static inline int _iwl_legacy_poll_direct_bit(struct iwl_priv *priv, u32 addr, +static inline int _il_poll_direct_bit(struct il_priv *priv, u32 addr, u32 mask, int timeout) { int t = 0; do { - if ((iwl_legacy_read_direct32(priv, addr) & mask) == mask) + if ((il_read_direct32(priv, addr) & mask) == mask) return t; - udelay(IWL_POLL_INTERVAL); - t += IWL_POLL_INTERVAL; + udelay(IL_POLL_INTERVAL); + t += IL_POLL_INTERVAL; } while (t < timeout); return -ETIMEDOUT; } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -static inline int __iwl_legacy_poll_direct_bit(const char *f, u32 l, - struct iwl_priv *priv, +static inline int __il_poll_direct_bit(const char *f, u32 l, + struct il_priv *priv, u32 addr, u32 mask, int timeout) { - int ret = _iwl_legacy_poll_direct_bit(priv, addr, mask, timeout); + int ret = _il_poll_direct_bit(priv, addr, mask, timeout); if (unlikely(ret == -ETIMEDOUT)) - IWL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) - " + IL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) - " "timedout - %s %d\n", addr, mask, f, l); else - IWL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) = 0x%08X " + IL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) = 0x%08X " "- %s %d\n", addr, mask, ret, f, l); return ret; } -#define iwl_poll_direct_bit(priv, addr, mask, timeout) \ -__iwl_legacy_poll_direct_bit(__FILE__, __LINE__, priv, addr, mask, timeout) +#define il_poll_direct_bit(priv, addr, mask, timeout) \ +__il_poll_direct_bit(__FILE__, __LINE__, priv, addr, mask, timeout) #else -#define iwl_poll_direct_bit _iwl_legacy_poll_direct_bit +#define il_poll_direct_bit _il_poll_direct_bit #endif -static inline u32 _iwl_legacy_read_prph(struct iwl_priv *priv, u32 reg) +static inline u32 _il_read_prph(struct il_priv *priv, u32 reg) { - _iwl_legacy_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); + _il_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); rmb(); - return _iwl_legacy_read_direct32(priv, HBUS_TARG_PRPH_RDAT); + return _il_read_direct32(priv, HBUS_TARG_PRPH_RDAT); } -static inline u32 iwl_legacy_read_prph(struct iwl_priv *priv, u32 reg) +static inline u32 il_read_prph(struct il_priv *priv, u32 reg) { unsigned long reg_flags; u32 val; spin_lock_irqsave(&priv->reg_lock, reg_flags); - iwl_grab_nic_access(priv); - val = _iwl_legacy_read_prph(priv, reg); - iwl_release_nic_access(priv); + il_grab_nic_access(priv); + val = _il_read_prph(priv, reg); + il_release_nic_access(priv); spin_unlock_irqrestore(&priv->reg_lock, reg_flags); return val; } -static inline void _iwl_legacy_write_prph(struct iwl_priv *priv, +static inline void _il_write_prph(struct il_priv *priv, u32 addr, u32 val) { - _iwl_legacy_write_direct32(priv, HBUS_TARG_PRPH_WADDR, + _il_write_direct32(priv, HBUS_TARG_PRPH_WADDR, ((addr & 0x0000FFFF) | (3 << 24))); wmb(); - _iwl_legacy_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); + _il_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); } static inline void -iwl_legacy_write_prph(struct iwl_priv *priv, u32 addr, u32 val) +il_write_prph(struct il_priv *priv, u32 addr, u32 val) { unsigned long reg_flags; spin_lock_irqsave(&priv->reg_lock, reg_flags); - if (!iwl_grab_nic_access(priv)) { - _iwl_legacy_write_prph(priv, addr, val); - iwl_release_nic_access(priv); + if (!il_grab_nic_access(priv)) { + _il_write_prph(priv, addr, val); + il_release_nic_access(priv); } spin_unlock_irqrestore(&priv->reg_lock, reg_flags); } -#define _iwl_legacy_set_bits_prph(priv, reg, mask) \ -_iwl_legacy_write_prph(priv, reg, (_iwl_legacy_read_prph(priv, reg) | mask)) +#define _il_set_bits_prph(priv, reg, mask) \ +_il_write_prph(priv, reg, (_il_read_prph(priv, reg) | mask)) static inline void -iwl_legacy_set_bits_prph(struct iwl_priv *priv, u32 reg, u32 mask) +il_set_bits_prph(struct il_priv *priv, u32 reg, u32 mask) { unsigned long reg_flags; spin_lock_irqsave(&priv->reg_lock, reg_flags); - iwl_grab_nic_access(priv); - _iwl_legacy_set_bits_prph(priv, reg, mask); - iwl_release_nic_access(priv); + il_grab_nic_access(priv); + _il_set_bits_prph(priv, reg, mask); + il_release_nic_access(priv); spin_unlock_irqrestore(&priv->reg_lock, reg_flags); } -#define _iwl_legacy_set_bits_mask_prph(priv, reg, bits, mask) \ -_iwl_legacy_write_prph(priv, reg, \ - ((_iwl_legacy_read_prph(priv, reg) & mask) | bits)) +#define _il_set_bits_mask_prph(priv, reg, bits, mask) \ +_il_write_prph(priv, reg, \ + ((_il_read_prph(priv, reg) & mask) | bits)) -static inline void iwl_legacy_set_bits_mask_prph(struct iwl_priv *priv, u32 reg, +static inline void il_set_bits_mask_prph(struct il_priv *priv, u32 reg, u32 bits, u32 mask) { unsigned long reg_flags; spin_lock_irqsave(&priv->reg_lock, reg_flags); - iwl_grab_nic_access(priv); - _iwl_legacy_set_bits_mask_prph(priv, reg, bits, mask); - iwl_release_nic_access(priv); + il_grab_nic_access(priv); + _il_set_bits_mask_prph(priv, reg, bits, mask); + il_release_nic_access(priv); spin_unlock_irqrestore(&priv->reg_lock, reg_flags); } -static inline void iwl_legacy_clear_bits_prph(struct iwl_priv +static inline void il_clear_bits_prph(struct il_priv *priv, u32 reg, u32 mask) { unsigned long reg_flags; u32 val; spin_lock_irqsave(&priv->reg_lock, reg_flags); - iwl_grab_nic_access(priv); - val = _iwl_legacy_read_prph(priv, reg); - _iwl_legacy_write_prph(priv, reg, (val & ~mask)); - iwl_release_nic_access(priv); + il_grab_nic_access(priv); + val = _il_read_prph(priv, reg); + _il_write_prph(priv, reg, (val & ~mask)); + il_release_nic_access(priv); spin_unlock_irqrestore(&priv->reg_lock, reg_flags); } -static inline u32 iwl_legacy_read_targ_mem(struct iwl_priv *priv, u32 addr) +static inline u32 il_read_targ_mem(struct il_priv *priv, u32 addr) { unsigned long reg_flags; u32 value; spin_lock_irqsave(&priv->reg_lock, reg_flags); - iwl_grab_nic_access(priv); + il_grab_nic_access(priv); - _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); + _il_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); rmb(); - value = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); + value = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT); - iwl_release_nic_access(priv); + il_release_nic_access(priv); spin_unlock_irqrestore(&priv->reg_lock, reg_flags); return value; } static inline void -iwl_legacy_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) +il_write_targ_mem(struct il_priv *priv, u32 addr, u32 val) { unsigned long reg_flags; spin_lock_irqsave(&priv->reg_lock, reg_flags); - if (!iwl_grab_nic_access(priv)) { - _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); + if (!il_grab_nic_access(priv)) { + _il_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); wmb(); - _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); - iwl_release_nic_access(priv); + _il_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); + il_release_nic_access(priv); } spin_unlock_irqrestore(&priv->reg_lock, reg_flags); } static inline void -iwl_legacy_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, +il_write_targ_mem_buf(struct il_priv *priv, u32 addr, u32 len, u32 *values) { unsigned long reg_flags; spin_lock_irqsave(&priv->reg_lock, reg_flags); - if (!iwl_grab_nic_access(priv)) { - _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); + if (!il_grab_nic_access(priv)) { + _il_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); wmb(); for (; 0 < len; len -= sizeof(u32), values++) - _iwl_legacy_write_direct32(priv, + _il_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); - iwl_release_nic_access(priv); + il_release_nic_access(priv); } spin_unlock_irqrestore(&priv->reg_lock, reg_flags); } diff --git a/drivers/net/wireless/iwlegacy/iwl-led.c b/drivers/net/wireless/iwlegacy/iwl-led.c index dc568a4..490b183 100644 --- a/drivers/net/wireless/iwlegacy/iwl-led.c +++ b/drivers/net/wireless/iwlegacy/iwl-led.c @@ -41,7 +41,7 @@ #include "iwl-core.h" #include "iwl-io.h" -/* default: IWL_LED_BLINK(0) using blinking index table */ +/* default: IL_LED_BLINK(0) using blinking index table */ static int led_mode; module_param(led_mode, int, S_IRUGO); MODULE_PARM_DESC(led_mode, "0=system default, " @@ -60,7 +60,7 @@ MODULE_PARM_DESC(led_mode, "0=system default, " * >0 to 1 167 167 * <=0 SOLID ON */ -static const struct ieee80211_tpt_blink iwl_blink[] = { +static const struct ieee80211_tpt_blink il_blink[] = { { .throughput = 0, .blink_time = 334 }, { .throughput = 1 * 1024 - 1, .blink_time = 260 }, { .throughput = 5 * 1024 - 1, .blink_time = 220 }, @@ -84,11 +84,11 @@ static const struct ieee80211_tpt_blink iwl_blink[] = { * compensation = (100 - averageDeviation) * 64 / 100 * NewBlinkTime = (compensation * BlinkTime) / 64 */ -static inline u8 iwl_legacy_blink_compensation(struct iwl_priv *priv, +static inline u8 il_blink_compensation(struct il_priv *priv, u8 time, u16 compensation) { if (!compensation) { - IWL_ERR(priv, "undefined blink compensation: " + IL_ERR(priv, "undefined blink compensation: " "use pre-defined blinking time\n"); return time; } @@ -97,13 +97,13 @@ static inline u8 iwl_legacy_blink_compensation(struct iwl_priv *priv, } /* Set led pattern command */ -static int iwl_legacy_led_cmd(struct iwl_priv *priv, +static int il_led_cmd(struct il_priv *priv, unsigned long on, unsigned long off) { - struct iwl_led_cmd led_cmd = { - .id = IWL_LED_LINK, - .interval = IWL_DEF_LED_INTRVL + struct il_led_cmd led_cmd = { + .id = IL_LED_LINK, + .interval = IL_DEF_LED_INTRVL }; int ret; @@ -115,14 +115,14 @@ static int iwl_legacy_led_cmd(struct iwl_priv *priv, if (off == 0) { /* led is SOLID_ON */ - on = IWL_LED_SOLID; + on = IL_LED_SOLID; } - IWL_DEBUG_LED(priv, "Led blink time compensation=%u\n", + IL_DEBUG_LED(priv, "Led blink time compensation=%u\n", priv->cfg->base_params->led_compensation); - led_cmd.on = iwl_legacy_blink_compensation(priv, on, + led_cmd.on = il_blink_compensation(priv, on, priv->cfg->base_params->led_compensation); - led_cmd.off = iwl_legacy_blink_compensation(priv, off, + led_cmd.off = il_blink_compensation(priv, off, priv->cfg->base_params->led_compensation); ret = priv->cfg->ops->led->cmd(priv, &led_cmd); @@ -133,52 +133,52 @@ static int iwl_legacy_led_cmd(struct iwl_priv *priv, return ret; } -static void iwl_legacy_led_brightness_set(struct led_classdev *led_cdev, +static void il_led_brightness_set(struct led_classdev *led_cdev, enum led_brightness brightness) { - struct iwl_priv *priv = container_of(led_cdev, struct iwl_priv, led); + struct il_priv *priv = container_of(led_cdev, struct il_priv, led); unsigned long on = 0; if (brightness > 0) - on = IWL_LED_SOLID; + on = IL_LED_SOLID; - iwl_legacy_led_cmd(priv, on, 0); + il_led_cmd(priv, on, 0); } -static int iwl_legacy_led_blink_set(struct led_classdev *led_cdev, +static int il_led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on, unsigned long *delay_off) { - struct iwl_priv *priv = container_of(led_cdev, struct iwl_priv, led); + struct il_priv *priv = container_of(led_cdev, struct il_priv, led); - return iwl_legacy_led_cmd(priv, *delay_on, *delay_off); + return il_led_cmd(priv, *delay_on, *delay_off); } -void iwl_legacy_leds_init(struct iwl_priv *priv) +void il_leds_init(struct il_priv *priv) { int mode = led_mode; int ret; - if (mode == IWL_LED_DEFAULT) + if (mode == IL_LED_DEFAULT) mode = priv->cfg->led_mode; priv->led.name = kasprintf(GFP_KERNEL, "%s-led", wiphy_name(priv->hw->wiphy)); - priv->led.brightness_set = iwl_legacy_led_brightness_set; - priv->led.blink_set = iwl_legacy_led_blink_set; + priv->led.brightness_set = il_led_brightness_set; + priv->led.blink_set = il_led_blink_set; priv->led.max_brightness = 1; switch (mode) { - case IWL_LED_DEFAULT: + case IL_LED_DEFAULT: WARN_ON(1); break; - case IWL_LED_BLINK: + case IL_LED_BLINK: priv->led.default_trigger = ieee80211_create_tpt_led_trigger(priv->hw, IEEE80211_TPT_LEDTRIG_FL_CONNECTED, - iwl_blink, ARRAY_SIZE(iwl_blink)); + il_blink, ARRAY_SIZE(il_blink)); break; - case IWL_LED_RF_STATE: + case IL_LED_RF_STATE: priv->led.default_trigger = ieee80211_get_radio_led_name(priv->hw); break; @@ -192,9 +192,9 @@ void iwl_legacy_leds_init(struct iwl_priv *priv) priv->led_registered = true; } -EXPORT_SYMBOL(iwl_legacy_leds_init); +EXPORT_SYMBOL(il_leds_init); -void iwl_legacy_leds_exit(struct iwl_priv *priv) +void il_leds_exit(struct il_priv *priv) { if (!priv->led_registered) return; @@ -202,4 +202,4 @@ void iwl_legacy_leds_exit(struct iwl_priv *priv) led_classdev_unregister(&priv->led); kfree(priv->led.name); } -EXPORT_SYMBOL(iwl_legacy_leds_exit); +EXPORT_SYMBOL(il_leds_exit); diff --git a/drivers/net/wireless/iwlegacy/iwl-led.h b/drivers/net/wireless/iwlegacy/iwl-led.h index f0791f7..ea7a8ea 100644 --- a/drivers/net/wireless/iwlegacy/iwl-led.h +++ b/drivers/net/wireless/iwlegacy/iwl-led.h @@ -24,33 +24,33 @@ * *****************************************************************************/ -#ifndef __iwl_legacy_leds_h__ -#define __iwl_legacy_leds_h__ +#ifndef __il_leds_h__ +#define __il_leds_h__ -struct iwl_priv; +struct il_priv; -#define IWL_LED_SOLID 11 -#define IWL_DEF_LED_INTRVL cpu_to_le32(1000) +#define IL_LED_SOLID 11 +#define IL_DEF_LED_INTRVL cpu_to_le32(1000) -#define IWL_LED_ACTIVITY (0<<1) -#define IWL_LED_LINK (1<<1) +#define IL_LED_ACTIVITY (0<<1) +#define IL_LED_LINK (1<<1) /* * LED mode - * IWL_LED_DEFAULT: use device default - * IWL_LED_RF_STATE: turn LED on/off based on RF state + * IL_LED_DEFAULT: use device default + * IL_LED_RF_STATE: turn LED on/off based on RF state * LED ON = RF ON * LED OFF = RF OFF - * IWL_LED_BLINK: adjust led blink rate based on blink table + * IL_LED_BLINK: adjust led blink rate based on blink table */ -enum iwl_led_mode { - IWL_LED_DEFAULT, - IWL_LED_RF_STATE, - IWL_LED_BLINK, +enum il_led_mode { + IL_LED_DEFAULT, + IL_LED_RF_STATE, + IL_LED_BLINK, }; -void iwl_legacy_leds_init(struct iwl_priv *priv); -void iwl_legacy_leds_exit(struct iwl_priv *priv); +void il_leds_init(struct il_priv *priv); +void il_leds_exit(struct il_priv *priv); -#endif /* __iwl_legacy_leds_h__ */ +#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 38647e4..72ef91e 100644 --- a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h +++ b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h @@ -24,14 +24,14 @@ * *****************************************************************************/ -#ifndef __iwl_legacy_rs_h__ -#define __iwl_legacy_rs_h__ - -struct iwl_rate_info { - u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ - u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */ - u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */ - u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ +#ifndef __il_rs_h__ +#define __il_rs_h__ + +struct il_rate_info { + u8 plcp; /* uCode API: IL_RATE_6M_PLCP, etc. */ + u8 plcp_siso; /* uCode API: IL_RATE_SISO_6M_PLCP, etc. */ + u8 plcp_mimo2; /* uCode API: IL_RATE_MIMO2_6M_PLCP, etc. */ + u8 ieee; /* MAC header: IL_RATE_6M_IEEE, etc. */ u8 prev_ieee; /* previous rate in IEEE speeds */ u8 next_ieee; /* next rate in IEEE speeds */ u8 prev_rs; /* previous rate used in rs algo */ @@ -40,9 +40,9 @@ struct iwl_rate_info { u8 next_rs_tgg; /* next rate used in TGG rs algo */ }; -struct iwl3945_rate_info { - u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ - u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ +struct il3945_rate_info { + u8 plcp; /* uCode API: IL_RATE_6M_PLCP, etc. */ + u8 ieee; /* MAC header: IL_RATE_6M_IEEE, etc. */ u8 prev_ieee; /* previous rate in IEEE speeds */ u8 next_ieee; /* next rate in IEEE speeds */ u8 prev_rs; /* previous rate used in rs algo */ @@ -56,210 +56,210 @@ struct iwl3945_rate_info { /* * These serve as indexes into - * struct iwl_rate_info iwlegacy_rates[IWL_RATE_COUNT]; + * struct il_rate_info iwlegacy_rates[IL_RATE_COUNT]; */ enum { - IWL_RATE_1M_INDEX = 0, - IWL_RATE_2M_INDEX, - IWL_RATE_5M_INDEX, - IWL_RATE_11M_INDEX, - IWL_RATE_6M_INDEX, - IWL_RATE_9M_INDEX, - IWL_RATE_12M_INDEX, - IWL_RATE_18M_INDEX, - IWL_RATE_24M_INDEX, - IWL_RATE_36M_INDEX, - IWL_RATE_48M_INDEX, - IWL_RATE_54M_INDEX, - IWL_RATE_60M_INDEX, - IWL_RATE_COUNT, - IWL_RATE_COUNT_LEGACY = IWL_RATE_COUNT - 1, /* Excluding 60M */ - IWL_RATE_COUNT_3945 = IWL_RATE_COUNT - 1, - IWL_RATE_INVM_INDEX = IWL_RATE_COUNT, - IWL_RATE_INVALID = IWL_RATE_COUNT, + IL_RATE_1M_INDEX = 0, + IL_RATE_2M_INDEX, + IL_RATE_5M_INDEX, + IL_RATE_11M_INDEX, + IL_RATE_6M_INDEX, + IL_RATE_9M_INDEX, + IL_RATE_12M_INDEX, + IL_RATE_18M_INDEX, + IL_RATE_24M_INDEX, + IL_RATE_36M_INDEX, + IL_RATE_48M_INDEX, + IL_RATE_54M_INDEX, + IL_RATE_60M_INDEX, + IL_RATE_COUNT, + IL_RATE_COUNT_LEGACY = IL_RATE_COUNT - 1, /* Excluding 60M */ + IL_RATE_COUNT_3945 = IL_RATE_COUNT - 1, + IL_RATE_INVM_INDEX = IL_RATE_COUNT, + IL_RATE_INVALID = IL_RATE_COUNT, }; enum { - IWL_RATE_6M_INDEX_TABLE = 0, - IWL_RATE_9M_INDEX_TABLE, - IWL_RATE_12M_INDEX_TABLE, - IWL_RATE_18M_INDEX_TABLE, - IWL_RATE_24M_INDEX_TABLE, - IWL_RATE_36M_INDEX_TABLE, - IWL_RATE_48M_INDEX_TABLE, - IWL_RATE_54M_INDEX_TABLE, - IWL_RATE_1M_INDEX_TABLE, - IWL_RATE_2M_INDEX_TABLE, - IWL_RATE_5M_INDEX_TABLE, - IWL_RATE_11M_INDEX_TABLE, - IWL_RATE_INVM_INDEX_TABLE = IWL_RATE_INVM_INDEX - 1, + IL_RATE_6M_INDEX_TABLE = 0, + IL_RATE_9M_INDEX_TABLE, + IL_RATE_12M_INDEX_TABLE, + IL_RATE_18M_INDEX_TABLE, + IL_RATE_24M_INDEX_TABLE, + IL_RATE_36M_INDEX_TABLE, + IL_RATE_48M_INDEX_TABLE, + IL_RATE_54M_INDEX_TABLE, + IL_RATE_1M_INDEX_TABLE, + IL_RATE_2M_INDEX_TABLE, + IL_RATE_5M_INDEX_TABLE, + IL_RATE_11M_INDEX_TABLE, + IL_RATE_INVM_INDEX_TABLE = IL_RATE_INVM_INDEX - 1, }; enum { - IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX, - IWL39_LAST_OFDM_RATE = IWL_RATE_54M_INDEX, - IWL_LAST_OFDM_RATE = IWL_RATE_60M_INDEX, - IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX, - IWL_LAST_CCK_RATE = IWL_RATE_11M_INDEX, + IL_FIRST_OFDM_RATE = IL_RATE_6M_INDEX, + IWL39_LAST_OFDM_RATE = IL_RATE_54M_INDEX, + IL_LAST_OFDM_RATE = IL_RATE_60M_INDEX, + IL_FIRST_CCK_RATE = IL_RATE_1M_INDEX, + IL_LAST_CCK_RATE = IL_RATE_11M_INDEX, }; /* #define vs. enum to keep from defaulting to 'large integer' */ -#define IWL_RATE_6M_MASK (1 << IWL_RATE_6M_INDEX) -#define IWL_RATE_9M_MASK (1 << IWL_RATE_9M_INDEX) -#define IWL_RATE_12M_MASK (1 << IWL_RATE_12M_INDEX) -#define IWL_RATE_18M_MASK (1 << IWL_RATE_18M_INDEX) -#define IWL_RATE_24M_MASK (1 << IWL_RATE_24M_INDEX) -#define IWL_RATE_36M_MASK (1 << IWL_RATE_36M_INDEX) -#define IWL_RATE_48M_MASK (1 << IWL_RATE_48M_INDEX) -#define IWL_RATE_54M_MASK (1 << IWL_RATE_54M_INDEX) -#define IWL_RATE_60M_MASK (1 << IWL_RATE_60M_INDEX) -#define IWL_RATE_1M_MASK (1 << IWL_RATE_1M_INDEX) -#define IWL_RATE_2M_MASK (1 << IWL_RATE_2M_INDEX) -#define IWL_RATE_5M_MASK (1 << IWL_RATE_5M_INDEX) -#define IWL_RATE_11M_MASK (1 << IWL_RATE_11M_INDEX) +#define IL_RATE_6M_MASK (1 << IL_RATE_6M_INDEX) +#define IL_RATE_9M_MASK (1 << IL_RATE_9M_INDEX) +#define IL_RATE_12M_MASK (1 << IL_RATE_12M_INDEX) +#define IL_RATE_18M_MASK (1 << IL_RATE_18M_INDEX) +#define IL_RATE_24M_MASK (1 << IL_RATE_24M_INDEX) +#define IL_RATE_36M_MASK (1 << IL_RATE_36M_INDEX) +#define IL_RATE_48M_MASK (1 << IL_RATE_48M_INDEX) +#define IL_RATE_54M_MASK (1 << IL_RATE_54M_INDEX) +#define IL_RATE_60M_MASK (1 << IL_RATE_60M_INDEX) +#define IL_RATE_1M_MASK (1 << IL_RATE_1M_INDEX) +#define IL_RATE_2M_MASK (1 << IL_RATE_2M_INDEX) +#define IL_RATE_5M_MASK (1 << IL_RATE_5M_INDEX) +#define IL_RATE_11M_MASK (1 << IL_RATE_11M_INDEX) /* uCode API values for legacy bit rates, both OFDM and CCK */ enum { - IWL_RATE_6M_PLCP = 13, - IWL_RATE_9M_PLCP = 15, - IWL_RATE_12M_PLCP = 5, - IWL_RATE_18M_PLCP = 7, - IWL_RATE_24M_PLCP = 9, - IWL_RATE_36M_PLCP = 11, - IWL_RATE_48M_PLCP = 1, - IWL_RATE_54M_PLCP = 3, - IWL_RATE_60M_PLCP = 3,/*FIXME:RS:should be removed*/ - IWL_RATE_1M_PLCP = 10, - IWL_RATE_2M_PLCP = 20, - IWL_RATE_5M_PLCP = 55, - IWL_RATE_11M_PLCP = 110, - /*FIXME:RS:add IWL_RATE_LEGACY_INVM_PLCP = 0,*/ + IL_RATE_6M_PLCP = 13, + IL_RATE_9M_PLCP = 15, + IL_RATE_12M_PLCP = 5, + IL_RATE_18M_PLCP = 7, + IL_RATE_24M_PLCP = 9, + IL_RATE_36M_PLCP = 11, + IL_RATE_48M_PLCP = 1, + IL_RATE_54M_PLCP = 3, + IL_RATE_60M_PLCP = 3,/*FIXME:RS:should be removed*/ + IL_RATE_1M_PLCP = 10, + IL_RATE_2M_PLCP = 20, + IL_RATE_5M_PLCP = 55, + IL_RATE_11M_PLCP = 110, + /*FIXME:RS:add IL_RATE_LEGACY_INVM_PLCP = 0,*/ }; /* uCode API values for OFDM high-throughput (HT) bit rates */ enum { - IWL_RATE_SISO_6M_PLCP = 0, - IWL_RATE_SISO_12M_PLCP = 1, - IWL_RATE_SISO_18M_PLCP = 2, - IWL_RATE_SISO_24M_PLCP = 3, - IWL_RATE_SISO_36M_PLCP = 4, - IWL_RATE_SISO_48M_PLCP = 5, - IWL_RATE_SISO_54M_PLCP = 6, - IWL_RATE_SISO_60M_PLCP = 7, - IWL_RATE_MIMO2_6M_PLCP = 0x8, - IWL_RATE_MIMO2_12M_PLCP = 0x9, - IWL_RATE_MIMO2_18M_PLCP = 0xa, - IWL_RATE_MIMO2_24M_PLCP = 0xb, - IWL_RATE_MIMO2_36M_PLCP = 0xc, - IWL_RATE_MIMO2_48M_PLCP = 0xd, - IWL_RATE_MIMO2_54M_PLCP = 0xe, - IWL_RATE_MIMO2_60M_PLCP = 0xf, - IWL_RATE_SISO_INVM_PLCP, - IWL_RATE_MIMO2_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP, + IL_RATE_SISO_6M_PLCP = 0, + IL_RATE_SISO_12M_PLCP = 1, + IL_RATE_SISO_18M_PLCP = 2, + IL_RATE_SISO_24M_PLCP = 3, + IL_RATE_SISO_36M_PLCP = 4, + IL_RATE_SISO_48M_PLCP = 5, + IL_RATE_SISO_54M_PLCP = 6, + IL_RATE_SISO_60M_PLCP = 7, + IL_RATE_MIMO2_6M_PLCP = 0x8, + IL_RATE_MIMO2_12M_PLCP = 0x9, + IL_RATE_MIMO2_18M_PLCP = 0xa, + IL_RATE_MIMO2_24M_PLCP = 0xb, + IL_RATE_MIMO2_36M_PLCP = 0xc, + IL_RATE_MIMO2_48M_PLCP = 0xd, + IL_RATE_MIMO2_54M_PLCP = 0xe, + IL_RATE_MIMO2_60M_PLCP = 0xf, + IL_RATE_SISO_INVM_PLCP, + IL_RATE_MIMO2_INVM_PLCP = IL_RATE_SISO_INVM_PLCP, }; /* MAC header values for bit rates */ enum { - IWL_RATE_6M_IEEE = 12, - IWL_RATE_9M_IEEE = 18, - IWL_RATE_12M_IEEE = 24, - IWL_RATE_18M_IEEE = 36, - IWL_RATE_24M_IEEE = 48, - IWL_RATE_36M_IEEE = 72, - IWL_RATE_48M_IEEE = 96, - IWL_RATE_54M_IEEE = 108, - IWL_RATE_60M_IEEE = 120, - IWL_RATE_1M_IEEE = 2, - IWL_RATE_2M_IEEE = 4, - IWL_RATE_5M_IEEE = 11, - IWL_RATE_11M_IEEE = 22, + IL_RATE_6M_IEEE = 12, + IL_RATE_9M_IEEE = 18, + IL_RATE_12M_IEEE = 24, + IL_RATE_18M_IEEE = 36, + IL_RATE_24M_IEEE = 48, + IL_RATE_36M_IEEE = 72, + IL_RATE_48M_IEEE = 96, + IL_RATE_54M_IEEE = 108, + IL_RATE_60M_IEEE = 120, + IL_RATE_1M_IEEE = 2, + IL_RATE_2M_IEEE = 4, + IL_RATE_5M_IEEE = 11, + IL_RATE_11M_IEEE = 22, }; -#define IWL_CCK_BASIC_RATES_MASK \ - (IWL_RATE_1M_MASK | \ - IWL_RATE_2M_MASK) +#define IL_CCK_BASIC_RATES_MASK \ + (IL_RATE_1M_MASK | \ + IL_RATE_2M_MASK) -#define IWL_CCK_RATES_MASK \ - (IWL_CCK_BASIC_RATES_MASK | \ - IWL_RATE_5M_MASK | \ - IWL_RATE_11M_MASK) +#define IL_CCK_RATES_MASK \ + (IL_CCK_BASIC_RATES_MASK | \ + IL_RATE_5M_MASK | \ + IL_RATE_11M_MASK) -#define IWL_OFDM_BASIC_RATES_MASK \ - (IWL_RATE_6M_MASK | \ - IWL_RATE_12M_MASK | \ - IWL_RATE_24M_MASK) +#define IL_OFDM_BASIC_RATES_MASK \ + (IL_RATE_6M_MASK | \ + IL_RATE_12M_MASK | \ + IL_RATE_24M_MASK) -#define IWL_OFDM_RATES_MASK \ - (IWL_OFDM_BASIC_RATES_MASK | \ - IWL_RATE_9M_MASK | \ - IWL_RATE_18M_MASK | \ - IWL_RATE_36M_MASK | \ - IWL_RATE_48M_MASK | \ - IWL_RATE_54M_MASK) +#define IL_OFDM_RATES_MASK \ + (IL_OFDM_BASIC_RATES_MASK | \ + IL_RATE_9M_MASK | \ + IL_RATE_18M_MASK | \ + IL_RATE_36M_MASK | \ + IL_RATE_48M_MASK | \ + IL_RATE_54M_MASK) -#define IWL_BASIC_RATES_MASK \ - (IWL_OFDM_BASIC_RATES_MASK | \ - IWL_CCK_BASIC_RATES_MASK) +#define IL_BASIC_RATES_MASK \ + (IL_OFDM_BASIC_RATES_MASK | \ + IL_CCK_BASIC_RATES_MASK) -#define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1) -#define IWL_RATES_MASK_3945 ((1 << IWL_RATE_COUNT_3945) - 1) +#define IL_RATES_MASK ((1 << IL_RATE_COUNT) - 1) +#define IL_RATES_MASK_3945 ((1 << IL_RATE_COUNT_3945) - 1) -#define IWL_INVALID_VALUE -1 +#define IL_INVALID_VALUE -1 -#define IWL_MIN_RSSI_VAL -100 -#define IWL_MAX_RSSI_VAL 0 +#define IL_MIN_RSSI_VAL -100 +#define IL_MAX_RSSI_VAL 0 /* These values specify how many Tx frame attempts before * searching for a new modulation mode */ -#define IWL_LEGACY_FAILURE_LIMIT 160 -#define IWL_LEGACY_SUCCESS_LIMIT 480 -#define IWL_LEGACY_TABLE_COUNT 160 +#define IL_LEGACY_FAILURE_LIMIT 160 +#define IL_LEGACY_SUCCESS_LIMIT 480 +#define IL_LEGACY_TABLE_COUNT 160 -#define IWL_NONE_LEGACY_FAILURE_LIMIT 400 -#define IWL_NONE_LEGACY_SUCCESS_LIMIT 4500 -#define IWL_NONE_LEGACY_TABLE_COUNT 1500 +#define IL_NONE_LEGACY_FAILURE_LIMIT 400 +#define IL_NONE_LEGACY_SUCCESS_LIMIT 4500 +#define IL_NONE_LEGACY_TABLE_COUNT 1500 /* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */ -#define IWL_RS_GOOD_RATIO 12800 /* 100% */ -#define IWL_RATE_SCALE_SWITCH 10880 /* 85% */ -#define IWL_RATE_HIGH_TH 10880 /* 85% */ -#define IWL_RATE_INCREASE_TH 6400 /* 50% */ -#define IWL_RATE_DECREASE_TH 1920 /* 15% */ +#define IL_RS_GOOD_RATIO 12800 /* 100% */ +#define IL_RATE_SCALE_SWITCH 10880 /* 85% */ +#define IL_RATE_HIGH_TH 10880 /* 85% */ +#define IL_RATE_INCREASE_TH 6400 /* 50% */ +#define IL_RATE_DECREASE_TH 1920 /* 15% */ /* possible actions when in legacy mode */ -#define IWL_LEGACY_SWITCH_ANTENNA1 0 -#define IWL_LEGACY_SWITCH_ANTENNA2 1 -#define IWL_LEGACY_SWITCH_SISO 2 -#define IWL_LEGACY_SWITCH_MIMO2_AB 3 -#define IWL_LEGACY_SWITCH_MIMO2_AC 4 -#define IWL_LEGACY_SWITCH_MIMO2_BC 5 +#define IL_LEGACY_SWITCH_ANTENNA1 0 +#define IL_LEGACY_SWITCH_ANTENNA2 1 +#define IL_LEGACY_SWITCH_SISO 2 +#define IL_LEGACY_SWITCH_MIMO2_AB 3 +#define IL_LEGACY_SWITCH_MIMO2_AC 4 +#define IL_LEGACY_SWITCH_MIMO2_BC 5 /* possible actions when in siso mode */ -#define IWL_SISO_SWITCH_ANTENNA1 0 -#define IWL_SISO_SWITCH_ANTENNA2 1 -#define IWL_SISO_SWITCH_MIMO2_AB 2 -#define IWL_SISO_SWITCH_MIMO2_AC 3 -#define IWL_SISO_SWITCH_MIMO2_BC 4 -#define IWL_SISO_SWITCH_GI 5 +#define IL_SISO_SWITCH_ANTENNA1 0 +#define IL_SISO_SWITCH_ANTENNA2 1 +#define IL_SISO_SWITCH_MIMO2_AB 2 +#define IL_SISO_SWITCH_MIMO2_AC 3 +#define IL_SISO_SWITCH_MIMO2_BC 4 +#define IL_SISO_SWITCH_GI 5 /* possible actions when in mimo mode */ -#define IWL_MIMO2_SWITCH_ANTENNA1 0 -#define IWL_MIMO2_SWITCH_ANTENNA2 1 -#define IWL_MIMO2_SWITCH_SISO_A 2 -#define IWL_MIMO2_SWITCH_SISO_B 3 -#define IWL_MIMO2_SWITCH_SISO_C 4 -#define IWL_MIMO2_SWITCH_GI 5 +#define IL_MIMO2_SWITCH_ANTENNA1 0 +#define IL_MIMO2_SWITCH_ANTENNA2 1 +#define IL_MIMO2_SWITCH_SISO_A 2 +#define IL_MIMO2_SWITCH_SISO_B 3 +#define IL_MIMO2_SWITCH_SISO_C 4 +#define IL_MIMO2_SWITCH_GI 5 -#define IWL_MAX_SEARCH IWL_MIMO2_SWITCH_GI +#define IL_MAX_SEARCH IL_MIMO2_SWITCH_GI -#define IWL_ACTION_LIMIT 3 /* # possible actions */ +#define IL_ACTION_LIMIT 3 /* # possible actions */ #define LQ_SIZE 2 /* 2 mode tables: "Active" and "Search" */ /* load per tid defines for A-MPDU activation */ -#define IWL_AGG_TPT_THREHOLD 0 -#define IWL_AGG_LOAD_THRESHOLD 10 -#define IWL_AGG_ALL_TID 0xff +#define IL_AGG_TPT_THREHOLD 0 +#define IL_AGG_LOAD_THRESHOLD 10 +#define IL_AGG_ALL_TID 0xff #define TID_QUEUE_CELL_SPACING 50 /*mS */ #define TID_QUEUE_MAX_SIZE 20 #define TID_ROUND_VALUE 5 /* mS */ @@ -268,9 +268,9 @@ enum { #define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING) #define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y)) -extern const struct iwl_rate_info iwlegacy_rates[IWL_RATE_COUNT]; +extern const struct il_rate_info iwlegacy_rates[IL_RATE_COUNT]; -enum iwl_table_type { +enum il_table_type { LQ_NONE, LQ_G, /* legacy types */ LQ_A, @@ -296,17 +296,17 @@ enum iwl_table_type { #define ANT_BC (ANT_B | ANT_C) #define ANT_ABC (ANT_AB | ANT_C) -#define IWL_MAX_MCS_DISPLAY_SIZE 12 +#define IL_MAX_MCS_DISPLAY_SIZE 12 -struct iwl_rate_mcs_info { - char mbps[IWL_MAX_MCS_DISPLAY_SIZE]; - char mcs[IWL_MAX_MCS_DISPLAY_SIZE]; +struct il_rate_mcs_info { + char mbps[IL_MAX_MCS_DISPLAY_SIZE]; + char mcs[IL_MAX_MCS_DISPLAY_SIZE]; }; /** - * struct iwl_rate_scale_data -- tx success history for one rate + * struct il_rate_scale_data -- tx success history for one rate */ -struct iwl_rate_scale_data { +struct il_rate_scale_data { u64 data; /* bitmap of successful frames */ s32 success_counter; /* number of frames successful */ s32 success_ratio; /* per-cent * 128 */ @@ -316,25 +316,25 @@ struct iwl_rate_scale_data { }; /** - * struct iwl_scale_tbl_info -- tx params and success history for all rates + * struct il_scale_tbl_info -- tx params and success history for all rates * - * There are two of these in struct iwl_lq_sta, + * There are two of these in struct il_lq_sta, * one for "active", and one for "search". */ -struct iwl_scale_tbl_info { - enum iwl_table_type lq_type; +struct il_scale_tbl_info { + enum il_table_type lq_type; u8 ant_type; u8 is_SGI; /* 1 = short guard interval */ u8 is_ht40; /* 1 = 40 MHz channel width */ u8 is_dup; /* 1 = duplicated data streams */ - u8 action; /* change modulation; IWL_[LEGACY/SISO/MIMO]_SWITCH_* */ + u8 action; /* change modulation; IL_[LEGACY/SISO/MIMO]_SWITCH_* */ u8 max_search; /* maximun number of tables we can search */ s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ u32 current_rate; /* rate_n_flags, uCode API format */ - struct iwl_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ + struct il_rate_scale_data win[IL_RATE_COUNT]; /* rate histories */ }; -struct iwl_traffic_load { +struct il_traffic_load { unsigned long time_stamp; /* age of the oldest statistics */ u32 packet_count[TID_QUEUE_MAX_SIZE]; /* packet count in this time * slice */ @@ -346,11 +346,11 @@ struct iwl_traffic_load { }; /** - * struct iwl_lq_sta -- driver's rate scaling private structure + * struct il_lq_sta -- driver's rate scaling private structure * * Pointer to this gets passed back and forth between driver and mac80211. */ -struct iwl_lq_sta { +struct il_lq_sta { u8 active_tbl; /* index of active table, range 0-1 */ u8 enable_counter; /* indicates HT mode */ u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */ @@ -371,7 +371,7 @@ struct iwl_lq_sta { u8 is_dup; enum ieee80211_band band; - /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ + /* The following are bitmaps of rates; IL_RATE_6M_MASK, etc. */ u32 supp_rates; u16 active_legacy_rate; u16 active_siso_rate; @@ -379,9 +379,9 @@ struct iwl_lq_sta { s8 max_rate_idx; /* Max rate set by user */ u8 missed_rate_counter; - struct iwl_link_quality_cmd lq; - struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ - struct iwl_traffic_load load[TID_MAX_LOAD_COUNT]; + struct il_link_quality_cmd lq; + struct il_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ + struct il_traffic_load load[TID_MAX_LOAD_COUNT]; u8 tx_agg_tid_en; #ifdef CONFIG_MAC80211_DEBUGFS struct dentry *rs_sta_dbgfs_scale_table_file; @@ -390,7 +390,7 @@ struct iwl_lq_sta { struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; u32 dbg_fixed_rate; #endif - struct iwl_priv *drv; + struct il_priv *drv; /* used to be in sta_info */ int last_txrate_idx; @@ -400,14 +400,14 @@ struct iwl_lq_sta { u8 is_agg; }; -static inline u8 iwl4965_num_of_ant(u8 mask) +static inline u8 il4965_num_of_ant(u8 mask) { return !!((mask) & ANT_A) + !!((mask) & ANT_B) + !!((mask) & ANT_C); } -static inline u8 iwl4965_first_antenna(u8 mask) +static inline u8 il4965_first_antenna(u8 mask) { if (mask & ANT_A) return ANT_A; @@ -418,39 +418,39 @@ static inline u8 iwl4965_first_antenna(u8 mask) /** - * iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info + * il3945_rate_scale_init - Initialize the rate scale table based on assoc info * * The specific throughput table used is based on the type of network * the associated with, including A, B, G, and G w/ TGG protection */ -extern void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); +extern void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); /* Initialize station's rate scaling information after adding station */ -extern void iwl4965_rs_rate_init(struct iwl_priv *priv, +extern void il4965_rs_rate_init(struct il_priv *priv, struct ieee80211_sta *sta, u8 sta_id); -extern void iwl3945_rs_rate_init(struct iwl_priv *priv, +extern void il3945_rs_rate_init(struct il_priv *priv, struct ieee80211_sta *sta, u8 sta_id); /** - * iwl_rate_control_register - Register the rate control algorithm callbacks + * il_rate_control_register - Register the rate control algorithm callbacks * * Since the rate control algorithm is hardware specific, there is no need * or reason to place it as a stand alone module. The driver can call - * iwl_rate_control_register in order to register the rate control callbacks + * il_rate_control_register in order to register the rate control callbacks * with the mac80211 subsystem. This should be performed prior to calling * ieee80211_register_hw * */ -extern int iwl4965_rate_control_register(void); -extern int iwl3945_rate_control_register(void); +extern int il4965_rate_control_register(void); +extern int il3945_rate_control_register(void); /** - * iwl_rate_control_unregister - Unregister the rate control callbacks + * il_rate_control_unregister - Unregister the rate control callbacks * * This should be called after calling ieee80211_unregister_hw, but before * the driver is unloaded. */ -extern void iwl4965_rate_control_unregister(void); -extern void iwl3945_rate_control_unregister(void); +extern void il4965_rate_control_unregister(void); +extern void il3945_rate_control_unregister(void); -#endif /* __iwl_legacy_rs__ */ +#endif /* __il_rs__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-power.c b/drivers/net/wireless/iwlegacy/iwl-power.c index 903ef0d..7ccff25 100644 --- a/drivers/net/wireless/iwlegacy/iwl-power.c +++ b/drivers/net/wireless/iwlegacy/iwl-power.c @@ -55,32 +55,32 @@ * (level 1) and for thermal throttle (levels 3 through 5) */ -struct iwl_power_vec_entry { - struct iwl_powertable_cmd cmd; +struct il_power_vec_entry { + struct il_powertable_cmd cmd; u8 no_dtim; /* number of skip dtim */ }; -static void iwl_legacy_power_sleep_cam_cmd(struct iwl_priv *priv, - struct iwl_powertable_cmd *cmd) +static void il_power_sleep_cam_cmd(struct il_priv *priv, + struct il_powertable_cmd *cmd) { memset(cmd, 0, sizeof(*cmd)); if (priv->power_data.pci_pm) - cmd->flags |= IWL_POWER_PCI_PM_MSK; + cmd->flags |= IL_POWER_PCI_PM_MSK; - IWL_DEBUG_POWER(priv, "Sleep command for CAM\n"); + IL_DEBUG_POWER(priv, "Sleep command for CAM\n"); } static int -iwl_legacy_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd) +il_set_power(struct il_priv *priv, struct il_powertable_cmd *cmd) { - IWL_DEBUG_POWER(priv, "Sending power/sleep command\n"); - IWL_DEBUG_POWER(priv, "Flags value = 0x%08X\n", cmd->flags); - IWL_DEBUG_POWER(priv, "Tx timeout = %u\n", + IL_DEBUG_POWER(priv, "Sending power/sleep command\n"); + IL_DEBUG_POWER(priv, "Flags value = 0x%08X\n", cmd->flags); + IL_DEBUG_POWER(priv, "Tx timeout = %u\n", le32_to_cpu(cmd->tx_data_timeout)); - IWL_DEBUG_POWER(priv, "Rx timeout = %u\n", + IL_DEBUG_POWER(priv, "Rx timeout = %u\n", le32_to_cpu(cmd->rx_data_timeout)); - IWL_DEBUG_POWER(priv, + IL_DEBUG_POWER(priv, "Sleep interval vector = { %d , %d , %d , %d , %d }\n", le32_to_cpu(cmd->sleep_interval[0]), le32_to_cpu(cmd->sleep_interval[1]), @@ -88,12 +88,12 @@ iwl_legacy_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd) le32_to_cpu(cmd->sleep_interval[3]), le32_to_cpu(cmd->sleep_interval[4])); - return iwl_legacy_send_cmd_pdu(priv, POWER_TABLE_CMD, - sizeof(struct iwl_powertable_cmd), cmd); + return il_send_cmd_pdu(priv, POWER_TABLE_CMD, + sizeof(struct il_powertable_cmd), cmd); } int -iwl_legacy_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, +il_power_set_mode(struct il_priv *priv, struct il_powertable_cmd *cmd, bool force) { int ret; @@ -102,58 +102,58 @@ iwl_legacy_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, lockdep_assert_held(&priv->mutex); /* Don't update the RX chain when chain noise calibration is running */ - update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || - priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE; + update_chains = priv->chain_noise_data.state == IL_CHAIN_NOISE_DONE || + priv->chain_noise_data.state == IL_CHAIN_NOISE_ALIVE; if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force) return 0; - if (!iwl_legacy_is_ready_rf(priv)) + if (!il_is_ready_rf(priv)) return -EIO; /* scan complete use sleep_power_next, need to be updated */ memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd)); if (test_bit(STATUS_SCANNING, &priv->status) && !force) { - IWL_DEBUG_INFO(priv, "Defer power set mode while scanning\n"); + IL_DEBUG_INFO(priv, "Defer power set mode while scanning\n"); return 0; } - if (cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK) + if (cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK) set_bit(STATUS_POWER_PMI, &priv->status); - ret = iwl_legacy_set_power(priv, cmd); + ret = il_set_power(priv, cmd); if (!ret) { - if (!(cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK)) + if (!(cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK)) clear_bit(STATUS_POWER_PMI, &priv->status); if (priv->cfg->ops->lib->update_chain_flags && update_chains) priv->cfg->ops->lib->update_chain_flags(priv); else if (priv->cfg->ops->lib->update_chain_flags) - IWL_DEBUG_POWER(priv, + IL_DEBUG_POWER(priv, "Cannot update the power, chain noise " "calibration running: %d\n", priv->chain_noise_data.state); memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)); } else - IWL_ERR(priv, "set power fail, ret = %d", ret); + IL_ERR(priv, "set power fail, ret = %d", ret); return ret; } -int iwl_legacy_power_update_mode(struct iwl_priv *priv, bool force) +int il_power_update_mode(struct il_priv *priv, bool force) { - struct iwl_powertable_cmd cmd; + struct il_powertable_cmd cmd; - iwl_legacy_power_sleep_cam_cmd(priv, &cmd); - return iwl_legacy_power_set_mode(priv, &cmd, force); + il_power_sleep_cam_cmd(priv, &cmd); + return il_power_set_mode(priv, &cmd, force); } -EXPORT_SYMBOL(iwl_legacy_power_update_mode); +EXPORT_SYMBOL(il_power_update_mode); /* initialize to default */ -void iwl_legacy_power_initialize(struct iwl_priv *priv) +void il_power_initialize(struct il_priv *priv) { - u16 lctl = iwl_legacy_pcie_link_ctl(priv); + u16 lctl = il_pcie_link_ctl(priv); priv->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN); @@ -162,4 +162,4 @@ void iwl_legacy_power_initialize(struct iwl_priv *priv) memset(&priv->power_data.sleep_cmd, 0, sizeof(priv->power_data.sleep_cmd)); } -EXPORT_SYMBOL(iwl_legacy_power_initialize); +EXPORT_SYMBOL(il_power_initialize); diff --git a/drivers/net/wireless/iwlegacy/iwl-power.h b/drivers/net/wireless/iwlegacy/iwl-power.h index d30b36ac..dba4ca9 100644 --- a/drivers/net/wireless/iwlegacy/iwl-power.h +++ b/drivers/net/wireless/iwlegacy/iwl-power.h @@ -25,31 +25,31 @@ * Intel Linux Wireless * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 *****************************************************************************/ -#ifndef __iwl_legacy_power_setting_h__ -#define __iwl_legacy_power_setting_h__ +#ifndef __il_power_setting_h__ +#define __il_power_setting_h__ #include "iwl-commands.h" -enum iwl_power_level { - IWL_POWER_INDEX_1, - IWL_POWER_INDEX_2, - IWL_POWER_INDEX_3, - IWL_POWER_INDEX_4, - IWL_POWER_INDEX_5, - IWL_POWER_NUM +enum il_power_level { + IL_POWER_INDEX_1, + IL_POWER_INDEX_2, + IL_POWER_INDEX_3, + IL_POWER_INDEX_4, + IL_POWER_INDEX_5, + IL_POWER_NUM }; -struct iwl_power_mgr { - struct iwl_powertable_cmd sleep_cmd; - struct iwl_powertable_cmd sleep_cmd_next; +struct il_power_mgr { + struct il_powertable_cmd sleep_cmd; + struct il_powertable_cmd sleep_cmd_next; int debug_sleep_level_override; bool pci_pm; }; int -iwl_legacy_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, +il_power_set_mode(struct il_priv *priv, struct il_powertable_cmd *cmd, bool force); -int iwl_legacy_power_update_mode(struct iwl_priv *priv, bool force); -void iwl_legacy_power_initialize(struct iwl_priv *priv); +int il_power_update_mode(struct il_priv *priv, bool force); +void il_power_initialize(struct il_priv *priv); -#endif /* __iwl_legacy_power_setting_h__ */ +#endif /* __il_power_setting_h__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-prph.h b/drivers/net/wireless/iwlegacy/iwl-prph.h index 30a4930..96788a1 100644 --- a/drivers/net/wireless/iwlegacy/iwl-prph.h +++ b/drivers/net/wireless/iwlegacy/iwl-prph.h @@ -60,8 +60,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#ifndef __iwl_legacy_prph_h__ -#define __iwl_legacy_prph_h__ +#ifndef __il_prph_h__ +#define __il_prph_h__ /* * Registers in this file are internal, not PCI bus memory mapped. @@ -120,13 +120,13 @@ * * 1) Initialization -- performs hardware calibration and sets up some * internal data, then notifies host via "initialize alive" notification - * (struct iwl_init_alive_resp) that it has completed all of its work. + * (struct il_init_alive_resp) that it has completed all of its work. * After signal from host, it then loads and starts the runtime program. * The initialization program must be used when initially setting up the * NIC after loading the driver. * * 2) Runtime/Protocol -- performs all normal runtime operations. This - * notifies host via "alive" notification (struct iwl_alive_resp) that it + * notifies host via "alive" notification (struct il_alive_resp) that it * is ready to be used. * * When initializing the NIC, the host driver does the following procedure: @@ -287,7 +287,7 @@ * Tx completion may end up being out-of-order). * * The driver must maintain the queue's Byte Count table in host DRAM - * (struct iwl4965_sched_queue_byte_cnt_tbl) for this mode. + * (struct il4965_sched_queue_byte_cnt_tbl) for this mode. * This mode does not support fragmentation. * * 2) FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order. @@ -514,10 +514,10 @@ #define IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ ((IWL49_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc) -#define IWL_SCD_TXFIFO_POS_TID (0) -#define IWL_SCD_TXFIFO_POS_RA (4) -#define IWL_SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) +#define IL_SCD_TXFIFO_POS_TID (0) +#define IL_SCD_TXFIFO_POS_RA (4) +#define IL_SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) /*********************** END TX SCHEDULER *************************************/ -#endif /* __iwl_legacy_prph_h__ */ +#endif /* __il_prph_h__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 9b5d0ab..9a2714c 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -73,7 +73,7 @@ * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled * to replenish the iwl->rxq->rx_free. - * + In iwl_rx_replenish (scheduled) if 'processed' != 'read' then the + * + In il_rx_replenish (scheduled) if 'processed' != 'read' then the * iwl->rxq is replenished and the READ INDEX is updated (updating the * 'processed' and 'read' driver indexes as well) * + A received packet is processed and handed to the kernel network stack, @@ -86,28 +86,28 @@ * * Driver sequence: * - * iwl_legacy_rx_queue_alloc() Allocates rx_free - * iwl_rx_replenish() Replenishes rx_free list from rx_used, and calls - * iwl_rx_queue_restock - * iwl_rx_queue_restock() Moves available buffers from rx_free into Rx + * il_rx_queue_alloc() Allocates rx_free + * il_rx_replenish() Replenishes rx_free list from rx_used, and calls + * il_rx_queue_restock + * il_rx_queue_restock() Moves available buffers from rx_free into Rx * queue, updates firmware pointers, and updates * the WRITE index. If insufficient rx_free buffers - * are available, schedules iwl_rx_replenish + * are available, schedules il_rx_replenish * * -- enable interrupts -- - * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the + * ISR - il_rx() Detach il_rx_mem_buffers from pool up to the * READ INDEX, detaching the SKB from the pool. * Moves the packet buffer from queue to rx_used. - * Calls iwl_rx_queue_restock to refill any empty + * Calls il_rx_queue_restock to refill any empty * slots. * ... * */ /** - * iwl_legacy_rx_queue_space - Return number of free slots available in queue. + * il_rx_queue_space - Return number of free slots available in queue. */ -int iwl_legacy_rx_queue_space(const struct iwl_rx_queue *q) +int il_rx_queue_space(const struct il_rx_queue *q) { int s = q->read - q->write; if (s <= 0) @@ -118,14 +118,14 @@ int iwl_legacy_rx_queue_space(const struct iwl_rx_queue *q) s = 0; return s; } -EXPORT_SYMBOL(iwl_legacy_rx_queue_space); +EXPORT_SYMBOL(il_rx_queue_space); /** - * iwl_legacy_rx_queue_update_write_ptr - Update the write pointer for the RX queue + * il_rx_queue_update_write_ptr - Update the write pointer for the RX queue */ void -iwl_legacy_rx_queue_update_write_ptr(struct iwl_priv *priv, - struct iwl_rx_queue *q) +il_rx_queue_update_write_ptr(struct il_priv *priv, + struct il_rx_queue *q) { unsigned long flags; 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, /* If power-saving is in use, make sure device is awake */ if (test_bit(STATUS_POWER_PMI, &priv->status)) { - reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); + reg = il_read32(priv, CSR_UCODE_DRV_GP1); if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Rx queue requesting wakeup," " GP1 = 0x%x\n", reg); - iwl_legacy_set_bit(priv, CSR_GP_CNTRL, + il_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); goto exit_unlock; } q->write_actual = (q->write & ~0x7); - iwl_legacy_write_direct32(priv, rx_wrt_ptr_reg, + il_write_direct32(priv, rx_wrt_ptr_reg, q->write_actual); /* Else device is assumed to be awake */ } else { /* Device expects a multiple of 8 */ q->write_actual = (q->write & ~0x7); - iwl_legacy_write_direct32(priv, rx_wrt_ptr_reg, + il_write_direct32(priv, rx_wrt_ptr_reg, q->write_actual); } @@ -166,11 +166,11 @@ iwl_legacy_rx_queue_update_write_ptr(struct iwl_priv *priv, exit_unlock: spin_unlock_irqrestore(&q->lock, flags); } -EXPORT_SYMBOL(iwl_legacy_rx_queue_update_write_ptr); +EXPORT_SYMBOL(il_rx_queue_update_write_ptr); -int iwl_legacy_rx_queue_alloc(struct iwl_priv *priv) +int il_rx_queue_alloc(struct il_priv *priv) { - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_rx_queue *rxq = &priv->rxq; struct device *dev = &priv->pci_dev->dev; int i; @@ -184,7 +184,7 @@ int iwl_legacy_rx_queue_alloc(struct iwl_priv *priv) if (!rxq->bd) goto err_bd; - rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct iwl_rb_status), + rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct il_rb_status), &rxq->rb_stts_dma, GFP_KERNEL); if (!rxq->rb_stts) goto err_rb; @@ -207,17 +207,17 @@ err_rb: err_bd: return -ENOMEM; } -EXPORT_SYMBOL(iwl_legacy_rx_queue_alloc); +EXPORT_SYMBOL(il_rx_queue_alloc); -void iwl_legacy_rx_spectrum_measure_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il_rx_spectrum_measure_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_spectrum_notification *report = &(pkt->u.spectrum_notif); if (!report->state) { - IWL_DEBUG_11H(priv, + IL_DEBUG_11H(priv, "Spectrum Measure Notification: Start\n"); return; } @@ -225,12 +225,12 @@ void iwl_legacy_rx_spectrum_measure_notif(struct iwl_priv *priv, memcpy(&priv->measure_report, report, sizeof(*report)); priv->measurement_status |= MEASUREMENT_READY; } -EXPORT_SYMBOL(iwl_legacy_rx_spectrum_measure_notif); +EXPORT_SYMBOL(il_rx_spectrum_measure_notif); /* * returns non-zero if packet should be dropped */ -int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv, +int il_set_decrypted_flag(struct il_priv *priv, struct ieee80211_hdr *hdr, u32 decrypt_res, struct ieee80211_rx_status *stats) @@ -241,14 +241,14 @@ int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv, * All contexts have the same setting here due to it being * a module parameter, so OK to check any context. */ - if (priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags & + if (priv->contexts[IL_RXON_CTX_BSS].active.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK) return 0; if (!(fc & IEEE80211_FCTL_PROTECTED)) return 0; - IWL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res); + IL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res); switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { case RX_RES_STATUS_SEC_TYPE_TKIP: /* 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, RX_RES_STATUS_BAD_ICV_MIC) { /* bad ICV, the packet is destroyed since the * decryption is inplace, drop it */ - IWL_DEBUG_RX(priv, "Packet destroyed\n"); + IL_DEBUG_RX(priv, "Packet destroyed\n"); return -1; } case RX_RES_STATUS_SEC_TYPE_CCMP: if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == RX_RES_STATUS_DECRYPT_OK) { - IWL_DEBUG_RX(priv, "hw decrypt successfully!!!\n"); + IL_DEBUG_RX(priv, "hw decrypt successfully!!!\n"); stats->flag |= RX_FLAG_DECRYPTED; } break; @@ -278,4 +278,4 @@ int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv, } return 0; } -EXPORT_SYMBOL(iwl_legacy_set_decrypted_flag); +EXPORT_SYMBOL(il_set_decrypted_flag); diff --git a/drivers/net/wireless/iwlegacy/iwl-scan.c b/drivers/net/wireless/iwlegacy/iwl-scan.c index a6b5222..93e939c 100644 --- a/drivers/net/wireless/iwlegacy/iwl-scan.c +++ b/drivers/net/wireless/iwlegacy/iwl-scan.c @@ -40,25 +40,25 @@ /* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after * sending probe req. This should be set long enough to hear probe responses * from more than one AP. */ -#define IWL_ACTIVE_DWELL_TIME_24 (30) /* all times in msec */ -#define IWL_ACTIVE_DWELL_TIME_52 (20) +#define IL_ACTIVE_DWELL_TIME_24 (30) /* all times in msec */ +#define IL_ACTIVE_DWELL_TIME_52 (20) -#define IWL_ACTIVE_DWELL_FACTOR_24GHZ (3) -#define IWL_ACTIVE_DWELL_FACTOR_52GHZ (2) +#define IL_ACTIVE_DWELL_FACTOR_24GHZ (3) +#define IL_ACTIVE_DWELL_FACTOR_52GHZ (2) /* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel. * Must be set longer than active dwell time. * For the most reliable scan, set > AP beacon interval (typically 100msec). */ -#define IWL_PASSIVE_DWELL_TIME_24 (20) /* all times in msec */ -#define IWL_PASSIVE_DWELL_TIME_52 (10) -#define IWL_PASSIVE_DWELL_BASE (100) -#define IWL_CHANNEL_TUNE_TIME 5 +#define IL_PASSIVE_DWELL_TIME_24 (20) /* all times in msec */ +#define IL_PASSIVE_DWELL_TIME_52 (10) +#define IL_PASSIVE_DWELL_BASE (100) +#define IL_CHANNEL_TUNE_TIME 5 -static int iwl_legacy_send_scan_abort(struct iwl_priv *priv) +static int il_send_scan_abort(struct il_priv *priv) { int ret; - struct iwl_rx_packet *pkt; - struct iwl_host_cmd cmd = { + struct il_rx_packet *pkt; + struct il_host_cmd cmd = { .id = REPLY_SCAN_ABORT_CMD, .flags = CMD_WANT_SKB, }; @@ -73,11 +73,11 @@ static int iwl_legacy_send_scan_abort(struct iwl_priv *priv) test_bit(STATUS_EXIT_PENDING, &priv->status)) return -EIO; - ret = iwl_legacy_send_cmd_sync(priv, &cmd); + ret = il_send_cmd_sync(priv, &cmd); if (ret) return ret; - pkt = (struct iwl_rx_packet *)cmd.reply_page; + pkt = (struct il_rx_packet *)cmd.reply_page; if (pkt->u.status != CAN_ABORT_STATUS) { /* The scan abort will return 1 for success or * 2 for "failure". A failure condition can be @@ -85,19 +85,19 @@ static int iwl_legacy_send_scan_abort(struct iwl_priv *priv) * can occur if we send the scan abort before we * the microcode has notified us that a scan is * completed. */ - IWL_DEBUG_SCAN(priv, "SCAN_ABORT ret %d.\n", pkt->u.status); + IL_DEBUG_SCAN(priv, "SCAN_ABORT ret %d.\n", pkt->u.status); ret = -EIO; } - iwl_legacy_free_pages(priv, cmd.reply_page); + il_free_pages(priv, cmd.reply_page); return ret; } -static void iwl_legacy_complete_scan(struct iwl_priv *priv, bool aborted) +static void il_complete_scan(struct il_priv *priv, bool aborted) { /* check if scan was requested from mac80211 */ if (priv->scan_request) { - IWL_DEBUG_SCAN(priv, "Complete scan in mac80211\n"); + IL_DEBUG_SCAN(priv, "Complete scan in mac80211\n"); ieee80211_scan_completed(priv->hw, aborted); } @@ -105,71 +105,71 @@ static void iwl_legacy_complete_scan(struct iwl_priv *priv, bool aborted) priv->scan_request = NULL; } -void iwl_legacy_force_scan_end(struct iwl_priv *priv) +void il_force_scan_end(struct il_priv *priv) { lockdep_assert_held(&priv->mutex); if (!test_bit(STATUS_SCANNING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n"); + IL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n"); return; } - IWL_DEBUG_SCAN(priv, "Forcing scan end\n"); + IL_DEBUG_SCAN(priv, "Forcing scan end\n"); clear_bit(STATUS_SCANNING, &priv->status); clear_bit(STATUS_SCAN_HW, &priv->status); clear_bit(STATUS_SCAN_ABORTING, &priv->status); - iwl_legacy_complete_scan(priv, true); + il_complete_scan(priv, true); } -static void iwl_legacy_do_scan_abort(struct iwl_priv *priv) +static void il_do_scan_abort(struct il_priv *priv) { int ret; lockdep_assert_held(&priv->mutex); if (!test_bit(STATUS_SCANNING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Not performing scan to abort\n"); + IL_DEBUG_SCAN(priv, "Not performing scan to abort\n"); return; } if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Scan abort in progress\n"); + IL_DEBUG_SCAN(priv, "Scan abort in progress\n"); return; } - ret = iwl_legacy_send_scan_abort(priv); + ret = il_send_scan_abort(priv); if (ret) { - IWL_DEBUG_SCAN(priv, "Send scan abort failed %d\n", ret); - iwl_legacy_force_scan_end(priv); + IL_DEBUG_SCAN(priv, "Send scan abort failed %d\n", ret); + il_force_scan_end(priv); } else - IWL_DEBUG_SCAN(priv, "Successfully send scan abort\n"); + IL_DEBUG_SCAN(priv, "Successfully send scan abort\n"); } /** - * iwl_scan_cancel - Cancel any currently executing HW scan + * il_scan_cancel - Cancel any currently executing HW scan */ -int iwl_legacy_scan_cancel(struct iwl_priv *priv) +int il_scan_cancel(struct il_priv *priv) { - IWL_DEBUG_SCAN(priv, "Queuing abort scan\n"); + IL_DEBUG_SCAN(priv, "Queuing abort scan\n"); queue_work(priv->workqueue, &priv->abort_scan); return 0; } -EXPORT_SYMBOL(iwl_legacy_scan_cancel); +EXPORT_SYMBOL(il_scan_cancel); /** - * iwl_legacy_scan_cancel_timeout - Cancel any currently executing HW scan + * il_scan_cancel_timeout - Cancel any currently executing HW scan * @ms: amount of time to wait (in milliseconds) for scan to abort * */ -int iwl_legacy_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) +int il_scan_cancel_timeout(struct il_priv *priv, unsigned long ms) { unsigned long timeout = jiffies + msecs_to_jiffies(ms); lockdep_assert_held(&priv->mutex); - IWL_DEBUG_SCAN(priv, "Scan cancel timeout\n"); + IL_DEBUG_SCAN(priv, "Scan cancel timeout\n"); - iwl_legacy_do_scan_abort(priv); + il_do_scan_abort(priv); while (time_before_eq(jiffies, timeout)) { 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) return test_bit(STATUS_SCAN_HW, &priv->status); } -EXPORT_SYMBOL(iwl_legacy_scan_cancel_timeout); +EXPORT_SYMBOL(il_scan_cancel_timeout); /* Service response to REPLY_SCAN_CMD (0x80) */ -static void iwl_legacy_rx_reply_scan(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il_rx_reply_scan(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_scanreq_notification *notif = - (struct iwl_scanreq_notification *)pkt->u.raw; + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_scanreq_notification *notif = + (struct il_scanreq_notification *)pkt->u.raw; - IWL_DEBUG_SCAN(priv, "Scan request status = 0x%x\n", notif->status); + IL_DEBUG_SCAN(priv, "Scan request status = 0x%x\n", notif->status); #endif } /* Service SCAN_START_NOTIFICATION (0x82) */ -static void iwl_legacy_rx_scan_start_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il_rx_scan_start_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_scanstart_notification *notif = - (struct iwl_scanstart_notification *)pkt->u.raw; + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_scanstart_notification *notif = + (struct il_scanstart_notification *)pkt->u.raw; priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); - IWL_DEBUG_SCAN(priv, "Scan start: " + IL_DEBUG_SCAN(priv, "Scan start: " "%d [802.11%s] " "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n", notif->channel, @@ -213,15 +213,15 @@ static void iwl_legacy_rx_scan_start_notif(struct iwl_priv *priv, } /* Service SCAN_RESULTS_NOTIFICATION (0x83) */ -static void iwl_legacy_rx_scan_results_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il_rx_scan_results_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_scanresults_notification *notif = - (struct iwl_scanresults_notification *)pkt->u.raw; + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_scanresults_notification *notif = + (struct il_scanresults_notification *)pkt->u.raw; - IWL_DEBUG_SCAN(priv, "Scan ch.res: " + IL_DEBUG_SCAN(priv, "Scan ch.res: " "%d [802.11%s] " "(TSF: 0x%08X:%08X) - %d " "elapsed=%lu usec\n", @@ -235,16 +235,16 @@ static void iwl_legacy_rx_scan_results_notif(struct iwl_priv *priv, } /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ -static void iwl_legacy_rx_scan_complete_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il_rx_scan_complete_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_scancomplete_notification *scan_notif = (void *)pkt->u.raw; #endif - IWL_DEBUG_SCAN(priv, + IL_DEBUG_SCAN(priv, "Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", scan_notif->scanned_channels, scan_notif->tsf_low, @@ -253,49 +253,49 @@ static void iwl_legacy_rx_scan_complete_notif(struct iwl_priv *priv, /* The HW is no longer scanning */ clear_bit(STATUS_SCAN_HW, &priv->status); - IWL_DEBUG_SCAN(priv, "Scan on %sGHz took %dms\n", + IL_DEBUG_SCAN(priv, "Scan on %sGHz took %dms\n", (priv->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2", jiffies_to_msecs(jiffies - priv->scan_start)); queue_work(priv->workqueue, &priv->scan_completed); } -void iwl_legacy_setup_rx_scan_handlers(struct iwl_priv *priv) +void il_setup_rx_scan_handlers(struct il_priv *priv) { /* scan handlers */ - priv->rx_handlers[REPLY_SCAN_CMD] = iwl_legacy_rx_reply_scan; + priv->rx_handlers[REPLY_SCAN_CMD] = il_rx_reply_scan; priv->rx_handlers[SCAN_START_NOTIFICATION] = - iwl_legacy_rx_scan_start_notif; + il_rx_scan_start_notif; priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = - iwl_legacy_rx_scan_results_notif; + il_rx_scan_results_notif; priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = - iwl_legacy_rx_scan_complete_notif; + il_rx_scan_complete_notif; } -EXPORT_SYMBOL(iwl_legacy_setup_rx_scan_handlers); +EXPORT_SYMBOL(il_setup_rx_scan_handlers); -inline u16 iwl_legacy_get_active_dwell_time(struct iwl_priv *priv, +inline u16 il_get_active_dwell_time(struct il_priv *priv, enum ieee80211_band band, u8 n_probes) { if (band == IEEE80211_BAND_5GHZ) - return IWL_ACTIVE_DWELL_TIME_52 + - IWL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1); + return IL_ACTIVE_DWELL_TIME_52 + + IL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1); else - return IWL_ACTIVE_DWELL_TIME_24 + - IWL_ACTIVE_DWELL_FACTOR_24GHZ * (n_probes + 1); + return IL_ACTIVE_DWELL_TIME_24 + + IL_ACTIVE_DWELL_FACTOR_24GHZ * (n_probes + 1); } -EXPORT_SYMBOL(iwl_legacy_get_active_dwell_time); +EXPORT_SYMBOL(il_get_active_dwell_time); -u16 iwl_legacy_get_passive_dwell_time(struct iwl_priv *priv, +u16 il_get_passive_dwell_time(struct il_priv *priv, enum ieee80211_band band, struct ieee80211_vif *vif) { - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; u16 passive = (band == IEEE80211_BAND_2GHZ) ? - IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : - IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; + IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_24 : + IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_52; - if (iwl_legacy_is_any_associated(priv)) { + if (il_is_any_associated(priv)) { /* * If we're associated, we clamp the maximum passive * 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, for_each_context(priv, ctx) { u16 value; - if (!iwl_legacy_is_associated_ctx(ctx)) + if (!il_is_associated_ctx(ctx)) continue; value = ctx->vif ? ctx->vif->bss_conf.beacon_int : 0; - if ((value > IWL_PASSIVE_DWELL_BASE) || !value) - value = IWL_PASSIVE_DWELL_BASE; - value = (value * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; + if ((value > IL_PASSIVE_DWELL_BASE) || !value) + value = IL_PASSIVE_DWELL_BASE; + value = (value * 98) / 100 - IL_CHANNEL_TUNE_TIME * 2; passive = min(value, passive); } } return passive; } -EXPORT_SYMBOL(iwl_legacy_get_passive_dwell_time); +EXPORT_SYMBOL(il_get_passive_dwell_time); -void iwl_legacy_init_scan_params(struct iwl_priv *priv) +void il_init_scan_params(struct il_priv *priv) { u8 ant_idx = fls(priv->hw_params.valid_tx_ant) - 1; if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ]) @@ -326,9 +326,9 @@ void iwl_legacy_init_scan_params(struct iwl_priv *priv) if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ]) priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx; } -EXPORT_SYMBOL(iwl_legacy_init_scan_params); +EXPORT_SYMBOL(il_init_scan_params); -static int iwl_legacy_scan_initiate(struct iwl_priv *priv, +static int il_scan_initiate(struct il_priv *priv, struct ieee80211_vif *vif) { int ret; @@ -340,23 +340,23 @@ static int iwl_legacy_scan_initiate(struct iwl_priv *priv, cancel_delayed_work(&priv->scan_check); - if (!iwl_legacy_is_ready_rf(priv)) { - IWL_WARN(priv, "Request scan called when driver not ready.\n"); + if (!il_is_ready_rf(priv)) { + IL_WARN(priv, "Request scan called when driver not ready.\n"); return -EIO; } if (test_bit(STATUS_SCAN_HW, &priv->status)) { - IWL_DEBUG_SCAN(priv, + IL_DEBUG_SCAN(priv, "Multiple concurrent scan requests in parallel.\n"); return -EBUSY; } if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Scan request while abort pending.\n"); + IL_DEBUG_SCAN(priv, "Scan request while abort pending.\n"); return -EBUSY; } - IWL_DEBUG_SCAN(priv, "Starting scan...\n"); + IL_DEBUG_SCAN(priv, "Starting scan...\n"); set_bit(STATUS_SCANNING, &priv->status); priv->scan_start = jiffies; @@ -368,19 +368,19 @@ static int iwl_legacy_scan_initiate(struct iwl_priv *priv, } queue_delayed_work(priv->workqueue, &priv->scan_check, - IWL_SCAN_CHECK_WATCHDOG); + IL_SCAN_CHECK_WATCHDOG); return 0; } -int iwl_legacy_mac_hw_scan(struct ieee80211_hw *hw, +int il_mac_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct cfg80211_scan_request *req) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; int ret; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); if (req->n_channels == 0) return -EINVAL; @@ -388,7 +388,7 @@ int iwl_legacy_mac_hw_scan(struct ieee80211_hw *hw, mutex_lock(&priv->mutex); if (test_bit(STATUS_SCANNING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); + IL_DEBUG_SCAN(priv, "Scan already in progress.\n"); ret = -EAGAIN; goto out_unlock; } @@ -398,38 +398,38 @@ int iwl_legacy_mac_hw_scan(struct ieee80211_hw *hw, priv->scan_vif = vif; priv->scan_band = req->channels[0]->band; - ret = iwl_legacy_scan_initiate(priv, vif); + ret = il_scan_initiate(priv, vif); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); out_unlock: mutex_unlock(&priv->mutex); return ret; } -EXPORT_SYMBOL(iwl_legacy_mac_hw_scan); +EXPORT_SYMBOL(il_mac_hw_scan); -static void iwl_legacy_bg_scan_check(struct work_struct *data) +static void il_bg_scan_check(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, scan_check.work); + struct il_priv *priv = + container_of(data, struct il_priv, scan_check.work); - IWL_DEBUG_SCAN(priv, "Scan check work\n"); + IL_DEBUG_SCAN(priv, "Scan check work\n"); /* Since we are here firmware does not finish scan and * most likely is in bad shape, so we don't bother to * send abort command, just force scan complete to mac80211 */ mutex_lock(&priv->mutex); - iwl_legacy_force_scan_end(priv); + il_force_scan_end(priv); mutex_unlock(&priv->mutex); } /** - * iwl_legacy_fill_probe_req - fill in all required fields and IE for probe request + * il_fill_probe_req - fill in all required fields and IE for probe request */ u16 -iwl_legacy_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, +il_fill_probe_req(struct il_priv *priv, struct ieee80211_mgmt *frame, const u8 *ta, const u8 *ies, int ie_len, int left) { int len = 0; @@ -471,28 +471,28 @@ iwl_legacy_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, return (u16)len; } -EXPORT_SYMBOL(iwl_legacy_fill_probe_req); +EXPORT_SYMBOL(il_fill_probe_req); -static void iwl_legacy_bg_abort_scan(struct work_struct *work) +static void il_bg_abort_scan(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); + struct il_priv *priv = container_of(work, struct il_priv, abort_scan); - IWL_DEBUG_SCAN(priv, "Abort scan work\n"); + IL_DEBUG_SCAN(priv, "Abort scan work\n"); /* We keep scan_check work queued in case when firmware will not * report back scan completed notification */ mutex_lock(&priv->mutex); - iwl_legacy_scan_cancel_timeout(priv, 200); + il_scan_cancel_timeout(priv, 200); mutex_unlock(&priv->mutex); } -static void iwl_legacy_bg_scan_completed(struct work_struct *work) +static void il_bg_scan_completed(struct work_struct *work) { - struct iwl_priv *priv = - container_of(work, struct iwl_priv, scan_completed); + struct il_priv *priv = + container_of(work, struct il_priv, scan_completed); bool aborted; - IWL_DEBUG_SCAN(priv, "Completed scan.\n"); + IL_DEBUG_SCAN(priv, "Completed scan.\n"); cancel_delayed_work(&priv->scan_check); @@ -500,26 +500,26 @@ static void iwl_legacy_bg_scan_completed(struct work_struct *work) aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->status); if (aborted) - IWL_DEBUG_SCAN(priv, "Aborted scan completed.\n"); + IL_DEBUG_SCAN(priv, "Aborted scan completed.\n"); if (!test_and_clear_bit(STATUS_SCANNING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Scan already completed.\n"); + IL_DEBUG_SCAN(priv, "Scan already completed.\n"); goto out_settings; } - iwl_legacy_complete_scan(priv, aborted); + il_complete_scan(priv, aborted); out_settings: /* Can we still talk to firmware ? */ - if (!iwl_legacy_is_ready_rf(priv)) + if (!il_is_ready_rf(priv)) goto out; /* * We do not commit power settings while scan is pending, * do it now if the settings changed. */ - iwl_legacy_power_set_mode(priv, &priv->power_data.sleep_cmd_next, false); - iwl_legacy_set_tx_power(priv, priv->tx_power_next, false); + il_power_set_mode(priv, &priv->power_data.sleep_cmd_next, false); + il_set_tx_power(priv, priv->tx_power_next, false); priv->cfg->ops->utils->post_scan(priv); @@ -527,23 +527,23 @@ out: mutex_unlock(&priv->mutex); } -void iwl_legacy_setup_scan_deferred_work(struct iwl_priv *priv) +void il_setup_scan_deferred_work(struct il_priv *priv) { - INIT_WORK(&priv->scan_completed, iwl_legacy_bg_scan_completed); - INIT_WORK(&priv->abort_scan, iwl_legacy_bg_abort_scan); - INIT_DELAYED_WORK(&priv->scan_check, iwl_legacy_bg_scan_check); + INIT_WORK(&priv->scan_completed, il_bg_scan_completed); + INIT_WORK(&priv->abort_scan, il_bg_abort_scan); + INIT_DELAYED_WORK(&priv->scan_check, il_bg_scan_check); } -EXPORT_SYMBOL(iwl_legacy_setup_scan_deferred_work); +EXPORT_SYMBOL(il_setup_scan_deferred_work); -void iwl_legacy_cancel_scan_deferred_work(struct iwl_priv *priv) +void il_cancel_scan_deferred_work(struct il_priv *priv) { cancel_work_sync(&priv->abort_scan); cancel_work_sync(&priv->scan_completed); if (cancel_delayed_work_sync(&priv->scan_check)) { mutex_lock(&priv->mutex); - iwl_legacy_force_scan_end(priv); + il_force_scan_end(priv); mutex_unlock(&priv->mutex); } } -EXPORT_SYMBOL(iwl_legacy_cancel_scan_deferred_work); +EXPORT_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 9f70a47..85fe48e 100644 --- a/drivers/net/wireless/iwlegacy/iwl-spectrum.h +++ b/drivers/net/wireless/iwlegacy/iwl-spectrum.h @@ -26,8 +26,8 @@ * *****************************************************************************/ -#ifndef __iwl_legacy_spectrum_h__ -#define __iwl_legacy_spectrum_h__ +#ifndef __il_spectrum_h__ +#define __il_spectrum_h__ enum { /* ieee80211_basic_report.map */ IEEE80211_BASIC_MAP_BSS = (1 << 0), 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 66f0fb2..3773f7d 100644 --- a/drivers/net/wireless/iwlegacy/iwl-sta.c +++ b/drivers/net/wireless/iwlegacy/iwl-sta.c @@ -37,72 +37,72 @@ #include "iwl-sta.h" /* priv->sta_lock must be held */ -static void iwl_legacy_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) +static void il_sta_ucode_activate(struct il_priv *priv, u8 sta_id) { - if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) - IWL_ERR(priv, + if (!(priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) + IL_ERR(priv, "ACTIVATE a non DRIVER active station id %u addr %pM\n", sta_id, priv->stations[sta_id].sta.sta.addr); - if (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE) { - IWL_DEBUG_ASSOC(priv, + if (priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE) { + IL_DEBUG_ASSOC(priv, "STA id %u addr %pM already present" " in uCode (according to driver)\n", sta_id, priv->stations[sta_id].sta.sta.addr); } else { - priv->stations[sta_id].used |= IWL_STA_UCODE_ACTIVE; - IWL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n", + priv->stations[sta_id].used |= IL_STA_UCODE_ACTIVE; + IL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n", sta_id, priv->stations[sta_id].sta.sta.addr); } } -static int iwl_legacy_process_add_sta_resp(struct iwl_priv *priv, - struct iwl_legacy_addsta_cmd *addsta, - struct iwl_rx_packet *pkt, +static int il_process_add_sta_resp(struct il_priv *priv, + struct il_addsta_cmd *addsta, + struct il_rx_packet *pkt, bool sync) { u8 sta_id = addsta->sta.sta_id; unsigned long flags; int ret = -EIO; - if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { - IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n", + if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { + IL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n", pkt->hdr.flags); return ret; } - IWL_DEBUG_INFO(priv, "Processing response for adding station %u\n", + IL_DEBUG_INFO(priv, "Processing response for adding station %u\n", sta_id); spin_lock_irqsave(&priv->sta_lock, flags); switch (pkt->u.add_sta.status) { case ADD_STA_SUCCESS_MSK: - IWL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n"); - iwl_legacy_sta_ucode_activate(priv, sta_id); + IL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n"); + il_sta_ucode_activate(priv, sta_id); ret = 0; break; case ADD_STA_NO_ROOM_IN_TABLE: - IWL_ERR(priv, "Adding station %d failed, no room in table.\n", + IL_ERR(priv, "Adding station %d failed, no room in table.\n", sta_id); break; case ADD_STA_NO_BLOCK_ACK_RESOURCE: - IWL_ERR(priv, + IL_ERR(priv, "Adding station %d failed, no block ack resource.\n", sta_id); break; case ADD_STA_MODIFY_NON_EXIST_STA: - IWL_ERR(priv, "Attempting to modify non-existing station %d\n", + IL_ERR(priv, "Attempting to modify non-existing station %d\n", sta_id); break; default: - IWL_DEBUG_ASSOC(priv, "Received REPLY_ADD_STA:(0x%08X)\n", + IL_DEBUG_ASSOC(priv, "Received REPLY_ADD_STA:(0x%08X)\n", pkt->u.add_sta.status); break; } - IWL_DEBUG_INFO(priv, "%s station id %u addr %pM\n", + IL_DEBUG_INFO(priv, "%s station id %u addr %pM\n", priv->stations[sta_id].sta.mode == STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", 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, * issue has not yet been resolved and this debugging is left to * observe the problem. */ - IWL_DEBUG_INFO(priv, "%s station according to cmd buffer %pM\n", + IL_DEBUG_INFO(priv, "%s station according to cmd buffer %pM\n", priv->stations[sta_id].sta.mode == STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", addsta->sta.addr); @@ -124,59 +124,59 @@ static int iwl_legacy_process_add_sta_resp(struct iwl_priv *priv, return ret; } -static void iwl_legacy_add_sta_callback(struct iwl_priv *priv, - struct iwl_device_cmd *cmd, - struct iwl_rx_packet *pkt) +static void il_add_sta_callback(struct il_priv *priv, + struct il_device_cmd *cmd, + struct il_rx_packet *pkt) { - struct iwl_legacy_addsta_cmd *addsta = - (struct iwl_legacy_addsta_cmd *)cmd->cmd.payload; + struct il_addsta_cmd *addsta = + (struct il_addsta_cmd *)cmd->cmd.payload; - iwl_legacy_process_add_sta_resp(priv, addsta, pkt, false); + il_process_add_sta_resp(priv, addsta, pkt, false); } -int iwl_legacy_send_add_sta(struct iwl_priv *priv, - struct iwl_legacy_addsta_cmd *sta, u8 flags) +int il_send_add_sta(struct il_priv *priv, + struct il_addsta_cmd *sta, u8 flags) { - struct iwl_rx_packet *pkt = NULL; + struct il_rx_packet *pkt = NULL; int ret = 0; u8 data[sizeof(*sta)]; - struct iwl_host_cmd cmd = { + struct il_host_cmd cmd = { .id = REPLY_ADD_STA, .flags = flags, .data = data, }; u8 sta_id __maybe_unused = sta->sta.sta_id; - IWL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n", + IL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n", sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); if (flags & CMD_ASYNC) - cmd.callback = iwl_legacy_add_sta_callback; + cmd.callback = il_add_sta_callback; else { cmd.flags |= CMD_WANT_SKB; might_sleep(); } cmd.len = priv->cfg->ops->utils->build_addsta_hcmd(sta, data); - ret = iwl_legacy_send_cmd(priv, &cmd); + ret = il_send_cmd(priv, &cmd); if (ret || (flags & CMD_ASYNC)) return ret; if (ret == 0) { - pkt = (struct iwl_rx_packet *)cmd.reply_page; - ret = iwl_legacy_process_add_sta_resp(priv, sta, pkt, true); + pkt = (struct il_rx_packet *)cmd.reply_page; + ret = il_process_add_sta_resp(priv, sta, pkt, true); } - iwl_legacy_free_pages(priv, cmd.reply_page); + il_free_pages(priv, cmd.reply_page); return ret; } -EXPORT_SYMBOL(iwl_legacy_send_add_sta); +EXPORT_SYMBOL(il_send_add_sta); -static void iwl_legacy_set_ht_add_station(struct iwl_priv *priv, u8 index, +static void il_set_ht_add_station(struct il_priv *priv, u8 index, struct ieee80211_sta *sta, - struct iwl_rxon_context *ctx) + struct il_rxon_context *ctx) { struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap; __le32 sta_flags; @@ -186,7 +186,7 @@ static void iwl_legacy_set_ht_add_station(struct iwl_priv *priv, u8 index, goto done; mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2; - IWL_DEBUG_ASSOC(priv, "spatial multiplexing power save mode: %s\n", + IL_DEBUG_ASSOC(priv, "spatial multiplexing power save mode: %s\n", (mimo_ps_mode == WLAN_HT_CAP_SM_PS_STATIC) ? "static" : (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, case WLAN_HT_CAP_SM_PS_DISABLED: break; default: - IWL_WARN(priv, "Invalid MIMO PS mode %d\n", mimo_ps_mode); + IL_WARN(priv, "Invalid MIMO PS mode %d\n", mimo_ps_mode); break; } @@ -216,7 +216,7 @@ static void iwl_legacy_set_ht_add_station(struct iwl_priv *priv, u8 index, sta_flags |= cpu_to_le32( (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); - if (iwl_legacy_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) + if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) sta_flags |= STA_FLG_HT40_EN_MSK; else 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, } /** - * iwl_legacy_prep_station - Prepare station information for addition + * il_prep_station - Prepare station information for addition * * should be called with sta_lock held */ -u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, +u8 il_prep_station(struct il_priv *priv, struct il_rxon_context *ctx, const u8 *addr, bool is_ap, struct ieee80211_sta *sta) { - struct iwl_station_entry *station; + struct il_station_entry *station; int i; - u8 sta_id = IWL_INVALID_STATION; + u8 sta_id = IL_INVALID_STATION; u16 rate; if (is_ap) @@ -244,7 +244,7 @@ u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, else if (is_broadcast_ether_addr(addr)) sta_id = ctx->bcast_sta_id; else - for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++) { + for (i = IL_STA_ID; i < priv->hw_params.max_stations; i++) { if (!compare_ether_addr(priv->stations[i].sta.sta.addr, addr)) { sta_id = i; @@ -252,7 +252,7 @@ u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, } if (!priv->stations[i].used && - sta_id == IWL_INVALID_STATION) + sta_id == IL_INVALID_STATION) sta_id = i; } @@ -260,7 +260,7 @@ u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, * These two conditions have the same outcome, but keep them * separate */ - if (unlikely(sta_id == IWL_INVALID_STATION)) + if (unlikely(sta_id == IL_INVALID_STATION)) return sta_id; /* @@ -268,30 +268,30 @@ u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, * station. Keep track if one is in progress so that we do not send * another. */ - if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) { - IWL_DEBUG_INFO(priv, + if (priv->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) { + IL_DEBUG_INFO(priv, "STA %d already in process of being added.\n", sta_id); return sta_id; } - if ((priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) && - (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE) && + if ((priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) && + (priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE) && !compare_ether_addr(priv->stations[sta_id].sta.sta.addr, addr)) { - IWL_DEBUG_ASSOC(priv, + IL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not adding again.\n", sta_id, addr); return sta_id; } station = &priv->stations[sta_id]; - station->used = IWL_STA_DRIVER_ACTIVE; - IWL_DEBUG_ASSOC(priv, "Add STA to driver ID %d: %pM\n", + station->used = IL_STA_DRIVER_ACTIVE; + IL_DEBUG_ASSOC(priv, "Add STA to driver ID %d: %pM\n", sta_id, addr); priv->num_stations++; /* Set up the REPLY_ADD_STA command to send to device */ - memset(&station->sta, 0, sizeof(struct iwl_legacy_addsta_cmd)); + memset(&station->sta, 0, sizeof(struct il_addsta_cmd)); memcpy(station->sta.sta.addr, addr, ETH_ALEN); station->sta.mode = 0; 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, station->ctxid = ctx->ctxid; if (sta) { - struct iwl_station_priv_common *sta_priv; + struct il_station_priv_common *sta_priv; sta_priv = (void *)sta->drv_priv; sta_priv->ctx = ctx; @@ -310,40 +310,40 @@ u8 iwl_legacy_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, * STA and broadcast STA) pass in a NULL sta, and mac80211 * doesn't allow HT IBSS. */ - iwl_legacy_set_ht_add_station(priv, sta_id, sta, ctx); + il_set_ht_add_station(priv, sta_id, sta, ctx); /* 3945 only */ rate = (priv->band == IEEE80211_BAND_5GHZ) ? - IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP; + IL_RATE_6M_PLCP : IL_RATE_1M_PLCP; /* Turn on both antennas for the station... */ station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK); return sta_id; } -EXPORT_SYMBOL_GPL(iwl_legacy_prep_station); +EXPORT_SYMBOL_GPL(il_prep_station); #define STA_WAIT_TIMEOUT (HZ/2) /** - * iwl_legacy_add_station_common - + * il_add_station_common - */ int -iwl_legacy_add_station_common(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +il_add_station_common(struct il_priv *priv, + struct il_rxon_context *ctx, const u8 *addr, bool is_ap, struct ieee80211_sta *sta, u8 *sta_id_r) { unsigned long flags_spin; int ret = 0; u8 sta_id; - struct iwl_legacy_addsta_cmd sta_cmd; + struct il_addsta_cmd sta_cmd; *sta_id_r = 0; spin_lock_irqsave(&priv->sta_lock, flags_spin); - sta_id = iwl_legacy_prep_station(priv, ctx, addr, is_ap, sta); - if (sta_id == IWL_INVALID_STATION) { - IWL_ERR(priv, "Unable to prepare station %pM for addition\n", + sta_id = il_prep_station(priv, ctx, addr, is_ap, sta); + if (sta_id == IL_INVALID_STATION) { + IL_ERR(priv, "Unable to prepare station %pM for addition\n", addr); spin_unlock_irqrestore(&priv->sta_lock, flags_spin); return -EINVAL; @@ -354,75 +354,75 @@ iwl_legacy_add_station_common(struct iwl_priv *priv, * station. Keep track if one is in progress so that we do not send * another. */ - if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) { - IWL_DEBUG_INFO(priv, + if (priv->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) { + IL_DEBUG_INFO(priv, "STA %d already in process of being added.\n", sta_id); spin_unlock_irqrestore(&priv->sta_lock, flags_spin); return -EEXIST; } - if ((priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) && - (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { - IWL_DEBUG_ASSOC(priv, + if ((priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) && + (priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) { + IL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not adding again.\n", sta_id, addr); spin_unlock_irqrestore(&priv->sta_lock, flags_spin); return -EEXIST; } - priv->stations[sta_id].used |= IWL_STA_UCODE_INPROGRESS; + priv->stations[sta_id].used |= IL_STA_UCODE_INPROGRESS; memcpy(&sta_cmd, &priv->stations[sta_id].sta, - sizeof(struct iwl_legacy_addsta_cmd)); + sizeof(struct il_addsta_cmd)); spin_unlock_irqrestore(&priv->sta_lock, flags_spin); /* Add station to device's station table */ - ret = iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); + ret = il_send_add_sta(priv, &sta_cmd, CMD_SYNC); if (ret) { spin_lock_irqsave(&priv->sta_lock, flags_spin); - IWL_ERR(priv, "Adding station %pM failed.\n", + IL_ERR(priv, "Adding station %pM failed.\n", priv->stations[sta_id].sta.sta.addr); - priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; - priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; + priv->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE; + priv->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS; spin_unlock_irqrestore(&priv->sta_lock, flags_spin); } *sta_id_r = sta_id; return ret; } -EXPORT_SYMBOL(iwl_legacy_add_station_common); +EXPORT_SYMBOL(il_add_station_common); /** - * iwl_legacy_sta_ucode_deactivate - deactivate ucode status for a station + * il_sta_ucode_deactivate - deactivate ucode status for a station * * priv->sta_lock must be held */ -static void iwl_legacy_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id) +static void il_sta_ucode_deactivate(struct il_priv *priv, u8 sta_id) { /* Ucode must be active and driver must be non active */ if ((priv->stations[sta_id].used & - (IWL_STA_UCODE_ACTIVE | IWL_STA_DRIVER_ACTIVE)) != - IWL_STA_UCODE_ACTIVE) - IWL_ERR(priv, "removed non active STA %u\n", sta_id); + (IL_STA_UCODE_ACTIVE | IL_STA_DRIVER_ACTIVE)) != + IL_STA_UCODE_ACTIVE) + IL_ERR(priv, "removed non active STA %u\n", sta_id); - priv->stations[sta_id].used &= ~IWL_STA_UCODE_ACTIVE; + priv->stations[sta_id].used &= ~IL_STA_UCODE_ACTIVE; - memset(&priv->stations[sta_id], 0, sizeof(struct iwl_station_entry)); - IWL_DEBUG_ASSOC(priv, "Removed STA %u\n", sta_id); + memset(&priv->stations[sta_id], 0, sizeof(struct il_station_entry)); + IL_DEBUG_ASSOC(priv, "Removed STA %u\n", sta_id); } -static int iwl_legacy_send_remove_station(struct iwl_priv *priv, +static int il_send_remove_station(struct il_priv *priv, const u8 *addr, int sta_id, bool temporary) { - struct iwl_rx_packet *pkt; + struct il_rx_packet *pkt; int ret; unsigned long flags_spin; - struct iwl_rem_sta_cmd rm_sta_cmd; + struct il_rem_sta_cmd rm_sta_cmd; - struct iwl_host_cmd cmd = { + struct il_host_cmd cmd = { .id = REPLY_REMOVE_STA, - .len = sizeof(struct iwl_rem_sta_cmd), + .len = sizeof(struct il_rem_sta_cmd), .flags = CMD_SYNC, .data = &rm_sta_cmd, }; @@ -433,14 +433,14 @@ static int iwl_legacy_send_remove_station(struct iwl_priv *priv, cmd.flags |= CMD_WANT_SKB; - ret = iwl_legacy_send_cmd(priv, &cmd); + ret = il_send_cmd(priv, &cmd); if (ret) return ret; - pkt = (struct iwl_rx_packet *)cmd.reply_page; - if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { - IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", + pkt = (struct il_rx_packet *)cmd.reply_page; + if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { + IL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", pkt->hdr.flags); ret = -EIO; } @@ -450,33 +450,33 @@ static int iwl_legacy_send_remove_station(struct iwl_priv *priv, case REM_STA_SUCCESS_MSK: if (!temporary) { spin_lock_irqsave(&priv->sta_lock, flags_spin); - iwl_legacy_sta_ucode_deactivate(priv, sta_id); + il_sta_ucode_deactivate(priv, sta_id); spin_unlock_irqrestore(&priv->sta_lock, flags_spin); } - IWL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n"); + IL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n"); break; default: ret = -EIO; - IWL_ERR(priv, "REPLY_REMOVE_STA failed\n"); + IL_ERR(priv, "REPLY_REMOVE_STA failed\n"); break; } } - iwl_legacy_free_pages(priv, cmd.reply_page); + il_free_pages(priv, cmd.reply_page); return ret; } /** - * iwl_legacy_remove_station - Remove driver's knowledge of station. + * il_remove_station - Remove driver's knowledge of station. */ -int iwl_legacy_remove_station(struct iwl_priv *priv, const u8 sta_id, +int il_remove_station(struct il_priv *priv, const u8 sta_id, const u8 *addr) { unsigned long flags; - if (!iwl_legacy_is_ready(priv)) { - IWL_DEBUG_INFO(priv, + if (!il_is_ready(priv)) { + IL_DEBUG_INFO(priv, "Unable to remove station %pM, device not ready.\n", addr); /* @@ -487,32 +487,32 @@ int iwl_legacy_remove_station(struct iwl_priv *priv, const u8 sta_id, return 0; } - IWL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n", + IL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n", sta_id, addr); - if (WARN_ON(sta_id == IWL_INVALID_STATION)) + if (WARN_ON(sta_id == IL_INVALID_STATION)) return -EINVAL; spin_lock_irqsave(&priv->sta_lock, flags); - if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { - IWL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", + if (!(priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) { + IL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", addr); goto out_err; } - if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { - IWL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n", + if (!(priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) { + IL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n", addr); goto out_err; } - if (priv->stations[sta_id].used & IWL_STA_LOCAL) { + if (priv->stations[sta_id].used & IL_STA_LOCAL) { kfree(priv->stations[sta_id].lq); priv->stations[sta_id].lq = NULL; } - priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; + priv->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE; priv->num_stations--; @@ -520,52 +520,52 @@ int iwl_legacy_remove_station(struct iwl_priv *priv, const u8 sta_id, spin_unlock_irqrestore(&priv->sta_lock, flags); - return iwl_legacy_send_remove_station(priv, addr, sta_id, false); + return il_send_remove_station(priv, addr, sta_id, false); out_err: spin_unlock_irqrestore(&priv->sta_lock, flags); return -EINVAL; } -EXPORT_SYMBOL_GPL(iwl_legacy_remove_station); +EXPORT_SYMBOL_GPL(il_remove_station); /** - * iwl_legacy_clear_ucode_stations - clear ucode station table bits + * il_clear_ucode_stations - clear ucode station table bits * * This function clears all the bits in the driver indicating * which stations are active in the ucode. Call when something * other than explicit station management would cause this in * the ucode, e.g. unassociated RXON. */ -void iwl_legacy_clear_ucode_stations(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) +void il_clear_ucode_stations(struct il_priv *priv, + struct il_rxon_context *ctx) { int i; unsigned long flags_spin; bool cleared = false; - IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n"); + IL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n"); spin_lock_irqsave(&priv->sta_lock, flags_spin); for (i = 0; i < priv->hw_params.max_stations; i++) { if (ctx && ctx->ctxid != priv->stations[i].ctxid) continue; - if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { - IWL_DEBUG_INFO(priv, + if (priv->stations[i].used & IL_STA_UCODE_ACTIVE) { + IL_DEBUG_INFO(priv, "Clearing ucode active for station %d\n", i); - priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; + priv->stations[i].used &= ~IL_STA_UCODE_ACTIVE; cleared = true; } } spin_unlock_irqrestore(&priv->sta_lock, flags_spin); if (!cleared) - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "No active stations found to be cleared\n"); } -EXPORT_SYMBOL(iwl_legacy_clear_ucode_stations); +EXPORT_SYMBOL(il_clear_ucode_stations); /** - * iwl_legacy_restore_stations() - Restore driver known stations to device + * il_restore_stations() - Restore driver known stations to device * * All stations considered active by driver, but not present in ucode, is * restored. @@ -573,57 +573,57 @@ EXPORT_SYMBOL(iwl_legacy_clear_ucode_stations); * Function sleeps. */ void -iwl_legacy_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) +il_restore_stations(struct il_priv *priv, struct il_rxon_context *ctx) { - struct iwl_legacy_addsta_cmd sta_cmd; - struct iwl_link_quality_cmd lq; + struct il_addsta_cmd sta_cmd; + struct il_link_quality_cmd lq; unsigned long flags_spin; int i; bool found = false; int ret; bool send_lq; - if (!iwl_legacy_is_ready(priv)) { - IWL_DEBUG_INFO(priv, + if (!il_is_ready(priv)) { + IL_DEBUG_INFO(priv, "Not ready yet, not restoring any stations.\n"); return; } - IWL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n"); + IL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n"); spin_lock_irqsave(&priv->sta_lock, flags_spin); for (i = 0; i < priv->hw_params.max_stations; i++) { if (ctx->ctxid != priv->stations[i].ctxid) continue; - if ((priv->stations[i].used & IWL_STA_DRIVER_ACTIVE) && - !(priv->stations[i].used & IWL_STA_UCODE_ACTIVE)) { - IWL_DEBUG_ASSOC(priv, "Restoring sta %pM\n", + if ((priv->stations[i].used & IL_STA_DRIVER_ACTIVE) && + !(priv->stations[i].used & IL_STA_UCODE_ACTIVE)) { + IL_DEBUG_ASSOC(priv, "Restoring sta %pM\n", priv->stations[i].sta.sta.addr); priv->stations[i].sta.mode = 0; - priv->stations[i].used |= IWL_STA_UCODE_INPROGRESS; + priv->stations[i].used |= IL_STA_UCODE_INPROGRESS; found = true; } } for (i = 0; i < priv->hw_params.max_stations; i++) { - if ((priv->stations[i].used & IWL_STA_UCODE_INPROGRESS)) { + if ((priv->stations[i].used & IL_STA_UCODE_INPROGRESS)) { memcpy(&sta_cmd, &priv->stations[i].sta, - sizeof(struct iwl_legacy_addsta_cmd)); + sizeof(struct il_addsta_cmd)); send_lq = false; if (priv->stations[i].lq) { memcpy(&lq, priv->stations[i].lq, - sizeof(struct iwl_link_quality_cmd)); + sizeof(struct il_link_quality_cmd)); send_lq = true; } spin_unlock_irqrestore(&priv->sta_lock, flags_spin); - ret = iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); + ret = il_send_add_sta(priv, &sta_cmd, CMD_SYNC); if (ret) { spin_lock_irqsave(&priv->sta_lock, flags_spin); - IWL_ERR(priv, "Adding station %pM failed.\n", + IL_ERR(priv, "Adding station %pM failed.\n", priv->stations[i].sta.sta.addr); priv->stations[i].used &= - ~IWL_STA_DRIVER_ACTIVE; + ~IL_STA_DRIVER_ACTIVE; priv->stations[i].used &= - ~IWL_STA_UCODE_INPROGRESS; + ~IL_STA_UCODE_INPROGRESS; spin_unlock_irqrestore(&priv->sta_lock, flags_spin); } @@ -632,24 +632,24 @@ iwl_legacy_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) * current LQ command */ if (send_lq) - iwl_legacy_send_lq_cmd(priv, ctx, &lq, + il_send_lq_cmd(priv, ctx, &lq, CMD_SYNC, true); spin_lock_irqsave(&priv->sta_lock, flags_spin); - priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; + priv->stations[i].used &= ~IL_STA_UCODE_INPROGRESS; } } spin_unlock_irqrestore(&priv->sta_lock, flags_spin); if (!found) - IWL_DEBUG_INFO(priv, "Restoring all known stations" + IL_DEBUG_INFO(priv, "Restoring all known stations" " .... no stations to be restored.\n"); else - IWL_DEBUG_INFO(priv, "Restoring all known stations" + IL_DEBUG_INFO(priv, "Restoring all known stations" " .... complete.\n"); } -EXPORT_SYMBOL(iwl_legacy_restore_stations); +EXPORT_SYMBOL(il_restore_stations); -int iwl_legacy_get_free_ucode_key_index(struct iwl_priv *priv) +int il_get_free_ucode_key_index(struct il_priv *priv) { int i; @@ -659,19 +659,19 @@ int iwl_legacy_get_free_ucode_key_index(struct iwl_priv *priv) return WEP_INVALID_OFFSET; } -EXPORT_SYMBOL(iwl_legacy_get_free_ucode_key_index); +EXPORT_SYMBOL(il_get_free_ucode_key_index); -void iwl_legacy_dealloc_bcast_stations(struct iwl_priv *priv) +void il_dealloc_bcast_stations(struct il_priv *priv) { unsigned long flags; int i; spin_lock_irqsave(&priv->sta_lock, flags); for (i = 0; i < priv->hw_params.max_stations; i++) { - if (!(priv->stations[i].used & IWL_STA_BCAST)) + if (!(priv->stations[i].used & IL_STA_BCAST)) continue; - priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; + priv->stations[i].used &= ~IL_STA_UCODE_ACTIVE; priv->num_stations--; BUG_ON(priv->num_stations < 0); kfree(priv->stations[i].lq); @@ -679,31 +679,31 @@ void iwl_legacy_dealloc_bcast_stations(struct iwl_priv *priv) } spin_unlock_irqrestore(&priv->sta_lock, flags); } -EXPORT_SYMBOL_GPL(iwl_legacy_dealloc_bcast_stations); +EXPORT_SYMBOL_GPL(il_dealloc_bcast_stations); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG -static void iwl_legacy_dump_lq_cmd(struct iwl_priv *priv, - struct iwl_link_quality_cmd *lq) +static void il_dump_lq_cmd(struct il_priv *priv, + struct il_link_quality_cmd *lq) { int i; - IWL_DEBUG_RATE(priv, "lq station id 0x%x\n", lq->sta_id); - IWL_DEBUG_RATE(priv, "lq ant 0x%X 0x%X\n", + IL_DEBUG_RATE(priv, "lq station id 0x%x\n", lq->sta_id); + IL_DEBUG_RATE(priv, "lq ant 0x%X 0x%X\n", lq->general_params.single_stream_ant_msk, lq->general_params.dual_stream_ant_msk); for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) - IWL_DEBUG_RATE(priv, "lq index %d 0x%X\n", + IL_DEBUG_RATE(priv, "lq index %d 0x%X\n", i, lq->rs_table[i].rate_n_flags); } #else -static inline void iwl_legacy_dump_lq_cmd(struct iwl_priv *priv, - struct iwl_link_quality_cmd *lq) +static inline void il_dump_lq_cmd(struct il_priv *priv, + struct il_link_quality_cmd *lq) { } #endif /** - * iwl_legacy_is_lq_table_valid() - Test one aspect of LQ cmd for validity + * il_is_lq_table_valid() - Test one aspect of LQ cmd for validity * * It sometimes happens when a HT rate has been in use and we * 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, * Test for this to prevent driver from sending LQ command between the time * RXON flags are updated and when LQ command is updated. */ -static bool iwl_legacy_is_lq_table_valid(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct iwl_link_quality_cmd *lq) +static bool il_is_lq_table_valid(struct il_priv *priv, + struct il_rxon_context *ctx, + struct il_link_quality_cmd *lq) { int i; if (ctx->ht.enabled) return true; - IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", + IL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", ctx->active.channel); for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & RATE_MCS_HT_MSK) { - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "index %d of LQ expects HT channel\n", i); return false; @@ -737,7 +737,7 @@ static bool iwl_legacy_is_lq_table_valid(struct iwl_priv *priv, } /** - * iwl_legacy_send_lq_cmd() - Send link quality command + * il_send_lq_cmd() - Send link quality command * @init: This command is sent as part of station initialization right * after station has been added. * @@ -746,35 +746,35 @@ static bool iwl_legacy_is_lq_table_valid(struct iwl_priv *priv, * this case to clear the state indicating that station creation is in * progress. */ -int iwl_legacy_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - struct iwl_link_quality_cmd *lq, u8 flags, bool init) +int il_send_lq_cmd(struct il_priv *priv, struct il_rxon_context *ctx, + struct il_link_quality_cmd *lq, u8 flags, bool init) { int ret = 0; unsigned long flags_spin; - struct iwl_host_cmd cmd = { + struct il_host_cmd cmd = { .id = REPLY_TX_LINK_QUALITY_CMD, - .len = sizeof(struct iwl_link_quality_cmd), + .len = sizeof(struct il_link_quality_cmd), .flags = flags, .data = lq, }; - if (WARN_ON(lq->sta_id == IWL_INVALID_STATION)) + if (WARN_ON(lq->sta_id == IL_INVALID_STATION)) return -EINVAL; spin_lock_irqsave(&priv->sta_lock, flags_spin); - if (!(priv->stations[lq->sta_id].used & IWL_STA_DRIVER_ACTIVE)) { + if (!(priv->stations[lq->sta_id].used & IL_STA_DRIVER_ACTIVE)) { spin_unlock_irqrestore(&priv->sta_lock, flags_spin); return -EINVAL; } spin_unlock_irqrestore(&priv->sta_lock, flags_spin); - iwl_legacy_dump_lq_cmd(priv, lq); + il_dump_lq_cmd(priv, lq); BUG_ON(init && (cmd.flags & CMD_ASYNC)); - if (iwl_legacy_is_lq_table_valid(priv, ctx, lq)) - ret = iwl_legacy_send_cmd(priv, &cmd); + if (il_is_lq_table_valid(priv, ctx, lq)) + ret = il_send_cmd(priv, &cmd); else ret = -EINVAL; @@ -782,35 +782,35 @@ int iwl_legacy_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, return ret; if (init) { - IWL_DEBUG_INFO(priv, "init LQ command complete," + IL_DEBUG_INFO(priv, "init LQ command complete," " clearing sta addition status for sta %d\n", lq->sta_id); spin_lock_irqsave(&priv->sta_lock, flags_spin); - priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; + priv->stations[lq->sta_id].used &= ~IL_STA_UCODE_INPROGRESS; spin_unlock_irqrestore(&priv->sta_lock, flags_spin); } return ret; } -EXPORT_SYMBOL(iwl_legacy_send_lq_cmd); +EXPORT_SYMBOL(il_send_lq_cmd); -int iwl_legacy_mac_sta_remove(struct ieee80211_hw *hw, +int il_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { - struct iwl_priv *priv = hw->priv; - struct iwl_station_priv_common *sta_common = (void *)sta->drv_priv; + struct il_priv *priv = hw->priv; + struct il_station_priv_common *sta_common = (void *)sta->drv_priv; int ret; - IWL_DEBUG_INFO(priv, "received request to remove station %pM\n", + IL_DEBUG_INFO(priv, "received request to remove station %pM\n", sta->addr); mutex_lock(&priv->mutex); - IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n", + IL_DEBUG_INFO(priv, "proceeding to remove station %pM\n", sta->addr); - ret = iwl_legacy_remove_station(priv, sta_common->sta_id, sta->addr); + ret = il_remove_station(priv, sta_common->sta_id, sta->addr); if (ret) - IWL_ERR(priv, "Error removing station %pM\n", + IL_ERR(priv, "Error removing station %pM\n", sta->addr); mutex_unlock(&priv->mutex); return ret; } -EXPORT_SYMBOL(iwl_legacy_mac_sta_remove); +EXPORT_SYMBOL(il_mac_sta_remove); diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.h b/drivers/net/wireless/iwlegacy/iwl-sta.h index 67bd75f..555b060 100644 --- a/drivers/net/wireless/iwlegacy/iwl-sta.h +++ b/drivers/net/wireless/iwlegacy/iwl-sta.h @@ -26,65 +26,65 @@ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 * *****************************************************************************/ -#ifndef __iwl_legacy_sta_h__ -#define __iwl_legacy_sta_h__ +#ifndef __il_sta_h__ +#define __il_sta_h__ #include "iwl-dev.h" #define HW_KEY_DYNAMIC 0 #define HW_KEY_DEFAULT 1 -#define IWL_STA_DRIVER_ACTIVE BIT(0) /* driver entry is active */ -#define IWL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */ -#define IWL_STA_UCODE_INPROGRESS BIT(2) /* ucode entry is in process of +#define IL_STA_DRIVER_ACTIVE BIT(0) /* driver entry is active */ +#define IL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */ +#define IL_STA_UCODE_INPROGRESS BIT(2) /* ucode entry is in process of being activated */ -#define IWL_STA_LOCAL BIT(3) /* station state not directed by mac80211; +#define IL_STA_LOCAL BIT(3) /* station state not directed by mac80211; (this is for the IBSS BSSID stations) */ -#define IWL_STA_BCAST BIT(4) /* this station is the special bcast station */ - - -void iwl_legacy_restore_stations(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -void iwl_legacy_clear_ucode_stations(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -void iwl_legacy_dealloc_bcast_stations(struct iwl_priv *priv); -int iwl_legacy_get_free_ucode_key_index(struct iwl_priv *priv); -int iwl_legacy_send_add_sta(struct iwl_priv *priv, - struct iwl_legacy_addsta_cmd *sta, u8 flags); -int iwl_legacy_add_station_common(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +#define IL_STA_BCAST BIT(4) /* this station is the special bcast station */ + + +void il_restore_stations(struct il_priv *priv, + struct il_rxon_context *ctx); +void il_clear_ucode_stations(struct il_priv *priv, + struct il_rxon_context *ctx); +void il_dealloc_bcast_stations(struct il_priv *priv); +int il_get_free_ucode_key_index(struct il_priv *priv); +int il_send_add_sta(struct il_priv *priv, + struct il_addsta_cmd *sta, u8 flags); +int il_add_station_common(struct il_priv *priv, + struct il_rxon_context *ctx, const u8 *addr, bool is_ap, struct ieee80211_sta *sta, u8 *sta_id_r); -int iwl_legacy_remove_station(struct iwl_priv *priv, +int il_remove_station(struct il_priv *priv, const u8 sta_id, const u8 *addr); -int iwl_legacy_mac_sta_remove(struct ieee80211_hw *hw, +int il_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta); -u8 iwl_legacy_prep_station(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, +u8 il_prep_station(struct il_priv *priv, + struct il_rxon_context *ctx, const u8 *addr, bool is_ap, struct ieee80211_sta *sta); -int iwl_legacy_send_lq_cmd(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct iwl_link_quality_cmd *lq, +int il_send_lq_cmd(struct il_priv *priv, + struct il_rxon_context *ctx, + struct il_link_quality_cmd *lq, u8 flags, bool init); /** - * iwl_legacy_clear_driver_stations - clear knowledge of all stations from driver + * il_clear_driver_stations - clear knowledge of all stations from driver * @priv: iwl priv struct * - * This is called during iwl_down() to make sure that in the case + * This is called during il_down() to make sure that in the case * we're coming there from a hardware restart mac80211 will be * able to reconfigure stations -- if we're getting there in the * normal down flow then the stations will already be cleared. */ -static inline void iwl_legacy_clear_driver_stations(struct iwl_priv *priv) +static inline void il_clear_driver_stations(struct il_priv *priv) { unsigned long flags; - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; spin_lock_irqsave(&priv->sta_lock, flags); memset(priv->stations, 0, sizeof(priv->stations)); @@ -107,16 +107,16 @@ static inline void iwl_legacy_clear_driver_stations(struct iwl_priv *priv) spin_unlock_irqrestore(&priv->sta_lock, flags); } -static inline int iwl_legacy_sta_id(struct ieee80211_sta *sta) +static inline int il_sta_id(struct ieee80211_sta *sta) { if (WARN_ON(!sta)) - return IWL_INVALID_STATION; + return IL_INVALID_STATION; - return ((struct iwl_station_priv_common *)sta->drv_priv)->sta_id; + return ((struct il_station_priv_common *)sta->drv_priv)->sta_id; } /** - * iwl_legacy_sta_id_or_broadcast - return sta_id or broadcast sta + * il_sta_id_or_broadcast - return sta_id or broadcast sta * @priv: iwl priv * @context: the current context * @sta: mac80211 station @@ -126,8 +126,8 @@ static inline int iwl_legacy_sta_id(struct ieee80211_sta *sta) * that case, we need to use the broadcast station, so this * inline wraps that pattern. */ -static inline int iwl_legacy_sta_id_or_broadcast(struct iwl_priv *priv, - struct iwl_rxon_context *context, +static inline int il_sta_id_or_broadcast(struct il_priv *priv, + struct il_rxon_context *context, struct ieee80211_sta *sta) { int sta_id; @@ -135,14 +135,14 @@ static inline int iwl_legacy_sta_id_or_broadcast(struct iwl_priv *priv, if (!sta) return context->bcast_sta_id; - sta_id = iwl_legacy_sta_id(sta); + sta_id = il_sta_id(sta); /* * mac80211 should not be passing a partially * initialised station! */ - WARN_ON(sta_id == IWL_INVALID_STATION); + WARN_ON(sta_id == IL_INVALID_STATION); return sta_id; } -#endif /* __iwl_legacy_sta_h__ */ +#endif /* __il_sta_h__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c index e1a559b..1c27c60 100644 --- a/drivers/net/wireless/iwlegacy/iwl-tx.c +++ b/drivers/net/wireless/iwlegacy/iwl-tx.c @@ -39,10 +39,10 @@ #include "iwl-helpers.h" /** - * iwl_legacy_txq_update_write_ptr - Send new write index to hardware + * il_txq_update_write_ptr - Send new write index to hardware */ void -iwl_legacy_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq) +il_txq_update_write_ptr(struct il_priv *priv, struct il_tx_queue *txq) { u32 reg = 0; 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) /* wake up nic if it's powered down ... * uCode will wake up, and interrupt us again, so next * time we'll skip this part. */ - reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); + reg = il_read32(priv, CSR_UCODE_DRV_GP1); if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Tx queue %d requesting wakeup," " GP1 = 0x%x\n", txq_id, reg); - iwl_legacy_set_bit(priv, CSR_GP_CNTRL, + il_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); return; } - iwl_legacy_write_direct32(priv, HBUS_TARG_WRPTR, + il_write_direct32(priv, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); /* @@ -75,45 +75,45 @@ iwl_legacy_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq) * trying to tx (during RFKILL, we're not trying to tx). */ } else - iwl_write32(priv, HBUS_TARG_WRPTR, + il_write32(priv, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); txq->need_update = 0; } -EXPORT_SYMBOL(iwl_legacy_txq_update_write_ptr); +EXPORT_SYMBOL(il_txq_update_write_ptr); /** - * iwl_legacy_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's + * il_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's */ -void iwl_legacy_tx_queue_unmap(struct iwl_priv *priv, int txq_id) +void il_tx_queue_unmap(struct il_priv *priv, int txq_id) { - struct iwl_tx_queue *txq = &priv->txq[txq_id]; - struct iwl_queue *q = &txq->q; + struct il_tx_queue *txq = &priv->txq[txq_id]; + struct il_queue *q = &txq->q; if (q->n_bd == 0) return; while (q->write_ptr != q->read_ptr) { priv->cfg->ops->lib->txq_free_tfd(priv, txq); - q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd); + q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd); } } -EXPORT_SYMBOL(iwl_legacy_tx_queue_unmap); +EXPORT_SYMBOL(il_tx_queue_unmap); /** - * iwl_legacy_tx_queue_free - Deallocate DMA queue. + * il_tx_queue_free - Deallocate DMA queue. * @txq: Transmit queue to deallocate. * * Empty queue by removing and destroying all BD's. * Free all buffers. * 0-fill, but do not free "txq" descriptor structure. */ -void iwl_legacy_tx_queue_free(struct iwl_priv *priv, int txq_id) +void il_tx_queue_free(struct il_priv *priv, int txq_id) { - struct iwl_tx_queue *txq = &priv->txq[txq_id]; + struct il_tx_queue *txq = &priv->txq[txq_id]; struct device *dev = &priv->pci_dev->dev; int i; - iwl_legacy_tx_queue_unmap(priv, txq_id); + il_tx_queue_unmap(priv, txq_id); /* De-alloc array of command/tx buffers */ 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) /* 0-fill queue descriptor structure */ memset(txq, 0, sizeof(*txq)); } -EXPORT_SYMBOL(iwl_legacy_tx_queue_free); +EXPORT_SYMBOL(il_tx_queue_free); /** - * iwl_cmd_queue_unmap - Unmap any remaining DMA mappings from command queue + * il_cmd_queue_unmap - Unmap any remaining DMA mappings from command queue */ -void iwl_legacy_cmd_queue_unmap(struct iwl_priv *priv) +void il_cmd_queue_unmap(struct il_priv *priv) { - struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; - struct iwl_queue *q = &txq->q; + struct il_tx_queue *txq = &priv->txq[priv->cmd_queue]; + struct il_queue *q = &txq->q; int i; if (q->n_bd == 0) return; while (q->read_ptr != q->write_ptr) { - i = iwl_legacy_get_cmd_index(q, q->read_ptr, 0); + i = il_get_cmd_index(q, q->read_ptr, 0); if (txq->meta[i].flags & CMD_MAPPED) { pci_unmap_single(priv->pci_dev, @@ -162,7 +162,7 @@ void iwl_legacy_cmd_queue_unmap(struct iwl_priv *priv) txq->meta[i].flags = 0; } - q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd); + q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd); } i = q->n_window; @@ -174,23 +174,23 @@ void iwl_legacy_cmd_queue_unmap(struct iwl_priv *priv) txq->meta[i].flags = 0; } } -EXPORT_SYMBOL(iwl_legacy_cmd_queue_unmap); +EXPORT_SYMBOL(il_cmd_queue_unmap); /** - * iwl_legacy_cmd_queue_free - Deallocate DMA queue. + * il_cmd_queue_free - Deallocate DMA queue. * @txq: Transmit queue to deallocate. * * Empty queue by removing and destroying all BD's. * Free all buffers. * 0-fill, but do not free "txq" descriptor structure. */ -void iwl_legacy_cmd_queue_free(struct iwl_priv *priv) +void il_cmd_queue_free(struct il_priv *priv) { - struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; + struct il_tx_queue *txq = &priv->txq[priv->cmd_queue]; struct device *dev = &priv->pci_dev->dev; int i; - iwl_legacy_cmd_queue_unmap(priv); + il_cmd_queue_unmap(priv); /* De-alloc array of command/tx buffers */ for (i = 0; i <= TFD_CMD_SLOTS; i++) @@ -210,7 +210,7 @@ void iwl_legacy_cmd_queue_free(struct iwl_priv *priv) /* 0-fill queue descriptor structure */ memset(txq, 0, sizeof(*txq)); } -EXPORT_SYMBOL(iwl_legacy_cmd_queue_free); +EXPORT_SYMBOL(il_cmd_queue_free); /*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** * DMA services @@ -235,7 +235,7 @@ EXPORT_SYMBOL(iwl_legacy_cmd_queue_free); * See more detailed info in iwl-4965-hw.h. ***************************************************/ -int iwl_legacy_queue_space(const struct iwl_queue *q) +int il_queue_space(const struct il_queue *q) { int s = q->read_ptr - q->write_ptr; @@ -250,25 +250,25 @@ int iwl_legacy_queue_space(const struct iwl_queue *q) s = 0; return s; } -EXPORT_SYMBOL(iwl_legacy_queue_space); +EXPORT_SYMBOL(il_queue_space); /** - * iwl_legacy_queue_init - Initialize queue's high/low-water and read/write indexes + * il_queue_init - Initialize queue's high/low-water and read/write indexes */ -static int iwl_legacy_queue_init(struct iwl_priv *priv, struct iwl_queue *q, +static int il_queue_init(struct il_priv *priv, struct il_queue *q, int count, int slots_num, u32 id) { q->n_bd = count; q->n_window = slots_num; q->id = id; - /* count must be power-of-two size, otherwise iwl_legacy_queue_inc_wrap - * and iwl_legacy_queue_dec_wrap are broken. */ + /* count must be power-of-two size, otherwise il_queue_inc_wrap + * and il_queue_dec_wrap are broken. */ BUG_ON(!is_power_of_2(count)); /* slots_num must be power-of-two size, otherwise - * iwl_legacy_get_cmd_index is broken. */ + * il_get_cmd_index is broken. */ BUG_ON(!is_power_of_2(slots_num)); 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, } /** - * iwl_legacy_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue + * il_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue */ -static int iwl_legacy_tx_queue_alloc(struct iwl_priv *priv, - struct iwl_tx_queue *txq, u32 id) +static int il_tx_queue_alloc(struct il_priv *priv, + struct il_tx_queue *txq, u32 id) { struct device *dev = &priv->pci_dev->dev; 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, txq->txb = kzalloc(sizeof(txq->txb[0]) * TFD_QUEUE_SIZE_MAX, GFP_KERNEL); if (!txq->txb) { - IWL_ERR(priv, "kmalloc for auxiliary BD " + IL_ERR(priv, "kmalloc for auxiliary BD " "structures failed\n"); goto error; } @@ -312,7 +312,7 @@ static int iwl_legacy_tx_queue_alloc(struct iwl_priv *priv, txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, GFP_KERNEL); if (!txq->tfds) { - IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz); + IL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz); goto error; } txq->q.id = id; @@ -327,9 +327,9 @@ static int iwl_legacy_tx_queue_alloc(struct iwl_priv *priv, } /** - * iwl_legacy_tx_queue_init - Allocate and initialize one tx/cmd queue + * il_tx_queue_init - Allocate and initialize one tx/cmd queue */ -int iwl_legacy_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, +int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq, int slots_num, u32 txq_id) { int i, len; @@ -347,19 +347,19 @@ int iwl_legacy_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, if (txq_id == priv->cmd_queue) actual_slots++; - txq->meta = kzalloc(sizeof(struct iwl_cmd_meta) * actual_slots, + txq->meta = kzalloc(sizeof(struct il_cmd_meta) * actual_slots, GFP_KERNEL); - txq->cmd = kzalloc(sizeof(struct iwl_device_cmd *) * actual_slots, + txq->cmd = kzalloc(sizeof(struct il_device_cmd *) * actual_slots, GFP_KERNEL); if (!txq->meta || !txq->cmd) goto out_free_arrays; - len = sizeof(struct iwl_device_cmd); + len = sizeof(struct il_device_cmd); for (i = 0; i < actual_slots; i++) { /* only happens for cmd queue */ if (i == slots_num) - len = IWL_MAX_CMD_SIZE; + len = IL_MAX_CMD_SIZE; txq->cmd[i] = kmalloc(len, GFP_KERNEL); if (!txq->cmd[i]) @@ -367,7 +367,7 @@ int iwl_legacy_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, } /* Alloc driver data array and TFD circular buffer */ - ret = iwl_legacy_tx_queue_alloc(priv, txq, txq_id); + ret = il_tx_queue_alloc(priv, txq, txq_id); if (ret) goto err; @@ -379,14 +379,14 @@ int iwl_legacy_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, * (if they need one at all). */ if (txq_id < 4) - iwl_legacy_set_swq_id(txq, txq_id, txq_id); + il_set_swq_id(txq, txq_id, txq_id); /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise - * iwl_legacy_queue_inc_wrap and iwl_legacy_queue_dec_wrap are broken. */ + * il_queue_inc_wrap and il_queue_dec_wrap are broken. */ BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); /* Initialize queue's high/low-water marks, and head/tail indexes */ - iwl_legacy_queue_init(priv, &txq->q, + il_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); /* Tell device where to find queue */ @@ -402,9 +402,9 @@ out_free_arrays: return -ENOMEM; } -EXPORT_SYMBOL(iwl_legacy_tx_queue_init); +EXPORT_SYMBOL(il_tx_queue_init); -void iwl_legacy_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq, +void il_tx_queue_reset(struct il_priv *priv, struct il_tx_queue *txq, int slots_num, u32 txq_id) { int actual_slots = slots_num; @@ -412,23 +412,23 @@ void iwl_legacy_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq, if (txq_id == priv->cmd_queue) actual_slots++; - memset(txq->meta, 0, sizeof(struct iwl_cmd_meta) * actual_slots); + memset(txq->meta, 0, sizeof(struct il_cmd_meta) * actual_slots); txq->need_update = 0; /* Initialize queue's high/low-water marks, and head/tail indexes */ - iwl_legacy_queue_init(priv, &txq->q, + il_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); /* Tell device where to find queue */ priv->cfg->ops->lib->txq_init(priv, txq); } -EXPORT_SYMBOL(iwl_legacy_tx_queue_reset); +EXPORT_SYMBOL(il_tx_queue_reset); /*************** HOST COMMAND QUEUE FUNCTIONS *****/ /** - * iwl_legacy_enqueue_hcmd - enqueue a uCode command + * il_enqueue_hcmd - enqueue a uCode command * @priv: device private data point * @cmd: a point to the ucode command structure * @@ -436,12 +436,12 @@ EXPORT_SYMBOL(iwl_legacy_tx_queue_reset); * failed. On success, it turns the index (> 0) of command in the * command queue. */ -int iwl_legacy_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd) { - struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; - struct iwl_queue *q = &txq->q; - struct iwl_device_cmd *out_cmd; - struct iwl_cmd_meta *out_meta; + struct il_tx_queue *txq = &priv->txq[priv->cmd_queue]; + struct il_queue *q = &txq->q; + struct il_device_cmd *out_cmd; + struct il_cmd_meta *out_meta; dma_addr_t phys_addr; unsigned long flags; int len; @@ -458,25 +458,25 @@ int iwl_legacy_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) * of device_cmd and max_cmd_size. */ BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && !(cmd->flags & CMD_SIZE_HUGE)); - BUG_ON(fix_size > IWL_MAX_CMD_SIZE); + BUG_ON(fix_size > IL_MAX_CMD_SIZE); - if (iwl_legacy_is_rfkill(priv) || iwl_legacy_is_ctkill(priv)) { - IWL_WARN(priv, "Not sending command - %s KILL\n", - iwl_legacy_is_rfkill(priv) ? "RF" : "CT"); + if (il_is_rfkill(priv) || il_is_ctkill(priv)) { + IL_WARN(priv, "Not sending command - %s KILL\n", + il_is_rfkill(priv) ? "RF" : "CT"); return -EIO; } spin_lock_irqsave(&priv->hcmd_lock, flags); - if (iwl_legacy_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) { + if (il_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) { spin_unlock_irqrestore(&priv->hcmd_lock, flags); - IWL_ERR(priv, "Restarting adapter due to command queue full\n"); + IL_ERR(priv, "Restarting adapter due to command queue full\n"); queue_work(priv->workqueue, &priv->restart); return -ENOSPC; } - idx = iwl_legacy_get_cmd_index(q, q->write_ptr, cmd->flags & CMD_SIZE_HUGE); + idx = il_get_cmd_index(q, q->write_ptr, cmd->flags & CMD_SIZE_HUGE); out_cmd = txq->cmd[idx]; out_meta = &txq->meta[idx]; @@ -503,26 +503,26 @@ int iwl_legacy_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) INDEX_TO_SEQ(q->write_ptr)); if (cmd->flags & CMD_SIZE_HUGE) out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; - len = sizeof(struct iwl_device_cmd); + len = sizeof(struct il_device_cmd); if (idx == TFD_CMD_SLOTS) - len = IWL_MAX_CMD_SIZE; + len = IL_MAX_CMD_SIZE; #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG switch (out_cmd->hdr.cmd) { case REPLY_TX_LINK_QUALITY_CMD: case SENSITIVITY_CMD: - IWL_DEBUG_HC_DUMP(priv, + IL_DEBUG_HC_DUMP(priv, "Sending command %s (#%x), seq: 0x%04X, " "%d bytes at %d[%d]:%d\n", - iwl_legacy_get_cmd_string(out_cmd->hdr.cmd), + il_get_cmd_string(out_cmd->hdr.cmd), out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), fix_size, q->write_ptr, idx, priv->cmd_queue); break; default: - IWL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, " + IL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, " "%d bytes at %d[%d]:%d\n", - iwl_legacy_get_cmd_string(out_cmd->hdr.cmd), + il_get_cmd_string(out_cmd->hdr.cmd), out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), fix_size, 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) U32_PAD(cmd->len)); /* Increment and update queue's write index */ - q->write_ptr = iwl_legacy_queue_inc_wrap(q->write_ptr, q->n_bd); - iwl_legacy_txq_update_write_ptr(priv, txq); + q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); + il_txq_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->hcmd_lock, flags); return idx; } /** - * iwl_legacy_hcmd_queue_reclaim - Reclaim TX command queue entries already Tx'd + * il_hcmd_queue_reclaim - Reclaim TX command queue entries already Tx'd * * When FW advances 'R' index, all entries between old and new 'R' index * need to be reclaimed. As result, some free space forms. If there is * enough free space (> low mark), wake the stack that feeds us. */ -static void iwl_legacy_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, +static void il_hcmd_queue_reclaim(struct il_priv *priv, int txq_id, int idx, int cmd_idx) { - struct iwl_tx_queue *txq = &priv->txq[txq_id]; - struct iwl_queue *q = &txq->q; + struct il_tx_queue *txq = &priv->txq[txq_id]; + struct il_queue *q = &txq->q; int nfreed = 0; - if ((idx >= q->n_bd) || (iwl_legacy_queue_used(q, idx) == 0)) { - IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " + if ((idx >= q->n_bd) || (il_queue_used(q, idx) == 0)) { + IL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " "is out of range [0-%d] %d %d.\n", txq_id, idx, q->n_bd, q->write_ptr, q->read_ptr); return; } - for (idx = iwl_legacy_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; - q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) { + for (idx = il_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; + q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { if (nfreed++ > 0) { - IWL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", idx, + IL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", idx, q->write_ptr, q->read_ptr); queue_work(priv->workqueue, &priv->restart); } @@ -585,7 +585,7 @@ static void iwl_legacy_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, } /** - * iwl_legacy_tx_cmd_complete - Pull unused buffers off the queue and reclaim them + * il_tx_cmd_complete - Pull unused buffers off the queue and reclaim them * @rxb: Rx buffer to reclaim * * 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, * if the callback returns 1 */ void -iwl_legacy_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) +il_tx_cmd_complete(struct il_priv *priv, struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); u16 sequence = le16_to_cpu(pkt->hdr.sequence); int txq_id = SEQ_TO_QUEUE(sequence); int index = SEQ_TO_INDEX(sequence); int cmd_index; bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME); - struct iwl_device_cmd *cmd; - struct iwl_cmd_meta *meta; - struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; + struct il_device_cmd *cmd; + struct il_cmd_meta *meta; + struct il_tx_queue *txq = &priv->txq[priv->cmd_queue]; unsigned long flags; /* 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) txq_id, priv->cmd_queue, sequence, priv->txq[priv->cmd_queue].q.read_ptr, priv->txq[priv->cmd_queue].q.write_ptr)) { - iwl_print_hex_error(priv, pkt, 32); + il_print_hex_error(priv, pkt, 32); return; } - cmd_index = iwl_legacy_get_cmd_index(&txq->q, index, huge); + cmd_index = il_get_cmd_index(&txq->q, index, huge); cmd = txq->cmd[cmd_index]; meta = &txq->meta[cmd_index]; @@ -638,12 +638,12 @@ iwl_legacy_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) spin_lock_irqsave(&priv->hcmd_lock, flags); - iwl_legacy_hcmd_queue_reclaim(priv, txq_id, index, cmd_index); + il_hcmd_queue_reclaim(priv, txq_id, index, cmd_index); if (!(meta->flags & CMD_ASYNC)) { clear_bit(STATUS_HCMD_ACTIVE, &priv->status); - IWL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s\n", - iwl_legacy_get_cmd_string(cmd->hdr.cmd)); + IL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s\n", + il_get_cmd_string(cmd->hdr.cmd)); wake_up(&priv->wait_command_queue); } @@ -652,4 +652,4 @@ iwl_legacy_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) spin_unlock_irqrestore(&priv->hcmd_lock, flags); } -EXPORT_SYMBOL(iwl_legacy_tx_cmd_complete); +EXPORT_SYMBOL(il_tx_cmd_complete); diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c index 7507819..d24937a 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); MODULE_LICENSE("GPL"); /* module parameters */ -struct iwl_mod_params iwl3945_mod_params = { +struct il_mod_params il3945_mod_params = { .sw_crypto = 1, .restart_fw = 1, .disable_hw_scan = 1, @@ -97,43 +97,43 @@ struct iwl_mod_params iwl3945_mod_params = { }; /** - * iwl3945_get_antenna_flags - Get antenna flags for RXON command + * il3945_get_antenna_flags - Get antenna flags for RXON command * @priv: eeprom and antenna fields are used to determine antenna flags * * priv->eeprom39 is used to determine if antenna AUX/MAIN are reversed - * iwl3945_mod_params.antenna specifies the antenna diversity mode: + * il3945_mod_params.antenna specifies the antenna diversity mode: * - * IWL_ANTENNA_DIVERSITY - NIC selects best antenna by itself - * IWL_ANTENNA_MAIN - Force MAIN antenna - * IWL_ANTENNA_AUX - Force AUX antenna + * IL_ANTENNA_DIVERSITY - NIC selects best antenna by itself + * IL_ANTENNA_MAIN - Force MAIN antenna + * IL_ANTENNA_AUX - Force AUX antenna */ -__le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv) +__le32 il3945_get_antenna_flags(const struct il_priv *priv) { - struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; - switch (iwl3945_mod_params.antenna) { - case IWL_ANTENNA_DIVERSITY: + switch (il3945_mod_params.antenna) { + case IL_ANTENNA_DIVERSITY: return 0; - case IWL_ANTENNA_MAIN: + case IL_ANTENNA_MAIN: if (eeprom->antenna_switch_type) return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK; return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK; - case IWL_ANTENNA_AUX: + case IL_ANTENNA_AUX: if (eeprom->antenna_switch_type) return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK; return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK; } /* bad antenna selector value */ - IWL_ERR(priv, "Bad antenna selector value (0x%x)\n", - iwl3945_mod_params.antenna); + IL_ERR(priv, "Bad antenna selector value (0x%x)\n", + il3945_mod_params.antenna); return 0; /* "diversity" is default if error */ } -static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, +static int il3945_set_ccmp_dynamic_key_info(struct il_priv *priv, struct ieee80211_key_conf *keyconf, u8 sta_id) { @@ -144,7 +144,7 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); - if (sta_id == priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id) + if (sta_id == priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id) key_flags |= STA_KEY_MULTICAST_MSK; keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; @@ -163,7 +163,7 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) == STA_KEY_FLG_NO_ENC) priv->stations[sta_id].sta.key.key_offset = - iwl_legacy_get_free_ucode_key_index(priv); + il_get_free_ucode_key_index(priv); /* else, we are overriding an existing key => no need to allocated room * in uCode. */ @@ -174,9 +174,9 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - IWL_DEBUG_INFO(priv, "hwcrypto: modify ucode station key info\n"); + IL_DEBUG_INFO(priv, "hwcrypto: modify ucode station key info\n"); - ret = iwl_legacy_send_add_sta(priv, + ret = il_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); spin_unlock_irqrestore(&priv->sta_lock, flags); @@ -184,40 +184,40 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, return ret; } -static int iwl3945_set_tkip_dynamic_key_info(struct iwl_priv *priv, +static int il3945_set_tkip_dynamic_key_info(struct il_priv *priv, struct ieee80211_key_conf *keyconf, u8 sta_id) { return -EOPNOTSUPP; } -static int iwl3945_set_wep_dynamic_key_info(struct iwl_priv *priv, +static int il3945_set_wep_dynamic_key_info(struct il_priv *priv, struct ieee80211_key_conf *keyconf, u8 sta_id) { return -EOPNOTSUPP; } -static int iwl3945_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id) +static int il3945_clear_sta_key_info(struct il_priv *priv, u8 sta_id) { unsigned long flags; - struct iwl_legacy_addsta_cmd sta_cmd; + struct il_addsta_cmd sta_cmd; spin_lock_irqsave(&priv->sta_lock, flags); - memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key)); + memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct il_hw_key)); memset(&priv->stations[sta_id].sta.key, 0, - sizeof(struct iwl4965_keyinfo)); + sizeof(struct il4965_keyinfo)); priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_legacy_addsta_cmd)); + memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct il_addsta_cmd)); spin_unlock_irqrestore(&priv->sta_lock, flags); - IWL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n"); - return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); + IL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n"); + return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); } -static int iwl3945_set_dynamic_key(struct iwl_priv *priv, +static int il3945_set_dynamic_key(struct il_priv *priv, struct ieee80211_key_conf *keyconf, u8 sta_id) { int ret = 0; @@ -226,75 +226,75 @@ static int iwl3945_set_dynamic_key(struct iwl_priv *priv, switch (keyconf->cipher) { case WLAN_CIPHER_SUITE_CCMP: - ret = iwl3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); + ret = il3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); break; case WLAN_CIPHER_SUITE_TKIP: - ret = iwl3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id); + ret = il3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id); break; case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: - ret = iwl3945_set_wep_dynamic_key_info(priv, keyconf, sta_id); + ret = il3945_set_wep_dynamic_key_info(priv, keyconf, sta_id); break; default: - IWL_ERR(priv, "Unknown alg: %s alg=%x\n", __func__, + IL_ERR(priv, "Unknown alg: %s alg=%x\n", __func__, keyconf->cipher); ret = -EINVAL; } - IWL_DEBUG_WEP(priv, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n", + IL_DEBUG_WEP(priv, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n", keyconf->cipher, keyconf->keylen, keyconf->keyidx, sta_id, ret); return ret; } -static int iwl3945_remove_static_key(struct iwl_priv *priv) +static int il3945_remove_static_key(struct il_priv *priv) { int ret = -EOPNOTSUPP; return ret; } -static int iwl3945_set_static_key(struct iwl_priv *priv, +static int il3945_set_static_key(struct il_priv *priv, struct ieee80211_key_conf *key) { if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || key->cipher == WLAN_CIPHER_SUITE_WEP104) return -EOPNOTSUPP; - IWL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher); + IL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher); return -EINVAL; } -static void iwl3945_clear_free_frames(struct iwl_priv *priv) +static void il3945_clear_free_frames(struct il_priv *priv) { struct list_head *element; - IWL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", + IL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", priv->frames_count); while (!list_empty(&priv->free_frames)) { element = priv->free_frames.next; list_del(element); - kfree(list_entry(element, struct iwl3945_frame, list)); + kfree(list_entry(element, struct il3945_frame, list)); priv->frames_count--; } if (priv->frames_count) { - IWL_WARN(priv, "%d frames still in use. Did we lose one?\n", + IL_WARN(priv, "%d frames still in use. Did we lose one?\n", priv->frames_count); priv->frames_count = 0; } } -static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl_priv *priv) +static struct il3945_frame *il3945_get_free_frame(struct il_priv *priv) { - struct iwl3945_frame *frame; + struct il3945_frame *frame; struct list_head *element; if (list_empty(&priv->free_frames)) { frame = kzalloc(sizeof(*frame), GFP_KERNEL); if (!frame) { - IWL_ERR(priv, "Could not allocate frame!\n"); + IL_ERR(priv, "Could not allocate frame!\n"); return NULL; } @@ -304,21 +304,21 @@ static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl_priv *priv) element = priv->free_frames.next; list_del(element); - return list_entry(element, struct iwl3945_frame, list); + return list_entry(element, struct il3945_frame, list); } -static void iwl3945_free_frame(struct iwl_priv *priv, struct iwl3945_frame *frame) +static void il3945_free_frame(struct il_priv *priv, struct il3945_frame *frame) { memset(frame, 0, sizeof(*frame)); list_add(&frame->list, &priv->free_frames); } -unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, +unsigned int il3945_fill_beacon_frame(struct il_priv *priv, struct ieee80211_hdr *hdr, int left) { - if (!iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS) || !priv->beacon_skb) + if (!il_is_associated(priv, IL_RXON_CTX_BSS) || !priv->beacon_skb) return 0; if (priv->beacon_skb->len > left) @@ -329,51 +329,51 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, return priv->beacon_skb->len; } -static int iwl3945_send_beacon_cmd(struct iwl_priv *priv) +static int il3945_send_beacon_cmd(struct il_priv *priv) { - struct iwl3945_frame *frame; + struct il3945_frame *frame; unsigned int frame_size; int rc; u8 rate; - frame = iwl3945_get_free_frame(priv); + frame = il3945_get_free_frame(priv); if (!frame) { - IWL_ERR(priv, "Could not obtain free frame buffer for beacon " + IL_ERR(priv, "Could not obtain free frame buffer for beacon " "command.\n"); return -ENOMEM; } - rate = iwl_legacy_get_lowest_plcp(priv, - &priv->contexts[IWL_RXON_CTX_BSS]); + rate = il_get_lowest_plcp(priv, + &priv->contexts[IL_RXON_CTX_BSS]); - frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate); + frame_size = il3945_hw_get_beacon_cmd(priv, frame, rate); - rc = iwl_legacy_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, + rc = il_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, &frame->u.cmd[0]); - iwl3945_free_frame(priv, frame); + il3945_free_frame(priv, frame); return rc; } -static void iwl3945_unset_hw_params(struct iwl_priv *priv) +static void il3945_unset_hw_params(struct il_priv *priv) { if (priv->_3945.shared_virt) dma_free_coherent(&priv->pci_dev->dev, - sizeof(struct iwl3945_shared), + sizeof(struct il3945_shared), priv->_3945.shared_virt, priv->_3945.shared_phys); } -static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, +static void il3945_build_tx_cmd_hwcrypto(struct il_priv *priv, struct ieee80211_tx_info *info, - struct iwl_device_cmd *cmd, + struct il_device_cmd *cmd, struct sk_buff *skb_frag, int sta_id) { - struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; - struct iwl_hw_key *keyinfo = &priv->stations[sta_id].keyinfo; + struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; + struct il_hw_key *keyinfo = &priv->stations[sta_id].keyinfo; tx_cmd->sec_ctl = 0; @@ -381,7 +381,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, case WLAN_CIPHER_SUITE_CCMP: tx_cmd->sec_ctl = TX_CMD_SEC_CCM; memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); - IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); + IL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); break; case WLAN_CIPHER_SUITE_TKIP: @@ -396,12 +396,12 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); - IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption " + IL_DEBUG_TX(priv, "Configuring packet for WEP encryption " "with key %d\n", info->control.hw_key->hw_key_idx); break; default: - IWL_ERR(priv, "Unknown encode cipher %x\n", keyinfo->cipher); + IL_ERR(priv, "Unknown encode cipher %x\n", keyinfo->cipher); break; } } @@ -409,12 +409,12 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, /* * handle build REPLY_TX command notification. */ -static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, - struct iwl_device_cmd *cmd, +static void il3945_build_tx_cmd_basic(struct il_priv *priv, + struct il_device_cmd *cmd, struct ieee80211_tx_info *info, struct ieee80211_hdr *hdr, u8 std_id) { - struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; + struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; __le32 tx_flags = tx_cmd->tx_flags; __le16 fc = hdr->frame_control; @@ -443,7 +443,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; } - iwl_legacy_tx_cmd_protection(priv, info, fc, &tx_flags); + il_tx_cmd_protection(priv, info, fc, &tx_flags); tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); if (ieee80211_is_mgmt(fc)) { @@ -463,15 +463,15 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, /* * start REPLY_TX command process */ -static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) +static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct iwl3945_tx_cmd *tx_cmd; - struct iwl_tx_queue *txq = NULL; - struct iwl_queue *q = NULL; - struct iwl_device_cmd *out_cmd; - struct iwl_cmd_meta *out_meta; + struct il3945_tx_cmd *tx_cmd; + struct il_tx_queue *txq = NULL; + struct il_queue *q = NULL; + struct il_device_cmd *out_cmd; + struct il_cmd_meta *out_meta; dma_addr_t phys_addr; dma_addr_t txcmd_phys; 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) unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - if (iwl_legacy_is_rfkill(priv)) { - IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); + if (il_is_rfkill(priv)) { + IL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); goto drop_unlock; } - if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == IWL_INVALID_RATE) { - IWL_ERR(priv, "ERROR: No TX rate available.\n"); + if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == IL_INVALID_RATE) { + IL_ERR(priv, "ERROR: No TX rate available.\n"); goto drop_unlock; } @@ -502,11 +502,11 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG if (ieee80211_is_auth(fc)) - IWL_DEBUG_TX(priv, "Sending AUTH frame\n"); + IL_DEBUG_TX(priv, "Sending AUTH frame\n"); else if (ieee80211_is_assoc_req(fc)) - IWL_DEBUG_TX(priv, "Sending ASSOC frame\n"); + IL_DEBUG_TX(priv, "Sending ASSOC frame\n"); else if (ieee80211_is_reassoc_req(fc)) - IWL_DEBUG_TX(priv, "Sending REASSOC frame\n"); + IL_DEBUG_TX(priv, "Sending REASSOC frame\n"); #endif spin_unlock_irqrestore(&priv->lock, flags); @@ -514,16 +514,16 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) hdr_len = ieee80211_hdrlen(fc); /* Find index into station table for destination station */ - sta_id = iwl_legacy_sta_id_or_broadcast( - priv, &priv->contexts[IWL_RXON_CTX_BSS], + sta_id = il_sta_id_or_broadcast( + priv, &priv->contexts[IL_RXON_CTX_BSS], info->control.sta); - if (sta_id == IWL_INVALID_STATION) { - IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", + if (sta_id == IL_INVALID_STATION) { + IL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", hdr->addr1); goto drop; } - IWL_DEBUG_RATE(priv, "station Id %d\n", sta_id); + IL_DEBUG_RATE(priv, "station Id %d\n", sta_id); if (ieee80211_is_data_qos(fc)) { u8 *qc = ieee80211_get_qos_ctl(hdr); @@ -536,22 +536,22 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) txq = &priv->txq[txq_id]; q = &txq->q; - if ((iwl_legacy_queue_space(q) < q->high_mark)) + if ((il_queue_space(q) < q->high_mark)) goto drop; spin_lock_irqsave(&priv->lock, flags); - idx = iwl_legacy_get_cmd_index(q, q->write_ptr, 0); + idx = il_get_cmd_index(q, q->write_ptr, 0); /* Set up driver data for this TFD */ - memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); + memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info)); txq->txb[q->write_ptr].skb = skb; - txq->txb[q->write_ptr].ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + txq->txb[q->write_ptr].ctx = &priv->contexts[IL_RXON_CTX_BSS]; /* Init first empty entry in queue's array of Tx/cmd buffers */ out_cmd = txq->cmd[idx]; out_meta = &txq->meta[idx]; - tx_cmd = (struct iwl3945_tx_cmd *)out_cmd->cmd.payload; + tx_cmd = (struct il3945_tx_cmd *)out_cmd->cmd.payload; memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); memset(tx_cmd, 0, sizeof(*tx_cmd)); @@ -570,20 +570,20 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) if (info->control.hw_key) - iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id); + il3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id); /* TODO need this for burst mode later on */ - iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id); + il3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id); /* set is_hcca to 0; it probably will never be implemented */ - iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0); + il3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0); /* Total # bytes to be transmitted */ len = (u16)skb->len; tx_cmd->len = cpu_to_le16(len); - iwl_legacy_dbg_log_tx_data_frame(priv, len, hdr); - iwl_legacy_update_stats(priv, true, fc, len); + il_dbg_log_tx_data_frame(priv, len, hdr); + il_update_stats(priv, true, fc, len); tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; @@ -594,11 +594,11 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) txq->need_update = 0; } - IWL_DEBUG_TX(priv, "sequence nr = 0X%x\n", + IL_DEBUG_TX(priv, "sequence nr = 0X%x\n", le16_to_cpu(out_cmd->hdr.sequence)); - IWL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); - iwl_print_hex_dump(priv, IWL_DL_TX, tx_cmd, sizeof(*tx_cmd)); - iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, + IL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); + il_print_hex_dump(priv, IL_DL_TX, tx_cmd, sizeof(*tx_cmd)); + il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd->hdr, ieee80211_hdrlen(fc)); /* @@ -610,8 +610,8 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) * of the MAC header (device reads on dword boundaries). * We'll tell device about this padding later. */ - len = sizeof(struct iwl3945_tx_cmd) + - sizeof(struct iwl_cmd_header) + hdr_len; + len = sizeof(struct il3945_tx_cmd) + + sizeof(struct il_cmd_header) + hdr_len; len = (len + 3) & ~3; /* 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) /* Tell device the write index *just past* this latest filled TFD */ - q->write_ptr = iwl_legacy_queue_inc_wrap(q->write_ptr, q->n_bd); - iwl_legacy_txq_update_write_ptr(priv, txq); + q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); + il_txq_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); - if ((iwl_legacy_queue_space(q) < q->high_mark) + if ((il_queue_space(q) < q->high_mark) && priv->mac80211_registered) { if (wait_write_ptr) { spin_lock_irqsave(&priv->lock, flags); txq->need_update = 1; - iwl_legacy_txq_update_write_ptr(priv, txq); + il_txq_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); } - iwl_legacy_stop_queue(priv, txq); + il_stop_queue(priv, txq); } return 0; @@ -666,13 +666,13 @@ drop: return -1; } -static int iwl3945_get_measurement(struct iwl_priv *priv, +static int il3945_get_measurement(struct il_priv *priv, struct ieee80211_measurement_params *params, u8 type) { - struct iwl_spectrum_cmd spectrum; - struct iwl_rx_packet *pkt; - struct iwl_host_cmd cmd = { + struct il_spectrum_cmd spectrum; + struct il_rx_packet *pkt; + struct il_host_cmd cmd = { .id = REPLY_SPECTRUM_MEASUREMENT_CMD, .data = (void *)&spectrum, .flags = CMD_WANT_SKB, @@ -681,10 +681,10 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, int rc; int spectrum_resp_status; int duration = le16_to_cpu(params->duration); - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; - if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) - add_time = iwl_legacy_usecs_to_beacons(priv, + if (il_is_associated(priv, IL_RXON_CTX_BSS)) + add_time = il_usecs_to_beacons(priv, le64_to_cpu(params->start_time) - priv->_3945.last_tsf, le16_to_cpu(ctx->timing.beacon_interval)); @@ -697,9 +697,9 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, cmd.len = sizeof(spectrum); spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); - if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) + if (il_is_associated(priv, IL_RXON_CTX_BSS)) spectrum.start_time = - iwl_legacy_add_beacon_time(priv, + il_add_beacon_time(priv, priv->_3945.last_beacon_time, add_time, le16_to_cpu(ctx->timing.beacon_interval)); else @@ -712,13 +712,13 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, spectrum.flags |= RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; - rc = iwl_legacy_send_cmd_sync(priv, &cmd); + rc = il_send_cmd_sync(priv, &cmd); if (rc) return rc; - pkt = (struct iwl_rx_packet *)cmd.reply_page; - if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { - IWL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n"); + pkt = (struct il_rx_packet *)cmd.reply_page; + if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { + IL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n"); rc = -EIO; } @@ -726,7 +726,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, switch (spectrum_resp_status) { case 0: /* Command will be handled */ if (pkt->u.spectrum.id != 0xff) { - IWL_DEBUG_INFO(priv, "Replaced existing measurement: %d\n", + IL_DEBUG_INFO(priv, "Replaced existing measurement: %d\n", pkt->u.spectrum.id); priv->measurement_status &= ~MEASUREMENT_READY; } @@ -739,36 +739,36 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, break; } - iwl_legacy_free_pages(priv, cmd.reply_page); + il_free_pages(priv, cmd.reply_page); return rc; } -static void iwl3945_rx_reply_alive(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il3945_rx_reply_alive(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_alive_resp *palive; + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_alive_resp *palive; struct delayed_work *pwork; palive = &pkt->u.alive_frame; - IWL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " + IL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " "0x%01X 0x%01X\n", palive->is_valid, palive->ver_type, palive->ver_subtype); if (palive->ver_subtype == INITIALIZE_SUBTYPE) { - IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); + IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); memcpy(&priv->card_alive_init, &pkt->u.alive_frame, - sizeof(struct iwl_alive_resp)); + sizeof(struct il_alive_resp)); pwork = &priv->init_alive_start; } else { - IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); + IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); memcpy(&priv->card_alive, &pkt->u.alive_frame, - sizeof(struct iwl_alive_resp)); + sizeof(struct il_alive_resp)); pwork = &priv->alive_start; - iwl3945_disable_events(priv); + il3945_disable_events(priv); } /* We delay the ALIVE response by 5ms to @@ -777,28 +777,28 @@ static void iwl3945_rx_reply_alive(struct iwl_priv *priv, queue_delayed_work(priv->workqueue, pwork, msecs_to_jiffies(5)); else - IWL_WARN(priv, "uCode did not respond OK.\n"); + IL_WARN(priv, "uCode did not respond OK.\n"); } -static void iwl3945_rx_reply_add_sta(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il3945_rx_reply_add_sta(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); #endif - IWL_DEBUG_RX(priv, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); + IL_DEBUG_RX(priv, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); } -static void iwl3945_rx_beacon_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il3945_rx_beacon_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status); + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il3945_beacon_notif *beacon = &(pkt->u.beacon_status); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG u8 rate = beacon->beacon_notify_hdr.rate; - IWL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " + IL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " "tsf %d %d rate %d\n", le32_to_cpu(beacon->beacon_notify_hdr.status) & TX_STATUS_MSK, beacon->beacon_notify_hdr.failure_frame, @@ -813,18 +813,18 @@ static void iwl3945_rx_beacon_notif(struct iwl_priv *priv, /* Handle notification from uCode that card's power state is changing * due to software, hardware, or critical temperature RFKILL */ -static void iwl3945_rx_card_state_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il3945_rx_card_state_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); unsigned long status = priv->status; - IWL_WARN(priv, "Card state received: HW:%s SW:%s\n", + IL_WARN(priv, "Card state received: HW:%s SW:%s\n", (flags & HW_CARD_DISABLED) ? "Kill" : "On", (flags & SW_CARD_DISABLED) ? "Kill" : "On"); - iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, + il_write32(priv, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); if (flags & HW_CARD_DISABLED) @@ -833,7 +833,7 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv, clear_bit(STATUS_RF_KILL_HW, &priv->status); - iwl_legacy_scan_cancel(priv); + il_scan_cancel(priv); if ((test_bit(STATUS_RF_KILL_HW, &status) != test_bit(STATUS_RF_KILL_HW, &priv->status))) @@ -844,7 +844,7 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv, } /** - * iwl3945_setup_rx_handlers - Initialize Rx handler callbacks + * il3945_setup_rx_handlers - Initialize Rx handler callbacks * * Setup the RX handlers for each of the reply types sent from the uCode * to the host. @@ -852,32 +852,32 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv, * This function chains into the hardware specific files for them to setup * any hardware specific handlers as well. */ -static void iwl3945_setup_rx_handlers(struct iwl_priv *priv) +static void il3945_setup_rx_handlers(struct il_priv *priv) { - priv->rx_handlers[REPLY_ALIVE] = iwl3945_rx_reply_alive; - priv->rx_handlers[REPLY_ADD_STA] = iwl3945_rx_reply_add_sta; - priv->rx_handlers[REPLY_ERROR] = iwl_legacy_rx_reply_error; - priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_legacy_rx_csa; + priv->rx_handlers[REPLY_ALIVE] = il3945_rx_reply_alive; + priv->rx_handlers[REPLY_ADD_STA] = il3945_rx_reply_add_sta; + priv->rx_handlers[REPLY_ERROR] = il_rx_reply_error; + priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa; priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = - iwl_legacy_rx_spectrum_measure_notif; - priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_legacy_rx_pm_sleep_notif; + il_rx_spectrum_measure_notif; + priv->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif; priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = - iwl_legacy_rx_pm_debug_statistics_notif; - priv->rx_handlers[BEACON_NOTIFICATION] = iwl3945_rx_beacon_notif; + il_rx_pm_debug_statistics_notif; + priv->rx_handlers[BEACON_NOTIFICATION] = il3945_rx_beacon_notif; /* * The same handler is used for both the REPLY to a discrete * statistics request from the host as well as for the periodic * statistics notifications (after received beacons) from the uCode. */ - priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl3945_reply_statistics; - priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl3945_hw_rx_statistics; + priv->rx_handlers[REPLY_STATISTICS_CMD] = il3945_reply_statistics; + priv->rx_handlers[STATISTICS_NOTIFICATION] = il3945_hw_rx_statistics; - iwl_legacy_setup_rx_scan_handlers(priv); - priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl3945_rx_card_state_notif; + il_setup_rx_scan_handlers(priv); + priv->rx_handlers[CARD_STATE_NOTIFICATION] = il3945_rx_card_state_notif; /* Set up hardware specific Rx handlers */ - iwl3945_hw_rx_handler_setup(priv); + il3945_hw_rx_handler_setup(priv); } /************************** RX-FUNCTIONS ****************************/ @@ -885,7 +885,7 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv) * Rx theory of operation * * The host allocates 32 DMA target addresses and passes the host address - * to the firmware at register IWL_RFDS_TABLE_LOWER + N * RFD_SIZE where N is + * to the firmware at register IL_RFDS_TABLE_LOWER + N * RFD_SIZE where N is * 0 to 31 * * Rx Queue Indexes @@ -914,7 +914,7 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv) * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled * to replenish the iwl->rxq->rx_free. - * + In iwl3945_rx_replenish (scheduled) if 'processed' != 'read' then the + * + In il3945_rx_replenish (scheduled) if 'processed' != 'read' then the * iwl->rxq is replenished and the READ INDEX is updated (updating the * 'processed' and 'read' driver indexes as well) * + 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) * * Driver sequence: * - * iwl3945_rx_replenish() Replenishes rx_free list from rx_used, and calls - * iwl3945_rx_queue_restock - * iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx + * il3945_rx_replenish() Replenishes rx_free list from rx_used, and calls + * il3945_rx_queue_restock + * il3945_rx_queue_restock() Moves available buffers from rx_free into Rx * queue, updates firmware pointers, and updates * the WRITE index. If insufficient rx_free buffers - * are available, schedules iwl3945_rx_replenish + * are available, schedules il3945_rx_replenish * * -- enable interrupts -- - * ISR - iwl3945_rx() Detach iwl_rx_mem_buffers from pool up to the + * ISR - il3945_rx() Detach il_rx_mem_buffers from pool up to the * READ INDEX, detaching the SKB from the pool. * Moves the packet buffer from queue to rx_used. - * Calls iwl3945_rx_queue_restock to refill any empty + * Calls il3945_rx_queue_restock to refill any empty * slots. * ... * */ /** - * iwl3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr + * il3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr */ -static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl_priv *priv, +static inline __le32 il3945_dma_addr2rbd_ptr(struct il_priv *priv, dma_addr_t dma_addr) { return cpu_to_le32((u32)dma_addr); } /** - * iwl3945_rx_queue_restock - refill RX queue from pre-allocated pool + * il3945_rx_queue_restock - refill RX queue from pre-allocated pool * * If there are slots in the RX queue that need to be restocked, * 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, * also updates the memory address in the firmware to reference the new * target buffer. */ -static void iwl3945_rx_queue_restock(struct iwl_priv *priv) +static void il3945_rx_queue_restock(struct il_priv *priv) { - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_rx_queue *rxq = &priv->rxq; struct list_head *element; - struct iwl_rx_mem_buffer *rxb; + struct il_rx_mem_buffer *rxb; unsigned long flags; int write; spin_lock_irqsave(&rxq->lock, flags); write = rxq->write & ~0x7; - while ((iwl_legacy_rx_queue_space(rxq) > 0) && (rxq->free_count)) { + while ((il_rx_queue_space(rxq) > 0) && (rxq->free_count)) { /* Get next free Rx buffer, remove from free list */ element = rxq->rx_free.next; - rxb = list_entry(element, struct iwl_rx_mem_buffer, list); + rxb = list_entry(element, struct il_rx_mem_buffer, list); list_del(element); /* Point to Rx buffer via next RBD in circular buffer */ - rxq->bd[rxq->write] = iwl3945_dma_addr2rbd_ptr(priv, rxb->page_dma); + rxq->bd[rxq->write] = il3945_dma_addr2rbd_ptr(priv, rxb->page_dma); rxq->queue[rxq->write] = rxb; rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; rxq->free_count--; @@ -1000,23 +1000,23 @@ static void iwl3945_rx_queue_restock(struct iwl_priv *priv) spin_lock_irqsave(&rxq->lock, flags); rxq->need_update = 1; spin_unlock_irqrestore(&rxq->lock, flags); - iwl_legacy_rx_queue_update_write_ptr(priv, rxq); + il_rx_queue_update_write_ptr(priv, rxq); } } /** - * iwl3945_rx_replenish - Move all used packet from rx_used to rx_free + * il3945_rx_replenish - Move all used packet from rx_used to rx_free * * When moving to rx_free an SKB is allocated for the slot. * - * Also restock the Rx queue via iwl3945_rx_queue_restock. + * Also restock the Rx queue via il3945_rx_queue_restock. * This is called as a scheduled work item (except for during initialization) */ -static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority) +static void il3945_rx_allocate(struct il_priv *priv, gfp_t priority) { - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_rx_queue *rxq = &priv->rxq; struct list_head *element; - struct iwl_rx_mem_buffer *rxb; + struct il_rx_mem_buffer *rxb; struct page *page; unsigned long flags; gfp_t gfp_mask = priority; @@ -1040,10 +1040,10 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority) page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order); if (!page) { if (net_ratelimit()) - IWL_DEBUG_INFO(priv, "Failed to allocate SKB buffer.\n"); + IL_DEBUG_INFO(priv, "Failed to allocate SKB buffer.\n"); if ((rxq->free_count <= RX_LOW_WATERMARK) && net_ratelimit()) - IWL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n", + IL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n", priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL", rxq->free_count); /* 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) return; } element = rxq->rx_used.next; - rxb = list_entry(element, struct iwl_rx_mem_buffer, list); + rxb = list_entry(element, struct il_rx_mem_buffer, list); list_del(element); spin_unlock_irqrestore(&rxq->lock, flags); @@ -1079,7 +1079,7 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority) } } -void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +void il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq) { unsigned long flags; int i; @@ -1094,7 +1094,7 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, PAGE_SIZE << priv->hw_params.rx_page_order, PCI_DMA_FROMDEVICE); - __iwl_legacy_free_pages(priv, rxq->pool[i].page); + __il_free_pages(priv, rxq->pool[i].page); rxq->pool[i].page = NULL; } 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) spin_unlock_irqrestore(&rxq->lock, flags); } -void iwl3945_rx_replenish(void *data) +void il3945_rx_replenish(void *data) { - struct iwl_priv *priv = data; + struct il_priv *priv = data; unsigned long flags; - iwl3945_rx_allocate(priv, GFP_KERNEL); + il3945_rx_allocate(priv, GFP_KERNEL); spin_lock_irqsave(&priv->lock, flags); - iwl3945_rx_queue_restock(priv); + il3945_rx_queue_restock(priv); spin_unlock_irqrestore(&priv->lock, flags); } -static void iwl3945_rx_replenish_now(struct iwl_priv *priv) +static void il3945_rx_replenish_now(struct il_priv *priv) { - iwl3945_rx_allocate(priv, GFP_ATOMIC); + il3945_rx_allocate(priv, GFP_ATOMIC); - iwl3945_rx_queue_restock(priv); + il3945_rx_queue_restock(priv); } @@ -1133,7 +1133,7 @@ static void iwl3945_rx_replenish_now(struct iwl_priv *priv) * This free routine walks the list of POOL entries and if SKB is set to * non NULL it is unmapped and freed */ -static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +static void il3945_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq) { int i; 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 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, PAGE_SIZE << priv->hw_params.rx_page_order, PCI_DMA_FROMDEVICE); - __iwl_legacy_free_pages(priv, rxq->pool[i].page); + __il_free_pages(priv, rxq->pool[i].page); rxq->pool[i].page = NULL; } } dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, rxq->bd_dma); - dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), + dma_free_coherent(&priv->pci_dev->dev, sizeof(struct il_rb_status), rxq->rb_stts, rxq->rb_stts_dma); rxq->bd = NULL; rxq->rb_stts = NULL; @@ -1173,7 +1173,7 @@ static u8 ratio2dB[100] = { /* Calculates a relative dB value from a ratio of linear * (i.e. not dB) signal levels. * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ -int iwl3945_calc_db_from_ratio(int sig_ratio) +int il3945_calc_db_from_ratio(int sig_ratio) { /* 1000:1 or higher just report as 60 dB */ if (sig_ratio >= 1000) @@ -1193,17 +1193,17 @@ int iwl3945_calc_db_from_ratio(int sig_ratio) } /** - * iwl3945_rx_handle - Main entry function for receiving responses from uCode + * il3945_rx_handle - Main entry function for receiving responses from uCode * * Uses the priv->rx_handlers callback function array to invoke * the appropriate handlers, including command responses, * frame-received notifications, and other notifications. */ -static void iwl3945_rx_handle(struct iwl_priv *priv) +static void il3945_rx_handle(struct il_priv *priv) { - struct iwl_rx_mem_buffer *rxb; - struct iwl_rx_packet *pkt; - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_rx_mem_buffer *rxb; + struct il_rx_packet *pkt; + struct il_rx_queue *rxq = &priv->rxq; u32 r, i; int reclaim; unsigned long flags; @@ -1225,7 +1225,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv) fill_rx = 1; /* Rx interrupt, but nothing sent from uCode */ if (i == r) - IWL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); + IL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); while (i != r) { int len; @@ -1259,17 +1259,17 @@ static void iwl3945_rx_handle(struct iwl_priv *priv) /* Based on type of command response or notification, * handle those that need handling via function in - * rx_handlers table. See iwl3945_setup_rx_handlers() */ + * rx_handlers table. See il3945_setup_rx_handlers() */ if (priv->rx_handlers[pkt->hdr.cmd]) { - IWL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, i, - iwl_legacy_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); + IL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, i, + il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); priv->isr_stats.rx_handlers[pkt->hdr.cmd]++; priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); } else { /* No handling needed */ - IWL_DEBUG_RX(priv, + IL_DEBUG_RX(priv, "r %d i %d No handler needed for %s, 0x%02x\n", - r, i, iwl_legacy_get_cmd_string(pkt->hdr.cmd), + r, i, il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); } @@ -1282,12 +1282,12 @@ static void iwl3945_rx_handle(struct iwl_priv *priv) if (reclaim) { /* Invoke any callbacks, transfer the buffer to caller, - * and fire off the (possibly) blocking iwl_legacy_send_cmd() + * and fire off the (possibly) blocking il_send_cmd() * as we reclaim the driver command queue */ if (rxb->page) - iwl_legacy_tx_cmd_complete(priv, rxb); + il_tx_cmd_complete(priv, rxb); else - IWL_WARN(priv, "Claim null rxb?\n"); + IL_WARN(priv, "Claim null rxb?\n"); } /* Reuse the page if possible. For notification packets and @@ -1312,7 +1312,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv) count++; if (count >= 8) { rxq->read = i; - iwl3945_rx_replenish_now(priv); + il3945_rx_replenish_now(priv); count = 0; } } @@ -1321,20 +1321,20 @@ static void iwl3945_rx_handle(struct iwl_priv *priv) /* Backtrack one entry */ rxq->read = i; if (fill_rx) - iwl3945_rx_replenish_now(priv); + il3945_rx_replenish_now(priv); else - iwl3945_rx_queue_restock(priv); + il3945_rx_queue_restock(priv); } /* call this function to flush any scheduled tasklet */ -static inline void iwl3945_synchronize_irq(struct iwl_priv *priv) +static inline void il3945_synchronize_irq(struct il_priv *priv) { /* wait to make sure we flush pending tasklet*/ synchronize_irq(priv->pci_dev->irq); tasklet_kill(&priv->irq_tasklet); } -static const char *iwl3945_desc_lookup(int i) +static const char *il3945_desc_lookup(int i) { switch (i) { case 1: @@ -1357,7 +1357,7 @@ static const char *iwl3945_desc_lookup(int i) #define ERROR_START_OFFSET (1 * sizeof(u32)) #define ERROR_ELEM_SIZE (7 * sizeof(u32)) -void iwl3945_dump_nic_error_log(struct iwl_priv *priv) +void il3945_dump_nic_error_log(struct il_priv *priv) { u32 i; u32 desc, time, count, base, data1; @@ -1365,47 +1365,47 @@ void iwl3945_dump_nic_error_log(struct iwl_priv *priv) base = le32_to_cpu(priv->card_alive.error_event_table_ptr); - if (!iwl3945_hw_valid_rtc_data_addr(base)) { - IWL_ERR(priv, "Not valid error log pointer 0x%08X\n", base); + if (!il3945_hw_valid_rtc_data_addr(base)) { + IL_ERR(priv, "Not valid error log pointer 0x%08X\n", base); return; } - count = iwl_legacy_read_targ_mem(priv, base); + count = il_read_targ_mem(priv, base); if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { - IWL_ERR(priv, "Start IWL Error Log Dump:\n"); - IWL_ERR(priv, "Status: 0x%08lX, count: %d\n", + IL_ERR(priv, "Start IWL Error Log Dump:\n"); + IL_ERR(priv, "Status: 0x%08lX, count: %d\n", priv->status, count); } - IWL_ERR(priv, "Desc Time asrtPC blink2 " + IL_ERR(priv, "Desc Time asrtPC blink2 " "ilink1 nmiPC Line\n"); for (i = ERROR_START_OFFSET; i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET; i += ERROR_ELEM_SIZE) { - desc = iwl_legacy_read_targ_mem(priv, base + i); + desc = il_read_targ_mem(priv, base + i); time = - iwl_legacy_read_targ_mem(priv, base + i + 1 * sizeof(u32)); + il_read_targ_mem(priv, base + i + 1 * sizeof(u32)); blink1 = - iwl_legacy_read_targ_mem(priv, base + i + 2 * sizeof(u32)); + il_read_targ_mem(priv, base + i + 2 * sizeof(u32)); blink2 = - iwl_legacy_read_targ_mem(priv, base + i + 3 * sizeof(u32)); + il_read_targ_mem(priv, base + i + 3 * sizeof(u32)); ilink1 = - iwl_legacy_read_targ_mem(priv, base + i + 4 * sizeof(u32)); + il_read_targ_mem(priv, base + i + 4 * sizeof(u32)); ilink2 = - iwl_legacy_read_targ_mem(priv, base + i + 5 * sizeof(u32)); + il_read_targ_mem(priv, base + i + 5 * sizeof(u32)); data1 = - iwl_legacy_read_targ_mem(priv, base + i + 6 * sizeof(u32)); + il_read_targ_mem(priv, base + i + 6 * sizeof(u32)); - IWL_ERR(priv, + IL_ERR(priv, "%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", - iwl3945_desc_lookup(desc), desc, time, blink1, blink2, + il3945_desc_lookup(desc), desc, time, blink1, blink2, ilink1, ilink2, data1); } } -static void iwl3945_irq_tasklet(struct iwl_priv *priv) +static void il3945_irq_tasklet(struct il_priv *priv) { u32 inta, handled = 0; u32 inta_fh; @@ -1419,20 +1419,20 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) /* Ack/clear/reset pending uCode interrupts. * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, * and will clear only when CSR_FH_INT_STATUS gets cleared. */ - inta = iwl_read32(priv, CSR_INT); - iwl_write32(priv, CSR_INT, inta); + inta = il_read32(priv, CSR_INT); + il_write32(priv, CSR_INT, inta); /* Ack/clear/reset pending flow-handler (DMA) interrupts. * Any new interrupts that happen after this, either while we're * in this tasklet, or later, will show up in next ISR/tasklet. */ - inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); - iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); + inta_fh = il_read32(priv, CSR_FH_INT_STATUS); + il_write32(priv, CSR_FH_INT_STATUS, inta_fh); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (iwl_legacy_get_debug_level(priv) & IWL_DL_ISR) { + if (il_get_debug_level(priv) & IL_DL_ISR) { /* just for debug */ - inta_mask = iwl_read32(priv, CSR_INT_MASK); - IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", + inta_mask = il_read32(priv, CSR_INT_MASK); + IL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); } #endif @@ -1450,13 +1450,13 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) /* Now service all interrupt bits discovered above. */ if (inta & CSR_INT_BIT_HW_ERR) { - IWL_ERR(priv, "Hardware error detected. Restarting.\n"); + IL_ERR(priv, "Hardware error detected. Restarting.\n"); /* Tell the device to stop sending interrupts */ - iwl_legacy_disable_interrupts(priv); + il_disable_interrupts(priv); priv->isr_stats.hw++; - iwl_legacy_irq_handle_error(priv); + il_irq_handle_error(priv); handled |= CSR_INT_BIT_HW_ERR; @@ -1464,17 +1464,17 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) { + if (il_get_debug_level(priv) & (IL_DL_ISR)) { /* NIC fires this, but we don't use it, redundant with WAKEUP */ if (inta & CSR_INT_BIT_SCD) { - IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " + IL_DEBUG_ISR(priv, "Scheduler finished to transmit " "the frame/frames.\n"); priv->isr_stats.sch++; } /* Alive notification via Rx interrupt will do the real work */ if (inta & CSR_INT_BIT_ALIVE) { - IWL_DEBUG_ISR(priv, "Alive interrupt\n"); + IL_DEBUG_ISR(priv, "Alive interrupt\n"); priv->isr_stats.alive++; } } @@ -1484,23 +1484,23 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) /* Error detected by uCode */ if (inta & CSR_INT_BIT_SW_ERR) { - IWL_ERR(priv, "Microcode SW error detected. " + IL_ERR(priv, "Microcode SW error detected. " "Restarting 0x%X.\n", inta); priv->isr_stats.sw++; - iwl_legacy_irq_handle_error(priv); + il_irq_handle_error(priv); handled |= CSR_INT_BIT_SW_ERR; } /* uCode wakes up after power-down sleep */ if (inta & CSR_INT_BIT_WAKEUP) { - IWL_DEBUG_ISR(priv, "Wakeup interrupt\n"); - iwl_legacy_rx_queue_update_write_ptr(priv, &priv->rxq); - iwl_legacy_txq_update_write_ptr(priv, &priv->txq[0]); - iwl_legacy_txq_update_write_ptr(priv, &priv->txq[1]); - iwl_legacy_txq_update_write_ptr(priv, &priv->txq[2]); - iwl_legacy_txq_update_write_ptr(priv, &priv->txq[3]); - iwl_legacy_txq_update_write_ptr(priv, &priv->txq[4]); - iwl_legacy_txq_update_write_ptr(priv, &priv->txq[5]); + IL_DEBUG_ISR(priv, "Wakeup interrupt\n"); + il_rx_queue_update_write_ptr(priv, &priv->rxq); + il_txq_update_write_ptr(priv, &priv->txq[0]); + il_txq_update_write_ptr(priv, &priv->txq[1]); + il_txq_update_write_ptr(priv, &priv->txq[2]); + il_txq_update_write_ptr(priv, &priv->txq[3]); + il_txq_update_write_ptr(priv, &priv->txq[4]); + il_txq_update_write_ptr(priv, &priv->txq[5]); priv->isr_stats.wakeup++; handled |= CSR_INT_BIT_WAKEUP; @@ -1510,67 +1510,67 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) * Rx "responses" (frame-received notification), and other * notifications from uCode come through here*/ if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { - iwl3945_rx_handle(priv); + il3945_rx_handle(priv); priv->isr_stats.rx++; handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); } if (inta & CSR_INT_BIT_FH_TX) { - IWL_DEBUG_ISR(priv, "Tx interrupt\n"); + IL_DEBUG_ISR(priv, "Tx interrupt\n"); priv->isr_stats.tx++; - iwl_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); - iwl_legacy_write_direct32(priv, FH39_TCSR_CREDIT + il_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); + il_write_direct32(priv, FH39_TCSR_CREDIT (FH39_SRVC_CHNL), 0x0); handled |= CSR_INT_BIT_FH_TX; } if (inta & ~handled) { - IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); + IL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); priv->isr_stats.unhandled++; } if (inta & ~priv->inta_mask) { - IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", + IL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", inta & ~priv->inta_mask); - IWL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh); + IL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh); } /* Re-enable all interrupts */ /* only Re-enable if disabled by irq */ if (test_bit(STATUS_INT_ENABLED, &priv->status)) - iwl_legacy_enable_interrupts(priv); + il_enable_interrupts(priv); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) { - inta = iwl_read32(priv, CSR_INT); - inta_mask = iwl_read32(priv, CSR_INT_MASK); - inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); - IWL_DEBUG_ISR(priv, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " + if (il_get_debug_level(priv) & (IL_DL_ISR)) { + inta = il_read32(priv, CSR_INT); + inta_mask = il_read32(priv, CSR_INT_MASK); + inta_fh = il_read32(priv, CSR_FH_INT_STATUS); + IL_DEBUG_ISR(priv, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); } #endif } -static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, +static int il3945_get_channels_for_scan(struct il_priv *priv, enum ieee80211_band band, u8 is_active, u8 n_probes, - struct iwl3945_scan_channel *scan_ch, + struct il3945_scan_channel *scan_ch, struct ieee80211_vif *vif) { struct ieee80211_channel *chan; const struct ieee80211_supported_band *sband; - const struct iwl_channel_info *ch_info; + const struct il_channel_info *ch_info; u16 passive_dwell = 0; u16 active_dwell = 0; int added, i; - sband = iwl_get_hw_mode(priv, band); + sband = il_get_hw_mode(priv, band); if (!sband) return 0; - active_dwell = iwl_legacy_get_active_dwell_time(priv, band, n_probes); - passive_dwell = iwl_legacy_get_passive_dwell_time(priv, band, vif); + active_dwell = il_get_active_dwell_time(priv, band, n_probes); + passive_dwell = il_get_passive_dwell_time(priv, band, vif); if (passive_dwell <= active_dwell) passive_dwell = active_dwell + 1; @@ -1583,10 +1583,10 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, scan_ch->channel = chan->hw_value; - ch_info = iwl_legacy_get_channel_info(priv, band, + ch_info = il_get_channel_info(priv, band, scan_ch->channel); - if (!iwl_legacy_is_channel_valid(ch_info)) { - IWL_DEBUG_SCAN(priv, + if (!il_is_channel_valid(ch_info)) { + IL_DEBUG_SCAN(priv, "Channel %d is INVALID for this band.\n", scan_ch->channel); continue; @@ -1597,10 +1597,10 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, /* If passive , set up for auto-switch * and use long active_dwell time. */ - if (!is_active || iwl_legacy_is_channel_passive(ch_info) || + if (!is_active || il_is_channel_passive(ch_info) || (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) { scan_ch->type = 0; /* passive */ - if (IWL_UCODE_API(priv->ucode_ver) == 1) + if (IL_UCODE_API(priv->ucode_ver) == 1) scan_ch->active_dwell = cpu_to_le16(passive_dwell - 1); } else { scan_ch->type = 1; /* active */ @@ -1610,7 +1610,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, * scan channels (probes gets sent right away), * or for passive channels (probes get se sent only after * hearing clear Rx packet).*/ - if (IWL_UCODE_API(priv->ucode_ver) >= 2) { + if (IL_UCODE_API(priv->ucode_ver) >= 2) { if (n_probes) scan_ch->type |= IWL39_SCAN_PROBE_MASK(n_probes); } else { @@ -1635,7 +1635,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, */ } - IWL_DEBUG_SCAN(priv, "Scanning %d [%s %d]\n", + IL_DEBUG_SCAN(priv, "Scanning %d [%s %d]\n", scan_ch->channel, (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE", (scan_ch->type & 1) ? @@ -1645,25 +1645,25 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, added++; } - IWL_DEBUG_SCAN(priv, "total channels to scan %d\n", added); + IL_DEBUG_SCAN(priv, "total channels to scan %d\n", added); return added; } -static void iwl3945_init_hw_rates(struct iwl_priv *priv, +static void il3945_init_hw_rates(struct il_priv *priv, struct ieee80211_rate *rates) { int i; - for (i = 0; i < IWL_RATE_COUNT_LEGACY; i++) { - rates[i].bitrate = iwl3945_rates[i].ieee * 5; + for (i = 0; i < IL_RATE_COUNT_LEGACY; i++) { + rates[i].bitrate = il3945_rates[i].ieee * 5; rates[i].hw_value = i; /* Rate scaling will work on indexes */ rates[i].hw_value_short = i; rates[i].flags = 0; - if ((i > IWL39_LAST_OFDM_RATE) || (i < IWL_FIRST_OFDM_RATE)) { + if ((i > IWL39_LAST_OFDM_RATE) || (i < IL_FIRST_OFDM_RATE)) { /* * If CCK != 1M then set short preamble rate flag. */ - rates[i].flags |= (iwl3945_rates[i].plcp == 10) ? + rates[i].flags |= (il3945_rates[i].plcp == 10) ? 0 : IEEE80211_RATE_SHORT_PREAMBLE; } } @@ -1675,40 +1675,40 @@ static void iwl3945_init_hw_rates(struct iwl_priv *priv, * ******************************************************************************/ -static void iwl3945_dealloc_ucode_pci(struct iwl_priv *priv) +static void il3945_dealloc_ucode_pci(struct il_priv *priv) { - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_code); - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data); - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init); - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_boot); + il_free_fw_desc(priv->pci_dev, &priv->ucode_code); + il_free_fw_desc(priv->pci_dev, &priv->ucode_data); + il_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); + il_free_fw_desc(priv->pci_dev, &priv->ucode_init); + il_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); + il_free_fw_desc(priv->pci_dev, &priv->ucode_boot); } /** - * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host, + * il3945_verify_inst_full - verify runtime uCode image in card vs. host, * looking at all data. */ -static int iwl3945_verify_inst_full(struct iwl_priv *priv, __le32 *image, u32 len) +static int il3945_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len) { u32 val; u32 save_len = len; int rc = 0; u32 errcnt; - IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); + IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); - iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, + il_write_direct32(priv, HBUS_TARG_MEM_RADDR, IWL39_RTC_INST_LOWER_BOUND); errcnt = 0; for (; len > 0; len -= sizeof(u32), image++) { /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log - * if IWL_DL_IO is set */ - val = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); + * if IL_DL_IO is set */ + val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { - IWL_ERR(priv, "uCode INST section is invalid at " + IL_ERR(priv, "uCode INST section is invalid at " "offset 0x%x, is 0x%x, s/b 0x%x\n", save_len - len, val, le32_to_cpu(*image)); rc = -EIO; @@ -1720,7 +1720,7 @@ static int iwl3945_verify_inst_full(struct iwl_priv *priv, __le32 *image, u32 le if (!errcnt) - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "ucode image in INSTRUCTION memory is good\n"); return rc; @@ -1728,29 +1728,29 @@ static int iwl3945_verify_inst_full(struct iwl_priv *priv, __le32 *image, u32 le /** - * iwl3945_verify_inst_sparse - verify runtime uCode image in card vs. host, + * il3945_verify_inst_sparse - verify runtime uCode image in card vs. host, * using sample data 100 bytes apart. If these sample points are good, * it's a pretty good bet that everything between them is good, too. */ -static int iwl3945_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) +static int il3945_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 len) { u32 val; int rc = 0; u32 errcnt = 0; u32 i; - IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); + IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log - * if IWL_DL_IO is set */ - iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, + * if IL_DL_IO is set */ + il_write_direct32(priv, HBUS_TARG_MEM_RADDR, i + IWL39_RTC_INST_LOWER_BOUND); - val = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); + val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { #if 0 /* Enable this if you want to see details */ - IWL_ERR(priv, "uCode INST section is invalid at " + IL_ERR(priv, "uCode INST section is invalid at " "offset 0x%x, is 0x%x, s/b 0x%x\n", i, val, *image); #endif @@ -1766,10 +1766,10 @@ static int iwl3945_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 /** - * iwl3945_verify_ucode - determine which instruction image is in SRAM, + * il3945_verify_ucode - determine which instruction image is in SRAM, * and verify its contents */ -static int iwl3945_verify_ucode(struct iwl_priv *priv) +static int il3945_verify_ucode(struct il_priv *priv) { __le32 *image; u32 len; @@ -1778,60 +1778,60 @@ static int iwl3945_verify_ucode(struct iwl_priv *priv) /* Try bootstrap */ image = (__le32 *)priv->ucode_boot.v_addr; len = priv->ucode_boot.len; - rc = iwl3945_verify_inst_sparse(priv, image, len); + rc = il3945_verify_inst_sparse(priv, image, len); if (rc == 0) { - IWL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n"); + IL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n"); return 0; } /* Try initialize */ image = (__le32 *)priv->ucode_init.v_addr; len = priv->ucode_init.len; - rc = iwl3945_verify_inst_sparse(priv, image, len); + rc = il3945_verify_inst_sparse(priv, image, len); if (rc == 0) { - IWL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n"); + IL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n"); return 0; } /* Try runtime/protocol */ image = (__le32 *)priv->ucode_code.v_addr; len = priv->ucode_code.len; - rc = iwl3945_verify_inst_sparse(priv, image, len); + rc = il3945_verify_inst_sparse(priv, image, len); if (rc == 0) { - IWL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n"); + IL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n"); return 0; } - IWL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); + IL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); /* Since nothing seems to match, show first several data entries in * instruction SRAM, so maybe visual inspection will give a clue. * Selection of bootstrap image (vs. other images) is arbitrary. */ image = (__le32 *)priv->ucode_boot.v_addr; len = priv->ucode_boot.len; - rc = iwl3945_verify_inst_full(priv, image, len); + rc = il3945_verify_inst_full(priv, image, len); return rc; } -static void iwl3945_nic_start(struct iwl_priv *priv) +static void il3945_nic_start(struct il_priv *priv) { /* Remove all resets to allow NIC to operate */ - iwl_write32(priv, CSR_RESET, 0); + il_write32(priv, CSR_RESET, 0); } #define IWL3945_UCODE_GET(item) \ -static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode)\ +static u32 il3945_ucode_get_##item(const struct il_ucode_header *ucode)\ { \ return le32_to_cpu(ucode->v1.item); \ } -static u32 iwl3945_ucode_get_header_size(u32 api_ver) +static u32 il3945_ucode_get_header_size(u32 api_ver) { return 24; } -static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode) +static u8 *il3945_ucode_get_data(const struct il_ucode_header *ucode) { return (u8 *) ucode->v1.data; } @@ -1843,13 +1843,13 @@ IWL3945_UCODE_GET(init_data_size); IWL3945_UCODE_GET(boot_size); /** - * iwl3945_read_ucode - Read uCode images from disk file. + * il3945_read_ucode - Read uCode images from disk file. * * Copy into buffers for card to fetch via bus-mastering */ -static int iwl3945_read_ucode(struct iwl_priv *priv) +static int il3945_read_ucode(struct il_priv *priv) { - const struct iwl_ucode_header *ucode; + const struct il_ucode_header *ucode; int ret = -EINVAL, index; const struct firmware *ucode_raw; /* firmware file name contains uCode/driver compatibility version */ @@ -1867,7 +1867,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) sprintf(buf, "%s%u%s", name_pre, index, ".ucode"); ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev); if (ret < 0) { - IWL_ERR(priv, "%s firmware file req failed: %d\n", + IL_ERR(priv, "%s firmware file req failed: %d\n", buf, ret); if (ret == -ENOENT) continue; @@ -1875,11 +1875,11 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) goto error; } else { if (index < api_max) - IWL_ERR(priv, "Loaded firmware %s, " + IL_ERR(priv, "Loaded firmware %s, " "which is deprecated. " " Please use API v%u instead.\n", buf, api_max); - IWL_DEBUG_INFO(priv, "Got firmware '%s' file " + IL_DEBUG_INFO(priv, "Got firmware '%s' file " "(%zd bytes) from disk\n", buf, ucode_raw->size); break; @@ -1890,30 +1890,30 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) goto error; /* Make sure that we got at least our header! */ - if (ucode_raw->size < iwl3945_ucode_get_header_size(1)) { - IWL_ERR(priv, "File size way too small!\n"); + if (ucode_raw->size < il3945_ucode_get_header_size(1)) { + IL_ERR(priv, "File size way too small!\n"); ret = -EINVAL; goto err_release; } /* Data from ucode file: header followed by uCode images */ - ucode = (struct iwl_ucode_header *)ucode_raw->data; + ucode = (struct il_ucode_header *)ucode_raw->data; priv->ucode_ver = le32_to_cpu(ucode->ver); - api_ver = IWL_UCODE_API(priv->ucode_ver); - inst_size = iwl3945_ucode_get_inst_size(ucode); - data_size = iwl3945_ucode_get_data_size(ucode); - init_size = iwl3945_ucode_get_init_size(ucode); - init_data_size = iwl3945_ucode_get_init_data_size(ucode); - boot_size = iwl3945_ucode_get_boot_size(ucode); - src = iwl3945_ucode_get_data(ucode); + api_ver = IL_UCODE_API(priv->ucode_ver); + inst_size = il3945_ucode_get_inst_size(ucode); + data_size = il3945_ucode_get_data_size(ucode); + init_size = il3945_ucode_get_init_size(ucode); + init_data_size = il3945_ucode_get_init_data_size(ucode); + boot_size = il3945_ucode_get_boot_size(ucode); + src = il3945_ucode_get_data(ucode); /* api_ver should match the api version forming part of the * firmware filename ... but we don't check for that and only rely * on the API version read from firmware header from here on forward */ if (api_ver < api_min || api_ver > api_max) { - IWL_ERR(priv, "Driver unable to support your firmware API. " + IL_ERR(priv, "Driver unable to support your firmware API. " "Driver supports v%u, firmware is v%u.\n", api_max, api_ver); priv->ucode_ver = 0; @@ -1921,45 +1921,45 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) goto err_release; } if (api_ver != api_max) - IWL_ERR(priv, "Firmware has old API version. Expected %u, " + IL_ERR(priv, "Firmware has old API version. Expected %u, " "got %u. New firmware can be obtained " "from http://www.intellinuxwireless.org.\n", api_max, api_ver); - IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", - IWL_UCODE_MAJOR(priv->ucode_ver), - IWL_UCODE_MINOR(priv->ucode_ver), - IWL_UCODE_API(priv->ucode_ver), - IWL_UCODE_SERIAL(priv->ucode_ver)); + IL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", + IL_UCODE_MAJOR(priv->ucode_ver), + IL_UCODE_MINOR(priv->ucode_ver), + IL_UCODE_API(priv->ucode_ver), + IL_UCODE_SERIAL(priv->ucode_ver)); snprintf(priv->hw->wiphy->fw_version, sizeof(priv->hw->wiphy->fw_version), "%u.%u.%u.%u", - IWL_UCODE_MAJOR(priv->ucode_ver), - IWL_UCODE_MINOR(priv->ucode_ver), - IWL_UCODE_API(priv->ucode_ver), - IWL_UCODE_SERIAL(priv->ucode_ver)); + IL_UCODE_MAJOR(priv->ucode_ver), + IL_UCODE_MINOR(priv->ucode_ver), + IL_UCODE_API(priv->ucode_ver), + IL_UCODE_SERIAL(priv->ucode_ver)); - IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", + IL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", priv->ucode_ver); - IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n", + IL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n", inst_size); - IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n", + IL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n", data_size); - IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n", + IL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n", init_size); - IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n", + IL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n", init_data_size); - IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n", + IL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n", boot_size); /* Verify size of file vs. image size info in file's header */ - if (ucode_raw->size != iwl3945_ucode_get_header_size(api_ver) + + if (ucode_raw->size != il3945_ucode_get_header_size(api_ver) + inst_size + data_size + init_size + init_data_size + boot_size) { - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "uCode file size %zd does not match expected size\n", ucode_raw->size); ret = -EINVAL; @@ -1968,34 +1968,34 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) /* Verify that uCode images will fit in card's SRAM */ if (inst_size > IWL39_MAX_INST_SIZE) { - IWL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n", + IL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n", inst_size); ret = -EINVAL; goto err_release; } if (data_size > IWL39_MAX_DATA_SIZE) { - IWL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n", + IL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n", data_size); ret = -EINVAL; goto err_release; } if (init_size > IWL39_MAX_INST_SIZE) { - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "uCode init instr len %d too large to fit in\n", init_size); ret = -EINVAL; goto err_release; } if (init_data_size > IWL39_MAX_DATA_SIZE) { - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "uCode init data len %d too large to fit in\n", init_data_size); ret = -EINVAL; goto err_release; } if (boot_size > IWL39_MAX_BSM_SIZE) { - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "uCode boot instr len %d too large to fit in\n", boot_size); ret = -EINVAL; @@ -2008,13 +2008,13 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) * 1) unmodified from disk * 2) backup cache for save/restore during power-downs */ priv->ucode_code.len = inst_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); priv->ucode_data.len = data_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); priv->ucode_data_backup.len = data_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || !priv->ucode_data_backup.v_addr) @@ -2023,10 +2023,10 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) /* Initialization instructions and data */ if (init_size && init_data_size) { priv->ucode_init.len = init_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); priv->ucode_init_data.len = init_data_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) goto err_pci_alloc; @@ -2035,7 +2035,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) /* Bootstrap (instructions only, no data) */ if (boot_size) { priv->ucode_boot.len = boot_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); if (!priv->ucode_boot.v_addr) goto err_pci_alloc; @@ -2045,18 +2045,18 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) /* Runtime instructions (first block of data in file) */ len = inst_size; - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %zd\n", len); memcpy(priv->ucode_code.v_addr, src, len); src += len; - IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", + IL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); /* Runtime data (2nd block) - * NOTE: Copy into backup buffer will be done in iwl3945_up() */ + * NOTE: Copy into backup buffer will be done in il3945_up() */ len = data_size; - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %zd\n", len); memcpy(priv->ucode_data.v_addr, src, len); memcpy(priv->ucode_data_backup.v_addr, src, len); @@ -2065,7 +2065,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) /* Initialization instructions (3rd block) */ if (init_size) { len = init_size; - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Copying (but not loading) init instr len %zd\n", len); memcpy(priv->ucode_init.v_addr, src, len); src += len; @@ -2074,7 +2074,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) /* Initialization data (4th block) */ if (init_data_size) { len = init_data_size; - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Copying (but not loading) init data len %zd\n", len); memcpy(priv->ucode_init_data.v_addr, src, len); src += len; @@ -2082,7 +2082,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) /* Bootstrap instructions (5th block) */ len = boot_size; - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %zd\n", len); memcpy(priv->ucode_boot.v_addr, src, len); @@ -2091,9 +2091,9 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) return 0; err_pci_alloc: - IWL_ERR(priv, "failed to allocate pci memory\n"); + IL_ERR(priv, "failed to allocate pci memory\n"); ret = -ENOMEM; - iwl3945_dealloc_ucode_pci(priv); + il3945_dealloc_ucode_pci(priv); err_release: release_firmware(ucode_raw); @@ -2104,7 +2104,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) /** - * iwl3945_set_ucode_ptrs - Set uCode address location + * il3945_set_ucode_ptrs - Set uCode address location * * Tell initialization uCode where to find runtime uCode. * @@ -2112,7 +2112,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) * We need to replace them to load runtime uCode inst and data, * and to save runtime data when powering down. */ -static int iwl3945_set_ucode_ptrs(struct iwl_priv *priv) +static int il3945_set_ucode_ptrs(struct il_priv *priv) { dma_addr_t pinst; dma_addr_t pdata; @@ -2122,56 +2122,56 @@ static int iwl3945_set_ucode_ptrs(struct iwl_priv *priv) pdata = priv->ucode_data_backup.p_addr; /* Tell bootstrap uCode where to find image to load */ - iwl_legacy_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_legacy_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_legacy_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, + il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, priv->ucode_data.len); /* Inst byte count must be last to set up, bit 31 signals uCode * that all new ptr/size info is in place */ - iwl_legacy_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, + il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, priv->ucode_code.len | BSM_DRAM_INST_LOAD); - IWL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); + IL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); return 0; } /** - * iwl3945_init_alive_start - Called after REPLY_ALIVE notification received + * il3945_init_alive_start - Called after REPLY_ALIVE notification received * * Called after REPLY_ALIVE notification received from "initialize" uCode. * * Tell "initialize" uCode to go ahead and load the runtime uCode. */ -static void iwl3945_init_alive_start(struct iwl_priv *priv) +static void il3945_init_alive_start(struct il_priv *priv) { /* Check alive response for "valid" sign from uCode */ if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { /* We had an error bringing up the hardware, so take it * all the way back down so we can try again */ - IWL_DEBUG_INFO(priv, "Initialize Alive failed.\n"); + IL_DEBUG_INFO(priv, "Initialize Alive failed.\n"); goto restart; } /* Bootstrap uCode has loaded initialize uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "initialize" alive if code weren't properly loaded. */ - if (iwl3945_verify_ucode(priv)) { + if (il3945_verify_ucode(priv)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ - IWL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); + IL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); goto restart; } /* Send pointers to protocol/runtime uCode image ... init code will * load and launch runtime uCode, which will send us another "Alive" * notification. */ - IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); - if (iwl3945_set_ucode_ptrs(priv)) { + IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); + if (il3945_set_ucode_ptrs(priv)) { /* Runtime instruction load won't happen; * take it all the way back down so we can try again */ - IWL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); + IL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); goto restart; } return; @@ -2181,49 +2181,49 @@ static void iwl3945_init_alive_start(struct iwl_priv *priv) } /** - * iwl3945_alive_start - called after REPLY_ALIVE notification received + * il3945_alive_start - called after REPLY_ALIVE notification received * from protocol/runtime uCode (initialization uCode's - * Alive gets handled by iwl3945_init_alive_start()). + * Alive gets handled by il3945_init_alive_start()). */ -static void iwl3945_alive_start(struct iwl_priv *priv) +static void il3945_alive_start(struct il_priv *priv) { int thermal_spin = 0; u32 rfkill; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; - IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); + IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); if (priv->card_alive.is_valid != UCODE_VALID_OK) { /* We had an error bringing up the hardware, so take it * all the way back down so we can try again */ - IWL_DEBUG_INFO(priv, "Alive failed.\n"); + IL_DEBUG_INFO(priv, "Alive failed.\n"); goto restart; } /* Initialize uCode has loaded Runtime uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "runtime" alive if code weren't properly loaded. */ - if (iwl3945_verify_ucode(priv)) { + if (il3945_verify_ucode(priv)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ - IWL_DEBUG_INFO(priv, "Bad runtime uCode load.\n"); + IL_DEBUG_INFO(priv, "Bad runtime uCode load.\n"); goto restart; } - rfkill = iwl_legacy_read_prph(priv, APMG_RFKILL_REG); - IWL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill); + rfkill = il_read_prph(priv, APMG_RFKILL_REG); + IL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill); if (rfkill & 0x1) { clear_bit(STATUS_RF_KILL_HW, &priv->status); /* if RFKILL is not on, then wait for thermal * sensor in adapter to kick in */ - while (iwl3945_hw_get_temperature(priv) == 0) { + while (il3945_hw_get_temperature(priv) == 0) { thermal_spin++; udelay(10); } if (thermal_spin) - IWL_DEBUG_INFO(priv, "Thermal calibration took %dus\n", + IL_DEBUG_INFO(priv, "Thermal calibration took %dus\n", thermal_spin * 10); } else set_bit(STATUS_RF_KILL_HW, &priv->status); @@ -2232,39 +2232,39 @@ static void iwl3945_alive_start(struct iwl_priv *priv) set_bit(STATUS_ALIVE, &priv->status); /* Enable watchdog to monitor the driver tx queues */ - iwl_legacy_setup_watchdog(priv); + il_setup_watchdog(priv); - if (iwl_legacy_is_rfkill(priv)) + if (il_is_rfkill(priv)) return; ieee80211_wake_queues(priv->hw); - priv->active_rate = IWL_RATES_MASK_3945; + priv->active_rate = IL_RATES_MASK_3945; - iwl_legacy_power_update_mode(priv, true); + il_power_update_mode(priv, true); - if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { - struct iwl3945_rxon_cmd *active_rxon = - (struct iwl3945_rxon_cmd *)(&ctx->active); + if (il_is_associated(priv, IL_RXON_CTX_BSS)) { + struct il3945_rxon_cmd *active_rxon = + (struct il3945_rxon_cmd *)(&ctx->active); ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; } else { /* Initialize our rx_config data */ - iwl_legacy_connection_init_rx_config(priv, ctx); + il_connection_init_rx_config(priv, ctx); } /* Configure Bluetooth device coexistence support */ - iwl_legacy_send_bt_config(priv); + il_send_bt_config(priv); set_bit(STATUS_READY, &priv->status); /* Configure the adapter for unassociated operation */ - iwl3945_commit_rxon(priv, ctx); + il3945_commit_rxon(priv, ctx); - iwl3945_reg_txpower_periodic(priv); + il3945_reg_txpower_periodic(priv); - IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); + IL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); wake_up(&priv->wait_command_queue); return; @@ -2273,16 +2273,16 @@ static void iwl3945_alive_start(struct iwl_priv *priv) queue_work(priv->workqueue, &priv->restart); } -static void iwl3945_cancel_deferred_work(struct iwl_priv *priv); +static void il3945_cancel_deferred_work(struct il_priv *priv); -static void __iwl3945_down(struct iwl_priv *priv) +static void __il3945_down(struct il_priv *priv) { unsigned long flags; int exit_pending; - IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); + IL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); - iwl_legacy_scan_cancel_timeout(priv, 200); + il_scan_cancel_timeout(priv, 200); exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); @@ -2291,9 +2291,9 @@ static void __iwl3945_down(struct iwl_priv *priv) del_timer_sync(&priv->watchdog); /* Station information will now be cleared in device */ - iwl_legacy_clear_ucode_stations(priv, NULL); - iwl_legacy_dealloc_bcast_stations(priv); - iwl_legacy_clear_driver_stations(priv); + il_clear_ucode_stations(priv, NULL); + il_dealloc_bcast_stations(priv); + il_clear_driver_stations(priv); /* Unblock any waiting calls */ wake_up_all(&priv->wait_command_queue); @@ -2304,20 +2304,20 @@ static void __iwl3945_down(struct iwl_priv *priv) clear_bit(STATUS_EXIT_PENDING, &priv->status); /* stop and reset the on-board processor */ - iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); + il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); /* tell the device to stop sending interrupts */ spin_lock_irqsave(&priv->lock, flags); - iwl_legacy_disable_interrupts(priv); + il_disable_interrupts(priv); spin_unlock_irqrestore(&priv->lock, flags); - iwl3945_synchronize_irq(priv); + il3945_synchronize_irq(priv); if (priv->mac80211_registered) ieee80211_stop_queues(priv->hw); - /* If we have not previously called iwl3945_init() then + /* If we have not previously called il3945_init() then * clear all bits but the RF Kill bits and return */ - if (!iwl_legacy_is_init(priv)) { + if (!il_is_init(priv)) { priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << STATUS_RF_KILL_HW | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << @@ -2338,109 +2338,109 @@ static void __iwl3945_down(struct iwl_priv *priv) test_bit(STATUS_EXIT_PENDING, &priv->status) << STATUS_EXIT_PENDING; - iwl3945_hw_txq_ctx_stop(priv); - iwl3945_hw_rxq_stop(priv); + il3945_hw_txq_ctx_stop(priv); + il3945_hw_rxq_stop(priv); /* Power-down device's busmaster DMA clocks */ - iwl_legacy_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); + il_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); udelay(5); /* Stop the device, and put it in low power state */ - iwl_legacy_apm_stop(priv); + il_apm_stop(priv); exit: - memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); + memset(&priv->card_alive, 0, sizeof(struct il_alive_resp)); if (priv->beacon_skb) dev_kfree_skb(priv->beacon_skb); priv->beacon_skb = NULL; /* clear out any free frames */ - iwl3945_clear_free_frames(priv); + il3945_clear_free_frames(priv); } -static void iwl3945_down(struct iwl_priv *priv) +static void il3945_down(struct il_priv *priv) { mutex_lock(&priv->mutex); - __iwl3945_down(priv); + __il3945_down(priv); mutex_unlock(&priv->mutex); - iwl3945_cancel_deferred_work(priv); + il3945_cancel_deferred_work(priv); } #define MAX_HW_RESTARTS 5 -static int iwl3945_alloc_bcast_station(struct iwl_priv *priv) +static int il3945_alloc_bcast_station(struct il_priv *priv) { - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; unsigned long flags; u8 sta_id; spin_lock_irqsave(&priv->sta_lock, flags); - sta_id = iwl_legacy_prep_station(priv, ctx, + sta_id = il_prep_station(priv, ctx, iwlegacy_bcast_addr, false, NULL); - if (sta_id == IWL_INVALID_STATION) { - IWL_ERR(priv, "Unable to prepare broadcast station\n"); + if (sta_id == IL_INVALID_STATION) { + IL_ERR(priv, "Unable to prepare broadcast station\n"); spin_unlock_irqrestore(&priv->sta_lock, flags); return -EINVAL; } - priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; - priv->stations[sta_id].used |= IWL_STA_BCAST; + priv->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE; + priv->stations[sta_id].used |= IL_STA_BCAST; spin_unlock_irqrestore(&priv->sta_lock, flags); return 0; } -static int __iwl3945_up(struct iwl_priv *priv) +static int __il3945_up(struct il_priv *priv) { int rc, i; - rc = iwl3945_alloc_bcast_station(priv); + rc = il3945_alloc_bcast_station(priv); if (rc) return rc; if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { - IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); + IL_WARN(priv, "Exit pending; will not bring the NIC up\n"); return -EIO; } if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { - IWL_ERR(priv, "ucode not available for device bring up\n"); + IL_ERR(priv, "ucode not available for device bring up\n"); return -EIO; } /* If platform's RF_KILL switch is NOT set to KILL */ - if (iwl_read32(priv, CSR_GP_CNTRL) & + if (il_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) clear_bit(STATUS_RF_KILL_HW, &priv->status); else { set_bit(STATUS_RF_KILL_HW, &priv->status); - IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); + IL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); return -ENODEV; } - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); + il_write32(priv, CSR_INT, 0xFFFFFFFF); - rc = iwl3945_hw_nic_init(priv); + rc = il3945_hw_nic_init(priv); if (rc) { - IWL_ERR(priv, "Unable to int nic\n"); + IL_ERR(priv, "Unable to int nic\n"); return rc; } /* make sure rfkill handshake bits are cleared */ - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, + il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); /* clear (again), then enable host interrupts */ - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); - iwl_legacy_enable_interrupts(priv); + il_write32(priv, CSR_INT, 0xFFFFFFFF); + il_enable_interrupts(priv); /* really make sure rfkill handshake bits are cleared */ - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); /* Copy original ucode data image from disk into backup cache. * This will be used to initialize the on-board processor's @@ -2460,26 +2460,26 @@ static int __iwl3945_up(struct iwl_priv *priv) rc = priv->cfg->ops->lib->load_ucode(priv); if (rc) { - IWL_ERR(priv, + IL_ERR(priv, "Unable to set up bootstrap uCode: %d\n", rc); continue; } /* start card; "initialize" will load runtime ucode */ - iwl3945_nic_start(priv); + il3945_nic_start(priv); - IWL_DEBUG_INFO(priv, DRV_NAME " is coming up\n"); + IL_DEBUG_INFO(priv, DRV_NAME " is coming up\n"); return 0; } set_bit(STATUS_EXIT_PENDING, &priv->status); - __iwl3945_down(priv); + __il3945_down(priv); clear_bit(STATUS_EXIT_PENDING, &priv->status); /* tried to restart and config the device for as long as our * patience could withstand */ - IWL_ERR(priv, "Unable to initialize device after %d attempts.\n", i); + IL_ERR(priv, "Unable to initialize device after %d attempts.\n", i); return -EIO; } @@ -2490,30 +2490,30 @@ static int __iwl3945_up(struct iwl_priv *priv) * *****************************************************************************/ -static void iwl3945_bg_init_alive_start(struct work_struct *data) +static void il3945_bg_init_alive_start(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, init_alive_start.work); + struct il_priv *priv = + container_of(data, struct il_priv, init_alive_start.work); mutex_lock(&priv->mutex); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) goto out; - iwl3945_init_alive_start(priv); + il3945_init_alive_start(priv); out: mutex_unlock(&priv->mutex); } -static void iwl3945_bg_alive_start(struct work_struct *data) +static void il3945_bg_alive_start(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, alive_start.work); + struct il_priv *priv = + container_of(data, struct il_priv, alive_start.work); mutex_lock(&priv->mutex); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) goto out; - iwl3945_alive_start(priv); + il3945_alive_start(priv); out: mutex_unlock(&priv->mutex); } @@ -2524,12 +2524,12 @@ out: * *is* readable even when device has been SW_RESET into low power mode * (e.g. during RF KILL). */ -static void iwl3945_rfkill_poll(struct work_struct *data) +static void il3945_rfkill_poll(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, _3945.rfkill_poll.work); + struct il_priv *priv = + container_of(data, struct il_priv, _3945.rfkill_poll.work); bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status); - bool new_rfkill = !(iwl_read32(priv, CSR_GP_CNTRL) + bool new_rfkill = !(il_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); if (new_rfkill != old_rfkill) { @@ -2540,7 +2540,7 @@ static void iwl3945_rfkill_poll(struct work_struct *data) wiphy_rfkill_set_hw_state(priv->hw->wiphy, new_rfkill); - IWL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n", + IL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n", new_rfkill ? "disable radio" : "enable radio"); } @@ -2551,14 +2551,14 @@ static void iwl3945_rfkill_poll(struct work_struct *data) } -int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) +int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) { - struct iwl_host_cmd cmd = { + struct il_host_cmd cmd = { .id = REPLY_SCAN_CMD, - .len = sizeof(struct iwl3945_scan_cmd), + .len = sizeof(struct il3945_scan_cmd), .flags = CMD_SIZE_HUGE, }; - struct iwl3945_scan_cmd *scan; + struct il3945_scan_cmd *scan; u8 n_probes = 0; enum ieee80211_band band; bool is_active = false; @@ -2568,26 +2568,26 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) lockdep_assert_held(&priv->mutex); if (!priv->scan_cmd) { - priv->scan_cmd = kmalloc(sizeof(struct iwl3945_scan_cmd) + - IWL_MAX_SCAN_SIZE, GFP_KERNEL); + priv->scan_cmd = kmalloc(sizeof(struct il3945_scan_cmd) + + IL_MAX_SCAN_SIZE, GFP_KERNEL); if (!priv->scan_cmd) { - IWL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n"); + IL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n"); return -ENOMEM; } } scan = priv->scan_cmd; - memset(scan, 0, sizeof(struct iwl3945_scan_cmd) + IWL_MAX_SCAN_SIZE); + memset(scan, 0, sizeof(struct il3945_scan_cmd) + IL_MAX_SCAN_SIZE); - scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; - scan->quiet_time = IWL_ACTIVE_QUIET_TIME; + scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH; + scan->quiet_time = IL_ACTIVE_QUIET_TIME; - if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { + if (il_is_associated(priv, IL_RXON_CTX_BSS)) { u16 interval; u32 extra; u32 suspend_time = 100; u32 scan_suspend_time = 100; - IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); + IL_DEBUG_INFO(priv, "Scanning while associated...\n"); interval = vif->bss_conf.beacon_int; @@ -2607,13 +2607,13 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) (extra | ((suspend_time % interval) * 1024)); scan->suspend_time = cpu_to_le32(scan_suspend_time); - IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n", + IL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n", scan_suspend_time, interval); } if (priv->scan_request->n_ssids) { int i, p = 0; - IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); + IL_DEBUG_SCAN(priv, "Kicking off active scan\n"); for (i = 0; i < priv->scan_request->n_ssids; i++) { /* always does wildcard anyway */ if (!priv->scan_request->ssids[i].ssid_len) @@ -2629,12 +2629,12 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) } is_active = true; } else - IWL_DEBUG_SCAN(priv, "Kicking off passive scan.\n"); + IL_DEBUG_SCAN(priv, "Kicking off passive scan.\n"); /* We don't build a direct scan probe request; the uCode will do * that based on the direct_mask added to each channel entry */ scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; - scan->tx_cmd.sta_id = priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id; + scan->tx_cmd.sta_id = priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id; scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; /* flags + rate selection */ @@ -2642,15 +2642,15 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) switch (priv->scan_band) { case IEEE80211_BAND_2GHZ: scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; - scan->tx_cmd.rate = IWL_RATE_1M_PLCP; + scan->tx_cmd.rate = IL_RATE_1M_PLCP; band = IEEE80211_BAND_2GHZ; break; case IEEE80211_BAND_5GHZ: - scan->tx_cmd.rate = IWL_RATE_6M_PLCP; + scan->tx_cmd.rate = IL_RATE_6M_PLCP; band = IEEE80211_BAND_5GHZ; break; default: - IWL_WARN(priv, "Invalid scan band\n"); + IL_WARN(priv, "Invalid scan band\n"); return -EIO; } @@ -2659,67 +2659,67 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) * is marked passive, we can do active scanning if we * detect transmissions. */ - scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT : - IWL_GOOD_CRC_TH_DISABLED; + scan->good_CRC_th = is_active ? IL_GOOD_CRC_TH_DEFAULT : + IL_GOOD_CRC_TH_DISABLED; - len = iwl_legacy_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, + len = il_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, vif->addr, priv->scan_request->ie, priv->scan_request->ie_len, - IWL_MAX_SCAN_SIZE - sizeof(*scan)); + IL_MAX_SCAN_SIZE - sizeof(*scan)); scan->tx_cmd.len = cpu_to_le16(len); /* select Rx antennas */ - scan->flags |= iwl3945_get_antenna_flags(priv); + scan->flags |= il3945_get_antenna_flags(priv); - scan->channel_count = iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, + scan->channel_count = il3945_get_channels_for_scan(priv, band, is_active, n_probes, (void *)&scan->data[len], vif); if (scan->channel_count == 0) { - IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); + IL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); return -EIO; } cmd.len += le16_to_cpu(scan->tx_cmd.len) + - scan->channel_count * sizeof(struct iwl3945_scan_channel); + scan->channel_count * sizeof(struct il3945_scan_channel); cmd.data = scan; scan->len = cpu_to_le16(cmd.len); set_bit(STATUS_SCAN_HW, &priv->status); - ret = iwl_legacy_send_cmd_sync(priv, &cmd); + ret = il_send_cmd_sync(priv, &cmd); if (ret) clear_bit(STATUS_SCAN_HW, &priv->status); return ret; } -void iwl3945_post_scan(struct iwl_priv *priv) +void il3945_post_scan(struct il_priv *priv) { - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; /* * Since setting the RXON may have been deferred while * performing the scan, fire one off if needed */ if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) - iwl3945_commit_rxon(priv, ctx); + il3945_commit_rxon(priv, ctx); } -static void iwl3945_bg_restart(struct work_struct *data) +static void il3945_bg_restart(struct work_struct *data) { - struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); + struct il_priv *priv = container_of(data, struct il_priv, restart); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; mutex_lock(&priv->mutex); for_each_context(priv, ctx) ctx->vif = NULL; priv->is_open = 0; mutex_unlock(&priv->mutex); - iwl3945_down(priv); + il3945_down(priv); ieee80211_restart_hw(priv->hw); } else { - iwl3945_down(priv); + il3945_down(priv); mutex_lock(&priv->mutex); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { @@ -2727,57 +2727,57 @@ static void iwl3945_bg_restart(struct work_struct *data) return; } - __iwl3945_up(priv); + __il3945_up(priv); mutex_unlock(&priv->mutex); } } -static void iwl3945_bg_rx_replenish(struct work_struct *data) +static void il3945_bg_rx_replenish(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, rx_replenish); + struct il_priv *priv = + container_of(data, struct il_priv, rx_replenish); mutex_lock(&priv->mutex); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) goto out; - iwl3945_rx_replenish(priv); + il3945_rx_replenish(priv); out: mutex_unlock(&priv->mutex); } -void iwl3945_post_associate(struct iwl_priv *priv) +void il3945_post_associate(struct il_priv *priv) { int rc = 0; struct ieee80211_conf *conf = NULL; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; if (!ctx->vif || !priv->is_open) return; - IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", + IL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", ctx->vif->bss_conf.aid, ctx->active.bssid_addr); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; - iwl_legacy_scan_cancel_timeout(priv, 200); + il_scan_cancel_timeout(priv, 200); - conf = iwl_legacy_ieee80211_get_hw_conf(priv->hw); + conf = il_ieee80211_get_hw_conf(priv->hw); ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl3945_commit_rxon(priv, ctx); + il3945_commit_rxon(priv, ctx); - rc = iwl_legacy_send_rxon_timing(priv, ctx); + rc = il_send_rxon_timing(priv, ctx); if (rc) - IWL_WARN(priv, "REPLY_RXON_TIMING failed - " + IL_WARN(priv, "REPLY_RXON_TIMING failed - " "Attempting to continue.\n"); ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; ctx->staging.assoc_id = cpu_to_le16(ctx->vif->bss_conf.aid); - IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", + IL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", ctx->vif->bss_conf.aid, ctx->vif->bss_conf.beacon_int); if (ctx->vif->bss_conf.use_short_preamble) @@ -2792,17 +2792,17 @@ void iwl3945_post_associate(struct iwl_priv *priv) ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; } - iwl3945_commit_rxon(priv, ctx); + il3945_commit_rxon(priv, ctx); switch (ctx->vif->type) { case NL80211_IFTYPE_STATION: - iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); + il3945_rate_scale_init(priv->hw, IL_AP_ID); break; case NL80211_IFTYPE_ADHOC: - iwl3945_send_beacon_cmd(priv); + il3945_send_beacon_cmd(priv); break; default: - IWL_ERR(priv, "%s Should not be called in %d mode\n", + IL_ERR(priv, "%s Should not be called in %d mode\n", __func__, ctx->vif->type); break; } @@ -2816,12 +2816,12 @@ void iwl3945_post_associate(struct iwl_priv *priv) #define UCODE_READY_TIMEOUT (2 * HZ) -static int iwl3945_mac_start(struct ieee80211_hw *hw) +static int il3945_mac_start(struct ieee80211_hw *hw) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; int ret; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); /* we should be verifying the device is ready to be opened */ mutex_lock(&priv->mutex); @@ -2830,22 +2830,22 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw) * ucode filename and max sizes are card-specific. */ if (!priv->ucode_code.len) { - ret = iwl3945_read_ucode(priv); + ret = il3945_read_ucode(priv); if (ret) { - IWL_ERR(priv, "Could not read microcode: %d\n", ret); + IL_ERR(priv, "Could not read microcode: %d\n", ret); mutex_unlock(&priv->mutex); goto out_release_irq; } } - ret = __iwl3945_up(priv); + ret = __il3945_up(priv); mutex_unlock(&priv->mutex); if (ret) goto out_release_irq; - IWL_DEBUG_INFO(priv, "Start UP work.\n"); + IL_DEBUG_INFO(priv, "Start UP work.\n"); /* Wait for START_ALIVE from ucode. Otherwise callbacks from * mac80211 will not be run successfully. */ @@ -2854,7 +2854,7 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw) UCODE_READY_TIMEOUT); if (!ret) { if (!test_bit(STATUS_READY, &priv->status)) { - IWL_ERR(priv, + IL_ERR(priv, "Wait for START_ALIVE timeout after %dms.\n", jiffies_to_msecs(UCODE_READY_TIMEOUT)); ret = -ETIMEDOUT; @@ -2867,29 +2867,29 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw) cancel_delayed_work(&priv->_3945.rfkill_poll); priv->is_open = 1; - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); return 0; out_release_irq: priv->is_open = 0; - IWL_DEBUG_MAC80211(priv, "leave - failed\n"); + IL_DEBUG_MAC80211(priv, "leave - failed\n"); return ret; } -static void iwl3945_mac_stop(struct ieee80211_hw *hw) +static void il3945_mac_stop(struct ieee80211_hw *hw) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); if (!priv->is_open) { - IWL_DEBUG_MAC80211(priv, "leave - skip\n"); + IL_DEBUG_MAC80211(priv, "leave - skip\n"); return; } priv->is_open = 0; - iwl3945_down(priv); + il3945_down(priv); flush_workqueue(priv->workqueue); @@ -2897,27 +2897,27 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw) queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, round_jiffies_relative(2 * HZ)); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); } -static void iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) +static void il3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); - IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, + IL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); - if (iwl3945_tx_skb(priv, skb)) + if (il3945_tx_skb(priv, skb)) dev_kfree_skb_any(skb); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); } -void iwl3945_config_ap(struct iwl_priv *priv) +void il3945_config_ap(struct il_priv *priv) { - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; struct ieee80211_vif *vif = ctx->vif; int rc = 0; @@ -2925,16 +2925,16 @@ void iwl3945_config_ap(struct iwl_priv *priv) return; /* The following should be done only at AP bring up */ - if (!(iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS))) { + if (!(il_is_associated(priv, IL_RXON_CTX_BSS))) { /* RXON - unassoc (to set timing command) */ ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl3945_commit_rxon(priv, ctx); + il3945_commit_rxon(priv, ctx); /* RXON Timing */ - rc = iwl_legacy_send_rxon_timing(priv, ctx); + rc = il_send_rxon_timing(priv, ctx); if (rc) - IWL_WARN(priv, "REPLY_RXON_TIMING failed - " + IL_WARN(priv, "REPLY_RXON_TIMING failed - " "Attempting to continue.\n"); ctx->staging.assoc_id = 0; @@ -2956,25 +2956,25 @@ void iwl3945_config_ap(struct iwl_priv *priv) } /* restore RXON assoc */ ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - iwl3945_commit_rxon(priv, ctx); + il3945_commit_rxon(priv, ctx); } - iwl3945_send_beacon_cmd(priv); + il3945_send_beacon_cmd(priv); } -static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, +static int il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; int ret = 0; - u8 sta_id = IWL_INVALID_STATION; + u8 sta_id = IL_INVALID_STATION; u8 static_key; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); - if (iwl3945_mod_params.sw_crypto) { - IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); + if (il3945_mod_params.sw_crypto) { + IL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); return -EOPNOTSUPP; } @@ -2986,66 +2986,66 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) return -EOPNOTSUPP; - static_key = !iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS); + static_key = !il_is_associated(priv, IL_RXON_CTX_BSS); if (!static_key) { - sta_id = iwl_legacy_sta_id_or_broadcast( - priv, &priv->contexts[IWL_RXON_CTX_BSS], sta); - if (sta_id == IWL_INVALID_STATION) + sta_id = il_sta_id_or_broadcast( + priv, &priv->contexts[IL_RXON_CTX_BSS], sta); + if (sta_id == IL_INVALID_STATION) return -EINVAL; } mutex_lock(&priv->mutex); - iwl_legacy_scan_cancel_timeout(priv, 100); + il_scan_cancel_timeout(priv, 100); switch (cmd) { case SET_KEY: if (static_key) - ret = iwl3945_set_static_key(priv, key); + ret = il3945_set_static_key(priv, key); else - ret = iwl3945_set_dynamic_key(priv, key, sta_id); - IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); + ret = il3945_set_dynamic_key(priv, key, sta_id); + IL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); break; case DISABLE_KEY: if (static_key) - ret = iwl3945_remove_static_key(priv); + ret = il3945_remove_static_key(priv); else - ret = iwl3945_clear_sta_key_info(priv, sta_id); - IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); + ret = il3945_clear_sta_key_info(priv, sta_id); + IL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); break; default: ret = -EINVAL; } mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); return ret; } -static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, +static int il3945_mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { - struct iwl_priv *priv = hw->priv; - struct iwl3945_sta_priv *sta_priv = (void *)sta->drv_priv; + struct il_priv *priv = hw->priv; + struct il3945_sta_priv *sta_priv = (void *)sta->drv_priv; int ret; bool is_ap = vif->type == NL80211_IFTYPE_STATION; u8 sta_id; - IWL_DEBUG_INFO(priv, "received request to add station %pM\n", + IL_DEBUG_INFO(priv, "received request to add station %pM\n", sta->addr); mutex_lock(&priv->mutex); - IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n", + IL_DEBUG_INFO(priv, "proceeding to add station %pM\n", sta->addr); - sta_priv->common.sta_id = IWL_INVALID_STATION; + sta_priv->common.sta_id = IL_INVALID_STATION; - ret = iwl_legacy_add_station_common(priv, - &priv->contexts[IWL_RXON_CTX_BSS], + ret = il_add_station_common(priv, + &priv->contexts[IL_RXON_CTX_BSS], sta->addr, is_ap, sta, &sta_id); if (ret) { - IWL_ERR(priv, "Unable to add station %pM (%d)\n", + IL_ERR(priv, "Unable to add station %pM (%d)\n", sta->addr, ret); /* Should we return success if return code is EEXIST ? */ mutex_unlock(&priv->mutex); @@ -3055,22 +3055,22 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, sta_priv->common.sta_id = sta_id; /* Initialize rate scaling */ - IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", + IL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", sta->addr); - iwl3945_rs_rate_init(priv, sta, sta_id); + il3945_rs_rate_init(priv, sta, sta_id); mutex_unlock(&priv->mutex); return 0; } -static void iwl3945_configure_filter(struct ieee80211_hw *hw, +static void il3945_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, u64 multicast) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; __le32 filter_or = 0, filter_nand = 0; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; #define CHK(test, flag) do { \ if (*total_flags & (test)) \ @@ -3079,7 +3079,7 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw, filter_nand |= (flag); \ } while (0) - IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", + IL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", changed_flags, *total_flags); 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, /* * Receiving all multicast frames is always enabled by the - * default flags setup in iwl_legacy_connection_init_rx_config() + * default flags setup in il_connection_init_rx_config() * since we currently do not support programming multicast * filters into the device. */ @@ -3131,103 +3131,103 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw, * level that is used instead of the global debug level if it (the per * device debug level) is set. */ -static ssize_t iwl3945_show_debug_level(struct device *d, +static ssize_t il3945_show_debug_level(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "0x%08X\n", iwl_legacy_get_debug_level(priv)); + struct il_priv *priv = dev_get_drvdata(d); + return sprintf(buf, "0x%08X\n", il_get_debug_level(priv)); } -static ssize_t iwl3945_store_debug_level(struct device *d, +static ssize_t il3945_store_debug_level(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); unsigned long val; int ret; ret = strict_strtoul(buf, 0, &val); if (ret) - IWL_INFO(priv, "%s is not in hex or decimal form.\n", buf); + IL_INFO(priv, "%s is not in hex or decimal form.\n", buf); else { priv->debug_level = val; - if (iwl_legacy_alloc_traffic_mem(priv)) - IWL_ERR(priv, + if (il_alloc_traffic_mem(priv)) + IL_ERR(priv, "Not enough memory to generate traffic log\n"); } return strnlen(buf, count); } static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, - iwl3945_show_debug_level, iwl3945_store_debug_level); + il3945_show_debug_level, il3945_store_debug_level); #endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */ -static ssize_t iwl3945_show_temperature(struct device *d, +static ssize_t il3945_show_temperature(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); - if (!iwl_legacy_is_alive(priv)) + if (!il_is_alive(priv)) return -EAGAIN; - return sprintf(buf, "%d\n", iwl3945_hw_get_temperature(priv)); + return sprintf(buf, "%d\n", il3945_hw_get_temperature(priv)); } -static DEVICE_ATTR(temperature, S_IRUGO, iwl3945_show_temperature, NULL); +static DEVICE_ATTR(temperature, S_IRUGO, il3945_show_temperature, NULL); -static ssize_t iwl3945_show_tx_power(struct device *d, +static ssize_t il3945_show_tx_power(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); return sprintf(buf, "%d\n", priv->tx_power_user_lmt); } -static ssize_t iwl3945_store_tx_power(struct device *d, +static ssize_t il3945_store_tx_power(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); char *p = (char *)buf; u32 val; val = simple_strtoul(p, &p, 10); if (p == buf) - IWL_INFO(priv, ": %s is not in decimal form.\n", buf); + IL_INFO(priv, ": %s is not in decimal form.\n", buf); else - iwl3945_hw_reg_set_txpower(priv, val); + il3945_hw_reg_set_txpower(priv, val); return count; } -static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, iwl3945_show_tx_power, iwl3945_store_tx_power); +static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, il3945_show_tx_power, il3945_store_tx_power); -static ssize_t iwl3945_show_flags(struct device *d, +static ssize_t il3945_show_flags(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_priv *priv = dev_get_drvdata(d); + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; return sprintf(buf, "0x%04X\n", ctx->active.flags); } -static ssize_t iwl3945_store_flags(struct device *d, +static ssize_t il3945_store_flags(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); u32 flags = simple_strtoul(buf, NULL, 0); - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; mutex_lock(&priv->mutex); if (le32_to_cpu(ctx->staging.flags) != flags) { /* Cancel any currently running scans... */ - if (iwl_legacy_scan_cancel_timeout(priv, 100)) - IWL_WARN(priv, "Could not cancel scan.\n"); + if (il_scan_cancel_timeout(priv, 100)) + IL_WARN(priv, "Could not cancel scan.\n"); else { - IWL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n", + IL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n", flags); ctx->staging.flags = cpu_to_le32(flags); - iwl3945_commit_rxon(priv, ctx); + il3945_commit_rxon(priv, ctx); } } mutex_unlock(&priv->mutex); @@ -3235,37 +3235,37 @@ static ssize_t iwl3945_store_flags(struct device *d, return count; } -static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, iwl3945_show_flags, iwl3945_store_flags); +static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, il3945_show_flags, il3945_store_flags); -static ssize_t iwl3945_show_filter_flags(struct device *d, +static ssize_t il3945_show_filter_flags(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_priv *priv = dev_get_drvdata(d); + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; return sprintf(buf, "0x%04X\n", le32_to_cpu(ctx->active.filter_flags)); } -static ssize_t iwl3945_store_filter_flags(struct device *d, +static ssize_t il3945_store_filter_flags(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_priv *priv = dev_get_drvdata(d); + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; u32 filter_flags = simple_strtoul(buf, NULL, 0); mutex_lock(&priv->mutex); if (le32_to_cpu(ctx->staging.filter_flags) != filter_flags) { /* Cancel any currently running scans... */ - if (iwl_legacy_scan_cancel_timeout(priv, 100)) - IWL_WARN(priv, "Could not cancel scan.\n"); + if (il_scan_cancel_timeout(priv, 100)) + IL_WARN(priv, "Could not cancel scan.\n"); else { - IWL_DEBUG_INFO(priv, "Committing rxon.filter_flags = " + IL_DEBUG_INFO(priv, "Committing rxon.filter_flags = " "0x%04X\n", filter_flags); ctx->staging.filter_flags = cpu_to_le32(filter_flags); - iwl3945_commit_rxon(priv, ctx); + il3945_commit_rxon(priv, ctx); } } mutex_unlock(&priv->mutex); @@ -3273,14 +3273,14 @@ static ssize_t iwl3945_store_filter_flags(struct device *d, return count; } -static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, iwl3945_show_filter_flags, - iwl3945_store_filter_flags); +static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, il3945_show_filter_flags, + il3945_store_filter_flags); -static ssize_t iwl3945_show_measurement(struct device *d, +static ssize_t il3945_show_measurement(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); - struct iwl_spectrum_notification measure_report; + struct il_priv *priv = dev_get_drvdata(d); + struct il_spectrum_notification measure_report; u32 size = sizeof(measure_report), len = 0, ofs = 0; u8 *data = (u8 *)&measure_report; unsigned long flags; @@ -3308,18 +3308,18 @@ static ssize_t iwl3945_show_measurement(struct device *d, return len; } -static ssize_t iwl3945_store_measurement(struct device *d, +static ssize_t il3945_store_measurement(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_priv *priv = dev_get_drvdata(d); + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; struct ieee80211_measurement_params params = { .channel = le16_to_cpu(ctx->active.channel), .start_time = cpu_to_le64(priv->_3945.last_tsf), .duration = cpu_to_le16(1), }; - u8 type = IWL_MEASURE_BASIC; + u8 type = IL_MEASURE_BASIC; u8 buffer[32]; u8 channel; @@ -3337,21 +3337,21 @@ static ssize_t iwl3945_store_measurement(struct device *d, type = simple_strtoul(p + 1, NULL, 0); } - IWL_DEBUG_INFO(priv, "Invoking measurement of type %d on " + IL_DEBUG_INFO(priv, "Invoking measurement of type %d on " "channel %d (for '%s')\n", type, params.channel, buf); - iwl3945_get_measurement(priv, ¶ms, type); + il3945_get_measurement(priv, ¶ms, type); return count; } static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR, - iwl3945_show_measurement, iwl3945_store_measurement); + il3945_show_measurement, il3945_store_measurement); -static ssize_t iwl3945_store_retry_rate(struct device *d, +static ssize_t il3945_store_retry_rate(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); priv->retry_rate = simple_strtoul(buf, NULL, 0); if (priv->retry_rate <= 0) @@ -3360,89 +3360,89 @@ static ssize_t iwl3945_store_retry_rate(struct device *d, return count; } -static ssize_t iwl3945_show_retry_rate(struct device *d, +static ssize_t il3945_show_retry_rate(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); return sprintf(buf, "%d", priv->retry_rate); } -static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, iwl3945_show_retry_rate, - iwl3945_store_retry_rate); +static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, il3945_show_retry_rate, + il3945_store_retry_rate); -static ssize_t iwl3945_show_channels(struct device *d, +static ssize_t il3945_show_channels(struct device *d, struct device_attribute *attr, char *buf) { /* all this shit doesn't belong into sysfs anyway */ return 0; } -static DEVICE_ATTR(channels, S_IRUSR, iwl3945_show_channels, NULL); +static DEVICE_ATTR(channels, S_IRUSR, il3945_show_channels, NULL); -static ssize_t iwl3945_show_antenna(struct device *d, +static ssize_t il3945_show_antenna(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); - if (!iwl_legacy_is_alive(priv)) + if (!il_is_alive(priv)) return -EAGAIN; - return sprintf(buf, "%d\n", iwl3945_mod_params.antenna); + return sprintf(buf, "%d\n", il3945_mod_params.antenna); } -static ssize_t iwl3945_store_antenna(struct device *d, +static ssize_t il3945_store_antenna(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv __maybe_unused = dev_get_drvdata(d); + struct il_priv *priv __maybe_unused = dev_get_drvdata(d); int ant; if (count == 0) return 0; if (sscanf(buf, "%1i", &ant) != 1) { - IWL_DEBUG_INFO(priv, "not in hex or decimal form.\n"); + IL_DEBUG_INFO(priv, "not in hex or decimal form.\n"); return count; } if ((ant >= 0) && (ant <= 2)) { - IWL_DEBUG_INFO(priv, "Setting antenna select to %d.\n", ant); - iwl3945_mod_params.antenna = (enum iwl3945_antenna)ant; + IL_DEBUG_INFO(priv, "Setting antenna select to %d.\n", ant); + il3945_mod_params.antenna = (enum il3945_antenna)ant; } else - IWL_DEBUG_INFO(priv, "Bad antenna select value %d.\n", ant); + IL_DEBUG_INFO(priv, "Bad antenna select value %d.\n", ant); return count; } -static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, iwl3945_show_antenna, iwl3945_store_antenna); +static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, il3945_show_antenna, il3945_store_antenna); -static ssize_t iwl3945_show_status(struct device *d, +static ssize_t il3945_show_status(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); - if (!iwl_legacy_is_alive(priv)) + struct il_priv *priv = dev_get_drvdata(d); + if (!il_is_alive(priv)) return -EAGAIN; return sprintf(buf, "0x%08x\n", (int)priv->status); } -static DEVICE_ATTR(status, S_IRUGO, iwl3945_show_status, NULL); +static DEVICE_ATTR(status, S_IRUGO, il3945_show_status, NULL); -static ssize_t iwl3945_dump_error_log(struct device *d, +static ssize_t il3945_dump_error_log(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); char *p = (char *)buf; if (p[0] == '1') - iwl3945_dump_nic_error_log(priv); + il3945_dump_nic_error_log(priv); return strnlen(buf, count); } -static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, iwl3945_dump_error_log); +static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, il3945_dump_error_log); /***************************************************************************** * @@ -3450,41 +3450,41 @@ static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, iwl3945_dump_error_log); * *****************************************************************************/ -static void iwl3945_setup_deferred_work(struct iwl_priv *priv) +static void il3945_setup_deferred_work(struct il_priv *priv) { priv->workqueue = create_singlethread_workqueue(DRV_NAME); init_waitqueue_head(&priv->wait_command_queue); - INIT_WORK(&priv->restart, iwl3945_bg_restart); - INIT_WORK(&priv->rx_replenish, iwl3945_bg_rx_replenish); - INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); - INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); - INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); + INIT_WORK(&priv->restart, il3945_bg_restart); + INIT_WORK(&priv->rx_replenish, il3945_bg_rx_replenish); + INIT_DELAYED_WORK(&priv->init_alive_start, il3945_bg_init_alive_start); + INIT_DELAYED_WORK(&priv->alive_start, il3945_bg_alive_start); + INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, il3945_rfkill_poll); - iwl_legacy_setup_scan_deferred_work(priv); + il_setup_scan_deferred_work(priv); - iwl3945_hw_setup_deferred_work(priv); + il3945_hw_setup_deferred_work(priv); init_timer(&priv->watchdog); priv->watchdog.data = (unsigned long)priv; - priv->watchdog.function = iwl_legacy_bg_watchdog; + priv->watchdog.function = il_bg_watchdog; tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) - iwl3945_irq_tasklet, (unsigned long)priv); + il3945_irq_tasklet, (unsigned long)priv); } -static void iwl3945_cancel_deferred_work(struct iwl_priv *priv) +static void il3945_cancel_deferred_work(struct il_priv *priv) { - iwl3945_hw_cancel_deferred_work(priv); + il3945_hw_cancel_deferred_work(priv); cancel_delayed_work_sync(&priv->init_alive_start); cancel_delayed_work(&priv->alive_start); - iwl_legacy_cancel_scan_deferred_work(priv); + il_cancel_scan_deferred_work(priv); } -static struct attribute *iwl3945_sysfs_entries[] = { +static struct attribute *il3945_sysfs_entries[] = { &dev_attr_antenna.attr, &dev_attr_channels.attr, &dev_attr_dump_errors.attr, @@ -3501,34 +3501,34 @@ static struct attribute *iwl3945_sysfs_entries[] = { NULL }; -static struct attribute_group iwl3945_attribute_group = { +static struct attribute_group il3945_attribute_group = { .name = NULL, /* put in device directory */ - .attrs = iwl3945_sysfs_entries, + .attrs = il3945_sysfs_entries, }; -struct ieee80211_ops iwl3945_hw_ops = { - .tx = iwl3945_mac_tx, - .start = iwl3945_mac_start, - .stop = iwl3945_mac_stop, - .add_interface = iwl_legacy_mac_add_interface, - .remove_interface = iwl_legacy_mac_remove_interface, - .change_interface = iwl_legacy_mac_change_interface, - .config = iwl_legacy_mac_config, - .configure_filter = iwl3945_configure_filter, - .set_key = iwl3945_mac_set_key, - .conf_tx = iwl_legacy_mac_conf_tx, - .reset_tsf = iwl_legacy_mac_reset_tsf, - .bss_info_changed = iwl_legacy_mac_bss_info_changed, - .hw_scan = iwl_legacy_mac_hw_scan, - .sta_add = iwl3945_mac_sta_add, - .sta_remove = iwl_legacy_mac_sta_remove, - .tx_last_beacon = iwl_legacy_mac_tx_last_beacon, +struct ieee80211_ops il3945_hw_ops = { + .tx = il3945_mac_tx, + .start = il3945_mac_start, + .stop = il3945_mac_stop, + .add_interface = il_mac_add_interface, + .remove_interface = il_mac_remove_interface, + .change_interface = il_mac_change_interface, + .config = il_mac_config, + .configure_filter = il3945_configure_filter, + .set_key = il3945_mac_set_key, + .conf_tx = il_mac_conf_tx, + .reset_tsf = il_mac_reset_tsf, + .bss_info_changed = il_mac_bss_info_changed, + .hw_scan = il_mac_hw_scan, + .sta_add = il3945_mac_sta_add, + .sta_remove = il_mac_sta_remove, + .tx_last_beacon = il_mac_tx_last_beacon, }; -static int iwl3945_init_drv(struct iwl_priv *priv) +static int il3945_init_drv(struct il_priv *priv) { int ret; - struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; priv->retry_rate = 1; priv->beacon_skb = NULL; @@ -3545,61 +3545,61 @@ static int iwl3945_init_drv(struct iwl_priv *priv) priv->band = IEEE80211_BAND_2GHZ; priv->iw_mode = NL80211_IFTYPE_STATION; - priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; + priv->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; /* initialize force reset */ - priv->force_reset.reset_duration = IWL_DELAY_NEXT_FORCE_FW_RELOAD; + priv->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { - IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", + IL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", eeprom->version); ret = -EINVAL; goto err; } - ret = iwl_legacy_init_channel_map(priv); + ret = il_init_channel_map(priv); if (ret) { - IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); + IL_ERR(priv, "initializing regulatory failed: %d\n", ret); goto err; } /* Set up txpower settings in driver for all channels */ - if (iwl3945_txpower_set_from_eeprom(priv)) { + if (il3945_txpower_set_from_eeprom(priv)) { ret = -EIO; goto err_free_channel_map; } - ret = iwl_legacy_init_geos(priv); + ret = il_init_geos(priv); if (ret) { - IWL_ERR(priv, "initializing geos failed: %d\n", ret); + IL_ERR(priv, "initializing geos failed: %d\n", ret); goto err_free_channel_map; } - iwl3945_init_hw_rates(priv, priv->ieee_rates); + il3945_init_hw_rates(priv, priv->ieee_rates); return 0; err_free_channel_map: - iwl_legacy_free_channel_map(priv); + il_free_channel_map(priv); err: return ret; } #define IWL3945_MAX_PROBE_REQUEST 200 -static int iwl3945_setup_mac(struct iwl_priv *priv) +static int il3945_setup_mac(struct il_priv *priv) { int ret; struct ieee80211_hw *hw = priv->hw; hw->rate_control_algorithm = "iwl-3945-rs"; - hw->sta_data_size = sizeof(struct iwl3945_sta_priv); - hw->vif_data_size = sizeof(struct iwl_vif_priv); + hw->sta_data_size = sizeof(struct il3945_sta_priv); + hw->vif_data_size = sizeof(struct il_vif_priv); /* Tell mac80211 our characteristics */ hw->flags = IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_SPECTRUM_MGMT; hw->wiphy->interface_modes = - priv->contexts[IWL_RXON_CTX_BSS].interface_modes; + priv->contexts[IL_RXON_CTX_BSS].interface_modes; hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_DISABLE_BEACON_HINTS | @@ -3620,11 +3620,11 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &priv->bands[IEEE80211_BAND_5GHZ]; - iwl_legacy_leds_init(priv); + il_leds_init(priv); ret = ieee80211_register_hw(priv->hw); if (ret) { - IWL_ERR(priv, "Failed to register hw (error %d)\n", ret); + IL_ERR(priv, "Failed to register hw (error %d)\n", ret); return ret; } priv->mac80211_registered = 1; @@ -3632,13 +3632,13 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) return 0; } -static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) +static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { int err = 0, i; - struct iwl_priv *priv; + struct il_priv *priv; struct ieee80211_hw *hw; - struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); - struct iwl3945_eeprom *eeprom; + struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data); + struct il3945_eeprom *eeprom; unsigned long flags; /*********************** @@ -3647,7 +3647,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e /* mac80211 allocates memory for this device instance, including * space for this driver's private structure */ - hw = iwl_legacy_alloc_all(cfg); + hw = il_alloc_all(cfg); if (hw == NULL) { pr_err("Can not allocate network device\n"); err = -ENOMEM; @@ -3659,40 +3659,40 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e priv->cmd_queue = IWL39_CMD_QUEUE_NUM; /* 3945 has only one valid context */ - priv->valid_contexts = BIT(IWL_RXON_CTX_BSS); + priv->valid_contexts = BIT(IL_RXON_CTX_BSS); - for (i = 0; i < NUM_IWL_RXON_CTX; i++) + for (i = 0; i < NUM_IL_RXON_CTX; i++) priv->contexts[i].ctxid = i; - priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; - priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; - priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; - priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; - priv->contexts[IWL_RXON_CTX_BSS].ap_sta_id = IWL_AP_ID; - priv->contexts[IWL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; - priv->contexts[IWL_RXON_CTX_BSS].interface_modes = + priv->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; + priv->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; + priv->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; + priv->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; + priv->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID; + priv->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; + priv->contexts[IL_RXON_CTX_BSS].interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); - priv->contexts[IWL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; - priv->contexts[IWL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; - priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; + priv->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; + priv->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; + priv->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; /* * Disabling hardware scan means that mac80211 will perform scans * "the hard way", rather than using device's scan. */ - if (iwl3945_mod_params.disable_hw_scan) { - IWL_DEBUG_INFO(priv, "Disabling hw_scan\n"); - iwl3945_hw_ops.hw_scan = NULL; + if (il3945_mod_params.disable_hw_scan) { + IL_DEBUG_INFO(priv, "Disabling hw_scan\n"); + il3945_hw_ops.hw_scan = NULL; } - IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); + IL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); priv->cfg = cfg; priv->pci_dev = pdev; priv->inta_mask = CSR_INI_SET_MASK; - if (iwl_legacy_alloc_traffic_mem(priv)) - IWL_ERR(priv, "Not enough memory to generate traffic log\n"); + if (il_alloc_traffic_mem(priv)) + IL_ERR(priv, "Not enough memory to generate traffic log\n"); /*************************** * 2. Initializing PCI bus @@ -3711,7 +3711,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e if (!err) err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { - IWL_WARN(priv, "No suitable DMA available.\n"); + IL_WARN(priv, "No suitable DMA available.\n"); goto out_pci_disable_device; } @@ -3729,9 +3729,9 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e goto out_pci_release_regions; } - IWL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", + IL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", (unsigned long long) pci_resource_len(pdev, 0)); - IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); + IL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); /* We disable the RETRY_TIMEOUT register (0x41) to keep * 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 * strange state ... like being left stranded by a primary kernel * and this is now the kdump kernel trying to start up */ - iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); + il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); /*********************** * 4. Read EEPROM * ********************/ /* Read the EEPROM */ - err = iwl_legacy_eeprom_init(priv); + err = il_eeprom_init(priv); if (err) { - IWL_ERR(priv, "Unable to init EEPROM\n"); + IL_ERR(priv, "Unable to init EEPROM\n"); goto out_iounmap; } /* MAC Address location in EEPROM same for 3945/4965 */ - eeprom = (struct iwl3945_eeprom *)priv->eeprom; - IWL_DEBUG_INFO(priv, "MAC address: %pM\n", eeprom->mac_address); + eeprom = (struct il3945_eeprom *)priv->eeprom; + IL_DEBUG_INFO(priv, "MAC address: %pM\n", eeprom->mac_address); SET_IEEE80211_PERM_ADDR(priv->hw, eeprom->mac_address); /*********************** * 5. Setup HW Constants * ********************/ /* Device-specific setup */ - if (iwl3945_hw_set_hw_params(priv)) { - IWL_ERR(priv, "failed to set hw settings\n"); + if (il3945_hw_set_hw_params(priv)) { + IL_ERR(priv, "failed to set hw settings\n"); goto out_eeprom_free; } @@ -3778,13 +3778,13 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e * 6. Setup priv * ********************/ - err = iwl3945_init_drv(priv); + err = il3945_init_drv(priv); if (err) { - IWL_ERR(priv, "initializing driver failed\n"); + IL_ERR(priv, "initializing driver failed\n"); goto out_unset_hw_params; } - IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n", + IL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n", priv->cfg->name); /*********************** @@ -3792,44 +3792,44 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e * ********************/ spin_lock_irqsave(&priv->lock, flags); - iwl_legacy_disable_interrupts(priv); + il_disable_interrupts(priv); spin_unlock_irqrestore(&priv->lock, flags); pci_enable_msi(priv->pci_dev); - err = request_irq(priv->pci_dev->irq, iwl_legacy_isr, + err = request_irq(priv->pci_dev->irq, il_isr, IRQF_SHARED, DRV_NAME, priv); if (err) { - IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); + IL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); goto out_disable_msi; } - err = sysfs_create_group(&pdev->dev.kobj, &iwl3945_attribute_group); + err = sysfs_create_group(&pdev->dev.kobj, &il3945_attribute_group); if (err) { - IWL_ERR(priv, "failed to create sysfs device attributes\n"); + IL_ERR(priv, "failed to create sysfs device attributes\n"); goto out_release_irq; } - iwl_legacy_set_rxon_channel(priv, + il_set_rxon_channel(priv, &priv->bands[IEEE80211_BAND_2GHZ].channels[5], - &priv->contexts[IWL_RXON_CTX_BSS]); - iwl3945_setup_deferred_work(priv); - iwl3945_setup_rx_handlers(priv); - iwl_legacy_power_initialize(priv); + &priv->contexts[IL_RXON_CTX_BSS]); + il3945_setup_deferred_work(priv); + il3945_setup_rx_handlers(priv); + il_power_initialize(priv); /********************************* * 8. Setup and Register mac80211 * *******************************/ - iwl_legacy_enable_interrupts(priv); + il_enable_interrupts(priv); - err = iwl3945_setup_mac(priv); + err = il3945_setup_mac(priv); if (err) goto out_remove_sysfs; - err = iwl_legacy_dbgfs_register(priv, DRV_NAME); + err = il_dbgfs_register(priv, DRV_NAME); if (err) - IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); + IL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); /* Start monitoring the killswitch */ 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 out_remove_sysfs: destroy_workqueue(priv->workqueue); priv->workqueue = NULL; - sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); + sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); out_release_irq: free_irq(priv->pci_dev->irq, priv); out_disable_msi: pci_disable_msi(priv->pci_dev); - iwl_legacy_free_geos(priv); - iwl_legacy_free_channel_map(priv); + il_free_geos(priv); + il_free_channel_map(priv); out_unset_hw_params: - iwl3945_unset_hw_params(priv); + il3945_unset_hw_params(priv); out_eeprom_free: - iwl_legacy_eeprom_free(priv); + il_eeprom_free(priv); out_iounmap: pci_iounmap(pdev, priv->hw_base); out_pci_release_regions: @@ -3859,74 +3859,74 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e pci_set_drvdata(pdev, NULL); pci_disable_device(pdev); out_ieee80211_free_hw: - iwl_legacy_free_traffic_mem(priv); + il_free_traffic_mem(priv); ieee80211_free_hw(priv->hw); out: return err; } -static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) +static void __devexit il3945_pci_remove(struct pci_dev *pdev) { - struct iwl_priv *priv = pci_get_drvdata(pdev); + struct il_priv *priv = pci_get_drvdata(pdev); unsigned long flags; if (!priv) return; - IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); + IL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); - iwl_legacy_dbgfs_unregister(priv); + il_dbgfs_unregister(priv); set_bit(STATUS_EXIT_PENDING, &priv->status); - iwl_legacy_leds_exit(priv); + il_leds_exit(priv); if (priv->mac80211_registered) { ieee80211_unregister_hw(priv->hw); priv->mac80211_registered = 0; } else { - iwl3945_down(priv); + il3945_down(priv); } /* * Make sure device is reset to low power before unloading driver. - * This may be redundant with iwl_down(), but there are paths to - * run iwl_down() without calling apm_ops.stop(), and there are - * paths to avoid running iwl_down() at all before leaving driver. + * This may be redundant with il_down(), but there are paths to + * run il_down() without calling apm_ops.stop(), and there are + * paths to avoid running il_down() at all before leaving driver. * This (inexpensive) call *makes sure* device is reset. */ - iwl_legacy_apm_stop(priv); + il_apm_stop(priv); /* make sure we flush any pending irq or * tasklet for the driver */ spin_lock_irqsave(&priv->lock, flags); - iwl_legacy_disable_interrupts(priv); + il_disable_interrupts(priv); spin_unlock_irqrestore(&priv->lock, flags); - iwl3945_synchronize_irq(priv); + il3945_synchronize_irq(priv); - sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); + sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); cancel_delayed_work_sync(&priv->_3945.rfkill_poll); - iwl3945_dealloc_ucode_pci(priv); + il3945_dealloc_ucode_pci(priv); if (priv->rxq.bd) - iwl3945_rx_queue_free(priv, &priv->rxq); - iwl3945_hw_txq_ctx_free(priv); + il3945_rx_queue_free(priv, &priv->rxq); + il3945_hw_txq_ctx_free(priv); - iwl3945_unset_hw_params(priv); + il3945_unset_hw_params(priv); /*netif_stop_queue(dev); */ flush_workqueue(priv->workqueue); - /* ieee80211_unregister_hw calls iwl3945_mac_stop, which flushes + /* ieee80211_unregister_hw calls il3945_mac_stop, which flushes * priv->workqueue... so we can't take down the workqueue * until now... */ destroy_workqueue(priv->workqueue); priv->workqueue = NULL; - iwl_legacy_free_traffic_mem(priv); + il_free_traffic_mem(priv); free_irq(pdev->irq, priv); pci_disable_msi(pdev); @@ -3936,8 +3936,8 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); - iwl_legacy_free_channel_map(priv); - iwl_legacy_free_geos(priv); + il_free_channel_map(priv); + il_free_geos(priv); kfree(priv->scan_cmd); if (priv->beacon_skb) dev_kfree_skb(priv->beacon_skb); @@ -3952,28 +3952,28 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) * *****************************************************************************/ -static struct pci_driver iwl3945_driver = { +static struct pci_driver il3945_driver = { .name = DRV_NAME, - .id_table = iwl3945_hw_card_ids, - .probe = iwl3945_pci_probe, - .remove = __devexit_p(iwl3945_pci_remove), - .driver.pm = IWL_LEGACY_PM_OPS, + .id_table = il3945_hw_card_ids, + .probe = il3945_pci_probe, + .remove = __devexit_p(il3945_pci_remove), + .driver.pm = IL_LEGACY_PM_OPS, }; -static int __init iwl3945_init(void) +static int __init il3945_init(void) { int ret; pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); pr_info(DRV_COPYRIGHT "\n"); - ret = iwl3945_rate_control_register(); + ret = il3945_rate_control_register(); if (ret) { pr_err("Unable to register rate control algorithm: %d\n", ret); return ret; } - ret = pci_register_driver(&iwl3945_driver); + ret = pci_register_driver(&il3945_driver); if (ret) { pr_err("Unable to initialize PCI module\n"); goto error_register; @@ -3982,32 +3982,32 @@ static int __init iwl3945_init(void) return ret; error_register: - iwl3945_rate_control_unregister(); + il3945_rate_control_unregister(); return ret; } -static void __exit iwl3945_exit(void) +static void __exit il3945_exit(void) { - pci_unregister_driver(&iwl3945_driver); - iwl3945_rate_control_unregister(); + pci_unregister_driver(&il3945_driver); + il3945_rate_control_unregister(); } MODULE_FIRMWARE(IWL3945_MODULE_FIRMWARE(IWL3945_UCODE_API_MAX)); -module_param_named(antenna, iwl3945_mod_params.antenna, int, S_IRUGO); +module_param_named(antenna, il3945_mod_params.antenna, int, S_IRUGO); MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); -module_param_named(swcrypto, iwl3945_mod_params.sw_crypto, int, S_IRUGO); +module_param_named(swcrypto, il3945_mod_params.sw_crypto, int, S_IRUGO); MODULE_PARM_DESC(swcrypto, "using software crypto (default 1 [software])"); -module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan, +module_param_named(disable_hw_scan, il3945_mod_params.disable_hw_scan, int, S_IRUGO); MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 1)"); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "debug output mask"); #endif -module_param_named(fw_restart, iwl3945_mod_params.restart_fw, int, S_IRUGO); +module_param_named(fw_restart, il3945_mod_params.restart_fw, int, S_IRUGO); MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); -module_exit(iwl3945_exit); -module_init(iwl3945_init); +module_exit(il3945_exit); +module_init(il3945_init); diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c index fd2f7a4..bd37c92 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); MODULE_LICENSE("GPL"); MODULE_ALIAS("iwl4965"); -void iwl4965_update_chain_flags(struct iwl_priv *priv) +void il4965_update_chain_flags(struct il_priv *priv) { - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; if (priv->cfg->ops->hcmd->set_rxon_chain) { for_each_context(priv, ctx) { priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); if (ctx->active.rx_chain != ctx->staging.rx_chain) - iwl_legacy_commit_rxon(priv, ctx); + il_commit_rxon(priv, ctx); } } } -static void iwl4965_clear_free_frames(struct iwl_priv *priv) +static void il4965_clear_free_frames(struct il_priv *priv) { struct list_head *element; - IWL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", + IL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", priv->frames_count); while (!list_empty(&priv->free_frames)) { element = priv->free_frames.next; list_del(element); - kfree(list_entry(element, struct iwl_frame, list)); + kfree(list_entry(element, struct il_frame, list)); priv->frames_count--; } if (priv->frames_count) { - IWL_WARN(priv, "%d frames still in use. Did we lose one?\n", + IL_WARN(priv, "%d frames still in use. Did we lose one?\n", priv->frames_count); priv->frames_count = 0; } } -static struct iwl_frame *iwl4965_get_free_frame(struct iwl_priv *priv) +static struct il_frame *il4965_get_free_frame(struct il_priv *priv) { - struct iwl_frame *frame; + struct il_frame *frame; struct list_head *element; if (list_empty(&priv->free_frames)) { frame = kzalloc(sizeof(*frame), GFP_KERNEL); if (!frame) { - IWL_ERR(priv, "Could not allocate frame!\n"); + IL_ERR(priv, "Could not allocate frame!\n"); return NULL; } @@ -138,16 +138,16 @@ static struct iwl_frame *iwl4965_get_free_frame(struct iwl_priv *priv) element = priv->free_frames.next; list_del(element); - return list_entry(element, struct iwl_frame, list); + return list_entry(element, struct il_frame, list); } -static void iwl4965_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) +static void il4965_free_frame(struct il_priv *priv, struct il_frame *frame) { memset(frame, 0, sizeof(*frame)); list_add(&frame->list, &priv->free_frames); } -static u32 iwl4965_fill_beacon_frame(struct iwl_priv *priv, +static u32 il4965_fill_beacon_frame(struct il_priv *priv, struct ieee80211_hdr *hdr, int left) { @@ -165,8 +165,8 @@ static u32 iwl4965_fill_beacon_frame(struct iwl_priv *priv, } /* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */ -static void iwl4965_set_beacon_tim(struct iwl_priv *priv, - struct iwl_tx_beacon_cmd *tx_beacon_cmd, +static void il4965_set_beacon_tim(struct il_priv *priv, + struct il_tx_beacon_cmd *tx_beacon_cmd, u8 *beacon, u32 frame_size) { u16 tim_idx; @@ -188,13 +188,13 @@ static void iwl4965_set_beacon_tim(struct iwl_priv *priv, tx_beacon_cmd->tim_idx = cpu_to_le16(tim_idx); tx_beacon_cmd->tim_size = beacon[tim_idx+1]; } else - IWL_WARN(priv, "Unable to find TIM Element in beacon\n"); + IL_WARN(priv, "Unable to find TIM Element in beacon\n"); } -static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, - struct iwl_frame *frame) +static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *priv, + struct il_frame *frame) { - struct iwl_tx_beacon_cmd *tx_beacon_cmd; + struct il_tx_beacon_cmd *tx_beacon_cmd; u32 frame_size; u32 rate_flags; u32 rate; @@ -206,7 +206,7 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, lockdep_assert_held(&priv->mutex); if (!priv->beacon_ctx) { - IWL_ERR(priv, "trying to build beacon w/o beacon context!\n"); + IL_ERR(priv, "trying to build beacon w/o beacon context!\n"); return 0; } @@ -215,7 +215,7 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); /* Set up TX beacon contents */ - frame_size = iwl4965_fill_beacon_frame(priv, tx_beacon_cmd->frame, + frame_size = il4965_fill_beacon_frame(priv, tx_beacon_cmd->frame, sizeof(frame->u) - sizeof(*tx_beacon_cmd)); if (WARN_ON_ONCE(frame_size > MAX_MPDU_SIZE)) return 0; @@ -230,53 +230,53 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK; /* Set up TX beacon command fields */ - iwl4965_set_beacon_tim(priv, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame, + il4965_set_beacon_tim(priv, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame, frame_size); /* Set up packet rate and flags */ - rate = iwl_legacy_get_lowest_plcp(priv, priv->beacon_ctx); - priv->mgmt_tx_ant = iwl4965_toggle_tx_ant(priv, priv->mgmt_tx_ant, + rate = il_get_lowest_plcp(priv, priv->beacon_ctx); + priv->mgmt_tx_ant = il4965_toggle_tx_ant(priv, priv->mgmt_tx_ant, priv->hw_params.valid_tx_ant); - rate_flags = iwl4965_ant_idx_to_flags(priv->mgmt_tx_ant); - if ((rate >= IWL_FIRST_CCK_RATE) && (rate <= IWL_LAST_CCK_RATE)) + rate_flags = il4965_ant_idx_to_flags(priv->mgmt_tx_ant); + if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE)) rate_flags |= RATE_MCS_CCK_MSK; - tx_beacon_cmd->tx.rate_n_flags = iwl4965_hw_set_rate_n_flags(rate, + tx_beacon_cmd->tx.rate_n_flags = il4965_hw_set_rate_n_flags(rate, rate_flags); return sizeof(*tx_beacon_cmd) + frame_size; } -int iwl4965_send_beacon_cmd(struct iwl_priv *priv) +int il4965_send_beacon_cmd(struct il_priv *priv) { - struct iwl_frame *frame; + struct il_frame *frame; unsigned int frame_size; int rc; - frame = iwl4965_get_free_frame(priv); + frame = il4965_get_free_frame(priv); if (!frame) { - IWL_ERR(priv, "Could not obtain free frame buffer for beacon " + IL_ERR(priv, "Could not obtain free frame buffer for beacon " "command.\n"); return -ENOMEM; } - frame_size = iwl4965_hw_get_beacon_cmd(priv, frame); + frame_size = il4965_hw_get_beacon_cmd(priv, frame); if (!frame_size) { - IWL_ERR(priv, "Error configuring the beacon command\n"); - iwl4965_free_frame(priv, frame); + IL_ERR(priv, "Error configuring the beacon command\n"); + il4965_free_frame(priv, frame); return -EINVAL; } - rc = iwl_legacy_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, + rc = il_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, &frame->u.cmd[0]); - iwl4965_free_frame(priv, frame); + il4965_free_frame(priv, frame); return rc; } -static inline dma_addr_t iwl4965_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx) +static inline dma_addr_t il4965_tfd_tb_get_addr(struct il_tfd *tfd, u8 idx) { - struct iwl_tfd_tb *tb = &tfd->tbs[idx]; + struct il_tfd_tb *tb = &tfd->tbs[idx]; dma_addr_t addr = get_unaligned_le32(&tb->lo); 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) return addr; } -static inline u16 iwl4965_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) +static inline u16 il4965_tfd_tb_get_len(struct il_tfd *tfd, u8 idx) { - struct iwl_tfd_tb *tb = &tfd->tbs[idx]; + struct il_tfd_tb *tb = &tfd->tbs[idx]; return le16_to_cpu(tb->hi_n_len) >> 4; } -static inline void iwl4965_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, +static inline void il4965_tfd_set_tb(struct il_tfd *tfd, u8 idx, dma_addr_t addr, u16 len) { - struct iwl_tfd_tb *tb = &tfd->tbs[idx]; + struct il_tfd_tb *tb = &tfd->tbs[idx]; u16 hi_n_len = len << 4; put_unaligned_le32(addr, &tb->lo); @@ -308,23 +308,23 @@ static inline void iwl4965_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, tfd->num_tbs = idx + 1; } -static inline u8 iwl4965_tfd_get_num_tbs(struct iwl_tfd *tfd) +static inline u8 il4965_tfd_get_num_tbs(struct il_tfd *tfd) { return tfd->num_tbs & 0x1f; } /** - * iwl4965_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] + * il4965_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] * @priv - driver private data * @txq - tx queue * * Does NOT advance any TFD circular buffer read/write indexes * Does NOT free the TFD itself (which is within circular buffer) */ -void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) +void il4965_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq) { - struct iwl_tfd *tfd_tmp = (struct iwl_tfd *)txq->tfds; - struct iwl_tfd *tfd; + struct il_tfd *tfd_tmp = (struct il_tfd *)txq->tfds; + struct il_tfd *tfd; struct pci_dev *dev = priv->pci_dev; int index = txq->q.read_ptr; int i; @@ -333,10 +333,10 @@ void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) tfd = &tfd_tmp[index]; /* Sanity check on number of chunks */ - num_tbs = iwl4965_tfd_get_num_tbs(tfd); + num_tbs = il4965_tfd_get_num_tbs(tfd); - if (num_tbs >= IWL_NUM_OF_TBS) { - IWL_ERR(priv, "Too many chunks: %i\n", num_tbs); + if (num_tbs >= IL_NUM_OF_TBS) { + IL_ERR(priv, "Too many chunks: %i\n", num_tbs); /* @todo issue fatal error, it is quite serious situation */ return; } @@ -350,8 +350,8 @@ void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) /* Unmap chunks, if any. */ for (i = 1; i < num_tbs; i++) - pci_unmap_single(dev, iwl4965_tfd_tb_get_addr(tfd, i), - iwl4965_tfd_tb_get_len(tfd, i), + pci_unmap_single(dev, il4965_tfd_tb_get_addr(tfd, i), + il4965_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE); /* free SKB */ @@ -368,37 +368,37 @@ void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) } } -int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, - struct iwl_tx_queue *txq, +int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *priv, + struct il_tx_queue *txq, dma_addr_t addr, u16 len, u8 reset, u8 pad) { - struct iwl_queue *q; - struct iwl_tfd *tfd, *tfd_tmp; + struct il_queue *q; + struct il_tfd *tfd, *tfd_tmp; u32 num_tbs; q = &txq->q; - tfd_tmp = (struct iwl_tfd *)txq->tfds; + tfd_tmp = (struct il_tfd *)txq->tfds; tfd = &tfd_tmp[q->write_ptr]; if (reset) memset(tfd, 0, sizeof(*tfd)); - num_tbs = iwl4965_tfd_get_num_tbs(tfd); + num_tbs = il4965_tfd_get_num_tbs(tfd); /* Each TFD can point to a maximum 20 Tx buffers */ - if (num_tbs >= IWL_NUM_OF_TBS) { - IWL_ERR(priv, "Error can not send more than %d chunks\n", - IWL_NUM_OF_TBS); + if (num_tbs >= IL_NUM_OF_TBS) { + IL_ERR(priv, "Error can not send more than %d chunks\n", + IL_NUM_OF_TBS); return -EINVAL; } BUG_ON(addr & ~DMA_BIT_MASK(36)); - if (unlikely(addr & ~IWL_TX_DMA_MASK)) - IWL_ERR(priv, "Unaligned address = %llx\n", + if (unlikely(addr & ~IL_TX_DMA_MASK)) + IL_ERR(priv, "Unaligned address = %llx\n", (unsigned long long)addr); - iwl4965_tfd_set_tb(tfd, num_tbs, addr, len); + il4965_tfd_set_tb(tfd, num_tbs, addr, len); return 0; } @@ -410,13 +410,13 @@ int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, * 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA * channels supported in hardware. */ -int iwl4965_hw_tx_queue_init(struct iwl_priv *priv, - struct iwl_tx_queue *txq) +int il4965_hw_tx_queue_init(struct il_priv *priv, + struct il_tx_queue *txq) { int txq_id = txq->q.id; /* Circular buffer (TFD queue in DRAM) physical base address */ - iwl_legacy_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), + il_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), txq->q.dma_addr >> 8); return 0; @@ -427,30 +427,30 @@ int iwl4965_hw_tx_queue_init(struct iwl_priv *priv, * Generic RX handler implementations * ******************************************************************************/ -static void iwl4965_rx_reply_alive(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il4965_rx_reply_alive(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_alive_resp *palive; + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_alive_resp *palive; struct delayed_work *pwork; palive = &pkt->u.alive_frame; - IWL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " + IL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " "0x%01X 0x%01X\n", palive->is_valid, palive->ver_type, palive->ver_subtype); if (palive->ver_subtype == INITIALIZE_SUBTYPE) { - IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); + IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); memcpy(&priv->card_alive_init, &pkt->u.alive_frame, - sizeof(struct iwl_init_alive_resp)); + sizeof(struct il_init_alive_resp)); pwork = &priv->init_alive_start; } else { - IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); + IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); memcpy(&priv->card_alive, &pkt->u.alive_frame, - sizeof(struct iwl_alive_resp)); + sizeof(struct il_alive_resp)); pwork = &priv->alive_start; } @@ -460,11 +460,11 @@ static void iwl4965_rx_reply_alive(struct iwl_priv *priv, queue_delayed_work(priv->workqueue, pwork, msecs_to_jiffies(5)); else - IWL_WARN(priv, "uCode did not respond OK.\n"); + IL_WARN(priv, "uCode did not respond OK.\n"); } /** - * iwl4965_bg_statistics_periodic - Timer callback to queue statistics + * il4965_bg_statistics_periodic - Timer callback to queue statistics * * This callback is provided in order to send a statistics request. * @@ -473,30 +473,30 @@ static void iwl4965_rx_reply_alive(struct iwl_priv *priv, * was received. We need to ensure we receive the statistics in order * to update the temperature used for calibrating the TXPOWER. */ -static void iwl4965_bg_statistics_periodic(unsigned long data) +static void il4965_bg_statistics_periodic(unsigned long data) { - struct iwl_priv *priv = (struct iwl_priv *)data; + struct il_priv *priv = (struct il_priv *)data; if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; /* dont send host command if rf-kill is on */ - if (!iwl_legacy_is_ready_rf(priv)) + if (!il_is_ready_rf(priv)) return; - iwl_legacy_send_statistics_request(priv, CMD_ASYNC, false); + il_send_statistics_request(priv, CMD_ASYNC, false); } -static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il4965_rx_beacon_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl4965_beacon_notif *beacon = - (struct iwl4965_beacon_notif *)pkt->u.raw; + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il4965_beacon_notif *beacon = + (struct il4965_beacon_notif *)pkt->u.raw; #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - u8 rate = iwl4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); + u8 rate = il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); - IWL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " + IL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " "tsf %d %d rate %d\n", le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, beacon->beacon_notify_hdr.failure_frame, @@ -508,35 +508,35 @@ static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); } -static void iwl4965_perform_ct_kill_task(struct iwl_priv *priv) +static void il4965_perform_ct_kill_task(struct il_priv *priv) { unsigned long flags; - IWL_DEBUG_POWER(priv, "Stop all queues\n"); + IL_DEBUG_POWER(priv, "Stop all queues\n"); if (priv->mac80211_registered) ieee80211_stop_queues(priv->hw); - iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, + il_write32(priv, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); - iwl_read32(priv, CSR_UCODE_DRV_GP1); + il_read32(priv, CSR_UCODE_DRV_GP1); spin_lock_irqsave(&priv->reg_lock, flags); - if (!iwl_grab_nic_access(priv)) - iwl_release_nic_access(priv); + if (!il_grab_nic_access(priv)) + il_release_nic_access(priv); spin_unlock_irqrestore(&priv->reg_lock, flags); } /* Handle notification from uCode that card's power state is changing * due to software, hardware, or critical temperature RFKILL */ -static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void il4965_rx_card_state_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_packet *pkt = rxb_addr(rxb); u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); unsigned long status = priv->status; - IWL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s CT:%s\n", + IL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s CT:%s\n", (flags & HW_CARD_DISABLED) ? "Kill" : "On", (flags & SW_CARD_DISABLED) ? "Kill" : "On", (flags & CT_CARD_DISABLED) ? @@ -545,22 +545,22 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | CT_CARD_DISABLED)) { - iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, + il_write32(priv, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - iwl_legacy_write_direct32(priv, HBUS_TARG_MBX_C, + il_write_direct32(priv, HBUS_TARG_MBX_C, HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); if (!(flags & RXON_CARD_DISABLED)) { - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, + il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - iwl_legacy_write_direct32(priv, HBUS_TARG_MBX_C, + il_write_direct32(priv, HBUS_TARG_MBX_C, HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); } } if (flags & CT_CARD_DISABLED) - iwl4965_perform_ct_kill_task(priv); + il4965_perform_ct_kill_task(priv); if (flags & HW_CARD_DISABLED) set_bit(STATUS_RF_KILL_HW, &priv->status); @@ -568,7 +568,7 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, clear_bit(STATUS_RF_KILL_HW, &priv->status); if (!(flags & RXON_CARD_DISABLED)) - iwl_legacy_scan_cancel(priv); + il_scan_cancel(priv); if ((test_bit(STATUS_RF_KILL_HW, &status) != test_bit(STATUS_RF_KILL_HW, &priv->status))) @@ -579,7 +579,7 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, } /** - * iwl4965_setup_rx_handlers - Initialize Rx handler callbacks + * il4965_setup_rx_handlers - Initialize Rx handler callbacks * * Setup the RX handlers for each of the reply types sent from the uCode * to the host. @@ -587,55 +587,55 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, * This function chains into the hardware specific files for them to setup * any hardware specific handlers as well. */ -static void iwl4965_setup_rx_handlers(struct iwl_priv *priv) +static void il4965_setup_rx_handlers(struct il_priv *priv) { - priv->rx_handlers[REPLY_ALIVE] = iwl4965_rx_reply_alive; - priv->rx_handlers[REPLY_ERROR] = iwl_legacy_rx_reply_error; - priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_legacy_rx_csa; + priv->rx_handlers[REPLY_ALIVE] = il4965_rx_reply_alive; + priv->rx_handlers[REPLY_ERROR] = il_rx_reply_error; + priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa; priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = - iwl_legacy_rx_spectrum_measure_notif; - priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_legacy_rx_pm_sleep_notif; + il_rx_spectrum_measure_notif; + priv->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif; priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = - iwl_legacy_rx_pm_debug_statistics_notif; - priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif; + il_rx_pm_debug_statistics_notif; + priv->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif; /* * The same handler is used for both the REPLY to a discrete * statistics request from the host as well as for the periodic * statistics notifications (after received beacons) from the uCode. */ - priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl4965_reply_statistics; - priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl4965_rx_statistics; + priv->rx_handlers[REPLY_STATISTICS_CMD] = il4965_reply_statistics; + priv->rx_handlers[STATISTICS_NOTIFICATION] = il4965_rx_statistics; - iwl_legacy_setup_rx_scan_handlers(priv); + il_setup_rx_scan_handlers(priv); /* status change handler */ priv->rx_handlers[CARD_STATE_NOTIFICATION] = - iwl4965_rx_card_state_notif; + il4965_rx_card_state_notif; priv->rx_handlers[MISSED_BEACONS_NOTIFICATION] = - iwl4965_rx_missed_beacon_notif; + il4965_rx_missed_beacon_notif; /* Rx handlers */ - priv->rx_handlers[REPLY_RX_PHY_CMD] = iwl4965_rx_reply_rx_phy; - priv->rx_handlers[REPLY_RX_MPDU_CMD] = iwl4965_rx_reply_rx; + priv->rx_handlers[REPLY_RX_PHY_CMD] = il4965_rx_reply_rx_phy; + priv->rx_handlers[REPLY_RX_MPDU_CMD] = il4965_rx_reply_rx; /* block ack */ - priv->rx_handlers[REPLY_COMPRESSED_BA] = iwl4965_rx_reply_compressed_ba; + priv->rx_handlers[REPLY_COMPRESSED_BA] = il4965_rx_reply_compressed_ba; /* Set up hardware specific Rx handlers */ priv->cfg->ops->lib->rx_handler_setup(priv); } /** - * iwl4965_rx_handle - Main entry function for receiving responses from uCode + * il4965_rx_handle - Main entry function for receiving responses from uCode * * Uses the priv->rx_handlers callback function array to invoke * the appropriate handlers, including command responses, * frame-received notifications, and other notifications. */ -void iwl4965_rx_handle(struct iwl_priv *priv) +void il4965_rx_handle(struct il_priv *priv) { - struct iwl_rx_mem_buffer *rxb; - struct iwl_rx_packet *pkt; - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_rx_mem_buffer *rxb; + struct il_rx_packet *pkt; + struct il_rx_queue *rxq = &priv->rxq; u32 r, i; int reclaim; unsigned long flags; @@ -650,7 +650,7 @@ void iwl4965_rx_handle(struct iwl_priv *priv) /* Rx interrupt, but nothing sent from uCode */ if (i == r) - IWL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); + IL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); /* calculate total frames need to be restock after handling RX */ total_empty = r - rxq->write_actual; @@ -696,18 +696,18 @@ void iwl4965_rx_handle(struct iwl_priv *priv) /* Based on type of command response or notification, * handle those that need handling via function in - * rx_handlers table. See iwl4965_setup_rx_handlers() */ + * rx_handlers table. See il4965_setup_rx_handlers() */ if (priv->rx_handlers[pkt->hdr.cmd]) { - IWL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, - i, iwl_legacy_get_cmd_string(pkt->hdr.cmd), + IL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, + i, il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); priv->isr_stats.rx_handlers[pkt->hdr.cmd]++; priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); } else { /* No handling needed */ - IWL_DEBUG_RX(priv, + IL_DEBUG_RX(priv, "r %d i %d No handler needed for %s, 0x%02x\n", - r, i, iwl_legacy_get_cmd_string(pkt->hdr.cmd), + r, i, il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); } @@ -720,12 +720,12 @@ void iwl4965_rx_handle(struct iwl_priv *priv) if (reclaim) { /* Invoke any callbacks, transfer the buffer to caller, - * and fire off the (possibly) blocking iwl_legacy_send_cmd() + * and fire off the (possibly) blocking il_send_cmd() * as we reclaim the driver command queue */ if (rxb->page) - iwl_legacy_tx_cmd_complete(priv, rxb); + il_tx_cmd_complete(priv, rxb); else - IWL_WARN(priv, "Claim null rxb?\n"); + IL_WARN(priv, "Claim null rxb?\n"); } /* Reuse the page if possible. For notification packets and @@ -750,7 +750,7 @@ void iwl4965_rx_handle(struct iwl_priv *priv) count++; if (count >= 8) { rxq->read = i; - iwl4965_rx_replenish_now(priv); + il4965_rx_replenish_now(priv); count = 0; } } @@ -759,20 +759,20 @@ void iwl4965_rx_handle(struct iwl_priv *priv) /* Backtrack one entry */ rxq->read = i; if (fill_rx) - iwl4965_rx_replenish_now(priv); + il4965_rx_replenish_now(priv); else - iwl4965_rx_queue_restock(priv); + il4965_rx_queue_restock(priv); } /* call this function to flush any scheduled tasklet */ -static inline void iwl4965_synchronize_irq(struct iwl_priv *priv) +static inline void il4965_synchronize_irq(struct il_priv *priv) { /* wait to make sure we flush pending tasklet*/ synchronize_irq(priv->pci_dev->irq); tasklet_kill(&priv->irq_tasklet); } -static void iwl4965_irq_tasklet(struct iwl_priv *priv) +static void il4965_irq_tasklet(struct il_priv *priv) { u32 inta, handled = 0; u32 inta_fh; @@ -787,20 +787,20 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) /* Ack/clear/reset pending uCode interrupts. * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, * and will clear only when CSR_FH_INT_STATUS gets cleared. */ - inta = iwl_read32(priv, CSR_INT); - iwl_write32(priv, CSR_INT, inta); + inta = il_read32(priv, CSR_INT); + il_write32(priv, CSR_INT, inta); /* Ack/clear/reset pending flow-handler (DMA) interrupts. * Any new interrupts that happen after this, either while we're * in this tasklet, or later, will show up in next ISR/tasklet. */ - inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); - iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); + inta_fh = il_read32(priv, CSR_FH_INT_STATUS); + il_write32(priv, CSR_FH_INT_STATUS, inta_fh); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (iwl_legacy_get_debug_level(priv) & IWL_DL_ISR) { + if (il_get_debug_level(priv) & IL_DL_ISR) { /* just for debug */ - inta_mask = iwl_read32(priv, CSR_INT_MASK); - IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", + inta_mask = il_read32(priv, CSR_INT_MASK); + IL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); } #endif @@ -818,13 +818,13 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) /* Now service all interrupt bits discovered above. */ if (inta & CSR_INT_BIT_HW_ERR) { - IWL_ERR(priv, "Hardware error detected. Restarting.\n"); + IL_ERR(priv, "Hardware error detected. Restarting.\n"); /* Tell the device to stop sending interrupts */ - iwl_legacy_disable_interrupts(priv); + il_disable_interrupts(priv); priv->isr_stats.hw++; - iwl_legacy_irq_handle_error(priv); + il_irq_handle_error(priv); handled |= CSR_INT_BIT_HW_ERR; @@ -832,17 +832,17 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) { + if (il_get_debug_level(priv) & (IL_DL_ISR)) { /* NIC fires this, but we don't use it, redundant with WAKEUP */ if (inta & CSR_INT_BIT_SCD) { - IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " + IL_DEBUG_ISR(priv, "Scheduler finished to transmit " "the frame/frames.\n"); priv->isr_stats.sch++; } /* Alive notification via Rx interrupt will do the real work */ if (inta & CSR_INT_BIT_ALIVE) { - IWL_DEBUG_ISR(priv, "Alive interrupt\n"); + IL_DEBUG_ISR(priv, "Alive interrupt\n"); priv->isr_stats.alive++; } } @@ -853,11 +853,11 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) /* HW RF KILL switch toggled */ if (inta & CSR_INT_BIT_RF_KILL) { int hw_rf_kill = 0; - if (!(iwl_read32(priv, CSR_GP_CNTRL) & + if (!(il_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) hw_rf_kill = 1; - IWL_WARN(priv, "RF_KILL bit toggled to %s.\n", + IL_WARN(priv, "RF_KILL bit toggled to %s.\n", hw_rf_kill ? "disable radio" : "enable radio"); priv->isr_stats.rfkill++; @@ -880,17 +880,17 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) /* Chip got too hot and stopped itself */ if (inta & CSR_INT_BIT_CT_KILL) { - IWL_ERR(priv, "Microcode CT kill error detected.\n"); + IL_ERR(priv, "Microcode CT kill error detected.\n"); priv->isr_stats.ctkill++; handled |= CSR_INT_BIT_CT_KILL; } /* Error detected by uCode */ if (inta & CSR_INT_BIT_SW_ERR) { - IWL_ERR(priv, "Microcode SW error detected. " + IL_ERR(priv, "Microcode SW error detected. " " Restarting 0x%X.\n", inta); priv->isr_stats.sw++; - iwl_legacy_irq_handle_error(priv); + il_irq_handle_error(priv); handled |= CSR_INT_BIT_SW_ERR; } @@ -900,10 +900,10 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) * and about any Rx buffers made available while asleep. */ if (inta & CSR_INT_BIT_WAKEUP) { - IWL_DEBUG_ISR(priv, "Wakeup interrupt\n"); - iwl_legacy_rx_queue_update_write_ptr(priv, &priv->rxq); + IL_DEBUG_ISR(priv, "Wakeup interrupt\n"); + il_rx_queue_update_write_ptr(priv, &priv->rxq); for (i = 0; i < priv->hw_params.max_txq_num; i++) - iwl_legacy_txq_update_write_ptr(priv, &priv->txq[i]); + il_txq_update_write_ptr(priv, &priv->txq[i]); priv->isr_stats.wakeup++; handled |= CSR_INT_BIT_WAKEUP; } @@ -912,14 +912,14 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) * Rx "responses" (frame-received notification), and other * notifications from uCode come through here*/ if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { - iwl4965_rx_handle(priv); + il4965_rx_handle(priv); priv->isr_stats.rx++; handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); } /* This "Tx" DMA channel is used only for loading uCode */ if (inta & CSR_INT_BIT_FH_TX) { - IWL_DEBUG_ISR(priv, "uCode load interrupt\n"); + IL_DEBUG_ISR(priv, "uCode load interrupt\n"); priv->isr_stats.tx++; handled |= CSR_INT_BIT_FH_TX; /* Wake up uCode load routine, now that load is complete */ @@ -928,30 +928,30 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) } if (inta & ~handled) { - IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); + IL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); priv->isr_stats.unhandled++; } if (inta & ~(priv->inta_mask)) { - IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", + IL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", inta & ~priv->inta_mask); - IWL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh); + IL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh); } /* Re-enable all interrupts */ /* only Re-enable if disabled by irq */ if (test_bit(STATUS_INT_ENABLED, &priv->status)) - iwl_legacy_enable_interrupts(priv); + il_enable_interrupts(priv); /* Re-enable RF_KILL if it occurred */ else if (handled & CSR_INT_BIT_RF_KILL) - iwl_legacy_enable_rfkill_int(priv); + il_enable_rfkill_int(priv); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) { - inta = iwl_read32(priv, CSR_INT); - inta_mask = iwl_read32(priv, CSR_INT_MASK); - inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); - IWL_DEBUG_ISR(priv, + if (il_get_debug_level(priv) & (IL_DL_ISR)) { + inta = il_read32(priv, CSR_INT); + inta_mask = il_read32(priv, CSR_INT_MASK); + inta_fh = il_read32(priv, CSR_FH_INT_STATUS); + IL_DEBUG_ISR(priv, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); } @@ -977,78 +977,78 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) * level that is used instead of the global debug level if it (the per * device debug level) is set. */ -static ssize_t iwl4965_show_debug_level(struct device *d, +static ssize_t il4965_show_debug_level(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "0x%08X\n", iwl_legacy_get_debug_level(priv)); + struct il_priv *priv = dev_get_drvdata(d); + return sprintf(buf, "0x%08X\n", il_get_debug_level(priv)); } -static ssize_t iwl4965_store_debug_level(struct device *d, +static ssize_t il4965_store_debug_level(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); unsigned long val; int ret; ret = strict_strtoul(buf, 0, &val); if (ret) - IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf); + IL_ERR(priv, "%s is not in hex or decimal form.\n", buf); else { priv->debug_level = val; - if (iwl_legacy_alloc_traffic_mem(priv)) - IWL_ERR(priv, + if (il_alloc_traffic_mem(priv)) + IL_ERR(priv, "Not enough memory to generate traffic log\n"); } return strnlen(buf, count); } static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, - iwl4965_show_debug_level, iwl4965_store_debug_level); + il4965_show_debug_level, il4965_store_debug_level); #endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */ -static ssize_t iwl4965_show_temperature(struct device *d, +static ssize_t il4965_show_temperature(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); - if (!iwl_legacy_is_alive(priv)) + if (!il_is_alive(priv)) return -EAGAIN; return sprintf(buf, "%d\n", priv->temperature); } -static DEVICE_ATTR(temperature, S_IRUGO, iwl4965_show_temperature, NULL); +static DEVICE_ATTR(temperature, S_IRUGO, il4965_show_temperature, NULL); -static ssize_t iwl4965_show_tx_power(struct device *d, +static ssize_t il4965_show_tx_power(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); - if (!iwl_legacy_is_ready_rf(priv)) + if (!il_is_ready_rf(priv)) return sprintf(buf, "off\n"); else return sprintf(buf, "%d\n", priv->tx_power_user_lmt); } -static ssize_t iwl4965_store_tx_power(struct device *d, +static ssize_t il4965_store_tx_power(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct il_priv *priv = dev_get_drvdata(d); unsigned long val; int ret; ret = strict_strtoul(buf, 10, &val); if (ret) - IWL_INFO(priv, "%s is not in decimal form.\n", buf); + IL_INFO(priv, "%s is not in decimal form.\n", buf); else { - ret = iwl_legacy_set_tx_power(priv, val, false); + ret = il_set_tx_power(priv, val, false); if (ret) - IWL_ERR(priv, "failed setting tx power (0x%d).\n", + IL_ERR(priv, "failed setting tx power (0x%d).\n", ret); else ret = count; @@ -1057,9 +1057,9 @@ static ssize_t iwl4965_store_tx_power(struct device *d, } static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, - iwl4965_show_tx_power, iwl4965_store_tx_power); + il4965_show_tx_power, il4965_store_tx_power); -static struct attribute *iwl_sysfs_entries[] = { +static struct attribute *il_sysfs_entries[] = { &dev_attr_temperature.attr, &dev_attr_tx_power.attr, #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG @@ -1068,9 +1068,9 @@ static struct attribute *iwl_sysfs_entries[] = { NULL }; -static struct attribute_group iwl_attribute_group = { +static struct attribute_group il_attribute_group = { .name = NULL, /* put in device directory */ - .attrs = iwl_sysfs_entries, + .attrs = il_sysfs_entries, }; /****************************************************************************** @@ -1079,28 +1079,28 @@ static struct attribute_group iwl_attribute_group = { * ******************************************************************************/ -static void iwl4965_dealloc_ucode_pci(struct iwl_priv *priv) +static void il4965_dealloc_ucode_pci(struct il_priv *priv) { - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_code); - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data); - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init); - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); - iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_boot); + il_free_fw_desc(priv->pci_dev, &priv->ucode_code); + il_free_fw_desc(priv->pci_dev, &priv->ucode_data); + il_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); + il_free_fw_desc(priv->pci_dev, &priv->ucode_init); + il_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); + il_free_fw_desc(priv->pci_dev, &priv->ucode_boot); } -static void iwl4965_nic_start(struct iwl_priv *priv) +static void il4965_nic_start(struct il_priv *priv) { /* Remove all resets to allow NIC to operate */ - iwl_write32(priv, CSR_RESET, 0); + il_write32(priv, CSR_RESET, 0); } -static void iwl4965_ucode_callback(const struct firmware *ucode_raw, +static void il4965_ucode_callback(const struct firmware *ucode_raw, void *context); -static int iwl4965_mac_setup_register(struct iwl_priv *priv, +static int il4965_mac_setup_register(struct il_priv *priv, u32 max_probe_length); -static int __must_check iwl4965_request_firmware(struct iwl_priv *priv, bool first) +static int __must_check il4965_request_firmware(struct il_priv *priv, bool first) { const char *name_pre = priv->cfg->fw_name_pre; char tag[8]; @@ -1114,35 +1114,35 @@ static int __must_check iwl4965_request_firmware(struct iwl_priv *priv, bool fir } if (priv->fw_index < priv->cfg->ucode_api_min) { - IWL_ERR(priv, "no suitable firmware found!\n"); + IL_ERR(priv, "no suitable firmware found!\n"); return -ENOENT; } sprintf(priv->firmware_name, "%s%s%s", name_pre, tag, ".ucode"); - IWL_DEBUG_INFO(priv, "attempting to load firmware '%s'\n", + IL_DEBUG_INFO(priv, "attempting to load firmware '%s'\n", priv->firmware_name); return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, &priv->pci_dev->dev, GFP_KERNEL, priv, - iwl4965_ucode_callback); + il4965_ucode_callback); } -struct iwl4965_firmware_pieces { +struct il4965_firmware_pieces { const void *inst, *data, *init, *init_data, *boot; size_t inst_size, data_size, init_size, init_data_size, boot_size; }; -static int iwl4965_load_firmware(struct iwl_priv *priv, +static int il4965_load_firmware(struct il_priv *priv, const struct firmware *ucode_raw, - struct iwl4965_firmware_pieces *pieces) + struct il4965_firmware_pieces *pieces) { - struct iwl_ucode_header *ucode = (void *)ucode_raw->data; + struct il_ucode_header *ucode = (void *)ucode_raw->data; u32 api_ver, hdr_size; const u8 *src; priv->ucode_ver = le32_to_cpu(ucode->ver); - api_ver = IWL_UCODE_API(priv->ucode_ver); + api_ver = IL_UCODE_API(priv->ucode_ver); switch (api_ver) { default: @@ -1151,7 +1151,7 @@ static int iwl4965_load_firmware(struct iwl_priv *priv, case 2: hdr_size = 24; if (ucode_raw->size < hdr_size) { - IWL_ERR(priv, "File size too small!\n"); + IL_ERR(priv, "File size too small!\n"); return -EINVAL; } pieces->inst_size = le32_to_cpu(ucode->v1.inst_size); @@ -1169,7 +1169,7 @@ static int iwl4965_load_firmware(struct iwl_priv *priv, pieces->data_size + pieces->init_size + pieces->init_data_size + pieces->boot_size) { - IWL_ERR(priv, + IL_ERR(priv, "uCode file size %d does not match expected size\n", (int)ucode_raw->size); return -EINVAL; @@ -1190,54 +1190,54 @@ static int iwl4965_load_firmware(struct iwl_priv *priv, } /** - * iwl4965_ucode_callback - callback when firmware was loaded + * il4965_ucode_callback - callback when firmware was loaded * * If loaded successfully, copies the firmware into buffers * for the card to fetch (via DMA). */ static void -iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context) +il4965_ucode_callback(const struct firmware *ucode_raw, void *context) { - struct iwl_priv *priv = context; - struct iwl_ucode_header *ucode; + struct il_priv *priv = context; + struct il_ucode_header *ucode; int err; - struct iwl4965_firmware_pieces pieces; + struct il4965_firmware_pieces pieces; const unsigned int api_max = priv->cfg->ucode_api_max; const unsigned int api_min = priv->cfg->ucode_api_min; u32 api_ver; u32 max_probe_length = 200; u32 standard_phy_calibration_size = - IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE; + IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE; memset(&pieces, 0, sizeof(pieces)); if (!ucode_raw) { if (priv->fw_index <= priv->cfg->ucode_api_max) - IWL_ERR(priv, + IL_ERR(priv, "request for firmware file '%s' failed.\n", priv->firmware_name); goto try_again; } - IWL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n", + IL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n", priv->firmware_name, ucode_raw->size); /* Make sure that we got at least the API version number */ if (ucode_raw->size < 4) { - IWL_ERR(priv, "File size way too small!\n"); + IL_ERR(priv, "File size way too small!\n"); goto try_again; } /* Data from ucode file: header followed by uCode images */ - ucode = (struct iwl_ucode_header *)ucode_raw->data; + ucode = (struct il_ucode_header *)ucode_raw->data; - err = iwl4965_load_firmware(priv, ucode_raw, &pieces); + err = il4965_load_firmware(priv, ucode_raw, &pieces); if (err) goto try_again; - api_ver = IWL_UCODE_API(priv->ucode_ver); + api_ver = IL_UCODE_API(priv->ucode_ver); /* * 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) * on the API version read from firmware header from here on forward */ if (api_ver < api_min || api_ver > api_max) { - IWL_ERR(priv, + IL_ERR(priv, "Driver unable to support your firmware API. " "Driver supports v%u, firmware is v%u.\n", api_max, api_ver); @@ -1253,25 +1253,25 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context) } if (api_ver != api_max) - IWL_ERR(priv, + IL_ERR(priv, "Firmware has old API version. Expected v%u, " "got v%u. New firmware can be obtained " "from http://www.intellinuxwireless.org.\n", api_max, api_ver); - IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", - IWL_UCODE_MAJOR(priv->ucode_ver), - IWL_UCODE_MINOR(priv->ucode_ver), - IWL_UCODE_API(priv->ucode_ver), - IWL_UCODE_SERIAL(priv->ucode_ver)); + IL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", + IL_UCODE_MAJOR(priv->ucode_ver), + IL_UCODE_MINOR(priv->ucode_ver), + IL_UCODE_API(priv->ucode_ver), + IL_UCODE_SERIAL(priv->ucode_ver)); snprintf(priv->hw->wiphy->fw_version, sizeof(priv->hw->wiphy->fw_version), "%u.%u.%u.%u", - IWL_UCODE_MAJOR(priv->ucode_ver), - IWL_UCODE_MINOR(priv->ucode_ver), - IWL_UCODE_API(priv->ucode_ver), - IWL_UCODE_SERIAL(priv->ucode_ver)); + IL_UCODE_MAJOR(priv->ucode_ver), + IL_UCODE_MINOR(priv->ucode_ver), + IL_UCODE_API(priv->ucode_ver), + IL_UCODE_SERIAL(priv->ucode_ver)); /* * For any of the failures below (before allocating pci memory) @@ -1279,46 +1279,46 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context) * user just got a corrupted version of the latest API. */ - IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", + IL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", priv->ucode_ver); - IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %Zd\n", + IL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %Zd\n", pieces.inst_size); - IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %Zd\n", + IL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %Zd\n", pieces.data_size); - IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %Zd\n", + IL_DEBUG_INFO(priv, "f/w package hdr init inst size = %Zd\n", pieces.init_size); - IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %Zd\n", + IL_DEBUG_INFO(priv, "f/w package hdr init data size = %Zd\n", pieces.init_data_size); - IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %Zd\n", + IL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %Zd\n", pieces.boot_size); /* Verify that uCode images will fit in card's SRAM */ if (pieces.inst_size > priv->hw_params.max_inst_size) { - IWL_ERR(priv, "uCode instr len %Zd too large to fit in\n", + IL_ERR(priv, "uCode instr len %Zd too large to fit in\n", pieces.inst_size); goto try_again; } if (pieces.data_size > priv->hw_params.max_data_size) { - IWL_ERR(priv, "uCode data len %Zd too large to fit in\n", + IL_ERR(priv, "uCode data len %Zd too large to fit in\n", pieces.data_size); goto try_again; } if (pieces.init_size > priv->hw_params.max_inst_size) { - IWL_ERR(priv, "uCode init instr len %Zd too large to fit in\n", + IL_ERR(priv, "uCode init instr len %Zd too large to fit in\n", pieces.init_size); goto try_again; } if (pieces.init_data_size > priv->hw_params.max_data_size) { - IWL_ERR(priv, "uCode init data len %Zd too large to fit in\n", + IL_ERR(priv, "uCode init data len %Zd too large to fit in\n", pieces.init_data_size); goto try_again; } if (pieces.boot_size > priv->hw_params.max_bsm_size) { - IWL_ERR(priv, "uCode boot instr len %Zd too large to fit in\n", + IL_ERR(priv, "uCode boot instr len %Zd too large to fit in\n", pieces.boot_size); goto try_again; } @@ -1329,13 +1329,13 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context) * 1) unmodified from disk * 2) backup cache for save/restore during power-downs */ priv->ucode_code.len = pieces.inst_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); priv->ucode_data.len = pieces.data_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); priv->ucode_data_backup.len = pieces.data_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || !priv->ucode_data_backup.v_addr) @@ -1344,10 +1344,10 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context) /* Initialization instructions and data */ if (pieces.init_size && pieces.init_data_size) { priv->ucode_init.len = pieces.init_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); priv->ucode_init_data.len = pieces.init_data_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) goto err_pci_alloc; @@ -1356,7 +1356,7 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context) /* Bootstrap (instructions only, no data) */ if (pieces.boot_size) { priv->ucode_boot.len = pieces.boot_size; - iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); + il_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); if (!priv->ucode_boot.v_addr) goto err_pci_alloc; @@ -1369,25 +1369,25 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context) /* Copy images into buffers for card's bus-master reads ... */ /* Runtime instructions (first block of data in file) */ - IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n", + IL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n", pieces.inst_size); memcpy(priv->ucode_code.v_addr, pieces.inst, pieces.inst_size); - IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", + IL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); /* * Runtime data - * NOTE: Copy into backup buffer will be done in iwl_up() + * NOTE: Copy into backup buffer will be done in il_up() */ - IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n", + IL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n", pieces.data_size); memcpy(priv->ucode_data.v_addr, pieces.data, pieces.data_size); memcpy(priv->ucode_data_backup.v_addr, pieces.data, pieces.data_size); /* Initialization instructions */ if (pieces.init_size) { - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Copying (but not loading) init instr len %Zd\n", pieces.init_size); 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) /* Initialization data */ if (pieces.init_data_size) { - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Copying (but not loading) init data len %Zd\n", pieces.init_data_size); memcpy(priv->ucode_init_data.v_addr, pieces.init_data, @@ -1403,7 +1403,7 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context) } /* Bootstrap instructions */ - IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", + IL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", pieces.boot_size); memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size); @@ -1421,19 +1421,19 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context) * * 9. Setup and register with mac80211 and debugfs **************************************************/ - err = iwl4965_mac_setup_register(priv, max_probe_length); + err = il4965_mac_setup_register(priv, max_probe_length); if (err) goto out_unbind; - err = iwl_legacy_dbgfs_register(priv, DRV_NAME); + err = il_dbgfs_register(priv, DRV_NAME); if (err) - IWL_ERR(priv, + IL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); err = sysfs_create_group(&priv->pci_dev->dev.kobj, - &iwl_attribute_group); + &il_attribute_group); if (err) { - IWL_ERR(priv, "failed to create sysfs device attributes\n"); + IL_ERR(priv, "failed to create sysfs device attributes\n"); goto out_unbind; } @@ -1444,14 +1444,14 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context) try_again: /* try next, if any */ - if (iwl4965_request_firmware(priv, false)) + if (il4965_request_firmware(priv, false)) goto out_unbind; release_firmware(ucode_raw); return; err_pci_alloc: - IWL_ERR(priv, "failed to allocate pci memory\n"); - iwl4965_dealloc_ucode_pci(priv); + IL_ERR(priv, "failed to allocate pci memory\n"); + il4965_dealloc_ucode_pci(priv); out_unbind: complete(&priv->_4965.firmware_loading_complete); device_release_driver(&priv->pci_dev->dev); @@ -1508,7 +1508,7 @@ static struct { char *name; u8 num; } advanced_lookup[] = { { "ADVANCED_SYSASSERT", 0 }, }; -static const char *iwl4965_desc_lookup(u32 num) +static const char *il4965_desc_lookup(u32 num) { int i; int max = ARRAY_SIZE(desc_lookup_text); @@ -1527,7 +1527,7 @@ static const char *iwl4965_desc_lookup(u32 num) #define ERROR_START_OFFSET (1 * sizeof(u32)) #define ERROR_ELEM_SIZE (7 * sizeof(u32)) -void iwl4965_dump_nic_error_log(struct iwl_priv *priv) +void il4965_dump_nic_error_log(struct il_priv *priv) { u32 data2, line; u32 desc, time, count, base, data1; @@ -1541,78 +1541,78 @@ void iwl4965_dump_nic_error_log(struct iwl_priv *priv) } if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) { - IWL_ERR(priv, + IL_ERR(priv, "Not valid error log pointer 0x%08X for %s uCode\n", base, (priv->ucode_type == UCODE_INIT) ? "Init" : "RT"); return; } - count = iwl_legacy_read_targ_mem(priv, base); + count = il_read_targ_mem(priv, base); if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { - IWL_ERR(priv, "Start IWL Error Log Dump:\n"); - IWL_ERR(priv, "Status: 0x%08lX, count: %d\n", + IL_ERR(priv, "Start IWL Error Log Dump:\n"); + IL_ERR(priv, "Status: 0x%08lX, count: %d\n", priv->status, count); } - desc = iwl_legacy_read_targ_mem(priv, base + 1 * sizeof(u32)); + desc = il_read_targ_mem(priv, base + 1 * sizeof(u32)); priv->isr_stats.err_code = desc; - pc = iwl_legacy_read_targ_mem(priv, base + 2 * sizeof(u32)); - blink1 = iwl_legacy_read_targ_mem(priv, base + 3 * sizeof(u32)); - blink2 = iwl_legacy_read_targ_mem(priv, base + 4 * sizeof(u32)); - ilink1 = iwl_legacy_read_targ_mem(priv, base + 5 * sizeof(u32)); - ilink2 = iwl_legacy_read_targ_mem(priv, base + 6 * sizeof(u32)); - data1 = iwl_legacy_read_targ_mem(priv, base + 7 * sizeof(u32)); - data2 = iwl_legacy_read_targ_mem(priv, base + 8 * sizeof(u32)); - line = iwl_legacy_read_targ_mem(priv, base + 9 * sizeof(u32)); - time = iwl_legacy_read_targ_mem(priv, base + 11 * sizeof(u32)); - hcmd = iwl_legacy_read_targ_mem(priv, base + 22 * sizeof(u32)); - - IWL_ERR(priv, "Desc Time " + pc = il_read_targ_mem(priv, base + 2 * sizeof(u32)); + blink1 = il_read_targ_mem(priv, base + 3 * sizeof(u32)); + blink2 = il_read_targ_mem(priv, base + 4 * sizeof(u32)); + ilink1 = il_read_targ_mem(priv, base + 5 * sizeof(u32)); + ilink2 = il_read_targ_mem(priv, base + 6 * sizeof(u32)); + data1 = il_read_targ_mem(priv, base + 7 * sizeof(u32)); + data2 = il_read_targ_mem(priv, base + 8 * sizeof(u32)); + line = il_read_targ_mem(priv, base + 9 * sizeof(u32)); + time = il_read_targ_mem(priv, base + 11 * sizeof(u32)); + hcmd = il_read_targ_mem(priv, base + 22 * sizeof(u32)); + + IL_ERR(priv, "Desc Time " "data1 data2 line\n"); - IWL_ERR(priv, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n", - iwl4965_desc_lookup(desc), desc, time, data1, data2, line); - IWL_ERR(priv, "pc blink1 blink2 ilink1 ilink2 hcmd\n"); - IWL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n", + IL_ERR(priv, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n", + il4965_desc_lookup(desc), desc, time, data1, data2, line); + IL_ERR(priv, "pc blink1 blink2 ilink1 ilink2 hcmd\n"); + IL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n", pc, blink1, blink2, ilink1, ilink2, hcmd); } -static void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) +static void il4965_rf_kill_ct_config(struct il_priv *priv) { - struct iwl_ct_kill_config cmd; + struct il_ct_kill_config cmd; unsigned long flags; int ret = 0; spin_lock_irqsave(&priv->lock, flags); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, + il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); spin_unlock_irqrestore(&priv->lock, flags); cmd.critical_temperature_R = cpu_to_le32(priv->hw_params.ct_kill_threshold); - ret = iwl_legacy_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD, + ret = il_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD, sizeof(cmd), &cmd); if (ret) - IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); + IL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); else - IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD " + IL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD " "succeeded, " "critical temperature is %d\n", priv->hw_params.ct_kill_threshold); } static const s8 default_queue_to_tx_fifo[] = { - IWL_TX_FIFO_VO, - IWL_TX_FIFO_VI, - IWL_TX_FIFO_BE, - IWL_TX_FIFO_BK, + IL_TX_FIFO_VO, + IL_TX_FIFO_VI, + IL_TX_FIFO_BE, + IL_TX_FIFO_BK, IWL49_CMD_FIFO_NUM, - IWL_TX_FIFO_UNUSED, - IWL_TX_FIFO_UNUSED, + IL_TX_FIFO_UNUSED, + IL_TX_FIFO_UNUSED, }; -static int iwl4965_alive_notify(struct iwl_priv *priv) +static int il4965_alive_notify(struct il_priv *priv) { u32 a; unsigned long flags; @@ -1622,52 +1622,52 @@ static int iwl4965_alive_notify(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); /* Clear 4965's internal Tx Scheduler data base */ - priv->scd_base_addr = iwl_legacy_read_prph(priv, + priv->scd_base_addr = il_read_prph(priv, IWL49_SCD_SRAM_BASE_ADDR); a = priv->scd_base_addr + IWL49_SCD_CONTEXT_DATA_OFFSET; for (; a < priv->scd_base_addr + IWL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4) - iwl_legacy_write_targ_mem(priv, a, 0); + il_write_targ_mem(priv, a, 0); for (; a < priv->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET; a += 4) - iwl_legacy_write_targ_mem(priv, a, 0); + il_write_targ_mem(priv, a, 0); for (; a < priv->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4) - iwl_legacy_write_targ_mem(priv, a, 0); + il_write_targ_mem(priv, a, 0); /* Tel 4965 where to find Tx byte count tables */ - iwl_legacy_write_prph(priv, IWL49_SCD_DRAM_BASE_ADDR, + il_write_prph(priv, IWL49_SCD_DRAM_BASE_ADDR, priv->scd_bc_tbls.dma >> 10); /* Enable DMA channel */ for (chan = 0; chan < FH49_TCSR_CHNL_NUM ; chan++) - iwl_legacy_write_direct32(priv, + il_write_direct32(priv, FH_TCSR_CHNL_TX_CONFIG_REG(chan), FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE); /* Update FH chicken bits */ - reg_val = iwl_legacy_read_direct32(priv, FH_TX_CHICKEN_BITS_REG); - iwl_legacy_write_direct32(priv, FH_TX_CHICKEN_BITS_REG, + reg_val = il_read_direct32(priv, FH_TX_CHICKEN_BITS_REG); + il_write_direct32(priv, FH_TX_CHICKEN_BITS_REG, reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); /* Disable chain mode for all queues */ - iwl_legacy_write_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, 0); + il_write_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, 0); /* Initialize each Tx queue (including the command queue) */ for (i = 0; i < priv->hw_params.max_txq_num; i++) { /* TFD circular buffer read/write indexes */ - iwl_legacy_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(i), 0); - iwl_legacy_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); + il_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(i), 0); + il_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); /* Max Tx Window size for Scheduler-ACK mode */ - iwl_legacy_write_targ_mem(priv, priv->scd_base_addr + + il_write_targ_mem(priv, priv->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(i), (SCD_WIN_SIZE << IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); /* Frame limit */ - iwl_legacy_write_targ_mem(priv, priv->scd_base_addr + + il_write_targ_mem(priv, priv->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(i) + sizeof(u32), (SCD_FRAME_LIMIT << @@ -1675,13 +1675,13 @@ static int iwl4965_alive_notify(struct iwl_priv *priv) IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); } - iwl_legacy_write_prph(priv, IWL49_SCD_INTERRUPT_MASK, + il_write_prph(priv, IWL49_SCD_INTERRUPT_MASK, (1 << priv->hw_params.max_txq_num) - 1); /* Activate all Tx DMA/FIFO channels */ - iwl4965_txq_set_sched(priv, IWL_MASK(0, 6)); + il4965_txq_set_sched(priv, IL_MASK(0, 6)); - iwl4965_set_wr_ptrs(priv, IWL_DEFAULT_CMD_QUEUE_NUM, 0); + il4965_set_wr_ptrs(priv, IL_DEFAULT_CMD_QUEUE_NUM, 0); /* make sure all queue are not stopped */ memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped)); @@ -1696,12 +1696,12 @@ static int iwl4965_alive_notify(struct iwl_priv *priv) for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) { int ac = default_queue_to_tx_fifo[i]; - iwl_txq_ctx_activate(priv, i); + il_txq_ctx_activate(priv, i); - if (ac == IWL_TX_FIFO_UNUSED) + if (ac == IL_TX_FIFO_UNUSED) continue; - iwl4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0); + il4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0); } spin_unlock_irqrestore(&priv->lock, flags); @@ -1710,37 +1710,37 @@ static int iwl4965_alive_notify(struct iwl_priv *priv) } /** - * iwl4965_alive_start - called after REPLY_ALIVE notification received + * il4965_alive_start - called after REPLY_ALIVE notification received * from protocol/runtime uCode (initialization uCode's - * Alive gets handled by iwl_init_alive_start()). + * Alive gets handled by il_init_alive_start()). */ -static void iwl4965_alive_start(struct iwl_priv *priv) +static void il4965_alive_start(struct il_priv *priv) { int ret = 0; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; - IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); + IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); if (priv->card_alive.is_valid != UCODE_VALID_OK) { /* We had an error bringing up the hardware, so take it * all the way back down so we can try again */ - IWL_DEBUG_INFO(priv, "Alive failed.\n"); + IL_DEBUG_INFO(priv, "Alive failed.\n"); goto restart; } /* Initialize uCode has loaded Runtime uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "runtime" alive if code weren't properly loaded. */ - if (iwl4965_verify_ucode(priv)) { + if (il4965_verify_ucode(priv)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ - IWL_DEBUG_INFO(priv, "Bad runtime uCode load.\n"); + IL_DEBUG_INFO(priv, "Bad runtime uCode load.\n"); goto restart; } - ret = iwl4965_alive_notify(priv); + ret = il4965_alive_notify(priv); if (ret) { - IWL_WARN(priv, + IL_WARN(priv, "Could not complete ALIVE transition [ntf]: %d\n", ret); goto restart; } @@ -1750,49 +1750,49 @@ static void iwl4965_alive_start(struct iwl_priv *priv) set_bit(STATUS_ALIVE, &priv->status); /* Enable watchdog to monitor the driver tx queues */ - iwl_legacy_setup_watchdog(priv); + il_setup_watchdog(priv); - if (iwl_legacy_is_rfkill(priv)) + if (il_is_rfkill(priv)) return; ieee80211_wake_queues(priv->hw); - priv->active_rate = IWL_RATES_MASK; + priv->active_rate = IL_RATES_MASK; - if (iwl_legacy_is_associated_ctx(ctx)) { - struct iwl_legacy_rxon_cmd *active_rxon = - (struct iwl_legacy_rxon_cmd *)&ctx->active; + if (il_is_associated_ctx(ctx)) { + struct il_rxon_cmd *active_rxon = + (struct il_rxon_cmd *)&ctx->active; /* apply any changes in staging */ ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; } else { - struct iwl_rxon_context *tmp; + struct il_rxon_context *tmp; /* Initialize our rx_config data */ for_each_context(priv, tmp) - iwl_legacy_connection_init_rx_config(priv, tmp); + il_connection_init_rx_config(priv, tmp); if (priv->cfg->ops->hcmd->set_rxon_chain) priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); } /* Configure bluetooth coexistence if enabled */ - iwl_legacy_send_bt_config(priv); + il_send_bt_config(priv); - iwl4965_reset_run_time_calib(priv); + il4965_reset_run_time_calib(priv); set_bit(STATUS_READY, &priv->status); /* Configure the adapter for unassociated operation */ - iwl_legacy_commit_rxon(priv, ctx); + il_commit_rxon(priv, ctx); /* At this point, the NIC is initialized and operational */ - iwl4965_rf_kill_ct_config(priv); + il4965_rf_kill_ct_config(priv); - IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); + IL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); wake_up(&priv->wait_command_queue); - iwl_legacy_power_update_mode(priv, true); - IWL_DEBUG_INFO(priv, "Updated power mode\n"); + il_power_update_mode(priv, true); + IL_DEBUG_INFO(priv, "Updated power mode\n"); return; @@ -1800,16 +1800,16 @@ static void iwl4965_alive_start(struct iwl_priv *priv) queue_work(priv->workqueue, &priv->restart); } -static void iwl4965_cancel_deferred_work(struct iwl_priv *priv); +static void il4965_cancel_deferred_work(struct il_priv *priv); -static void __iwl4965_down(struct iwl_priv *priv) +static void __il4965_down(struct il_priv *priv) { unsigned long flags; int exit_pending; - IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); + IL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); - iwl_legacy_scan_cancel_timeout(priv, 200); + il_scan_cancel_timeout(priv, 200); exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); @@ -1817,9 +1817,9 @@ static void __iwl4965_down(struct iwl_priv *priv) * to prevent rearm timer */ del_timer_sync(&priv->watchdog); - iwl_legacy_clear_ucode_stations(priv, NULL); - iwl_legacy_dealloc_bcast_stations(priv); - iwl_legacy_clear_driver_stations(priv); + il_clear_ucode_stations(priv, NULL); + il_dealloc_bcast_stations(priv); + il_clear_driver_stations(priv); /* Unblock any waiting calls */ wake_up_all(&priv->wait_command_queue); @@ -1830,20 +1830,20 @@ static void __iwl4965_down(struct iwl_priv *priv) clear_bit(STATUS_EXIT_PENDING, &priv->status); /* stop and reset the on-board processor */ - iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); + il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); /* tell the device to stop sending interrupts */ spin_lock_irqsave(&priv->lock, flags); - iwl_legacy_disable_interrupts(priv); + il_disable_interrupts(priv); spin_unlock_irqrestore(&priv->lock, flags); - iwl4965_synchronize_irq(priv); + il4965_synchronize_irq(priv); if (priv->mac80211_registered) ieee80211_stop_queues(priv->hw); - /* If we have not previously called iwl_init() then + /* If we have not previously called il_init() then * clear all bits but the RF Kill bit and return */ - if (!iwl_legacy_is_init(priv)) { + if (!il_is_init(priv)) { priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << STATUS_RF_KILL_HW | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << @@ -1864,50 +1864,50 @@ static void __iwl4965_down(struct iwl_priv *priv) test_bit(STATUS_EXIT_PENDING, &priv->status) << STATUS_EXIT_PENDING; - iwl4965_txq_ctx_stop(priv); - iwl4965_rxq_stop(priv); + il4965_txq_ctx_stop(priv); + il4965_rxq_stop(priv); /* Power-down device's busmaster DMA clocks */ - iwl_legacy_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); + il_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); udelay(5); /* Make sure (redundant) we've released our request to stay awake */ - iwl_legacy_clear_bit(priv, CSR_GP_CNTRL, + il_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); /* Stop the device, and put it in low power state */ - iwl_legacy_apm_stop(priv); + il_apm_stop(priv); exit: - memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); + memset(&priv->card_alive, 0, sizeof(struct il_alive_resp)); dev_kfree_skb(priv->beacon_skb); priv->beacon_skb = NULL; /* clear out any free frames */ - iwl4965_clear_free_frames(priv); + il4965_clear_free_frames(priv); } -static void iwl4965_down(struct iwl_priv *priv) +static void il4965_down(struct il_priv *priv) { mutex_lock(&priv->mutex); - __iwl4965_down(priv); + __il4965_down(priv); mutex_unlock(&priv->mutex); - iwl4965_cancel_deferred_work(priv); + il4965_cancel_deferred_work(priv); } #define HW_READY_TIMEOUT (50) -static int iwl4965_set_hw_ready(struct iwl_priv *priv) +static int il4965_set_hw_ready(struct il_priv *priv) { int ret = 0; - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_NIC_READY); /* See if we got it */ - ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG, + ret = il_poll_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, HW_READY_TIMEOUT); @@ -1916,107 +1916,107 @@ static int iwl4965_set_hw_ready(struct iwl_priv *priv) else priv->hw_ready = false; - IWL_DEBUG_INFO(priv, "hardware %s\n", + IL_DEBUG_INFO(priv, "hardware %s\n", (priv->hw_ready == 1) ? "ready" : "not ready"); return ret; } -static int iwl4965_prepare_card_hw(struct iwl_priv *priv) +static int il4965_prepare_card_hw(struct il_priv *priv) { int ret = 0; - IWL_DEBUG_INFO(priv, "iwl4965_prepare_card_hw enter\n"); + IL_DEBUG_INFO(priv, "il4965_prepare_card_hw enter\n"); - ret = iwl4965_set_hw_ready(priv); + ret = il4965_set_hw_ready(priv); if (priv->hw_ready) return ret; /* If HW is not ready, prepare the conditions to check again */ - iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_PREPARE); - ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG, + ret = il_poll_bit(priv, CSR_HW_IF_CONFIG_REG, ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000); /* HW should be ready by now, check again. */ if (ret != -ETIMEDOUT) - iwl4965_set_hw_ready(priv); + il4965_set_hw_ready(priv); return ret; } #define MAX_HW_RESTARTS 5 -static int __iwl4965_up(struct iwl_priv *priv) +static int __il4965_up(struct il_priv *priv) { - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; int i; int ret; if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { - IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); + IL_WARN(priv, "Exit pending; will not bring the NIC up\n"); return -EIO; } if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { - IWL_ERR(priv, "ucode not available for device bringup\n"); + IL_ERR(priv, "ucode not available for device bringup\n"); return -EIO; } for_each_context(priv, ctx) { - ret = iwl4965_alloc_bcast_station(priv, ctx); + ret = il4965_alloc_bcast_station(priv, ctx); if (ret) { - iwl_legacy_dealloc_bcast_stations(priv); + il_dealloc_bcast_stations(priv); return ret; } } - iwl4965_prepare_card_hw(priv); + il4965_prepare_card_hw(priv); if (!priv->hw_ready) { - IWL_WARN(priv, "Exit HW not ready\n"); + IL_WARN(priv, "Exit HW not ready\n"); return -EIO; } /* If platform's RF_KILL switch is NOT set to KILL */ - if (iwl_read32(priv, + if (il_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) clear_bit(STATUS_RF_KILL_HW, &priv->status); else set_bit(STATUS_RF_KILL_HW, &priv->status); - if (iwl_legacy_is_rfkill(priv)) { + if (il_is_rfkill(priv)) { wiphy_rfkill_set_hw_state(priv->hw->wiphy, true); - iwl_legacy_enable_interrupts(priv); - IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); + il_enable_interrupts(priv); + IL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); return 0; } - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); + il_write32(priv, CSR_INT, 0xFFFFFFFF); - /* must be initialised before iwl_hw_nic_init */ - priv->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM; + /* must be initialised before il_hw_nic_init */ + priv->cmd_queue = IL_DEFAULT_CMD_QUEUE_NUM; - ret = iwl4965_hw_nic_init(priv); + ret = il4965_hw_nic_init(priv); if (ret) { - IWL_ERR(priv, "Unable to init nic\n"); + IL_ERR(priv, "Unable to init nic\n"); return ret; } /* make sure rfkill handshake bits are cleared */ - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, + il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); /* clear (again), then enable host interrupts */ - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); - iwl_legacy_enable_interrupts(priv); + il_write32(priv, CSR_INT, 0xFFFFFFFF); + il_enable_interrupts(priv); /* really make sure rfkill handshake bits are cleared */ - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); /* Copy original ucode data image from disk into backup cache. * This will be used to initialize the on-board processor's @@ -2032,26 +2032,26 @@ static int __iwl4965_up(struct iwl_priv *priv) ret = priv->cfg->ops->lib->load_ucode(priv); if (ret) { - IWL_ERR(priv, "Unable to set up bootstrap uCode: %d\n", + IL_ERR(priv, "Unable to set up bootstrap uCode: %d\n", ret); continue; } /* start card; "initialize" will load runtime ucode */ - iwl4965_nic_start(priv); + il4965_nic_start(priv); - IWL_DEBUG_INFO(priv, DRV_NAME " is coming up\n"); + IL_DEBUG_INFO(priv, DRV_NAME " is coming up\n"); return 0; } set_bit(STATUS_EXIT_PENDING, &priv->status); - __iwl4965_down(priv); + __il4965_down(priv); clear_bit(STATUS_EXIT_PENDING, &priv->status); /* tried to restart and config the device for as long as our * patience could withstand */ - IWL_ERR(priv, "Unable to initialize device after %d attempts.\n", i); + IL_ERR(priv, "Unable to initialize device after %d attempts.\n", i); return -EIO; } @@ -2062,10 +2062,10 @@ static int __iwl4965_up(struct iwl_priv *priv) * *****************************************************************************/ -static void iwl4965_bg_init_alive_start(struct work_struct *data) +static void il4965_bg_init_alive_start(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, init_alive_start.work); + struct il_priv *priv = + container_of(data, struct il_priv, init_alive_start.work); mutex_lock(&priv->mutex); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) @@ -2076,23 +2076,23 @@ out: mutex_unlock(&priv->mutex); } -static void iwl4965_bg_alive_start(struct work_struct *data) +static void il4965_bg_alive_start(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, alive_start.work); + struct il_priv *priv = + container_of(data, struct il_priv, alive_start.work); mutex_lock(&priv->mutex); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) goto out; - iwl4965_alive_start(priv); + il4965_alive_start(priv); out: mutex_unlock(&priv->mutex); } -static void iwl4965_bg_run_time_calib_work(struct work_struct *work) +static void il4965_bg_run_time_calib_work(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, + struct il_priv *priv = container_of(work, struct il_priv, run_time_calib_work); mutex_lock(&priv->mutex); @@ -2104,37 +2104,37 @@ static void iwl4965_bg_run_time_calib_work(struct work_struct *work) } if (priv->start_calib) { - iwl4965_chain_noise_calibration(priv, + il4965_chain_noise_calibration(priv, (void *)&priv->_4965.statistics); - iwl4965_sensitivity_calibration(priv, + il4965_sensitivity_calibration(priv, (void *)&priv->_4965.statistics); } mutex_unlock(&priv->mutex); } -static void iwl4965_bg_restart(struct work_struct *data) +static void il4965_bg_restart(struct work_struct *data) { - struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); + struct il_priv *priv = container_of(data, struct il_priv, restart); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; mutex_lock(&priv->mutex); for_each_context(priv, ctx) ctx->vif = NULL; priv->is_open = 0; - __iwl4965_down(priv); + __il4965_down(priv); mutex_unlock(&priv->mutex); - iwl4965_cancel_deferred_work(priv); + il4965_cancel_deferred_work(priv); ieee80211_restart_hw(priv->hw); } else { - iwl4965_down(priv); + il4965_down(priv); mutex_lock(&priv->mutex); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { @@ -2142,21 +2142,21 @@ static void iwl4965_bg_restart(struct work_struct *data) return; } - __iwl4965_up(priv); + __il4965_up(priv); mutex_unlock(&priv->mutex); } } -static void iwl4965_bg_rx_replenish(struct work_struct *data) +static void il4965_bg_rx_replenish(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, rx_replenish); + struct il_priv *priv = + container_of(data, struct il_priv, rx_replenish); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; mutex_lock(&priv->mutex); - iwl4965_rx_replenish(priv); + il4965_rx_replenish(priv); mutex_unlock(&priv->mutex); } @@ -2172,12 +2172,12 @@ static void iwl4965_bg_rx_replenish(struct work_struct *data) * Not a mac80211 entry point function, but it fits in with all the * other mac80211 functions grouped here. */ -static int iwl4965_mac_setup_register(struct iwl_priv *priv, +static int il4965_mac_setup_register(struct il_priv *priv, u32 max_probe_length) { int ret; struct ieee80211_hw *hw = priv->hw; - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; hw->rate_control_algorithm = "iwl-4965-rs"; @@ -2188,12 +2188,12 @@ static int iwl4965_mac_setup_register(struct iwl_priv *priv, IEEE80211_HW_SPECTRUM_MGMT | IEEE80211_HW_REPORTS_TX_ACK_STATUS; - if (priv->cfg->sku & IWL_SKU_N) + if (priv->cfg->sku & IL_SKU_N) hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | IEEE80211_HW_SUPPORTS_STATIC_SMPS; - hw->sta_data_size = sizeof(struct iwl_station_priv); - hw->vif_data_size = sizeof(struct iwl_vif_priv); + hw->sta_data_size = sizeof(struct il_station_priv); + hw->vif_data_size = sizeof(struct il_vif_priv); for_each_context(priv, ctx) { hw->wiphy->interface_modes |= ctx->interface_modes; @@ -2216,7 +2216,7 @@ static int iwl4965_mac_setup_register(struct iwl_priv *priv, /* Default value; 4 EDCA QOS priorities */ hw->queues = 4; - hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; + hw->max_listen_interval = IL_CONN_MAX_LISTEN_INTERVAL; if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = @@ -2225,11 +2225,11 @@ static int iwl4965_mac_setup_register(struct iwl_priv *priv, priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &priv->bands[IEEE80211_BAND_5GHZ]; - iwl_legacy_leds_init(priv); + il_leds_init(priv); ret = ieee80211_register_hw(priv->hw); if (ret) { - IWL_ERR(priv, "Failed to register hw (error %d)\n", ret); + IL_ERR(priv, "Failed to register hw (error %d)\n", ret); return ret; } priv->mac80211_registered = 1; @@ -2238,25 +2238,25 @@ static int iwl4965_mac_setup_register(struct iwl_priv *priv, } -int iwl4965_mac_start(struct ieee80211_hw *hw) +int il4965_mac_start(struct ieee80211_hw *hw) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; int ret; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); /* we should be verifying the device is ready to be opened */ mutex_lock(&priv->mutex); - ret = __iwl4965_up(priv); + ret = __il4965_up(priv); mutex_unlock(&priv->mutex); if (ret) return ret; - if (iwl_legacy_is_rfkill(priv)) + if (il_is_rfkill(priv)) goto out; - IWL_DEBUG_INFO(priv, "Start UP work done.\n"); + IL_DEBUG_INFO(priv, "Start UP work done.\n"); /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from * mac80211 will not be run successfully. */ @@ -2265,99 +2265,99 @@ int iwl4965_mac_start(struct ieee80211_hw *hw) UCODE_READY_TIMEOUT); if (!ret) { if (!test_bit(STATUS_READY, &priv->status)) { - IWL_ERR(priv, "START_ALIVE timeout after %dms.\n", + IL_ERR(priv, "START_ALIVE timeout after %dms.\n", jiffies_to_msecs(UCODE_READY_TIMEOUT)); return -ETIMEDOUT; } } - iwl4965_led_enable(priv); + il4965_led_enable(priv); out: priv->is_open = 1; - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); return 0; } -void iwl4965_mac_stop(struct ieee80211_hw *hw) +void il4965_mac_stop(struct ieee80211_hw *hw) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); if (!priv->is_open) return; priv->is_open = 0; - iwl4965_down(priv); + il4965_down(priv); flush_workqueue(priv->workqueue); /* User space software may expect getting rfkill changes * even if interface is down */ - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); - iwl_legacy_enable_rfkill_int(priv); + il_write32(priv, CSR_INT, 0xFFFFFFFF); + il_enable_rfkill_int(priv); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); } -void iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) +void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; - IWL_DEBUG_MACDUMP(priv, "enter\n"); + IL_DEBUG_MACDUMP(priv, "enter\n"); - IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, + IL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); - if (iwl4965_tx_skb(priv, skb)) + if (il4965_tx_skb(priv, skb)) dev_kfree_skb_any(skb); - IWL_DEBUG_MACDUMP(priv, "leave\n"); + IL_DEBUG_MACDUMP(priv, "leave\n"); } -void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, +void il4965_mac_update_tkip_key(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_key_conf *keyconf, struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) { - struct iwl_priv *priv = hw->priv; - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; + struct il_priv *priv = hw->priv; + struct il_vif_priv *vif_priv = (void *)vif->drv_priv; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); - iwl4965_update_tkip_key(priv, vif_priv->ctx, keyconf, sta, + il4965_update_tkip_key(priv, vif_priv->ctx, keyconf, sta, iv32, phase1key); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); } -int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, +int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key) { - struct iwl_priv *priv = hw->priv; - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; - struct iwl_rxon_context *ctx = vif_priv->ctx; + struct il_priv *priv = hw->priv; + struct il_vif_priv *vif_priv = (void *)vif->drv_priv; + struct il_rxon_context *ctx = vif_priv->ctx; int ret; u8 sta_id; bool is_default_wep_key = false; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); if (priv->cfg->mod_params->sw_crypto) { - IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); + IL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); return -EOPNOTSUPP; } - sta_id = iwl_legacy_sta_id_or_broadcast(priv, vif_priv->ctx, sta); - if (sta_id == IWL_INVALID_STATION) + sta_id = il_sta_id_or_broadcast(priv, vif_priv->ctx, sta); + if (sta_id == IL_INVALID_STATION) return -EINVAL; mutex_lock(&priv->mutex); - iwl_legacy_scan_cancel_timeout(priv, 100); + il_scan_cancel_timeout(priv, 100); /* * 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, switch (cmd) { case SET_KEY: if (is_default_wep_key) - ret = iwl4965_set_default_wep_key(priv, + ret = il4965_set_default_wep_key(priv, vif_priv->ctx, key); else - ret = iwl4965_set_dynamic_key(priv, vif_priv->ctx, + ret = il4965_set_dynamic_key(priv, vif_priv->ctx, key, sta_id); - IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); + IL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); break; case DISABLE_KEY: if (is_default_wep_key) - ret = iwl4965_remove_default_wep_key(priv, ctx, key); + ret = il4965_remove_default_wep_key(priv, ctx, key); else - ret = iwl4965_remove_dynamic_key(priv, ctx, + ret = il4965_remove_dynamic_key(priv, ctx, key, sta_id); - IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); + IL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); break; default: ret = -EINVAL; } mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); return ret; } -int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, +int il4965_mac_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum ieee80211_ampdu_mlme_action action, struct ieee80211_sta *sta, u16 tid, u16 *ssn, u8 buf_size) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; int ret = -EINVAL; - IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", + IL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", sta->addr, tid); - if (!(priv->cfg->sku & IWL_SKU_N)) + if (!(priv->cfg->sku & IL_SKU_N)) return -EACCES; mutex_lock(&priv->mutex); switch (action) { case IEEE80211_AMPDU_RX_START: - IWL_DEBUG_HT(priv, "start Rx\n"); - ret = iwl4965_sta_rx_agg_start(priv, sta, tid, *ssn); + IL_DEBUG_HT(priv, "start Rx\n"); + ret = il4965_sta_rx_agg_start(priv, sta, tid, *ssn); break; case IEEE80211_AMPDU_RX_STOP: - IWL_DEBUG_HT(priv, "stop Rx\n"); - ret = iwl4965_sta_rx_agg_stop(priv, sta, tid); + IL_DEBUG_HT(priv, "stop Rx\n"); + ret = il4965_sta_rx_agg_stop(priv, sta, tid); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) ret = 0; break; case IEEE80211_AMPDU_TX_START: - IWL_DEBUG_HT(priv, "start Tx\n"); - ret = iwl4965_tx_agg_start(priv, vif, sta, tid, ssn); + IL_DEBUG_HT(priv, "start Tx\n"); + ret = il4965_tx_agg_start(priv, vif, sta, tid, ssn); break; case IEEE80211_AMPDU_TX_STOP: - IWL_DEBUG_HT(priv, "stop Tx\n"); - ret = iwl4965_tx_agg_stop(priv, vif, sta, tid); + IL_DEBUG_HT(priv, "stop Tx\n"); + ret = il4965_tx_agg_stop(priv, vif, sta, tid); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) ret = 0; break; @@ -2452,30 +2452,30 @@ int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, return ret; } -int iwl4965_mac_sta_add(struct ieee80211_hw *hw, +int il4965_mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { - struct iwl_priv *priv = hw->priv; - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; + struct il_priv *priv = hw->priv; + struct il_station_priv *sta_priv = (void *)sta->drv_priv; + struct il_vif_priv *vif_priv = (void *)vif->drv_priv; bool is_ap = vif->type == NL80211_IFTYPE_STATION; int ret; u8 sta_id; - IWL_DEBUG_INFO(priv, "received request to add station %pM\n", + IL_DEBUG_INFO(priv, "received request to add station %pM\n", sta->addr); mutex_lock(&priv->mutex); - IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n", + IL_DEBUG_INFO(priv, "proceeding to add station %pM\n", sta->addr); - sta_priv->common.sta_id = IWL_INVALID_STATION; + sta_priv->common.sta_id = IL_INVALID_STATION; atomic_set(&sta_priv->pending_frames, 0); - ret = iwl_legacy_add_station_common(priv, vif_priv->ctx, sta->addr, + ret = il_add_station_common(priv, vif_priv->ctx, sta->addr, is_ap, sta, &sta_id); if (ret) { - IWL_ERR(priv, "Unable to add station %pM (%d)\n", + IL_ERR(priv, "Unable to add station %pM (%d)\n", sta->addr, ret); /* Should we return success if return code is EEXIST ? */ mutex_unlock(&priv->mutex); @@ -2485,31 +2485,31 @@ int iwl4965_mac_sta_add(struct ieee80211_hw *hw, sta_priv->common.sta_id = sta_id; /* Initialize rate scaling */ - IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", + IL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", sta->addr); - iwl4965_rs_rate_init(priv, sta, sta_id); + il4965_rs_rate_init(priv, sta, sta_id); mutex_unlock(&priv->mutex); return 0; } -void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, +void il4965_mac_channel_switch(struct ieee80211_hw *hw, struct ieee80211_channel_switch *ch_switch) { - struct iwl_priv *priv = hw->priv; - const struct iwl_channel_info *ch_info; + struct il_priv *priv = hw->priv; + const struct il_channel_info *ch_info; struct ieee80211_conf *conf = &hw->conf; struct ieee80211_channel *channel = ch_switch->channel; - struct iwl_ht_config *ht_conf = &priv->current_ht_config; + struct il_ht_config *ht_conf = &priv->current_ht_config; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; u16 ch; - IWL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(priv, "enter\n"); mutex_lock(&priv->mutex); - if (iwl_legacy_is_rfkill(priv)) + if (il_is_rfkill(priv)) goto out; if (test_bit(STATUS_EXIT_PENDING, &priv->status) || @@ -2517,7 +2517,7 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) goto out; - if (!iwl_legacy_is_associated_ctx(ctx)) + if (!il_is_associated_ctx(ctx)) goto out; if (!priv->cfg->ops->lib->set_channel_switch) @@ -2527,9 +2527,9 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, if (le16_to_cpu(ctx->active.channel) == ch) goto out; - ch_info = iwl_legacy_get_channel_info(priv, channel->band, ch); - if (!iwl_legacy_is_channel_valid(ch_info)) { - IWL_DEBUG_MAC80211(priv, "invalid channel\n"); + ch_info = il_get_channel_info(priv, channel->band, ch); + if (!il_is_channel_valid(ch_info)) { + IL_DEBUG_MAC80211(priv, "invalid channel\n"); goto out; } @@ -2559,13 +2559,13 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, if ((le16_to_cpu(ctx->staging.channel) != ch)) ctx->staging.flags = 0; - iwl_legacy_set_rxon_channel(priv, channel, ctx); - iwl_legacy_set_rxon_ht(priv, ht_conf); - iwl_legacy_set_flags_for_band(priv, ctx, channel->band, ctx->vif); + il_set_rxon_channel(priv, channel, ctx); + il_set_rxon_ht(priv, ht_conf); + il_set_flags_for_band(priv, ctx, channel->band, ctx->vif); spin_unlock_irq(&priv->lock); - iwl_legacy_set_rate(priv); + il_set_rate(priv); /* * at this point, staging_rxon has the * configuration for channel switch @@ -2580,17 +2580,17 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, out: mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(priv, "leave\n"); } -void iwl4965_configure_filter(struct ieee80211_hw *hw, +void il4965_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, u64 multicast) { - struct iwl_priv *priv = hw->priv; + struct il_priv *priv = hw->priv; __le32 filter_or = 0, filter_nand = 0; - struct iwl_rxon_context *ctx; + struct il_rxon_context *ctx; #define CHK(test, flag) do { \ if (*total_flags & (test)) \ @@ -2599,7 +2599,7 @@ void iwl4965_configure_filter(struct ieee80211_hw *hw, filter_nand |= (flag); \ } while (0) - IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", + IL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", changed_flags, *total_flags); CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); @@ -2625,7 +2625,7 @@ void iwl4965_configure_filter(struct ieee80211_hw *hw, /* * Receiving all multicast frames is always enabled by the - * default flags setup in iwl_legacy_connection_init_rx_config() + * default flags setup in il_connection_init_rx_config() * since we currently do not support programming multicast * filters into the device. */ @@ -2639,9 +2639,9 @@ void iwl4965_configure_filter(struct ieee80211_hw *hw, * *****************************************************************************/ -static void iwl4965_bg_txpower_work(struct work_struct *work) +static void il4965_bg_txpower_work(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, + struct il_priv *priv = container_of(work, struct il_priv, txpower_work); mutex_lock(&priv->mutex); @@ -2666,62 +2666,62 @@ out: mutex_unlock(&priv->mutex); } -static void iwl4965_setup_deferred_work(struct iwl_priv *priv) +static void il4965_setup_deferred_work(struct il_priv *priv) { priv->workqueue = create_singlethread_workqueue(DRV_NAME); init_waitqueue_head(&priv->wait_command_queue); - INIT_WORK(&priv->restart, iwl4965_bg_restart); - INIT_WORK(&priv->rx_replenish, iwl4965_bg_rx_replenish); - INIT_WORK(&priv->run_time_calib_work, iwl4965_bg_run_time_calib_work); - INIT_DELAYED_WORK(&priv->init_alive_start, iwl4965_bg_init_alive_start); - INIT_DELAYED_WORK(&priv->alive_start, iwl4965_bg_alive_start); + INIT_WORK(&priv->restart, il4965_bg_restart); + INIT_WORK(&priv->rx_replenish, il4965_bg_rx_replenish); + INIT_WORK(&priv->run_time_calib_work, il4965_bg_run_time_calib_work); + INIT_DELAYED_WORK(&priv->init_alive_start, il4965_bg_init_alive_start); + INIT_DELAYED_WORK(&priv->alive_start, il4965_bg_alive_start); - iwl_legacy_setup_scan_deferred_work(priv); + il_setup_scan_deferred_work(priv); - INIT_WORK(&priv->txpower_work, iwl4965_bg_txpower_work); + INIT_WORK(&priv->txpower_work, il4965_bg_txpower_work); init_timer(&priv->statistics_periodic); priv->statistics_periodic.data = (unsigned long)priv; - priv->statistics_periodic.function = iwl4965_bg_statistics_periodic; + priv->statistics_periodic.function = il4965_bg_statistics_periodic; init_timer(&priv->watchdog); priv->watchdog.data = (unsigned long)priv; - priv->watchdog.function = iwl_legacy_bg_watchdog; + priv->watchdog.function = il_bg_watchdog; tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) - iwl4965_irq_tasklet, (unsigned long)priv); + il4965_irq_tasklet, (unsigned long)priv); } -static void iwl4965_cancel_deferred_work(struct iwl_priv *priv) +static void il4965_cancel_deferred_work(struct il_priv *priv) { cancel_work_sync(&priv->txpower_work); cancel_delayed_work_sync(&priv->init_alive_start); cancel_delayed_work(&priv->alive_start); cancel_work_sync(&priv->run_time_calib_work); - iwl_legacy_cancel_scan_deferred_work(priv); + il_cancel_scan_deferred_work(priv); del_timer_sync(&priv->statistics_periodic); } -static void iwl4965_init_hw_rates(struct iwl_priv *priv, +static void il4965_init_hw_rates(struct il_priv *priv, struct ieee80211_rate *rates) { int i; - for (i = 0; i < IWL_RATE_COUNT_LEGACY; i++) { + for (i = 0; i < IL_RATE_COUNT_LEGACY; i++) { rates[i].bitrate = iwlegacy_rates[i].ieee * 5; rates[i].hw_value = i; /* Rate scaling will work on indexes */ rates[i].hw_value_short = i; rates[i].flags = 0; - if ((i >= IWL_FIRST_CCK_RATE) && (i <= IWL_LAST_CCK_RATE)) { + if ((i >= IL_FIRST_CCK_RATE) && (i <= IL_LAST_CCK_RATE)) { /* * If CCK != 1M then set short preamble rate flag. */ rates[i].flags |= - (iwlegacy_rates[i].plcp == IWL_RATE_1M_PLCP) ? + (iwlegacy_rates[i].plcp == IL_RATE_1M_PLCP) ? 0 : IEEE80211_RATE_SHORT_PREAMBLE; } } @@ -2729,15 +2729,15 @@ static void iwl4965_init_hw_rates(struct iwl_priv *priv, /* * Acquire priv->lock before calling this function ! */ -void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index) +void il4965_set_wr_ptrs(struct il_priv *priv, int txq_id, u32 index) { - iwl_legacy_write_direct32(priv, HBUS_TARG_WRPTR, + il_write_direct32(priv, HBUS_TARG_WRPTR, (index & 0xff) | (txq_id << 8)); - iwl_legacy_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(txq_id), index); + il_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(txq_id), index); } -void iwl4965_tx_queue_set_status(struct iwl_priv *priv, - struct iwl_tx_queue *txq, +void il4965_tx_queue_set_status(struct il_priv *priv, + struct il_tx_queue *txq, int tx_fifo_id, int scd_retry) { int txq_id = txq->q.id; @@ -2746,7 +2746,7 @@ void iwl4965_tx_queue_set_status(struct iwl_priv *priv, int active = test_bit(txq_id, &priv->txq_ctx_active_msk) ? 1 : 0; /* Set up and activate */ - iwl_legacy_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), + il_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), (active << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) | (tx_fifo_id << IWL49_SCD_QUEUE_STTS_REG_POS_TXF) | (scd_retry << IWL49_SCD_QUEUE_STTS_REG_POS_WSL) | @@ -2755,13 +2755,13 @@ void iwl4965_tx_queue_set_status(struct iwl_priv *priv, txq->sched_retry = scd_retry; - IWL_DEBUG_INFO(priv, "%s %s Queue %d on AC %d\n", + IL_DEBUG_INFO(priv, "%s %s Queue %d on AC %d\n", active ? "Activate" : "Deactivate", scd_retry ? "BA" : "AC", txq_id, tx_fifo_id); } -static int iwl4965_init_drv(struct iwl_priv *priv) +static int il4965_init_drv(struct il_priv *priv) { int ret; @@ -2778,91 +2778,91 @@ static int iwl4965_init_drv(struct iwl_priv *priv) priv->iw_mode = NL80211_IFTYPE_STATION; priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; - priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; + priv->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; /* initialize force reset */ - priv->force_reset.reset_duration = IWL_DELAY_NEXT_FORCE_FW_RELOAD; + priv->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; /* Choose which receivers/antennas to use */ if (priv->cfg->ops->hcmd->set_rxon_chain) priv->cfg->ops->hcmd->set_rxon_chain(priv, - &priv->contexts[IWL_RXON_CTX_BSS]); + &priv->contexts[IL_RXON_CTX_BSS]); - iwl_legacy_init_scan_params(priv); + il_init_scan_params(priv); - ret = iwl_legacy_init_channel_map(priv); + ret = il_init_channel_map(priv); if (ret) { - IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); + IL_ERR(priv, "initializing regulatory failed: %d\n", ret); goto err; } - ret = iwl_legacy_init_geos(priv); + ret = il_init_geos(priv); if (ret) { - IWL_ERR(priv, "initializing geos failed: %d\n", ret); + IL_ERR(priv, "initializing geos failed: %d\n", ret); goto err_free_channel_map; } - iwl4965_init_hw_rates(priv, priv->ieee_rates); + il4965_init_hw_rates(priv, priv->ieee_rates); return 0; err_free_channel_map: - iwl_legacy_free_channel_map(priv); + il_free_channel_map(priv); err: return ret; } -static void iwl4965_uninit_drv(struct iwl_priv *priv) +static void il4965_uninit_drv(struct il_priv *priv) { - iwl4965_calib_free_results(priv); - iwl_legacy_free_geos(priv); - iwl_legacy_free_channel_map(priv); + il4965_calib_free_results(priv); + il_free_geos(priv); + il_free_channel_map(priv); kfree(priv->scan_cmd); } -static void iwl4965_hw_detect(struct iwl_priv *priv) +static void il4965_hw_detect(struct il_priv *priv) { - priv->hw_rev = _iwl_legacy_read32(priv, CSR_HW_REV); - priv->hw_wa_rev = _iwl_legacy_read32(priv, CSR_HW_REV_WA_REG); + priv->hw_rev = _il_read32(priv, CSR_HW_REV); + priv->hw_wa_rev = _il_read32(priv, CSR_HW_REV_WA_REG); priv->rev_id = priv->pci_dev->revision; - IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", priv->rev_id); + IL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", priv->rev_id); } -static int iwl4965_set_hw_params(struct iwl_priv *priv) +static int il4965_set_hw_params(struct il_priv *priv) { priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; if (priv->cfg->mod_params->amsdu_size_8K) - priv->hw_params.rx_page_order = get_order(IWL_RX_BUF_SIZE_8K); + priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_8K); else - priv->hw_params.rx_page_order = get_order(IWL_RX_BUF_SIZE_4K); + priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_4K); - priv->hw_params.max_beacon_itrvl = IWL_MAX_UCODE_BEACON_INTERVAL; + priv->hw_params.max_beacon_itrvl = IL_MAX_UCODE_BEACON_INTERVAL; if (priv->cfg->mod_params->disable_11n) - priv->cfg->sku &= ~IWL_SKU_N; + priv->cfg->sku &= ~IL_SKU_N; /* Device-specific setup */ return priv->cfg->ops->lib->set_hw_params(priv); } -static const u8 iwl4965_bss_ac_to_fifo[] = { - IWL_TX_FIFO_VO, - IWL_TX_FIFO_VI, - IWL_TX_FIFO_BE, - IWL_TX_FIFO_BK, +static const u8 il4965_bss_ac_to_fifo[] = { + IL_TX_FIFO_VO, + IL_TX_FIFO_VI, + IL_TX_FIFO_BE, + IL_TX_FIFO_BK, }; -static const u8 iwl4965_bss_ac_to_queue[] = { +static const u8 il4965_bss_ac_to_queue[] = { 0, 1, 2, 3, }; static int -iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) +il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { int err = 0, i; - struct iwl_priv *priv; + struct il_priv *priv; struct ieee80211_hw *hw; - struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); + struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data); unsigned long flags; u16 pci_cmd; @@ -2870,7 +2870,7 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * 1. Allocating HW data ************************/ - hw = iwl_legacy_alloc_all(cfg); + hw = il_alloc_all(cfg); if (!hw) { err = -ENOMEM; goto out; @@ -2883,41 +2883,41 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * more may be discovered when firmware * is loaded. */ - priv->valid_contexts = BIT(IWL_RXON_CTX_BSS); + priv->valid_contexts = BIT(IL_RXON_CTX_BSS); - for (i = 0; i < NUM_IWL_RXON_CTX; i++) + for (i = 0; i < NUM_IL_RXON_CTX; i++) priv->contexts[i].ctxid = i; - priv->contexts[IWL_RXON_CTX_BSS].always_active = true; - priv->contexts[IWL_RXON_CTX_BSS].is_active = true; - priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; - priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; - priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; - priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; - priv->contexts[IWL_RXON_CTX_BSS].ap_sta_id = IWL_AP_ID; - priv->contexts[IWL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; - priv->contexts[IWL_RXON_CTX_BSS].ac_to_fifo = iwl4965_bss_ac_to_fifo; - priv->contexts[IWL_RXON_CTX_BSS].ac_to_queue = iwl4965_bss_ac_to_queue; - priv->contexts[IWL_RXON_CTX_BSS].exclusive_interface_modes = + priv->contexts[IL_RXON_CTX_BSS].always_active = true; + priv->contexts[IL_RXON_CTX_BSS].is_active = true; + priv->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; + priv->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; + priv->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; + priv->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; + priv->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID; + priv->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; + priv->contexts[IL_RXON_CTX_BSS].ac_to_fifo = il4965_bss_ac_to_fifo; + priv->contexts[IL_RXON_CTX_BSS].ac_to_queue = il4965_bss_ac_to_queue; + priv->contexts[IL_RXON_CTX_BSS].exclusive_interface_modes = BIT(NL80211_IFTYPE_ADHOC); - priv->contexts[IWL_RXON_CTX_BSS].interface_modes = + priv->contexts[IL_RXON_CTX_BSS].interface_modes = BIT(NL80211_IFTYPE_STATION); - priv->contexts[IWL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP; - priv->contexts[IWL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; - priv->contexts[IWL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; - priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; + priv->contexts[IL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP; + priv->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; + priv->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; + priv->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; - BUILD_BUG_ON(NUM_IWL_RXON_CTX != 1); + BUILD_BUG_ON(NUM_IL_RXON_CTX != 1); SET_IEEE80211_DEV(hw, &pdev->dev); - IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); + IL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); priv->cfg = cfg; priv->pci_dev = pdev; priv->inta_mask = CSR_INI_SET_MASK; - if (iwl_legacy_alloc_traffic_mem(priv)) - IWL_ERR(priv, "Not enough memory to generate traffic log\n"); + if (il_alloc_traffic_mem(priv)) + IL_ERR(priv, "Not enough memory to generate traffic log\n"); /************************** * 2. Initializing PCI bus @@ -2942,7 +2942,7 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) DMA_BIT_MASK(32)); /* both attempts failed: */ if (err) { - IWL_WARN(priv, "No suitable DMA available.\n"); + IL_WARN(priv, "No suitable DMA available.\n"); goto out_pci_disable_device; } } @@ -2963,9 +2963,9 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_pci_release_regions; } - IWL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", + IL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", (unsigned long long) pci_resource_len(pdev, 0)); - IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); + IL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); /* these spin locks will be used in apm_ops.init and EEPROM access * we should init now @@ -2978,19 +2978,19 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * strange state ... like being left stranded by a primary kernel * and this is now the kdump kernel trying to start up */ - iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); + il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); - iwl4965_hw_detect(priv); - IWL_INFO(priv, "Detected %s, REV=0x%X\n", + il4965_hw_detect(priv); + IL_INFO(priv, "Detected %s, REV=0x%X\n", priv->cfg->name, priv->hw_rev); /* We disable the RETRY_TIMEOUT register (0x41) to keep * PCI Tx retries from interfering with C3 CPU state */ pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); - iwl4965_prepare_card_hw(priv); + il4965_prepare_card_hw(priv); if (!priv->hw_ready) { - IWL_WARN(priv, "Failed, HW not ready\n"); + IL_WARN(priv, "Failed, HW not ready\n"); goto out_iounmap; } @@ -2998,12 +2998,12 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * 4. Read EEPROM *****************/ /* Read the EEPROM */ - err = iwl_legacy_eeprom_init(priv); + err = il_eeprom_init(priv); if (err) { - IWL_ERR(priv, "Unable to init EEPROM\n"); + IL_ERR(priv, "Unable to init EEPROM\n"); goto out_iounmap; } - err = iwl4965_eeprom_check_version(priv); + err = il4965_eeprom_check_version(priv); if (err) goto out_free_eeprom; @@ -3011,16 +3011,16 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_free_eeprom; /* extract MAC Address */ - iwl4965_eeprom_get_mac(priv, priv->addresses[0].addr); - IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr); + il4965_eeprom_get_mac(priv, priv->addresses[0].addr); + IL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr); priv->hw->wiphy->addresses = priv->addresses; priv->hw->wiphy->n_addresses = 1; /************************ * 5. Setup HW constants ************************/ - if (iwl4965_set_hw_params(priv)) { - IWL_ERR(priv, "failed to set hw parameters\n"); + if (il4965_set_hw_params(priv)) { + IL_ERR(priv, "failed to set hw parameters\n"); goto out_free_eeprom; } @@ -3028,7 +3028,7 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * 6. Setup priv *******************/ - err = iwl4965_init_drv(priv); + err = il4965_init_drv(priv); if (err) goto out_free_eeprom; /* 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) * 7. Setup services ********************/ spin_lock_irqsave(&priv->lock, flags); - iwl_legacy_disable_interrupts(priv); + il_disable_interrupts(priv); spin_unlock_irqrestore(&priv->lock, flags); pci_enable_msi(priv->pci_dev); - err = request_irq(priv->pci_dev->irq, iwl_legacy_isr, + err = request_irq(priv->pci_dev->irq, il_isr, IRQF_SHARED, DRV_NAME, priv); if (err) { - IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); + IL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); goto out_disable_msi; } - iwl4965_setup_deferred_work(priv); - iwl4965_setup_rx_handlers(priv); + il4965_setup_deferred_work(priv); + il4965_setup_rx_handlers(priv); /********************************************* * 8. Enable interrupts and read RFKILL state @@ -3063,10 +3063,10 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); } - iwl_legacy_enable_rfkill_int(priv); + il_enable_rfkill_int(priv); /* If platform's RF_KILL switch is NOT set to KILL */ - if (iwl_read32(priv, CSR_GP_CNTRL) & + if (il_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) clear_bit(STATUS_RF_KILL_HW, &priv->status); else @@ -3075,11 +3075,11 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) wiphy_rfkill_set_hw_state(priv->hw->wiphy, test_bit(STATUS_RF_KILL_HW, &priv->status)); - iwl_legacy_power_initialize(priv); + il_power_initialize(priv); init_completion(&priv->_4965.firmware_loading_complete); - err = iwl4965_request_firmware(priv, true); + err = il4965_request_firmware(priv, true); if (err) goto out_destroy_workqueue; @@ -3091,9 +3091,9 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) free_irq(priv->pci_dev->irq, priv); out_disable_msi: pci_disable_msi(priv->pci_dev); - iwl4965_uninit_drv(priv); + il4965_uninit_drv(priv); out_free_eeprom: - iwl_legacy_eeprom_free(priv); + il_eeprom_free(priv); out_iounmap: pci_iounmap(pdev, priv->hw_base); out_pci_release_regions: @@ -3102,15 +3102,15 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) out_pci_disable_device: pci_disable_device(pdev); out_ieee80211_free_hw: - iwl_legacy_free_traffic_mem(priv); + il_free_traffic_mem(priv); ieee80211_free_hw(priv->hw); out: return err; } -static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) +static void __devexit il4965_pci_remove(struct pci_dev *pdev) { - struct iwl_priv *priv = pci_get_drvdata(pdev); + struct il_priv *priv = pci_get_drvdata(pdev); unsigned long flags; if (!priv) @@ -3118,62 +3118,62 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) wait_for_completion(&priv->_4965.firmware_loading_complete); - IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); + IL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); - iwl_legacy_dbgfs_unregister(priv); - sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); + il_dbgfs_unregister(priv); + sysfs_remove_group(&pdev->dev.kobj, &il_attribute_group); - /* ieee80211_unregister_hw call wil cause iwl_mac_stop to - * to be called and iwl4965_down since we are removing the device + /* ieee80211_unregister_hw call wil cause il_mac_stop to + * to be called and il4965_down since we are removing the device * we need to set STATUS_EXIT_PENDING bit. */ set_bit(STATUS_EXIT_PENDING, &priv->status); - iwl_legacy_leds_exit(priv); + il_leds_exit(priv); if (priv->mac80211_registered) { ieee80211_unregister_hw(priv->hw); priv->mac80211_registered = 0; } else { - iwl4965_down(priv); + il4965_down(priv); } /* * Make sure device is reset to low power before unloading driver. - * This may be redundant with iwl4965_down(), but there are paths to - * run iwl4965_down() without calling apm_ops.stop(), and there are - * paths to avoid running iwl4965_down() at all before leaving driver. + * This may be redundant with il4965_down(), but there are paths to + * run il4965_down() without calling apm_ops.stop(), and there are + * paths to avoid running il4965_down() at all before leaving driver. * This (inexpensive) call *makes sure* device is reset. */ - iwl_legacy_apm_stop(priv); + il_apm_stop(priv); /* make sure we flush any pending irq or * tasklet for the driver */ spin_lock_irqsave(&priv->lock, flags); - iwl_legacy_disable_interrupts(priv); + il_disable_interrupts(priv); spin_unlock_irqrestore(&priv->lock, flags); - iwl4965_synchronize_irq(priv); + il4965_synchronize_irq(priv); - iwl4965_dealloc_ucode_pci(priv); + il4965_dealloc_ucode_pci(priv); if (priv->rxq.bd) - iwl4965_rx_queue_free(priv, &priv->rxq); - iwl4965_hw_txq_ctx_free(priv); + il4965_rx_queue_free(priv, &priv->rxq); + il4965_hw_txq_ctx_free(priv); - iwl_legacy_eeprom_free(priv); + il_eeprom_free(priv); /*netif_stop_queue(dev); */ flush_workqueue(priv->workqueue); - /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes + /* ieee80211_unregister_hw calls il_mac_stop, which flushes * priv->workqueue... so we can't take down the workqueue * until now... */ destroy_workqueue(priv->workqueue); priv->workqueue = NULL; - iwl_legacy_free_traffic_mem(priv); + il_free_traffic_mem(priv); free_irq(priv->pci_dev->irq, priv); pci_disable_msi(priv->pci_dev); @@ -3182,7 +3182,7 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); - iwl4965_uninit_drv(priv); + il4965_uninit_drv(priv); dev_kfree_skb(priv->beacon_skb); @@ -3193,9 +3193,9 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask * must be called under priv->lock and mac access */ -void iwl4965_txq_set_sched(struct iwl_priv *priv, u32 mask) +void il4965_txq_set_sched(struct il_priv *priv, u32 mask) { - iwl_legacy_write_prph(priv, IWL49_SCD_TXFACT, mask); + il_write_prph(priv, IWL49_SCD_TXFACT, mask); } /***************************************************************************** @@ -3205,38 +3205,38 @@ void iwl4965_txq_set_sched(struct iwl_priv *priv, u32 mask) *****************************************************************************/ /* Hardware specific file defines the PCI IDs table for that hardware module */ -static DEFINE_PCI_DEVICE_TABLE(iwl4965_hw_card_ids) = { +static DEFINE_PCI_DEVICE_TABLE(il4965_hw_card_ids) = { #if defined(CONFIG_IWL4965_MODULE) || defined(CONFIG_IWL4965) - {IWL_PCI_DEVICE(0x4229, PCI_ANY_ID, iwl4965_cfg)}, - {IWL_PCI_DEVICE(0x4230, PCI_ANY_ID, iwl4965_cfg)}, + {IL_PCI_DEVICE(0x4229, PCI_ANY_ID, il4965_cfg)}, + {IL_PCI_DEVICE(0x4230, PCI_ANY_ID, il4965_cfg)}, #endif /* CONFIG_IWL4965 */ {0} }; -MODULE_DEVICE_TABLE(pci, iwl4965_hw_card_ids); +MODULE_DEVICE_TABLE(pci, il4965_hw_card_ids); -static struct pci_driver iwl4965_driver = { +static struct pci_driver il4965_driver = { .name = DRV_NAME, - .id_table = iwl4965_hw_card_ids, - .probe = iwl4965_pci_probe, - .remove = __devexit_p(iwl4965_pci_remove), - .driver.pm = IWL_LEGACY_PM_OPS, + .id_table = il4965_hw_card_ids, + .probe = il4965_pci_probe, + .remove = __devexit_p(il4965_pci_remove), + .driver.pm = IL_LEGACY_PM_OPS, }; -static int __init iwl4965_init(void) +static int __init il4965_init(void) { int ret; pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); pr_info(DRV_COPYRIGHT "\n"); - ret = iwl4965_rate_control_register(); + ret = il4965_rate_control_register(); if (ret) { pr_err("Unable to register rate control algorithm: %d\n", ret); return ret; } - ret = pci_register_driver(&iwl4965_driver); + ret = pci_register_driver(&il4965_driver); if (ret) { pr_err("Unable to initialize PCI module\n"); goto error_register; @@ -3245,32 +3245,32 @@ static int __init iwl4965_init(void) return ret; error_register: - iwl4965_rate_control_unregister(); + il4965_rate_control_unregister(); return ret; } -static void __exit iwl4965_exit(void) +static void __exit il4965_exit(void) { - pci_unregister_driver(&iwl4965_driver); - iwl4965_rate_control_unregister(); + pci_unregister_driver(&il4965_driver); + il4965_rate_control_unregister(); } -module_exit(iwl4965_exit); -module_init(iwl4965_init); +module_exit(il4965_exit); +module_init(il4965_init); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "debug output mask"); #endif -module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, S_IRUGO); +module_param_named(swcrypto, il4965_mod_params.sw_crypto, int, S_IRUGO); MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); -module_param_named(queues_num, iwl4965_mod_params.num_of_queues, int, S_IRUGO); +module_param_named(queues_num, il4965_mod_params.num_of_queues, int, S_IRUGO); MODULE_PARM_DESC(queues_num, "number of hw queues."); -module_param_named(11n_disable, iwl4965_mod_params.disable_11n, int, S_IRUGO); +module_param_named(11n_disable, il4965_mod_params.disable_11n, int, S_IRUGO); MODULE_PARM_DESC(11n_disable, "disable 11n functionality"); -module_param_named(amsdu_size_8K, iwl4965_mod_params.amsdu_size_8K, +module_param_named(amsdu_size_8K, il4965_mod_params.amsdu_size_8K, int, S_IRUGO); MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size"); -module_param_named(fw_restart, iwl4965_mod_params.restart_fw, int, S_IRUGO); +module_param_named(fw_restart, il4965_mod_params.restart_fw, int, S_IRUGO); MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); -- 2.7.4