forked from Minki/linux
iwlegacy: rename priv to il
Make code shorter. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
This commit is contained in:
parent
e2ebc8337d
commit
46bc8d4b0e
@ -29,22 +29,22 @@
|
||||
#include "iwl-3945-debugfs.h"
|
||||
|
||||
|
||||
static int il3945_statistics_flag(struct il_priv *priv, char *buf, int bufsz)
|
||||
static int il3945_statistics_flag(struct il_priv *il, char *buf, int bufsz)
|
||||
{
|
||||
int p = 0;
|
||||
|
||||
p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n",
|
||||
le32_to_cpu(priv->_3945.statistics.flag));
|
||||
if (le32_to_cpu(priv->_3945.statistics.flag) &
|
||||
le32_to_cpu(il->_3945.statistics.flag));
|
||||
if (le32_to_cpu(il->_3945.statistics.flag) &
|
||||
UCODE_STATISTICS_CLEAR_MSK)
|
||||
p += scnprintf(buf + p, bufsz - p,
|
||||
"\tStatistics have been cleared\n");
|
||||
p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
|
||||
(le32_to_cpu(priv->_3945.statistics.flag) &
|
||||
(le32_to_cpu(il->_3945.statistics.flag) &
|
||||
UCODE_STATISTICS_FREQUENCY_MSK)
|
||||
? "2.4 GHz" : "5.2 GHz");
|
||||
p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
|
||||
(le32_to_cpu(priv->_3945.statistics.flag) &
|
||||
(le32_to_cpu(il->_3945.statistics.flag) &
|
||||
UCODE_STATISTICS_NARROW_BAND_MSK)
|
||||
? "enabled" : "disabled");
|
||||
return p;
|
||||
@ -54,7 +54,7 @@ ssize_t il3945_ucode_rx_stats_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int pos = 0;
|
||||
char *buf;
|
||||
int bufsz = sizeof(struct iwl39_statistics_rx_phy) * 40 +
|
||||
@ -66,12 +66,12 @@ ssize_t il3945_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 (!il_is_alive(priv))
|
||||
if (!il_is_alive(il))
|
||||
return -EAGAIN;
|
||||
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate Buffer\n");
|
||||
IL_ERR(il, "Can not allocate Buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -80,20 +80,20 @@ ssize_t il3945_ucode_rx_stats_read(struct file *file,
|
||||
* the last statistics notification from uCode
|
||||
* might not reflect the current uCode activity
|
||||
*/
|
||||
ofdm = &priv->_3945.statistics.rx.ofdm;
|
||||
cck = &priv->_3945.statistics.rx.cck;
|
||||
general = &priv->_3945.statistics.rx.general;
|
||||
accum_ofdm = &priv->_3945.accum_statistics.rx.ofdm;
|
||||
accum_cck = &priv->_3945.accum_statistics.rx.cck;
|
||||
accum_general = &priv->_3945.accum_statistics.rx.general;
|
||||
delta_ofdm = &priv->_3945.delta_statistics.rx.ofdm;
|
||||
delta_cck = &priv->_3945.delta_statistics.rx.cck;
|
||||
delta_general = &priv->_3945.delta_statistics.rx.general;
|
||||
max_ofdm = &priv->_3945.max_delta.rx.ofdm;
|
||||
max_cck = &priv->_3945.max_delta.rx.cck;
|
||||
max_general = &priv->_3945.max_delta.rx.general;
|
||||
ofdm = &il->_3945.statistics.rx.ofdm;
|
||||
cck = &il->_3945.statistics.rx.cck;
|
||||
general = &il->_3945.statistics.rx.general;
|
||||
accum_ofdm = &il->_3945.accum_statistics.rx.ofdm;
|
||||
accum_cck = &il->_3945.accum_statistics.rx.cck;
|
||||
accum_general = &il->_3945.accum_statistics.rx.general;
|
||||
delta_ofdm = &il->_3945.delta_statistics.rx.ofdm;
|
||||
delta_cck = &il->_3945.delta_statistics.rx.cck;
|
||||
delta_general = &il->_3945.delta_statistics.rx.general;
|
||||
max_ofdm = &il->_3945.max_delta.rx.ofdm;
|
||||
max_cck = &il->_3945.max_delta.rx.cck;
|
||||
max_general = &il->_3945.max_delta.rx.general;
|
||||
|
||||
pos += il3945_statistics_flag(priv, buf, bufsz);
|
||||
pos += il3945_statistics_flag(il, buf, bufsz);
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
|
||||
"acumulative delta max\n",
|
||||
"Statistics_Rx - OFDM:");
|
||||
@ -329,19 +329,19 @@ ssize_t il3945_ucode_tx_stats_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = 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 (!il_is_alive(priv))
|
||||
if (!il_is_alive(il))
|
||||
return -EAGAIN;
|
||||
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate Buffer\n");
|
||||
IL_ERR(il, "Can not allocate Buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -350,11 +350,11 @@ ssize_t il3945_ucode_tx_stats_read(struct file *file,
|
||||
* the last statistics notification from uCode
|
||||
* might not reflect the current uCode activity
|
||||
*/
|
||||
tx = &priv->_3945.statistics.tx;
|
||||
accum_tx = &priv->_3945.accum_statistics.tx;
|
||||
delta_tx = &priv->_3945.delta_statistics.tx;
|
||||
max_tx = &priv->_3945.max_delta.tx;
|
||||
pos += il3945_statistics_flag(priv, buf, bufsz);
|
||||
tx = &il->_3945.statistics.tx;
|
||||
accum_tx = &il->_3945.accum_statistics.tx;
|
||||
delta_tx = &il->_3945.delta_statistics.tx;
|
||||
max_tx = &il->_3945.max_delta.tx;
|
||||
pos += il3945_statistics_flag(il, buf, bufsz);
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
|
||||
"acumulative delta max\n",
|
||||
"Statistics_Tx:");
|
||||
@ -425,7 +425,7 @@ ssize_t il3945_ucode_general_stats_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int pos = 0;
|
||||
char *buf;
|
||||
int bufsz = sizeof(struct iwl39_statistics_general) * 10 + 300;
|
||||
@ -435,12 +435,12 @@ ssize_t il3945_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 (!il_is_alive(priv))
|
||||
if (!il_is_alive(il))
|
||||
return -EAGAIN;
|
||||
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate Buffer\n");
|
||||
IL_ERR(il, "Can not allocate Buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -449,19 +449,19 @@ ssize_t il3945_ucode_general_stats_read(struct file *file,
|
||||
* the last statistics notification from uCode
|
||||
* might not reflect the current uCode activity
|
||||
*/
|
||||
general = &priv->_3945.statistics.general;
|
||||
dbg = &priv->_3945.statistics.general.dbg;
|
||||
div = &priv->_3945.statistics.general.div;
|
||||
accum_general = &priv->_3945.accum_statistics.general;
|
||||
delta_general = &priv->_3945.delta_statistics.general;
|
||||
max_general = &priv->_3945.max_delta.general;
|
||||
accum_dbg = &priv->_3945.accum_statistics.general.dbg;
|
||||
delta_dbg = &priv->_3945.delta_statistics.general.dbg;
|
||||
max_dbg = &priv->_3945.max_delta.general.dbg;
|
||||
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 += il3945_statistics_flag(priv, buf, bufsz);
|
||||
general = &il->_3945.statistics.general;
|
||||
dbg = &il->_3945.statistics.general.dbg;
|
||||
div = &il->_3945.statistics.general.div;
|
||||
accum_general = &il->_3945.accum_statistics.general;
|
||||
delta_general = &il->_3945.delta_statistics.general;
|
||||
max_general = &il->_3945.max_delta.general;
|
||||
accum_dbg = &il->_3945.accum_statistics.general.dbg;
|
||||
delta_dbg = &il->_3945.delta_statistics.general.dbg;
|
||||
max_dbg = &il->_3945.max_delta.general.dbg;
|
||||
accum_div = &il->_3945.accum_statistics.general.div;
|
||||
delta_div = &il->_3945.delta_statistics.general.div;
|
||||
max_div = &il->_3945.max_delta.general.div;
|
||||
pos += il3945_statistics_flag(il, buf, bufsz);
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
|
||||
"acumulative delta max\n",
|
||||
"Statistics_General:");
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
|
||||
/* Send led command */
|
||||
static int il3945_send_led_cmd(struct il_priv *priv,
|
||||
static int il3945_send_led_cmd(struct il_priv *il,
|
||||
struct il_led_cmd *led_cmd)
|
||||
{
|
||||
struct il_host_cmd cmd = {
|
||||
@ -55,7 +55,7 @@ static int il3945_send_led_cmd(struct il_priv *priv,
|
||||
.callback = NULL,
|
||||
};
|
||||
|
||||
return il_send_cmd(priv, &cmd);
|
||||
return il_send_cmd(il, &cmd);
|
||||
}
|
||||
|
||||
const struct il_led_ops il3945_led_ops = {
|
||||
|
@ -153,7 +153,7 @@ static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta)
|
||||
int unflushed = 0;
|
||||
int i;
|
||||
unsigned long flags;
|
||||
struct il_priv *priv __maybe_unused = rs_sta->priv;
|
||||
struct il_priv *il __maybe_unused = rs_sta->il;
|
||||
|
||||
/*
|
||||
* For each rate, if we have collected data on that rate
|
||||
@ -167,7 +167,7 @@ static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta)
|
||||
spin_lock_irqsave(&rs_sta->lock, flags);
|
||||
if (time_after(jiffies, rs_sta->win[i].stamp +
|
||||
IL_RATE_WIN_FLUSH)) {
|
||||
IL_DEBUG_RATE(priv, "flushing %d samples of rate "
|
||||
IL_DEBUG_RATE(il, "flushing %d samples of rate "
|
||||
"index %d\n",
|
||||
rs_sta->win[i].counter, i);
|
||||
il3945_clear_window(&rs_sta->win[i]);
|
||||
@ -186,12 +186,12 @@ static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta)
|
||||
static void il3945_bg_rate_scale_flush(unsigned long data)
|
||||
{
|
||||
struct il3945_rs_sta *rs_sta = (void *)data;
|
||||
struct il_priv *priv __maybe_unused = rs_sta->priv;
|
||||
struct il_priv *il __maybe_unused = rs_sta->il;
|
||||
int unflushed = 0;
|
||||
unsigned long flags;
|
||||
u32 packet_count, duration, pps;
|
||||
|
||||
IL_DEBUG_RATE(priv, "enter\n");
|
||||
IL_DEBUG_RATE(il, "enter\n");
|
||||
|
||||
unflushed = il3945_rate_scale_flush_windows(rs_sta);
|
||||
|
||||
@ -206,7 +206,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
|
||||
duration =
|
||||
jiffies_to_msecs(jiffies - rs_sta->last_partial_flush);
|
||||
|
||||
IL_DEBUG_RATE(priv, "Tx'd %d packets in %dms\n",
|
||||
IL_DEBUG_RATE(il, "Tx'd %d packets in %dms\n",
|
||||
packet_count, duration);
|
||||
|
||||
/* Determine packets per second */
|
||||
@ -226,7 +226,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
|
||||
|
||||
rs_sta->flush_time = msecs_to_jiffies(duration);
|
||||
|
||||
IL_DEBUG_RATE(priv, "new flush period: %d msec ave %d\n",
|
||||
IL_DEBUG_RATE(il, "new flush period: %d msec ave %d\n",
|
||||
duration, packet_count);
|
||||
|
||||
mod_timer(&rs_sta->rate_scale_flush, jiffies +
|
||||
@ -244,7 +244,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
|
||||
|
||||
spin_unlock_irqrestore(&rs_sta->lock, flags);
|
||||
|
||||
IL_DEBUG_RATE(priv, "leave\n");
|
||||
IL_DEBUG_RATE(il, "leave\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -260,10 +260,10 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
|
||||
{
|
||||
unsigned long flags;
|
||||
s32 fail_count;
|
||||
struct il_priv *priv __maybe_unused = rs_sta->priv;
|
||||
struct il_priv *il __maybe_unused = rs_sta->il;
|
||||
|
||||
if (!retries) {
|
||||
IL_DEBUG_RATE(priv, "leave: retries == 0 -- should be at least 1\n");
|
||||
IL_DEBUG_RATE(il, "leave: retries == 0 -- should be at least 1\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -332,24 +332,24 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
|
||||
/*
|
||||
* Called after adding a new station to initialize rate scaling
|
||||
*/
|
||||
void il3945_rs_rate_init(struct il_priv *priv, struct ieee80211_sta *sta, u8 sta_id)
|
||||
void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id)
|
||||
{
|
||||
struct ieee80211_hw *hw = priv->hw;
|
||||
struct ieee80211_conf *conf = &priv->hw->conf;
|
||||
struct ieee80211_hw *hw = il->hw;
|
||||
struct ieee80211_conf *conf = &il->hw->conf;
|
||||
struct il3945_sta_priv *psta;
|
||||
struct il3945_rs_sta *rs_sta;
|
||||
struct ieee80211_supported_band *sband;
|
||||
int i;
|
||||
|
||||
IL_DEBUG_INFO(priv, "enter\n");
|
||||
if (sta_id == priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id)
|
||||
IL_DEBUG_INFO(il, "enter\n");
|
||||
if (sta_id == il->contexts[IL_RXON_CTX_BSS].bcast_sta_id)
|
||||
goto out;
|
||||
|
||||
psta = (struct il3945_sta_priv *) sta->drv_priv;
|
||||
rs_sta = &psta->rs_sta;
|
||||
sband = hw->wiphy->bands[conf->channel->band];
|
||||
|
||||
rs_sta->priv = priv;
|
||||
rs_sta->il = il;
|
||||
|
||||
rs_sta->start_rate = IL_RATE_INVALID;
|
||||
|
||||
@ -379,18 +379,18 @@ void il3945_rs_rate_init(struct il_priv *priv, struct ieee80211_sta *sta, u8 sta
|
||||
}
|
||||
}
|
||||
|
||||
priv->_3945.sta_supp_rates = sta->supp_rates[sband->band];
|
||||
il->_3945.sta_supp_rates = sta->supp_rates[sband->band];
|
||||
/* For 5 GHz band it start at IL_FIRST_OFDM_RATE */
|
||||
if (sband->band == IEEE80211_BAND_5GHZ) {
|
||||
rs_sta->last_txrate_idx += IL_FIRST_OFDM_RATE;
|
||||
priv->_3945.sta_supp_rates = priv->_3945.sta_supp_rates <<
|
||||
il->_3945.sta_supp_rates = il->_3945.sta_supp_rates <<
|
||||
IL_FIRST_OFDM_RATE;
|
||||
}
|
||||
|
||||
out:
|
||||
priv->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS;
|
||||
il->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS;
|
||||
|
||||
IL_DEBUG_INFO(priv, "leave\n");
|
||||
IL_DEBUG_INFO(il, "leave\n");
|
||||
}
|
||||
|
||||
static void *il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
|
||||
@ -399,7 +399,7 @@ static void *il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
|
||||
}
|
||||
|
||||
/* rate scale requires free function to be implemented */
|
||||
static void il3945_rs_free(void *priv)
|
||||
static void il3945_rs_free(void *il)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -408,24 +408,24 @@ static void *il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t
|
||||
{
|
||||
struct il3945_rs_sta *rs_sta;
|
||||
struct il3945_sta_priv *psta = (void *) sta->drv_priv;
|
||||
struct il_priv *priv __maybe_unused = il_priv;
|
||||
struct il_priv *il __maybe_unused = il_priv;
|
||||
|
||||
IL_DEBUG_RATE(priv, "enter\n");
|
||||
IL_DEBUG_RATE(il, "enter\n");
|
||||
|
||||
rs_sta = &psta->rs_sta;
|
||||
|
||||
spin_lock_init(&rs_sta->lock);
|
||||
init_timer(&rs_sta->rate_scale_flush);
|
||||
|
||||
IL_DEBUG_RATE(priv, "leave\n");
|
||||
IL_DEBUG_RATE(il, "leave\n");
|
||||
|
||||
return rs_sta;
|
||||
}
|
||||
|
||||
static void il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta,
|
||||
void *priv_sta)
|
||||
void *il_sta)
|
||||
{
|
||||
struct il3945_rs_sta *rs_sta = priv_sta;
|
||||
struct il3945_rs_sta *rs_sta = il_sta;
|
||||
|
||||
/*
|
||||
* Be careful not to use any members of il3945_rs_sta (like trying
|
||||
@ -442,18 +442,18 @@ static void il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta,
|
||||
* NOTE: Uses il_priv->retry_rate for the # of retries attempted by
|
||||
* the hardware for each rate.
|
||||
*/
|
||||
static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband,
|
||||
struct ieee80211_sta *sta, void *priv_sta,
|
||||
static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *sband,
|
||||
struct ieee80211_sta *sta, void *il_sta,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
s8 retries = 0, current_count;
|
||||
int scale_rate_index, first_index, last_index;
|
||||
unsigned long flags;
|
||||
struct il_priv *priv = (struct il_priv *)priv_rate;
|
||||
struct il3945_rs_sta *rs_sta = priv_sta;
|
||||
struct il_priv *il = (struct il_priv *)il_rate;
|
||||
struct il3945_rs_sta *rs_sta = il_sta;
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
|
||||
IL_DEBUG_RATE(priv, "enter\n");
|
||||
IL_DEBUG_RATE(il, "enter\n");
|
||||
|
||||
retries = info->status.rates[0].count;
|
||||
/* Sanity Check for retries */
|
||||
@ -462,18 +462,18 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band
|
||||
|
||||
first_index = sband->bitrates[info->status.rates[0].idx].hw_value;
|
||||
if ((first_index < 0) || (first_index >= IL_RATE_COUNT_3945)) {
|
||||
IL_DEBUG_RATE(priv, "leave: Rate out of bounds: %d\n", first_index);
|
||||
IL_DEBUG_RATE(il, "leave: Rate out of bounds: %d\n", first_index);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!priv_sta) {
|
||||
IL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
|
||||
if (!il_sta) {
|
||||
IL_DEBUG_RATE(il, "leave: No STA il data to update!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Treat uninitialized rate scaling data same as non-existing. */
|
||||
if (!rs_sta->priv) {
|
||||
IL_DEBUG_RATE(priv, "leave: STA priv data uninitialized!\n");
|
||||
if (!rs_sta->il) {
|
||||
IL_DEBUG_RATE(il, "leave: STA il data uninitialized!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -487,19 +487,19 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band
|
||||
* Update the window for each rate. We determine which rates
|
||||
* were Tx'd based on the total number of retries vs. the number
|
||||
* of retries configured for each rate -- currently set to the
|
||||
* priv value 'retry_rate' vs. rate specific
|
||||
* il value 'retry_rate' vs. rate specific
|
||||
*
|
||||
* On exit from this while loop last_index indicates the rate
|
||||
* at which the frame was finally transmitted (or failed if no
|
||||
* ACK)
|
||||
*/
|
||||
while (retries > 1) {
|
||||
if ((retries - 1) < priv->retry_rate) {
|
||||
if ((retries - 1) < il->retry_rate) {
|
||||
current_count = (retries - 1);
|
||||
last_index = scale_rate_index;
|
||||
} else {
|
||||
current_count = priv->retry_rate;
|
||||
last_index = il3945_rs_next_rate(priv,
|
||||
current_count = il->retry_rate;
|
||||
last_index = il3945_rs_next_rate(il,
|
||||
scale_rate_index);
|
||||
}
|
||||
|
||||
@ -508,7 +508,7 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band
|
||||
il3945_collect_tx_data(rs_sta,
|
||||
&rs_sta->win[scale_rate_index],
|
||||
0, current_count, scale_rate_index);
|
||||
IL_DEBUG_RATE(priv, "Update rate %d for %d retries.\n",
|
||||
IL_DEBUG_RATE(il, "Update rate %d for %d retries.\n",
|
||||
scale_rate_index, current_count);
|
||||
|
||||
retries -= current_count;
|
||||
@ -518,7 +518,7 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band
|
||||
|
||||
|
||||
/* Update the last index window with success/failure based on ACK */
|
||||
IL_DEBUG_RATE(priv, "Update rate %d with %s.\n",
|
||||
IL_DEBUG_RATE(il, "Update rate %d with %s.\n",
|
||||
last_index,
|
||||
(info->flags & IEEE80211_TX_STAT_ACK) ?
|
||||
"success" : "failure");
|
||||
@ -543,7 +543,7 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band
|
||||
|
||||
spin_unlock_irqrestore(&rs_sta->lock, flags);
|
||||
|
||||
IL_DEBUG_RATE(priv, "leave\n");
|
||||
IL_DEBUG_RATE(il, "leave\n");
|
||||
}
|
||||
|
||||
static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
|
||||
@ -551,7 +551,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
|
||||
{
|
||||
u8 high = IL_RATE_INVALID;
|
||||
u8 low = IL_RATE_INVALID;
|
||||
struct il_priv *priv __maybe_unused = rs_sta->priv;
|
||||
struct il_priv *il __maybe_unused = rs_sta->il;
|
||||
|
||||
/* 802.11A walks to the next literal adjacent rate in
|
||||
* the rate table */
|
||||
@ -591,7 +591,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
|
||||
break;
|
||||
if (rate_mask & (1 << low))
|
||||
break;
|
||||
IL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low);
|
||||
IL_DEBUG_RATE(il, "Skipping masked lower rate: %d\n", low);
|
||||
}
|
||||
|
||||
high = index;
|
||||
@ -604,7 +604,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
|
||||
break;
|
||||
if (rate_mask & (1 << high))
|
||||
break;
|
||||
IL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high);
|
||||
IL_DEBUG_RATE(il, "Skipping masked higher rate: %d\n", high);
|
||||
}
|
||||
|
||||
return (high << 8) | low;
|
||||
@ -626,8 +626,8 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
|
||||
* rate table and must reference the driver allocated rate table
|
||||
*
|
||||
*/
|
||||
static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
|
||||
void *priv_sta, struct ieee80211_tx_rate_control *txrc)
|
||||
static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
|
||||
void *il_sta, struct ieee80211_tx_rate_control *txrc)
|
||||
{
|
||||
struct ieee80211_supported_band *sband = txrc->sband;
|
||||
struct sk_buff *skb = txrc->skb;
|
||||
@ -635,7 +635,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
|
||||
u8 high = IL_RATE_INVALID;
|
||||
u16 high_low;
|
||||
int index;
|
||||
struct il3945_rs_sta *rs_sta = priv_sta;
|
||||
struct il3945_rs_sta *rs_sta = il_sta;
|
||||
struct il3945_rate_scale_data *window = NULL;
|
||||
int current_tpt = IL_INVALID_VALUE;
|
||||
int low_tpt = IL_INVALID_VALUE;
|
||||
@ -645,18 +645,18 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
|
||||
unsigned long flags;
|
||||
u16 rate_mask;
|
||||
s8 max_rate_idx = -1;
|
||||
struct il_priv *priv __maybe_unused = (struct il_priv *)priv_r;
|
||||
struct il_priv *il __maybe_unused = (struct il_priv *)il_r;
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
|
||||
IL_DEBUG_RATE(priv, "enter\n");
|
||||
IL_DEBUG_RATE(il, "enter\n");
|
||||
|
||||
/* Treat uninitialized rate scaling data same as non-existing. */
|
||||
if (rs_sta && !rs_sta->priv) {
|
||||
IL_DEBUG_RATE(priv, "Rate scaling information not initialized yet.\n");
|
||||
priv_sta = NULL;
|
||||
if (rs_sta && !rs_sta->il) {
|
||||
IL_DEBUG_RATE(il, "Rate scaling information not initialized yet.\n");
|
||||
il_sta = NULL;
|
||||
}
|
||||
|
||||
if (rate_control_send_low(sta, priv_sta, txrc))
|
||||
if (rate_control_send_low(sta, il_sta, txrc))
|
||||
return;
|
||||
|
||||
rate_mask = sta->supp_rates[sband->band];
|
||||
@ -699,7 +699,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
|
||||
(window->success_counter < IL_RATE_MIN_SUCCESS_TH))) {
|
||||
spin_unlock_irqrestore(&rs_sta->lock, flags);
|
||||
|
||||
IL_DEBUG_RATE(priv, "Invalid average_tpt on rate %d: "
|
||||
IL_DEBUG_RATE(il, "Invalid average_tpt on rate %d: "
|
||||
"counter: %d, success_counter: %d, "
|
||||
"expected_tpt is %sNULL\n",
|
||||
index,
|
||||
@ -737,7 +737,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
|
||||
|
||||
/* Low success ratio , need to drop the rate */
|
||||
if ((window->success_ratio < IL_RATE_DECREASE_TH) || !current_tpt) {
|
||||
IL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n");
|
||||
IL_DEBUG_RATE(il, "decrease rate because of low success_ratio\n");
|
||||
scale_action = -1;
|
||||
/* No throughput measured yet for adjacent rates,
|
||||
* try increase */
|
||||
@ -756,7 +756,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
|
||||
(high_tpt != IL_INVALID_VALUE) &&
|
||||
(low_tpt < current_tpt) && (high_tpt < current_tpt)) {
|
||||
|
||||
IL_DEBUG_RATE(priv, "No action -- low [%d] & high [%d] < "
|
||||
IL_DEBUG_RATE(il, "No action -- low [%d] & high [%d] < "
|
||||
"current_tpt [%d]\n",
|
||||
low_tpt, high_tpt, current_tpt);
|
||||
scale_action = 0;
|
||||
@ -771,13 +771,13 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
|
||||
window->success_ratio >= IL_RATE_INCREASE_TH)
|
||||
scale_action = 1;
|
||||
else {
|
||||
IL_DEBUG_RATE(priv,
|
||||
IL_DEBUG_RATE(il,
|
||||
"decrease rate because of high tpt\n");
|
||||
scale_action = 0;
|
||||
}
|
||||
} else if (low_tpt != IL_INVALID_VALUE) {
|
||||
if (low_tpt > current_tpt) {
|
||||
IL_DEBUG_RATE(priv,
|
||||
IL_DEBUG_RATE(il,
|
||||
"decrease rate because of low tpt\n");
|
||||
scale_action = -1;
|
||||
} else if (window->success_ratio >= IL_RATE_INCREASE_TH) {
|
||||
@ -816,7 +816,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
|
||||
break;
|
||||
}
|
||||
|
||||
IL_DEBUG_RATE(priv, "Selected %d (action %d) - low %d high %d\n",
|
||||
IL_DEBUG_RATE(il, "Selected %d (action %d) - low %d high %d\n",
|
||||
index, scale_action, low, high);
|
||||
|
||||
out:
|
||||
@ -831,7 +831,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
|
||||
info->control.rates[0].idx = rs_sta->last_txrate_idx;
|
||||
}
|
||||
|
||||
IL_DEBUG_RATE(priv, "leave: %d\n", index);
|
||||
IL_DEBUG_RATE(il, "leave: %d\n", index);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MAC80211_DEBUGFS
|
||||
@ -878,10 +878,10 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static void il3945_add_debugfs(void *priv, void *priv_sta,
|
||||
static void il3945_add_debugfs(void *il, void *il_sta,
|
||||
struct dentry *dir)
|
||||
{
|
||||
struct il3945_rs_sta *lq_sta = priv_sta;
|
||||
struct il3945_rs_sta *lq_sta = il_sta;
|
||||
|
||||
lq_sta->rs_sta_dbgfs_stats_table_file =
|
||||
debugfs_create_file("rate_stats_table", 0600, dir,
|
||||
@ -889,9 +889,9 @@ static void il3945_add_debugfs(void *priv, void *priv_sta,
|
||||
|
||||
}
|
||||
|
||||
static void il3945_remove_debugfs(void *priv, void *priv_sta)
|
||||
static void il3945_remove_debugfs(void *il, void *il_sta)
|
||||
{
|
||||
struct il3945_rs_sta *lq_sta = priv_sta;
|
||||
struct il3945_rs_sta *lq_sta = il_sta;
|
||||
debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file);
|
||||
}
|
||||
#endif
|
||||
@ -901,9 +901,9 @@ static void il3945_remove_debugfs(void *priv, void *priv_sta)
|
||||
* the station is added. Since mac80211 calls this function before a
|
||||
* station is added we ignore it.
|
||||
*/
|
||||
static void il3945_rs_rate_init_stub(void *priv_r,
|
||||
static void il3945_rs_rate_init_stub(void *il_r,
|
||||
struct ieee80211_supported_band *sband,
|
||||
struct ieee80211_sta *sta, void *priv_sta)
|
||||
struct ieee80211_sta *sta, void *il_sta)
|
||||
{
|
||||
}
|
||||
|
||||
@ -925,21 +925,21 @@ static struct rate_control_ops rs_ops = {
|
||||
};
|
||||
void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
|
||||
{
|
||||
struct il_priv *priv = hw->priv;
|
||||
struct il_priv *il = hw->priv;
|
||||
s32 rssi = 0;
|
||||
unsigned long flags;
|
||||
struct il3945_rs_sta *rs_sta;
|
||||
struct ieee80211_sta *sta;
|
||||
struct il3945_sta_priv *psta;
|
||||
|
||||
IL_DEBUG_RATE(priv, "enter\n");
|
||||
IL_DEBUG_RATE(il, "enter\n");
|
||||
|
||||
rcu_read_lock();
|
||||
|
||||
sta = ieee80211_find_sta(priv->contexts[IL_RXON_CTX_BSS].vif,
|
||||
priv->stations[sta_id].sta.sta.addr);
|
||||
sta = ieee80211_find_sta(il->contexts[IL_RXON_CTX_BSS].vif,
|
||||
il->stations[sta_id].sta.sta.addr);
|
||||
if (!sta) {
|
||||
IL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n");
|
||||
IL_DEBUG_RATE(il, "Unable to find station to initialize rate scaling.\n");
|
||||
rcu_read_unlock();
|
||||
return;
|
||||
}
|
||||
@ -950,10 +950,10 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
|
||||
spin_lock_irqsave(&rs_sta->lock, flags);
|
||||
|
||||
rs_sta->tgg = 0;
|
||||
switch (priv->band) {
|
||||
switch (il->band) {
|
||||
case IEEE80211_BAND_2GHZ:
|
||||
/* TODO: this always does G, not a regression */
|
||||
if (priv->contexts[IL_RXON_CTX_BSS].active.flags &
|
||||
if (il->contexts[IL_RXON_CTX_BSS].active.flags &
|
||||
RXON_FLG_TGG_PROTECT_MSK) {
|
||||
rs_sta->tgg = 1;
|
||||
rs_sta->expected_tpt = il3945_expected_tpt_g_prot;
|
||||
@ -971,15 +971,15 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
|
||||
|
||||
spin_unlock_irqrestore(&rs_sta->lock, flags);
|
||||
|
||||
rssi = priv->_3945.last_rx_rssi;
|
||||
rssi = il->_3945.last_rx_rssi;
|
||||
if (rssi == 0)
|
||||
rssi = IL_MIN_RSSI_VAL;
|
||||
|
||||
IL_DEBUG_RATE(priv, "Network RSSI: %d\n", rssi);
|
||||
IL_DEBUG_RATE(il, "Network RSSI: %d\n", rssi);
|
||||
|
||||
rs_sta->start_rate = il3945_get_rate_index_by_rssi(rssi, priv->band);
|
||||
rs_sta->start_rate = il3945_get_rate_index_by_rssi(rssi, il->band);
|
||||
|
||||
IL_DEBUG_RATE(priv, "leave: rssi %d assign rate index: "
|
||||
IL_DEBUG_RATE(il, "leave: rssi %d assign rate index: "
|
||||
"%d (plcp 0x%x)\n", rssi, rs_sta->start_rate,
|
||||
il3945_rates[rs_sta->start_rate].plcp);
|
||||
rcu_read_unlock();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -85,7 +85,7 @@ struct il3945_rate_scale_data {
|
||||
|
||||
struct il3945_rs_sta {
|
||||
spinlock_t lock;
|
||||
struct il_priv *priv;
|
||||
struct il_priv *il;
|
||||
s32 *expected_tpt;
|
||||
unsigned long last_partial_flush;
|
||||
unsigned long last_flush;
|
||||
@ -207,12 +207,12 @@ struct il3945_ibss_seq {
|
||||
*****************************************************************************/
|
||||
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,
|
||||
extern void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq);
|
||||
extern unsigned int il3945_fill_beacon_frame(struct il_priv *il,
|
||||
struct ieee80211_hdr *hdr, int left);
|
||||
extern int il3945_dump_nic_event_log(struct il_priv *priv, bool full_log,
|
||||
extern int il3945_dump_nic_event_log(struct il_priv *il, bool full_log,
|
||||
char **buf, bool display);
|
||||
extern void il3945_dump_nic_error_log(struct il_priv *priv);
|
||||
extern void il3945_dump_nic_error_log(struct il_priv *il);
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
@ -230,44 +230,44 @@ extern void il3945_dump_nic_error_log(struct il_priv *priv);
|
||||
* il3945_mac_ <-- mac80211 callback
|
||||
*
|
||||
****************************************************************************/
|
||||
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,
|
||||
extern void il3945_hw_rx_handler_setup(struct il_priv *il);
|
||||
extern void il3945_hw_setup_deferred_work(struct il_priv *il);
|
||||
extern void il3945_hw_cancel_deferred_work(struct il_priv *il);
|
||||
extern int il3945_hw_rxq_stop(struct il_priv *il);
|
||||
extern int il3945_hw_set_hw_params(struct il_priv *il);
|
||||
extern int il3945_hw_nic_init(struct il_priv *il);
|
||||
extern int il3945_hw_nic_stop_master(struct il_priv *il);
|
||||
extern void il3945_hw_txq_ctx_free(struct il_priv *il);
|
||||
extern void il3945_hw_txq_ctx_stop(struct il_priv *il);
|
||||
extern int il3945_hw_nic_reset(struct il_priv *il);
|
||||
extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il,
|
||||
struct il_tx_queue *txq,
|
||||
dma_addr_t addr, u16 len,
|
||||
u8 reset, u8 pad);
|
||||
extern void il3945_hw_txq_free_tfd(struct il_priv *priv,
|
||||
extern void il3945_hw_txq_free_tfd(struct il_priv *il,
|
||||
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,
|
||||
extern int il3945_hw_get_temperature(struct il_priv *il);
|
||||
extern int il3945_hw_tx_queue_init(struct il_priv *il,
|
||||
struct il_tx_queue *txq);
|
||||
extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv,
|
||||
extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il,
|
||||
struct il3945_frame *frame, u8 rate);
|
||||
void il3945_hw_build_tx_cmd_rate(struct il_priv *priv,
|
||||
void il3945_hw_build_tx_cmd_rate(struct il_priv *il,
|
||||
struct il_device_cmd *cmd,
|
||||
struct ieee80211_tx_info *info,
|
||||
struct ieee80211_hdr *hdr,
|
||||
int sta_id, int tx_id);
|
||||
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,
|
||||
extern int il3945_hw_reg_send_txpower(struct il_priv *il);
|
||||
extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power);
|
||||
extern void il3945_hw_rx_statistics(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
void il3945_reply_statistics(struct il_priv *priv,
|
||||
void il3945_reply_statistics(struct il_priv *il,
|
||||
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 void il3945_disable_events(struct il_priv *il);
|
||||
extern int il4965_get_temperature(const struct il_priv *il);
|
||||
extern void il3945_post_associate(struct il_priv *il);
|
||||
extern void il3945_config_ap(struct il_priv *il);
|
||||
|
||||
extern int il3945_commit_rxon(struct il_priv *priv,
|
||||
extern int il3945_commit_rxon(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
|
||||
/**
|
||||
@ -278,26 +278,26 @@ extern int il3945_commit_rxon(struct il_priv *priv,
|
||||
* not yet been merged into a single common layer for managing the
|
||||
* station tables.
|
||||
*/
|
||||
extern u8 il3945_hw_find_station(struct il_priv *priv, const u8 *bssid);
|
||||
extern u8 il3945_hw_find_station(struct il_priv *il, const u8 *bssid);
|
||||
|
||||
extern struct ieee80211_ops il3945_hw_ops;
|
||||
|
||||
/*
|
||||
* Forward declare iwl-3945.c functions for iwl3945-base.c
|
||||
*/
|
||||
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 __le32 il3945_get_antenna_flags(const struct il_priv *il);
|
||||
extern int il3945_init_hw_rate_table(struct il_priv *il);
|
||||
extern void il3945_reg_txpower_periodic(struct il_priv *il);
|
||||
extern int il3945_txpower_set_from_eeprom(struct il_priv *il);
|
||||
|
||||
extern const struct il_channel_info *il3945_get_channel_info(
|
||||
const struct il_priv *priv, enum ieee80211_band band, u16 channel);
|
||||
const struct il_priv *il, enum ieee80211_band band, u16 channel);
|
||||
|
||||
extern int il3945_rs_next_rate(struct il_priv *priv, int rate);
|
||||
extern int il3945_rs_next_rate(struct il_priv *il, int rate);
|
||||
|
||||
/* scanning */
|
||||
int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif);
|
||||
void il3945_post_scan(struct il_priv *priv);
|
||||
int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif);
|
||||
void il3945_post_scan(struct il_priv *il);
|
||||
|
||||
/* rates */
|
||||
extern const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945];
|
||||
|
@ -80,14 +80,14 @@ struct statistics_general_data {
|
||||
u32 beacon_energy_c;
|
||||
};
|
||||
|
||||
void il4965_calib_free_results(struct il_priv *priv)
|
||||
void il4965_calib_free_results(struct il_priv *il)
|
||||
{
|
||||
int 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;
|
||||
kfree(il->calib_results[i].buf);
|
||||
il->calib_results[i].buf = NULL;
|
||||
il->calib_results[i].buf_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ void il4965_calib_free_results(struct il_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 il4965_sens_energy_cck(struct il_priv *priv,
|
||||
static int il4965_sens_energy_cck(struct il_priv *il,
|
||||
u32 norm_fa,
|
||||
u32 rx_enable_time,
|
||||
struct statistics_general_data *rx_info)
|
||||
@ -130,9 +130,9 @@ static int il4965_sens_energy_cck(struct il_priv *priv,
|
||||
u32 max_false_alarms = MAX_FA_CCK * rx_enable_time;
|
||||
u32 min_false_alarms = MIN_FA_CCK * rx_enable_time;
|
||||
struct il_sensitivity_data *data = NULL;
|
||||
const struct il_sensitivity_ranges *ranges = priv->hw_params.sens;
|
||||
const struct il_sensitivity_ranges *ranges = il->hw_params.sens;
|
||||
|
||||
data = &(priv->sensitivity_data);
|
||||
data = &(il->sensitivity_data);
|
||||
|
||||
data->nrg_auto_corr_silence_diff = 0;
|
||||
|
||||
@ -160,7 +160,7 @@ static int il4965_sens_energy_cck(struct il_priv *priv,
|
||||
val = data->nrg_silence_rssi[i];
|
||||
silence_ref = max(silence_ref, val);
|
||||
}
|
||||
IL_DEBUG_CALIB(priv, "silence a %u, b %u, c %u, 20-bcn max %u\n",
|
||||
IL_DEBUG_CALIB(il, "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 il4965_sens_energy_cck(struct il_priv *priv,
|
||||
max_nrg_cck = (u32) max(max_nrg_cck, (data->nrg_value[i]));
|
||||
max_nrg_cck += 6;
|
||||
|
||||
IL_DEBUG_CALIB(priv, "rx energy a %u, b %u, c %u, 10-bcn max/min %u\n",
|
||||
IL_DEBUG_CALIB(il, "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,15 +194,15 @@ static int il4965_sens_energy_cck(struct il_priv *priv,
|
||||
data->num_in_cck_no_fa++;
|
||||
else
|
||||
data->num_in_cck_no_fa = 0;
|
||||
IL_DEBUG_CALIB(priv, "consecutive bcns with few false alarms = %u\n",
|
||||
IL_DEBUG_CALIB(il, "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)) {
|
||||
IL_DEBUG_CALIB(priv, "norm FA %u > max FA %u\n",
|
||||
IL_DEBUG_CALIB(il, "norm FA %u > max FA %u\n",
|
||||
false_alarms, max_false_alarms);
|
||||
IL_DEBUG_CALIB(priv, "... reducing sensitivity\n");
|
||||
IL_DEBUG_CALIB(il, "... 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;
|
||||
@ -219,7 +219,7 @@ static int il4965_sens_energy_cck(struct il_priv *priv,
|
||||
data->nrg_auto_corr_silence_diff = (s32)data->nrg_silence_ref -
|
||||
(s32)silence_ref;
|
||||
|
||||
IL_DEBUG_CALIB(priv,
|
||||
IL_DEBUG_CALIB(il,
|
||||
"norm FA %u < min FA %u, silence diff %d\n",
|
||||
false_alarms, min_false_alarms,
|
||||
data->nrg_auto_corr_silence_diff);
|
||||
@ -234,18 +234,18 @@ static int il4965_sens_energy_cck(struct il_priv *priv,
|
||||
((data->nrg_auto_corr_silence_diff > NRG_DIFF) ||
|
||||
(data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) {
|
||||
|
||||
IL_DEBUG_CALIB(priv, "... increasing sensitivity\n");
|
||||
IL_DEBUG_CALIB(il, "... 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 {
|
||||
IL_DEBUG_CALIB(priv,
|
||||
IL_DEBUG_CALIB(il,
|
||||
"... but not changing sensitivity\n");
|
||||
}
|
||||
|
||||
/* Else we got a healthy number of false alarms, keep status quo */
|
||||
} else {
|
||||
IL_DEBUG_CALIB(priv, " FA in safe zone\n");
|
||||
IL_DEBUG_CALIB(il, " FA in safe zone\n");
|
||||
data->nrg_curr_state = IL_FA_GOOD_RANGE;
|
||||
|
||||
/* Store for use in "fewer than desired" with later beacon */
|
||||
@ -255,7 +255,7 @@ static int il4965_sens_energy_cck(struct il_priv *priv,
|
||||
* give it some extra margin by reducing sensitivity again
|
||||
* (but don't go below measured energy of desired Rx) */
|
||||
if (IL_FA_TOO_MANY == data->nrg_prev_state) {
|
||||
IL_DEBUG_CALIB(priv, "... increasing margin\n");
|
||||
IL_DEBUG_CALIB(il, "... 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 il4965_sens_energy_cck(struct il_priv *priv,
|
||||
* Lower value is higher energy, so we use max()!
|
||||
*/
|
||||
data->nrg_th_cck = max(max_nrg_cck, data->nrg_th_cck);
|
||||
IL_DEBUG_CALIB(priv, "new nrg_th_cck %u\n", data->nrg_th_cck);
|
||||
IL_DEBUG_CALIB(il, "new nrg_th_cck %u\n", data->nrg_th_cck);
|
||||
|
||||
data->nrg_prev_state = data->nrg_curr_state;
|
||||
|
||||
@ -306,7 +306,7 @@ static int il4965_sens_energy_cck(struct il_priv *priv,
|
||||
}
|
||||
|
||||
|
||||
static int il4965_sens_auto_corr_ofdm(struct il_priv *priv,
|
||||
static int il4965_sens_auto_corr_ofdm(struct il_priv *il,
|
||||
u32 norm_fa,
|
||||
u32 rx_enable_time)
|
||||
{
|
||||
@ -315,14 +315,14 @@ static int il4965_sens_auto_corr_ofdm(struct il_priv *priv,
|
||||
u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time;
|
||||
u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time;
|
||||
struct il_sensitivity_data *data = NULL;
|
||||
const struct il_sensitivity_ranges *ranges = priv->hw_params.sens;
|
||||
const struct il_sensitivity_ranges *ranges = il->hw_params.sens;
|
||||
|
||||
data = &(priv->sensitivity_data);
|
||||
data = &(il->sensitivity_data);
|
||||
|
||||
/* If we got too many false alarms this time, reduce sensitivity */
|
||||
if (false_alarms > max_false_alarms) {
|
||||
|
||||
IL_DEBUG_CALIB(priv, "norm FA %u > max FA %u)\n",
|
||||
IL_DEBUG_CALIB(il, "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 il4965_sens_auto_corr_ofdm(struct il_priv *priv,
|
||||
/* Else if we got fewer than desired, increase sensitivity */
|
||||
else if (false_alarms < min_false_alarms) {
|
||||
|
||||
IL_DEBUG_CALIB(priv, "norm FA %u < min FA %u\n",
|
||||
IL_DEBUG_CALIB(il, "norm FA %u < min FA %u\n",
|
||||
false_alarms, min_false_alarms);
|
||||
|
||||
val = data->auto_corr_ofdm - AUTO_CORR_STEP_OFDM;
|
||||
@ -364,13 +364,13 @@ static int il4965_sens_auto_corr_ofdm(struct il_priv *priv,
|
||||
data->auto_corr_ofdm_mrc_x1 =
|
||||
max((u32)ranges->auto_corr_min_ofdm_mrc_x1, val);
|
||||
} else {
|
||||
IL_DEBUG_CALIB(priv, "min FA %u < norm FA %u < max FA %u OK\n",
|
||||
IL_DEBUG_CALIB(il, "min FA %u < norm FA %u < max FA %u OK\n",
|
||||
min_false_alarms, false_alarms, max_false_alarms);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void il4965_prepare_legacy_sensitivity_tbl(struct il_priv *priv,
|
||||
static void il4965_prepare_legacy_sensitivity_tbl(struct il_priv *il,
|
||||
struct il_sensitivity_data *data,
|
||||
__le16 *tbl)
|
||||
{
|
||||
@ -400,18 +400,18 @@ static void il4965_prepare_legacy_sensitivity_tbl(struct il_priv *priv,
|
||||
tbl[HD_OFDM_ENERGY_TH_IN_INDEX] =
|
||||
cpu_to_le16(data->nrg_th_cca);
|
||||
|
||||
IL_DEBUG_CALIB(priv, "ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n",
|
||||
IL_DEBUG_CALIB(il, "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);
|
||||
|
||||
IL_DEBUG_CALIB(priv, "cck: ac %u mrc %u thresh %u\n",
|
||||
IL_DEBUG_CALIB(il, "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 il4965_sensitivity_write(struct il_priv *priv)
|
||||
static int il4965_sensitivity_write(struct il_priv *il)
|
||||
{
|
||||
struct il_sensitivity_cmd cmd;
|
||||
struct il_sensitivity_data *data = NULL;
|
||||
@ -422,43 +422,43 @@ static int il4965_sensitivity_write(struct il_priv *priv)
|
||||
.data = &cmd,
|
||||
};
|
||||
|
||||
data = &(priv->sensitivity_data);
|
||||
data = &(il->sensitivity_data);
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
|
||||
il4965_prepare_legacy_sensitivity_tbl(priv, data, &cmd.table[0]);
|
||||
il4965_prepare_legacy_sensitivity_tbl(il, data, &cmd.table[0]);
|
||||
|
||||
/* Update uCode's "work" table, and copy it to DSP */
|
||||
cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE;
|
||||
|
||||
/* Don't send command to uCode if nothing has changed */
|
||||
if (!memcmp(&cmd.table[0], &(priv->sensitivity_tbl[0]),
|
||||
if (!memcmp(&cmd.table[0], &(il->sensitivity_tbl[0]),
|
||||
sizeof(u16)*HD_TABLE_SIZE)) {
|
||||
IL_DEBUG_CALIB(priv, "No change in SENSITIVITY_CMD\n");
|
||||
IL_DEBUG_CALIB(il, "No change in SENSITIVITY_CMD\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Copy table for comparison next time */
|
||||
memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]),
|
||||
memcpy(&(il->sensitivity_tbl[0]), &(cmd.table[0]),
|
||||
sizeof(u16)*HD_TABLE_SIZE);
|
||||
|
||||
return il_send_cmd(priv, &cmd_out);
|
||||
return il_send_cmd(il, &cmd_out);
|
||||
}
|
||||
|
||||
void il4965_init_sensitivity(struct il_priv *priv)
|
||||
void il4965_init_sensitivity(struct il_priv *il)
|
||||
{
|
||||
int ret = 0;
|
||||
int i;
|
||||
struct il_sensitivity_data *data = NULL;
|
||||
const struct il_sensitivity_ranges *ranges = priv->hw_params.sens;
|
||||
const struct il_sensitivity_ranges *ranges = il->hw_params.sens;
|
||||
|
||||
if (priv->disable_sens_cal)
|
||||
if (il->disable_sens_cal)
|
||||
return;
|
||||
|
||||
IL_DEBUG_CALIB(priv, "Start il4965_init_sensitivity\n");
|
||||
IL_DEBUG_CALIB(il, "Start il4965_init_sensitivity\n");
|
||||
|
||||
/* Clear driver's sensitivity algo data */
|
||||
data = &(priv->sensitivity_data);
|
||||
data = &(il->sensitivity_data);
|
||||
|
||||
if (ranges == NULL)
|
||||
return;
|
||||
@ -495,11 +495,11 @@ void il4965_init_sensitivity(struct il_priv *priv)
|
||||
data->last_bad_plcp_cnt_cck = 0;
|
||||
data->last_fa_cnt_cck = 0;
|
||||
|
||||
ret |= il4965_sensitivity_write(priv);
|
||||
IL_DEBUG_CALIB(priv, "<<return 0x%X\n", ret);
|
||||
ret |= il4965_sensitivity_write(il);
|
||||
IL_DEBUG_CALIB(il, "<<return 0x%X\n", ret);
|
||||
}
|
||||
|
||||
void il4965_sensitivity_calibration(struct il_priv *priv, void *resp)
|
||||
void il4965_sensitivity_calibration(struct il_priv *il, void *resp)
|
||||
{
|
||||
u32 rx_enable_time;
|
||||
u32 fa_cck;
|
||||
@ -514,25 +514,25 @@ void il4965_sensitivity_calibration(struct il_priv *priv, void *resp)
|
||||
unsigned long flags;
|
||||
struct statistics_general_data statis;
|
||||
|
||||
if (priv->disable_sens_cal)
|
||||
if (il->disable_sens_cal)
|
||||
return;
|
||||
|
||||
data = &(priv->sensitivity_data);
|
||||
data = &(il->sensitivity_data);
|
||||
|
||||
if (!il_is_any_associated(priv)) {
|
||||
IL_DEBUG_CALIB(priv, "<< - not associated\n");
|
||||
if (!il_is_any_associated(il)) {
|
||||
IL_DEBUG_CALIB(il, "<< - not associated\n");
|
||||
return;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
spin_lock_irqsave(&il->lock, flags);
|
||||
|
||||
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) {
|
||||
IL_DEBUG_CALIB(priv, "<< invalid data.\n");
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
IL_DEBUG_CALIB(il, "<< invalid data.\n");
|
||||
spin_unlock_irqrestore(&il->lock, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -556,12 +556,12 @@ void il4965_sensitivity_calibration(struct il_priv *priv, void *resp)
|
||||
statis.beacon_energy_c =
|
||||
le32_to_cpu(rx_info->beacon_energy_c);
|
||||
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
spin_unlock_irqrestore(&il->lock, flags);
|
||||
|
||||
IL_DEBUG_CALIB(priv, "rx_enable_time = %u usecs\n", rx_enable_time);
|
||||
IL_DEBUG_CALIB(il, "rx_enable_time = %u usecs\n", rx_enable_time);
|
||||
|
||||
if (!rx_enable_time) {
|
||||
IL_DEBUG_CALIB(priv, "<< RX Enable Time == 0!\n");
|
||||
IL_DEBUG_CALIB(il, "<< RX Enable Time == 0!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -600,14 +600,14 @@ void il4965_sensitivity_calibration(struct il_priv *priv, void *resp)
|
||||
norm_fa_ofdm = fa_ofdm + bad_plcp_ofdm;
|
||||
norm_fa_cck = fa_cck + bad_plcp_cck;
|
||||
|
||||
IL_DEBUG_CALIB(priv,
|
||||
IL_DEBUG_CALIB(il,
|
||||
"cck: fa %u badp %u ofdm: fa %u badp %u\n", fa_cck,
|
||||
bad_plcp_cck, fa_ofdm, bad_plcp_ofdm);
|
||||
|
||||
il4965_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time);
|
||||
il4965_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis);
|
||||
il4965_sens_auto_corr_ofdm(il, norm_fa_ofdm, rx_enable_time);
|
||||
il4965_sens_energy_cck(il, norm_fa_cck, rx_enable_time, &statis);
|
||||
|
||||
il4965_sensitivity_write(priv);
|
||||
il4965_sensitivity_write(il);
|
||||
}
|
||||
|
||||
static inline u8 il4965_find_first_chain(u8 mask)
|
||||
@ -624,7 +624,7 @@ static inline u8 il4965_find_first_chain(u8 mask)
|
||||
* disconnected.
|
||||
*/
|
||||
static void
|
||||
il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig,
|
||||
il4965_find_disconn_antenna(struct il_priv *il, u32* average_sig,
|
||||
struct il_chain_noise_data *data)
|
||||
{
|
||||
u32 active_chains = 0;
|
||||
@ -635,11 +635,11 @@ il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig,
|
||||
u16 i = 0;
|
||||
|
||||
average_sig[0] = data->chain_signal_a /
|
||||
priv->cfg->base_params->chain_noise_num_beacons;
|
||||
il->cfg->base_params->chain_noise_num_beacons;
|
||||
average_sig[1] = data->chain_signal_b /
|
||||
priv->cfg->base_params->chain_noise_num_beacons;
|
||||
il->cfg->base_params->chain_noise_num_beacons;
|
||||
average_sig[2] = data->chain_signal_c /
|
||||
priv->cfg->base_params->chain_noise_num_beacons;
|
||||
il->cfg->base_params->chain_noise_num_beacons;
|
||||
|
||||
if (average_sig[0] >= average_sig[1]) {
|
||||
max_average_sig = average_sig[0];
|
||||
@ -657,9 +657,9 @@ il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig,
|
||||
active_chains = (1 << max_average_sig_antenna_i);
|
||||
}
|
||||
|
||||
IL_DEBUG_CALIB(priv, "average_sig: a %d b %d c %d\n",
|
||||
IL_DEBUG_CALIB(il, "average_sig: a %d b %d c %d\n",
|
||||
average_sig[0], average_sig[1], average_sig[2]);
|
||||
IL_DEBUG_CALIB(priv, "max_average_sig = %d, antenna %d\n",
|
||||
IL_DEBUG_CALIB(il, "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 @@ il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig,
|
||||
data->disconn_array[i] = 1;
|
||||
else
|
||||
active_chains |= (1 << i);
|
||||
IL_DEBUG_CALIB(priv, "i = %d rssiDelta = %d "
|
||||
IL_DEBUG_CALIB(il, "i = %d rssiDelta = %d "
|
||||
"disconn_array[i] = %d\n",
|
||||
i, rssi_delta, data->disconn_array[i]);
|
||||
}
|
||||
@ -689,58 +689,58 @@ il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig,
|
||||
* To be safe, simply mask out any chains that we know
|
||||
* are not on the device.
|
||||
*/
|
||||
active_chains &= priv->hw_params.valid_rx_ant;
|
||||
active_chains &= il->hw_params.valid_rx_ant;
|
||||
|
||||
num_tx_chains = 0;
|
||||
for (i = 0; i < NUM_RX_CHAINS; i++) {
|
||||
/* loops on all the bits of
|
||||
* priv->hw_setting.valid_tx_ant */
|
||||
* il->hw_setting.valid_tx_ant */
|
||||
u8 ant_msk = (1 << i);
|
||||
if (!(priv->hw_params.valid_tx_ant & ant_msk))
|
||||
if (!(il->hw_params.valid_tx_ant & ant_msk))
|
||||
continue;
|
||||
|
||||
num_tx_chains++;
|
||||
if (data->disconn_array[i] == 0)
|
||||
/* there is a Tx antenna connected */
|
||||
break;
|
||||
if (num_tx_chains == priv->hw_params.tx_chains_num &&
|
||||
if (num_tx_chains == il->hw_params.tx_chains_num &&
|
||||
data->disconn_array[i]) {
|
||||
/*
|
||||
* If all chains are disconnected
|
||||
* connect the first valid tx chain
|
||||
*/
|
||||
first_chain =
|
||||
il4965_find_first_chain(priv->cfg->valid_tx_ant);
|
||||
il4965_find_first_chain(il->cfg->valid_tx_ant);
|
||||
data->disconn_array[first_chain] = 0;
|
||||
active_chains |= BIT(first_chain);
|
||||
IL_DEBUG_CALIB(priv,
|
||||
IL_DEBUG_CALIB(il,
|
||||
"All Tx chains are disconnected W/A - declare %d as connected\n",
|
||||
first_chain);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (active_chains != priv->hw_params.valid_rx_ant &&
|
||||
active_chains != priv->chain_noise_data.active_chains)
|
||||
IL_DEBUG_CALIB(priv,
|
||||
if (active_chains != il->hw_params.valid_rx_ant &&
|
||||
active_chains != il->chain_noise_data.active_chains)
|
||||
IL_DEBUG_CALIB(il,
|
||||
"Detected that not all antennas are connected! "
|
||||
"Connected: %#x, valid: %#x.\n",
|
||||
active_chains, priv->hw_params.valid_rx_ant);
|
||||
active_chains, il->hw_params.valid_rx_ant);
|
||||
|
||||
/* Save for use within RXON, TX, SCAN commands, etc. */
|
||||
data->active_chains = active_chains;
|
||||
IL_DEBUG_CALIB(priv, "active_chains (bitwise) = 0x%x\n",
|
||||
IL_DEBUG_CALIB(il, "active_chains (bitwise) = 0x%x\n",
|
||||
active_chains);
|
||||
}
|
||||
|
||||
static void il4965_gain_computation(struct il_priv *priv,
|
||||
static void il4965_gain_computation(struct il_priv *il,
|
||||
u32 *average_noise,
|
||||
u16 min_average_noise_antenna_i,
|
||||
u32 min_average_noise,
|
||||
u8 default_chain)
|
||||
{
|
||||
int i, ret;
|
||||
struct il_chain_noise_data *data = &priv->chain_noise_data;
|
||||
struct il_chain_noise_data *data = &il->chain_noise_data;
|
||||
|
||||
data->delta_gain_code[min_average_noise_antenna_i] = 0;
|
||||
|
||||
@ -762,7 +762,7 @@ static void il4965_gain_computation(struct il_priv *priv,
|
||||
data->delta_gain_code[i] = 0;
|
||||
}
|
||||
}
|
||||
IL_DEBUG_CALIB(priv, "delta_gain_codes: a %d b %d c %d\n",
|
||||
IL_DEBUG_CALIB(il, "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]);
|
||||
@ -777,10 +777,10 @@ static void il4965_gain_computation(struct il_priv *priv,
|
||||
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 = il_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
|
||||
ret = il_send_cmd_pdu(il, REPLY_PHY_CALIBRATION_CMD,
|
||||
sizeof(cmd), &cmd);
|
||||
if (ret)
|
||||
IL_DEBUG_CALIB(priv, "fail sending cmd "
|
||||
IL_DEBUG_CALIB(il, "fail sending cmd "
|
||||
"REPLY_PHY_CALIBRATION_CMD\n");
|
||||
|
||||
/* TODO we might want recalculate
|
||||
@ -799,7 +799,7 @@ static void il4965_gain_computation(struct il_priv *priv,
|
||||
* 1) Which antennas are connected.
|
||||
* 2) Differential rx gain settings to balance the 3 receivers.
|
||||
*/
|
||||
void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp)
|
||||
void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)
|
||||
{
|
||||
struct il_chain_noise_data *data = NULL;
|
||||
|
||||
@ -821,12 +821,12 @@ void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp)
|
||||
unsigned long flags;
|
||||
struct statistics_rx_non_phy *rx_info;
|
||||
|
||||
struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
|
||||
struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS];
|
||||
|
||||
if (priv->disable_chain_noise_cal)
|
||||
if (il->disable_chain_noise_cal)
|
||||
return;
|
||||
|
||||
data = &(priv->chain_noise_data);
|
||||
data = &(il->chain_noise_data);
|
||||
|
||||
/*
|
||||
* Accumulate just the first "chain_noise_num_beacons" after
|
||||
@ -834,18 +834,18 @@ void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp)
|
||||
*/
|
||||
if (data->state != IL_CHAIN_NOISE_ACCUMULATE) {
|
||||
if (data->state == IL_CHAIN_NOISE_ALIVE)
|
||||
IL_DEBUG_CALIB(priv, "Wait for noise calib reset\n");
|
||||
IL_DEBUG_CALIB(il, "Wait for noise calib reset\n");
|
||||
return;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
spin_lock_irqsave(&il->lock, flags);
|
||||
|
||||
rx_info = &(((struct il_notif_statistics *)stat_resp)->
|
||||
rx.general);
|
||||
|
||||
if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
|
||||
IL_DEBUG_CALIB(priv, " << Interference data unavailable\n");
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
IL_DEBUG_CALIB(il, " << Interference data unavailable\n");
|
||||
spin_unlock_irqrestore(&il->lock, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -861,9 +861,9 @@ void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp)
|
||||
/* Make sure we accumulate data for just the associated channel
|
||||
* (even if scanning). */
|
||||
if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) {
|
||||
IL_DEBUG_CALIB(priv, "Stats not from chan=%d, band24=%d\n",
|
||||
IL_DEBUG_CALIB(il, "Stats not from chan=%d, band24=%d\n",
|
||||
rxon_chnum, rxon_band24);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
spin_unlock_irqrestore(&il->lock, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -882,7 +882,7 @@ void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp)
|
||||
chain_sig_b = le32_to_cpu(rx_info->beacon_rssi_b) & IN_BAND_FILTER;
|
||||
chain_sig_c = le32_to_cpu(rx_info->beacon_rssi_c) & IN_BAND_FILTER;
|
||||
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
spin_unlock_irqrestore(&il->lock, flags);
|
||||
|
||||
data->beacon_count++;
|
||||
|
||||
@ -894,30 +894,30 @@ void il4965_chain_noise_calibration(struct il_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);
|
||||
|
||||
IL_DEBUG_CALIB(priv, "chan=%d, band24=%d, beacon=%d\n",
|
||||
IL_DEBUG_CALIB(il, "chan=%d, band24=%d, beacon=%d\n",
|
||||
rxon_chnum, rxon_band24, data->beacon_count);
|
||||
IL_DEBUG_CALIB(priv, "chain_sig: a %d b %d c %d\n",
|
||||
IL_DEBUG_CALIB(il, "chain_sig: a %d b %d c %d\n",
|
||||
chain_sig_a, chain_sig_b, chain_sig_c);
|
||||
IL_DEBUG_CALIB(priv, "chain_noise: a %d b %d c %d\n",
|
||||
IL_DEBUG_CALIB(il, "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:
|
||||
* 1) Disconnected antennas (using signal strengths)
|
||||
* 2) Differential gain (using silence noise) to balance receivers */
|
||||
if (data->beacon_count !=
|
||||
priv->cfg->base_params->chain_noise_num_beacons)
|
||||
il->cfg->base_params->chain_noise_num_beacons)
|
||||
return;
|
||||
|
||||
/* Analyze signal for disconnected antenna */
|
||||
il4965_find_disconn_antenna(priv, average_sig, data);
|
||||
il4965_find_disconn_antenna(il, average_sig, data);
|
||||
|
||||
/* Analyze noise for rx balance */
|
||||
average_noise[0] = data->chain_noise_a /
|
||||
priv->cfg->base_params->chain_noise_num_beacons;
|
||||
il->cfg->base_params->chain_noise_num_beacons;
|
||||
average_noise[1] = data->chain_noise_b /
|
||||
priv->cfg->base_params->chain_noise_num_beacons;
|
||||
il->cfg->base_params->chain_noise_num_beacons;
|
||||
average_noise[2] = data->chain_noise_c /
|
||||
priv->cfg->base_params->chain_noise_num_beacons;
|
||||
il->cfg->base_params->chain_noise_num_beacons;
|
||||
|
||||
for (i = 0; i < NUM_RX_CHAINS; i++) {
|
||||
if (!(data->disconn_array[i]) &&
|
||||
@ -929,39 +929,39 @@ void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp)
|
||||
}
|
||||
}
|
||||
|
||||
IL_DEBUG_CALIB(priv, "average_noise: a %d b %d c %d\n",
|
||||
IL_DEBUG_CALIB(il, "average_noise: a %d b %d c %d\n",
|
||||
average_noise[0], average_noise[1],
|
||||
average_noise[2]);
|
||||
|
||||
IL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n",
|
||||
IL_DEBUG_CALIB(il, "min_average_noise = %d, antenna %d\n",
|
||||
min_average_noise, min_average_noise_antenna_i);
|
||||
|
||||
il4965_gain_computation(priv, average_noise,
|
||||
il4965_gain_computation(il, average_noise,
|
||||
min_average_noise_antenna_i, min_average_noise,
|
||||
il4965_find_first_chain(priv->cfg->valid_rx_ant));
|
||||
il4965_find_first_chain(il->cfg->valid_rx_ant));
|
||||
|
||||
/* Some power changes may have been made during the calibration.
|
||||
* Update and commit the RXON
|
||||
*/
|
||||
if (priv->cfg->ops->lib->update_chain_flags)
|
||||
priv->cfg->ops->lib->update_chain_flags(priv);
|
||||
if (il->cfg->ops->lib->update_chain_flags)
|
||||
il->cfg->ops->lib->update_chain_flags(il);
|
||||
|
||||
data->state = IL_CHAIN_NOISE_DONE;
|
||||
il_power_update_mode(priv, false);
|
||||
il_power_update_mode(il, false);
|
||||
}
|
||||
|
||||
void il4965_reset_run_time_calib(struct il_priv *priv)
|
||||
void il4965_reset_run_time_calib(struct il_priv *il)
|
||||
{
|
||||
int i;
|
||||
memset(&(priv->sensitivity_data), 0,
|
||||
memset(&(il->sensitivity_data), 0,
|
||||
sizeof(struct il_sensitivity_data));
|
||||
memset(&(priv->chain_noise_data), 0,
|
||||
memset(&(il->chain_noise_data), 0,
|
||||
sizeof(struct il_chain_noise_data));
|
||||
for (i = 0; i < NUM_RX_CHAINS; i++)
|
||||
priv->chain_noise_data.delta_gain_code[i] =
|
||||
il->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 */
|
||||
il_send_statistics_request(priv, CMD_ASYNC, true);
|
||||
il_send_statistics_request(il, CMD_ASYNC, true);
|
||||
}
|
||||
|
@ -66,10 +66,10 @@
|
||||
#include "iwl-core.h"
|
||||
#include "iwl-commands.h"
|
||||
|
||||
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);
|
||||
void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp);
|
||||
void il4965_sensitivity_calibration(struct il_priv *il, void *resp);
|
||||
void il4965_init_sensitivity(struct il_priv *il);
|
||||
void il4965_reset_run_time_calib(struct il_priv *il);
|
||||
void il4965_calib_free_results(struct il_priv *il);
|
||||
|
||||
#endif /* __il_4965_calib_h__ */
|
||||
|
@ -33,12 +33,12 @@ static const char *fmt_table = " %-30s %10u %10u %10u %10u\n";
|
||||
static const char *fmt_header =
|
||||
"%-32s current cumulative delta max\n";
|
||||
|
||||
static int il4965_statistics_flag(struct il_priv *priv, char *buf, int bufsz)
|
||||
static int il4965_statistics_flag(struct il_priv *il, char *buf, int bufsz)
|
||||
{
|
||||
int p = 0;
|
||||
u32 flag;
|
||||
|
||||
flag = le32_to_cpu(priv->_4965.statistics.flag);
|
||||
flag = le32_to_cpu(il->_4965.statistics.flag);
|
||||
|
||||
p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag);
|
||||
if (flag & UCODE_STATISTICS_CLEAR_MSK)
|
||||
@ -57,7 +57,7 @@ static int il4965_statistics_flag(struct il_priv *priv, char *buf, int bufsz)
|
||||
ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int pos = 0;
|
||||
char *buf;
|
||||
int bufsz = sizeof(struct statistics_rx_phy) * 40 +
|
||||
@ -70,12 +70,12 @@ ssize_t il4965_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 (!il_is_alive(priv))
|
||||
if (!il_is_alive(il))
|
||||
return -EAGAIN;
|
||||
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate Buffer\n");
|
||||
IL_ERR(il, "Can not allocate Buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -84,24 +84,24 @@ ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,
|
||||
* the last statistics notification from uCode
|
||||
* might not reflect the current uCode activity
|
||||
*/
|
||||
ofdm = &priv->_4965.statistics.rx.ofdm;
|
||||
cck = &priv->_4965.statistics.rx.cck;
|
||||
general = &priv->_4965.statistics.rx.general;
|
||||
ht = &priv->_4965.statistics.rx.ofdm_ht;
|
||||
accum_ofdm = &priv->_4965.accum_statistics.rx.ofdm;
|
||||
accum_cck = &priv->_4965.accum_statistics.rx.cck;
|
||||
accum_general = &priv->_4965.accum_statistics.rx.general;
|
||||
accum_ht = &priv->_4965.accum_statistics.rx.ofdm_ht;
|
||||
delta_ofdm = &priv->_4965.delta_statistics.rx.ofdm;
|
||||
delta_cck = &priv->_4965.delta_statistics.rx.cck;
|
||||
delta_general = &priv->_4965.delta_statistics.rx.general;
|
||||
delta_ht = &priv->_4965.delta_statistics.rx.ofdm_ht;
|
||||
max_ofdm = &priv->_4965.max_delta.rx.ofdm;
|
||||
max_cck = &priv->_4965.max_delta.rx.cck;
|
||||
max_general = &priv->_4965.max_delta.rx.general;
|
||||
max_ht = &priv->_4965.max_delta.rx.ofdm_ht;
|
||||
ofdm = &il->_4965.statistics.rx.ofdm;
|
||||
cck = &il->_4965.statistics.rx.cck;
|
||||
general = &il->_4965.statistics.rx.general;
|
||||
ht = &il->_4965.statistics.rx.ofdm_ht;
|
||||
accum_ofdm = &il->_4965.accum_statistics.rx.ofdm;
|
||||
accum_cck = &il->_4965.accum_statistics.rx.cck;
|
||||
accum_general = &il->_4965.accum_statistics.rx.general;
|
||||
accum_ht = &il->_4965.accum_statistics.rx.ofdm_ht;
|
||||
delta_ofdm = &il->_4965.delta_statistics.rx.ofdm;
|
||||
delta_cck = &il->_4965.delta_statistics.rx.cck;
|
||||
delta_general = &il->_4965.delta_statistics.rx.general;
|
||||
delta_ht = &il->_4965.delta_statistics.rx.ofdm_ht;
|
||||
max_ofdm = &il->_4965.max_delta.rx.ofdm;
|
||||
max_cck = &il->_4965.max_delta.rx.cck;
|
||||
max_general = &il->_4965.max_delta.rx.general;
|
||||
max_ht = &il->_4965.max_delta.rx.ofdm_ht;
|
||||
|
||||
pos += il4965_statistics_flag(priv, buf, bufsz);
|
||||
pos += il4965_statistics_flag(il, buf, bufsz);
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
fmt_header, "Statistics_Rx - OFDM:");
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
@ -489,19 +489,19 @@ ssize_t il4965_ucode_tx_stats_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = 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 (!il_is_alive(priv))
|
||||
if (!il_is_alive(il))
|
||||
return -EAGAIN;
|
||||
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate Buffer\n");
|
||||
IL_ERR(il, "Can not allocate Buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -509,12 +509,12 @@ ssize_t il4965_ucode_tx_stats_read(struct file *file,
|
||||
* the last statistics notification from uCode
|
||||
* might not reflect the current uCode activity
|
||||
*/
|
||||
tx = &priv->_4965.statistics.tx;
|
||||
accum_tx = &priv->_4965.accum_statistics.tx;
|
||||
delta_tx = &priv->_4965.delta_statistics.tx;
|
||||
max_tx = &priv->_4965.max_delta.tx;
|
||||
tx = &il->_4965.statistics.tx;
|
||||
accum_tx = &il->_4965.accum_statistics.tx;
|
||||
delta_tx = &il->_4965.delta_statistics.tx;
|
||||
max_tx = &il->_4965.max_delta.tx;
|
||||
|
||||
pos += il4965_statistics_flag(priv, buf, bufsz);
|
||||
pos += il4965_statistics_flag(il, buf, bufsz);
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
fmt_header, "Statistics_Tx:");
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
@ -664,7 +664,7 @@ ssize_t
|
||||
il4965_ucode_general_stats_read(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int pos = 0;
|
||||
char *buf;
|
||||
int bufsz = sizeof(struct statistics_general) * 10 + 300;
|
||||
@ -674,12 +674,12 @@ il4965_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 (!il_is_alive(priv))
|
||||
if (!il_is_alive(il))
|
||||
return -EAGAIN;
|
||||
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate Buffer\n");
|
||||
IL_ERR(il, "Can not allocate Buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -687,20 +687,20 @@ il4965_ucode_general_stats_read(struct file *file, char __user *user_buf,
|
||||
* the last statistics notification from uCode
|
||||
* might not reflect the current uCode activity
|
||||
*/
|
||||
general = &priv->_4965.statistics.general.common;
|
||||
dbg = &priv->_4965.statistics.general.common.dbg;
|
||||
div = &priv->_4965.statistics.general.common.div;
|
||||
accum_general = &priv->_4965.accum_statistics.general.common;
|
||||
accum_dbg = &priv->_4965.accum_statistics.general.common.dbg;
|
||||
accum_div = &priv->_4965.accum_statistics.general.common.div;
|
||||
delta_general = &priv->_4965.delta_statistics.general.common;
|
||||
max_general = &priv->_4965.max_delta.general.common;
|
||||
delta_dbg = &priv->_4965.delta_statistics.general.common.dbg;
|
||||
max_dbg = &priv->_4965.max_delta.general.common.dbg;
|
||||
delta_div = &priv->_4965.delta_statistics.general.common.div;
|
||||
max_div = &priv->_4965.max_delta.general.common.div;
|
||||
general = &il->_4965.statistics.general.common;
|
||||
dbg = &il->_4965.statistics.general.common.dbg;
|
||||
div = &il->_4965.statistics.general.common.div;
|
||||
accum_general = &il->_4965.accum_statistics.general.common;
|
||||
accum_dbg = &il->_4965.accum_statistics.general.common.dbg;
|
||||
accum_div = &il->_4965.accum_statistics.general.common.div;
|
||||
delta_general = &il->_4965.delta_statistics.general.common;
|
||||
max_general = &il->_4965.max_delta.general.common;
|
||||
delta_dbg = &il->_4965.delta_statistics.general.common.dbg;
|
||||
max_dbg = &il->_4965.max_delta.general.common.dbg;
|
||||
delta_div = &il->_4965.delta_statistics.general.common.div;
|
||||
max_div = &il->_4965.max_delta.general.common.div;
|
||||
|
||||
pos += il4965_statistics_flag(priv, buf, bufsz);
|
||||
pos += il4965_statistics_flag(il, buf, bufsz);
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
fmt_header, "Statistics_General:");
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
|
@ -87,23 +87,23 @@
|
||||
* EEPROM chip, not a single event, so even reads could conflict if they
|
||||
* weren't arbitrated by the semaphore.
|
||||
*/
|
||||
int il4965_eeprom_acquire_semaphore(struct il_priv *priv)
|
||||
int il4965_eeprom_acquire_semaphore(struct il_priv *il)
|
||||
{
|
||||
u16 count;
|
||||
int ret;
|
||||
|
||||
for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) {
|
||||
/* Request semaphore */
|
||||
il_set_bit(priv, CSR_HW_IF_CONFIG_REG,
|
||||
il_set_bit(il, CSR_HW_IF_CONFIG_REG,
|
||||
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
|
||||
|
||||
/* See if we got it */
|
||||
ret = il_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
|
||||
ret = il_poll_bit(il, 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) {
|
||||
IL_DEBUG_IO(priv,
|
||||
IL_DEBUG_IO(il,
|
||||
"Acquired semaphore after %d tries.\n",
|
||||
count+1);
|
||||
return ret;
|
||||
@ -113,42 +113,42 @@ int il4965_eeprom_acquire_semaphore(struct il_priv *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void il4965_eeprom_release_semaphore(struct il_priv *priv)
|
||||
void il4965_eeprom_release_semaphore(struct il_priv *il)
|
||||
{
|
||||
il_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
|
||||
il_clear_bit(il, CSR_HW_IF_CONFIG_REG,
|
||||
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
|
||||
|
||||
}
|
||||
|
||||
int il4965_eeprom_check_version(struct il_priv *priv)
|
||||
int il4965_eeprom_check_version(struct il_priv *il)
|
||||
{
|
||||
u16 eeprom_ver;
|
||||
u16 calib_ver;
|
||||
|
||||
eeprom_ver = il_eeprom_query16(priv, EEPROM_VERSION);
|
||||
calib_ver = il_eeprom_query16(priv,
|
||||
eeprom_ver = il_eeprom_query16(il, EEPROM_VERSION);
|
||||
calib_ver = il_eeprom_query16(il,
|
||||
EEPROM_4965_CALIB_VERSION_OFFSET);
|
||||
|
||||
if (eeprom_ver < priv->cfg->eeprom_ver ||
|
||||
calib_ver < priv->cfg->eeprom_calib_ver)
|
||||
if (eeprom_ver < il->cfg->eeprom_ver ||
|
||||
calib_ver < il->cfg->eeprom_calib_ver)
|
||||
goto err;
|
||||
|
||||
IL_INFO(priv, "device EEPROM VER=0x%x, CALIB=0x%x\n",
|
||||
IL_INFO(il, "device EEPROM VER=0x%x, CALIB=0x%x\n",
|
||||
eeprom_ver, calib_ver);
|
||||
|
||||
return 0;
|
||||
err:
|
||||
IL_ERR(priv, "Unsupported (too old) EEPROM VER=0x%x < 0x%x "
|
||||
IL_ERR(il, "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);
|
||||
eeprom_ver, il->cfg->eeprom_ver,
|
||||
calib_ver, il->cfg->eeprom_calib_ver);
|
||||
return -EINVAL;
|
||||
|
||||
}
|
||||
|
||||
void il4965_eeprom_get_mac(const struct il_priv *priv, u8 *mac)
|
||||
void il4965_eeprom_get_mac(const struct il_priv *il, u8 *mac)
|
||||
{
|
||||
const u8 *addr = il_eeprom_query_addr(priv,
|
||||
const u8 *addr = il_eeprom_query_addr(il,
|
||||
EEPROM_MAC_ADDRESS);
|
||||
memcpy(mac, addr, ETH_ALEN);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
/* Send led command */
|
||||
static int
|
||||
il4965_send_led_cmd(struct il_priv *priv, struct il_led_cmd *led_cmd)
|
||||
il4965_send_led_cmd(struct il_priv *il, struct il_led_cmd *led_cmd)
|
||||
{
|
||||
struct il_host_cmd cmd = {
|
||||
.id = REPLY_LEDS_CMD,
|
||||
@ -55,17 +55,17 @@ il4965_send_led_cmd(struct il_priv *priv, struct il_led_cmd *led_cmd)
|
||||
};
|
||||
u32 reg;
|
||||
|
||||
reg = il_read32(priv, CSR_LED_REG);
|
||||
reg = il_read32(il, CSR_LED_REG);
|
||||
if (reg != (reg & CSR_LED_BSM_CTRL_MSK))
|
||||
il_write32(priv, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK);
|
||||
il_write32(il, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK);
|
||||
|
||||
return il_send_cmd(priv, &cmd);
|
||||
return il_send_cmd(il, &cmd);
|
||||
}
|
||||
|
||||
/* Set led register off */
|
||||
void il4965_led_enable(struct il_priv *priv)
|
||||
void il4965_led_enable(struct il_priv *il)
|
||||
{
|
||||
il_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_ON);
|
||||
il_write32(il, CSR_LED_REG, CSR_LED_REG_TRUN_ON);
|
||||
}
|
||||
|
||||
const struct il_led_ops il4965_led_ops = {
|
||||
|
@ -28,6 +28,6 @@
|
||||
#define __il_4965_led_h__
|
||||
|
||||
extern const struct il_led_ops il4965_led_ops;
|
||||
void il4965_led_enable(struct il_priv *priv);
|
||||
void il4965_led_enable(struct il_priv *il);
|
||||
|
||||
#endif /* __il_4965_led_h__ */
|
||||
|
@ -40,13 +40,13 @@
|
||||
#include "iwl-4965.h"
|
||||
#include "iwl-sta.h"
|
||||
|
||||
void il4965_check_abort_status(struct il_priv *priv,
|
||||
void il4965_check_abort_status(struct il_priv *il,
|
||||
u8 frame_count, u32 status)
|
||||
{
|
||||
if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
|
||||
IL_ERR(priv, "Tx flush command to flush out all frames\n");
|
||||
if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
|
||||
queue_work(priv->workqueue, &priv->tx_flush);
|
||||
IL_ERR(il, "Tx flush command to flush out all frames\n");
|
||||
if (!test_bit(STATUS_EXIT_PENDING, &il->status))
|
||||
queue_work(il->workqueue, &il->tx_flush);
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ struct il_mod_params il4965_mod_params = {
|
||||
/* the rest are 0 by default */
|
||||
};
|
||||
|
||||
void il4965_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq)
|
||||
void il4965_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq)
|
||||
{
|
||||
unsigned long flags;
|
||||
int i;
|
||||
@ -71,10 +71,10 @@ void il4965_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq)
|
||||
/* In the reset function, these buffers may have been allocated
|
||||
* to an SKB, so we need to unmap and free potential storage */
|
||||
if (rxq->pool[i].page != NULL) {
|
||||
pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
|
||||
PAGE_SIZE << priv->hw_params.rx_page_order,
|
||||
pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma,
|
||||
PAGE_SIZE << il->hw_params.rx_page_order,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
__il_free_pages(priv, rxq->pool[i].page);
|
||||
__il_free_pages(il, rxq->pool[i].page);
|
||||
rxq->pool[i].page = NULL;
|
||||
}
|
||||
list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
|
||||
@ -91,29 +91,29 @@ void il4965_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq)
|
||||
spin_unlock_irqrestore(&rxq->lock, flags);
|
||||
}
|
||||
|
||||
int il4965_rx_init(struct il_priv *priv, struct il_rx_queue *rxq)
|
||||
int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq)
|
||||
{
|
||||
u32 rb_size;
|
||||
const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */
|
||||
u32 rb_timeout = 0;
|
||||
|
||||
if (priv->cfg->mod_params->amsdu_size_8K)
|
||||
if (il->cfg->mod_params->amsdu_size_8K)
|
||||
rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K;
|
||||
else
|
||||
rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K;
|
||||
|
||||
/* Stop Rx DMA */
|
||||
il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
|
||||
il_write_direct32(il, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
|
||||
|
||||
/* Reset driver's Rx queue write index */
|
||||
il_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0);
|
||||
il_write_direct32(il, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0);
|
||||
|
||||
/* Tell device where to find RBD circular buffer in DRAM */
|
||||
il_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG,
|
||||
il_write_direct32(il, FH_RSCSR_CHNL0_RBDCB_BASE_REG,
|
||||
(u32)(rxq->bd_dma >> 8));
|
||||
|
||||
/* Tell device where in DRAM to update its Rx status */
|
||||
il_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG,
|
||||
il_write_direct32(il, FH_RSCSR_CHNL0_STTS_WPTR_REG,
|
||||
rxq->rb_stts_dma >> 4);
|
||||
|
||||
/* Enable Rx DMA
|
||||
@ -122,7 +122,7 @@ int il4965_rx_init(struct il_priv *priv, struct il_rx_queue *rxq)
|
||||
* RB timeout 0x10
|
||||
* 256 RBDs
|
||||
*/
|
||||
il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG,
|
||||
il_write_direct32(il, FH_MEM_RCSR_CHNL0_CONFIG_REG,
|
||||
FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL |
|
||||
FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL |
|
||||
FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK |
|
||||
@ -131,77 +131,77 @@ int il4965_rx_init(struct il_priv *priv, struct il_rx_queue *rxq)
|
||||
(rfdnlog << FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS));
|
||||
|
||||
/* Set interrupt coalescing timer to default (2048 usecs) */
|
||||
il_write8(priv, CSR_INT_COALESCING, IL_HOST_INT_TIMEOUT_DEF);
|
||||
il_write8(il, CSR_INT_COALESCING, IL_HOST_INT_TIMEOUT_DEF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void il4965_set_pwr_vmain(struct il_priv *priv)
|
||||
static void il4965_set_pwr_vmain(struct il_priv *il)
|
||||
{
|
||||
/*
|
||||
* (for documentation purposes)
|
||||
* to set power to V_AUX, do:
|
||||
|
||||
if (pci_pme_capable(priv->pci_dev, PCI_D3cold))
|
||||
il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
|
||||
if (pci_pme_capable(il->pci_dev, PCI_D3cold))
|
||||
il_set_bits_mask_prph(il, APMG_PS_CTRL_REG,
|
||||
APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
|
||||
~APMG_PS_CTRL_MSK_PWR_SRC);
|
||||
*/
|
||||
|
||||
il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
|
||||
il_set_bits_mask_prph(il, APMG_PS_CTRL_REG,
|
||||
APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
|
||||
~APMG_PS_CTRL_MSK_PWR_SRC);
|
||||
}
|
||||
|
||||
int il4965_hw_nic_init(struct il_priv *priv)
|
||||
int il4965_hw_nic_init(struct il_priv *il)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct il_rx_queue *rxq = &priv->rxq;
|
||||
struct il_rx_queue *rxq = &il->rxq;
|
||||
int ret;
|
||||
|
||||
/* nic_init */
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
priv->cfg->ops->lib->apm_ops.init(priv);
|
||||
spin_lock_irqsave(&il->lock, flags);
|
||||
il->cfg->ops->lib->apm_ops.init(il);
|
||||
|
||||
/* Set interrupt coalescing calibration timer to default (512 usecs) */
|
||||
il_write8(priv, CSR_INT_COALESCING, IL_HOST_INT_CALIB_TIMEOUT_DEF);
|
||||
il_write8(il, CSR_INT_COALESCING, IL_HOST_INT_CALIB_TIMEOUT_DEF);
|
||||
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
spin_unlock_irqrestore(&il->lock, flags);
|
||||
|
||||
il4965_set_pwr_vmain(priv);
|
||||
il4965_set_pwr_vmain(il);
|
||||
|
||||
priv->cfg->ops->lib->apm_ops.config(priv);
|
||||
il->cfg->ops->lib->apm_ops.config(il);
|
||||
|
||||
/* Allocate the RX queue, or reset if it is already allocated */
|
||||
if (!rxq->bd) {
|
||||
ret = il_rx_queue_alloc(priv);
|
||||
ret = il_rx_queue_alloc(il);
|
||||
if (ret) {
|
||||
IL_ERR(priv, "Unable to initialize Rx queue\n");
|
||||
IL_ERR(il, "Unable to initialize Rx queue\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
} else
|
||||
il4965_rx_queue_reset(priv, rxq);
|
||||
il4965_rx_queue_reset(il, rxq);
|
||||
|
||||
il4965_rx_replenish(priv);
|
||||
il4965_rx_replenish(il);
|
||||
|
||||
il4965_rx_init(priv, rxq);
|
||||
il4965_rx_init(il, rxq);
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
spin_lock_irqsave(&il->lock, flags);
|
||||
|
||||
rxq->need_update = 1;
|
||||
il_rx_queue_update_write_ptr(priv, rxq);
|
||||
il_rx_queue_update_write_ptr(il, rxq);
|
||||
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
spin_unlock_irqrestore(&il->lock, flags);
|
||||
|
||||
/* Allocate or reset and init all Tx and Command queues */
|
||||
if (!priv->txq) {
|
||||
ret = il4965_txq_ctx_alloc(priv);
|
||||
if (!il->txq) {
|
||||
ret = il4965_txq_ctx_alloc(il);
|
||||
if (ret)
|
||||
return ret;
|
||||
} else
|
||||
il4965_txq_ctx_reset(priv);
|
||||
il4965_txq_ctx_reset(il);
|
||||
|
||||
set_bit(STATUS_INIT, &priv->status);
|
||||
set_bit(STATUS_INIT, &il->status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -209,7 +209,7 @@ int il4965_hw_nic_init(struct il_priv *priv)
|
||||
/**
|
||||
* il4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr
|
||||
*/
|
||||
static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *priv,
|
||||
static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *il,
|
||||
dma_addr_t dma_addr)
|
||||
{
|
||||
return cpu_to_le32((u32)(dma_addr >> 8));
|
||||
@ -226,9 +226,9 @@ static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *priv,
|
||||
* also updates the memory address in the firmware to reference the new
|
||||
* target buffer.
|
||||
*/
|
||||
void il4965_rx_queue_restock(struct il_priv *priv)
|
||||
void il4965_rx_queue_restock(struct il_priv *il)
|
||||
{
|
||||
struct il_rx_queue *rxq = &priv->rxq;
|
||||
struct il_rx_queue *rxq = &il->rxq;
|
||||
struct list_head *element;
|
||||
struct il_rx_mem_buffer *rxb;
|
||||
unsigned long flags;
|
||||
@ -245,7 +245,7 @@ void il4965_rx_queue_restock(struct il_priv *priv)
|
||||
list_del(element);
|
||||
|
||||
/* Point to Rx buffer via next RBD in circular buffer */
|
||||
rxq->bd[rxq->write] = il4965_dma_addr2rbd_ptr(priv,
|
||||
rxq->bd[rxq->write] = il4965_dma_addr2rbd_ptr(il,
|
||||
rxb->page_dma);
|
||||
rxq->queue[rxq->write] = rxb;
|
||||
rxq->write = (rxq->write + 1) & RX_QUEUE_MASK;
|
||||
@ -255,7 +255,7 @@ void il4965_rx_queue_restock(struct il_priv *priv)
|
||||
/* If the pre-allocated buffer pool is dropping low, schedule to
|
||||
* refill it */
|
||||
if (rxq->free_count <= RX_LOW_WATERMARK)
|
||||
queue_work(priv->workqueue, &priv->rx_replenish);
|
||||
queue_work(il->workqueue, &il->rx_replenish);
|
||||
|
||||
|
||||
/* If we've added more space for the firmware to place data, tell it.
|
||||
@ -264,7 +264,7 @@ void il4965_rx_queue_restock(struct il_priv *priv)
|
||||
spin_lock_irqsave(&rxq->lock, flags);
|
||||
rxq->need_update = 1;
|
||||
spin_unlock_irqrestore(&rxq->lock, flags);
|
||||
il_rx_queue_update_write_ptr(priv, rxq);
|
||||
il_rx_queue_update_write_ptr(il, rxq);
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,9 +276,9 @@ void il4965_rx_queue_restock(struct il_priv *priv)
|
||||
* Also restock the Rx queue via il_rx_queue_restock.
|
||||
* This is called as a scheduled work item (except for during initialization)
|
||||
*/
|
||||
static void il4965_rx_allocate(struct il_priv *priv, gfp_t priority)
|
||||
static void il4965_rx_allocate(struct il_priv *il, gfp_t priority)
|
||||
{
|
||||
struct il_rx_queue *rxq = &priv->rxq;
|
||||
struct il_rx_queue *rxq = &il->rxq;
|
||||
struct list_head *element;
|
||||
struct il_rx_mem_buffer *rxb;
|
||||
struct page *page;
|
||||
@ -296,20 +296,20 @@ static void il4965_rx_allocate(struct il_priv *priv, gfp_t priority)
|
||||
if (rxq->free_count > RX_LOW_WATERMARK)
|
||||
gfp_mask |= __GFP_NOWARN;
|
||||
|
||||
if (priv->hw_params.rx_page_order > 0)
|
||||
if (il->hw_params.rx_page_order > 0)
|
||||
gfp_mask |= __GFP_COMP;
|
||||
|
||||
/* Alloc a new receive buffer */
|
||||
page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order);
|
||||
page = alloc_pages(gfp_mask, il->hw_params.rx_page_order);
|
||||
if (!page) {
|
||||
if (net_ratelimit())
|
||||
IL_DEBUG_INFO(priv, "alloc_pages failed, "
|
||||
IL_DEBUG_INFO(il, "alloc_pages failed, "
|
||||
"order: %d\n",
|
||||
priv->hw_params.rx_page_order);
|
||||
il->hw_params.rx_page_order);
|
||||
|
||||
if ((rxq->free_count <= RX_LOW_WATERMARK) &&
|
||||
net_ratelimit())
|
||||
IL_CRIT(priv,
|
||||
IL_CRIT(il,
|
||||
"Failed to alloc_pages with %s. "
|
||||
"Only %u free buffers remaining.\n",
|
||||
priority == GFP_ATOMIC ?
|
||||
@ -325,7 +325,7 @@ static void il4965_rx_allocate(struct il_priv *priv, gfp_t priority)
|
||||
|
||||
if (list_empty(&rxq->rx_used)) {
|
||||
spin_unlock_irqrestore(&rxq->lock, flags);
|
||||
__free_pages(page, priv->hw_params.rx_page_order);
|
||||
__free_pages(page, il->hw_params.rx_page_order);
|
||||
return;
|
||||
}
|
||||
element = rxq->rx_used.next;
|
||||
@ -337,8 +337,8 @@ static void il4965_rx_allocate(struct il_priv *priv, gfp_t priority)
|
||||
BUG_ON(rxb->page);
|
||||
rxb->page = page;
|
||||
/* Get physical address of the RB */
|
||||
rxb->page_dma = pci_map_page(priv->pci_dev, page, 0,
|
||||
PAGE_SIZE << priv->hw_params.rx_page_order,
|
||||
rxb->page_dma = pci_map_page(il->pci_dev, page, 0,
|
||||
PAGE_SIZE << il->hw_params.rx_page_order,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
/* dma address must be no more than 36 bits */
|
||||
BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36));
|
||||
@ -349,28 +349,28 @@ static void il4965_rx_allocate(struct il_priv *priv, gfp_t priority)
|
||||
|
||||
list_add_tail(&rxb->list, &rxq->rx_free);
|
||||
rxq->free_count++;
|
||||
priv->alloc_rxb_page++;
|
||||
il->alloc_rxb_page++;
|
||||
|
||||
spin_unlock_irqrestore(&rxq->lock, flags);
|
||||
}
|
||||
}
|
||||
|
||||
void il4965_rx_replenish(struct il_priv *priv)
|
||||
void il4965_rx_replenish(struct il_priv *il)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
il4965_rx_allocate(priv, GFP_KERNEL);
|
||||
il4965_rx_allocate(il, GFP_KERNEL);
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
il4965_rx_queue_restock(priv);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
spin_lock_irqsave(&il->lock, flags);
|
||||
il4965_rx_queue_restock(il);
|
||||
spin_unlock_irqrestore(&il->lock, flags);
|
||||
}
|
||||
|
||||
void il4965_rx_replenish_now(struct il_priv *priv)
|
||||
void il4965_rx_replenish_now(struct il_priv *il)
|
||||
{
|
||||
il4965_rx_allocate(priv, GFP_ATOMIC);
|
||||
il4965_rx_allocate(il, GFP_ATOMIC);
|
||||
|
||||
il4965_rx_queue_restock(priv);
|
||||
il4965_rx_queue_restock(il);
|
||||
}
|
||||
|
||||
/* Assumes that the skb field of the buffers in 'pool' is kept accurate.
|
||||
@ -378,33 +378,33 @@ void il4965_rx_replenish_now(struct il_priv *priv)
|
||||
* This free routine walks the list of POOL entries and if SKB is set to
|
||||
* non NULL it is unmapped and freed
|
||||
*/
|
||||
void il4965_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq)
|
||||
void il4965_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
|
||||
if (rxq->pool[i].page != NULL) {
|
||||
pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
|
||||
PAGE_SIZE << priv->hw_params.rx_page_order,
|
||||
pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma,
|
||||
PAGE_SIZE << il->hw_params.rx_page_order,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
__il_free_pages(priv, rxq->pool[i].page);
|
||||
__il_free_pages(il, rxq->pool[i].page);
|
||||
rxq->pool[i].page = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
|
||||
dma_free_coherent(&il->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
|
||||
rxq->bd_dma);
|
||||
dma_free_coherent(&priv->pci_dev->dev, sizeof(struct il_rb_status),
|
||||
dma_free_coherent(&il->pci_dev->dev, sizeof(struct il_rb_status),
|
||||
rxq->rb_stts, rxq->rb_stts_dma);
|
||||
rxq->bd = NULL;
|
||||
rxq->rb_stts = NULL;
|
||||
}
|
||||
|
||||
int il4965_rxq_stop(struct il_priv *priv)
|
||||
int il4965_rxq_stop(struct il_priv *il)
|
||||
{
|
||||
|
||||
/* stop Rx DMA */
|
||||
il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
|
||||
il_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG,
|
||||
il_write_direct32(il, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
|
||||
il_poll_direct_bit(il, FH_MEM_RSSR_RX_STATUS_REG,
|
||||
FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
|
||||
|
||||
return 0;
|
||||
@ -431,7 +431,7 @@ int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int il4965_calc_rssi(struct il_priv *priv,
|
||||
static int il4965_calc_rssi(struct il_priv *il,
|
||||
struct il_rx_phy_res *rx_resp)
|
||||
{
|
||||
/* data from PHY/DSP regarding signal strength, etc.,
|
||||
@ -456,7 +456,7 @@ static int il4965_calc_rssi(struct il_priv *priv,
|
||||
if (valid_antennae & (1 << i))
|
||||
max_rssi = max(ncphy->rssi_info[i << 1], max_rssi);
|
||||
|
||||
IL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n",
|
||||
IL_DEBUG_STATS(il, "Rssi In A %d B %d C %d Max %d AGC dB %d\n",
|
||||
ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4],
|
||||
max_rssi, agc);
|
||||
|
||||
@ -466,7 +466,7 @@ static int il4965_calc_rssi(struct il_priv *priv,
|
||||
}
|
||||
|
||||
|
||||
static u32 il4965_translate_rx_status(struct il_priv *priv, u32 decrypt_in)
|
||||
static u32 il4965_translate_rx_status(struct il_priv *il, u32 decrypt_in)
|
||||
{
|
||||
u32 decrypt_out = 0;
|
||||
|
||||
@ -519,13 +519,13 @@ static u32 il4965_translate_rx_status(struct il_priv *priv, u32 decrypt_in)
|
||||
break;
|
||||
}
|
||||
|
||||
IL_DEBUG_RX(priv, "decrypt_in:0x%x decrypt_out = 0x%x\n",
|
||||
IL_DEBUG_RX(il, "decrypt_in:0x%x decrypt_out = 0x%x\n",
|
||||
decrypt_in, decrypt_out);
|
||||
|
||||
return decrypt_out;
|
||||
}
|
||||
|
||||
static void il4965_pass_packet_to_mac80211(struct il_priv *priv,
|
||||
static void il4965_pass_packet_to_mac80211(struct il_priv *il,
|
||||
struct ieee80211_hdr *hdr,
|
||||
u16 len,
|
||||
u32 ampdu_status,
|
||||
@ -536,36 +536,36 @@ static void il4965_pass_packet_to_mac80211(struct il_priv *priv,
|
||||
__le16 fc = hdr->frame_control;
|
||||
|
||||
/* We only process data packets if the interface is open */
|
||||
if (unlikely(!priv->is_open)) {
|
||||
IL_DEBUG_DROP_LIMIT(priv,
|
||||
if (unlikely(!il->is_open)) {
|
||||
IL_DEBUG_DROP_LIMIT(il,
|
||||
"Dropping packet while interface is not open.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* In case of HW accelerated crypto and bad decryption, drop */
|
||||
if (!priv->cfg->mod_params->sw_crypto &&
|
||||
il_set_decrypted_flag(priv, hdr, ampdu_status, stats))
|
||||
if (!il->cfg->mod_params->sw_crypto &&
|
||||
il_set_decrypted_flag(il, hdr, ampdu_status, stats))
|
||||
return;
|
||||
|
||||
skb = dev_alloc_skb(128);
|
||||
if (!skb) {
|
||||
IL_ERR(priv, "dev_alloc_skb failed\n");
|
||||
IL_ERR(il, "dev_alloc_skb failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len);
|
||||
|
||||
il_update_stats(priv, false, fc, len);
|
||||
il_update_stats(il, false, fc, len);
|
||||
memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));
|
||||
|
||||
ieee80211_rx(priv->hw, skb);
|
||||
priv->alloc_rxb_page--;
|
||||
ieee80211_rx(il->hw, skb);
|
||||
il->alloc_rxb_page--;
|
||||
rxb->page = NULL;
|
||||
}
|
||||
|
||||
/* Called for REPLY_RX (legacy ABG frames), or
|
||||
* REPLY_RX_MPDU_CMD (HT high-throughput N frames). */
|
||||
void il4965_rx_reply_rx(struct il_priv *priv,
|
||||
void il4965_rx_reply_rx(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb)
|
||||
{
|
||||
struct ieee80211_hdr *header;
|
||||
@ -582,7 +582,7 @@ void il4965_rx_reply_rx(struct il_priv *priv,
|
||||
* REPLY_RX and REPLY_RX_MPDU_CMD are handled differently.
|
||||
* REPLY_RX: physical layer info is in this buffer
|
||||
* REPLY_RX_MPDU_CMD: physical layer info was sent in separate
|
||||
* command and cached in priv->last_phy_res
|
||||
* command and cached in il->last_phy_res
|
||||
*
|
||||
* Here we set up local variables depending on which command is
|
||||
* received.
|
||||
@ -597,28 +597,28 @@ void il4965_rx_reply_rx(struct il_priv *priv,
|
||||
phy_res->cfg_phy_cnt + len);
|
||||
ampdu_status = le32_to_cpu(rx_pkt_status);
|
||||
} else {
|
||||
if (!priv->_4965.last_phy_res_valid) {
|
||||
IL_ERR(priv, "MPDU frame without cached PHY data\n");
|
||||
if (!il->_4965.last_phy_res_valid) {
|
||||
IL_ERR(il, "MPDU frame without cached PHY data\n");
|
||||
return;
|
||||
}
|
||||
phy_res = &priv->_4965.last_phy_res;
|
||||
phy_res = &il->_4965.last_phy_res;
|
||||
amsdu = (struct il_rx_mpdu_res_start *)pkt->u.raw;
|
||||
header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*amsdu));
|
||||
len = le16_to_cpu(amsdu->byte_count);
|
||||
rx_pkt_status = *(__le32 *)(pkt->u.raw + sizeof(*amsdu) + len);
|
||||
ampdu_status = il4965_translate_rx_status(priv,
|
||||
ampdu_status = il4965_translate_rx_status(il,
|
||||
le32_to_cpu(rx_pkt_status));
|
||||
}
|
||||
|
||||
if ((unlikely(phy_res->cfg_phy_cnt > 20))) {
|
||||
IL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n",
|
||||
IL_DEBUG_DROP(il, "dsp size out of range [0,20]: %d/n",
|
||||
phy_res->cfg_phy_cnt);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(rx_pkt_status & RX_RES_STATUS_NO_CRC32_ERROR) ||
|
||||
!(rx_pkt_status & RX_RES_STATUS_NO_RXE_OVERFLOW)) {
|
||||
IL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n",
|
||||
IL_DEBUG_RX(il, "Bad CRC or FIFO: 0x%08X.\n",
|
||||
le32_to_cpu(rx_pkt_status));
|
||||
return;
|
||||
}
|
||||
@ -641,13 +641,13 @@ void il4965_rx_reply_rx(struct il_priv *priv,
|
||||
* this W/A doesn't propagate it to the mac80211 */
|
||||
/*rx_status.flag |= RX_FLAG_MACTIME_MPDU;*/
|
||||
|
||||
priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp);
|
||||
il->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp);
|
||||
|
||||
/* Find max signal strength (dBm) among 3 antenna/receiver chains */
|
||||
rx_status.signal = il4965_calc_rssi(priv, phy_res);
|
||||
rx_status.signal = il4965_calc_rssi(il, phy_res);
|
||||
|
||||
il_dbg_log_rx_data_frame(priv, len, header);
|
||||
IL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n",
|
||||
il_dbg_log_rx_data_frame(il, len, header);
|
||||
IL_DEBUG_STATS_LIMIT(il, "Rssi %d, TSF %llu\n",
|
||||
rx_status.signal, (unsigned long long)rx_status.mactime);
|
||||
|
||||
/*
|
||||
@ -679,22 +679,22 @@ void il4965_rx_reply_rx(struct il_priv *priv,
|
||||
if (rate_n_flags & RATE_MCS_SGI_MSK)
|
||||
rx_status.flag |= RX_FLAG_SHORT_GI;
|
||||
|
||||
il4965_pass_packet_to_mac80211(priv, header, len, ampdu_status,
|
||||
il4965_pass_packet_to_mac80211(il, header, len, ampdu_status,
|
||||
rxb, &rx_status);
|
||||
}
|
||||
|
||||
/* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD).
|
||||
* This will be used later in il_rx_reply_rx() for REPLY_RX_MPDU_CMD. */
|
||||
void il4965_rx_reply_rx_phy(struct il_priv *priv,
|
||||
void il4965_rx_reply_rx_phy(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb)
|
||||
{
|
||||
struct il_rx_packet *pkt = rxb_addr(rxb);
|
||||
priv->_4965.last_phy_res_valid = true;
|
||||
memcpy(&priv->_4965.last_phy_res, pkt->u.raw,
|
||||
il->_4965.last_phy_res_valid = true;
|
||||
memcpy(&il->_4965.last_phy_res, pkt->u.raw,
|
||||
sizeof(struct il_rx_phy_res));
|
||||
}
|
||||
|
||||
static int il4965_get_channels_for_scan(struct il_priv *priv,
|
||||
static int il4965_get_channels_for_scan(struct il_priv *il,
|
||||
struct ieee80211_vif *vif,
|
||||
enum ieee80211_band band,
|
||||
u8 is_active, u8 n_probes,
|
||||
@ -708,18 +708,18 @@ static int il4965_get_channels_for_scan(struct il_priv *priv,
|
||||
int added, i;
|
||||
u16 channel;
|
||||
|
||||
sband = il_get_hw_mode(priv, band);
|
||||
sband = il_get_hw_mode(il, band);
|
||||
if (!sband)
|
||||
return 0;
|
||||
|
||||
active_dwell = il_get_active_dwell_time(priv, band, n_probes);
|
||||
passive_dwell = il_get_passive_dwell_time(priv, band, vif);
|
||||
active_dwell = il_get_active_dwell_time(il, band, n_probes);
|
||||
passive_dwell = il_get_passive_dwell_time(il, band, vif);
|
||||
|
||||
if (passive_dwell <= active_dwell)
|
||||
passive_dwell = active_dwell + 1;
|
||||
|
||||
for (i = 0, added = 0; i < priv->scan_request->n_channels; i++) {
|
||||
chan = priv->scan_request->channels[i];
|
||||
for (i = 0, added = 0; i < il->scan_request->n_channels; i++) {
|
||||
chan = il->scan_request->channels[i];
|
||||
|
||||
if (chan->band != band)
|
||||
continue;
|
||||
@ -727,9 +727,9 @@ static int il4965_get_channels_for_scan(struct il_priv *priv,
|
||||
channel = chan->hw_value;
|
||||
scan_ch->channel = cpu_to_le16(channel);
|
||||
|
||||
ch_info = il_get_channel_info(priv, band, channel);
|
||||
ch_info = il_get_channel_info(il, band, channel);
|
||||
if (!il_is_channel_valid(ch_info)) {
|
||||
IL_DEBUG_SCAN(priv,
|
||||
IL_DEBUG_SCAN(il,
|
||||
"Channel %d is INVALID for this band.\n",
|
||||
channel);
|
||||
continue;
|
||||
@ -759,7 +759,7 @@ static int il4965_get_channels_for_scan(struct il_priv *priv,
|
||||
else
|
||||
scan_ch->tx_gain = ((1 << 5) | (5 << 3));
|
||||
|
||||
IL_DEBUG_SCAN(priv, "Scanning ch=%d prob=0x%X [%s %d]\n",
|
||||
IL_DEBUG_SCAN(il, "Scanning ch=%d prob=0x%X [%s %d]\n",
|
||||
channel, le32_to_cpu(scan_ch->type),
|
||||
(scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ?
|
||||
"ACTIVE" : "PASSIVE",
|
||||
@ -770,11 +770,11 @@ static int il4965_get_channels_for_scan(struct il_priv *priv,
|
||||
added++;
|
||||
}
|
||||
|
||||
IL_DEBUG_SCAN(priv, "total channels to scan %d\n", added);
|
||||
IL_DEBUG_SCAN(il, "total channels to scan %d\n", added);
|
||||
return added;
|
||||
}
|
||||
|
||||
int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif)
|
||||
int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
|
||||
{
|
||||
struct il_host_cmd cmd = {
|
||||
.id = REPLY_SCAN_CMD,
|
||||
@ -782,47 +782,47 @@ int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif)
|
||||
.flags = CMD_SIZE_HUGE,
|
||||
};
|
||||
struct il_scan_cmd *scan;
|
||||
struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
|
||||
struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS];
|
||||
u32 rate_flags = 0;
|
||||
u16 cmd_len;
|
||||
u16 rx_chain = 0;
|
||||
enum ieee80211_band band;
|
||||
u8 n_probes = 0;
|
||||
u8 rx_ant = priv->hw_params.valid_rx_ant;
|
||||
u8 rx_ant = il->hw_params.valid_rx_ant;
|
||||
u8 rate;
|
||||
bool is_active = false;
|
||||
int chan_mod;
|
||||
u8 active_chains;
|
||||
u8 scan_tx_antennas = priv->hw_params.valid_tx_ant;
|
||||
u8 scan_tx_antennas = il->hw_params.valid_tx_ant;
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
if (vif)
|
||||
ctx = il_rxon_ctx_from_vif(vif);
|
||||
|
||||
if (!priv->scan_cmd) {
|
||||
priv->scan_cmd = kmalloc(sizeof(struct il_scan_cmd) +
|
||||
if (!il->scan_cmd) {
|
||||
il->scan_cmd = kmalloc(sizeof(struct il_scan_cmd) +
|
||||
IL_MAX_SCAN_SIZE, GFP_KERNEL);
|
||||
if (!priv->scan_cmd) {
|
||||
IL_DEBUG_SCAN(priv,
|
||||
if (!il->scan_cmd) {
|
||||
IL_DEBUG_SCAN(il,
|
||||
"fail to allocate memory for scan\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
scan = priv->scan_cmd;
|
||||
scan = il->scan_cmd;
|
||||
memset(scan, 0, sizeof(struct il_scan_cmd) + IL_MAX_SCAN_SIZE);
|
||||
|
||||
scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH;
|
||||
scan->quiet_time = IL_ACTIVE_QUIET_TIME;
|
||||
|
||||
if (il_is_any_associated(priv)) {
|
||||
if (il_is_any_associated(il)) {
|
||||
u16 interval;
|
||||
u32 extra;
|
||||
u32 suspend_time = 100;
|
||||
u32 scan_suspend_time = 100;
|
||||
|
||||
IL_DEBUG_INFO(priv, "Scanning while associated...\n");
|
||||
IL_DEBUG_INFO(il, "Scanning while associated...\n");
|
||||
interval = vif->bss_conf.beacon_int;
|
||||
|
||||
scan->suspend_time = 0;
|
||||
@ -834,39 +834,39 @@ int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif)
|
||||
scan_suspend_time = (extra |
|
||||
((suspend_time % interval) * 1024));
|
||||
scan->suspend_time = cpu_to_le32(scan_suspend_time);
|
||||
IL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n",
|
||||
IL_DEBUG_SCAN(il, "suspend_time 0x%X beacon interval %d\n",
|
||||
scan_suspend_time, interval);
|
||||
}
|
||||
|
||||
if (priv->scan_request->n_ssids) {
|
||||
if (il->scan_request->n_ssids) {
|
||||
int i, p = 0;
|
||||
IL_DEBUG_SCAN(priv, "Kicking off active scan\n");
|
||||
for (i = 0; i < priv->scan_request->n_ssids; i++) {
|
||||
IL_DEBUG_SCAN(il, "Kicking off active scan\n");
|
||||
for (i = 0; i < il->scan_request->n_ssids; i++) {
|
||||
/* always does wildcard anyway */
|
||||
if (!priv->scan_request->ssids[i].ssid_len)
|
||||
if (!il->scan_request->ssids[i].ssid_len)
|
||||
continue;
|
||||
scan->direct_scan[p].id = WLAN_EID_SSID;
|
||||
scan->direct_scan[p].len =
|
||||
priv->scan_request->ssids[i].ssid_len;
|
||||
il->scan_request->ssids[i].ssid_len;
|
||||
memcpy(scan->direct_scan[p].ssid,
|
||||
priv->scan_request->ssids[i].ssid,
|
||||
priv->scan_request->ssids[i].ssid_len);
|
||||
il->scan_request->ssids[i].ssid,
|
||||
il->scan_request->ssids[i].ssid_len);
|
||||
n_probes++;
|
||||
p++;
|
||||
}
|
||||
is_active = true;
|
||||
} else
|
||||
IL_DEBUG_SCAN(priv, "Start passive scan.\n");
|
||||
IL_DEBUG_SCAN(il, "Start passive scan.\n");
|
||||
|
||||
scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
|
||||
scan->tx_cmd.sta_id = ctx->bcast_sta_id;
|
||||
scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
|
||||
|
||||
switch (priv->scan_band) {
|
||||
switch (il->scan_band) {
|
||||
case IEEE80211_BAND_2GHZ:
|
||||
scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
|
||||
chan_mod = le32_to_cpu(
|
||||
priv->contexts[IL_RXON_CTX_BSS].active.flags &
|
||||
il->contexts[IL_RXON_CTX_BSS].active.flags &
|
||||
RXON_FLG_CHANNEL_MODE_MSK)
|
||||
>> RXON_FLG_CHANNEL_MODE_POS;
|
||||
if (chan_mod == CHANNEL_MODE_PURE_40) {
|
||||
@ -880,7 +880,7 @@ int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif)
|
||||
rate = IL_RATE_6M_PLCP;
|
||||
break;
|
||||
default:
|
||||
IL_WARN(priv, "Invalid scan band\n");
|
||||
IL_WARN(il, "Invalid scan band\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@ -904,54 +904,54 @@ int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif)
|
||||
scan->good_CRC_th = is_active ? IL_GOOD_CRC_TH_DEFAULT :
|
||||
IL_GOOD_CRC_TH_NEVER;
|
||||
|
||||
band = priv->scan_band;
|
||||
band = il->scan_band;
|
||||
|
||||
if (priv->cfg->scan_rx_antennas[band])
|
||||
rx_ant = priv->cfg->scan_rx_antennas[band];
|
||||
if (il->cfg->scan_rx_antennas[band])
|
||||
rx_ant = il->cfg->scan_rx_antennas[band];
|
||||
|
||||
priv->scan_tx_ant[band] = il4965_toggle_tx_ant(priv,
|
||||
priv->scan_tx_ant[band],
|
||||
il->scan_tx_ant[band] = il4965_toggle_tx_ant(il,
|
||||
il->scan_tx_ant[band],
|
||||
scan_tx_antennas);
|
||||
rate_flags |= il4965_ant_idx_to_flags(priv->scan_tx_ant[band]);
|
||||
rate_flags |= il4965_ant_idx_to_flags(il->scan_tx_ant[band]);
|
||||
scan->tx_cmd.rate_n_flags = il4965_hw_set_rate_n_flags(rate, rate_flags);
|
||||
|
||||
/* In power save mode use one chain, otherwise use all chains */
|
||||
if (test_bit(STATUS_POWER_PMI, &priv->status)) {
|
||||
if (test_bit(STATUS_POWER_PMI, &il->status)) {
|
||||
/* rx_ant has been set to all valid chains previously */
|
||||
active_chains = rx_ant &
|
||||
((u8)(priv->chain_noise_data.active_chains));
|
||||
((u8)(il->chain_noise_data.active_chains));
|
||||
if (!active_chains)
|
||||
active_chains = rx_ant;
|
||||
|
||||
IL_DEBUG_SCAN(priv, "chain_noise_data.active_chains: %u\n",
|
||||
priv->chain_noise_data.active_chains);
|
||||
IL_DEBUG_SCAN(il, "chain_noise_data.active_chains: %u\n",
|
||||
il->chain_noise_data.active_chains);
|
||||
|
||||
rx_ant = il4965_first_antenna(active_chains);
|
||||
}
|
||||
|
||||
/* MIMO is not used here, but value is required */
|
||||
rx_chain |= priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS;
|
||||
rx_chain |= il->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS;
|
||||
rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS;
|
||||
rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS;
|
||||
rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS;
|
||||
scan->rx_chain = cpu_to_le16(rx_chain);
|
||||
|
||||
cmd_len = il_fill_probe_req(priv,
|
||||
cmd_len = il_fill_probe_req(il,
|
||||
(struct ieee80211_mgmt *)scan->data,
|
||||
vif->addr,
|
||||
priv->scan_request->ie,
|
||||
priv->scan_request->ie_len,
|
||||
il->scan_request->ie,
|
||||
il->scan_request->ie_len,
|
||||
IL_MAX_SCAN_SIZE - sizeof(*scan));
|
||||
scan->tx_cmd.len = cpu_to_le16(cmd_len);
|
||||
|
||||
scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK |
|
||||
RXON_FILTER_BCON_AWARE_MSK);
|
||||
|
||||
scan->channel_count = il4965_get_channels_for_scan(priv, vif, band,
|
||||
scan->channel_count = il4965_get_channels_for_scan(il, vif, band,
|
||||
is_active, n_probes,
|
||||
(void *)&scan->data[cmd_len]);
|
||||
if (scan->channel_count == 0) {
|
||||
IL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count);
|
||||
IL_DEBUG_SCAN(il, "channel count %d\n", scan->channel_count);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@ -960,49 +960,49 @@ int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif)
|
||||
cmd.data = scan;
|
||||
scan->len = cpu_to_le16(cmd.len);
|
||||
|
||||
set_bit(STATUS_SCAN_HW, &priv->status);
|
||||
set_bit(STATUS_SCAN_HW, &il->status);
|
||||
|
||||
ret = il_send_cmd_sync(priv, &cmd);
|
||||
ret = il_send_cmd_sync(il, &cmd);
|
||||
if (ret)
|
||||
clear_bit(STATUS_SCAN_HW, &priv->status);
|
||||
clear_bit(STATUS_SCAN_HW, &il->status);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int il4965_manage_ibss_station(struct il_priv *priv,
|
||||
int il4965_manage_ibss_station(struct il_priv *il,
|
||||
struct ieee80211_vif *vif, bool add)
|
||||
{
|
||||
struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
|
||||
|
||||
if (add)
|
||||
return il4965_add_bssid_station(priv, vif_priv->ctx,
|
||||
return il4965_add_bssid_station(il, vif_priv->ctx,
|
||||
vif->bss_conf.bssid,
|
||||
&vif_priv->ibss_bssid_sta_id);
|
||||
return il_remove_station(priv, vif_priv->ibss_bssid_sta_id,
|
||||
return il_remove_station(il, vif_priv->ibss_bssid_sta_id,
|
||||
vif->bss_conf.bssid);
|
||||
}
|
||||
|
||||
void il4965_free_tfds_in_queue(struct il_priv *priv,
|
||||
void il4965_free_tfds_in_queue(struct il_priv *il,
|
||||
int sta_id, int tid, int freed)
|
||||
{
|
||||
lockdep_assert_held(&priv->sta_lock);
|
||||
lockdep_assert_held(&il->sta_lock);
|
||||
|
||||
if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed)
|
||||
priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
|
||||
if (il->stations[sta_id].tid[tid].tfds_in_queue >= freed)
|
||||
il->stations[sta_id].tid[tid].tfds_in_queue -= freed;
|
||||
else {
|
||||
IL_DEBUG_TX(priv, "free more than tfds_in_queue (%u:%d)\n",
|
||||
priv->stations[sta_id].tid[tid].tfds_in_queue,
|
||||
IL_DEBUG_TX(il, "free more than tfds_in_queue (%u:%d)\n",
|
||||
il->stations[sta_id].tid[tid].tfds_in_queue,
|
||||
freed);
|
||||
priv->stations[sta_id].tid[tid].tfds_in_queue = 0;
|
||||
il->stations[sta_id].tid[tid].tfds_in_queue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#define IL_TX_QUEUE_MSK 0xfffff
|
||||
|
||||
static bool il4965_is_single_rx_stream(struct il_priv *priv)
|
||||
static bool il4965_is_single_rx_stream(struct il_priv *il)
|
||||
{
|
||||
return priv->current_ht_config.smps == IEEE80211_SMPS_STATIC ||
|
||||
priv->current_ht_config.single_chain_sufficient;
|
||||
return il->current_ht_config.smps == IEEE80211_SMPS_STATIC ||
|
||||
il->current_ht_config.single_chain_sufficient;
|
||||
}
|
||||
|
||||
#define IL_NUM_RX_CHAINS_MULTIPLE 3
|
||||
@ -1020,10 +1020,10 @@ static bool il4965_is_single_rx_stream(struct il_priv *priv)
|
||||
* MIMO (dual stream) requires at least 2, but works better with 3.
|
||||
* This does not determine *which* chains to use, just how many.
|
||||
*/
|
||||
static int il4965_get_active_rx_chain_count(struct il_priv *priv)
|
||||
static int il4965_get_active_rx_chain_count(struct il_priv *il)
|
||||
{
|
||||
/* # of Rx chains to use when expecting MIMO. */
|
||||
if (il4965_is_single_rx_stream(priv))
|
||||
if (il4965_is_single_rx_stream(il))
|
||||
return IL_NUM_RX_CHAINS_SINGLE;
|
||||
else
|
||||
return IL_NUM_RX_CHAINS_MULTIPLE;
|
||||
@ -1034,10 +1034,10 @@ static int il4965_get_active_rx_chain_count(struct il_priv *priv)
|
||||
* multiplexing power save, use the active count for rx chain count.
|
||||
*/
|
||||
static int
|
||||
il4965_get_idle_rx_chain_count(struct il_priv *priv, int active_cnt)
|
||||
il4965_get_idle_rx_chain_count(struct il_priv *il, int active_cnt)
|
||||
{
|
||||
/* # Rx chains when idling, depending on SMPS mode */
|
||||
switch (priv->current_ht_config.smps) {
|
||||
switch (il->current_ht_config.smps) {
|
||||
case IEEE80211_SMPS_STATIC:
|
||||
case IEEE80211_SMPS_DYNAMIC:
|
||||
return IL_NUM_IDLE_CHAINS_SINGLE;
|
||||
@ -1045,7 +1045,7 @@ il4965_get_idle_rx_chain_count(struct il_priv *priv, int active_cnt)
|
||||
return active_cnt;
|
||||
default:
|
||||
WARN(1, "invalid SMPS mode %d",
|
||||
priv->current_ht_config.smps);
|
||||
il->current_ht_config.smps);
|
||||
return active_cnt;
|
||||
}
|
||||
}
|
||||
@ -1067,10 +1067,10 @@ static u8 il4965_count_chain_bitmap(u32 chain_bitmap)
|
||||
* Selects how many and which Rx receivers/antennas/chains to use.
|
||||
* This should not be used for scan command ... it puts data in wrong place.
|
||||
*/
|
||||
void il4965_set_rxon_chain(struct il_priv *priv, struct il_rxon_context *ctx)
|
||||
void il4965_set_rxon_chain(struct il_priv *il, struct il_rxon_context *ctx)
|
||||
{
|
||||
bool is_single = il4965_is_single_rx_stream(priv);
|
||||
bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status);
|
||||
bool is_single = il4965_is_single_rx_stream(il);
|
||||
bool is_cam = !test_bit(STATUS_POWER_PMI, &il->status);
|
||||
u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt;
|
||||
u32 active_chains;
|
||||
u16 rx_chain;
|
||||
@ -1079,16 +1079,16 @@ void il4965_set_rxon_chain(struct il_priv *priv, struct il_rxon_context *ctx)
|
||||
* Before first association, we assume all antennas are connected.
|
||||
* Just after first association, il4965_chain_noise_calibration()
|
||||
* checks which antennas actually *are* connected. */
|
||||
if (priv->chain_noise_data.active_chains)
|
||||
active_chains = priv->chain_noise_data.active_chains;
|
||||
if (il->chain_noise_data.active_chains)
|
||||
active_chains = il->chain_noise_data.active_chains;
|
||||
else
|
||||
active_chains = priv->hw_params.valid_rx_ant;
|
||||
active_chains = il->hw_params.valid_rx_ant;
|
||||
|
||||
rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS;
|
||||
|
||||
/* How many receivers should we use? */
|
||||
active_rx_cnt = il4965_get_active_rx_chain_count(priv);
|
||||
idle_rx_cnt = il4965_get_idle_rx_chain_count(priv, active_rx_cnt);
|
||||
active_rx_cnt = il4965_get_active_rx_chain_count(il);
|
||||
idle_rx_cnt = il4965_get_idle_rx_chain_count(il, active_rx_cnt);
|
||||
|
||||
|
||||
/* correct rx chain count according hw settings
|
||||
@ -1111,7 +1111,7 @@ void il4965_set_rxon_chain(struct il_priv *priv, struct il_rxon_context *ctx)
|
||||
else
|
||||
ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK;
|
||||
|
||||
IL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n",
|
||||
IL_DEBUG_ASSOC(il, "rx_chain=0x%X active=%d idle=%d\n",
|
||||
ctx->staging.rx_chain,
|
||||
active_rx_cnt, idle_rx_cnt);
|
||||
|
||||
@ -1119,7 +1119,7 @@ void il4965_set_rxon_chain(struct il_priv *priv, struct il_rxon_context *ctx)
|
||||
active_rx_cnt < idle_rx_cnt);
|
||||
}
|
||||
|
||||
u8 il4965_toggle_tx_ant(struct il_priv *priv, u8 ant, u8 valid)
|
||||
u8 il4965_toggle_tx_ant(struct il_priv *il, u8 ant, u8 valid)
|
||||
{
|
||||
int i;
|
||||
u8 ind = ant;
|
||||
@ -1149,7 +1149,7 @@ static const char *il4965_get_fh_string(int cmd)
|
||||
}
|
||||
}
|
||||
|
||||
int il4965_dump_fh(struct il_priv *priv, char **buf, bool display)
|
||||
int il4965_dump_fh(struct il_priv *il, char **buf, bool display)
|
||||
{
|
||||
int i;
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
@ -1179,16 +1179,16 @@ int il4965_dump_fh(struct il_priv *priv, char **buf, bool display)
|
||||
pos += scnprintf(*buf + pos, bufsz - pos,
|
||||
" %34s: 0X%08x\n",
|
||||
il4965_get_fh_string(fh_tbl[i]),
|
||||
il_read_direct32(priv, fh_tbl[i]));
|
||||
il_read_direct32(il, fh_tbl[i]));
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
#endif
|
||||
IL_ERR(priv, "FH register values:\n");
|
||||
IL_ERR(il, "FH register values:\n");
|
||||
for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
|
||||
IL_ERR(priv, " %34s: 0X%08x\n",
|
||||
IL_ERR(il, " %34s: 0X%08x\n",
|
||||
il4965_get_fh_string(fh_tbl[i]),
|
||||
il_read_direct32(priv, fh_tbl[i]));
|
||||
il_read_direct32(il, fh_tbl[i]));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -41,7 +41,7 @@
|
||||
#include "iwl-4965-hw.h"
|
||||
#include "iwl-4965.h"
|
||||
|
||||
void il4965_rx_missed_beacon_notif(struct il_priv *priv,
|
||||
void il4965_rx_missed_beacon_notif(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb)
|
||||
|
||||
{
|
||||
@ -50,22 +50,22 @@ void il4965_rx_missed_beacon_notif(struct il_priv *priv,
|
||||
|
||||
missed_beacon = &pkt->u.missed_beacon;
|
||||
if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) >
|
||||
priv->missed_beacon_threshold) {
|
||||
IL_DEBUG_CALIB(priv,
|
||||
il->missed_beacon_threshold) {
|
||||
IL_DEBUG_CALIB(il,
|
||||
"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))
|
||||
il4965_init_sensitivity(priv);
|
||||
if (!test_bit(STATUS_SCANNING, &il->status))
|
||||
il4965_init_sensitivity(il);
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 il4965_rx_calc_noise(struct il_priv *priv)
|
||||
static void il4965_rx_calc_noise(struct il_priv *il)
|
||||
{
|
||||
struct statistics_rx_non_phy *rx_info;
|
||||
int num_active_rx = 0;
|
||||
@ -73,7 +73,7 @@ static void il4965_rx_calc_noise(struct il_priv *priv)
|
||||
int bcn_silence_a, bcn_silence_b, bcn_silence_c;
|
||||
int last_rx_noise;
|
||||
|
||||
rx_info = &(priv->_4965.statistics.rx.general);
|
||||
rx_info = &(il->_4965.statistics.rx.general);
|
||||
bcn_silence_a =
|
||||
le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER;
|
||||
bcn_silence_b =
|
||||
@ -100,7 +100,7 @@ static void il4965_rx_calc_noise(struct il_priv *priv)
|
||||
else
|
||||
last_rx_noise = IL_NOISE_MEAS_NOT_AVAILABLE;
|
||||
|
||||
IL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n",
|
||||
IL_DEBUG_CALIB(il, "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 il4965_rx_calc_noise(struct il_priv *priv)
|
||||
* FIXME: This function is for debugging, do not deal with
|
||||
* the case of counters roll-over.
|
||||
*/
|
||||
static void il4965_accumulative_statistics(struct il_priv *priv,
|
||||
static void il4965_accumulative_statistics(struct il_priv *il,
|
||||
__le32 *stats)
|
||||
{
|
||||
int i, size;
|
||||
@ -121,15 +121,15 @@ static void il4965_accumulative_statistics(struct il_priv *priv,
|
||||
struct statistics_general_common *general, *accum_general;
|
||||
struct statistics_tx *tx, *accum_tx;
|
||||
|
||||
prev_stats = (__le32 *)&priv->_4965.statistics;
|
||||
accum_stats = (u32 *)&priv->_4965.accum_statistics;
|
||||
prev_stats = (__le32 *)&il->_4965.statistics;
|
||||
accum_stats = (u32 *)&il->_4965.accum_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;
|
||||
accum_tx = &priv->_4965.accum_statistics.tx;
|
||||
delta = (u32 *)&priv->_4965.delta_statistics;
|
||||
max_delta = (u32 *)&priv->_4965.max_delta;
|
||||
general = &il->_4965.statistics.general.common;
|
||||
accum_general = &il->_4965.accum_statistics.general.common;
|
||||
tx = &il->_4965.statistics.tx;
|
||||
accum_tx = &il->_4965.accum_statistics.tx;
|
||||
delta = (u32 *)&il->_4965.delta_statistics;
|
||||
max_delta = (u32 *)&il->_4965.max_delta;
|
||||
|
||||
for (i = sizeof(__le32); i < size;
|
||||
i += sizeof(__le32), stats++, prev_stats++, delta++,
|
||||
@ -151,65 +151,65 @@ static void il4965_accumulative_statistics(struct il_priv *priv,
|
||||
|
||||
#define REG_RECALIB_PERIOD (60)
|
||||
|
||||
void il4965_rx_statistics(struct il_priv *priv,
|
||||
void il4965_rx_statistics(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb)
|
||||
{
|
||||
int change;
|
||||
struct il_rx_packet *pkt = rxb_addr(rxb);
|
||||
|
||||
IL_DEBUG_RX(priv,
|
||||
IL_DEBUG_RX(il,
|
||||
"Statistics notification received (%d vs %d).\n",
|
||||
(int)sizeof(struct il_notif_statistics),
|
||||
le32_to_cpu(pkt->len_n_flags) &
|
||||
FH_RSCSR_FRAME_SIZE_MSK);
|
||||
|
||||
change = ((priv->_4965.statistics.general.common.temperature !=
|
||||
change = ((il->_4965.statistics.general.common.temperature !=
|
||||
pkt->u.stats.general.common.temperature) ||
|
||||
((priv->_4965.statistics.flag &
|
||||
((il->_4965.statistics.flag &
|
||||
STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
|
||||
(pkt->u.stats.flag &
|
||||
STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
|
||||
il4965_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
|
||||
il4965_accumulative_statistics(il, (__le32 *)&pkt->u.stats);
|
||||
#endif
|
||||
|
||||
/* TODO: reading some of statistics is unneeded */
|
||||
memcpy(&priv->_4965.statistics, &pkt->u.stats,
|
||||
sizeof(priv->_4965.statistics));
|
||||
memcpy(&il->_4965.statistics, &pkt->u.stats,
|
||||
sizeof(il->_4965.statistics));
|
||||
|
||||
set_bit(STATUS_STATISTICS, &priv->status);
|
||||
set_bit(STATUS_STATISTICS, &il->status);
|
||||
|
||||
/* Reschedule the statistics timer to occur in
|
||||
* REG_RECALIB_PERIOD seconds to ensure we get a
|
||||
* thermal update even if the uCode doesn't give
|
||||
* us one */
|
||||
mod_timer(&priv->statistics_periodic, jiffies +
|
||||
mod_timer(&il->statistics_periodic, jiffies +
|
||||
msecs_to_jiffies(REG_RECALIB_PERIOD * 1000));
|
||||
|
||||
if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) &&
|
||||
if (unlikely(!test_bit(STATUS_SCANNING, &il->status)) &&
|
||||
(pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
|
||||
il4965_rx_calc_noise(priv);
|
||||
queue_work(priv->workqueue, &priv->run_time_calib_work);
|
||||
il4965_rx_calc_noise(il);
|
||||
queue_work(il->workqueue, &il->run_time_calib_work);
|
||||
}
|
||||
if (priv->cfg->ops->lib->temp_ops.temperature && change)
|
||||
priv->cfg->ops->lib->temp_ops.temperature(priv);
|
||||
if (il->cfg->ops->lib->temp_ops.temperature && change)
|
||||
il->cfg->ops->lib->temp_ops.temperature(il);
|
||||
}
|
||||
|
||||
void il4965_reply_statistics(struct il_priv *priv,
|
||||
void il4965_reply_statistics(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *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,
|
||||
memset(&il->_4965.accum_statistics, 0,
|
||||
sizeof(struct il_notif_statistics));
|
||||
memset(&priv->_4965.delta_statistics, 0,
|
||||
memset(&il->_4965.delta_statistics, 0,
|
||||
sizeof(struct il_notif_statistics));
|
||||
memset(&priv->_4965.max_delta, 0,
|
||||
memset(&il->_4965.max_delta, 0,
|
||||
sizeof(struct il_notif_statistics));
|
||||
#endif
|
||||
IL_DEBUG_RX(priv, "Statistics have been cleared\n");
|
||||
IL_DEBUG_RX(il, "Statistics have been cleared\n");
|
||||
}
|
||||
il4965_rx_statistics(priv, rxb);
|
||||
il4965_rx_statistics(il, rxb);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "iwl-4965.h"
|
||||
|
||||
static struct il_link_quality_cmd *
|
||||
il4965_sta_alloc_lq(struct il_priv *priv, u8 sta_id)
|
||||
il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id)
|
||||
{
|
||||
int i, r;
|
||||
struct il_link_quality_cmd *link_cmd;
|
||||
@ -44,12 +44,12 @@ il4965_sta_alloc_lq(struct il_priv *priv, u8 sta_id)
|
||||
|
||||
link_cmd = kzalloc(sizeof(struct il_link_quality_cmd), GFP_KERNEL);
|
||||
if (!link_cmd) {
|
||||
IL_ERR(priv, "Unable to allocate memory for LQ cmd.\n");
|
||||
IL_ERR(il, "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)
|
||||
if (il->band == IEEE80211_BAND_5GHZ)
|
||||
r = IL_RATE_6M_INDEX;
|
||||
else
|
||||
r = IL_RATE_1M_INDEX;
|
||||
@ -57,7 +57,7 @@ il4965_sta_alloc_lq(struct il_priv *priv, u8 sta_id)
|
||||
if (r >= IL_FIRST_CCK_RATE && r <= IL_LAST_CCK_RATE)
|
||||
rate_flags |= RATE_MCS_CCK_MSK;
|
||||
|
||||
rate_flags |= il4965_first_antenna(priv->hw_params.valid_tx_ant) <<
|
||||
rate_flags |= il4965_first_antenna(il->hw_params.valid_tx_ant) <<
|
||||
RATE_MCS_ANT_POS;
|
||||
rate_n_flags = il4965_hw_set_rate_n_flags(iwlegacy_rates[r].plcp,
|
||||
rate_flags);
|
||||
@ -65,16 +65,16 @@ il4965_sta_alloc_lq(struct il_priv *priv, u8 sta_id)
|
||||
link_cmd->rs_table[i].rate_n_flags = rate_n_flags;
|
||||
|
||||
link_cmd->general_params.single_stream_ant_msk =
|
||||
il4965_first_antenna(priv->hw_params.valid_tx_ant);
|
||||
il4965_first_antenna(il->hw_params.valid_tx_ant);
|
||||
|
||||
link_cmd->general_params.dual_stream_ant_msk =
|
||||
priv->hw_params.valid_tx_ant &
|
||||
~il4965_first_antenna(priv->hw_params.valid_tx_ant);
|
||||
il->hw_params.valid_tx_ant &
|
||||
~il4965_first_antenna(il->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 (il4965_num_of_ant(priv->hw_params.valid_tx_ant) == 2) {
|
||||
} else if (il4965_num_of_ant(il->hw_params.valid_tx_ant) == 2) {
|
||||
link_cmd->general_params.dual_stream_ant_msk =
|
||||
priv->hw_params.valid_tx_ant;
|
||||
il->hw_params.valid_tx_ant;
|
||||
}
|
||||
|
||||
link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
|
||||
@ -92,7 +92,7 @@ il4965_sta_alloc_lq(struct il_priv *priv, u8 sta_id)
|
||||
* Function sleeps.
|
||||
*/
|
||||
int
|
||||
il4965_add_bssid_station(struct il_priv *priv, struct il_rxon_context *ctx,
|
||||
il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx,
|
||||
const u8 *addr, u8 *sta_id_r)
|
||||
{
|
||||
int ret;
|
||||
@ -103,40 +103,40 @@ il4965_add_bssid_station(struct il_priv *priv, struct il_rxon_context *ctx,
|
||||
if (sta_id_r)
|
||||
*sta_id_r = IL_INVALID_STATION;
|
||||
|
||||
ret = il_add_station_common(priv, ctx, addr, 0, NULL, &sta_id);
|
||||
ret = il_add_station_common(il, ctx, addr, 0, NULL, &sta_id);
|
||||
if (ret) {
|
||||
IL_ERR(priv, "Unable to add station %pM\n", addr);
|
||||
IL_ERR(il, "Unable to add station %pM\n", addr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (sta_id_r)
|
||||
*sta_id_r = sta_id;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
priv->stations[sta_id].used |= IL_STA_LOCAL;
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
il->stations[sta_id].used |= IL_STA_LOCAL;
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
/* Set up default rate scaling table in device's station table */
|
||||
link_cmd = il4965_sta_alloc_lq(priv, sta_id);
|
||||
link_cmd = il4965_sta_alloc_lq(il, sta_id);
|
||||
if (!link_cmd) {
|
||||
IL_ERR(priv,
|
||||
IL_ERR(il,
|
||||
"Unable to initialize rate scaling for station %pM.\n",
|
||||
addr);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = il_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true);
|
||||
ret = il_send_lq_cmd(il, ctx, link_cmd, CMD_SYNC, true);
|
||||
if (ret)
|
||||
IL_ERR(priv, "Link quality command failed (%d)\n", ret);
|
||||
IL_ERR(il, "Link quality command failed (%d)\n", ret);
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
priv->stations[sta_id].lq = link_cmd;
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
il->stations[sta_id].lq = link_cmd;
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int il4965_static_wepkey_cmd(struct il_priv *priv,
|
||||
static int il4965_static_wepkey_cmd(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
bool send_if_empty)
|
||||
{
|
||||
@ -178,74 +178,74 @@ static int il4965_static_wepkey_cmd(struct il_priv *priv,
|
||||
cmd.len = cmd_size;
|
||||
|
||||
if (not_empty || send_if_empty)
|
||||
return il_send_cmd(priv, &cmd);
|
||||
return il_send_cmd(il, &cmd);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int il4965_restore_default_wep_keys(struct il_priv *priv,
|
||||
int il4965_restore_default_wep_keys(struct il_priv *il,
|
||||
struct il_rxon_context *ctx)
|
||||
{
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
return il4965_static_wepkey_cmd(priv, ctx, false);
|
||||
return il4965_static_wepkey_cmd(il, ctx, false);
|
||||
}
|
||||
|
||||
int il4965_remove_default_wep_key(struct il_priv *priv,
|
||||
int il4965_remove_default_wep_key(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *keyconf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
IL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n",
|
||||
IL_DEBUG_WEP(il, "Removing default WEP key: idx=%d\n",
|
||||
keyconf->keyidx);
|
||||
|
||||
memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0]));
|
||||
if (il_is_rfkill(priv)) {
|
||||
IL_DEBUG_WEP(priv,
|
||||
if (il_is_rfkill(il)) {
|
||||
IL_DEBUG_WEP(il,
|
||||
"Not sending REPLY_WEPKEY command due to RFKILL.\n");
|
||||
/* but keys in device are clear anyway so return success */
|
||||
return 0;
|
||||
}
|
||||
ret = il4965_static_wepkey_cmd(priv, ctx, 1);
|
||||
IL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n",
|
||||
ret = il4965_static_wepkey_cmd(il, ctx, 1);
|
||||
IL_DEBUG_WEP(il, "Remove default WEP key: idx=%d ret=%d\n",
|
||||
keyconf->keyidx, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int il4965_set_default_wep_key(struct il_priv *priv,
|
||||
int il4965_set_default_wep_key(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *keyconf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
if (keyconf->keylen != WEP_KEY_LEN_128 &&
|
||||
keyconf->keylen != WEP_KEY_LEN_64) {
|
||||
IL_DEBUG_WEP(priv, "Bad WEP key length %d\n", keyconf->keylen);
|
||||
IL_DEBUG_WEP(il, "Bad WEP key length %d\n", keyconf->keylen);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV;
|
||||
keyconf->hw_key_idx = HW_KEY_DEFAULT;
|
||||
priv->stations[ctx->ap_sta_id].keyinfo.cipher = keyconf->cipher;
|
||||
il->stations[ctx->ap_sta_id].keyinfo.cipher = keyconf->cipher;
|
||||
|
||||
ctx->wep_keys[keyconf->keyidx].key_size = keyconf->keylen;
|
||||
memcpy(&ctx->wep_keys[keyconf->keyidx].key, &keyconf->key,
|
||||
keyconf->keylen);
|
||||
|
||||
ret = il4965_static_wepkey_cmd(priv, ctx, false);
|
||||
IL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n",
|
||||
ret = il4965_static_wepkey_cmd(il, ctx, false);
|
||||
IL_DEBUG_WEP(il, "Set default WEP key: len=%d idx=%d ret=%d\n",
|
||||
keyconf->keylen, keyconf->keyidx, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int il4965_set_wep_dynamic_key_info(struct il_priv *priv,
|
||||
static int il4965_set_wep_dynamic_key_info(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *keyconf,
|
||||
u8 sta_id)
|
||||
@ -254,7 +254,7 @@ static int il4965_set_wep_dynamic_key_info(struct il_priv *priv,
|
||||
__le16 key_flags = 0;
|
||||
struct il_addsta_cmd sta_cmd;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV;
|
||||
|
||||
@ -268,40 +268,40 @@ static int il4965_set_wep_dynamic_key_info(struct il_priv *priv,
|
||||
if (sta_id == ctx->bcast_sta_id)
|
||||
key_flags |= STA_KEY_MULTICAST_MSK;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
|
||||
priv->stations[sta_id].keyinfo.cipher = keyconf->cipher;
|
||||
priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
|
||||
priv->stations[sta_id].keyinfo.keyidx = keyconf->keyidx;
|
||||
il->stations[sta_id].keyinfo.cipher = keyconf->cipher;
|
||||
il->stations[sta_id].keyinfo.keylen = keyconf->keylen;
|
||||
il->stations[sta_id].keyinfo.keyidx = keyconf->keyidx;
|
||||
|
||||
memcpy(priv->stations[sta_id].keyinfo.key,
|
||||
memcpy(il->stations[sta_id].keyinfo.key,
|
||||
keyconf->key, keyconf->keylen);
|
||||
|
||||
memcpy(&priv->stations[sta_id].sta.key.key[3],
|
||||
memcpy(&il->stations[sta_id].sta.key.key[3],
|
||||
keyconf->key, keyconf->keylen);
|
||||
|
||||
if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
|
||||
if ((il->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 =
|
||||
il_get_free_ucode_key_index(priv);
|
||||
il->stations[sta_id].sta.key.key_offset =
|
||||
il_get_free_ucode_key_index(il);
|
||||
/* else, we are overriding an existing key => no need to allocated room
|
||||
* in uCode. */
|
||||
|
||||
WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
|
||||
WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
|
||||
"no space for a new key");
|
||||
|
||||
priv->stations[sta_id].sta.key.key_flags = key_flags;
|
||||
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
|
||||
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
il->stations[sta_id].sta.key.key_flags = key_flags;
|
||||
il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
|
||||
il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
|
||||
memcpy(&sta_cmd, &priv->stations[sta_id].sta,
|
||||
memcpy(&sta_cmd, &il->stations[sta_id].sta,
|
||||
sizeof(struct il_addsta_cmd));
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
|
||||
return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
|
||||
}
|
||||
|
||||
static int il4965_set_ccmp_dynamic_key_info(struct il_priv *priv,
|
||||
static int il4965_set_ccmp_dynamic_key_info(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *keyconf,
|
||||
u8 sta_id)
|
||||
@ -310,7 +310,7 @@ static int il4965_set_ccmp_dynamic_key_info(struct il_priv *priv,
|
||||
__le16 key_flags = 0;
|
||||
struct il_addsta_cmd sta_cmd;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK);
|
||||
key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
|
||||
@ -321,38 +321,38 @@ static int il4965_set_ccmp_dynamic_key_info(struct il_priv *priv,
|
||||
|
||||
keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
priv->stations[sta_id].keyinfo.cipher = keyconf->cipher;
|
||||
priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
il->stations[sta_id].keyinfo.cipher = keyconf->cipher;
|
||||
il->stations[sta_id].keyinfo.keylen = keyconf->keylen;
|
||||
|
||||
memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key,
|
||||
memcpy(il->stations[sta_id].keyinfo.key, keyconf->key,
|
||||
keyconf->keylen);
|
||||
|
||||
memcpy(priv->stations[sta_id].sta.key.key, keyconf->key,
|
||||
memcpy(il->stations[sta_id].sta.key.key, keyconf->key,
|
||||
keyconf->keylen);
|
||||
|
||||
if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
|
||||
if ((il->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 =
|
||||
il_get_free_ucode_key_index(priv);
|
||||
il->stations[sta_id].sta.key.key_offset =
|
||||
il_get_free_ucode_key_index(il);
|
||||
/* else, we are overriding an existing key => no need to allocated room
|
||||
* in uCode. */
|
||||
|
||||
WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
|
||||
WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
|
||||
"no space for a new key");
|
||||
|
||||
priv->stations[sta_id].sta.key.key_flags = key_flags;
|
||||
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
|
||||
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
il->stations[sta_id].sta.key.key_flags = key_flags;
|
||||
il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
|
||||
il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
|
||||
memcpy(&sta_cmd, &priv->stations[sta_id].sta,
|
||||
memcpy(&sta_cmd, &il->stations[sta_id].sta,
|
||||
sizeof(struct il_addsta_cmd));
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
|
||||
return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
|
||||
}
|
||||
|
||||
static int il4965_set_tkip_dynamic_key_info(struct il_priv *priv,
|
||||
static int il4965_set_tkip_dynamic_key_info(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *keyconf,
|
||||
u8 sta_id)
|
||||
@ -371,35 +371,35 @@ static int il4965_set_tkip_dynamic_key_info(struct il_priv *priv,
|
||||
keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
|
||||
keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
|
||||
priv->stations[sta_id].keyinfo.cipher = keyconf->cipher;
|
||||
priv->stations[sta_id].keyinfo.keylen = 16;
|
||||
il->stations[sta_id].keyinfo.cipher = keyconf->cipher;
|
||||
il->stations[sta_id].keyinfo.keylen = 16;
|
||||
|
||||
if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
|
||||
if ((il->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 =
|
||||
il_get_free_ucode_key_index(priv);
|
||||
il->stations[sta_id].sta.key.key_offset =
|
||||
il_get_free_ucode_key_index(il);
|
||||
/* else, we are overriding an existing key => no need to allocated room
|
||||
* in uCode. */
|
||||
|
||||
WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
|
||||
WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
|
||||
"no space for a new key");
|
||||
|
||||
priv->stations[sta_id].sta.key.key_flags = key_flags;
|
||||
il->stations[sta_id].sta.key.key_flags = key_flags;
|
||||
|
||||
|
||||
/* This copy is acutally not needed: we get the key with each TX */
|
||||
memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16);
|
||||
memcpy(il->stations[sta_id].keyinfo.key, keyconf->key, 16);
|
||||
|
||||
memcpy(priv->stations[sta_id].sta.key.key, keyconf->key, 16);
|
||||
memcpy(il->stations[sta_id].sta.key.key, keyconf->key, 16);
|
||||
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void il4965_update_tkip_key(struct il_priv *priv,
|
||||
void il4965_update_tkip_key(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *keyconf,
|
||||
struct ieee80211_sta *sta, u32 iv32, u16 *phase1key)
|
||||
@ -408,34 +408,34 @@ void il4965_update_tkip_key(struct il_priv *priv,
|
||||
unsigned long flags;
|
||||
int i;
|
||||
|
||||
if (il_scan_cancel(priv)) {
|
||||
if (il_scan_cancel(il)) {
|
||||
/* cancel scan failed, just live w/ bad key and rely
|
||||
briefly on SW decryption */
|
||||
return;
|
||||
}
|
||||
|
||||
sta_id = il_sta_id_or_broadcast(priv, ctx, sta);
|
||||
sta_id = il_sta_id_or_broadcast(il, ctx, sta);
|
||||
if (sta_id == IL_INVALID_STATION)
|
||||
return;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
|
||||
priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32;
|
||||
il->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
priv->stations[sta_id].sta.key.tkip_rx_ttak[i] =
|
||||
il->stations[sta_id].sta.key.tkip_rx_ttak[i] =
|
||||
cpu_to_le16(phase1key[i]);
|
||||
|
||||
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
|
||||
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
|
||||
il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
|
||||
il_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
|
||||
il_send_add_sta(il, &il->stations[sta_id].sta, CMD_ASYNC);
|
||||
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
}
|
||||
|
||||
int il4965_remove_dynamic_key(struct il_priv *priv,
|
||||
int il4965_remove_dynamic_key(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *keyconf,
|
||||
u8 sta_id)
|
||||
@ -445,15 +445,15 @@ int il4965_remove_dynamic_key(struct il_priv *priv,
|
||||
u8 keyidx;
|
||||
struct il_addsta_cmd sta_cmd;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
ctx->key_mapping_keys--;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
key_flags = le16_to_cpu(priv->stations[sta_id].sta.key.key_flags);
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
key_flags = le16_to_cpu(il->stations[sta_id].sta.key.key_flags);
|
||||
keyidx = (key_flags >> STA_KEY_FLG_KEYID_POS) & 0x3;
|
||||
|
||||
IL_DEBUG_WEP(priv, "Remove dynamic key: idx=%d sta=%d\n",
|
||||
IL_DEBUG_WEP(il, "Remove dynamic key: idx=%d sta=%d\n",
|
||||
keyconf->keyidx, sta_id);
|
||||
|
||||
if (keyconf->keyidx != keyidx) {
|
||||
@ -462,76 +462,76 @@ int il4965_remove_dynamic_key(struct il_priv *priv,
|
||||
* been replaced by another one with different index.
|
||||
* Don't do anything and return ok
|
||||
*/
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) {
|
||||
IL_WARN(priv, "Removing wrong key %d 0x%x\n",
|
||||
if (il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) {
|
||||
IL_WARN(il, "Removing wrong key %d 0x%x\n",
|
||||
keyconf->keyidx, key_flags);
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!test_and_clear_bit(priv->stations[sta_id].sta.key.key_offset,
|
||||
&priv->ucode_key_table))
|
||||
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,
|
||||
if (!test_and_clear_bit(il->stations[sta_id].sta.key.key_offset,
|
||||
&il->ucode_key_table))
|
||||
IL_ERR(il, "index %d not used in uCode key table.\n",
|
||||
il->stations[sta_id].sta.key.key_offset);
|
||||
memset(&il->stations[sta_id].keyinfo, 0,
|
||||
sizeof(struct il_hw_key));
|
||||
memset(&priv->stations[sta_id].sta.key, 0,
|
||||
memset(&il->stations[sta_id].sta.key, 0,
|
||||
sizeof(struct il4965_keyinfo));
|
||||
priv->stations[sta_id].sta.key.key_flags =
|
||||
il->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;
|
||||
il->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET;
|
||||
il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
|
||||
il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
|
||||
if (il_is_rfkill(priv)) {
|
||||
IL_DEBUG_WEP(priv,
|
||||
if (il_is_rfkill(il)) {
|
||||
IL_DEBUG_WEP(il,
|
||||
"Not sending REPLY_ADD_STA command because RFKILL enabled.\n");
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
memcpy(&sta_cmd, &priv->stations[sta_id].sta,
|
||||
memcpy(&sta_cmd, &il->stations[sta_id].sta,
|
||||
sizeof(struct il_addsta_cmd));
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
|
||||
return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
|
||||
}
|
||||
|
||||
int il4965_set_dynamic_key(struct il_priv *priv, struct il_rxon_context *ctx,
|
||||
int il4965_set_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *keyconf, u8 sta_id)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
ctx->key_mapping_keys++;
|
||||
keyconf->hw_key_idx = HW_KEY_DYNAMIC;
|
||||
|
||||
switch (keyconf->cipher) {
|
||||
case WLAN_CIPHER_SUITE_CCMP:
|
||||
ret = il4965_set_ccmp_dynamic_key_info(priv, ctx,
|
||||
ret = il4965_set_ccmp_dynamic_key_info(il, ctx,
|
||||
keyconf, sta_id);
|
||||
break;
|
||||
case WLAN_CIPHER_SUITE_TKIP:
|
||||
ret = il4965_set_tkip_dynamic_key_info(priv, ctx,
|
||||
ret = il4965_set_tkip_dynamic_key_info(il, ctx,
|
||||
keyconf, sta_id);
|
||||
break;
|
||||
case WLAN_CIPHER_SUITE_WEP40:
|
||||
case WLAN_CIPHER_SUITE_WEP104:
|
||||
ret = il4965_set_wep_dynamic_key_info(priv, ctx,
|
||||
ret = il4965_set_wep_dynamic_key_info(il, ctx,
|
||||
keyconf, sta_id);
|
||||
break;
|
||||
default:
|
||||
IL_ERR(priv,
|
||||
IL_ERR(il,
|
||||
"Unknown alg: %s cipher = %x\n", __func__,
|
||||
keyconf->cipher);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
IL_DEBUG_WEP(priv,
|
||||
IL_DEBUG_WEP(il,
|
||||
"Set dynamic key: cipher=%x len=%d idx=%d sta=%d ret=%d\n",
|
||||
keyconf->cipher, keyconf->keylen, keyconf->keyidx,
|
||||
sta_id, ret);
|
||||
@ -546,37 +546,37 @@ int il4965_set_dynamic_key(struct il_priv *priv, struct il_rxon_context *ctx,
|
||||
* and marks it driver active, so that it will be restored to the
|
||||
* device at the next best time.
|
||||
*/
|
||||
int il4965_alloc_bcast_station(struct il_priv *priv,
|
||||
int il4965_alloc_bcast_station(struct il_priv *il,
|
||||
struct il_rxon_context *ctx)
|
||||
{
|
||||
struct il_link_quality_cmd *link_cmd;
|
||||
unsigned long flags;
|
||||
u8 sta_id;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
sta_id = il_prep_station(priv, ctx, iwlegacy_bcast_addr,
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
sta_id = il_prep_station(il, ctx, iwlegacy_bcast_addr,
|
||||
false, NULL);
|
||||
if (sta_id == IL_INVALID_STATION) {
|
||||
IL_ERR(priv, "Unable to prepare broadcast station\n");
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
IL_ERR(il, "Unable to prepare broadcast station\n");
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
priv->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE;
|
||||
priv->stations[sta_id].used |= IL_STA_BCAST;
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
il->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE;
|
||||
il->stations[sta_id].used |= IL_STA_BCAST;
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
link_cmd = il4965_sta_alloc_lq(priv, sta_id);
|
||||
link_cmd = il4965_sta_alloc_lq(il, sta_id);
|
||||
if (!link_cmd) {
|
||||
IL_ERR(priv,
|
||||
IL_ERR(il,
|
||||
"Unable to initialize rate scaling for bcast station.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
priv->stations[sta_id].lq = link_cmd;
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
il->stations[sta_id].lq = link_cmd;
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -587,39 +587,39 @@ int il4965_alloc_bcast_station(struct il_priv *priv,
|
||||
* Only used by iwl4965. Placed here to have all bcast station management
|
||||
* code together.
|
||||
*/
|
||||
static int il4965_update_bcast_station(struct il_priv *priv,
|
||||
static int il4965_update_bcast_station(struct il_priv *il,
|
||||
struct il_rxon_context *ctx)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct il_link_quality_cmd *link_cmd;
|
||||
u8 sta_id = ctx->bcast_sta_id;
|
||||
|
||||
link_cmd = il4965_sta_alloc_lq(priv, sta_id);
|
||||
link_cmd = il4965_sta_alloc_lq(il, sta_id);
|
||||
if (!link_cmd) {
|
||||
IL_ERR(priv,
|
||||
IL_ERR(il,
|
||||
"Unable to initialize rate scaling for bcast station.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
if (priv->stations[sta_id].lq)
|
||||
kfree(priv->stations[sta_id].lq);
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
if (il->stations[sta_id].lq)
|
||||
kfree(il->stations[sta_id].lq);
|
||||
else
|
||||
IL_DEBUG_INFO(priv,
|
||||
IL_DEBUG_INFO(il,
|
||||
"Bcast station rate scaling has not been initialized yet.\n");
|
||||
priv->stations[sta_id].lq = link_cmd;
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
il->stations[sta_id].lq = link_cmd;
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int il4965_update_bcast_stations(struct il_priv *priv)
|
||||
int il4965_update_bcast_stations(struct il_priv *il)
|
||||
{
|
||||
struct il_rxon_context *ctx;
|
||||
int ret = 0;
|
||||
|
||||
for_each_context(priv, ctx) {
|
||||
ret = il4965_update_bcast_station(priv, ctx);
|
||||
for_each_context(il, ctx) {
|
||||
ret = il4965_update_bcast_station(il, ctx);
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
@ -630,92 +630,92 @@ int il4965_update_bcast_stations(struct il_priv *priv)
|
||||
/**
|
||||
* il4965_sta_tx_modify_enable_tid - Enable Tx for this TID in station table
|
||||
*/
|
||||
int il4965_sta_tx_modify_enable_tid(struct il_priv *priv, int sta_id, int tid)
|
||||
int il4965_sta_tx_modify_enable_tid(struct il_priv *il, int sta_id, int tid)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct il_addsta_cmd sta_cmd;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
/* Remove "disable" flag, to enable Tx for this TID */
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX;
|
||||
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,
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX;
|
||||
il->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid));
|
||||
il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
memcpy(&sta_cmd, &il->stations[sta_id].sta,
|
||||
sizeof(struct il_addsta_cmd));
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
|
||||
return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
|
||||
}
|
||||
|
||||
int il4965_sta_rx_agg_start(struct il_priv *priv, struct ieee80211_sta *sta,
|
||||
int il4965_sta_rx_agg_start(struct il_priv *il, struct ieee80211_sta *sta,
|
||||
int tid, u16 ssn)
|
||||
{
|
||||
unsigned long flags;
|
||||
int sta_id;
|
||||
struct il_addsta_cmd sta_cmd;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
sta_id = il_sta_id(sta);
|
||||
if (sta_id == IL_INVALID_STATION)
|
||||
return -ENXIO;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
priv->stations[sta_id].sta.station_flags_msk = 0;
|
||||
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK;
|
||||
priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid;
|
||||
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,
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
il->stations[sta_id].sta.station_flags_msk = 0;
|
||||
il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK;
|
||||
il->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid;
|
||||
il->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn);
|
||||
il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
memcpy(&sta_cmd, &il->stations[sta_id].sta,
|
||||
sizeof(struct il_addsta_cmd));
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
|
||||
return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
|
||||
}
|
||||
|
||||
int il4965_sta_rx_agg_stop(struct il_priv *priv, struct ieee80211_sta *sta,
|
||||
int il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta,
|
||||
int tid)
|
||||
{
|
||||
unsigned long flags;
|
||||
int sta_id;
|
||||
struct il_addsta_cmd sta_cmd;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
sta_id = il_sta_id(sta);
|
||||
if (sta_id == IL_INVALID_STATION) {
|
||||
IL_ERR(priv, "Invalid station for AGG tid %d\n", tid);
|
||||
IL_ERR(il, "Invalid station for AGG tid %d\n", tid);
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
priv->stations[sta_id].sta.station_flags_msk = 0;
|
||||
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK;
|
||||
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,
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
il->stations[sta_id].sta.station_flags_msk = 0;
|
||||
il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK;
|
||||
il->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid;
|
||||
il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
memcpy(&sta_cmd, &il->stations[sta_id].sta,
|
||||
sizeof(struct il_addsta_cmd));
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
|
||||
return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
|
||||
}
|
||||
|
||||
void
|
||||
il4965_sta_modify_sleep_tx_count(struct il_priv *priv, int sta_id, int cnt)
|
||||
il4965_sta_modify_sleep_tx_count(struct il_priv *il, int sta_id, int cnt)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
priv->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK;
|
||||
priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
|
||||
priv->stations[sta_id].sta.sta.modify_mask =
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
il->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK;
|
||||
il->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
|
||||
il->stations[sta_id].sta.sta.modify_mask =
|
||||
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;
|
||||
il_send_add_sta(priv,
|
||||
&priv->stations[sta_id].sta, CMD_ASYNC);
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
il->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt);
|
||||
il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
il_send_add_sta(il,
|
||||
&il->stations[sta_id].sta, CMD_ASYNC);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -48,22 +48,22 @@
|
||||
* it's a pretty good bet that everything between them is good, too.
|
||||
*/
|
||||
static int
|
||||
il4965_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 len)
|
||||
il4965_verify_inst_sparse(struct il_priv *il, __le32 *image, u32 len)
|
||||
{
|
||||
u32 val;
|
||||
int ret = 0;
|
||||
u32 errcnt = 0;
|
||||
u32 i;
|
||||
|
||||
IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
|
||||
IL_DEBUG_INFO(il, "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 IL_DL_IO is set */
|
||||
il_write_direct32(priv, HBUS_TARG_MEM_RADDR,
|
||||
il_write_direct32(il, HBUS_TARG_MEM_RADDR,
|
||||
i + IWL4965_RTC_INST_LOWER_BOUND);
|
||||
val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT);
|
||||
val = _il_read_direct32(il, HBUS_TARG_MEM_RDAT);
|
||||
if (val != le32_to_cpu(*image)) {
|
||||
ret = -EIO;
|
||||
errcnt++;
|
||||
@ -79,7 +79,7 @@ il4965_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 len)
|
||||
* il4965_verify_inst_full - verify runtime uCode image in card vs. host,
|
||||
* looking at all data.
|
||||
*/
|
||||
static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image,
|
||||
static int il4965_verify_inst_full(struct il_priv *il, __le32 *image,
|
||||
u32 len)
|
||||
{
|
||||
u32 val;
|
||||
@ -87,9 +87,9 @@ static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image,
|
||||
int ret = 0;
|
||||
u32 errcnt;
|
||||
|
||||
IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
|
||||
IL_DEBUG_INFO(il, "ucode inst image size is %u\n", len);
|
||||
|
||||
il_write_direct32(priv, HBUS_TARG_MEM_RADDR,
|
||||
il_write_direct32(il, HBUS_TARG_MEM_RADDR,
|
||||
IWL4965_RTC_INST_LOWER_BOUND);
|
||||
|
||||
errcnt = 0;
|
||||
@ -97,9 +97,9 @@ static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image,
|
||||
/* read data comes through single port, auto-incr addr */
|
||||
/* NOTE: Use the debugless read so we don't flood kernel log
|
||||
* if IL_DL_IO is set */
|
||||
val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT);
|
||||
val = _il_read_direct32(il, HBUS_TARG_MEM_RDAT);
|
||||
if (val != le32_to_cpu(*image)) {
|
||||
IL_ERR(priv, "uCode INST section is invalid at "
|
||||
IL_ERR(il, "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,7 +110,7 @@ static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image,
|
||||
}
|
||||
|
||||
if (!errcnt)
|
||||
IL_DEBUG_INFO(priv,
|
||||
IL_DEBUG_INFO(il,
|
||||
"ucode image in INSTRUCTION memory is good\n");
|
||||
|
||||
return ret;
|
||||
@ -120,47 +120,47 @@ static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image,
|
||||
* il4965_verify_ucode - determine which instruction image is in SRAM,
|
||||
* and verify its contents
|
||||
*/
|
||||
int il4965_verify_ucode(struct il_priv *priv)
|
||||
int il4965_verify_ucode(struct il_priv *il)
|
||||
{
|
||||
__le32 *image;
|
||||
u32 len;
|
||||
int ret;
|
||||
|
||||
/* Try bootstrap */
|
||||
image = (__le32 *)priv->ucode_boot.v_addr;
|
||||
len = priv->ucode_boot.len;
|
||||
ret = il4965_verify_inst_sparse(priv, image, len);
|
||||
image = (__le32 *)il->ucode_boot.v_addr;
|
||||
len = il->ucode_boot.len;
|
||||
ret = il4965_verify_inst_sparse(il, image, len);
|
||||
if (!ret) {
|
||||
IL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n");
|
||||
IL_DEBUG_INFO(il, "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 = il4965_verify_inst_sparse(priv, image, len);
|
||||
image = (__le32 *)il->ucode_init.v_addr;
|
||||
len = il->ucode_init.len;
|
||||
ret = il4965_verify_inst_sparse(il, image, len);
|
||||
if (!ret) {
|
||||
IL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n");
|
||||
IL_DEBUG_INFO(il, "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 = il4965_verify_inst_sparse(priv, image, len);
|
||||
image = (__le32 *)il->ucode_code.v_addr;
|
||||
len = il->ucode_code.len;
|
||||
ret = il4965_verify_inst_sparse(il, image, len);
|
||||
if (!ret) {
|
||||
IL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n");
|
||||
IL_DEBUG_INFO(il, "Runtime uCode is good in inst SRAM\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
IL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
|
||||
IL_ERR(il, "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 = il4965_verify_inst_full(priv, image, len);
|
||||
image = (__le32 *)il->ucode_boot.v_addr;
|
||||
len = il->ucode_boot.len;
|
||||
ret = il4965_verify_inst_full(il, image, len);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -73,75 +73,75 @@ extern struct il_mod_params il4965_mod_params;
|
||||
extern struct ieee80211_ops il4965_hw_ops;
|
||||
|
||||
/* tx queue */
|
||||
void il4965_free_tfds_in_queue(struct il_priv *priv,
|
||||
void il4965_free_tfds_in_queue(struct il_priv *il,
|
||||
int sta_id, int tid, int freed);
|
||||
|
||||
/* RXON */
|
||||
void il4965_set_rxon_chain(struct il_priv *priv,
|
||||
void il4965_set_rxon_chain(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
|
||||
/* uCode */
|
||||
int il4965_verify_ucode(struct il_priv *priv);
|
||||
int il4965_verify_ucode(struct il_priv *il);
|
||||
|
||||
/* lib */
|
||||
void il4965_check_abort_status(struct il_priv *priv,
|
||||
void il4965_check_abort_status(struct il_priv *il,
|
||||
u8 frame_count, u32 status);
|
||||
|
||||
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);
|
||||
void il4965_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq);
|
||||
int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq);
|
||||
int il4965_hw_nic_init(struct il_priv *il);
|
||||
int il4965_dump_fh(struct il_priv *il, char **buf, bool display);
|
||||
|
||||
/* rx */
|
||||
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);
|
||||
void il4965_rx_queue_restock(struct il_priv *il);
|
||||
void il4965_rx_replenish(struct il_priv *il);
|
||||
void il4965_rx_replenish_now(struct il_priv *il);
|
||||
void il4965_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq);
|
||||
int il4965_rxq_stop(struct il_priv *il);
|
||||
int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band);
|
||||
void il4965_rx_reply_rx(struct il_priv *priv,
|
||||
void il4965_rx_reply_rx(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
void il4965_rx_reply_rx_phy(struct il_priv *priv,
|
||||
void il4965_rx_reply_rx_phy(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
void il4965_rx_handle(struct il_priv *priv);
|
||||
void il4965_rx_handle(struct il_priv *il);
|
||||
|
||||
/* tx */
|
||||
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,
|
||||
void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq);
|
||||
int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il,
|
||||
struct il_tx_queue *txq,
|
||||
dma_addr_t addr, u16 len, u8 reset, u8 pad);
|
||||
int il4965_hw_tx_queue_init(struct il_priv *priv,
|
||||
int il4965_hw_tx_queue_init(struct il_priv *il,
|
||||
struct il_tx_queue *txq);
|
||||
void il4965_hwrate_to_tx_control(struct il_priv *priv, u32 rate_n_flags,
|
||||
void il4965_hwrate_to_tx_control(struct il_priv *il, u32 rate_n_flags,
|
||||
struct ieee80211_tx_info *info);
|
||||
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,
|
||||
int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb);
|
||||
int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif,
|
||||
struct ieee80211_sta *sta, u16 tid, u16 *ssn);
|
||||
int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif,
|
||||
int il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif,
|
||||
struct ieee80211_sta *sta, u16 tid);
|
||||
int il4965_txq_check_empty(struct il_priv *priv,
|
||||
int il4965_txq_check_empty(struct il_priv *il,
|
||||
int sta_id, u8 tid, int txq_id);
|
||||
void il4965_rx_reply_compressed_ba(struct il_priv *priv,
|
||||
void il4965_rx_reply_compressed_ba(struct il_priv *il,
|
||||
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);
|
||||
int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int index);
|
||||
void il4965_hw_txq_ctx_free(struct il_priv *il);
|
||||
int il4965_txq_ctx_alloc(struct il_priv *il);
|
||||
void il4965_txq_ctx_reset(struct il_priv *il);
|
||||
void il4965_txq_ctx_stop(struct il_priv *il);
|
||||
void il4965_txq_set_sched(struct il_priv *il, u32 mask);
|
||||
|
||||
/*
|
||||
* Acquire priv->lock before calling this function !
|
||||
* Acquire il->lock before calling this function !
|
||||
*/
|
||||
void il4965_set_wr_ptrs(struct il_priv *priv, int txq_id, u32 index);
|
||||
void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 index);
|
||||
/**
|
||||
* 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 !
|
||||
* NOTE: Acquire il->lock before calling this function !
|
||||
*/
|
||||
void il4965_tx_queue_set_status(struct il_priv *priv,
|
||||
void il4965_tx_queue_set_status(struct il_priv *il,
|
||||
struct il_tx_queue *txq,
|
||||
int tx_fifo_id, int scd_retry);
|
||||
|
||||
@ -167,27 +167,27 @@ static inline bool il4965_is_tx_success(u32 status)
|
||||
(status == TX_STATUS_DIRECT_DONE);
|
||||
}
|
||||
|
||||
u8 il4965_toggle_tx_ant(struct il_priv *priv, u8 ant_idx, u8 valid);
|
||||
u8 il4965_toggle_tx_ant(struct il_priv *il, u8 ant_idx, u8 valid);
|
||||
|
||||
/* rx */
|
||||
void il4965_rx_missed_beacon_notif(struct il_priv *priv,
|
||||
void il4965_rx_missed_beacon_notif(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
bool il4965_good_plcp_health(struct il_priv *priv,
|
||||
bool il4965_good_plcp_health(struct il_priv *il,
|
||||
struct il_rx_packet *pkt);
|
||||
void il4965_rx_statistics(struct il_priv *priv,
|
||||
void il4965_rx_statistics(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
void il4965_reply_statistics(struct il_priv *priv,
|
||||
void il4965_reply_statistics(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
|
||||
/* scan */
|
||||
int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif);
|
||||
int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif);
|
||||
|
||||
/* station mgmt */
|
||||
int il4965_manage_ibss_station(struct il_priv *priv,
|
||||
int il4965_manage_ibss_station(struct il_priv *il,
|
||||
struct ieee80211_vif *vif, bool add);
|
||||
|
||||
/* hcmd */
|
||||
int il4965_send_beacon_cmd(struct il_priv *priv);
|
||||
int il4965_send_beacon_cmd(struct il_priv *il);
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
const char *il4965_get_tx_fail_reason(u32 status);
|
||||
@ -197,38 +197,38 @@ il4965_get_tx_fail_reason(u32 status) { return ""; }
|
||||
#endif
|
||||
|
||||
/* station management */
|
||||
int il4965_alloc_bcast_station(struct il_priv *priv,
|
||||
int il4965_alloc_bcast_station(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
int il4965_add_bssid_station(struct il_priv *priv,
|
||||
int il4965_add_bssid_station(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
const u8 *addr, u8 *sta_id_r);
|
||||
int il4965_remove_default_wep_key(struct il_priv *priv,
|
||||
int il4965_remove_default_wep_key(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *key);
|
||||
int il4965_set_default_wep_key(struct il_priv *priv,
|
||||
int il4965_set_default_wep_key(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *key);
|
||||
int il4965_restore_default_wep_keys(struct il_priv *priv,
|
||||
int il4965_restore_default_wep_keys(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
int il4965_set_dynamic_key(struct il_priv *priv,
|
||||
int il4965_set_dynamic_key(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *key, u8 sta_id);
|
||||
int il4965_remove_dynamic_key(struct il_priv *priv,
|
||||
int il4965_remove_dynamic_key(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *key, u8 sta_id);
|
||||
void il4965_update_tkip_key(struct il_priv *priv,
|
||||
void il4965_update_tkip_key(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_key_conf *keyconf,
|
||||
struct ieee80211_sta *sta, u32 iv32, u16 *phase1key);
|
||||
int il4965_sta_tx_modify_enable_tid(struct il_priv *priv,
|
||||
int il4965_sta_tx_modify_enable_tid(struct il_priv *il,
|
||||
int sta_id, int tid);
|
||||
int il4965_sta_rx_agg_start(struct il_priv *priv, struct ieee80211_sta *sta,
|
||||
int il4965_sta_rx_agg_start(struct il_priv *il, struct ieee80211_sta *sta,
|
||||
int tid, u16 ssn);
|
||||
int il4965_sta_rx_agg_stop(struct il_priv *priv, struct ieee80211_sta *sta,
|
||||
int il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta,
|
||||
int tid);
|
||||
void il4965_sta_modify_sleep_tx_count(struct il_priv *priv,
|
||||
void il4965_sta_modify_sleep_tx_count(struct il_priv *il,
|
||||
int sta_id, int cnt);
|
||||
int il4965_update_bcast_stations(struct il_priv *priv);
|
||||
int il4965_update_bcast_stations(struct il_priv *il);
|
||||
|
||||
/* rate */
|
||||
static inline u32 il4965_ant_idx_to_flags(u8 ant_idx)
|
||||
@ -247,10 +247,10 @@ static inline __le32 il4965_hw_set_rate_n_flags(u8 rate, u32 flags)
|
||||
}
|
||||
|
||||
/* eeprom */
|
||||
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);
|
||||
void il4965_eeprom_get_mac(const struct il_priv *il, u8 *mac);
|
||||
int il4965_eeprom_acquire_semaphore(struct il_priv *il);
|
||||
void il4965_eeprom_release_semaphore(struct il_priv *il);
|
||||
int il4965_eeprom_check_version(struct il_priv *il);
|
||||
|
||||
/* mac80211 handlers (for 4965) */
|
||||
void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -88,9 +88,9 @@ struct il_cmd;
|
||||
#define IL_CMD(x) case x: return #x
|
||||
|
||||
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,
|
||||
int (*rxon_assoc)(struct il_priv *il, struct il_rxon_context *ctx);
|
||||
int (*commit_rxon)(struct il_priv *il, struct il_rxon_context *ctx);
|
||||
void (*set_rxon_chain)(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
};
|
||||
|
||||
@ -98,13 +98,13 @@ struct il_hcmd_utils_ops {
|
||||
u16 (*get_hcmd_size)(u8 cmd_id, u16 len);
|
||||
u16 (*build_addsta_hcmd)(const struct il_addsta_cmd *cmd,
|
||||
u8 *data);
|
||||
int (*request_scan)(struct il_priv *priv, struct ieee80211_vif *vif);
|
||||
void (*post_scan)(struct il_priv *priv);
|
||||
int (*request_scan)(struct il_priv *il, struct ieee80211_vif *vif);
|
||||
void (*post_scan)(struct il_priv *il);
|
||||
};
|
||||
|
||||
struct il_apm_ops {
|
||||
int (*init)(struct il_priv *priv);
|
||||
void (*config)(struct il_priv *priv);
|
||||
int (*init)(struct il_priv *il);
|
||||
void (*config)(struct il_priv *il);
|
||||
};
|
||||
|
||||
struct il_debugfs_ops {
|
||||
@ -117,43 +117,43 @@ struct il_debugfs_ops {
|
||||
};
|
||||
|
||||
struct il_temp_ops {
|
||||
void (*temperature)(struct il_priv *priv);
|
||||
void (*temperature)(struct il_priv *il);
|
||||
};
|
||||
|
||||
struct il_lib_ops {
|
||||
/* set hw dependent parameters */
|
||||
int (*set_hw_params)(struct il_priv *priv);
|
||||
int (*set_hw_params)(struct il_priv *il);
|
||||
/* Handling TX */
|
||||
void (*txq_update_byte_cnt_tbl)(struct il_priv *priv,
|
||||
void (*txq_update_byte_cnt_tbl)(struct il_priv *il,
|
||||
struct il_tx_queue *txq,
|
||||
u16 byte_cnt);
|
||||
int (*txq_attach_buf_to_tfd)(struct il_priv *priv,
|
||||
int (*txq_attach_buf_to_tfd)(struct il_priv *il,
|
||||
struct il_tx_queue *txq,
|
||||
dma_addr_t addr,
|
||||
u16 len, u8 reset, u8 pad);
|
||||
void (*txq_free_tfd)(struct il_priv *priv,
|
||||
void (*txq_free_tfd)(struct il_priv *il,
|
||||
struct il_tx_queue *txq);
|
||||
int (*txq_init)(struct il_priv *priv,
|
||||
int (*txq_init)(struct il_priv *il,
|
||||
struct il_tx_queue *txq);
|
||||
/* setup Rx handler */
|
||||
void (*rx_handler_setup)(struct il_priv *priv);
|
||||
void (*rx_handler_setup)(struct il_priv *il);
|
||||
/* alive notification after init uCode load */
|
||||
void (*init_alive_start)(struct il_priv *priv);
|
||||
void (*init_alive_start)(struct il_priv *il);
|
||||
/* check validity of rtc data address */
|
||||
int (*is_valid_rtc_data_addr)(u32 addr);
|
||||
/* 1st ucode load */
|
||||
int (*load_ucode)(struct il_priv *priv);
|
||||
int (*load_ucode)(struct il_priv *il);
|
||||
|
||||
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,
|
||||
void (*dump_nic_error_log)(struct il_priv *il);
|
||||
int (*dump_fh)(struct il_priv *il, char **buf, bool display);
|
||||
int (*set_channel_switch)(struct il_priv *il,
|
||||
struct ieee80211_channel_switch *ch_switch);
|
||||
/* power management */
|
||||
struct il_apm_ops apm_ops;
|
||||
|
||||
/* power */
|
||||
int (*send_tx_power) (struct il_priv *priv);
|
||||
void (*update_chain_flags)(struct il_priv *priv);
|
||||
int (*send_tx_power) (struct il_priv *il);
|
||||
void (*update_chain_flags)(struct il_priv *il);
|
||||
|
||||
/* eeprom operations (as defined in iwl-eeprom.h) */
|
||||
struct il_eeprom_ops eeprom_ops;
|
||||
@ -166,15 +166,15 @@ struct il_lib_ops {
|
||||
};
|
||||
|
||||
struct il_led_ops {
|
||||
int (*cmd)(struct il_priv *priv, struct il_led_cmd *led_cmd);
|
||||
int (*cmd)(struct il_priv *il, struct il_led_cmd *led_cmd);
|
||||
};
|
||||
|
||||
struct il_legacy_ops {
|
||||
void (*post_associate)(struct il_priv *priv);
|
||||
void (*config_ap)(struct il_priv *priv);
|
||||
void (*post_associate)(struct il_priv *il);
|
||||
void (*config_ap)(struct il_priv *il);
|
||||
/* station management */
|
||||
int (*update_bcast_stations)(struct il_priv *priv);
|
||||
int (*manage_ibss_station)(struct il_priv *priv,
|
||||
int (*update_bcast_stations)(struct il_priv *il);
|
||||
int (*manage_ibss_station)(struct il_priv *il,
|
||||
struct ieee80211_vif *vif, bool add);
|
||||
};
|
||||
|
||||
@ -247,7 +247,7 @@ struct il_base_params {
|
||||
* on firmware version used.
|
||||
*
|
||||
* For example,
|
||||
* if (IL_UCODE_API(priv->ucode_ver) >= 2) {
|
||||
* if (IL_UCODE_API(il->ucode_ver) >= 2) {
|
||||
* Driver interacts with Firmware API version >= 2.
|
||||
* } else {
|
||||
* Driver interacts with Firmware API version 1.
|
||||
@ -290,35 +290,35 @@ int il_mac_conf_tx(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif, u16 queue,
|
||||
const struct ieee80211_tx_queue_params *params);
|
||||
int il_mac_tx_last_beacon(struct ieee80211_hw *hw);
|
||||
void il_set_rxon_hwcrypto(struct il_priv *priv,
|
||||
void il_set_rxon_hwcrypto(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
int hw_decrypt);
|
||||
int il_check_rxon_cmd(struct il_priv *priv,
|
||||
int il_check_rxon_cmd(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
int il_full_rxon_required(struct il_priv *priv,
|
||||
int il_full_rxon_required(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
int il_set_rxon_channel(struct il_priv *priv,
|
||||
int il_set_rxon_channel(struct il_priv *il,
|
||||
struct ieee80211_channel *ch,
|
||||
struct il_rxon_context *ctx);
|
||||
void il_set_flags_for_band(struct il_priv *priv,
|
||||
void il_set_flags_for_band(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
enum ieee80211_band band,
|
||||
struct ieee80211_vif *vif);
|
||||
u8 il_get_single_channel_number(struct il_priv *priv,
|
||||
u8 il_get_single_channel_number(struct il_priv *il,
|
||||
enum ieee80211_band band);
|
||||
void il_set_rxon_ht(struct il_priv *priv,
|
||||
void il_set_rxon_ht(struct il_priv *il,
|
||||
struct il_ht_config *ht_conf);
|
||||
bool il_is_ht40_tx_allowed(struct il_priv *priv,
|
||||
bool il_is_ht40_tx_allowed(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct ieee80211_sta_ht_cap *ht_cap);
|
||||
void il_connection_init_rx_config(struct il_priv *priv,
|
||||
void il_connection_init_rx_config(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
void il_set_rate(struct il_priv *priv);
|
||||
int il_set_decrypted_flag(struct il_priv *priv,
|
||||
void il_set_rate(struct il_priv *il);
|
||||
int il_set_decrypted_flag(struct il_priv *il,
|
||||
struct ieee80211_hdr *hdr,
|
||||
u32 decrypt_res,
|
||||
struct ieee80211_rx_status *stats);
|
||||
void il_irq_handle_error(struct il_priv *priv);
|
||||
void il_irq_handle_error(struct il_priv *il);
|
||||
int il_mac_add_interface(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif);
|
||||
void il_mac_remove_interface(struct ieee80211_hw *hw,
|
||||
@ -326,42 +326,42 @@ void il_mac_remove_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 il_alloc_txq_mem(struct il_priv *priv);
|
||||
void il_txq_mem(struct il_priv *priv);
|
||||
int il_alloc_txq_mem(struct il_priv *il);
|
||||
void il_txq_mem(struct il_priv *il);
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
|
||||
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,
|
||||
int il_alloc_traffic_mem(struct il_priv *il);
|
||||
void il_free_traffic_mem(struct il_priv *il);
|
||||
void il_reset_traffic_log(struct il_priv *il);
|
||||
void il_dbg_log_tx_data_frame(struct il_priv *il,
|
||||
u16 length, struct ieee80211_hdr *header);
|
||||
void il_dbg_log_rx_data_frame(struct il_priv *priv,
|
||||
void il_dbg_log_rx_data_frame(struct il_priv *il,
|
||||
u16 length, struct ieee80211_hdr *header);
|
||||
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,
|
||||
void il_clear_traffic_stats(struct il_priv *il);
|
||||
void il_update_stats(struct il_priv *il, bool is_tx, __le16 fc,
|
||||
u16 len);
|
||||
#else
|
||||
static inline int il_alloc_traffic_mem(struct il_priv *priv)
|
||||
static inline int il_alloc_traffic_mem(struct il_priv *il)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void il_free_traffic_mem(struct il_priv *priv)
|
||||
static inline void il_free_traffic_mem(struct il_priv *il)
|
||||
{
|
||||
}
|
||||
static inline void il_reset_traffic_log(struct il_priv *priv)
|
||||
static inline void il_reset_traffic_log(struct il_priv *il)
|
||||
{
|
||||
}
|
||||
static inline void il_dbg_log_tx_data_frame(struct il_priv *priv,
|
||||
static inline void il_dbg_log_tx_data_frame(struct il_priv *il,
|
||||
u16 length, struct ieee80211_hdr *header)
|
||||
{
|
||||
}
|
||||
static inline void il_dbg_log_rx_data_frame(struct il_priv *priv,
|
||||
static inline void il_dbg_log_rx_data_frame(struct il_priv *il,
|
||||
u16 length, struct ieee80211_hdr *header)
|
||||
{
|
||||
}
|
||||
static inline void il_update_stats(struct il_priv *priv, bool is_tx,
|
||||
static inline void il_update_stats(struct il_priv *il, bool is_tx,
|
||||
__le16 fc, u16 len)
|
||||
{
|
||||
}
|
||||
@ -369,83 +369,83 @@ static inline void il_update_stats(struct il_priv *priv, bool is_tx,
|
||||
/*****************************************************
|
||||
* RX handlers.
|
||||
* **************************************************/
|
||||
void il_rx_pm_sleep_notif(struct il_priv *priv,
|
||||
void il_rx_pm_sleep_notif(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
void il_rx_pm_debug_statistics_notif(struct il_priv *priv,
|
||||
void il_rx_pm_debug_statistics_notif(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
void il_rx_reply_error(struct il_priv *priv,
|
||||
void il_rx_reply_error(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
|
||||
/*****************************************************
|
||||
* RX
|
||||
******************************************************/
|
||||
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,
|
||||
void il_cmd_queue_unmap(struct il_priv *il);
|
||||
void il_cmd_queue_free(struct il_priv *il);
|
||||
int il_rx_queue_alloc(struct il_priv *il);
|
||||
void il_rx_queue_update_write_ptr(struct il_priv *il,
|
||||
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,
|
||||
void il_tx_cmd_complete(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
/* Handlers */
|
||||
void il_rx_spectrum_measure_notif(struct il_priv *priv,
|
||||
void il_rx_spectrum_measure_notif(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
void il_recover_from_statistics(struct il_priv *priv,
|
||||
void il_recover_from_statistics(struct il_priv *il,
|
||||
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);
|
||||
void il_chswitch_done(struct il_priv *il, bool is_success);
|
||||
void il_rx_csa(struct il_priv *il, struct il_rx_mem_buffer *rxb);
|
||||
|
||||
/* TX helpers */
|
||||
|
||||
/*****************************************************
|
||||
* TX
|
||||
******************************************************/
|
||||
void il_txq_update_write_ptr(struct il_priv *priv,
|
||||
void il_txq_update_write_ptr(struct il_priv *il,
|
||||
struct il_tx_queue *txq);
|
||||
int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq,
|
||||
int il_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq,
|
||||
int slots_num, u32 txq_id);
|
||||
void il_tx_queue_reset(struct il_priv *priv,
|
||||
void il_tx_queue_reset(struct il_priv *il,
|
||||
struct il_tx_queue *txq,
|
||||
int slots_num, u32 txq_id);
|
||||
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);
|
||||
void il_tx_queue_unmap(struct il_priv *il, int txq_id);
|
||||
void il_tx_queue_free(struct il_priv *il, int txq_id);
|
||||
void il_setup_watchdog(struct il_priv *il);
|
||||
/*****************************************************
|
||||
* TX power
|
||||
****************************************************/
|
||||
int il_set_tx_power(struct il_priv *priv, s8 tx_power, bool force);
|
||||
int il_set_tx_power(struct il_priv *il, s8 tx_power, bool force);
|
||||
|
||||
/*******************************************************************************
|
||||
* Rate
|
||||
******************************************************************************/
|
||||
|
||||
u8 il_get_lowest_plcp(struct il_priv *priv,
|
||||
u8 il_get_lowest_plcp(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
|
||||
/*******************************************************************************
|
||||
* Scanning
|
||||
******************************************************************************/
|
||||
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);
|
||||
void il_init_scan_params(struct il_priv *il);
|
||||
int il_scan_cancel(struct il_priv *il);
|
||||
int il_scan_cancel_timeout(struct il_priv *il, unsigned long ms);
|
||||
void il_force_scan_end(struct il_priv *il);
|
||||
int il_mac_hw_scan(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct cfg80211_scan_request *req);
|
||||
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,
|
||||
void il_internal_short_hw_scan(struct il_priv *il);
|
||||
int il_force_reset(struct il_priv *il, bool external);
|
||||
u16 il_fill_probe_req(struct il_priv *il,
|
||||
struct ieee80211_mgmt *frame,
|
||||
const u8 *ta, const u8 *ie, int ie_len, int left);
|
||||
void il_setup_rx_scan_handlers(struct il_priv *priv);
|
||||
u16 il_get_active_dwell_time(struct il_priv *priv,
|
||||
void il_setup_rx_scan_handlers(struct il_priv *il);
|
||||
u16 il_get_active_dwell_time(struct il_priv *il,
|
||||
enum ieee80211_band band,
|
||||
u8 n_probes);
|
||||
u16 il_get_passive_dwell_time(struct il_priv *priv,
|
||||
u16 il_get_passive_dwell_time(struct il_priv *il,
|
||||
enum ieee80211_band band,
|
||||
struct ieee80211_vif *vif);
|
||||
void il_setup_scan_deferred_work(struct il_priv *priv);
|
||||
void il_cancel_scan_deferred_work(struct il_priv *priv);
|
||||
void il_setup_scan_deferred_work(struct il_priv *il);
|
||||
void il_cancel_scan_deferred_work(struct il_priv *il);
|
||||
|
||||
/* For faster active scanning, scan will move to the next channel if fewer than
|
||||
* PLCP_QUIET_THRESH packets are heard on this channel within
|
||||
@ -463,37 +463,37 @@ void il_cancel_scan_deferred_work(struct il_priv *priv);
|
||||
*****************************************************/
|
||||
|
||||
const char *il_get_cmd_string(u8 cmd);
|
||||
int __must_check il_send_cmd_sync(struct il_priv *priv,
|
||||
int __must_check il_send_cmd_sync(struct il_priv *il,
|
||||
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,
|
||||
int il_send_cmd(struct il_priv *il, struct il_host_cmd *cmd);
|
||||
int __must_check il_send_cmd_pdu(struct il_priv *il, u8 id,
|
||||
u16 len, const void *data);
|
||||
int il_send_cmd_pdu_async(struct il_priv *priv, u8 id, u16 len,
|
||||
int il_send_cmd_pdu_async(struct il_priv *il, u8 id, u16 len,
|
||||
const void *data,
|
||||
void (*callback)(struct il_priv *priv,
|
||||
void (*callback)(struct il_priv *il,
|
||||
struct il_device_cmd *cmd,
|
||||
struct il_rx_packet *pkt));
|
||||
|
||||
int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd);
|
||||
int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd);
|
||||
|
||||
|
||||
/*****************************************************
|
||||
* PCI *
|
||||
*****************************************************/
|
||||
|
||||
static inline u16 il_pcie_link_ctl(struct il_priv *priv)
|
||||
static inline u16 il_pcie_link_ctl(struct il_priv *il)
|
||||
{
|
||||
int pos;
|
||||
u16 pci_lnk_ctl;
|
||||
pos = pci_pcie_cap(priv->pci_dev);
|
||||
pci_read_config_word(priv->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl);
|
||||
pos = pci_pcie_cap(il->pci_dev);
|
||||
pci_read_config_word(il->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl);
|
||||
return pci_lnk_ctl;
|
||||
}
|
||||
|
||||
void il_bg_watchdog(unsigned long data);
|
||||
u32 il_usecs_to_beacons(struct il_priv *priv,
|
||||
u32 il_usecs_to_beacons(struct il_priv *il,
|
||||
u32 usec, u32 beacon_interval);
|
||||
__le32 il_add_beacon_time(struct il_priv *priv, u32 base,
|
||||
__le32 il_add_beacon_time(struct il_priv *il, u32 base,
|
||||
u32 addon, u32 beacon_interval);
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
@ -512,24 +512,24 @@ extern const struct dev_pm_ops il_pm_ops;
|
||||
/*****************************************************
|
||||
* Error Handling Debugging
|
||||
******************************************************/
|
||||
void il4965_dump_nic_error_log(struct il_priv *priv);
|
||||
void il4965_dump_nic_error_log(struct il_priv *il);
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
void il_print_rx_config_cmd(struct il_priv *priv,
|
||||
void il_print_rx_config_cmd(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
#else
|
||||
static inline void il_print_rx_config_cmd(struct il_priv *priv,
|
||||
static inline void il_print_rx_config_cmd(struct il_priv *il,
|
||||
struct il_rxon_context *ctx)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void il_clear_isr_stats(struct il_priv *priv);
|
||||
void il_clear_isr_stats(struct il_priv *il);
|
||||
|
||||
/*****************************************************
|
||||
* GEOS
|
||||
******************************************************/
|
||||
int il_init_geos(struct il_priv *priv);
|
||||
void il_free_geos(struct il_priv *priv);
|
||||
int il_init_geos(struct il_priv *il);
|
||||
void il_free_geos(struct il_priv *il);
|
||||
|
||||
/*************** DRIVER STATUS FUNCTIONS *****/
|
||||
|
||||
@ -552,71 +552,71 @@ void il_free_geos(struct il_priv *priv);
|
||||
#define STATUS_FW_ERROR 17
|
||||
#define STATUS_CHANNEL_SWITCH_PENDING 18
|
||||
|
||||
static inline int il_is_ready(struct il_priv *priv)
|
||||
static inline int il_is_ready(struct il_priv *il)
|
||||
{
|
||||
/* The adapter is 'ready' if READY and GEO_CONFIGURED bits are
|
||||
* set but EXIT_PENDING is not */
|
||||
return test_bit(STATUS_READY, &priv->status) &&
|
||||
test_bit(STATUS_GEO_CONFIGURED, &priv->status) &&
|
||||
!test_bit(STATUS_EXIT_PENDING, &priv->status);
|
||||
return test_bit(STATUS_READY, &il->status) &&
|
||||
test_bit(STATUS_GEO_CONFIGURED, &il->status) &&
|
||||
!test_bit(STATUS_EXIT_PENDING, &il->status);
|
||||
}
|
||||
|
||||
static inline int il_is_alive(struct il_priv *priv)
|
||||
static inline int il_is_alive(struct il_priv *il)
|
||||
{
|
||||
return test_bit(STATUS_ALIVE, &priv->status);
|
||||
return test_bit(STATUS_ALIVE, &il->status);
|
||||
}
|
||||
|
||||
static inline int il_is_init(struct il_priv *priv)
|
||||
static inline int il_is_init(struct il_priv *il)
|
||||
{
|
||||
return test_bit(STATUS_INIT, &priv->status);
|
||||
return test_bit(STATUS_INIT, &il->status);
|
||||
}
|
||||
|
||||
static inline int il_is_rfkill_hw(struct il_priv *priv)
|
||||
static inline int il_is_rfkill_hw(struct il_priv *il)
|
||||
{
|
||||
return test_bit(STATUS_RF_KILL_HW, &priv->status);
|
||||
return test_bit(STATUS_RF_KILL_HW, &il->status);
|
||||
}
|
||||
|
||||
static inline int il_is_rfkill(struct il_priv *priv)
|
||||
static inline int il_is_rfkill(struct il_priv *il)
|
||||
{
|
||||
return il_is_rfkill_hw(priv);
|
||||
return il_is_rfkill_hw(il);
|
||||
}
|
||||
|
||||
static inline int il_is_ctkill(struct il_priv *priv)
|
||||
static inline int il_is_ctkill(struct il_priv *il)
|
||||
{
|
||||
return test_bit(STATUS_CT_KILL, &priv->status);
|
||||
return test_bit(STATUS_CT_KILL, &il->status);
|
||||
}
|
||||
|
||||
static inline int il_is_ready_rf(struct il_priv *priv)
|
||||
static inline int il_is_ready_rf(struct il_priv *il)
|
||||
{
|
||||
|
||||
if (il_is_rfkill(priv))
|
||||
if (il_is_rfkill(il))
|
||||
return 0;
|
||||
|
||||
return il_is_ready(priv);
|
||||
return il_is_ready(il);
|
||||
}
|
||||
|
||||
extern void il_send_bt_config(struct il_priv *priv);
|
||||
extern int il_send_statistics_request(struct il_priv *priv,
|
||||
extern void il_send_bt_config(struct il_priv *il);
|
||||
extern int il_send_statistics_request(struct il_priv *il,
|
||||
u8 flags, bool clear);
|
||||
void il_apm_stop(struct il_priv *priv);
|
||||
int il_apm_init(struct il_priv *priv);
|
||||
void il_apm_stop(struct il_priv *il);
|
||||
int il_apm_init(struct il_priv *il);
|
||||
|
||||
int il_send_rxon_timing(struct il_priv *priv,
|
||||
int il_send_rxon_timing(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
static inline int il_send_rxon_assoc(struct il_priv *priv,
|
||||
static inline int il_send_rxon_assoc(struct il_priv *il,
|
||||
struct il_rxon_context *ctx)
|
||||
{
|
||||
return priv->cfg->ops->hcmd->rxon_assoc(priv, ctx);
|
||||
return il->cfg->ops->hcmd->rxon_assoc(il, ctx);
|
||||
}
|
||||
static inline int il_commit_rxon(struct il_priv *priv,
|
||||
static inline int il_commit_rxon(struct il_priv *il,
|
||||
struct il_rxon_context *ctx)
|
||||
{
|
||||
return priv->cfg->ops->hcmd->commit_rxon(priv, ctx);
|
||||
return il->cfg->ops->hcmd->commit_rxon(il, ctx);
|
||||
}
|
||||
static inline const struct ieee80211_supported_band *il_get_hw_mode(
|
||||
struct il_priv *priv, enum ieee80211_band band)
|
||||
struct il_priv *il, enum ieee80211_band band)
|
||||
{
|
||||
return priv->hw->wiphy->bands[band];
|
||||
return il->hw->wiphy->bands[band];
|
||||
}
|
||||
|
||||
/* mac80211 handlers */
|
||||
@ -627,7 +627,7 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_bss_conf *bss_conf,
|
||||
u32 changes);
|
||||
void il_tx_cmd_protection(struct il_priv *priv,
|
||||
void il_tx_cmd_protection(struct il_priv *il,
|
||||
struct ieee80211_tx_info *info,
|
||||
__le16 fc, __le32 *tx_flags);
|
||||
|
||||
|
@ -37,7 +37,7 @@ extern u32 iwlegacy_debug_level;
|
||||
#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 il_print_hex_error(priv, p, len) \
|
||||
#define il_print_hex_error(il, p, len) \
|
||||
do { \
|
||||
print_hex_dump(KERN_ERR, "iwl data: ", \
|
||||
DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
|
||||
@ -60,9 +60,9 @@ do { \
|
||||
__func__ , ## args); \
|
||||
} while (0)
|
||||
|
||||
#define il_print_hex_dump(priv, level, p, len) \
|
||||
#define il_print_hex_dump(il, level, p, len) \
|
||||
do { \
|
||||
if (il_get_debug_level(priv) & level) \
|
||||
if (il_get_debug_level(il) & level) \
|
||||
print_hex_dump(KERN_DEBUG, "iwl data: ", \
|
||||
DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
|
||||
} while (0)
|
||||
@ -70,21 +70,21 @@ do { \
|
||||
#else
|
||||
#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,
|
||||
static inline void il_print_hex_dump(struct il_priv *il, int level,
|
||||
const void *p, u32 len)
|
||||
{}
|
||||
#endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
|
||||
int il_dbgfs_register(struct il_priv *priv, const char *name);
|
||||
void il_dbgfs_unregister(struct il_priv *priv);
|
||||
int il_dbgfs_register(struct il_priv *il, const char *name);
|
||||
void il_dbgfs_unregister(struct il_priv *il);
|
||||
#else
|
||||
static inline int
|
||||
il_dbgfs_register(struct il_priv *priv, const char *name)
|
||||
il_dbgfs_register(struct il_priv *il, const char *name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void il_dbgfs_unregister(struct il_priv *priv)
|
||||
static inline void il_dbgfs_unregister(struct il_priv *il)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_IWLWIFI_LEGACY_DEBUGFS */
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
/* create and remove of files */
|
||||
#define DEBUGFS_ADD_FILE(name, parent, mode) do { \
|
||||
if (!debugfs_create_file(#name, mode, parent, priv, \
|
||||
if (!debugfs_create_file(#name, mode, parent, il, \
|
||||
&il_dbgfs_##name##_ops)) \
|
||||
goto err; \
|
||||
} while (0)
|
||||
@ -106,7 +106,7 @@ static ssize_t il_dbgfs_tx_statistics_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char *buf;
|
||||
int pos = 0;
|
||||
|
||||
@ -122,20 +122,20 @@ static ssize_t il_dbgfs_tx_statistics_read(struct file *file,
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"\t%25s\t\t: %u\n",
|
||||
il_get_mgmt_string(cnt),
|
||||
priv->tx_stats.mgmt[cnt]);
|
||||
il->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",
|
||||
il_get_ctrl_string(cnt),
|
||||
priv->tx_stats.ctrl[cnt]);
|
||||
il->tx_stats.ctrl[cnt]);
|
||||
}
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
|
||||
priv->tx_stats.data_cnt);
|
||||
il->tx_stats.data_cnt);
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
|
||||
priv->tx_stats.data_bytes);
|
||||
il->tx_stats.data_bytes);
|
||||
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
kfree(buf);
|
||||
return ret;
|
||||
@ -146,7 +146,7 @@ il_dbgfs_clear_traffic_statistics_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
u32 clear_flag;
|
||||
char buf[8];
|
||||
int buf_size;
|
||||
@ -157,7 +157,7 @@ il_dbgfs_clear_traffic_statistics_write(struct file *file,
|
||||
return -EFAULT;
|
||||
if (sscanf(buf, "%x", &clear_flag) != 1)
|
||||
return -EFAULT;
|
||||
il_clear_traffic_stats(priv);
|
||||
il_clear_traffic_stats(il);
|
||||
|
||||
return count;
|
||||
}
|
||||
@ -166,7 +166,7 @@ static ssize_t il_dbgfs_rx_statistics_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char *buf;
|
||||
int pos = 0;
|
||||
int cnt;
|
||||
@ -182,20 +182,20 @@ static ssize_t il_dbgfs_rx_statistics_read(struct file *file,
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"\t%25s\t\t: %u\n",
|
||||
il_get_mgmt_string(cnt),
|
||||
priv->rx_stats.mgmt[cnt]);
|
||||
il->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",
|
||||
il_get_ctrl_string(cnt),
|
||||
priv->rx_stats.ctrl[cnt]);
|
||||
il->rx_stats.ctrl[cnt]);
|
||||
}
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
|
||||
priv->rx_stats.data_cnt);
|
||||
il->rx_stats.data_cnt);
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
|
||||
priv->rx_stats.data_bytes);
|
||||
il->rx_stats.data_bytes);
|
||||
|
||||
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
kfree(buf);
|
||||
@ -214,28 +214,28 @@ static ssize_t il_dbgfs_sram_read(struct file *file,
|
||||
ssize_t ret;
|
||||
int i;
|
||||
int pos = 0;
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
size_t bufsz;
|
||||
|
||||
/* default is to dump the entire data segment */
|
||||
if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) {
|
||||
priv->dbgfs_sram_offset = 0x800000;
|
||||
if (priv->ucode_type == UCODE_INIT)
|
||||
priv->dbgfs_sram_len = priv->ucode_init_data.len;
|
||||
if (!il->dbgfs_sram_offset && !il->dbgfs_sram_len) {
|
||||
il->dbgfs_sram_offset = 0x800000;
|
||||
if (il->ucode_type == UCODE_INIT)
|
||||
il->dbgfs_sram_len = il->ucode_init_data.len;
|
||||
else
|
||||
priv->dbgfs_sram_len = priv->ucode_data.len;
|
||||
il->dbgfs_sram_len = il->ucode_data.len;
|
||||
}
|
||||
bufsz = 30 + priv->dbgfs_sram_len * sizeof(char) * 10;
|
||||
bufsz = 30 + il->dbgfs_sram_len * sizeof(char) * 10;
|
||||
buf = kmalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "sram_len: 0x%x\n",
|
||||
priv->dbgfs_sram_len);
|
||||
il->dbgfs_sram_len);
|
||||
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 = il_read_targ_mem(priv, priv->dbgfs_sram_offset + \
|
||||
priv->dbgfs_sram_len - i);
|
||||
il->dbgfs_sram_offset);
|
||||
for (i = il->dbgfs_sram_len; i > 0; i -= 4) {
|
||||
val = il_read_targ_mem(il, il->dbgfs_sram_offset + \
|
||||
il->dbgfs_sram_len - i);
|
||||
if (i < 4) {
|
||||
switch (i) {
|
||||
case 1:
|
||||
@ -264,7 +264,7 @@ static ssize_t il_dbgfs_sram_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char buf[64];
|
||||
int buf_size;
|
||||
u32 offset, len;
|
||||
@ -275,11 +275,11 @@ static ssize_t il_dbgfs_sram_write(struct file *file,
|
||||
return -EFAULT;
|
||||
|
||||
if (sscanf(buf, "%x,%x", &offset, &len) == 2) {
|
||||
priv->dbgfs_sram_offset = offset;
|
||||
priv->dbgfs_sram_len = len;
|
||||
il->dbgfs_sram_offset = offset;
|
||||
il->dbgfs_sram_len = len;
|
||||
} else {
|
||||
priv->dbgfs_sram_offset = 0;
|
||||
priv->dbgfs_sram_len = 0;
|
||||
il->dbgfs_sram_offset = 0;
|
||||
il->dbgfs_sram_len = 0;
|
||||
}
|
||||
|
||||
return count;
|
||||
@ -289,24 +289,24 @@ static ssize_t
|
||||
il_dbgfs_stations_read(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
struct il_station_entry *station;
|
||||
int max_sta = priv->hw_params.max_stations;
|
||||
int max_sta = il->hw_params.max_stations;
|
||||
char *buf;
|
||||
int i, j, pos = 0;
|
||||
ssize_t ret;
|
||||
/* Add 30 for initial string */
|
||||
const size_t bufsz = 30 + sizeof(char) * 500 * (priv->num_stations);
|
||||
const size_t bufsz = 30 + sizeof(char) * 500 * (il->num_stations);
|
||||
|
||||
buf = kmalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n",
|
||||
priv->num_stations);
|
||||
il->num_stations);
|
||||
|
||||
for (i = 0; i < max_sta; i++) {
|
||||
station = &priv->stations[i];
|
||||
station = &il->stations[i];
|
||||
if (!station->used)
|
||||
continue;
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
@ -349,32 +349,32 @@ static ssize_t il_dbgfs_nvm_read(struct file *file,
|
||||
loff_t *ppos)
|
||||
{
|
||||
ssize_t ret;
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int pos = 0, ofs = 0, buf_size = 0;
|
||||
const u8 *ptr;
|
||||
char *buf;
|
||||
u16 eeprom_ver;
|
||||
size_t eeprom_len = priv->cfg->base_params->eeprom_size;
|
||||
size_t eeprom_len = il->cfg->base_params->eeprom_size;
|
||||
buf_size = 4 * eeprom_len + 256;
|
||||
|
||||
if (eeprom_len % 16) {
|
||||
IL_ERR(priv, "NVM size is not multiple of 16.\n");
|
||||
IL_ERR(il, "NVM size is not multiple of 16.\n");
|
||||
return -ENODATA;
|
||||
}
|
||||
|
||||
ptr = priv->eeprom;
|
||||
ptr = il->eeprom;
|
||||
if (!ptr) {
|
||||
IL_ERR(priv, "Invalid EEPROM memory\n");
|
||||
IL_ERR(il, "Invalid EEPROM memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* 4 characters for byte 0xYY */
|
||||
buf = kzalloc(buf_size, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate Buffer\n");
|
||||
IL_ERR(il, "Can not allocate Buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
eeprom_ver = il_eeprom_query16(priv, EEPROM_VERSION);
|
||||
eeprom_ver = il_eeprom_query16(il, EEPROM_VERSION);
|
||||
pos += scnprintf(buf + pos, buf_size - pos, "EEPROM "
|
||||
"version: 0x%x\n", eeprom_ver);
|
||||
for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
|
||||
@ -395,23 +395,23 @@ static ssize_t
|
||||
il_dbgfs_channels_read(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
struct ieee80211_channel *channels = NULL;
|
||||
const struct ieee80211_supported_band *supp_band = NULL;
|
||||
int pos = 0, i, bufsz = PAGE_SIZE;
|
||||
char *buf;
|
||||
ssize_t ret;
|
||||
|
||||
if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status))
|
||||
if (!test_bit(STATUS_GEO_CONFIGURED, &il->status))
|
||||
return -EAGAIN;
|
||||
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate Buffer\n");
|
||||
IL_ERR(il, "Can not allocate Buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
supp_band = il_get_hw_mode(priv, IEEE80211_BAND_2GHZ);
|
||||
supp_band = il_get_hw_mode(il, IEEE80211_BAND_2GHZ);
|
||||
if (supp_band) {
|
||||
channels = supp_band->channels;
|
||||
|
||||
@ -434,7 +434,7 @@ il_dbgfs_channels_read(struct file *file, char __user *user_buf,
|
||||
IEEE80211_CHAN_PASSIVE_SCAN ?
|
||||
"passive only" : "active/passive");
|
||||
}
|
||||
supp_band = il_get_hw_mode(priv, IEEE80211_BAND_5GHZ);
|
||||
supp_band = il_get_hw_mode(il, IEEE80211_BAND_5GHZ);
|
||||
if (supp_band) {
|
||||
channels = supp_band->channels;
|
||||
|
||||
@ -466,43 +466,43 @@ static ssize_t il_dbgfs_status_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char buf[512];
|
||||
int pos = 0;
|
||||
const size_t bufsz = sizeof(buf);
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n",
|
||||
test_bit(STATUS_HCMD_ACTIVE, &priv->status));
|
||||
test_bit(STATUS_HCMD_ACTIVE, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n",
|
||||
test_bit(STATUS_INT_ENABLED, &priv->status));
|
||||
test_bit(STATUS_INT_ENABLED, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
|
||||
test_bit(STATUS_RF_KILL_HW, &priv->status));
|
||||
test_bit(STATUS_RF_KILL_HW, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n",
|
||||
test_bit(STATUS_CT_KILL, &priv->status));
|
||||
test_bit(STATUS_CT_KILL, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n",
|
||||
test_bit(STATUS_INIT, &priv->status));
|
||||
test_bit(STATUS_INIT, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
|
||||
test_bit(STATUS_ALIVE, &priv->status));
|
||||
test_bit(STATUS_ALIVE, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n",
|
||||
test_bit(STATUS_READY, &priv->status));
|
||||
test_bit(STATUS_READY, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_TEMPERATURE:\t %d\n",
|
||||
test_bit(STATUS_TEMPERATURE, &priv->status));
|
||||
test_bit(STATUS_TEMPERATURE, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n",
|
||||
test_bit(STATUS_GEO_CONFIGURED, &priv->status));
|
||||
test_bit(STATUS_GEO_CONFIGURED, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n",
|
||||
test_bit(STATUS_EXIT_PENDING, &priv->status));
|
||||
test_bit(STATUS_EXIT_PENDING, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n",
|
||||
test_bit(STATUS_STATISTICS, &priv->status));
|
||||
test_bit(STATUS_STATISTICS, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n",
|
||||
test_bit(STATUS_SCANNING, &priv->status));
|
||||
test_bit(STATUS_SCANNING, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n",
|
||||
test_bit(STATUS_SCAN_ABORTING, &priv->status));
|
||||
test_bit(STATUS_SCAN_ABORTING, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n",
|
||||
test_bit(STATUS_SCAN_HW, &priv->status));
|
||||
test_bit(STATUS_SCAN_HW, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n",
|
||||
test_bit(STATUS_POWER_PMI, &priv->status));
|
||||
test_bit(STATUS_POWER_PMI, &il->status));
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n",
|
||||
test_bit(STATUS_FW_ERROR, &priv->status));
|
||||
test_bit(STATUS_FW_ERROR, &il->status));
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
}
|
||||
|
||||
@ -510,7 +510,7 @@ static ssize_t il_dbgfs_interrupt_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int pos = 0;
|
||||
int cnt = 0;
|
||||
char *buf;
|
||||
@ -519,7 +519,7 @@ static ssize_t il_dbgfs_interrupt_read(struct file *file,
|
||||
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate Buffer\n");
|
||||
IL_ERR(il, "Can not allocate Buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -527,46 +527,46 @@ static ssize_t il_dbgfs_interrupt_read(struct file *file,
|
||||
"Interrupt Statistics Report:\n");
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n",
|
||||
priv->isr_stats.hw);
|
||||
il->isr_stats.hw);
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n",
|
||||
priv->isr_stats.sw);
|
||||
if (priv->isr_stats.sw || priv->isr_stats.hw) {
|
||||
il->isr_stats.sw);
|
||||
if (il->isr_stats.sw || il->isr_stats.hw) {
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"\tLast Restarting Code: 0x%X\n",
|
||||
priv->isr_stats.err_code);
|
||||
il->isr_stats.err_code);
|
||||
}
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n",
|
||||
priv->isr_stats.sch);
|
||||
il->isr_stats.sch);
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n",
|
||||
priv->isr_stats.alive);
|
||||
il->isr_stats.alive);
|
||||
#endif
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"HW RF KILL switch toggled:\t %u\n",
|
||||
priv->isr_stats.rfkill);
|
||||
il->isr_stats.rfkill);
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n",
|
||||
priv->isr_stats.ctkill);
|
||||
il->isr_stats.ctkill);
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n",
|
||||
priv->isr_stats.wakeup);
|
||||
il->isr_stats.wakeup);
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"Rx command responses:\t\t %u\n",
|
||||
priv->isr_stats.rx);
|
||||
il->isr_stats.rx);
|
||||
for (cnt = 0; cnt < REPLY_MAX; cnt++) {
|
||||
if (priv->isr_stats.rx_handlers[cnt] > 0)
|
||||
if (il->isr_stats.rx_handlers[cnt] > 0)
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"\tRx handler[%36s]:\t\t %u\n",
|
||||
il_get_cmd_string(cnt),
|
||||
priv->isr_stats.rx_handlers[cnt]);
|
||||
il->isr_stats.rx_handlers[cnt]);
|
||||
}
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n",
|
||||
priv->isr_stats.tx);
|
||||
il->isr_stats.tx);
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n",
|
||||
priv->isr_stats.unhandled);
|
||||
il->isr_stats.unhandled);
|
||||
|
||||
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
kfree(buf);
|
||||
@ -577,7 +577,7 @@ static ssize_t il_dbgfs_interrupt_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char buf[8];
|
||||
int buf_size;
|
||||
u32 reset_flag;
|
||||
@ -589,7 +589,7 @@ static ssize_t il_dbgfs_interrupt_write(struct file *file,
|
||||
if (sscanf(buf, "%x", &reset_flag) != 1)
|
||||
return -EFAULT;
|
||||
if (reset_flag == 0)
|
||||
il_clear_isr_stats(priv);
|
||||
il_clear_isr_stats(il);
|
||||
|
||||
return count;
|
||||
}
|
||||
@ -598,13 +598,13 @@ static ssize_t
|
||||
il_dbgfs_qos_read(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
struct il_rxon_context *ctx;
|
||||
int pos = 0, i;
|
||||
char buf[256 * NUM_IL_RXON_CTX];
|
||||
const size_t bufsz = sizeof(buf);
|
||||
|
||||
for_each_context(priv, ctx) {
|
||||
for_each_context(il, ctx) {
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n",
|
||||
ctx->ctxid);
|
||||
for (i = 0; i < AC_NUM; i++) {
|
||||
@ -626,7 +626,7 @@ static ssize_t il_dbgfs_disable_ht40_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char buf[8];
|
||||
int buf_size;
|
||||
int ht40;
|
||||
@ -637,10 +637,10 @@ static ssize_t il_dbgfs_disable_ht40_write(struct file *file,
|
||||
return -EFAULT;
|
||||
if (sscanf(buf, "%d", &ht40) != 1)
|
||||
return -EFAULT;
|
||||
if (!il_is_any_associated(priv))
|
||||
priv->disable_ht40 = ht40 ? true : false;
|
||||
if (!il_is_any_associated(il))
|
||||
il->disable_ht40 = ht40 ? true : false;
|
||||
else {
|
||||
IL_ERR(priv, "Sta associated with AP - "
|
||||
IL_ERR(il, "Sta associated with AP - "
|
||||
"Change to 40MHz channel support is not allowed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -652,14 +652,14 @@ static ssize_t il_dbgfs_disable_ht40_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char buf[100];
|
||||
int pos = 0;
|
||||
const size_t bufsz = sizeof(buf);
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"11n 40MHz Mode: %s\n",
|
||||
priv->disable_ht40 ? "Disabled" : "Enabled");
|
||||
il->disable_ht40 ? "Disabled" : "Enabled");
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
}
|
||||
|
||||
@ -676,39 +676,39 @@ static ssize_t il_dbgfs_traffic_log_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int pos = 0, ofs = 0;
|
||||
int cnt = 0, entry;
|
||||
struct il_tx_queue *txq;
|
||||
struct il_queue *q;
|
||||
struct il_rx_queue *rxq = &priv->rxq;
|
||||
struct il_rx_queue *rxq = &il->rxq;
|
||||
char *buf;
|
||||
int bufsz = ((IL_TRAFFIC_ENTRIES * IL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
|
||||
(priv->cfg->base_params->num_of_queues * 32 * 8) + 400;
|
||||
(il->cfg->base_params->num_of_queues * 32 * 8) + 400;
|
||||
const u8 *ptr;
|
||||
ssize_t ret;
|
||||
|
||||
if (!priv->txq) {
|
||||
IL_ERR(priv, "txq not ready\n");
|
||||
if (!il->txq) {
|
||||
IL_ERR(il, "txq not ready\n");
|
||||
return -EAGAIN;
|
||||
}
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate buffer\n");
|
||||
IL_ERR(il, "Can not allocate buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n");
|
||||
for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) {
|
||||
txq = &priv->txq[cnt];
|
||||
for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) {
|
||||
txq = &il->txq[cnt];
|
||||
q = &txq->q;
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"q[%d]: read_ptr: %u, write_ptr: %u\n",
|
||||
cnt, q->read_ptr, q->write_ptr);
|
||||
}
|
||||
if (priv->tx_traffic && (iwlegacy_debug_level & IL_DL_TX)) {
|
||||
ptr = priv->tx_traffic;
|
||||
if (il->tx_traffic && (iwlegacy_debug_level & IL_DL_TX)) {
|
||||
ptr = il->tx_traffic;
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"Tx Traffic idx: %u\n", priv->tx_traffic_idx);
|
||||
"Tx Traffic idx: %u\n", il->tx_traffic_idx);
|
||||
for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) {
|
||||
for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16;
|
||||
entry++, ofs += 16) {
|
||||
@ -728,10 +728,10 @@ static ssize_t il_dbgfs_traffic_log_read(struct file *file,
|
||||
"read: %u, write: %u\n",
|
||||
rxq->read, rxq->write);
|
||||
|
||||
if (priv->rx_traffic && (iwlegacy_debug_level & IL_DL_RX)) {
|
||||
ptr = priv->rx_traffic;
|
||||
if (il->rx_traffic && (iwlegacy_debug_level & IL_DL_RX)) {
|
||||
ptr = il->rx_traffic;
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"Rx Traffic idx: %u\n", priv->rx_traffic_idx);
|
||||
"Rx Traffic idx: %u\n", il->rx_traffic_idx);
|
||||
for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) {
|
||||
for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16;
|
||||
entry++, ofs += 16) {
|
||||
@ -755,7 +755,7 @@ static ssize_t il_dbgfs_traffic_log_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char buf[8];
|
||||
int buf_size;
|
||||
int traffic_log;
|
||||
@ -767,7 +767,7 @@ static ssize_t il_dbgfs_traffic_log_write(struct file *file,
|
||||
if (sscanf(buf, "%d", &traffic_log) != 1)
|
||||
return -EFAULT;
|
||||
if (traffic_log == 0)
|
||||
il_reset_traffic_log(priv);
|
||||
il_reset_traffic_log(il);
|
||||
|
||||
return count;
|
||||
}
|
||||
@ -776,7 +776,7 @@ static ssize_t il_dbgfs_tx_queue_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
struct il_tx_queue *txq;
|
||||
struct il_queue *q;
|
||||
char *buf;
|
||||
@ -784,24 +784,24 @@ static ssize_t il_dbgfs_tx_queue_read(struct file *file,
|
||||
int cnt;
|
||||
int ret;
|
||||
const size_t bufsz = sizeof(char) * 64 *
|
||||
priv->cfg->base_params->num_of_queues;
|
||||
il->cfg->base_params->num_of_queues;
|
||||
|
||||
if (!priv->txq) {
|
||||
IL_ERR(priv, "txq not ready\n");
|
||||
if (!il->txq) {
|
||||
IL_ERR(il, "txq not ready\n");
|
||||
return -EAGAIN;
|
||||
}
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) {
|
||||
txq = &priv->txq[cnt];
|
||||
for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) {
|
||||
txq = &il->txq[cnt];
|
||||
q = &txq->q;
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"hwq %.2d: read=%u write=%u stop=%d"
|
||||
" swq_id=%#.2x (ac %d/hwq %d)\n",
|
||||
cnt, q->read_ptr, q->write_ptr,
|
||||
!!test_bit(cnt, priv->queue_stopped),
|
||||
!!test_bit(cnt, il->queue_stopped),
|
||||
txq->swq_id, txq->swq_id & 3,
|
||||
(txq->swq_id >> 2) & 0x1f);
|
||||
if (cnt >= 4)
|
||||
@ -809,7 +809,7 @@ static ssize_t il_dbgfs_tx_queue_read(struct file *file,
|
||||
/* for the ACs, display the stop count too */
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
" stop-count: %d\n",
|
||||
atomic_read(&priv->queue_stop_count[cnt]));
|
||||
atomic_read(&il->queue_stop_count[cnt]));
|
||||
}
|
||||
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
kfree(buf);
|
||||
@ -820,8 +820,8 @@ static ssize_t il_dbgfs_rx_queue_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_rx_queue *rxq = &priv->rxq;
|
||||
struct il_priv *il = file->private_data;
|
||||
struct il_rx_queue *rxq = &il->rxq;
|
||||
char buf[256];
|
||||
int pos = 0;
|
||||
const size_t bufsz = sizeof(buf);
|
||||
@ -846,8 +846,8 @@ static ssize_t il_dbgfs_ucode_rx_stats_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file,
|
||||
struct il_priv *il = file->private_data;
|
||||
return il->cfg->ops->lib->debugfs_ops.rx_stats_read(file,
|
||||
user_buf, count, ppos);
|
||||
}
|
||||
|
||||
@ -855,8 +855,8 @@ static ssize_t il_dbgfs_ucode_tx_stats_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file,
|
||||
struct il_priv *il = file->private_data;
|
||||
return il->cfg->ops->lib->debugfs_ops.tx_stats_read(file,
|
||||
user_buf, count, ppos);
|
||||
}
|
||||
|
||||
@ -864,8 +864,8 @@ static ssize_t il_dbgfs_ucode_general_stats_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file,
|
||||
struct il_priv *il = file->private_data;
|
||||
return il->cfg->ops->lib->debugfs_ops.general_stats_read(file,
|
||||
user_buf, count, ppos);
|
||||
}
|
||||
|
||||
@ -873,7 +873,7 @@ static ssize_t il_dbgfs_sensitivity_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int pos = 0;
|
||||
int cnt = 0;
|
||||
char *buf;
|
||||
@ -881,10 +881,10 @@ static ssize_t il_dbgfs_sensitivity_read(struct file *file,
|
||||
ssize_t ret;
|
||||
struct il_sensitivity_data *data;
|
||||
|
||||
data = &priv->sensitivity_data;
|
||||
data = &il->sensitivity_data;
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate Buffer\n");
|
||||
IL_ERR(il, "Can not allocate Buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -954,7 +954,7 @@ static ssize_t il_dbgfs_chain_noise_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int pos = 0;
|
||||
int cnt = 0;
|
||||
char *buf;
|
||||
@ -962,10 +962,10 @@ static ssize_t il_dbgfs_chain_noise_read(struct file *file,
|
||||
ssize_t ret;
|
||||
struct il_chain_noise_data *data;
|
||||
|
||||
data = &priv->chain_noise_data;
|
||||
data = &il->chain_noise_data;
|
||||
buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
IL_ERR(priv, "Can not allocate Buffer\n");
|
||||
IL_ERR(il, "Can not allocate Buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -1012,13 +1012,13 @@ static ssize_t il_dbgfs_power_save_status_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char buf[60];
|
||||
int pos = 0;
|
||||
const size_t bufsz = sizeof(buf);
|
||||
u32 pwrsave_status;
|
||||
|
||||
pwrsave_status = il_read32(priv, CSR_GP_CNTRL) &
|
||||
pwrsave_status = il_read32(il, CSR_GP_CNTRL) &
|
||||
CSR_GP_REG_POWER_SAVE_STATUS_MSK;
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: ");
|
||||
@ -1035,7 +1035,7 @@ static ssize_t il_dbgfs_clear_ucode_statistics_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char buf[8];
|
||||
int buf_size;
|
||||
int clear;
|
||||
@ -1048,9 +1048,9 @@ static ssize_t il_dbgfs_clear_ucode_statistics_write(struct file *file,
|
||||
return -EFAULT;
|
||||
|
||||
/* make request to uCode to retrieve statistics information */
|
||||
mutex_lock(&priv->mutex);
|
||||
il_send_statistics_request(priv, CMD_SYNC, true);
|
||||
mutex_unlock(&priv->mutex);
|
||||
mutex_lock(&il->mutex);
|
||||
il_send_statistics_request(il, CMD_SYNC, true);
|
||||
mutex_unlock(&il->mutex);
|
||||
|
||||
return count;
|
||||
}
|
||||
@ -1059,12 +1059,12 @@ static ssize_t il_dbgfs_rxon_flags_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int len = 0;
|
||||
char buf[20];
|
||||
|
||||
len = sprintf(buf, "0x%04X\n",
|
||||
le32_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.flags));
|
||||
le32_to_cpu(il->contexts[IL_RXON_CTX_BSS].active.flags));
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
@ -1072,12 +1072,12 @@ static ssize_t il_dbgfs_rxon_filter_flags_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int len = 0;
|
||||
char buf[20];
|
||||
|
||||
len = sprintf(buf, "0x%04X\n",
|
||||
le32_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.filter_flags));
|
||||
le32_to_cpu(il->contexts[IL_RXON_CTX_BSS].active.filter_flags));
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
@ -1085,13 +1085,13 @@ static ssize_t il_dbgfs_fh_reg_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char *buf;
|
||||
int pos = 0;
|
||||
ssize_t ret = -EFAULT;
|
||||
|
||||
if (priv->cfg->ops->lib->dump_fh) {
|
||||
ret = pos = priv->cfg->ops->lib->dump_fh(priv, &buf, true);
|
||||
if (il->cfg->ops->lib->dump_fh) {
|
||||
ret = pos = il->cfg->ops->lib->dump_fh(il, &buf, true);
|
||||
if (buf) {
|
||||
ret = simple_read_from_buffer(user_buf,
|
||||
count, ppos, buf, pos);
|
||||
@ -1106,13 +1106,13 @@ static ssize_t il_dbgfs_missed_beacon_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int pos = 0;
|
||||
char buf[12];
|
||||
const size_t bufsz = sizeof(buf);
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos, "%d\n",
|
||||
priv->missed_beacon_threshold);
|
||||
il->missed_beacon_threshold);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
}
|
||||
@ -1121,7 +1121,7 @@ static ssize_t il_dbgfs_missed_beacon_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char buf[8];
|
||||
int buf_size;
|
||||
int missed;
|
||||
@ -1135,10 +1135,10 @@ static ssize_t il_dbgfs_missed_beacon_write(struct file *file,
|
||||
|
||||
if (missed < IL_MISSED_BEACON_THRESHOLD_MIN ||
|
||||
missed > IL_MISSED_BEACON_THRESHOLD_MAX)
|
||||
priv->missed_beacon_threshold =
|
||||
il->missed_beacon_threshold =
|
||||
IL_MISSED_BEACON_THRESHOLD_DEF;
|
||||
else
|
||||
priv->missed_beacon_threshold = missed;
|
||||
il->missed_beacon_threshold = missed;
|
||||
|
||||
return count;
|
||||
}
|
||||
@ -1147,13 +1147,13 @@ static ssize_t il_dbgfs_force_reset_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
int pos = 0;
|
||||
char buf[300];
|
||||
const size_t bufsz = sizeof(buf);
|
||||
struct il_force_reset *force_reset;
|
||||
|
||||
force_reset = &priv->force_reset;
|
||||
force_reset = &il->force_reset;
|
||||
|
||||
pos += scnprintf(buf + pos, bufsz - pos,
|
||||
"\tnumber of reset request: %d\n",
|
||||
@ -1176,9 +1176,9 @@ static ssize_t il_dbgfs_force_reset_write(struct file *file,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
int ret;
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
|
||||
ret = il_force_reset(priv, true);
|
||||
ret = il_force_reset(il, true);
|
||||
|
||||
return ret ? ret : count;
|
||||
}
|
||||
@ -1187,7 +1187,7 @@ static ssize_t il_dbgfs_wd_timeout_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct il_priv *priv = file->private_data;
|
||||
struct il_priv *il = file->private_data;
|
||||
char buf[8];
|
||||
int buf_size;
|
||||
int timeout;
|
||||
@ -1201,8 +1201,8 @@ static ssize_t il_dbgfs_wd_timeout_write(struct file *file,
|
||||
if (timeout < 0 || timeout > IL_MAX_WD_TIMEOUT)
|
||||
timeout = IL_DEF_WD_TIMEOUT;
|
||||
|
||||
priv->cfg->base_params->wd_timeout = timeout;
|
||||
il_setup_watchdog(priv);
|
||||
il->cfg->base_params->wd_timeout = timeout;
|
||||
il_setup_watchdog(il);
|
||||
return count;
|
||||
}
|
||||
|
||||
@ -1230,16 +1230,16 @@ DEBUGFS_WRITE_FILE_OPS(wd_timeout);
|
||||
* Create the debugfs files and directories
|
||||
*
|
||||
*/
|
||||
int il_dbgfs_register(struct il_priv *priv, const char *name)
|
||||
int il_dbgfs_register(struct il_priv *il, const char *name)
|
||||
{
|
||||
struct dentry *phyd = priv->hw->wiphy->debugfsdir;
|
||||
struct dentry *phyd = il->hw->wiphy->debugfsdir;
|
||||
struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug;
|
||||
|
||||
dir_drv = debugfs_create_dir(name, phyd);
|
||||
if (!dir_drv)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->debugfs_dir = dir_drv;
|
||||
il->debugfs_dir = dir_drv;
|
||||
|
||||
dir_data = debugfs_create_dir("data", dir_drv);
|
||||
if (!dir_data)
|
||||
@ -1274,26 +1274,26 @@ int il_dbgfs_register(struct il_priv *priv, const char *name)
|
||||
DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);
|
||||
DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR);
|
||||
|
||||
if (priv->cfg->base_params->sensitivity_calib_by_driver)
|
||||
if (il->cfg->base_params->sensitivity_calib_by_driver)
|
||||
DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR);
|
||||
if (priv->cfg->base_params->chain_noise_calib_by_driver)
|
||||
if (il->cfg->base_params->chain_noise_calib_by_driver)
|
||||
DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR);
|
||||
DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR);
|
||||
DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR);
|
||||
DEBUGFS_ADD_FILE(wd_timeout, dir_debug, S_IWUSR);
|
||||
if (priv->cfg->base_params->sensitivity_calib_by_driver)
|
||||
if (il->cfg->base_params->sensitivity_calib_by_driver)
|
||||
DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf,
|
||||
&priv->disable_sens_cal);
|
||||
if (priv->cfg->base_params->chain_noise_calib_by_driver)
|
||||
&il->disable_sens_cal);
|
||||
if (il->cfg->base_params->chain_noise_calib_by_driver)
|
||||
DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf,
|
||||
&priv->disable_chain_noise_cal);
|
||||
&il->disable_chain_noise_cal);
|
||||
DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf,
|
||||
&priv->disable_tx_power_cal);
|
||||
&il->disable_tx_power_cal);
|
||||
return 0;
|
||||
|
||||
err:
|
||||
IL_ERR(priv, "Can't create the debugfs directory\n");
|
||||
il_dbgfs_unregister(priv);
|
||||
IL_ERR(il, "Can't create the debugfs directory\n");
|
||||
il_dbgfs_unregister(il);
|
||||
return -ENOMEM;
|
||||
}
|
||||
EXPORT_SYMBOL(il_dbgfs_register);
|
||||
@ -1302,12 +1302,12 @@ EXPORT_SYMBOL(il_dbgfs_register);
|
||||
* Remove the debugfs files and directories
|
||||
*
|
||||
*/
|
||||
void il_dbgfs_unregister(struct il_priv *priv)
|
||||
void il_dbgfs_unregister(struct il_priv *il)
|
||||
{
|
||||
if (!priv->debugfs_dir)
|
||||
if (!il->debugfs_dir)
|
||||
return;
|
||||
|
||||
debugfs_remove_recursive(priv->debugfs_dir);
|
||||
priv->debugfs_dir = NULL;
|
||||
debugfs_remove_recursive(il->debugfs_dir);
|
||||
il->debugfs_dir = NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(il_dbgfs_unregister);
|
||||
|
@ -106,7 +106,7 @@ struct il_cmd_meta {
|
||||
* invoked for SYNC commands, if it were and its result passed
|
||||
* through it would be simpler...)
|
||||
*/
|
||||
void (*callback)(struct il_priv *priv,
|
||||
void (*callback)(struct il_priv *il,
|
||||
struct il_device_cmd *cmd,
|
||||
struct il_rx_packet *pkt);
|
||||
|
||||
@ -321,7 +321,7 @@ struct il_device_cmd {
|
||||
struct il_host_cmd {
|
||||
const void *data;
|
||||
unsigned long reply_page;
|
||||
void (*callback)(struct il_priv *priv,
|
||||
void (*callback)(struct il_priv *il,
|
||||
struct il_device_cmd *cmd,
|
||||
struct il_rx_packet *pkt);
|
||||
u32 flags;
|
||||
@ -476,7 +476,7 @@ struct il_station_priv_common {
|
||||
};
|
||||
|
||||
/*
|
||||
* il_station_priv: Driver's private station information
|
||||
* il_station_priv: Driver's ilate station information
|
||||
*
|
||||
* When mac80211 creates a station it reserves some space (hw->sta_data_size)
|
||||
* in the structure for use by driver. This structure is places in that
|
||||
@ -494,7 +494,7 @@ struct il_station_priv {
|
||||
};
|
||||
|
||||
/**
|
||||
* struct il_vif_priv - driver's private per-interface information
|
||||
* struct il_vif_priv - driver's ilate per-interface information
|
||||
*
|
||||
* When mac80211 allocates a virtual interface, it can allocate
|
||||
* space for us to put data into.
|
||||
@ -625,7 +625,7 @@ struct il_hw_params {
|
||||
* il4965_mac_ <-- mac80211 callback
|
||||
*
|
||||
****************************************************************************/
|
||||
extern void il4965_update_chain_flags(struct il_priv *priv);
|
||||
extern void il4965_update_chain_flags(struct il_priv *il);
|
||||
extern const u8 iwlegacy_bcast_addr[ETH_ALEN];
|
||||
extern int il_queue_space(const struct il_queue *q);
|
||||
static inline int il_queue_used(const struct il_queue *q, int i)
|
||||
@ -973,7 +973,7 @@ struct il_priv {
|
||||
enum ieee80211_band band;
|
||||
int alloc_rxb_page;
|
||||
|
||||
void (*rx_handlers[REPLY_MAX])(struct il_priv *priv,
|
||||
void (*rx_handlers[REPLY_MAX])(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb);
|
||||
|
||||
struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
|
||||
@ -1247,14 +1247,14 @@ struct il_priv {
|
||||
bool led_registered;
|
||||
}; /*il_priv */
|
||||
|
||||
static inline void il_txq_ctx_activate(struct il_priv *priv, int txq_id)
|
||||
static inline void il_txq_ctx_activate(struct il_priv *il, int txq_id)
|
||||
{
|
||||
set_bit(txq_id, &priv->txq_ctx_active_msk);
|
||||
set_bit(txq_id, &il->txq_ctx_active_msk);
|
||||
}
|
||||
|
||||
static inline void il_txq_ctx_deactivate(struct il_priv *priv, int txq_id)
|
||||
static inline void il_txq_ctx_deactivate(struct il_priv *il, int txq_id)
|
||||
{
|
||||
clear_bit(txq_id, &priv->txq_ctx_active_msk);
|
||||
clear_bit(txq_id, &il->txq_ctx_active_msk);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
@ -1265,15 +1265,15 @@ static inline void il_txq_ctx_deactivate(struct il_priv *priv, int txq_id)
|
||||
* level will be used if set, otherwise the global debug level which can be
|
||||
* set via module parameter is used.
|
||||
*/
|
||||
static inline u32 il_get_debug_level(struct il_priv *priv)
|
||||
static inline u32 il_get_debug_level(struct il_priv *il)
|
||||
{
|
||||
if (priv->debug_level)
|
||||
return priv->debug_level;
|
||||
if (il->debug_level)
|
||||
return il->debug_level;
|
||||
else
|
||||
return iwlegacy_debug_level;
|
||||
}
|
||||
#else
|
||||
static inline u32 il_get_debug_level(struct il_priv *priv)
|
||||
static inline u32 il_get_debug_level(struct il_priv *il)
|
||||
{
|
||||
return iwlegacy_debug_level;
|
||||
}
|
||||
@ -1281,11 +1281,11 @@ static inline u32 il_get_debug_level(struct il_priv *priv)
|
||||
|
||||
|
||||
static inline struct ieee80211_hdr *
|
||||
il_tx_queue_get_hdr(struct il_priv *priv,
|
||||
il_tx_queue_get_hdr(struct il_priv *il,
|
||||
int txq_id, int idx)
|
||||
{
|
||||
if (priv->txq[txq_id].txb[idx].skb)
|
||||
return (struct ieee80211_hdr *)priv->txq[txq_id].
|
||||
if (il->txq[txq_id].txb[idx].skb)
|
||||
return (struct ieee80211_hdr *)il->txq[txq_id].
|
||||
txb[idx].skb->data;
|
||||
return NULL;
|
||||
}
|
||||
@ -1298,21 +1298,21 @@ il_rxon_ctx_from_vif(struct ieee80211_vif *vif)
|
||||
return vif_priv->ctx;
|
||||
}
|
||||
|
||||
#define for_each_context(priv, ctx) \
|
||||
for (ctx = &priv->contexts[IL_RXON_CTX_BSS]; \
|
||||
ctx < &priv->contexts[NUM_IL_RXON_CTX]; ctx++) \
|
||||
if (priv->valid_contexts & BIT(ctx->ctxid))
|
||||
#define for_each_context(il, ctx) \
|
||||
for (ctx = &il->contexts[IL_RXON_CTX_BSS]; \
|
||||
ctx < &il->contexts[NUM_IL_RXON_CTX]; ctx++) \
|
||||
if (il->valid_contexts & BIT(ctx->ctxid))
|
||||
|
||||
static inline int il_is_associated(struct il_priv *priv,
|
||||
static inline int il_is_associated(struct il_priv *il,
|
||||
enum il_rxon_context_id ctxid)
|
||||
{
|
||||
return (priv->contexts[ctxid].active.filter_flags &
|
||||
return (il->contexts[ctxid].active.filter_flags &
|
||||
RXON_FILTER_ASSOC_MSK) ? 1 : 0;
|
||||
}
|
||||
|
||||
static inline int il_is_any_associated(struct il_priv *priv)
|
||||
static inline int il_is_any_associated(struct il_priv *il)
|
||||
{
|
||||
return il_is_associated(priv, IL_RXON_CTX_BSS);
|
||||
return il_is_associated(il, IL_RXON_CTX_BSS);
|
||||
}
|
||||
|
||||
static inline int il_is_associated_ctx(struct il_rxon_context *ctx)
|
||||
@ -1350,15 +1350,15 @@ il_is_channel_ibss(const struct il_channel_info *ch)
|
||||
}
|
||||
|
||||
static inline void
|
||||
__il_free_pages(struct il_priv *priv, struct page *page)
|
||||
__il_free_pages(struct il_priv *il, struct page *page)
|
||||
{
|
||||
__free_pages(page, priv->hw_params.rx_page_order);
|
||||
priv->alloc_rxb_page--;
|
||||
__free_pages(page, il->hw_params.rx_page_order);
|
||||
il->alloc_rxb_page--;
|
||||
}
|
||||
|
||||
static inline void il_free_pages(struct il_priv *priv, unsigned long page)
|
||||
static inline void il_free_pages(struct il_priv *il, unsigned long page)
|
||||
{
|
||||
free_pages(page, priv->hw_params.rx_page_order);
|
||||
priv->alloc_rxb_page--;
|
||||
free_pages(page, il->hw_params.rx_page_order);
|
||||
il->alloc_rxb_page--;
|
||||
}
|
||||
#endif /* __il_dev_h__ */
|
||||
|
@ -87,7 +87,7 @@
|
||||
* is contained in the eeprom map itself.
|
||||
*
|
||||
* During init, we copy the eeprom information and channel map
|
||||
* information into priv->channel_info_24/52 and priv->channel_map_24/52
|
||||
* information into il->channel_info_24/52 and il->channel_map_24/52
|
||||
*
|
||||
* channel_map_24/52 provides the index in the channel_info array for a
|
||||
* given channel. We have to have two separate maps as there is channel
|
||||
@ -142,18 +142,18 @@ static const u8 iwlegacy_eeprom_band_7[] = { /* 5.2 ht40 channel */
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static int il_eeprom_verify_signature(struct il_priv *priv)
|
||||
static int il_eeprom_verify_signature(struct il_priv *il)
|
||||
{
|
||||
u32 gp = il_read32(priv, CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK;
|
||||
u32 gp = il_read32(il, CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK;
|
||||
int ret = 0;
|
||||
|
||||
IL_DEBUG_EEPROM(priv, "EEPROM signature=0x%08x\n", gp);
|
||||
IL_DEBUG_EEPROM(il, "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:
|
||||
IL_ERR(priv, "bad EEPROM signature,"
|
||||
IL_ERR(il, "bad EEPROM signature,"
|
||||
"EEPROM_GP=0x%08x\n", gp);
|
||||
ret = -ENOENT;
|
||||
break;
|
||||
@ -162,59 +162,59 @@ static int il_eeprom_verify_signature(struct il_priv *priv)
|
||||
}
|
||||
|
||||
const u8
|
||||
*il_eeprom_query_addr(const struct il_priv *priv, size_t offset)
|
||||
*il_eeprom_query_addr(const struct il_priv *il, size_t offset)
|
||||
{
|
||||
BUG_ON(offset >= priv->cfg->base_params->eeprom_size);
|
||||
return &priv->eeprom[offset];
|
||||
BUG_ON(offset >= il->cfg->base_params->eeprom_size);
|
||||
return &il->eeprom[offset];
|
||||
}
|
||||
EXPORT_SYMBOL(il_eeprom_query_addr);
|
||||
|
||||
u16 il_eeprom_query16(const struct il_priv *priv, size_t offset)
|
||||
u16 il_eeprom_query16(const struct il_priv *il, size_t offset)
|
||||
{
|
||||
if (!priv->eeprom)
|
||||
if (!il->eeprom)
|
||||
return 0;
|
||||
return (u16)priv->eeprom[offset] | ((u16)priv->eeprom[offset + 1] << 8);
|
||||
return (u16)il->eeprom[offset] | ((u16)il->eeprom[offset + 1] << 8);
|
||||
}
|
||||
EXPORT_SYMBOL(il_eeprom_query16);
|
||||
|
||||
/**
|
||||
* il_eeprom_init - read EEPROM contents
|
||||
*
|
||||
* Load the EEPROM contents from adapter into priv->eeprom
|
||||
* Load the EEPROM contents from adapter into il->eeprom
|
||||
*
|
||||
* NOTE: This routine uses the non-debug IO access functions.
|
||||
*/
|
||||
int il_eeprom_init(struct il_priv *priv)
|
||||
int il_eeprom_init(struct il_priv *il)
|
||||
{
|
||||
__le16 *e;
|
||||
u32 gp = il_read32(priv, CSR_EEPROM_GP);
|
||||
u32 gp = il_read32(il, CSR_EEPROM_GP);
|
||||
int sz;
|
||||
int ret;
|
||||
u16 addr;
|
||||
|
||||
/* allocate eeprom */
|
||||
sz = priv->cfg->base_params->eeprom_size;
|
||||
IL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz);
|
||||
priv->eeprom = kzalloc(sz, GFP_KERNEL);
|
||||
if (!priv->eeprom) {
|
||||
sz = il->cfg->base_params->eeprom_size;
|
||||
IL_DEBUG_EEPROM(il, "NVM size = %d\n", sz);
|
||||
il->eeprom = kzalloc(sz, GFP_KERNEL);
|
||||
if (!il->eeprom) {
|
||||
ret = -ENOMEM;
|
||||
goto alloc_err;
|
||||
}
|
||||
e = (__le16 *)priv->eeprom;
|
||||
e = (__le16 *)il->eeprom;
|
||||
|
||||
priv->cfg->ops->lib->apm_ops.init(priv);
|
||||
il->cfg->ops->lib->apm_ops.init(il);
|
||||
|
||||
ret = il_eeprom_verify_signature(priv);
|
||||
ret = il_eeprom_verify_signature(il);
|
||||
if (ret < 0) {
|
||||
IL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp);
|
||||
IL_ERR(il, "EEPROM not found, EEPROM_GP=0x%08x\n", gp);
|
||||
ret = -ENOENT;
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Make sure driver (instead of uCode) is allowed to read EEPROM */
|
||||
ret = priv->cfg->ops->lib->eeprom_ops.acquire_semaphore(priv);
|
||||
ret = il->cfg->ops->lib->eeprom_ops.acquire_semaphore(il);
|
||||
if (ret < 0) {
|
||||
IL_ERR(priv, "Failed to acquire EEPROM semaphore.\n");
|
||||
IL_ERR(il, "Failed to acquire EEPROM semaphore.\n");
|
||||
ret = -ENOENT;
|
||||
goto err;
|
||||
}
|
||||
@ -223,95 +223,95 @@ int il_eeprom_init(struct il_priv *priv)
|
||||
for (addr = 0; addr < sz; addr += sizeof(u16)) {
|
||||
u32 r;
|
||||
|
||||
_il_write32(priv, CSR_EEPROM_REG,
|
||||
_il_write32(il, CSR_EEPROM_REG,
|
||||
CSR_EEPROM_REG_MSK_ADDR & (addr << 1));
|
||||
|
||||
ret = il_poll_bit(priv, CSR_EEPROM_REG,
|
||||
ret = il_poll_bit(il, CSR_EEPROM_REG,
|
||||
CSR_EEPROM_REG_READ_VALID_MSK,
|
||||
CSR_EEPROM_REG_READ_VALID_MSK,
|
||||
IL_EEPROM_ACCESS_TIMEOUT);
|
||||
if (ret < 0) {
|
||||
IL_ERR(priv, "Time out reading EEPROM[%d]\n",
|
||||
IL_ERR(il, "Time out reading EEPROM[%d]\n",
|
||||
addr);
|
||||
goto done;
|
||||
}
|
||||
r = _il_read_direct32(priv, CSR_EEPROM_REG);
|
||||
r = _il_read_direct32(il, CSR_EEPROM_REG);
|
||||
e[addr / 2] = cpu_to_le16(r >> 16);
|
||||
}
|
||||
|
||||
IL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n",
|
||||
IL_DEBUG_EEPROM(il, "NVM Type: %s, version: 0x%x\n",
|
||||
"EEPROM",
|
||||
il_eeprom_query16(priv, EEPROM_VERSION));
|
||||
il_eeprom_query16(il, EEPROM_VERSION));
|
||||
|
||||
ret = 0;
|
||||
done:
|
||||
priv->cfg->ops->lib->eeprom_ops.release_semaphore(priv);
|
||||
il->cfg->ops->lib->eeprom_ops.release_semaphore(il);
|
||||
|
||||
err:
|
||||
if (ret)
|
||||
il_eeprom_free(priv);
|
||||
il_eeprom_free(il);
|
||||
/* Reset chip to save power until we load uCode during "up". */
|
||||
il_apm_stop(priv);
|
||||
il_apm_stop(il);
|
||||
alloc_err:
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(il_eeprom_init);
|
||||
|
||||
void il_eeprom_free(struct il_priv *priv)
|
||||
void il_eeprom_free(struct il_priv *il)
|
||||
{
|
||||
kfree(priv->eeprom);
|
||||
priv->eeprom = NULL;
|
||||
kfree(il->eeprom);
|
||||
il->eeprom = NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(il_eeprom_free);
|
||||
|
||||
static void il_init_band_reference(const struct il_priv *priv,
|
||||
static void il_init_band_reference(const struct il_priv *il,
|
||||
int eep_band, int *eeprom_ch_count,
|
||||
const struct il_eeprom_channel **eeprom_ch_info,
|
||||
const u8 **eeprom_ch_index)
|
||||
{
|
||||
u32 offset = priv->cfg->ops->lib->
|
||||
u32 offset = il->cfg->ops->lib->
|
||||
eeprom_ops.regulatory_bands[eep_band - 1];
|
||||
switch (eep_band) {
|
||||
case 1: /* 2.4GHz band */
|
||||
*eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_1);
|
||||
*eeprom_ch_info = (struct il_eeprom_channel *)
|
||||
il_eeprom_query_addr(priv, offset);
|
||||
il_eeprom_query_addr(il, 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 il_eeprom_channel *)
|
||||
il_eeprom_query_addr(priv, offset);
|
||||
il_eeprom_query_addr(il, 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 il_eeprom_channel *)
|
||||
il_eeprom_query_addr(priv, offset);
|
||||
il_eeprom_query_addr(il, 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 il_eeprom_channel *)
|
||||
il_eeprom_query_addr(priv, offset);
|
||||
il_eeprom_query_addr(il, 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 il_eeprom_channel *)
|
||||
il_eeprom_query_addr(priv, offset);
|
||||
il_eeprom_query_addr(il, 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 il_eeprom_channel *)
|
||||
il_eeprom_query_addr(priv, offset);
|
||||
il_eeprom_query_addr(il, 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 il_eeprom_channel *)
|
||||
il_eeprom_query_addr(priv, offset);
|
||||
il_eeprom_query_addr(il, offset);
|
||||
*eeprom_ch_index = iwlegacy_eeprom_band_7;
|
||||
break;
|
||||
default:
|
||||
@ -322,11 +322,11 @@ static void il_init_band_reference(const struct il_priv *priv,
|
||||
#define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \
|
||||
? # x " " : "")
|
||||
/**
|
||||
* il_mod_ht40_chan_info - Copy ht40 channel info into driver's priv.
|
||||
* il_mod_ht40_chan_info - Copy ht40 channel info into driver's il.
|
||||
*
|
||||
* Does not set up a command, or touch hardware.
|
||||
*/
|
||||
static int il_mod_ht40_chan_info(struct il_priv *priv,
|
||||
static int il_mod_ht40_chan_info(struct il_priv *il,
|
||||
enum ieee80211_band band, u16 channel,
|
||||
const struct il_eeprom_channel *eeprom_ch,
|
||||
u8 clear_ht40_extension_channel)
|
||||
@ -334,12 +334,12 @@ static int il_mod_ht40_chan_info(struct il_priv *priv,
|
||||
struct il_channel_info *ch_info;
|
||||
|
||||
ch_info = (struct il_channel_info *)
|
||||
il_get_channel_info(priv, band, channel);
|
||||
il_get_channel_info(il, band, channel);
|
||||
|
||||
if (!il_is_channel_valid(ch_info))
|
||||
return -1;
|
||||
|
||||
IL_DEBUG_EEPROM(priv, "HT40 Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):"
|
||||
IL_DEBUG_EEPROM(il, "HT40 Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):"
|
||||
" Ad-Hoc %ssupported\n",
|
||||
ch_info->channel,
|
||||
il_is_channel_a_band(ch_info) ?
|
||||
@ -371,7 +371,7 @@ static int il_mod_ht40_chan_info(struct il_priv *priv,
|
||||
/**
|
||||
* il_init_channel_map - Set up driver's info for all possible channels
|
||||
*/
|
||||
int il_init_channel_map(struct il_priv *priv)
|
||||
int il_init_channel_map(struct il_priv *il)
|
||||
{
|
||||
int eeprom_ch_count = 0;
|
||||
const u8 *eeprom_ch_index = NULL;
|
||||
@ -379,39 +379,39 @@ int il_init_channel_map(struct il_priv *priv)
|
||||
int band, ch;
|
||||
struct il_channel_info *ch_info;
|
||||
|
||||
if (priv->channel_count) {
|
||||
IL_DEBUG_EEPROM(priv, "Channel map already initialized.\n");
|
||||
if (il->channel_count) {
|
||||
IL_DEBUG_EEPROM(il, "Channel map already initialized.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
IL_DEBUG_EEPROM(priv, "Initializing regulatory info from EEPROM\n");
|
||||
IL_DEBUG_EEPROM(il, "Initializing regulatory info from EEPROM\n");
|
||||
|
||||
priv->channel_count =
|
||||
il->channel_count =
|
||||
ARRAY_SIZE(iwlegacy_eeprom_band_1) +
|
||||
ARRAY_SIZE(iwlegacy_eeprom_band_2) +
|
||||
ARRAY_SIZE(iwlegacy_eeprom_band_3) +
|
||||
ARRAY_SIZE(iwlegacy_eeprom_band_4) +
|
||||
ARRAY_SIZE(iwlegacy_eeprom_band_5);
|
||||
|
||||
IL_DEBUG_EEPROM(priv, "Parsing data for %d channels.\n",
|
||||
priv->channel_count);
|
||||
IL_DEBUG_EEPROM(il, "Parsing data for %d channels.\n",
|
||||
il->channel_count);
|
||||
|
||||
priv->channel_info = kzalloc(sizeof(struct il_channel_info) *
|
||||
priv->channel_count, GFP_KERNEL);
|
||||
if (!priv->channel_info) {
|
||||
IL_ERR(priv, "Could not allocate channel_info\n");
|
||||
priv->channel_count = 0;
|
||||
il->channel_info = kzalloc(sizeof(struct il_channel_info) *
|
||||
il->channel_count, GFP_KERNEL);
|
||||
if (!il->channel_info) {
|
||||
IL_ERR(il, "Could not allocate channel_info\n");
|
||||
il->channel_count = 0;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ch_info = priv->channel_info;
|
||||
ch_info = il->channel_info;
|
||||
|
||||
/* Loop through the 5 EEPROM bands adding them in order to the
|
||||
* channel map we maintain (that contains additional information than
|
||||
* what just in the EEPROM) */
|
||||
for (band = 1; band <= 5; band++) {
|
||||
|
||||
il_init_band_reference(priv, band, &eeprom_ch_count,
|
||||
il_init_band_reference(il, band, &eeprom_ch_count,
|
||||
&eeprom_ch_info, &eeprom_ch_index);
|
||||
|
||||
/* Loop through each band adding each of the channels */
|
||||
@ -433,7 +433,7 @@ int il_init_channel_map(struct il_priv *priv)
|
||||
IEEE80211_CHAN_NO_HT40;
|
||||
|
||||
if (!(il_is_channel_valid(ch_info))) {
|
||||
IL_DEBUG_EEPROM(priv,
|
||||
IL_DEBUG_EEPROM(il,
|
||||
"Ch. %d Flags %x [%sGHz] - "
|
||||
"No traffic\n",
|
||||
ch_info->channel,
|
||||
@ -450,7 +450,7 @@ int il_init_channel_map(struct il_priv *priv)
|
||||
ch_info->scan_power = eeprom_ch_info[ch].max_power_avg;
|
||||
ch_info->min_power = 0;
|
||||
|
||||
IL_DEBUG_EEPROM(priv, "Ch. %d [%sGHz] "
|
||||
IL_DEBUG_EEPROM(il, "Ch. %d [%sGHz] "
|
||||
"%s%s%s%s%s%s(0x%02x %ddBm):"
|
||||
" Ad-Hoc %ssupported\n",
|
||||
ch_info->channel,
|
||||
@ -475,9 +475,9 @@ int il_init_channel_map(struct il_priv *priv)
|
||||
}
|
||||
|
||||
/* Check if we do have HT40 channels */
|
||||
if (priv->cfg->ops->lib->eeprom_ops.regulatory_bands[5] ==
|
||||
if (il->cfg->ops->lib->eeprom_ops.regulatory_bands[5] ==
|
||||
EEPROM_REGULATORY_BAND_NO_HT40 &&
|
||||
priv->cfg->ops->lib->eeprom_ops.regulatory_bands[6] ==
|
||||
il->cfg->ops->lib->eeprom_ops.regulatory_bands[6] ==
|
||||
EEPROM_REGULATORY_BAND_NO_HT40)
|
||||
return 0;
|
||||
|
||||
@ -485,7 +485,7 @@ int il_init_channel_map(struct il_priv *priv)
|
||||
for (band = 6; band <= 7; band++) {
|
||||
enum ieee80211_band ieeeband;
|
||||
|
||||
il_init_band_reference(priv, band, &eeprom_ch_count,
|
||||
il_init_band_reference(il, 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 il_init_channel_map(struct il_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 */
|
||||
il_mod_ht40_chan_info(priv, ieeeband,
|
||||
il_mod_ht40_chan_info(il, ieeeband,
|
||||
eeprom_ch_index[ch],
|
||||
&eeprom_ch_info[ch],
|
||||
IEEE80211_CHAN_NO_HT40PLUS);
|
||||
|
||||
/* Set up driver's info for upper half */
|
||||
il_mod_ht40_chan_info(priv, ieeeband,
|
||||
il_mod_ht40_chan_info(il, ieeeband,
|
||||
eeprom_ch_index[ch] + 4,
|
||||
&eeprom_ch_info[ch],
|
||||
IEEE80211_CHAN_NO_HT40MINUS);
|
||||
@ -515,34 +515,34 @@ EXPORT_SYMBOL(il_init_channel_map);
|
||||
/*
|
||||
* il_free_channel_map - undo allocations in il_init_channel_map
|
||||
*/
|
||||
void il_free_channel_map(struct il_priv *priv)
|
||||
void il_free_channel_map(struct il_priv *il)
|
||||
{
|
||||
kfree(priv->channel_info);
|
||||
priv->channel_count = 0;
|
||||
kfree(il->channel_info);
|
||||
il->channel_count = 0;
|
||||
}
|
||||
EXPORT_SYMBOL(il_free_channel_map);
|
||||
|
||||
/**
|
||||
* il_get_channel_info - Find driver's private channel info
|
||||
* il_get_channel_info - Find driver's ilate channel info
|
||||
*
|
||||
* Based on band and channel number.
|
||||
*/
|
||||
const struct
|
||||
il_channel_info *il_get_channel_info(const struct il_priv *priv,
|
||||
il_channel_info *il_get_channel_info(const struct il_priv *il,
|
||||
enum ieee80211_band band, u16 channel)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (band) {
|
||||
case IEEE80211_BAND_5GHZ:
|
||||
for (i = 14; i < priv->channel_count; i++) {
|
||||
if (priv->channel_info[i].channel == channel)
|
||||
return &priv->channel_info[i];
|
||||
for (i = 14; i < il->channel_count; i++) {
|
||||
if (il->channel_info[i].channel == channel)
|
||||
return &il->channel_info[i];
|
||||
}
|
||||
break;
|
||||
case IEEE80211_BAND_2GHZ:
|
||||
if (channel >= 1 && channel <= 14)
|
||||
return &priv->channel_info[channel - 1];
|
||||
return &il->channel_info[channel - 1];
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
|
@ -325,20 +325,20 @@ struct il_eeprom_calib_info {
|
||||
|
||||
struct il_eeprom_ops {
|
||||
const u32 regulatory_bands[7];
|
||||
int (*acquire_semaphore) (struct il_priv *priv);
|
||||
void (*release_semaphore) (struct il_priv *priv);
|
||||
int (*acquire_semaphore) (struct il_priv *il);
|
||||
void (*release_semaphore) (struct il_priv *il);
|
||||
};
|
||||
|
||||
|
||||
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,
|
||||
int il_eeprom_init(struct il_priv *il);
|
||||
void il_eeprom_free(struct il_priv *il);
|
||||
const u8 *il_eeprom_query_addr(const struct il_priv *il,
|
||||
size_t offset);
|
||||
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);
|
||||
u16 il_eeprom_query16(const struct il_priv *il, size_t offset);
|
||||
int il_init_channel_map(struct il_priv *il);
|
||||
void il_free_channel_map(struct il_priv *il);
|
||||
const struct il_channel_info *il_get_channel_info(
|
||||
const struct il_priv *priv,
|
||||
const struct il_priv *il,
|
||||
enum ieee80211_band band, u16 channel);
|
||||
|
||||
#endif /* __il_eeprom_h__ */
|
||||
|
@ -90,12 +90,12 @@ EXPORT_SYMBOL(il_get_cmd_string);
|
||||
|
||||
#define HOST_COMPLETE_TIMEOUT (HZ / 2)
|
||||
|
||||
static void il_generic_cmd_callback(struct il_priv *priv,
|
||||
static void il_generic_cmd_callback(struct il_priv *il,
|
||||
struct il_device_cmd *cmd,
|
||||
struct il_rx_packet *pkt)
|
||||
{
|
||||
if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
|
||||
IL_ERR(priv, "Bad return from %s (0x%08X)\n",
|
||||
IL_ERR(il, "Bad return from %s (0x%08X)\n",
|
||||
il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
|
||||
return;
|
||||
}
|
||||
@ -104,18 +104,18 @@ static void il_generic_cmd_callback(struct il_priv *priv,
|
||||
switch (cmd->hdr.cmd) {
|
||||
case REPLY_TX_LINK_QUALITY_CMD:
|
||||
case SENSITIVITY_CMD:
|
||||
IL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n",
|
||||
IL_DEBUG_HC_DUMP(il, "back from %s (0x%08X)\n",
|
||||
il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
|
||||
break;
|
||||
default:
|
||||
IL_DEBUG_HC(priv, "back from %s (0x%08X)\n",
|
||||
IL_DEBUG_HC(il, "back from %s (0x%08X)\n",
|
||||
il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
il_send_cmd_async(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
il_send_cmd_async(struct il_priv *il, struct il_host_cmd *cmd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -128,57 +128,57 @@ il_send_cmd_async(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
if (!cmd->callback)
|
||||
cmd->callback = il_generic_cmd_callback;
|
||||
|
||||
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
|
||||
if (test_bit(STATUS_EXIT_PENDING, &il->status))
|
||||
return -EBUSY;
|
||||
|
||||
ret = il_enqueue_hcmd(priv, cmd);
|
||||
ret = il_enqueue_hcmd(il, cmd);
|
||||
if (ret < 0) {
|
||||
IL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n",
|
||||
IL_ERR(il, "Error sending %s: enqueue_hcmd failed: %d\n",
|
||||
il_get_cmd_string(cmd->id), ret);
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int il_send_cmd_sync(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
int il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
|
||||
{
|
||||
int cmd_idx;
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
BUG_ON(cmd->flags & CMD_ASYNC);
|
||||
|
||||
/* A synchronous command can not have a callback set. */
|
||||
BUG_ON(cmd->callback);
|
||||
|
||||
IL_DEBUG_INFO(priv, "Attempting to send sync command %s\n",
|
||||
IL_DEBUG_INFO(il, "Attempting to send sync command %s\n",
|
||||
il_get_cmd_string(cmd->id));
|
||||
|
||||
set_bit(STATUS_HCMD_ACTIVE, &priv->status);
|
||||
IL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n",
|
||||
set_bit(STATUS_HCMD_ACTIVE, &il->status);
|
||||
IL_DEBUG_INFO(il, "Setting HCMD_ACTIVE for command %s\n",
|
||||
il_get_cmd_string(cmd->id));
|
||||
|
||||
cmd_idx = il_enqueue_hcmd(priv, cmd);
|
||||
cmd_idx = il_enqueue_hcmd(il, cmd);
|
||||
if (cmd_idx < 0) {
|
||||
ret = cmd_idx;
|
||||
IL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n",
|
||||
IL_ERR(il, "Error sending %s: enqueue_hcmd failed: %d\n",
|
||||
il_get_cmd_string(cmd->id), ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = wait_event_timeout(priv->wait_command_queue,
|
||||
!test_bit(STATUS_HCMD_ACTIVE, &priv->status),
|
||||
ret = wait_event_timeout(il->wait_command_queue,
|
||||
!test_bit(STATUS_HCMD_ACTIVE, &il->status),
|
||||
HOST_COMPLETE_TIMEOUT);
|
||||
if (!ret) {
|
||||
if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) {
|
||||
IL_ERR(priv,
|
||||
if (test_bit(STATUS_HCMD_ACTIVE, &il->status)) {
|
||||
IL_ERR(il,
|
||||
"Error sending %s: time out after %dms.\n",
|
||||
il_get_cmd_string(cmd->id),
|
||||
jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
|
||||
|
||||
clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
|
||||
IL_DEBUG_INFO(priv,
|
||||
clear_bit(STATUS_HCMD_ACTIVE, &il->status);
|
||||
IL_DEBUG_INFO(il,
|
||||
"Clearing HCMD_ACTIVE for command %s\n",
|
||||
il_get_cmd_string(cmd->id));
|
||||
ret = -ETIMEDOUT;
|
||||
@ -186,20 +186,20 @@ int il_send_cmd_sync(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
|
||||
IL_ERR(priv, "Command %s aborted: RF KILL Switch\n",
|
||||
if (test_bit(STATUS_RF_KILL_HW, &il->status)) {
|
||||
IL_ERR(il, "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)) {
|
||||
IL_ERR(priv, "Command %s failed: FW Error\n",
|
||||
if (test_bit(STATUS_FW_ERROR, &il->status)) {
|
||||
IL_ERR(il, "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) {
|
||||
IL_ERR(priv, "Error: Response NULL in '%s'\n",
|
||||
IL_ERR(il, "Error: Response NULL in '%s'\n",
|
||||
il_get_cmd_string(cmd->id));
|
||||
ret = -EIO;
|
||||
goto cancel;
|
||||
@ -216,12 +216,12 @@ cancel:
|
||||
* in later, it will possibly set an invalid
|
||||
* address (cmd->meta.source).
|
||||
*/
|
||||
priv->txq[priv->cmd_queue].meta[cmd_idx].flags &=
|
||||
il->txq[il->cmd_queue].meta[cmd_idx].flags &=
|
||||
~CMD_WANT_SKB;
|
||||
}
|
||||
fail:
|
||||
if (cmd->reply_page) {
|
||||
il_free_pages(priv, cmd->reply_page);
|
||||
il_free_pages(il, cmd->reply_page);
|
||||
cmd->reply_page = 0;
|
||||
}
|
||||
out:
|
||||
@ -229,17 +229,17 @@ out:
|
||||
}
|
||||
EXPORT_SYMBOL(il_send_cmd_sync);
|
||||
|
||||
int il_send_cmd(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
int il_send_cmd(struct il_priv *il, struct il_host_cmd *cmd)
|
||||
{
|
||||
if (cmd->flags & CMD_ASYNC)
|
||||
return il_send_cmd_async(priv, cmd);
|
||||
return il_send_cmd_async(il, cmd);
|
||||
|
||||
return il_send_cmd_sync(priv, cmd);
|
||||
return il_send_cmd_sync(il, cmd);
|
||||
}
|
||||
EXPORT_SYMBOL(il_send_cmd);
|
||||
|
||||
int
|
||||
il_send_cmd_pdu(struct il_priv *priv, u8 id, u16 len, const void *data)
|
||||
il_send_cmd_pdu(struct il_priv *il, u8 id, u16 len, const void *data)
|
||||
{
|
||||
struct il_host_cmd cmd = {
|
||||
.id = id,
|
||||
@ -247,13 +247,13 @@ il_send_cmd_pdu(struct il_priv *priv, u8 id, u16 len, const void *data)
|
||||
.data = data,
|
||||
};
|
||||
|
||||
return il_send_cmd_sync(priv, &cmd);
|
||||
return il_send_cmd_sync(il, &cmd);
|
||||
}
|
||||
EXPORT_SYMBOL(il_send_cmd_pdu);
|
||||
|
||||
int il_send_cmd_pdu_async(struct il_priv *priv,
|
||||
int il_send_cmd_pdu_async(struct il_priv *il,
|
||||
u8 id, u16 len, const void *data,
|
||||
void (*callback)(struct il_priv *priv,
|
||||
void (*callback)(struct il_priv *il,
|
||||
struct il_device_cmd *cmd,
|
||||
struct il_rx_packet *pkt))
|
||||
{
|
||||
@ -266,6 +266,6 @@ int il_send_cmd_pdu_async(struct il_priv *priv,
|
||||
cmd.flags |= CMD_ASYNC;
|
||||
cmd.callback = callback;
|
||||
|
||||
return il_send_cmd_async(priv, &cmd);
|
||||
return il_send_cmd_async(il, &cmd);
|
||||
}
|
||||
EXPORT_SYMBOL(il_send_cmd_pdu_async);
|
||||
|
@ -108,28 +108,28 @@ il_set_swq_id(struct il_tx_queue *txq, u8 ac, u8 hwq)
|
||||
txq->swq_id = (hwq << 2) | ac;
|
||||
}
|
||||
|
||||
static inline void il_wake_queue(struct il_priv *priv,
|
||||
static inline void il_wake_queue(struct il_priv *il,
|
||||
struct il_tx_queue *txq)
|
||||
{
|
||||
u8 queue = txq->swq_id;
|
||||
u8 ac = queue & 3;
|
||||
u8 hwq = (queue >> 2) & 0x1f;
|
||||
|
||||
if (test_and_clear_bit(hwq, priv->queue_stopped))
|
||||
if (atomic_dec_return(&priv->queue_stop_count[ac]) <= 0)
|
||||
ieee80211_wake_queue(priv->hw, ac);
|
||||
if (test_and_clear_bit(hwq, il->queue_stopped))
|
||||
if (atomic_dec_return(&il->queue_stop_count[ac]) <= 0)
|
||||
ieee80211_wake_queue(il->hw, ac);
|
||||
}
|
||||
|
||||
static inline void il_stop_queue(struct il_priv *priv,
|
||||
static inline void il_stop_queue(struct il_priv *il,
|
||||
struct il_tx_queue *txq)
|
||||
{
|
||||
u8 queue = txq->swq_id;
|
||||
u8 ac = queue & 3;
|
||||
u8 hwq = (queue >> 2) & 0x1f;
|
||||
|
||||
if (!test_and_set_bit(hwq, priv->queue_stopped))
|
||||
if (atomic_inc_return(&priv->queue_stop_count[ac]) > 0)
|
||||
ieee80211_stop_queue(priv->hw, ac);
|
||||
if (!test_and_set_bit(hwq, il->queue_stopped))
|
||||
if (atomic_inc_return(&il->queue_stop_count[ac]) > 0)
|
||||
ieee80211_stop_queue(il->hw, ac);
|
||||
}
|
||||
|
||||
#ifdef ieee80211_stop_queue
|
||||
@ -144,39 +144,39 @@ static inline void il_stop_queue(struct il_priv *priv,
|
||||
|
||||
#define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue
|
||||
|
||||
static inline void il_disable_interrupts(struct il_priv *priv)
|
||||
static inline void il_disable_interrupts(struct il_priv *il)
|
||||
{
|
||||
clear_bit(STATUS_INT_ENABLED, &priv->status);
|
||||
clear_bit(STATUS_INT_ENABLED, &il->status);
|
||||
|
||||
/* disable interrupts from uCode/NIC to host */
|
||||
il_write32(priv, CSR_INT_MASK, 0x00000000);
|
||||
il_write32(il, CSR_INT_MASK, 0x00000000);
|
||||
|
||||
/* acknowledge/clear/reset any interrupts still pending
|
||||
* from uCode or flow handler (Rx/Tx DMA) */
|
||||
il_write32(priv, CSR_INT, 0xffffffff);
|
||||
il_write32(priv, CSR_FH_INT_STATUS, 0xffffffff);
|
||||
IL_DEBUG_ISR(priv, "Disabled interrupts\n");
|
||||
il_write32(il, CSR_INT, 0xffffffff);
|
||||
il_write32(il, CSR_FH_INT_STATUS, 0xffffffff);
|
||||
IL_DEBUG_ISR(il, "Disabled interrupts\n");
|
||||
}
|
||||
|
||||
static inline void il_enable_rfkill_int(struct il_priv *priv)
|
||||
static inline void il_enable_rfkill_int(struct il_priv *il)
|
||||
{
|
||||
IL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n");
|
||||
il_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
|
||||
IL_DEBUG_ISR(il, "Enabling rfkill interrupt\n");
|
||||
il_write32(il, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
|
||||
}
|
||||
|
||||
static inline void il_enable_interrupts(struct il_priv *priv)
|
||||
static inline void il_enable_interrupts(struct il_priv *il)
|
||||
{
|
||||
IL_DEBUG_ISR(priv, "Enabling interrupts\n");
|
||||
set_bit(STATUS_INT_ENABLED, &priv->status);
|
||||
il_write32(priv, CSR_INT_MASK, priv->inta_mask);
|
||||
IL_DEBUG_ISR(il, "Enabling interrupts\n");
|
||||
set_bit(STATUS_INT_ENABLED, &il->status);
|
||||
il_write32(il, CSR_INT_MASK, il->inta_mask);
|
||||
}
|
||||
|
||||
/**
|
||||
* il_beacon_time_mask_low - mask of lower 32 bit of beacon time
|
||||
* @priv -- pointer to il_priv data structure
|
||||
* @il -- pointer to il_priv data structure
|
||||
* @tsf_bits -- number of bits need to shift for masking)
|
||||
*/
|
||||
static inline u32 il_beacon_time_mask_low(struct il_priv *priv,
|
||||
static inline u32 il_beacon_time_mask_low(struct il_priv *il,
|
||||
u16 tsf_bits)
|
||||
{
|
||||
return (1 << tsf_bits) - 1;
|
||||
@ -184,10 +184,10 @@ static inline u32 il_beacon_time_mask_low(struct il_priv *priv,
|
||||
|
||||
/**
|
||||
* il_beacon_time_mask_high - mask of higher 32 bit of beacon time
|
||||
* @priv -- pointer to il_priv data structure
|
||||
* @il -- pointer to il_priv data structure
|
||||
* @tsf_bits -- number of bits need to shift for masking)
|
||||
*/
|
||||
static inline u32 il_beacon_time_mask_high(struct il_priv *priv,
|
||||
static inline u32 il_beacon_time_mask_high(struct il_priv *il,
|
||||
u16 tsf_bits)
|
||||
{
|
||||
return ((1 << (32 - tsf_bits)) - 1) << tsf_bits;
|
||||
|
@ -62,72 +62,72 @@
|
||||
*
|
||||
*/
|
||||
|
||||
static inline void _il_write8(struct il_priv *priv, u32 ofs, u8 val)
|
||||
static inline void _il_write8(struct il_priv *il, u32 ofs, u8 val)
|
||||
{
|
||||
iowrite8(val, priv->hw_base + ofs);
|
||||
iowrite8(val, il->hw_base + ofs);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
static inline void
|
||||
__il_write8(const char *f, u32 l, struct il_priv *priv,
|
||||
__il_write8(const char *f, u32 l, struct il_priv *il,
|
||||
u32 ofs, u8 val)
|
||||
{
|
||||
IL_DEBUG_IO(priv, "write8(0x%08X, 0x%02X) - %s %d\n", ofs, val, f, l);
|
||||
_il_write8(priv, ofs, val);
|
||||
IL_DEBUG_IO(il, "write8(0x%08X, 0x%02X) - %s %d\n", ofs, val, f, l);
|
||||
_il_write8(il, ofs, val);
|
||||
}
|
||||
#define il_write8(priv, ofs, val) \
|
||||
__il_write8(__FILE__, __LINE__, priv, ofs, val)
|
||||
#define il_write8(il, ofs, val) \
|
||||
__il_write8(__FILE__, __LINE__, il, ofs, val)
|
||||
#else
|
||||
#define il_write8(priv, ofs, val) _il_write8(priv, ofs, val)
|
||||
#define il_write8(il, ofs, val) _il_write8(il, ofs, val)
|
||||
#endif
|
||||
|
||||
|
||||
static inline void _il_write32(struct il_priv *priv, u32 ofs, u32 val)
|
||||
static inline void _il_write32(struct il_priv *il, u32 ofs, u32 val)
|
||||
{
|
||||
iowrite32(val, priv->hw_base + ofs);
|
||||
iowrite32(val, il->hw_base + ofs);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
static inline void
|
||||
__il_write32(const char *f, u32 l, struct il_priv *priv,
|
||||
__il_write32(const char *f, u32 l, struct il_priv *il,
|
||||
u32 ofs, u32 val)
|
||||
{
|
||||
IL_DEBUG_IO(priv, "write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
|
||||
_il_write32(priv, ofs, val);
|
||||
IL_DEBUG_IO(il, "write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
|
||||
_il_write32(il, ofs, val);
|
||||
}
|
||||
#define il_write32(priv, ofs, val) \
|
||||
__il_write32(__FILE__, __LINE__, priv, ofs, val)
|
||||
#define il_write32(il, ofs, val) \
|
||||
__il_write32(__FILE__, __LINE__, il, ofs, val)
|
||||
#else
|
||||
#define il_write32(priv, ofs, val) _il_write32(priv, ofs, val)
|
||||
#define il_write32(il, ofs, val) _il_write32(il, ofs, val)
|
||||
#endif
|
||||
|
||||
static inline u32 _il_read32(struct il_priv *priv, u32 ofs)
|
||||
static inline u32 _il_read32(struct il_priv *il, u32 ofs)
|
||||
{
|
||||
u32 val = ioread32(priv->hw_base + ofs);
|
||||
u32 val = ioread32(il->hw_base + ofs);
|
||||
return val;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
static inline u32
|
||||
__il_read32(char *f, u32 l, struct il_priv *priv, u32 ofs)
|
||||
__il_read32(char *f, u32 l, struct il_priv *il, u32 ofs)
|
||||
{
|
||||
IL_DEBUG_IO(priv, "read_direct32(0x%08X) - %s %d\n", ofs, f, l);
|
||||
return _il_read32(priv, ofs);
|
||||
IL_DEBUG_IO(il, "read_direct32(0x%08X) - %s %d\n", ofs, f, l);
|
||||
return _il_read32(il, ofs);
|
||||
}
|
||||
#define il_read32(priv, ofs) __il_read32(__FILE__, __LINE__, priv, ofs)
|
||||
#define il_read32(il, ofs) __il_read32(__FILE__, __LINE__, il, ofs)
|
||||
#else
|
||||
#define il_read32(p, o) _il_read32(p, o)
|
||||
#endif
|
||||
|
||||
#define IL_POLL_INTERVAL 10 /* microseconds */
|
||||
static inline int
|
||||
_il_poll_bit(struct il_priv *priv, u32 addr,
|
||||
_il_poll_bit(struct il_priv *il, u32 addr,
|
||||
u32 bits, u32 mask, int timeout)
|
||||
{
|
||||
int t = 0;
|
||||
|
||||
do {
|
||||
if ((_il_read32(priv, addr) & mask) == (bits & mask))
|
||||
if ((_il_read32(il, addr) & mask) == (bits & mask))
|
||||
return t;
|
||||
udelay(IL_POLL_INTERVAL);
|
||||
t += IL_POLL_INTERVAL;
|
||||
@ -137,34 +137,34 @@ _il_poll_bit(struct il_priv *priv, u32 addr,
|
||||
}
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
static inline int __il_poll_bit(const char *f, u32 l,
|
||||
struct il_priv *priv, u32 addr,
|
||||
struct il_priv *il, u32 addr,
|
||||
u32 bits, u32 mask, int timeout)
|
||||
{
|
||||
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",
|
||||
int ret = _il_poll_bit(il, addr, bits, mask, timeout);
|
||||
IL_DEBUG_IO(il, "poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n",
|
||||
addr, bits, mask,
|
||||
unlikely(ret == -ETIMEDOUT) ? "timeout" : "", f, l);
|
||||
return ret;
|
||||
}
|
||||
#define il_poll_bit(priv, addr, bits, mask, timeout) \
|
||||
__il_poll_bit(__FILE__, __LINE__, priv, addr, \
|
||||
#define il_poll_bit(il, addr, bits, mask, timeout) \
|
||||
__il_poll_bit(__FILE__, __LINE__, il, addr, \
|
||||
bits, mask, timeout)
|
||||
#else
|
||||
#define il_poll_bit(p, a, b, m, t) _il_poll_bit(p, a, b, m, t)
|
||||
#endif
|
||||
|
||||
static inline void _il_set_bit(struct il_priv *priv, u32 reg, u32 mask)
|
||||
static inline void _il_set_bit(struct il_priv *il, u32 reg, u32 mask)
|
||||
{
|
||||
_il_write32(priv, reg, _il_read32(priv, reg) | mask);
|
||||
_il_write32(il, reg, _il_read32(il, reg) | mask);
|
||||
}
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
static inline void __il_set_bit(const char *f, u32 l,
|
||||
struct il_priv *priv, u32 reg, u32 mask)
|
||||
struct il_priv *il, u32 reg, u32 mask)
|
||||
{
|
||||
u32 val = _il_read32(priv, reg) | mask;
|
||||
IL_DEBUG_IO(priv, "set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg,
|
||||
u32 val = _il_read32(il, reg) | mask;
|
||||
IL_DEBUG_IO(il, "set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg,
|
||||
mask, val);
|
||||
_il_write32(priv, reg, val);
|
||||
_il_write32(il, reg, val);
|
||||
}
|
||||
static inline void il_set_bit(struct il_priv *p, u32 r, u32 m)
|
||||
{
|
||||
@ -186,18 +186,18 @@ static inline void il_set_bit(struct il_priv *p, u32 r, u32 m)
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
_il_clear_bit(struct il_priv *priv, u32 reg, u32 mask)
|
||||
_il_clear_bit(struct il_priv *il, u32 reg, u32 mask)
|
||||
{
|
||||
_il_write32(priv, reg, _il_read32(priv, reg) & ~mask);
|
||||
_il_write32(il, reg, _il_read32(il, reg) & ~mask);
|
||||
}
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
static inline void
|
||||
__il_clear_bit(const char *f, u32 l,
|
||||
struct il_priv *priv, u32 reg, u32 mask)
|
||||
struct il_priv *il, u32 reg, u32 mask)
|
||||
{
|
||||
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);
|
||||
u32 val = _il_read32(il, reg) & ~mask;
|
||||
IL_DEBUG_IO(il, "clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
|
||||
_il_write32(il, reg, val);
|
||||
}
|
||||
static inline void il_clear_bit(struct il_priv *p, u32 r, u32 m)
|
||||
{
|
||||
@ -218,13 +218,13 @@ static inline void il_clear_bit(struct il_priv *p, u32 r, u32 m)
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int _il_grab_nic_access(struct il_priv *priv)
|
||||
static inline int _il_grab_nic_access(struct il_priv *il)
|
||||
{
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
/* this bit wakes up the NIC */
|
||||
_il_set_bit(priv, CSR_GP_CNTRL,
|
||||
_il_set_bit(il, CSR_GP_CNTRL,
|
||||
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
|
||||
|
||||
/*
|
||||
@ -244,15 +244,15 @@ static inline int _il_grab_nic_access(struct il_priv *priv)
|
||||
* good idea before accessing 3945/4965 SRAM (e.g. reading Event Log).
|
||||
*
|
||||
*/
|
||||
ret = _il_poll_bit(priv, CSR_GP_CNTRL,
|
||||
ret = _il_poll_bit(il, 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 = _il_read32(priv, CSR_GP_CNTRL);
|
||||
IL_ERR(priv,
|
||||
val = _il_read32(il, CSR_GP_CNTRL);
|
||||
IL_ERR(il,
|
||||
"MAC is in deep sleep!. CSR_GP_CNTRL = 0x%08X\n", val);
|
||||
_il_write32(priv, CSR_RESET,
|
||||
_il_write32(il, CSR_RESET,
|
||||
CSR_RESET_REG_FLAG_FORCE_NMI);
|
||||
return -EIO;
|
||||
}
|
||||
@ -262,117 +262,117 @@ static inline int _il_grab_nic_access(struct il_priv *priv)
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
static inline int __il_grab_nic_access(const char *f, u32 l,
|
||||
struct il_priv *priv)
|
||||
struct il_priv *il)
|
||||
{
|
||||
IL_DEBUG_IO(priv, "grabbing nic access - %s %d\n", f, l);
|
||||
return _il_grab_nic_access(priv);
|
||||
IL_DEBUG_IO(il, "grabbing nic access - %s %d\n", f, l);
|
||||
return _il_grab_nic_access(il);
|
||||
}
|
||||
#define il_grab_nic_access(priv) \
|
||||
__il_grab_nic_access(__FILE__, __LINE__, priv)
|
||||
#define il_grab_nic_access(il) \
|
||||
__il_grab_nic_access(__FILE__, __LINE__, il)
|
||||
#else
|
||||
#define il_grab_nic_access(priv) \
|
||||
_il_grab_nic_access(priv)
|
||||
#define il_grab_nic_access(il) \
|
||||
_il_grab_nic_access(il)
|
||||
#endif
|
||||
|
||||
static inline void _il_release_nic_access(struct il_priv *priv)
|
||||
static inline void _il_release_nic_access(struct il_priv *il)
|
||||
{
|
||||
_il_clear_bit(priv, CSR_GP_CNTRL,
|
||||
_il_clear_bit(il, CSR_GP_CNTRL,
|
||||
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
|
||||
}
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
static inline void __il_release_nic_access(const char *f, u32 l,
|
||||
struct il_priv *priv)
|
||||
struct il_priv *il)
|
||||
{
|
||||
|
||||
IL_DEBUG_IO(priv, "releasing nic access - %s %d\n", f, l);
|
||||
_il_release_nic_access(priv);
|
||||
IL_DEBUG_IO(il, "releasing nic access - %s %d\n", f, l);
|
||||
_il_release_nic_access(il);
|
||||
}
|
||||
#define il_release_nic_access(priv) \
|
||||
__il_release_nic_access(__FILE__, __LINE__, priv)
|
||||
#define il_release_nic_access(il) \
|
||||
__il_release_nic_access(__FILE__, __LINE__, il)
|
||||
#else
|
||||
#define il_release_nic_access(priv) \
|
||||
_il_release_nic_access(priv)
|
||||
#define il_release_nic_access(il) \
|
||||
_il_release_nic_access(il)
|
||||
#endif
|
||||
|
||||
static inline u32 _il_read_direct32(struct il_priv *priv, u32 reg)
|
||||
static inline u32 _il_read_direct32(struct il_priv *il, u32 reg)
|
||||
{
|
||||
return _il_read32(priv, reg);
|
||||
return _il_read32(il, reg);
|
||||
}
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
static inline u32 __il_read_direct32(const char *f, u32 l,
|
||||
struct il_priv *priv, u32 reg)
|
||||
struct il_priv *il, u32 reg)
|
||||
{
|
||||
u32 value = _il_read_direct32(priv, reg);
|
||||
IL_DEBUG_IO(priv,
|
||||
u32 value = _il_read_direct32(il, reg);
|
||||
IL_DEBUG_IO(il,
|
||||
"read_direct32(0x%4X) = 0x%08x - %s %d\n", reg, value,
|
||||
f, l);
|
||||
return value;
|
||||
}
|
||||
static inline u32 il_read_direct32(struct il_priv *priv, u32 reg)
|
||||
static inline u32 il_read_direct32(struct il_priv *il, u32 reg)
|
||||
{
|
||||
u32 value;
|
||||
unsigned long reg_flags;
|
||||
|
||||
spin_lock_irqsave(&priv->reg_lock, reg_flags);
|
||||
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);
|
||||
spin_lock_irqsave(&il->reg_lock, reg_flags);
|
||||
il_grab_nic_access(il);
|
||||
value = __il_read_direct32(__FILE__, __LINE__, il, reg);
|
||||
il_release_nic_access(il);
|
||||
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
|
||||
return value;
|
||||
}
|
||||
|
||||
#else
|
||||
static inline u32 il_read_direct32(struct il_priv *priv, u32 reg)
|
||||
static inline u32 il_read_direct32(struct il_priv *il, u32 reg)
|
||||
{
|
||||
u32 value;
|
||||
unsigned long reg_flags;
|
||||
|
||||
spin_lock_irqsave(&priv->reg_lock, reg_flags);
|
||||
il_grab_nic_access(priv);
|
||||
value = _il_read_direct32(priv, reg);
|
||||
il_release_nic_access(priv);
|
||||
spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
|
||||
spin_lock_irqsave(&il->reg_lock, reg_flags);
|
||||
il_grab_nic_access(il);
|
||||
value = _il_read_direct32(il, reg);
|
||||
il_release_nic_access(il);
|
||||
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
|
||||
return value;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void _il_write_direct32(struct il_priv *priv,
|
||||
static inline void _il_write_direct32(struct il_priv *il,
|
||||
u32 reg, u32 value)
|
||||
{
|
||||
_il_write32(priv, reg, value);
|
||||
_il_write32(il, reg, value);
|
||||
}
|
||||
static inline void
|
||||
il_write_direct32(struct il_priv *priv, u32 reg, u32 value)
|
||||
il_write_direct32(struct il_priv *il, u32 reg, u32 value)
|
||||
{
|
||||
unsigned long reg_flags;
|
||||
|
||||
spin_lock_irqsave(&priv->reg_lock, reg_flags);
|
||||
if (!il_grab_nic_access(priv)) {
|
||||
_il_write_direct32(priv, reg, value);
|
||||
il_release_nic_access(priv);
|
||||
spin_lock_irqsave(&il->reg_lock, reg_flags);
|
||||
if (!il_grab_nic_access(il)) {
|
||||
_il_write_direct32(il, reg, value);
|
||||
il_release_nic_access(il);
|
||||
}
|
||||
spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
|
||||
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
|
||||
}
|
||||
|
||||
static inline void il_write_reg_buf(struct il_priv *priv,
|
||||
static inline void il_write_reg_buf(struct il_priv *il,
|
||||
u32 reg, u32 len, u32 *values)
|
||||
{
|
||||
u32 count = sizeof(u32);
|
||||
|
||||
if ((priv != NULL) && (values != NULL)) {
|
||||
if ((il != NULL) && (values != NULL)) {
|
||||
for (; 0 < len; len -= count, reg += count, values++)
|
||||
il_write_direct32(priv, reg, *values);
|
||||
il_write_direct32(il, reg, *values);
|
||||
}
|
||||
}
|
||||
|
||||
static inline int _il_poll_direct_bit(struct il_priv *priv, u32 addr,
|
||||
static inline int _il_poll_direct_bit(struct il_priv *il, u32 addr,
|
||||
u32 mask, int timeout)
|
||||
{
|
||||
int t = 0;
|
||||
|
||||
do {
|
||||
if ((il_read_direct32(priv, addr) & mask) == mask)
|
||||
if ((il_read_direct32(il, addr) & mask) == mask)
|
||||
return t;
|
||||
udelay(IL_POLL_INTERVAL);
|
||||
t += IL_POLL_INTERVAL;
|
||||
@ -383,159 +383,159 @@ static inline int _il_poll_direct_bit(struct il_priv *priv, u32 addr,
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
static inline int __il_poll_direct_bit(const char *f, u32 l,
|
||||
struct il_priv *priv,
|
||||
struct il_priv *il,
|
||||
u32 addr, u32 mask, int timeout)
|
||||
{
|
||||
int ret = _il_poll_direct_bit(priv, addr, mask, timeout);
|
||||
int ret = _il_poll_direct_bit(il, addr, mask, timeout);
|
||||
|
||||
if (unlikely(ret == -ETIMEDOUT))
|
||||
IL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) - "
|
||||
IL_DEBUG_IO(il, "poll_direct_bit(0x%08X, 0x%08X) - "
|
||||
"timedout - %s %d\n", addr, mask, f, l);
|
||||
else
|
||||
IL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) = 0x%08X "
|
||||
IL_DEBUG_IO(il, "poll_direct_bit(0x%08X, 0x%08X) = 0x%08X "
|
||||
"- %s %d\n", addr, mask, ret, f, l);
|
||||
return ret;
|
||||
}
|
||||
#define il_poll_direct_bit(priv, addr, mask, timeout) \
|
||||
__il_poll_direct_bit(__FILE__, __LINE__, priv, addr, mask, timeout)
|
||||
#define il_poll_direct_bit(il, addr, mask, timeout) \
|
||||
__il_poll_direct_bit(__FILE__, __LINE__, il, addr, mask, timeout)
|
||||
#else
|
||||
#define il_poll_direct_bit _il_poll_direct_bit
|
||||
#endif
|
||||
|
||||
static inline u32 _il_read_prph(struct il_priv *priv, u32 reg)
|
||||
static inline u32 _il_read_prph(struct il_priv *il, u32 reg)
|
||||
{
|
||||
_il_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
|
||||
_il_write_direct32(il, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
|
||||
rmb();
|
||||
return _il_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
|
||||
return _il_read_direct32(il, HBUS_TARG_PRPH_RDAT);
|
||||
}
|
||||
static inline u32 il_read_prph(struct il_priv *priv, u32 reg)
|
||||
static inline u32 il_read_prph(struct il_priv *il, u32 reg)
|
||||
{
|
||||
unsigned long reg_flags;
|
||||
u32 val;
|
||||
|
||||
spin_lock_irqsave(&priv->reg_lock, reg_flags);
|
||||
il_grab_nic_access(priv);
|
||||
val = _il_read_prph(priv, reg);
|
||||
il_release_nic_access(priv);
|
||||
spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
|
||||
spin_lock_irqsave(&il->reg_lock, reg_flags);
|
||||
il_grab_nic_access(il);
|
||||
val = _il_read_prph(il, reg);
|
||||
il_release_nic_access(il);
|
||||
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline void _il_write_prph(struct il_priv *priv,
|
||||
static inline void _il_write_prph(struct il_priv *il,
|
||||
u32 addr, u32 val)
|
||||
{
|
||||
_il_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
|
||||
_il_write_direct32(il, HBUS_TARG_PRPH_WADDR,
|
||||
((addr & 0x0000FFFF) | (3 << 24)));
|
||||
wmb();
|
||||
_il_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
|
||||
_il_write_direct32(il, HBUS_TARG_PRPH_WDAT, val);
|
||||
}
|
||||
|
||||
static inline void
|
||||
il_write_prph(struct il_priv *priv, u32 addr, u32 val)
|
||||
il_write_prph(struct il_priv *il, u32 addr, u32 val)
|
||||
{
|
||||
unsigned long reg_flags;
|
||||
|
||||
spin_lock_irqsave(&priv->reg_lock, reg_flags);
|
||||
if (!il_grab_nic_access(priv)) {
|
||||
_il_write_prph(priv, addr, val);
|
||||
il_release_nic_access(priv);
|
||||
spin_lock_irqsave(&il->reg_lock, reg_flags);
|
||||
if (!il_grab_nic_access(il)) {
|
||||
_il_write_prph(il, addr, val);
|
||||
il_release_nic_access(il);
|
||||
}
|
||||
spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
|
||||
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
|
||||
}
|
||||
|
||||
#define _il_set_bits_prph(priv, reg, mask) \
|
||||
_il_write_prph(priv, reg, (_il_read_prph(priv, reg) | mask))
|
||||
#define _il_set_bits_prph(il, reg, mask) \
|
||||
_il_write_prph(il, reg, (_il_read_prph(il, reg) | mask))
|
||||
|
||||
static inline void
|
||||
il_set_bits_prph(struct il_priv *priv, u32 reg, u32 mask)
|
||||
il_set_bits_prph(struct il_priv *il, u32 reg, u32 mask)
|
||||
{
|
||||
unsigned long reg_flags;
|
||||
|
||||
spin_lock_irqsave(&priv->reg_lock, reg_flags);
|
||||
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);
|
||||
spin_lock_irqsave(&il->reg_lock, reg_flags);
|
||||
il_grab_nic_access(il);
|
||||
_il_set_bits_prph(il, reg, mask);
|
||||
il_release_nic_access(il);
|
||||
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
|
||||
}
|
||||
|
||||
#define _il_set_bits_mask_prph(priv, reg, bits, mask) \
|
||||
_il_write_prph(priv, reg, \
|
||||
((_il_read_prph(priv, reg) & mask) | bits))
|
||||
#define _il_set_bits_mask_prph(il, reg, bits, mask) \
|
||||
_il_write_prph(il, reg, \
|
||||
((_il_read_prph(il, reg) & mask) | bits))
|
||||
|
||||
static inline void il_set_bits_mask_prph(struct il_priv *priv, u32 reg,
|
||||
static inline void il_set_bits_mask_prph(struct il_priv *il, u32 reg,
|
||||
u32 bits, u32 mask)
|
||||
{
|
||||
unsigned long reg_flags;
|
||||
|
||||
spin_lock_irqsave(&priv->reg_lock, reg_flags);
|
||||
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);
|
||||
spin_lock_irqsave(&il->reg_lock, reg_flags);
|
||||
il_grab_nic_access(il);
|
||||
_il_set_bits_mask_prph(il, reg, bits, mask);
|
||||
il_release_nic_access(il);
|
||||
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
|
||||
}
|
||||
|
||||
static inline void il_clear_bits_prph(struct il_priv
|
||||
*priv, u32 reg, u32 mask)
|
||||
*il, u32 reg, u32 mask)
|
||||
{
|
||||
unsigned long reg_flags;
|
||||
u32 val;
|
||||
|
||||
spin_lock_irqsave(&priv->reg_lock, reg_flags);
|
||||
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);
|
||||
spin_lock_irqsave(&il->reg_lock, reg_flags);
|
||||
il_grab_nic_access(il);
|
||||
val = _il_read_prph(il, reg);
|
||||
_il_write_prph(il, reg, (val & ~mask));
|
||||
il_release_nic_access(il);
|
||||
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
|
||||
}
|
||||
|
||||
static inline u32 il_read_targ_mem(struct il_priv *priv, u32 addr)
|
||||
static inline u32 il_read_targ_mem(struct il_priv *il, u32 addr)
|
||||
{
|
||||
unsigned long reg_flags;
|
||||
u32 value;
|
||||
|
||||
spin_lock_irqsave(&priv->reg_lock, reg_flags);
|
||||
il_grab_nic_access(priv);
|
||||
spin_lock_irqsave(&il->reg_lock, reg_flags);
|
||||
il_grab_nic_access(il);
|
||||
|
||||
_il_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
|
||||
_il_write_direct32(il, HBUS_TARG_MEM_RADDR, addr);
|
||||
rmb();
|
||||
value = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT);
|
||||
value = _il_read_direct32(il, HBUS_TARG_MEM_RDAT);
|
||||
|
||||
il_release_nic_access(priv);
|
||||
spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
|
||||
il_release_nic_access(il);
|
||||
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline void
|
||||
il_write_targ_mem(struct il_priv *priv, u32 addr, u32 val)
|
||||
il_write_targ_mem(struct il_priv *il, u32 addr, u32 val)
|
||||
{
|
||||
unsigned long reg_flags;
|
||||
|
||||
spin_lock_irqsave(&priv->reg_lock, reg_flags);
|
||||
if (!il_grab_nic_access(priv)) {
|
||||
_il_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
|
||||
spin_lock_irqsave(&il->reg_lock, reg_flags);
|
||||
if (!il_grab_nic_access(il)) {
|
||||
_il_write_direct32(il, HBUS_TARG_MEM_WADDR, addr);
|
||||
wmb();
|
||||
_il_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
|
||||
il_release_nic_access(priv);
|
||||
_il_write_direct32(il, HBUS_TARG_MEM_WDAT, val);
|
||||
il_release_nic_access(il);
|
||||
}
|
||||
spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
|
||||
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
|
||||
}
|
||||
|
||||
static inline void
|
||||
il_write_targ_mem_buf(struct il_priv *priv, u32 addr,
|
||||
il_write_targ_mem_buf(struct il_priv *il, u32 addr,
|
||||
u32 len, u32 *values)
|
||||
{
|
||||
unsigned long reg_flags;
|
||||
|
||||
spin_lock_irqsave(&priv->reg_lock, reg_flags);
|
||||
if (!il_grab_nic_access(priv)) {
|
||||
_il_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
|
||||
spin_lock_irqsave(&il->reg_lock, reg_flags);
|
||||
if (!il_grab_nic_access(il)) {
|
||||
_il_write_direct32(il, HBUS_TARG_MEM_WADDR, addr);
|
||||
wmb();
|
||||
for (; 0 < len; len -= sizeof(u32), values++)
|
||||
_il_write_direct32(priv,
|
||||
_il_write_direct32(il,
|
||||
HBUS_TARG_MEM_WDAT, *values);
|
||||
|
||||
il_release_nic_access(priv);
|
||||
il_release_nic_access(il);
|
||||
}
|
||||
spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
|
||||
spin_unlock_irqrestore(&il->reg_lock, reg_flags);
|
||||
}
|
||||
#endif
|
||||
|
@ -84,11 +84,11 @@ static const struct ieee80211_tpt_blink il_blink[] = {
|
||||
* compensation = (100 - averageDeviation) * 64 / 100
|
||||
* NewBlinkTime = (compensation * BlinkTime) / 64
|
||||
*/
|
||||
static inline u8 il_blink_compensation(struct il_priv *priv,
|
||||
static inline u8 il_blink_compensation(struct il_priv *il,
|
||||
u8 time, u16 compensation)
|
||||
{
|
||||
if (!compensation) {
|
||||
IL_ERR(priv, "undefined blink compensation: "
|
||||
IL_ERR(il, "undefined blink compensation: "
|
||||
"use pre-defined blinking time\n");
|
||||
return time;
|
||||
}
|
||||
@ -97,7 +97,7 @@ static inline u8 il_blink_compensation(struct il_priv *priv,
|
||||
}
|
||||
|
||||
/* Set led pattern command */
|
||||
static int il_led_cmd(struct il_priv *priv,
|
||||
static int il_led_cmd(struct il_priv *il,
|
||||
unsigned long on,
|
||||
unsigned long off)
|
||||
{
|
||||
@ -107,10 +107,10 @@ static int il_led_cmd(struct il_priv *priv,
|
||||
};
|
||||
int ret;
|
||||
|
||||
if (!test_bit(STATUS_READY, &priv->status))
|
||||
if (!test_bit(STATUS_READY, &il->status))
|
||||
return -EBUSY;
|
||||
|
||||
if (priv->blink_on == on && priv->blink_off == off)
|
||||
if (il->blink_on == on && il->blink_off == off)
|
||||
return 0;
|
||||
|
||||
if (off == 0) {
|
||||
@ -118,17 +118,17 @@ static int il_led_cmd(struct il_priv *priv,
|
||||
on = IL_LED_SOLID;
|
||||
}
|
||||
|
||||
IL_DEBUG_LED(priv, "Led blink time compensation=%u\n",
|
||||
priv->cfg->base_params->led_compensation);
|
||||
led_cmd.on = il_blink_compensation(priv, on,
|
||||
priv->cfg->base_params->led_compensation);
|
||||
led_cmd.off = il_blink_compensation(priv, off,
|
||||
priv->cfg->base_params->led_compensation);
|
||||
IL_DEBUG_LED(il, "Led blink time compensation=%u\n",
|
||||
il->cfg->base_params->led_compensation);
|
||||
led_cmd.on = il_blink_compensation(il, on,
|
||||
il->cfg->base_params->led_compensation);
|
||||
led_cmd.off = il_blink_compensation(il, off,
|
||||
il->cfg->base_params->led_compensation);
|
||||
|
||||
ret = priv->cfg->ops->led->cmd(priv, &led_cmd);
|
||||
ret = il->cfg->ops->led->cmd(il, &led_cmd);
|
||||
if (!ret) {
|
||||
priv->blink_on = on;
|
||||
priv->blink_off = off;
|
||||
il->blink_on = on;
|
||||
il->blink_off = off;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -136,70 +136,70 @@ static int il_led_cmd(struct il_priv *priv,
|
||||
static void il_led_brightness_set(struct led_classdev *led_cdev,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
struct il_priv *priv = container_of(led_cdev, struct il_priv, led);
|
||||
struct il_priv *il = container_of(led_cdev, struct il_priv, led);
|
||||
unsigned long on = 0;
|
||||
|
||||
if (brightness > 0)
|
||||
on = IL_LED_SOLID;
|
||||
|
||||
il_led_cmd(priv, on, 0);
|
||||
il_led_cmd(il, on, 0);
|
||||
}
|
||||
|
||||
static int il_led_blink_set(struct led_classdev *led_cdev,
|
||||
unsigned long *delay_on,
|
||||
unsigned long *delay_off)
|
||||
{
|
||||
struct il_priv *priv = container_of(led_cdev, struct il_priv, led);
|
||||
struct il_priv *il = container_of(led_cdev, struct il_priv, led);
|
||||
|
||||
return il_led_cmd(priv, *delay_on, *delay_off);
|
||||
return il_led_cmd(il, *delay_on, *delay_off);
|
||||
}
|
||||
|
||||
void il_leds_init(struct il_priv *priv)
|
||||
void il_leds_init(struct il_priv *il)
|
||||
{
|
||||
int mode = led_mode;
|
||||
int ret;
|
||||
|
||||
if (mode == IL_LED_DEFAULT)
|
||||
mode = priv->cfg->led_mode;
|
||||
mode = il->cfg->led_mode;
|
||||
|
||||
priv->led.name = kasprintf(GFP_KERNEL, "%s-led",
|
||||
wiphy_name(priv->hw->wiphy));
|
||||
priv->led.brightness_set = il_led_brightness_set;
|
||||
priv->led.blink_set = il_led_blink_set;
|
||||
priv->led.max_brightness = 1;
|
||||
il->led.name = kasprintf(GFP_KERNEL, "%s-led",
|
||||
wiphy_name(il->hw->wiphy));
|
||||
il->led.brightness_set = il_led_brightness_set;
|
||||
il->led.blink_set = il_led_blink_set;
|
||||
il->led.max_brightness = 1;
|
||||
|
||||
switch (mode) {
|
||||
case IL_LED_DEFAULT:
|
||||
WARN_ON(1);
|
||||
break;
|
||||
case IL_LED_BLINK:
|
||||
priv->led.default_trigger =
|
||||
ieee80211_create_tpt_led_trigger(priv->hw,
|
||||
il->led.default_trigger =
|
||||
ieee80211_create_tpt_led_trigger(il->hw,
|
||||
IEEE80211_TPT_LEDTRIG_FL_CONNECTED,
|
||||
il_blink, ARRAY_SIZE(il_blink));
|
||||
break;
|
||||
case IL_LED_RF_STATE:
|
||||
priv->led.default_trigger =
|
||||
ieee80211_get_radio_led_name(priv->hw);
|
||||
il->led.default_trigger =
|
||||
ieee80211_get_radio_led_name(il->hw);
|
||||
break;
|
||||
}
|
||||
|
||||
ret = led_classdev_register(&priv->pci_dev->dev, &priv->led);
|
||||
ret = led_classdev_register(&il->pci_dev->dev, &il->led);
|
||||
if (ret) {
|
||||
kfree(priv->led.name);
|
||||
kfree(il->led.name);
|
||||
return;
|
||||
}
|
||||
|
||||
priv->led_registered = true;
|
||||
il->led_registered = true;
|
||||
}
|
||||
EXPORT_SYMBOL(il_leds_init);
|
||||
|
||||
void il_leds_exit(struct il_priv *priv)
|
||||
void il_leds_exit(struct il_priv *il)
|
||||
{
|
||||
if (!priv->led_registered)
|
||||
if (!il->led_registered)
|
||||
return;
|
||||
|
||||
led_classdev_unregister(&priv->led);
|
||||
kfree(priv->led.name);
|
||||
led_classdev_unregister(&il->led);
|
||||
kfree(il->led.name);
|
||||
}
|
||||
EXPORT_SYMBOL(il_leds_exit);
|
||||
|
@ -50,7 +50,7 @@ enum il_led_mode {
|
||||
IL_LED_BLINK,
|
||||
};
|
||||
|
||||
void il_leds_init(struct il_priv *priv);
|
||||
void il_leds_exit(struct il_priv *priv);
|
||||
void il_leds_init(struct il_priv *il);
|
||||
void il_leds_exit(struct il_priv *il);
|
||||
|
||||
#endif /* __il_leds_h__ */
|
||||
|
@ -346,7 +346,7 @@ struct il_traffic_load {
|
||||
};
|
||||
|
||||
/**
|
||||
* struct il_lq_sta -- driver's rate scaling private structure
|
||||
* struct il_lq_sta -- driver's rate scaling ilate structure
|
||||
*
|
||||
* Pointer to this gets passed back and forth between driver and mac80211.
|
||||
*/
|
||||
@ -400,11 +400,9 @@ struct il_lq_sta {
|
||||
u8 is_agg;
|
||||
};
|
||||
|
||||
static inline u8 il4965_num_of_ant(u8 mask)
|
||||
static inline u8 il4965_num_of_ant(u8 m)
|
||||
{
|
||||
return !!((mask) & ANT_A) +
|
||||
!!((mask) & ANT_B) +
|
||||
!!((mask) & ANT_C);
|
||||
return !!(m & ANT_A) + !!(m & ANT_B) + !!(m & ANT_C);
|
||||
}
|
||||
|
||||
static inline u8 il4965_first_antenna(u8 mask)
|
||||
@ -426,9 +424,9 @@ static inline u8 il4965_first_antenna(u8 mask)
|
||||
extern void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
|
||||
|
||||
/* Initialize station's rate scaling information after adding station */
|
||||
extern void il4965_rs_rate_init(struct il_priv *priv,
|
||||
extern void il4965_rs_rate_init(struct il_priv *il,
|
||||
struct ieee80211_sta *sta, u8 sta_id);
|
||||
extern void il3945_rs_rate_init(struct il_priv *priv,
|
||||
extern void il3945_rs_rate_init(struct il_priv *il,
|
||||
struct ieee80211_sta *sta, u8 sta_id);
|
||||
|
||||
/**
|
||||
|
@ -60,27 +60,27 @@ struct il_power_vec_entry {
|
||||
u8 no_dtim; /* number of skip dtim */
|
||||
};
|
||||
|
||||
static void il_power_sleep_cam_cmd(struct il_priv *priv,
|
||||
static void il_power_sleep_cam_cmd(struct il_priv *il,
|
||||
struct il_powertable_cmd *cmd)
|
||||
{
|
||||
memset(cmd, 0, sizeof(*cmd));
|
||||
|
||||
if (priv->power_data.pci_pm)
|
||||
if (il->power_data.pci_pm)
|
||||
cmd->flags |= IL_POWER_PCI_PM_MSK;
|
||||
|
||||
IL_DEBUG_POWER(priv, "Sleep command for CAM\n");
|
||||
IL_DEBUG_POWER(il, "Sleep command for CAM\n");
|
||||
}
|
||||
|
||||
static int
|
||||
il_set_power(struct il_priv *priv, struct il_powertable_cmd *cmd)
|
||||
il_set_power(struct il_priv *il, struct il_powertable_cmd *cmd)
|
||||
{
|
||||
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",
|
||||
IL_DEBUG_POWER(il, "Sending power/sleep command\n");
|
||||
IL_DEBUG_POWER(il, "Flags value = 0x%08X\n", cmd->flags);
|
||||
IL_DEBUG_POWER(il, "Tx timeout = %u\n",
|
||||
le32_to_cpu(cmd->tx_data_timeout));
|
||||
IL_DEBUG_POWER(priv, "Rx timeout = %u\n",
|
||||
IL_DEBUG_POWER(il, "Rx timeout = %u\n",
|
||||
le32_to_cpu(cmd->rx_data_timeout));
|
||||
IL_DEBUG_POWER(priv,
|
||||
IL_DEBUG_POWER(il,
|
||||
"Sleep interval vector = { %d , %d , %d , %d , %d }\n",
|
||||
le32_to_cpu(cmd->sleep_interval[0]),
|
||||
le32_to_cpu(cmd->sleep_interval[1]),
|
||||
@ -88,78 +88,78 @@ il_set_power(struct il_priv *priv, struct il_powertable_cmd *cmd)
|
||||
le32_to_cpu(cmd->sleep_interval[3]),
|
||||
le32_to_cpu(cmd->sleep_interval[4]));
|
||||
|
||||
return il_send_cmd_pdu(priv, POWER_TABLE_CMD,
|
||||
return il_send_cmd_pdu(il, POWER_TABLE_CMD,
|
||||
sizeof(struct il_powertable_cmd), cmd);
|
||||
}
|
||||
|
||||
int
|
||||
il_power_set_mode(struct il_priv *priv, struct il_powertable_cmd *cmd,
|
||||
il_power_set_mode(struct il_priv *il, struct il_powertable_cmd *cmd,
|
||||
bool force)
|
||||
{
|
||||
int ret;
|
||||
bool update_chains;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
/* Don't update the RX chain when chain noise calibration is running */
|
||||
update_chains = priv->chain_noise_data.state == IL_CHAIN_NOISE_DONE ||
|
||||
priv->chain_noise_data.state == IL_CHAIN_NOISE_ALIVE;
|
||||
update_chains = il->chain_noise_data.state == IL_CHAIN_NOISE_DONE ||
|
||||
il->chain_noise_data.state == IL_CHAIN_NOISE_ALIVE;
|
||||
|
||||
if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force)
|
||||
if (!memcmp(&il->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force)
|
||||
return 0;
|
||||
|
||||
if (!il_is_ready_rf(priv))
|
||||
if (!il_is_ready_rf(il))
|
||||
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) {
|
||||
IL_DEBUG_INFO(priv, "Defer power set mode while scanning\n");
|
||||
memcpy(&il->power_data.sleep_cmd_next, cmd, sizeof(*cmd));
|
||||
if (test_bit(STATUS_SCANNING, &il->status) && !force) {
|
||||
IL_DEBUG_INFO(il, "Defer power set mode while scanning\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK)
|
||||
set_bit(STATUS_POWER_PMI, &priv->status);
|
||||
set_bit(STATUS_POWER_PMI, &il->status);
|
||||
|
||||
ret = il_set_power(priv, cmd);
|
||||
ret = il_set_power(il, cmd);
|
||||
if (!ret) {
|
||||
if (!(cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK))
|
||||
clear_bit(STATUS_POWER_PMI, &priv->status);
|
||||
clear_bit(STATUS_POWER_PMI, &il->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)
|
||||
IL_DEBUG_POWER(priv,
|
||||
if (il->cfg->ops->lib->update_chain_flags && update_chains)
|
||||
il->cfg->ops->lib->update_chain_flags(il);
|
||||
else if (il->cfg->ops->lib->update_chain_flags)
|
||||
IL_DEBUG_POWER(il,
|
||||
"Cannot update the power, chain noise "
|
||||
"calibration running: %d\n",
|
||||
priv->chain_noise_data.state);
|
||||
il->chain_noise_data.state);
|
||||
|
||||
memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd));
|
||||
memcpy(&il->power_data.sleep_cmd, cmd, sizeof(*cmd));
|
||||
} else
|
||||
IL_ERR(priv, "set power fail, ret = %d", ret);
|
||||
IL_ERR(il, "set power fail, ret = %d", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int il_power_update_mode(struct il_priv *priv, bool force)
|
||||
int il_power_update_mode(struct il_priv *il, bool force)
|
||||
{
|
||||
struct il_powertable_cmd cmd;
|
||||
|
||||
il_power_sleep_cam_cmd(priv, &cmd);
|
||||
return il_power_set_mode(priv, &cmd, force);
|
||||
il_power_sleep_cam_cmd(il, &cmd);
|
||||
return il_power_set_mode(il, &cmd, force);
|
||||
}
|
||||
EXPORT_SYMBOL(il_power_update_mode);
|
||||
|
||||
/* initialize to default */
|
||||
void il_power_initialize(struct il_priv *priv)
|
||||
void il_power_initialize(struct il_priv *il)
|
||||
{
|
||||
u16 lctl = il_pcie_link_ctl(priv);
|
||||
u16 lctl = il_pcie_link_ctl(il);
|
||||
|
||||
priv->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN);
|
||||
il->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN);
|
||||
|
||||
priv->power_data.debug_sleep_level_override = -1;
|
||||
il->power_data.debug_sleep_level_override = -1;
|
||||
|
||||
memset(&priv->power_data.sleep_cmd, 0,
|
||||
sizeof(priv->power_data.sleep_cmd));
|
||||
memset(&il->power_data.sleep_cmd, 0,
|
||||
sizeof(il->power_data.sleep_cmd));
|
||||
}
|
||||
EXPORT_SYMBOL(il_power_initialize);
|
||||
|
@ -47,9 +47,9 @@ struct il_power_mgr {
|
||||
};
|
||||
|
||||
int
|
||||
il_power_set_mode(struct il_priv *priv, struct il_powertable_cmd *cmd,
|
||||
il_power_set_mode(struct il_priv *il, struct il_powertable_cmd *cmd,
|
||||
bool force);
|
||||
int il_power_update_mode(struct il_priv *priv, bool force);
|
||||
void il_power_initialize(struct il_priv *priv);
|
||||
int il_power_update_mode(struct il_priv *il, bool force);
|
||||
void il_power_initialize(struct il_priv *il);
|
||||
|
||||
#endif /* __il_power_setting_h__ */
|
||||
|
@ -124,11 +124,11 @@ EXPORT_SYMBOL(il_rx_queue_space);
|
||||
* il_rx_queue_update_write_ptr - Update the write pointer for the RX queue
|
||||
*/
|
||||
void
|
||||
il_rx_queue_update_write_ptr(struct il_priv *priv,
|
||||
il_rx_queue_update_write_ptr(struct il_priv *il,
|
||||
struct il_rx_queue *q)
|
||||
{
|
||||
unsigned long flags;
|
||||
u32 rx_wrt_ptr_reg = priv->hw_params.rx_wrt_ptr_reg;
|
||||
u32 rx_wrt_ptr_reg = il->hw_params.rx_wrt_ptr_reg;
|
||||
u32 reg;
|
||||
|
||||
spin_lock_irqsave(&q->lock, flags);
|
||||
@ -137,27 +137,27 @@ il_rx_queue_update_write_ptr(struct il_priv *priv,
|
||||
goto exit_unlock;
|
||||
|
||||
/* If power-saving is in use, make sure device is awake */
|
||||
if (test_bit(STATUS_POWER_PMI, &priv->status)) {
|
||||
reg = il_read32(priv, CSR_UCODE_DRV_GP1);
|
||||
if (test_bit(STATUS_POWER_PMI, &il->status)) {
|
||||
reg = il_read32(il, CSR_UCODE_DRV_GP1);
|
||||
|
||||
if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
|
||||
IL_DEBUG_INFO(priv,
|
||||
IL_DEBUG_INFO(il,
|
||||
"Rx queue requesting wakeup,"
|
||||
" GP1 = 0x%x\n", reg);
|
||||
il_set_bit(priv, CSR_GP_CNTRL,
|
||||
il_set_bit(il, CSR_GP_CNTRL,
|
||||
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
|
||||
goto exit_unlock;
|
||||
}
|
||||
|
||||
q->write_actual = (q->write & ~0x7);
|
||||
il_write_direct32(priv, rx_wrt_ptr_reg,
|
||||
il_write_direct32(il, 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);
|
||||
il_write_direct32(priv, rx_wrt_ptr_reg,
|
||||
il_write_direct32(il, rx_wrt_ptr_reg,
|
||||
q->write_actual);
|
||||
}
|
||||
|
||||
@ -168,10 +168,10 @@ il_rx_queue_update_write_ptr(struct il_priv *priv,
|
||||
}
|
||||
EXPORT_SYMBOL(il_rx_queue_update_write_ptr);
|
||||
|
||||
int il_rx_queue_alloc(struct il_priv *priv)
|
||||
int il_rx_queue_alloc(struct il_priv *il)
|
||||
{
|
||||
struct il_rx_queue *rxq = &priv->rxq;
|
||||
struct device *dev = &priv->pci_dev->dev;
|
||||
struct il_rx_queue *rxq = &il->rxq;
|
||||
struct device *dev = &il->pci_dev->dev;
|
||||
int i;
|
||||
|
||||
spin_lock_init(&rxq->lock);
|
||||
@ -202,7 +202,7 @@ int il_rx_queue_alloc(struct il_priv *priv)
|
||||
return 0;
|
||||
|
||||
err_rb:
|
||||
dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
|
||||
dma_free_coherent(&il->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
|
||||
rxq->bd_dma);
|
||||
err_bd:
|
||||
return -ENOMEM;
|
||||
@ -210,27 +210,27 @@ err_bd:
|
||||
EXPORT_SYMBOL(il_rx_queue_alloc);
|
||||
|
||||
|
||||
void il_rx_spectrum_measure_notif(struct il_priv *priv,
|
||||
void il_rx_spectrum_measure_notif(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb)
|
||||
{
|
||||
struct il_rx_packet *pkt = rxb_addr(rxb);
|
||||
struct il_spectrum_notification *report = &(pkt->u.spectrum_notif);
|
||||
|
||||
if (!report->state) {
|
||||
IL_DEBUG_11H(priv,
|
||||
IL_DEBUG_11H(il,
|
||||
"Spectrum Measure Notification: Start\n");
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(&priv->measure_report, report, sizeof(*report));
|
||||
priv->measurement_status |= MEASUREMENT_READY;
|
||||
memcpy(&il->measure_report, report, sizeof(*report));
|
||||
il->measurement_status |= MEASUREMENT_READY;
|
||||
}
|
||||
EXPORT_SYMBOL(il_rx_spectrum_measure_notif);
|
||||
|
||||
/*
|
||||
* returns non-zero if packet should be dropped
|
||||
*/
|
||||
int il_set_decrypted_flag(struct il_priv *priv,
|
||||
int il_set_decrypted_flag(struct il_priv *il,
|
||||
struct ieee80211_hdr *hdr,
|
||||
u32 decrypt_res,
|
||||
struct ieee80211_rx_status *stats)
|
||||
@ -241,14 +241,14 @@ int il_set_decrypted_flag(struct il_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[IL_RXON_CTX_BSS].active.filter_flags &
|
||||
if (il->contexts[IL_RXON_CTX_BSS].active.filter_flags &
|
||||
RXON_FILTER_DIS_DECRYPT_MSK)
|
||||
return 0;
|
||||
|
||||
if (!(fc & IEEE80211_FCTL_PROTECTED))
|
||||
return 0;
|
||||
|
||||
IL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res);
|
||||
IL_DEBUG_RX(il, "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 il_set_decrypted_flag(struct il_priv *priv,
|
||||
RX_RES_STATUS_BAD_ICV_MIC) {
|
||||
/* bad ICV, the packet is destroyed since the
|
||||
* decryption is inplace, drop it */
|
||||
IL_DEBUG_RX(priv, "Packet destroyed\n");
|
||||
IL_DEBUG_RX(il, "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) {
|
||||
IL_DEBUG_RX(priv, "hw decrypt successfully!!!\n");
|
||||
IL_DEBUG_RX(il, "hw decrypt successfully!!!\n");
|
||||
stats->flag |= RX_FLAG_DECRYPTED;
|
||||
}
|
||||
break;
|
||||
|
@ -54,7 +54,7 @@
|
||||
#define IL_PASSIVE_DWELL_BASE (100)
|
||||
#define IL_CHANNEL_TUNE_TIME 5
|
||||
|
||||
static int il_send_scan_abort(struct il_priv *priv)
|
||||
static int il_send_scan_abort(struct il_priv *il)
|
||||
{
|
||||
int ret;
|
||||
struct il_rx_packet *pkt;
|
||||
@ -66,14 +66,14 @@ static int il_send_scan_abort(struct il_priv *priv)
|
||||
/* Exit instantly with error when device is not ready
|
||||
* to receive scan abort command or it does not perform
|
||||
* hardware scan currently */
|
||||
if (!test_bit(STATUS_READY, &priv->status) ||
|
||||
!test_bit(STATUS_GEO_CONFIGURED, &priv->status) ||
|
||||
!test_bit(STATUS_SCAN_HW, &priv->status) ||
|
||||
test_bit(STATUS_FW_ERROR, &priv->status) ||
|
||||
test_bit(STATUS_EXIT_PENDING, &priv->status))
|
||||
if (!test_bit(STATUS_READY, &il->status) ||
|
||||
!test_bit(STATUS_GEO_CONFIGURED, &il->status) ||
|
||||
!test_bit(STATUS_SCAN_HW, &il->status) ||
|
||||
test_bit(STATUS_FW_ERROR, &il->status) ||
|
||||
test_bit(STATUS_EXIT_PENDING, &il->status))
|
||||
return -EIO;
|
||||
|
||||
ret = il_send_cmd_sync(priv, &cmd);
|
||||
ret = il_send_cmd_sync(il, &cmd);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -85,73 +85,73 @@ static int il_send_scan_abort(struct il_priv *priv)
|
||||
* can occur if we send the scan abort before we
|
||||
* the microcode has notified us that a scan is
|
||||
* completed. */
|
||||
IL_DEBUG_SCAN(priv, "SCAN_ABORT ret %d.\n", pkt->u.status);
|
||||
IL_DEBUG_SCAN(il, "SCAN_ABORT ret %d.\n", pkt->u.status);
|
||||
ret = -EIO;
|
||||
}
|
||||
|
||||
il_free_pages(priv, cmd.reply_page);
|
||||
il_free_pages(il, cmd.reply_page);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void il_complete_scan(struct il_priv *priv, bool aborted)
|
||||
static void il_complete_scan(struct il_priv *il, bool aborted)
|
||||
{
|
||||
/* check if scan was requested from mac80211 */
|
||||
if (priv->scan_request) {
|
||||
IL_DEBUG_SCAN(priv, "Complete scan in mac80211\n");
|
||||
ieee80211_scan_completed(priv->hw, aborted);
|
||||
if (il->scan_request) {
|
||||
IL_DEBUG_SCAN(il, "Complete scan in mac80211\n");
|
||||
ieee80211_scan_completed(il->hw, aborted);
|
||||
}
|
||||
|
||||
priv->scan_vif = NULL;
|
||||
priv->scan_request = NULL;
|
||||
il->scan_vif = NULL;
|
||||
il->scan_request = NULL;
|
||||
}
|
||||
|
||||
void il_force_scan_end(struct il_priv *priv)
|
||||
void il_force_scan_end(struct il_priv *il)
|
||||
{
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
if (!test_bit(STATUS_SCANNING, &priv->status)) {
|
||||
IL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n");
|
||||
if (!test_bit(STATUS_SCANNING, &il->status)) {
|
||||
IL_DEBUG_SCAN(il, "Forcing scan end while not scanning\n");
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
il_complete_scan(priv, true);
|
||||
IL_DEBUG_SCAN(il, "Forcing scan end\n");
|
||||
clear_bit(STATUS_SCANNING, &il->status);
|
||||
clear_bit(STATUS_SCAN_HW, &il->status);
|
||||
clear_bit(STATUS_SCAN_ABORTING, &il->status);
|
||||
il_complete_scan(il, true);
|
||||
}
|
||||
|
||||
static void il_do_scan_abort(struct il_priv *priv)
|
||||
static void il_do_scan_abort(struct il_priv *il)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
if (!test_bit(STATUS_SCANNING, &priv->status)) {
|
||||
IL_DEBUG_SCAN(priv, "Not performing scan to abort\n");
|
||||
if (!test_bit(STATUS_SCANNING, &il->status)) {
|
||||
IL_DEBUG_SCAN(il, "Not performing scan to abort\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->status)) {
|
||||
IL_DEBUG_SCAN(priv, "Scan abort in progress\n");
|
||||
if (test_and_set_bit(STATUS_SCAN_ABORTING, &il->status)) {
|
||||
IL_DEBUG_SCAN(il, "Scan abort in progress\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = il_send_scan_abort(priv);
|
||||
ret = il_send_scan_abort(il);
|
||||
if (ret) {
|
||||
IL_DEBUG_SCAN(priv, "Send scan abort failed %d\n", ret);
|
||||
il_force_scan_end(priv);
|
||||
IL_DEBUG_SCAN(il, "Send scan abort failed %d\n", ret);
|
||||
il_force_scan_end(il);
|
||||
} else
|
||||
IL_DEBUG_SCAN(priv, "Successfully send scan abort\n");
|
||||
IL_DEBUG_SCAN(il, "Successfully send scan abort\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* il_scan_cancel - Cancel any currently executing HW scan
|
||||
*/
|
||||
int il_scan_cancel(struct il_priv *priv)
|
||||
int il_scan_cancel(struct il_priv *il)
|
||||
{
|
||||
IL_DEBUG_SCAN(priv, "Queuing abort scan\n");
|
||||
queue_work(priv->workqueue, &priv->abort_scan);
|
||||
IL_DEBUG_SCAN(il, "Queuing abort scan\n");
|
||||
queue_work(il->workqueue, &il->abort_scan);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(il_scan_cancel);
|
||||
@ -161,28 +161,28 @@ EXPORT_SYMBOL(il_scan_cancel);
|
||||
* @ms: amount of time to wait (in milliseconds) for scan to abort
|
||||
*
|
||||
*/
|
||||
int il_scan_cancel_timeout(struct il_priv *priv, unsigned long ms)
|
||||
int il_scan_cancel_timeout(struct il_priv *il, unsigned long ms)
|
||||
{
|
||||
unsigned long timeout = jiffies + msecs_to_jiffies(ms);
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
IL_DEBUG_SCAN(priv, "Scan cancel timeout\n");
|
||||
IL_DEBUG_SCAN(il, "Scan cancel timeout\n");
|
||||
|
||||
il_do_scan_abort(priv);
|
||||
il_do_scan_abort(il);
|
||||
|
||||
while (time_before_eq(jiffies, timeout)) {
|
||||
if (!test_bit(STATUS_SCAN_HW, &priv->status))
|
||||
if (!test_bit(STATUS_SCAN_HW, &il->status))
|
||||
break;
|
||||
msleep(20);
|
||||
}
|
||||
|
||||
return test_bit(STATUS_SCAN_HW, &priv->status);
|
||||
return test_bit(STATUS_SCAN_HW, &il->status);
|
||||
}
|
||||
EXPORT_SYMBOL(il_scan_cancel_timeout);
|
||||
|
||||
/* Service response to REPLY_SCAN_CMD (0x80) */
|
||||
static void il_rx_reply_scan(struct il_priv *priv,
|
||||
static void il_rx_reply_scan(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb)
|
||||
{
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
@ -190,19 +190,19 @@ static void il_rx_reply_scan(struct il_priv *priv,
|
||||
struct il_scanreq_notification *notif =
|
||||
(struct il_scanreq_notification *)pkt->u.raw;
|
||||
|
||||
IL_DEBUG_SCAN(priv, "Scan request status = 0x%x\n", notif->status);
|
||||
IL_DEBUG_SCAN(il, "Scan request status = 0x%x\n", notif->status);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Service SCAN_START_NOTIFICATION (0x82) */
|
||||
static void il_rx_scan_start_notif(struct il_priv *priv,
|
||||
static void il_rx_scan_start_notif(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb)
|
||||
{
|
||||
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);
|
||||
IL_DEBUG_SCAN(priv, "Scan start: "
|
||||
il->scan_start_tsf = le32_to_cpu(notif->tsf_low);
|
||||
IL_DEBUG_SCAN(il, "Scan start: "
|
||||
"%d [802.11%s] "
|
||||
"(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n",
|
||||
notif->channel,
|
||||
@ -213,7 +213,7 @@ static void il_rx_scan_start_notif(struct il_priv *priv,
|
||||
}
|
||||
|
||||
/* Service SCAN_RESULTS_NOTIFICATION (0x83) */
|
||||
static void il_rx_scan_results_notif(struct il_priv *priv,
|
||||
static void il_rx_scan_results_notif(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb)
|
||||
{
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
@ -221,7 +221,7 @@ static void il_rx_scan_results_notif(struct il_priv *priv,
|
||||
struct il_scanresults_notification *notif =
|
||||
(struct il_scanresults_notification *)pkt->u.raw;
|
||||
|
||||
IL_DEBUG_SCAN(priv, "Scan ch.res: "
|
||||
IL_DEBUG_SCAN(il, "Scan ch.res: "
|
||||
"%d [802.11%s] "
|
||||
"(TSF: 0x%08X:%08X) - %d "
|
||||
"elapsed=%lu usec\n",
|
||||
@ -230,12 +230,12 @@ static void il_rx_scan_results_notif(struct il_priv *priv,
|
||||
le32_to_cpu(notif->tsf_high),
|
||||
le32_to_cpu(notif->tsf_low),
|
||||
le32_to_cpu(notif->statistics[0]),
|
||||
le32_to_cpu(notif->tsf_low) - priv->scan_start_tsf);
|
||||
le32_to_cpu(notif->tsf_low) - il->scan_start_tsf);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */
|
||||
static void il_rx_scan_complete_notif(struct il_priv *priv,
|
||||
static void il_rx_scan_complete_notif(struct il_priv *il,
|
||||
struct il_rx_mem_buffer *rxb)
|
||||
{
|
||||
|
||||
@ -244,36 +244,36 @@ static void il_rx_scan_complete_notif(struct il_priv *priv,
|
||||
struct il_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
|
||||
#endif
|
||||
|
||||
IL_DEBUG_SCAN(priv,
|
||||
IL_DEBUG_SCAN(il,
|
||||
"Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n",
|
||||
scan_notif->scanned_channels,
|
||||
scan_notif->tsf_low,
|
||||
scan_notif->tsf_high, scan_notif->status);
|
||||
|
||||
/* The HW is no longer scanning */
|
||||
clear_bit(STATUS_SCAN_HW, &priv->status);
|
||||
clear_bit(STATUS_SCAN_HW, &il->status);
|
||||
|
||||
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));
|
||||
IL_DEBUG_SCAN(il, "Scan on %sGHz took %dms\n",
|
||||
(il->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2",
|
||||
jiffies_to_msecs(jiffies - il->scan_start));
|
||||
|
||||
queue_work(priv->workqueue, &priv->scan_completed);
|
||||
queue_work(il->workqueue, &il->scan_completed);
|
||||
}
|
||||
|
||||
void il_setup_rx_scan_handlers(struct il_priv *priv)
|
||||
void il_setup_rx_scan_handlers(struct il_priv *il)
|
||||
{
|
||||
/* scan handlers */
|
||||
priv->rx_handlers[REPLY_SCAN_CMD] = il_rx_reply_scan;
|
||||
priv->rx_handlers[SCAN_START_NOTIFICATION] =
|
||||
il->rx_handlers[REPLY_SCAN_CMD] = il_rx_reply_scan;
|
||||
il->rx_handlers[SCAN_START_NOTIFICATION] =
|
||||
il_rx_scan_start_notif;
|
||||
priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] =
|
||||
il->rx_handlers[SCAN_RESULTS_NOTIFICATION] =
|
||||
il_rx_scan_results_notif;
|
||||
priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] =
|
||||
il->rx_handlers[SCAN_COMPLETE_NOTIFICATION] =
|
||||
il_rx_scan_complete_notif;
|
||||
}
|
||||
EXPORT_SYMBOL(il_setup_rx_scan_handlers);
|
||||
|
||||
inline u16 il_get_active_dwell_time(struct il_priv *priv,
|
||||
inline u16 il_get_active_dwell_time(struct il_priv *il,
|
||||
enum ieee80211_band band,
|
||||
u8 n_probes)
|
||||
{
|
||||
@ -286,7 +286,7 @@ inline u16 il_get_active_dwell_time(struct il_priv *priv,
|
||||
}
|
||||
EXPORT_SYMBOL(il_get_active_dwell_time);
|
||||
|
||||
u16 il_get_passive_dwell_time(struct il_priv *priv,
|
||||
u16 il_get_passive_dwell_time(struct il_priv *il,
|
||||
enum ieee80211_band band,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
@ -295,13 +295,13 @@ u16 il_get_passive_dwell_time(struct il_priv *priv,
|
||||
IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_24 :
|
||||
IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_52;
|
||||
|
||||
if (il_is_any_associated(priv)) {
|
||||
if (il_is_any_associated(il)) {
|
||||
/*
|
||||
* If we're associated, we clamp the maximum passive
|
||||
* dwell time to be 98% of the smallest beacon interval
|
||||
* (minus 2 * channel tune time)
|
||||
*/
|
||||
for_each_context(priv, ctx) {
|
||||
for_each_context(il, ctx) {
|
||||
u16 value;
|
||||
|
||||
if (!il_is_associated_ctx(ctx))
|
||||
@ -318,56 +318,56 @@ u16 il_get_passive_dwell_time(struct il_priv *priv,
|
||||
}
|
||||
EXPORT_SYMBOL(il_get_passive_dwell_time);
|
||||
|
||||
void il_init_scan_params(struct il_priv *priv)
|
||||
void il_init_scan_params(struct il_priv *il)
|
||||
{
|
||||
u8 ant_idx = fls(priv->hw_params.valid_tx_ant) - 1;
|
||||
if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ])
|
||||
priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx;
|
||||
if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ])
|
||||
priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx;
|
||||
u8 ant_idx = fls(il->hw_params.valid_tx_ant) - 1;
|
||||
if (!il->scan_tx_ant[IEEE80211_BAND_5GHZ])
|
||||
il->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx;
|
||||
if (!il->scan_tx_ant[IEEE80211_BAND_2GHZ])
|
||||
il->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx;
|
||||
}
|
||||
EXPORT_SYMBOL(il_init_scan_params);
|
||||
|
||||
static int il_scan_initiate(struct il_priv *priv,
|
||||
static int il_scan_initiate(struct il_priv *il,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
lockdep_assert_held(&il->mutex);
|
||||
|
||||
if (WARN_ON(!priv->cfg->ops->utils->request_scan))
|
||||
if (WARN_ON(!il->cfg->ops->utils->request_scan))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
cancel_delayed_work(&priv->scan_check);
|
||||
cancel_delayed_work(&il->scan_check);
|
||||
|
||||
if (!il_is_ready_rf(priv)) {
|
||||
IL_WARN(priv, "Request scan called when driver not ready.\n");
|
||||
if (!il_is_ready_rf(il)) {
|
||||
IL_WARN(il, "Request scan called when driver not ready.\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (test_bit(STATUS_SCAN_HW, &priv->status)) {
|
||||
IL_DEBUG_SCAN(priv,
|
||||
if (test_bit(STATUS_SCAN_HW, &il->status)) {
|
||||
IL_DEBUG_SCAN(il,
|
||||
"Multiple concurrent scan requests in parallel.\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
|
||||
IL_DEBUG_SCAN(priv, "Scan request while abort pending.\n");
|
||||
if (test_bit(STATUS_SCAN_ABORTING, &il->status)) {
|
||||
IL_DEBUG_SCAN(il, "Scan request while abort pending.\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
IL_DEBUG_SCAN(priv, "Starting scan...\n");
|
||||
IL_DEBUG_SCAN(il, "Starting scan...\n");
|
||||
|
||||
set_bit(STATUS_SCANNING, &priv->status);
|
||||
priv->scan_start = jiffies;
|
||||
set_bit(STATUS_SCANNING, &il->status);
|
||||
il->scan_start = jiffies;
|
||||
|
||||
ret = priv->cfg->ops->utils->request_scan(priv, vif);
|
||||
ret = il->cfg->ops->utils->request_scan(il, vif);
|
||||
if (ret) {
|
||||
clear_bit(STATUS_SCANNING, &priv->status);
|
||||
clear_bit(STATUS_SCANNING, &il->status);
|
||||
return ret;
|
||||
}
|
||||
|
||||
queue_delayed_work(priv->workqueue, &priv->scan_check,
|
||||
queue_delayed_work(il->workqueue, &il->scan_check,
|
||||
IL_SCAN_CHECK_WATCHDOG);
|
||||
|
||||
return 0;
|
||||
@ -377,33 +377,33 @@ int il_mac_hw_scan(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct cfg80211_scan_request *req)
|
||||
{
|
||||
struct il_priv *priv = hw->priv;
|
||||
struct il_priv *il = hw->priv;
|
||||
int ret;
|
||||
|
||||
IL_DEBUG_MAC80211(priv, "enter\n");
|
||||
IL_DEBUG_MAC80211(il, "enter\n");
|
||||
|
||||
if (req->n_channels == 0)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&priv->mutex);
|
||||
mutex_lock(&il->mutex);
|
||||
|
||||
if (test_bit(STATUS_SCANNING, &priv->status)) {
|
||||
IL_DEBUG_SCAN(priv, "Scan already in progress.\n");
|
||||
if (test_bit(STATUS_SCANNING, &il->status)) {
|
||||
IL_DEBUG_SCAN(il, "Scan already in progress.\n");
|
||||
ret = -EAGAIN;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* mac80211 will only ask for one band at a time */
|
||||
priv->scan_request = req;
|
||||
priv->scan_vif = vif;
|
||||
priv->scan_band = req->channels[0]->band;
|
||||
il->scan_request = req;
|
||||
il->scan_vif = vif;
|
||||
il->scan_band = req->channels[0]->band;
|
||||
|
||||
ret = il_scan_initiate(priv, vif);
|
||||
ret = il_scan_initiate(il, vif);
|
||||
|
||||
IL_DEBUG_MAC80211(priv, "leave\n");
|
||||
IL_DEBUG_MAC80211(il, "leave\n");
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(&priv->mutex);
|
||||
mutex_unlock(&il->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -411,17 +411,17 @@ EXPORT_SYMBOL(il_mac_hw_scan);
|
||||
|
||||
static void il_bg_scan_check(struct work_struct *data)
|
||||
{
|
||||
struct il_priv *priv =
|
||||
struct il_priv *il =
|
||||
container_of(data, struct il_priv, scan_check.work);
|
||||
|
||||
IL_DEBUG_SCAN(priv, "Scan check work\n");
|
||||
IL_DEBUG_SCAN(il, "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);
|
||||
il_force_scan_end(priv);
|
||||
mutex_unlock(&priv->mutex);
|
||||
mutex_lock(&il->mutex);
|
||||
il_force_scan_end(il);
|
||||
mutex_unlock(&il->mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -429,7 +429,7 @@ static void il_bg_scan_check(struct work_struct *data)
|
||||
*/
|
||||
|
||||
u16
|
||||
il_fill_probe_req(struct il_priv *priv, struct ieee80211_mgmt *frame,
|
||||
il_fill_probe_req(struct il_priv *il, struct ieee80211_mgmt *frame,
|
||||
const u8 *ta, const u8 *ies, int ie_len, int left)
|
||||
{
|
||||
int len = 0;
|
||||
@ -475,75 +475,75 @@ EXPORT_SYMBOL(il_fill_probe_req);
|
||||
|
||||
static void il_bg_abort_scan(struct work_struct *work)
|
||||
{
|
||||
struct il_priv *priv = container_of(work, struct il_priv, abort_scan);
|
||||
struct il_priv *il = container_of(work, struct il_priv, abort_scan);
|
||||
|
||||
IL_DEBUG_SCAN(priv, "Abort scan work\n");
|
||||
IL_DEBUG_SCAN(il, "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);
|
||||
il_scan_cancel_timeout(priv, 200);
|
||||
mutex_unlock(&priv->mutex);
|
||||
mutex_lock(&il->mutex);
|
||||
il_scan_cancel_timeout(il, 200);
|
||||
mutex_unlock(&il->mutex);
|
||||
}
|
||||
|
||||
static void il_bg_scan_completed(struct work_struct *work)
|
||||
{
|
||||
struct il_priv *priv =
|
||||
struct il_priv *il =
|
||||
container_of(work, struct il_priv, scan_completed);
|
||||
bool aborted;
|
||||
|
||||
IL_DEBUG_SCAN(priv, "Completed scan.\n");
|
||||
IL_DEBUG_SCAN(il, "Completed scan.\n");
|
||||
|
||||
cancel_delayed_work(&priv->scan_check);
|
||||
cancel_delayed_work(&il->scan_check);
|
||||
|
||||
mutex_lock(&priv->mutex);
|
||||
mutex_lock(&il->mutex);
|
||||
|
||||
aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->status);
|
||||
aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &il->status);
|
||||
if (aborted)
|
||||
IL_DEBUG_SCAN(priv, "Aborted scan completed.\n");
|
||||
IL_DEBUG_SCAN(il, "Aborted scan completed.\n");
|
||||
|
||||
if (!test_and_clear_bit(STATUS_SCANNING, &priv->status)) {
|
||||
IL_DEBUG_SCAN(priv, "Scan already completed.\n");
|
||||
if (!test_and_clear_bit(STATUS_SCANNING, &il->status)) {
|
||||
IL_DEBUG_SCAN(il, "Scan already completed.\n");
|
||||
goto out_settings;
|
||||
}
|
||||
|
||||
il_complete_scan(priv, aborted);
|
||||
il_complete_scan(il, aborted);
|
||||
|
||||
out_settings:
|
||||
/* Can we still talk to firmware ? */
|
||||
if (!il_is_ready_rf(priv))
|
||||
if (!il_is_ready_rf(il))
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* We do not commit power settings while scan is pending,
|
||||
* do it now if the settings changed.
|
||||
*/
|
||||
il_power_set_mode(priv, &priv->power_data.sleep_cmd_next, false);
|
||||
il_set_tx_power(priv, priv->tx_power_next, false);
|
||||
il_power_set_mode(il, &il->power_data.sleep_cmd_next, false);
|
||||
il_set_tx_power(il, il->tx_power_next, false);
|
||||
|
||||
priv->cfg->ops->utils->post_scan(priv);
|
||||
il->cfg->ops->utils->post_scan(il);
|
||||
|
||||
out:
|
||||
mutex_unlock(&priv->mutex);
|
||||
mutex_unlock(&il->mutex);
|
||||
}
|
||||
|
||||
void il_setup_scan_deferred_work(struct il_priv *priv)
|
||||
void il_setup_scan_deferred_work(struct il_priv *il)
|
||||
{
|
||||
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);
|
||||
INIT_WORK(&il->scan_completed, il_bg_scan_completed);
|
||||
INIT_WORK(&il->abort_scan, il_bg_abort_scan);
|
||||
INIT_DELAYED_WORK(&il->scan_check, il_bg_scan_check);
|
||||
}
|
||||
EXPORT_SYMBOL(il_setup_scan_deferred_work);
|
||||
|
||||
void il_cancel_scan_deferred_work(struct il_priv *priv)
|
||||
void il_cancel_scan_deferred_work(struct il_priv *il)
|
||||
{
|
||||
cancel_work_sync(&priv->abort_scan);
|
||||
cancel_work_sync(&priv->scan_completed);
|
||||
cancel_work_sync(&il->abort_scan);
|
||||
cancel_work_sync(&il->scan_completed);
|
||||
|
||||
if (cancel_delayed_work_sync(&priv->scan_check)) {
|
||||
mutex_lock(&priv->mutex);
|
||||
il_force_scan_end(priv);
|
||||
mutex_unlock(&priv->mutex);
|
||||
if (cancel_delayed_work_sync(&il->scan_check)) {
|
||||
mutex_lock(&il->mutex);
|
||||
il_force_scan_end(il);
|
||||
mutex_unlock(&il->mutex);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(il_cancel_scan_deferred_work);
|
||||
|
@ -36,28 +36,28 @@
|
||||
#include "iwl-core.h"
|
||||
#include "iwl-sta.h"
|
||||
|
||||
/* priv->sta_lock must be held */
|
||||
static void il_sta_ucode_activate(struct il_priv *priv, u8 sta_id)
|
||||
/* il->sta_lock must be held */
|
||||
static void il_sta_ucode_activate(struct il_priv *il, u8 sta_id)
|
||||
{
|
||||
|
||||
if (!(priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE))
|
||||
IL_ERR(priv,
|
||||
if (!(il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE))
|
||||
IL_ERR(il,
|
||||
"ACTIVATE a non DRIVER active station id %u addr %pM\n",
|
||||
sta_id, priv->stations[sta_id].sta.sta.addr);
|
||||
sta_id, il->stations[sta_id].sta.sta.addr);
|
||||
|
||||
if (priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE) {
|
||||
IL_DEBUG_ASSOC(priv,
|
||||
if (il->stations[sta_id].used & IL_STA_UCODE_ACTIVE) {
|
||||
IL_DEBUG_ASSOC(il,
|
||||
"STA id %u addr %pM already present"
|
||||
" in uCode (according to driver)\n",
|
||||
sta_id, priv->stations[sta_id].sta.sta.addr);
|
||||
sta_id, il->stations[sta_id].sta.sta.addr);
|
||||
} else {
|
||||
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);
|
||||
il->stations[sta_id].used |= IL_STA_UCODE_ACTIVE;
|
||||
IL_DEBUG_ASSOC(il, "Added STA id %u addr %pM to uCode\n",
|
||||
sta_id, il->stations[sta_id].sta.sta.addr);
|
||||
}
|
||||
}
|
||||
|
||||
static int il_process_add_sta_resp(struct il_priv *priv,
|
||||
static int il_process_add_sta_resp(struct il_priv *il,
|
||||
struct il_addsta_cmd *addsta,
|
||||
struct il_rx_packet *pkt,
|
||||
bool sync)
|
||||
@ -67,45 +67,45 @@ static int il_process_add_sta_resp(struct il_priv *priv,
|
||||
int ret = -EIO;
|
||||
|
||||
if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
|
||||
IL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n",
|
||||
IL_ERR(il, "Bad return from REPLY_ADD_STA (0x%08X)\n",
|
||||
pkt->hdr.flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
IL_DEBUG_INFO(priv, "Processing response for adding station %u\n",
|
||||
IL_DEBUG_INFO(il, "Processing response for adding station %u\n",
|
||||
sta_id);
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
|
||||
switch (pkt->u.add_sta.status) {
|
||||
case ADD_STA_SUCCESS_MSK:
|
||||
IL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n");
|
||||
il_sta_ucode_activate(priv, sta_id);
|
||||
IL_DEBUG_INFO(il, "REPLY_ADD_STA PASSED\n");
|
||||
il_sta_ucode_activate(il, sta_id);
|
||||
ret = 0;
|
||||
break;
|
||||
case ADD_STA_NO_ROOM_IN_TABLE:
|
||||
IL_ERR(priv, "Adding station %d failed, no room in table.\n",
|
||||
IL_ERR(il, "Adding station %d failed, no room in table.\n",
|
||||
sta_id);
|
||||
break;
|
||||
case ADD_STA_NO_BLOCK_ACK_RESOURCE:
|
||||
IL_ERR(priv,
|
||||
IL_ERR(il,
|
||||
"Adding station %d failed, no block ack resource.\n",
|
||||
sta_id);
|
||||
break;
|
||||
case ADD_STA_MODIFY_NON_EXIST_STA:
|
||||
IL_ERR(priv, "Attempting to modify non-existing station %d\n",
|
||||
IL_ERR(il, "Attempting to modify non-existing station %d\n",
|
||||
sta_id);
|
||||
break;
|
||||
default:
|
||||
IL_DEBUG_ASSOC(priv, "Received REPLY_ADD_STA:(0x%08X)\n",
|
||||
IL_DEBUG_ASSOC(il, "Received REPLY_ADD_STA:(0x%08X)\n",
|
||||
pkt->u.add_sta.status);
|
||||
break;
|
||||
}
|
||||
|
||||
IL_DEBUG_INFO(priv, "%s station id %u addr %pM\n",
|
||||
priv->stations[sta_id].sta.mode ==
|
||||
IL_DEBUG_INFO(il, "%s station id %u addr %pM\n",
|
||||
il->stations[sta_id].sta.mode ==
|
||||
STA_CONTROL_MODIFY_MSK ? "Modified" : "Added",
|
||||
sta_id, priv->stations[sta_id].sta.sta.addr);
|
||||
sta_id, il->stations[sta_id].sta.sta.addr);
|
||||
|
||||
/*
|
||||
* XXX: The MAC address in the command buffer is often changed from
|
||||
@ -115,27 +115,27 @@ static int il_process_add_sta_resp(struct il_priv *priv,
|
||||
* issue has not yet been resolved and this debugging is left to
|
||||
* observe the problem.
|
||||
*/
|
||||
IL_DEBUG_INFO(priv, "%s station according to cmd buffer %pM\n",
|
||||
priv->stations[sta_id].sta.mode ==
|
||||
IL_DEBUG_INFO(il, "%s station according to cmd buffer %pM\n",
|
||||
il->stations[sta_id].sta.mode ==
|
||||
STA_CONTROL_MODIFY_MSK ? "Modified" : "Added",
|
||||
addsta->sta.addr);
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void il_add_sta_callback(struct il_priv *priv,
|
||||
static void il_add_sta_callback(struct il_priv *il,
|
||||
struct il_device_cmd *cmd,
|
||||
struct il_rx_packet *pkt)
|
||||
{
|
||||
struct il_addsta_cmd *addsta =
|
||||
(struct il_addsta_cmd *)cmd->cmd.payload;
|
||||
|
||||
il_process_add_sta_resp(priv, addsta, pkt, false);
|
||||
il_process_add_sta_resp(il, addsta, pkt, false);
|
||||
|
||||
}
|
||||
|
||||
int il_send_add_sta(struct il_priv *priv,
|
||||
int il_send_add_sta(struct il_priv *il,
|
||||
struct il_addsta_cmd *sta, u8 flags)
|
||||
{
|
||||
struct il_rx_packet *pkt = NULL;
|
||||
@ -148,7 +148,7 @@ int il_send_add_sta(struct il_priv *priv,
|
||||
};
|
||||
u8 sta_id __maybe_unused = sta->sta.sta_id;
|
||||
|
||||
IL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n",
|
||||
IL_DEBUG_INFO(il, "Adding sta %u (%pM) %ssynchronously\n",
|
||||
sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : "");
|
||||
|
||||
if (flags & CMD_ASYNC)
|
||||
@ -158,23 +158,23 @@ int il_send_add_sta(struct il_priv *priv,
|
||||
might_sleep();
|
||||
}
|
||||
|
||||
cmd.len = priv->cfg->ops->utils->build_addsta_hcmd(sta, data);
|
||||
ret = il_send_cmd(priv, &cmd);
|
||||
cmd.len = il->cfg->ops->utils->build_addsta_hcmd(sta, data);
|
||||
ret = il_send_cmd(il, &cmd);
|
||||
|
||||
if (ret || (flags & CMD_ASYNC))
|
||||
return ret;
|
||||
|
||||
if (ret == 0) {
|
||||
pkt = (struct il_rx_packet *)cmd.reply_page;
|
||||
ret = il_process_add_sta_resp(priv, sta, pkt, true);
|
||||
ret = il_process_add_sta_resp(il, sta, pkt, true);
|
||||
}
|
||||
il_free_pages(priv, cmd.reply_page);
|
||||
il_free_pages(il, cmd.reply_page);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(il_send_add_sta);
|
||||
|
||||
static void il_set_ht_add_station(struct il_priv *priv, u8 index,
|
||||
static void il_set_ht_add_station(struct il_priv *il, u8 index,
|
||||
struct ieee80211_sta *sta,
|
||||
struct il_rxon_context *ctx)
|
||||
{
|
||||
@ -186,13 +186,13 @@ static void il_set_ht_add_station(struct il_priv *priv, u8 index,
|
||||
goto done;
|
||||
|
||||
mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2;
|
||||
IL_DEBUG_ASSOC(priv, "spatial multiplexing power save mode: %s\n",
|
||||
IL_DEBUG_ASSOC(il, "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) ?
|
||||
"dynamic" : "disabled");
|
||||
|
||||
sta_flags = priv->stations[index].sta.station_flags;
|
||||
sta_flags = il->stations[index].sta.station_flags;
|
||||
|
||||
sta_flags &= ~(STA_FLG_RTS_MIMO_PROT_MSK | STA_FLG_MIMO_DIS_MSK);
|
||||
|
||||
@ -206,7 +206,7 @@ static void il_set_ht_add_station(struct il_priv *priv, u8 index,
|
||||
case WLAN_HT_CAP_SM_PS_DISABLED:
|
||||
break;
|
||||
default:
|
||||
IL_WARN(priv, "Invalid MIMO PS mode %d\n", mimo_ps_mode);
|
||||
IL_WARN(il, "Invalid MIMO PS mode %d\n", mimo_ps_mode);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -216,12 +216,12 @@ static void il_set_ht_add_station(struct il_priv *priv, u8 index,
|
||||
sta_flags |= cpu_to_le32(
|
||||
(u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS);
|
||||
|
||||
if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
|
||||
if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap))
|
||||
sta_flags |= STA_FLG_HT40_EN_MSK;
|
||||
else
|
||||
sta_flags &= ~STA_FLG_HT40_EN_MSK;
|
||||
|
||||
priv->stations[index].sta.station_flags = sta_flags;
|
||||
il->stations[index].sta.station_flags = sta_flags;
|
||||
done:
|
||||
return;
|
||||
}
|
||||
@ -231,7 +231,7 @@ static void il_set_ht_add_station(struct il_priv *priv, u8 index,
|
||||
*
|
||||
* should be called with sta_lock held
|
||||
*/
|
||||
u8 il_prep_station(struct il_priv *priv, struct il_rxon_context *ctx,
|
||||
u8 il_prep_station(struct il_priv *il, struct il_rxon_context *ctx,
|
||||
const u8 *addr, bool is_ap, struct ieee80211_sta *sta)
|
||||
{
|
||||
struct il_station_entry *station;
|
||||
@ -244,14 +244,14 @@ u8 il_prep_station(struct il_priv *priv, struct il_rxon_context *ctx,
|
||||
else if (is_broadcast_ether_addr(addr))
|
||||
sta_id = ctx->bcast_sta_id;
|
||||
else
|
||||
for (i = IL_STA_ID; i < priv->hw_params.max_stations; i++) {
|
||||
if (!compare_ether_addr(priv->stations[i].sta.sta.addr,
|
||||
for (i = IL_STA_ID; i < il->hw_params.max_stations; i++) {
|
||||
if (!compare_ether_addr(il->stations[i].sta.sta.addr,
|
||||
addr)) {
|
||||
sta_id = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!priv->stations[i].used &&
|
||||
if (!il->stations[i].used &&
|
||||
sta_id == IL_INVALID_STATION)
|
||||
sta_id = i;
|
||||
}
|
||||
@ -268,27 +268,27 @@ u8 il_prep_station(struct il_priv *priv, struct il_rxon_context *ctx,
|
||||
* station. Keep track if one is in progress so that we do not send
|
||||
* another.
|
||||
*/
|
||||
if (priv->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) {
|
||||
IL_DEBUG_INFO(priv,
|
||||
if (il->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) {
|
||||
IL_DEBUG_INFO(il,
|
||||
"STA %d already in process of being added.\n",
|
||||
sta_id);
|
||||
return sta_id;
|
||||
}
|
||||
|
||||
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)) {
|
||||
IL_DEBUG_ASSOC(priv,
|
||||
if ((il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) &&
|
||||
(il->stations[sta_id].used & IL_STA_UCODE_ACTIVE) &&
|
||||
!compare_ether_addr(il->stations[sta_id].sta.sta.addr, addr)) {
|
||||
IL_DEBUG_ASSOC(il,
|
||||
"STA %d (%pM) already added, not adding again.\n",
|
||||
sta_id, addr);
|
||||
return sta_id;
|
||||
}
|
||||
|
||||
station = &priv->stations[sta_id];
|
||||
station = &il->stations[sta_id];
|
||||
station->used = IL_STA_DRIVER_ACTIVE;
|
||||
IL_DEBUG_ASSOC(priv, "Add STA to driver ID %d: %pM\n",
|
||||
IL_DEBUG_ASSOC(il, "Add STA to driver ID %d: %pM\n",
|
||||
sta_id, addr);
|
||||
priv->num_stations++;
|
||||
il->num_stations++;
|
||||
|
||||
/* Set up the REPLY_ADD_STA command to send to device */
|
||||
memset(&station->sta, 0, sizeof(struct il_addsta_cmd));
|
||||
@ -310,10 +310,10 @@ u8 il_prep_station(struct il_priv *priv, struct il_rxon_context *ctx,
|
||||
* STA and broadcast STA) pass in a NULL sta, and mac80211
|
||||
* doesn't allow HT IBSS.
|
||||
*/
|
||||
il_set_ht_add_station(priv, sta_id, sta, ctx);
|
||||
il_set_ht_add_station(il, sta_id, sta, ctx);
|
||||
|
||||
/* 3945 only */
|
||||
rate = (priv->band == IEEE80211_BAND_5GHZ) ?
|
||||
rate = (il->band == IEEE80211_BAND_5GHZ) ?
|
||||
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);
|
||||
@ -329,7 +329,7 @@ EXPORT_SYMBOL_GPL(il_prep_station);
|
||||
* il_add_station_common -
|
||||
*/
|
||||
int
|
||||
il_add_station_common(struct il_priv *priv,
|
||||
il_add_station_common(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
const u8 *addr, bool is_ap,
|
||||
struct ieee80211_sta *sta, u8 *sta_id_r)
|
||||
@ -340,12 +340,12 @@ il_add_station_common(struct il_priv *priv,
|
||||
struct il_addsta_cmd sta_cmd;
|
||||
|
||||
*sta_id_r = 0;
|
||||
spin_lock_irqsave(&priv->sta_lock, flags_spin);
|
||||
sta_id = il_prep_station(priv, ctx, addr, is_ap, sta);
|
||||
spin_lock_irqsave(&il->sta_lock, flags_spin);
|
||||
sta_id = il_prep_station(il, ctx, addr, is_ap, sta);
|
||||
if (sta_id == IL_INVALID_STATION) {
|
||||
IL_ERR(priv, "Unable to prepare station %pM for addition\n",
|
||||
IL_ERR(il, "Unable to prepare station %pM for addition\n",
|
||||
addr);
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -354,37 +354,37 @@ il_add_station_common(struct il_priv *priv,
|
||||
* station. Keep track if one is in progress so that we do not send
|
||||
* another.
|
||||
*/
|
||||
if (priv->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) {
|
||||
IL_DEBUG_INFO(priv,
|
||||
if (il->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) {
|
||||
IL_DEBUG_INFO(il,
|
||||
"STA %d already in process of being added.\n",
|
||||
sta_id);
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
if ((priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) &&
|
||||
(priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) {
|
||||
IL_DEBUG_ASSOC(priv,
|
||||
if ((il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) &&
|
||||
(il->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) {
|
||||
IL_DEBUG_ASSOC(il,
|
||||
"STA %d (%pM) already added, not adding again.\n",
|
||||
sta_id, addr);
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
priv->stations[sta_id].used |= IL_STA_UCODE_INPROGRESS;
|
||||
memcpy(&sta_cmd, &priv->stations[sta_id].sta,
|
||||
il->stations[sta_id].used |= IL_STA_UCODE_INPROGRESS;
|
||||
memcpy(&sta_cmd, &il->stations[sta_id].sta,
|
||||
sizeof(struct il_addsta_cmd));
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
|
||||
|
||||
/* Add station to device's station table */
|
||||
ret = il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
|
||||
ret = il_send_add_sta(il, &sta_cmd, CMD_SYNC);
|
||||
if (ret) {
|
||||
spin_lock_irqsave(&priv->sta_lock, flags_spin);
|
||||
IL_ERR(priv, "Adding station %pM failed.\n",
|
||||
priv->stations[sta_id].sta.sta.addr);
|
||||
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);
|
||||
spin_lock_irqsave(&il->sta_lock, flags_spin);
|
||||
IL_ERR(il, "Adding station %pM failed.\n",
|
||||
il->stations[sta_id].sta.sta.addr);
|
||||
il->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE;
|
||||
il->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS;
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
|
||||
}
|
||||
*sta_id_r = sta_id;
|
||||
return ret;
|
||||
@ -394,23 +394,23 @@ EXPORT_SYMBOL(il_add_station_common);
|
||||
/**
|
||||
* il_sta_ucode_deactivate - deactivate ucode status for a station
|
||||
*
|
||||
* priv->sta_lock must be held
|
||||
* il->sta_lock must be held
|
||||
*/
|
||||
static void il_sta_ucode_deactivate(struct il_priv *priv, u8 sta_id)
|
||||
static void il_sta_ucode_deactivate(struct il_priv *il, u8 sta_id)
|
||||
{
|
||||
/* Ucode must be active and driver must be non active */
|
||||
if ((priv->stations[sta_id].used &
|
||||
if ((il->stations[sta_id].used &
|
||||
(IL_STA_UCODE_ACTIVE | IL_STA_DRIVER_ACTIVE)) !=
|
||||
IL_STA_UCODE_ACTIVE)
|
||||
IL_ERR(priv, "removed non active STA %u\n", sta_id);
|
||||
IL_ERR(il, "removed non active STA %u\n", sta_id);
|
||||
|
||||
priv->stations[sta_id].used &= ~IL_STA_UCODE_ACTIVE;
|
||||
il->stations[sta_id].used &= ~IL_STA_UCODE_ACTIVE;
|
||||
|
||||
memset(&priv->stations[sta_id], 0, sizeof(struct il_station_entry));
|
||||
IL_DEBUG_ASSOC(priv, "Removed STA %u\n", sta_id);
|
||||
memset(&il->stations[sta_id], 0, sizeof(struct il_station_entry));
|
||||
IL_DEBUG_ASSOC(il, "Removed STA %u\n", sta_id);
|
||||
}
|
||||
|
||||
static int il_send_remove_station(struct il_priv *priv,
|
||||
static int il_send_remove_station(struct il_priv *il,
|
||||
const u8 *addr, int sta_id,
|
||||
bool temporary)
|
||||
{
|
||||
@ -433,14 +433,14 @@ static int il_send_remove_station(struct il_priv *priv,
|
||||
|
||||
cmd.flags |= CMD_WANT_SKB;
|
||||
|
||||
ret = il_send_cmd(priv, &cmd);
|
||||
ret = il_send_cmd(il, &cmd);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
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",
|
||||
IL_ERR(il, "Bad return from REPLY_REMOVE_STA (0x%08X)\n",
|
||||
pkt->hdr.flags);
|
||||
ret = -EIO;
|
||||
}
|
||||
@ -449,20 +449,20 @@ static int il_send_remove_station(struct il_priv *priv,
|
||||
switch (pkt->u.rem_sta.status) {
|
||||
case REM_STA_SUCCESS_MSK:
|
||||
if (!temporary) {
|
||||
spin_lock_irqsave(&priv->sta_lock, flags_spin);
|
||||
il_sta_ucode_deactivate(priv, sta_id);
|
||||
spin_unlock_irqrestore(&priv->sta_lock,
|
||||
spin_lock_irqsave(&il->sta_lock, flags_spin);
|
||||
il_sta_ucode_deactivate(il, sta_id);
|
||||
spin_unlock_irqrestore(&il->sta_lock,
|
||||
flags_spin);
|
||||
}
|
||||
IL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n");
|
||||
IL_DEBUG_ASSOC(il, "REPLY_REMOVE_STA PASSED\n");
|
||||
break;
|
||||
default:
|
||||
ret = -EIO;
|
||||
IL_ERR(priv, "REPLY_REMOVE_STA failed\n");
|
||||
IL_ERR(il, "REPLY_REMOVE_STA failed\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
il_free_pages(priv, cmd.reply_page);
|
||||
il_free_pages(il, cmd.reply_page);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -470,13 +470,13 @@ static int il_send_remove_station(struct il_priv *priv,
|
||||
/**
|
||||
* il_remove_station - Remove driver's knowledge of station.
|
||||
*/
|
||||
int il_remove_station(struct il_priv *priv, const u8 sta_id,
|
||||
int il_remove_station(struct il_priv *il, const u8 sta_id,
|
||||
const u8 *addr)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
if (!il_is_ready(priv)) {
|
||||
IL_DEBUG_INFO(priv,
|
||||
if (!il_is_ready(il)) {
|
||||
IL_DEBUG_INFO(il,
|
||||
"Unable to remove station %pM, device not ready.\n",
|
||||
addr);
|
||||
/*
|
||||
@ -487,42 +487,42 @@ int il_remove_station(struct il_priv *priv, const u8 sta_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
IL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n",
|
||||
IL_DEBUG_ASSOC(il, "Removing STA from driver:%d %pM\n",
|
||||
sta_id, addr);
|
||||
|
||||
if (WARN_ON(sta_id == IL_INVALID_STATION))
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
|
||||
if (!(priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) {
|
||||
IL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n",
|
||||
if (!(il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) {
|
||||
IL_DEBUG_INFO(il, "Removing %pM but non DRIVER active\n",
|
||||
addr);
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
if (!(priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) {
|
||||
IL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n",
|
||||
if (!(il->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) {
|
||||
IL_DEBUG_INFO(il, "Removing %pM but non UCODE active\n",
|
||||
addr);
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
if (priv->stations[sta_id].used & IL_STA_LOCAL) {
|
||||
kfree(priv->stations[sta_id].lq);
|
||||
priv->stations[sta_id].lq = NULL;
|
||||
if (il->stations[sta_id].used & IL_STA_LOCAL) {
|
||||
kfree(il->stations[sta_id].lq);
|
||||
il->stations[sta_id].lq = NULL;
|
||||
}
|
||||
|
||||
priv->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE;
|
||||
il->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE;
|
||||
|
||||
priv->num_stations--;
|
||||
il->num_stations--;
|
||||
|
||||
BUG_ON(priv->num_stations < 0);
|
||||
BUG_ON(il->num_stations < 0);
|
||||
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
|
||||
return il_send_remove_station(priv, addr, sta_id, false);
|
||||
return il_send_remove_station(il, addr, sta_id, false);
|
||||
out_err:
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
return -EINVAL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(il_remove_station);
|
||||
@ -535,31 +535,31 @@ EXPORT_SYMBOL_GPL(il_remove_station);
|
||||
* other than explicit station management would cause this in
|
||||
* the ucode, e.g. unassociated RXON.
|
||||
*/
|
||||
void il_clear_ucode_stations(struct il_priv *priv,
|
||||
void il_clear_ucode_stations(struct il_priv *il,
|
||||
struct il_rxon_context *ctx)
|
||||
{
|
||||
int i;
|
||||
unsigned long flags_spin;
|
||||
bool cleared = false;
|
||||
|
||||
IL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n");
|
||||
IL_DEBUG_INFO(il, "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)
|
||||
spin_lock_irqsave(&il->sta_lock, flags_spin);
|
||||
for (i = 0; i < il->hw_params.max_stations; i++) {
|
||||
if (ctx && ctx->ctxid != il->stations[i].ctxid)
|
||||
continue;
|
||||
|
||||
if (priv->stations[i].used & IL_STA_UCODE_ACTIVE) {
|
||||
IL_DEBUG_INFO(priv,
|
||||
if (il->stations[i].used & IL_STA_UCODE_ACTIVE) {
|
||||
IL_DEBUG_INFO(il,
|
||||
"Clearing ucode active for station %d\n", i);
|
||||
priv->stations[i].used &= ~IL_STA_UCODE_ACTIVE;
|
||||
il->stations[i].used &= ~IL_STA_UCODE_ACTIVE;
|
||||
cleared = true;
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
|
||||
|
||||
if (!cleared)
|
||||
IL_DEBUG_INFO(priv,
|
||||
IL_DEBUG_INFO(il,
|
||||
"No active stations found to be cleared\n");
|
||||
}
|
||||
EXPORT_SYMBOL(il_clear_ucode_stations);
|
||||
@ -573,7 +573,7 @@ EXPORT_SYMBOL(il_clear_ucode_stations);
|
||||
* Function sleeps.
|
||||
*/
|
||||
void
|
||||
il_restore_stations(struct il_priv *priv, struct il_rxon_context *ctx)
|
||||
il_restore_stations(struct il_priv *il, struct il_rxon_context *ctx)
|
||||
{
|
||||
struct il_addsta_cmd sta_cmd;
|
||||
struct il_link_quality_cmd lq;
|
||||
@ -583,48 +583,48 @@ il_restore_stations(struct il_priv *priv, struct il_rxon_context *ctx)
|
||||
int ret;
|
||||
bool send_lq;
|
||||
|
||||
if (!il_is_ready(priv)) {
|
||||
IL_DEBUG_INFO(priv,
|
||||
if (!il_is_ready(il)) {
|
||||
IL_DEBUG_INFO(il,
|
||||
"Not ready yet, not restoring any stations.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
IL_DEBUG_ASSOC(il, "Restoring all known stations ... start.\n");
|
||||
spin_lock_irqsave(&il->sta_lock, flags_spin);
|
||||
for (i = 0; i < il->hw_params.max_stations; i++) {
|
||||
if (ctx->ctxid != il->stations[i].ctxid)
|
||||
continue;
|
||||
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 |= IL_STA_UCODE_INPROGRESS;
|
||||
if ((il->stations[i].used & IL_STA_DRIVER_ACTIVE) &&
|
||||
!(il->stations[i].used & IL_STA_UCODE_ACTIVE)) {
|
||||
IL_DEBUG_ASSOC(il, "Restoring sta %pM\n",
|
||||
il->stations[i].sta.sta.addr);
|
||||
il->stations[i].sta.mode = 0;
|
||||
il->stations[i].used |= IL_STA_UCODE_INPROGRESS;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < priv->hw_params.max_stations; i++) {
|
||||
if ((priv->stations[i].used & IL_STA_UCODE_INPROGRESS)) {
|
||||
memcpy(&sta_cmd, &priv->stations[i].sta,
|
||||
for (i = 0; i < il->hw_params.max_stations; i++) {
|
||||
if ((il->stations[i].used & IL_STA_UCODE_INPROGRESS)) {
|
||||
memcpy(&sta_cmd, &il->stations[i].sta,
|
||||
sizeof(struct il_addsta_cmd));
|
||||
send_lq = false;
|
||||
if (priv->stations[i].lq) {
|
||||
memcpy(&lq, priv->stations[i].lq,
|
||||
if (il->stations[i].lq) {
|
||||
memcpy(&lq, il->stations[i].lq,
|
||||
sizeof(struct il_link_quality_cmd));
|
||||
send_lq = true;
|
||||
}
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
|
||||
ret = il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
|
||||
ret = il_send_add_sta(il, &sta_cmd, CMD_SYNC);
|
||||
if (ret) {
|
||||
spin_lock_irqsave(&priv->sta_lock, flags_spin);
|
||||
IL_ERR(priv, "Adding station %pM failed.\n",
|
||||
priv->stations[i].sta.sta.addr);
|
||||
priv->stations[i].used &=
|
||||
spin_lock_irqsave(&il->sta_lock, flags_spin);
|
||||
IL_ERR(il, "Adding station %pM failed.\n",
|
||||
il->stations[i].sta.sta.addr);
|
||||
il->stations[i].used &=
|
||||
~IL_STA_DRIVER_ACTIVE;
|
||||
priv->stations[i].used &=
|
||||
il->stations[i].used &=
|
||||
~IL_STA_UCODE_INPROGRESS;
|
||||
spin_unlock_irqrestore(&priv->sta_lock,
|
||||
spin_unlock_irqrestore(&il->sta_lock,
|
||||
flags_spin);
|
||||
}
|
||||
/*
|
||||
@ -632,71 +632,71 @@ il_restore_stations(struct il_priv *priv, struct il_rxon_context *ctx)
|
||||
* current LQ command
|
||||
*/
|
||||
if (send_lq)
|
||||
il_send_lq_cmd(priv, ctx, &lq,
|
||||
il_send_lq_cmd(il, ctx, &lq,
|
||||
CMD_SYNC, true);
|
||||
spin_lock_irqsave(&priv->sta_lock, flags_spin);
|
||||
priv->stations[i].used &= ~IL_STA_UCODE_INPROGRESS;
|
||||
spin_lock_irqsave(&il->sta_lock, flags_spin);
|
||||
il->stations[i].used &= ~IL_STA_UCODE_INPROGRESS;
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
|
||||
if (!found)
|
||||
IL_DEBUG_INFO(priv, "Restoring all known stations"
|
||||
IL_DEBUG_INFO(il, "Restoring all known stations"
|
||||
" .... no stations to be restored.\n");
|
||||
else
|
||||
IL_DEBUG_INFO(priv, "Restoring all known stations"
|
||||
IL_DEBUG_INFO(il, "Restoring all known stations"
|
||||
" .... complete.\n");
|
||||
}
|
||||
EXPORT_SYMBOL(il_restore_stations);
|
||||
|
||||
int il_get_free_ucode_key_index(struct il_priv *priv)
|
||||
int il_get_free_ucode_key_index(struct il_priv *il)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < priv->sta_key_max_num; i++)
|
||||
if (!test_and_set_bit(i, &priv->ucode_key_table))
|
||||
for (i = 0; i < il->sta_key_max_num; i++)
|
||||
if (!test_and_set_bit(i, &il->ucode_key_table))
|
||||
return i;
|
||||
|
||||
return WEP_INVALID_OFFSET;
|
||||
}
|
||||
EXPORT_SYMBOL(il_get_free_ucode_key_index);
|
||||
|
||||
void il_dealloc_bcast_stations(struct il_priv *priv)
|
||||
void il_dealloc_bcast_stations(struct il_priv *il)
|
||||
{
|
||||
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 & IL_STA_BCAST))
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
for (i = 0; i < il->hw_params.max_stations; i++) {
|
||||
if (!(il->stations[i].used & IL_STA_BCAST))
|
||||
continue;
|
||||
|
||||
priv->stations[i].used &= ~IL_STA_UCODE_ACTIVE;
|
||||
priv->num_stations--;
|
||||
BUG_ON(priv->num_stations < 0);
|
||||
kfree(priv->stations[i].lq);
|
||||
priv->stations[i].lq = NULL;
|
||||
il->stations[i].used &= ~IL_STA_UCODE_ACTIVE;
|
||||
il->num_stations--;
|
||||
BUG_ON(il->num_stations < 0);
|
||||
kfree(il->stations[i].lq);
|
||||
il->stations[i].lq = NULL;
|
||||
}
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(il_dealloc_bcast_stations);
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
|
||||
static void il_dump_lq_cmd(struct il_priv *priv,
|
||||
static void il_dump_lq_cmd(struct il_priv *il,
|
||||
struct il_link_quality_cmd *lq)
|
||||
{
|
||||
int i;
|
||||
IL_DEBUG_RATE(priv, "lq station id 0x%x\n", lq->sta_id);
|
||||
IL_DEBUG_RATE(priv, "lq ant 0x%X 0x%X\n",
|
||||
IL_DEBUG_RATE(il, "lq station id 0x%x\n", lq->sta_id);
|
||||
IL_DEBUG_RATE(il, "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++)
|
||||
IL_DEBUG_RATE(priv, "lq index %d 0x%X\n",
|
||||
IL_DEBUG_RATE(il, "lq index %d 0x%X\n",
|
||||
i, lq->rs_table[i].rate_n_flags);
|
||||
}
|
||||
#else
|
||||
static inline void il_dump_lq_cmd(struct il_priv *priv,
|
||||
static inline void il_dump_lq_cmd(struct il_priv *il,
|
||||
struct il_link_quality_cmd *lq)
|
||||
{
|
||||
}
|
||||
@ -713,7 +713,7 @@ static inline void il_dump_lq_cmd(struct il_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 il_is_lq_table_valid(struct il_priv *priv,
|
||||
static bool il_is_lq_table_valid(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct il_link_quality_cmd *lq)
|
||||
{
|
||||
@ -722,12 +722,12 @@ static bool il_is_lq_table_valid(struct il_priv *priv,
|
||||
if (ctx->ht.enabled)
|
||||
return true;
|
||||
|
||||
IL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n",
|
||||
IL_DEBUG_INFO(il, "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) {
|
||||
IL_DEBUG_INFO(priv,
|
||||
IL_DEBUG_INFO(il,
|
||||
"index %d of LQ expects HT channel\n",
|
||||
i);
|
||||
return false;
|
||||
@ -746,7 +746,7 @@ static bool il_is_lq_table_valid(struct il_priv *priv,
|
||||
* this case to clear the state indicating that station creation is in
|
||||
* progress.
|
||||
*/
|
||||
int il_send_lq_cmd(struct il_priv *priv, struct il_rxon_context *ctx,
|
||||
int il_send_lq_cmd(struct il_priv *il, struct il_rxon_context *ctx,
|
||||
struct il_link_quality_cmd *lq, u8 flags, bool init)
|
||||
{
|
||||
int ret = 0;
|
||||
@ -763,18 +763,18 @@ int il_send_lq_cmd(struct il_priv *priv, struct il_rxon_context *ctx,
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags_spin);
|
||||
if (!(priv->stations[lq->sta_id].used & IL_STA_DRIVER_ACTIVE)) {
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
|
||||
spin_lock_irqsave(&il->sta_lock, flags_spin);
|
||||
if (!(il->stations[lq->sta_id].used & IL_STA_DRIVER_ACTIVE)) {
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
|
||||
return -EINVAL;
|
||||
}
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
|
||||
|
||||
il_dump_lq_cmd(priv, lq);
|
||||
il_dump_lq_cmd(il, lq);
|
||||
BUG_ON(init && (cmd.flags & CMD_ASYNC));
|
||||
|
||||
if (il_is_lq_table_valid(priv, ctx, lq))
|
||||
ret = il_send_cmd(priv, &cmd);
|
||||
if (il_is_lq_table_valid(il, ctx, lq))
|
||||
ret = il_send_cmd(il, &cmd);
|
||||
else
|
||||
ret = -EINVAL;
|
||||
|
||||
@ -782,12 +782,12 @@ int il_send_lq_cmd(struct il_priv *priv, struct il_rxon_context *ctx,
|
||||
return ret;
|
||||
|
||||
if (init) {
|
||||
IL_DEBUG_INFO(priv, "init LQ command complete,"
|
||||
IL_DEBUG_INFO(il, "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 &= ~IL_STA_UCODE_INPROGRESS;
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
|
||||
spin_lock_irqsave(&il->sta_lock, flags_spin);
|
||||
il->stations[lq->sta_id].used &= ~IL_STA_UCODE_INPROGRESS;
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags_spin);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -797,20 +797,20 @@ int il_mac_sta_remove(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_sta *sta)
|
||||
{
|
||||
struct il_priv *priv = hw->priv;
|
||||
struct il_priv *il = hw->priv;
|
||||
struct il_station_priv_common *sta_common = (void *)sta->drv_priv;
|
||||
int ret;
|
||||
|
||||
IL_DEBUG_INFO(priv, "received request to remove station %pM\n",
|
||||
IL_DEBUG_INFO(il, "received request to remove station %pM\n",
|
||||
sta->addr);
|
||||
mutex_lock(&priv->mutex);
|
||||
IL_DEBUG_INFO(priv, "proceeding to remove station %pM\n",
|
||||
mutex_lock(&il->mutex);
|
||||
IL_DEBUG_INFO(il, "proceeding to remove station %pM\n",
|
||||
sta->addr);
|
||||
ret = il_remove_station(priv, sta_common->sta_id, sta->addr);
|
||||
ret = il_remove_station(il, sta_common->sta_id, sta->addr);
|
||||
if (ret)
|
||||
IL_ERR(priv, "Error removing station %pM\n",
|
||||
IL_ERR(il, "Error removing station %pM\n",
|
||||
sta->addr);
|
||||
mutex_unlock(&priv->mutex);
|
||||
mutex_unlock(&il->mutex);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(il_mac_sta_remove);
|
||||
|
@ -43,56 +43,56 @@
|
||||
#define IL_STA_BCAST BIT(4) /* this station is the special bcast station */
|
||||
|
||||
|
||||
void il_restore_stations(struct il_priv *priv,
|
||||
void il_restore_stations(struct il_priv *il,
|
||||
struct il_rxon_context *ctx);
|
||||
void il_clear_ucode_stations(struct il_priv *priv,
|
||||
void il_clear_ucode_stations(struct il_priv *il,
|
||||
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,
|
||||
void il_dealloc_bcast_stations(struct il_priv *il);
|
||||
int il_get_free_ucode_key_index(struct il_priv *il);
|
||||
int il_send_add_sta(struct il_priv *il,
|
||||
struct il_addsta_cmd *sta, u8 flags);
|
||||
int il_add_station_common(struct il_priv *priv,
|
||||
int il_add_station_common(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
const u8 *addr, bool is_ap,
|
||||
struct ieee80211_sta *sta, u8 *sta_id_r);
|
||||
int il_remove_station(struct il_priv *priv,
|
||||
int il_remove_station(struct il_priv *il,
|
||||
const u8 sta_id,
|
||||
const u8 *addr);
|
||||
int il_mac_sta_remove(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_sta *sta);
|
||||
|
||||
u8 il_prep_station(struct il_priv *priv,
|
||||
u8 il_prep_station(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
const u8 *addr, bool is_ap,
|
||||
struct ieee80211_sta *sta);
|
||||
|
||||
int il_send_lq_cmd(struct il_priv *priv,
|
||||
int il_send_lq_cmd(struct il_priv *il,
|
||||
struct il_rxon_context *ctx,
|
||||
struct il_link_quality_cmd *lq,
|
||||
u8 flags, bool init);
|
||||
|
||||
/**
|
||||
* il_clear_driver_stations - clear knowledge of all stations from driver
|
||||
* @priv: iwl priv struct
|
||||
* @il: iwl il struct
|
||||
*
|
||||
* 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 il_clear_driver_stations(struct il_priv *priv)
|
||||
static inline void il_clear_driver_stations(struct il_priv *il)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct il_rxon_context *ctx;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
memset(priv->stations, 0, sizeof(priv->stations));
|
||||
priv->num_stations = 0;
|
||||
spin_lock_irqsave(&il->sta_lock, flags);
|
||||
memset(il->stations, 0, sizeof(il->stations));
|
||||
il->num_stations = 0;
|
||||
|
||||
priv->ucode_key_table = 0;
|
||||
il->ucode_key_table = 0;
|
||||
|
||||
for_each_context(priv, ctx) {
|
||||
for_each_context(il, ctx) {
|
||||
/*
|
||||
* Remove all key information that is not stored as part
|
||||
* of station information since mac80211 may not have had
|
||||
@ -104,7 +104,7 @@ static inline void il_clear_driver_stations(struct il_priv *priv)
|
||||
ctx->key_mapping_keys = 0;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
spin_unlock_irqrestore(&il->sta_lock, flags);
|
||||
}
|
||||
|
||||
static inline int il_sta_id(struct ieee80211_sta *sta)
|
||||
@ -117,7 +117,7 @@ static inline int il_sta_id(struct ieee80211_sta *sta)
|
||||
|
||||
/**
|
||||
* il_sta_id_or_broadcast - return sta_id or broadcast sta
|
||||
* @priv: iwl priv
|
||||
* @il: iwl il
|
||||
* @context: the current context
|
||||
* @sta: mac80211 station
|
||||
*
|
||||
@ -126,7 +126,7 @@ static inline int il_sta_id(struct ieee80211_sta *sta)
|
||||
* that case, we need to use the broadcast station, so this
|
||||
* inline wraps that pattern.
|
||||
*/
|
||||
static inline int il_sta_id_or_broadcast(struct il_priv *priv,
|
||||
static inline int il_sta_id_or_broadcast(struct il_priv *il,
|
||||
struct il_rxon_context *context,
|
||||
struct ieee80211_sta *sta)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@
|
||||
* il_txq_update_write_ptr - Send new write index to hardware
|
||||
*/
|
||||
void
|
||||
il_txq_update_write_ptr(struct il_priv *priv, struct il_tx_queue *txq)
|
||||
il_txq_update_write_ptr(struct il_priv *il, struct il_tx_queue *txq)
|
||||
{
|
||||
u32 reg = 0;
|
||||
int txq_id = txq->q.id;
|
||||
@ -51,22 +51,22 @@ il_txq_update_write_ptr(struct il_priv *priv, struct il_tx_queue *txq)
|
||||
return;
|
||||
|
||||
/* if we're trying to save power */
|
||||
if (test_bit(STATUS_POWER_PMI, &priv->status)) {
|
||||
if (test_bit(STATUS_POWER_PMI, &il->status)) {
|
||||
/* 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 = il_read32(priv, CSR_UCODE_DRV_GP1);
|
||||
reg = il_read32(il, CSR_UCODE_DRV_GP1);
|
||||
|
||||
if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
|
||||
IL_DEBUG_INFO(priv,
|
||||
IL_DEBUG_INFO(il,
|
||||
"Tx queue %d requesting wakeup,"
|
||||
" GP1 = 0x%x\n", txq_id, reg);
|
||||
il_set_bit(priv, CSR_GP_CNTRL,
|
||||
il_set_bit(il, CSR_GP_CNTRL,
|
||||
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
|
||||
return;
|
||||
}
|
||||
|
||||
il_write_direct32(priv, HBUS_TARG_WRPTR,
|
||||
il_write_direct32(il, HBUS_TARG_WRPTR,
|
||||
txq->q.write_ptr | (txq_id << 8));
|
||||
|
||||
/*
|
||||
@ -75,7 +75,7 @@ il_txq_update_write_ptr(struct il_priv *priv, struct il_tx_queue *txq)
|
||||
* trying to tx (during RFKILL, we're not trying to tx).
|
||||
*/
|
||||
} else
|
||||
il_write32(priv, HBUS_TARG_WRPTR,
|
||||
il_write32(il, HBUS_TARG_WRPTR,
|
||||
txq->q.write_ptr | (txq_id << 8));
|
||||
txq->need_update = 0;
|
||||
}
|
||||
@ -84,16 +84,16 @@ EXPORT_SYMBOL(il_txq_update_write_ptr);
|
||||
/**
|
||||
* il_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's
|
||||
*/
|
||||
void il_tx_queue_unmap(struct il_priv *priv, int txq_id)
|
||||
void il_tx_queue_unmap(struct il_priv *il, int txq_id)
|
||||
{
|
||||
struct il_tx_queue *txq = &priv->txq[txq_id];
|
||||
struct il_tx_queue *txq = &il->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);
|
||||
il->cfg->ops->lib->txq_free_tfd(il, txq);
|
||||
q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd);
|
||||
}
|
||||
}
|
||||
@ -107,13 +107,13 @@ EXPORT_SYMBOL(il_tx_queue_unmap);
|
||||
* Free all buffers.
|
||||
* 0-fill, but do not free "txq" descriptor structure.
|
||||
*/
|
||||
void il_tx_queue_free(struct il_priv *priv, int txq_id)
|
||||
void il_tx_queue_free(struct il_priv *il, int txq_id)
|
||||
{
|
||||
struct il_tx_queue *txq = &priv->txq[txq_id];
|
||||
struct device *dev = &priv->pci_dev->dev;
|
||||
struct il_tx_queue *txq = &il->txq[txq_id];
|
||||
struct device *dev = &il->pci_dev->dev;
|
||||
int i;
|
||||
|
||||
il_tx_queue_unmap(priv, txq_id);
|
||||
il_tx_queue_unmap(il, txq_id);
|
||||
|
||||
/* De-alloc array of command/tx buffers */
|
||||
for (i = 0; i < TFD_TX_CMD_SLOTS; i++)
|
||||
@ -121,7 +121,7 @@ void il_tx_queue_free(struct il_priv *priv, int txq_id)
|
||||
|
||||
/* De-alloc circular buffer of TFDs */
|
||||
if (txq->q.n_bd)
|
||||
dma_free_coherent(dev, priv->hw_params.tfd_size *
|
||||
dma_free_coherent(dev, il->hw_params.tfd_size *
|
||||
txq->q.n_bd, txq->tfds, txq->q.dma_addr);
|
||||
|
||||
/* De-alloc array of per-TFD driver data */
|
||||
@ -142,9 +142,9 @@ EXPORT_SYMBOL(il_tx_queue_free);
|
||||
/**
|
||||
* il_cmd_queue_unmap - Unmap any remaining DMA mappings from command queue
|
||||
*/
|
||||
void il_cmd_queue_unmap(struct il_priv *priv)
|
||||
void il_cmd_queue_unmap(struct il_priv *il)
|
||||
{
|
||||
struct il_tx_queue *txq = &priv->txq[priv->cmd_queue];
|
||||
struct il_tx_queue *txq = &il->txq[il->cmd_queue];
|
||||
struct il_queue *q = &txq->q;
|
||||
int i;
|
||||
|
||||
@ -155,7 +155,7 @@ void il_cmd_queue_unmap(struct il_priv *priv)
|
||||
i = il_get_cmd_index(q, q->read_ptr, 0);
|
||||
|
||||
if (txq->meta[i].flags & CMD_MAPPED) {
|
||||
pci_unmap_single(priv->pci_dev,
|
||||
pci_unmap_single(il->pci_dev,
|
||||
dma_unmap_addr(&txq->meta[i], mapping),
|
||||
dma_unmap_len(&txq->meta[i], len),
|
||||
PCI_DMA_BIDIRECTIONAL);
|
||||
@ -167,7 +167,7 @@ void il_cmd_queue_unmap(struct il_priv *priv)
|
||||
|
||||
i = q->n_window;
|
||||
if (txq->meta[i].flags & CMD_MAPPED) {
|
||||
pci_unmap_single(priv->pci_dev,
|
||||
pci_unmap_single(il->pci_dev,
|
||||
dma_unmap_addr(&txq->meta[i], mapping),
|
||||
dma_unmap_len(&txq->meta[i], len),
|
||||
PCI_DMA_BIDIRECTIONAL);
|
||||
@ -184,13 +184,13 @@ EXPORT_SYMBOL(il_cmd_queue_unmap);
|
||||
* Free all buffers.
|
||||
* 0-fill, but do not free "txq" descriptor structure.
|
||||
*/
|
||||
void il_cmd_queue_free(struct il_priv *priv)
|
||||
void il_cmd_queue_free(struct il_priv *il)
|
||||
{
|
||||
struct il_tx_queue *txq = &priv->txq[priv->cmd_queue];
|
||||
struct device *dev = &priv->pci_dev->dev;
|
||||
struct il_tx_queue *txq = &il->txq[il->cmd_queue];
|
||||
struct device *dev = &il->pci_dev->dev;
|
||||
int i;
|
||||
|
||||
il_cmd_queue_unmap(priv);
|
||||
il_cmd_queue_unmap(il);
|
||||
|
||||
/* De-alloc array of command/tx buffers */
|
||||
for (i = 0; i <= TFD_CMD_SLOTS; i++)
|
||||
@ -198,7 +198,7 @@ void il_cmd_queue_free(struct il_priv *priv)
|
||||
|
||||
/* De-alloc circular buffer of TFDs */
|
||||
if (txq->q.n_bd)
|
||||
dma_free_coherent(dev, priv->hw_params.tfd_size * txq->q.n_bd,
|
||||
dma_free_coherent(dev, il->hw_params.tfd_size * txq->q.n_bd,
|
||||
txq->tfds, txq->q.dma_addr);
|
||||
|
||||
/* deallocate arrays */
|
||||
@ -256,7 +256,7 @@ EXPORT_SYMBOL(il_queue_space);
|
||||
/**
|
||||
* il_queue_init - Initialize queue's high/low-water and read/write indexes
|
||||
*/
|
||||
static int il_queue_init(struct il_priv *priv, struct il_queue *q,
|
||||
static int il_queue_init(struct il_priv *il, struct il_queue *q,
|
||||
int count, int slots_num, u32 id)
|
||||
{
|
||||
q->n_bd = count;
|
||||
@ -287,19 +287,19 @@ static int il_queue_init(struct il_priv *priv, struct il_queue *q,
|
||||
/**
|
||||
* il_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue
|
||||
*/
|
||||
static int il_tx_queue_alloc(struct il_priv *priv,
|
||||
static int il_tx_queue_alloc(struct il_priv *il,
|
||||
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;
|
||||
struct device *dev = &il->pci_dev->dev;
|
||||
size_t tfd_sz = il->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX;
|
||||
|
||||
/* Driver private data, only for Tx (not command) queues,
|
||||
/* Driver ilate data, only for Tx (not command) queues,
|
||||
* not shared with device. */
|
||||
if (id != priv->cmd_queue) {
|
||||
if (id != il->cmd_queue) {
|
||||
txq->txb = kzalloc(sizeof(txq->txb[0]) *
|
||||
TFD_QUEUE_SIZE_MAX, GFP_KERNEL);
|
||||
if (!txq->txb) {
|
||||
IL_ERR(priv, "kmalloc for auxiliary BD "
|
||||
IL_ERR(il, "kmalloc for auxiliary BD "
|
||||
"structures failed\n");
|
||||
goto error;
|
||||
}
|
||||
@ -312,7 +312,7 @@ static int il_tx_queue_alloc(struct il_priv *priv,
|
||||
txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr,
|
||||
GFP_KERNEL);
|
||||
if (!txq->tfds) {
|
||||
IL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz);
|
||||
IL_ERR(il, "pci_alloc_consistent(%zd) failed\n", tfd_sz);
|
||||
goto error;
|
||||
}
|
||||
txq->q.id = id;
|
||||
@ -329,7 +329,7 @@ static int il_tx_queue_alloc(struct il_priv *priv,
|
||||
/**
|
||||
* il_tx_queue_init - Allocate and initialize one tx/cmd queue
|
||||
*/
|
||||
int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq,
|
||||
int il_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq,
|
||||
int slots_num, u32 txq_id)
|
||||
{
|
||||
int i, len;
|
||||
@ -344,7 +344,7 @@ int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq,
|
||||
* For normal Tx queues (all other queues), no super-size command
|
||||
* space is needed.
|
||||
*/
|
||||
if (txq_id == priv->cmd_queue)
|
||||
if (txq_id == il->cmd_queue)
|
||||
actual_slots++;
|
||||
|
||||
txq->meta = kzalloc(sizeof(struct il_cmd_meta) * actual_slots,
|
||||
@ -367,7 +367,7 @@ int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq,
|
||||
}
|
||||
|
||||
/* Alloc driver data array and TFD circular buffer */
|
||||
ret = il_tx_queue_alloc(priv, txq, txq_id);
|
||||
ret = il_tx_queue_alloc(il, txq, txq_id);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
@ -386,11 +386,11 @@ int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq,
|
||||
BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
|
||||
|
||||
/* Initialize queue's high/low-water marks, and head/tail indexes */
|
||||
il_queue_init(priv, &txq->q,
|
||||
il_queue_init(il, &txq->q,
|
||||
TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
|
||||
|
||||
/* Tell device where to find queue */
|
||||
priv->cfg->ops->lib->txq_init(priv, txq);
|
||||
il->cfg->ops->lib->txq_init(il, txq);
|
||||
|
||||
return 0;
|
||||
err:
|
||||
@ -404,12 +404,12 @@ out_free_arrays:
|
||||
}
|
||||
EXPORT_SYMBOL(il_tx_queue_init);
|
||||
|
||||
void il_tx_queue_reset(struct il_priv *priv, struct il_tx_queue *txq,
|
||||
void il_tx_queue_reset(struct il_priv *il, struct il_tx_queue *txq,
|
||||
int slots_num, u32 txq_id)
|
||||
{
|
||||
int actual_slots = slots_num;
|
||||
|
||||
if (txq_id == priv->cmd_queue)
|
||||
if (txq_id == il->cmd_queue)
|
||||
actual_slots++;
|
||||
|
||||
memset(txq->meta, 0, sizeof(struct il_cmd_meta) * actual_slots);
|
||||
@ -417,11 +417,11 @@ void il_tx_queue_reset(struct il_priv *priv, struct il_tx_queue *txq,
|
||||
txq->need_update = 0;
|
||||
|
||||
/* Initialize queue's high/low-water marks, and head/tail indexes */
|
||||
il_queue_init(priv, &txq->q,
|
||||
il_queue_init(il, &txq->q,
|
||||
TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
|
||||
|
||||
/* Tell device where to find queue */
|
||||
priv->cfg->ops->lib->txq_init(priv, txq);
|
||||
il->cfg->ops->lib->txq_init(il, txq);
|
||||
}
|
||||
EXPORT_SYMBOL(il_tx_queue_reset);
|
||||
|
||||
@ -429,16 +429,16 @@ EXPORT_SYMBOL(il_tx_queue_reset);
|
||||
|
||||
/**
|
||||
* il_enqueue_hcmd - enqueue a uCode command
|
||||
* @priv: device private data point
|
||||
* @il: device ilate data point
|
||||
* @cmd: a point to the ucode command structure
|
||||
*
|
||||
* The function returns < 0 values to indicate the operation is
|
||||
* failed. On success, it turns the index (> 0) of command in the
|
||||
* command queue.
|
||||
*/
|
||||
int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)
|
||||
{
|
||||
struct il_tx_queue *txq = &priv->txq[priv->cmd_queue];
|
||||
struct il_tx_queue *txq = &il->txq[il->cmd_queue];
|
||||
struct il_queue *q = &txq->q;
|
||||
struct il_device_cmd *out_cmd;
|
||||
struct il_cmd_meta *out_meta;
|
||||
@ -448,7 +448,7 @@ int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
u32 idx;
|
||||
u16 fix_size;
|
||||
|
||||
cmd->len = priv->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len);
|
||||
cmd->len = il->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len);
|
||||
fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr));
|
||||
|
||||
/* If any of the command structures end up being larger than
|
||||
@ -460,19 +460,19 @@ int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
!(cmd->flags & CMD_SIZE_HUGE));
|
||||
BUG_ON(fix_size > IL_MAX_CMD_SIZE);
|
||||
|
||||
if (il_is_rfkill(priv) || il_is_ctkill(priv)) {
|
||||
IL_WARN(priv, "Not sending command - %s KILL\n",
|
||||
il_is_rfkill(priv) ? "RF" : "CT");
|
||||
if (il_is_rfkill(il) || il_is_ctkill(il)) {
|
||||
IL_WARN(il, "Not sending command - %s KILL\n",
|
||||
il_is_rfkill(il) ? "RF" : "CT");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&priv->hcmd_lock, flags);
|
||||
spin_lock_irqsave(&il->hcmd_lock, flags);
|
||||
|
||||
if (il_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) {
|
||||
spin_unlock_irqrestore(&priv->hcmd_lock, flags);
|
||||
spin_unlock_irqrestore(&il->hcmd_lock, flags);
|
||||
|
||||
IL_ERR(priv, "Restarting adapter due to command queue full\n");
|
||||
queue_work(priv->workqueue, &priv->restart);
|
||||
IL_ERR(il, "Restarting adapter due to command queue full\n");
|
||||
queue_work(il->workqueue, &il->restart);
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
@ -481,7 +481,7 @@ int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
out_meta = &txq->meta[idx];
|
||||
|
||||
if (WARN_ON(out_meta->flags & CMD_MAPPED)) {
|
||||
spin_unlock_irqrestore(&priv->hcmd_lock, flags);
|
||||
spin_unlock_irqrestore(&il->hcmd_lock, flags);
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
@ -499,7 +499,7 @@ int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
* information */
|
||||
|
||||
out_cmd->hdr.flags = 0;
|
||||
out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(priv->cmd_queue) |
|
||||
out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(il->cmd_queue) |
|
||||
INDEX_TO_SEQ(q->write_ptr));
|
||||
if (cmd->flags & CMD_SIZE_HUGE)
|
||||
out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
|
||||
@ -511,43 +511,43 @@ int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
switch (out_cmd->hdr.cmd) {
|
||||
case REPLY_TX_LINK_QUALITY_CMD:
|
||||
case SENSITIVITY_CMD:
|
||||
IL_DEBUG_HC_DUMP(priv,
|
||||
IL_DEBUG_HC_DUMP(il,
|
||||
"Sending command %s (#%x), seq: 0x%04X, "
|
||||
"%d bytes at %d[%d]:%d\n",
|
||||
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);
|
||||
q->write_ptr, idx, il->cmd_queue);
|
||||
break;
|
||||
default:
|
||||
IL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, "
|
||||
IL_DEBUG_HC(il, "Sending command %s (#%x), seq: 0x%04X, "
|
||||
"%d bytes at %d[%d]:%d\n",
|
||||
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);
|
||||
q->write_ptr, idx, il->cmd_queue);
|
||||
}
|
||||
#endif
|
||||
txq->need_update = 1;
|
||||
|
||||
if (priv->cfg->ops->lib->txq_update_byte_cnt_tbl)
|
||||
if (il->cfg->ops->lib->txq_update_byte_cnt_tbl)
|
||||
/* Set up entry in queue's byte count circular buffer */
|
||||
priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, 0);
|
||||
il->cfg->ops->lib->txq_update_byte_cnt_tbl(il, txq, 0);
|
||||
|
||||
phys_addr = pci_map_single(priv->pci_dev, &out_cmd->hdr,
|
||||
phys_addr = pci_map_single(il->pci_dev, &out_cmd->hdr,
|
||||
fix_size, PCI_DMA_BIDIRECTIONAL);
|
||||
dma_unmap_addr_set(out_meta, mapping, phys_addr);
|
||||
dma_unmap_len_set(out_meta, len, fix_size);
|
||||
|
||||
priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
|
||||
il->cfg->ops->lib->txq_attach_buf_to_tfd(il, txq,
|
||||
phys_addr, fix_size, 1,
|
||||
U32_PAD(cmd->len));
|
||||
|
||||
/* Increment and update queue's write index */
|
||||
q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd);
|
||||
il_txq_update_write_ptr(priv, txq);
|
||||
il_txq_update_write_ptr(il, txq);
|
||||
|
||||
spin_unlock_irqrestore(&priv->hcmd_lock, flags);
|
||||
spin_unlock_irqrestore(&il->hcmd_lock, flags);
|
||||
return idx;
|
||||
}
|
||||
|
||||
@ -558,15 +558,15 @@ int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd)
|
||||
* 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 il_hcmd_queue_reclaim(struct il_priv *priv, int txq_id,
|
||||
static void il_hcmd_queue_reclaim(struct il_priv *il, int txq_id,
|
||||
int idx, int cmd_idx)
|
||||
{
|
||||
struct il_tx_queue *txq = &priv->txq[txq_id];
|
||||
struct il_tx_queue *txq = &il->txq[txq_id];
|
||||
struct il_queue *q = &txq->q;
|
||||
int nfreed = 0;
|
||||
|
||||
if ((idx >= q->n_bd) || (il_queue_used(q, idx) == 0)) {
|
||||
IL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, "
|
||||
IL_ERR(il, "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;
|
||||
@ -576,9 +576,9 @@ static void il_hcmd_queue_reclaim(struct il_priv *priv, int txq_id,
|
||||
q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) {
|
||||
|
||||
if (nfreed++ > 0) {
|
||||
IL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", idx,
|
||||
IL_ERR(il, "HCMD skipped: index (%d) %d %d\n", idx,
|
||||
q->write_ptr, q->read_ptr);
|
||||
queue_work(priv->workqueue, &priv->restart);
|
||||
queue_work(il->workqueue, &il->restart);
|
||||
}
|
||||
|
||||
}
|
||||
@ -593,7 +593,7 @@ static void il_hcmd_queue_reclaim(struct il_priv *priv, int txq_id,
|
||||
* if the callback returns 1
|
||||
*/
|
||||
void
|
||||
il_tx_cmd_complete(struct il_priv *priv, struct il_rx_mem_buffer *rxb)
|
||||
il_tx_cmd_complete(struct il_priv *il, struct il_rx_mem_buffer *rxb)
|
||||
{
|
||||
struct il_rx_packet *pkt = rxb_addr(rxb);
|
||||
u16 sequence = le16_to_cpu(pkt->hdr.sequence);
|
||||
@ -603,18 +603,18 @@ il_tx_cmd_complete(struct il_priv *priv, struct il_rx_mem_buffer *rxb)
|
||||
bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME);
|
||||
struct il_device_cmd *cmd;
|
||||
struct il_cmd_meta *meta;
|
||||
struct il_tx_queue *txq = &priv->txq[priv->cmd_queue];
|
||||
struct il_tx_queue *txq = &il->txq[il->cmd_queue];
|
||||
unsigned long flags;
|
||||
|
||||
/* If a Tx command is being handled and it isn't in the actual
|
||||
* command queue then there a command routing bug has been introduced
|
||||
* in the queue management code. */
|
||||
if (WARN(txq_id != priv->cmd_queue,
|
||||
if (WARN(txq_id != il->cmd_queue,
|
||||
"wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n",
|
||||
txq_id, priv->cmd_queue, sequence,
|
||||
priv->txq[priv->cmd_queue].q.read_ptr,
|
||||
priv->txq[priv->cmd_queue].q.write_ptr)) {
|
||||
il_print_hex_error(priv, pkt, 32);
|
||||
txq_id, il->cmd_queue, sequence,
|
||||
il->txq[il->cmd_queue].q.read_ptr,
|
||||
il->txq[il->cmd_queue].q.write_ptr)) {
|
||||
il_print_hex_error(il, pkt, 32);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -624,7 +624,7 @@ il_tx_cmd_complete(struct il_priv *priv, struct il_rx_mem_buffer *rxb)
|
||||
|
||||
txq->time_stamp = jiffies;
|
||||
|
||||
pci_unmap_single(priv->pci_dev,
|
||||
pci_unmap_single(il->pci_dev,
|
||||
dma_unmap_addr(meta, mapping),
|
||||
dma_unmap_len(meta, len),
|
||||
PCI_DMA_BIDIRECTIONAL);
|
||||
@ -634,22 +634,22 @@ il_tx_cmd_complete(struct il_priv *priv, struct il_rx_mem_buffer *rxb)
|
||||
meta->source->reply_page = (unsigned long)rxb_addr(rxb);
|
||||
rxb->page = NULL;
|
||||
} else if (meta->callback)
|
||||
meta->callback(priv, cmd, pkt);
|
||||
meta->callback(il, cmd, pkt);
|
||||
|
||||
spin_lock_irqsave(&priv->hcmd_lock, flags);
|
||||
spin_lock_irqsave(&il->hcmd_lock, flags);
|
||||
|
||||
il_hcmd_queue_reclaim(priv, txq_id, index, cmd_index);
|
||||
il_hcmd_queue_reclaim(il, txq_id, index, cmd_index);
|
||||
|
||||
if (!(meta->flags & CMD_ASYNC)) {
|
||||
clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
|
||||
IL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s\n",
|
||||
clear_bit(STATUS_HCMD_ACTIVE, &il->status);
|
||||
IL_DEBUG_INFO(il, "Clearing HCMD_ACTIVE for command %s\n",
|
||||
il_get_cmd_string(cmd->hdr.cmd));
|
||||
wake_up(&priv->wait_command_queue);
|
||||
wake_up(&il->wait_command_queue);
|
||||
}
|
||||
|
||||
/* Mark as unmapped */
|
||||
meta->flags = 0;
|
||||
|
||||
spin_unlock_irqrestore(&priv->hcmd_lock, flags);
|
||||
spin_unlock_irqrestore(&il->hcmd_lock, flags);
|
||||
}
|
||||
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
Loading…
Reference in New Issue
Block a user