iwlegacy: rename iwl to il

iwl_legacy prefix result in long function names, what cause that we
have frequent line split and not readable code. Also iwl_foo symbols
are duplicated in iwlwifi driver, what is annoying when editing
kernel tree with cscope.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
This commit is contained in:
Stanislaw Gruszka 2011-10-24 15:41:30 +02:00
parent fee005e5dd
commit e2ebc8337d
52 changed files with 7030 additions and 7030 deletions

View file

@ -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:");

View file

@ -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)
{

View file

@ -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__ */

View file

@ -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);
}

View file

@ -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,
};

View file

@ -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__ */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -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 <linux/pci.h> /* for struct pci_device_id */
#include <linux/kernel.h>
#include <net/ieee80211_radiotap.h>
/* 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 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 iwl3945_commit_rxon(struct iwl_priv *priv,
struct iwl_rxon_context *ctx);
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

View file

@ -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, "<<return 0x%X\n", ret);
ret |= il4965_sensitivity_write(priv);
IL_DEBUG_CALIB(priv, "<<return 0x%X\n", ret);
}
void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp)
void il4965_sensitivity_calibration(struct il_priv *priv, void *resp)
{
u32 rx_enable_time;
u32 fa_cck;
@ -508,7 +508,7 @@ void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp)
u32 bad_plcp_ofdm;
u32 norm_fa_ofdm;
u32 norm_fa_cck;
struct iwl_sensitivity_data *data = NULL;
struct il_sensitivity_data *data = NULL;
struct statistics_rx_non_phy *rx_info;
struct statistics_rx_phy *ofdm, *cck;
unsigned long flags;
@ -519,19 +519,19 @@ void iwl4965_sensitivity_calibration(struct iwl_priv *priv, void *resp)
data = &(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);
}

View file

@ -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__ */

View file

@ -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,

View file

@ -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;

View file

@ -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 @@ int iwl4965_eeprom_check_version(struct iwl_priv *priv)
}
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);
}

View file

@ -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__ */

View file

@ -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,
};

View file

@ -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__ */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -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);
}

View file

@ -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);

File diff suppressed because it is too large Load diff

View file

@ -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;
}

File diff suppressed because it is too large Load diff

View file

@ -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__ */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -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 "<ilw@linux.intel.com>"
#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<api>.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__ */

View file

@ -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__ */

View file

@ -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

View file

@ -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);

File diff suppressed because it is too large Load diff

View file

@ -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 @@ int iwl_legacy_eeprom_init(struct iwl_priv *priv)
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);

View file

@ -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 <net/mac80211.h>
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__ */

View file

@ -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__ */

View file

@ -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 @@ int iwl_legacy_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
}
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);

View file

@ -27,45 +27,45 @@
*
*****************************************************************************/
#ifndef __iwl_legacy_helpers_h__
#define __iwl_legacy_helpers_h__
#ifndef __il_helpers_h__
#define __il_helpers_h__
#include <linux/ctype.h>
#include <net/mac80211.h>
#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__ */

View file

@ -26,8 +26,8 @@
*
*****************************************************************************/
#ifndef __iwl_legacy_io_h__
#define __iwl_legacy_io_h__
#ifndef __il_io_h__
#define __il_io_h__
#include <linux/io.h>
@ -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);
}

View file

@ -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);

View file

@ -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__ */

View file

@ -24,14 +24,14 @@
*
*****************************************************************************/
#ifndef __iwl_legacy_rs_h__
#define __iwl_legacy_rs_h__
#ifndef __il_rs_h__
#define __il_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. */
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__ */

View file

@ -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);

View file

@ -25,31 +25,31 @@
* Intel Linux Wireless <ilw@linux.intel.com>
* 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__ */

View file

@ -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__ */

View file

@ -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 @@ int iwl_legacy_rx_queue_alloc(struct iwl_priv *priv)
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);

View file

@ -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 @@ static void iwl_legacy_bg_scan_completed(struct work_struct *work)
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);

View file

@ -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),

View file

@ -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);

View file

@ -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 */
#define IL_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,
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__ */

View file

@ -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 @@ int iwl_legacy_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
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);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff